vocenc: abort if unsupported codec is used

Signed-off-by: Paul B Mahol <onemda@gmail.com>
pull/6/merge
Paul B Mahol 12 years ago
parent 4a2599b0e6
commit 1c5b56eec7
  1. 6
      libavformat/vocenc.c

@ -30,6 +30,7 @@ typedef struct voc_enc_context {
static int voc_write_header(AVFormatContext *s) static int voc_write_header(AVFormatContext *s)
{ {
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec;
const int header_size = 26; const int header_size = 26;
const int version = 0x0114; const int version = 0x0114;
@ -37,6 +38,11 @@ static int voc_write_header(AVFormatContext *s)
|| s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO) || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO)
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
if (!enc->codec_tag || enc->codec_tag > 0xffff) {
av_log(s, AV_LOG_ERROR, "unsupported codec\n");
return AVERROR(EINVAL);
}
avio_write(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1); avio_write(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1);
avio_wl16(pb, header_size); avio_wl16(pb, header_size);
avio_wl16(pb, version); avio_wl16(pb, version);

Loading…
Cancel
Save