summaryrefslogtreecommitdiff
path: root/libavformat/matroskaenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-08-17 14:23:20 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-17 14:23:20 +0200
commit27fbe31c921f49078764a69ccb701dbb767c7410 (patch)
tree5a80541540a0a72063c3fa854febb77afc6518b7 /libavformat/matroskaenc.c
parentd071df888d5896031380b2b1733bd0cec833c3b6 (diff)
parent6cd9d0f77d527491d0c3626f16b8e125a8a9344b (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: Revert "avconv: use stream copy by default when possible." avconv: print stream copy information. avconv: use stream copy by default when possible. matroskaenc: vertical alignment. matroskaenc: implement query_codec() lavf: add avformat_query_codec(). lavc: add avcodec_get_type() for mapping codec_id -> type. flvenc: use int64_t to store offsets avconv: don't segfault on 0 input files. Do not write ID3v1 tags by default mpegts: log into an AVFormatContext rather than MpegTSContext. Conflicts: doc/APIchanges libavcodec/version.h libavformat/avformat.h libavformat/mp3enc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r--libavformat/matroskaenc.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index ecc5e6bbb3..8cf781ddcd 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1198,6 +1198,22 @@ static int mkv_write_trailer(AVFormatContext *s)
return 0;
}
+static int mkv_query_codec(enum CodecID codec_id, int std_compliance)
+{
+ int i;
+ for (i = 0; ff_mkv_codec_tags[i].id != CODEC_ID_NONE; i++)
+ if (ff_mkv_codec_tags[i].id == codec_id)
+ return 1;
+
+ if (std_compliance < FF_COMPLIANCE_NORMAL) { // mkv theoretically supports any
+ enum AVMediaType type = avcodec_get_type(codec_id); // video/audio through VFW/ACM
+ if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)
+ return 1;
+ }
+
+ return 0;
+}
+
#if CONFIG_MATROSKA_MUXER
AVOutputFormat ff_matroska_muxer = {
.name = "matroska",
@@ -1210,9 +1226,10 @@ AVOutputFormat ff_matroska_muxer = {
.write_header = mkv_write_header,
.write_packet = mkv_write_packet,
.write_trailer = mkv_write_trailer,
- .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
- .codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0},
- .subtitle_codec = CODEC_ID_SSA,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
+ .codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0},
+ .subtitle_codec = CODEC_ID_SSA,
+ .query_codec = mkv_query_codec,
};
#endif