tiistai 16. syyskuuta 2008

Tweaking the DVD burning

I noticed that burn plugin doesn't set the subtitle track on by default. This patch modifies the behaviour so that first subtitle track is set on by default.

--- config.c.orig 2008-09-16 22:53:54.000000000 +0300
+++ config.c    2008-09-16 22:55:02.000000000 +0300
@@ -194,6 +194,7 @@

                                m_file << "" <<>
                                m_file << " " <<>
+                               << "        
 s2=64; 
" <>
                                  << "        get_movie_path() << "\" chapters=\""
                                  <<>get_chapters(m_job.get_chapters_mode()) << "\"/>" <<>

keskiviikko 3. syyskuuta 2008

Fixing the DVD playback, take two

Ok, the previous hack did work with most of DVDs, but not with ones made with VDR's burn plugin. So I changed the code a bit more and now subtitle menu works and includes new item on second row that actually set subtitle selection for xine to 'Auto'. There's also fixes for finnish translations and modified remote buttons for DVD playback.



diff -ruN /home/user/vdr-xineliboutput-cvs-20080817/frontend.c xineliboutput/frontend.c
--- /home/user/vdr-xineliboutput-cvs-20080817/frontend.c 2008-07-30 17:43:16.000000000 +0300
+++ xineliboutput/frontend.c 2008-09-03 22:31:42.000000000 +0300
@@ -111,6 +111,12 @@
 #if VDRVERSNUM <>
     cXinelibDevice::Instance().ClrAvailableDvdSpuTracks(false);
 #endif
