示例#1
0
void ijkmp_android_set_opensles_enabled(IjkMediaPlayer *mp, bool enabled)
{
    if (!mp)
         return;

    MPTRACE("ijkmp_android_set_opensles_enabled(%d)", enabled ? 1 : 0);
    pthread_mutex_lock(&mp->mutex);

    if (mp) {
        if (enabled) {
            if (!SDL_AoutAndroid_IsObjectOfOpenSLES(mp->ffplayer->aout)) {
                ALOGI("recreate aout for OpenSL ES\n");
                SDL_AoutFreeP(&mp->ffplayer->aout);
                mp->ffplayer->aout = SDL_AoutAndroid_CreateForOpenSLES();
            }
        } else {
            if (!SDL_AoutAndroid_IsObjectOfAudioTrack(mp->ffplayer->aout)) {
                ALOGI("recreate aout for AudioTrack\n");
                SDL_AoutFreeP(&mp->ffplayer->aout);
                mp->ffplayer->aout = SDL_AoutAndroid_CreateForAudioTrack();
            }
        }
    }

    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ijkmp_android_set_opensles_enabled()=void");
}
示例#2
0
static SDL_Aout *func_open_audio_output(IJKFF_Pipeline *pipeline, FFPlayer *ffp)
{
    if (ffp->opensles) {
        return SDL_AoutAndroid_CreateForOpenSLES();
    } else {
        return SDL_AoutAndroid_CreateForAudioTrack();
    }
}