cccombiner: expose new input-meta-processing type, force

In force mode, generated captions are discarded even if input video
buffers do not hold CC meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8091>
This commit is contained in:
Mathieu Duponchelle 2024-12-06 19:13:50 +01:00 committed by GStreamer Marge Bot
parent 0c17efafa3
commit 7be4d09f14
3 changed files with 16 additions and 0 deletions

View file

@ -8183,6 +8183,11 @@
"desc": "discard aggregated CC when input video buffers hold CC metas already", "desc": "discard aggregated CC when input video buffers hold CC metas already",
"name": "favor", "name": "favor",
"value": "2" "value": "2"
},
{
"desc": "discard aggregated CC even when input video buffers do not hold CC",
"name": "force",
"value": "3"
} }
] ]
}, },

View file

@ -90,6 +90,9 @@ gst_cccombiner_input_meta_processing_get_type (void)
{CCCOMBINER_INPUT_PROCESSING_FAVOR, {CCCOMBINER_INPUT_PROCESSING_FAVOR,
"discard aggregated CC when input video buffers hold CC metas already", "discard aggregated CC when input video buffers hold CC metas already",
"favor"}, "favor"},
{CCCOMBINER_INPUT_PROCESSING_FORCE,
"discard aggregated CC even when input video buffers do not hold CC",
"force"},
{0, NULL, NULL}, {0, NULL, NULL},
}; };
@ -679,6 +682,12 @@ gst_cc_combiner_collect_captions (GstCCCombiner * self, gboolean timeout)
g_array_set_size (self->current_frame_captions, 0); g_array_set_size (self->current_frame_captions, 0);
} }
break; break;
case CCCOMBINER_INPUT_PROCESSING_FORCE:
GST_LOG_OBJECT (self,
"Forced input captions, dropping %d dequeued captions",
self->current_frame_captions->len);
g_array_set_size (self->current_frame_captions, 0);
break;
} }
if (self->current_frame_captions->len > 0) { if (self->current_frame_captions->len > 0) {

View file

@ -47,6 +47,7 @@ typedef struct _GstCCCombinerClass GstCCCombinerClass;
* @CCCOMBINER_INPUT_PROCESSING_APPEND: append aggregated CC to existing metas on video buffers * @CCCOMBINER_INPUT_PROCESSING_APPEND: append aggregated CC to existing metas on video buffers
* @CCCOMBINER_INPUT_PROCESSING_DROP: drop existing CC metas on input video buffers * @CCCOMBINER_INPUT_PROCESSING_DROP: drop existing CC metas on input video buffers
* @CCCOMBINER_INPUT_PROCESSING_FAVOR: discard aggregated CC when input video buffers hold CC metas already * @CCCOMBINER_INPUT_PROCESSING_FAVOR: discard aggregated CC when input video buffers hold CC metas already
* @CCCOMBINER_INPUT_PROCESSING_FORCE: discard aggregated CC even when input video buffers do not hold CC meta
* *
* Possible processing types for the input-meta-processing property. * Possible processing types for the input-meta-processing property.
* *
@ -56,6 +57,7 @@ typedef enum {
CCCOMBINER_INPUT_PROCESSING_APPEND = 0, CCCOMBINER_INPUT_PROCESSING_APPEND = 0,
CCCOMBINER_INPUT_PROCESSING_DROP, CCCOMBINER_INPUT_PROCESSING_DROP,
CCCOMBINER_INPUT_PROCESSING_FAVOR, CCCOMBINER_INPUT_PROCESSING_FAVOR,
CCCOMBINER_INPUT_PROCESSING_FORCE,
} GstCCCombinerInputProcessing; } GstCCCombinerInputProcessing;
struct _GstCCCombiner struct _GstCCCombiner