Yuan Yijun (bbbush) wrote,
Yuan Yijun


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 并且,重构也是出神入化的。

Tags: linux, 转载

  • 资本主义

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

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

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

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


  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded