MyGstream.java 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. package com.wdkl.gstreamer.demo;
  2. import android.util.Log;
  3. public class MyGstream {
  4. //c 调用
  5. protected native void nativeInit(String serverUri); // Initialize native code, build pipeline, etc
  6. protected native void nativeFinalize(); // Destroy pipeline and shutdown native code
  7. protected native void nativePlay(); // Set pipeline to PLAYING
  8. protected native void nativePause(); // Set pipeline to PAUSED
  9. protected static native boolean nativeClassInit(); // Initialize native class: cache Method IDs for callbacks
  10. protected long native_custom_data; // Native code will use this to keep private data
  11. // 必须实现此方法。给 c 调用,用于输出状态
  12. protected void setMessage(final String message) {
  13. Log.d("Streamer", "onMessage: " + message);
  14. }
  15. // 必须实现此方法。给 c 调用,用于判断是否加载完成,才能执行命令
  16. protected void onGStreamerInitialized () {
  17. Log.d("Streamer", "onGStreamerInitialized");
  18. }
  19. //初始化 c 库
  20. static {
  21. //System.loadLibrary("gstreamer_android");
  22. System.loadLibrary("wdkl-broadcast");
  23. nativeClassInit();
  24. }
  25. }