From 0c8f5ba689416ba6f11fd176e6c1fd61207c477e Mon Sep 17 00:00:00 2001
From: Bob Igo <bob@stormlogic.com>
Date: Wed, 15 Jul 2009 15:18:52 -0400
Subject: wrapper now lets command-line options override dynamic ones

---
 abs/core-testing/mplayer-wrapper/PKGBUILD          |  2 +-
 .../mplayer-wrapper/mplayer-wrapper.pl             | 29 ++++++++++++++++++----
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/abs/core-testing/mplayer-wrapper/PKGBUILD b/abs/core-testing/mplayer-wrapper/PKGBUILD
index b9e3aef..52ccbd4 100644
--- a/abs/core-testing/mplayer-wrapper/PKGBUILD
+++ b/abs/core-testing/mplayer-wrapper/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=mplayer-wrapper
 pkgver=1	
-pkgrel=2
+pkgrel=3
 pkgdesc="wrapper for mplayer and mplayer derivatives"
 arch=('i686' 'x86_64')
 
diff --git a/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl
index 2d823d9..646b675 100755
--- a/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl
+++ b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl
@@ -38,9 +38,28 @@ sub run () {
     my $mediafile = @ARGV[$#ARGV];
     my $player = &pick_player();
 
+    # mplayer evaluates configuration options in the following order, with
+    # later-evaluated options overriding earlier-evaluated ones, both within
+    # a given configuration location and between them:
+    # 1) system-wide configuration/profiles, /etc/mplayer/mplayer.conf
+    # 2) user-specific configuration/profiles, ~/.mplayer/config
+    # 3) commandline configuration parameters
+    # 4) file-specific configuration, ~/.mplayer/[filename].conf
+    # 5) any nonstandard configuration file, included via "-include" parameter
+    #
+    # This script's dynamic configuration options fall in at 2.5 above,
+    # so commandline options, file-specific configuration options,
+    # or a nonstandard configuration file will override the options that
+    # the script creates, but system-wide and user-specific configuration
+    # will be overridden by the dynamic configuration options.
+    #
+    # This is sub-optimal, as the easiest way for a user to compensate for
+    # a misfiring configuration rule would be to override it in a configuration
+    # file.  Instead, they will have to change the way they run this script.
+
     my $player_parameters = join(' ',
-				 &translate_parameters($player,@ARGV[0..$#ARGV-1]),
-				 &dynamic_parameters($mediafile));
+				 &dynamic_parameters($mediafile),
+				 &translate_parameters($player,@ARGV[0..$#ARGV-1]));
     &player($player,$player_parameters,$mediafile);
 }
 
@@ -98,13 +117,13 @@ sub dynamic_parameters () {
 	push(@parameters, "-vo vdpau");
 	push(@parameters, "-vc ffmpeg12vdpau");
 
-	# problems reported with WMV3 support
+	# problems have been reported with WMV3 support
 	
 #    } elsif ($codec eq "ffwmv3") { # WMV3
 #	push(@parameters, "-vo vdpau");
 #	push(@parameters, "-vc ffwmv3vdpau");
 
-	# problems reported with WVC1 support
+	# problems have been reported with WVC1 support
 	
 #    } elsif ($codec eq "ffvc1") { # WVC1
 #	push(@parameters, "-vo vdpau");
@@ -144,7 +163,7 @@ sub player () {
     my($player,$parameters,$mediafile)=@_;
     my $command = "$player $parameters \"$mediafile\" 2>&1 |";
 
-    print "DEBUG: command is:\n$command\n";
+    print "DEBUG: $0's player command is: *** $command ***\n";
     open(SHELL, $command);
     while (<SHELL>) {
 	print $_;
-- 
cgit v0.12