一、环境
i.MX6平台+gstreamer。
二、实现
封装3个函数,play_fast_forward、play_fast_reverse、play_normal_speed
分别对应快进、快退、正常播放。
gstreamer使用playbin管道。
1、play_fast_forward
void play_fast_forward(GstElement *playbin_em)
{
int64_t pos = 0;
gboolean ret = gst_element_query_position(playbin_em,GST_FORMAT_TIME,&pos);
if (0 == ret)
{
printf("gst_element_query_position fail\n");
return;
}
printf("get pos=%lld\n",pos);
gint64 duration = 0;
ret = gst_element_query_duration(playbin_em,GST_FORMAT_TIME,&duration);
if (0 == ret)
{
printf("gst_element_query_duration fail\n");
return;
}
printf("get duration=%lld\n",duration);
ret = gst_element_seek(playbin_em,4.0,GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH |GS