Unified · Split
| @@ -30,6 +30,7 @@ typedef struct voc_enc_context { · 29 unmodified lines | |||
| 30 | static int voc_write_header(AVFormatContext *s) | 30 | static 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); |