Chinaunix首页 | 论坛 | 博客
  • 博客访问: 500485
  • 博文数量: 174
  • 博客积分: 8001
  • 博客等级: 中将
  • 技术积分: 1840
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-04 19:30
文章分类

全部博文(174)

文章存档

2011年(1)

2010年(24)

2009年(149)

我的朋友

分类: LINUX

2009-05-11 21:06:56

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

阅读(1952) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2009-12-06 14:30:58

"queue元素不应该被放在解码器元素前面" 看http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-threads.html 中的一幅图,就会知道这种说法不正确。