1 #ifndef __FFMPEG_HELPER_H__
2 #define __FFMPEG_HELPER_H__
8 #include "libavformat/avformat.h"
9 #include "libavcodec/avcodec.h"
10 #include "libswscale/swscale.h"
11 #include "libavutil/imgutils.h"
12 #include "libavutil/time.h"
13 #include "libavdevice/avdevice.h"
18 static jint nativeOnLoad(JavaVM * jvm, void* reserved);
19 static jint nativeInitEncoder(JNIEnv *env, jclass cls, jint width, jint height, jstring url);
20 static jint nativeProcessFrame(JNIEnv *env, jclass cls, jbyteArray data);
21 static jint nativeClose();
24 static void av_log_cb (void *ptr, int level, const char* fmt, va_list vl);
25 void javaPrint(const char* str, int level);
27 int processFrame(uint8_t *data);
28 int initEncoder(int width, int height, const char* url);
32 FfmpegHelper(JavaVM* vm, jclass cls);
35 static FfmpegHelper* singleton;
37 jclass ai_suanzi_rtmpclient_FfmpegHelper;
40 AVFormatContext* formatCtx;
41 AVCodecContext* codecCtx;
48 unsigned int frameCnt;
50 static bool isEncoderReady;
53 #endif /* __FFMPEG_HELPER_H__ */