]> git.sesse.net Git - vlc/commitdiff
* libvlc.h input.c headphone.c:
authorBoris Dorès <babal@videolan.org>
Sat, 20 Dec 2003 22:57:36 +0000 (22:57 +0000)
committerBoris Dorès <babal@videolan.org>
Sat, 20 Dec 2003 22:57:36 +0000 (22:57 +0000)
    fix support of audio channel mixers, like the headphone channel mixer
    for instance, which was broken since the introduction of user audio
    filters; if specified by the user and compatible with the audio
    pipeline, we add the channel mixer after the user filters.
    -> unfortunately, this fix removed two strings and introduced 4 new
       ones
    -> TODO: allow the user to choose only amongst channel mixers, not
       all available audio filters

* vlc.exe.manifest Makefile.am install-win32 :
    add a manifest file to allow the win32 gui to use Windows XP visual
    styles when available.

Makefile.am
install-win32
modules/audio_filter/channel_mixer/headphone.c
src/audio_output/input.c
src/libvlc.h
vlc.exe.manifest [new file with mode: 0644]

index cddf7ffc08c00913051a7aebe895acb6ee444164..47ebb1219ccbe8c5d60a415eda3c44974427957f 100644 (file)
@@ -558,6 +558,7 @@ package-win32-base:
        cp "$(srcdir)/install-win32" "$(srcdir)/vlc-${VERSION}/nsi"
 # Copy relevant files
        cp "$(top_builddir)/vlc$(EXEEXT)" "$(srcdir)/vlc-${VERSION}/"
+       cp "$(top_builddir)/vlc$(EXEEXT).manifest" "$(srcdir)/vlc-${VERSION}/"
        $(STRIP) "$(srcdir)/vlc-${VERSION}/vlc$(EXEEXT)"
        for file in AUTHORS MAINTAINERS THANKS NEWS COPYING README ; \
          do cp "$(srcdir)/$$file" "$(srcdir)/vlc-${VERSION}/$${file}.txt" ; \
index 356f6945e862cd150c284acb03b437f28fd5afa0..dacd516cc4f6b709c5229d8dd76a746013b5bfaf 100644 (file)
@@ -60,6 +60,7 @@ Section "Install"
        SetOutPath $INSTDIR\r
 \r
        File  vlc.exe\r
+       File  vlc.exe.manifest\r
        File  *.txt\r
 \r
        File  /r plugins\r
index 7530b5c33a093ff00eb2d81063df6c72c6374253..6fc892eb56cb877694e10e1538126486fd1346a4 100644 (file)
@@ -3,7 +3,7 @@
  *               -> gives the feeling of a real room with a simple headphone
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: headphone.c,v 1.5 2003/05/15 22:27:37 massiot Exp $
+ * $Id: headphone.c,v 1.6 2003/12/20 22:57:36 babal Exp $
  *
  * Authors: Boris Dorès <babal@via.ecp.fr>
  *
@@ -45,16 +45,25 @@ static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
+#define MODULE_DESCRIPTION N_ ( \
+     "This effect gives you the feeling that you are standing in a room " \
+     "with a complete 5.1 speaker set when using only a headphone, " \
+     "providing a more realistic sound experience. It should also be " \
+     "more comfortable and less tiring when listening to music for " \
+     "long periods of time.\nIt works with any source format from mono " \
+     "to 5.1.")
+
 #define HEADPHONE_DIM_TEXT N_("Characteristic dimension")
 #define HEADPHONE_DIM_LONGTEXT N_( \
      "Headphone virtual spatialization effect parameter: "\
      "distance between front left speaker and listener in meters.")
 
 vlc_module_begin();
-    add_category_hint( N_("headphone"), NULL, VLC_FALSE );
-    add_integer( "headphone-dim", 5, NULL, HEADPHONE_DIM_TEXT,
-                 HEADPHONE_DIM_LONGTEXT, VLC_TRUE );
-    set_description( _("headphone channel mixer with virtual spatialization effect") );
+    add_category_hint( N_("headphone"), MODULE_DESCRIPTION, VLC_FALSE );
+    add_integer( "headphone-dim", 10, NULL, HEADPHONE_DIM_TEXT,
+                 HEADPHONE_DIM_LONGTEXT, VLC_FALSE );
+    set_description( N_("headphone channel mixer with virtual spatialization effect") );
+
     set_capability( "audio filter", 0 );
     set_callbacks( Create, Destroy );
     add_shortcut( "headphone" );
index 573cf2398110ac31e6037cc02654804ce33c0178..205532d62334f2968636ab927907a9954b10ab2e 100644 (file)
@@ -2,7 +2,7 @@
  * input.c : internal management of input streams for the audio output
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: input.c,v 1.41 2003/12/17 23:21:15 hartman Exp $
+ * $Id: input.c,v 1.42 2003/12/20 22:57:36 babal Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
 
 static int VisualizationCallback( vlc_object_t *, char const *,
                                 vlc_value_t, vlc_value_t, void * );
+static aout_filter_t * allocateUserChannelMixer( aout_instance_t *,
+                                                 audio_sample_format_t *,
+                                                 audio_sample_format_t * );
 
 /*****************************************************************************
  * aout_InputNew : allocate a new input and rework the filter pipeline
  *****************************************************************************/
 int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
 {
-    audio_sample_format_t intermediate_format;
+    audio_sample_format_t user_filter_format;
+    audio_sample_format_t intermediate_format;/* input of resampler */
     vlc_value_t val, text;
     char * psz_filters;
+    aout_filter_t * p_user_channel_mixer;
 
     aout_FormatPrint( p_aout, "input", &p_input->input );
 
@@ -60,11 +65,28 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
             sizeof(audio_sample_format_t) );
     intermediate_format.i_rate = p_input->input.i_rate;
 
+    /* Try to use the channel mixer chosen by the user */
+    memcpy ( &user_filter_format, &intermediate_format,
+             sizeof(audio_sample_format_t) );
+    user_filter_format.i_physical_channels = p_input->input.i_physical_channels;
+    user_filter_format.i_original_channels = p_input->input.i_original_channels;
+    user_filter_format.i_bytes_per_frame = user_filter_format.i_bytes_per_frame
+                              * aout_FormatNbChannels( &user_filter_format )
+                              / aout_FormatNbChannels( &intermediate_format );
+    p_user_channel_mixer = allocateUserChannelMixer( p_aout, &user_filter_format,
+                                                   &intermediate_format );
+    /* If it failed, let the main pipeline do channel mixing */
+    if ( ! p_user_channel_mixer )
+    {
+        memcpy ( &user_filter_format, &intermediate_format,
+                 sizeof(audio_sample_format_t) );
+    }
+
     /* Create filters. */
     if ( aout_FiltersCreatePipeline( p_aout, p_input->pp_filters,
                                      &p_input->i_nb_filters,
                                      &p_input->input,
-                                     &intermediate_format
+                                     &user_filter_format
                                      ) < 0 )
     {
         msg_Err( p_aout, "couldn't set an input pipeline" );
@@ -112,15 +134,6 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
     {
         char *psz_parser = psz_filters;
         char *psz_next;
-        audio_sample_format_t format_in, format_out;
-
-        memcpy( &format_in, &p_aout->mixer.mixer,
-                sizeof( audio_sample_format_t ) );
-        memcpy( &format_out,&p_aout->mixer.mixer,
-                sizeof( audio_sample_format_t ) );
-
-        format_in.i_rate  = p_input->input.i_rate;
-        format_out.i_rate = p_input->input.i_rate;
 
         while( psz_parser && *psz_parser )
         {
@@ -158,9 +171,9 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
             }
 
             vlc_object_attach( p_filter , p_aout );
-            memcpy( &p_filter->input, &format_in,
+            memcpy( &p_filter->input, &user_filter_format,
                     sizeof(audio_sample_format_t) );
-            memcpy( &p_filter->output, &format_out,
+            memcpy( &p_filter->output, &user_filter_format,
                     sizeof(audio_sample_format_t) );
 
             p_filter->p_module =
@@ -187,6 +200,12 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
     }
     if( psz_filters ) free( psz_filters );
 
+    /* Attach the user channel mixer */
+    if ( p_user_channel_mixer )
+    {
+        p_input->pp_filters[p_input->i_nb_filters++] = p_user_channel_mixer;
+    }
+
     /* Prepare hints for the buffer allocator. */
     p_input->input_alloc.i_alloc_type = AOUT_ALLOC_HEAP;
     p_input->input_alloc.i_bytes_per_sec = -1;
@@ -476,3 +495,48 @@ static int VisualizationCallback( vlc_object_t *p_this, char const *psz_cmd,
 
     return VLC_SUCCESS;
 }
+
+static aout_filter_t * allocateUserChannelMixer( aout_instance_t * p_aout,
+                                     audio_sample_format_t * p_input_format,
+                                     audio_sample_format_t * p_output_format )
+{
+    aout_filter_t * p_channel_mixer;
+
+    /* Retreive user preferred channel mixer */
+    char * psz_name = config_GetPsz( p_aout, "audio-channel-mixer" );
+
+    /* Not specified => let the main pipeline do the mixing */
+    if ( ! psz_name ) return NULL;
+
+    /* Debug information */
+    aout_FormatsPrint( p_aout, "channel mixer", p_input_format,
+                       p_output_format );
+
+    /* Create a VLC object */
+    p_channel_mixer = vlc_object_create( p_aout, sizeof(aout_filter_t) );
+    if( p_channel_mixer == NULL )
+    {
+        msg_Err( p_aout, "cannot add user channel mixer %s", psz_name );
+        return NULL;
+    }
+    vlc_object_attach( p_channel_mixer , p_aout );
+
+    /* Attach the suitable module */
+    memcpy( &p_channel_mixer->input, p_input_format,
+                    sizeof(audio_sample_format_t) );
+    memcpy( &p_channel_mixer->output, p_output_format,
+                    sizeof(audio_sample_format_t) );
+    p_channel_mixer->p_module =
+                    module_Need( p_channel_mixer,"audio filter", psz_name );
+    if( p_channel_mixer->p_module== NULL )
+    {
+        msg_Err( p_aout, "cannot add user channel mixer %s", psz_name );
+        vlc_object_detach( p_channel_mixer );
+        vlc_object_destroy( p_channel_mixer );
+        return NULL;
+    }
+    p_channel_mixer->b_continuity = VLC_FALSE;
+
+    /* Ok */
+    return p_channel_mixer;
+}
index 780dbb1b639f8cb80c1743312851f712ab3b595b..825bbf81c5eaaa89642c4b89c75804f84629f9b9 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.h: main libvlc header
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.h,v 1.124 2003/12/15 14:05:19 hartman Exp $
+ * $Id: libvlc.h,v 1.125 2003/12/20 22:57:36 babal Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -158,14 +158,12 @@ static char *ppsz_language_text[] =
     "This allows you to add audio postprocessing filters, to modify " \
     "the sound.")
 
-#define HEADPHONE_TEXT N_("Headphone virtual spatialization effect")
-#define HEADPHONE_LONGTEXT N_( \
-    "This effect gives you the feeling that you are standing in a room " \
-    "with a complete 5.1 speaker set when using only a headphone, " \
-    "providing a more realistic sound experience. It should also be " \
-    "more comfortable and less tiring when listening to music for " \
-    "long periods of time.\nIt works with any source format from mono " \
-    "to 5.1.")
+#define AUDIO_CHANNEL_MIXER N_("Channel mixer")
+#define AUDIO_CHANNEL_MIXER_LONGTEXT N_( \
+     "This allows you to choose a specific audio channel mixer. For instance " \
+     "the headphone channel mixer will downmix any audio source to a stereo " \
+     "output and give the feeling that you are standing in a room with a " \
+     "complete 5.1 speaker set when using only a headphone.")
 
 #define VOUT_CAT_LONGTEXT N_( \
     "These options allow you to modify options related to " \
