before the discusstion:

play_rate问题是我们做gstreamer开发经常遇到的问题

这也许有一点令人费解, play rate的设定是放在gst_element_seek ()、gst_event_new_seek 里面实现的。

1 basic from gstreamer

Goal
Fast-forward, reverse-playback and slow-motion are all techniques collectively known as trick modes and they all have in common that modify the normal playback rate. This tutorial shows how to achieve these effects and adds frame-stepping into the deal. In particular, it shows:

How to change the playback rate, faster and slower than normal, forward and backwards.
How to advance a video frame-by-frame

Introduction
Fast-forward is the technique that plays a media at a speed higher than its normal (intended) speed; whereas slow-motion uses a speed lower than the intended one. Reverse playback does the same thing but backwards, from the end of the stream to the beginning.

All these techniques do is change the playback rate, which is a variable equal to 1.0 for normal playback, greater than 1.0 (in absolute value) for fast modes, lower than 1.0 (in absolute value) for slow modes, positive for forward playback and negative for reverse playback.

提供两种方法,如下:
GStreamer provides two mechanisms to change the playback rate: Step Events and Seek Events. Step Events allow skipping a given amount of media besides changing the subsequent playback rate (only to positive values). Seek Events, additionally, allow jumping to any position in the stream and set positive and negative playback rates.

In Basic tutorial 4: Time management seek events have already been shown, using a helper function to hide their complexity. This tutorial explains a bit more how to use these events.

Step Events are a more convenient way of changing the playback rate, due to the reduced number of parameters needed to create them; however, their implementation in GStreamer still needs a bit more polishing so Seek Events are used in this tutorial instead.

To use these events, they are created and then passed onto the pipeline, where theypropagateupstream until they reach an element that can handle them. If an event is passed onto a bin element like playbin2, it will simply feed the event to all its sinks, which will result in multiple seeks being performed. The common approach is to retrieve one of playbin2’s sinks through the video-sink or audio-sink properties and feed the event directly into the sink.

Frame stepping is a technique that allows playing a video frame by frame. It is implemented by pausing the pipeline, and then sending Step Events to skip one frame each time.

2 the setting functions for gst_event_new_seek ()

GstEvent *
gst_event_new_seek (gdouble rate,
                    GstFormat format,
                    GstSeekFlags flags,
                    GstSeekType start_type,
                    gint64 start,
                    GstSeekType stop_type,
                    gint64 stop);
Allocate a new seek event with the given parameters.
The seek event configures playback of the pipeline between start to stop at the speed given in rate , also called a playback segment. The start and stop values are expressed in format .
A rate of 1.0 means normal playback rate, 2.0 means double speed. Negatives values means backwards playback. A value of 0.0 for the rate is not allowed and should be accomplished instead by PAUSING the pipeline.
A pipeline has a default playback segment configured with a start position of 0, a stop position of -1 and a rate of 1.0. The currently configured playback segment can be queried with GST_QUERY_SEGMENT.
start_type and stop_type specify how to adjust the currently configured start and stop fields in playback segment. Adjustments can be made relative or absolute to the last configured values. A type of GST_SEEK_TYPE_NONE means that the position should not be updated.
When the rate is positive and start has been updated, playback will start from the newly configured start position.
For negative rates, playback will start from the newly configured stop position (if any). If the stop position is updated, it must be different from -1 (GST_CLOCK_TIME_NONE) for negative rates.
It is not possible to seek relative to the current playback position, to do this, PAUSE the pipeline, query the current playback position with GST_QUERY_POSITION and update the playback segment current position with a GST_SEEK_TYPE_SET to the desired position.
Parameters
rate
The new playback rate
 
format
The format of the seek values
 
flags
The optional seek flags
 
start_type
The type and flags for the new start position
 
start
The value of the new start position
 
stop_type
The type and flags for the new stop position
 
stop
The value of the new stop position
 
Returns
a new seek event.

ref:

1 basic from s

http://docs.gstreamer.com/display/GstSDK/Basic+tutorial+13%3A+Playback+speed

2 gst_element_seek ()

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-seek

3 gst_event_new_seek ()

https://developer.gnome.org/gstreamer/stable/gstreamer-GstEvent.html#gst-event-new-seek

Discuss with me @QQ: 28044280

