// Returns whether or not the supplied DLNA resource matches the supplied format and format identifier
private static boolean isType(DLNAResource resource, int matchType, Format.Identifier matchIdentifier) {
boolean match = false;
if (resource != null) {
Format format = resource.getFormat();
// the int returned by format.getType() is a bitmap, so match by checking the bit is set
// XXX the old isCompatible implementations (incorrectly) used to match
// with getType() == matchType
if ((format != null) && ((format.getType() & matchType) == matchType)) {
if (matchIdentifier == null) { // match any identifier
match = true;
} else { // match the specified format identifier
Format.Identifier identifier = format.getIdentifier();
match = identifier.equals(matchIdentifier);
}
}
}