[FFmpeg-devel] [PATCH] jni, mediacodec: Return ENOSYS on unsupported platforms

Timothy Gu timothygu99 at gmail.com
Wed Aug 3 01:28:10 EEST 2016


---
 libavcodec/jni.c        | 9 ++++-----
 libavcodec/mediacodec.c | 6 ++++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/jni.c b/libavcodec/jni.c
index 32456f5..85dcf2a 100644
--- a/libavcodec/jni.c
+++ b/libavcodec/jni.c
@@ -20,19 +20,18 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 
-#include "config.h"
+#include "libavutil/error.h"
 #include "jni.h"
 
 #if CONFIG_JNI
-
-#include <errno.h>
 #include <jni.h>
 #include <pthread.h>
 
 #include "libavutil/log.h"
-#include "libavutil/error.h"
 #include "ffjni.h"
 
 void *java_vm;
@@ -69,7 +68,7 @@ void *av_jni_get_java_vm(void *log_ctx)
 
 int av_jni_set_java_vm(void *vm, void *log_ctx)
 {
-    return 0;
+    return AVERROR(ENOSYS);
 }
 
 void *av_jni_get_java_vm(void *log_ctx)
diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c
index cd8766f..a658f0e 100644
--- a/libavcodec/mediacodec.c
+++ b/libavcodec/mediacodec.c
@@ -22,6 +22,8 @@
 
 #include "config.h"
 
+#include "libavutil/error.h"
+
 #if CONFIG_H264_MEDIACODEC_HWACCEL
 
 #include <jni.h>
@@ -108,7 +110,7 @@ AVMediaCodecContext *av_mediacodec_alloc_context(void)
 
 int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface)
 {
-    return 0;
+    return AVERROR(ENOSYS);
 }
 
 void av_mediacodec_default_free(AVCodecContext *avctx)
@@ -117,7 +119,7 @@ void av_mediacodec_default_free(AVCodecContext *avctx)
 
 int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render)
 {
-    return 0;
+    return AVERROR(ENOSYS);
 }
 
 #endif
-- 
2.1.4



More information about the ffmpeg-devel mailing list