[FFmpeg-devel] [PATCH 1/4] lavf: matroska subtitle muxer

rcombs rcombs at rcombs.me
Thu May 28 07:10:13 EEST 2020


---
 configure                 |  1 +
 libavformat/allformats.c  |  1 +
 libavformat/matroskaenc.c | 30 ++++++++++++++++++++++++++++++
 libavformat/version.h     |  2 +-
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 8569a60bf8..9929c29006 100755
--- a/configure
+++ b/configure
@@ -3305,6 +3305,7 @@ ismv_muxer_select="mov_muxer"
 ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
 latm_muxer_select="aac_adtstoasc_bsf"
 matroska_audio_muxer_select="matroska_muxer"
+matroska_subtitle_muxer_select="matroska_muxer"
 matroska_demuxer_select="iso_media riffdec"
 matroska_demuxer_suggest="bzlib lzo zlib"
 matroska_muxer_select="iso_media riffenc vp9_superframe_bsf aac_adtstoasc_bsf"
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 3919c9e4c1..1bae208195 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -233,6 +233,7 @@ extern AVOutputFormat ff_md5_muxer;
 extern AVInputFormat  ff_matroska_demuxer;
 extern AVOutputFormat ff_matroska_muxer;
 extern AVOutputFormat ff_matroska_audio_muxer;
+extern AVOutputFormat ff_matroska_subtitle_muxer;
 extern AVInputFormat  ff_mgsts_demuxer;
 extern AVInputFormat  ff_microdvd_demuxer;
 extern AVOutputFormat ff_microdvd_muxer;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1c1ea71f59..1f7a9528de 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2891,3 +2891,33 @@ AVOutputFormat ff_matroska_audio_muxer = {
     .priv_class        = &mka_class,
 };
 #endif
+
+#if CONFIG_MATROSKA_SUBTITLE_MUXER
+static const AVClass mks_class = {
+    .class_name = "matroska subtitle muxer",
+    .item_name  = av_default_item_name,
+    .option     = options,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
+AVOutputFormat ff_matroska_subtitle_muxer = {
+    .name              = "matroska",
+    .long_name         = NULL_IF_CONFIG_SMALL("Matroska Subtitle"),
+    .extensions        = "mks",
+    .priv_data_size    = sizeof(MatroskaMuxContext),
+    .audio_codec       = AV_CODEC_ID_NONE,
+    .video_codec       = AV_CODEC_ID_NONE,
+    .subtitle_codec    = AV_CODEC_ID_ASS,
+    .init              = mkv_init,
+    .deinit            = mkv_deinit,
+    .write_header      = mkv_write_header,
+    .write_packet      = mkv_write_flush_packet,
+    .write_trailer     = mkv_write_trailer,
+    .check_bitstream   = mkv_check_bitstream,
+    .flags             = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT |
+                         AVFMT_ALLOW_FLUSH,
+    .codec_tag         = (const AVCodecTag* const []){
+         additional_subtitle_tags, 0
+    },
+    .priv_class        = &mks_class,
+};
+#endif
diff --git a/libavformat/version.h b/libavformat/version.h
index 493a0b337f..e0135fc7d3 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
-#define LIBAVFORMAT_VERSION_MINOR  43
+#define LIBAVFORMAT_VERSION_MINOR  44
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-- 
2.26.2



More information about the ffmpeg-devel mailing list