Revision 4d41f3ee

View differences:

libavformat/matroska.c
2375 2375
}
2376 2376

  
2377 2377
static int
2378
matroska_parse_block(MatroskaDemuxContext *matroska, uint64_t cluster_time,
2378
matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
2379
                     int64_t pos, uint64_t cluster_time,
2379 2380
                     int is_keyframe, int *ptrack, AVPacket **ppkt)
2380 2381
{
2381
    int res;
2382
    uint32_t id;
2382
    int res = 0;
2383 2383
    int track;
2384 2384
    AVPacket *pkt;
2385
    uint8_t *data, *origdata;
2386
    int size;
2385
    uint8_t *origdata = data;
2387 2386
    int16_t block_time;
2388 2387
    uint32_t *lace_size = NULL;
2389 2388
    int n, flags, laces = 0;
2390 2389
    uint64_t num;
2391
    int64_t pos= url_ftell(&matroska->ctx->pb);
2392

  
2393
    if ((res = ebml_read_binary(matroska, &id, &data, &size)) < 0)
2394
        return res;
2395
    origdata = data;
2396 2390

  
2397 2391
    /* first byte(s): tracknum */
2398 2392
    if ((n = matroska_ebmlnum_uint(data, size, &num)) < 0) {
......
2567 2561
    int is_keyframe = PKT_FLAG_KEY, last_num_packets = matroska->num_packets;
2568 2562
    uint64_t duration = AV_NOPTS_VALUE;
2569 2563
    int track = -1;
2564
    uint8_t *data;
2565
    int size = 0;
2566
    int64_t pos = 0;
2570 2567

  
2571 2568
    av_log(matroska->ctx, AV_LOG_DEBUG, "parsing blockgroup...\n");
2572 2569

  
......
2584 2581
             * of the harder things, so this code is a bit complicated.
2585 2582
             * See http://www.matroska.org/ for documentation. */
2586 2583
            case MATROSKA_ID_BLOCK: {
2587
                res = matroska_parse_block(matroska, cluster_time,
2588
                                           is_keyframe, &track, &pkt);
2584
                pos = url_ftell(&matroska->ctx->pb);
2585
                res = ebml_read_binary(matroska, &id, &data, &size);
2589 2586
                break;
2590 2587
            }
2591 2588

  
......
2620 2617
        }
2621 2618
    }
2622 2619

  
2620
    if (res)
2621
        return res;
2622

  
2623
    if (size > 0)
2624
        res = matroska_parse_block(matroska, data, size, pos, cluster_time,
2625
                                   is_keyframe, &track, &pkt);
2626

  
2623 2627
    if (pkt)
2624 2628
    {
2625 2629
        if (duration != AV_NOPTS_VALUE)
......
2637 2641
    int res = 0;
2638 2642
    uint32_t id;
2639 2643
    uint64_t cluster_time = 0;
2644
    uint8_t *data;
2645
    int64_t pos;
2646
    int size;
2640 2647

  
2641 2648
    av_log(matroska->ctx, AV_LOG_DEBUG,
2642 2649
           "parsing cluster at %"PRId64"\n", url_ftell(&matroska->ctx->pb));
......
2668 2675
                break;
2669 2676

  
2670 2677
            case MATROSKA_ID_SIMPLEBLOCK:
2671
                matroska_parse_block(matroska, cluster_time, -1, NULL, NULL);
2678
                pos = url_ftell(&matroska->ctx->pb);
2679
                res = ebml_read_binary(matroska, &id, &data, &size);
2680
                if (res == 0)
2681
                    res = matroska_parse_block(matroska, data, size, pos,
2682
                                               cluster_time, -1, NULL, NULL);
2672 2683
                break;
2673 2684

  
2674 2685
            default:

Also available in: Unified diff