Merge branch 'master' of /home/carl/git/dvdomatic
authorCarl Hetherington <cth@carlh.net>
Thu, 21 Mar 2013 16:31:57 +0000 (16:31 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 21 Mar 2013 16:31:57 +0000 (16:31 +0000)
12 files changed:
src/lib/config.cc
src/lib/config.h
src/lib/image.cc
src/lib/util.cc
src/lib/util.h
src/tools/dvdomatic.cc
src/tools/po/es_ES.po [new file with mode: 0644]
test/metadata.ref
test/test.cc
windows/installer.nsi.32.in
windows/installer.nsi.64.in
wscript

index ad132437a02ac0b47707c659455a1eeda107687c..5dce3748d72c4c7bd75df294858e945301e42637 100644 (file)
@@ -167,3 +167,10 @@ Config::default_directory_or (string a) const
 
        return _default_directory;
 }
+
+void
+Config::drop ()
+{
+       delete _instance;
+       _instance = 0;
+}
index 0e9c4a60aed4ade7c699b949823625ddedf7bdfa..ee46166e6d9809e4a098dcba15175f25509f459f 100644 (file)
@@ -169,6 +169,7 @@ public:
        void write () const;
 
        static Config* instance ();
+       static void drop ();
 
 private:
        Config ();
index 268c08173086659f657530eac0419f2e150a239e..2355d22e5b959ab12af8c9f8bae144d781649315 100644 (file)
@@ -75,6 +75,7 @@ Image::lines (int n) const
        case PIX_FMT_YUV444P9LE:
        case PIX_FMT_YUV444P10BE:
        case PIX_FMT_YUV444P10LE:
+       case PIX_FMT_UYVY422:
                return size().height;
        default:
                throw PixelFormatError (N_("lines()"), _pixel_format);
@@ -99,6 +100,7 @@ Image::components () const
                return 3;
        case PIX_FMT_RGB24:
        case PIX_FMT_RGBA:
+       case PIX_FMT_UYVY422:
                return 1;
        default:
                throw PixelFormatError (N_("components()"), _pixel_format);
@@ -211,6 +213,7 @@ Image::post_process (string pp, bool aligned) const
                break;
        case PIX_FMT_YUV422P10LE:
        case PIX_FMT_YUV422P:
+       case PIX_FMT_UYVY422:
                pp_format = PP_FORMAT_422;
                break;
        case PIX_FMT_YUV444P:
@@ -291,6 +294,9 @@ Image::swap_16 (uint16_t v)
 void
 Image::make_black ()
 {
+       /* U/V black value for 8-bit colour */
+       static uint8_t const eight_bit_uv = (1 << 7) - 1;
+       
        /* U/V black value for 9-bit colour */
        static uint16_t const nine_bit_uv = (1 << 8) - 1;
 
@@ -302,8 +308,8 @@ Image::make_black ()
        case PIX_FMT_YUV422P:
        case PIX_FMT_YUV444P:
                memset (data()[0], 0, lines(0) * stride()[0]);
-               memset (data()[1], 0x7f, lines(1) * stride()[1]);
-               memset (data()[2], 0x7f, lines(2) * stride()[2]);
+               memset (data()[1], eight_bit_uv, lines(1) * stride()[1]);
+               memset (data()[2], eight_bit_uv, lines(2) * stride()[2]);
                break;
 
        case PIX_FMT_YUV422P9LE:
@@ -329,8 +335,24 @@ Image::make_black ()
                memset (data()[0], 0, lines(0) * stride()[0]);
                break;
 
+       case PIX_FMT_UYVY422:
+       {
+               int const Y = lines(0);
+               int const X = line_size()[0];
+               uint8_t* p = data()[0];
+               for (int y = 0; y < Y; ++y) {
+                       for (int x = 0; x < X / 4; ++x) {
+                               *p++ = eight_bit_uv; // Cb
+                               *p++ = 0;            // Y0
+                               *p++ = eight_bit_uv; // Cr
+                               *p++ = 0;            // Y1
+                       }
+               }
+               break;
+       }
+
        default:
-               assert (false);
+               throw PixelFormatError (N_("make_black()"), _pixel_format);
        }
 }
 
@@ -428,6 +450,8 @@ Image::bytes_per_pixel (int c) const
                } else {
                        return 1;
                }
+       case PIX_FMT_UYVY422:
+               return 2;
        case PIX_FMT_YUV444P:
                return 3;
        case PIX_FMT_YUV444P9BE:
@@ -436,7 +460,7 @@ Image::bytes_per_pixel (int c) const
        case PIX_FMT_YUV444P10BE:
                return 6;
        default:
-               assert (false);
+               throw PixelFormatError (N_("bytes_per_pixel()"), _pixel_format);
        }
 
        return 0;
