diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2019-02-28 17:24:56 +0100 |
---|---|---|
committer | Mathieu Duponchelle <mduponchelle1@gmail.com> | 2019-02-28 17:03:33 +0000 |
commit | 74d281fbc2c8017b8f2c58ec21f6882fd4731936 (patch) | |
tree | be0e6dfd3f658ca843279c98c3fed74758fbc20f | |
parent | 4b8e3b215a7be3c2fd45333fc9616a933d0b967f (diff) |
cccombiner: implement update_src_caps
It is necessary to implement this vmethod, as when the src pad
is marked as reconfigure, the base class will reset to src caps,
and the default update_src_caps simply queries the caps allowed
downstream without taking into account the caps set by
gst_aggregator_set_src_caps.
-rw-r--r-- | ext/closedcaption/gstcccombiner.c | 20 | ||||
-rw-r--r-- | ext/closedcaption/gstcccombiner.h | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/ext/closedcaption/gstcccombiner.c b/ext/closedcaption/gstcccombiner.c index 4e6760e13..ef4c5666f 100644 --- a/ext/closedcaption/gstcccombiner.c +++ b/ext/closedcaption/gstcccombiner.c @@ -73,6 +73,7 @@ gst_cc_combiner_finalize (GObject * object) g_array_unref (self->current_frame_captions); self->current_frame_captions = NULL; + gst_caps_replace (&self->video_caps, NULL); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -353,7 +354,7 @@ gst_cc_combiner_sink_event (GstAggregator * aggregator, &self->video_fps_d)) self->video_fps_n = self->video_fps_d = 0; - gst_aggregator_set_src_caps (aggregator, caps); + self->video_caps = gst_caps_ref (caps); } break; @@ -375,6 +376,7 @@ gst_cc_combiner_stop (GstAggregator * aggregator) self->current_video_running_time = self->current_video_running_time_end = GST_CLOCK_TIME_NONE; gst_buffer_replace (&self->current_video_buffer, NULL); + gst_caps_replace (&self->video_caps, NULL); g_array_set_size (self->current_frame_captions, 0); self->current_caption_type = GST_VIDEO_CAPTION_TYPE_UNKNOWN; @@ -421,6 +423,21 @@ gst_cc_combiner_create_new_pad (GstAggregator * aggregator, return agg_pad; } +static GstFlowReturn +gst_cc_combiner_update_src_caps (GstAggregator * agg, + GstCaps * caps, GstCaps ** ret) +{ + GstFlowReturn res = GST_AGGREGATOR_FLOW_NEED_DATA; + GstCCCombiner *self = GST_CCCOMBINER (agg); + + if (self->video_caps) { + *ret = gst_caps_intersect (caps, self->video_caps); + res = GST_FLOW_OK; + } + + return res; +} + static void gst_cc_combiner_class_init (GstCCCombinerClass * klass) { @@ -452,6 +469,7 @@ gst_cc_combiner_class_init (GstCCCombinerClass * klass) aggregator_class->flush = gst_cc_combiner_flush; aggregator_class->create_new_pad = gst_cc_combiner_create_new_pad; aggregator_class->sink_event = gst_cc_combiner_sink_event; + aggregator_class->update_src_caps = gst_cc_combiner_update_src_caps; GST_DEBUG_CATEGORY_INIT (gst_cc_combiner_debug, "cccombiner", 0, "Closed Caption combiner"); diff --git a/ext/closedcaption/gstcccombiner.h b/ext/closedcaption/gstcccombiner.h index df3dff0c2..6bf2e67a6 100644 --- a/ext/closedcaption/gstcccombiner.h +++ b/ext/closedcaption/gstcccombiner.h @@ -48,6 +48,7 @@ struct _GstCCCombiner GstClockTime current_video_running_time; GstClockTime current_video_running_time_end; GstBuffer *current_video_buffer; + GstCaps *video_caps; GArray *current_frame_captions; GstVideoCaptionType current_caption_type; |