]> git.sesse.net Git - vlc/blobdiff - modules/mux/avi.c
Remove stdlib.h
[vlc] / modules / mux / avi.c
index 1011921df608ecf7e9923c075febf645b998ab24..39f9787761384115f69c1eca2078de1653f2b83e 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * avi.c
  *****************************************************************************
- * Copyright (C) 2001, 2002 VideoLAN
+ * Copyright (C) 2001, 2002 the VideoLAN team
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  *****************************************************************************/
 /* TODO: add OpenDML write support */
 
-#include <stdlib.h>
 
 #include <vlc/vlc.h>
-#include <vlc/input.h>
-#include <vlc/sout.h>
-
-#include "codecs.h"
+#include <vlc_sout.h>
+#include <vlc_block.h>
+#include <vlc_codecs.h>
 
 /*****************************************************************************
  * Module descriptor
@@ -42,6 +40,8 @@ static void Close  ( vlc_object_t * );
 
 vlc_module_begin();
     set_description( _("AVI muxer") );
+    set_category( CAT_SOUT );
+    set_subcategory( SUBCAT_SOUT_MUX );
     set_capability( "sout mux", 5 );
     add_shortcut( "avi" );
     set_callbacks( Open, Close );
@@ -62,7 +62,7 @@ typedef struct avi_stream_s
 
     char fcc[4];
 
-    mtime_t i_duration;       // in µs
+    mtime_t i_duration;       // in Âµs
 
     int     i_frames;        // total frame count
     int64_t i_totalsize;    // total stream size
@@ -294,11 +294,15 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
                 case VLC_FOURCC( 'w', 'm', 'a', '1' ):
                     p_wf->wFormatTag = WAVE_FORMAT_WMA1;
                     break;
+                case VLC_FOURCC( 'w', 'm', 'a', ' ' ):
                 case VLC_FOURCC( 'w', 'm', 'a', '2' ):
                     p_wf->wFormatTag = WAVE_FORMAT_WMA2;
                     break;
-                case VLC_FOURCC( 'w', 'm', 'a', '3' ):
-                    p_wf->wFormatTag = WAVE_FORMAT_WMA3;
+                case VLC_FOURCC( 'w', 'm', 'a', 'p' ):
+                    p_wf->wFormatTag = WAVE_FORMAT_WMAP;
+                    break;
+                case VLC_FOURCC( 'w', 'm', 'a', 'l' ):
+                    p_wf->wFormatTag = WAVE_FORMAT_WMAL;
                     break;
                     /* raw codec */
                 case VLC_FOURCC( 'u', '8', ' ', ' ' ):
@@ -421,7 +425,7 @@ static int Mux      ( sout_mux_t *p_mux )
 
         p_fifo = p_mux->pp_inputs[i]->p_fifo;
         i_count = p_fifo->i_depth;
-        while( i_count > 0 )
+        while( i_count > 1 )
         {
             avi_idx1_entry_t *p_idx;
             block_t *p_data;
@@ -467,6 +471,7 @@ static int Mux      ( sout_mux_t *p_mux )
                 if( p_data->i_buffer & 0x01 )
                 {
                     p_data = block_Realloc( p_data, 0, p_data->i_buffer + 1 );
+                    p_data->p_buffer[ p_data->i_buffer - 1 ] = '\0';
                 }
 
                 p_sys->i_movi_size += p_data->i_buffer;
@@ -540,7 +545,7 @@ static void bo_AddLWordBE( buffer_out_t *p_bo, uint64_t i )
 }
 #endif
 
-static void bo_AddFCC( buffer_out_t *p_bo, char *fcc )
+static void bo_AddFCC( buffer_out_t *p_bo, const char *fcc )
 {
     bo_AddByte( p_bo, fcc[0] );
     bo_AddByte( p_bo, fcc[1] );
@@ -619,8 +624,8 @@ static int avi_HeaderAdd_avih( sout_mux_t *p_mux,
         if( p_sys->stream[i_stream].i_duration > 0 )
         {
             i_maxbytespersec +=
-                p_sys->stream[p_sys->i_stream_video].i_totalsize /
-                p_sys->stream[p_sys->i_stream_video].i_duration;
+                p_sys->stream[i_stream].i_totalsize /
+                p_sys->stream[i_stream].i_duration;
         }
     }