playbin2, gst_element_seek and http.

Luis de Bethencourt luis at debethencourt.com
Sat May 19 04:01:03 PDT 2012


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.


More information about the gstreamer-devel mailing list