index abbc357493ec35baba546ef31289a54a2e6aec01..593d0e76043953abc1f306ac12c29f33d6ef43db 100644 (file)
@@ -235,8 +235,6 @@ seconds (struct timeval t)
 void
 dvdomatic_setup ()
 {
-       bindtextdomain ("libdvdomatic", LOCALE_PREFIX);
-       
        avfilter_register_all ();
        
        Format::setup_formats ();
@@ -248,11 +246,36 @@ dvdomatic_setup ()
        ui_thread = this_thread::get_id ();
 }
 
+#ifdef DVDOMATIC_WINDOWS
+boost::filesystem::path
+mo_path ()
+{
+       wchar_t buffer[512];
+       GetModuleFileName (0, buffer, 512 * sizeof(wchar_t));
+       boost::filesystem::path p (buffer);
+       p = p.parent_path ();
+       p = p.parent_path ();
+       p /= "locale";
+       return p;
+}
+#endif
+
 void
 dvdomatic_setup_i18n (string lang)
 {
-       bindtextdomain ("libdvdomatic", LOCALE_PREFIX);
-       setlocale (LC_ALL, lang.c_str ());
+       setlocale (LC_ALL, "");
+       textdomain ("libdvdomatic");
+       
+#ifdef DVDOMATIC_WINDOWS
+       string const e = "LANGUAGE=" + lang;
+       putenv (e.c_str());
+
+       bindtextdomain ("libdvdomatic", mo_path().string().c_str());
+#endif
+
+#ifdef DVDOMATIC_POSIX
+       bindtextdomain ("libdvdomatic", POSIX_LOCALE_PREFIX);
+#endif 
 }
 
 /** @param start Start position for the crop within the image.
index 60498be5a90a5ff762b886f2c314f7dad1d4d66c..3d251cf06ad0d1d9ca36816ea438fdd41d26a680 100644 (file)
@@ -30,6 +30,7 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/asio.hpp>
 #include <boost/optional.hpp>
+#include <boost/filesystem.hpp>
 #include <libdcp/util.h>
 extern "C" {
 #include <libavcodec/avcodec.h>
@@ -60,6 +61,9 @@ extern std::string md5_digest (std::string);
 extern std::string md5_digest (void const *, int);
 extern void ensure_ui_thread ();
 extern std::string audio_channel_name (int);
+#ifdef DVDOMATIC_WINDOWS
+extern boost::filesystem::path mo_path ();
+#endif
 
 typedef int SourceFrame;
 
index aa936523d30585f24611660a85425f07274d6f49..4a778100c8e657cb1537bae03e8515a44b178dc5 100644 (file)
@@ -416,10 +416,11 @@ private:
                info.SetDevelopers (authors);
 
                wxArrayString translators;
-               translators.Add (wxT ("Olivier Perriere (freedcp.net)"));
+               translators.Add (wxT ("Olivier Perriere"));
                translators.Add (wxT ("Lilian Lefranc"));
                translators.Add (wxT ("Thierry Journet"));
                translators.Add (wxT ("Massimiliano Broggi"));
+               translators.Add (wxT ("Manuel Acevedo"));
                info.SetTranslators (translators);
                
                info.SetWebSite (wxT ("http://carlh.net/software/dvdomatic"));
@@ -456,9 +457,9 @@ setup_i18n ()
        if (wxLocale::IsAvailable (language)) {
                locale = new wxLocale (language, wxLOCALE_LOAD_DEFAULT);
 
-#ifdef __WXGTK__
-               locale->AddCatalogLookupPathPrefix (wxT (LOCALE_PREFIX "/locale"));
-#endif
+#ifdef DVDOMATIC_WINDOWS
+               locale->AddCatalogLookupPathPrefix (std_to_wx (mo_path().string()));
+#endif         
 
                locale->AddCatalog (wxT ("libdvdomatic-wx"));
                locale->AddCatalog (wxT ("dvdomatic"));
@@ -485,15 +486,26 @@ class App : public wxApp
                unsetenv ("UBUNTU_MENUPROXY");
 #endif         
 
-               /* This needs to be before setup_i18n, as setup_i18n() will
-                  create a Config object, which needs Scalers to have
-                  been created.
+               wxInitAllImageHandlers ();
+
+               /* Enable i18n; this will create a Config object
+                  to look for a force-configured language.  This Config
+                  object will be wrong, however, because dvdomatic_setup
+                  hasn't yet been called and there aren't any scalers, filters etc.
+                  set up yet.
+               */
+               setup_i18n ();
+
+               /* Set things up, including scalers / filters etc.
+                  which will now be internationalised correctly.
                */
                dvdomatic_setup ();
 
