Hi all,
- Hardware Platform Jetson AGX Orin
- JetPack Version 5.0.2-b231
- GStreamer version 1.16.3
Using gstreamer code examples on element pad signaling, I put together a pipeline that is to take mp4 files.
I used a g_signal_connect to react to when qtdemux adds it’s source pad, but it never gets called, it seems.
Instead, the pipeline failes to elevate it’s state when I ask it to.
Struct for holding all the elements, for pipeline callback reasons:
typedef struct _DynamicPipeData {
GstElement *pipeline;
GstElement *source;
GstElement *demux;
GstElement *parse;
GstElement *queue;
GstElement *nvdec;
GstElement *nvconv;
GstElement *vconv;
GstElement *sink;
} DynamicPipeData;
Main code:
GstStateChangeReturn state_change_return;
gst_init (nullptr, nullptr);
data.source = gst_element_factory_make ("filesrc", "source");
data.demux = gst_element_factory_make ("qtdemux", "demux");
data.parse = gst_element_factory_make ("h264parse", "parse");
data.queue = gst_element_factory_make ("queue", "queue");
data.nvdec = gst_element_factory_make ("nvv4l2decoder", "nvdec");
data.nvconv = gst_element_factory_make ("nvvidconv", "nvconv");
data.vconv = gst_element_factory_make ("videoconvert", "vconv");
data.sink = gst_element_factory_make ("appsink", "sink");
data.pipeline = gst_pipeline_new ("empty-pipeline");
gst_bin_add_many (GST_BIN (data.pipeline), data.source, data.demux, data.parse, data.queue, data.nvdec, data.nvconv, data.vconv, data.sink, NULL);
if (!gst_element_link_many (data.source, data.demux, NULL)) {g_printerr ("Elements could not be linked.\n");}
if (!gst_element_link_many (data.parse, data.queue, data.nvdec, data.nvconv, data.vconv, data.sink, NULL)) {g_printerr ("Elements could not be linked.\n");}
g_object_set (data.source, "location", addressIn, NULL);
g_signal_connect (data.demux, "pad-added", G_CALLBACK (pad_added_handler), &data);
state_change_return = gst_element_set_state (data.pipeline, GST_STATE_NULL);
state_change_return = gst_element_set_state (data.pipeline, GST_STATE_READY);
state_change_return = gst_element_set_state (data.pipeline, GST_STATE_PAUSED);
state_change_return = gst_element_set_state (data.pipeline, GST_STATE_PLAYING);
Since the pad_added_handler doesn’t get called, I haven’t included that function here.
I added plenty of cout’s with the prefix "Local file: " to help keep track of what is going on in the terminal output:
Local file: Start preliminary pipeline build.
Local file: Setting properites of elements.
Local file: Setting properties of source.
Local file: Connect demux to pad-adder signal.
Local file: Start playing pipeline.
Local file: Pipeline state enums are as follows: GST_STATE_VOID_PENDING=0, GST_STATE_NULL=1, GST_STATE_READY=2, GST_STATE_PAUSED=3, GST_STATE_PLAYING=4
Local file: Pipeline state return enums are as follows: GST_STATE_CHANGE_FAILURE=0, GST_STATE_CHANGE_SUCCESS=1, GST_STATE_CHANGE_ASYNC=2, GST_STATE_CHANGE_NO_PREROLL=3
Local file: Current pipeline state: 1 - GST_STATE_NULL
Local file: Setting state to: 1 - GST_STATE_NULL
Local file: Pipeline change return: 1 - GST_STATE_CHANGE_SUCCESS
Local file: Current pipeline state: 1 - GST_STATE_NULL
Local file: Setting state to: 2 - GST_STATE_READY
nvbuf_utils: Could not get EGL display connection
nvbuf_utils: Could not get EGL display connection
Opening in BLOCKING MODE
Local file: Pipeline change return: 1 - GST_STATE_CHANGE_SUCCESS
Local file: Current pipeline state: 1 - GST_STATE_NULL
Local file: Setting state to: 3 - GST_STATE_PAUSED
(executable:33062): GStreamer-WARNING **: 17:23:45.891: Trying to set debug field of error message, but string is not valid UTF-8. Pleasefile a bug.
(executable:33062): GStreamer-WARNING **: 17:23:45.891: Trying to set debug field of error message, but string is not valid UTF-8. Please file a bug.
Local file: Pipeline change return: 0 - GST_STATE_CHANGE_FAILURE
Local file: Current pipeline state: 0 - GST_STATE_VOID_PENDING
Local file: Setting state to: 4 - GST_STATE_PLAYING
(executable:33062): GStreamer-WARNING **: 17:23:46.892: Trying to set debug field of error message, but string is not valid UTF-8. Please file a bug.
(executable:33062): GStreamer-WARNING **: 17:23:46.892: Trying to set debug field of error message, but string is not valid UTF-8. Please file a bug.
Local file: Pipeline change return: 0 - GST_STATE_CHANGE_FAILURE
Local file: Current pipeline state: 0 - GST_STATE_VOID_PENDING
Local file: Start listening to pipeline bus.
Segmentation fault (core dumped)
Any advice would be appreciated.