I need some help figuring out seeking. I've been writing a small
command-line player to learn GStreamer programming, and have hit a total wall trying to figure out seeking. I'm setting up a pipeline as follows: filesrc -> decodebin -> audioconvert -> audioresample -> alsasink It plays files just fine. But then I add the following after the pipeline is set up: gst_element_set_state(pipeline, GST_STATE_PAUSED); if (!gst_element_seek_simple(pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, 3e10)) { g_printerr("simple seek failed\n"); } gst_element_set_state(pipeline, GST_STATE_PLAYING); The seek fails and the file starts playing from the beginning. I've tried all permutations of seek flags, I've tried the more advanced gst_element_seek, and nothing I've tried has worked. I'm attaching my full source code. Could someone please give me a hand here? Thanks. -- Soren Harward ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel gst-play.c (4K) Download Attachment |
I need some help figuring out seeking. I've been writing a small
command-line player to learn GStreamer programming, and have hit a total wall trying to figure out seeking. I'm setting up a pipeline as follows: filesrc -> decodebin -> audioconvert -> audioresample -> alsasink It plays files just fine. But then I add the following after the pipeline is set up: gst_element_set_state(pipeline, GST_STATE_PAUSED); if (!gst_element_seek_simple(pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, 3e10)) { g_printerr("simple seek failed\n"); } gst_element_set_state(pipeline, GST_STATE_PLAYING); The seek fails and the file starts playing from the beginning. I've tried all permutations of seek flags, I've tried the more advanced gst_element_seek, and nothing I've tried has worked. I'm attaching my full source code. Could someone please give me a hand here? Thanks. -- Soren Harward ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel gst-play.c (4K) Download Attachment |
Hi,
On Sat, 2008-08-16 at 01:47 -0400, Soren Harward wrote: > I need some help figuring out seeking. I've been writing a small > command-line player to learn GStreamer programming, and have hit a > total wall trying to figure out seeking. I'm setting up a pipeline as > follows: > > filesrc -> decodebin -> audioconvert -> audioresample -> alsasink > > It plays files just fine. But then I add the following after the > pipeline is set up: > > gst_element_set_state(pipeline, GST_STATE_PAUSED); You are not waiting for the confirmation that your pipeline has properly pre-rolled (reached the PAUSED state). Simply put, Seeks can only work when the pipeline is either in the PAUSED or PLAYING state. You should wait for the GST_MESSAGE_STATE_CHANGED message on the bus from the pipeline stating it has successfully changed state to PAUSED before sending that seek. > if (!gst_element_seek_simple(pipeline, GST_FORMAT_TIME, > GST_SEEK_FLAG_FLUSH, 3e10)) { > g_printerr("simple seek failed\n"); > } > gst_element_set_state(pipeline, GST_STATE_PLAYING); > > The seek fails and the file starts playing from the beginning. I've > tried all permutations of seek flags, I've tried the more advanced > gst_element_seek, and nothing I've tried has worked. I'm attaching my > full source code. Could someone please give me a hand here? Thanks. > > -- > Soren Harward > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel Edward Hervey <[hidden email]> Collabora Multimedia ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Saturday 16 August 2008 4:13:30 Edward Hervey wrote:
> You are not waiting for the confirmation that your pipeline has > properly pre-rolled (reached the PAUSED state). Simply put, Seeks can > only work when the pipeline is either in the PAUSED or PLAYING state. > > You should wait for the GST_MESSAGE_STATE_CHANGED message on the bus > from the pipeline stating it has successfully changed state to PAUSED > before sending that seek. Thanks. Adding an event loop which calls gst_element_get_state and waits for it to return GST_STATE_PAUSED also seems to work. Is one way better than the other? -- Soren Harward [hidden email] ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Administrator
|
Hi,
On Sat, 2008-08-16 at 08:14 -0400, Soren Harward wrote: > On Saturday 16 August 2008 4:13:30 Edward Hervey wrote: > > You are not waiting for the confirmation that your pipeline has > > properly pre-rolled (reached the PAUSED state). Simply put, Seeks can > > only work when the pipeline is either in the PAUSED or PLAYING state. > > > > You should wait for the GST_MESSAGE_STATE_CHANGED message on the bus > > from the pipeline stating it has successfully changed state to PAUSED > > before sending that seek. > > Thanks. Adding an event loop which calls gst_element_get_state and waits for > it to return GST_STATE_PAUSED also seems to work. Is one way better than the > other? > You just run the risk that if an error is emitted in that state transition... it will hang (until the timeout you specified...). GStreamer is designed to be used asynchronously (send instructions and receive feedback either via signals, or mainly via bus messages). You can simulate that asynchronous behaviour by creating a state machine around you bus polling (when you see a certain message, do a certain action, when you see an EOS/ERROR you exit, etc...). Edward ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |