mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 01:37:16 +00:00
Bug 792404 - Add nestegg_offset_seek to enable stream switching for DASH-WebM r=kinetik
This commit is contained in:
parent
4601da27f5
commit
272d7ed20d
@ -9,6 +9,7 @@ nestegg_destroy
|
||||
nestegg_duration
|
||||
nestegg_free_packet
|
||||
nestegg_init
|
||||
nestegg_offset_seek
|
||||
nestegg_packet_count
|
||||
nestegg_packet_data
|
||||
nestegg_packet_track
|
||||
|
@ -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 a4dd140a8c1073d8d5ef7848f83730e12bdfcf18.
|
||||
The git commit ID used was ce207d5b7566da2900e728b776a918ff3ab3dbb0.
|
||||
|
@ -194,6 +194,15 @@ int nestegg_get_cue_point(nestegg * context, unsigned int cluster_num,
|
||||
int64_t max_offset, int64_t * start_pos,
|
||||
int64_t * end_pos);
|
||||
|
||||
/** Seek to @a offset. Stream will seek directly to offset.
|
||||
Should be used to seek to the start of a resync point, i.e. cluster; the
|
||||
parser will not be able to understand other offsets.
|
||||
@param context Stream context initialized by #nestegg_init.
|
||||
@param offset Absolute offset in bytes.
|
||||
@retval 0 Success.
|
||||
@retval -1 Error. */
|
||||
int nestegg_offset_seek(nestegg * context, uint64_t offset);
|
||||
|
||||
/** Seek @a track to @a tstamp. Stream seek will terminate at the earliest
|
||||
key point in the stream at or before @a tstamp. Other tracks in the
|
||||
stream will output packets with unspecified but nearby timestamps.
|
||||
|
@ -1647,6 +1647,27 @@ nestegg_get_cue_point(nestegg * ctx, unsigned int cluster_num, int64_t max_offse
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nestegg_offset_seek(nestegg * ctx, uint64_t offset)
|
||||
{
|
||||
int r;
|
||||
|
||||
/* Seek and set up parser state for segment-level element (Cluster). */
|
||||
r = ne_io_seek(ctx->io, offset, NESTEGG_SEEK_SET);
|
||||
if (r != 0)
|
||||
return -1;
|
||||
ctx->last_id = 0;
|
||||
ctx->last_size = 0;
|
||||
|
||||
while (ctx->ancestor)
|
||||
ne_ctx_pop(ctx);
|
||||
|
||||
ne_ctx_push(ctx, ne_top_level_elements, ctx);
|
||||
ne_ctx_push(ctx, ne_segment_elements, &ctx->segment);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nestegg_track_seek(nestegg * ctx, unsigned int track, uint64_t tstamp)
|
||||
{
|
||||
@ -1691,17 +1712,7 @@ nestegg_track_seek(nestegg * ctx, unsigned int track, uint64_t tstamp)
|
||||
}
|
||||
|
||||
/* Seek and set up parser state for segment-level element (Cluster). */
|
||||
r = ne_io_seek(ctx->io, ctx->segment_offset + seek_pos, NESTEGG_SEEK_SET);
|
||||
if (r != 0)
|
||||
return -1;
|
||||
ctx->last_id = 0;
|
||||
ctx->last_size = 0;
|
||||
|
||||
while (ctx->ancestor)
|
||||
ne_ctx_pop(ctx);
|
||||
|
||||
ne_ctx_push(ctx, ne_top_level_elements, ctx);
|
||||
ne_ctx_push(ctx, ne_segment_elements, &ctx->segment);
|
||||
r = nestegg_offset_seek(ctx, ctx->segment_offset + seek_pos);
|
||||
ctx->log(ctx, NESTEGG_LOG_DEBUG, "seek: parsing cluster elements");
|
||||
r = ne_parse(ctx, NULL, -1);
|
||||
if (r != 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user