Commit 66c4cbb0 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: mp4: add chunk virtual trun

Adds continuity sequence counter,
like fragmented mp4 truns
parent daca57ae
......@@ -439,6 +439,11 @@ static void MP4_GetInterleaving( demux_t *p_demux, uint64_t *pi_max_contiguous,
nexttk = cur;
}
/* copy previous run */
if( nexttk && nexttk->i_chunk > 0 )
nexttk->chunk[nexttk->i_chunk].i_virtual_run_number =
nexttk->chunk[nexttk->i_chunk - 1].i_virtual_run_number;
if( tk != nexttk )
{
i_duration = i_duration * CLOCK_FREQ / tk->i_timescale;
......@@ -448,6 +453,9 @@ static void MP4_GetInterleaving( demux_t *p_demux, uint64_t *pi_max_contiguous,
if( tk->i_chunk != tk->i_chunk_count )
*pb_flat = false;
if( nexttk && nexttk->i_chunk > 0 ) /* new run number */
nexttk->chunk[nexttk->i_chunk].i_virtual_run_number++;
}
tk = nexttk;
......
......@@ -38,6 +38,7 @@ typedef struct
uint32_t i_sample_count; /* how many samples in this chunk */
uint32_t i_sample_first; /* index of the first sample in this chunk */
uint32_t i_sample; /* index of the next sample to read in this chunk */
uint32_t i_virtual_run_number; /* chunks interleaving sequence */
/* now provide way to calculate pts, dts, and offset without too
much memory and with fast access */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment