Improve Ffmpeg layer
[rtmpclient.git] / app / src / main / java / ai / suanzi / rtmpclient / FfmpegHelper.java
1 package ai.suanzi.rtmpclient;
2
3 import org.apache.log4j.Logger;
4
5 public class FfmpegHelper {
6
7     static {
8         String arch = System.getProperty("os.arch");
9         if (arch.equals("i686")){
10             System.loadLibrary("x264");
11         }
12         System.loadLibrary("avutil");
13         System.loadLibrary("postproc");
14         System.loadLibrary("swresample");
15         System.loadLibrary("swscale");
16         System.loadLibrary("avcodec");
17         System.loadLibrary("avdevice");
18         System.loadLibrary("avfilter");
19         System.loadLibrary("avformat");
20         System.loadLibrary("FfmpegHelperJNI");
21     }
22
23     private static Logger gLogger = Logger.getLogger("FfmpegHelper");
24
25     // callback from native
26     public static void javaPrint(String string){
27         gLogger.error(string);
28     }
29
30     // native methods
31     public static native int initialEncoder(int width, int height, String url);
32     public static native int processFrame(byte[] frame);
33     public static native int close();
34 }