mplayer.sh and AID 0

Message ID 42BEEA3F.8060707@syphir.sytes.net
State New
Headers

Commit Message

C.Y.M June 26, 2005, 5:47 p.m. UTC
  C.Y.M wrote:
> I was just debugging mplayer.sh because I could not get it to play a .vdr file
> with an audio track set to "0", then I realized that if the AID is set to 0, the
> mplayer plugin does not actually specify 0 for the AID track (it just leaves it
> blank).  The following changes to mplayer.sh fix the problem.
> 
> while shift; do
>   if [ "$1" = "SLAVE" ]; then
>     declare SLAVE="$1"
>   elif [ "$1" = "AID" ]; then
>     declare AID="-aid $2"
>     shift
>   fi
>   if [ "$AID" = "" ]; then
>     declare AID="-aid 0"
>   fi
> done
> 


Here is a patch for mplayer.sh-0.8.6 which fixes the AID problem for "-aid 0"
and also automatically increments the AID by 1 when an AVI is detected.  There
was also a video resolution missing from the NTSC "direct video" detection.

Regards,
C.
  

Comments

Juri Haberland June 29, 2005, 9:45 p.m. UTC | #1
"C.Y.M" <syphir@syphir.sytes.net> wrote:
> C.Y.M wrote:
>> I was just debugging mplayer.sh because I could not get it to play a .vdr file
>> with an audio track set to "0", then I realized that if the AID is set to 0, the
>> mplayer plugin does not actually specify 0 for the AID track (it just leaves it
>> blank).  The following changes to mplayer.sh fix the problem.

[snip]

Yeah, I haven't implemented this yet and I might not do this in the
future as mplayer now seems to be able to switch audio on the fly - this
just needs to be supported by the mplayer-plugin (hint, hint!).

This AID stuff has more problems of that kind that you encountered, too:
If you have a VOB file with AC3 sound the audio ids are again different
and if the VOB file has PCM audio you need a different aid again...

> was also a video resolution missing from the NTSC "direct video" detection.

Sorry, I know you send me a patch for this some time ago and it is in my
developement branch but I didn't update the "stable" branch.

I hope to get a new version out end of July.

Cheers,
    Juri
  
C.Y.M June 29, 2005, 10:12 p.m. UTC | #2
Juri Haberland wrote:
> "C.Y.M" <syphir@syphir.sytes.net> wrote:
> 
>>C.Y.M wrote:
>>
>>>I was just debugging mplayer.sh because I could not get it to play a .vdr file
>>>with an audio track set to "0", then I realized that if the AID is set to 0, the
>>>mplayer plugin does not actually specify 0 for the AID track (it just leaves it
>>>blank).  The following changes to mplayer.sh fix the problem.
> 
> 
> [snip]
> 
> Yeah, I haven't implemented this yet and I might not do this in the
> future as mplayer now seems to be able to switch audio on the fly - this
> just needs to be supported by the mplayer-plugin (hint, hint!).
> 
> This AID stuff has more problems of that kind that you encountered, too:
> If you have a VOB file with AC3 sound the audio ids are again different
> and if the VOB file has PCM audio you need a different aid again...
> 

I think the main problem with the AID 0 is this line:

