From 8318951c942e2619e4c84315f3e49364b444df79 Mon Sep 17 00:00:00 2001
From: Bob Igo <bob@stormlogic.com>
Date: Mon, 13 Jul 2009 14:31:25 -0400
Subject: preliminary version of mplayer wrapper; needs further integration
 work

---
 abs/core-testing/mplayer-wrapper/PKGBUILD          |   9 +-
 .../mplayer-wrapper/bin/mplayer-wrapper.pl         | 110 --------------------
 .../mplayer-wrapper/mplayer-wrapper.install        |  38 +++++++
 .../mplayer-wrapper/mplayer-wrapper.pl             | 113 +++++++++++++++++++++
 4 files changed, 158 insertions(+), 112 deletions(-)
 delete mode 100755 abs/core-testing/mplayer-wrapper/bin/mplayer-wrapper.pl
 create mode 100644 abs/core-testing/mplayer-wrapper/mplayer-wrapper.install
 create mode 100755 abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl

diff --git a/abs/core-testing/mplayer-wrapper/PKGBUILD b/abs/core-testing/mplayer-wrapper/PKGBUILD
index 82f1082..3fb4124 100644
--- a/abs/core-testing/mplayer-wrapper/PKGBUILD
+++ b/abs/core-testing/mplayer-wrapper/PKGBUILD
@@ -1,5 +1,5 @@
 pkgname=mplayer-wrapper
-pkgver=1
+pkgver=1	
 pkgrel=1
 pkgdesc="wrapper for mplayer and mplayer derivatives"
 arch=('i686' 'x86_64')
@@ -10,7 +10,12 @@ source=(mplayer-wrapper.pl)
 
 license=('GPL2')
 
+install=mplayer-wrapper.install
 build() {
+   LH_ROOT=/usr/LH
+   mkdir -p $startdir/pkg/$LH_ROOT/bin/
+
    cd $startdir
-   install -m0777 -D bin/*  $startdir/pkg/usr/LH/bin/
+   # executables
+   install -m0755 -D *.pl  $startdir/pkg/$LH_ROOT/bin/
 }
diff --git a/abs/core-testing/mplayer-wrapper/bin/mplayer-wrapper.pl b/abs/core-testing/mplayer-wrapper/bin/mplayer-wrapper.pl
deleted file mode 100755
index 583786d..0000000
--- a/abs/core-testing/mplayer-wrapper/bin/mplayer-wrapper.pl
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/perl
-
-use Shell;
-use strict;
-use POSIX qw(floor);
-
-# Written by Bob Igo from the MythTV Store at http://MythiC.TV
-# including some original code and contributions from Nick C.
-# and graysky.
-# Email: bob@stormlogic.com
-#
-# If you run into problems with this script, please send me email
-
-# PURPOSE:
-# --------------------------
-# This is a wrapper script that tries to find the best parameters
-# for calling an underlying video player.  The outer layer determines
-# the best playback parameters, while the inner layer picks the best
-# player to call.
-
-# RATIONALE:
-# --------------------------
-# Default video playback options are not optimal on all hardware or
-# for all video types.  In addition, common video players do not
-# offer to bookmark video so that you can resume where you left off.
-# Both of these problems can be addressed by this wrapper.
-
-# PARAMETERS:
-# --------------------------
-# The same parameters you'd use for mplayer, some of which may be
-# translated automatically for use with smplayer.
-
-# FILES:
-# --------------------------
-# $mediafile, the file to play
-
-sub run () {
-    my $mediafile = @ARGV[$#ARGV];
-    my $player = &pick_player();
-
-    my $player_parameters = join(' ',
-				 &translate_parameters($player,@ARGV[0..$#ARGV-1]),
-				 &dynamic_parameters($mediafile));
-    &player($player,$player_parameters,$mediafile);
-}
-
-&run();
-
-# Translates any parameters into ones that will be compatible with the given player.
-sub translate_parameters() {
-    my($player,@parameters)=@_;
-
-    if ($player eq "smplayer") {
-	# Stupidly, smplayer uses a different set of command-line parameters than generic
-	# mplayer, so we need to translate mplayer-centric ones into the few that are
-	# available in smplayer-ese.
-	my %smplayer_parameter_translation_array = (
-	    "-fs" => "-fullscreen",
-	    "-zoom" => " "
-	    );
-	
-	sub translate() {
-	    my($flag)=@_;
-	    return $smplayer_parameter_translation_array{$flag};
-	}
-	
-	return map(&translate($_), @parameters);
-    } else {
-	return @parameters;
-    }
-}
-
-# Returns an array of dynamic parameters based in part on the media.
-sub dynamic_parameters () {
-    my($mediafile)=@_;
-    return(); # ??? empty for now; further development required
-}
-
-# Find the best player for use on this system.  The script prefers smplayer,
-# which has built-in bookmarking, falling back to mplayer-resumer.pl, which
-# implements bookmarking as an mplayer wrapper, if smplayer cannot be found.
-# Finally, if no bookmarking players can be found, a barebones mplayer is used.
-sub pick_player () {
-    my @possible_players = ("smplayer", "mplayer-resumer.pl", "mplayer");
-    my $command;
-    my $candidate_player;
-    foreach (@possible_players) {
-	$candidate_player = $_;
-	$command = "which $candidate_player |";
-	open(SHELL, $command);
-	if (<SHELL>) {
-	    #print "player $candidate_player : $_\n";
-	    return $candidate_player;
-	}
-	close(SHELL);
-    }
-}
-
-# Calls player
-sub player () {
-    my($player,$parameters,$mediafile)=@_;
-    my $command = "$player $parameters \"$mediafile\" 2>&1 2>/dev/null |";
-
-    #print "DEBUG: command is:\n$command\n";
-    open(SHELL, $command);
-    while (<SHELL>) {
-	print $_;
-    }
-    close(SHELL);
-}
diff --git a/abs/core-testing/mplayer-wrapper/mplayer-wrapper.install b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.install
new file mode 100644
index 0000000..18f1b75
--- /dev/null
+++ b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.install
@@ -0,0 +1,38 @@
+# This is a default template for a post-install scriptlet.  You can
+# remove any functions you don't need (and this header).
+
+# arg 1:  the new package version
+pre_install() {
+/bin/true
+}
+
+# arg 1:  the new package version
+post_install() {
+/bin/true
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+pre_upgrade() {
+  /bin/true
+}
+
+# arg 1:  the new package version
+# arg 2:  the old package version
+post_upgrade() {
+  /bin/true
+}
+
+# arg 1:  the old package version
+pre_remove() {
+  /bin/true
+}
+
+# arg 1:  the old package version
+post_remove() {
+  /bin/true
+}
+
+op=$1
+shift
+$op $*
diff --git a/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl
new file mode 100755
index 0000000..9977741
--- /dev/null
+++ b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl
@@ -0,0 +1,113 @@
+#!/usr/bin/perl
+
+use Shell;
+use strict;
+use POSIX qw(floor);
+
+# Written by Bob Igo from the MythTV Store at http://MythiC.TV
+# including some original code and contributions from Nick C.
+# and graysky.
+# Email: bob@stormlogic.com
+#
+# If you run into problems with this script, please send me email
+
+# PURPOSE:
+# --------------------------
+# This is a wrapper script that tries to find the best parameters
+# for calling an underlying video player.  The outer layer determines
+# the best playback parameters, while the inner layer picks the best
+# player to call.
+
+# RATIONALE:
+# --------------------------
+# Default video playback options are not optimal on all hardware or
+# for all video types.  In addition, common video players do not
+# offer to bookmark video so that you can resume where you left off.
+# Both of these problems can be addressed by this wrapper.
+
+# PARAMETERS:
+# --------------------------
+# The same parameters you'd use for mplayer, some of which may be
+# translated automatically for use with smplayer.
+
+# FILES:
+# --------------------------
+# $mediafile, the file to play
+
+sub run () {
+    my $mediafile = @ARGV[$#ARGV];
+    my $player = &pick_player();
+
+    my $player_parameters = join(' ',
+				 &translate_parameters($player,@ARGV[0..$#ARGV-1]),
+				 &dynamic_parameters($mediafile));
+    &player($player,$player_parameters,$mediafile);
+}
+
+&run();
+
+# Translates any parameters into ones that will be compatible with the given player.
+sub translate_parameters() {
+    my($player,@parameters)=@_;
+
+    if ($player eq "smplayer") {
+	# Stupidly, smplayer uses a different set of command-line parameters than generic
+	# mplayer, so we need to translate mplayer-centric ones into the few that are
+	# available in smplayer-ese.
+	my %smplayer_parameter_translation_array = (
+	    "-fs" => "-fullscreen",
+	    "-zoom" => " "
+	    );
+	
+	sub translate() {
+	    my($flag)=@_;
+	    return $smplayer_parameter_translation_array{$flag};
+	}
+	
+	return map(&translate($_), @parameters);
+    } else {
+	# currently, all other players used by this wrapper work with mplayer parameters
+	return @parameters;
+    }
+}
+
+# Returns an array of dynamic parameters based on the media type,
+# the presence of special playback decoding hardware, and the
+# general capability of the CPU.
+sub dynamic_parameters () {
+    my($mediafile)=@_;
+    return(); # ??? empty for now; further development required
+}
+
+# Find the best player for use on this system.  The script prefers smplayer,
+# which has built-in bookmarking, falling back to mplayer-resumer.pl, which
+# implements bookmarking as an mplayer wrapper, if smplayer cannot be found.
+# Finally, if no bookmarking players can be found, a barebones mplayer is used.
+sub pick_player () {
+    my @possible_players = ("smplayer", "mplayer-resumer.pl", "mplayer");
+    my $command;
+    my $candidate_player;
+    foreach (@possible_players) {
+	$candidate_player = $_;
+	$command = "which $candidate_player |";
+	open(SHELL, $command);
+	if (<SHELL>) {
+	    #print "player $candidate_player : $_\n";
+	    return $candidate_player;
+	}
+	close(SHELL);
+    }
+}
+
+# Calls player
+sub player () {
+    my($player,$parameters,$mediafile)=@_;
+    my $command = "$player $parameters \"$mediafile\" 2>&1 2>/dev/null |";
+
+    #print "DEBUG: command is:\n$command\n";
+    open(SHELL, $command);
+    while (<SHELL>) {
+	print $_;
+    }
+    close(SHELL);
+}
-- 
cgit v0.12