]> git.sesse.net Git - vlc/blobdiff - src/misc/darwin_specific.m
src/playlist/loadsave.c, modules/demux/playlist/*, modules/gui/*,
[vlc] / src / misc / darwin_specific.m
index 71536c5004d26ba94d7a4978be5b03e0f89a0df6..5dc48a8b473728a1f9d9f9587223bf3aa546fb94 100644 (file)
@@ -1,17 +1,17 @@
 /*****************************************************************************
- * darwin_specific.m: Darwin specific features 
+ * darwin_specific.m: Darwin specific features
  *****************************************************************************
- * Copyright (C) 2001 VideoLAN
- * $Id: darwin_specific.m,v 1.10 2003/02/06 23:01:31 sam Exp $
+ * Copyright (C) 2001-2004 the VideoLAN team
+ * $Id$
  *
- * Authors: Samuel Hocevar <sam@zoy.org>
+ * Authors: Sam Hocevar <sam@zoy.org>
  *          Christophe Massiot <massiot@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -19,7 +19,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.
  *****************************************************************************/
 #include <string.h>                                              /* strdup() */
 #include <stdlib.h>                                                /* free() */
 #include <vlc/vlc.h>
 
 #include <Cocoa/Cocoa.h>
+#include <CoreFoundation/CFString.h>
+
+#ifdef HAVE_LOCALE_H
+#   include <locale.h>
+#endif
 
 /*****************************************************************************
  * system_Init: fill in program path & retrieve language
@@ -36,16 +41,25 @@ static int FindLanguage( const char * psz_lang )
     const char ** ppsz_parser;
     const char * ppsz_all[] =
     {
+        "Catalan", "ca",
+        "Danish", "da",
         "German", "de",
         "British", "en_GB",
+        "English", "en",
+        "Spanish", "es",
         "French", "fr",
         "Italian", "it",
         "Japanese", "ja",
+        "Korean", "ko",
+       "Georgian", "ka",
         "Dutch", "nl",
-        "Norwegian", "no",
-        "Polish", "pl",
+       "Occitan", "oc",
+        "Brazillian Portuguese", "pt_BR",
+        "Romanian", "ro",
         "Russian", "ru",
-        "Swedish", "sv",
+        "Turkish", "tr",
+        "Simplified Chinese", "zh_CN", 
+        "Chinese Traditional", "zh_TW",
         NULL
     };
 
@@ -89,28 +103,31 @@ void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] )
         NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
 
         /* Retrieve user's preferences. */
-        NSUserDefaults * o_defs = [NSUserDefaults standardUserDefaults]; 
-        NSArray * o_languages = [o_defs objectForKey:@"AppleLanguages"]; 
-        NSEnumerator * o_enumerator = [o_languages objectEnumerator]; 
+        NSUserDefaults * o_defs = [NSUserDefaults standardUserDefaults];
+        NSArray * o_languages = [o_defs objectForKey:@"AppleLanguages"];
+        NSEnumerator * o_enumerator = [o_languages objectEnumerator];
         NSString * o_lang;
 
         while ( (o_lang = [o_enumerator nextObject]) )
-        { 
+        {
             const char * psz_string = [o_lang lossyCString];
             if ( FindLanguage( psz_string ) )
             {
                 break;
             }
         }
-        
+
         [o_pool release];
     }
+
+    vlc_mutex_init( p_this, &p_this->p_libvlc->iconv_lock );
+    p_this->p_libvlc->iconv_macosx = vlc_iconv_open( "UTF-8", "UTF-8-MAC" );
 }
 
 /*****************************************************************************
  * system_Configure: check for system specific configuration options.
  *****************************************************************************/
-void system_Configure( vlc_t *p_this )
+void system_Configure( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] )
 {
 
 }
@@ -121,5 +138,9 @@ void system_Configure( vlc_t *p_this )
 void system_End( vlc_t *p_this )
 {
     free( p_this->p_libvlc->psz_vlcpath );
+
+    if ( p_this->p_libvlc->iconv_macosx != (vlc_iconv_t)-1 )
+        vlc_iconv_close( p_this->p_libvlc->iconv_macosx );
+    vlc_mutex_destroy( &p_this->p_libvlc->iconv_lock );
 }