mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 804372 - Allow values for TrackNumber > 0; map TrackNumber to external index r=kinetik
This commit is contained in:
parent
077f80d348
commit
e467f307c4
@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
|
||||
|
||||
The nestegg git repository is: git://github.com/kinetiknz/nestegg.git
|
||||
|
||||
The git commit ID used was 37c8ec972f6908e884b2e3be6eaf7915dbe4e278.
|
||||
The git commit ID used was 7e5f24f1a160b192a9f45800df81d07cd2dd2413.
|
||||
|
@ -319,6 +319,12 @@ int nestegg_packet_count(nestegg_packet * packet, unsigned int * count);
|
||||
int nestegg_packet_data(nestegg_packet * packet, unsigned int item,
|
||||
unsigned char ** data, size_t * length);
|
||||
|
||||
/**
|
||||
* Query the presence of cues.
|
||||
* @retval 0 The media has no cues.
|
||||
* @retval 1 The media has cues. */
|
||||
int nestegg_has_cues(nestegg * context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1155,6 +1155,37 @@ ne_get_timecode_scale(nestegg * ctx)
|
||||
return scale;
|
||||
}
|
||||
|
||||
static int
|
||||
ne_map_track_number_to_index(nestegg * ctx,
|
||||
unsigned int track_number,
|
||||
unsigned int * track_index)
|
||||
{
|
||||
struct ebml_list_node * node;
|
||||
struct track_entry * t_entry;
|
||||
uint64_t t_number = 0;
|
||||
|
||||
if (!track_index)
|
||||
return -1;
|
||||
*track_index = 0;
|
||||
|
||||
if (track_number == 0)
|
||||
return -1;
|
||||
|
||||
node = ctx->segment.tracks.track_entry.head;
|
||||
while (node) {
|
||||
assert(node->id == ID_TRACK_ENTRY);
|
||||
t_entry = node->data;
|
||||
if (ne_get_uint(t_entry->number, &t_number) != 0)
|
||||
return -1;
|
||||
if (t_number == track_number)
|
||||
return 0;
|
||||
*track_index += 1;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static struct track_entry *
|
||||
ne_find_track_entry(nestegg * ctx, unsigned int track)
|
||||
{
|
||||
@ -1183,8 +1214,8 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
|
||||
struct frame * f, * last;
|
||||
struct track_entry * entry;
|
||||
double track_scale;
|
||||
uint64_t track, length, frame_sizes[256], cluster_tc, flags, frames, tc_scale, total;
|
||||
unsigned int i, lacing;
|
||||
uint64_t track_number, length, frame_sizes[256], cluster_tc, flags, frames, tc_scale, total;
|
||||
unsigned int i, lacing, track;
|
||||
size_t consumed = 0;
|
||||
|
||||
*data = NULL;
|
||||
@ -1192,11 +1223,11 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
|
||||
if (block_size > LIMIT_BLOCK)
|
||||
return -1;
|
||||
|
||||
r = ne_read_vint(ctx->io, &track, &length);
|
||||
r = ne_read_vint(ctx->io, &track_number, &length);
|
||||
if (r != 1)
|
||||
return r;
|
||||
|
||||
if (track == 0 || track > ctx->track_count)
|
||||
if (track_number == 0)
|
||||
return -1;
|
||||
|
||||
consumed += length;
|
||||
@ -1269,7 +1300,10 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
|
||||
if (total > block_size)
|
||||
return -1;
|
||||
|
||||
entry = ne_find_track_entry(ctx, track - 1);
|
||||
if (ne_map_track_number_to_index(ctx, track_number, &track) != 0)
|
||||
return -1;
|
||||
|
||||
entry = ne_find_track_entry(ctx, track);
|
||||
if (!entry)
|
||||
return -1;
|
||||
|
||||
@ -1287,7 +1321,7 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
|
||||
return -1;
|
||||
|
||||
pkt = ne_alloc(sizeof(*pkt));
|
||||
pkt->track = track - 1;
|
||||
pkt->track = track;
|
||||
pkt->timecode = abs_timecode * tc_scale * track_scale;
|
||||
|
||||
ctx->log(ctx, NESTEGG_LOG_DEBUG, "%sblock t %lld pts %f f %llx frames: %llu",
|
||||
@ -1588,6 +1622,13 @@ nestegg_track_count(nestegg * ctx, unsigned int * tracks)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nestegg_has_cues(nestegg * ctx)
|
||||
{
|
||||
return ctx->segment.cues.cue_point.head ||
|
||||
ne_find_seek_for_id(ctx->segment.seek_head.head, ID_CUES);
|
||||
}
|
||||
|
||||
int
|
||||
nestegg_get_cue_point(nestegg * ctx, unsigned int cluster_num, int64_t max_offset,
|
||||
int64_t * start_pos, int64_t * end_pos, uint64_t * tstamp)
|
||||
|
Loading…
Reference in New Issue
Block a user