diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-06 04:51:14 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-22 18:20:14 +0300 |
commit | 76f4b117807c30a528539fc5c7a7e35cb288cfcf (patch) | |
tree | 9c7cc07175940db0d5e06d0bc6ec9e00e6dc5927 /libavformat/flvenc.c | |
parent | 797ba4d53b080962a9efca95c96bdf525cc2f787 (diff) |
avformat/flvenc: Allow muxing video codecs which are not explicitly supported by the muxer
This allows stream copying video codecs before they are explicitly
supported. The same feature was in the past useful for audio codecs
in flv
This partly reverts the changes from 735ab7c5e04e2316afbd56643c13de17a7ac89cd
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/flvenc.c')
-rw-r--r-- | libavformat/flvenc.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index e4717ca5d2..9ee27bf49f 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -336,6 +336,13 @@ static int unsupported_codec(AVFormatContext *s, return AVERROR(ENOSYS); } +static int check_video_codec_tag(int codec_tag) { + if (codec_tag <= 0 || codec_tag > 15) { + return AVERROR(ENOSYS); + } else + return 0; +} + static int flv_write_header(AVFormatContext *s) { int i; @@ -358,7 +365,7 @@ static int flv_write_header(AVFormatContext *s) return AVERROR(EINVAL); } flv->video_enc = enc; - if (!ff_codec_get_tag(flv_video_codec_ids, enc->codec_id)) + if (check_video_codec_tag(enc->codec_tag) < 0) return unsupported_codec(s, "Video", enc->codec_id); if (enc->codec_id == AV_CODEC_ID_MPEG4 || @@ -542,7 +549,9 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) case AVMEDIA_TYPE_VIDEO: avio_w8(pb, FLV_TAG_TYPE_VIDEO); - flags = ff_codec_get_tag(flv_video_codec_ids, enc->codec_id); + flags = enc->codec_tag; + if (check_video_codec_tag(flags) < 0) + return unsupported_codec(s, "Video", enc->codec_id); flags |= pkt->flags & AV_PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER; break; |