static int pcm_encode_frame(AVCodecContext *avctx,

			    unsigned char *frame, int buf_size, void *data)

{

    int n, sample_size, v;

    short *samples;

    unsigned char *dst;



    switch(avctx->codec->id) {

    case CODEC_ID_PCM_S16LE:

    case CODEC_ID_PCM_S16BE:

    case CODEC_ID_PCM_U16LE:

    case CODEC_ID_PCM_U16BE:

        sample_size = 2;

        break;

    default:

        sample_size = 1;

        break;

    }

    n = buf_size / sample_size;

    samples = data;

    dst = frame;



    switch(avctx->codec->id) {

    case CODEC_ID_PCM_S16LE:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = v & 0xff;

            dst[1] = v >> 8;

            dst += 2;

        }

        break;

    case CODEC_ID_PCM_S16BE:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = v >> 8;

            dst[1] = v;

            dst += 2;

        }

        break;

    case CODEC_ID_PCM_U16LE:

        for(;n>0;n--) {

            v = *samples++;

            v += 0x8000;

            dst[0] = v & 0xff;

            dst[1] = v >> 8;

            dst += 2;

        }

        break;

    case CODEC_ID_PCM_U16BE:

        for(;n>0;n--) {

            v = *samples++;

            v += 0x8000;

            dst[0] = v >> 8;

            dst[1] = v;

            dst += 2;

        }

        break;

    case CODEC_ID_PCM_S8:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = (v + 128) >> 8;

            dst++;

        }

        break;

    case CODEC_ID_PCM_U8:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = ((v + 128) >> 8) + 128;

            dst++;

        }

        break;

    case CODEC_ID_PCM_ALAW:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = linear_to_alaw[(v + 32768) >> 2];

            dst++;

        }

        break;

    case CODEC_ID_PCM_MULAW:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = linear_to_ulaw[(v + 32768) >> 2];

            dst++;

        }

        break;

    default:

        return -1;

    }

    avctx->key_frame = 1;

    //avctx->frame_size = (dst - frame) / (sample_size * avctx->channels);



    return dst - frame;

}

static int pcm_encode_frame(AVCodecContext *avctx,

			    unsigned char *frame, int buf_size, void *data)

{

    int n, sample_size, v;

    short *samples;

    unsigned char *dst;



    switch(avctx->codec->id) {

    case CODEC_ID_PCM_S16LE:

    case CODEC_ID_PCM_S16BE:

    case CODEC_ID_PCM_U16LE:

    case CODEC_ID_PCM_U16BE:

        sample_size = 2;

        break;

    default:

        sample_size = 1;

        break;

    }

    n = buf_size / sample_size;

    samples = data;

    dst = frame;



    switch(avctx->codec->id) {

    case CODEC_ID_PCM_S16LE:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = v & 0xff;

            dst[1] = v >> 8;

            dst += 2;

        }

        break;

    case CODEC_ID_PCM_S16BE:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = v >> 8;

            dst[1] = v;

            dst += 2;

        }

        break;

    case CODEC_ID_PCM_U16LE:

        for(;n>0;n--) {

            v = *samples++;

            v += 0x8000;

            dst[0] = v & 0xff;

            dst[1] = v >> 8;

            dst += 2;

        }

        break;

    case CODEC_ID_PCM_U16BE:

        for(;n>0;n--) {

            v = *samples++;

            v += 0x8000;

            dst[0] = v >> 8;

            dst[1] = v;

            dst += 2;

        }

        break;

    case CODEC_ID_PCM_S8:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = (v + 128) >> 8;

            dst++;

        }

        break;

    case CODEC_ID_PCM_U8:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = ((v + 128) >> 8) + 128;

            dst++;

        }

        break;

    case CODEC_ID_PCM_ALAW:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = linear_to_alaw[(v + 32768) >> 2];

            dst++;

        }

        break;

    case CODEC_ID_PCM_MULAW:

        for(;n>0;n--) {

            v = *samples++;

            dst[0] = linear_to_ulaw[(v + 32768) >> 2];

            dst++;

        }

        break;

    default:

        return -1;

    }

    avctx->key_frame = 1;

    



    return dst - frame;

}

            dst[0] = (v + 128) >> 8;             dst[0] = ((v + 128) >> 8) + 128;
static int FUNC_0(AVCodecContext *VAR_0,

			    unsigned char *VAR_1, int VAR_2, void *VAR_3)

{

    int VAR_4, VAR_5, VAR_6;

    short *VAR_7;

    unsigned char *VAR_8;



    switch(VAR_0->codec->id) {

    case CODEC_ID_PCM_S16LE:

    case CODEC_ID_PCM_S16BE:

    case CODEC_ID_PCM_U16LE:

    case CODEC_ID_PCM_U16BE:

        VAR_5 = 2;

        break;

    default:

        VAR_5 = 1;

        break;

    }

    VAR_4 = VAR_2 / VAR_5;

    VAR_7 = VAR_3;

    VAR_8 = VAR_1;



    switch(VAR_0->codec->id) {

    case CODEC_ID_PCM_S16LE:

        for(;VAR_4>0;VAR_4--) {

            VAR_6 = *VAR_7++;

            VAR_8[0] = VAR_6 & 0xff;

            VAR_8[1] = VAR_6 >> 8;

            VAR_8 += 2;

        }

        break;

    case CODEC_ID_PCM_S16BE:

        for(;VAR_4>0;VAR_4--) {

            VAR_6 = *VAR_7++;

            VAR_8[0] = VAR_6 >> 8;

            VAR_8[1] = VAR_6;

            VAR_8 += 2;

        }

        break;

    case CODEC_ID_PCM_U16LE:

        for(;VAR_4>0;VAR_4--) {

            VAR_6 = *VAR_7++;

            VAR_6 += 0x8000;

            VAR_8[0] = VAR_6 & 0xff;

            VAR_8[1] = VAR_6 >> 8;

            VAR_8 += 2;

        }

        break;

    case CODEC_ID_PCM_U16BE:

        for(;VAR_4>0;VAR_4--) {

            VAR_6 = *VAR_7++;

            VAR_6 += 0x8000;

            VAR_8[0] = VAR_6 >> 8;

            VAR_8[1] = VAR_6;

            VAR_8 += 2;

        }

        break;

    case CODEC_ID_PCM_S8:

        for(;VAR_4>0;VAR_4--) {

            VAR_6 = *VAR_7++;

            VAR_8[0] = (VAR_6 + 128) >> 8;

            VAR_8++;

        }

        break;

    case CODEC_ID_PCM_U8:

        for(;VAR_4>0;VAR_4--) {

            VAR_6 = *VAR_7++;

            VAR_8[0] = ((VAR_6 + 128) >> 8) + 128;

            VAR_8++;

        }

        break;

    case CODEC_ID_PCM_ALAW:

        for(;VAR_4>0;VAR_4--) {

            VAR_6 = *VAR_7++;

            VAR_8[0] = linear_to_alaw[(VAR_6 + 32768) >> 2];

            VAR_8++;

        }

        break;

    case CODEC_ID_PCM_MULAW:

        for(;VAR_4>0;VAR_4--) {

            VAR_6 = *VAR_7++;

            VAR_8[0] = linear_to_ulaw[(VAR_6 + 32768) >> 2];

            VAR_8++;

        }

        break;

    default:

        return -1;

    }

    VAR_0->key_frame = 1;

    



    return VAR_8 - VAR_1;

}

static int FUNC_0(AVCodecContext *VAR_0,
unsigned char *VAR_1, int VAR_2, void *VAR_3)
{ int VAR_4, VAR_5, VAR_6; short *VAR_7; unsigned char *VAR_8; switch(VAR_0->codec->id) { case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_U16LE:
case CODEC_ID_PCM_U16BE:
VAR_5 = 2; break; default:
VAR_5 = 1; break; } VAR_4 = VAR_2 / VAR_5; VAR_7 = VAR_3; VAR_8 = VAR_1; switch(VAR_0->codec->id) { case CODEC_ID_PCM_S16LE:
for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_7++; VAR_8[0] = VAR_6 & 0xff; VAR_8[1] = VAR_6 >> 8; VAR_8 += 2; } break; case CODEC_ID_PCM_S16BE:
for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_7++; VAR_8[0] = VAR_6 >> 8; VAR_8[1] = VAR_6; VAR_8 += 2; } break; case CODEC_ID_PCM_U16LE:
for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_7++; VAR_6 += 0x8000; VAR_8[0] = VAR_6 & 0xff; VAR_8[1] = VAR_6 >> 8; VAR_8 += 2; } break; case CODEC_ID_PCM_U16BE:
for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_7++; VAR_6 += 0x8000; VAR_8[0] = VAR_6 >> 8; VAR_8[1] = VAR_6; VAR_8 += 2; } break; case CODEC_ID_PCM_S8:
for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_7++; VAR_8[0] = (VAR_6 + 128) >> 8; VAR_8++; } break; case CODEC_ID_PCM_U8:
for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_7++; VAR_8[0] = ((VAR_6 + 128) >> 8) + 128; VAR_8++; } break; case CODEC_ID_PCM_ALAW:
for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_7++; VAR_8[0] = linear_to_alaw[(VAR_6 + 32768) >> 2]; VAR_8++; } break; case CODEC_ID_PCM_MULAW:
for(;VAR_4>0;VAR_4--) { VAR_6 = *VAR_7++; VAR_8[0] = linear_to_ulaw[(VAR_6 + 32768) >> 2]; VAR_8++; } break; default:
return -1; } VAR_0->key_frame = 1; return VAR_8 - VAR_1; }