[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mythtv-dev
Subject:    [mythtv] MythDVD-0.13 Subtitle/Captions Patch
From:       Alex <alex () agni ! phys ! iit ! edu>
Date:       2003-12-31 9:20:57
Message-ID: Pine.WNT.4.56.0312310319410.852 () snoot
[Download RAW message or body]

This is a MIME-formatted message.  If you see this text it means that your
E-mail software does not support MIME-formatted messages.


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


["mythdvd-0.13-subtitles.patch" (application/octet-stream)]

diff -aur mythdvd-0.13/mythdvd/main.cpp mythdvd-0.13-subtitle/mythdvd/main.cpp
--- mythdvd-0.13/mythdvd/main.cpp	2003-11-27 17:43:16.000000000 -0600
+++ mythdvd-0.13-subtitle/mythdvd/main.cpp	2003-12-31 03:01:25.000000000 -0600
@@ -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,8 +149,22 @@
             }
             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();
diff -aur mythdvd-0.13/mythdvd/settings.cpp \
                mythdvd-0.13-subtitle/mythdvd/settings.cpp
--- mythdvd-0.13/mythdvd/settings.cpp	2003-11-27 09:29:53.000000000 -0600
+++ mythdvd-0.13-subtitle/mythdvd/settings.cpp	2003-12-31 02:58:34.000000000 -0600
@@ -73,13 +73,44 @@
     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)."));
     };
 };
 
+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. "));
+    };
+};
+
+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. "));
+    };
+};
+
 #ifdef VCD_SUPPORT
 class VCDPlayerCommand: public LineEditSetting, public GlobalSetting {
 public:
@@ -100,6 +131,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"));



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic