gst_element_seek fails with alawdec
Stefan Sauer
ensonic at hora-obscura.de
Mon Oct 3 10:58:42 PDT 2011
On 09/23/2011 08:30 AM, Jesu Anuroop Suresh wrote:
> Hi
>
> Below is the pipeline
>
> gst-launch -v filesrc location=give_me_jesus.alaw ! audio/x-alaw,
> rate=44100, channels=2 ! alawdec ! alsasink
>
> It fails for gst_element_seek
only for backward or for both? File a bug for it and ideally have a look
at alwadec and see if you can make a patch.
Stefan
> Below is the code for the seek
>
> ff - 1 for forward, 0 for backward
> time_seconds = number of seconds to seek
>
> This same code is working with the mp3 pipeline
>
> static void seekMediaTime (int ff, int time_seconds)
> {
> gint64 start_pos, stop_pos, rate;
> gint64 start_flag, stop_flag;
> gint64 pos, len, tmp = 0;
> gint64 timeFf = FF_SPEED_BASE;
> GstFormat fmt = GST_FORMAT_TIME;
>
> if (!gst_element_query_duration (recordEng.recPipeline, &fmt, &len) ||
> !gst_element_query_position (recordEng.recPipeline, &fmt, &pos))
> {
> printf ("%s: %d Query Failed\r\n",__func__,__LINE__);
> return;
> }
>
> if (ff == 1)
> {
> timeFf = ((gint64)FF_SPEED_BASE * time_seconds);
>
> if ((len <= (pos + timeFf)) || (len == pos))
> timeFf = 0;
> else
> tmp = pos + timeFf;
> printf ("FORWARDWORD BY:%llu\r\n",timeFf);
> }
> else
> {
> timeFf = ((gint64)FF_SPEED_BASE * time_seconds);
>
> if ((pos <= timeFf) || (len == pos))
> timeFf = 0;
> else
> tmp = (pos - timeFf);
> printf ("BACKWORD BY:%llu\r\n",timeFf);
> }
> g_print ("Current Pos Time: %llu %llu\r\n",pos,len);
> g_print ("Set Pos Time: %llu\r\n",tmp);
> timeFf = tmp;
> rate = 1.0;
> start_pos = timeFf;
> start_flag = GST_SEEK_TYPE_SET;
> stop_flag = GST_SEEK_TYPE_NONE;
> stop_pos = GST_CLOCK_TIME_NONE;
>
> if (!gst_element_seek (recordEng.recPipeline, rate,
> GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
> start_flag, start_pos,
> stop_flag, stop_pos))
> {
> g_print ("Seek failed!\r\n");
> }
> else
> {
> g_print ("Time: %" GST_TIME_FORMAT " / %"
> GST_TIME_FORMAT "\r\n",
> GST_TIME_ARGS (pos), GST_TIME_ARGS (len));
>
> /* We will wait til it is running or failed */
> if (gst_element_get_state (recordEng.recPipeline,
> NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE)
> {
> g_print ("Failed to go into PLAYING state\r\n");
> }
> }
> }
>
>
> Regards
> Jesu Anuroop Suresh
>
>
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/gst-element-seek-fails-with-alawdec-tp3835910p3835910.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list