-               wxInitAllImageHandlers ();
-               setup_i18n ();
-               
+               /* Force the configuration to be re-loaded correctly next
+                  time it is needed.
+               */
+               Config::drop ();
+
                if (!film_to_load.empty() && boost::filesystem::is_directory (film_to_load)) {
                        try {
                                film.reset (new Film (film_to_load));
diff --git a/src/tools/po/es_ES.po b/src/tools/po/es_ES.po
new file mode 100644 (file)
index 0000000..78eecb3
--- /dev/null
@@ -0,0 +1,117 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DVDOMATIC\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-03-15 08:39+0000\n"
+"PO-Revision-Date: 2013-03-20 17:05-0500\n"
+"Last-Translator: Manuel AC <manuel.acevedo@civantos.>\n"
+"Language-Team: Manuel AC <manuel.acevedo@civantos.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.5\n"
+"Language: ES-ES\n"
+
+#: src/tools/dvdomatic.cc:177
+msgid "&Analyse audio"
+msgstr "&Analizar sonido"
+
+#: src/tools/dvdomatic.cc:183
+msgid "&Edit"
+msgstr "&Editar"
+
+#: src/tools/dvdomatic.cc:182
+msgid "&File"
+msgstr "&Archivo"
+
+#: src/tools/dvdomatic.cc:185
+msgid "&Help"
+msgstr "&Ayuda"
+
+#: src/tools/dvdomatic.cc:184
+msgid "&Jobs"
+msgstr "&Tareas"
+
+#: src/tools/dvdomatic.cc:173
+msgid "&Make DCP"
+msgstr "&Hacer DCP"
+
+#: src/tools/dvdomatic.cc:161
+msgid "&Open..."
+msgstr "&Abrir..."
+
+#: src/tools/dvdomatic.cc:170
+msgid "&Preferences..."
+msgstr "&Preferencias..."
+
+#: src/tools/dvdomatic.cc:165
+msgid "&Properties..."
+msgstr "&Propiedades..."
+
+#: src/tools/dvdomatic.cc:167
+msgid "&Quit"
+msgstr "&Salir"
+
+#: src/tools/dvdomatic.cc:163
+msgid "&Save"
+msgstr "&Guardar"
+
+#: src/tools/dvdomatic.cc:174
+msgid "&Send DCP to TMS"
+msgstr "&Enviar DCP al TMS"
+
+#: src/tools/dvdomatic.cc:409
+msgid ""
+"(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole Laursen"
+msgstr ""
+"(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole Laursen"
+
+#: src/tools/dvdomatic.cc:180
+msgid "About"
+msgstr "Acerca de"
+
+#: src/tools/dvdomatic.cc:497
+msgid "Could not load film %1 (%2)"
+msgstr "No se pudo cargar la película %1 (%2)"
+
+#: src/tools/dvdomatic.cc:331
+#, c-format
+msgid "Could not open film at %s (%s)"
+msgstr "No se pudo cargar la película en %s (%s)"
+
+#: src/tools/dvdomatic.cc:287 src/tools/dvdomatic.cc:402
+#: src/tools/dvdomatic.cc:501
+msgid "DVD-o-matic"
+msgstr "DVD-o-matic"
+
+#: src/tools/dvdomatic.cc:75
+msgid "Film changed"
+msgstr "Película cambiada"
+
+#: src/tools/dvdomatic.cc:408
+msgid "Free, open-source DCP generation from almost anything."
+msgstr ""
+"Generación de DCP a partir de casi cualquier fuente, libre y de código "
+"abierto."
+
+#: src/tools/dvdomatic.cc:160
+msgid "New..."
+msgstr "Nuevo..."
+
+#: src/tools/dvdomatic.cc:175
+msgid "S&how DCP"
+msgstr "&Mostrar DCP"
+
+#: src/tools/dvdomatic.cc:319
+msgid "Select film to open"
+msgstr "Selecciona la película a abrir"
+
+#: src/tools/dvdomatic.cc:303
+#, c-format
+msgid "The directory %s already exists."
+msgstr "La carpeta %s ya existe."
index 10702f8a00239db4e92545f3d58245be4ae7c539..16e3837c8c64274a4d409f5be719c63e490e99e2 100644 (file)
@@ -36,7 +36,6 @@ dcp_frame_rate 0
 width 0
 height 0
 length 0
-dcp_intrinsic_duration 0
 content_digest 
 external_audio_stream external 0 0
 source_frame_rate 0
index f31b3b1cabfe64689e30e5fe76c72693f18a9ec4..61e192058b0087e516e4e94cfd5eee09ec6bb47f 100644 (file)
@@ -102,6 +102,7 @@ BOOST_AUTO_TEST_CASE (make_black_test)
        pix_fmts.push_back (AV_PIX_FMT_YUV444P9BE);
        pix_fmts.push_back (AV_PIX_FMT_YUV444P10LE);
        pix_fmts.push_back (AV_PIX_FMT_YUV444P10BE);
+       pix_fmts.push_back (AV_PIX_FMT_UYVY422);
 
        int N = 0;
        for (list<AVPixelFormat>::const_iterator i = pix_fmts.begin(); i != pix_fmts.end(); ++i) {
index 3a07080fcac4d154dce903be9a64e514a8b81a5a..b2bb2f3a99b8aa7b4e3f0c3b6afffd99800cc04e 100644 (file)
@@ -93,14 +93,16 @@ File "%deps%/etc/ImageMagick/delegates.xml"
 SetOutPath "$PROFILE\.magick"
 File "%deps%/etc/ImageMagick/delegates.xml"
 
-SetOutPath "$INSTDIR\bin\fr_FR"
+SetOutPath "$INSTDIR\locale\fr\LC_MESSAGES"
 File "%binaries%/src/lib/mo/fr_FR/libdvdomatic.mo"
 File "%binaries%/src/wx/mo/fr_FR/libdvdomatic-wx.mo"
 File "%binaries%/src/tools/mo/fr_FR/dvdomatic.mo"
-SetOutPath "$INSTDIR\bin\it_IT"
+SetOutPath "$INSTDIR\locale\it\LC_MESSAGES"
 File "%binaries%/src/lib/mo/it_IT/libdvdomatic.mo"
 File "%binaries%/src/wx/mo/it_IT/libdvdomatic-wx.mo"
 File "%binaries%/src/tools/mo/it_IT/dvdomatic.mo"
+SetOutPath "$INSTDIR\locale\es\LC_MESSAGES"
+File "%binaries%/src/tools/mo/es_ES/dvdomatic.mo"
 
 CreateShortCut "$DESKTOP\DVD-o-matic.lnk" "$INSTDIR\bin\dvdomatic.exe" ""
 CreateShortCut "$DESKTOP\DVD-o-matic encode server.lnk" "$INSTDIR\bin\servomatic_gui.exe" ""
index 5e4298cbe09fce552a77b2f713011f4e04d04dce..92117859106e9d330567c03d39d925cc6370a1b6 100644 (file)
@@ -103,12 +103,11 @@ File "%deps%/etc/ImageMagick/delegates.xml"
 SetOutPath "$PROFILE\.magick"
 File "%deps%/etc/ImageMagick/delegates.xml"
 
-SetOutPath "$INSTDIR\bin\fr_FR"
+SetOutPath "$INSTDIR\locale\fr\LC_MESSAGES"
 File "%binaries%/src/lib/mo/fr_FR/libdvdomatic.mo"
 File "%binaries%/src/wx/mo/fr_FR/libdvdomatic-wx.mo"
 File "%binaries%/src/tools/mo/fr_FR/dvdomatic.mo"
-
-SetOutPath "$INSTDIR\bin\it_IT"
+SetOutPath "$INSTDIR\locale\it\LC_MESSAGES"
 File "%binaries%/src/lib/mo/it_IT/libdvdomatic.mo"
 File "%binaries%/src/wx/mo/it_IT/libdvdomatic-wx.mo"
 File "%binaries%/src/tools/mo/it_IT/dvdomatic.mo"
diff --git a/wscript b/wscript
index 4f81e493416b5ade9d028d4459c026c6f999c09c..612abdf223ea2be0f7e2895406803a91d38020c2 100644 (file)
--- a/wscript
+++ b/wscript
@@ -22,8 +22,7 @@ def configure(conf):
         conf.load('winres')
 
     conf.env.append_value('CXXFLAGS', ['-D__STDC_CONSTANT_MACROS', '-msse', '-mfpmath=sse', '-ffast-math', '-fno-strict-aliasing',
-                                       '-Wall', '-Wno-attributes', '-Wextra',
-                                       '-DLOCALE_PREFIX="%s/share/locale"' % conf.env['PREFIX']])
+                                       '-Wall', '-Wno-attributes', '-Wextra'])
 
     if conf.options.target_windows:
         conf.env.append_value('CXXFLAGS', ['-DDVDOMATIC_WINDOWS', '-DWIN32_LEAN_AND_MEAN', '-DBOOST_USE_WINDOWS_H', '-DUNICODE'])
@@ -37,6 +36,7 @@ def configure(conf):
         boost_thread = 'boost_thread_win32-mt'
     else:
         conf.env.append_value('CXXFLAGS', '-DDVDOMATIC_POSIX')
+        conf.env.append_value('CXXFLAGS', '-DPOSIX_LOCALE_PREFIX="%s/share/locale"' % conf.env['PREFIX'])
         boost_lib_suffix = ''
         boost_thread = 'boost_thread'
         conf.env.append_value('LINKFLAGS', '-pthread')