]> git.sesse.net Git - vlc/commitdiff
Woops
authorClément Stenac <zorglub@videolan.org>
Sun, 30 Apr 2006 17:39:28 +0000 (17:39 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 30 Apr 2006 17:39:28 +0000 (17:39 +0000)
modules/mux/asf.c
modules/mux/avi.c

index 7dd2ba3f4080956c37af0ae9e370c7d118850a52..169b96d1a5715a9352c5b9927a861820f8166c43 100644 (file)
@@ -1,4 +1,3 @@
-static int i_global = 0, i_passed = 0, i_written = 0;
 /*****************************************************************************
  * asf.c: asf muxer module for vlc
  *****************************************************************************
@@ -584,8 +583,6 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
 static int Mux( sout_mux_t *p_mux )
 {
     sout_mux_sys_t *p_sys = p_mux->p_sys;
-    i_global++;
-    fprintf( stderr, "Called %i\n", i_global );
 
     if( p_sys->b_write_header )
     {
@@ -611,8 +608,6 @@ static int Mux( sout_mux_t *p_mux )
             /* not enough data */
             return VLC_SUCCESS;
         }
-        i_passed++;
-        fprintf( stderr, "Passed %i\n", i_passed );
 
         if( p_sys->i_dts_first < 0 )
         {
@@ -630,8 +625,6 @@ static int Mux( sout_mux_t *p_mux )
 
         if( ( pk = asf_packet_create( p_mux, tk, data ) ) )
         {
-            i_written ++;
-            fprintf( stderr, "Written %i\n", i_written );
             sout_AccessOutWrite( p_mux->p_access, pk );
         }
     }
index 09f688516e624cb9fe8b6dc85462e9cabdb4ec2e..a5328744ed5385772f0af37cce4cc51a3166586e 100644 (file)
@@ -1,4 +1,3 @@
-static int i_global = 0;
 /*****************************************************************************
  * avi.c
  *****************************************************************************
@@ -111,7 +110,7 @@ struct sout_mux_sys_t
 };
 
 // FIXME FIXME
-#define HDR_SIZE 4096
+#define HDR_SIZE 10240
 
 /* Flags in avih */
 #define AVIF_HASINDEX       0x00000010  // Index at end of file?
@@ -405,7 +404,6 @@ static int Mux      ( sout_mux_t *p_mux )
     avi_stream_t    *p_stream;
     int i_stream;
     int i;
-i_global++;
 
     if( p_sys->b_write_header )
     {
@@ -476,6 +474,7 @@ i_global++;
                 {
                     p_data = block_Realloc( p_data, 0, p_data->i_buffer + 1 );
                 }
+
                 p_sys->i_movi_size += p_data->i_buffer;
                 sout_AccessOutWrite( p_mux->p_access, p_data );
             }
@@ -764,9 +763,9 @@ static int avi_HeaderAdd_strf( sout_mux_t *p_mux,
             bo_AddDWordLE( p_bo, p_stream->p_bih->biYPelsPerMeter );
             bo_AddDWordLE( p_bo, p_stream->p_bih->biClrUsed );
             bo_AddDWordLE( p_bo, p_stream->p_bih->biClrImportant );
-//            bo_AddMem( p_bo,
-//                       p_stream->p_bih->biSize - sizeof( BITMAPINFOHEADER ),
-//                       (uint8_t*)&p_stream->p_bih[1] );
+            bo_AddMem( p_bo,
+                       p_stream->p_bih->biSize - sizeof( BITMAPINFOHEADER ),
+                       (uint8_t*)&p_stream->p_bih[1] );
             break;
     }
 
@@ -792,38 +791,32 @@ static block_t *avi_HeaderCreateRIFF( sout_mux_t *p_mux )
     int                 i_stream;
     int                 i_maxbytespersec;
     int                 i_junk;
-    buffer_out_t        bo, bo_save;
+    buffer_out_t        bo;
 
-    /* Real header + LIST-movi */
-    p_hdr = block_New( p_mux, HDR_SIZE + 12 );
-    memset( p_hdr->p_buffer, 0, HDR_SIZE  + 12 );
+    p_hdr = block_New( p_mux, HDR_SIZE );
+    memset( p_hdr->p_buffer, 0, HDR_SIZE );
 
-    bo_Init( &bo, HDR_SIZE + 12, p_hdr->p_buffer );
+    bo_Init( &bo, HDR_SIZE, p_hdr->p_buffer );
 
     bo_AddFCC( &bo, "RIFF" );
-    bo_AddDWordLE( &bo, p_sys->i_movi_size + HDR_SIZE + p_sys->i_idx1_size );
+    bo_AddDWordLE( &bo, p_sys->i_movi_size + HDR_SIZE - 8 + p_sys->i_idx1_size );
     bo_AddFCC( &bo, "AVI " );
 
     bo_AddFCC( &bo, "LIST" );
-    memcpy( &bo_save, &bo, sizeof( buffer_out_t ) );
-    bo_AddDWordLE( &bo, 0 );
+    bo_AddDWordLE( &bo, HDR_SIZE - 8);
     bo_AddFCC( &bo, "hdrl" );
 
     avi_HeaderAdd_avih( p_mux, &bo );
-    for( i_stream = 0, i_maxbytespersec = 0; i_stream < p_sys->i_streams;
-         i_stream++ )
+    for( i_stream = 0,i_maxbytespersec = 0; i_stream < p_sys->i_streams; i_stream++ )
     {
         avi_HeaderAdd_strl( p_mux, &bo, &p_sys->stream[i_stream] );
     }
 
-    bo_AddDWordLE( &bo_save, bo.i_buffer - bo_save.i_buffer - 4 );
-
-    i_junk = HDR_SIZE - bo.i_buffer - 8;
+    i_junk = HDR_SIZE - bo.i_buffer - 8 - 12;
     bo_AddFCC( &bo, "JUNK" );
     bo_AddDWordLE( &bo, i_junk );
 
     bo.i_buffer += i_junk;
-    fprintf( stderr, "Writing list-movi at %i\n", bo.i_buffer );
     bo_AddFCC( &bo, "LIST" );
     bo_AddDWordLE( &bo, p_sys->i_movi_size + 4 );
     bo_AddFCC( &bo, "movi" );