본문 바로가기
IT와 개발/GStreamer Study

Specifying the pads

by 도서 임보자 2024. 8. 30.

이전에 설명했듯이 pad는 데이터가 element로 들어오고 나가는 포트이며, 이는 pad를 element 생성 프로세스에서 매우 중요한 항목으로 만듭니다. Boilerplate 코드에서 static pad 템플릿이 pad 템플릿을 element 클래스에 등록하는 방법을 살펴보았습니다. 여기서는 실제 element를 만드는 방법, _event() 함수를 사용하여 특정 형식에 맞게 구성하는 방법, element가 데이터를 흐르게 하는 함수를 등록하는 방법을 살펴보겠습니다.

 

Element의 _init() 함수에서는 _class_init() 함수에서 element 클래스에 등록된 pad 템플릿을 사용하여 pad를 만듭니다. Pad를 만든 후에는 sinkpad에서 입력 데이터를 수신하고 처리할 _chain() 함수 포인터를 설정해야 합니다. 선택적으로 _event() 함수 포인터와 _query() 함수 포인터를 설정할 수도 있습니다. 또는 pad는 looping 모드에서 작동할 수도 있는데, 이는 pad가 직접 데이터를 가져올 수 있다는 것을 의미합니다. 이 주제에 대해서는 나중에 자세히 설명합니다. 그런 다음 pad를 element에 등록해야 합니다. 이는 다음과 같이 진행됩니다.

static void
gst_my_filter_init (GstMyFilter *filter)
{
  /* pad through which data comes in to the element */
  filter->sinkpad = gst_pad_new_from_static_template (
    &sink_template, "sink");
  /* pads are configured here with gst_pad_set_*_function () */



  gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);

  /* pad through which data goes out of the element */
  filter->srcpad = gst_pad_new_from_static_template (
    &src_template, "src");
  /* pads are configured here with gst_pad_set_*_function () */



  gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);

  /* properties initial value */
  filter->silent = FALSE;
}

 

 

원문: Specifying the pads (gstreamer.freedesktop.org)

 

Specifying the pads

Specifying the pads As explained before, pads are the port through which data goes in and out of your element, and that makes them a very important item in the process of element creation. In the boilerplate code, we have seen how static pad templates take

gstreamer.freedesktop.org

 

반응형

'IT와 개발 > GStreamer Study' 카테고리의 다른 글

The event function  (0) 2024.09.13
The chain function  (0) 2024.09.06
Constructing the Boilerplate  (0) 2024.08.23
Plugin Writer's Guide: Foundations  (0) 2024.08.16
Things to check when writing an application  (0) 2024.08.09