mplayer.sh and AID 0

Message ID da3vcd$c13$1@video.local.muempf.de
State New
Headers

Commit Message

Stefan Huelswitt July 1, 2005, 5:43 p.m. UTC
  Hi,

attached is a patch which:

1.) fix the AID 0 problem. AID 0 is now allways passed. The
default autoselect is now on AID -1. To enter the -1 value, first
press 0 and than left.

2.) supports switch_audio slave command. The command is mapped to
key 2.

Regards.

PS: line numbers may be a bit off
  

Comments

C.Y.M July 1, 2005, 10:06 p.m. UTC | #1
Stefan Huelswitt wrote:
> diff -urN -X mp3-unstable/.exclude mp3-0.9.12/mplayer.c mp3-unstable/mplayer.c
> --- mp3-0.9.12/mplayer.c	2005-02-21 18:30:01.000000000 +0100
> +++ mp3-unstable/mplayer.c	2005-07-01 19:26:51.000000000 +0200

Thanks! So, after applying this to the mplayer plugin, what should be changed in
mplayer.sh?

Best Regards,
C.
  
Juri Haberland July 2, 2005, 12:24 a.m. UTC | #2
"C.Y.M" <syphir@syphir.sytes.net> wrote:
> Thanks! So, after applying this to the mplayer plugin, what should be changed in
> mplayer.sh?

At best - nothing. Just use a recent (>= 1.0pre7) version of mplayer and
cycle through the available audio tracks with button number '2'.

Cheers,
    Juri
  
C.Y.M July 2, 2005, 12:46 a.m. UTC | #3
Juri Haberland wrote:
> "C.Y.M" <syphir@syphir.sytes.net> wrote:
> 
>>Thanks! So, after applying this to the mplayer plugin, what should be changed in
>>mplayer.sh?
> 
> 
> At best - nothing. Just use a recent (>= 1.0pre7) version of mplayer and
> cycle through the available audio tracks with button number '2'.
> 

I guess there is no need to add 1 to the AID when a DivX is detected now.. :)

Thanks,
C.
  
Stefan Huelswitt July 2, 2005, 12:10 p.m. UTC | #4
On 02 Jul 2005 Juri Haberland <list-linux.vdr@koschikode.com> wrote:
> "C.Y.M" <syphir@syphir.sytes.net> wrote:
>> Thanks! So, after applying this to the mplayer plugin, what should be changed in
>> mplayer.sh?
> 
> At best - nothing. Just use a recent (>= 1.0pre7) version of mplayer and
> cycle through the available audio tracks with button number '2'.

I'm not sure about, but any feedback welcome.

Regards.
  
C.Y.M July 2, 2005, 1:30 p.m. UTC | #5
Stefan Huelswitt wrote:
> On 02 Jul 2005 Juri Haberland <list-linux.vdr@koschikode.com> wrote:
> 
>>"C.Y.M" <syphir@syphir.sytes.net> wrote:
>>
>>>Thanks! So, after applying this to the mplayer plugin, what should be changed in
>>>mplayer.sh?
>>
>>At best - nothing. Just use a recent (>= 1.0pre7) version of mplayer and
>>cycle through the available audio tracks with button number '2'.
> 
> 
> I'm not sure about, but any feedback welcome.
> 

Ok, This is what I have seen so far (while using this new patch for the mplayer
plugin).

If I set the AID to "default", and do not make any changes to mplayer.sh-0.8.6
(reversing my patch above), then I am able to switch AIDs on the fly using the
"2" key on the remote.  But, without any changes to mplayer.sh, I am not able to
specify a particular default AID (ie; setting AID to 0,1,2,...).  This would not
be a problem, except that Mplayer seems to default to AID=1 when there are two
audio pids (0 and 1).  IMHO, Mplayer should default to 0 before 1, if they both
exist (apid 1 is the secondary audio track, so it should default to apid 0 first).

After re-applying the changes to mplayer.sh with my original patch on this
thread, and setting the default AID to 0, and then trying to play a file that
only contains AID 1, I am not able to switch to AID 1 using button "2" on the
remote.  But, If I try to play a file with two apids (0 and 1), then I can still
switch between the two audio IDs with these changes to mplayer.sh.  If mplayer
does not start with a valid apid, then it will not be able to switch between
apids.  Therefore, I still had to add some logic to mplayer.sh that detects AVI
file types and sets the apid to 1 (no matter what the default is in the plugin).
Also, it appears that the mplayer plugin is still not returning "AID 0" to the
mplayer.sh script.

Best Regards,
C.
  

Patch

