Mercurial > libavformat.hg
comparison matroska.c @ 1916:6a5bafd079fd libavformat
remove no more needed parameters
author | aurel |
---|---|
date | Tue, 13 Mar 2007 00:20:18 +0000 |
parents | b3a5ffd3bc99 |
children | 6901a6e6dd95 |
comparison
equal
deleted
inserted
replaced
1915:b3a5ffd3bc99 | 1916:6a5bafd079fd |
---|---|
2426 } | 2426 } |
2427 | 2427 |
2428 static int | 2428 static int |
2429 matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, | 2429 matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, |
2430 int64_t pos, uint64_t cluster_time, uint64_t duration, | 2430 int64_t pos, uint64_t cluster_time, uint64_t duration, |
2431 int is_keyframe, int is_bframe, | 2431 int is_keyframe, int is_bframe) |
2432 int *ptrack, AVPacket **ppkt) | |
2433 { | 2432 { |
2434 int res = 0; | 2433 int res = 0; |
2435 int track; | 2434 int track; |
2436 AVPacket *pkt; | 2435 AVPacket *pkt; |
2437 uint8_t *origdata = data; | 2436 uint8_t *origdata = data; |
2449 data += n; | 2448 data += n; |
2450 size -= n; | 2449 size -= n; |
2451 | 2450 |
2452 /* fetch track from num */ | 2451 /* fetch track from num */ |
2453 track = matroska_find_track_by_num(matroska, num); | 2452 track = matroska_find_track_by_num(matroska, num); |
2454 if (ptrack) *ptrack = track; | |
2455 if (size <= 3 || track < 0 || track >= matroska->num_tracks) { | 2453 if (size <= 3 || track < 0 || track >= matroska->num_tracks) { |
2456 av_log(matroska->ctx, AV_LOG_INFO, | 2454 av_log(matroska->ctx, AV_LOG_INFO, |
2457 "Invalid stream %d or size %u\n", track, size); | 2455 "Invalid stream %d or size %u\n", track, size); |
2458 av_free(origdata); | 2456 av_free(origdata); |
2459 return res; | 2457 return res; |
2576 if (slice+1 == slices) | 2574 if (slice+1 == slices) |
2577 slice_size = lace_size[n] - slice_offset; | 2575 slice_size = lace_size[n] - slice_offset; |
2578 else | 2576 else |
2579 slice_size = rv_offset(data, slice+1, slices) - slice_offset; | 2577 slice_size = rv_offset(data, slice+1, slices) - slice_offset; |
2580 pkt = av_mallocz(sizeof(AVPacket)); | 2578 pkt = av_mallocz(sizeof(AVPacket)); |
2581 if (ppkt) *ppkt = pkt; | |
2582 /* XXX: prevent data copy... */ | 2579 /* XXX: prevent data copy... */ |
2583 if (av_new_packet(pkt, slice_size) < 0) { | 2580 if (av_new_packet(pkt, slice_size) < 0) { |
2584 res = AVERROR_NOMEM; | 2581 res = AVERROR_NOMEM; |
2585 n = laces-1; | 2582 n = laces-1; |
2586 break; | 2583 break; |
2616 matroska_parse_blockgroup (MatroskaDemuxContext *matroska, | 2613 matroska_parse_blockgroup (MatroskaDemuxContext *matroska, |
2617 uint64_t cluster_time) | 2614 uint64_t cluster_time) |
2618 { | 2615 { |
2619 int res = 0; | 2616 int res = 0; |
2620 uint32_t id; | 2617 uint32_t id; |
2621 AVPacket *pkt = NULL; | |
2622 int is_bframe = 0; | 2618 int is_bframe = 0; |
2623 int is_keyframe = PKT_FLAG_KEY, last_num_packets = matroska->num_packets; | 2619 int is_keyframe = PKT_FLAG_KEY, last_num_packets = matroska->num_packets; |
2624 uint64_t duration = AV_NOPTS_VALUE; | 2620 uint64_t duration = AV_NOPTS_VALUE; |
2625 int track = -1; | |
2626 uint8_t *data; | 2621 uint8_t *data; |
2627 int size = 0; | 2622 int size = 0; |
2628 int64_t pos = 0; | 2623 int64_t pos = 0; |
2629 | 2624 |
2630 av_log(matroska->ctx, AV_LOG_DEBUG, "parsing blockgroup...\n"); | 2625 av_log(matroska->ctx, AV_LOG_DEBUG, "parsing blockgroup...\n"); |
2688 if (res) | 2683 if (res) |
2689 return res; | 2684 return res; |
2690 | 2685 |
2691 if (size > 0) | 2686 if (size > 0) |
2692 res = matroska_parse_block(matroska, data, size, pos, cluster_time, | 2687 res = matroska_parse_block(matroska, data, size, pos, cluster_time, |
2693 duration, is_keyframe, is_bframe, | 2688 duration, is_keyframe, is_bframe); |
2694 &track, &pkt); | |
2695 | 2689 |
2696 return res; | 2690 return res; |
2697 } | 2691 } |
2698 | 2692 |
2699 static int | 2693 static int |
2739 pos = url_ftell(&matroska->ctx->pb); | 2733 pos = url_ftell(&matroska->ctx->pb); |
2740 res = ebml_read_binary(matroska, &id, &data, &size); | 2734 res = ebml_read_binary(matroska, &id, &data, &size); |
2741 if (res == 0) | 2735 if (res == 0) |
2742 res = matroska_parse_block(matroska, data, size, pos, | 2736 res = matroska_parse_block(matroska, data, size, pos, |
2743 cluster_time, AV_NOPTS_VALUE, | 2737 cluster_time, AV_NOPTS_VALUE, |
2744 -1, 0, NULL, NULL); | 2738 -1, 0); |
2745 break; | 2739 break; |
2746 | 2740 |
2747 default: | 2741 default: |
2748 av_log(matroska->ctx, AV_LOG_INFO, | 2742 av_log(matroska->ctx, AV_LOG_INFO, |
2749 "Unknown entry 0x%x in cluster data\n", id); | 2743 "Unknown entry 0x%x in cluster data\n", id); |