Skip to content
Snippets Groups Projects
Commit 0dcfccaa authored by Paul B Mahol's avatar Paul B Mahol
Browse files

auenc: strict check for supported codec


Also check number of streams and give error message why muxing failed.
This prevents muxing unsupported codec with known and supported tag.

Signed-off-by: default avatarPaul B Mahol <onemda@gmail.com>
parent 10e4905d
No related branches found
No related tags found
No related merge requests found
...@@ -156,8 +156,16 @@ static int au_write_header(AVFormatContext *s) ...@@ -156,8 +156,16 @@ static int au_write_header(AVFormatContext *s)
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec; AVCodecContext *enc = s->streams[0]->codec;
if (!enc->codec_tag) if (s->nb_streams != 1) {
av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
}
enc->codec_tag = ff_codec_get_tag(codec_au_tags, enc->codec_id);
if (!enc->codec_tag) {
av_log(s, AV_LOG_ERROR, "unsupported codec\n");
return AVERROR(EINVAL);
}
ffio_wfourcc(pb, ".snd"); /* magic number */ ffio_wfourcc(pb, ".snd"); /* magic number */
avio_wb32(pb, AU_HEADER_SIZE); /* header size */ avio_wb32(pb, AU_HEADER_SIZE); /* header size */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment