[FFmpeg-devel] [PATCH v2] avformat/westwood_aud: Adds PCM format demux.
Tomas Härdin
tjoppen at acc.umu.se
Wed Mar 20 15:26:44 EET 2019
tis 2019-03-19 klockan 22:53 +0000 skrev Aidan R:
> @@ -69,13 +75,25 @@ static int wsaud_probe(AVProbeData *p)
> if (p->buf[10] & 0xFC)
> return 0;
>
> - if (p->buf[11] != 99 && p->buf[11] != 1)
> + /* valid format values are 99 == adpcm, 1 == snd1 and 0 == pcm */
> + if (p->buf[11] != 99 && p->buf[11] != 1 && p->buf[11] != 0)
> return 0;
>
> - /* read ahead to the first audio chunk and validate the first header signature */
> - if (AV_RL32(&p->buf[16]) != AUD_CHUNK_SIGNATURE)
> + /* read ahead to the first audio chunk and validate the first header
> + * signature pcm format does not use a chunk format, so don't check
Missing a period between "pcm" and "format"?
> @@ -130,20 +161,24 @@ static int wsaud_read_packet(AVFormatContext *s,
> AVPacket *pkt)
> {
> AVIOContext *pb = s->pb;
> + AUDDemuxContext *aud = s->priv_data;
> unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE];
> - unsigned int chunk_size;
> + unsigned int chunk_size, bytes_per_sample;
> int ret = 0;
> AVStream *st = s->streams[0];
>
> - if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
> - AUD_CHUNK_PREAMBLE_SIZE)
> - return AVERROR(EIO);
> + /* AUD files don't store PCM audio in chunks */
> + if (st->codecpar->codec_id != AV_CODEC_ID_PCM_S16LE) {
What about AV_CODEC_ID_PCM_U8?
A sample + FATE test for this would be nice
/Tomas
More information about the ffmpeg-devel
mailing list