+    char buffer[4];
+    char *q = buffer;
+    const char *s = I18nLanguageCode(Setup.SubtitleLanguages[0]);    
+    if (s)      
+      strncpy(q, s, 3);     
+    cXinelibDevice::Instance().SetAvailableTrack(ttSubtitle, 0, 1, q);
     while(*map) {
       bool Current = false;
       while(*map == ' ') map++;
@@ -124,7 +130,7 @@
  }
       }
       if(*map >= '0' && *map <= '9') {
- int id = atoi(map);
+ int id = atoi(map) +1;
  while(*map && *map != ':') map++;
  if(*map == ':') map++;
  char *lang = map;
@@ -382,11 +388,32 @@
 #else
 void cXinelibThread::SetSubtitleTrack(eTrackType Track)
 {
+  int TempTrack = 0;
+  if (Track == ttNone)
+  {
+    TempTrack = 0;
+  }
+  else if (Track == ttSubtitleFirst)
+  {
+    TempTrack = 999;
+  }
+  else
+  {
+    TempTrack = Track - 1;
+  }
   TRACEF("cXinelibThread::SetSubtitleTrack");
-  cString buf = cString::sprintf("SPUSTREAM %d%s", 
- Track==ttNone ? ttXSubtitleNone  : (Track - ttSubtitleFirst), 
+  if (TempTrack == 999)
+  {
+    cString buf = cString::sprintf("SPUSTREAM %d%s", ttXSubtitleAuto, " auto");
+    Xine_Control(buf);
+  }
+  else
+  {
+    cString buf = cString::sprintf("SPUSTREAM %d%s",
+ Track==ttNone ? ttXSubtitleNone  : (TempTrack - ttSubtitleFirst), 
  m_SpuLangAuto ? " auto" : "");
-  Xine_Control(buf);
+    Xine_Control(buf);
+  }
 }
 #endif
 
diff -ruN /home/user/vdr-xineliboutput-cvs-20080817/media_player.c xineliboutput/media_player.c
--- /home/user/vdr-xineliboutput-cvs-20080817/media_player.c 2008-07-20 13:44:02.000000000 +0300
+++ xineliboutput/media_player.c 2008-09-03 23:06:24.000000000 +0300
@@ -130,6 +130,7 @@
 
 void cXinelibPlayer::SetSubtitleTrack(eTrackType Type, const tTrackId *TrackId)
 {
+dsyslog("media_player.c: setsubtitletrack");
 #if VDRVERSNUM >= 10515
   cXinelibDevice::Instance().SetSubtitleTrackDevice(Type);
 #endif
@@ -847,14 +848,14 @@
 
 class cDvdMenu : public cOsdMenu {
  public:
-  cDvdMenu(void) : cOsdMenu("DVD Menu")
+  cDvdMenu(void) : cOsdMenu(tr("DVD Menu"))
   {
-    Add(new cOsdItem("Exit DVD menu",  osUser1));
-    Add(new cOsdItem("DVD Root menu",  osUser2));
-    Add(new cOsdItem("DVD Title menu", osUser3));
-    Add(new cOsdItem("DVD SPU menu",   osUser4));
-    Add(new cOsdItem("DVD Audio menu", osUser5));
-    Add(new cOsdItem("Close menu",     osEnd));
+    Add(new cOsdItem(tr("Exit DVD menu"),  osUser1));
+    Add(new cOsdItem(tr("DVD Root menu"),  osUser2));
+    Add(new cOsdItem(tr("DVD Title menu"), osUser3));
+    Add(new cOsdItem(tr("DVD SPU menu"),   osUser4));
+    Add(new cOsdItem(tr("DVD Audio menu"), osUser5));
+    Add(new cOsdItem(tr("Close menu"),     osEnd));
     Display();
   }
 };
@@ -953,8 +954,8 @@
       // Replay control
       case kUp:    Key = kPlay;    break;
       case kDown:  Key = kPause;   break;
-      case kLeft:  Key = kFastRew; break;
-      case kRight: Key = kFastFwd; break;
+      case kLeft:  Key = kPrev; break;
+      case kRight: Key = kNext; break;
       case kOk:    
    if(m_Player->Speed() != 1) {
      Hide();
@@ -1010,15 +1011,17 @@
     case k3:      m_Player->Control("SEEK +20");  break;
 
     case kStop: 
-    case kBlue:   Hide();
-                  Close();
-                  return osEnd;
+//    case kBlue:   Hide();
+//                  Close();
+//                  return osEnd;
 
     case k9:      m_Player->Control("EVENT XINE_EVENT_INPUT_NEXT TITLE"); break;
     case k7:      m_Player->Control("EVENT XINE_EVENT_INPUT_PREVIOUS TITLE"); break;
     case k6:
+//    case kYellow:
     case kNext:   m_Player->Control("EVENT XINE_EVENT_INPUT_NEXT CHAPTER"); break;
     case k4:
+//    case kGreen:
     case kPrev:   m_Player->Control("EVENT XINE_EVENT_INPUT_PREVIOUS CHAPTER"); break;
 
     case kFastFwd:
diff -ruN /home/user/vdr-xineliboutput-cvs-20080817/po/fi_FI.po xineliboutput/po/fi_FI.po
--- /home/user/vdr-xineliboutput-cvs-20080817/po/fi_FI.po 2008-06-12 02:29:09.000000000 +0300
+++ xineliboutput/po/fi_FI.po 2008-09-03 23:06:31.000000000 +0300
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: VDR 1.5.7\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-23 12:36+0300\n"
+"POT-Creation-Date: 2008-09-03 23:03+0300\n"
 "PO-Revision-Date: 2007-11-23 10:17+0200\n"
 "Last-Translator: Petri Hintukainen\n"
 "Language-Team: \n"
@@ -134,26 +134,42 @@
 msgstr "Laitteistolla"
 
 msgid "no"
-msgstr ""
+msgstr "ei"
 
 msgid "grayscale"
-msgstr ""
+msgstr "harmaasävy"
 
 msgid "transparent"
-msgstr ""
+msgstr "läpinäkyvä"
 
 msgid "transparent grayscale"
-msgstr ""
+msgstr "läpinäkyvä harmaasävy"
 
 msgid "yes"
-msgstr ""
+msgstr "kyllä"
 
 msgid "nearest"
-msgstr ""
+msgstr "lähin"
 
 msgid "bilinear"
+msgstr "bilineaarinen"
+
+msgid "none"
+msgstr "ei mitään"
+
+msgid "nonref"
 msgstr ""
 
+msgid "bidir"
+msgstr "kaksisuuntainen"
+
+msgid "nonkey"
+msgstr ""
+
+#, fuzzy
+msgid "all"
+msgstr "pieni"
+
 msgid "Frontend initialization failed"
 msgstr "Näyttölaitteen alustus epäonnistui"
 
@@ -187,6 +203,27 @@
 msgid "Normal play"
 msgstr "Normaali toisto"
 
+msgid "DVD Menu"
+msgstr "DVD valikko"
+
+msgid "Exit DVD menu"
+msgstr "Palaa DVD valikkoon"
+
+msgid "DVD Root menu"
+msgstr "DVD päävalikko"
+
+msgid "DVD Title menu"
+msgstr "DVD nimikevalikko"
+
+msgid "DVD SPU menu"
+msgstr "DVD tekstitysvalikko"
+
+msgid "DVD Audio menu"
+msgstr "DVD äänivalikko"
+
+msgid "Close menu"
+msgstr "Sulje"
+
 msgid "Delete image ?"
 msgstr "Poistetaanko kuva ?"
 
@@ -254,7 +291,7 @@
 msgstr "Ääniasetukset"
 
 msgid "Headphone audio mode"
-msgstr ""
+msgstr "Kuuloke tila"
 
 msgid "Audio Compression"
 msgstr "Voimista hiljaisia ääniä"
@@ -275,7 +312,7 @@
 msgstr "Videon kuvasuhde"
 
 msgid "On"
-msgstr ""
+msgstr "Päällä"
 
 msgid "Deinterlacing"
 msgstr "Lomituksen poisto"
@@ -287,13 +324,13 @@
 msgstr "Miksaa AC3-ääni surroundiksi"
 
 msgid "Default playlist not found"
-msgstr ""
+msgstr "Oletussoittolistaa ei löydy"
 
 msgid "Default playlist is not symlink"
-msgstr ""
+msgstr "Oletussoittolista ei ole symbolinenlinkki"
 
 msgid "Default playlist not defined"
-msgstr ""
+msgstr "Oletussoittolistaa ei ole määritelty"
 
 msgid "Delay"
 msgstr "Viive"
@@ -315,7 +352,7 @@
 msgstr "Äänenvoimakkuuden säätö"
 
 msgid "Mix to headphones"
-msgstr ""
+msgstr "Miksaa kuulokkeille"
 
 msgid "Visualization"
 msgstr "Visualisointi"
@@ -474,7 +511,7 @@
 msgstr "Erillisen tekstityksen koko"
 
 msgid "DVB subtitle decoder"
-msgstr ""
+msgstr "DVB tekstitysdekooderi"
 
 msgid "Decoder"
 msgstr "Dekooderi"
@@ -599,6 +636,9 @@
 msgid "Cache metainfo"
 msgstr "Tallenna metatieto"
 
+msgid "Arrow keys control DVD playback"
+msgstr "Kontrolloi DVD toistoa nuolinäppäimillä"
+
 msgid "Grayscale"
 msgstr "Harmaasävy"
 
@@ -606,7 +646,7 @@
 msgstr "Bittikartta"
 
 msgid "OSD"
-msgstr ""
+msgstr "Kuvaruutunäyttö"
 
 msgid "Media Player"
 msgstr "Mediasoitin"

tiistai 2. syyskuuta 2008

Fixing the DVD playback and new show stopper

I found a solution to the DVD playback problems. First thing to do was to change line in config_xineliboutput file which resides in /root/.xine folder. I had to uncomment line media.dvd.language and set it to 'fi'. Then I made change into xineliboutput code; frontend.c

original:

 void cXinelibThread::SetSubtitleTrack(eTrackType Track)
{
  TRACEF("cXinelibThread::SetSubtitleTrack");
  cString buf = cString::sprintf("SPUSTREAM %d%s", 
Track==ttNone ? ttXSubtitleNone  : (Track - ttSubtitleFirst), 
m_SpuLangAuto ? " auto" : "");
  Xine_Control(buf);
}

modified:

void cXinelibThread::SetSubtitleTrack(eTrackType Track)
{
  TRACEF("cXinelibThread::SetSubtitleTrack");
  cString buf = cString::sprintf("SPUSTREAM %d%s", ttXSubtitleAuto, " auto");
  Xine_Control(buf);
}

So also DVD playback is working now, but I found much bigger problem. When Mini is hooked to the TV and is put to sleep and then waked up the TV output is messed up. Problem is that the TV out adapter is not recognized after sleep. It is only recognized after reboot.

I couldn't find any solution for that yet so the project is on hold for a while.