playbin2, gst_element_seek and http.

Luis de Bethencourt luis at debethencourt.com
Sat May 19 09:25:12 PDT 2012


On 19 May 2012 13:49, Kyrylo V Polezhaiev <polezhaiev at ukr.net> wrote:
> Thanks, Luis.
>> Why is the GstElement 'pipeline' passed to all functions, except for
>> the seek that is 'bin'?
> I use pipeline as the first argument instead of playbin2 now.
>> May I ask why you are changing the state to paused and then setting it
>> back again?
> Okay, now I am removed this part. So now I have:
>
>    gint64 position, length;
>    GstFormat format = GST_FORMAT_TIME;
>    gst_element_query_duration (pipeline, &format, &length);
>    position = static_cast<gint64>(length * (percents * 0.01));
>    if (!gst_element_seek(pipeline, 1.0, format, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, position, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
>    {
>        MessageBoxA(0, "gst_element_seek failed", "Error", 0);
>    }
>
> Just before gst_element_seek I have following values:
>    length   = 187623000000
>    position = 73124858969
>    percents = 38.974358
>    format   = GST_FORMAT_TIME
>
> But now video still begins from start instead of from 73124858969.
>
>

That is very strange, it should work.
Can you get a GST_DEBUG log and paste it in pastebin?
I'm intrigued.

Thanks,
Luis

>
>> On 19 May 2012 11:53, Luis de Bethencourt <luis at debethencourt.com> wrote:
>> > On 19 May 2012 09:58, Kyrylo V Polezhaiev <polezhaiev at ukr.net> wrote:
>> >> Hello, I am using the following code in my browser plugin to set position in video:
>> >>
>> >> void OVIMediaPlayer::set_position(float percents)
>> >> {
>> >>     gint64 position, length;
>> >>     GstFormat format = GST_FORMAT_TIME;
>> >>     gst_element_query_duration (pipeline, &format, &length);
>> >>     position = static_cast<gint64>(length * (percents * 0.01));
>> >>     GstState state;
>> >>     gst_element_get_state(pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
>> >>     gst_element_set_state(pipeline, GST_STATE_PAUSED);
>> >>     gst_element_seek(bin, 1.0, format, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, position, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
>> >>     gst_element_set_state(pipeline, state);
>> >>     return;
>> >> }
>> >>
>> >> My pipeline contains playbin2 with directdraw video sink and plays video from http server. Server supports HTTP Range Headers. My function gets percents argument in range [0; 100] to set position of video. But after each call video begins from begging.
>> >>
>> >
>> > May I ask why you are changing the state to paused and then setting it
>> > back again?
>> > The rest looks OK, so I'm puzzled by this.
>>
>> Why is the GstElement 'pipeline' passed to all functions, except for
>> the seek that is 'bin'?
>> Can you check that you are really passing a [0-100] percent value?
>> Considering you are passing
>> that value as a float it might be [0-1] somewhere else.
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> 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