]> git.sesse.net Git - vlc/blobdiff - modules/mux/mp4.c
Qt: CaptureOpenPanel: check and prefill with usual devices
[vlc] / modules / mux / mp4.c
index f459b5248fb959a60c7e85a8c46dd60556ff25ad..8af05589ec941cae2c4fd24bee7d339b1cb55896 100644 (file)
@@ -204,11 +204,13 @@ static int Open( vlc_object_t *p_this )
     {
         /* Now add ftyp header */
         box = box_new( "ftyp" );
-        if( p_sys->b_3gp ) bo_add_fourcc( box, "3gp4" );
+        if( p_sys->b_3gp ) bo_add_fourcc( box, "3gp6" );
         else bo_add_fourcc( box, "isom" );
         bo_add_32be  ( box, 0 );
         if( p_sys->b_3gp ) bo_add_fourcc( box, "3gp4" );
         else bo_add_fourcc( box, "mp41" );
+        bo_add_fourcc( box, "avc1" );
+        bo_add_fourcc( box, "qt  " );
         box_fix( box );
 
         p_sys->i_pos += box->i_buffer;
@@ -562,7 +564,7 @@ again:
         }
 
         /* update */
-        p_stream->i_duration += p_data->i_length;
+        p_stream->i_duration = p_stream->i_last_dts - p_stream->i_dts_start + p_data->i_length;
         p_sys->i_pos += p_data->i_buffer;
 
         /* Save the DTS */
@@ -1513,6 +1515,7 @@ static bo_t *GetMoovBox( sout_mux_t *p_mux )
 
     uint32_t        i_movie_timescale = 90000;
     int64_t         i_movie_duration  = 0;
+    int64_t         i_timestamp = get_timestamp();
 
     moov = box_new( "moov" );
 
@@ -1531,16 +1534,16 @@ static bo_t *GetMoovBox( sout_mux_t *p_mux )
     if( !p_sys->b_64_ext )
     {
         mvhd = box_full_new( "mvhd", 0, 0 );
-        bo_add_32be( mvhd, get_timestamp() );   // creation time
-        bo_add_32be( mvhd, get_timestamp() );   // modification time
+        bo_add_32be( mvhd, i_timestamp );   // creation time
+        bo_add_32be( mvhd, i_timestamp );   // modification time
         bo_add_32be( mvhd, i_movie_timescale);  // timescale
         bo_add_32be( mvhd, i_movie_duration );  // duration
     }
     else
     {
         mvhd = box_full_new( "mvhd", 1, 0 );
-        bo_add_64be( mvhd, get_timestamp() );   // creation time
-        bo_add_64be( mvhd, get_timestamp() );   // modification time
+        bo_add_64be( mvhd, i_timestamp );   // creation time
+        bo_add_64be( mvhd, i_timestamp );   // modification time
         bo_add_32be( mvhd, i_movie_timescale);  // timescale
         bo_add_64be( mvhd, i_movie_duration );  // duration
     }
@@ -1592,8 +1595,8 @@ static bo_t *GetMoovBox( sout_mux_t *p_mux )
             else
                 tkhd = box_full_new( "tkhd", 0, 1 );
 
-            bo_add_32be( tkhd, get_timestamp() );       // creation time
-            bo_add_32be( tkhd, get_timestamp() );       // modification time
+            bo_add_32be( tkhd, i_timestamp );       // creation time
+            bo_add_32be( tkhd, i_timestamp );       // modification time
             bo_add_32be( tkhd, p_stream->i_track_id );
             bo_add_32be( tkhd, 0 );                     // reserved 0
             bo_add_32be( tkhd, p_stream->i_duration *
@@ -1607,8 +1610,8 @@ static bo_t *GetMoovBox( sout_mux_t *p_mux )
             else
                 tkhd = box_full_new( "tkhd", 1, 1 );
 
-            bo_add_64be( tkhd, get_timestamp() );       // creation time
-            bo_add_64be( tkhd, get_timestamp() );       // modification time
+            bo_add_64be( tkhd, i_timestamp );       // creation time
+            bo_add_64be( tkhd, i_timestamp );       // modification time
             bo_add_32be( tkhd, p_stream->i_track_id );
             bo_add_32be( tkhd, 0 );                     // reserved 0
             bo_add_64be( tkhd, p_stream->i_duration *
@@ -1730,8 +1733,8 @@ static bo_t *GetMoovBox( sout_mux_t *p_mux )
         if( !p_sys->b_64_ext )
         {
             mdhd = box_full_new( "mdhd", 0, 0 );
-            bo_add_32be( mdhd, get_timestamp() );   // creation time
-            bo_add_32be( mdhd, get_timestamp() );   // modification time
+            bo_add_32be( mdhd, i_timestamp );   // creation time
+            bo_add_32be( mdhd, i_timestamp );   // modification time
             bo_add_32be( mdhd, i_timescale);        // timescale
             bo_add_32be( mdhd, p_stream->i_duration * (int64_t)i_timescale /
                                (mtime_t)1000000 );  // duration
@@ -1739,8 +1742,8 @@ static bo_t *GetMoovBox( sout_mux_t *p_mux )
         else
         {
             mdhd = box_full_new( "mdhd", 1, 0 );
-            bo_add_64be( mdhd, get_timestamp() );   // creation time
-            bo_add_64be( mdhd, get_timestamp() );   // modification time
+            bo_add_64be( mdhd, i_timestamp );   // creation time
+            bo_add_64be( mdhd, i_timestamp );   // modification time
             bo_add_32be( mdhd, i_timescale);        // timescale
             bo_add_64be( mdhd, p_stream->i_duration * (int64_t)i_timescale /
                                (mtime_t)1000000 );  // duration