[FFmpeg-cvslog] avcodec/libdav1d: add support for A53 Closed Captions
James Almer
git at videolan.org
Sat Aug 15 19:01:59 EEST 2020
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Aug 7 16:05:13 2020 -0300| [6c1bf7c02e8ec5f3c0a432774373ba0e8448e499] | committer: James Almer
avcodec/libdav1d: add support for A53 Closed Captions
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c1bf7c02e8ec5f3c0a432774373ba0e8448e499
---
configure | 3 ++-
libavcodec/libdav1d.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 34c40a765a..f23695858b 100755
--- a/configure
+++ b/configure
@@ -3211,6 +3211,7 @@ libcelt_decoder_deps="libcelt"
libcodec2_decoder_deps="libcodec2"
libcodec2_encoder_deps="libcodec2"
libdav1d_decoder_deps="libdav1d"
+libdav1d_decoder_select="atsc_a53"
libdavs2_decoder_deps="libdavs2"
libfdk_aac_decoder_deps="libfdk_aac"
libfdk_aac_encoder_deps="libfdk_aac"
@@ -6329,7 +6330,7 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas
enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lcodec2
-enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.4.0" "dav1d/dav1d.h" dav1d_version
+enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.5.0" "dav1d/dav1d.h" dav1d_version
enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open
enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 132d344296..fd801c6fd5 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -26,7 +26,9 @@
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
+#include "atsc_a53.h"
#include "avcodec.h"
+#include "bytestream.h"
#include "decode.h"
#include "internal.h"
@@ -364,6 +366,34 @@ FF_ENABLE_DEPRECATION_WARNINGS
light->MaxCLL = p->content_light->max_content_light_level;
light->MaxFALL = p->content_light->max_frame_average_light_level;
}
+ if (p->itut_t35) {
+ GetByteContext gb;
+ unsigned int user_identifier;
+
+ bytestream2_init(&gb, p->itut_t35->payload, p->itut_t35->payload_size);
+ bytestream2_skip(&gb, 1); // terminal provider code
+ bytestream2_skip(&gb, 1); // terminal provider oriented code
+ user_identifier = bytestream2_get_be32(&gb);
+ switch (user_identifier) {
+ case MKBETAG('G', 'A', '9', '4'): { // closed captions
+ AVBufferRef *buf = NULL;
+
+ res = ff_parse_a53_cc(&buf, gb.buffer, bytestream2_get_bytes_left(&gb));
+ if (res < 0)
+ goto fail;
+ if (!res)
+ break;
+
+ if (!av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_A53_CC, buf))
+ av_buffer_unref(&buf);
+
+ c->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
+ break;
+ }
+ default: // ignore unsupported identifiers
+ break;
+ }
+ }
res = 0;
fail:
More information about the ffmpeg-cvslog
mailing list