<div id=":111" class="ii gt"><div id=":10m">Hi,<br>
<br>
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....).<br>
<br>
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?<br>
<br>
1 - I have succesfully tested the pipeline with cmd line,<br>
2 - I defined the GstAppSrc's caps... but still not sure... The stream is a mpeg2 video with mepgTS container.<br>
3 - Is it an incompatible format pixel....?<br>4 - It works with a raw format and the simple pipeline : <br> appsrc -> autovideosink<br>
_________________________________________<br>
<br>
Here is part of my code :<br>
<br>
GMainLoop *loop;<br>
GstBus *bus;<br>
<br>
GstElement *pipeline, *appsrc, *demuxer, *decoder, *postprocess, *videosink;<br>
loop = g_main_loop_new (NULL, FALSE);<br>
<br>
/* Create gstreamer elements */<br>
pipeline = gst_pipeline_new ("pipeline");<br>
appsrc = gst_element_factory_make ("appsrc", "app-src");<br>
decoder = gst_element_factory_make ("vdpaumpegdec", "vdpau-decoder");<br>
demuxer = gst_element_factory_make ("mpegtsdemux", "mpeg-demux");<br>
postprocess = gst_element_factory_make ("vdpauvideopostprocess", "vdpau-video-post-process");<br>
videosink = gst_element_factory_make ("vdpausink", "vdpau-sink");<br>
<br>
/* set the capabilities of the appsrc element */<br>
GstCaps *caps = gst_caps_new_simple ("video/mpeg",<br>
"width", G_TYPE_INT, 720,<br>
"height", G_TYPE_INT, 576,<br>
"framerate", GST_TYPE_FRACTION, 25, 1,<br>
"bpp", G_TYPE_INT, 16,<br>
"depth", G_TYPE_INT, 16,<br>
"endianness", G_TYPE_INT, G_BYTE_ORDER,<br>
NULL);<br>
<br>
gst_app_src_set_caps(GST_APP_SRC(appsrc), caps);<br>
<br>
/* we add all elements into the pipeline */<br>
/* we link the elements together */<br>
gst_element_link (appsrc, demuxer);<br>
gst_element_link_many (decoder, postprocess, videosink, NULL);<br>
g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added), decoder);<br>
<br>
/* play */<br>
gst_element_set_state (pipeline, GST_STATE_PLAYING);<br>
<br>
/* create the buffer */<br>
GstBuffer *buffer = gst_buffer_new();<br>
GST_BUFFER_DATA (buffer) = _avPacket.data; // Data from the original buffer<br>
GST_BUFFER_SIZE (buffer) = _avPacket.size; // Size of the original buffer<br>
printf("BUFFER_SIZE = %d \n", _avPacket.size);<br>
<br>
/* push the buffer to pipeline via appsrc */<br>
GstFlowReturn gstFlowReturn = gst_app_src_push_buffer(GST_APP_SRC(appsrc), buffer);<br>
<br>
/* and loop... */<br>
g_main_loop_run (loop);<br>
<br>
/* clean up */<br>
gst_element_set_state (pipeline, GST_STATE_NULL);<br>
gst_object_unref (GST_OBJECT (pipeline));<br>
<br>
________________________________________________<br>
<br>
Thanks for your help!<br>
</div></div>