├── .gitignore ├── .idea ├── checkstyle-idea.xml ├── encodings.xml ├── gradle.xml ├── markdown-navigator.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── CMakeLists.txt ├── build.gradle ├── libs │ └── armeabi-v7a │ │ └── libffmpeg.so ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wyh │ │ └── ffmpegcmd │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── mark.jpg │ ├── cpp │ │ ├── CMakeLists.txt │ │ ├── android_log.h │ │ ├── cmdutils.c │ │ ├── cmdutils.h │ │ ├── cmdutils_common_opts.h │ │ ├── ffmpeg-api.c │ │ ├── ffmpeg-api.h │ │ ├── ffmpeg-jni.cpp │ │ ├── ffmpeg-jni.h │ │ ├── ffmpeg.c │ │ ├── ffmpeg.h │ │ ├── ffmpeg_filter.c │ │ ├── ffmpeg_opt.c │ │ ├── include │ │ │ ├── libavcodec │ │ │ │ ├── avcodec.h │ │ │ │ ├── avdct.h │ │ │ │ ├── avfft.h │ │ │ │ ├── d3d11va.h │ │ │ │ ├── dirac.h │ │ │ │ ├── dv_profile.h │ │ │ │ ├── dxva2.h │ │ │ │ ├── jni.h │ │ │ │ ├── mediacodec.h │ │ │ │ ├── qsv.h │ │ │ │ ├── vaapi.h │ │ │ │ ├── vda.h │ │ │ │ ├── vdpau.h │ │ │ │ ├── version.h │ │ │ │ ├── videotoolbox.h │ │ │ │ ├── vorbis_parser.h │ │ │ │ └── xvmc.h │ │ │ ├── libavdevice │ │ │ │ ├── avdevice.h │ │ │ │ └── version.h │ │ │ ├── libavfilter │ │ │ │ ├── avfilter.h │ │ │ │ ├── avfiltergraph.h │ │ │ │ ├── buffersink.h │ │ │ │ ├── buffersrc.h │ │ │ │ └── version.h │ │ │ ├── libavformat │ │ │ │ ├── avformat.h │ │ │ │ ├── avio.h │ │ │ │ └── version.h │ │ │ ├── libavutil │ │ │ │ ├── adler32.h │ │ │ │ ├── aes.h │ │ │ │ ├── aes_ctr.h │ │ │ │ ├── attributes.h │ │ │ │ ├── audio_fifo.h │ │ │ │ ├── avassert.h │ │ │ │ ├── avconfig.h │ │ │ │ ├── avstring.h │ │ │ │ ├── avutil.h │ │ │ │ ├── base64.h │ │ │ │ ├── blowfish.h │ │ │ │ ├── bprint.h │ │ │ │ ├── bswap.h │ │ │ │ ├── buffer.h │ │ │ │ ├── camellia.h │ │ │ │ ├── cast5.h │ │ │ │ ├── channel_layout.h │ │ │ │ ├── common.h │ │ │ │ ├── cpu.h │ │ │ │ ├── crc.h │ │ │ │ ├── des.h │ │ │ │ ├── dict.h │ │ │ │ ├── display.h │ │ │ │ ├── downmix_info.h │ │ │ │ ├── error.h │ │ │ │ ├── eval.h │ │ │ │ ├── ffversion.h │ │ │ │ ├── fifo.h │ │ │ │ ├── file.h │ │ │ │ ├── frame.h │ │ │ │ ├── hash.h │ │ │ │ ├── hmac.h │ │ │ │ ├── hwcontext.h │ │ │ │ ├── hwcontext_cuda.h │ │ │ │ ├── hwcontext_dxva2.h │ │ │ │ ├── hwcontext_qsv.h │ │ │ │ ├── hwcontext_vaapi.h │ │ │ │ ├── hwcontext_vdpau.h │ │ │ │ ├── imgutils.h │ │ │ │ ├── intfloat.h │ │ │ │ ├── intreadwrite.h │ │ │ │ ├── lfg.h │ │ │ │ ├── log.h │ │ │ │ ├── lzo.h │ │ │ │ ├── macros.h │ │ │ │ ├── mastering_display_metadata.h │ │ │ │ ├── mathematics.h │ │ │ │ ├── md5.h │ │ │ │ ├── mem.h │ │ │ │ ├── motion_vector.h │ │ │ │ ├── murmur3.h │ │ │ │ ├── opt.h │ │ │ │ ├── parseutils.h │ │ │ │ ├── pixdesc.h │ │ │ │ ├── pixelutils.h │ │ │ │ ├── pixfmt.h │ │ │ │ ├── random_seed.h │ │ │ │ ├── rational.h │ │ │ │ ├── rc4.h │ │ │ │ ├── replaygain.h │ │ │ │ ├── ripemd.h │ │ │ │ ├── samplefmt.h │ │ │ │ ├── sha.h │ │ │ │ ├── sha512.h │ │ │ │ ├── spherical.h │ │ │ │ ├── stereo3d.h │ │ │ │ ├── tea.h │ │ │ │ ├── threadmessage.h │ │ │ │ ├── time.h │ │ │ │ ├── timecode.h │ │ │ │ ├── timestamp.h │ │ │ │ ├── tree.h │ │ │ │ ├── twofish.h │ │ │ │ ├── version.h │ │ │ │ └── xtea.h │ │ │ ├── libswresample │ │ │ │ ├── swresample.h │ │ │ │ └── version.h │ │ │ └── libswscale │ │ │ │ ├── swscale.h │ │ │ │ └── version.h │ │ ├── j4a_base.c │ │ └── j4a_base.h │ ├── java │ │ └── com │ │ │ └── wyh │ │ │ └── ffmpegcmd │ │ │ ├── AboutFragment.java │ │ │ ├── MainActivity.java │ │ │ ├── common │ │ │ ├── App.java │ │ │ ├── AppExecutors.java │ │ │ ├── Click.java │ │ │ ├── Logger.java │ │ │ ├── PermissionHelper.java │ │ │ ├── SaveProgressDialog.java │ │ │ ├── SecureAlertDialog.java │ │ │ ├── SecureDialog.java │ │ │ ├── SecurePopupWindow.java │ │ │ ├── SecureProgressDialog.java │ │ │ └── VideoUtil.java │ │ │ ├── edit │ │ │ ├── BaseEditActivity.java │ │ │ ├── EditItem.java │ │ │ ├── EditItemAdapter.java │ │ │ ├── EditMediaListActivity.java │ │ │ ├── ItemMediaAdapter.java │ │ │ ├── MediaFile.java │ │ │ ├── audio │ │ │ │ ├── AudioFragment.java │ │ │ │ ├── AudioMixActivity.java │ │ │ │ └── AudioTransCodeActivity.java │ │ │ └── video │ │ │ │ ├── AudioDeMuxActivity.java │ │ │ │ ├── VideoDeMuxActivity.java │ │ │ │ ├── VideoFilterActivity.java │ │ │ │ ├── VideoFlipActivity.java │ │ │ │ ├── VideoFragment.java │ │ │ │ ├── VideoNoWaterMarkActivity.java │ │ │ │ ├── VideoPuzzActivity.java │ │ │ │ └── VideoWaterMarkActivity.java │ │ │ ├── ffmpeg │ │ │ ├── Callback.java │ │ │ ├── FFmpeg.java │ │ │ ├── FFmpegApi.java │ │ │ ├── FFmpegAudio.java │ │ │ ├── FFmpegJni.java │ │ │ └── FFmpegVideo.java │ │ │ └── util │ │ │ ├── DateUtil.java │ │ │ ├── DeviceUtil.java │ │ │ ├── FileUtil.java │ │ │ ├── KeyBoardUtil.java │ │ │ ├── SnackBarUtil.java │ │ │ ├── StorageUtils.java │ │ │ ├── ToastUtil.java │ │ │ └── ViewUtil.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable-xxhdpi │ │ ├── audio_black.png │ │ ├── icon.png │ │ ├── video.png │ │ └── video_black.png │ │ ├── drawable │ │ ├── dialog_bg.xml │ │ ├── dialog_bottom_bg.xml │ │ ├── ic_audiotrack_black_24dp.xml │ │ ├── ic_call_merge_audio_24dp.xml │ │ ├── ic_demux_audio_black_24dp.xml │ │ ├── ic_demux_video_black_24dp.xml │ │ ├── ic_filter_black_24dp.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_more_horiz_white_24dp.xml │ │ ├── ic_ondemand_video_black_24dp.xml │ │ ├── ic_person_outline_black_24dp.xml │ │ ├── ic_trans_code_black_24dp.xml │ │ ├── ic_un_logo_black_24dp.xml │ │ ├── ic_video_puzz_black_24dp.xml │ │ ├── ic_video_watermark_black_24dp.xml │ │ └── progress_bar.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── activity_media_list.xml │ │ ├── fragment_about.xml │ │ ├── fragment_edit_list.xml │ │ ├── item_edit.xml │ │ ├── item_media.xml │ │ └── save_progress.xml │ │ ├── menu │ │ └── menu_toolbar.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── file_paths.xml │ └── test │ └── java │ └── com │ └── wyh │ └── ffmpegcmd │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | -------------------------------------------------------------------------------- /.idea/checkstyle-idea.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 18 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### FFEditor 2 | 3 | 一款强大的音视频编辑 App 4 | 5 | ![111.png](https://upload-images.jianshu.io/upload_images/4679478-7de6fd06af639e13.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300) 6 | 7 | 8 | 9 | 下载试用:https://fir.im/f3vd 10 | 11 | FFmpeg so 的编译基于 https://github.com/yhaolpz/FFmpeg/tree/cmd_ffmpeg_app_3.3 -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | #初步生成的ffmpeg动态库地址 4 | set(ffmpeg_output_shared_lib 5 | ${CMAKE_SOURCE_DIR}/libs/armeabi-v7a/ 6 | CACHE INTERNAL "ffmpeg_output_shared_lib_dir" 7 | ) 8 | #初步生成的ffmpeg头文件 9 | set(ffmpeg_output_include_dir 10 | ${CMAKE_SOURCE_DIR}/src/cpp/include 11 | CACHE INTERNAL "ffmpeg_output_include_dir" 12 | ) 13 | 14 | add_subdirectory(${CMAKE_SOURCE_DIR}/src/main/cpp) -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.wyh.ffmpegcmd" 7 | minSdkVersion 21 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | externalNativeBuild { 13 | cmake { 14 | cppFlags " -O3 -Wall -pipe " + 15 | " -ffast-math -fPIC" + 16 | " -fstrict-aliasing -Werror=strict-aliasing" + 17 | " -Wa,--noexecstack " + 18 | " -DANDROID -DNDEBUG" 19 | 20 | cFlags " -O3 -Wall -pipe " + 21 | " -ffast-math -fPIC" + 22 | " -fstrict-aliasing -Werror=strict-aliasing" + 23 | " -Wa,--noexecstack " + 24 | " -DANDROID -DNDEBUG" 25 | 26 | arguments "-DANDROID_PIE=OFF", 27 | "-DANDROID_ARM_NEON=TRUE", 28 | "-DANDROID_PLATFORM=android-14" 29 | 30 | } 31 | } 32 | ndk { 33 | abiFilters "armeabi-v7a" 34 | } 35 | } 36 | buildTypes { 37 | release { 38 | minifyEnabled false 39 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 40 | } 41 | } 42 | externalNativeBuild { 43 | cmake { 44 | path "CMakeLists.txt" 45 | } 46 | } 47 | 48 | sourceSets.main { 49 | jniLibs.srcDirs 'libs' 50 | } 51 | } 52 | 53 | dependencies { 54 | implementation fileTree(dir: 'libs', include: ['*.jar']) 55 | implementation 'com.android.support:appcompat-v7:28.0.0' 56 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 57 | testImplementation 'junit:junit:4.12' 58 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 59 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 60 | implementation 'com.android.support:design:28.0.0' 61 | implementation 'com.android.support:recyclerview-v7:28.0.0' 62 | //MD 底部导航栏 63 | implementation 'com.ashokvarma.android:bottom-navigation-bar:2.0.3' 64 | implementation 'com.github.bumptech.glide:glide:4.7.1' 65 | } 66 | -------------------------------------------------------------------------------- /app/libs/armeabi-v7a/libffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/libs/armeabi-v7a/libffmpeg.so -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/wyh/ffmpegcmd/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.wyh.ffmpegcmd", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 18 | 19 | 20 | 21 | 22 | 23 | 28 | 31 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/assets/mark.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/assets/mark.jpg -------------------------------------------------------------------------------- /app/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | #获取当前目录 4 | set(pwd_dir ${CMAKE_SOURCE_DIR}/src/main/cpp) 5 | 6 | #设置头文件 7 | set(include_dir 8 | ${pwd_dir} 9 | ${pwd_dir}/../../../../../FFmpeg 10 | ${ffmpeg_output_include_dir} 11 | ) 12 | 13 | #将若干库链接到目标库文件 14 | set(link_lib 15 | log 16 | android 17 | m 18 | ) 19 | 20 | #设置编译选项 21 | set(cmake_c_flag_debug 22 | 23 | ) 24 | set(cmake_cxx_flag_debug 25 | 26 | ) 27 | #设置要编译的源文件 28 | set(source_files 29 | ${pwd_dir}/ffmpeg-jni.cpp 30 | ${pwd_dir}/ffmpeg-api.c 31 | ${pwd_dir}/cmdutils.c 32 | ${pwd_dir}/ffmpeg.c 33 | ${pwd_dir}/ffmpeg_opt.c 34 | ${pwd_dir}/ffmpeg_filter.c 35 | ${pwd_dir}/j4a_base.c 36 | ) 37 | 38 | add_library(libffmpeg SHARED IMPORTED) 39 | set_target_properties(libffmpeg PROPERTIES IMPORTED_LOCATION 40 | ${ffmpeg_output_shared_lib}/libffmpeg.so) 41 | 42 | set(link_lib 43 | ${link_lib} 44 | libffmpeg 45 | ) 46 | 47 | #以下为固定语法,无需修改 48 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_dir}) 49 | include_directories(${include_dir}) 50 | set(CMAKE_C_FLAGS_DEBUG "${cmake_c_flag_debug} -s") 51 | set(CMAKE_CXX_FLAGS_DEBUG "${cmake_cxx_flag_debug} -s") 52 | add_library(cmd-ffmpeg SHARED ${source_files}) 53 | target_link_libraries(cmd-ffmpeg ${link_lib}) -------------------------------------------------------------------------------- /app/src/main/cpp/android_log.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by meitu on 2019/3/13. 3 | // 4 | 5 | #ifndef FFMPEGCMD_ANDROID_LOG_H 6 | #define FFMPEGCMD_ANDROID_LOG_H 7 | 8 | #ifdef ANDROID 9 | #include 10 | #ifndef LOG_TAG 11 | #define MY_TAG "MYTAG" 12 | #define AV_TAG "AVLOG" 13 | #endif 14 | #define LOGE(format, ...) __android_log_print(ANDROID_LOG_ERROR, MY_TAG, format, ##__VA_ARGS__) 15 | #define LOGD(format, ...) __android_log_print(ANDROID_LOG_DEBUG, MY_TAG, format, ##__VA_ARGS__) 16 | #define XLOGD(...) __android_log_print(ANDROID_LOG_INFO,AV_TAG,__VA_ARGS__) 17 | #define XLOGE(...) __android_log_print(ANDROID_LOG_ERROR,AV_TAG,__VA_ARGS__) 18 | #else 19 | #define LOGE(format, ...) printf(MY_TAG format "\n", ##__VA_ARGS__) 20 | #define LOGD(format, ...) printf(MY_TAG format "\n", ##__VA_ARGS__) 21 | #define XLOGE(format, ...) fprintf(stdout, AV_TAG ": " format "\n", ##__VA_ARGS__) 22 | #define XLOGI(format, ...) fprintf(stderr, AV_TAG ": " format "\n", ##__VA_ARGS__) 23 | #endif 24 | 25 | #endif //FFMPEGCMD_ANDROID_LOG_H 26 | -------------------------------------------------------------------------------- /app/src/main/cpp/cmdutils_common_opts.h: -------------------------------------------------------------------------------- 1 | { "L" , OPT_EXIT, {.func_arg = show_license}, "show license" }, 2 | { "h" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" }, 3 | { "?" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" }, 4 | { "help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" }, 5 | { "-help" , OPT_EXIT, {.func_arg = show_help}, "show help", "topic" }, 6 | { "version" , OPT_EXIT, {.func_arg = show_version}, "show version" }, 7 | { "buildconf" , OPT_EXIT, {.func_arg = show_buildconf}, "show build configuration" }, 8 | { "formats" , OPT_EXIT, {.func_arg = show_formats }, "show available formats" }, 9 | { "muxers" , OPT_EXIT, {.func_arg = show_muxers }, "show available muxers" }, 10 | { "demuxers" , OPT_EXIT, {.func_arg = show_demuxers }, "show available demuxers" }, 11 | { "devices" , OPT_EXIT, {.func_arg = show_devices }, "show available devices" }, 12 | { "codecs" , OPT_EXIT, {.func_arg = show_codecs }, "show available codecs" }, 13 | { "decoders" , OPT_EXIT, {.func_arg = show_decoders }, "show available decoders" }, 14 | { "encoders" , OPT_EXIT, {.func_arg = show_encoders }, "show available encoders" }, 15 | { "bsfs" , OPT_EXIT, {.func_arg = show_bsfs }, "show available bit stream filters" }, 16 | { "protocols" , OPT_EXIT, {.func_arg = show_protocols}, "show available protocols" }, 17 | { "filters" , OPT_EXIT, {.func_arg = show_filters }, "show available filters" }, 18 | { "pix_fmts" , OPT_EXIT, {.func_arg = show_pix_fmts }, "show available pixel formats" }, 19 | { "layouts" , OPT_EXIT, {.func_arg = show_layouts }, "show standard channel layouts" }, 20 | { "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" }, 21 | { "colors" , OPT_EXIT, {.func_arg = show_colors }, "show available color names" }, 22 | { "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" }, 23 | { "v", HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" }, 24 | { "report" , 0, {(void*)opt_report}, "generate a report" }, 25 | { "max_alloc" , HAS_ARG, {.func_arg = opt_max_alloc}, "set maximum size of a single allocated block", "bytes" }, 26 | { "cpuflags" , HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, 27 | { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, 28 | #if CONFIG_OPENCL 29 | { "opencl_bench", OPT_EXIT, {.func_arg = opt_opencl_bench}, "run benchmark on all OpenCL devices and show results" }, 30 | { "opencl_options", HAS_ARG, {.func_arg = opt_opencl}, "set OpenCL environment options" }, 31 | #endif 32 | #if CONFIG_AVDEVICE 33 | { "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, 34 | "list sources of the input device", "device" }, 35 | { "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, 36 | "list sinks of the output device", "device" }, 37 | #endif 38 | -------------------------------------------------------------------------------- /app/src/main/cpp/ffmpeg-api.c: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wyh on 2019/4/3. 3 | #include "ffmpeg-api.h" 4 | #include 5 | #include "android_log.h" 6 | 7 | #include "ffmpeg.h" 8 | #include "j4a_base.h" 9 | 10 | AVFormatContext *ic; 11 | int video_stream_idx; 12 | 13 | JNIEXPORT jint JNICALL 14 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_open(JNIEnv *env, jclass type, jstring url_) { 15 | const char *videoUrl = NULL; 16 | videoUrl = (*env)->GetStringUTFChars(env, url_, NULL); 17 | LOGE("FFmpegApi_open_video url : %s", videoUrl); 18 | ic = avformat_alloc_context(); 19 | if (avformat_open_input(&ic, videoUrl, NULL, NULL) < 0) { 20 | LOGE("could not open source %s", videoUrl); 21 | return -1; 22 | } 23 | if (avformat_find_stream_info(ic, NULL) < 0) { 24 | LOGE("could not find stream information"); 25 | return -1; 26 | } 27 | video_stream_idx = av_find_best_stream(ic, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0); 28 | return 0; 29 | } 30 | 31 | JNIEXPORT jdouble JNICALL 32 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_getVideoRotation(JNIEnv *env, jclass type) { 33 | if (video_stream_idx >= 0) { 34 | AVStream *video_stream = ic->streams[video_stream_idx]; 35 | return get_rotation(video_stream); 36 | } else { 37 | return 0; 38 | } 39 | } 40 | 41 | JNIEXPORT jlong JNICALL 42 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_getDuration(JNIEnv *env, jclass type) { 43 | return av_rescale(ic->duration, 1000, AV_TIME_BASE); 44 | } 45 | 46 | JNIEXPORT jint JNICALL 47 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_getVideoWidth(JNIEnv *env, jclass type) { 48 | if (video_stream_idx >= 0) { 49 | AVStream *video_stream = ic->streams[video_stream_idx]; 50 | return video_stream->codecpar->width; 51 | } else { 52 | return 0; 53 | } 54 | } 55 | 56 | JNIEXPORT jint JNICALL 57 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_getVideoHeight(JNIEnv *env, jclass type) { 58 | if (video_stream_idx >= 0) { 59 | AVStream *video_stream = ic->streams[video_stream_idx]; 60 | return video_stream->codecpar->height; 61 | } else { 62 | return 0; 63 | } 64 | } 65 | 66 | JNIEXPORT jstring JNICALL 67 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_getVideoCodecName(JNIEnv *env, jclass type) { 68 | if (video_stream_idx >= 0) { 69 | AVStream *video_stream = ic->streams[video_stream_idx]; 70 | const char *codec_name = avcodec_get_name(video_stream->codecpar->codec_id); 71 | return (*env)->NewStringUTF(env, codec_name); 72 | } else { 73 | return NULL; 74 | } 75 | } 76 | 77 | JNIEXPORT void JNICALL 78 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_close(JNIEnv *env, jclass type) { 79 | avformat_close_input(&ic); 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/cpp/ffmpeg-api.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by meitu on 2019/5/12. 3 | // 4 | 5 | #ifndef FFMPEGCMD_FFMPEG_API_H 6 | #define FFMPEGCMD_FFMPEG_API_H 7 | 8 | #include 9 | #include 10 | #include "cmdutils.h" 11 | 12 | JNIEXPORT jint JNICALL 13 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_open(JNIEnv *env, jclass type, jstring url_); 14 | 15 | JNIEXPORT jdouble JNICALL 16 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_getVideoRotation(JNIEnv *env, jclass type); 17 | 18 | JNIEXPORT jlong JNICALL 19 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_getDuration(JNIEnv *env, jclass type); 20 | 21 | JNIEXPORT jint JNICALL 22 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_getVideoWidth(JNIEnv *env, jclass type); 23 | 24 | JNIEXPORT jint JNICALL 25 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_getVideoHeight(JNIEnv *env, jclass type); 26 | 27 | JNIEXPORT jstring JNICALL 28 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_getVideoCodecName(JNIEnv *env, jclass type); 29 | 30 | JNIEXPORT void JNICALL 31 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegApi_close(JNIEnv *env, jclass type); 32 | 33 | #endif //FFMPEGCMD_FFMPEG_API_H 34 | -------------------------------------------------------------------------------- /app/src/main/cpp/ffmpeg-jni.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "android_log.h" 4 | 5 | #include "ffmpeg.h" 6 | #include "j4a_base.h" 7 | 8 | static const char *m_avlog = NULL; 9 | 10 | jstring stoJstring(JNIEnv *env, const char *pat) { 11 | jclass strClass = env->FindClass("java/lang/String"); 12 | jmethodID ctorID = env->GetMethodID(strClass, "", "([BLjava/lang/String;)V"); 13 | jbyteArray bytes = env->NewByteArray(strlen(pat)); 14 | env->SetByteArrayRegion(bytes, 0, strlen(pat), (jbyte *) pat); 15 | jstring encoding = env->NewStringUTF("utf-8"); 16 | auto finalJstring = (jstring) env->NewObject(strClass, ctorID, bytes, encoding); 17 | env->DeleteLocalRef(strClass); 18 | env->DeleteLocalRef(bytes); 19 | env->DeleteLocalRef(encoding); 20 | return finalJstring; 21 | } 22 | 23 | extern "C" 24 | JNIEXPORT jint JNICALL 25 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegJni_execute(JNIEnv *env, jclass type, jobjectArray commands) { 26 | int argc = env->GetArrayLength(commands); 27 | char *argv[argc]; 28 | int i; 29 | for (i = 0; i < argc; i++) { 30 | auto js = (jstring) env->GetObjectArrayElement(commands, i); 31 | argv[i] = (char *) env->GetStringUTFChars(js, 0); 32 | } 33 | LOGD("----------begin---------"); 34 | return main(argc, argv); 35 | } 36 | 37 | extern "C" 38 | void callJavaMethod(const char *log) { 39 | m_avlog = log; 40 | } 41 | 42 | extern "C" 43 | JNIEXPORT jstring JNICALL 44 | Java_com_wyh_ffmpegcmd_ffmpeg_FFmpegJni_getLog(JNIEnv *env, jclass type) { 45 | if (m_avlog != NULL && m_avlog != nullptr) { 46 | return stoJstring(env, m_avlog); 47 | // return env->NewStringUTF(m_avlog); 48 | } else { 49 | return NULL; 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/cpp/ffmpeg-jni.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by meitu on 2019/4/2. 3 | // 4 | 5 | #ifndef FFMPEGCMD_FFMPEG_JNI_H 6 | #define FFMPEGCMD_FFMPEG_JNI_H 7 | 8 | void callJavaMethod(char *log); 9 | 10 | #endif //FFMPEGCMD_FFMPEG_JNI_H 11 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavcodec/avdct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_AVDCT_H 20 | #define AVCODEC_AVDCT_H 21 | 22 | #include "libavutil/opt.h" 23 | 24 | /** 25 | * AVDCT context. 26 | * @note function pointers can be NULL if the specific features have been 27 | * disabled at build time. 28 | */ 29 | typedef struct AVDCT { 30 | const AVClass *av_class; 31 | 32 | void (*idct)(int16_t *block /* align 16 */); 33 | 34 | /** 35 | * IDCT input permutation. 36 | * Several optimized IDCTs need a permutated input (relative to the 37 | * normal order of the reference IDCT). 38 | * This permutation must be performed before the idct_put/add. 39 | * Note, normally this can be merged with the zigzag/alternate scan
40 | * An example to avoid confusion: 41 | * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) 42 | * - (x -> reference DCT -> reference IDCT -> x) 43 | * - (x -> reference DCT -> simple_mmx_perm = idct_permutation 44 | * -> simple_idct_mmx -> x) 45 | * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant 46 | * -> simple_idct_mmx -> ...) 47 | */ 48 | uint8_t idct_permutation[64]; 49 | 50 | void (*fdct)(int16_t *block /* align 16 */); 51 | 52 | 53 | /** 54 | * DCT algorithm. 55 | * must use AVOptions to set this field. 56 | */ 57 | int dct_algo; 58 | 59 | /** 60 | * IDCT algorithm. 61 | * must use AVOptions to set this field. 62 | */ 63 | int idct_algo; 64 | 65 | void (*get_pixels)(int16_t *block /* align 16 */, 66 | const uint8_t *pixels /* align 8 */, 67 | ptrdiff_t line_size); 68 | 69 | int bits_per_sample; 70 | } AVDCT; 71 | 72 | /** 73 | * Allocates a AVDCT context. 74 | * This needs to be initialized with avcodec_dct_init() after optionally 75 | * configuring it with AVOptions. 76 | * 77 | * To free it use av_free() 78 | */ 79 | AVDCT *avcodec_dct_alloc(void); 80 | int avcodec_dct_init(AVDCT *); 81 | 82 | const AVClass *avcodec_dct_get_class(void); 83 | 84 | #endif /* AVCODEC_AVDCT_H */ 85 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavcodec/d3d11va.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Direct3D11 HW acceleration 3 | * 4 | * copyright (c) 2009 Laurent Aimar 5 | * copyright (c) 2015 Steve Lhomme 6 | * 7 | * This file is part of FFmpeg. 8 | * 9 | * FFmpeg is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * FFmpeg is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with FFmpeg; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | #ifndef AVCODEC_D3D11VA_H 25 | #define AVCODEC_D3D11VA_H 26 | 27 | /** 28 | * @file 29 | * @ingroup lavc_codec_hwaccel_d3d11va 30 | * Public libavcodec D3D11VA header. 31 | */ 32 | 33 | #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 34 | #undef _WIN32_WINNT 35 | #define _WIN32_WINNT 0x0602 36 | #endif 37 | 38 | #include 39 | #include 40 | 41 | /** 42 | * @defgroup lavc_codec_hwaccel_d3d11va Direct3D11 43 | * @ingroup lavc_codec_hwaccel 44 | * 45 | * @{ 46 | */ 47 | 48 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards 49 | #define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface 50 | 51 | /** 52 | * This structure is used to provides the necessary configurations and data 53 | * to the Direct3D11 FFmpeg HWAccel implementation. 54 | * 55 | * The application must make it available as AVCodecContext.hwaccel_context. 56 | * 57 | * Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext. 58 | */ 59 | typedef struct AVD3D11VAContext { 60 | /** 61 | * D3D11 decoder object 62 | */ 63 | ID3D11VideoDecoder *decoder; 64 | 65 | /** 66 | * D3D11 VideoContext 67 | */ 68 | ID3D11VideoContext *video_context; 69 | 70 | /** 71 | * D3D11 configuration used to create the decoder 72 | */ 73 | D3D11_VIDEO_DECODER_CONFIG *cfg; 74 | 75 | /** 76 | * The number of surface in the surface array 77 | */ 78 | unsigned surface_count; 79 | 80 | /** 81 | * The array of Direct3D surfaces used to create the decoder 82 | */ 83 | ID3D11VideoDecoderOutputView **surface; 84 | 85 | /** 86 | * A bit field configuring the workarounds needed for using the decoder 87 | */ 88 | uint64_t workaround; 89 | 90 | /** 91 | * Private to the FFmpeg AVHWAccel implementation 92 | */ 93 | unsigned report_id; 94 | 95 | /** 96 | * Mutex to access video_context 97 | */ 98 | HANDLE context_mutex; 99 | } AVD3D11VAContext; 100 | 101 | /** 102 | * Allocate an AVD3D11VAContext. 103 | * 104 | * @return Newly-allocated AVD3D11VAContext or NULL on failure. 105 | */ 106 | AVD3D11VAContext *av_d3d11va_alloc_context(void); 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | #endif /* AVCODEC_D3D11VA_H */ 113 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavcodec/dxva2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DXVA2 HW acceleration 3 | * 4 | * copyright (c) 2009 Laurent Aimar 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_DXVA2_H 24 | #define AVCODEC_DXVA2_H 25 | 26 | /** 27 | * @file 28 | * @ingroup lavc_codec_hwaccel_dxva2 29 | * Public libavcodec DXVA2 header. 30 | */ 31 | 32 | #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 33 | #undef _WIN32_WINNT 34 | #define _WIN32_WINNT 0x0602 35 | #endif 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | /** 42 | * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 43 | * @ingroup lavc_codec_hwaccel 44 | * 45 | * @{ 46 | */ 47 | 48 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards 49 | #define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface 50 | 51 | /** 52 | * This structure is used to provides the necessary configurations and data 53 | * to the DXVA2 FFmpeg HWAccel implementation. 54 | * 55 | * The application must make it available as AVCodecContext.hwaccel_context. 56 | */ 57 | struct dxva_context { 58 | /** 59 | * DXVA2 decoder object 60 | */ 61 | IDirectXVideoDecoder *decoder; 62 | 63 | /** 64 | * DXVA2 configuration used to create the decoder 65 | */ 66 | const DXVA2_ConfigPictureDecode *cfg; 67 | 68 | /** 69 | * The number of surface in the surface array 70 | */ 71 | unsigned surface_count; 72 | 73 | /** 74 | * The array of Direct3D surfaces used to create the decoder 75 | */ 76 | LPDIRECT3DSURFACE9 *surface; 77 | 78 | /** 79 | * A bit field configuring the workarounds needed for using the decoder 80 | */ 81 | uint64_t workaround; 82 | 83 | /** 84 | * Private to the FFmpeg AVHWAccel implementation 85 | */ 86 | unsigned report_id; 87 | }; 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | #endif /* AVCODEC_DXVA2_H */ 94 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavcodec/jni.h: -------------------------------------------------------------------------------- 1 | /* 2 | * JNI public API functions 3 | * 4 | * Copyright (c) 2015-2016 Matthieu Bouron 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_JNI_H 24 | #define AVCODEC_JNI_H 25 | 26 | /* 27 | * Manually set a Java virtual machine which will be used to retrieve the JNI 28 | * environment. Once a Java VM is set it cannot be changed afterwards, meaning 29 | * you can call multiple times av_jni_set_java_vm with the same Java VM pointer 30 | * however it will error out if you try to set a different Java VM. 31 | * 32 | * @param vm Java virtual machine 33 | * @param log_ctx context used for logging, can be NULL 34 | * @return 0 on success, < 0 otherwise 35 | */ 36 | int av_jni_set_java_vm(void *vm, void *log_ctx); 37 | 38 | /* 39 | * Get the Java virtual machine which has been set with av_jni_set_java_vm. 40 | * 41 | * @param vm Java virtual machine 42 | * @return a pointer to the Java virtual machine 43 | */ 44 | void *av_jni_get_java_vm(void *log_ctx); 45 | 46 | #endif /* AVCODEC_JNI_H */ 47 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavcodec/mediacodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Android MediaCodec public API 3 | * 4 | * Copyright (c) 2016 Matthieu Bouron 5 | * 6 | * This file is part of FFmpeg. 7 | * 8 | * FFmpeg is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * FFmpeg is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with FFmpeg; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_MEDIACODEC_H 24 | #define AVCODEC_MEDIACODEC_H 25 | 26 | #include "libavcodec/avcodec.h" 27 | 28 | /** 29 | * This structure holds a reference to a android/view/Surface object that will 30 | * be used as output by the decoder. 31 | * 32 | */ 33 | typedef struct AVMediaCodecContext { 34 | 35 | /** 36 | * android/view/Surface object reference. 37 | */ 38 | void *surface; 39 | 40 | } AVMediaCodecContext; 41 | 42 | /** 43 | * Allocate and initialize a MediaCodec context. 44 | * 45 | * When decoding with MediaCodec is finished, the caller must free the 46 | * MediaCodec context with av_mediacodec_default_free. 47 | * 48 | * @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise 49 | */ 50 | AVMediaCodecContext *av_mediacodec_alloc_context(void); 51 | 52 | /** 53 | * Convenience function that sets up the MediaCodec context. 54 | * 55 | * @param avctx codec context 56 | * @param ctx MediaCodec context to initialize 57 | * @param surface reference to an android/view/Surface 58 | * @return 0 on success, < 0 otherwise 59 | */ 60 | int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface); 61 | 62 | /** 63 | * This function must be called to free the MediaCodec context initialized with 64 | * av_mediacodec_default_init(). 65 | * 66 | * @param avctx codec context 67 | */ 68 | void av_mediacodec_default_free(AVCodecContext *avctx); 69 | 70 | /** 71 | * Opaque structure representing a MediaCodec buffer to render. 72 | */ 73 | typedef struct MediaCodecBuffer AVMediaCodecBuffer; 74 | 75 | /** 76 | * Release a MediaCodec buffer and render it to the surface that is associated 77 | * with the decoder. This function should only be called once on a given 78 | * buffer, once released the underlying buffer returns to the codec, thus 79 | * subsequent calls to this function will have no effect. 80 | * 81 | * @param buffer the buffer to render 82 | * @param render 1 to release and render the buffer to the surface or 0 to 83 | * discard the buffer 84 | * @return 0 on success, < 0 otherwise 85 | */ 86 | int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render); 87 | 88 | #endif /* AVCODEC_MEDIACODEC_H */ 89 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavcodec/vorbis_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * A public API for Vorbis parsing 22 | * 23 | * Determines the duration for each packet. 24 | */ 25 | 26 | #ifndef AVCODEC_VORBIS_PARSER_H 27 | #define AVCODEC_VORBIS_PARSER_H 28 | 29 | #include 30 | 31 | typedef struct AVVorbisParseContext AVVorbisParseContext; 32 | 33 | /** 34 | * Allocate and initialize the Vorbis parser using headers in the extradata. 35 | * 36 | * @param avctx codec context 37 | * @param s Vorbis parser context 38 | */ 39 | AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, 40 | int extradata_size); 41 | 42 | /** 43 | * Free the parser and everything associated with it. 44 | */ 45 | void av_vorbis_parse_free(AVVorbisParseContext **s); 46 | 47 | #define VORBIS_FLAG_HEADER 0x00000001 48 | #define VORBIS_FLAG_COMMENT 0x00000002 49 | #define VORBIS_FLAG_SETUP 0x00000004 50 | 51 | /** 52 | * Get the duration for a Vorbis packet. 53 | * 54 | * If @p flags is @c NULL, 55 | * special frames are considered invalid. 56 | * 57 | * @param s Vorbis parser context 58 | * @param buf buffer containing a Vorbis frame 59 | * @param buf_size size of the buffer 60 | * @param flags flags for special frames 61 | */ 62 | int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, 63 | int buf_size, int *flags); 64 | 65 | /** 66 | * Get the duration for a Vorbis packet. 67 | * 68 | * @param s Vorbis parser context 69 | * @param buf buffer containing a Vorbis frame 70 | * @param buf_size size of the buffer 71 | */ 72 | int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, 73 | int buf_size); 74 | 75 | void av_vorbis_parse_reset(AVVorbisParseContext *s); 76 | 77 | #endif /* AVCODEC_VORBIS_PARSER_H */ 78 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavdevice/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVDEVICE_VERSION_H 20 | #define AVDEVICE_VERSION_H 21 | 22 | /** 23 | * @file 24 | * @ingroup lavd 25 | * Libavdevice version macros 26 | */ 27 | 28 | #include "libavutil/version.h" 29 | 30 | #define LIBAVDEVICE_VERSION_MAJOR 57 31 | #define LIBAVDEVICE_VERSION_MINOR 6 32 | #define LIBAVDEVICE_VERSION_MICRO 100 33 | 34 | #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ 35 | LIBAVDEVICE_VERSION_MINOR, \ 36 | LIBAVDEVICE_VERSION_MICRO) 37 | #define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \ 38 | LIBAVDEVICE_VERSION_MINOR, \ 39 | LIBAVDEVICE_VERSION_MICRO) 40 | #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT 41 | 42 | #define LIBAVDEVICE_IDENT "Lavd" AV_STRINGIFY(LIBAVDEVICE_VERSION) 43 | 44 | /** 45 | * FF_API_* defines may be placed below to indicate public API that will be 46 | * dropped at a future version bump. The defines themselves are not part of 47 | * the public API and may change, break or disappear at any time. 48 | */ 49 | 50 | #endif /* AVDEVICE_VERSION_H */ 51 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavfilter/avfiltergraph.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Filter graphs 3 | * copyright (c) 2007 Bobby Bingham 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVFILTER_AVFILTERGRAPH_H 23 | #define AVFILTER_AVFILTERGRAPH_H 24 | 25 | #include "avfilter.h" 26 | #include "libavutil/log.h" 27 | 28 | #endif /* AVFILTER_AVFILTERGRAPH_H */ 29 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavfilter/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVFILTER_VERSION_H 22 | #define AVFILTER_VERSION_H 23 | 24 | /** 25 | * @file 26 | * @ingroup lavfi 27 | * Libavfilter version macros 28 | */ 29 | 30 | #include "libavutil/version.h" 31 | 32 | #define LIBAVFILTER_VERSION_MAJOR 6 33 | #define LIBAVFILTER_VERSION_MINOR 82 34 | #define LIBAVFILTER_VERSION_MICRO 100 35 | 36 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ 37 | LIBAVFILTER_VERSION_MINOR, \ 38 | LIBAVFILTER_VERSION_MICRO) 39 | #define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \ 40 | LIBAVFILTER_VERSION_MINOR, \ 41 | LIBAVFILTER_VERSION_MICRO) 42 | #define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT 43 | 44 | #define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION) 45 | 46 | /** 47 | * FF_API_* defines may be placed below to indicate public API that will be 48 | * dropped at a future version bump. The defines themselves are not part of 49 | * the public API and may change, break or disappear at any time. 50 | */ 51 | 52 | #ifndef FF_API_OLD_FILTER_OPTS 53 | #define FF_API_OLD_FILTER_OPTS (LIBAVFILTER_VERSION_MAJOR < 7) 54 | #endif 55 | #ifndef FF_API_OLD_FILTER_OPTS_ERROR 56 | #define FF_API_OLD_FILTER_OPTS_ERROR (LIBAVFILTER_VERSION_MAJOR < 7) 57 | #endif 58 | #ifndef FF_API_AVFILTER_OPEN 59 | #define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 7) 60 | #endif 61 | #ifndef FF_API_AVFILTER_INIT_FILTER 62 | #define FF_API_AVFILTER_INIT_FILTER (LIBAVFILTER_VERSION_MAJOR < 7) 63 | #endif 64 | #ifndef FF_API_OLD_FILTER_REGISTER 65 | #define FF_API_OLD_FILTER_REGISTER (LIBAVFILTER_VERSION_MAJOR < 7) 66 | #endif 67 | #ifndef FF_API_NOCONST_GET_NAME 68 | #define FF_API_NOCONST_GET_NAME (LIBAVFILTER_VERSION_MAJOR < 7) 69 | #endif 70 | #ifndef FF_API_LAVR_OPTS 71 | #define FF_API_LAVR_OPTS (LIBAVFILTER_VERSION_MAJOR < 7) 72 | #endif 73 | 74 | #endif /* AVFILTER_VERSION_H */ 75 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/adler32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_adler32 24 | * Public header for Adler-32 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_ADLER32_H 28 | #define AVUTIL_ADLER32_H 29 | 30 | #include 31 | #include "attributes.h" 32 | 33 | /** 34 | * @defgroup lavu_adler32 Adler-32 35 | * @ingroup lavu_hash 36 | * Adler-32 hash function implementation. 37 | * 38 | * @{ 39 | */ 40 | 41 | /** 42 | * Calculate the Adler32 checksum of a buffer. 43 | * 44 | * Passing the return value to a subsequent av_adler32_update() call 45 | * allows the checksum of multiple buffers to be calculated as though 46 | * they were concatenated. 47 | * 48 | * @param adler initial checksum value 49 | * @param buf pointer to input buffer 50 | * @param len size of input buffer 51 | * @return updated checksum 52 | */ 53 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, 54 | unsigned int len) av_pure; 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | #endif /* AVUTIL_ADLER32_H */ 61 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_AES_H 22 | #define AVUTIL_AES_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_aes AES 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_aes_size; 36 | 37 | struct AVAES; 38 | 39 | /** 40 | * Allocate an AVAES context. 41 | */ 42 | struct AVAES *av_aes_alloc(void); 43 | 44 | /** 45 | * Initialize an AVAES context. 46 | * @param key_bits 128, 192 or 256 47 | * @param decrypt 0 for encryption, 1 for decryption 48 | */ 49 | int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); 50 | 51 | /** 52 | * Encrypt or decrypt a buffer using a previously initialized context. 53 | * @param count number of 16 byte blocks 54 | * @param dst destination array, can be equal to src 55 | * @param src source array, can be equal to dst 56 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 57 | * @param decrypt 0 for encryption, 1 for decryption 58 | */ 59 | void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | #endif /* AVUTIL_AES_H */ 66 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/aes_ctr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AES-CTR cipher 3 | * Copyright (c) 2015 Eran Kornblau 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_AES_CTR_H 23 | #define AVUTIL_AES_CTR_H 24 | 25 | #include 26 | 27 | #include "attributes.h" 28 | #include "version.h" 29 | 30 | #define AES_CTR_KEY_SIZE (16) 31 | #define AES_CTR_IV_SIZE (8) 32 | 33 | struct AVAESCTR; 34 | 35 | /** 36 | * Allocate an AVAESCTR context. 37 | */ 38 | struct AVAESCTR *av_aes_ctr_alloc(void); 39 | 40 | /** 41 | * Initialize an AVAESCTR context. 42 | * @param key encryption key, must have a length of AES_CTR_KEY_SIZE 43 | */ 44 | int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key); 45 | 46 | /** 47 | * Release an AVAESCTR context. 48 | */ 49 | void av_aes_ctr_free(struct AVAESCTR *a); 50 | 51 | /** 52 | * Process a buffer using a previously initialized context. 53 | * @param dst destination array, can be equal to src 54 | * @param src source array, can be equal to dst 55 | * @param size the size of src and dst 56 | */ 57 | void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int size); 58 | 59 | /** 60 | * Get the current iv 61 | */ 62 | const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a); 63 | 64 | /** 65 | * Generate a random iv 66 | */ 67 | void av_aes_ctr_set_random_iv(struct AVAESCTR *a); 68 | 69 | /** 70 | * Forcefully change the iv 71 | */ 72 | void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv); 73 | 74 | /** 75 | * Increment the top 64 bit of the iv (performed after each frame) 76 | */ 77 | void av_aes_ctr_increment_iv(struct AVAESCTR *a); 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | #endif /* AVUTIL_AES_CTR_H */ 84 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/avassert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2010 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * simple assert() macros that are a bit more flexible than ISO C assert(). 24 | * @author Michael Niedermayer 25 | */ 26 | 27 | #ifndef AVUTIL_AVASSERT_H 28 | #define AVUTIL_AVASSERT_H 29 | 30 | #include 31 | #include "avutil.h" 32 | #include "log.h" 33 | 34 | /** 35 | * assert() equivalent, that is always enabled. 36 | */ 37 | #define av_assert0(cond) do { \ 38 | if (!(cond)) { \ 39 | av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \ 40 | AV_STRINGIFY(cond), __FILE__, __LINE__); \ 41 | abort(); \ 42 | } \ 43 | } while (0) 44 | 45 | 46 | /** 47 | * assert() equivalent, that does not lie in speed critical code. 48 | * These asserts() thus can be enabled without fearing speed loss. 49 | */ 50 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 51 | #define av_assert1(cond) av_assert0(cond) 52 | #else 53 | #define av_assert1(cond) ((void)0) 54 | #endif 55 | 56 | 57 | /** 58 | * assert() equivalent, that does lie in speed critical code. 59 | */ 60 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 61 | #define av_assert2(cond) av_assert0(cond) 62 | #define av_assert2_fpu() av_assert0_fpu() 63 | #else 64 | #define av_assert2(cond) ((void)0) 65 | #define av_assert2_fpu() ((void)0) 66 | #endif 67 | 68 | /** 69 | * Assert that floating point opperations can be executed. 70 | * 71 | * This will av_assert0() that the cpu is not in MMX state on X86 72 | */ 73 | void av_assert0_fpu(void); 74 | 75 | #endif /* AVUTIL_AVASSERT_H */ 76 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/avconfig.h: -------------------------------------------------------------------------------- 1 | /* Generated by ffconf */ 2 | #ifndef AVUTIL_AVCONFIG_H 3 | #define AVUTIL_AVCONFIG_H 4 | #define AV_HAVE_BIGENDIAN 0 5 | #define AV_HAVE_FAST_UNALIGNED 0 6 | #endif /* AVUTIL_AVCONFIG_H */ 7 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BASE64_H 22 | #define AVUTIL_BASE64_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_base64 Base64 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | /** 33 | * Decode a base64-encoded string. 34 | * 35 | * @param out buffer for decoded data 36 | * @param in null-terminated input string 37 | * @param out_size size in bytes of the out buffer, must be at 38 | * least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in)) 39 | * @return number of bytes written, or a negative value in case of 40 | * invalid input 41 | */ 42 | int av_base64_decode(uint8_t *out, const char *in, int out_size); 43 | 44 | /** 45 | * Calculate the output size in bytes needed to decode a base64 string 46 | * with length x to a data buffer. 47 | */ 48 | #define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4) 49 | 50 | /** 51 | * Encode data to base64 and null-terminate. 52 | * 53 | * @param out buffer for encoded data 54 | * @param out_size size in bytes of the out buffer (including the 55 | * null terminator), must be at least AV_BASE64_SIZE(in_size) 56 | * @param in input buffer containing the data to encode 57 | * @param in_size size in bytes of the in buffer 58 | * @return out or NULL in case of error 59 | */ 60 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); 61 | 62 | /** 63 | * Calculate the output size needed to base64-encode x bytes to a 64 | * null-terminated string. 65 | */ 66 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | #endif /* AVUTIL_BASE64_H */ 73 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/blowfish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Blowfish algorithm 3 | * Copyright (c) 2012 Samuel Pitoiset 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_BLOWFISH_H 23 | #define AVUTIL_BLOWFISH_H 24 | 25 | #include 26 | 27 | /** 28 | * @defgroup lavu_blowfish Blowfish 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | #define AV_BF_ROUNDS 16 34 | 35 | typedef struct AVBlowfish { 36 | uint32_t p[AV_BF_ROUNDS + 2]; 37 | uint32_t s[4][256]; 38 | } AVBlowfish; 39 | 40 | /** 41 | * Allocate an AVBlowfish context. 42 | */ 43 | AVBlowfish *av_blowfish_alloc(void); 44 | 45 | /** 46 | * Initialize an AVBlowfish context. 47 | * 48 | * @param ctx an AVBlowfish context 49 | * @param key a key 50 | * @param key_len length of the key 51 | */ 52 | void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); 53 | 54 | /** 55 | * Encrypt or decrypt a buffer using a previously initialized context. 56 | * 57 | * @param ctx an AVBlowfish context 58 | * @param xl left four bytes halves of input to be encrypted 59 | * @param xr right four bytes halves of input to be encrypted 60 | * @param decrypt 0 for encryption, 1 for decryption 61 | */ 62 | void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, 63 | int decrypt); 64 | 65 | /** 66 | * Encrypt or decrypt a buffer using a previously initialized context. 67 | * 68 | * @param ctx an AVBlowfish context 69 | * @param dst destination array, can be equal to src 70 | * @param src source array, can be equal to dst 71 | * @param count number of 8 byte blocks 72 | * @param iv initialization vector for CBC mode, if NULL ECB will be used 73 | * @param decrypt 0 for encryption, 1 for decryption 74 | */ 75 | void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, 76 | int count, uint8_t *iv, int decrypt); 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | #endif /* AVUTIL_BLOWFISH_H */ 83 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/bswap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * byte swapping routines 24 | */ 25 | 26 | #ifndef AVUTIL_BSWAP_H 27 | #define AVUTIL_BSWAP_H 28 | 29 | #include 30 | #include "libavutil/avconfig.h" 31 | #include "attributes.h" 32 | 33 | #ifdef HAVE_AV_CONFIG_H 34 | 35 | #include "config.h" 36 | 37 | #if ARCH_AARCH64 38 | # include "aarch64/bswap.h" 39 | #elif ARCH_ARM 40 | # include "arm/bswap.h" 41 | #elif ARCH_AVR32 42 | # include "avr32/bswap.h" 43 | #elif ARCH_SH4 44 | # include "sh4/bswap.h" 45 | #elif ARCH_X86 46 | # include "x86/bswap.h" 47 | #endif 48 | 49 | #endif /* HAVE_AV_CONFIG_H */ 50 | 51 | #define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) 52 | #define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) 53 | #define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) 54 | 55 | #define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) 56 | 57 | #ifndef av_bswap16 58 | static av_always_inline av_const uint16_t av_bswap16(uint16_t x) 59 | { 60 | x= (x>>8) | (x<<8); 61 | return x; 62 | } 63 | #endif 64 | 65 | #ifndef av_bswap32 66 | static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 67 | { 68 | return AV_BSWAP32C(x); 69 | } 70 | #endif 71 | 72 | #ifndef av_bswap64 73 | static inline uint64_t av_const av_bswap64(uint64_t x) 74 | { 75 | return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); 76 | } 77 | #endif 78 | 79 | // be2ne ... big-endian to native-endian 80 | // le2ne ... little-endian to native-endian 81 | 82 | #if AV_HAVE_BIGENDIAN 83 | #define av_be2ne16(x) (x) 84 | #define av_be2ne32(x) (x) 85 | #define av_be2ne64(x) (x) 86 | #define av_le2ne16(x) av_bswap16(x) 87 | #define av_le2ne32(x) av_bswap32(x) 88 | #define av_le2ne64(x) av_bswap64(x) 89 | #define AV_BE2NEC(s, x) (x) 90 | #define AV_LE2NEC(s, x) AV_BSWAPC(s, x) 91 | #else 92 | #define av_be2ne16(x) av_bswap16(x) 93 | #define av_be2ne32(x) av_bswap32(x) 94 | #define av_be2ne64(x) av_bswap64(x) 95 | #define av_le2ne16(x) (x) 96 | #define av_le2ne32(x) (x) 97 | #define av_le2ne64(x) (x) 98 | #define AV_BE2NEC(s, x) AV_BSWAPC(s, x) 99 | #define AV_LE2NEC(s, x) (x) 100 | #endif 101 | 102 | #define AV_BE2NE16C(x) AV_BE2NEC(16, x) 103 | #define AV_BE2NE32C(x) AV_BE2NEC(32, x) 104 | #define AV_BE2NE64C(x) AV_BE2NEC(64, x) 105 | #define AV_LE2NE16C(x) AV_LE2NEC(16, x) 106 | #define AV_LE2NE32C(x) AV_LE2NEC(32, x) 107 | #define AV_LE2NE64C(x) AV_LE2NEC(64, x) 108 | 109 | #endif /* AVUTIL_BSWAP_H */ 110 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/camellia.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the CAMELLIA algorithm as mentioned in RFC3713 3 | * Copyright (c) 2014 Supraja Meedinti 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_CAMELLIA_H 23 | #define AVUTIL_CAMELLIA_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil CAMELLIA algorithm 31 | * @defgroup lavu_camellia CAMELLIA 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_camellia_size; 37 | 38 | struct AVCAMELLIA; 39 | 40 | /** 41 | * Allocate an AVCAMELLIA context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVCAMELLIA *av_camellia_alloc(void); 45 | 46 | /** 47 | * Initialize an AVCAMELLIA context. 48 | * 49 | * @param ctx an AVCAMELLIA context 50 | * @param key a key of 16, 24, 32 bytes used for encryption/decryption 51 | * @param key_bits number of keybits: possible are 128, 192, 256 52 | */ 53 | int av_camellia_init(struct AVCAMELLIA *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context 57 | * 58 | * @param ctx an AVCAMELLIA context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 16 byte blocks 62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode 63 | * @param decrypt 0 for encryption, 1 for decryption 64 | */ 65 | void av_camellia_crypt(struct AVCAMELLIA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | #endif /* AVUTIL_CAMELLIA_H */ 71 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/cast5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the CAST128 algorithm as mentioned in RFC2144 3 | * Copyright (c) 2014 Supraja Meedinti 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_CAST5_H 23 | #define AVUTIL_CAST5_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil CAST5 algorithm 31 | * @defgroup lavu_cast5 CAST5 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_cast5_size; 37 | 38 | struct AVCAST5; 39 | 40 | /** 41 | * Allocate an AVCAST5 context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVCAST5 *av_cast5_alloc(void); 45 | /** 46 | * Initialize an AVCAST5 context. 47 | * 48 | * @param ctx an AVCAST5 context 49 | * @param key a key of 5,6,...16 bytes used for encryption/decryption 50 | * @param key_bits number of keybits: possible are 40,48,...,128 51 | * @return 0 on success, less than 0 on failure 52 | */ 53 | int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context, ECB mode only 57 | * 58 | * @param ctx an AVCAST5 context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 8 byte blocks 62 | * @param decrypt 0 for encryption, 1 for decryption 63 | */ 64 | void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, int decrypt); 65 | 66 | /** 67 | * Encrypt or decrypt a buffer using a previously initialized context 68 | * 69 | * @param ctx an AVCAST5 context 70 | * @param dst destination array, can be equal to src 71 | * @param src source array, can be equal to dst 72 | * @param count number of 8 byte blocks 73 | * @param iv initialization vector for CBC mode, NULL for ECB mode 74 | * @param decrypt 0 for encryption, 1 for decryption 75 | */ 76 | void av_cast5_crypt2(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 77 | /** 78 | * @} 79 | */ 80 | #endif /* AVUTIL_CAST5_H */ 81 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/des.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DES encryption/decryption 3 | * Copyright (c) 2007 Reimar Doeffinger 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_DES_H 23 | #define AVUTIL_DES_H 24 | 25 | #include 26 | 27 | /** 28 | * @defgroup lavu_des DES 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | typedef struct AVDES { 34 | uint64_t round_keys[3][16]; 35 | int triple_des; 36 | } AVDES; 37 | 38 | /** 39 | * Allocate an AVDES context. 40 | */ 41 | AVDES *av_des_alloc(void); 42 | 43 | /** 44 | * @brief Initializes an AVDES context. 45 | * 46 | * @param key_bits must be 64 or 192 47 | * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption 48 | * @return zero on success, negative value otherwise 49 | */ 50 | int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt); 51 | 52 | /** 53 | * @brief Encrypts / decrypts using the DES algorithm. 54 | * 55 | * @param count number of 8 byte blocks 56 | * @param dst destination array, can be equal to src, must be 8-byte aligned 57 | * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL 58 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used, 59 | * must be 8-byte aligned 60 | * @param decrypt 0 for encryption, 1 for decryption 61 | */ 62 | void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 63 | 64 | /** 65 | * @brief Calculates CBC-MAC using the DES algorithm. 66 | * 67 | * @param count number of 8 byte blocks 68 | * @param dst destination array, can be equal to src, must be 8-byte aligned 69 | * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL 70 | */ 71 | void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count); 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | #endif /* AVUTIL_DES_H */ 78 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/ffversion.h: -------------------------------------------------------------------------------- 1 | /* Automatically generated by version.sh, do not manually edit! */ 2 | #ifndef AVUTIL_FFVERSION_H 3 | #define AVUTIL_FFVERSION_H 4 | #define FFMPEG_VERSION "n3.3.9-1-g3d5762380d" 5 | #endif /* AVUTIL_FFVERSION_H */ 6 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_FILE_H 20 | #define AVUTIL_FILE_H 21 | 22 | #include 23 | 24 | #include "avutil.h" 25 | 26 | /** 27 | * @file 28 | * Misc file utilities. 29 | */ 30 | 31 | /** 32 | * Read the file with name filename, and put its content in a newly 33 | * allocated buffer or map it with mmap() when available. 34 | * In case of success set *bufptr to the read or mmapped buffer, and 35 | * *size to the size in bytes of the buffer in *bufptr. 36 | * The returned buffer must be released with av_file_unmap(). 37 | * 38 | * @param log_offset loglevel offset used for logging 39 | * @param log_ctx context used for logging 40 | * @return a non negative number in case of success, a negative value 41 | * corresponding to an AVERROR error code in case of failure 42 | */ 43 | av_warn_unused_result 44 | int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, 45 | int log_offset, void *log_ctx); 46 | 47 | /** 48 | * Unmap or free the buffer bufptr created by av_file_map(). 49 | * 50 | * @param size size in bytes of bufptr, must be the same as returned 51 | * by av_file_map() 52 | */ 53 | void av_file_unmap(uint8_t *bufptr, size_t size); 54 | 55 | /** 56 | * Wrapper to work around the lack of mkstemp() on mingw. 57 | * Also, tries to create file in /tmp first, if possible. 58 | * *prefix can be a character constant; *filename will be allocated internally. 59 | * @return file descriptor of opened file (or negative value corresponding to an 60 | * AVERROR code on error) 61 | * and opened file name in **filename. 62 | * @note On very old libcs it is necessary to set a secure umask before 63 | * calling this, av_tempfile() can't call umask itself as it is used in 64 | * libraries and could interfere with the calling application. 65 | * @deprecated as fd numbers cannot be passed saftely between libs on some platforms 66 | */ 67 | int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); 68 | 69 | #endif /* AVUTIL_FILE_H */ 70 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/hmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Martin Storsjo 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_HMAC_H 22 | #define AVUTIL_HMAC_H 23 | 24 | #include 25 | 26 | #include "version.h" 27 | /** 28 | * @defgroup lavu_hmac HMAC 29 | * @ingroup lavu_crypto 30 | * @{ 31 | */ 32 | 33 | enum AVHMACType { 34 | AV_HMAC_MD5, 35 | AV_HMAC_SHA1, 36 | AV_HMAC_SHA224, 37 | AV_HMAC_SHA256, 38 | AV_HMAC_SHA384 = 12, 39 | AV_HMAC_SHA512, 40 | }; 41 | 42 | typedef struct AVHMAC AVHMAC; 43 | 44 | /** 45 | * Allocate an AVHMAC context. 46 | * @param type The hash function used for the HMAC. 47 | */ 48 | AVHMAC *av_hmac_alloc(enum AVHMACType type); 49 | 50 | /** 51 | * Free an AVHMAC context. 52 | * @param ctx The context to free, may be NULL 53 | */ 54 | void av_hmac_free(AVHMAC *ctx); 55 | 56 | /** 57 | * Initialize an AVHMAC context with an authentication key. 58 | * @param ctx The HMAC context 59 | * @param key The authentication key 60 | * @param keylen The length of the key, in bytes 61 | */ 62 | void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); 63 | 64 | /** 65 | * Hash data with the HMAC. 66 | * @param ctx The HMAC context 67 | * @param data The data to hash 68 | * @param len The length of the data, in bytes 69 | */ 70 | void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); 71 | 72 | /** 73 | * Finish hashing and output the HMAC digest. 74 | * @param ctx The HMAC context 75 | * @param out The output buffer to write the digest into 76 | * @param outlen The length of the out buffer, in bytes 77 | * @return The number of bytes written to out, or a negative error code. 78 | */ 79 | int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); 80 | 81 | /** 82 | * Hash an array of data with a key. 83 | * @param ctx The HMAC context 84 | * @param data The data to hash 85 | * @param len The length of the data, in bytes 86 | * @param key The authentication key 87 | * @param keylen The length of the key, in bytes 88 | * @param out The output buffer to write the digest into 89 | * @param outlen The length of the out buffer, in bytes 90 | * @return The number of bytes written to out, or a negative error code. 91 | */ 92 | int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, 93 | const uint8_t *key, unsigned int keylen, 94 | uint8_t *out, unsigned int outlen); 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | #endif /* AVUTIL_HMAC_H */ 101 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/hwcontext_cuda.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | 20 | #ifndef AVUTIL_HWCONTEXT_CUDA_H 21 | #define AVUTIL_HWCONTEXT_CUDA_H 22 | 23 | #ifndef CUDA_VERSION 24 | #include 25 | #endif 26 | 27 | #include "pixfmt.h" 28 | 29 | /** 30 | * @file 31 | * An API-specific header for AV_HWDEVICE_TYPE_CUDA. 32 | * 33 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 34 | * AVBufferRefs whose data pointer is a CUdeviceptr. 35 | */ 36 | 37 | typedef struct AVCUDADeviceContextInternal AVCUDADeviceContextInternal; 38 | 39 | /** 40 | * This struct is allocated as AVHWDeviceContext.hwctx 41 | */ 42 | typedef struct AVCUDADeviceContext { 43 | CUcontext cuda_ctx; 44 | AVCUDADeviceContextInternal *internal; 45 | } AVCUDADeviceContext; 46 | 47 | /** 48 | * AVHWFramesContext.hwctx is currently not used 49 | */ 50 | 51 | #endif /* AVUTIL_HWCONTEXT_CUDA_H */ 52 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/hwcontext_dxva2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | 20 | #ifndef AVUTIL_HWCONTEXT_DXVA2_H 21 | #define AVUTIL_HWCONTEXT_DXVA2_H 22 | 23 | /** 24 | * @file 25 | * An API-specific header for AV_HWDEVICE_TYPE_DXVA2. 26 | * 27 | * Only fixed-size pools are supported. 28 | * 29 | * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs 30 | * with the data pointer set to a pointer to IDirect3DSurface9. 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | /** 37 | * This struct is allocated as AVHWDeviceContext.hwctx 38 | */ 39 | typedef struct AVDXVA2DeviceContext { 40 | IDirect3DDeviceManager9 *devmgr; 41 | } AVDXVA2DeviceContext; 42 | 43 | /** 44 | * This struct is allocated as AVHWFramesContext.hwctx 45 | */ 46 | typedef struct AVDXVA2FramesContext { 47 | /** 48 | * The surface type (e.g. DXVA2_VideoProcessorRenderTarget or 49 | * DXVA2_VideoDecoderRenderTarget). Must be set by the caller. 50 | */ 51 | DWORD surface_type; 52 | 53 | /** 54 | * The surface pool. When an external pool is not provided by the caller, 55 | * this will be managed (allocated and filled on init, freed on uninit) by 56 | * libavutil. 57 | */ 58 | IDirect3DSurface9 **surfaces; 59 | int nb_surfaces; 60 | 61 | /** 62 | * Certain drivers require the decoder to be destroyed before the surfaces. 63 | * To allow internally managed pools to work properly in such cases, this 64 | * field is provided. 65 | * 66 | * If it is non-NULL, libavutil will call IDirectXVideoDecoder_Release() on 67 | * it just before the internal surface pool is freed. 68 | */ 69 | IDirectXVideoDecoder *decoder_to_release; 70 | } AVDXVA2FramesContext; 71 | 72 | #endif /* AVUTIL_HWCONTEXT_DXVA2_H */ 73 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/hwcontext_qsv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_QSV_H 20 | #define AVUTIL_HWCONTEXT_QSV_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_QSV. 27 | * 28 | * This API does not support dynamic frame pools. AVHWFramesContext.pool must 29 | * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVQSVDeviceContext { 36 | mfxSession session; 37 | } AVQSVDeviceContext; 38 | 39 | /** 40 | * This struct is allocated as AVHWFramesContext.hwctx 41 | */ 42 | typedef struct AVQSVFramesContext { 43 | mfxFrameSurface1 *surfaces; 44 | int nb_surfaces; 45 | 46 | /** 47 | * A combination of MFX_MEMTYPE_* describing the frame pool. 48 | */ 49 | int frame_type; 50 | } AVQSVFramesContext; 51 | 52 | #endif /* AVUTIL_HWCONTEXT_QSV_H */ 53 | 54 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/hwcontext_vdpau.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_HWCONTEXT_VDPAU_H 20 | #define AVUTIL_HWCONTEXT_VDPAU_H 21 | 22 | #include 23 | 24 | /** 25 | * @file 26 | * An API-specific header for AV_HWDEVICE_TYPE_VDPAU. 27 | * 28 | * This API supports dynamic frame pools. AVHWFramesContext.pool must return 29 | * AVBufferRefs whose data pointer is a VdpVideoSurface. 30 | */ 31 | 32 | /** 33 | * This struct is allocated as AVHWDeviceContext.hwctx 34 | */ 35 | typedef struct AVVDPAUDeviceContext { 36 | VdpDevice device; 37 | VdpGetProcAddress *get_proc_address; 38 | } AVVDPAUDeviceContext; 39 | 40 | /** 41 | * AVHWFramesContext.hwctx is currently not used 42 | */ 43 | 44 | #endif /* AVUTIL_HWCONTEXT_VDPAU_H */ 45 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/intfloat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Mans Rullgard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_H 22 | #define AVUTIL_INTFLOAT_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | union av_intfloat32 { 28 | uint32_t i; 29 | float f; 30 | }; 31 | 32 | union av_intfloat64 { 33 | uint64_t i; 34 | double f; 35 | }; 36 | 37 | /** 38 | * Reinterpret a 32-bit integer as a float. 39 | */ 40 | static av_always_inline float av_int2float(uint32_t i) 41 | { 42 | union av_intfloat32 v; 43 | v.i = i; 44 | return v.f; 45 | } 46 | 47 | /** 48 | * Reinterpret a float as a 32-bit integer. 49 | */ 50 | static av_always_inline uint32_t av_float2int(float f) 51 | { 52 | union av_intfloat32 v; 53 | v.f = f; 54 | return v.i; 55 | } 56 | 57 | /** 58 | * Reinterpret a 64-bit integer as a double. 59 | */ 60 | static av_always_inline double av_int2double(uint64_t i) 61 | { 62 | union av_intfloat64 v; 63 | v.i = i; 64 | return v.f; 65 | } 66 | 67 | /** 68 | * Reinterpret a double as a 64-bit integer. 69 | */ 70 | static av_always_inline uint64_t av_double2int(double f) 71 | { 72 | union av_intfloat64 v; 73 | v.f = f; 74 | return v.i; 75 | } 76 | 77 | #endif /* AVUTIL_INTFLOAT_H */ 78 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/lfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lagged Fibonacci PRNG 3 | * Copyright (c) 2008 Michael Niedermayer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LFG_H 23 | #define AVUTIL_LFG_H 24 | 25 | #include 26 | 27 | typedef struct AVLFG { 28 | unsigned int state[64]; 29 | int index; 30 | } AVLFG; 31 | 32 | void av_lfg_init(AVLFG *c, unsigned int seed); 33 | 34 | /** 35 | * Seed the state of the ALFG using binary data. 36 | * 37 | * Return value: 0 on success, negative value (AVERROR) on failure. 38 | */ 39 | int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length); 40 | 41 | /** 42 | * Get the next random unsigned 32-bit number using an ALFG. 43 | * 44 | * Please also consider a simple LCG like state= state*1664525+1013904223, 45 | * it may be good enough and faster for your specific use case. 46 | */ 47 | static inline unsigned int av_lfg_get(AVLFG *c){ 48 | c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; 49 | return c->state[c->index++ & 63]; 50 | } 51 | 52 | /** 53 | * Get the next random unsigned 32-bit number using a MLFG. 54 | * 55 | * Please also consider av_lfg_get() above, it is faster. 56 | */ 57 | static inline unsigned int av_mlfg_get(AVLFG *c){ 58 | unsigned int a= c->state[(c->index-55) & 63]; 59 | unsigned int b= c->state[(c->index-24) & 63]; 60 | return c->state[c->index++ & 63] = 2*a*b+a+b; 61 | } 62 | 63 | /** 64 | * Get the next two numbers generated by a Box-Muller Gaussian 65 | * generator using the random numbers issued by lfg. 66 | * 67 | * @param out array where the two generated numbers are placed 68 | */ 69 | void av_bmg_get(AVLFG *lfg, double out[2]); 70 | 71 | #endif /* AVUTIL_LFG_H */ 72 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/lzo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LZO 1x decompression 3 | * copyright (c) 2006 Reimar Doeffinger 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LZO_H 23 | #define AVUTIL_LZO_H 24 | 25 | /** 26 | * @defgroup lavu_lzo LZO 27 | * @ingroup lavu_crypto 28 | * 29 | * @{ 30 | */ 31 | 32 | #include 33 | 34 | /** @name Error flags returned by av_lzo1x_decode 35 | * @{ */ 36 | /// end of the input buffer reached before decoding finished 37 | #define AV_LZO_INPUT_DEPLETED 1 38 | /// decoded data did not fit into output buffer 39 | #define AV_LZO_OUTPUT_FULL 2 40 | /// a reference to previously decoded data was wrong 41 | #define AV_LZO_INVALID_BACKPTR 4 42 | /// a non-specific error in the compressed bitstream 43 | #define AV_LZO_ERROR 8 44 | /** @} */ 45 | 46 | #define AV_LZO_INPUT_PADDING 8 47 | #define AV_LZO_OUTPUT_PADDING 12 48 | 49 | /** 50 | * @brief Decodes LZO 1x compressed data. 51 | * @param out output buffer 52 | * @param outlen size of output buffer, number of bytes left are returned here 53 | * @param in input buffer 54 | * @param inlen size of input buffer, number of bytes left are returned here 55 | * @return 0 on success, otherwise a combination of the error flags above 56 | * 57 | * Make sure all buffers are appropriately padded, in must provide 58 | * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. 59 | */ 60 | int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* AVUTIL_LZO_H */ 67 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * @ingroup lavu 22 | * Utility Preprocessor macros 23 | */ 24 | 25 | #ifndef AVUTIL_MACROS_H 26 | #define AVUTIL_MACROS_H 27 | 28 | /** 29 | * @addtogroup preproc_misc Preprocessor String Macros 30 | * 31 | * String manipulation macros 32 | * 33 | * @{ 34 | */ 35 | 36 | #define AV_STRINGIFY(s) AV_TOSTRING(s) 37 | #define AV_TOSTRING(s) #s 38 | 39 | #define AV_GLUE(a, b) a ## b 40 | #define AV_JOIN(a, b) AV_GLUE(a, b) 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | #define AV_PRAGMA(s) _Pragma(#s) 47 | 48 | #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) 49 | 50 | #endif /* AVUTIL_MACROS_H */ 51 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/mastering_display_metadata.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2016 Neil Birkbeck 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MASTERING_DISPLAY_METADATA_H 22 | #define AVUTIL_MASTERING_DISPLAY_METADATA_H 23 | 24 | #include "frame.h" 25 | #include "rational.h" 26 | 27 | 28 | /** 29 | * Mastering display metadata capable of representing the color volume of 30 | * the display used to master the content (SMPTE 2086:2014). 31 | * 32 | * To be used as payload of a AVFrameSideData or AVPacketSideData with the 33 | * appropriate type. 34 | * 35 | * @note The struct should be allocated with av_mastering_display_metadata_alloc() 36 | * and its size is not a part of the public ABI. 37 | */ 38 | typedef struct AVMasteringDisplayMetadata { 39 | /** 40 | * CIE 1931 xy chromaticity coords of color primaries (r, g, b order). 41 | */ 42 | AVRational display_primaries[3][2]; 43 | 44 | /** 45 | * CIE 1931 xy chromaticity coords of white point. 46 | */ 47 | AVRational white_point[2]; 48 | 49 | /** 50 | * Min luminance of mastering display (cd/m^2). 51 | */ 52 | AVRational min_luminance; 53 | 54 | /** 55 | * Max luminance of mastering display (cd/m^2). 56 | */ 57 | AVRational max_luminance; 58 | 59 | /** 60 | * Flag indicating whether the display primaries (and white point) are set. 61 | */ 62 | int has_primaries; 63 | 64 | /** 65 | * Flag indicating whether the luminance (min_ and max_) have been set. 66 | */ 67 | int has_luminance; 68 | 69 | } AVMasteringDisplayMetadata; 70 | 71 | /** 72 | * Allocate an AVMasteringDisplayMetadata structure and set its fields to 73 | * default values. The resulting struct can be freed using av_freep(). 74 | * 75 | * @return An AVMasteringDisplayMetadata filled with default values or NULL 76 | * on failure. 77 | */ 78 | AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void); 79 | 80 | /** 81 | * Allocate a complete AVMasteringDisplayMetadata and add it to the frame. 82 | * 83 | * @param frame The frame which side data is added to. 84 | * 85 | * @return The AVMasteringDisplayMetadata structure to be filled by caller. 86 | */ 87 | AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame); 88 | 89 | #endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */ 90 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_md5 24 | * Public header for MD5 hash function implementation. 25 | */ 26 | 27 | #ifndef AVUTIL_MD5_H 28 | #define AVUTIL_MD5_H 29 | 30 | #include 31 | 32 | #include "attributes.h" 33 | #include "version.h" 34 | 35 | /** 36 | * @defgroup lavu_md5 MD5 37 | * @ingroup lavu_hash 38 | * MD5 hash function implementation. 39 | * 40 | * @{ 41 | */ 42 | 43 | extern const int av_md5_size; 44 | 45 | struct AVMD5; 46 | 47 | /** 48 | * Allocate an AVMD5 context. 49 | */ 50 | struct AVMD5 *av_md5_alloc(void); 51 | 52 | /** 53 | * Initialize MD5 hashing. 54 | * 55 | * @param ctx pointer to the function context (of size av_md5_size) 56 | */ 57 | void av_md5_init(struct AVMD5 *ctx); 58 | 59 | /** 60 | * Update hash value. 61 | * 62 | * @param ctx hash function context 63 | * @param src input data to update hash with 64 | * @param len input data length 65 | */ 66 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); 67 | 68 | /** 69 | * Finish hashing and output digest value. 70 | * 71 | * @param ctx hash function context 72 | * @param dst buffer where output digest value is stored 73 | */ 74 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); 75 | 76 | /** 77 | * Hash an array of data. 78 | * 79 | * @param dst The output buffer to write the digest into 80 | * @param src The data to hash 81 | * @param len The length of the data, in bytes 82 | */ 83 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | #endif /* AVUTIL_MD5_H */ 90 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/motion_vector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_MOTION_VECTOR_H 20 | #define AVUTIL_MOTION_VECTOR_H 21 | 22 | #include 23 | 24 | typedef struct AVMotionVector { 25 | /** 26 | * Where the current macroblock comes from; negative value when it comes 27 | * from the past, positive value when it comes from the future. 28 | * XXX: set exact relative ref frame reference instead of a +/- 1 "direction". 29 | */ 30 | int32_t source; 31 | /** 32 | * Width and height of the block. 33 | */ 34 | uint8_t w, h; 35 | /** 36 | * Absolute source position. Can be outside the frame area. 37 | */ 38 | int16_t src_x, src_y; 39 | /** 40 | * Absolute destination position. Can be outside the frame area. 41 | */ 42 | int16_t dst_x, dst_y; 43 | /** 44 | * Extra flag information. 45 | * Currently unused. 46 | */ 47 | uint64_t flags; 48 | /** 49 | * Motion vector 50 | * src_x = dst_x + motion_x / motion_scale 51 | * src_y = dst_y + motion_y / motion_scale 52 | */ 53 | int32_t motion_x, motion_y; 54 | uint16_t motion_scale; 55 | } AVMotionVector; 56 | 57 | #endif /* AVUTIL_MOTION_VECTOR_H */ 58 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/pixelutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_PIXELUTILS_H 20 | #define AVUTIL_PIXELUTILS_H 21 | 22 | #include 23 | #include 24 | #include "common.h" 25 | 26 | /** 27 | * Sum of abs(src1[x] - src2[x]) 28 | */ 29 | typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, 30 | const uint8_t *src2, ptrdiff_t stride2); 31 | 32 | /** 33 | * Get a potentially optimized pointer to a Sum-of-absolute-differences 34 | * function (see the av_pixelutils_sad_fn prototype). 35 | * 36 | * @param w_bits 1< 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RANDOM_SEED_H 22 | #define AVUTIL_RANDOM_SEED_H 23 | 24 | #include 25 | /** 26 | * @addtogroup lavu_crypto 27 | * @{ 28 | */ 29 | 30 | /** 31 | * Get a seed to use in conjunction with random functions. 32 | * This function tries to provide a good seed at a best effort bases. 33 | * Its possible to call this function multiple times if more bits are needed. 34 | * It can be quite slow, which is why it should only be used as seed for a faster 35 | * PRNG. The quality of the seed depends on the platform. 36 | */ 37 | uint32_t av_get_random_seed(void); 38 | 39 | /** 40 | * @} 41 | */ 42 | 43 | #endif /* AVUTIL_RANDOM_SEED_H */ 44 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RC4 encryption/decryption/pseudo-random number generator 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RC4_H 22 | #define AVUTIL_RC4_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_rc4 RC4 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | typedef struct AVRC4 { 33 | uint8_t state[256]; 34 | int x, y; 35 | } AVRC4; 36 | 37 | /** 38 | * Allocate an AVRC4 context. 39 | */ 40 | AVRC4 *av_rc4_alloc(void); 41 | 42 | /** 43 | * @brief Initializes an AVRC4 context. 44 | * 45 | * @param key_bits must be a multiple of 8 46 | * @param decrypt 0 for encryption, 1 for decryption, currently has no effect 47 | * @return zero on success, negative value otherwise 48 | */ 49 | int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); 50 | 51 | /** 52 | * @brief Encrypts / decrypts using the RC4 algorithm. 53 | * 54 | * @param count number of bytes 55 | * @param dst destination array, can be equal to src 56 | * @param src source array, can be equal to dst, may be NULL 57 | * @param iv not (yet) used for RC4, should be NULL 58 | * @param decrypt 0 for encryption, 1 for decryption, not (yet) used 59 | */ 60 | void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | #endif /* AVUTIL_RC4_H */ 67 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/replaygain.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_REPLAYGAIN_H 20 | #define AVUTIL_REPLAYGAIN_H 21 | 22 | #include 23 | 24 | /** 25 | * ReplayGain information (see 26 | * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). 27 | * The size of this struct is a part of the public ABI. 28 | */ 29 | typedef struct AVReplayGain { 30 | /** 31 | * Track replay gain in microbels (divide by 100000 to get the value in dB). 32 | * Should be set to INT32_MIN when unknown. 33 | */ 34 | int32_t track_gain; 35 | /** 36 | * Peak track amplitude, with 100000 representing full scale (but values 37 | * may overflow). 0 when unknown. 38 | */ 39 | uint32_t track_peak; 40 | /** 41 | * Same as track_gain, but for the whole album. 42 | */ 43 | int32_t album_gain; 44 | /** 45 | * Same as track_peak, but for the whole album, 46 | */ 47 | uint32_t album_peak; 48 | } AVReplayGain; 49 | 50 | #endif /* AVUTIL_REPLAYGAIN_H */ 51 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/ripemd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * @ingroup lavu_ripemd 25 | * Public header for RIPEMD hash function implementation. 26 | */ 27 | 28 | #ifndef AVUTIL_RIPEMD_H 29 | #define AVUTIL_RIPEMD_H 30 | 31 | #include 32 | 33 | #include "attributes.h" 34 | #include "version.h" 35 | 36 | /** 37 | * @defgroup lavu_ripemd RIPEMD 38 | * @ingroup lavu_hash 39 | * RIPEMD hash function implementation. 40 | * 41 | * @{ 42 | */ 43 | 44 | extern const int av_ripemd_size; 45 | 46 | struct AVRIPEMD; 47 | 48 | /** 49 | * Allocate an AVRIPEMD context. 50 | */ 51 | struct AVRIPEMD *av_ripemd_alloc(void); 52 | 53 | /** 54 | * Initialize RIPEMD hashing. 55 | * 56 | * @param context pointer to the function context (of size av_ripemd_size) 57 | * @param bits number of bits in digest (128, 160, 256 or 320 bits) 58 | * @return zero if initialization succeeded, -1 otherwise 59 | */ 60 | int av_ripemd_init(struct AVRIPEMD* context, int bits); 61 | 62 | /** 63 | * Update hash value. 64 | * 65 | * @param context hash function context 66 | * @param data input data to update hash with 67 | * @param len input data length 68 | */ 69 | void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); 70 | 71 | /** 72 | * Finish hashing and output digest value. 73 | * 74 | * @param context hash function context 75 | * @param digest buffer where output digest value is stored 76 | */ 77 | void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | #endif /* AVUTIL_RIPEMD_H */ 84 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/sha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * @ingroup lavu_sha 24 | * Public header for SHA-1 & SHA-256 hash function implementations. 25 | */ 26 | 27 | #ifndef AVUTIL_SHA_H 28 | #define AVUTIL_SHA_H 29 | 30 | #include 31 | 32 | #include "attributes.h" 33 | #include "version.h" 34 | 35 | /** 36 | * @defgroup lavu_sha SHA 37 | * @ingroup lavu_hash 38 | * SHA-1 and SHA-256 (Secure Hash Algorithm) hash function implementations. 39 | * 40 | * This module supports the following SHA hash functions: 41 | * 42 | * - SHA-1: 160 bits 43 | * - SHA-224: 224 bits, as a variant of SHA-2 44 | * - SHA-256: 256 bits, as a variant of SHA-2 45 | * 46 | * @see For SHA-384, SHA-512, and variants thereof, see @ref lavu_sha512. 47 | * 48 | * @{ 49 | */ 50 | 51 | extern const int av_sha_size; 52 | 53 | struct AVSHA; 54 | 55 | /** 56 | * Allocate an AVSHA context. 57 | */ 58 | struct AVSHA *av_sha_alloc(void); 59 | 60 | /** 61 | * Initialize SHA-1 or SHA-2 hashing. 62 | * 63 | * @param context pointer to the function context (of size av_sha_size) 64 | * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) 65 | * @return zero if initialization succeeded, -1 otherwise 66 | */ 67 | int av_sha_init(struct AVSHA* context, int bits); 68 | 69 | /** 70 | * Update hash value. 71 | * 72 | * @param context hash function context 73 | * @param data input data to update hash with 74 | * @param len input data length 75 | */ 76 | void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); 77 | 78 | /** 79 | * Finish hashing and output digest value. 80 | * 81 | * @param context hash function context 82 | * @param digest buffer where output digest value is stored 83 | */ 84 | void av_sha_final(struct AVSHA* context, uint8_t *digest); 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | #endif /* AVUTIL_SHA_H */ 91 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/sha512.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * Copyright (C) 2013 James Almer 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * @ingroup lavu_sha512 25 | * Public header for SHA-512 implementation. 26 | */ 27 | 28 | #ifndef AVUTIL_SHA512_H 29 | #define AVUTIL_SHA512_H 30 | 31 | #include 32 | 33 | #include "attributes.h" 34 | #include "version.h" 35 | 36 | /** 37 | * @defgroup lavu_sha512 SHA-512 38 | * @ingroup lavu_hash 39 | * SHA-512 (Secure Hash Algorithm) hash function implementations. 40 | * 41 | * This module supports the following SHA-2 hash functions: 42 | * 43 | * - SHA-512/224: 224 bits 44 | * - SHA-512/256: 256 bits 45 | * - SHA-384: 384 bits 46 | * - SHA-512: 512 bits 47 | * 48 | * @see For SHA-1, SHA-256, and variants thereof, see @ref lavu_sha. 49 | * 50 | * @{ 51 | */ 52 | 53 | extern const int av_sha512_size; 54 | 55 | struct AVSHA512; 56 | 57 | /** 58 | * Allocate an AVSHA512 context. 59 | */ 60 | struct AVSHA512 *av_sha512_alloc(void); 61 | 62 | /** 63 | * Initialize SHA-2 512 hashing. 64 | * 65 | * @param context pointer to the function context (of size av_sha512_size) 66 | * @param bits number of bits in digest (224, 256, 384 or 512 bits) 67 | * @return zero if initialization succeeded, -1 otherwise 68 | */ 69 | int av_sha512_init(struct AVSHA512* context, int bits); 70 | 71 | /** 72 | * Update hash value. 73 | * 74 | * @param context hash function context 75 | * @param data input data to update hash with 76 | * @param len input data length 77 | */ 78 | void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); 79 | 80 | /** 81 | * Finish hashing and output digest value. 82 | * 83 | * @param context hash function context 84 | * @param digest buffer where output digest value is stored 85 | */ 86 | void av_sha512_final(struct AVSHA512* context, uint8_t *digest); 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | #endif /* AVUTIL_SHA512_H */ 93 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/tea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A 32-bit implementation of the TEA algorithm 3 | * Copyright (c) 2015 Vesselin Bontchev 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_TEA_H 23 | #define AVUTIL_TEA_H 24 | 25 | #include 26 | 27 | /** 28 | * @file 29 | * @brief Public header for libavutil TEA algorithm 30 | * @defgroup lavu_tea TEA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | extern const int av_tea_size; 36 | 37 | struct AVTEA; 38 | 39 | /** 40 | * Allocate an AVTEA context 41 | * To free the struct: av_free(ptr) 42 | */ 43 | struct AVTEA *av_tea_alloc(void); 44 | 45 | /** 46 | * Initialize an AVTEA context. 47 | * 48 | * @param ctx an AVTEA context 49 | * @param key a key of 16 bytes used for encryption/decryption 50 | * @param rounds the number of rounds in TEA (64 is the "standard") 51 | */ 52 | void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds); 53 | 54 | /** 55 | * Encrypt or decrypt a buffer using a previously initialized context. 56 | * 57 | * @param ctx an AVTEA context 58 | * @param dst destination array, can be equal to src 59 | * @param src source array, can be equal to dst 60 | * @param count number of 8 byte blocks 61 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 62 | * @param decrypt 0 for encryption, 1 for decryption 63 | */ 64 | void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src, 65 | int count, uint8_t *iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | #endif /* AVUTIL_TEA_H */ 72 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2003 Fabrice Bellard 3 | * 4 | * This file is part of FFmpeg. 5 | * 6 | * FFmpeg is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * FFmpeg is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with FFmpeg; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_TIME_H 22 | #define AVUTIL_TIME_H 23 | 24 | #include 25 | 26 | /** 27 | * Get the current time in microseconds. 28 | */ 29 | int64_t av_gettime(void); 30 | 31 | /** 32 | * Get the current time in microseconds since some unspecified starting point. 33 | * On platforms that support it, the time comes from a monotonic clock 34 | * This property makes this time source ideal for measuring relative time. 35 | * The returned values may not be monotonic on platforms where a monotonic 36 | * clock is not available. 37 | */ 38 | int64_t av_gettime_relative(void); 39 | 40 | /** 41 | * Indicates with a boolean result if the av_gettime_relative() time source 42 | * is monotonic. 43 | */ 44 | int av_gettime_relative_is_monotonic(void); 45 | 46 | /** 47 | * Sleep for a period of time. Although the duration is expressed in 48 | * microseconds, the actual delay may be rounded to the precision of the 49 | * system timer. 50 | * 51 | * @param usec Number of microseconds to sleep. 52 | * @return zero on success or (negative) error code. 53 | */ 54 | int av_usleep(unsigned usec); 55 | 56 | #endif /* AVUTIL_TIME_H */ 57 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/timestamp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * timestamp utils, mostly useful for debugging/logging purposes 22 | */ 23 | 24 | #ifndef AVUTIL_TIMESTAMP_H 25 | #define AVUTIL_TIMESTAMP_H 26 | 27 | #include "common.h" 28 | 29 | #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64) 30 | #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS 31 | #endif 32 | 33 | #define AV_TS_MAX_STRING_SIZE 32 34 | 35 | /** 36 | * Fill the provided buffer with a string containing a timestamp 37 | * representation. 38 | * 39 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE 40 | * @param ts the timestamp to represent 41 | * @return the buffer in input 42 | */ 43 | static inline char *av_ts_make_string(char *buf, int64_t ts) 44 | { 45 | if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); 46 | else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%" PRId64, ts); 47 | return buf; 48 | } 49 | 50 | /** 51 | * Convenience macro, the return value should be used only directly in 52 | * function arguments but never stand-alone. 53 | */ 54 | #define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts) 55 | 56 | /** 57 | * Fill the provided buffer with a string containing a timestamp time 58 | * representation. 59 | * 60 | * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE 61 | * @param ts the timestamp to represent 62 | * @param tb the timebase of the timestamp 63 | * @return the buffer in input 64 | */ 65 | static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb) 66 | { 67 | if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); 68 | else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts); 69 | return buf; 70 | } 71 | 72 | /** 73 | * Convenience macro, the return value should be used only directly in 74 | * function arguments but never stand-alone. 75 | */ 76 | #define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb) 77 | 78 | #endif /* AVUTIL_TIMESTAMP_H */ 79 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/twofish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the TwoFish algorithm 3 | * Copyright (c) 2015 Supraja Meedinti 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_TWOFISH_H 23 | #define AVUTIL_TWOFISH_H 24 | 25 | #include 26 | 27 | 28 | /** 29 | * @file 30 | * @brief Public header for libavutil TWOFISH algorithm 31 | * @defgroup lavu_twofish TWOFISH 32 | * @ingroup lavu_crypto 33 | * @{ 34 | */ 35 | 36 | extern const int av_twofish_size; 37 | 38 | struct AVTWOFISH; 39 | 40 | /** 41 | * Allocate an AVTWOFISH context 42 | * To free the struct: av_free(ptr) 43 | */ 44 | struct AVTWOFISH *av_twofish_alloc(void); 45 | 46 | /** 47 | * Initialize an AVTWOFISH context. 48 | * 49 | * @param ctx an AVTWOFISH context 50 | * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption 51 | * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise 52 | */ 53 | int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits); 54 | 55 | /** 56 | * Encrypt or decrypt a buffer using a previously initialized context 57 | * 58 | * @param ctx an AVTWOFISH context 59 | * @param dst destination array, can be equal to src 60 | * @param src source array, can be equal to dst 61 | * @param count number of 16 byte blocks 62 | * @paran iv initialization vector for CBC mode, NULL for ECB mode 63 | * @param decrypt 0 for encryption, 1 for decryption 64 | */ 65 | void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); 66 | 67 | /** 68 | * @} 69 | */ 70 | #endif /* AVUTIL_TWOFISH_H */ 71 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libavutil/xtea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A 32-bit implementation of the XTEA algorithm 3 | * Copyright (c) 2012 Samuel Pitoiset 4 | * 5 | * This file is part of FFmpeg. 6 | * 7 | * FFmpeg is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * FFmpeg is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with FFmpeg; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_XTEA_H 23 | #define AVUTIL_XTEA_H 24 | 25 | #include 26 | 27 | /** 28 | * @file 29 | * @brief Public header for libavutil XTEA algorithm 30 | * @defgroup lavu_xtea XTEA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | typedef struct AVXTEA { 36 | uint32_t key[16]; 37 | } AVXTEA; 38 | 39 | /** 40 | * Allocate an AVXTEA context. 41 | */ 42 | AVXTEA *av_xtea_alloc(void); 43 | 44 | /** 45 | * Initialize an AVXTEA context. 46 | * 47 | * @param ctx an AVXTEA context 48 | * @param key a key of 16 bytes used for encryption/decryption, 49 | * interpreted as big endian 32 bit numbers 50 | */ 51 | void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); 52 | 53 | /** 54 | * Initialize an AVXTEA context. 55 | * 56 | * @param ctx an AVXTEA context 57 | * @param key a key of 16 bytes used for encryption/decryption, 58 | * interpreted as little endian 32 bit numbers 59 | */ 60 | void av_xtea_le_init(struct AVXTEA *ctx, const uint8_t key[16]); 61 | 62 | /** 63 | * Encrypt or decrypt a buffer using a previously initialized context, 64 | * in big endian format. 65 | * 66 | * @param ctx an AVXTEA context 67 | * @param dst destination array, can be equal to src 68 | * @param src source array, can be equal to dst 69 | * @param count number of 8 byte blocks 70 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 71 | * @param decrypt 0 for encryption, 1 for decryption 72 | */ 73 | void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, 74 | int count, uint8_t *iv, int decrypt); 75 | 76 | /** 77 | * Encrypt or decrypt a buffer using a previously initialized context, 78 | * in little endian format. 79 | * 80 | * @param ctx an AVXTEA context 81 | * @param dst destination array, can be equal to src 82 | * @param src source array, can be equal to dst 83 | * @param count number of 8 byte blocks 84 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 85 | * @param decrypt 0 for encryption, 1 for decryption 86 | */ 87 | void av_xtea_le_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, 88 | int count, uint8_t *iv, int decrypt); 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | #endif /* AVUTIL_XTEA_H */ 95 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libswresample/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Version macros. 3 | * 4 | * This file is part of libswresample 5 | * 6 | * libswresample is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * libswresample is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with libswresample; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef SWRESAMPLE_VERSION_H 22 | #define SWRESAMPLE_VERSION_H 23 | 24 | /** 25 | * @file 26 | * Libswresample version macros 27 | */ 28 | 29 | #include "libavutil/avutil.h" 30 | 31 | #define LIBSWRESAMPLE_VERSION_MAJOR 2 32 | #define LIBSWRESAMPLE_VERSION_MINOR 7 33 | #define LIBSWRESAMPLE_VERSION_MICRO 100 34 | 35 | #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ 36 | LIBSWRESAMPLE_VERSION_MINOR, \ 37 | LIBSWRESAMPLE_VERSION_MICRO) 38 | #define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \ 39 | LIBSWRESAMPLE_VERSION_MINOR, \ 40 | LIBSWRESAMPLE_VERSION_MICRO) 41 | #define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT 42 | 43 | #define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION) 44 | 45 | #endif /* SWRESAMPLE_VERSION_H */ 46 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/libswscale/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of FFmpeg. 3 | * 4 | * FFmpeg is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * FFmpeg is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with FFmpeg; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SWSCALE_VERSION_H 20 | #define SWSCALE_VERSION_H 21 | 22 | /** 23 | * @file 24 | * swscale version macros 25 | */ 26 | 27 | #include "libavutil/version.h" 28 | 29 | #define LIBSWSCALE_VERSION_MAJOR 4 30 | #define LIBSWSCALE_VERSION_MINOR 6 31 | #define LIBSWSCALE_VERSION_MICRO 100 32 | 33 | #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ 34 | LIBSWSCALE_VERSION_MINOR, \ 35 | LIBSWSCALE_VERSION_MICRO) 36 | #define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \ 37 | LIBSWSCALE_VERSION_MINOR, \ 38 | LIBSWSCALE_VERSION_MICRO) 39 | #define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT 40 | 41 | #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) 42 | 43 | /** 44 | * FF_API_* defines may be placed below to indicate public API that will be 45 | * dropped at a future version bump. The defines themselves are not part of 46 | * the public API and may change, break or disappear at any time. 47 | */ 48 | 49 | #ifndef FF_API_SWS_VECTOR 50 | #define FF_API_SWS_VECTOR (LIBSWSCALE_VERSION_MAJOR < 6) 51 | #endif 52 | 53 | #endif /* SWSCALE_VERSION_H */ 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/AboutFragment.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | /** 12 | * Created by wyh on 2019/3/17. 13 | */ 14 | public class AboutFragment extends Fragment { 15 | public static final String TAG = "AboutFragment"; 16 | public static final String TITLE = "About"; 17 | 18 | 19 | public static AboutFragment newInstance() { 20 | 21 | Bundle args = new Bundle(); 22 | 23 | AboutFragment fragment = new AboutFragment(); 24 | fragment.setArguments(args); 25 | return fragment; 26 | } 27 | 28 | @Override 29 | public void onCreate(@Nullable Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | } 32 | 33 | @Nullable 34 | @Override 35 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 36 | return inflater.inflate(R.layout.fragment_about, container,false); 37 | } 38 | 39 | @Override 40 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { 41 | super.onViewCreated(view, savedInstanceState); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/common/App.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.common; 2 | 3 | import android.app.Application; 4 | 5 | /** 6 | * Created by wyh on 2019/3/13. 7 | */ 8 | public class App extends Application { 9 | 10 | private static App app; 11 | 12 | public static App get() { 13 | return app; 14 | } 15 | 16 | @Override 17 | public void onCreate() { 18 | super.onCreate(); 19 | app = this; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/common/Click.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.common; 2 | 3 | import android.view.View; 4 | 5 | /** 6 | * Created by wyh3 on 2018/7/21. 7 | * 一些通用的、与交互相关的、与业务无关的点击事件监听器 8 | * 抽离出来公用,避免每次用的时候都要重新写一个 9 | */ 10 | public class Click { 11 | 12 | /** 13 | * 天真无暇的click 14 | */ 15 | public interface OnClickListener { 16 | void onClick(); 17 | } 18 | 19 | /** 20 | * 监听控件点击时还想多传一个参数 21 | */ 22 | public interface OnViewClickListener { 23 | void onClick(View view, T t); 24 | } 25 | 26 | /** 27 | * 监听对象可能是任意一个抽象的实体 28 | */ 29 | public interface OnObjectClickListener { 30 | void onObjectClick(T t); 31 | } 32 | 33 | /** 34 | * 需要回调位置的监听 35 | */ 36 | public interface OnPositionClickListener { 37 | void onPositionClick(int position); 38 | } 39 | 40 | /** 41 | * 需要回调位置的监听 42 | */ 43 | public interface OnItemClickListener { 44 | void onItemClick(T t, int position); 45 | } 46 | 47 | /** 48 | * 需要回调位置的监听 49 | */ 50 | public interface OnItemViewClickListener { 51 | void onItemClick(View view, T t, int position); 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/common/Logger.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.common; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * Created by wyh on 2019/3/18. 7 | */ 8 | public class Logger { 9 | private static final String TAG = "FFmpegCmd_Logger"; 10 | 11 | public static void d(String tag, String message) { 12 | Log.d(tag, message); 13 | } 14 | 15 | 16 | public static void e(String tag, String message, Throwable throwable) { 17 | Log.e(tag, message, throwable); 18 | } 19 | 20 | public static void d(String message) { 21 | Log.d(TAG, message); 22 | } 23 | 24 | 25 | public static void e(String message, Throwable throwable) { 26 | Log.e(TAG, message, throwable); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/common/PermissionHelper.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.common; 2 | 3 | import android.Manifest; 4 | import android.content.Context; 5 | import android.content.pm.PackageManager; 6 | import android.os.Build; 7 | import android.support.v4.content.ContextCompat; 8 | 9 | /** 10 | * Created by wyh on 2019/3/12. 11 | */ 12 | 13 | public class PermissionHelper { 14 | 15 | private PermissionHelper() { 16 | } 17 | 18 | private static boolean hasStoragePermission = false; 19 | 20 | public static boolean hasWriteAndReadStoragePermission(Context context) { 21 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { 22 | return true; 23 | } 24 | //如果已经有权限了,就不再检查 25 | if (hasStoragePermission) { 26 | return true; 27 | } 28 | if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) 29 | != PackageManager.PERMISSION_GRANTED) { 30 | hasStoragePermission = false; 31 | return false; 32 | } 33 | hasStoragePermission = true; 34 | return true; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/common/SaveProgressDialog.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.common; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | import android.os.Bundle; 6 | import android.support.annotation.IntRange; 7 | import android.support.annotation.NonNull; 8 | import android.view.View; 9 | import android.widget.ProgressBar; 10 | import android.widget.TextView; 11 | 12 | import com.wyh.ffmpegcmd.R; 13 | 14 | import java.util.Locale; 15 | 16 | /** 17 | * 带有进度条的dialog 18 | */ 19 | public class SaveProgressDialog extends SecureDialog implements View.OnClickListener { 20 | 21 | public static final String TAG = "SaveProgressDialog"; 22 | 23 | private static final String PROGRESS = "%d%%"; 24 | 25 | private ProgressBar mProgressBar; 26 | private TextView mTvProgress; 27 | private SavingDialogCallback mSavingDialogCallback; 28 | 29 | public SaveProgressDialog(@NonNull Context context) { 30 | super(context); 31 | } 32 | 33 | public SaveProgressDialog(@NonNull Context context, int themeResId) { 34 | super(context, themeResId); 35 | } 36 | 37 | public interface SavingDialogCallback { 38 | void cancelVideoSave(); 39 | } 40 | 41 | public void setSavingDialogCallback(SavingDialogCallback callback) { 42 | this.mSavingDialogCallback = callback; 43 | } 44 | 45 | @Override 46 | public void onCreate(Bundle savedInstanceState) { 47 | super.onCreate(savedInstanceState); 48 | mProgressBar = findViewById(R.id.download_progress_view); 49 | mTvProgress = findViewById(R.id.tv_progress_text); 50 | findViewById(R.id.btn_cancel).setVisibility(View.GONE); 51 | setCancelable(false); 52 | } 53 | 54 | public static SaveProgressDialog getInstance(Context context) { 55 | SaveProgressDialog dialog = new SaveProgressDialog(context, R.style.CommonDialog); 56 | dialog.setContentView(R.layout.save_progress); 57 | return dialog; 58 | } 59 | 60 | 61 | public void updateProgress(@IntRange(from = 0, to = 100) int progress) { 62 | if (null != mTvProgress && null != mProgressBar) { 63 | if (progress != mProgressBar.getProgress()) { 64 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 65 | mProgressBar.setProgress(progress, true); 66 | } else { 67 | mProgressBar.setProgress(progress); 68 | } 69 | mTvProgress.setText(String.format(Locale.getDefault(), PROGRESS, progress)); 70 | } 71 | } 72 | } 73 | 74 | @Override 75 | public void onClick(View v) { 76 | if (v.getId() == R.id.btn_cancel) { // 取消保存 77 | if (null != mSavingDialogCallback) { 78 | mSavingDialogCallback.cancelVideoSave(); 79 | } 80 | dismiss(); 81 | } 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/common/VideoUtil.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.common; 2 | 3 | import android.media.MediaMetadataRetriever; 4 | import android.media.MediaScannerConnection; 5 | 6 | import com.wyh.ffmpegcmd.util.FileUtil; 7 | 8 | /** 9 | * l 10 | * Created by wyh on 2019/5/12. 11 | */ 12 | public class VideoUtil { 13 | 14 | public static long getVideoDuration(String path) { 15 | MediaMetadataRetriever mmr = new MediaMetadataRetriever(); 16 | mmr.setDataSource(path); 17 | String result = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); 18 | try { 19 | return Long.parseLong(result); 20 | } catch (Exception ignored) { 21 | 22 | } 23 | return 0; 24 | } 25 | 26 | public static int getVideoWidth(String path) { 27 | MediaMetadataRetriever mmr = new MediaMetadataRetriever(); 28 | mmr.setDataSource(path); 29 | String result = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH); 30 | try { 31 | return Integer.parseInt(result); 32 | } catch (Exception ignored) { 33 | 34 | } 35 | return 0; 36 | } 37 | 38 | public static int getVideoHeight(String path) { 39 | MediaMetadataRetriever mmr = new MediaMetadataRetriever(); 40 | mmr.setDataSource(path); 41 | String result = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT); 42 | try { 43 | return Integer.parseInt(result); 44 | } catch (Exception ignored) { 45 | 46 | } 47 | return 0; 48 | } 49 | 50 | /** 51 | * 扫描媒体文件 52 | * 53 | * @param filePath 54 | */ 55 | public static void scanFile(String filePath) { 56 | if (FileUtil.isFileExist(filePath)) { 57 | MediaScannerConnection.scanFile(App.get(), 58 | new String[]{filePath}, null, null); 59 | } 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/EditItem.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit; 2 | 3 | import android.support.annotation.DrawableRes; 4 | 5 | /** 6 | * Created by wyh on 2019/3/17. 7 | */ 8 | public class EditItem { 9 | @DrawableRes 10 | public final int imgRes; 11 | 12 | public final String text; 13 | 14 | public final Class activityClass; 15 | 16 | public EditItem(int imgRes, String text, Class activityClass) { 17 | this.imgRes = imgRes; 18 | this.text = text; 19 | this.activityClass = activityClass; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return "EditItem{" + 25 | "imgRes=" + imgRes + 26 | ", text='" + text + '\'' + 27 | ", activityClass=" + activityClass + 28 | '}'; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/EditMediaListActivity.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.v7.widget.LinearLayoutManager; 6 | import android.support.v7.widget.RecyclerView; 7 | 8 | import com.wyh.ffmpegcmd.R; 9 | import com.wyh.ffmpegcmd.common.Click; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | /** 15 | * Created by wyh on 2019/3/20. 16 | */ 17 | public abstract class EditMediaListActivity extends BaseEditActivity { 18 | 19 | 20 | protected RecyclerView mRecyclerView; 21 | protected ItemMediaAdapter mAdapter; 22 | protected List mMediaFileList; 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | setContentView(R.layout.activity_media_list); 28 | mRecyclerView = findViewById(R.id.recycleView); 29 | mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); 30 | mMediaFileList = new ArrayList<>(); 31 | mAdapter = new ItemMediaAdapter(mMediaFileList); 32 | mRecyclerView.setAdapter(mAdapter); 33 | mAdapter.setEditItemOnClickListener(new Click.OnObjectClickListener() { 34 | @Override 35 | public void onObjectClick(MediaFile mediaFile) { 36 | onMediaFileClick(mediaFile); 37 | } 38 | }); 39 | } 40 | 41 | protected void onMediaFileClick(@NonNull MediaFile mediaFile) { 42 | if (mediaFile.getType() == MediaFile.TYPE_VIDEO) { 43 | playVideo(mediaFile.getPath()); 44 | } else if (mediaFile.getType() == MediaFile.TYPE_AUDIO) { 45 | playAudio(mediaFile.getPath()); 46 | } 47 | } 48 | 49 | 50 | protected void deleteLastMediaFile() { 51 | if (mMediaFileList.size() < 1) { 52 | return; 53 | } 54 | mMediaFileList.remove(mMediaFileList.size() - 1); 55 | mAdapter.notifyItemRemoved(mMediaFileList.size()); 56 | } 57 | 58 | 59 | @Override 60 | protected void onPickFile(@NonNull MediaFile mediaFile) { 61 | super.onPickFile(mediaFile); 62 | mMediaFileList.add(mediaFile); 63 | mAdapter.notifyItemInserted(mMediaFileList.size()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/ItemMediaAdapter.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit; 2 | 3 | import android.support.annotation.NonNull; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.bumptech.glide.Glide; 12 | import com.wyh.ffmpegcmd.R; 13 | import com.wyh.ffmpegcmd.common.Click; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * Created by wyh on 2019/3/17. 19 | */ 20 | public class ItemMediaAdapter extends RecyclerView.Adapter implements View.OnClickListener { 21 | 22 | private List mediaFiles; 23 | 24 | private Click.OnObjectClickListener mMediaFileOnClickListener; 25 | 26 | public ItemMediaAdapter(List mediaFiles) { 27 | this.mediaFiles = mediaFiles; 28 | } 29 | 30 | public void setEditItemOnClickListener(Click.OnObjectClickListener mEditItemOnClickListener) { 31 | this.mMediaFileOnClickListener = mEditItemOnClickListener; 32 | } 33 | 34 | @NonNull 35 | @Override 36 | public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { 37 | View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_media, viewGroup, false); 38 | return new ItemVH(view); 39 | } 40 | 41 | @Override 42 | public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) { 43 | if (viewHolder instanceof ItemVH) { 44 | ItemVH itemVH = (ItemVH) viewHolder; 45 | itemVH.bind(mediaFiles.get(i), i); 46 | } 47 | } 48 | 49 | @Override 50 | public int getItemCount() { 51 | return mediaFiles == null ? 0 : mediaFiles.size(); 52 | } 53 | 54 | @Override 55 | public void onClick(View v) { 56 | if (v.getTag() instanceof MediaFile) { 57 | if (mMediaFileOnClickListener != null) { 58 | mMediaFileOnClickListener.onObjectClick((MediaFile) v.getTag()); 59 | } 60 | } 61 | } 62 | 63 | class ItemVH extends RecyclerView.ViewHolder { 64 | private ImageView mIvMedia; 65 | private TextView mTvMediaTitle; 66 | private TextView mTvMediaPath; 67 | 68 | ItemVH(@NonNull View itemView) { 69 | super(itemView); 70 | mIvMedia = itemView.findViewById(R.id.iv_media); 71 | mTvMediaTitle = itemView.findViewById(R.id.tv_media_title); 72 | mTvMediaPath = itemView.findViewById(R.id.tv_media_path); 73 | itemView.setOnClickListener(ItemMediaAdapter.this); 74 | } 75 | 76 | void bind(MediaFile mediaFile, int pos) { 77 | switch (mediaFile.getType()) { 78 | case MediaFile.TYPE_AUDIO: 79 | Glide.with(mIvMedia).load(R.drawable.audio_black).into(mIvMedia); 80 | break; 81 | case MediaFile.TYPE_VIDEO: 82 | Glide.with(mIvMedia).asBitmap().load(mediaFile.getPath()).into(mIvMedia); 83 | break; 84 | case MediaFile.TYPE_IMG: 85 | Glide.with(mIvMedia).asBitmap().load(mediaFile.getPath()).into(mIvMedia); 86 | break; 87 | } 88 | mTvMediaPath.setText(mediaFile.getPath()); 89 | mTvMediaTitle.setText(mediaFile.getName()); 90 | itemView.setTag(mediaFile); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/MediaFile.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit; 2 | 3 | import android.support.annotation.IntDef; 4 | 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | 8 | /** 9 | * Created by wyh on 2019/3/17. 10 | * 多媒体文件 11 | */ 12 | public class MediaFile { 13 | public static final int TYPE_IMG = 1; 14 | public static final int TYPE_AUDIO = 2; 15 | public static final int TYPE_VIDEO = 3; 16 | 17 | @IntDef({TYPE_IMG, TYPE_AUDIO, TYPE_VIDEO}) 18 | @Retention(RetentionPolicy.SOURCE) 19 | public @interface Type { 20 | } 21 | 22 | private String name; 23 | private String path; 24 | private String thumb; 25 | 26 | @Type 27 | private int type; 28 | 29 | public void setType(@Type int type) { 30 | this.type = type; 31 | } 32 | 33 | @Type 34 | public int getType() { 35 | return type; 36 | } 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | 46 | public String getPath() { 47 | return path; 48 | } 49 | 50 | public void setPath(String path) { 51 | this.path = path; 52 | } 53 | 54 | public String getThumb() { 55 | return thumb; 56 | } 57 | 58 | public void setThumb(String thumb) { 59 | this.thumb = thumb; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/audio/AudioFragment.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit.audio; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.annotation.NonNull; 6 | import android.support.annotation.Nullable; 7 | import android.support.v4.app.Fragment; 8 | import android.support.v7.widget.GridLayoutManager; 9 | import android.support.v7.widget.RecyclerView; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | import android.widget.Toast; 14 | 15 | import com.wyh.ffmpegcmd.R; 16 | import com.wyh.ffmpegcmd.common.Click; 17 | import com.wyh.ffmpegcmd.edit.EditItem; 18 | import com.wyh.ffmpegcmd.edit.EditItemAdapter; 19 | 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | /** 24 | * Created by wyh on 2019/3/17. 25 | */ 26 | public class AudioFragment extends Fragment { 27 | public static final String TAG = "AudioFragment"; 28 | public static final String TITLE = "Audio"; 29 | 30 | private RecyclerView mRecycleView; 31 | private EditItemAdapter mAdapter; 32 | private List mEditItemList; 33 | 34 | 35 | public static AudioFragment newInstance() { 36 | Bundle args = new Bundle(); 37 | AudioFragment fragment = new AudioFragment(); 38 | fragment.setArguments(args); 39 | return fragment; 40 | } 41 | 42 | @Override 43 | public void onCreate(@Nullable Bundle savedInstanceState) { 44 | super.onCreate(savedInstanceState); 45 | mEditItemList = new ArrayList<>(); 46 | // mEditItemList.add(new EditItem(R.drawable.ic_trans_code_black_24dp, 47 | // AudioTransCodeActivity.TITLE, AudioTransCodeActivity.class)); 48 | mEditItemList.add(new EditItem(R.drawable.ic_call_merge_audio_24dp, 49 | AudioMixActivity.TITLE, AudioMixActivity.class)); 50 | } 51 | 52 | @Nullable 53 | @Override 54 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 55 | return inflater.inflate(R.layout.fragment_edit_list, container, false); 56 | } 57 | 58 | @Override 59 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { 60 | super.onViewCreated(view, savedInstanceState); 61 | mRecycleView = view.findViewById(R.id.recycleView); 62 | GridLayoutManager manager = new GridLayoutManager(getContext(), 3); 63 | mRecycleView.setLayoutManager(manager); 64 | mAdapter = new EditItemAdapter(mEditItemList); 65 | mRecycleView.setAdapter(mAdapter); 66 | mAdapter.setEditItemOnClickListener(new Click.OnObjectClickListener() { 67 | @Override 68 | public void onObjectClick(EditItem editItem) { 69 | Intent intent = new Intent(getContext(), editItem.activityClass); 70 | if (getContext() != null) { 71 | getContext().startActivity(intent); 72 | } 73 | } 74 | }); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/audio/AudioMixActivity.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit.audio; 2 | 3 | import android.view.Menu; 4 | 5 | import com.wyh.ffmpegcmd.edit.EditMediaListActivity; 6 | import com.wyh.ffmpegcmd.edit.MediaFile; 7 | import com.wyh.ffmpegcmd.ffmpeg.Callback; 8 | import com.wyh.ffmpegcmd.ffmpeg.FFmpegAudio; 9 | import com.wyh.ffmpegcmd.util.DateUtil; 10 | import com.wyh.ffmpegcmd.util.FileUtil; 11 | 12 | import java.io.File; 13 | import java.util.ArrayList; 14 | import java.util.Date; 15 | import java.util.List; 16 | 17 | public class AudioMixActivity extends EditMediaListActivity { 18 | 19 | public static final String TITLE = "混音"; 20 | 21 | @Override 22 | protected String getEditTitle() { 23 | return TITLE; 24 | } 25 | 26 | @Override 27 | protected void createOptionsMenu(Menu menu) { 28 | menu.add("添加音频"); 29 | menu.add("删除音频"); 30 | menu.add("开始"); 31 | } 32 | 33 | @Override 34 | protected void onMenuClick(int order) { 35 | if (order == 0) { 36 | pickAudio(); 37 | } else if (order == 1) { 38 | deleteLastMediaFile(); 39 | } else if (order == 2) { 40 | if (mMediaFileList.size() < 2) { 41 | showErrorSnack("请添加音频"); 42 | return; 43 | } 44 | run(mMediaFileList); 45 | } 46 | } 47 | 48 | private void run(List mediaFileList) { 49 | showLoadingDialog(); 50 | final String outputAudio = FileUtil.OUTPUT_AUDIO_DIR + File.separator + 51 | "mix_" + DateUtil.format(new Date()) + ".mp3"; 52 | List audioPaths = new ArrayList<>(); 53 | for (int i = 0; i < mediaFileList.size(); i++) { 54 | if (i == 0) { 55 | continue; 56 | } 57 | audioPaths.add(mediaFileList.get(i).getPath()); 58 | } 59 | FFmpegAudio.mixAudio(mediaFileList.get(0).getPath(), audioPaths, outputAudio, new Callback() { 60 | @Override 61 | public void onSuccess() { 62 | dismissLoadingDialog(); 63 | showSaveDoneAndPlayDialog(outputAudio, false); 64 | } 65 | @Override 66 | public void onLog(String log) { 67 | 68 | } 69 | 70 | @Override 71 | public void onFail() { 72 | dismissLoadingDialog(); 73 | showErrorSnack("合成失败"); 74 | } 75 | }); 76 | } 77 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/audio/AudioTransCodeActivity.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit.audio; 2 | 3 | import android.view.Menu; 4 | 5 | import com.wyh.ffmpegcmd.edit.EditMediaListActivity; 6 | 7 | /** 8 | * Created by wyh on 2019/3/20. 9 | */ 10 | public class AudioTransCodeActivity extends EditMediaListActivity { 11 | 12 | public static final String TITLE = "音频转码"; 13 | 14 | 15 | @Override 16 | protected String getEditTitle() { 17 | return TITLE; 18 | } 19 | 20 | @Override 21 | protected void createOptionsMenu(Menu menu) { 22 | menu.add("选择音频"); 23 | menu.add("删除"); 24 | menu.add("开始"); 25 | } 26 | 27 | @Override 28 | protected void onMenuClick(int order) { 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/video/AudioDeMuxActivity.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit.video; 2 | 3 | import android.support.annotation.NonNull; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.Menu; 9 | 10 | import com.wyh.ffmpegcmd.R; 11 | import com.wyh.ffmpegcmd.edit.BaseEditActivity; 12 | import com.wyh.ffmpegcmd.edit.EditMediaListActivity; 13 | import com.wyh.ffmpegcmd.edit.ItemMediaAdapter; 14 | import com.wyh.ffmpegcmd.edit.MediaFile; 15 | import com.wyh.ffmpegcmd.ffmpeg.Callback; 16 | import com.wyh.ffmpegcmd.ffmpeg.FFmpegAudio; 17 | import com.wyh.ffmpegcmd.ffmpeg.FFmpegVideo; 18 | import com.wyh.ffmpegcmd.util.DateUtil; 19 | import com.wyh.ffmpegcmd.util.FileUtil; 20 | import com.wyh.ffmpegcmd.util.SnackBarUtil; 21 | 22 | import java.io.File; 23 | import java.util.ArrayList; 24 | import java.util.Date; 25 | import java.util.List; 26 | 27 | public class AudioDeMuxActivity extends EditMediaListActivity { 28 | private static final String TAG = "VideoDeMuxActivity"; 29 | public static final String TITLE = "提取音频"; 30 | 31 | 32 | @Override 33 | protected String getEditTitle() { 34 | return TITLE; 35 | } 36 | 37 | @Override 38 | protected void createOptionsMenu(Menu menu) { 39 | menu.add("选择视频"); 40 | menu.add("删除"); 41 | menu.add("开始"); 42 | } 43 | 44 | @Override 45 | protected void onMenuClick(int order) { 46 | if (order == 0) { 47 | if (mMediaFileList.size() == 1) { 48 | SnackBarUtil.showError(mRoot, "已选择视频"); 49 | return; 50 | } 51 | pickVideo(); 52 | } else if (order == 1) { 53 | deleteLastMediaFile(); 54 | } else { 55 | if (mMediaFileList.size() == 0) { 56 | SnackBarUtil.showError(mRoot, "请选择视频"); 57 | return; 58 | } 59 | run(); 60 | } 61 | } 62 | 63 | private void run() { 64 | showLoadingDialog(); 65 | final String output = FileUtil.OUTPUT_AUDIO_DIR + File.separator + 66 | "demux_" + DateUtil.format(new Date()) + ".aac"; 67 | FFmpegVideo.demuxAudio(mMediaFileList.get(0).getPath(), output, new Callback() { 68 | @Override 69 | public void onSuccess() { 70 | dismissLoadingDialog(); 71 | showSaveDoneAndPlayDialog(output, false); 72 | } 73 | @Override 74 | public void onLog(String log) { 75 | 76 | } 77 | 78 | @Override 79 | public void onFail() { 80 | dismissLoadingDialog(); 81 | } 82 | }); 83 | } 84 | 85 | 86 | } 87 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/video/VideoDeMuxActivity.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit.video; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.v7.widget.LinearLayoutManager; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.view.Menu; 8 | 9 | import com.wyh.ffmpegcmd.R; 10 | import com.wyh.ffmpegcmd.edit.BaseEditActivity; 11 | import com.wyh.ffmpegcmd.edit.EditMediaListActivity; 12 | import com.wyh.ffmpegcmd.edit.ItemMediaAdapter; 13 | import com.wyh.ffmpegcmd.edit.MediaFile; 14 | import com.wyh.ffmpegcmd.ffmpeg.Callback; 15 | import com.wyh.ffmpegcmd.ffmpeg.FFmpegVideo; 16 | import com.wyh.ffmpegcmd.util.DateUtil; 17 | import com.wyh.ffmpegcmd.util.FileUtil; 18 | import com.wyh.ffmpegcmd.util.SnackBarUtil; 19 | 20 | import java.io.File; 21 | import java.util.ArrayList; 22 | import java.util.Date; 23 | import java.util.List; 24 | 25 | public class VideoDeMuxActivity extends EditMediaListActivity { 26 | private static final String TAG = "VideoDeMuxActivity"; 27 | public static final String TITLE = "提取视频"; 28 | 29 | @Override 30 | protected String getEditTitle() { 31 | return TITLE; 32 | } 33 | 34 | @Override 35 | protected void createOptionsMenu(Menu menu) { 36 | menu.add("选择视频"); 37 | menu.add("删除"); 38 | menu.add("开始"); 39 | } 40 | 41 | 42 | @Override 43 | protected void onMenuClick(int order) { 44 | if (order == 0) { 45 | if (mMediaFileList.size() == 1) { 46 | SnackBarUtil.showError(mRoot, "已选择视频"); 47 | return; 48 | } 49 | pickVideo(); 50 | } else if (order == 1) { 51 | deleteLastMediaFile(); 52 | } else { 53 | if (mMediaFileList.size() == 0) { 54 | SnackBarUtil.showError(mRoot, "请选择视频"); 55 | return; 56 | } 57 | run(); 58 | } 59 | } 60 | 61 | private void run() { 62 | showLoadingDialog(); 63 | final String output = FileUtil.OUTPUT_VIDEO_DIR + File.separator + 64 | "demux_" + DateUtil.format(new Date()) + ".mp4"; 65 | FFmpegVideo.demuxVideo(mMediaFileList.get(0).getPath(), output, new Callback() { 66 | @Override 67 | public void onSuccess() { 68 | dismissLoadingDialog(); 69 | showSaveDoneAndPlayDialog(output, true); 70 | } 71 | 72 | @Override 73 | public void onLog(String log) { 74 | 75 | } 76 | 77 | @Override 78 | public void onFail() { 79 | dismissLoadingDialog(); 80 | 81 | } 82 | }); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/video/VideoFlipActivity.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit.video; 2 | 3 | import android.view.Menu; 4 | 5 | import com.wyh.ffmpegcmd.common.VideoUtil; 6 | import com.wyh.ffmpegcmd.edit.EditMediaListActivity; 7 | import com.wyh.ffmpegcmd.edit.MediaFile; 8 | import com.wyh.ffmpegcmd.ffmpeg.Callback; 9 | import com.wyh.ffmpegcmd.ffmpeg.FFmpegVideo; 10 | import com.wyh.ffmpegcmd.util.FileUtil; 11 | import com.wyh.ffmpegcmd.util.SnackBarUtil; 12 | 13 | import java.io.File; 14 | import java.util.List; 15 | 16 | /** 17 | * Created by wyh on 2019/3/20. 18 | */ 19 | public class VideoFlipActivity extends EditMediaListActivity { 20 | 21 | private static final String TAG = "VideoFlipActivity"; 22 | 23 | public static final String TITLE = "视频镜像"; 24 | 25 | 26 | @Override 27 | protected String getEditTitle() { 28 | return TITLE; 29 | } 30 | 31 | @Override 32 | protected void createOptionsMenu(Menu menu) { 33 | menu.add("选择视频"); 34 | menu.add("删除视频"); 35 | menu.add("上下翻转"); 36 | menu.add("左右翻转"); 37 | } 38 | 39 | @Override 40 | protected void onMenuClick(int order) { 41 | if (order == 0) { 42 | if (mMediaFileList.size() == 1) { 43 | SnackBarUtil.showError(mRoot, "已选择视频"); 44 | return; 45 | } 46 | pickVideo(); 47 | } else if (order == 1) { 48 | deleteLastMediaFile(); 49 | } else if (order == 2) { 50 | run(mMediaFileList, true); 51 | } else if (order == 3) { 52 | run(mMediaFileList, false); 53 | } 54 | } 55 | 56 | private void run(List mMediaFileList, boolean vertical) { 57 | final String output = FileUtil.OUTPUT_VIDEO_DIR + File.separator + 58 | "flip_" + TAG + ".mp4"; 59 | showLoadingDialog(); 60 | FFmpegVideo.flipVideo(mMediaFileList.get(0).getPath(), 61 | output, vertical, new Callback() { 62 | @Override 63 | public void onLog(String log) { 64 | 65 | } 66 | 67 | @Override 68 | public void onSuccess() { 69 | dismissLoadingDialog(); 70 | showSaveDoneAndPlayDialog(output, true); 71 | } 72 | 73 | @Override 74 | public void onFail() { 75 | dismissLoadingDialog(); 76 | SnackBarUtil.showError(mRoot, "合成失败"); 77 | } 78 | }); 79 | 80 | } 81 | 82 | 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/edit/video/VideoWaterMarkActivity.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.edit.video; 2 | 3 | import android.view.Menu; 4 | 5 | import com.wyh.ffmpegcmd.common.App; 6 | import com.wyh.ffmpegcmd.edit.EditMediaListActivity; 7 | import com.wyh.ffmpegcmd.edit.MediaFile; 8 | import com.wyh.ffmpegcmd.ffmpeg.Callback; 9 | import com.wyh.ffmpegcmd.ffmpeg.FFmpegVideo; 10 | import com.wyh.ffmpegcmd.util.FileUtil; 11 | import com.wyh.ffmpegcmd.util.SnackBarUtil; 12 | 13 | import java.io.File; 14 | 15 | /** 16 | * Created by wyh on 2019/3/18. 17 | */ 18 | public class VideoWaterMarkActivity extends EditMediaListActivity { 19 | private static final String TAG = "VideoWaterMarkActivity"; 20 | public static final String TITLE = "加水印"; 21 | 22 | 23 | @Override 24 | protected String getEditTitle() { 25 | return TITLE; 26 | } 27 | 28 | @Override 29 | protected void createOptionsMenu(Menu menu) { 30 | menu.add("选择视频"); 31 | menu.add("删除"); 32 | menu.add("添加水印"); 33 | } 34 | 35 | @Override 36 | protected void onMenuClick(int order) { 37 | if (order == 0) { 38 | for (MediaFile file : mMediaFileList) { 39 | if (file.getType() == MediaFile.TYPE_VIDEO) { 40 | SnackBarUtil.showError(mRoot, "已经选择视频了"); 41 | return; 42 | } 43 | } 44 | pickVideo(); 45 | } else if (order == 1) { 46 | deleteLastMediaFile(); 47 | } else { 48 | if (mMediaFileList.size() == 0) { 49 | SnackBarUtil.showError(mRoot, "未选择视频"); 50 | return; 51 | } 52 | showLoadingDialog(); 53 | 54 | File file = new File(FileUtil.OUTPUT_VIDEO_DIR + File.separator + 55 | "watermark.jpg"); 56 | if (!file.exists()) { 57 | FileUtil.copyFromAssets(App.get(), "mark.jpg", file.getAbsolutePath()); 58 | } 59 | final String output = FileUtil.OUTPUT_VIDEO_DIR + File.separator + 60 | "watermark_" + TAG + ".mp4"; 61 | FFmpegVideo.addWaterMark(mMediaFileList.get(0).getPath(), 62 | file.getAbsolutePath(), 1, output, new Callback() { 63 | @Override 64 | public void onSuccess() { 65 | dismissLoadingDialog(); 66 | showSaveDoneAndPlayDialog(output, true); 67 | } 68 | 69 | @Override 70 | public void onLog(String log) { 71 | } 72 | 73 | @Override 74 | public void onFail() { 75 | dismissLoadingDialog(); 76 | } 77 | }); 78 | } 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/ffmpeg/Callback.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.ffmpeg; 2 | 3 | /** 4 | * Created by wyh on 2019/3/13. 5 | */ 6 | public interface Callback { 7 | 8 | void onLog(String log); 9 | 10 | void onSuccess(); 11 | 12 | void onFail(); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/ffmpeg/FFmpegApi.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.ffmpeg; 2 | 3 | public class FFmpegApi { 4 | private static final String TAG = "FFmpegApi"; 5 | 6 | /* 7 | * 获取视频信息步骤: 8 | * 1.open(String url) 9 | * 2.getXXX() 10 | * 3.close 11 | **/ 12 | public static boolean openVideo(String url) { 13 | int ret = open(url); 14 | return ret >= 0; 15 | } 16 | 17 | //ms 18 | public static long getDuration() { 19 | return getVideoDuration(); 20 | } 21 | 22 | public static int getWidth() { 23 | return getVideoWidth(); 24 | } 25 | 26 | public static int getHeight() { 27 | return getVideoHeight(); 28 | } 29 | 30 | public static double getRotation() { 31 | return getVideoRotation(); 32 | } 33 | 34 | public static native double getVideoRotation(); 35 | 36 | public static native int open(String url); 37 | 38 | private static native long getVideoDuration(); 39 | 40 | public static native int getVideoWidth(); 41 | 42 | public static native int getVideoHeight(); 43 | 44 | public static native String getVideoCodecName(); 45 | 46 | public static native void close(); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/ffmpeg/FFmpegAudio.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.ffmpeg; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by wyh on 2019/3/14. 8 | * 音频编辑 9 | */ 10 | public class FFmpegAudio { 11 | 12 | /** 13 | * 混音 14 | * 15 | * @param srcAudioPath 原音 16 | * @param audioPathList 目标音 17 | * @param outputPath 输出目录 18 | */ 19 | public static void mixAudio(String srcAudioPath, List audioPathList, String outputPath, Callback callback) { 20 | ArrayList commandList = new ArrayList<>(); 21 | commandList.add("ffmpeg"); 22 | commandList.add("-i"); 23 | commandList.add(srcAudioPath); 24 | for (String audioPath : audioPathList) { 25 | commandList.add("-i"); 26 | commandList.add(audioPath); 27 | } 28 | commandList.add("-filter_complex"); 29 | commandList.add("amix=inputs=" + (audioPathList.size() + 1) + ":duration=first:dropout_transition=1"); 30 | commandList.add("-f"); 31 | commandList.add("mp3"); 32 | commandList.add("-ac");//声道数 33 | commandList.add("1"); 34 | commandList.add("-ar"); //采样率 35 | commandList.add("24k"); 36 | commandList.add("-ab");//比特率 37 | commandList.add("32k"); 38 | commandList.add("-y"); 39 | commandList.add(outputPath); 40 | FFmpeg.getInstance().run(commandList, callback); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/ffmpeg/FFmpegJni.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.ffmpeg; 2 | 3 | import com.wyh.ffmpegcmd.common.Logger; 4 | 5 | /** 6 | * Created by wyh on 2019/3/12. 7 | */ 8 | public final class FFmpegJni { 9 | private FFmpegJni() { 10 | 11 | } 12 | 13 | // Used to load the 'native-lib' library on application startup. 14 | static { 15 | System.loadLibrary("ffmpeg"); 16 | System.loadLibrary("cmd-ffmpeg"); 17 | } 18 | 19 | public static native int execute(String[] commands); 20 | 21 | public static native String getLog(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/util/DateUtil.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.util; 2 | 3 | import android.support.annotation.IntDef; 4 | import android.support.annotation.StringDef; 5 | 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.text.SimpleDateFormat; 9 | import java.util.Date; 10 | import java.util.Locale; 11 | import java.util.TimeZone; 12 | 13 | /** 14 | * Created by wyh on 2019/3/18. 15 | */ 16 | public class DateUtil { 17 | 18 | public static final String FORMAT_TIME_EN = "yyyy-MM-dd-HH-mm-ss"; 19 | 20 | @StringDef({FORMAT_TIME_EN}) 21 | @Retention(RetentionPolicy.SOURCE) 22 | public @interface FORMAT { 23 | } 24 | 25 | private static final SimpleDateFormat SDF = new SimpleDateFormat(FORMAT_TIME_EN, Locale.CHINA); 26 | 27 | 28 | public static String format(@FORMAT String timeFormat, Date date) { 29 | SDF.setTimeZone(TimeZone.getDefault()); 30 | SDF.applyPattern(timeFormat); 31 | return SDF.format(date); 32 | } 33 | 34 | public static String format(Date date) { 35 | return format(FORMAT_TIME_EN, date); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/util/KeyBoardUtil.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.util; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.view.View; 6 | import android.view.inputmethod.InputMethodManager; 7 | import android.widget.EditText; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * 打开或关闭软键盘 13 | * 14 | * @author zhy 15 | */ 16 | public class KeyBoardUtil { 17 | /** 18 | * 打卡软键盘 19 | * 20 | * @param mEditText 输入框 21 | */ 22 | public static void showKeybord(EditText mEditText) { 23 | InputMethodManager imm = (InputMethodManager) mEditText.getContext() 24 | .getSystemService(Context.INPUT_METHOD_SERVICE); 25 | if (imm != null) { 26 | imm.showSoftInput(mEditText, InputMethodManager.RESULT_SHOWN); 27 | imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 28 | InputMethodManager.HIDE_IMPLICIT_ONLY); 29 | } 30 | } 31 | 32 | /** 33 | * 关闭软键盘 34 | * 35 | * @param mEditText 输入框 36 | */ 37 | public static void hideSoftKeyboard(EditText mEditText) { 38 | InputMethodManager imm = (InputMethodManager) mEditText.getContext() 39 | .getSystemService(Context.INPUT_METHOD_SERVICE); 40 | 41 | if (imm != null) { 42 | imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0); 43 | } 44 | } 45 | 46 | /** 47 | * 隐藏软键盘(只适用于Activity,不适用于Fragment) 48 | */ 49 | public static void hideSoftKeyboard(Activity activity) { 50 | View view = activity.getCurrentFocus(); 51 | if (view != null) { 52 | InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE); 53 | if (inputMethodManager != null) { 54 | inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); 55 | } 56 | } 57 | } 58 | 59 | /** 60 | * 隐藏软键盘(可用于Activity,Fragment) 61 | */ 62 | public static void hideSoftKeyboard(Context context, List viewList) { 63 | if (viewList == null) return; 64 | 65 | InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); 66 | 67 | for (View v : viewList) { 68 | if (inputMethodManager != null) { 69 | inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/util/SnackBarUtil.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.util; 2 | 3 | import android.graphics.Color; 4 | import android.support.design.widget.Snackbar; 5 | import android.view.View; 6 | import android.widget.TextView; 7 | 8 | import com.wyh.ffmpegcmd.R; 9 | 10 | /** 11 | * Created by wyh on 2019/3/18. 12 | */ 13 | public class SnackBarUtil { 14 | 15 | public static void showInfo(View root, String message) { 16 | Snackbar snackbar = Snackbar.make(root, message, Snackbar.LENGTH_SHORT); 17 | setSnackBarColor(snackbar, Color.WHITE, Color.BLACK); 18 | snackbar.show(); 19 | } 20 | 21 | 22 | public static void showError(View root, String message) { 23 | Snackbar snackbar = Snackbar.make(root, message, Snackbar.LENGTH_SHORT); 24 | setSnackBarColor(snackbar, Color.WHITE, Color.RED); 25 | snackbar.show(); 26 | } 27 | 28 | 29 | /** 30 | * 设置文字和背景颜色 31 | */ 32 | public static void setSnackBarColor(Snackbar snackbar, int textColor, int backgroundColor) { 33 | View view = snackbar.getView(); 34 | view.setBackgroundColor(backgroundColor); 35 | ((TextView) view.findViewById(R.id.snackbar_text)).setTextColor(textColor); 36 | } 37 | 38 | /** 39 | * 设置背景颜色 40 | */ 41 | public static void setSnackBarColor(Snackbar snackbar, int backgroundColor) { 42 | View view = snackbar.getView(); 43 | view.setBackgroundColor(backgroundColor); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/util/StorageUtils.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.util; 2 | 3 | import android.os.Environment; 4 | 5 | /** 6 | * Created by wyh on 2019/5/12. 7 | */ 8 | public class StorageUtils { 9 | 10 | /** 11 | * 判断存储卡是否可读 12 | * @return true可读,false不可读 13 | */ 14 | public static boolean isExternalStorageReadable() { 15 | final String state = Environment.getExternalStorageState(); 16 | return state.equals(Environment.MEDIA_MOUNTED) || state.equals(Environment.MEDIA_MOUNTED_READ_ONLY); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/util/ToastUtil.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.util; 2 | 3 | import android.widget.Toast; 4 | 5 | import com.wyh.ffmpegcmd.common.App; 6 | 7 | /** 8 | * Created by wyh on 2019/3/17. 9 | */ 10 | public class ToastUtil { 11 | public static void show(String text) { 12 | Toast.makeText(App.get(), text, Toast.LENGTH_SHORT).show(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/wyh/ffmpegcmd/util/ViewUtil.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd.util; 2 | 3 | import android.view.View; 4 | import android.view.ViewGroup; 5 | 6 | public class ViewUtil { 7 | 8 | 9 | public static void setViewWidth(View view, int width) { 10 | ViewGroup.LayoutParams params = view.getLayoutParams(); 11 | params.width = width; 12 | view.setLayoutParams(params); 13 | } 14 | 15 | public static void setViewHeight(View view, int height) { 16 | ViewGroup.LayoutParams params = view.getLayoutParams(); 17 | params.height = height; 18 | view.setLayoutParams(params); 19 | } 20 | 21 | public static void setViewSize(View view, int width, int height) { 22 | ViewGroup.LayoutParams params = view.getLayoutParams(); 23 | params.width = width; 24 | params.height = height; 25 | view.setLayoutParams(params); 26 | } 27 | 28 | public static void setViewBottomMargin(View view, int margin) { 29 | if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) { 30 | ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams(); 31 | if (layoutParams.bottomMargin != margin) { 32 | layoutParams.bottomMargin = margin; 33 | view.setLayoutParams(layoutParams); 34 | } 35 | } 36 | } 37 | 38 | public static void setViewTopMargin(View view, int margin) { 39 | if (view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) { 40 | ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams(); 41 | if (layoutParams.topMargin != margin) { 42 | layoutParams.topMargin = margin; 43 | view.setLayoutParams(layoutParams); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/audio_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/drawable-xxhdpi/audio_black.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/drawable-xxhdpi/video.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/video_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/drawable-xxhdpi/video_black.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/dialog_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dialog_bottom_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_audiotrack_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_call_merge_audio_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_demux_audio_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_demux_video_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_filter_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_more_horiz_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_ondemand_video_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_person_outline_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_trans_code_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_un_logo_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_video_puzz_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_video_watermark_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/progress_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 20 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_media_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 21 | 22 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_edit_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_edit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 19 | 26 | 27 | 33 | 34 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_media.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 32 | 33 | 45 | 46 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/res/layout/save_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | 18 | 26 | 27 | 39 | 40 | 48 | 49 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #111111 4 | #000 5 | #E1F5FE 6 | #A1E1F5FE 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FFEditor 3 | 4 | 5 | 6 | \n 7 | \t FFEditor 即 FFmpeg Editor,表示基于 FFmpeg 实现。 FFmpeg 是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序,它提供了录制、转换以及流化音视频的完整解决方案,采用 LGPL/GPL 许可证。 \n 8 | \t GPL 是 GNU General Public License(GNU 通用公共许可证)的缩写形式;LGPL 是 GNU Lesser General Public License (GNU 宽通用公共许可证)的缩写形式。它们是自由软件(Free Software)的通用版权认证协议。基于 GPL 的软件允许商业化销售,但不允许封闭源代码。如果您对遵循GPL的软件进行任何改动和/或再次开发并予以发布,则您的产品必须继承 GPL 协议,不允许封闭源代码。\n 9 | \t 基于 LGPL 的软件也允许商业化销售,但不允许封闭源代码。如果您对遵循 LGPL 的软件进行任何改动和/或再次开发并予以发布,则您的产品必须继承LGPL协议,不允许封闭源代码。但是如果您的程序对遵循 LGPL 的软件进行任何连接、调用而不是包含,则允许封闭源代码。\n 10 | \n\n\n\n\n 11 | 关于我:\n 12 | Code: https://github.com/yhaolpz \n 13 | Email: yhaowa@outlook.com \n 14 | Blog: https://yhaolpz.github.io \n 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/xml/file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/test/java/com/wyh/ffmpegcmd/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.wyh.ffmpegcmd; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.3.1' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | 15 | 16 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhaolpz/FFmpegCmd/0fa62bd9a02eeda8e251d7fd5f56758040eeeb45/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Mar 12 23:50:52 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------