Revision 1af99b02

View differences:

libavformat/iff.c
88 88
    uint32_t  body_size;
89 89
    uint32_t  sent_bytes;
90 90
    uint32_t  audio_frame_count;
91
    unsigned  compression;  ///< delta compression method used
91
    svx8_compression_type   svx8_compression;
92
    bitmap_compression_type bitmap_compression;  ///< delta compression method used
92 93
    unsigned  bpp;          ///< bits per plane to decode (differs from bits_per_coded_sample if HAM)
93 94
    unsigned  ham;          ///< 0 if non-HAM or number of hold bits (6 for bpp > 6, 4 otherwise)
94 95
    unsigned  flags;        ///< 1 for EHB, 0 is no extra half darkening
......
146 147
    AVStream *st;
147 148
    uint8_t *buf;
148 149
    uint32_t chunk_id, data_size;
149
    int compression = -1;
150 150
    uint32_t screenmode = 0;
151 151
    unsigned transparency = 0;
152 152
    unsigned masking = 0; // no mask
......
178 178
            st->codec->sample_rate = avio_rb16(pb);
179 179
            if (data_size >= 16) {
180 180
                avio_skip(pb, 1);
181
                compression        = avio_r8(pb);
181
                iff->svx8_compression = avio_r8(pb);
182 182
            }
183 183
            break;
184 184

  
......
209 209
            break;
210 210

  
211 211
        case ID_BMHD:
212
            iff->bitmap_compression = -1;
212 213
            st->codec->codec_type            = AVMEDIA_TYPE_VIDEO;
213 214
            if (data_size <= 8)
214 215
                return AVERROR_INVALIDDATA;
......
219 220
            if (data_size >= 10)
220 221
                masking                      = avio_r8(pb);
221 222
            if (data_size >= 11)
222
                compression                  = avio_r8(pb);
223
                iff->bitmap_compression      = avio_r8(pb);
223 224
            if (data_size >= 14) {
224 225
                avio_skip(pb, 1); // padding
225 226
                transparency                 = avio_rb16(pb);
......
263 264
    case AVMEDIA_TYPE_AUDIO:
264 265
        av_set_pts_info(st, 32, 1, st->codec->sample_rate);
265 266

  
266
        switch(compression) {
267
        switch (iff->svx8_compression) {
267 268
        case COMP_NONE:
268 269
            st->codec->codec_id = CODEC_ID_PCM_S8;
269 270
            break;
......
274 275
            st->codec->codec_id = CODEC_ID_8SVX_EXP;
275 276
            break;
276 277
        default:
277
            av_log(s, AV_LOG_ERROR, "unknown compression method\n");
278
            av_log(s, AV_LOG_ERROR,
279
                   "Unknown SVX8 compression method '%d'\n", iff->svx8_compression);
278 280
            return -1;
279 281
        }
280 282

  
......
284 286
        break;
285 287

  
286 288
    case AVMEDIA_TYPE_VIDEO:
287
        iff->compression  = compression;
288 289
        iff->bpp          = st->codec->bits_per_coded_sample;
289 290
        if ((screenmode & 0x800 /* Hold And Modify */) && iff->bpp <= 8) {
290 291
            iff->ham      = iff->bpp > 6 ? 6 : 4;
......
302 303
        }
303 304
        buf = st->codec->extradata;
304 305
        bytestream_put_be16(&buf, IFF_EXTRA_VIDEO_SIZE);
305
        bytestream_put_byte(&buf, iff->compression);
306
        bytestream_put_byte(&buf, iff->bitmap_compression);
306 307
        bytestream_put_byte(&buf, iff->bpp);
307 308
        bytestream_put_byte(&buf, iff->ham);
308 309
        bytestream_put_byte(&buf, iff->flags);
309 310
        bytestream_put_be16(&buf, iff->transparency);
310 311
        bytestream_put_byte(&buf, iff->masking);
311 312

  
312
        switch (compression) {
313
        switch (iff->bitmap_compression) {
313 314
        case BITMAP_RAW:
314 315
            st->codec->codec_id = CODEC_ID_IFF_ILBM;
315 316
            break;
......
317 318
            st->codec->codec_id = CODEC_ID_IFF_BYTERUN1;
318 319
            break;
319 320
        default:
320
            av_log(s, AV_LOG_ERROR, "unknown compression method\n");
321
            av_log(s, AV_LOG_ERROR,
322
                   "Unknown bitmap compression method '%d'\n", iff->bitmap_compression);
321 323
            return AVERROR_INVALIDDATA;
322 324
        }
323 325
        break;

Also available in: Unified diff