avformat/matroskaenc: implement AVOutputFormat.query_codec for webm

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2018-09-21 12:52:13 -03:00
parent 14ac62f9af
commit 794079e815
4 changed files with 29 additions and 1 deletions

View File

@ -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},

View File

@ -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[];

View File

@ -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,

View File

@ -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, \