]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/transcode.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / stream_out / transcode.c
index b565e0358ef47d511e80cba744f9063cab722858..c44108e10364cd54ecdbf91931b35a2f5dd81947 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
 #include <vlc/vlc.h>
 #include <vlc_input.h>
 #include <vlc_sout.h>
@@ -40,6 +36,8 @@
 #include <vlc_filter.h>
 #include <vlc_osd.h>
 
+#include <math.h>
+
 #define MASTER_SYNC_MAX_DRIFT 100000
 
 /* FIXME Ugly */
 #define HURRYUP_LONGTEXT N_( "The transcoder will drop frames if your CPU " \
                 "can't keep up with the encoding rate." )
 
-static char *ppsz_deinterlace_type[] =
+static const char *ppsz_deinterlace_type[] =
 {
     "deinterlace", "ffmpeg-deinterlace"
 };
@@ -798,6 +796,15 @@ static void Close( vlc_object_t * p_this )
 
     sout_StreamDelete( p_sys->p_out );
 
+    while( p_sys->i_afilters )
+    {
+        p_sys->i_afilters--;
+        if( p_sys->psz_afilters[p_sys->i_afilters] )
+            free( p_sys->psz_afilters[p_sys->i_afilters] );
+        if( p_sys->p_afilters_cfg[p_sys->i_afilters] )
+            free( p_sys->p_afilters_cfg[p_sys->i_afilters] );
+    }
+
     while( p_sys->p_audio_cfg != NULL )
     {
         config_chain_t *p_next = p_sys->p_audio_cfg->p_next;
@@ -812,6 +819,15 @@ static void Close( vlc_object_t * p_this )
     }
     if( p_sys->psz_aenc ) free( p_sys->psz_aenc );
 
+    while( p_sys->i_vfilters )
+    {
+        p_sys->i_vfilters--;
+        if( p_sys->psz_vfilters[p_sys->i_vfilters] )
+            free( p_sys->psz_vfilters[p_sys->i_vfilters] );
+        if( p_sys->p_vfilters_cfg[p_sys->i_vfilters] )
+            free( p_sys->p_vfilters_cfg[p_sys->i_vfilters] );
+    }
+
     while( p_sys->p_video_cfg != NULL )
     {
         config_chain_t *p_next = p_sys->p_video_cfg->p_next;
@@ -1303,7 +1319,7 @@ static int transcode_audio_new( sout_stream_t *p_stream,
         msg_Err( p_stream, "cannot find decoder" );
         return VLC_EGENERIC;
     }
-    id->p_decoder->fmt_out.audio.i_bitspersample = 
+    id->p_decoder->fmt_out.audio.i_bitspersample =
         audio_BitsPerSample( id->p_decoder->fmt_out.i_codec );
     fmt_last = id->p_decoder->fmt_out;
     /* Fix AAC SBR changing number of channels and sampling rate */
@@ -1619,6 +1635,7 @@ static aout_buffer_t *audio_new_buffer( decoder_t *p_dec, int i_samples )
     }
 
     p_buffer = malloc( sizeof(aout_buffer_t) );
+    p_buffer->b_discontinuity = VLC_FALSE;
     p_buffer->pf_release = audio_release_buffer;
     p_buffer->p_sys = p_block = block_New( p_dec, i_size );
 
@@ -2047,7 +2064,7 @@ static void transcode_video_close( sout_stream_t *p_stream,
     if( p_stream->p_sys->i_threads >= 1 )
     {
         vlc_mutex_lock( &p_stream->p_sys->lock_out );
-        p_stream->p_sys->b_die = 1;
+        vlc_object_kill( p_stream->p_sys );
         vlc_cond_signal( &p_stream->p_sys->cond );
         vlc_mutex_unlock( &p_stream->p_sys->lock_out );
         vlc_thread_join( p_stream->p_sys );
@@ -2129,7 +2146,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
 
     while( (p_pic = id->p_decoder->pf_decode_video( id->p_decoder, &in )) )
     {
-        subpicture_t *p_subpic = 0;
+        subpicture_t *p_subpic = NULL;
         if( p_input )
             stats_UpdateInteger( p_input, p_input->p->counters.p_decoded_video,
                                  1, NULL );
@@ -2166,7 +2183,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
             /* Set the pts of the frame being encoded */
             p_pic->date = i_pts;
 
-            if( i_video_drift < i_master_drift - 50000 )
+            if( i_video_drift < (i_master_drift - 50000) )
             {
 #if 0
                 msg_Dbg( p_stream, "dropping frame (%i)",
@@ -2175,7 +2192,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
                 p_pic->pf_release( p_pic );
                 continue;
             }
-            else if( i_video_drift > i_master_drift + 50000 )
+            else if( i_video_drift > (i_master_drift + 50000) )
             {
 #if 0
                 msg_Dbg( p_stream, "adding frame (%i)",
@@ -2387,7 +2404,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
         /* Run user specified filter chain */
         for( i = 0; i < id->i_ufilter; i++ )
         {
-            p_pic = id->pp_ufilter[i]->pf_video_filter(id->pp_ufilter[i], p_pic);
+            p_pic = id->pp_ufilter[i]->pf_video_filter( id->pp_ufilter[i],
+                                                        p_pic );
         }
 
         if( p_sys->i_threads == 0 )
@@ -2413,8 +2431,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
         if( p_sys->b_master_sync && i_duplicate > 1 )
         {
             mtime_t i_pts = date_Get( &id->interpolated_pts ) + 1;
-            if ( p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT
-                  || p_pic->date - i_pts < -MASTER_SYNC_MAX_DRIFT )
+            if( (p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT)
+                 || ((p_pic->date - i_pts) < -MASTER_SYNC_MAX_DRIFT) )
             {
                 msg_Dbg( p_stream, "drift is too high, resetting master sync" );
                 date_Set( &id->interpolated_pts, p_pic->date );