gst_element_seek fails with alawdec

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

gst_element_seek fails with alawdec

Jesu Anuroop Suresh
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
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



Reply | Threaded
Open this post in threaded view
|

Re: gst_element_seek fails with alawdec

Stefan Sauer
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
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst_element_seek fails with alawdec

Jesu Anuroop Suresh
Hi Stefan,

Thanks for your replay. 

It does fail for both forward and backward.

Yes let me try that to add some patch to alawdec for the seek,

With Warm Regards
Jesu Anuroop Suresh

"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."
"Anyone who has never made a mistake has never tried anything new."






On Mon, Oct 3, 2011 at 11:29 PM, Stefan Sauer [via GStreamer-devel] <[hidden email]> wrote:
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
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



If you reply to this email, your message will be added to the discussion below:
http://gstreamer-devel.966125.n4.nabble.com/gst-element-seek-fails-with-alawdec-tp3835910p3868308.html
To unsubscribe from gst_element_seek fails with alawdec, click here.