static int mjpeg_decode_com(MJpegDecodeContext *s)

{

    /* XXX: verify len field validity */

    int len = get_bits(&s->gb, 16);

    if (len >= 2 && len < 32768) {

	/* XXX: any better upper bound */

	uint8_t *cbuf = av_malloc(len - 1);

	if (cbuf) {

	    int i;

	    for (i = 0; i < len - 2; i++)

		cbuf[i] = get_bits(&s->gb, 8);

	    if (i > 0 && cbuf[i-1] == '\n')

		cbuf[i-1] = 0;

	    else

		cbuf[i] = 0;



            if(s->avctx->debug & FF_DEBUG_PICT_INFO)

                av_log(s->avctx, AV_LOG_INFO, "mjpeg comment: '%s'\n", cbuf);



	    /* buggy avid, it puts EOI only at every 10th frame */

	    if (!strcmp(cbuf, "AVID"))

	    {

		s->buggy_avid = 1;

		//	if (s->first_picture)

		//	    printf("mjpeg: workarounding buggy AVID\n");

	    }

            else if(!strcmp(cbuf, "CS=ITU601")){

                s->cs_itu601= 1;

            }



	    av_free(cbuf);

	}

    }



    return 0;

}

static int mjpeg_decode_com(MJpegDecodeContext *s)

{

    

    int len = get_bits(&s->gb, 16);

    if (len >= 2 && len < 32768) {

	

	uint8_t *cbuf = av_malloc(len - 1);

	if (cbuf) {

	    int i;

	    for (i = 0; i < len - 2; i++)

		cbuf[i] = get_bits(&s->gb, 8);

	    if (i > 0 && cbuf[i-1] == '\n')

		cbuf[i-1] = 0;

	    else

		cbuf[i] = 0;



            if(s->avctx->debug & FF_DEBUG_PICT_INFO)

                av_log(s->avctx, AV_LOG_INFO, "mjpeg comment: '%s'\n", cbuf);



	    

	    if (!strcmp(cbuf, "AVID"))

	    {

		s->buggy_avid = 1;

		

		

	    }

            else if(!strcmp(cbuf, "CS=ITU601")){

                s->cs_itu601= 1;

            }



	    av_free(cbuf);

	}

    }



    return 0;

}

    if (len >= 2 && len < 32768) {
static int FUNC_0(MJpegDecodeContext *VAR_0)

{

    

    int VAR_1 = get_bits(&VAR_0->gb, 16);

    if (VAR_1 >= 2 && VAR_1 < 32768) {

	

	uint8_t *cbuf = av_malloc(VAR_1 - 1);

	if (cbuf) {

	    int VAR_2;

	    for (VAR_2 = 0; VAR_2 < VAR_1 - 2; VAR_2++)

		cbuf[VAR_2] = get_bits(&VAR_0->gb, 8);

	    if (VAR_2 > 0 && cbuf[VAR_2-1] == '\n')

		cbuf[VAR_2-1] = 0;

	    else

		cbuf[VAR_2] = 0;



            if(VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)

                av_log(VAR_0->avctx, AV_LOG_INFO, "mjpeg comment: '%VAR_0'\n", cbuf);



	    

	    if (!strcmp(cbuf, "AVID"))

	    {

		VAR_0->buggy_avid = 1;

		

		

	    }

            else if(!strcmp(cbuf, "CS=ITU601")){

                VAR_0->cs_itu601= 1;

            }



	    av_free(cbuf);

	}

    }



    return 0;

}

static int FUNC_0(MJpegDecodeContext *VAR_0)
{ int VAR_1 = get_bits(&VAR_0->gb, 16); if (VAR_1 >= 2 && VAR_1 < 32768) { uint8_t *cbuf = av_malloc(VAR_1 - 1); if (cbuf) { int VAR_2; for (VAR_2 = 0; VAR_2 < VAR_1 - 2; VAR_2++) cbuf[VAR_2] = get_bits(&VAR_0->gb, 8); if (VAR_2 > 0 && cbuf[VAR_2-1] == '\n')
cbuf[VAR_2-1] = 0; else
cbuf[VAR_2] = 0; if(VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(VAR_0->avctx, AV_LOG_INFO, "mjpeg comment: '%VAR_0'\n", cbuf); if (!strcmp(cbuf, "AVID"))
{ VAR_0->buggy_avid = 1; } else if(!strcmp(cbuf, "CS=ITU601")){ VAR_0->cs_itu601= 1; } av_free(cbuf); } } return 0; }