Hello,
I'm playing .mov files in a Ogre Code (a 3D Rendering Engine) like that: http://www.ogre3d.org/tikiwiki/Using+GStreamer+with+Ogre I need to know when the video has reached its final (stopped playing) and need to rewind it to play periodically. I have no idea how I know when the video stopped playing, I tried to rewind it doing: gst_element_set_state(GST_ELEMENT(mPlayer), GST_STATE_NULL); gst_element_set_state(GST_ELEMENT(mPlayer), GST_STATE_PLAYING); But it does not work. How should I do it? Thanks. -- Marlos Cholodovskis Machado ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Hi Marlos,
You should have a bus callback as described here: http://www.gstreamer.net/data/doc/gstreamer/head/manual/html/chapter-bus.html#section-bus-howto that will catch EOS messages, which are emitted when your stream is done playback. Upon getting this message, you need to call gst_element_seek on your playbin element with a seek position of 0, which will tell it to restart. I posted a simple example here: http://tristanswork.blogspot.com/2010/10/looping-playback-with-gstreamer.html -t -- Tristan Matthews email: [hidden email] web: http://tristanswork.blogspot.com ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Thanks for answering, but it is not working in my app.
The bus that catches EOS messages is never called, I mean, even when the video is over I do not know since the function is not invoked. Have this ever happened to you? The code I'm using is in the link I posted. Anyway, thanks for answering and providing an example. 2010/10/27 Tristan Matthews <[hidden email]> Hi Marlos, -- Marlos Cholodovskis Machado ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
I've tried to seek the video out of the callback function and it fails, why?
2010/10/27 Marlos C. Machado <[hidden email]> Thanks for answering, but it is not working in my app. -- Marlos Cholodovskis Machado ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Wed, Oct 27, 2010 at 6:17 PM, Marlos C. Machado <[hidden email]> wrote: I've tried to seek the video out of the callback function and it fails, why? That is hard to guess. Maybe you should provide a snippet of your code to make it easier to identify the problem.
-- Thiago Sousa Santos ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
I didnt do that because I posted the url where it is...
The whole code is attached. 2010/10/28 [hidden email] <[hidden email]>
-- Marlos Cholodovskis Machado ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel ogre.cpp (22K) Download Attachment |
On Thu, Oct 28, 2010 at 9:59 PM, Marlos C. Machado <[hidden email]> wrote: I didnt do that because I posted the url where it is... Are you getting the EOS message? I don't see any mainloop or code popping message from the bus on this sample (unless it is done on the superclass).
-- Thiago Sousa Santos ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
The main loop is in myApp.go, its a superclass.
On the create scene, before the main loop I call: gst_bus_add_watch(bus, onBusMessage, getUserData(mPlayer)); 2010/10/28 [hidden email] <[hidden email]>
-- Marlos Cholodovskis Machado ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Thu, Oct 28, 2010 at 10:32 PM, Marlos C. Machado <[hidden email]> wrote: The main loop is in myApp.go, its a superclass. Ok, if you're getting the EOS on the bus and sets the pipeline to NULL, the video will stop. It seems that it should restart if the user presses space from the code. Is that failing? To restart the video, simply use gst_element_seek_simple when getting EOS: http://www.gstreamer.net/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-seek-simple
-- Thiago Sousa Santos ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
I changed this code to restart the video, this is not a problem, the biggest problem is that onBusMessage is never called, it never enter in onBusMessage.
2010/10/28 [hidden email] <[hidden email]>
-- Marlos Cholodovskis Machado ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Thu, Oct 28, 2010 at 10:52 PM, Marlos C. Machado <[hidden email]> wrote: I changed this code to restart the video, this is not a problem, the biggest problem is that onBusMessage is never called, it never enter in onBusMessage. You need to poll the bus somehow for new messages. Check the docs at: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-bus.html
-- Thiago Sousa Santos ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Marlos C. Machado
You could use a thread were you can extract your current time of the stream, also extract total duration. The when total duration - current position is zero or negative, you can rewind to the start by using seeking function (gst_element). This way you can simulate the repeat mode that most players have. Or listen to the bus calls and when EOS reached, do what ever you want.
Hope that helps. Cristian. |
Free forum by Nabble | Edit this page |