avcodec/mediacodec_surface: define and use FFANativeWindow to mimic NDK interface
This will make it easy to switch to ANativeWindow_fromSurface and ANativeWindow_release in the future. Signed-off-by: Aman Gupta <aman@tmm1.net>
This commit is contained in:
parent
8a3623e2fb
commit
7fddf4b266
@ -25,7 +25,7 @@
|
|||||||
#include "ffjni.h"
|
#include "ffjni.h"
|
||||||
#include "mediacodec_surface.h"
|
#include "mediacodec_surface.h"
|
||||||
|
|
||||||
void *ff_mediacodec_surface_ref(void *surface, void *log_ctx)
|
FFANativeWindow *ff_mediacodec_surface_ref(void *surface, void *log_ctx)
|
||||||
{
|
{
|
||||||
JNIEnv *env = NULL;
|
JNIEnv *env = NULL;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ void *ff_mediacodec_surface_ref(void *surface, void *log_ctx)
|
|||||||
return (*env)->NewGlobalRef(env, surface);
|
return (*env)->NewGlobalRef(env, surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_mediacodec_surface_unref(void *surface, void *log_ctx)
|
int ff_mediacodec_surface_unref(FFANativeWindow *window, void *log_ctx)
|
||||||
{
|
{
|
||||||
JNIEnv *env = NULL;
|
JNIEnv *env = NULL;
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ int ff_mediacodec_surface_unref(void *surface, void *log_ctx)
|
|||||||
return AVERROR_EXTERNAL;
|
return AVERROR_EXTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*env)->DeleteGlobalRef(env, surface);
|
(*env)->DeleteGlobalRef(env, window);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,10 @@
|
|||||||
|
|
||||||
#include "libavcodec/avcodec.h"
|
#include "libavcodec/avcodec.h"
|
||||||
|
|
||||||
void *ff_mediacodec_surface_ref(void *surface, void *log_ctx);
|
struct FFANativeWindow;
|
||||||
int ff_mediacodec_surface_unref(void *surface, void *log_ctx);
|
typedef struct FFANativeWindow FFANativeWindow;
|
||||||
|
|
||||||
|
FFANativeWindow *ff_mediacodec_surface_ref(void *surface, void *log_ctx);
|
||||||
|
int ff_mediacodec_surface_unref(FFANativeWindow *window, void *log_ctx);
|
||||||
|
|
||||||
#endif /* AVCODEC_MEDIACODEC_SURFACE_H */
|
#endif /* AVCODEC_MEDIACODEC_SURFACE_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user