Created
March 2, 2013 14:02
-
-
Save ebridges/5071129 to your computer and use it in GitHub Desktop.
PVMF Error Codes for Android video playback using MediaPlayer. This perl script will generate a Java enum based on the listing of codes at the end of the gist. Error codes derived from https://github.com/android/platform_external_opencore/blob/master/pvmi/pvmf/include/pvmf_return_codes.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/android/platform_external_opencore/blob/master/pvmi/pvmf/include/pvmf_return_codes.h | |
use strict; | |
my $enumName = "VideoErrorCode"; | |
my $first = 1; | |
my %data; | |
for(<DATA>){ | |
chomp; | |
my ($msg,$code) = split /,/; | |
$data{$code*1} = $msg; | |
} | |
print "enum $enumName {\n"; | |
for (sort keys %data) { | |
my $code = $_; | |
my $msg = $data{$_}; | |
my $absCode = $code * -1; | |
print "\t" . ($first ? "" : ",") . $enumName . "_" . $absCode . '(' . $code . ', "' . $msg . '")' . "\n"; | |
$first = undef; | |
} | |
print "\nprivate static final Map<Integer, $enumName> LOOKUP = new HashMap<Integer, $enumName>();\n"; | |
print "\nstatic {\n"; | |
for (sort keys %data) { | |
my $code = $_; | |
my $msg = $data{$_}; | |
my $absCode = $code * -1; | |
print "\tLOOKUP.put($code, $enumName" . '_' . "$absCode);\n"; | |
} | |
print "}\n"; | |
print qq^ | |
private Integer code; | |
private String message; | |
$enumName(Integer code, String message) { | |
this.code = code; | |
this.message = message; | |
} | |
public Integer code() { | |
return code; | |
} | |
public String message() { | |
return message; | |
} | |
public static VideoErrorCode fromCode(Integer code) { | |
return LOOKUP.get(code); | |
} | |
} | |
^; | |
__DATA__ | |
general failure,-1 | |
playback canceled,-2 | |
no memory available,-3 | |
request not supported,-4 | |
invalid argument, -5 | |
invalid resource handle specified,-6 | |
resource already exists and another one cannot be created,-7 | |
resource busy and request cannot be handled,-8 | |
resource not ready to accept request,-9 | |
data corruption detected,-10 | |
request timed out,-11 | |
general overflow,-12 | |
general underflow,-13 | |
resource in wrong state to handle request,-14 | |
resource not available,-15 | |
invalid configuration of resource,-16 | |
general error in underlying resource,-17 | |
general data processing error,-18 | |
general port processing error,-19 | |
unauthorize to access resource,-20 | |
lacking a valid license for the content,-21 | |
lacking a valid license for the content; however a preview is available,-22 | |
downloaded content length is larger than the maximum request size,-23 | |
maximum number of objects in use,-24 | |
low disk space,-25 | |
authentication required,-26 | |
callback has become invalid due to change in direction of NPT clock,-27 | |
callback is called as clock has stopped,-28 | |
error due to missing call for ReleaseMatadataValue() API,-29 | |
redirect error,-30 | |
method or API is not implemented,-31 | |
video container is not valid for progressive playback,-32 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment