前言:gstreamer 的 1.0 porting guide 里面有提到一下改变,但是,并不是覆盖了全面,本文结合porting 的实际写成,涉及整个porting 真正要用的的一下接口。

gstreamer 0.1 to 1.0 的主要接口改动包括如下方面:

1 Gstbuffer的变化

2 Gstreamer 的 一些插件的接口变化,gst-plugins-base Elements

3 glib 的相关改动

1 *GstBuffer 的变化,这部分,在接口更改说明文档里面有比较详细的说明:

    A GstBuffer is now a simple boxed type this means that subclassing is not possible anymore. To add data to the buffer you would now use gst_buffer_insert_memory() with a GstMemory object containing the data. Multiple memory blocks can added to a GstBuffer that can then be retrieved with gst_buffer_peek_memory().GST_BUFFER_DATA(), GST_BUFFER_MALLOCDATA(), GST_BUFFER_FREE_FUNC() andGST_BUFFER_SIZE() are gone, along with the fields in GstBuffer.The most common way to access all the data in a buffer is by usinggst_buffer_map() and gst_buffer_unmap(). These calls require you to specifythe access mode required to the data and will automatically merge and returna writable copy of the data.GST_BUFFER_SIZE() can be replaced with gst_buffer_get_size() but if alsoaccess to the data is required, gst_buffer_map() can return both the sizeand data in one go.The buffer must be writable (gst_buffer_is_writable()) in order to modifythe fields, metadata or buffer memory. gst_buffer_make_writable() will notautomatically make a writable copy of the memory but will instead increasethe refcount of the memory. The _map() and _peek_memory() methods willautomatically create writable copies when needed.gst_buffer_make_metadata_writable() is gone, you can replace this safelywith gst_buffer_make_writable().gst_buffer_copy_metadata() is gone, use gst_buffer_copy_into() instead andmind use GST_BUFFER_COPY_METADATA instead of the former GST_BUFFER_COPY_ALL.gst_buffer_create_sub() is gone and can be safely replaced withgst_buffer_copy_region(). Changing the size of the buffer data can be done with gst_buffer_resize(),which will also update the metadata fields correctly. gst_buffer_set_size()is #defined to a special case of gst_buffer_resize() with a 0 offset.gst_buffer_try_new_and_alloc() is replaced with gst_buffer_new_and_alloc(),which now returns NULL when memory allocation fails.GST_BUFFER_CAPS() is gone, caps are not set on buffers anymore but are seton the pads where the buffer is pushed on. Likewise GST_BUFFER_COPY_CAPS isnot needed anymore. gst_buffer_get/set_caps() are gone too.
   【hsy案】 CAPS 现在不能从buffer里面拿到了,所以,类似, GstStructure* meta = gst_caps_get_structure(GST_BUFFER_CAPS(buffer), 0);的接口要改下。
    GST_BUFFER_TIMESTAMP is gone, use GST_BUFFER_PTS or GST_BUFFER_DTS instead.Likewise GST_BUFFER_TIMESTAMP_IS_VALID() was changed toGST_BUFFER_PTS_IS_VALID and GST_BUFFER_DTS_IS_VALIDgst_buffer_join() was renamed to gst_buffer_append() and the memory is notdirectly merged but appended.gst_buffer_merge() was removed, it is the same as gst_buffer_join() butwithout taking ownership of the arguments. Caller code should ref themselveswhen needed. Note that the extra refs might force slower paths ingst_buffer_join().gst_buffer_is_span() and gst_buffer_span() are removed, usegst_buffer_merge() and gst_buffer_resize() for the same effect. Merging andspanning is delayed until the buffer is mapped and in some cases no mergingof memory is needed at all when the element can deal with individual memorychunks.
HSY案:
0.10的版本中,Gstbuffer是一个多层结构的数据,包括数据指针,buff大小等。新版本就是一个boxed 结构,

* GstQuery 是一个重要的改动

    Boxed types derived from GstMiniObject.The GstStructure is removed from the public API, use the getters to geta handle to a GstStructure.gst_query_new_application() -> gst_query_new_custom()gst_query_parse_formats_length() -> gst_query_parse_n_formats()gst_query_parse_formats_nth() -> gst_query_parse_nth_format()Some query utility functions no longer use an inout parameter for the 
    destination/query format:
   【hsy案】这里是指有一些指针传递来取回的接口被改掉了,改成直接值传递的方式,以前inout的模式取消了,只有in的模式。- gst_pad_query_position()- gst_pad_query_duration()- gst_pad_query_convert()- gst_pad_query_peer_position()- gst_pad_query_peer_duration()- gst_pad_query_peer_convert()- gst_element_query_position()- gst_element_query_duration()- gst_element_query_convert()gst_element_get_query_types() and gst_pad_get_query_types() with associated functions were removed.
