History

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.

Aman Gupta committed 7 years ago

Commit 7fddf4b1 parent 8a3623e2 files · +8 −5Browse files

Unified · Split

2 files
  1. libavcodec/mediacodec_surface.c +3 −3
  2. libavcodec/mediacodec_surface.h +5 −2
libavcodec/mediacodec_surface.c+3−3
@@ -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
28void *ff_mediacodec_surface_ref(void *surface, void *log_ctx)28FFANativeWindow *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
40int ff_mediacodec_surface_unref(void *surface, void *log_ctx)40int 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}
libavcodec/mediacodec_surface.h+5−2
@@ -25,7 +25,10 @@ · 24 unmodified lines
25 25
26#include "libavcodec/avcodec.h"26#include "libavcodec/avcodec.h"
27 27
28void *ff_mediacodec_surface_ref(void *surface, void *log_ctx);28struct FFANativeWindow;
29int ff_mediacodec_surface_unref(void *surface, void *log_ctx);29typedef struct FFANativeWindow FFANativeWindow;
30
31FFANativeWindow *ff_mediacodec_surface_ref(void *surface, void *log_ctx);
32int ff_mediacodec_surface_unref(FFANativeWindow *window, void *log_ctx);
30 33
31#endif /* AVCODEC_MEDIACODEC_SURFACE_H */34#endif /* AVCODEC_MEDIACODEC_SURFACE_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t