diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2022-01-13 11:31:55 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2022-01-18 00:41:34 +0000 |
commit | a3468e59b68c3842bef9c33296e3b8cfb4df14d5 (patch) | |
tree | a6607c093c6516637d9feffbc4f6009e784bc13e | |
parent | e876f605c834766ce312372f55271e97e8327a8b (diff) | |
download | gstreamer-plugins-bad-a3468e59b68c3842bef9c33296e3b8cfb4df14d5.tar.gz |
mxfdemux: don't error out if VANC track only contains packets we don't handle
If the VANC track does contain packets, but we skip over all packets, just
treat it the same as if there hadn't been any packets at all and send a
GAP event instead of erroring out with "Failed to handle essence element".
We would error out because when we reach the end of the loop without having
found a closed caption packet the flow return variable is still FLOW_ERROR
which is what it has been initialised to.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2568>
-rw-r--r-- | gst/mxf/mxfvanc.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gst/mxf/mxfvanc.c b/gst/mxf/mxfvanc.c index f9342465f..d2530e09a 100644 --- a/gst/mxf/mxfvanc.c +++ b/gst/mxf/mxfvanc.c @@ -138,12 +138,9 @@ mxf_vanc_handle_essence_element (const MXFUL * key, GstBuffer * buffer, * * The same scheme can be used for ANC packets. */ - - *outbuf = gst_buffer_new (); - GST_BUFFER_FLAG_SET (*outbuf, GST_BUFFER_FLAG_GAP); - ret = GST_FLOW_OK; - goto out; + goto no_data; } + for (i = 0; i < num_packets; i++) { G_GNUC_UNUSED guint16 line_num; G_GNUC_UNUSED guint8 wrapping_type; @@ -190,6 +187,7 @@ mxf_vanc_handle_essence_element (const MXFUL * key, GstBuffer * buffer, /* Not S334 EIA-708 */ if (did != 0x61 && sdid != 0x01) { + GST_TRACE ("Skipping VANC data with DID/SDID 0x%02X/0x%02X", did, sdid); if (!gst_byte_reader_skip (&reader, array_count * array_item_size - 2)) goto out; continue; @@ -215,6 +213,14 @@ mxf_vanc_handle_essence_element (const MXFUL * key, GstBuffer * buffer, gst_buffer_unref (buffer); return GST_FLOW_OK; } + +no_data: + + /* No packets or we skipped over all packets */ + *outbuf = gst_buffer_new (); + GST_BUFFER_FLAG_SET (*outbuf, GST_BUFFER_FLAG_GAP); + ret = GST_FLOW_OK; + out: gst_buffer_unmap (buffer, &map); gst_buffer_unref (buffer); |