Use of gstAppSrc and VDPAU treatment...

Jérémy Lauraire jeremy.lauraire at gmail.com
Mon Jul 4 08:14:15 PDT 2011


Hi,

I am facing difficulties with the use of gstAppSrc : my idea is to feed the
pipeline with buffer that I have already treated from a streaming flow (data
are in an avpacket => avPacket.data and avPacket.size....).

I've try to follow API explanations and examples to implement my application
but i still have a green display...  What am I doing wrong?

1 - I have succesfully tested the pipeline with cmd line,
2 - I defined the GstAppSrc's caps... but still not sure... The stream is a
mpeg2 video with mepgTS container.
3 - Is it an incompatible format pixel....?
4 - It works with a raw format and the simple pipeline :
         appsrc -> autovideosink
_________________________________________

Here is part of my code :

      GMainLoop *loop;
      GstBus *bus;

      GstElement *pipeline, *appsrc, *demuxer, *decoder, *postprocess,
*videosink;
      loop = g_main_loop_new (NULL, FALSE);

      /* Create gstreamer elements */
      pipeline    = gst_pipeline_new ("pipeline");
      appsrc      = gst_element_factory_make ("appsrc", "app-src");
      decoder     = gst_element_factory_make ("vdpaumpegdec",
"vdpau-decoder");
      demuxer     = gst_element_factory_make ("mpegtsdemux", "mpeg-demux");
      postprocess = gst_element_factory_make ("vdpauvideopostprocess",
"vdpau-video-post-process");
      videosink   = gst_element_factory_make ("vdpausink", "vdpau-sink");

      /* set the capabilities of the appsrc element */
      GstCaps *caps = gst_caps_new_simple ("video/mpeg",
                              "width", G_TYPE_INT, 720,
                              "height", G_TYPE_INT, 576,
                              "framerate", GST_TYPE_FRACTION, 25, 1,
                              "bpp", G_TYPE_INT, 16,
                              "depth", G_TYPE_INT, 16,
                              "endianness", G_TYPE_INT, G_BYTE_ORDER,
                              NULL);

      gst_app_src_set_caps(GST_APP_SRC(appsrc), caps);

      /* we add all elements into the pipeline */
      /* we link the elements together */
      gst_element_link (appsrc, demuxer);
      gst_element_link_many (decoder, postprocess, videosink, NULL);
      g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added),
decoder);

      /* play */
      gst_element_set_state (pipeline, GST_STATE_PLAYING);

      /* create the buffer */
      GstBuffer *buffer = gst_buffer_new();
      GST_BUFFER_DATA (buffer) = _avPacket.data; // Data from the original
buffer
      GST_BUFFER_SIZE (buffer) = _avPacket.size; // Size of the original
       buffer
      printf("BUFFER_SIZE = %d \n", _avPacket.size);

      /* push the buffer to pipeline via appsrc */
      GstFlowReturn gstFlowReturn =
gst_app_src_push_buffer(GST_APP_SRC(appsrc), buffer);

      /* and loop... */
      g_main_loop_run (loop);

      /* clean up */
      gst_element_set_state (pipeline, GST_STATE_NULL);
      gst_object_unref (GST_OBJECT (pipeline));

________________________________________________

Thanks for your help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110704/e01bd07a/attachment.html>


More information about the gstreamer-devel mailing list