set environment variable with DVB device number trunk
authornathan
Sat, 24 Oct 2009 11:20:45 +0800
branchtrunk
changeset 31566c0f412764
parent 30 f8a59739816b
child 32 cea1b4f741be
set environment variable with DVB device number
README
examples/mplayer.sh.example
player-mplayer.c
     1.1 --- a/README	Tue Sep 01 20:55:41 2009 +0800
     1.2 +++ b/README	Sat Oct 24 11:20:45 2009 +0800
     1.3 @@ -177,7 +177,9 @@
     1.4  
     1.5  MPlayer is called through a script called "mplayer.sh" with the filename to
     1.6  play as first argument and the phrase SLAVE as second argument if slave mode is
     1.7 -enabled. You can use the commandline option -M/--mplayer to change the name and
     1.8 +enabled. Additional the environment variable DVB_DEVICE will be set with the
     1.9 +number of the DVB card which VDR uses as primary display.
    1.10 +You can use the commandline option -M/--mplayer to change the name and
    1.11  location of the mplayer script. The script has to call MPlayer with all the
    1.12  necessary options.
    1.13  
     2.1 --- a/examples/mplayer.sh.example	Tue Sep 01 20:55:41 2009 +0800
     2.2 +++ b/examples/mplayer.sh.example	Sat Oct 24 11:20:45 2009 +0800
     2.3 @@ -12,6 +12,9 @@
     2.4  # mplayer options, -vc will be added below
     2.5  # add "-lircconf <lircrc>" to enable LIRC support
     2.6  OPTS="-vo mpegpes"
     2.7 +if [ "aa$DVB_DEVICE" != "aa" ]; then
     2.8 +  OPTS="-vo mpegpes:card=$DVB_DEVICE -ao mpegpes:card=$DVB_DEVICE"
     2.9 +fi
    2.10  
    2.11  # mplayer options for SlaveMode
    2.12  SLAVE="-slave -quiet -nolirc"
     3.1 --- a/player-mplayer.c	Tue Sep 01 20:55:41 2009 +0800
     3.2 +++ b/player-mplayer.c	Sat Oct 24 11:20:45 2009 +0800
     3.3 @@ -397,6 +397,10 @@
     3.4      else aid[0]=0;
     3.5      snprintf(cmd,sizeof(cmd),"%s \"%s\" %s%s",MPlayerCmd,fname,MPlayerSetup.SlaveMode?"SLAVE":"",aid);
     3.6      free(fname);
     3.7 +    // give index of primary dvb adapter device to mplayer via environment variable
     3.8 +    char dvb[4];
     3.9 +    snprintf(dvb,sizeof(dvb),"%d",cDevice::PrimaryDevice()->CardIndex()+1);
    3.10 +    setenv("DVB_DEVICE",dvb,1);
    3.11      execle("/bin/sh","sh","-c",cmd,(char *)0,environ);
    3.12      esyslog("ERROR: exec failed for %s: (%d) %s",cmd,errno,strerror(errno));
    3.13      exit(127);