[vlc-commits] demux: mp4: add chunk virtual trun

Francois Cartegnie git at videolan.org
Mon Oct 31 19:22:49 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct 31 11:09:16 2016 +0100| [66c4cbb087903b8a0ca61737e914899f77d522a6] | committer: Francois Cartegnie

demux: mp4: add chunk virtual trun

Adds continuity sequence counter,
like fragmented mp4 truns

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=66c4cbb087903b8a0ca61737e914899f77d522a6
---

 modules/demux/mp4/mp4.c | 8 ++++++++
 modules/demux/mp4/mp4.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 4b98566..2fcc649 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -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;
diff --git a/modules/demux/mp4/mp4.h b/modules/demux/mp4/mp4.h
index 47067d5..f38fbfe 100644
--- a/modules/demux/mp4/mp4.h
+++ b/modules/demux/mp4/mp4.h
@@ -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 */



More information about the vlc-commits mailing list