Revision be187388 libavcodec/ac3enc.c

View differences:

libavcodec/ac3enc.c
1657 1657
    if (s->cutoff > (s->sample_rate >> 1))
1658 1658
        s->cutoff = s->sample_rate >> 1;
1659 1659

  
1660
    /* validate audio service type / channels combination */
1661
    if ((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_KARAOKE &&
1662
         avctx->channels == 1) ||
1663
        ((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_COMMENTARY ||
1664
          avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_EMERGENCY  ||
1665
          avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_VOICE_OVER)
1666
         && avctx->channels > 1)) {
1667
        av_log(avctx, AV_LOG_ERROR, "invalid audio service type for the "
1668
                                    "specified number of channels\n");
1669
        return AVERROR(EINVAL);
1670
    }
1671

  
1660 1672
    return 0;
1661 1673
}
1662 1674

  
......
1799 1811
        return ret;
1800 1812

  
1801 1813
    s->bitstream_id   = 8 + s->bit_alloc.sr_shift;
1802
    s->bitstream_mode = 0; /* complete main audio service */
1814
    s->bitstream_mode = avctx->audio_service_type;
1815
    if (s->bitstream_mode == AV_AUDIO_SERVICE_TYPE_KARAOKE)
1816
        s->bitstream_mode = 0x7;
1803 1817

  
1804 1818
    s->frame_size_min  = 2 * ff_ac3_frame_size_tab[s->frame_size_code][s->bit_alloc.sr_code];
1805 1819
    s->bits_written    = 0;

Also available in: Unified diff