closedcaption: Use new API for converting GstVideoCaptionType from/to GstCaps

This commit is contained in:
Sebastian Dröge 2018-12-11 14:12:13 +02:00 committed by Sebastian Dröge
parent 48f48cc4ba
commit aa72783b95
2 changed files with 2 additions and 43 deletions

View file

@ -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))

View file

@ -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);