--- /dev/null
+#ifndef __FFMPEG_HELPER_H__
+#define __FFMPEG_HELPER_H__
+
+#include <jni.h>
+#include <string>
+
+extern "C" {
+ #include "libavformat/avformat.h"
+ #include "libavcodec/avcodec.h"
+ #include "libswscale/swscale.h"
+ #include "libavutil/imgutils.h"
+ #include "libavutil/time.h"
+ #include "libavdevice/avdevice.h"
+}
+
+class FfmpegHelper {
+public:
+ static jint nativeOnLoad(JavaVM * jvm, void* reserved);
+ static jint nativeInitialEncoder(JNIEnv *env, jclass cls, jint width, jint height, jstring url);
+ static jint nativeProcessFrame(JNIEnv *env, jclass cls, jbyteArray data);
+ static jint nativeClose();
+
+private:
+ static void av_log_cb (void *ptr, int level, const char* fmt, va_list vl);
+ void javaPrint(const char* str);
+ static void init();
+ int processFrame(uint8_t *data);
+ int initEncoder(int width, int height, const char* url);
+ int close();
+
+private:
+ FfmpegHelper(JavaVM* vm, jclass cls);
+
+private:
+ static FfmpegHelper* singleton;
+ JavaVM *jvm;
+ jclass ai_suanzi_rtmpclient_FfmpegHelper;
+ static bool isInit;
+
+ AVFormatContext* formatCtx;
+ AVCodecContext* codecCtx;
+ AVCodec* codec;
+ AVStream* vStream;
+ int pWidth;
+ int pHeight;
+ unsigned int frameCnt;
+ int64_t startTime;
+};
+
+#endif /* __FFMPEG_HELPER_H__ */