static sdl_amedia_status_t SDL_AMediaCodecJava_configure_surface( JNIEnv*env, SDL_AMediaCodec* acodec, const SDL_AMediaFormat* aformat, jobject android_surface, SDL_AMediaCrypto *crypto, uint32_t flags) { SDLTRACE("SDL_AMediaCodecJava_configure_surface"); // TODO: implement SDL_AMediaCrypto SDL_AMediaCodec_Opaque *opaque = (SDL_AMediaCodec_Opaque *)acodec->opaque; jobject android_media_format = SDL_AMediaFormatJava_getObject(env, aformat); jobject android_media_codec = SDL_AMediaCodecJava_getObject(env, acodec); ALOGE("configure acodec:%p format:%p: surface:%p", android_media_codec, android_media_format, android_surface); (*env)->CallVoidMethod(env, android_media_codec, g_clazz.jmid_configure, android_media_format, android_surface, crypto, flags); if (SDL_JNI_CatchException(env)) { return SDL_AMEDIA_ERROR_UNKNOWN; } opaque->is_input_buffer_valid = true; SDL_JNI_DeleteGlobalRefP(env, &opaque->input_buffer_array); SDL_JNI_DeleteGlobalRefP(env, &opaque->output_buffer_array); return SDL_AMEDIA_OK; }
static sdl_amedia_status_t SDL_AMediaCodecJava_flush(SDL_AMediaCodec* acodec) { SDLTRACE("%s", __func__); JNIEnv *env = NULL; if (JNI_OK != SDL_JNI_SetupThreadEnv(&env)) { ALOGE("%s: SetupThreadEnv failed", __func__); return SDL_AMEDIA_ERROR_UNKNOWN; } jobject android_media_codec = SDL_AMediaCodecJava_getObject(env, acodec); (*env)->CallVoidMethod(env, android_media_codec, g_clazz.jmid_flush, android_media_codec); if (SDL_JNI_CatchException(env)) { ALOGE("%s: flush", __func__); return SDL_AMEDIA_ERROR_UNKNOWN; } return SDL_AMEDIA_OK; }