#include "config.h"
+#include "libavutil/error.h"
+
+#include "mediacodec.h"
+
#if CONFIG_H264_MEDIACODEC_HWACCEL
#include <jni.h>
#include "libavutil/mem.h"
#include "ffjni.h"
-#include "mediacodec.h"
-#include "mediacodecdec.h"
+#include "mediacodecdec_common.h"
+#include "version.h"
AVMediaCodecContext *av_mediacodec_alloc_context(void)
{
{
int ret = 0;
JNIEnv *env = NULL;
- int attached = 0;
- env = ff_jni_attach_env(&attached, avctx);
+ env = ff_jni_get_env(avctx);
if (!env) {
return AVERROR_EXTERNAL;
}
ret = AVERROR_EXTERNAL;
}
- if (attached) {
- ff_jni_detach_env(avctx);
- }
-
return ret;
}
void av_mediacodec_default_free(AVCodecContext *avctx)
{
JNIEnv *env = NULL;
- int attached = 0;
AVMediaCodecContext *ctx = avctx->hwaccel_context;
return;
}
- env = ff_jni_attach_env(&attached, avctx);
+ env = ff_jni_get_env(avctx);
if (!env) {
return;
}
ctx->surface = NULL;
}
- if (attached) {
- ff_jni_detach_env(avctx);
- }
-
av_freep(&avctx->hwaccel_context);
}
#include <stdlib.h>
-#include "mediacodec.h"
-
AVMediaCodecContext *av_mediacodec_alloc_context(void)
{
return NULL;
int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface)
{
- return 0;
+ return AVERROR(ENOSYS);
}
void av_mediacodec_default_free(AVCodecContext *avctx)
int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render)
{
- return 0;
+ return AVERROR(ENOSYS);
}
#endif