]> git.sesse.net Git - x264/blobdiff - output/mp4.c
Don't calculate ref/partition stats if not necessary
[x264] / output / mp4.c
index c5e19887f909e69248b33bb5f2f06cbbedb1e5b5..f76541ed91ffc35d804b064fe5f5e60591626a12 100644 (file)
 #include "muxers.h"
 #include <gpac/isomedia.h>
 
+#ifdef HAVE_GF_MALLOC
+#undef malloc
+#undef free
+#define malloc gf_malloc
+#define free gf_free
+#endif
+
 typedef struct
 {
     GF_ISOFile *p_file;
@@ -31,7 +38,7 @@ typedef struct
     GF_ISOSample *p_sample;
     int i_track;
     uint32_t i_descidx;
-    int i_time_res;
+    uint32_t i_time_res;
     int64_t i_time_inc;
     int i_numframe;
     int i_delay_time;
@@ -39,7 +46,7 @@ typedef struct
 
 static void recompute_bitrate_mp4( GF_ISOFile *p_file, int i_track )
 {
-    u32 i, count, di, timescale, time_wnd, rate;
+    u32 count, di, timescale, time_wnd, rate;
     u64 offset;
     Double br;
     GF_ESD *esd;
@@ -54,7 +61,7 @@ static void recompute_bitrate_mp4( GF_ISOFile *p_file, int i_track )
 
     timescale = gf_isom_get_media_timescale( p_file, i_track );
     count = gf_isom_get_sample_count( p_file, i_track );
-    for( i = 0; i < count; i++ )
+    for( int i = 0; i < count; i++ )
     {
         GF_ISOSample *samp = gf_isom_get_sample_info( p_file, i_track, i+1, &di, &offset );
         if( !samp )
@@ -115,7 +122,7 @@ static int close_file( hnd_t handle, int64_t largest_pts, int64_t second_largest
          * So, if mdhd duration is equal to the last DTS or less, we give the last composition time delta to the last sample duration.
          * And then, the mdhd duration is updated, but it time-wise doesn't give the actual duration.
          * The tkhd duration is the actual track duration. */
-        uint64_t mdhd_duration = (2 * largest_pts - second_largest_pts - p_mp4->i_delay_time) * p_mp4->i_time_inc;
+        uint64_t mdhd_duration = (2 * largest_pts - second_largest_pts) * p_mp4->i_time_inc;
         if( mdhd_duration != gf_isom_get_media_duration( p_mp4->p_file, p_mp4->i_track ) )
         {
             uint64_t last_dts = gf_isom_get_sample_dts( p_mp4->p_file, p_mp4->i_track, p_mp4->i_numframe );