Yuan Yijun (bbbush) wrote,
Yuan Yijun
bbbush

GstAdapter

GStreamer-0.8 有 GstByteStream
GStreamer-0.10 变成了 GstAdapter

GstByteStream 的用法

In the above example, you'll notice how bytestream handles buffering of data for you. The result is that you can handle the same data multiple times. Event handling in bytestream is currently sort of wacky, but it works quite well. The one big disadvantage of bytestream is that it requires the element to be loop-based. Long-term, we hope to have a chain-based usable version of bytestream, too.


GstAdapter 文档提到:

This class is for elements that receive buffers in an undesired size. While for example raw video contains one image per buffer, the same is not true for a lot of other formats, especially those that come directly from a file. So if you have undefined buffer sizes and require a specific size, this object is for you.

An adapter is created with gst_adapter_new(). It can be freed again with g_object_unref().

The theory of operation is like this: All buffers received are put into the adapter using gst_adapter_push() and the data is then read back in chunks of the desired size using gst_adapter_peek(). After the data is processed, it is freed using gst_adapter_flush().

For example, a sink pad's chain function that needs to pass data to a library in 512-byte chunks could be implemented like this:


觉得 Gstreamer 的文档写得真不错,连我都能看懂 :D 并且,重构也是出神入化的。


update:
为什么后面的文档都统统看不懂了捏
Tags: linux, 转载
Subscribe

  • 资本主义

    1. 资本如果有 300% 回报就命都不要了,当上总统的回报相比余生,岂止 300% 2. 大家反对的是让有钱人得偿所愿。如果是普通人当上总统是最好,就算是政客也需要众筹。突然出现一个自己有能力负担竞选开支的人,正说明了金钱无所不能,正是理智的人害怕的事情 3.…

  • zz:回来后,一些搞不懂的“共识”

    http://www.mitbbs.com/article_t/Returnee/13379685.html 共识一:欧美搞设计、掌握技术和市场,中国只会生产。利润都被欧美赚走了。 但是结果是中国越来越有钱,欧美越来越没钱,这算是共识吗? 共识二:中国贫富差距大,钱都被少数人赚去了;…

  • 医改提议:从市场化到证券化

    题目太大,想法很简单。如果从就医等于花钱的角度去想问题,资源永远不够,怎么搞都会有人反对。如果把就医看作投资就不一样,医患之间就是全新的关系。投资的花花肠子非常多。量化,打包组合,自主选择,尤其是投资组合的概念非常重要。证券市场让经济更有效率,不把其中的经验用起来就可惜了。…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments