[vlc-commits] demux: mp4: set pts delay = preload

Francois Cartegnie git at videolan.org
Mon Oct 20 16:42:51 CEST 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct 20 14:16:37 2014 +0200| [ff9139a5c4957369117d1249f6ae67ca1b65444b] | committer: Francois Cartegnie

demux: mp4: set pts delay = preload

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

 modules/demux/mp4/mp4.c |   19 +++++++++++++++++--
 modules/demux/mp4/mp4.h |    1 +
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index fa89c96..a8eb4c2 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -1612,11 +1612,24 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 return VLC_EGENERIC;
             return Seek( p_demux, p_sys->p_title->seekpoint[i_seekpoint]->i_time_offset );
         }
-
+        case DEMUX_GET_PTS_DELAY:
+        {
+            for( unsigned int i = 0; i < p_sys->i_tracks; i++ )
+            {
+                const MP4_Box_t *p_load;
+                if ( (p_load = MP4_BoxGet( p_sys->track[i].p_track, "load" )) &&
+                     BOXDATA(p_load)->i_duration > 0 )
+                {
+                    *va_arg(args, int64_t *) = BOXDATA(p_load)->i_duration *
+                            CLOCK_FREQ / p_sys->track[i].i_timescale;
+                    return VLC_SUCCESS;
+                }
+            }
+            return VLC_EGENERIC;
+        }
         case DEMUX_SET_NEXT_DEMUX_TIME:
         case DEMUX_SET_GROUP:
         case DEMUX_HAS_UNSUPPORTED_META:
-        case DEMUX_GET_PTS_DELAY:
         case DEMUX_CAN_RECORD:
             return VLC_EGENERIC;
 
@@ -2540,6 +2553,8 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
 {
     demux_sys_t *p_sys = p_demux->p_sys;
 
+    p_track->p_track = p_box_trak;
+
     MP4_Box_t *p_tkhd = MP4_BoxGet( p_box_trak, "tkhd" );
     MP4_Box_t *p_tref = MP4_BoxGet( p_box_trak, "tref" );
     MP4_Box_t *p_elst;
diff --git a/modules/demux/mp4/mp4.h b/modules/demux/mp4/mp4.h
index eeb96ab..48418e2 100644
--- a/modules/demux/mp4/mp4.h
+++ b/modules/demux/mp4/mp4.h
@@ -115,6 +115,7 @@ typedef struct
     uint64_t     i_first_dts;    /* i_first_dts value
                                                    of the next chunk */
 
+    MP4_Box_t *p_track;
     MP4_Box_t *p_stbl;  /* will contain all timing information */
     MP4_Box_t *p_stsd;  /* will contain all data to initialize decoder */
     MP4_Box_t *p_sample;/* point on actual sdsd */



More information about the vlc-commits mailing list