cccombiner: Make use of new GstAggregator::negotiate()

Simplifies the caps handling code considerably here and removes some
spurious negotiation.
This commit is contained in:
Sebastian Dröge 2019-08-14 10:13:52 +03:00 committed by Sebastian Dröge
parent 9b9e39be24
commit 92dd72b7ee
2 changed files with 2 additions and 20 deletions

View File

@ -73,7 +73,6 @@ gst_cc_combiner_finalize (GObject * object)
g_array_unref (self->current_frame_captions); g_array_unref (self->current_frame_captions);
self->current_frame_captions = NULL; self->current_frame_captions = NULL;
gst_caps_replace (&self->video_caps, NULL);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
@ -374,7 +373,7 @@ gst_cc_combiner_sink_event (GstAggregator * aggregator,
self->video_fps_n = fps_n; self->video_fps_n = fps_n;
self->video_fps_d = fps_d; self->video_fps_d = fps_d;
self->video_caps = gst_caps_ref (caps); gst_aggregator_set_src_caps (aggregator, caps);
} }
break; break;
@ -396,7 +395,6 @@ gst_cc_combiner_stop (GstAggregator * aggregator)
self->current_video_running_time = self->current_video_running_time_end = self->current_video_running_time = self->current_video_running_time_end =
GST_CLOCK_TIME_NONE; GST_CLOCK_TIME_NONE;
gst_buffer_replace (&self->current_video_buffer, NULL); gst_buffer_replace (&self->current_video_buffer, NULL);
gst_caps_replace (&self->video_caps, NULL);
g_array_set_size (self->current_frame_captions, 0); g_array_set_size (self->current_frame_captions, 0);
self->current_caption_type = GST_VIDEO_CAPTION_TYPE_UNKNOWN; self->current_caption_type = GST_VIDEO_CAPTION_TYPE_UNKNOWN;
@ -447,21 +445,6 @@ gst_cc_combiner_create_new_pad (GstAggregator * aggregator,
return agg_pad; 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 gboolean static gboolean
gst_cc_combiner_src_query (GstAggregator * aggregator, GstQuery * query) gst_cc_combiner_src_query (GstAggregator * aggregator, GstQuery * query)
{ {
@ -594,7 +577,7 @@ gst_cc_combiner_class_init (GstCCCombinerClass * klass)
aggregator_class->flush = gst_cc_combiner_flush; aggregator_class->flush = gst_cc_combiner_flush;
aggregator_class->create_new_pad = gst_cc_combiner_create_new_pad; aggregator_class->create_new_pad = gst_cc_combiner_create_new_pad;
aggregator_class->sink_event = gst_cc_combiner_sink_event; aggregator_class->sink_event = gst_cc_combiner_sink_event;
aggregator_class->update_src_caps = gst_cc_combiner_update_src_caps; aggregator_class->negotiate = NULL;
aggregator_class->get_next_time = gst_aggregator_simple_get_next_time; aggregator_class->get_next_time = gst_aggregator_simple_get_next_time;
aggregator_class->src_query = gst_cc_combiner_src_query; aggregator_class->src_query = gst_cc_combiner_src_query;
aggregator_class->sink_query = gst_cc_combiner_sink_query; aggregator_class->sink_query = gst_cc_combiner_sink_query;

View File

@ -48,7 +48,6 @@ struct _GstCCCombiner
GstClockTime current_video_running_time; GstClockTime current_video_running_time;
GstClockTime current_video_running_time_end; GstClockTime current_video_running_time_end;
GstBuffer *current_video_buffer; GstBuffer *current_video_buffer;
GstCaps *video_caps;
GArray *current_frame_captions; GArray *current_frame_captions;
GstVideoCaptionType current_caption_type; GstVideoCaptionType current_caption_type;