summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivia Nikolaidou <vivia@ahiru.eu>2020-07-02 12:28:34 +0300
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-07-03 07:02:05 +0000
commit83190c4ec0041db0c10a629b51f8f9881fac9300 (patch)
tree1b4d8617a3e601ffb8bb6196c4b6a85b5dff04ba
parent0f7a515efbef92f7479b56555f5c7108fbdb2b7f (diff)
downloadgst-libav-83190c4ec0041db0c10a629b51f8f9881fac9300.tar.gz
gstavviddec: Only allow a single closed caption meta
Following discussion in https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1396#note_556068 While it is technically possible to store multiple closed caption metas in the same buffer, we don't currently do that anywhere and for H264/MPEG2 both parts have to be stored in the same packet, and also the number of CC bytes you can store per frame is rather limited. This restriction might be relaxed later once we figured out how to do it without breaking things. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/82>
-rw-r--r--ext/libav/gstavviddec.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
index 9f784f4..502390d 100644
--- a/ext/libav/gstavviddec.c
+++ b/ext/libav/gstavviddec.c
@@ -1691,26 +1691,14 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
AVFrameSideData *side_data =
av_frame_get_side_data (ffmpegdec->picture, AV_FRAME_DATA_A53_CC);
if (side_data) {
- GstVideoCaptionMeta *cc_meta = NULL;
- gpointer iter = NULL;
- gboolean found_708_raw_meta = FALSE;
-
GST_LOG_OBJECT (ffmpegdec,
"Found CC side data of type AV_FRAME_DATA_A53_CC, size %d",
side_data->size);
GST_MEMDUMP ("A53 CC", side_data->data, side_data->size);
- while ((cc_meta = (GstVideoCaptionMeta *)
- gst_buffer_iterate_meta_filtered (out_frame->input_buffer, &iter,
- GST_VIDEO_CAPTION_META_API_TYPE))) {
- if (cc_meta->caption_type != GST_VIDEO_CAPTION_TYPE_CEA708_RAW)
- continue;
- found_708_raw_meta = TRUE;
- break;
- }
-
- /* do not add CEA 708 caption meta if it already exists */
- if (!found_708_raw_meta) {
+ /* do not add closed caption meta if it already exists */
+ if (!gst_buffer_get_meta (out_frame->output_buffer,
+ GST_VIDEO_CAPTION_META_API_TYPE)) {
out_frame->output_buffer =
gst_buffer_make_writable (out_frame->output_buffer);
gst_buffer_add_video_caption_meta (out_frame->output_buffer,
@@ -1718,7 +1706,7 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
side_data->size);
} else {
GST_LOG_OBJECT (ffmpegdec,
- "CEA 708 caption meta already exists: will not add new caption meta");
+ "Closed caption meta already exists: will not add new caption meta");
}
}
}