Revision 868170c4

View differences:

libavcodec/mlp.h
26 26

  
27 27
#include "avcodec.h"
28 28

  
29
/** Last possible matrix channel for each codec */
30
#define MAX_MATRIX_CHANNEL_MLP      5
31
#define MAX_MATRIX_CHANNEL_TRUEHD   7
29 32
/** Maximum number of channels that can be decoded. */
30 33
#define MAX_CHANNELS        16
31 34

  
libavcodec/mlpdec.c
335 335
    uint8_t checksum;
336 336
    uint8_t lossless_check;
337 337
    int start_count = get_bits_count(gbp);
338
    const int max_matrix_channel = m->avctx->codec_id == CODEC_ID_MLP
339
                                 ? MAX_MATRIX_CHANNEL_MLP
340
                                 : MAX_MATRIX_CHANNEL_TRUEHD;
338 341

  
339 342
    sync_word = get_bits(gbp, 13);
340 343
    s->noise_type = get_bits1(gbp);
......
352 355
    s->max_channel        = get_bits(gbp, 4);
353 356
    s->max_matrix_channel = get_bits(gbp, 4);
354 357

  
358
    if (s->max_matrix_channel > max_matrix_channel) {
359
        av_log(m->avctx, AV_LOG_ERROR,
360
               "Max matrix channel cannot be greater than %d.\n",
361
               max_matrix_channel);
362
        return -1;
363
    }
364

  
365
    if (s->max_channel != s->max_matrix_channel) {
366
        av_log(m->avctx, AV_LOG_ERROR,
367
               "Max channel must be equal max matrix channel.\n");
368
        return -1;
369
    }
370

  
355 371
    if (s->min_channel > s->max_channel) {
356 372
        av_log(m->avctx, AV_LOG_ERROR,
357 373
               "Substream min channel cannot be greater than max channel.\n");

Also available in: Unified diff