<div><br></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Hi,<br><br>Does any one tried the seek on alaw pipeline.<br><br>I could able to record and playback the alaw file but seek forward and<br>
backward on the<br><br>pipeline is failing.<br><br>Below is the code for seek which works perfectly fine for the mp3 playback<br>pipeline.<br><br><br>static void seekMediaTime (int ff, int time_seconds)<br>{<br> gint64 start_pos, stop_pos, rate;<br>
gint64 start_flag, stop_flag;<br> gint64 pos, len, tmp = 0;<br> gint64 timeFf = FF_SPEED_BASE;<br> GstFormat fmt = GST_FORMAT_TIME;<br><br> /* If media is not playing */<br> if (recordEng.recStatus != REC_PAUSE)<br>
return;<br><br> gst_element_query_duration (recordEng.recPipeline, &fmt, &len);<br> gst_element_query_position (recordEng.recPipeline, &fmt, &pos);<br><br> if (ff == 0)<br> {<br> timeFf = ((gint64)FF_SPEED_BASE * time_seconds);<br>
<br> if ((len <= (pos + timeFf)) || (len == pos))<br> timeFf = 0;<br> else<br> tmp = pos + timeFf;<br> printf ("FORWARDWORD BY:%llu\r\n",timeFf);<br> }<br>
else<br> {<br> timeFf = ((gint64)FF_SPEED_BASE * time_seconds);<br><br> if ((pos <= timeFf) || (len == pos))<br> timeFf = 0;<br> else<br> tmp = (pos - timeFf);<br>
printf ("BACKWORD BY:%llu\r\n",timeFf);<br> }<br> g_print ("Current Pos Time: %llu %llu\r\n",pos,len);<br> g_print ("Set Pos Time: %llu\r\n",tmp);<br> timeFf = tmp;<br> rate = 1.0;<br>
start_pos = timeFf;<br> start_flag = GST_SEEK_TYPE_SET;<br> stop_flag = GST_SEEK_TYPE_NONE;<br> stop_pos = GST_CLOCK_TIME_NONE;<br><br> if (recordEng.recStatus == REC_PLAYING)<br> gst_element_set_state(GST_ELEMENT(recordEng.recPipeline),<br>
GST_STATE_PAUSED);<br><br> if (!gst_element_seek (recordEng.recPipeline, rate,<br> GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,<br> start_flag, start_pos,<br> stop_flag, stop_pos))<br>
{<br> g_print ("Seek failed!\r\n");<br> }<br> else<br> {<br> g_print ("Time: %" GST_TIME_FORMAT " / %"<br> GST_TIME_FORMAT "\r\n",<br> GST_TIME_ARGS (pos), GST_TIME_ARGS (len));<br>
<br> /* We will wait til it is running or failed */<br> if (gst_element_get_state (recordEng.recPipeline,<br> NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE)<br> {<br> g_print ("Failed to go into PLAYING state\r\n");<br>
}<br> }<br><br> if (recordEng.recStatus == REC_PLAYING)<br> gst_element_set_state(GST_ELEMENT(recordEng.recPipeline),<br> GST_STATE_PLAYING);<br>}</span></div><br clear="all">With Warm Regards<br>
Jesu Anuroop Suresh <br><br>"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."<br>"Anyone who has never made a mistake has never tried anything new."<br>
<br>