提交 b1989d9f 编写于 作者: Z Zhang Rui

android: remove ijkutil

上级 b1e82398
......@@ -117,7 +117,6 @@ public final class IjkMediaPlayer extends SimpleMediaPlayer {
libLoader = sLocalLibLoader;
libLoader.loadLibrary("ijkffmpeg");
libLoader.loadLibrary("ijkutil");
libLoader.loadLibrary("ijksdl");
libLoader.loadLibrary("ijkplayer");
mIsLibLoaded = true;
......
......@@ -51,7 +51,7 @@ LOCAL_SRC_FILES += android/pipeline/ffpipeline_android.c
LOCAL_SRC_FILES += android/pipeline/ffpipenode_android_mediacodec_vdec.c
LOCAL_SRC_FILES += android/pipeline/ffpipenode_android_mediacodec_vout.c
LOCAL_SHARED_LIBRARIES := ijkffmpeg ijkutil ijksdl
LOCAL_SHARED_LIBRARIES := ijkffmpeg ijksdl
LOCAL_STATIC_LIBRARIES := android-ndk-profiler
LOCAL_MODULE := ijkplayer
......
......@@ -26,7 +26,7 @@
#include <string.h>
#include <jni.h>
#include "../ff_ffinc.h"
#include "ijkutil/ijkutil.h"
#include "ijksdl/ijksdl_log.h"
#include "ijksdl/android/ijksdl_android_jni.h"
#define JNI_CLASS_FFMPEG_API "tv/danmaku/ijk/media/player/ffmpeg/FFmpegApi"
......
......@@ -24,8 +24,7 @@
#include <string.h>
#include <pthread.h>
#include <jni.h>
#include "ijkutil/ijkutil.h"
#include "ijkutil/android/ijkutil_android.h"
#include "ijksdl/ijksdl_log.h"
#include "../ff_ffplay.h"
#include "ffmpeg_api_jni.h"
#include "ijkplayer_android_def.h"
......
......@@ -23,7 +23,7 @@
#include <limits.h>
#include "libavcodec/avcodec.h"
#include "ijkutil/ijklog.h"
#include "ijksdl/ijksdl_log.h"
#if 1
/* Parse the SPS/PPS Metadata and convert it to annex b format */
static int convert_sps_pps( const uint8_t *p_buf, size_t i_buf_size,
......
......@@ -64,6 +64,7 @@
#include "ff_ffpipenode.h"
#include "ff_ffplay_debug.h"
#include "ijkmeta.h"
#include "ijksdl/ijksdl_log.h"
// FIXME: 9 work around NDKr8e or gcc4.7 bug
// isnan() may not recognize some double NAN, so we test both double and float
......
......@@ -59,7 +59,7 @@ LOCAL_SRC_FILES += android/ijksdl_vout_android_nativewindow.c
LOCAL_SRC_FILES += android/ijksdl_vout_android_surface.c
LOCAL_SRC_FILES += android/ijksdl_vout_overlay_android_mediacodec.c
LOCAL_SHARED_LIBRARIES := ijkffmpeg ijkutil
LOCAL_SHARED_LIBRARIES := ijkffmpeg
LOCAL_STATIC_LIBRARIES := cpufeatures yuv_static
LOCAL_MODULE := ijksdl
......
......@@ -25,7 +25,6 @@
#include <assert.h>
#include "ijksdl_android_jni.h"
#include "ijkutil/ijkutil.h"
#include "../ijksdl_inc_internal.h"
#include "../ijksdl_audio.h"
......
......@@ -25,7 +25,6 @@
#include <assert.h>
#include <android/native_window.h>
#include "ijkutil/ijkutil.h"
#include "../ijksdl_vout.h"
#include "../ijksdl_vout_internal.h"
#include "../ffmpeg/ijksdl_inc_ffmpeg.h"
......
......@@ -82,11 +82,6 @@ jint SDL_JNI_SetupThreadEnv(JNIEnv **p_env)
return -1;
}
void SDL_JNI_ThrowException(JNIEnv *env, const char* msg)
{
jniThrowException(env, "java/lang/IllegalStateException", msg);
}
jboolean SDL_JNI_RethrowException(JNIEnv *env)
{
if ((*env)->ExceptionCheck(env)) {
......@@ -108,6 +103,43 @@ jboolean SDL_JNI_CatchException(JNIEnv *env)
return JNI_FALSE;
}
int SDL_JNI_ThrowException(JNIEnv* env, const char* className, const char* msg)
{
if ((*env)->ExceptionCheck(env)) {
jthrowable exception = (*env)->ExceptionOccurred(env);
(*env)->ExceptionClear(env);
if (exception != NULL) {
ALOGW("Discarding pending exception (%s) to throw", className);
(*env)->DeleteLocalRef(env, exception);
}
}
jclass exceptionClass = (*env)->FindClass(env, className);
if (exceptionClass == NULL) {
ALOGE("Unable to find exception class %s", className);
/* ClassNotFoundException now pending */
goto fail;
}
if ((*env)->ThrowNew(env, exceptionClass, msg) != JNI_OK) {
ALOGE("Failed throwing '%s' '%s'", className, msg);
/* an exception, most likely OOM, will now be pending */
goto fail;
}
return 0;
fail:
if (exceptionClass)
(*env)->DeleteLocalRef(env, exceptionClass);
return -1;
}
int SDL_JNI_ThrowIllegalStateException(JNIEnv *env, const char* msg)
{
return SDL_JNI_ThrowException(env, "java/lang/IllegalStateException", msg);
}
jobject SDL_JNI_NewObjectAsGlobalRef(JNIEnv *env, jclass clazz, jmethodID methodID, ...)
{
va_list args;
......
......@@ -52,9 +52,10 @@ JavaVM *SDL_JNI_GetJvm();
jint SDL_JNI_SetupThreadEnv(JNIEnv **p_env);
void SDL_JNI_ThrowException(JNIEnv *env, const char* msg);
jboolean SDL_JNI_RethrowException(JNIEnv *env);
jboolean SDL_JNI_CatchException(JNIEnv *env);
int SDL_JNI_ThrowException(JNIEnv *env, const char *exception, const char* msg);
int SDL_JNI_ThrowIllegalStateException(JNIEnv *env, const char* msg);
jobject SDL_JNI_NewObjectAsGlobalRef(JNIEnv *env, jclass clazz, jmethodID methodID, ...);
......@@ -115,4 +116,34 @@ int SDL_Android_GetApiLevel();
} \
} while(0);
#define JNI_CHECK_GOTO(condition__, env__, exception__, msg__, label__) \
do { \
if (!(condition__)) { \
if (exception__) { \
SDL_JNI_ThrowException(env__, exception__, msg__); \
} \
goto label__; \
} \
}while(0)
#define JNI_CHECK_RET_VOID(condition__, env__, exception__, msg__) \
do { \
if (!(condition__)) { \
if (exception__) { \
SDL_JNI_ThrowException(env__, exception__, msg__); \
} \
return; \
} \
}while(0)
#define JNI_CHECK_RET(condition__, env__, exception__, msg__, ret__) \
do { \
if (!(condition__)) { \
if (exception__) { \
SDL_JNI_ThrowException(env__, exception__, msg__); \
} \
return ret__; \
} \
}while(0)
#endif
......@@ -23,7 +23,6 @@
#include "ijksdl_codec_android_mediacodec.h"
#include <assert.h>
#include "ijkutil/ijkutil.h"
// FIXME: release SDL_AMediaCodec
sdl_amedia_status_t SDL_AMediaCodec_delete(SDL_AMediaCodec* acodec)
......
......@@ -25,7 +25,6 @@
#define IJKSDL_ANDROID__ANDROID_CODEC_ANDROID_MEDIACODEC_INTERNAL_H
#include "ijksdl_codec_android_mediacodec.h"
#include "ijkutil/ijkutil.h"
inline static SDL_AMediaCodec *SDL_AMediaCodec_CreateInternal(size_t opaque_size)
{
......
......@@ -27,7 +27,6 @@
#include "ijksdl_codec_android_mediacodec_internal.h"
#include "ijksdl_codec_android_mediaformat_java.h"
#include "ijksdl_inc_internal_android.h"
#include "ijkutil/ijkutil.h"
static SDL_Class g_amediacodec_class = {
.name = "AMediaCodecJava",
......
......@@ -24,7 +24,7 @@
#ifndef IJKSDL_ANDROID__ANDROID_CODEC_ANDROID_MEDIADEF_H
#define IJKSDL_ANDROID__ANDROID_CODEC_ANDROID_MEDIADEF_H
#include "ijkutil/ijkutil.h"
#include "../ijksdl_misc.h"
typedef enum sdl_amedia_status_t {
SDL_AMEDIA_OK = 0,
......
......@@ -25,7 +25,6 @@
#define IJKSDL_ANDROID__ANDROID_CODEC_ANDROID_MEDIAFORMAT_INTERNAL_H
#include "ijksdl_codec_android_mediaformat.h"
#include "ijkutil/ijkutil.h"
inline static SDL_AMediaFormat *SDL_AMediaFormat_CreateInternal(size_t opaque_size)
{
......
......@@ -24,9 +24,11 @@
#define IJKPLAYER__IJKSDL_INC_INTERNAL_ANDROID_H
#include <stdint.h>
#include <jni.h>
#include "../ijksdl_inc_internal.h"
#include "ijkutil/ijkutil.h"
#include "../ijksdl_misc.h"
#include "../ijksdl_log.h"
enum {
HAL_PIXEL_FORMAT_RGBA_8888 = 1,
......
......@@ -25,7 +25,6 @@
#include <assert.h>
#include <android/native_window.h>
#include "ijkutil/ijkutil.h"
#include "ijksdl_vout_overlay_android_mediacodec.h"
#include "android_nativewindow.h"
#include "../ijksdl_vout.h"
......
......@@ -23,11 +23,11 @@
#include "ijksdl_vout_overlay_android_mediacodec.h"
#include "ijksdl_codec_android_mediacodec.h"
#include "ijksdl_inc_internal_android.h"
#include "../ijksdl_stdinc.h"
#include "../ijksdl_mutex.h"
#include "../ijksdl_vout_internal.h"
#include "../ijksdl_video.h"
#include "ijkutil/ijklog.h"
typedef struct SDL_VoutOverlay_Opaque {
SDL_mutex *mutex;
......
......@@ -26,7 +26,25 @@
#include <stdio.h>
#define IJK_LOG_TAG "IJKMEDIA"
#ifdef __ANDROID__
#include <android/log.h>
#define IJK_LOG_UNKNOWN ANDROID_LOG_UNKNOWN
#define IJK_LOG_DEFAULT ANDROID_LOG_DEFAULT
#define IJK_LOG_VERBOSE ANDROID_LOG_VERBOSE
#define IJK_LOG_DEBUG ANDROID_LOG_DEBUG
#define IJK_LOG_INFO ANDROID_LOG_INFO
#define IJK_LOG_WARN ANDROID_LOG_WARN
#define IJK_LOG_ERROR ANDROID_LOG_ERROR
#define IJK_LOG_FATAL ANDROID_LOG_FATAL
#define IJK_LOG_SILENT ANDROID_LOG_SILENT
#define VLOG(level, TAG, ...) ((void)__android_log_vprint(level, TAG, __VA_ARGS__))
#define ALOG(level, TAG, ...) ((void)__android_log_print(level, TAG, __VA_ARGS__))
#else
#define IJK_LOG_UNKNOWN 0
#define IJK_LOG_DEFAULT 1
......@@ -40,13 +58,18 @@
#define IJK_LOG_SILENT 8
#define VLOG(level, TAG, ...) ((void)vprintf(__VA_ARGS__))
#define ALOG(level, TAG, ...) ((void)printf(__VA_ARGS__))
#endif
#define IJK_LOG_TAG "IJKMEDIA"
#define VLOGV(...) VLOG(IJK_LOG_VERBOSE, IJK_LOG_TAG, __VA_ARGS__)
#define VLOGD(...) VLOG(IJK_LOG_DEBUG, IJK_LOG_TAG, __VA_ARGS__)
#define VLOGI(...) VLOG(IJK_LOG_INFO, IJK_LOG_TAG, __VA_ARGS__)
#define VLOGW(...) VLOG(IJK_LOG_WARN, IJK_LOG_TAG, __VA_ARGS__)
#define VLOGE(...) VLOG(IJK_LOG_ERROR, IJK_LOG_TAG, __VA_ARGS__)
#define ALOG(level, TAG, ...) ((void)printf(__VA_ARGS__))
#define ALOGV(...) ALOG(IJK_LOG_VERBOSE, IJK_LOG_TAG, __VA_ARGS__)
#define ALOGD(...) ALOG(IJK_LOG_DEBUG, IJK_LOG_TAG, __VA_ARGS__)
#define ALOGI(...) ALOG(IJK_LOG_INFO, IJK_LOG_TAG, __VA_ARGS__)
......
......@@ -45,6 +45,10 @@
return (retval__); \
}
#ifndef NELEM
#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
#endif
inline static void *mallocz(size_t size)
{
void *mem = malloc(size);
......
......@@ -23,6 +23,7 @@
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include "ijksdl_inc_internal.h"
#include "ijksdl_thread.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册