Java Code Examples for org.videolan.libvlc.util.HWDecoderUtil#Decoder

The following examples show how to use org.videolan.libvlc.util.HWDecoderUtil#Decoder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Media.java    From libvlc-android-sdk with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Add or remove hw acceleration media options
 *
 * @param enabled if true, hw decoder will be used
 * @param force force hw acceleration even for unknown devices
 */
public void setHWDecoderEnabled(boolean enabled, boolean force) {
    HWDecoderUtil.Decoder decoder = enabled ?
            HWDecoderUtil.getDecoderFromDevice() :
            HWDecoderUtil.Decoder.NONE;

    /* Unknown device but the user asked for hardware acceleration */
    if (decoder == HWDecoderUtil.Decoder.UNKNOWN && force)
        decoder = HWDecoderUtil.Decoder.ALL;

    if (decoder == HWDecoderUtil.Decoder.NONE || decoder == HWDecoderUtil.Decoder.UNKNOWN) {
        addOption(":codec=all");
        return;
    }

    /*
     * Set higher caching values if using iomx decoding, since some omx
     * decoders have a very high latency, and if the preroll data isn't
     * enough to make the decoder output a frame, the playback timing gets
     * started too soon, and every decoded frame appears to be too late.
     * On Nexus One, the decoder latency seems to be 25 input packets
     * for 320x170 H.264, a few packets less on higher resolutions.
     * On Nexus S, the decoder latency seems to be about 7 packets.
     */
    if (!mFileCachingSet)
        addOption(":file-caching=1500");
    if (!mNetworkCachingSet)
        addOption(":network-caching=1500");

    final StringBuilder sb = new StringBuilder(":codec=");
    if (decoder == HWDecoderUtil.Decoder.MEDIACODEC || decoder == HWDecoderUtil.Decoder.ALL)
        sb.append(getMediaCodecModule()).append(",");
    if (force && (decoder == HWDecoderUtil.Decoder.OMX || decoder == HWDecoderUtil.Decoder.ALL))
        sb.append("iomx,");
    sb.append("all");

    addOption(sb.toString());
}
 
Example 2
Source File: Media.java    From OTTLivePlayer_vlc with MIT License 5 votes vote down vote up
/**
 * Add or remove hw acceleration media options
 *
 * @param enabled if true, hw decoder will be used
 * @param force force hw acceleration even for unknown devices
 */
public void setHWDecoderEnabled(boolean enabled, boolean force) {
    HWDecoderUtil.Decoder decoder = enabled ?
            HWDecoderUtil.getDecoderFromDevice() :
            HWDecoderUtil.Decoder.NONE;

    /* Unknown device but the user asked for hardware acceleration */
    if (decoder == HWDecoderUtil.Decoder.UNKNOWN && force)
        decoder = HWDecoderUtil.Decoder.ALL;

    if (decoder == HWDecoderUtil.Decoder.NONE || decoder == HWDecoderUtil.Decoder.UNKNOWN) {
        addOption(":codec=all");
        return;
    }

    /*
     * Set higher caching values if using iomx decoding, since some omx
     * decoders have a very high latency, and if the preroll data isn't
     * enough to make the decoder output a frame, the playback timing gets
     * started too soon, and every decoded frame appears to be too late.
     * On Nexus One, the decoder latency seems to be 25 input packets
     * for 320x170 H.264, a few packets less on higher resolutions.
     * On Nexus S, the decoder latency seems to be about 7 packets.
     */
    addOption(":file-caching=1500");
    addOption(":network-caching=1500");

    final StringBuilder sb = new StringBuilder(":codec=");
    if (decoder == HWDecoderUtil.Decoder.MEDIACODEC || decoder == HWDecoderUtil.Decoder.ALL)
        sb.append(getMediaCodecModule()).append(",");
    if (force && (decoder == HWDecoderUtil.Decoder.OMX || decoder == HWDecoderUtil.Decoder.ALL))
        sb.append("iomx,");
    sb.append("all");

    addOption(sb.toString());
}
 
Example 3
Source File: Media.java    From OTTLivePlayer_vlc with MIT License 5 votes vote down vote up
/**
 * Add or remove hw acceleration media options
 *
 * @param enabled if true, hw decoder will be used
 * @param force force hw acceleration even for unknown devices
 */
public void setHWDecoderEnabled(boolean enabled, boolean force) {
    HWDecoderUtil.Decoder decoder = enabled ?
            HWDecoderUtil.getDecoderFromDevice() :
            HWDecoderUtil.Decoder.NONE;

    /* Unknown device but the user asked for hardware acceleration */
    if (decoder == HWDecoderUtil.Decoder.UNKNOWN && force)
        decoder = HWDecoderUtil.Decoder.ALL;

    if (decoder == HWDecoderUtil.Decoder.NONE || decoder == HWDecoderUtil.Decoder.UNKNOWN) {
        addOption(":codec=all");
        return;
    }

    /*
     * Set higher caching values if using iomx decoding, since some omx
     * decoders have a very high latency, and if the preroll data isn't
     * enough to make the decoder output a frame, the playback timing gets
     * started too soon, and every decoded frame appears to be too late.
     * On Nexus One, the decoder latency seems to be 25 input packets
     * for 320x170 H.264, a few packets less on higher resolutions.
     * On Nexus S, the decoder latency seems to be about 7 packets.
     */
    addOption(":file-caching=1500");
    addOption(":network-caching=1500");

    final StringBuilder sb = new StringBuilder(":codec=");
    if (decoder == HWDecoderUtil.Decoder.MEDIACODEC || decoder == HWDecoderUtil.Decoder.ALL)
        sb.append(getMediaCodecModule()).append(",");
    if (force && (decoder == HWDecoderUtil.Decoder.OMX || decoder == HWDecoderUtil.Decoder.ALL))
        sb.append("iomx,");
    sb.append("all");

    addOption(sb.toString());
}
 
