Hi,
I'm coding a transcoding application (not using encodebin). Upto now I had been using following code to get time for which the pipeline has been in Playing state (To show user information like xx minutes/seconds the operation has run for or to calcutate averate speed and estimate remaining time etc.): - GstClockTime elapsedTime = GST_CLOCK_TIME_NONE; GstClock *clock = gst_element_get_clock(m_pPipeline); if(clock) elapsedTime = (gst_clock_get_time(clock) - gst_element_get_base_time(m_pPipeline)) / GST_SECOND; Pipeline is like this: - gst_bin_add_many(GST_BIN(m_pPipeline), source, queue, audioConvert, audioEncoder, container, sink, NULL); But then I added code to allow pausing the operation like this: - gst_element_set_state(m_pPipeline, GST_STATE_PAUSED); Now pipeline is paused but the clock is not. It is running always. What should I do achieve my target? Regards, Yogesh Marwaha http://sparklemedia.sourceforge.net/ _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
On Sun, Feb 20, 2011 at 4:46 PM, Yogesh Marwaha <[hidden email]> wrote: > Hi, > > I'm coding a transcoding application (not using encodebin). > > Upto now I had been using following code to get time for which the pipeline > has been in Playing state (To show user information like xx minutes/seconds > the operation has run for or to calcutate averate speed and estimate remaining > time etc.): - > GstClockTime elapsedTime = GST_CLOCK_TIME_NONE; > GstClock *clock = gst_element_get_clock(m_pPipeline); > if(clock) > elapsedTime = (gst_clock_get_time(clock) - > gst_element_get_base_time(m_pPipeline)) / GST_SECOND; > > Pipeline is like this: - > gst_bin_add_many(GST_BIN(m_pPipeline), source, queue, audioConvert, > audioEncoder, container, sink, NULL); > > But then I added code to allow pausing the operation like this: - > gst_element_set_state(m_pPipeline, GST_STATE_PAUSED); > > Now pipeline is paused but the clock is not. It is running always. > > What should I do achieve my target? You should read this: http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-synchronisation.txt and, of course, use the running time instead of the absolute time. By heart, it should be something like: gst_clock_get_time(gst_element_get_clock(...)) - gst_element_get_base_time (...) Regards > > Regards, > > Yogesh Marwaha > http://sparklemedia.sourceforge.net/ > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
On Sun, Feb 20, 2011 at 6:31 PM, Marco Ballesio <[hidden email]> wrote: > Hi, > > On Sun, Feb 20, 2011 at 4:46 PM, Yogesh Marwaha <[hidden email]> wrote: >> Hi, >> >> I'm coding a transcoding application (not using encodebin). >> >> Upto now I had been using following code to get time for which the pipeline >> has been in Playing state (To show user information like xx minutes/seconds >> the operation has run for or to calcutate averate speed and estimate remaining >> time etc.): - >> GstClockTime elapsedTime = GST_CLOCK_TIME_NONE; >> GstClock *clock = gst_element_get_clock(m_pPipeline); >> if(clock) >> elapsedTime = (gst_clock_get_time(clock) - >> gst_element_get_base_time(m_pPipeline)) / GST_SECOND; >> >> Pipeline is like this: - >> gst_bin_add_many(GST_BIN(m_pPipeline), source, queue, audioConvert, >> audioEncoder, container, sink, NULL); >> >> But then I added code to allow pausing the operation like this: - >> gst_element_set_state(m_pPipeline, GST_STATE_PAUSED); >> >> Now pipeline is paused but the clock is not. It is running always. >> >> What should I do achieve my target? > > You should read this: > > http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-synchronisation.txt > > and, of course, use the running time instead of the absolute time. By > heart, it should be something like: > > gst_clock_get_time(gst_element_get_clock(...)) - gst_element_get_base_time (...) Just to clarify my previous comment, it is just a stub. The proper usage involves unreffing the clock as well. Something like the following sounds more appropriate: ... GstClock *clock = gst_element_get_clock (elem); if (clock) { running_time = (clock) - gst_element_get_base_time (elem) gst_object_unref (clock); } ... > > Regards > >> >> Regards, >> >> Yogesh Marwaha >> http://sparklemedia.sourceforge.net/ >> _______________________________________________ >> gstreamer-devel mailing list >> [hidden email] >> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel >> > gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Marco Ballesio
On Sunday 20 Feb 2011 22:01:21 Marco Ballesio wrote:
> Hi, > > On Sun, Feb 20, 2011 at 4:46 PM, Yogesh Marwaha <[hidden email]> wrote: > > Hi, > > > > I'm coding a transcoding application (not using encodebin). > > > > Upto now I had been using following code to get time for which the > > pipeline has been in Playing state (To show user information like xx > > minutes/seconds the operation has run for or to calcutate averate speed > > and estimate remaining time etc.): - > > GstClockTime elapsedTime = GST_CLOCK_TIME_NONE; > > GstClock *clock = gst_element_get_clock(m_pPipeline); > > if(clock) > > elapsedTime = (gst_clock_get_time(clock) - > > gst_element_get_base_time(m_pPipeline)) / GST_SECOND; > > > > Pipeline is like this: - > > gst_bin_add_many(GST_BIN(m_pPipeline), source, queue, > > audioConvert, audioEncoder, container, sink, NULL); > > > > But then I added code to allow pausing the operation like this: - > > gst_element_set_state(m_pPipeline, GST_STATE_PAUSED); > > > > Now pipeline is paused but the clock is not. It is running always. > > > > What should I do achieve my target? > > You should read this: > > http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-synch > ronisation.txt > > and, of course, use the running time instead of the absolute time. By > heart, it should be something like: > > gst_clock_get_time(gst_element_get_clock(...)) - gst_element_get_base_time > (...) > > Regards > > > Regards, > > > > Yogesh Marwaha > > http://sparklemedia.sourceforge.net/ > > _______________________________________________ > > gstreamer-devel mailing list > > [hidden email] > > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel I fail to understand how is your suggestion different than mine? I have read 2nd and 3rd sections of document you pointed to and it seems that I'm doing the same; may be I'm understanding something in a wrong way. Can you help me understand? Regards, Yogesh Marwaha _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
I am still unable to crack a solution. Can anyone provide some help? Regards, On 20 February 2011 22:56, Yogesh Marwaha <[hidden email]> wrote:
-- Yogesh M http://sparklemedia.sourceforge.net/ http://mazedaar.wordpress.com/ http://snakeeyes.wordpress.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Yogesh Marwaha
On Sun, 2011-02-20 at 20:16 +0530, Yogesh Marwaha wrote:
Hi, > I'm coding a transcoding application (not using encodebin). > > Upto now I had been using following code to get time for which the pipeline > has been in Playing state (To show user information like xx minutes/seconds > the operation has run for or to calcutate averate speed and estimate remaining > time etc.): - Maybe what you want is a progressreport element in your pipeline (somewhere between decoder + encoder)? This will post "progress" element messages on the bus. e.g.: gst-launch-0.10 filesrc location=foo.flac ! decodebin2 ! progressreport ! fakesink Cheers -Tim _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On 22 February 2011 16:55, Tim-Philipp Müller <[hidden email]> wrote:
Cheers progressreport element only give access to the processed and actual lengths of stream. It does show remaining time in the debug output but that too is always increasing (i.e. when pipeline is put to Paused state) Regards,
-- Yogesh M http://sparklemedia.sourceforge.net/ http://mazedaar.wordpress.com/ http://snakeeyes.wordpress.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Wed, 2011-02-23 at 16:20 +0530, Yogesh Marwaha wrote:
> progressreport element only give access to the processed and actual > lengths of stream. It does show remaining time in the debug output but > that too is always increasing (i.e. when pipeline is put to Paused > state) Yes, indeed. You could just create a GTimer and start/pause/continue/stop it depending on pipeline state change messages on the bus. Cheers -Tim _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Yogesh Marwaha
Found the root cause of the problem.
gst_element_get_base_time(m_pPipeline) is only updated when pipeline is put to Playing state. So, when the pipeline is in Paused state my code fails and when the pipeline is again put to Playing state base time is update and elapsed time is calculated correctly.
So, I'll have store elapsed time and only update it if in Playing state. OR implement all these things on my own. Lets see what I do in the coming weekend. PS: My app can only (presently) rip audio cds. You can download latest svn snapshot from http://sparklemedia.svn.sourceforge.net/viewvc/sparklemedia/subprojects/sparklex/current-unstable/?view=tar
On 20 February 2011 20:16, Yogesh Marwaha <[hidden email]> wrote: Hi, -- Yogesh M http://sparklemedia.sourceforge.net/ http://mazedaar.wordpress.com/ http://snakeeyes.wordpress.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |