skip_bits(&s->gb, 8); skip_bits(&s->gb, 8);
t_w = get_bits(&s->gb, 8); t_h = get_bits(&s->gb, 8); if (t_w && t_h) {  if (len-10-(t_w*t_h*3) > 0) len -= t_w*t_h*3; } len -= 10; goto out; }  if (id == ff_get_fourcc("Adob") && (get_bits(&s->gb, 8) == 'e')) { printf("mjpeg: Adobe header found\n"); skip_bits(&s->gb, 16);  skip_bits(&s->gb, 16);  skip_bits(&s->gb, 16);  skip_bits(&s->gb, 8);  len -= 7;
static int mjpeg_decode_app(MJpegDecodeContext *s){    int len, id;    /* XXX: verify len field validity */    len = get_bits(&s->gb, 16);    if (len < 5)	return -1;    id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16);    id = be2me_32(id);    len -= 6;    /* buggy AVID, it puts EOI only at every 10th frame */    /* also this fourcc is used by non-avid files too, it means       interleaving, but it's always present in AVID files */    if (id == ff_get_fourcc("AVI1"))    {	/* structure:	    4bytes	AVI1	    1bytes	polarity	    1bytes	always zero	    4bytes	field_size	    4bytes	field_size_less_padding	*/    	s->buggy_avid = 1;//	if (s->first_picture)//	    printf("mjpeg: workarounding buggy AVID\n");	s->interlace_polarity = get_bits(&s->gb, 8);#if 0	skip_bits(&s->gb, 8);	skip_bits(&s->gb, 32);	skip_bits(&s->gb, 32);	len -= 10;#endif//	if (s->interlace_polarity)//	    printf("mjpeg: interlace polarity: %d\n", s->interlace_polarity);	goto out;    }        len -= 2;        if (id == ff_get_fourcc("JFIF"))    {	skip_bits(&s->gb, 8); /* the trailing zero-byte */	printf("mjpeg: JFIF header found (version: %x.%x)\n",	    get_bits(&s->gb, 8), get_bits(&s->gb, 8));	if (get_bits(&s->gb, 8) == 0)	{	    s->avctx->aspect_ratio_info = FF_ASPECT_EXTENDED;	    s->avctx->aspected_width = get_bits(&s->gb, 16);	    s->avctx->aspected_height = get_bits(&s->gb, 16);	}	else	{	    skip_bits(&s->gb, 16);	    skip_bits(&s->gb, 16);	}	skip_bits(&s->gb, 8);	skip_bits(&s->gb, 8);	goto out;    }        /* Apple MJPEG-A */    if ((s->start_code == APP1) && (len > (0x28 - 8)))    {	id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16);	id = be2me_32(id);	len -= 4;	if (id == ff_get_fourcc("mjpg")) /* Apple MJPEG-A */	{#if 0	    skip_bits(&s->gb, 32); /* field size */	    skip_bits(&s->gb, 32); /* pad field size */	    skip_bits(&s->gb, 32); /* next off */	    skip_bits(&s->gb, 32); /* quant off */	    skip_bits(&s->gb, 32); /* huff off */	    skip_bits(&s->gb, 32); /* image off */	    skip_bits(&s->gb, 32); /* scan off */	    skip_bits(&s->gb, 32); /* data off */#endif	    if (s->first_picture)		printf("mjpeg: Apple MJPEG-A header found\n");	}    }out:    return 0;}