static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,

        int *need_next_header, int *new_frame_start)

{

    int err;

    union {

        uint64_t u64;

        uint8_t  u8[8];

    } tmp = { av_be2ne64(state) };

    AC3HeaderInfo hdr, *phdr = &hdr;

    GetBitContext gbc;



    init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);

    err = avpriv_ac3_parse_header2(&gbc, &phdr);



    if(err < 0)

        return 0;



    hdr_info->sample_rate = hdr.sample_rate;

    hdr_info->bit_rate = hdr.bit_rate;

    hdr_info->channels = hdr.channels;

    hdr_info->channel_layout = hdr.channel_layout;

    hdr_info->samples = hdr.num_blocks * 256;

    hdr_info->service_type = hdr.bitstream_mode;

    if (hdr.bitstream_mode == 0x7 && hdr.channels > 1)

        hdr_info->service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;

    if(hdr.bitstream_id>10)

        hdr_info->codec_id = AV_CODEC_ID_EAC3;

    else if (hdr_info->codec_id == AV_CODEC_ID_NONE)

        hdr_info->codec_id = AV_CODEC_ID_AC3;



    *need_next_header = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT);

    *new_frame_start  = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT);

    return hdr.frame_size;

}

static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,

        int *need_next_header, int *new_frame_start)

{

    int err;

    union {

        uint64_t u64;

        uint8_t  u8[8];

    } tmp = { av_be2ne64(state) };

    AC3HeaderInfo hdr, *phdr = &hdr;

    GetBitContext gbc;



    init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);

    err = avpriv_ac3_parse_header2(&gbc, &phdr);



    if(err < 0)

        return 0;



    hdr_info->sample_rate = hdr.sample_rate;

    hdr_info->bit_rate = hdr.bit_rate;

    hdr_info->channels = hdr.channels;

    hdr_info->channel_layout = hdr.channel_layout;

    hdr_info->samples = hdr.num_blocks * 256;

    hdr_info->service_type = hdr.bitstream_mode;

    if (hdr.bitstream_mode == 0x7 && hdr.channels > 1)

        hdr_info->service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;

    if(hdr.bitstream_id>10)

        hdr_info->codec_id = AV_CODEC_ID_EAC3;

    else if (hdr_info->codec_id == AV_CODEC_ID_NONE)

        hdr_info->codec_id = AV_CODEC_ID_AC3;



    *need_next_header = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT);

    *new_frame_start  = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT);

    return hdr.frame_size;

}

        uint8_t  u8[8];         uint8_t  u8[8];
static int FUNC_0(uint64_t VAR_0, AACAC3ParseContext *VAR_1,

        int *VAR_2, int *VAR_3)

{

    int VAR_4;

    union {

        uint64_t u64;

        uint8_t  u8[8];

    } VAR_5 = { av_be2ne64(VAR_0) };

    AC3HeaderInfo hdr, *phdr = &hdr;

    GetBitContext gbc;



    init_get_bits(&gbc, VAR_5.u8+8-AC3_HEADER_SIZE, 54);

    VAR_4 = avpriv_ac3_parse_header2(&gbc, &phdr);



    if(VAR_4 < 0)

        return 0;



    VAR_1->sample_rate = hdr.sample_rate;

    VAR_1->bit_rate = hdr.bit_rate;

    VAR_1->channels = hdr.channels;

    VAR_1->channel_layout = hdr.channel_layout;

    VAR_1->samples = hdr.num_blocks * 256;

    VAR_1->service_type = hdr.bitstream_mode;

    if (hdr.bitstream_mode == 0x7 && hdr.channels > 1)

        VAR_1->service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;

    if(hdr.bitstream_id>10)

        VAR_1->codec_id = AV_CODEC_ID_EAC3;

    else if (VAR_1->codec_id == AV_CODEC_ID_NONE)

        VAR_1->codec_id = AV_CODEC_ID_AC3;



    *VAR_2 = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT);

    *VAR_3  = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT);

    return hdr.frame_size;

}

static int FUNC_0(uint64_t VAR_0, AACAC3ParseContext *VAR_1,
int *VAR_2, int *VAR_3)
{ int VAR_4; union { uint64_t u64; uint8_t  u8[8]; } VAR_5 = { av_be2ne64(VAR_0) }; AC3HeaderInfo hdr, *phdr = &hdr; GetBitContext gbc; init_get_bits(&gbc, VAR_5.u8+8-AC3_HEADER_SIZE, 54); VAR_4 = avpriv_ac3_parse_header2(&gbc, &phdr); if(VAR_4 < 0)
return 0; VAR_1->sample_rate = hdr.sample_rate; VAR_1->bit_rate = hdr.bit_rate; VAR_1->channels = hdr.channels; VAR_1->channel_layout = hdr.channel_layout; VAR_1->samples = hdr.num_blocks * 256; VAR_1->service_type = hdr.bitstream_mode; if (hdr.bitstream_mode == 0x7 && hdr.channels > 1)
VAR_1->service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; if(hdr.bitstream_id>10)
VAR_1->codec_id = AV_CODEC_ID_EAC3; else if (VAR_1->codec_id == AV_CODEC_ID_NONE)
VAR_1->codec_id = AV_CODEC_ID_AC3; *VAR_2 = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT); *VAR_3  = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT); return hdr.frame_size; }