[FFmpeg-cvslog] avformat/matroskaenc: implement AVOutputFormat.query_codec for webm

James Almer git at videolan.org
Wed Sep 26 21:47:50 EEST 2018


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Sep 21 12:52:13 2018 -0300| [794079e81529f63e32ffc3e8ac4a9dae3b80e765] | committer: James Almer

avformat/matroskaenc: implement AVOutputFormat.query_codec for webm

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=794079e81529f63e32ffc3e8ac4a9dae3b80e765
---

 libavformat/matroska.c    | 16 ++++++++++++++++
 libavformat/matroska.h    |  1 +
 libavformat/matroskaenc.c | 11 +++++++++++
 libavformat/version.h     |  2 +-
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index 94ccbecedb..4d18d147fc 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -103,6 +103,22 @@ const CodecTags ff_mkv_codec_tags[]={
     {""                 , AV_CODEC_ID_NONE}
 };
 
+const CodecTags ff_webm_codec_tags[] = {
+    {"V_VP8"            , AV_CODEC_ID_VP8},
+    {"V_VP9"            , AV_CODEC_ID_VP9},
+    {"V_AV1"            , AV_CODEC_ID_AV1},
+
+    {"A_VORBIS"         , AV_CODEC_ID_VORBIS},
+    {"A_OPUS"           , AV_CODEC_ID_OPUS},
+
+    {"D_WEBVTT/SUBTITLES"   , AV_CODEC_ID_WEBVTT},
+    {"D_WEBVTT/CAPTIONS"    , AV_CODEC_ID_WEBVTT},
+    {"D_WEBVTT/DESCRIPTIONS", AV_CODEC_ID_WEBVTT},
+    {"D_WEBVTT/METADATA"    , AV_CODEC_ID_WEBVTT},
+
+    {""                 , AV_CODEC_ID_NONE}
+};
+
 const CodecMime ff_mkv_image_mime_tags[] = {
     {"image/gif"                  , AV_CODEC_ID_GIF},
     {"image/jpeg"                 , AV_CODEC_ID_MJPEG},
diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 83c824614d..86968a8de1 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -360,6 +360,7 @@ typedef struct CodecTags{
 #define MATROSKA_VIDEO_STEREO_PLANE_COUNT  3
 
 extern const CodecTags ff_mkv_codec_tags[];
+extern const CodecTags ff_webm_codec_tags[];
 extern const CodecMime ff_mkv_mime_tags[];
 extern const CodecMime ff_mkv_image_mime_tags[];
 extern const AVMetadataConv ff_mkv_metadata_conv[];
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index f1985d8f67..90fbaa93f4 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2680,6 +2680,16 @@ static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance)
     return 0;
 }
 
+static int webm_query_codec(enum AVCodecID codec_id, int std_compliance)
+{
+    int i;
+    for (i = 0; ff_webm_codec_tags[i].id != AV_CODEC_ID_NONE; i++)
+        if (ff_webm_codec_tags[i].id == codec_id)
+            return 1;
+
+    return 0;
+}
+
 static int mkv_init(struct AVFormatContext *s)
 {
     int i;
@@ -2832,6 +2842,7 @@ AVOutputFormat ff_webm_muxer = {
     .write_header      = mkv_write_header,
     .write_packet      = mkv_write_flush_packet,
     .write_trailer     = mkv_write_trailer,
+    .query_codec       = webm_query_codec,
     .check_bitstream   = mkv_check_bitstream,
     .flags             = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
                          AVFMT_TS_NONSTRICT | AVFMT_ALLOW_FLUSH,
diff --git a/libavformat/version.h b/libavformat/version.h
index b346bc3bcd..7032e21adc 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
 #define LIBAVFORMAT_VERSION_MINOR  18
-#define LIBAVFORMAT_VERSION_MICRO 102
+#define LIBAVFORMAT_VERSION_MICRO 103
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list