[FFmpeg-devel] [PATCH] iff: support IFF MAUD

Paul B Mahol onemda at gmail.com
Thu Nov 29 10:38:50 CET 2012


On 11/29/12, Paul B Mahol <onemda at gmail.com> wrote:
>> On Thu, Nov 29, 2012 at 06:06:59AM +0100, Piotr Bandurski wrote:
>> info:
>>
>> http://lclevy.free.fr/amiga/MAUDINFO.TXT
>>
>> samples:
>>
>> http://www.datafilehost.com/download-e7d22dd6.html
>>
>> diff --git a/libavformat/iff.c b/libavformat/iff.c
>> index c8936d3..18d8f31 100644
>> --- a/libavformat/iff.c
>> +++ b/libavformat/iff.c
>> @@ -38,6 +38,9 @@
>>
>>  #define ID_8SVX       MKTAG('8','S','V','X')
>>  #define ID_16SV       MKTAG('1','6','S','V')
>> +#define ID_MAUD       MKTAG('M','A','U','D')
>> +#define ID_MHDR       MKTAG('M','H','D','R')
>> +#define ID_MDAT       MKTAG('M','D','A','T')
>>  #define ID_VHDR       MKTAG('V','H','D','R')
>>  #define ID_ATAK       MKTAG('A','T','A','K')
>>  #define ID_RLSE       MKTAG('R','L','S','E')
>> @@ -91,6 +94,8 @@ typedef struct {
>>      uint32_t  body_size;
>>      uint32_t  sent_bytes;
>>      svx8_compression_type   svx8_compression;
>> +    unsigned  maud_bits;
>> +    unsigned  maud_compression;
>>      unsigned  bitmap_compression;  ///< delta compression method used
>>      unsigned  bpp;          ///< bits per plane to decode (differs from
>> bits_per_coded_sample if HAM)
>>      unsigned  ham;          ///< 0 if non-HAM or number of hold bits (6
>> for bpp > 6, 4 otherwise)
>> @@ -125,6 +130,7 @@ static int iff_probe(AVProbeData *p)
>>      if (  AV_RL32(d)   == ID_FORM &&
>>           (AV_RL32(d+8) == ID_8SVX ||
>>            AV_RL32(d+8) == ID_16SV ||
>> +          AV_RL32(d+8) == ID_MAUD ||
>>            AV_RL32(d+8) == ID_PBM  ||
>>            AV_RL32(d+8) == ID_ACBM ||
>>            AV_RL32(d+8) == ID_DEEP ||
>> @@ -184,9 +190,42 @@ static int iff_read_header(AVFormatContext *s)
>>              }
>>              break;
>>
>> +        case ID_MHDR:
>> +            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
>> +
>> +            iff->maud_bits = -1;
>> +            iff->maud_compression = -1;
>> +            if (data_size < 32)
>> +                return AVERROR_INVALIDDATA;
>> +            avio_skip(pb, 4);
>> +            iff->maud_bits = avio_rb16(pb);
>> +            avio_skip(pb, 2);
>> +            st->codec->sample_rate = avio_rb32(pb);
>> +            avio_skip(pb, 4);
>> +            st->codec->channels = avio_rb16(pb);
>> +            iff->maud_compression = avio_rb16(pb);
>> +            if (iff->maud_bits != 8 && iff->maud_bits != 16) {
>> +                av_log_ask_for_sample(s, "unsupported bit depth (%d)",
>> iff->maud_bits);
>> +                return AVERROR_PATCHWELCOME;
>> +            }
>> +            if (st->codec->channels == 1)
>> +                st->codec->channel_layout = AV_CH_LAYOUT_MONO;
>> +            else if (st->codec->channels == 2)
>> +                st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
>> +            else {
>> +                av_log_ask_for_sample(s, "unsupported number of channels
>> (%d)", st->codec->channels);
>> +                return AVERROR_PATCHWELCOME;
>> +            }
>> +            if (iff->maud_compression != 0) {
>> +                av_log_ask_for_sample(s, "unsupported compression (%d)",
>> st->codec->channels);
>
> typo. Samples?

Can be created/read with sox.


More information about the ffmpeg-devel mailing list