[gst-devel] problem playing video file with this sample code

sanjay kumar gupta sanjay417 at rediffmail.com
Wed Dec 20 14:22:05 CET 2006


Hi all,
 I have written the simple code for playing audio/video files using decodebin.
Idea of creating the pipeline is as follows:
/-----------------------
1. created the elements filesrc and decodebin. Added & Linked these elements to pipeline and subscribed for callback cb_newpad() with decodebin element.
2. created the elements audioconvert and alsasink and added these elements to audio bin with ghostpad. (this audio bin is not yet added in the pipeline)
3. created the element xvimagesink and added this element to video bin with ghostpad. (this video bin is not yet added in the pipeline)
4. Now setting the pipeline (with partial elements in step 1) to running state.
4. When getting callback cb_newpad() for pad with mime type "audio/*" then adding the audio bin to pipeline, linking the ghostpad of audio bin with this new pad.
 Once it is added and linked in pipeline, I am synchronizing the state of audio bin with pipeline state using following function:
 gst_element_sync_state_with_parent (audiobin);
4. When getting callback cb_newpad() for pad for mime type "video/*" then adding the video bin to pipeline, linking the ghostpad of video bin with this new pad.
 Once it is added and linked in pipeline, I am synchronizing the state of video bin with pipeline (parent of video bin) state using following function:
 gst_element_sync_state_with_parent (videobin);
/------------------------------

When  I am trying to play audio file (only audio stream) or video file without audio (only video stream) then this code is perfectly working.
but facing problem when file contain both audio and video stream.
It sometime plays perfectly but sometime I am getting EOS (end of stream) notification immediately.
what is the reason for this behavior.
I tried to use the following pipeline from command line. it always worked fine:
$gst-launch-0.10 filesrc location=soccer.avi ! decodebin name="decodebin" decodebin.! xvimagesink decodebin.! audioconvert ! alsasink 
Code is attached in this mail.
Can someone please point out where could be the problem & please suggest the necessary changes needed?
Any help would be appreciated. 
Thanks in advance.

Regards,
Sanjay

*********************************
  Sanjay Kumar Gupta
  Motorola India Elecronics Ltd.,
  "TSR Towers",H.No. 6-3-1090,
  Somajiguda, Raj Bhavan Road,
  Hyderabad-500082.
  Email: sanjayg at motorola.com
*********************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20061220/1e4bbc81/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmp.c
Type: text/x-csrc
Size: 4592 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20061220/1e4bbc81/attachment.c>


More information about the gstreamer-devel mailing list