Revision fc23d843

View differences:

libavcodec/mpeg12.c
2260 2260
    const uint8_t *buf_ptr = buf;
2261 2261
    const uint8_t *buf_end = buf + buf_size;
2262 2262
    int ret, input_size;
2263
    int last_code= 0;
2263 2264

  
2264 2265
    for(;;) {
2265 2266
        /* find next start code */
......
2296 2297
        /* prepare data for next start code */
2297 2298
        switch(start_code) {
2298 2299
        case SEQ_START_CODE:
2300
            if(last_code == 0){
2299 2301
            mpeg1_decode_sequence(avctx, buf_ptr,
2300 2302
                                    input_size);
2303
            }else{
2304
                av_log(avctx, AV_LOG_ERROR, "ignoring SEQ_START_CODE after %X\n", last_code);
2305
            }
2301 2306
            break;
2302 2307

  
2303 2308
        case PICTURE_START_CODE:
......
2310 2315
            if(mpeg1_decode_picture(avctx,
2311 2316
                                    buf_ptr, input_size) < 0)
2312 2317
                s2->pict_type=0;
2318
            last_code= PICTURE_START_CODE;
2313 2319
            break;
2314 2320
        case EXT_START_CODE:
2315 2321
            init_get_bits(&s2->gb, buf_ptr, input_size*8);
2316 2322

  
2317 2323
            switch(get_bits(&s2->gb, 4)) {
2318 2324
            case 0x1:
2325
                if(last_code == 0){
2319 2326
                mpeg_decode_sequence_extension(s);
2327
                }else{
2328
                    av_log(avctx, AV_LOG_ERROR, "ignoring seq ext after %X\n", last_code);
2329
                }
2320 2330
                break;
2321 2331
            case 0x2:
2322 2332
                mpeg_decode_sequence_display_extension(s);
......
2329 2339
                break;
2330 2340
            case 0x8:
2331 2341
                mpeg_decode_picture_coding_extension(s);
2342
                last_code= PICTURE_START_CODE;
2332 2343
                break;
2333 2344
            }
2334 2345
            break;
......
2337 2348
                                    buf_ptr, input_size);
2338 2349
            break;
2339 2350
        case GOP_START_CODE:
2351
            if(last_code == 0){
2340 2352
            s2->first_field=0;
2341 2353
            mpeg_decode_gop(avctx,
2342 2354
                                    buf_ptr, input_size);
2355
            }else{
2356
                av_log(avctx, AV_LOG_ERROR, "ignoring GOP_START_CODE after %X\n", last_code);
2357
            }
2343 2358
            break;
2344 2359
        default:
2345 2360
            if (start_code >= SLICE_MIN_START_CODE &&
2346
                start_code <= SLICE_MAX_START_CODE) {
2361
                start_code <= SLICE_MAX_START_CODE && last_code!=0) {
2347 2362
                int mb_y= start_code - SLICE_MIN_START_CODE;
2363
                last_code= SLICE_MIN_START_CODE;
2348 2364

  
2349 2365
                if(s2->last_picture_ptr==NULL){
2350 2366
                /* Skip B-frames if we do not have reference frames and gop is not closed */

Also available in: Unified diff