queue元素的作用:
A queue is the thread boundary element through which you can force the use of threads. It does so by using a classic provider/receiver model as learned in threading classes at universities all around the world. By doing this, it acts both as a means to make data throughput between threads threadsafe, and it can also act as a buffer. Queues have several GObject properties to be configured for specific uses. For example, you can set lower and upper tresholds for the element. If there’s less data than the lower treshold (default: disabled), it will block output. If there’s more data than the upper treshold, it will block input or (if configured to do so) drop data.
队列元素是线程的边界,通过它,你可以控制线程。它使用经典的 provider/receiver 模型。它一方面作为一种让线程之间进行线程安全的传递数据的方法;另一方面,可以作为缓冲区。你可以设置它的上下限。
一般情况下,不需要设置上下限就可以工作了。值得注意的是:
queue元素不应该被放在解码器元素前面,例如:
gst-launch filesrc location=test.mpeg ! dvddemux name=demuxer demuxer. ! queue ! mpeg2dec ! ffmpegcolorspace ! sdlvideosink demuxer. ! queue ! mad ! audioconvert ! a udioresample ! autoaudiosink
将不能工作:
WARNING: erroneous pipeline: could not link queue0 to mpeg2dec0
而应该将queue放在播放区的前面,播放区是指在sink元素之前的可能的转换元素等组成的几个元素,这里使用queue元素,就将播放作为一个线程,而解码在另一个线程进行,符合queue的设计意图,也只有这样才能正常工作。
gst-launch filesrc location=test.mpeg ! dvddemux name=demuxer demuxer. ! mpeg2dec ! queue ! ffmpegcolorspace ! sdlvideosink demuxer. ! mad ! queue ! audioconvert ! audioresample ! autoaudiosink
阅读(1996) | 评论(1) | 转发(0) |