컴퓨터 공학

GStreamer 요약

집빈지노 2021. 10. 14. 15:46

#Tut 1

` gst_init (&argc, &argv);  --  Initializing GStreamer. Must be the first GStreamer command.

 

` pipeline = gst_parse_launch("[source]", NULL);   -- set of all interconnected elements

` gst_parse_launch  --  easy shortcut pipeline

 

#Tut 2

Elements

` source = gst_element_factory_make ("videotestsrc", "source");

` sink = gst_element_factory_make ("autovideosink", "sink");

 

Pipeline

** bin : element used to contain other elements

` pipeline = gst_pipeline_new ("test-pipeline");  -- create new pipeline

- A pipeline is a particular type of bin

 

Building pipeline

/* Build the pipeline */
gst_bin_add_many (GST_BIN (pipeline), source, sink, NULL);
if (gst_element_link (source, sink) != TRUE) {
    g_printerr ("Elements could not be linked.\n");
    gst_object_unref (pipeline);
    return -1;
  }

` gst_bin_add_many ();  -- accepts a list of elements to be added, ending with NULL

`* gst_bin_add()  --  add individual elements

` gst_element_link()  --  first parameter is source, second is destination. Only elements residing in the same bin can be linked together. Add them them to pipeline first before trying to link them.