summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Igo <bob@stormlogic.com>2009-07-27 19:28:40 (GMT)
committerBob Igo <bob@stormlogic.com>2009-07-27 19:28:40 (GMT)
commit9e5dc3ebc4d7cb2945f25d53708a1bdadde81a23 (patch)
tree244dbb47051bc60908d52f2ac0d4dbc6daaa4db1
parent4b20016d96d7ab2d4d6964ff353c2cfc791b11f5 (diff)
downloadlinhes_pkgbuild-9e5dc3ebc4d7cb2945f25d53708a1bdadde81a23.zip
linhes_pkgbuild-9e5dc3ebc4d7cb2945f25d53708a1bdadde81a23.tar.gz
linhes_pkgbuild-9e5dc3ebc4d7cb2945f25d53708a1bdadde81a23.tar.bz2
mplayer-wrapper.pl now checks for vdpau capability and sets parameters accordingly
-rw-r--r--abs/core-testing/mplayer-wrapper/PKGBUILD2
-rwxr-xr-xabs/core-testing/mplayer-wrapper/mplayer-wrapper.pl54
2 files changed, 48 insertions, 8 deletions
diff --git a/abs/core-testing/mplayer-wrapper/PKGBUILD b/abs/core-testing/mplayer-wrapper/PKGBUILD
index 9c0934b..2774c1a 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=5
+pkgrel=8
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 86c40c6..da0e838 100755
--- a/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl
+++ b/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl
@@ -97,7 +97,39 @@ sub dynamic_parameters () {
my($mediafile)=@_;
my @parameters = ();
my $codec="";
+ my %vdpau_supported_modes=();
+ # See if the GPU and driver support vdpau for GPU-based accelerated decoding
+ my $command="vdpinfo |";
+ # On supported hardware, vdpinfo produces relevant results that look something like this (see
+ # http://www.phoronix.com/forums/showthread.php?t=14493 for additional details, or run
+ # vdpinfo on vdpau-capable hardware yourself):
+ #
+ #MPEG1 0 2 4096 4096
+ #MPEG2_SIMPLE 3 2 4096 4096
+ #MPEG2_MAIN 3 2 4096 4096
+ #H264_MAIN 41 4 4096 4096
+ #H264_HIGH 41 4 4096 4096
+
+ my $grabbing_modes=0;
+ open(SHELL, $command);
+ while (<SHELL>) {
+ chop;
+ if (m/Decoder Capabilities/gi) {
+ $grabbing_modes=1;
+ #print "*** MODES START NOW"
+ } elsif (m/Output Surface/gi) {
+ $grabbing_modes=0;
+ } elsif ($grabbing_modes) {
+ if (m/[A-Z]+[0-9]+/g) {
+ s/(_.*)//g;
+ #print "*** GRABBED MODE $_\n";
+ $vdpau_supported_modes{$_} = 1;
+ }
+ }
+ }
+ close(SHELL);
+
# figure out what codec the video uses
my $command="mplayer -identify -frames 0 \"$mediafile\" | grep ID_VIDEO_CODEC | cut -c 16- |";
open(SHELL, $command);
@@ -109,30 +141,38 @@ sub dynamic_parameters () {
close(SHELL);
# We should use vdpau if it's available and helps with the codec we need to decode.
- # ??? NOTE: At the moment, vdpau capability is assumed, not verified.
if ($codec eq "ffh264") { # h.264
- push(@parameters, "-vo vdpau");
- push(@parameters, "-vc ffh264vdpau");
+ if ($vdpau_supported_modes{"H264"}) {
+ push(@parameters, "-vo vdpau");
+ push(@parameters, "-vc ffh264vdpau");
+ }
} elsif ($codec eq "ffmpeg2") { # MPEG2
- push(@parameters, "-vo vdpau");
- push(@parameters, "-vc ffmpeg12vdpau");
+ if ($vdpau_supported_modes{"MPEG2"}) {
+ push(@parameters, "-vo vdpau");
+ push(@parameters, "-vc ffmpeg12vdpau");
+ }
+ # ??? although MPEG1 is rare, it seems as if it should work with -vc ffmpeg12vdpau as well
+
# problems have been reported with WMV3 support
# } elsif ($codec eq "ffwmv3") { # WMV3
+# if ($vdpau_supported) {
# push(@parameters, "-vo vdpau");
# push(@parameters, "-vc ffwmv3vdpau");
-
+# }
# problems have been reported with WVC1 support
# } elsif ($codec eq "ffvc1") { # WVC1
+# if ($vdpau_supported) {
# push(@parameters, "-vo vdpau");
# push(@parameters, "-vc ffvc1vdpau");
+# }
} else {
push(@parameters, "-vo xv,x11,");
push(@parameters, "-vc ,");
- push(@parameters, "-vf pp=lb,");
+ push(@parameters, "-vf pp=lb,"); # doesn't actually work with vdpau, but doesn't break anything
}
return(@parameters);
}