All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.red5.io.FourCcInfoMask Maven / Gradle / Ivy

There is a newer version: 2.0.15
Show newest version
package org.red5.io;

import java.util.EnumSet;

/**
 * Capability flags define specific functionalities, such as the ability to decode, encode, or forward.
 *
 * @author Paul Gregoire
 */
public enum FourCcInfoMask {

    CanDecode((byte) 0x01), // Can decode
    CanEncode((byte) 0x02), // Can encode
    CanForward((byte) 0x04); // Can forward any codec

    private final byte mask;

    FourCcInfoMask(byte b) {
        mask = b;
    }

    public byte getMask() {
        return mask;
    }

    public static EnumSet fromMask(byte b) {
        EnumSet result = EnumSet.noneOf(FourCcInfoMask.class);
        for (FourCcInfoMask mask : values()) {
            if ((b & mask.getMask()) == mask.getMask()) {
                result.add(mask);
            }
        }
        return result;
    }

    public static byte toMask(EnumSet set) {
        byte result = 0;
        for (FourCcInfoMask mask : set) {
            result |= mask.getMask();
        }
        return result;
    }

    public static EnumSet all() {
        return EnumSet.allOf(FourCcInfoMask.class);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy