summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core-testing/mplayer-wrapper/mplayer-wrapper.pl')
-rwxr-xr-xabs/core-testing/mplayer-wrapper/mplayer-wrapper.pl54
1 files changed, 47 insertions, 7 deletions
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);
}