diff -urN -X mp3-unstable/.exclude mp3-0.9.12/mplayer.c mp3-unstable/mplayer.c
--- mp3-0.9.12/mplayer.c	2005-02-21 18:30:01.000000000 +0100
+++ mp3-unstable/mplayer.c	2005-07-01 19:26:51.000000000 +0200
@@ -458,20 +458,15 @@ 
           case kOk: if(visible && !modeOnly) { Hide(); DoShowMode=true; }
                     else ShowTimed();
                     break;
-          case k0:  player->DvdNav(navMenu); break;
           case k1:  player->AudioDelay(1); break;
-          case k2:  player->DvdNav(navUp); break;
+          case k2:  player->SwitchAudio(); break;
           case k3:  if(visible && !modeOnly) {
                       Hide();
                       osdPos--; if(osdPos<-6) osdPos=-6;
                       ShowTimed();
                       }
                     break;
-          case k4:  player->DvdNav(navLeft); break;
-          case k5:  player->DvdNav(navSelect); break;
-          case k6:  player->DvdNav(navRight); break;
           case k7:  player->AudioDelay(-1); break;
-          case k8:  player->DvdNav(navDown); break;
           case k9:  if(visible && !modeOnly) {
                       Hide();
                       osdPos++; if(osdPos>0) osdPos=0;
@@ -499,7 +494,7 @@ 
 cMenuMPlayAid::cMenuMPlayAid(void)
 :cOsdMenu(tr("MPlayer Audio ID"),20)
 {
-  Add(new cMenuEditIntItem(tr("Audiostream ID"),&MPlayerAid,0,255));
+  Add(new cMenuEditIntItem(tr("Audiostream ID"),&MPlayerAid,-1,255));
   Display();
 }
 
@@ -538,7 +533,7 @@ 
 void cMenuMPlayBrowse::SetButtons(void)
 {
   static char blue[12];
-  snprintf(blue,sizeof(blue),"AID:%d",MPlayerAid);
+  snprintf(blue,sizeof(blue),MPlayerAid>=0 ? "AID:%d" : "AID:def",MPlayerAid);
   SetHelp(tr("Play"), MPlayerSetup.ResumeMode ? tr("Rewind"):0, tr("Source"), blue);
   Display();
 }
diff -urN -X mp3-unstable/.exclude mp3-0.9.12/player-mplayer.c mp3-unstable/player-mplayer.c
--- mp3-0.9.12/player-mplayer.c	2005-01-12 18:07:22.000000000 +0100
+++ mp3-unstable/player-mplayer.c	2005-07-01 19:15:41.000000000 +0200
@@ -48,7 +49,7 @@ 
 #define MPLAYER_2_VDR(x) (MIN((int)((x)*2.55),255))
 
 const char *MPlayerCmd = "mplayer.sh";
-int MPlayerAid=0;
+int MPlayerAid=-1;
 
 // -- cMPlayerStatus -----------------------------------------------------------
 
@@ -611,17 +640,10 @@ 
     }
 }
 
-void cMPlayerPlayer::DvdNav(eDvdNav mode)
+void cMPlayerPlayer::SwitchAudio(void)
 {
   if(slave) {
-    switch(mode) {
-      case navUp:     MPlayerControl("dvdnav 1"); break;
-      case navDown:   MPlayerControl("dvdnav 2"); break;
-      case navLeft:   MPlayerControl("dvdnav 3"); break;
-      case navRight:  MPlayerControl("dvdnav 4"); break;
-      case navMenu:   MPlayerControl("dvdnav 5"); break;
-      case navSelect: MPlayerControl("dvdnav 6"); break;
-      }
+    MPlayerControl("switch_audio");
     }
 }
 
diff -urN -X mp3-unstable/.exclude mp3-0.9.12/player-mplayer.h mp3-unstable/player-mplayer.h
--- mp3-0.9.12/player-mplayer.h	2005-01-09 13:33:23.000000000 +0100
+++ mp3-unstable/player-mplayer.h	2005-07-01 19:13:56.000000000 +0200
@@ -48,8 +48,6 @@ 
 
 // ----------------------------------------------------------------
 
-enum eDvdNav { navUp, navDown, navLeft, navRight, navMenu, navSelect };
-
 class cMPlayerPlayer : public cPlayer, cThread {
 private:
   cFileObj *file;
@@ -82,7 +81,7 @@ 
   void SkipSeconds(int secs);
   void Osd(void);
   void AudioDelay(int del);
-  void DvdNav(eDvdNav mode);
+  void SwitchAudio(void);
   virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame);
   virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed);
   };