player-mplayer.c:    if(MPlayerAid>0) snprintf(aid,sizeof(aid)," AID
%d",MPlayerAid);

So, if the AID is not > 0, it does not specify the ID.

It should be:

player-mplayer.c:    if(MPlayerAid>=0) snprintf(aid,sizeof(aid)," AID
%d",MPlayerAid);

Regards,
C.
  
Juri Haberland June 30, 2005, 7:31 a.m. UTC | #3
"C.Y.M" <syphir@syphir.sytes.net> wrote:
> Juri Haberland wrote:

>> Yeah, I haven't implemented this yet and I might not do this in the
>> future as mplayer now seems to be able to switch audio on the fly - this
>> just needs to be supported by the mplayer-plugin (hint, hint!).
>> 
>> This AID stuff has more problems of that kind that you encountered, too:
>> If you have a VOB file with AC3 sound the audio ids are again different
>> and if the VOB file has PCM audio you need a different aid again...
> 
> I think the main problem with the AID 0 is this line:
> 
> player-mplayer.c:    if(MPlayerAid>0) snprintf(aid,sizeof(aid)," AID
> %d",MPlayerAid);
> 
> So, if the AID is not > 0, it does not specify the ID.
> 
> It should be:
> 
> player-mplayer.c:    if(MPlayerAid>=0) snprintf(aid,sizeof(aid)," AID
> %d",MPlayerAid);

Oh, I misread that part of your initial mail. I thought the problem is
in mplayer.sh where I didn't implemented the AID logic.

Cheers,
    Juri
  
C.Y.M June 30, 2005, 12:28 p.m. UTC | #4
Juri Haberland wrote:
> "C.Y.M" <syphir@syphir.sytes.net> wrote:
> 
>>Juri Haberland wrote:
> 
> 
>>>Yeah, I haven't implemented this yet and I might not do this in the
>>>future as mplayer now seems to be able to switch audio on the fly - this
>>>just needs to be supported by the mplayer-plugin (hint, hint!).
>>>
>>>This AID stuff has more problems of that kind that you encountered, too:
>>>If you have a VOB file with AC3 sound the audio ids are again different
>>>and if the VOB file has PCM audio you need a different aid again...
>>
>>I think the main problem with the AID 0 is this line:
>>
>>player-mplayer.c:    if(MPlayerAid>0) snprintf(aid,sizeof(aid)," AID
>>%d",MPlayerAid);
>>
>>So, if the AID is not > 0, it does not specify the ID.
>>
>>It should be:
>>
>>player-mplayer.c:    if(MPlayerAid>=0) snprintf(aid,sizeof(aid)," AID
>>%d",MPlayerAid);
> 
> 
> Oh, I misread that part of your initial mail. I thought the problem is
> in mplayer.sh where I didn't implemented the AID logic.
> 

Well, it could be fixed in either place.  I was just saying that either new
logic needs to be added to mplayer.sh (the patch I posted above) when the
mplayer plugin returns nothing for AID 0, or, fix the mplayer plugin to return
AID 0.

Regards,
C.
  
Stefan Huelswitt June 30, 2005, 3:41 p.m. UTC | #5
On 29 Jun 2005 Juri Haberland <list-linux.vdr@koschikode.com> wrote:

> Yeah, I haven't implemented this yet and I might not do this in the
> future as mplayer now seems to be able to switch audio on the fly - this
> just needs to be supported by the mplayer-plugin (hint, hint!).

What is the "slave" command to switch the AID?
Is there a slave command to list all available AID's?
Is there a way to detect on-the-fly if the running mplayer
supports AID changes?

Regards.
  
Stefan Huelswitt June 30, 2005, 3:46 p.m. UTC | #6
On 30 Jun 2005 "C.Y.M" <syphir@syphir.sytes.net> wrote:

> I think the main problem with the AID 0 is this line:
> 
> player-mplayer.c:    if(MPlayerAid>0) snprintf(aid,sizeof(aid)," AID
> %d",MPlayerAid);
> 
> So, if the AID is not > 0, it does not specify the ID.
> 
> It should be:
> 
> player-mplayer.c:    if(MPlayerAid>=0) snprintf(aid,sizeof(aid)," AID
> %d",MPlayerAid);

In this case, you can obmit the check completely. The value never
can be <0.

The idea is, to have a "default mode" where mplayer selects the
right AID. AID=0 was used to flag default mode, which now seems
to be a bad definition.

Further problem is, that you cannot enter a value <0 in VDR's
cEditIntItem. I'm investigating a solution.

Regards.
  
Juri Haberland June 30, 2005, 7:52 p.m. UTC | #7
Stefan Huelswitt <s.huelswitt@gmx.de> wrote:
> On 29 Jun 2005 Juri Haberland <list-linux.vdr@koschikode.com> wrote:
> 
>> Yeah, I haven't implemented this yet and I might not do this in the
>> future as mplayer now seems to be able to switch audio on the fly - this
>> just needs to be supported by the mplayer-plugin (hint, hint!).
> 
> What is the "slave" command to switch the AID?

switch_audio

> Is there a slave command to list all available AID's?

no, switch_audio just cycles through all available audio tracks

> Is there a way to detect on-the-fly if the running mplayer
> supports AID changes?

Not that I know of, but older versions seem to ignore switch_audio.

The only way to determin the slave commands understood is to call
mplayer with '-input cmdlist'.

Cheers,
    Juri

PS: yes, I'll support the aid stuff in the next release, though I'm not
happy with it.
  
Stefan Huelswitt June 30, 2005, 8 p.m. UTC | #8
On 30 Jun 2005 Juri Haberland <list-linux.vdr@koschikode.com> wrote:
> Stefan Huelswitt <s.huelswitt@gmx.de> wrote:
>> On 29 Jun 2005 Juri Haberland <list-linux.vdr@koschikode.com> wrote:
>> 
>>> Yeah, I haven't implemented this yet and I might not do this in the
>>> future as mplayer now seems to be able to switch audio on the fly - this
>>> just needs to be supported by the mplayer-plugin (hint, hint!).
>> 
>> What is the "slave" command to switch the AID?
> 
> switch_audio
> 
>> Is there a slave command to list all available AID's?
> 
> no, switch_audio just cycles through all available audio tracks

What is the prevered key (on VDR's remote) to bind the
switch_audio?

Regards.
  
Juri Haberland June 30, 2005, 8:35 p.m. UTC | #9
Stefan Huelswitt <s.huelswitt@gmx.de> wrote:
> On 30 Jun 2005 Juri Haberland <list-linux.vdr@koschikode.com> wrote:
>> Stefan Huelswitt <s.huelswitt@gmx.de> wrote:
>>> On 29 Jun 2005 Juri Haberland <list-linux.vdr@koschikode.com> wrote:
>>> 
>>>> Yeah, I haven't implemented this yet and I might not do this in the
>>>> future as mplayer now seems to be able to switch audio on the fly - this
>>>> just needs to be supported by the mplayer-plugin (hint, hint!).
>>> 
>>> What is the "slave" command to switch the AID?
>> 
>> switch_audio
>> 
>>> Is there a slave command to list all available AID's?
>> 
>> no, switch_audio just cycles through all available audio tracks
> 
> What is the prevered key (on VDR's remote) to bind the
> switch_audio?

Uhm, I just saw that in the meantime all keys with digits are used - 
and the colored keys as well - I don't have a good idea.
Just pick one that is on most RCs.

Cheers,
    Juri
  
Stefan Huelswitt June 30, 2005, 8:57 p.m. UTC | #10
On 30 Jun 2005 Juri Haberland <list-linux.vdr@koschikode.com> wrote:
>> What is the prevered key (on VDR's remote) to bind the
>> switch_audio?
> 
> Uhm, I just saw that in the meantime all keys with digits are used - 
> and the colored keys as well - I don't have a good idea.
> Just pick one that is on most RCs.

Hmm, may be I should remove the dvdnav stuff. I got reports that
it doesn't works and that it has been removed completely from
current mplayer version.
This would free up some keys.

Regards.
  
Juri Haberland June 30, 2005, 9:39 p.m. UTC | #11
Stefan Huelswitt <s.huelswitt@gmx.de> wrote:
> On 30 Jun 2005 Juri Haberland <list-linux.vdr@koschikode.com> wrote:
>>> What is the prevered key (on VDR's remote) to bind the
>>> switch_audio?
>> 
>> Uhm, I just saw that in the meantime all keys with digits are used - 
>> and the colored keys as well - I don't have a good idea.
>> Just pick one that is on most RCs.
> 
> Hmm, may be I should remove the dvdnav stuff. I got reports that
> it doesn't works and that it has been removed completely from
> current mplayer version.
> This would free up some keys.

Yes, I think this is a good idea - I never unterstood folks that wanted
to use mplayer to watch DVDs - it's just not in the shape to do the most
basic task.

Though I included a patch in mplayer.sh to play DVDs I later on declared
it unsupported und suggested people should spend their time in fixing
and improving the DVD-plugin.

Cheers,
    Juri
  

Patch

--- plugins/mplayer.sh.orig	2004-11-06 13:00:00.000000000 -0800
+++ plugins/mplayer.sh	2005-06-26 10:16:27.000000000 -0700
@@ -481,7 +481,17 @@ 
 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="$2"
+    shift
+  fi
+  if [ "$AID" = "" ]; then
+    declare AID="0"
+  fi
+done
 declare -a XResPAL[0]
 declare -a XResNTSC[0]
 declare FDSTR=""
@@ -540,15 +550,20 @@ 
     choosebesty
     if test $NEW_X -eq 0 -o $NEW_Y -eq 0; then echolog "*** FATAL: Illegal Resolution ..."; exit; fi
 
+    if test $VIDEO_FORMAT == "DIV3"; then
+      echolog "*** INFO: AVI detected. Increasing AID by 1"
+      AID=$(($AID+1))
+    fi
+
     if test $MPEG_DIRECT == "true" -a \( $VIDEO_FORMAT == "0x10000001" -o $VIDEO_FORMAT == "0x10000002" \) -a \( \
              \( $PAL  -a $NEW_FPS == "25" -a \( \( $ORIG_X == "352" -a $ORIG_Y == "288" \) -o \( $ORIG_Y == "576" -a \
              \( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "528" -o $ORIG_X == "544" -o $ORIG_X == "688" -o $ORIG_X == "704" -o $ORIG_X == "720" \) \) \) \) -o \
              \( $NTSC -a $NEW_FPS == "30" -a \( \( $ORIG_X == "352" -a $ORIG_Y == "240" \) -o \( $ORIG_Y == "480" -a \
-             \( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "512" -o $ORIG_X == "640" -o $ORIG_X == "704" -o $ORIG_X == "720" \) \) \) \) \
+             \( $ORIG_X == "352" -o $ORIG_X == "480" -o $ORIG_X == "512" -o $ORIG_X == "544" -o $ORIG_X == "640" -o $ORIG_X == "704" -o $ORIG_X == "720" \) \) \) \) \
        \) ; then
-      CMDLINE="$MPLAYER -vo $VO $AOUT $FDSTR $CACHESTR $REMOTE $USERDEF"
+      CMDLINE="$MPLAYER -vo $VO $AOUT -aid $AID $FDSTR $CACHESTR $REMOTE $USERDEF"
     else
-      CMDLINE="$MPLAYER -vo $VO $AOUT -vop $VOP:$NEW_FPS,expand=$NEW_X:$REAL_Y:-1:-1:1,scale=$NEW_X:${NEW_Y}${DETC} $SPEED $FDSTR $CACHESTR $REMOTE $SUBTITLES $USERDEF $FORCEIDX"
+      CMDLINE="$MPLAYER -vo $VO $AOUT -aid $AID -vop $VOP:$NEW_FPS,expand=$NEW_X:$REAL_Y:-1:-1:1,scale=$NEW_X:${NEW_Y}${DETC} $SPEED $FDSTR $CACHESTR $REMOTE $SUBTITLES $USERDEF $FORCEIDX"
     fi
 fi