static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length)

{

    const uint8_t *buf_ptr, *end_ptr;

    uint8_t *data_ptr;

    int i;



    if (length > 61444) /* worst case PAL 1920 samples 8 channels */

        return -1;

    av_new_packet(pkt, length);

    avio_read(pb, pkt->data, length);

    data_ptr = pkt->data;

    end_ptr = pkt->data + length;

    buf_ptr = pkt->data + 4; /* skip SMPTE 331M header */

    for (; buf_ptr < end_ptr; ) {

        for (i = 0; i < st->codec->channels; i++) {

            uint32_t sample = bytestream_get_le32(&buf_ptr);

            if (st->codec->bits_per_coded_sample == 24)

                bytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff);

            else

                bytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff);

        }

        buf_ptr += 32 - st->codec->channels*4; // always 8 channels stored SMPTE 331M

    }

    pkt->size = data_ptr - pkt->data;

    return 0;

}

static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length)

{

    const uint8_t *buf_ptr, *end_ptr;

    uint8_t *data_ptr;

    int i;



    if (length > 61444) 

        return -1;

    av_new_packet(pkt, length);

    avio_read(pb, pkt->data, length);

    data_ptr = pkt->data;

    end_ptr = pkt->data + length;

    buf_ptr = pkt->data + 4; 

    for (; buf_ptr < end_ptr; ) {

        for (i = 0; i < st->codec->channels; i++) {

            uint32_t sample = bytestream_get_le32(&buf_ptr);

            if (st->codec->bits_per_coded_sample == 24)

                bytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff);

            else

                bytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff);

        }

        buf_ptr += 32 - st->codec->channels*4; 

    }

    pkt->size = data_ptr - pkt->data;

    return 0;

}

    av_new_packet(pkt, length);     avio_read(pb, pkt->data, length);     for (; buf_ptr < end_ptr; ) {     pkt->size = data_ptr - pkt->data;
static int FUNC_0(AVIOContext *VAR_0, AVStream *VAR_1, AVPacket *VAR_2, int64_t VAR_3)

{

    const uint8_t *VAR_4, *end_ptr;

    uint8_t *data_ptr;

    int VAR_5;



    if (VAR_3 > 61444) 

        return -1;

    av_new_packet(VAR_2, VAR_3);

    avio_read(VAR_0, VAR_2->data, VAR_3);

    data_ptr = VAR_2->data;

    end_ptr = VAR_2->data + VAR_3;

    VAR_4 = VAR_2->data + 4; 

    for (; VAR_4 < end_ptr; ) {

        for (VAR_5 = 0; VAR_5 < VAR_1->codec->channels; VAR_5++) {

            uint32_t sample = bytestream_get_le32(&VAR_4);

            if (VAR_1->codec->bits_per_coded_sample == 24)

                bytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff);

            else

                bytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff);

        }

        VAR_4 += 32 - VAR_1->codec->channels*4; 

    }

    VAR_2->size = data_ptr - VAR_2->data;

    return 0;

}

static int FUNC_0(AVIOContext *VAR_0, AVStream *VAR_1, AVPacket *VAR_2, int64_t VAR_3)
{ const uint8_t *VAR_4, *end_ptr; uint8_t *data_ptr; int VAR_5; if (VAR_3 > 61444)
return -1; av_new_packet(VAR_2, VAR_3); avio_read(VAR_0, VAR_2->data, VAR_3); data_ptr = VAR_2->data; end_ptr = VAR_2->data + VAR_3; VAR_4 = VAR_2->data + 4; for (; VAR_4 < end_ptr; ) { for (VAR_5 = 0; VAR_5 < VAR_1->codec->channels; VAR_5++) { uint32_t sample = bytestream_get_le32(&VAR_4); if (VAR_1->codec->bits_per_coded_sample == 24)
bytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff); else
bytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff); } VAR_4 += 32 - VAR_1->codec->channels*4; } VAR_2->size = data_ptr - VAR_2->data; return 0; }