2

If a pipeline is created GstElement *pipeline = gst_pipeline_new (session_id); on my server whenever a user visits http://myurl.com/new?session_id=123&file_path=/vids/vid.mp4 (mp4 videos are streamed to a RTMP server), how can I use the name of the pipeline "123" to set the pipeline state to not playing when the user visits http://myurl.com/to_not_playin?session_id=123? Each visit to http://myurl.com/new launches gstreamer in a new thread (because my webserver is asynchronous and I want multiple users to use the platform) then the different elements/pads are created and linked.

Cheyenne Forbes
  • 491
  • 1
  • 5
  • 15
  • Do keep in mind that tying a thread to each and every request effectively makes the maximum number of users equal to the number of threads your OS can spawn. See [here](http://stackoverflow.com/questions/344203/maximum-number-of-threads-per-process-in-linux) for a question concerning Linux. – Daniel Kamil Kozar Apr 11 '17 at 00:10

2 Answers2

1

There is no way to get a pipeline by name generically in GStreamer, you should store the name -> pipeline map yourself if you need it.

thiagoss
  • 2,034
  • 13
  • 8
  • I created a `GHashTable* my_hash_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_object_unref);` and add the pipelines after I create them `g_hash_table_insert(my_hash_table, pipeline_name, pipeline)` then retrieve the one I want with `GstElement* pipeline = g_hash_table_lookup(my_hash_table, "pipeline name");` – Cheyenne Forbes Apr 11 '17 at 15:47
0

How to set a name on a GStreamer pipeline:

gst_element_set_name(pipeline, "gbxpipeline");

How to get the named pipeline in a message handler:

if (!strcmp("gbxpipeline", strcmp(GST_MESSAGE_SRC_NAME(msg))) {
    // You've got your pipeline!
}

Reference: https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-set-name

David Manpearl
  • 12,362
  • 8
  • 55
  • 72