CMakeLists.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # For more information about using CMake with Android Studio, read the
  2. # documentation: https://d.android.com/studio/projects/add-native-code.html
  3. # Sets the minimum version of CMake required to build the native library.
  4. cmake_minimum_required(VERSION 3.4.1)
  5. # Creates and names a library, sets it as either STATIC
  6. # or SHARED, and provides the relative paths to its source code.
  7. # You can define multiple libraries, and CMake builds them for you.
  8. # Gradle automatically packages shared libraries with your APK.
  9. set(SRC_FFMPEG
  10. src/main/cpp/ffmpeg/cmdutils.c
  11. src/main/cpp/ffmpeg/ffmpeg.c
  12. src/main/cpp/ffmpeg/ffmpeg_filter.c
  13. src/main/cpp/ffmpeg/ffmpeg_opt.c
  14. src/main/cpp/ffmpeg_cmd.c
  15. src/main/cpp/ffmpeg/ffprobe.c
  16. src/main/cpp/ffmpeg/ffmpeg_hw.c)
  17. set(SRC_VISUALIZER
  18. src/main/cpp/visualizer/fft.cpp
  19. src/main/cpp/visualizer/fixed_fft.cpp
  20. src/main/cpp/visualizer/frank_visualizer.cpp
  21. src/main/cpp/visualizer/frank_visualizer_jni.cpp
  22. src/main/cpp/visualizer/window.cpp)
  23. set(SRC_METADATA
  24. src/main/cpp/metadata/media_retriever.cpp
  25. src/main/cpp/metadata/media_retriever_jni.cpp
  26. src/main/cpp/metadata/metadata_util.c
  27. src/main/cpp/metadata/ffmpeg_media_retriever.c)
  28. set(SRC_FFPLAYER ffplayer)
  29. add_library( # Sets the name of the library.
  30. media-handle
  31. # Sets the library as a shared library.
  32. SHARED
  33. # Provides a relative path to your source file(s).
  34. ${SRC_FFMPEG}
  35. ${SRC_VISUALIZER}
  36. ${SRC_METADATA}
  37. # ${SRC_FFPLAYER}
  38. src/main/cpp/video_filter.c
  39. src/main/cpp/ffprobe_cmd.cpp
  40. src/main/cpp/video_cutting.cpp
  41. src/main/cpp/yuv/yuv_converter.cpp
  42. src/main/cpp/pcm/pcm_process.cpp
  43. src/main/cpp/media_transcode.cpp
  44. src/main/cpp/ff_audio_resample.cpp
  45. src/main/cpp/common_media_jni.cpp
  46. src/main/cpp/ff_audio_player.cpp
  47. src/main/cpp/audio_player_jni.cpp
  48. src/main/cpp/ff_rtmp_pusher.cpp
  49. src/main/cpp/ffmpeg_pusher_jni.cpp
  50. )
  51. add_library( ffmpeg
  52. SHARED
  53. IMPORTED )
  54. set_target_properties( ffmpeg
  55. PROPERTIES IMPORTED_LOCATION
  56. ../../../../libs/${CMAKE_ANDROID_ARCH_ABI}/libffmpeg.so )
  57. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
  58. include_directories(src/main/cpp)
  59. include_directories(src/main/cpp/ffmpeg)
  60. include_directories(src/main/cpp/include)
  61. include_directories(src/main/cpp/metadata)
  62. include_directories(ffplayer)
  63. if(${CMAKE_ANDROID_ARCH_ABI} MATCHES "armeabi-v7a")
  64. include_directories(src/main/cpp/include/armeabi-v7a)
  65. message("This is armeabi-v7a")
  66. elseif(${CMAKE_ANDROID_ARCH_ABI} MATCHES "arm64-v8a")
  67. include_directories(src/main/cpp/include/arm64-v8a)
  68. message("This is arm64-v8a")
  69. endif()
  70. find_library( # Sets the name of the path variable.
  71. log-lib
  72. log )
  73. target_link_libraries( # Specifies the target library.
  74. media-handle
  75. ffmpeg
  76. -landroid #native_window
  77. -ljnigraphics #bitmap
  78. -lOpenSLES #openSLES
  79. # Links the target library to the log library
  80. # included in the NDK.
  81. ${log-lib} )