}
public native String getVersion();
+ public native int init(int width, int height);
+ public native int flush();
+ public native int close();
+ public native int process(byte[] data);
+ public native int play(Object surface, String fname);
}
LOCAL_MODULE := ffmpeg-jni
LOCAL_SRC_FILES := ai_suanzi_rtmpclient_Ffmpeg.cpp
LOCAL_SHARED_LIBRARIES := avdevice avcodec avformat avfilter swresample swscale avutil postproc x264
-LOCAL_LDLIBS :=-llog
+LOCAL_LDLIBS :=-llog -landroid
include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
// Created by Peng Li on 30/4/2018.
//
#include "ai_suanzi_rtmpclient_Ffmpeg.h"
-#include <android/log.h>
+#include <android/native_window.h>
+#include <android/native_window_jni.h>
+#include "log.h"
extern "C" {
#include "libavformat/avformat.h"
#include "libavutil/time.h"
}
-#define TAG "PENG"
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,TAG,__VA_ARGS__)
JNIEXPORT jstring JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_getVersion (JNIEnv *env, jobject obj) {
jint v = avformat_version();
LOGE("######### Ffmpeg JNI version i= %d", v);
return env->NewStringUTF("====== Ffmpeg call =======");
+}
+
+JNIEXPORT jint JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_init (JNIEnv *, jobject, jint, jint) {
+ return 0;
+}
+
+JNIEXPORT jint JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_flush (JNIEnv *, jobject){
+ return 0;
+}
+
+JNIEXPORT jint JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_close (JNIEnv *, jobject){
+ return 0;
+}
+
+JNIEXPORT jint JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_process (JNIEnv *, jobject, jbyteArray){
+ return 0;
+}
+
+JNIEXPORT jint JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_play (JNIEnv *, jobject, jobject, jstring){
+ return 0;
}
\ No newline at end of file
JNIEXPORT jstring JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_getVersion
(JNIEnv *, jobject);
+/*
+ * Class: ai_suanzi_rtmpclient_Ffmpeg
+ * Method: init
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_init
+ (JNIEnv *, jobject, jint, jint);
+
+/*
+ * Class: ai_suanzi_rtmpclient_Ffmpeg
+ * Method: flush
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_flush
+ (JNIEnv *, jobject);
+
+/*
+ * Class: ai_suanzi_rtmpclient_Ffmpeg
+ * Method: close
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_close
+ (JNIEnv *, jobject);
+
+/*
+ * Class: ai_suanzi_rtmpclient_Ffmpeg
+ * Method: process
+ * Signature: ([B)I
+ */
+JNIEXPORT jint JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_process
+ (JNIEnv *, jobject, jbyteArray);
+
+/*
+ * Class: ai_suanzi_rtmpclient_Ffmpeg
+ * Method: play
+ * Signature: (Ljava/lang/Object;Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_ai_suanzi_rtmpclient_Ffmpeg_play
+ (JNIEnv *, jobject, jobject, jstring);
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+//
+// Created by Peng Li on 30/4/2018.
+//
+
+#ifndef RTMPCLIENT_LOG_H
+#define RTMPCLIENT_LOG_H
+
+#include <android/log.h>
+
+#define LOG_TAG __FILE__
+
+#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
+#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUT, LOG_TAG, __VA_ARGS__)
+#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
+#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)
+#define LOGF(...) __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, __VA_ARGS__)
+#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
+
+
+#endif //RTMPCLIENT_LOG_H