cccombiner: expose new input-meta-processing type, force
authorMathieu Duponchelle <mathieu@centricular.com>
Fri, 6 Dec 2024 18:13:50 +0000 (19:13 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 16 Dec 2024 15:43:20 +0000 (15:43 +0000)
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>

subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json
subprojects/gst-plugins-bad/ext/closedcaption/gstcccombiner.c
subprojects/gst-plugins-bad/ext/closedcaption/gstcccombiner.h

index 102e012e2b02ec83f90cb011ab6fa5f9bf3a6899..e3a8806a186eb2b08a885cd40bd1aa7bb5889328 100644 (file)
                         "desc": "discard aggregated CC when input video buffers hold CC metas already",
                         "name": "favor",
                         "value": "2"
+                    },
+                    {
+                        "desc": "discard aggregated CC even when input video buffers do not hold CC",
+                        "name": "force",
+                        "value": "3"
                     }
                 ]
             },
index 152b7631d40b4524d6128551f705ac740ab0240a..d3dc337db838853aaf1180cc041d9875bb63ed07 100644 (file)
@@ -90,6 +90,9 @@ gst_cccombiner_input_meta_processing_get_type (void)
     {CCCOMBINER_INPUT_PROCESSING_FAVOR,
           "discard aggregated CC when input video buffers hold CC metas already",
         "favor"},
+    {CCCOMBINER_INPUT_PROCESSING_FORCE,
+          "discard aggregated CC even when input video buffers do not hold CC",
+        "force"},
     {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);
       }
       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) {
index defd9832ef7d97f6ba29136a43ea90de14d3a852..52f6b656949fac9f1151eb4dfdf3c2bb9908dd5f 100644 (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_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_FORCE: discard aggregated CC even when input video buffers do not hold CC meta
  *
  * Possible processing types for the input-meta-processing property.
  *
@@ -56,6 +57,7 @@ typedef enum {
   CCCOMBINER_INPUT_PROCESSING_APPEND = 0,
   CCCOMBINER_INPUT_PROCESSING_DROP,
   CCCOMBINER_INPUT_PROCESSING_FAVOR,
+  CCCOMBINER_INPUT_PROCESSING_FORCE,
 } GstCCCombinerInputProcessing;
 
 struct _GstCCCombiner