Is there a current Mplayer.sh for apid selection?

Message ID 4224BDCD.50100@syphir.sytes.net
State New
Headers

Commit Message

C.Y.M March 1, 2005, 7:09 p.m. UTC
  Since Mplayer 0.9.8, there was a new option to select the audio pid during play 
back.  There were a few patches floating around and the one attached to this 
email is what I am currently using against the current version of mplayer.sh. 
But, I am having a problem with this patch as it sometimes selects the secondary 
audio track (which is usually in a different language) and I am unable to get 
mplayer to use the primary apid.  I have attached this patch as reference, but 
there is something still wrong with the audio selection. Does anyone have a 
working solution?

Best Regards,
  

Comments

Lars Altenhain March 1, 2005, 10:39 p.m. UTC | #1
Hi,

C.Y.M schrieb:

> Since Mplayer 0.9.8, there was a new option to select the audio pid 
> during play back.  There were a few patches floating around and the 
> one attached to this email is what I am currently using against the 
> current version of mplayer.sh. But, I am having a problem with this 
> patch as it sometimes selects the secondary audio track (which is 
> usually in a different language) and I am unable to get mplayer to use 
> the primary apid.  I have attached this patch as reference, but there 
> is something still wrong with the audio selection. Does anyone have a 
> working solution?
>
> Best Regards,
>
This effect is due to the different numbering scheme for audio tracks in 
mpeg and avi files (avi: 1-99, mpeg: 0-31, see man mplayer). Some time 
ago I had posted a patch for the mplayer.sh in the forum on vdrportal.de 
(http://www.vdrportal.de/board/thread.php?postid=177058#post177058). 
This patch increases the AID variable by 1 if an avi file is detected. 
And it also checks if the selected audio track is available in the file. 
If the selected audio track number is not present in the file, the -aid 
parameter is not used in the mplayer command line. This patch is for an 
older version of the mplayer.sh file, so I think it doesn't apply 
without some small changes.

Best Regards
Lars
  

Patch

--- mplayer.sh.orig	2004-11-29 18:23:23.000000000 -0800
+++ mplayer.sh	2004-11-29 18:27:00.000000000 -0800
@@ -178,7 +178,7 @@ 
   if test -z "$VO"; then errorcfg VO; exit; else debugvar VO "$VO"; fi
 
   if test -z "$AO"; then errorcfg AO; exit; else debugvar AO "$AO"; fi
-  AOUT="-ao $AO"
+  AOUT="-ao $AO $AID"
 
   if test -z $CACHE; then
     echolog "*** Option CACHE not set in config file - calling mplayer without Cache!"
@@ -481,7 +481,14 @@ 
 declare ORIG_FPS NEW_FPS ORIG_ASPECT VIDEO_FORMAT AUDIO_CODEC
 declare CMDLINE AOUT REMOTE USERDEF SUFFIX
 declare FILE="$1"
-declare SLAVE="$2"
+while shift; do
+  if [ "$1" = "SLAVE" ]; then
+    declare SLAVE="$1"
+  elif [ "$1" = "AID" ]; then
+    declare AID="-aid $2"
+    shift
+  fi
+done
 declare -a XResPAL[0]
 declare -a XResNTSC[0]
 declare FDSTR=""