aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-09-21 12:52:13 -0300
committerJames Almer <jamrial@gmail.com>2018-09-26 15:17:13 -0300
commit794079e81529f63e32ffc3e8ac4a9dae3b80e765 (patch)
treef22abd2483a025d00c3e014ac14789889d940204
parent14ac62f9af58fe3cbbf92e2aa1951e2af4b26333 (diff)
downloadffmpeg-794079e81529f63e32ffc3e8ac4a9dae3b80e765.tar.gz
avformat/matroskaenc: implement AVOutputFormat.query_codec for webm
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/matroska.c16
-rw-r--r--libavformat/matroska.h1
-rw-r--r--libavformat/matroskaenc.c11
-rw-r--r--libavformat/version.h2
4 files changed, 29 insertions, 1 deletions
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, \