seek help about fast forward/backward & plugin

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

seek help about fast forward/backward & plugin

Volter Yen
Hi all,
    Recently,I used the adecode to try to implement an audio player with  fast forward/backwad fuctions, but It gave no response to my seeking action in my application, and the probelm maybe be caused by the event process in the decode element,it just forward the event to other elements in the pipe.
 and  the related codes are as follow: 
 
static gboolean gst_adecoder_src_event(GstPad * pad, GstEvent * event)
{
    gboolean res;
    GstADecoder *adecoder;
    adecoder = GST_ADECODER(GST_PAD_PARENT(pad));
    if (adecoder->codec_handle == NULL)
    goto no_decoder;
    res = gst_pad_push_event(adecoder->sinkpad, event);
    return res;
    no_decoder:
    {
        GST_DEBUG_OBJECT(adecoder, "no decoder, cannot handle event");
        gst_event_unref(event);
        return FALSE;
    }
}
 
 
static gboolean gst_adecoder_sink_event(GstPad * pad, GstEvent * event)
{
    GstADecoder *adecoder = GST_ADECODER(GST_PAD_PARENT(pad));
    gboolean ret = TRUE;
    #ifdef DEBUG
    printf("Got %s event on sink pad\n", GST_EVENT_TYPE_NAME(event));
    #endif
    switch (GST_EVENT_TYPE(event))
    {
  case GST_EVENT_NEWSEGMENT:
  ret = gst_pad_event_default(pad, event);
  break;
     case GST_EVENT_FLUSH_START:
        ret = gst_pad_event_default(pad, event);
        break;
     case GST_EVENT_FLUSH_STOP:
        ret = gst_pad_event_default(pad, event);
        break;
     case GST_EVENT_EOS:
      gst_adecoder_decode_remaining(adecoder);
      ret = gst_pad_event_default(pad, event);
        break;
     default:
        ret = gst_pad_event_default(pad, event);
        break;
    }
    return ret;
}
 
      Is there any problem? Any suggestion? Thank you!
 
      Volter



500强春季最新高薪职位信息,快填简历参加面试
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: seek help about fast forward/backward & plugin

Volter Yen
Hi Tyler,
   Thank your reply first,my pipeline is just working in pull mode according to what you said, it is:
gst-launch-0.10 filesrc location=$1 ! adecoder Codec=3 ! queue max-size-buffers=23 min-threshold-buffers =2 ! osssink
and the source is a mp3 file,which is 32kbps,44100Hz and 2 channels
 
   and ,addtionally,I think maybe I should add some code to the GST_EVENT_FLUSH_STOP processing to empty the buffers before forward the event
 
Volter

在2008-04-09,"Tyler Nielsen" <[hidden email]> 写道:
Volter,

What pipeline did you use?  What audio file type are you playing?  Adecoder can run in two modes, push or pull.  In pull mode, adecoder drivers the pipeline, and as you pointed out it doesn't implement seek.  In push mode, adecoder receives data from upstream, as long as the upstream component supports seeking, adecoder doesn't need to do anything additional.

As an example, with mp3, this won't seek correctly, because adecoder just pulls data from the filesrc.
filesrc location=$1 ! adecoder Codec=3 ! osssink

This will seek, (but I've found it's very slow on my dm6446):
filesrc location=$1 ! mp3parse ! adecoder ! osssink

Tyler

2008/4/8 Volter Yen <[hidden email]>:
Hi all,
    Recently,I used the adecode to try to implement an audio player with  fast forward/backwad fuctions, but It gave no response to my seeking action in my application, and the probelm maybe be caused by the event process in the decode element,it just forward the event to other elements in the pipe.
 and  the related codes are as follow: 
 
