From aa72783b95e681dd5c30b97b77ec27d67fb05ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 11 Dec 2018 14:12:13 +0200 Subject: [PATCH] closedcaption: Use new API for converting GstVideoCaptionType from/to GstCaps --- ext/closedcaption/gstcccombiner.c | 23 +---------------------- ext/closedcaption/gstccextractor.c | 22 +--------------------- 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/ext/closedcaption/gstcccombiner.c b/ext/closedcaption/gstcccombiner.c index dd11920119..4e6760e13f 100644 --- a/ext/closedcaption/gstcccombiner.c +++ b/ext/closedcaption/gstcccombiner.c @@ -347,28 +347,7 @@ gst_cc_combiner_sink_event (GstAggregator * aggregator, s = gst_caps_get_structure (caps, 0); if (strcmp (GST_OBJECT_NAME (agg_pad), "caption") == 0) { - const gchar *format; - - format = gst_structure_get_string (s, "format"); - if (gst_structure_has_name (s, "closedcaption/x-cea-608")) { - if (strcmp (format, "raw") == 0) { - self->current_caption_type = GST_VIDEO_CAPTION_TYPE_CEA608_RAW; - } else if (strcmp (format, "s334-1a") == 0) { - self->current_caption_type = GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A; - } else { - g_assert_not_reached (); - } - } else if (gst_structure_has_name (s, "closedcaption/x-cea-708")) { - if (strcmp (format, "cc_data") == 0) { - self->current_caption_type = GST_VIDEO_CAPTION_TYPE_CEA708_RAW; - } else if (strcmp (format, "cdp") == 0) { - self->current_caption_type = GST_VIDEO_CAPTION_TYPE_CEA708_CDP; - } else { - g_assert_not_reached (); - } - } else { - g_assert_not_reached (); - } + self->current_caption_type = gst_video_caption_type_from_caps (caps); } else { if (!gst_structure_get_fraction (s, "framerate", &self->video_fps_n, &self->video_fps_d)) diff --git a/ext/closedcaption/gstccextractor.c b/ext/closedcaption/gstccextractor.c index b18cfabd03..d693e18d74 100644 --- a/ext/closedcaption/gstccextractor.c +++ b/ext/closedcaption/gstccextractor.c @@ -277,27 +277,7 @@ static GstCaps * create_caps_from_caption_type (GstVideoCaptionType caption_type, const GstVideoInfo * video_info) { - GstCaps *caption_caps = NULL; - - switch (caption_type) { - case GST_VIDEO_CAPTION_TYPE_CEA608_RAW: - caption_caps = gst_caps_new_simple ("closedcaption/x-cea-608", - "format", G_TYPE_STRING, "raw", NULL); - break; - case GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A: - caption_caps = gst_caps_new_simple ("closedcaption/x-cea-608", - "format", G_TYPE_STRING, "s334-1a", NULL); - break; - case GST_VIDEO_CAPTION_TYPE_CEA708_RAW: - caption_caps = gst_caps_new_simple ("closedcaption/x-cea-708", - "format", G_TYPE_STRING, "cc_data", NULL); - break; - case GST_VIDEO_CAPTION_TYPE_CEA708_CDP: - caption_caps = gst_caps_new_simple ("closedcaption/x-cea-708", - "format", G_TYPE_STRING, "cdp", NULL); - default: - break; - } + GstCaps *caption_caps = gst_video_caption_type_to_caps (caption_type); gst_caps_set_simple (caption_caps, "framerate", GST_TYPE_FRACTION, video_info->fps_n, video_info->fps_d, NULL);