[gst-embedded] How to use dfbvideosink

Jesse Bonzo Jesse at spectronix.com
Wed Dec 29 17:08:47 PST 2010


I am having some problems getting the dfbvideosink to play a video file. I
was able to use the example provided and play from the test video source.
After some searching I decided to try the playbin but I don't get any video
from that. How should I set up the pipeline? Here is what I have so far

 

 

#include <directfb.h>

#include <gst/gst.h>

 

static IDirectFB *dfb = NULL;

static IDirectFBSurface *primary = NULL;

static GMainLoop *loop;

 

#define DFBCHECK(x...)                                         \

  {                                                            \

    DFBResult err = x;                                         \

                                                               \

    if (err != DFB_OK)                                         \

      {                                                        \

        fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \

        DirectFBErrorFatal( #x, err );                         \

      }                                                        \

  }

 

static gboolean

get_me_out (gpointer data)

{

  g_main_loop_quit (loop);

  return FALSE;

}

 

int

main (int argc, char *argv[])

{

  DFBSurfaceDescription dsc;

  GstElement *pipeline, *sink;

 

  /* Init both GStreamer and DirectFB */

  DFBCHECK (DirectFBInit (&argc, &argv));

  gst_init (&argc, &argv);

 

  /* Creates DirectFB main context and set it to fullscreen layout */

  DFBCHECK (DirectFBCreate (&dfb));

  DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));

 

  /* We want a double buffered primary surface */

  dsc.flags = DSDESC_CAPS;

  dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;

 

  DFBCHECK (dfb->CreateSurface (dfb, &dsc, &primary));

 

  /* Creating our pipeline : videotestsrc ! dfbvideosink */

  pipeline = gst_element_factory_make("playbin", NULL); //gst_pipeline_new
(NULL);

  g_assert (pipeline);

 

  sink = gst_element_factory_make ("dfbvideosink", NULL);

  g_assert (sink);

  /* That's the interesting part, giving the primary surface to dfbvideosink
*/

  g_object_set (sink, "surface", primary, NULL);

 

  g_object_set(pipeline, "uri", "file:///root/test.mp4", NULL);

  g_object_set(pipeline, "video-sink", sink, NULL);

 

  /* Let's play ! */

  gst_element_set_state (pipeline, GST_STATE_PLAYING);

 

  /* we need to run a GLib main loop to get out of here */

  loop = g_main_loop_new (NULL, FALSE);

  /* Get us out after 20 seconds */

  g_timeout_add (20000, get_me_out, NULL);

  g_main_loop_run (loop);

 

  /* Release elements and stop playback */

  gst_element_set_state (pipeline, GST_STATE_NULL);

 

  /* Free the main loop */

  g_main_loop_unref (loop);

 

  /* Release DirectFB context and surface */

  primary->Release (primary);

  dfb->Release (dfb);

 

  return 0;

}

 

The result is a brown screen (the default directfb color I think).

 

Thanks for your help

-Jesse

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-embedded/attachments/20101229/04292468/attachment.htm>


More information about the Gstreamer-embedded mailing list