[gstreamer][001] Seek issues and so on相关推荐

  1. [Study Notes][001][gstreamer] memory

    gstreamer 的buffer的概念含义非常多,仔细研读,gstreamer关于buffer的定义:本文highlight这些定义: 并结合实例分析一下. Object Hierarchy GBo ...

  2. GStreamer(二)

    http://antkillerfarm.github.io/ GStreamer应用(续) TCP远程播放 除了本地播放之外,GStreamer亦支持远程播放.以下仅以TCP远程播放为例. TCP远 ...

  3. GStreamer基础教程07 - 播放速率控制

    摘要 在常见的媒体播放器中,通常可以看到快进,快退,慢放等功能,这部分功能被称为"特技模式(Trick Mode)",这些模式有个共同点:都通过修改播放的速率来达到相应的目的. 本 ...

  4. Gstreamer的一些基本概念与A/V同步分析

    http://blog.csdn.net/shenbin1430/article/details/4291963 ================================= 一.媒体流(str ...

  5. python 循环播放音乐_python gstreamer实现视频快进/快退/循环播放功能

    这篇文章主要介绍了python gstreamer 实现视频快进/快退/循环播放功能,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下 Gstreamer到底是个啥? ...

  6. GStreamer开发介绍

    https://blog.csdn.net/liu_xiao_cheng/article/details/43017491#section-bin-ghost-img 发Chat 转载 2015年01 ...

  7. Gstreamer - 位置跟踪和定位

    Position tracking and seeking 到目前为止,我们已经了解了如何创建pipeline 来进行媒体处理以及如何使其运行.大多数应用程序开发人员会对向用户提供有关媒体进度的反馈感 ...

  8. Gstreamer 应用开发:1-基础介绍

    我们之前的系列,正式的介绍了Gstreamer,并且围绕如何使用USB相机推流实现RTSP服务器来做了介绍,并在Jeston TX1 平台上做了优化急速的一些探索. 今天我们开始围绕如何用命令实现一个 ...

  9. 【GStreamer 】1-扫盲介绍

    从历史的角度来看,Linux 在多媒体方面已经远远落后于其它的操作系统.微软的Windows和苹果的MacOS它们对多媒体设备.多媒体创作.播放和实时处理等方面已经有了很好的支持.另一方面,Linux ...

最新文章

  1. JVM自动内存管理:对象判定和回收算法
  2. PNAS | 菌群大战:“单打独斗之殇”与“分而治之之利”
  3. C# 框架是什么?MVC是什么 ?工厂模式是什么?设计模式是什么?三层架构是什...
  4. 转载:static的初始化顺序
  5. 2015第29周五AOP
  6. Leetcode 583.两个字符串的删除操作
  7. pycharm 离线安装插件
  8. 可输入div的问题探讨
  9. java整理软件--- Java OCR 图像智能字符识别技术,可识别中文,但是验证码不可以识别...已测识别中文效果很好
  10. Python遍历文件夹获取文件名并写入excel
  11. UEFI win7系统的安装
  12. 基于M6097 switch的STP协议调试方法
  13. ESP32开发实例(七),WebServer使用
  14. Spring cloud和规则引擎urule整合代码
  15. 所有文件夹变成快捷方式之“1KB文件夹快捷方式病毒”清除
  16. ConcurrentHashMap比其他并发集合的安全效率要高一些?
  17. 华为mate40和vivox50pro+哪个好
  18. 验证tomcat安装成功
  19. html5 自动扣图,js+html5 canvas实现ps钢笔抠图
  20. java 使用onvif协议 PTZ 登录认证,获取摄像头位置, 控制摄像头转动,digest认证,拍照截图

热门文章

  1. 2. 移动安全渗透测试-(Android安全基础)
  2. TSP旅行商问题之分支界限法法求解(C语言)
  3. 脚手架-- yarn link后,Error: Cannot find module 。。。
  4. 【Python】字符串的格式化
  5. C#LeetCode刷题之#344-反转字符串​​​​​​​(Reverse String)
  6. 无法打开文件“libboost_python-vc120-mt-sgd-1_59.lib”
  7. Python3网络爬虫开发实战分析Ajax爬取今日头条街拍美图
  8. 再见,付费录屏软件!我用70行Python代码打造免费版!
  9. python发邮件和网络的简单使用
  10. Python高级——HTTP协议