Implementing a media player using Gstreamer: Mapping the STOPPED state

Federico Zamperini fzamperini at
Tue Dec 4 05:03:13 PST 2012

	when I want to stop a pipeline I set it to the NULL state (see 
When you go to the NULL state the pipeline is flushed and all the 
resources are freed, so next time you start the pipeline (moving it to 
the PLAYING state) you don't need to seek back to the beginning of the 


Il 04/12/2012 12:30, Mandeep Sandhu ha scritto:
> Hi All,
> I'm implementing a media player on an embedded board. I'm using
> Gstreamer for the actual media playback (the chip vendor provides us
> with some proprietary plugins for H264/AAC decoding and audio/video
> sinks for the specific hardware).
> Currently I'm concentrating on just playing MP4/H264/AAC files (other
> formats will be supported later when I figure out how to do
> auto-detection! :))
> My gst pipeline essentially looks like this:
> file-source -> qtdemux -> h264dec -> vsink
>                          |
>                          +-----> aacdec -> asink
> So, I have most of the bits worked out, except what state to set on
> the pipeline when I'm in the STOPPED state of my player (eg: a user
> pressed the STOP button on the player or the stream ended (EOS)).
> Initially I thought setting the pipeline to READY state would do it
> but that turned out to be wrong. Reading docs on GST_MESSAGE_EOS
> revealed that the EOS event is retained in the elements and has to be
> flushed explicitly.
> I have the state of my player being tracked by state machine, so the
> SM transitions to the STOPPED state on either an explicit command (by
> the user) or when the EOS message appears on the pipeline's bus.
> So I wrote some code to flush the pipeline and then set it to the
> PAUSED state (since I don't want playback to start automatically).
> Here's what I do when going into the STOPPED state:
> gst_element_seek(m_pipeline, 1.0, GST_FORMAT_TIME,
>                       GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET,
>                       0, GST_SEEK_TYPE_NONE,  0);
> gst_element_set_state (m_pipeline, GST_STATE_PAUSED);
> Is this correct way to handle the scenario described or is there a
> better/recommended way of going about it?
> I basically want the stream playback position to be set to the start
> so that a play command will cause it to play the file from the
> beginning.
> Any pointers appreciated.
> Thanks,
> -mandeep
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at
> -----
> Nessun virus nel messaggio.
> Controllato da AVG -
> Versione: 2013.0.2793 / Database dei virus: 2629/5906 -  Data di rilascio: 19/11/2012
> Database dei virus interno non c aggiornato.

More information about the gstreamer-devel mailing list