History

vocenc: abort if unsupported codec is used

Paul B Mahol committed 14 years ago

Commit 1c5b56e1 parent 4a2599b1 file · +6 −0Browse files

Unified · Split

libavformat/vocenc.c+6−0
@@ -30,6 +30,7 @@ typedef struct voc_enc_context { · 29 unmodified lines
30static int voc_write_header(AVFormatContext *s)30static int voc_write_header(AVFormatContext *s)
31{31{
32 AVIOContext *pb = s->pb;32 AVIOContext *pb = s->pb;
33 AVCodecContext *enc = s->streams[0]->codec;
33 const int header_size = 26;34 const int header_size = 26;
34 const int version = 0x0114;35 const int version = 0x0114;
35 36
@@ -37,6 +38,11 @@ static int voc_write_header(AVFormatContext *s) · 1 unmodified line
37 || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO)38 || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO)
38 return AVERROR_PATCHWELCOME;39 return AVERROR_PATCHWELCOME;
39 40
41 if (!enc->codec_tag || enc->codec_tag > 0xffff) {
42 av_log(s, AV_LOG_ERROR, "unsupported codec\n");
43 return AVERROR(EINVAL);
44 }
45
40 avio_write(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1);46 avio_write(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1);
41 avio_wl16(pb, header_size);47 avio_wl16(pb, header_size);
42 avio_wl16(pb, version);48 avio_wl16(pb, version);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t