[mythtv] [patch] MythDVD subtitle options

Alex alex at agni.phys.iit.edu
Wed Dec 31 19:12:23 EST 2003


(Resubmitted with proper versions, etc)

This is a patch I just created to allow easy manipulation of some mplayer
commandline args. In the DVD Play Settings menu it allows you to turn
on/off captions, subtitles, and which title to play.

If you use each function (it'll work if these aren't in), you need a
%subtitle and a %title string in the DVDPlayerCommand variable (in MySQL).
Also, I changed the %d for the device to %device.

My mplayer commandline is: mplayer dvd://%title -dvd-device %device -fs
-zoom -font /usr/local/share/mythtv/FreeSans.ttf %subtitle
-subfont-autoscale 2 -subfont-text-scale 3.5 -sub-bg-alpha 155
-sub-bg-color 0 -subwidth 80 -vo xv

Patch is attached.

Hope its usable! This is my first submittion :)

-alex
-------------- next part --------------
Index: mythdvd/mythdvd/main.cpp
===================================================================RCS file: /var/lib/mythcvs/mythdvd/mythdvd/main.cpp,v
retrieving revision 1.11
diff -u -d -r1.11 main.cpp
--- mythdvd/mythdvd/main.cpp    26 Dec 2003 07:16:09 -0000      1.11
+++ mythdvd/mythdvd/main.cpp    1 Jan 2004 00:09:36 -0000
@@ -129,17 +129,16 @@
     }
     else
     {
-        if(command_string.contains("%d"))
+        if(command_string.contains("%title"))
+        {
+            QString dvd_title = gContext->GetSetting("DVDTitle");
+            command_string = command_string.replace( QRegExp("%title"), dvd_title );
+        }
+        if(command_string.contains("%device"))
         {
-            //
-            //  Need to do device substitution
-            //
             QString dvd_device = gContext->GetSetting("DVDDeviceLocation");
             if(dvd_device.length() < 1)
             {
-                //
-                //  RTF README
-                //
                 DialogBox *no_device_dialog = new DialogBox(gContext->GetMainWindow(),
                            QObject::tr("\n\nYou have no DVD Device defined."));
                 no_device_dialog->AddButton(QObject::tr("OK, I'll go run Setup"));
@@ -150,9 +149,23 @@
             }
             else
             {
-                command_string = command_string.replace( QRegExp("%d"), dvd_device );
+                command_string = command_string.replace( QRegExp("%device"), dvd_device );
             }
         }
+        if(command_string.contains("%subtitle"))
+        {
+            QString dvd_subtitle;
+            if(gContext->GetNumSetting("DVDCaptions", 0))
+            {
+                dvd_subtitle.append("-subcc ");
+            }
+            if(gContext->GetNumSetting("DVDSubTitleLang", 0))
+            {
+                dvd_subtitle.append("-slang en ");
+            }
+            dvd_subtitle.truncate((dvd_subtitle.length() - 1));
+            command_string = command_string.replace( QRegExp("%subtitle"), dvd_subtitle );
+        }
         myth_system(command_string);
         gContext->GetMainWindow()->raise();
         gContext->GetMainWindow()->setActiveWindow();
Index: mythdvd/mythdvd/settings.cpp
===================================================================RCS file: /var/lib/mythcvs/mythdvd/mythdvd/settings.cpp,v
retrieving revision 1.19
diff -u -d -r1.19 settings.cpp
--- mythdvd/mythdvd/settings.cpp        26 Dec 2003 07:16:09 -0000      1.19
+++ mythdvd/mythdvd/settings.cpp        1 Jan 2004 00:09:36 -0000
@@ -73,10 +73,43 @@
     PlayerCommand():
         GlobalSetting("DVDPlayerCommand") {
         setLabel(QObject::tr("DVD Player Command"));
-        setValue("mplayer dvd:// -dvd-device %d -fs -zoom -vo xv");
+        setValue("mplayer dvd://%title -dvd-device %device -fs -zoom -font /usr/local/share/mythtv/FreeSans.ttf %subtitle -subfont-autoscale 2 -subfont-text-scale 3.5 -sub-bg-alpha 155 -sub-bg-color 0 -subwidth 80 -vo xv");
         setHelpText(QObject::tr("This can be any command to launch a DVD player "
-                    "(e.g. MPlayer, ogle, etc.). If present, %d will "
-                    "be substituted for the DVD device (e.g. /dev/dvd)."));
+                    "(e.g. MPlayer, ogle, etc.). If present, %device will "
+                    "be substituted for the DVD device (e.g. /dev/dvd); "
+                    "%subtitle will be substituted for subtitle options and "
+                    "%title for the title number."));
+    };
+};
+
+class PlayerPlayTitle: public SpinBoxSetting, public GlobalSetting {
+public:
+    PlayerPlayTitle():
+        SpinBoxSetting(1, 30, 1), GlobalSetting("DVDTitle") {
+        setLabel(QObject::tr("DVD Title"));
+        setValue(1);
+        setHelpText(QObject::tr("This can be any title number to play. "
+                    "some movies have the movie under a different title number."));
+    };
+};
+
+class PlayerCaptionOptions: public CheckBoxSetting, public GlobalSetting {
+public:
+    PlayerCaptionOptions():
+        GlobalSetting("DVDCaptions") {
+        setLabel(QObject::tr("DVD Captions"));
+        setValue(true);
+        setHelpText(QObject::tr("Turn captions on or off. (Mplayer option '-subcc')"));
+    };
+};
+
+class PlayerSubTitleOptions: public CheckBoxSetting, public GlobalSetting {
+public:
+    PlayerSubTitleOptions():
+        GlobalSetting("DVDSubTitleLang") {
+        setLabel(QObject::tr("DVD Subtitles"));
+        setValue(false);
+        setHelpText(QObject::tr("Turn subtitles on or off. (MPlayer option '-slang en')"));
     };
 };
 
@@ -100,6 +133,9 @@
     VerticalConfigurationGroup* playersettings = new VerticalConfigurationGroup(false);
     playersettings->setLabel(QObject::tr("DVD Player Settings"));
     playersettings->addChild(new PlayerCommand());
+    playersettings->addChild(new PlayerPlayTitle());
+    playersettings->addChild(new PlayerCaptionOptions());
+    playersettings->addChild(new PlayerSubTitleOptions());
 #ifdef VCD_SUPPORT
     VerticalConfigurationGroup* VCDplayersettings = new VerticalConfigurationGroup(false);
     VCDplayersettings->setLabel(QObject::tr("VCD Player Settings"));


More information about the mythtv-dev mailing list