Java Code Examples for org.videolan.libvlc.util.HWDecoderUtil#getAudioOutputFromDevice()

The following examples show how to use org.videolan.libvlc.util.HWDecoderUtil#getAudioOutputFromDevice() . 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: LibVLC.java    From libvlc-sdk-android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a LibVLC withs options
 *
 * @param options
 */
public LibVLC(Context context, ArrayList<String> options) {
    mAppContext = context.getApplicationContext();
    loadLibraries();

    if (options == null)
        options = new ArrayList<String>();
    boolean setAout = true, setChroma = true;
    // check if aout/vout options are already set
    for (String option : options) {
        if (option.startsWith("--aout="))
            setAout = false;
        if (option.startsWith("--android-display-chroma"))
            setChroma = false;
        if (!setAout && !setChroma)
            break;
    }

    // set aout/vout options if they are not set
    if (setAout || setChroma) {
        if (setAout) {
            final HWDecoderUtil.AudioOutput hwAout = HWDecoderUtil.getAudioOutputFromDevice();
            if (hwAout == HWDecoderUtil.AudioOutput.OPENSLES)
                options.add("--aout=opensles");
            else
                options.add("--aout=android_audiotrack");
        }
        if (setChroma) {
            options.add("--android-display-chroma");
            options.add("RV16");
        }
    }
    nativeNew(options.toArray(new String[options.size()]), context.getDir("vlc", Context.MODE_PRIVATE).getAbsolutePath());
}
 
Example 2
Source File: LibVLC.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Create a LibVLC withs options
 *
 * @param options
 */
public LibVLC(ArrayList<String> options) {
    boolean setAout = true, setChroma = true;
    // check if aout/vout options are already set
    if (options != null) {
        for (String option : options) {
            if (option.startsWith("--aout="))
                setAout = false;
            if (option.startsWith("--androidwindow-chroma"))
                setChroma = false;
            if (!setAout && !setChroma)
                break;
        }
    }

    // set aout/vout options if they are not set
    if (setAout || setChroma) {
        if (options == null)
            options = new ArrayList<String>();
        if (setAout) {
            final HWDecoderUtil.AudioOutput hwAout = HWDecoderUtil.getAudioOutputFromDevice();
            if (hwAout == HWDecoderUtil.AudioOutput.OPENSLES)
                options.add("--aout=opensles");
            else
                options.add("--aout=android_audiotrack");
        }
        if (setChroma) {
            options.add("--androidwindow-chroma");
            options.add("RV32");
        }
    }

    nativeNew(options.toArray(new String[options.size()]));
}
 
Example 3
Source File: VLCOptions.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
public static String getAout(SharedPreferences pref) {
    int aout = -1;
    try {
        aout = Integer.parseInt(pref.getString("aout", "-1"));
    } catch (NumberFormatException ignored) {}
    final HWDecoderUtil.AudioOutput hwaout = HWDecoderUtil.getAudioOutputFromDevice();
    if (hwaout == HWDecoderUtil.AudioOutput.AUDIOTRACK || hwaout == HWDecoderUtil.AudioOutput.OPENSLES)
        aout = hwaout == HWDecoderUtil.AudioOutput.OPENSLES ? AOUT_OPENSLES : AOUT_AUDIOTRACK;

    return aout == AOUT_OPENSLES ? "opensles_android" : "android_audiotrack";
}