static gboolean gst_adecoder_src_event(GstPad * pad, GstEvent * event)
{
    gboolean res;
    GstADecoder *adecoder;
    adecoder = GST_ADECODER(GST_PAD_PARENT(pad));
    if (adecoder->codec_handle == NULL)
    goto no_decoder;
    res = gst_pad_push_event(adecoder->sinkpad, event);
    return res;
    no_decoder:
    {
        GST_DEBUG_OBJECT(adecoder, "no decoder, cannot handle event");
        gst_event_unref(event);
        return FALSE;
    }
}
 
 
static gboolean gst_adecoder_sink_event(GstPad * pad, GstEvent * event)
{
    GstADecoder *adecoder = GST_ADECODER(GST_PAD_PARENT(pad));
    gboolean ret = TRUE;
    #ifdef DEBUG
    printf("Got %s event on sink pad\n", GST_EVENT_TYPE_NAME(event));
    #endif
    switch (GST_EVENT_TYPE(event))
    {
  case GST_EVENT_NEWSEGMENT:
  ret = gst_pad_event_default(pad, event);
  break;
     case GST_EVENT_FLUSH_START:
        ret = gst_pad_event_default(pad, event);
        break;
     case GST_EVENT_FLUSH_STOP:
        ret = gst_pad_event_default(pad, event);
        break;
     case GST_EVENT_EOS:
      gst_adecoder_decode_remaining(adecoder);
      ret = gst_pad_event_default(pad, event);
        break;
     default:
        ret = gst_pad_event_default(pad, event);
        break;
    }
    return ret;
}
 
      Is there any problem? Any suggestion? Thank you!
 
      Volter



500强春季最新高薪职位信息,快填简历参加面试
_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source





蒙牛以领先责任创4年至高荣誉 权威数据为蒙牛加冕
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: seek help about fast forward/backward & plugin

Volter Yen
In reply to this post by Volter Yen
Hi sudarshan ,
    It have simply processed the state changes. namely when  the change is ST_STATE_CHANGE_READY_TO_NULL, reset the decode and clear the buffers,
and I am tring to change to pipeline's scheduling mode according to Tyler's suggestion. anyhow,thank you a lot!
   Volter
 

在2008-04-09,"sudarshan bisht" <[hidden email]> 写道:
Hi Volter,
              Its better to implement all the event handling in _change_state function .

2008/4/8 Volter Yen <[hidden email]>:
Hi all,
    Recently,I used the adecode to try to implement an audio player with  fast forward/backwad fuctions, but It gave no response to my seeking action in my application, and the probelm maybe be caused by the event process in the decode element,it just forward the event to other elements in the pipe.
 and  the related codes are as follow: 
 
static gboolean gst_adecoder_src_event(GstPad * pad, GstEvent * event)
{
    gboolean res;
    GstADecoder *adecoder;
    adecoder = GST_ADECODER(GST_PAD_PARENT(pad));
    if (adecoder->codec_handle == NULL)
    goto no_decoder;
    res = gst_pad_push_event(adecoder->sinkpad, event);
    return res;
    no_decoder:
    {
        GST_DEBUG_OBJECT(adecoder, "no decoder, cannot handle event");
        gst_event_unref(event);
        return FALSE;
    }
}
 
 
static gboolean gst_adecoder_sink_event(GstPad * pad, GstEvent * event)
{
    GstADecoder *adecoder = GST_ADECODER(GST_PAD_PARENT(pad));
    gboolean ret = TRUE;
    #ifdef DEBUG
    printf("Got %s event on sink pad\n", GST_EVENT_TYPE_NAME(event));
    #endif
    switch (GST_EVENT_TYPE(event))
    {
  case GST_EVENT_NEWSEGMENT:
  ret = gst_pad_event_default(pad, event);
  break;
     case GST_EVENT_FLUSH_START:
        ret = gst_pad_event_default(pad, event);
        break;
     case GST_EVENT_FLUSH_STOP:
        ret = gst_pad_event_default(pad, event);
        break;
     case GST_EVENT_EOS:
      gst_adecoder_decode_remaining(adecoder);
      ret = gst_pad_event_default(pad, event);
        break;
     default:
        ret = gst_pad_event_default(pad, event);
        break;
    }
    return ret;
}
 
      Is there any problem? Any suggestion? Thank you!
 
      Volter



500强春季最新高薪职位信息,快填简历参加面试
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel




--
Regards,

Sudarshan Bisht



蒙牛以领先责任创4年至高荣誉 权威数据为蒙牛加冕
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel