static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)

{

    AVStream *st;

    enum AVAudioServiceType *ast;

    int eac3info, acmod, lfeon, bsmod;



    if (c->fc->nb_streams < 1)

        return 0;

    st = c->fc->streams[c->fc->nb_streams-1];



    ast = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE,

                                                            sizeof(*ast));

    if (!ast)

        return AVERROR(ENOMEM);



    /* No need to parse fields for additional independent substreams and its

     * associated dependent substreams since libavcodec's E-AC-3 decoder

     * does not support them yet. */

    avio_rb16(pb); /* data_rate and num_ind_sub */

    eac3info = avio_rb24(pb);

    bsmod = (eac3info >> 12) & 0x1f;

    acmod = (eac3info >>  9) & 0x7;

    lfeon = (eac3info >>  8) & 0x1;

    st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod];

    if (lfeon)

        st->codec->channel_layout |= AV_CH_LOW_FREQUENCY;

    st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout);

    *ast = bsmod;

    if (st->codec->channels > 1 && bsmod == 0x7)

        *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE;



    st->codec->audio_service_type = *ast;



    return 0;

}

static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)

{

    AVStream *st;

    enum AVAudioServiceType *ast;

    int eac3info, acmod, lfeon, bsmod;



    if (c->fc->nb_streams < 1)

        return 0;

    st = c->fc->streams[c->fc->nb_streams-1];



    ast = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE,

                                                            sizeof(*ast));

    if (!ast)

        return AVERROR(ENOMEM);



    





    avio_rb16(pb); 

    eac3info = avio_rb24(pb);

    bsmod = (eac3info >> 12) & 0x1f;

    acmod = (eac3info >>  9) & 0x7;

    lfeon = (eac3info >>  8) & 0x1;

    st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod];

    if (lfeon)

        st->codec->channel_layout |= AV_CH_LOW_FREQUENCY;

    st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout);

    *ast = bsmod;

    if (st->codec->channels > 1 && bsmod == 0x7)

        *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE;



    st->codec->audio_service_type = *ast;



    return 0;

}

static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)

{

    AVStream *st;

    enum AVAudioServiceType *VAR_3;

    int VAR_4, VAR_5, VAR_6, VAR_7;



    if (VAR_0->fc->nb_streams < 1)

        return 0;

    st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];



    VAR_3 = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE,

                                                            sizeof(*VAR_3));

    if (!VAR_3)

        return AVERROR(ENOMEM);



    





    avio_rb16(VAR_1); 

    VAR_4 = avio_rb24(VAR_1);

    VAR_7 = (VAR_4 >> 12) & 0x1f;

    VAR_5 = (VAR_4 >>  9) & 0x7;

    VAR_6 = (VAR_4 >>  8) & 0x1;

    st->codec->channel_layout = avpriv_ac3_channel_layout_tab[VAR_5];

    if (VAR_6)

        st->codec->channel_layout |= AV_CH_LOW_FREQUENCY;

    st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout);

    *VAR_3 = VAR_7;

    if (st->codec->channels > 1 && VAR_7 == 0x7)

        *VAR_3 = AV_AUDIO_SERVICE_TYPE_KARAOKE;



    st->codec->audio_service_type = *VAR_3;



    return 0;

}

static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)
{ AVStream *st; enum AVAudioServiceType *VAR_3; int VAR_4, VAR_5, VAR_6, VAR_7; if (VAR_0->fc->nb_streams < 1)
return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; VAR_3 = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE,
sizeof(*VAR_3)); if (!VAR_3)
return AVERROR(ENOMEM); avio_rb16(VAR_1); VAR_4 = avio_rb24(VAR_1); VAR_7 = (VAR_4 >> 12) & 0x1f; VAR_5 = (VAR_4 >>  9) & 0x7; VAR_6 = (VAR_4 >>  8) & 0x1; st->codec->channel_layout = avpriv_ac3_channel_layout_tab[VAR_5]; if (VAR_6)
st->codec->channel_layout |= AV_CH_LOW_FREQUENCY; st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout); *VAR_3 = VAR_7; if (st->codec->channels > 1 && VAR_7 == 0x7)
*VAR_3 = AV_AUDIO_SERVICE_TYPE_KARAOKE; st->codec->audio_service_type = *VAR_3; return 0; }