[vlc-devel] [PATCH] karaoke : setting the output to mono

Sukrit Sangwan sukritsangwan at gmail.com
Tue Mar 6 10:49:10 CET 2012


i have set the output of karaoke to mono.
i have tested, it works fine


diff --git a/modules/audio_filter/karaoke.c b/modules/audio_filter/karaoke.c
index 81bc276..8371c40 100644
--- a/modules/audio_filter/karaoke.c
+++ b/modules/audio_filter/karaoke.c
@@ -72,8 +72,24 @@ static block_t *Process (filter_t *filter, block_t
*block)

         *(spl++) = s;
         *(spl++) = s;
-        /* TODO: set output format to mono */
     }
+
+    /* set output to mono */
+    block_t *p_out_block = block_Alloc( block->i_buffer / 2 );
+    if( p_out_block == NULL )
+        return NULL;
+    p_out_block->i_flags   = block->i_flags;
+    p_out_block->i_nb_samples = block->i_nb_samples;
+    p_out_block->i_dts     = block->i_dts;
+    p_out_block->i_pts     = block->i_pts;
+    p_out_block->i_length  = block->i_length;
+    for( unsigned i = 0; i < block->i_nb_samples; i++ )
+    {
+        p_out_block->p_buffer[i] = spl[ 2 * i + 1 ];
+    }
+    filter->fmt_out.audio.i_channels = 1;
+    filter->fmt_out.audio.i_physical_channels = 1;
+
     (void) filter;
     return block;
 }


-- 
Regards
Sukrit Sangwan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120306/1d560fbd/attachment.html>


More information about the vlc-devel mailing list