GstAppSink簡介


Description

  Appsink is a sink plugin that supports many different methods for making the application get a handle on the GStreamer data in a pipeline. Unlike most GStreamer elements, Appsink provides external API functions.appsink can be used by linking to the gstappsink.h header file to access the methods or by using the appsink action signals and properties.

  AppsInk是一個槽插件,它提供了多種供應用程序處理GStreamer管道數據流的方法。不同於大多數的GStreamer元件。Appsink提供額外的API函數。添加gstappsink.h頭文件后獲取appsink的方法(函數)或者使用appsink的響應信號和屬性。

  The normal way of retrieving samples from appsink is by using the gst_app_sink_pull_sample() and gst_app_sink_pull_preroll()methods. These methods block until a sample becomes available in the sink or when the sink is shut down or reaches EOS.There are also timed variants of  these methods, gst_app_sink_try_pull_sample() and gst_app_sink_try_pull_preroll(), which accept a timeout parameter to limit the amount of time to wait.

    常用的從appsink獲取采樣數據的方法是使用gst_app_sink_pull_sample函數和gst_app_sink_pull_preroll函數。這兩個函數都是阻塞的,直到在槽中可獲取到一個采樣數據或者當槽被關閉或者結束信號到來。這兩個方法也都有時間上的變體函數,gst_app_sink_try_pull_sample函數和gst_app_sink_pull_preroll函數,這兩個函數接受一個超時參數來限制函數等待時間。

  Appsink will internally use a queue to collect buffers from the streaming thread. If the application is not pulling samples fast enough, this queue will consume a lot of memory over time. The "max-buffers" property can be used to limit the queue size. The "drop" property controls whether the streaming thread blocks or if older buffers are dropped when the maximum queue size is reached. Note that blocking the streaming thread can negatively affect real-time performance and should be avoided.

  Appsink將在內部使用一個隊列來收集從流線程中獲取的緩存。如果應用程序沒有足夠快的拉取(pull)采樣數據,隨着時間消逝,這個隊列將消耗大量的內存。Appsink的max-buffers屬性可以用來限制內部隊列的大小。AppSink的drop屬性控制當流線程阻塞、緩存到達了隊列最大個數之后是否掉先前的緩存數據。注意,阻塞流線程將對實時性能有負面影響,應當避免。

  If a blocking behaviour is not desirable, setting the "emit-signals" property to TRUE will make appsink emit the "new-sample" and "new-preroll" signals when a sample can be pulled without blocking.The "caps" property on appsink can be used to control the formats that appsink can receive. This property can contain non-fixed caps, the format of the pulled samples can be obtained by getting the sample caps.

  如果阻塞式行為不可取,那么設置Appsink的emit-signals屬性為TRUE,讓appsink在采樣數據可以被非阻塞式拉取的時候發送“new-sample”信號和“new-preroll”信號。Appsink的caps屬性可以用來控制appsink能夠接收的緩存數據格式。該數據可以包含不固定的caps,拉取采樣數據的格式可以通過獲取采樣caps獲知。

  If one of the pull-preroll or pull-sample methods return NULL, the appsink is stopped or in the EOS state. You can check for the EOS state with the "eos" property or with the gst_app_sink_is_eos() method.The eos signal can also be used to be informed when the EOS state is reached to avoid polling.

  如果pull-preroll方法或者pull-sample方法返回NULL,那么appsink被停止了或者處於EOS(結束)狀態。可以通過Appsink的eos屬性或者gst_app_sink_is_eos函數來檢查Appsink是否處於EOS狀態。eos信號也可以用來通知應用程序避免拉取數據,當Appsink到達了EOS狀態。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM