[FFmpeg-devel] [PATCH v2] avformat/westwood_aud: Adds PCM format demux.
Aidan R
aidan.is at hotmail.co.uk
Wed Mar 20 17:56:14 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"?
Missing after signature after re-reading it myself.
>
>> @@ -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?
Good catch, I don't think any actually exist in the wild, but I have supported
the possibility in wsaud_read_header and from looking at the audio engine it
looks to support it in theory.
>
>A sample + FATE test for this would be nice
Some guidance on where to start for that would be most welcome. I have short
examples from Blade Runner that could be used but wouldn't distributing them
violate copyright?
--
Aidan Richmond
More information about the ffmpeg-devel
mailing list