Hello its me again I solved my previous issue but no im totally stuck doing
this: I have a working pipeline that splits a song into 6 channels but now i dont have any clue about how convert it to c++ code This is the pipeline "gst-launch-1.0 -v filesrc location=/home/arion/Downloads/test2.mp3 name=src ! decodebin ! audioconvert ! "audio/x-raw,channels=6" ! deinterleave keep-positions=true name=d interleave name=i ! autoaudiosink d.src_0 ! queue ! volume volume=0 ! i.sink_1 d.src_1 ! queue ! volume volume=1 ! i.sink_2 d.src_2 ! volume volume = 0 ! queue ! i.sink_3 d.src_3 ! volume volume=0 ! queue ! i.sink_4 d.src_4 ! volume volume=0 ! queue ! i.sink_5 d.src_5 ! volume volume=0 ! queue ! i.sink_6" -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Le lundi 07 octobre 2019 à 11:25 -0500, diegoavila a écrit :
> Hello its me again I solved my previous issue but no im totally stuck doing > this: > I have a working pipeline that splits a song into 6 channels but now i dont > have any clue about how convert it to c++ code > This is the pipeline "gst-launch-1.0 -v filesrc > location=/home/arion/Downloads/test2.mp3 name=src ! decodebin ! audioconvert > ! "audio/x-raw,channels=6" ! deinterleave keep-positions=true name=d > interleave name=i ! autoaudiosink d.src_0 ! queue ! volume volume=0 ! > i.sink_1 d.src_1 ! queue ! volume volume=1 ! i.sink_2 d.src_2 ! volume > volume = 0 ! queue ! i.sink_3 d.src_3 ! volume volume=0 ! queue ! i.sink_4 > d.src_4 ! volume volume=0 ! queue ! i.sink_5 d.src_5 ! volume volume=0 ! > queue ! i.sink_6" GError *error = NULL; GstElement *pipeline = gst_parse_launch ("filesrc location=/home/arion/Downloads/test2.mp3 name=src " "! decodebin ! audioconvert ! "audio/x-raw,channels=6" ! deinterleave keep-positions=true name=d " "interleave name=i ! autoaudiosink " "d.src_0 ! queue ! volume volume=0 ! i.sink_1 " "d.src_1 ! queue ! volume volume=1 ! i.sink_2 " "d.src_2 ! volume volume = 0 ! queue ! i.sink_3 " "d.src_3 ! volume volume=0 ! queue ! i.sink_4 " "d.src_4 ! volume volume=0 ! queue ! i.sink_5 " "d.src_5 ! volume volume=0 ! queue ! i.sink_6", &error); gst_element_set_state (pipeline, GST_STATE_PLAYING); /* your main loop */ If you give any element a name, you can then access it using gst_bin_get_by_name(GST_BIN (pipeline), name); Then you next step will be to slowly make it more dynamic for your needs. Then you can combine gst_parse_bin_from_description() and the previous function, and then gst_bin_add() to add the dynamically created bins into the pipeline. That all depends on the level of flexibility you want at the end of your day. Nicolas > > > > -- > Sent from: http://gstreamer-devel.966125.n4.nabble.com/ > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (201 bytes) Download Attachment |
Thanks actually im trying to write all the pipeline elements by miself , i
cant use gst_parse_launch () function (work ) , my current code is : #include <gst/gst.h> #include <iostream> #include <thread> #include <chrono> typedef struct _CustomData { GstElement *pipeline; GstElement *source; GstElement *audio_queue; GstElement *audio_convert; GstElement *audio_sink; GstElement *decodebin; GstElement *deinterleave; GstElement *interleave; } CustomData; static void cb_new_pad (GstElement *element, GstPad *pad, CustomData data); // GOAL // gst-launch-1.0 -v filesrc location=/home/atr/Downloads/test.mp3 name=src //! decodebin ! audioconvert ! "audio/x-raw,channels=6" ! deinterleave keep-positions=true name=d interleave name=i // ! autoaudiosink d.src_0 ! queue ! volume volume=0 ! i.sink_1 d.src_1 ! queue ! volume volume=1 // ! i.sink_2 d.src_2 ! volume volume = 0 ! queue ! i.sink_3 d.src_3 ! volume volume=0 ! queue ! i.sink_4 d.src_4 // ! volume volume=0 ! queue ! i.sink_5 d.src_5 ! volume volume=0 ! queue ! i.sink_6 static void cb_new_pad (GstElement *element, GstPad *pad, CustomData data) { g_print("Inside the pad_added_handler method \n"); //GstPad *sink_pad_audio = gst_element_get_static_pad (data->audio_queue, "sink"); } int main(int argc, char *argv[]) { CustomData data; GstBus *bus; GstMessage *msg; /* Initialize GStreamer */ gst_init (&argc, &argv); data.pipeline = gst_pipeline_new ("test-pipeline"); data.source = gst_element_factory_make ("filesrc", "src"); data.audio_queue = gst_element_factory_make("queue","audio_queue"); data.audio_convert = gst_element_factory_make ("audioconvert", "audio_convert"); data.audio_sink = gst_element_factory_make ("autoaudiosink", "audio_sink"); data.decodebin = gst_element_factory_make ("decodebin", "decodebin"); data.deinterleave = gst_element_factory_make ("deinterleave", "d"); data.interleave = gst_element_factory_make ("interleave", "i"); if(!data.pipeline || !data.source || !data.audio_queue || !data.audio_convert || !data.audio_sink || !data.deinterleave || !data.interleave || !data.decodebin) { g_printerr ("Not all elements could be created.\n"); return -1; } gst_bin_add_many (GST_BIN (data.pipeline), data.source,data.audio_queue,data.audio_convert,data.audio_sink, data.deinterleave,data.interleave,data.decodebin ,NULL); if(!gst_element_link (data.source, data.decodebin)) { g_printerr ("Decodebin and source could not be linked.\n"); gst_object_unref (data.pipeline); return -1; } if (!gst_element_link_many (data.audio_queue,data.audio_convert,data.audio_sink,NULL)) { g_printerr (" audio Elements could not be linked.\n"); gst_object_unref (data.pipeline); return -1; } g_object_set (data.source, "location", "/home/diego/Downloads/test.mp3", NULL); g_signal_connect (data.decodebin, "pad-added", G_CALLBACK (cb_new_pad), &data); return 0; } but the signal is not working i dont know why -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |