- else if( !b_found )
- {
- if( b_color )
- utf8_fprintf( stdout, "\n" WHITE "%s" GRAY "\n",
- _( "No matching module found. Use --list or" \
- "--list-verbose to list available modules." ) );
- else
- utf8_fprintf( stdout, "\n%s\n",
- _( "No matching module found. Use --list or" \
- "--list-verbose to list available modules." ) );
- }
-
- /* Release the module list */
- module_list_free (list);
-}
-
-/*****************************************************************************
- * ListModules: list the available modules with their description
- *****************************************************************************
- * Print a list of all available modules (builtins and plugins) and a short
- * description for each one.
- *****************************************************************************/
-static void ListModules( libvlc_int_t *p_this, bool b_verbose )
-{
- module_t *p_parser;
- char psz_spaces[22];
-
- bool b_color = config_GetInt( p_this, "color" ) > 0;
-
- memset( psz_spaces, ' ', 22 );
-
-#ifdef WIN32
- ShowConsole( true );
-#endif
-
- /* List all modules */
- module_t **list = module_list_get (NULL);
-
- /* Enumerate each module */
- for (size_t j = 0; (p_parser = list[j]) != NULL; j++)
- {
- int i;
-
- /* Nasty hack, but right now I'm too tired to think about a nice
- * solution */
- i = 22 - strlen( p_parser->psz_object_name ) - 1;
- if( i < 0 ) i = 0;
- psz_spaces[i] = 0;
-
- if( b_color )
- utf8_fprintf( stdout, GREEN" %s%s "WHITE"%s\n"GRAY,
- p_parser->psz_object_name,
- psz_spaces,
- p_parser->psz_longname );
- else
- utf8_fprintf( stdout, " %s%s %s\n",
- p_parser->psz_object_name,
- psz_spaces, p_parser->psz_longname );
-
- if( b_verbose )
- {
- char *const *pp_shortcut = p_parser->pp_shortcuts;
- while( *pp_shortcut )
- {
- if( strcmp( *pp_shortcut, p_parser->psz_object_name ) )
- {
- if( b_color )
- utf8_fprintf( stdout, CYAN" s %s\n"GRAY,
- *pp_shortcut );
- else
- utf8_fprintf( stdout, " s %s\n",
- *pp_shortcut );
- }
- pp_shortcut++;
- }
- if( p_parser->psz_capability )
- {
- if( b_color )
- utf8_fprintf( stdout, MAGENTA" c %s (%d)\n"GRAY,
- p_parser->psz_capability,
- p_parser->i_score );
- else
- utf8_fprintf( stdout, " c %s (%d)\n",
- p_parser->psz_capability,
- p_parser->i_score );
- }
- }
-
- psz_spaces[i] = ' ';
- }
- module_list_free (list);
-
-#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
- PauseConsole();
-#endif
-}
-
-/*****************************************************************************
- * Version: print complete program version
- *****************************************************************************
- * Print complete program version and build number.
- *****************************************************************************/
-static void Version( void )
-{
-#ifdef WIN32
- ShowConsole( true );
-#endif
-
- utf8_fprintf( stdout, _("VLC version %s\n"), VLC_Version() );
- utf8_fprintf( stdout, _("Compiled by %s@%s.%s\n"),
- VLC_CompileBy(), VLC_CompileHost(), VLC_CompileDomain() );
- utf8_fprintf( stdout, _("Compiler: %s\n"), VLC_Compiler() );
- utf8_fprintf( stdout, "%s", LICENSE_MSG );
-
-#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
- PauseConsole();
-#endif
-}
-
-/*****************************************************************************
- * ShowConsole: On Win32, create an output console for debug messages
- *****************************************************************************
- * This function is useful only on Win32.
- *****************************************************************************/
-#ifdef WIN32 /* */
-static void ShowConsole( bool b_dofile )
-{
-# ifndef UNDER_CE
- FILE *f_help = NULL;
-
- if( getenv( "PWD" ) && getenv( "PS1" ) ) return; /* cygwin shell */
-
- AllocConsole();
- /* Use the ANSI code page (e.g. Windows-1252) as expected by the LibVLC
- * Unicode/locale subsystem. By default, we have the obsolecent OEM code
- * page (e.g. CP437 or CP850). */
- SetConsoleOutputCP (GetACP ());
- SetConsoleTitle ("VLC media player version "PACKAGE_VERSION);
-
- freopen( "CONOUT$", "w", stderr );
- freopen( "CONIN$", "r", stdin );
-
- if( b_dofile && (f_help = fopen( "vlc-help.txt", "wt" )) )
- {
- fclose( f_help );
- freopen( "vlc-help.txt", "wt", stdout );
- utf8_fprintf( stderr, _("\nDumped content to vlc-help.txt file.\n") );
- }
- else freopen( "CONOUT$", "w", stdout );
-
-# endif
-}
-#endif
-
-/*****************************************************************************
- * PauseConsole: On Win32, wait for a key press before closing the console
- *****************************************************************************
- * This function is useful only on Win32.
- *****************************************************************************/
-#ifdef WIN32 /* */
-static void PauseConsole( void )
-{
-# ifndef UNDER_CE
-
- if( getenv( "PWD" ) && getenv( "PS1" ) ) return; /* cygwin shell */
-
- utf8_fprintf( stderr, _("\nPress the RETURN key to continue...\n") );
- getchar();
- fclose( stdout );
-
-# endif
-}
-#endif
-
-/*****************************************************************************
- * ConsoleWidth: Return the console width in characters
- *****************************************************************************
- * We use the stty shell command to get the console width; if this fails or
- * if the width is less than 80, we default to 80.
- *****************************************************************************/
-static int ConsoleWidth( void )
-{
- unsigned i_width = 80;
-
-#ifndef WIN32
- FILE *file = popen( "stty size 2>/dev/null", "r" );
- if (file != NULL)
- {
- if (fscanf (file, "%*u %u", &i_width) <= 0)
- i_width = 80;
- pclose( file );
- }
-#elif !defined (UNDER_CE)
- CONSOLE_SCREEN_BUFFER_INFO buf;
-
- if (GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &buf))
- i_width = buf.dwSize.X;
-#endif
-
- return i_width;
-}
-
-/*****************************************************************************
- * InitDeviceValues: initialize device values
- *****************************************************************************
- * This function inits the dvd, vcd and cd-audio values
- *****************************************************************************/
-static void InitDeviceValues( libvlc_int_t *p_vlc )
-{
-#ifdef HAVE_HAL
- LibHalContext * ctx = NULL;
- int i, i_devices;
- char **devices = NULL;
- char *block_dev = NULL;
- dbus_bool_t b_dvd;
-
- DBusConnection *p_connection = NULL;
- DBusError error;
-
- ctx = libhal_ctx_new();
- if( !ctx ) return;
- dbus_error_init( &error );
- p_connection = dbus_bus_get ( DBUS_BUS_SYSTEM, &error );
- if( dbus_error_is_set( &error ) || !p_connection )
- {
- libhal_ctx_free( ctx );
- dbus_error_free( &error );
- return;
- }
- libhal_ctx_set_dbus_connection( ctx, p_connection );
- if( libhal_ctx_init( ctx, &error ) )
- {
- if( ( devices = libhal_get_all_devices( ctx, &i_devices, NULL ) ) )
- {
- for( i = 0; i < i_devices; i++ )
- {
- if( !libhal_device_property_exists( ctx, devices[i],
- "storage.cdrom.dvd", NULL ) )
- {
- continue;
- }
- b_dvd = libhal_device_get_property_bool( ctx, devices[ i ],
- "storage.cdrom.dvd", NULL );
- block_dev = libhal_device_get_property_string( ctx,
- devices[ i ], "block.device" , NULL );
- if( b_dvd )
- {
- config_PutPsz( p_vlc, "dvd", block_dev );
- }
-
- config_PutPsz( p_vlc, "vcd", block_dev );
- config_PutPsz( p_vlc, "cd-audio", block_dev );
- libhal_free_string( block_dev );
- }
- libhal_free_string_array( devices );
- }
- libhal_ctx_shutdown( ctx, NULL );
- dbus_connection_unref( p_connection );
- libhal_ctx_free( ctx );
- }
- else
- {
- msg_Warn( p_vlc, "Unable to get HAL device properties" );
- }
-#else
- (void)p_vlc;
-#endif /* HAVE_HAL */
-}
-
-#include <vlc_avcodec.h>
-
-void vlc_avcodec_mutex (bool acquire)
-{
- static vlc_mutex_t lock = VLC_STATIC_MUTEX;
-
- if (acquire)
- vlc_mutex_lock (&lock);
- else
- vlc_mutex_unlock (&lock);