[FFmpeg-devel] [PATCH] avformat/westwood_aud: Adds PCM format demux.

Tomas Härdin tjoppen at acc.umu.se
Thu Feb 28 23:06:31 EET 2019


ons 2019-02-27 klockan 23:12 +0000 skrev Aidan R:
> PCM format AUD files are found in Westwood's Blade Runner game.

Do we have samples for this?

> @@ -100,6 +119,15 @@ static int wsaud_read_header(AVFormatContext *s)
>          return AVERROR(ENOMEM);
>  
>      switch (codec) {
> +    case  0:
> +        if (bits_per_sample == 8) {
> +            st->codecpar->codec_id = AV_CODEC_ID_PCM_U8;
> +        } else {
> +            st->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE;
> +        }
> +        st->codecpar->bits_per_coded_sample = bits_per_sample;
> +        st->codecpar->bit_rate = channels * sample_rate * bits_per_sample;
> +        break;
>      case  1:
>          if (channels != 1) {
>              avpriv_request_sample(s, "Stereo WS-SND1");
> @@ -130,20 +158,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 u8?

/Tomas


More information about the ffmpeg-devel mailing list