@@ -686,13 +684,12 @@ vlc_module_begin();
     add_bool( "hq-resampling", 1, NULL, AOUT_RESAMP_TEXT, AOUT_RESAMP_LONGTEXT, VLC_TRUE );
 #endif
     add_bool( "spdif", 0, NULL, SPDIF_TEXT, SPDIF_LONGTEXT, VLC_FALSE );
-#if 0
-    add_bool( "headphone-opt", 0, NULL, HEADPHONE_TEXT,
-                        HEADPHONE_LONGTEXT, VLC_FALSE );
-#endif
     add_integer( "audio-desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT, VLC_TRUE );
     add_string("audio-filter",0,NULL,AUDIO_FILTER_TEXT,
                     AUDIO_FILTER_LONGTEXT,VLC_FALSE);
+    add_module( "audio-channel-mixer", "audio filter", NULL, NULL,
+                   AUDIO_CHANNEL_MIXER, AUDIO_CHANNEL_MIXER_LONGTEXT,
+                   VLC_FALSE );
 
     /* Video options */
     add_category_hint( N_("Video"), VOUT_CAT_LONGTEXT , VLC_FALSE );
diff --git a/vlc.exe.manifest b/vlc.exe.manifest
new file mode 100644 (file)
index 0000000..e73fcc3
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">\r
+       <assemblyIdentity\r
+               version="1.0.0.0"\r
+               processorArchitecture="X86"\r
+               name="VideoLAN.VLC"\r
+               type="win32"\r
+       />\r
+       <description>see http://www.videolan.org</description>\r
+       <dependency>\r
+               <dependentAssembly>\r
+                       <assemblyIdentity\r
+                               type="win32"\r
+                               name="Microsoft.Windows.Common-Controls"\r
+                               version="6.0.0.0"\r
+                               processorArchitecture="X86"\r
+                               publicKeyToken="6595b64144ccf1df"\r
+                               language="*"\r
+                       />\r
+               </dependentAssembly>\r
+       </dependency>\r
+</assembly>\r