nnstreamer python 예제를 보다보니, 아래와 같이 pipeline 문자열을 이용해서 구성하고
이름으로 싱크를 찾아 콜백을 연결해 주는걸 보니, 일일이 element 생성해서 연결할 필요가 없을 것 같아서 검색중
gst_launch_cmdline += "tensor_sink name=tensor_sink t. ! " self.pipeline = Gst.parse_launch(gst_launch_cmdline) # bus and message callback bus = self.pipeline.get_bus() bus.add_signal_watch() bus.connect("message", self.on_bus_message) self.tensor_filter = self.pipeline.get_by_name("tensor_filter") self.wayland_sink = self.pipeline.get_by_name("img_tensor") # tensor sink signal : new data callback tensor_sink = self.pipeline.get_by_name("tensor_sink") tensor_sink.connect("new-data", self.new_data_cb) # @brief Callback for tensor sink signal. def new_data_cb(self, sink, buffer): """Callback for tensor sink signal. :param sink: tensor sink element :param buffer: buffer from element :return: None """ |
parse쪽은 c 로는 아래의 함수를 쓰면 될 것 같은데
gst_parse_launch GstElement * gst_parse_launch (const gchar * pipeline_description, GError ** error) Create a new pipeline based on command line syntax. Please note that you might get a return value that is not NULL even though the error is set. In this case there was a recoverable parsing error and you can try to play the pipeline. To create a sub-pipeline (bin) for embedding into an existing pipeline use gst_parse_bin_from_description. Parameters: pipeline_description – the command line describing the pipeline error – the error message in case of an erroneous pipeline. Returns ( [transfer: floating]) – a new element on success, NULL on failure. If more than one toplevel element is specified by the pipeline_description, all elements are put into a GstPipeline, which than is returned. |
[링크 : https://gstreamer.freedesktop.org/documentation/gstreamer/gstparse.html?gi-language=c]
아래의 함수를 이용해서 찾으면 될...지도?
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstBin ╰──GstPipeline gst_bin_get_by_name GstElement * gst_bin_get_by_name (GstBin * bin, const gchar * name) Gets the element with the given name from a bin. This function recurses into child bins. Parameters: bin – a GstBin name – the element name to search for Returns ( [transfer: full][nullable]) – the GstElement with the given name |
'프로그램 사용 > gstreamer' 카테고리의 다른 글
nnstreamer (0) | 2023.12.20 |
---|---|
gst-device-monitor-1.0 (0) | 2023.12.06 |
gstremaer videobox + videomixer (0) | 2023.04.10 |
gst-inspector.c (0) | 2023.04.06 |
gstreamer videomixer 반쪽 성공 (0) | 2023.03.27 |