<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hello,<br><br> I am newbie in gstreamer. I have problem in getting the track length of the file.<br>I have implemented a timeout function where I am querying the duration of the file using gst_element_query_duration. <br><br>Here is my callback function...<br><br><br>static gboolean<br>cb_print_position (GstElement *pipeline)<br>{<br>GstElement *pipeline = (GstElement *) data;<br> GstFormat fmt = GST_FORMAT_TIME;<br> gboolean test;<br> gint64 len;<br> guint64 len_seconds;<br> gint32 pos = 0; <br>test = gst_element_query_duration(<br> pipeline, &fmt, &len<br> );<br><br> if (test)<br> {<br><br> len_seconds =
len / GST_SECOND;<br> printf("total time: %lld (%llds)\n", len, len_seconds);<br> <br> int hour, mins;<br> hour = len_seconds / 3600;<br> len_seconds -= (hour * 3600);<br> mins = len_seconds / 60;<br> len_seconds -= (mins * 60);<br> std::cout << "Length is " << mins << ":" << len_seconds;<br> pos = g_random_int_range(0, len_seconds);<br> printf("random: %d\n", pos);<br> }<br>return TRUE;<br>}<br><br>gst_element_set_state(playerpipeline, GST_STATE_PLAYING);<br>g_timeout_add(5 * 1000, (GSourceFunc)cb_print_position, playerpipeline);<br>g_main_loop_run(playerloop);<br><br><br>The problem is that I am not able to get the length of the file. can anyone help me in getting the track length of the file?<br><br>Thanks,<br>Krupa<br><br><br><p
class="MsoNormal"><span><strong><font style="background-color: rgb(64, 255, 255);">Sooner or later, those who win are those who think they can</font></strong>.</span></p><p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 12pt;">~ <a rel="nofollow" target="_blank" href="http://in.f83.mail.yahoo.com/victory/quotations/authors/quotes_bach_richard.html">Richard Bach </a>~</span></p></td></tr></table><br>
<!--1--><hr size=1></hr> Bollywood news, movie reviews, film trailers and more! <a href="http://in.rd.yahoo.com/tagline_movies_1/*http://in.movies.yahoo.com/?wm=n/"> Click here.</a>