Example 4
Source File: Media.java    From vlc-example-streamplayer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Add or remove hw acceleration media options
 *
 * @param enabled if true, hw decoder will be used
 * @param force force hw acceleration even for unknown devices
 */
public void setHWDecoderEnabled(boolean enabled, boolean force) {
    HWDecoderUtil.Decoder decoder = enabled ?
            HWDecoderUtil.getDecoderFromDevice() :
            HWDecoderUtil.Decoder.NONE;

    /* Unknown device but the user asked for hardware acceleration */
    if (decoder == HWDecoderUtil.Decoder.UNKNOWN && force)
        decoder = HWDecoderUtil.Decoder.ALL;

    if (decoder == HWDecoderUtil.Decoder.NONE || decoder == HWDecoderUtil.Decoder.UNKNOWN) {
        addOption(":codec=all");
        return;
    }

    /*
     * Set higher caching values if using iomx decoding, since some omx
     * decoders have a very high latency, and if the preroll data isn't
     * enough to make the decoder output a frame, the playback timing gets
     * started too soon, and every decoded frame appears to be too late.
     * On Nexus One, the decoder latency seems to be 25 input packets
     * for 320x170 H.264, a few packets less on higher resolutions.
     * On Nexus S, the decoder latency seems to be about 7 packets.
     */
    addOption(":file-caching=1500");
    addOption(":network-caching=1500");

    final StringBuilder sb = new StringBuilder(":codec=");
    if (decoder == HWDecoderUtil.Decoder.MEDIACODEC || decoder == HWDecoderUtil.Decoder.ALL)
        sb.append(getMediaCodecModule()).append(",");
    if (force && (decoder == HWDecoderUtil.Decoder.OMX || decoder == HWDecoderUtil.Decoder.ALL))
        sb.append("iomx,");
    sb.append("all");

    addOption(sb.toString());
}
 
Example 5
Source File: Media.java    From libvlc-sdk-android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Add or remove hw acceleration media options
 *
 * @param enabled if true, hw decoder will be used
 * @param force   force hw acceleration even for unknown devices
 */
public void setHWDecoderEnabled(boolean enabled, boolean force) {
    HWDecoderUtil.Decoder decoder = enabled ?
            HWDecoderUtil.getDecoderFromDevice() :
            HWDecoderUtil.Decoder.NONE;

    /* Unknown device but the user asked for hardware acceleration */
    if (decoder == HWDecoderUtil.Decoder.UNKNOWN && force)
        decoder = HWDecoderUtil.Decoder.ALL;

    if (decoder == HWDecoderUtil.Decoder.NONE || decoder == HWDecoderUtil.Decoder.UNKNOWN) {
        addOption(":codec=all");
        return;
    }

    /*
     * Set higher caching values if using iomx decoding, since some omx
     * decoders have a very high latency, and if the preroll data isn't
     * enough to make the decoder output a frame, the playback timing gets
     * started too soon, and every decoded frame appears to be too late.
     * On Nexus One, the decoder latency seems to be 25 input packets
     * for 320x170 H.264, a few packets less on higher resolutions.
     * On Nexus S, the decoder latency seems to be about 7 packets.
     */
    if (!mFileCachingSet)
        addOption(":file-caching=1500");
    if (!mNetworkCachingSet)
        addOption(":network-caching=1500");

    final StringBuilder sb = new StringBuilder(":codec=");
    if (decoder == HWDecoderUtil.Decoder.MEDIACODEC || decoder == HWDecoderUtil.Decoder.ALL)
        sb.append(getMediaCodecModule()).append(",");
    if (force && (decoder == HWDecoderUtil.Decoder.OMX || decoder == HWDecoderUtil.Decoder.ALL))
        sb.append("iomx,");
    sb.append("all");

    addOption(sb.toString());
}
 
Example 6
Source File: Media.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Add or remove hw acceleration media options
 *
 * @param enabled if true, hw decoder will be used
 * @param force force hw acceleration even for unknown devices
 */
public void setHWDecoderEnabled(boolean enabled, boolean force) {
    final HWDecoderUtil.Decoder decoder = enabled ?
            HWDecoderUtil.getDecoderFromDevice() :
            HWDecoderUtil.Decoder.NONE;

    if (decoder == HWDecoderUtil.Decoder.NONE ||
            (decoder == HWDecoderUtil.Decoder.UNKNOWN && !force)) {
        addOption(":codec=all");
        return;
    }

    /*
     * Set higher caching values if using iomx decoding, since some omx
     * decoders have a very high latency, and if the preroll data isn't
     * enough to make the decoder output a frame, the playback timing gets
     * started too soon, and every decoded frame appears to be too late.
     * On Nexus One, the decoder latency seems to be 25 input packets
     * for 320x170 H.264, a few packets less on higher resolutions.
     * On Nexus S, the decoder latency seems to be about 7 packets.
     */
    addOption(":file-caching=1500");
    addOption(":network-caching=1500");

    final StringBuilder sb = new StringBuilder(":codec=");
    if (decoder == HWDecoderUtil.Decoder.MEDIACODEC)
        sb.append(getMediaCodecModule()).append(",");
    else if (decoder == HWDecoderUtil.Decoder.OMX)
        sb.append("iomx,");
    else
        sb.append(getMediaCodecModule()).append(",iomx,");
    sb.append("all");

    addOption(sb.toString());
}