* GstTagList
    is now an opaque mini object instead of being typedefed to a GstStructure.

While it was previously okay (and in some cases required because of
    missing taglist API) to cast a GstTagList to a GstStructure or use
    gst_structure_* API on taglists, you can no longer do that. Doing so will
    cause crashes.

Also, tag lists are refcounted now, and can therefore not be freely
    modified any longer. Make sure to call

taglist = gst_tag_list_make_writable (taglist);

before adding, removing or changing tags in the taglist.

gst_tag_list_new() has been renamed to gst_tag_list_new_empty().
    gst_tag_list_new_full*() have been renamed to gst_tag_list_new*().
    gst_tag_list_free() has been replaced by gst_tag_list_unref().

GST_TAG_IMAGE, GST_TAG_PREVIEW_IMAGE, GST_TAG_ATTACHMENT: many tags that
    used to be of type GstBuffer are now of type GstSample (which is basically
    a struct containing a buffer alongside caps and some other info).

gst_tag_list_get_buffer() => gst_tag_list_get_sample()

gst_is_tag_list() => GST_IS_TAG_LIST ()

Sample to create a memory block via 1.0 edition
1
2
3
4
5
6
7
8
9
GstBuffer *buffer;
GstMemory *memory;
gint size, width, height, bpp;
...
size = width * height * bpp;
buffer = gst_buffer_new ();
memory = gst_allocator_alloc (NULL, size, NULL);
gst_buffer_insert_memory (buffer, -1, memory);
...

2 Gstreamer 的 一些插件的接口变化

2.1 gst-plugins-base Elements

GstBuffer 被Gstsample取代了

appsrc and GstBuffer

Basic: The appsrc element can be used by applications to insert data into a GStreamer pipeline. Unlike most GStreamer elements, appsrc provides external API functions.The main way of handing data to the appsrc element is by calling the gst_app_src_push_buffer() method or by emitting the push-buffer action signal. This will put the buffer onto aqueuefrom which appsrc will read from in its streaming thread. It is important to note that data transport will not happen from the thread that performed the push-buffer call.

appsink

buffer

--01 0.1 接口函数和buffer有关的不能用了

GstBuffer* buffer = gst_app_sink_pull_buffer(sink);

--02 1.0的写法如下
GstBuffer * gst_sample_get_buffer ()

接口从sample里面获取buffer的值。

GstSample *sample;

sample = gst_app_sink_pull_sample (appsink);

buf = gst_sample_get_buffer (sample);

Caps

1.0 版本的使用

GstCaps *           gst_app_sink_get_caps               (GstAppSink *appsink);

0.1 版本的使用

GST_BUFFER_CAPS(buf)

   

ref:

1  Porting 0.10 applications to 1.0

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-porting-1.0.html

2 GStreamer 0.10 to 1.0 porting guide

https://cgit.freedesktop.org/gstreamer/gstreamer/plain/docs/random/porting-to-1.0.txt

3  GStreamer Application Development Manual (1.4.5)

https://gstreamer.freedesktop.org/data/doc/gstreamer/1.4/manual/html/index.html

4  GStreamer Base Plugins 0.10 Library Reference Manual : appsink

https://www.freedesktop.org/software/gstreamer-sdk/data/docs/2012.5/gst-plugins-base-libs-0.10/gst-plugins-base-libs-appsink.html

GStreamer Base Plugins 1.0 Library Reference Manual :appsink

https://developer.gnome.org/gst-plugins-libs/stable/gst-plugins-base-libs-appsink.html

5 gst-plugins-base Elements

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/

6 The sample code for gstreamer

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstSample.html

7 library reference : elements and plugins GStreamer Core Plugins 1.0 Plugins Reference Manual

https://developer.gnome.org/gst-plugins-libs/stable/index.html

8 sample for gst_buffer_map 

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-allocation-buffer.html

gst_buffer_map 

https://developer.gnome.org/gstreamer/stable/gstreamer-GstBuffer.html#gst-buffer-map

10 glib

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

版权所有:转贴请指明出处!谢谢!
正在制作中,马上还会更新。。。

微信: NewTechLife 
Made by huang.makin@gmail.com

QQ:28044280

[gstreamer] [002] porting from 0.10 to 1.0 knew how相关推荐

  1. centos下安装apache+mysql5.7.13+php5.3.3+phpmyadmin4.0.10

    此处记录我学习中遇到的一些问题,可能并不具备参考价值,后期将会将会更新相关内容 1.phpmyadmin4.10.20安装包下载 下载地址:https://files.phpmyadmin.net/p ...

  2. %date:~0,10%用法

    其实很简单: 0,开始位置; 10,取字符的个数; 例如当前时间是: 日期是: %date:~0,10%就是2008-05-29 %time:~0,2%就是14 %time:~3,2%就是13 如果我 ...

  3. Anaconda3+python3.7.10+TensorFlow2.3.0+PyQt5环境搭建

    Anaconda3+python3.7.10+TensorFlow2.3.0+PyQt5环境搭建 一.Anaconda 创建 python3.7环境 1.进入 C:\Users\用户名 目录下,找到 ...

  4. 2021年大数据Spark(四十三):SparkStreaming整合Kafka 0.10 开发使用

    目录 整合Kafka 0-10-开发使用 原理 1.Direct方式 2.简单的并行度1 : 1 ​​​​​​​API 注意 ​​​​​​​代码实现-自动提交偏移量到默认主题 ​​​​​​​代码实现- ...

  5. TensorFlow tfjs 0.10.3 发布

    翻译 | 王柯凝 出品 | AI科技大本营(公众号ID:rgznai100) TensorFlow tfjs 0.10.3 近日正式发布,新版本主要有以下改进内容,AI科技大本营对其编译如下. ▌资源 ...

  6. codis3.2升级redis3.11到redis6.0.10调研

    codis升级redis3.11到redis6.0.10背景 当前codis最新版本为3.2对应的redis的版本为3.2.11,针对以往的redis在使用过程中当内存碎片率过高时只能重启节点,无法动 ...

  7. iis7.5 php7.0,(原创)win7自带IIS7.5+php7.0.10安装教程(图)

    php在上周8月18日发布了PHP 7.0 (7.0.10)版本.详细下载页面http://windows.php.net/download/,根据自身电脑配置情况酌情下载版本.win7旗舰版,iis ...

  8. 编译安装mariadb-10.0.10

    安装cmake centos上编译mariadb5.5以上的需要至少cmake2.6,如果是rpm包,则需要至少cmake2.8.7以上. [root@school ~]# tar xf cmake- ...

  9. 为什么将 0.1f 改为 0 会使性能降低 10 倍?

    点击蓝色"程序猿DD"关注我 回复"资源"获取独家整理的学习资料! 作者 | cenalulu 来源 | http://sina.lt/gtFw 一个有趣的实验 ...

最新文章

  1. Win10的64位操作系统,Visual Studio 2019配置OpenCV4.1.0
  2. php 存储多选项_php高并发之opcache详解
  3. 洛谷 - P1217 - 回文质数 - 枚举
  4. ServerBootstrap
  5. SqlMap异常的处理
  6. android 仿qq 功能,Android 仿QQ界面的实现
  7. CPU,内存, 硬盘,指令之间的关系
  8. 零基础如何自学Java?
  9. orcale linux卸载,Linux下卸载ORACLE的多种方法(转)
  10. 腾讯微博qq说说备份导出工具_软件推荐Day51 其他工具类 腾讯微博备份
  11. 云服务器被恶意ddos攻击了怎么办?
  12. 服务器怎么连接无线路由器怎么设置,光猫连接无线路由器怎么设置
  13. wp下载吧主题模板_内含newzhan2.60无授权版本
  14. Unity3D获取当前键盘按键及Unity3D鼠标、键盘的基本操作
  15. Java8的其它 新特性(笔记二十四)
  16. 授人以鱼不如授人以渔——和女儿学一起学成语
  17. matlab 运动检测,如何使用MATLAB进行运动目标的检测
  18. 【数据库】数据库的基础知识
  19. 电磁兼容EMC详解及测试流程
  20. netstat+taskkill命令解决windows端口占用问题

热门文章

  1. “未在本地计算机上注册“Microsoft.ACE.OLEDB.12.0”提供程序”的解决方案
  2. 8.面向对象-----类和对象
  3. 【软件】OBS无法捕捉显示屏
  4. jmeter利用influxdb和grafana实现数据可视化
  5. 当我谈Flask的时候我在谈些什么
  6. inode索引节点---初识
  7. dagger2 注入_如何使用Dagger 2在您的应用程序中实现依赖注入
  8. 连续两天高烧_连续工作两天,可以看电视11秒
  9. ubuntu安装spark-2.4.7-bin-without-hadoop
  10. Python爬虫进阶必备 | X中网密码加密算法分析