This will make it easy to switch to ANativeWindow_fromSurface and ANativeWindow_release in the future.
Unified · Split
| @@ -25,7 +25,7 @@ · 24 unmodified lines | |||
| 25 | #include "ffjni.h" | 25 | #include "ffjni.h" |
| 26 | #include "mediacodec_surface.h" | 26 | #include "mediacodec_surface.h" |
| 27 | 27 | ||
| 28 | void *ff_mediacodec_surface_ref(void *surface, void *log_ctx) | 28 | FFANativeWindow *ff_mediacodec_surface_ref(void *surface, void *log_ctx) |
| 29 | { | 29 | { |
| 30 | JNIEnv *env = NULL; | 30 | JNIEnv *env = NULL; |
| 31 | 31 | ||
| @@ -37,7 +37,7 @@ void *ff_mediacodec_surface_ref(void *surface, void *log_ctx) · 5 unmodified lines | |||
| 37 | return (*env)->NewGlobalRef(env, surface); | 37 | return (*env)->NewGlobalRef(env, surface); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | int ff_mediacodec_surface_unref(void *surface, void *log_ctx) | 40 | int ff_mediacodec_surface_unref(FFANativeWindow *window, void *log_ctx) |
| 41 | { | 41 | { |
| 42 | JNIEnv *env = NULL; | 42 | JNIEnv *env = NULL; |
| 43 | 43 | ||
| @@ -46,7 +46,7 @@ int ff_mediacodec_surface_unref(void *surface, void *log_ctx) · 2 unmodified lines | |||
| 46 | return AVERROR_EXTERNAL; | 46 | return AVERROR_EXTERNAL; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | (*env)->DeleteGlobalRef(env, surface); | 49 | (*env)->DeleteGlobalRef(env, window); |
| 50 | 50 | ||
| 51 | return 0; | 51 | return 0; |
| 52 | } | 52 | } |
| @@ -25,7 +25,10 @@ · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | #include "libavcodec/avcodec.h" | 26 | #include "libavcodec/avcodec.h" |
| 27 | 27 | ||
| 28 | void *ff_mediacodec_surface_ref(void *surface, void *log_ctx); | 28 | struct FFANativeWindow; |
| 29 | int ff_mediacodec_surface_unref(void *surface, void *log_ctx); | 29 | typedef struct FFANativeWindow FFANativeWindow; |
| 30 | |||
| 31 | FFANativeWindow *ff_mediacodec_surface_ref(void *surface, void *log_ctx); | ||
| 32 | int ff_mediacodec_surface_unref(FFANativeWindow *window, void *log_ctx); | ||
| 30 | 33 | ||
| 31 | #endif /* AVCODEC_MEDIACODEC_SURFACE_H */ | 34 | #endif /* AVCODEC_MEDIACODEC_SURFACE_H */ |