Revision 643fd8a1

View differences:

libavcodec/mjpegdec.c
338 338
    }
339 339
    s->picture.pict_type= FF_I_TYPE;
340 340
    s->picture.key_frame= 1;
341
    s->got_picture = 1;
341 342

  
342 343
    for(i=0; i<3; i++){
343 344
        s->linesize[i]= s->picture.linesize[i] << s->interlaced;
......
1249 1250
    int start_code;
1250 1251
    AVFrame *picture = data;
1251 1252

  
1253
    s->got_picture = 0; // picture from previous image can not be reused
1252 1254
    buf_ptr = buf;
1253 1255
    buf_end = buf + buf_size;
1254 1256
    while (buf_ptr < buf_end) {
......
1410 1412
                    if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
1411 1413
                        break;
1412 1414
eoi_parser:
1415
                    if (!s->got_picture) {
1416
                        av_log(avctx, AV_LOG_WARNING, "Found EOI before any SOF, ignoring\n");
1417
                        break;
1418
                    }
1413 1419
                    {
1414 1420
                        if (s->interlaced) {
1415 1421
                            s->bottom_field ^= 1;
......
1434 1440
                    }
1435 1441
                    break;
1436 1442
                case SOS:
1443
                    if (!s->got_picture) {
1444
                        av_log(avctx, AV_LOG_WARNING, "Can not process SOS before SOF, skipping\n");
1445
                        break;
1446
                    }
1437 1447
                    ff_mjpeg_decode_sos(s);
1438 1448
                    /* buggy avid puts EOI every 10-20th frame */
1439 1449
                    /* if restart period is over process EOI */
libavcodec/mjpegdec.h
81 81
    int quant_index[4];   /* quant table index for each component */
82 82
    int last_dc[MAX_COMPONENTS]; /* last DEQUANTIZED dc (XXX: am I right to do that ?) */
83 83
    AVFrame picture; /* picture structure */
84
    int got_picture;                                ///< we found a SOF and picture is valid, too.
84 85
    int linesize[MAX_COMPONENTS];                   ///< linesize << interlaced
85 86
    int8_t *qscale_table;
86 87
    DECLARE_ALIGNED_16(DCTELEM, block[64]);

Also available in: Unified diff