Hi,<br><br>I am developing live video streaming application. As application receives live video streaming buffer periodically from other layers. As first step I started reading the data from the avi file(format:video/x-msvideo) and passed the same to gstbuffer .Caps has been set to the buffer before pushing the data to be played.<br>
<br>However the caps that is set is not successfully playing the video. Below is the snippet of the code.As of now I have constructed the pipeline only for the video part.<br><br> Kindly let me know the additions required to play audio,video successfully.<br>
<br>[pipeline code]<br><br> app->src = (GstAppSrc*)gst_element_factory_make("appsrc", "mysrc");<br> app->decoder = gst_element_factory_make("decodebin", "mydecoder");<br>
app->ffmpeg = gst_element_factory_make("ffmpegcolorspace", "myffmpeg");<br> app->xvimagesink = gst_element_factory_make("xvimagesink", "myvsink");<br><br>[/pipeline code]<br>
<br>[callback for signal "pad-added" for the decoder element]<br><br>static void on_pad_added(GstElement *element, GstPad *pad)<br>{<br> GstCaps *caps;<br> GstStructure *str;<br> gchar *name;<br> GstPad *ffmpegsink;<br>
GstPadLinkReturn ret;<br><br> g_debug("pad added");<br><br> caps = gst_pad_get_caps(pad);<br> str = gst_caps_get_structure(caps, 0);<br> g_assert(str);<br> name = (gchar*)gst_structure_get_name(str);<br>
g_debug("pad name %s", name);<br> if(g_strrstr(name, "video")){<br><br> ffmpegsink = gst_element_get_pad(gst_app.ffmpeg, "sink");<br> g_assert(ffmpegsink);<br> ret = gst_pad_link(pad, ffmpegsink);<br>
g_debug("pad_link returned %d\n", ret);<br> gst_object_unref(ffmpegsink);<br> }<br> gst_caps_unref(caps);<br>}<br>[/callback for signal "pad-added" for the decoder element]<br><br>
[caps set for appsrc element]<br><br>caps = gst_caps_new_simple ("video/x-xvid",<br> "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),<br> "framerate", GST_TYPE_FRACTION, 25, 1,<br>
"pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,<br> "width", G_TYPE_INT, 704,<br> "height", G_TYPE_INT, 400,<br> NULL);<br><br> gst_app_src_set_caps(GST_APP_SRC(app->src), caps);<br>
<br>[/caps set for appsrc element]<br><br>If the caps set as "video/x-msvideo" then the error encountered is "Error The stream is of a different type than handled by this element" and if the caps set as "video/x-xvid" error encountered is "*** glibc detected *** ./video: double free or corruption (!prev): 0x08192f68 ***"<br>
<br>[Buffer fed to appsrc]<br><br>bytes_read = fread(data, 1, BUFF_SIZE, fp); //Reading data from avi file pointer.<br>bytetotal += bytes_read;<br><br>buffer= gst_buffer_new(); <br>GST_BUFFER_MALLOCDATA(buffer) = data;<br>
GST_BUFFER_SIZE(buffer)=bytes_read;<br>GST_BUFFER_DATA(buffer) = GST_BUFFER_MALLOCDATA(buffer);<br><br>gst_app_src_push_buffer(app->src, buffer);<br><br>[/Buffer fed to appsrc]<br><br><br>Thanks and Regards,<br>Sree<br>