static int mp3_header_compress(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,

                     uint8_t **poutbuf, int *poutbuf_size,

                     const uint8_t *buf, int buf_size, int keyframe){

    uint32_t header;

    int mode_extension;



    if(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){

        av_log(avctx, AV_LOG_ERROR, "not standards compliant\n");

        return -1;

    }



    header = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];

    mode_extension= (header>>4)&3;



    if(ff_mpa_check_header(header) < 0 || (header&0x70000) != 0x30000){

        *poutbuf= (uint8_t *) buf;

        *poutbuf_size= buf_size;



        av_log(avctx, AV_LOG_INFO, "cannot compress %08X\n", header);

        return 0;

    }



    *poutbuf_size= buf_size - 4;

    *poutbuf= av_malloc(buf_size - 4 + FF_INPUT_BUFFER_PADDING_SIZE);

    memcpy(*poutbuf, buf + 4, buf_size - 4 + FF_INPUT_BUFFER_PADDING_SIZE);



    if(avctx->channels==2){

        if((header & (3<<19)) != 3<<19){

            (*poutbuf)[1] &= 0x3F;

            (*poutbuf)[1] |= mode_extension<<6;

            FFSWAP(int, (*poutbuf)[1], (*poutbuf)[2]);

        }else{

            (*poutbuf)[1] &= 0x8F;

            (*poutbuf)[1] |= mode_extension<<4;

        }

    }



    return 1;

}

static int mp3_header_compress(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,

                     uint8_t **poutbuf, int *poutbuf_size,

                     const uint8_t *buf, int buf_size, int keyframe){

    uint32_t header;

    int mode_extension;



    if(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){

        av_log(avctx, AV_LOG_ERROR, "not standards compliant\n");

        return -1;

    }



    header = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];

    mode_extension= (header>>4)&3;



    if(ff_mpa_check_header(header) < 0 || (header&0x70000) != 0x30000){

        *poutbuf= (uint8_t *) buf;

        *poutbuf_size= buf_size;



        av_log(avctx, AV_LOG_INFO, "cannot compress %08X\n", header);

        return 0;

    }



    *poutbuf_size= buf_size - 4;

    *poutbuf= av_malloc(buf_size - 4 + FF_INPUT_BUFFER_PADDING_SIZE);

    memcpy(*poutbuf, buf + 4, buf_size - 4 + FF_INPUT_BUFFER_PADDING_SIZE);



    if(avctx->channels==2){

        if((header & (3<<19)) != 3<<19){

            (*poutbuf)[1] &= 0x3F;

            (*poutbuf)[1] |= mode_extension<<6;

            FFSWAP(int, (*poutbuf)[1], (*poutbuf)[2]);

        }else{

            (*poutbuf)[1] &= 0x8F;

            (*poutbuf)[1] |= mode_extension<<4;

        }

    }



    return 1;

}

static int FUNC_0(AVBitStreamFilterContext *VAR_0, AVCodecContext *VAR_1, const char *VAR_2,

                     uint8_t **VAR_3, int *VAR_4,

                     const uint8_t *VAR_5, int VAR_6, int VAR_7){

    uint32_t header;

    int VAR_8;



    if(VAR_1->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){

        av_log(VAR_1, AV_LOG_ERROR, "not standards compliant\n");

        return -1;

    }



    header = (VAR_5[0] << 24) | (VAR_5[1] << 16) | (VAR_5[2] << 8) | VAR_5[3];

    VAR_8= (header>>4)&3;



    if(ff_mpa_check_header(header) < 0 || (header&0x70000) != 0x30000){

        *VAR_3= (uint8_t *) VAR_5;

        *VAR_4= VAR_6;



        av_log(VAR_1, AV_LOG_INFO, "cannot compress %08X\n", header);

        return 0;

    }



    *VAR_4= VAR_6 - 4;

    *VAR_3= av_malloc(VAR_6 - 4 + FF_INPUT_BUFFER_PADDING_SIZE);

    memcpy(*VAR_3, VAR_5 + 4, VAR_6 - 4 + FF_INPUT_BUFFER_PADDING_SIZE);



    if(VAR_1->channels==2){

        if((header & (3<<19)) != 3<<19){

            (*VAR_3)[1] &= 0x3F;

            (*VAR_3)[1] |= VAR_8<<6;

            FFSWAP(int, (*VAR_3)[1], (*VAR_3)[2]);

        }else{

            (*VAR_3)[1] &= 0x8F;

            (*VAR_3)[1] |= VAR_8<<4;

        }

    }



    return 1;

}

static int FUNC_0(AVBitStreamFilterContext *VAR_0, AVCodecContext *VAR_1, const char *VAR_2,
uint8_t **VAR_3, int *VAR_4,
const uint8_t *VAR_5, int VAR_6, int VAR_7){ uint32_t header; int VAR_8; if(VAR_1->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){ av_log(VAR_1, AV_LOG_ERROR, "not standards compliant\n"); return -1; } header = (VAR_5[0] << 24) | (VAR_5[1] << 16) | (VAR_5[2] << 8) | VAR_5[3]; VAR_8= (header>>4)&3; if(ff_mpa_check_header(header) < 0 || (header&0x70000) != 0x30000){ *VAR_3= (uint8_t *) VAR_5; *VAR_4= VAR_6; av_log(VAR_1, AV_LOG_INFO, "cannot compress %08X\n", header); return 0; } *VAR_4= VAR_6 - 4; *VAR_3= av_malloc(VAR_6 - 4 + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(*VAR_3, VAR_5 + 4, VAR_6 - 4 + FF_INPUT_BUFFER_PADDING_SIZE); if(VAR_1->channels==2){ if((header & (3<<19)) != 3<<19){ (*VAR_3)[1] &= 0x3F; (*VAR_3)[1] |= VAR_8<<6; FFSWAP(int, (*VAR_3)[1], (*VAR_3)[2]); }else{ (*VAR_3)[1] &= 0x8F; (*VAR_3)[1] |= VAR_8<<4; } } return 1; }