NUV_MYTHEXT = 'X'
} nuv_frametype;
-static int nuv_probe(AVProbeData *p)
+static int nuv_probe(const AVProbeData *p)
{
if (!memcmp(p->buf, "NuppelVideo", 12))
return AVPROBE_SCORE_MAX;
if (!vst && !myth)
return 1; // no codec data needed
while (!avio_feof(pb)) {
- int size, subtype;
+ int size, subtype, ret;
frametype = avio_r8(pb);
switch (frametype) {
avio_skip(pb, 6);
size = PKTSIZE(avio_rl32(pb));
if (vst && subtype == 'R') {
- if (vst->codecpar->extradata) {
- av_freep(&vst->codecpar->extradata);
- vst->codecpar->extradata_size = 0;
- }
- if (ff_get_extradata(NULL, vst->codecpar, pb, size) < 0)
- return AVERROR(ENOMEM);
+ if ((ret = ff_get_extradata(NULL, vst->codecpar, pb, size)) < 0)
+ return ret;
size = 0;
if (!myth)
return 0;
ast->codecpar->bits_per_coded_sample = avio_rl32(pb);
ast->codecpar->channels = avio_rl32(pb);
ast->codecpar->channel_layout = 0;
+ if (ast->codecpar->channels <= 0) {
+ av_log(s, AV_LOG_ERROR, "Invalid channels %d\n", ast->codecpar->channels);
+ return AVERROR_INVALIDDATA;
+ }
id = ff_wav_codec_get_id(ast->codecpar->codec_tag,
ast->codecpar->bits_per_coded_sample);
memcpy(pkt->data, hdr, copyhdrsize);
ret = avio_read(pb, pkt->data + copyhdrsize, size);
if (ret < 0) {
- av_packet_unref(pkt);
return ret;
}
if (ret < size)
}
-AVInputFormat ff_nuv_demuxer = {
+const AVInputFormat ff_nuv_demuxer = {
.name = "nuv",
.long_name = NULL_IF_CONFIG_SMALL("NuppelVideo"),
.priv_data_size = sizeof(NUVContext),