Compare commits

...

720 Commits

Author SHA1 Message Date
Taner Şener 7a9c62f556 Update FUNDING.yml 2021-10-07 09:42:47 +01:00
Taner Şener df463626f1 Update README.md 2021-04-16 17:58:12 +01:00
Taner Şener 94607015d9 Update README.md 2021-04-16 17:55:12 +01:00
Taner Şener 7710133dcf Add the link of medium article to the README 2021-04-16 17:54:43 +01:00
Taner Sener b0c3d5bb27 announce the retirement 2021-04-13 20:19:53 +01:00
Taner Sener 0dbbc5e11f Add mavenCentral() links 2021-02-07 20:51:34 +00:00
Taner Sener 195a809cca fix android async example 2020-11-03 22:24:10 +00:00
Taner Sener 0aae541e81 support iOS 14, fixes #553 2020-09-26 15:31:46 +01:00
Pete dda06154f1 Update arch-common.sh (#534)
* Update arch-common.sh

x265 download on Bitbucket no longer works. Use GitHub link instead
2020-08-24 13:50:51 +01:00
Taner Sener 725aef963c update the packaging for android arm-v7a and arm-v7a-neon architectures and remove custom abi rules for releases, fixes #511 2020-08-03 19:34:53 +01:00
Taner Sener 94adca685e fix proguard rules, fixes #508 2020-08-03 19:34:45 +01:00
Taner Şener 4f6e484d5b merge v4.4 to master (#503)
* cleanup openh264 build

* apply 'use build host and target host in build scripts' efe1c59a

* remove custom common_includes

The includes are handled by llvm via --sysroot parameter.

* remove unnecessary parameters for make command

using the names of compiler tools same way as they are used (without full path) for ffmpeg build

* let AndroidStudio manage project root

* import cpufeatures from NDK

* Enable stale action

* Use JSON parsing in getMediaInformation, fixes #417

* Remove internal log line limit on Android, fixes #418

* add support for vo-amrwbenc, fixes #381

* Enable all gpl libraries when both --full and --enable-gpl flags are present, fixes #394

* let the project be opened and managed in Android Studio

* bring in cpu_features as a submodule

* add cpu_features script

and some helper fuctions to android-common

* fix lint errors

* use cpu_features script

it's a regular library, only it's enabled by default

* import cpu_features into Android.mk

also clean up the Android.mk files a bit
also, import libc++_shared correctly, so that it is packed in AAR

* fix Android.lts.mk

* with NDK r20 and higher, openh264.a does not depend on libc++

* Revert "with NDK r20 and higher, openh264.a does not depend on libc++"

This reverts commit dc751016

* Revert a (small) portion of commit e77f8971

On lower API, openh264 depends on libc++_shared. Here, for simplicity, we force this dependency for all API levels.

* LTS: fix the static constructor blocks to handle the changed name of the cpu features library

Also, add ffmpeg dependencies for lower APIs (how did it work before?)
Also, just try to load c++_shared if it is present, not trying to guess whether the external libraries require it (android.sh will still make the decision to add c++_shared to dependencies list based on the list of external libraries).

* switch the submodule to fork

* rename the submodule library

* scripts changed for renamed libary and move cpu-features to slot 47

create_cpufeatures_package_config moved back to android-common.sh
android_ndk_cmake to handle generic Android-NDK toolchain invocation of cmake

* update the Android.mk files to reflect cpu-features rename

also, remove unnecessary dependencies

* fix for LTS

* not needed anymore

* revert the commit 740fd2e9

load of c++_shared determined by the list of enabled external libraries

* Using static lib for Google cpu-features

* let openh264 work with external cpu-features

compatible with NDK deperecated implementation and with ndk_compat from https://github.com/google/cpu_features

* set packages path

* make android-cpu-features.sh executable

* automatically update submodules from android.sh

* disable publishing to bintray

* bump version

* list cpu-features after builtin libraries

* fix javadoc warnings

* disable stripping of debug symbols for ffmpeg, fixes #447

* do not detach main thread on error cases, fixes #446

* release unreleased utf strings in setNativeEnvironmentVariable(), fixes #443

* implement toString() method for Statistics and LogMessage classes, fixes #438

* do not install lldb for android in travis builds

* fix travis builds

* remove unused test resources

* switch src/cpu-features remote to google/cpu_features

* switch expat source code with expat submodule

* update submodules in top level build scripts

* switch openh264 source code with openh264 submodule

* implement bash functions to download external libraries

* implement ignoreSignal api method, fixes #258, #214

* use the latest android ndk

* disable avfoundation device for ios lts releases, fixes #462

* update ios test-app versions

* implement an api method to set environment variables, fixes #466

* update release scripts to use the latest ndk version

* update stale.yml

* implement ffmpeg async api

* add executionId to log and statistic callbacks

* fix ndk version in travis

* fix test commands in android test app

* fix android env variables  in travis

* switch to personal fork for cpu-features, use in-repo sources for expat and openh264

* introduce an api method to list ongoing executions

* use a thread safe implementation to list ongoing executions

* add startTime to FFmpegExecution class

* test openh264 in ios/tvos test applications

* use new x265 version v3.4

* use new x264 version v20200630-stable

* use new chromaprint version v1.5.0

* use new wavpack version v5.3.0

* use new kvazaar version v2.0.0

* use new libvorbis version v1.3.7

* use new nettle version v3.6

* use new libjpeg-turbo version v2.0.5

* use new ffmpeg version v4.4-dev-416-g1998d1d6af

* remove coreimage references on ios/tvos, fixes #480

* use new freetype version 2.10.2

* enable redownloading of ffmpeg source code

* freeze v4.4

* disable building of audiotoolbox output device on ios/tvos

* do not process log lines with zero length on ios/tvos

* update libsamplerate build workarounds

* do not print parsing exceptions for not found keys on android

* synchronize updating lastCommandOutput on ios/tvos, fixes #494

* introduce execution specific log levels, fixes #495

* fix x265 compilation errors on ios/tvos

* fix android lts neon packaging

* fix processing of ios/tvos flags

* fix mobile-ffmpeg videotoolbox flags for tvos

* release v4.4.LTS

* use v4.4.LTS in test applications

* fix ios/tvos system library indexes in ffmpeg build scripts

* update ios test-app settings

* fix android release packaging script

* Update README

Co-authored-by: alexcohn <sasha.cohn@gmail.com>
2020-07-29 21:28:04 +01:00
Taner Sener 8bc3165083 Update stale.yml 2020-05-09 01:22:59 +01:00
Taner Sener 6d3cdcf35f Enable stale action 2020-05-08 14:27:59 +01:00
Taner Sener fc032eb014 Merge pull request #408 from tanersener/development
Development
2020-04-30 01:02:30 +01:00
Taner Sener d09b4378e7 add git check in top level build scripts 2020-04-30 01:01:25 +01:00
Taner Sener 4ad203d8ef update ios assets for dependencies 2020-04-18 00:42:28 +01:00
Taner Sener 72cd70e60b update android.sh desription 2020-04-17 00:44:00 +01:00
Taner Sener 904e9def33 Merge pull request #385 from tanersener/development
merge project page changes
2020-04-17 00:15:17 +01:00
Taner Sener 6cf3de77fb update project page 2020-04-17 00:13:56 +01:00
Taner Sener 2169d5af99 merge v4.3.2 2020-04-16 23:51:07 +01:00
Taner Sener 90a30b68e2 Merge branch 'master' into development 2020-04-16 23:45:55 +01:00
Taner Sener 5b3816b121 update README 2020-04-16 23:20:57 +01:00
Taner Sener c373dc32e0 update build numbers for ios/tvos test apps 2020-04-16 12:33:51 +01:00
Taner Sener c679de1af7 fix ios/tvos main release scripts 2020-04-16 12:33:51 +01:00
Taner Sener bdcee571bb use v4.3.2 in android test-app 2020-04-15 23:15:07 +01:00
Taner Sener 00233e707d fix gnutls build errors 2020-04-15 00:34:56 +01:00
Taner Sener c658b6af61 patch avfoundation.m for ios 2020-04-14 23:12:48 +01:00
Taner Sener 740a290a71 freeze v4.3.2 2020-04-14 21:44:22 +01:00
Taner Sener 9627fe43c3 set a fixed NDK version in build.gradle 2020-04-14 20:35:38 +01:00
Taner Sener df6dd51b7d use new ffmpeg version v4.3-dev-2955-g19a16330f4 2020-04-13 22:04:51 +01:00
Taner Sener 6b8f83b9ff use new x264 version v20200409-stable 2020-04-13 21:51:15 +01:00
Taner Sener 50c91e58be use new x265 version v3.3 2020-04-13 21:44:11 +01:00
Taner Sener 14ffa7ee35 use new gmp version v6.2.0 2020-04-13 21:39:32 +01:00
Taner Sener 23948da2de use new gnutls version v3.6.13 2020-04-13 21:31:59 +01:00
Taner Sener 56621fbffb use new openh264 version v2.1.0 2020-04-13 21:26:43 +01:00
Taner Sener 3c398cb8a0 use new snappy version v1.1.8 2020-04-13 21:17:30 +01:00
Taner Sener dac231cad3 use new fribidi version v1.0.9 2020-04-13 21:11:36 +01:00
Taner Sener 080906ea0d depend on smart-exception-java on android test-app 2020-04-13 19:38:26 +01:00
Taner Sener 13fed8c537 specify ndk version in travis.yml 2020-04-13 16:08:54 +01:00
Taner Sener 105126acef decrease travis build duration 2020-04-13 15:22:25 +01:00
Taner Sener 99dc774b34 set issue tracker url in bintray 2020-04-12 18:44:49 +01:00
Taner Sener 554e714b37 update deprecated gradle properties 2020-04-11 01:08:56 +01:00
Taner Sener 10a464220f update how hscale ios patch is applied for issue #370 2020-04-06 18:56:32 +01:00
Taner Sener 080bb47c28 revert ios patches before building android for openh264 2020-04-02 12:33:04 +01:00
Taner Sener c2b44c40eb enable video4linux2 devices on Android to support external usb cameras 2020-04-02 00:32:46 +01:00
Taner Sener 95be9fac95 update gradle plugin version 2020-04-01 23:40:30 +01:00
Taner Sener b1ca8f4841 disable hscale workaround for android, fixes #370 2020-04-01 23:32:27 +01:00
Alex Cohn 2dbfad6915 remove unnecessary parameters for make command
using the names of compiler tools same way as they are used (without full path) for ffmpeg build
2020-04-01 23:23:26 +01:00
Alex Cohn 5a7fba3574 remove custom common_includes
The includes are handled by llvm via --sysroot parameter.
2020-04-01 23:23:26 +01:00
alexcohn b84faa479d apply 'use build host and target host in build scripts' efe1c59a 2020-04-01 23:23:26 +01:00
alexcohn bdcd943c94 cleanup openh264 build 2020-04-01 23:23:26 +01:00
Taner Sener 915a8e1e2b update gradle plugin version 2020-03-29 23:50:36 +01:00
Taner Sener e29aa828d6 enable libwebp_anim encoder, fixes #366 2020-03-29 23:50:23 +01:00
Taner Sener 99a6f18f5f add create xcframework bundles option to ios.sh, fixes #351 2020-03-29 18:56:24 +01:00
Taner Sener 8af793fccb fix parsing of unicode parameters on ios/tvos, fixes #360 2020-03-09 20:30:25 +00:00
Taner Sener e5f9f72038 update rubber band build flags 2020-03-02 23:23:26 +00:00
Taner Sener 0baff685d7 support rubber band external library 2020-03-01 20:05:10 +00:00
Taner Sener 6d5cb88d0a use system uuid library for tvos 2020-02-29 00:41:17 +00:00
Taner Sener 6fc1ed06c6 refactor system package function names in build scripts 2020-02-28 23:17:20 +00:00
Taner Sener 4c86999458 refactor ARCH_OPTIONS in build scripts 2020-02-28 23:11:48 +00:00
Taner Sener 95261c1ade update libaom .gitignore 2020-02-28 22:03:22 +00:00
Taner Sener ca0bb9fd0f fix libaom linking error on mac catalyst 2020-02-28 20:07:21 +00:00
Taner Sener 12f52514b8 fix sdl linking error on mac catalyst 2020-02-28 07:47:33 +00:00
Taner Sener 64488a818a disable asm for external libraries on mac catalyst 2020-02-25 22:52:55 +00:00
Taner Sener c7e7cc20ef fix mac catalyst build errors 2020-02-25 19:55:22 +00:00
Taner Sener efe1c59a20 use build host and target host in build scripts 2020-02-24 21:24:58 +00:00
Taner Sener 4605e778c5 update mac catalyst arch name 2020-02-24 00:29:20 +00:00
Taner Sener ec851d33a3 disable asm for ffmpeg on x86-64h 2020-02-23 19:21:24 +00:00
Taner Sener b5565bd359 disable asm for x265 on x86-64h 2020-02-23 18:37:29 +00:00
Taner Sener 9229cf50c4 use system uuid library for ios 2020-02-23 14:12:43 +00:00
Taner Sener 7cf14d21e4 add mac catalyst support 2020-02-23 09:22:16 +00:00
Taner Sener 091f96ae84 fix travis builds 2020-02-16 18:17:59 +00:00
Taner Sener a13a05725a fix travis ios builds 2020-02-16 18:17:59 +00:00
Taner Sener 0981ff571b update SIMD_OPTIONS as ARCH_OPTIONS 2020-02-16 18:17:59 +00:00
Taner Sener 4e92d550fd fix travis builds 2020-02-16 15:38:02 +00:00
Taner Sener 1157681271 fix travis ios builds 2020-02-15 23:18:23 +00:00
Taner Sener 78e5411df9 update SIMD_OPTIONS as ARCH_OPTIONS 2020-02-15 22:20:51 +00:00
Taner Sener 917c22e209 Merge pull request #329 from tanersener/development
merge v4.3.1 fixes
2020-01-26 12:22:52 +00:00
Taner Sener 46b538107b update release dates 2020-01-26 12:19:05 +00:00
Taner Sener fd11dd5004 apply workaround for aarch64 architectures, fixes #328 2020-01-25 10:06:22 +00:00
Taner Sener 9da84b3edb fix concurrent writer registration, fixes #324 2020-01-22 23:18:19 +00:00
Taner Sener 639dbb3ccb update clean.sh script 2020-01-19 11:16:43 +00:00
Taner Sener c708cbdedd merge development changes (#318)
* fix cancel operation

* update wiki images

* cleanup Android project

Co-authored-by: hannesa2 <hannes.achleitner@googlemail.com>
2020-01-16 21:11:50 +00:00
Hannes Achleitner d8b1754272 cleanup Android project 2020-01-16 20:49:23 +00:00
Taner Sener 73e2cc557f update wiki images 2020-01-16 19:41:51 +00:00
Taner Sener e34f08c539 fix cancel operation 2020-01-16 00:59:41 +00:00
Taner Sener b70229b9e7 fix cancel operation 2020-01-14 19:53:54 +00:00
Taner Sener 00978be936 merge v4.3.1 release 2020-01-14 00:30:27 +00:00
Taner Sener 47a9b728d7 update project main page 2020-01-14 00:16:17 +00:00
Taner Sener 32f25905cb update test-application versions 2020-01-13 23:37:03 +00:00
Taner Sener 35c26b390c freeze v4.3.1 2020-01-13 00:35:05 +00:00
Taner Sener b9549a04e7 fix duplicate symbol errors for fftools 2020-01-12 20:54:57 +00:00
Taner Sener c6840985e6 update copyright headers for android 2020-01-12 20:54:57 +00:00
Taner Sener 8e671be23d fix ffprobe optional parameter parsing errors. 2020-01-12 20:08:05 +00:00
Taner Sener 807051ce3c create scripts to build universal packages. 2020-01-12 20:06:22 +00:00
Taner Sener c38ebd52b6 update ios/tvos test applications 2020-01-12 20:05:13 +00:00
Taner Sener 37ba9a95c1 fix ios/tvos depreciation warnings 2020-01-12 10:11:13 +00:00
Taner Sener 99ae2531a4 fix ios tvos compilation for libvpx 2020-01-12 09:10:55 +00:00
Taner Sener 60accc6233 fix ffprobe android lts linking errors 2020-01-10 01:07:06 +00:00
Taner Sener 35fd709066 use new x264 version v20191125-stable 2020-01-09 23:01:48 +00:00
Taner Sener 57ebc9a177 fix libvpx ios compilation errors 2020-01-09 22:07:22 +00:00
Taner Sener dcb1935b57 fix wavpack ios compilation errors 2020-01-09 18:14:44 +00:00
Taner Sener 815b122cef use new ffmpeg version v4.3-dev-1944-g94cdf82d53 2020-01-09 01:18:19 +00:00
Taner Sener f3a279348d use new wavpack version v5.2.0 2020-01-09 01:06:30 +00:00
Taner Sener 920aa583b9 use new xvidcore version v1.3.7 2020-01-09 01:04:41 +00:00
Taner Sener 1e7a4bb3f2 use new libwebp version v1.1.0 2020-01-09 01:04:07 +00:00
Taner Sener e92ba21784 use new libjpeg-turbo version v2.0.4 2020-01-09 01:00:18 +00:00
Taner Sener 0d47a43829 use new libvpx version v1.8.2 2020-01-09 00:52:30 +00:00
Taner Sener 77d4f80ba6 use new libaom version v1.0.0-errata1-avif-110-gceb377078 2020-01-08 23:50:00 +00:00
Taner Sener ab0ecc624d use system libiconv on ios/tvos, fixes #230 2020-01-08 23:35:02 +00:00
Taner Sener 7d9747789b implement ffprobe, fixes #286 2020-01-08 23:27:35 +00:00
Taner Sener dfdadf656b use system libiconv on ios/tvos 2020-01-08 16:15:39 +00:00
Taner Sener ef03a31d23 update helper methods to reflect concurrent execution support changes, fixes #182 2020-01-03 12:41:19 +00:00
Taner Sener 8041678c13 Merge branch 'concurrent' into development 2020-01-03 00:38:13 +00:00
Taner Sener 283ebe29a4 fix report option and issue #302 2020-01-03 00:11:51 +00:00
Taner Sener bdbabb5a18 prevent libogg auto detection, fixes #307 2019-12-28 11:18:13 +03:00
Taner Sener 4e078bb9e8 support concurrent execution 2019-12-19 23:47:38 +00:00
Taner Sener 240def7581 fix x265 build errors 2019-12-19 19:38:16 +00:00
Taner Sener cc1a5bd4b2 update gradle version 2019-12-15 11:50:52 +00:00
Taner Sener 6ae6627d97 update library version 2019-12-15 11:30:52 +00:00
Taner Sener b151e6ab81 synchronise mobile-ffmpeg source code 2019-12-15 01:21:27 +00:00
Taner Sener e3c0e4d2e7 use new ffmpeg version v4.3-dev-1687 2019-12-14 23:38:18 +00:00
Taner Sener 9dec4e0353 update ignored files for new versions 2019-12-14 20:39:02 +00:00
Taner Sener 062ca46069 use new xvidcore version 1.3.6 2019-12-14 19:08:02 +00:00
Taner Sener 267e8236f5 use new gnutls version 3.6.11.1 2019-12-14 19:04:52 +00:00
Taner Sener 4f3380c7fe use new tiff version 4.1 2019-12-14 19:02:49 +00:00
Taner Sener 7692c42c64 use new fribidi version 1.0.8 2019-12-14 18:58:53 +00:00
Taner Sener 18a8f6478f fix tvos pod name in README, fixes #276 2019-11-25 20:30:28 +00:00
Taner Sener 71a1289c32 fix tvos pod name 2019-11-25 20:27:49 +00:00
Javernaut 911a8f5478 [Android Demo] Cleaning Fragment classes 2019-11-21 18:35:31 +00:00
Javernaut 54fe0bd773 [Android Demo] Simplifying the layout for the main screen 2019-11-21 18:35:31 +00:00
Javernaut 7c99fcdeac [Android Demo] Removing custom header for the screen and using a standard ActionBar provided by the app theme 2019-11-21 18:35:31 +00:00
Javernaut 47c590c2b1 [Android Demo] Migrating the demo app to AndroidX 2019-11-21 18:35:31 +00:00
Javernaut 3e307bb4d6 [Android Demo] Removing worthless instrumentation tests from the demo app 2019-11-21 18:35:31 +00:00
Alexander Berezhnoi feece0ea50 Android library module improvement (#269)
* [Android Demo] Updating the Android Gradle Plugin to 3.5.2

* [Android Demo] Updating Gradle distribution to 6.0

* [Android Demo] Removing redundant dependencies in the library module

* [Android Demo] Removing worthless instrumentation test file from library module

* [Android Demo] Updating testing dependency in library module

* [Android Demo] Removing redundant resources from the library module

* Improving the android.sh, so it builds only necessary parts of the only library module

* Improving the android.sh. Cleaning only android library module when calling gradlew.

* [Android Demo] Updating Gradle dist to 6.0.1
2019-11-19 12:20:19 +00:00
Taner Sener 540e180e53 merge master README 2019-11-16 16:36:00 +00:00
Taner Sener 6e5af90e9c remove old patreon backers 2019-11-16 16:11:38 +00:00
jess b26f87d292 Activating Open Collective (#239)
* Added financial contributors to the README

* Update README.md

increase level and add numbers
2019-11-16 16:08:36 +00:00
Taner Sener 38398cb128 use new libxml2 version 2.9.10 2019-11-02 12:59:38 +00:00
Taner Sener a416890244 use new x265 version 3.2.1 2019-11-02 12:55:05 +00:00
Taner Sener a10996cf7e merge v4.3 fixes (#263)
* generate ios documentation

* update project page

* improve getNativeLastCommandOutput checks
2019-10-28 09:24:45 +00:00
Taner Sener 9bf06a9bc2 improve getNativeLastCommandOutput checks 2019-10-28 09:13:21 +00:00
Taner Sener 31d413d980 merge documentation updates (#262)
* generate ios documentation

* update project page
2019-10-27 15:48:12 +00:00
Taner Sener f7957bf2d9 update project page 2019-10-27 15:46:51 +00:00
Taner Sener 6a41bfd4e1 generate ios documentation 2019-10-27 15:20:29 +00:00
Taner Sener 92eb33e0b5 Merge pull request #261 from tanersener/development
merge v4.3
2019-10-27 15:14:40 +00:00
Taner Sener 2a96951d7d Merge branch 'master' into development 2019-10-27 15:14:12 +00:00
Taner Sener 448b5c61bb use new versions in ios test applications 2019-10-27 14:21:11 +00:00
Taner Sener 4217621f6f update issue template fields and paypal link 2019-10-27 12:59:56 +00:00
Taner Sener 9db209d406 release v4.3 2019-10-27 12:53:06 +00:00
Taner Sener 8a478f6dbe do not use deprecated api methods in test applications 2019-10-27 11:39:16 +00:00
Taner Sener cdc9dde9db fix getMediaInformation errors 2019-10-27 09:53:10 +00:00
Taner Sener ba768fe9e4 fix AsyncExecuteTask compatibility errors 2019-10-27 09:46:25 +00:00
Taner Sener 3993234a23 fix getNativeLastCommandOutput errors 2019-10-26 20:57:04 +01:00
Taner Sener aafc9587fc freeze v4.3 2019-10-26 15:27:31 +01:00
Taner Sener f6ea03addf prevent multiple executions, fixes #259 2019-10-26 14:17:32 +01:00
Taner Sener 0bead05ef8 add a few tests for issue #255 2019-10-26 12:44:05 +01:00
Taner Sener e00eadb4ff catch exceptions thrown by LogCallback and StatisticsCallback blocks, fixes #255 2019-10-26 12:30:00 +01:00
Taner Sener 220b4cead6 use new x264 version v20191024-2245-stable 2019-10-25 00:52:42 +01:00
Taner Sener 699485e0c5 use new ffmpeg version v4.3-dev-1181 2019-10-25 00:49:51 +01:00
Taner Sener 39f80127af use new libaom version v1.0.0-2567 2019-10-25 00:43:28 +01:00
Taner Sener 524d90aafe use new x265 version 3.2 2019-10-24 15:50:28 +01:00
Taner Sener aed8772010 use new twolame version 0.4.0 2019-10-24 00:17:20 +01:00
Taner Sener 663bd9e10a use new gnutls version 3.6.10 2019-10-23 23:47:24 +01:00
Taner Sener 6747a96694 use new fribidi version 1.0.7 2019-10-23 23:22:13 +01:00
Taner Sener a1a3c196cc use new fontconfig version 2.13.92 2019-10-23 20:46:08 +01:00
Taner Sener 0920ad0684 use new expat version 2.2.9 2019-10-23 19:41:27 +01:00
Taner Sener 1f32a2a47c support ios 13 2019-10-21 00:03:41 +01:00
Taner Sener cd5a43332a enable crc and crypto extensions for arm64e cpus 2019-09-17 23:08:32 +03:00
Taner Sener e6006621aa enable asm for gnutls on arm64 and arm64e architectures 2019-09-17 23:08:32 +03:00
Taner Sener 5ea232e853 fix libogg include errors 2019-09-16 17:01:49 +03:00
Taner Sener 8c5bb2d462 fix libogg include errors 2019-09-16 16:25:41 +03:00
Taner Sener c78f7b8822 fix gnutls asm errors 2019-09-16 13:41:06 +03:00
Taner Sener 0dbcdd373f use new x265 version 3.1.2 2019-09-16 11:42:23 +03:00
Taner Sener 1d828d300f use new libvpx version 1.8.1 2019-09-15 22:15:20 +03:00
Taner Sener c9c34dd4d0 use new gnutls version 3.6.9 2019-09-15 21:53:34 +03:00
Taner Sener ce920a56af use new libogg version 1.3.4 2019-09-15 21:32:20 +03:00
Taner Sener 231de3e7b4 use new libjpeg-turbo version 2.0.3 2019-09-15 21:23:42 +03:00
Taner Sener bbff12fb32 use new expat version 2.2.8 2019-09-15 21:14:30 +03:00
Taner Sener 14fbeca989 add backers section in readme.md 2019-09-10 12:14:31 +03:00
Taner Sener 3f24d91c9f add backers section in readme.md 2019-09-10 12:11:47 +03:00
Taner Sener c85017fe15 record only video using android_camera on site README 2019-09-06 22:16:48 +03:00
Taner Sener dc614948f9 record only video using android_camera on site README 2019-09-06 22:15:22 +03:00
Taner Sener 59ee330875 record only video using android_camera 2019-09-06 22:01:39 +03:00
Taner Sener 9444911b5d record only video using android_camera 2019-09-06 21:58:51 +03:00
Taner Sener 3d5dff0883 add ios min package screenshot 2019-08-30 15:02:47 +03:00
Taner Sener 5ec5470590 use printLastCommandOutput in android examples 2019-08-29 21:14:00 +03:00
Taner Sener 80cbbd6d5d add printLastCommandOutput api method on android 2019-08-29 21:06:48 +03:00
Taner Sener 39e55f48ee fix test errors 2019-08-28 18:07:59 +03:00
Taner Sener 2d2278b111 use av_malloc/av_free functions to allocate memory 2019-08-28 14:24:00 +03:00
Taner Sener 2e595085ef use new ffmpeg version v4.3-dev-300-gf8ad2ddd7a 2019-08-28 13:54:56 +03:00
Taner Sener 86ed56ecae build the last command output inside the log callback function, fixes #211 2019-08-28 13:32:09 +03:00
Taner Sener f97dccb5f9 remove unused Android Manifest attributes, fixes #206. 2019-08-06 23:59:57 +03:00
Taner Sener fc0d13f5a5 update test-app versions 2019-08-06 23:46:57 +03:00
Taner Sener cfa7948c10 update FUNDING.yml 2019-07-24 12:00:28 +03:00
Taner Sener d1b5ef3643 Update FUNDING.yml 2019-07-24 11:58:38 +03:00
Taner Sener 1815af56e8 use full package in README examples 2019-07-20 09:22:46 +03:00
Taner Sener a16c573b31 use full package in examples 2019-07-20 09:21:03 +03:00
Taner Sener ff54a727f1 update ffmpeg build scripts 2019-07-20 00:49:33 +03:00
Taner Sener 40f74f9cd5 update travis configuration 2019-07-18 10:39:56 +03:00
Taner Sener d34e86fda5 test new travis fixes 2019-07-18 10:13:01 +03:00
Taner Sener fa4d818a38 test travis fixes 2019-07-18 10:08:25 +03:00
Taner Sener 179cc3c029 support single quotes and double quotes in command strings, fixes #190 2019-07-16 21:14:20 +03:00
Taner Sener 293e51301a support single quotes and double quotes in command strings 2019-07-16 21:14:19 +03:00
Taner Sener fde19f7bff Update FUNDING.yml
add open collective link
2019-07-16 21:14:19 +03:00
Taner Sener d6d6b14214 Merge pull request #175 from tanersener/development
update README
2019-07-16 21:14:18 +03:00
Taner Sener 46b331059a build ffmpeg without -mdynamic-no-pic on ios/tvos, fixes #187 2019-07-16 15:25:17 +03:00
Taner Sener c285041333 include sysv hash table in both android release variants, enhances #184 2019-07-14 11:09:03 +03:00
Taner Sener d20cbfc03c use new x265 version 3.1.1 2019-07-11 16:32:01 +03:00
Taner Sener 2bc8e925e4 use new openh264 version 2.0.0 2019-07-11 15:05:44 +03:00
Taner Sener 7e2c8039fa use new kvazaar version 1.3.0 2019-07-11 12:38:41 +03:00
Taner Sener a212506d2c Update FUNDING.yml
add open collective link
2019-07-09 18:03:40 +03:00
Taner Sener 40e2e0e279 remove patreon link 2019-07-08 15:02:22 +03:00
Taner Sener aeac5d17f4 remove patreon link 2019-07-08 15:01:25 +03:00
Taner Sener c08b377287 display sponsor button 2019-07-08 14:43:15 +03:00
Taner Sener 214f2e0902 display sponsor button 2019-07-08 14:41:39 +03:00
Taner Sener 7910ba20be remove development builds link 2019-07-07 20:53:14 +03:00
Taner Sener 2c13b1ac8d remove development builds link 2019-07-07 20:47:26 +03:00
Taner Sener 8e221e9380 add patreon link 2019-07-07 19:48:38 +03:00
Taner Sener fffac3e9cd add patreon link 2019-07-07 19:47:48 +03:00
Taner Sener 1637b94a2a version bump 2019-07-05 19:56:15 +03:00
Taner Sener 13e87d6dc5 use underscore instead of hyphen in android library names 2019-07-05 15:35:10 +03:00
Taner Sener 819ccf4294 Merge pull request #175 from tanersener/development
update README
2019-07-04 15:09:48 +03:00
Taner Sener b2a957471b update README 2019-07-04 15:09:16 +03:00
Taner Sener a3610893d7 Merge pull request #174 from tanersener/development
update project website
2019-07-04 15:02:55 +03:00
Taner Sener cfd54d23f4 update project website 2019-07-04 15:02:12 +03:00
Taner Sener 2e80a5552c Merge pull request #173 from tanersener/development
merge v4.2.2
2019-07-04 14:44:46 +03:00
Taner Sener 40f0c6d093 update android.sh help text 2019-07-04 14:43:35 +03:00
Taner Sener d8db2adf7f update README 2019-07-04 14:31:46 +03:00
Taner Sener d3aca61ce6 add pods test application for tvos 2019-07-03 23:13:37 +03:00
Taner Sener aef439d4d4 update test applications 2019-07-03 16:39:28 +03:00
Taner Sener ae5cdad4e5 re-generate android javadoc documentation 2019-07-03 13:22:54 +03:00
Taner Sener c80e11cfc4 disable asm for libtheora on android lts releases 2019-07-03 13:15:44 +03:00
Taner Sener 879a78601c fix snappy linking errors on android 2019-07-03 03:35:47 +03:00
Taner Sener d0b26d7c59 freeze v4.2.2 2019-07-02 18:33:21 +03:00
Taner Sener 7f1a6b1c01 fix build errors 2019-07-02 17:32:42 +03:00
Taner Sener 0011be58d0 use new libaom version 1.0.0-2018-g5bceb59e7 2019-07-02 15:02:24 +03:00
Taner Sener e5ba73c90f use new x264 version snapshot-20190701 2019-07-02 14:48:01 +03:00
Taner Sener bc1d17b7ba use new ffmpeg version 4.2-dev-1824-g231d0c819f 2019-07-02 14:42:55 +03:00
Taner Sener 2f5b4751d5 use new gnutls version 3.6.8 2019-07-02 14:37:24 +03:00
Taner Sener fe05bb766e use new nettle version 3.5.1 2019-07-02 13:02:03 +03:00
Taner Sener b1f7f22970 use new freetype version 2.10.1 2019-07-02 09:35:52 +03:00
Taner Sener ed1a3edb6e use new expat version 2.2.7 2019-07-02 09:28:15 +03:00
Taner Sener 4aecd528eb update top level build scripts 2019-06-30 00:01:35 +03:00
Taner Sener fe8e3f6605 include external library license files in universal library release packages, fixes #169 2019-06-29 16:28:16 +03:00
Taner Sener d1ccc2e219 add iOS modulemap for mobileffmpeg.framework, fixes #166 2019-06-29 02:31:18 +03:00
Taner Sener bfafe4cd84 update README 2019-06-25 17:45:11 +03:00
Taner Sener c67e2b0aaa enable travis builds on master and development branches fixes #160 2019-06-25 17:40:45 +03:00
Taner Sener 61ebdd4532 merge travis build configuration 2019-06-25 17:22:26 +03:00
Taner Sener 605c43511f Merge branch 'development' into travis-test 2019-06-25 17:20:40 +03:00
Taner Sener 29a4866fff enable travis android jobs 2019-06-25 14:39:44 +03:00
Taner Sener 25dc08be0e implement --no-output-redirection hidden flag 2019-06-25 13:10:41 +03:00
Taner Sener 6c1117baf8 test travis ios lts build fix #11 2019-06-25 10:02:44 +03:00
Taner Sener 247a0c3f6a test travis ios lts build fix #10 2019-06-25 09:30:09 +03:00
Taner Sener aa2370c665 test travis ios lts build fix #9 2019-06-25 09:24:43 +03:00
Taner Sener c4504de8d0 test travis ios lts build fix #8 2019-06-25 09:10:54 +03:00
Taner Sener 61d9e890ec test travis ios lts build fix #7 2019-06-25 08:40:34 +03:00
Taner Sener a878c0ec84 test travis ios lts build fix #6 2019-06-25 08:35:47 +03:00
Taner Sener 979d9a0b18 test travis ios lts build fix #5 2019-06-25 08:14:51 +03:00
Taner Sener 056da3a64f test travis ios lts build fix #4 2019-06-25 07:47:11 +03:00
Taner Sener 1ffc0632cf test travis ios lts build fix #3 2019-06-25 07:40:49 +03:00
Taner Sener 877c8fdfd9 test travis ios lts build fix #2 2019-06-25 07:21:08 +03:00
Taner Sener 20b54df76c test travis ios lts build fix 2019-06-25 07:17:44 +03:00
Taner Sener 1191d09d45 enable all android, ios and tvos jobs for travis 2019-06-24 23:37:54 +03:00
Taner Sener 78bc0ef275 add travis ios test job 2019-06-24 23:07:45 +03:00
Taner Sener a3c922e11b add all travis android jobs 2019-06-24 23:00:21 +03:00
Taner Sener d63649a67a enable travis job matrixes 2019-06-24 21:46:26 +03:00
Taner Sener ddd1ba8468 add travis license and cache sections 2019-06-24 20:59:24 +03:00
Taner Sener 6326504628 implement hidden --no-link-time-optimization flag for android 2019-06-24 17:44:42 +03:00
Taner Sener 308b269710 add travis platform dependency 2019-06-24 15:48:58 +03:00
Taner Sener e2bcbe18d2 Add travis confguration 2019-06-24 15:38:37 +03:00
Taner Sener 981741de0b implement hidden --no-workspace-cleanup- flag for ffmpeg builds 2019-06-24 14:58:07 +03:00
Taner Sener b9ca079fd7 log --reconf and --rebuild flags, fixes #159 2019-06-24 14:21:36 +03:00
Taner Sener 39920243ea include development builds link in README 2019-06-23 13:50:50 +03:00
Taner Sener 8f288e3971 upgrade gradle wrapper to 5.4.1 2019-06-23 12:06:35 +03:00
Taner Sener dea2d51783 fix android lint issues 2019-06-23 11:44:04 +03:00
Taner Sener 6fdf6e4dec fix gradle warnings 2019-06-23 10:41:24 +03:00
Taner Sener 137e3aa1c3 update gradle bintray plugin 2019-06-23 10:06:22 +03:00
Taner Sener eb7649e666 update version as 4.2.2 2019-06-22 22:08:16 +03:00
Taner Sener 56b4e1eeb1 use new libaom version 1.0.0-1974-g32185d165 2019-06-22 22:02:35 +03:00
Taner Sener fe6f1299ae use new x264 version snapshot-20190621 2019-06-22 21:31:41 +03:00
Taner Sener 17cc87793a use new ffmpeg version 4.2-dev-1735-gebcf4d354f 2019-06-19 12:24:43 +03:00
Taner Sener 6a0ea618dc use the different cocoapods packages for tvos and ios 2019-06-19 11:23:05 +03:00
Taner Sener 205a3016ef remove allowBackup flag from androidmanifest.xml file, fixes #154 2019-06-18 13:30:07 +03:00
Taner Sener 3a1e7507d5 use new opus version 1.3.1 2019-06-15 09:23:51 +03:00
Taner Sener adac5c4a7d use new libpng version 1.6.37 2019-06-15 00:00:20 +03:00
Taner Sener 51b232670a use new libiconv version 1.16 2019-06-14 23:58:25 +03:00
Taner Sener 0e2357f761 use new fontconfig version 2.13.91 2019-06-14 23:44:13 +03:00
Taner Sener bcb22f9e63 clean script updated 2019-06-14 19:13:22 +03:00
Taner Sener 3a252b5059 use ffmpeg 4.2-dev-1720-gc9c1711f49 2019-06-14 18:57:28 +03:00
Taner Sener 7d24edd1b2 support openh264, fixed #152 2019-06-14 16:56:48 +03:00
Taner Sener e4b43d6584 add gif samples for tvos platform 2019-06-11 15:40:13 +03:00
Taner Sener cfb9d40f0b update README 2019-06-11 13:00:14 +03:00
Taner Sener 4092ada348 add tvos test-applications 2019-06-11 00:15:54 +03:00
Taner Sener ec6a7c40ac auto-disable 32-bit architectures on IOS 11 and 12, fixes #149 2019-06-11 00:15:54 +03:00
Taner Sener b7785d5bf2 support tvos, fixed #151 2019-06-11 00:15:53 +03:00
Taner Sener 0eea0a3246 getSupportedCameraIds api method introduced on android, fixes #145 2019-05-29 12:00:18 +03:00
Taner Sener f16edb5779 fix version strings in Info.plist file, fixes #141
(cherry picked from commit 88f2d7d728)
2019-05-21 16:18:30 +03:00
Taner Sener 88f2d7d728 fix version strings in Info.plist file 2019-05-21 16:13:10 +03:00
Taner Sener 413a4cb5a6 disable libgif auto-detection for libwebp on ios 2019-05-13 19:32:00 +03:00
Taner Sener ff3d2f94fa remove android:label property from AndroidManifest.xml 2019-05-04 09:09:45 +03:00
Taner Sener 48b909445c include proguard configuration in aar archive, fix #128 2019-04-27 23:11:26 +03:00
Taner Sener 6369bf54a8 fix libvpx build errors on android lts 2019-04-27 10:49:02 +03:00
Taner Sener cb5285a749 add async execution utility class for Android 2019-04-27 08:45:51 +03:00
Taner Sener a91f51bdcc support api level 16 on android by implementing missing functions in android_lts_support library 2019-04-27 00:25:02 +03:00
Taner Sener c103dc0f16 explicitly specify LOCAL_ARM_NEON flag on Android.lts.mk 2019-04-26 13:05:32 +03:00
Taner Sener 2a8317e3fe trigger arm-v7a-neon check when armeabi-v7a is loaded, fix #126 2019-04-26 12:53:31 +03:00
Taner Sener ef004c8d03 Revert "use api level 18 for android lts releases"
This reverts commit a019c44f56.
2019-04-24 15:23:50 +03:00
Taner Sener 0da03186ac add release notes links in version history table 2019-04-22 12:32:36 +03:00
Taner Sener c1422648aa reverse version history table order 2019-04-22 12:26:48 +03:00
Taner Sener 19852f9193 update versions section in README 2019-04-22 12:21:43 +03:00
Taner Sener c50917ab27 exclude unwider libraries during linking for android 2019-04-21 14:46:11 +03:00
Taner Sener 328e93680c update test-app kvazaar command 2019-04-21 14:45:22 +03:00
Taner Sener 3e647a4bbf remove api level 21 specific features 2019-04-21 11:06:31 +03:00
Taner Sener 5ed1871c6d use an lts specific build.gradle file for lts releases 2019-04-21 10:14:38 +03:00
Taner Sener 846b986f1c add setNativeEnvironmentVariable method for android 2019-04-20 17:00:18 +03:00
Taner Sener a019c44f56 use api level 18 for android lts releases 2019-04-20 13:41:46 +03:00
Taner Sener d4e87a8f2a add side data to stream information, fix #123 2019-04-18 19:22:50 +03:00
Taner Sener 56ccd1f2de fix metadata creation for stream information on ios, fix #122 2019-04-18 18:52:52 +03:00
Taner Sener f6d8703027 fix data stream parsing errors on ios 2019-04-18 17:44:09 +03:00
Taner Sener 579c435442 fix data stream parsing errors on android 2019-04-18 17:30:58 +03:00
Taner Sener cd9c858d93 add generic stream test cases for media information parsing 2019-04-18 16:40:41 +03:00
Taner Sener c6be30edca add metadata test cases for media information parsing 2019-04-18 15:44:46 +03:00
Taner Sener 02916b6ce4 add new test cases for media information parsing 2019-04-18 15:06:54 +03:00
Taner Sener e32e5fc13c update test-app Podfile.lock 2019-04-18 14:31:19 +03:00
Taner Sener 6b94aeea2d add ANDROID_HOME validation 2019-04-07 15:23:21 +03:00
Taner Sener 48774bf01a improve getMediaInformation, fix #113 2019-04-07 11:19:57 +03:00
Taner Sener d91065b3b6 fix ld: symbol(s) not found for architecture x86_64 errors 2019-04-06 10:05:53 +03:00
Taner Sener b3702699e2 fix ld: symbol(s) not found for architecture x86_64 errors 2019-04-05 18:38:19 +03:00
Taner Sener 44043868b8 fix paths in clean script 2019-04-03 19:31:44 +03:00
Taner Sener 2e26282b4a Merge pull request #112 from tanersener/development
merge the latest documentation updates
2019-04-03 19:24:50 +03:00
Taner Sener 4988ab9cc6 update README 2019-04-03 19:22:15 +03:00
Taner Sener 83503c1fdb disable gitter 2019-04-03 19:19:50 +03:00
Taner Sener 69b5c6e8a5 fix gradle warnings 2019-04-03 19:15:22 +03:00
Taner Sener 50acbeb4c8 remove unused declarations from app build.gradle 2019-04-03 19:07:55 +03:00
Taner Sener aa87ece761 version bump in ios autotools 2019-04-03 18:59:53 +03:00
Taner Sener ccd068b11b Merge pull request #110 from tanersener/development
merge v4.2.1 to master
2019-04-02 21:22:58 +03:00
Taner Sener dd35c6131a release v4.2.1 2019-04-02 21:18:43 +03:00
Taner Sener e0d7b9cad6 update ios test applications with v4.2.1 packages 2019-04-02 20:46:12 +03:00
Taner Sener 8b3692267f fix podspec errors 2019-04-02 19:59:25 +03:00
Taner Sener ac4893216c use v4.2.1 release in android test-application 2019-04-02 18:54:54 +03:00
Taner Sener 23b701a556 fix android release script for http-gpl package 2019-04-02 18:04:30 +03:00
Taner Sener 69b2fa6e03 set android target sdk version to 28 in release scripts 2019-04-02 13:04:51 +03:00
Taner Sener c2870db53c add libc++_shared library dependency to x265 2019-04-02 09:56:33 +03:00
Taner Sener cccd72d96a set android target sdk version to 28 2019-04-02 09:56:33 +03:00
Taner Sener 5472992f83 upgrade gradle plugin version to 3.3.2 2019-04-02 09:56:33 +03:00
Taner Sener 0107986bdf move android release build files under tools/release/android 2019-04-02 09:56:32 +03:00
Taner Sener a3887fda89 prepare v4.2.1 2019-04-02 09:56:31 +03:00
Taner Sener e76ae61e2b autoreconf fontconfig 2019-04-01 09:56:48 +03:00
Taner Sener b4a75138e2 autoreconf libuuid 2019-04-01 09:48:53 +03:00
Taner Sener 5b3db7db41 disable realtime only for libvpx 2019-03-31 11:19:35 +03:00
Taner Sener b5f7531dff replace printf calls with av_log, fixes #104 2019-03-29 21:57:14 +03:00
Taner Sener 3a2ebf15f0 update mobile-ffmpeg library using ffmpeg/fftools 2019-03-29 21:45:30 +03:00
Taner Sener 0f61b7e0bf use new x264 version snapshot-20190328-2245-stable 2019-03-29 20:04:55 +03:00
Taner Sener 2456c963e6 use new ffmpeg version v4.2-dev-1156-g9dece050ef 2019-03-29 19:22:14 +03:00
Taner Sener d124a16627 use new libaom version v1.0.0-1544-g5bdd95475 2019-03-29 18:03:01 +03:00
Taner Sener 1434d0c300 use new libwebp version v1.0.2 2019-03-29 17:32:10 +03:00
Taner Sener 5fc5c86749 use new libjpeg turbo version v2.0.2 2019-03-29 16:16:58 +03:00
Taner Sener 2e969093e8 use new leptonica version v1.78.0 2019-03-29 16:09:36 +03:00
Taner Sener f7526b861e use new freetype version v2.10.0 2019-03-29 15:58:03 +03:00
Taner Sener 71ec510992 fix xcode 10 compatibility issues, fixes issues #60 and #106 2019-03-29 14:49:58 +03:00
Taner Sener 738b93cb42 use 12.1 as IOS_MIN_VERSION 2019-03-26 17:33:12 +03:00
Taner Sener dd695b64f0 print build options during compilation 2019-03-25 20:22:37 +03:00
Taner Sener 882e3303c7 Revert "import predefined cpufeatures module in android ndk-build" 2019-03-25 19:10:48 +03:00
Taner Sener 2a68ce3a5b print build date on library initialization 2019-03-25 00:49:54 +03:00
Taner Sener c0b471b312 fix cpu-features linking error for libvpx on android platform as mentioned in #102 2019-03-24 23:25:50 +03:00
Taner Sener 31e3b2b836 add info severity to system information in build log 2019-03-24 21:12:27 +03:00
Taner Sener 8f94235dc0 print BUILD_VERSION during compilation 2019-03-24 20:32:16 +03:00
Taner Sener 0b1ceb031f update default android.mk for android builds 2019-03-24 17:55:17 +03:00
Taner Sener 7a2cea646b remove config.h includes from library headers, fix #100 2019-03-22 12:30:32 +03:00
Taner Sener b18006fceb import predefined cpufeatures module in android ndk-build 2019-03-04 18:25:32 +03:00
Taner Sener 16c335981e remove c++_shared dependency for ffmpeg on android, fixes #92 2019-03-04 16:53:40 +03:00
Taner Sener 2db0de4d8e remove app icons from android library, fix #88 2019-02-23 14:19:17 +03:00
Taner Sener 38fd55e605 upgrade gradle wrapper to v5.2.1, fixes #87 2019-02-20 12:56:39 +03:00
Taner Sener 801377f739 register active JVM with av_jni_set_java_vm(), fix #83 2019-02-14 20:55:39 +03:00
Taner Sener 143347c530 enable signing and proguard for android test-app release builds, fix #82 2019-02-14 15:34:27 +03:00
Taner Sener cdf1532e1d fix ffmpeg arm64 build errors 2019-02-09 11:19:11 +03:00
Taner Sener e99bec4622 add log guards for nslog statements in ios library 2019-02-09 10:07:31 +03:00
Taner Sener fcb298b91a fix doxygen errors 2019-02-08 23:59:59 +03:00
Taner Sener cd58ea32c1 update javadoc 2019-02-08 23:30:07 +03:00
Taner Sener 850da3004d fix android javadoc errors 2019-02-08 23:17:00 +03:00
Taner Sener 73285ef20a use new ffmpeg version v4.2-dev-768-g7f8bfbee36 2019-02-08 22:56:44 +03:00
Taner Sener 027d9ac753 use new libaom version v1.0.0-1318 2019-02-08 22:50:55 +03:00
Taner Sener e27ab37249 use new x265 version v3.0 2019-02-08 22:42:10 +03:00
Taner Sener 92248f3f33 add a new async command task for android 2019-02-08 17:18:30 +03:00
Taner Sener b3d0c650fb implement pipe support and add a pipe tab inside test-applications. 2019-02-08 12:05:03 +03:00
Taner Sener 19fc09e378 update libvpx version to 1.8.0 2019-02-05 16:40:45 +03:00
Taner Sener cbb059aa1f add clean script to delete binary files 2019-02-02 18:51:30 +03:00
Taner Sener debd06db88 downgrade sdl to v2.0.8 2019-01-31 20:38:25 +03:00
Taner Sener c2b2226e16 do not use -DDEBUG when debug flag is present, fix #74 for ios. 2019-01-31 15:34:54 +03:00
Taner Sener 299f176e45 do not --enable-lto for ffmpeg when debug flag is present, fix #74 for android. 2019-01-29 18:32:23 +03:00
Taner Sener 06811386a3 do not --enable-lto for ffmpeg when debug flag is present, fix #74 for android. 2019-01-29 18:27:34 +03:00
Taner Sener 8650308bfb use new ffmpeg version v4.2-dev-702-gd8ebfd1bdf 2019-01-27 12:26:34 +03:00
Taner Sener 3005a673cd use new libxml2 version 2.9.9 2019-01-27 12:19:45 +03:00
Taner Sener 3a91363d1d fix android scripts for ndk r19, #72 2019-01-27 09:29:44 +03:00
Taner Sener 2fc9e360ad Update am__api_version in libilbc/configure 2019-01-22 17:54:33 +03:00
Taner Sener d6b935dac5 Merge pull request #71 from RexProg/master
Update configure
2019-01-22 17:48:03 +03:00
RexProg 42c1732886 Update configure 2019-01-22 17:32:59 +03:30
Taner Sener 4ffd9b31f2 include documentation_url in full and full-gpl podspec files. 2019-01-18 00:40:59 +03:00
Taner Sener c92b236b5c update podspec file to enable cocoapods.org page generation 2019-01-17 23:54:54 +03:00
Taner Sener e8d60ac392 Merge pull request #69 from tanersener/development
remove <br/> from last rows
2019-01-08 14:26:52 +03:00
Taner Sener 4a2d1221e3 remove <br/> from last rows 2019-01-08 13:52:05 +03:00
Taner Sener 15b4f67060 Merge pull request #68 from tanersener/dev-v4.2
merge v4.2 updates
2019-01-08 13:49:10 +03:00
Taner Sener 7e8b90a2fb update strip-frameworks.sh references 2019-01-08 13:37:05 +03:00
Taner Sener 852d148727 update asset paths in docs 2019-01-08 13:25:28 +03:00
Taner Sener 5f9813877f disable lto for IOS 2019-01-02 20:20:39 +03:00
Taner Sener 77ba8681ff Merge pull request #64 from tanersener/dev-v4.2
apply minor documentation updates from dev-v4.2 branch
2018-12-31 14:35:17 +03:00
Taner Sener c5aeb63278 apply minor documentation updates 2018-12-31 14:30:10 +03:00
Taner Sener 85bab613bf Merge pull request #63 from tanersener/dev-v4.2
merge v4.2 to master
2018-12-30 15:15:40 +03:00
Taner Sener 64e4f81ff6 update README 2018-12-30 15:13:53 +03:00
Taner Sener 85aa254fb0 update README 2018-12-30 13:45:32 +03:00
Taner Sener 76b6e82993 use latest released version on ios test-app 2018-12-29 11:33:43 +03:00
Taner Sener 8c756b8033 use latest released version in android test-app 2018-12-29 09:46:25 +03:00
Taner Sener 1c6963374c update test application build numbers 2018-12-28 21:53:34 +03:00
Taner Sener 3a18694799 clean release directories in ios release scripts 2018-12-28 20:40:21 +03:00
Taner Sener edb7c6bce2 fix x265 ios bitcode errors 2018-12-28 18:31:42 +03:00
Taner Sener a7de983214 update ios podspec dependencies 2018-12-28 14:00:33 +03:00
Taner Sener 11b0155110 assembly disabled for x264 on IOS i386 and x86_64 2018-12-28 13:51:48 +03:00
Taner Sener 16a55ccd0e fix ios package detection 2018-12-27 16:17:57 +03:00
Taner Sener 92c81bedaa fix android package detection 2018-12-27 16:10:38 +03:00
Taner Sener 73d05ee3a2 use v4.2.LTS in android test-app 2018-12-27 15:43:00 +03:00
Taner Sener 836d1450db use deployment target 9.3 for ios lts releases 2018-12-27 13:56:50 +03:00
Taner Sener b6b29cc2c2 update api documentation 2018-12-27 12:17:39 +03:00
Taner Sener c306df44af fix tesseract source code 2018-12-27 10:47:36 +03:00
Taner Sener d1ac2b37b6 rollback to tesseract v3.05.02 2018-12-27 10:45:06 +03:00
Taner Sener c4f30fb621 update tesseract .pc versions 2018-12-27 10:16:20 +03:00
Taner Sener d88571e30f fix android release scripts 2018-12-27 00:38:40 +03:00
Taner Sener 95c4b2eb75 move isNativeLTSBuild method inside AbiDetect class 2018-12-26 22:14:16 +03:00
Taner Sener 5555f759c0 fix android init log for non-lts releases 2018-12-26 22:14:16 +03:00
Taner Sener 9c87ef0546 use the same value for compile sdk version and target sdk version 2018-12-26 22:14:16 +03:00
Taner Sener 69cee669d4 move ios isLTSBuild method inside ArchDetect class 2018-12-26 21:38:12 +03:00
Taner Sener 056be3480d perform darwin os checks earlier in ios.sh 2018-12-26 20:22:36 +03:00
Taner Sener c8a1f43446 update release scripts 2018-12-26 19:21:14 +03:00
Taner Sener 7b8c0e528a change build dependencies for android arm-v7a-neon architecture. 2018-12-26 01:05:47 +03:00
Taner Sener a1bed50fa7 use new ffmpeg version v4.2-dev-480-g70c86deb8e 2018-12-25 23:39:14 +03:00
Taner Sener 3e98adc541 add lts flag to cflags 2018-12-25 22:59:36 +03:00
Taner Sener c47e6e7a70 enable lts version for android 2018-12-25 15:58:55 +03:00
Taner Sener afd7cc625a use new sdl version v2.0.9 2018-12-25 13:39:02 +03:00
Taner Sener f5a5ec85b8 use new tesseract version v4.0.0 2018-12-25 13:34:34 +03:00
Taner Sener 733566386b use new leptonica version v1.77.0 2018-12-25 13:21:13 +03:00
Taner Sener 08b07197f2 use new libpng version v1.6.36 2018-12-25 13:12:22 +03:00
Taner Sener 0602d3ed42 use new libaom version v1.0.0-1053-g440e6d412 2018-12-25 12:59:46 +03:00
Taner Sener 17a21867e0 use new x264 version snapshot-20181224-2245-stable 2018-12-25 12:41:42 +03:00
Taner Sener 5e3ed008fd enable asm for libvpx on ios arm64e 2018-12-25 12:06:37 +03:00
Taner Sener d5f6327634 fix libaom build on ios arm64e 2018-12-25 11:35:34 +03:00
Taner Sener e71f879506 use sdk version as ios min version 2018-12-24 22:14:20 +03:00
Taner Sener 9d1a7f9893 create ios framework for each external library 2018-12-24 19:11:12 +03:00
Taner Sener fb87f6fb93 fix ios --lts build errors 2018-12-23 12:34:02 +03:00
Taner Sener 84f64466c6 fix wrong paths for ios libwebp build 2018-12-23 09:39:33 +03:00
Taner Sener c29766c11d update test apps with new binaries 2018-12-22 23:16:38 +03:00
Taner Sener 9ddb8e716a drop shared libraries support for ios, fix #59 2018-12-22 21:49:31 +03:00
Taner Sener 938ccf28b2 add CFBundleSupportedPlatforms key to the info.plist file, fix #58 2018-12-22 21:32:37 +03:00
Taner Sener 8351675692 add new ios test-app for universal binaries 2018-12-21 20:31:35 +03:00
Taner Sener 66d0e2a43d rename default ios test-app as pods-with-tooltip 2018-12-21 13:35:44 +03:00
Taner Sener 1ef044c87f add a new ios test-app with manual frameworks 2018-12-21 12:20:16 +03:00
Taner Sener fd57251531 update ios test-app info.plist 2018-12-21 09:42:51 +03:00
Taner Sener a145bb6e06 update size optimization flags 2018-12-19 20:13:44 +03:00
Taner Sener 1a33b54893 do not warn about not supported optimization arguments on ios 2018-12-19 18:36:57 +03:00
Taner Sener b77614be2e fix default ios releases 2018-12-19 15:34:16 +03:00
Taner Sener 3dcff03844 add guards for ios sdk v12.1 specific constants 2018-12-19 15:32:10 +03:00
Taner Sener 7294c21d85 set ffmpeg debug option by top level build script 2018-12-19 14:54:25 +03:00
Taner Sener 2c579d33cb patch gas-preprocessor.pl against regex warnings 2018-12-19 14:47:43 +03:00
Taner Sener 703242e65c fix debug and size optimization flags 2018-12-19 13:51:06 +03:00
Taner Sener 45ff661719 disable armv7 and armv7s for main build, armv7s for lts 2018-12-19 12:31:20 +03:00
Taner Sener ffc9f609f0 android cpu abi implemented 2018-12-19 10:31:22 +03:00
Taner Sener 30a90c1318 support ios arm64e architecture 2018-12-19 09:28:15 +03:00
Taner Sener 13ac2cdc70 set next release number 2018-12-19 09:26:45 +03:00
Taner Sener d8a902a405 Log active sdk version for IOS 2018-12-18 23:28:55 +03:00
Taner Sener 3a52290297 Reorganize Info.plist entries 2018-12-18 21:44:19 +03:00
Taner Sener 3390f7e076 Remove unused gnutls specific IOS_MIN_VERSION variable 2018-12-18 21:37:52 +03:00
Taner Sener 3bd8087fb2 add strip-frameworks.sh script to shared universal library, fixes #55 2018-12-18 21:01:15 +03:00
Taner Sener 776a14dd0b add ios-frameworks wiki assets 2018-12-18 18:12:39 +03:00
Taner Sener 5a2397f39c apply issue #18 patch in ios test application 2018-12-17 20:47:38 +03:00
Taner Sener 5d6b1341b2 add patch script for issue #18 2018-12-17 19:51:45 +03:00
Taner Sener 4ef0f24b1d Merge branch 'master' into dev-v3.x 2018-12-16 22:22:48 +03:00
Taner Sener af2d21458d disable unused devices for ffmpeg IOS build 2018-12-16 22:20:14 +03:00
Taner Sener 5bf6afe0bf disable assembly for xvidcore on IOS x86-64 2018-12-16 22:20:14 +03:00
Taner Sener ca562561e7 fix test errors 2018-12-16 22:20:14 +03:00
Taner Sener e20a27f60d disable unusable devices from ffmpeg android build 2018-12-16 11:53:50 +03:00
Taner Sener 23fecea67f decrease size of ios binaries 2018-12-14 15:11:15 +03:00
Taner Sener 4b1feed331 decrease size of android libraries 2018-12-12 19:17:00 +03:00
Taner Sener 6d5ffc8da0 update versions section as releases 2018-12-12 01:20:02 +03:00
Taner Sener 1cc5d7067c Merge pull request #52 from tanersener/dev-v3.x
fix github page errors
2018-12-12 00:34:27 +03:00
Taner Sener 6c799e4a2e fix github page errors 2018-12-12 00:32:43 +03:00
Taner Sener 28a61a4699 Set theme jekyll-theme-minimal 2018-12-11 22:44:18 +03:00
Taner Sener 99f08588e1 Set theme jekyll-theme-modernist 2018-12-11 22:41:28 +03:00
Taner Sener cd871f5ff8 Merge pull request #51 from tanersener/dev-v3.x
merge v3.1 to master
2018-12-11 00:37:40 +03:00
Taner Sener d634b5d11b Merge branch 'master' into dev-v3.x 2018-12-11 00:36:51 +03:00
Taner Sener d05b37571a merge v3.1 to master 2018-12-11 00:30:11 +03:00
Taner Sener 9408c5d40c merge branch 'master' into dev-v3.x 2018-12-11 00:24:31 +03:00
Taner Sener 64c1cf6e1e use v3.1 in ios test-app 2018-12-11 00:07:35 +03:00
Taner Sener 8521c29ac8 apply post-release updates 2018-12-10 21:29:04 +03:00
Taner Sener 327d65307e use v3.1 in android test-app 2018-12-10 19:22:32 +03:00
Taner Sener 10567f8c90 release v3.1 2018-12-10 09:47:26 +03:00
Taner Sener 8fb5cf4527 use longer android versionCode 2018-12-09 23:43:45 +03:00
Taner Sener 502ff33107 use new toolchain name for android 2018-12-09 22:48:00 +03:00
Taner Sener a0e9b21515 use new nettle version: v3.4.1 2018-12-09 18:09:16 +03:00
Taner Sener 54ab8353a2 use new x264 version: snapshot-20181208-2245-stable 2018-12-09 18:03:07 +03:00
Taner Sener 9c6e4c7f6f use new libwebp version: v1.0.1 2018-12-09 18:01:43 +03:00
Taner Sener 696081f580 use new tiff version: v4.0.10 2018-12-09 12:59:36 +03:00
Taner Sener 86e1f752e8 use new libjpeg-turbo version: v2.0.1 2018-12-09 12:55:52 +03:00
Taner Sener 4d83b4c396 use new libaom version: v1.0.0-1014-gbf0a6f9d1 2018-12-09 12:49:34 +03:00
Taner Sener 200a2c8289 use new ffmpeg version: n4.1-10-g59e30c05d7 2018-12-09 12:38:35 +03:00
Taner Sener f1f35f7e2c remove not supported set_toolchain_gcc_paths function from build scripts, as part of fix #48 2018-12-09 12:04:32 +03:00
Taner Sener 7b0b8a68d8 Process callback data inside @autoreleasepool block, fix #47 2018-12-09 09:48:57 +03:00
Taner Sener 9aa8afbaa5 Process log level earlier, fix #50 2018-12-09 09:39:48 +03:00
Taner Sener 4d5e759953 use gradle wrapper for android test-app 2018-12-09 00:48:31 +03:00
Taner Sener 12d2cc1665 fix android libvorbis build errors 2018-12-08 23:44:00 +03:00
Taner Sener ad74fbba8d Use gradle wrapper for Android. 2018-12-08 21:05:52 +03:00
Taner Sener 15a107a0fd Upgrade gradle wrapper version. 2018-12-08 20:56:19 +03:00
Taner Sener 5b392e4a85 Use new version of Android gradle plugin. 2018-12-08 20:41:24 +03:00
Taner Sener d719a02d14 disable sdl2 auto-detection in ffmpeg build scripts. 2018-12-08 11:27:04 +03:00
Taner Sener 6ac802ce81 video4linux2 enabled again, #48 fixed with option 2. 2018-12-07 21:24:39 +03:00
Taner Sener f6843481e4 Disable v4l2 and fix #48. 2018-12-07 09:42:07 +03:00
Taner Sener e259e4a437 android ndk version is printed during library compilation. 2018-12-06 21:00:02 +03:00
Taner Sener 0897c655b1 Disabled fontconfig test bz106632.c due to deprecated system() calls 2018-11-18 09:15:58 +03:00
Taner Sener 3a14b142f7 README updated: Versions section revised as Releases 2018-11-12 19:18:12 +03:00
Taner Sener bb1399ad83 test-app: amr conversion command updated 2018-10-28 15:40:09 +03:00
Taner Sener 84d8a153c2 Stream information typo fixed 2018-10-26 17:00:32 +03:00
Taner Sener 91ee58ca4b delimiter validation added in execute() 2018-10-26 14:35:20 +03:00
Taner Sener 334987736a documentation update 2018-10-26 14:11:46 +03:00
Taner Sener 8d3d809482 Merged v3.0 2018-10-25 21:38:54 +03:00
Taner Sener fbf8757bc9 Unused source files removed 2018-10-25 21:20:58 +03:00
Taner Sener eb5810a2b3 ios test-app using v3.0 2018-10-25 20:41:20 +03:00
Taner Sener 05dee70dcc documentation update 2018-10-25 18:00:49 +03:00
Taner Sener 9fde72ac48 fixed: gpl package detection 2018-10-25 13:43:43 +03:00
Taner Sener f9912c462c android test-app versions updated 2018-10-25 13:10:53 +03:00
Taner Sener fdfef17c51 README update: package table updated 2018-10-25 01:24:08 +03:00
Taner Sener 5f86552238 README, testing html table 2018-10-25 01:09:50 +03:00
Taner Sener b4287287eb README packages table updated 2018-10-25 00:21:37 +03:00
Taner Sener 5cc967fb92 preparing release 2018-10-24 23:37:48 +03:00
Taner Sener 56df2b1018 doc updated 2018-10-24 21:43:36 +03:00
Taner Sener 5403567631 test-app updated: manual tests added for chromaprint and libwebp 2018-10-24 20:56:00 +03:00
Taner Sener 82e08a56b9 ios update: optional videotoolbox support handled in autools files 2018-10-24 10:15:39 +03:00
Taner Sener e6ff6f2951 version update: ffmpeg v4.1-dev-1517-gc2ac3b8e6a 2018-10-24 09:35:50 +03:00
Taner Sener 1b855d5762 version update: libaom v1.0.0-820-g4c118dc5 2018-10-24 01:58:57 +03:00
Taner Sener 6db573c9b3 version update: opus v1.3 2018-10-24 01:48:29 +03:00
Taner Sener 3831dcfeb8 updated:project logo 2018-10-24 01:29:50 +03:00
Taner Sener 010a11aa78 updated: media file used for https testing 2018-10-24 01:19:20 +03:00
Taner Sener 9c4092acd5 updated: using delimiter in test apps 2018-10-24 00:45:03 +03:00
Taner Sener aa99132930 updated: size optimization disabled on debug builds 2018-10-24 00:38:33 +03:00
Taner Sener 9dfae4be30 updated: cpu architectures on ios 2018-10-24 00:37:56 +03:00
Taner Sener 7f9ebf9988 new api: package detection and external library methods implemented on ios 2018-10-24 00:10:05 +03:00
Taner Sener 36f5dd2ece new api: getLastXXX methods implemented on ios 2018-10-23 19:38:14 +03:00
Taner Sener 133c0c42eb new api: executeWithDelimiter method added for ios 2018-10-23 19:37:42 +03:00
Taner Sener 48645800ec new api: getMediaInformation for ios 2018-10-23 19:26:57 +03:00
Taner Sener 998d3bfa37 updated: new test case for start time 2018-10-22 22:15:47 +03:00
Taner Sener 60d1ed9f90 updated: rounding mode for start time 2018-10-22 13:46:07 +03:00
Taner Sener 209131b92f fixed: index method handling substring length 2018-10-21 22:27:46 +03:00
Taner Sener 1a88f77684 fixed: getMediaInformation method return type fixed on android 2018-10-20 00:28:43 +03:00
Taner Sener a4fadfce40 fixed: last command output filtered based on log severity 2018-10-19 23:28:18 +03:00
Taner Sener a737b02e88 MediaInformationTests completed 2018-10-19 22:02:49 +03:00
Taner Sener 235fe08dc4 MediaInformation classes added. 2018-10-19 11:02:22 +03:00
Taner Sener 893dcf8582 FFmpegTest class added 2018-10-18 08:33:36 +03:00
Taner Sener 2e20471922 custom package name defined on android platform. 2018-10-17 23:39:45 +03:00
Taner Sener baf251e659 fixed: log level is effective for system commands 2018-10-17 22:50:35 +03:00
Taner Sener 1a9ac6dbb0 new api feature: system execute method implemented on android 2018-10-17 21:25:20 +03:00
Taner Sener 317d01c3e6 new native api: getBuildConf method added for android 2018-10-17 20:16:29 +03:00
Taner Sener cd8a8e2145 new api: getExternalLibraries on android 2018-10-17 18:04:46 +03:00
Taner Sener fa8d119669 new api: last return code and last command output on android 2018-10-17 18:03:37 +03:00
Taner Sener 9c5cf7d825 fixed: PIC for cmake based libraries on android platform 2018-10-17 12:22:44 +03:00
Taner Sener 554bbe3fbf android test app permissions updated 2018-10-17 09:28:33 +03:00
Taner Sener 2f2f779d12 android test app updated with twolame test 2018-10-17 08:15:35 +03:00
Taner Sener fe7ea3a975 reverting ffmpeg back to v4.1-dev-1368-gd3bda871f0 2018-10-16 23:07:45 +03:00
Taner Sener ed755140b3 updated: libaom version inside .pc file 2018-10-16 21:23:16 +03:00
Taner Sener b03c484fd3 ios test app updated with new codecs 2018-10-16 20:41:47 +03:00
Taner Sener b665a4ee34 avfoundation enabled for ios 2018-10-16 19:43:19 +03:00
Taner Sener f43eaa7a08 speed option implemented 2018-10-16 19:09:27 +03:00
Taner Sener 55b28d48e6 videotoolbox enabled for ios 2018-10-16 18:41:34 +03:00
Taner Sener cdd2d54f4c Updated package information 2018-10-16 18:02:39 +03:00
Taner Sener fbe3dd4806 version update: libaom-v1.0.0-773-g07f8a18bb 2018-10-16 00:47:17 +03:00
Taner Sener 76ec9d59cf version update: x264-20181015 2018-10-16 00:43:23 +03:00
Taner Sener d2a3df33b6 Public web page updated 2018-10-16 00:41:55 +03:00
Taner Sener 5bffc5ed9d README updated 2018-10-15 22:51:15 +03:00
Taner Sener 95f6fdd9e4 logo name updated 2018-10-15 22:27:51 +03:00
Taner Sener 1a9a47c65b platform specific ffmpeg outputs enabled. 2018-10-15 22:14:57 +03:00
Taner Sener 1d3c0e7f60 ffmpeg n4.1-dev-1457-ge1e6a31216 2018-10-15 21:59:10 +03:00
Taner Sener a307a10c32 updated: ios target host 2018-10-15 20:33:38 +03:00
Taner Sener 78e986bf20 bitcode removed from cxxflags for ios i386 and x86-64 architectures 2018-10-15 20:30:40 +03:00
Taner Sener e702bef31f new external library: tesseract 2018-10-15 04:16:26 +03:00
Taner Sener 006a001fd0 new external library: sdl 2018-10-14 14:14:01 +03:00
Taner Sener 7d29088799 new external library: twolame 2018-10-14 13:36:33 +03:00
Taner Sener dfddf18b52 new major version 2018-10-14 12:22:34 +03:00
Taner Sener 1336eab42f updated: ios release package information 2018-10-14 12:18:44 +03:00
Taner Sener e01989639d fixed: ios x265 v2.9 build errors 2018-10-14 11:41:09 +03:00
Taner Sener 1b041324b4 fixed; android x265 v2.9 linking errors 2018-10-14 10:10:08 +03:00
Taner Sener df3faba968 using x265 v2.9 2018-10-13 23:15:33 +03:00
Taner Sener 85c4fe3308 Update issue templates 2018-10-05 19:52:14 +03:00
Taner Sener 1b3b2c3c2f android native version bump 2018-09-29 18:17:13 +03:00
Taner Sener d9d31985df android test-app version bump 2018-09-29 18:09:12 +03:00
Taner Sener 322877b3c3 versions in fontconfig build scripts updated. 2018-09-29 18:08:49 +03:00
Taner Sener 9d414b9790 Reverted "using ffmpeg n4.1-dev-1349-g179ed2d2e0 version"
This reverts commit 318efe8a5d.
2018-09-29 18:02:18 +03:00
Taner Sener 270fc3f1ad ignored files updated for fontconfig 2018-09-29 14:09:29 +03:00
Taner Sener d2ef2da94b fontconfig patch applied for https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/109 2018-09-29 13:28:41 +03:00
Taner Sener f92c5288b9 fontconfig v2.13.1 2018-09-29 12:17:28 +03:00
Taner Sener 248a6cba7a update release version 2018-09-29 12:17:27 +03:00
Taner Sener 318efe8a5d using ffmpeg n4.1-dev-1349-g179ed2d2e0 version 2018-09-29 11:18:26 +03:00
Taner Sener ea9abafaa7 preparing next minor release 2018-09-29 10:41:21 +03:00
Taner Sener 9ede8768f5 README, misleading Xcode support information corrected 2018-09-29 09:44:05 +03:00
Taner Sener 1fcf112ed0 Minor changes for Xcode 7.3.1 compatibility, fixes #28 2018-09-29 09:31:30 +03:00
Taner Sener ace472d20c Using custom Xcode for building. 2018-09-27 12:34:39 +03:00
Taner Sener 36fa6b0028 New keys added in IOS framework Info.plist file 2018-09-26 13:41:18 +03:00
Taner Sener 841a44e2c8 IOS static universal binary generation merged from dev-v2.x. 2018-09-25 14:27:35 +03:00
Taner Sener 29ca9e37e7 Fixed IOS dynamic framework generation, issue #27 2018-09-25 13:55:19 +03:00
Taner Sener f0a65465e9 README updated. 2018-09-22 23:08:42 +03:00
Taner Sener 4808e4c686 ios static universal libraries fixed. 2018-09-22 22:17:34 +03:00
Taner Sener 41f55f415e Updated README. 2018-09-20 19:48:00 +03:00
Taner Sener 3716c4623b Removed MinimumOSVersion from ios Info.plist 2018-09-19 15:35:45 +03:00
Taner Sener 7ccf16f130 libvpx minimum ios version set to 7.0 in order to build library on IOS 12. 2018-09-19 14:45:32 +03:00
Taner Sener 2cc3a9b0db Building static ios libraries enabled. 2018-09-19 13:48:44 +03:00
Taner Sener 21c071bebe API documentation update. 2018-09-16 20:27:52 +03:00
Taner Sener caa4ac1f9b Using latest released versions. 2018-09-16 20:21:04 +03:00
Taner Sener 09caf1e997 Android test application uses the latest published version. 2018-09-16 19:32:50 +03:00
Taner Sener b3109cf276 Preparing v2.1.1 patch for android. 2018-09-16 17:22:23 +03:00
Taner Sener 4bd20725a8 Fixed armeabi-v7a-neon ABI for issue #24 2018-09-16 15:57:31 +03:00
Taner Sener 0a127d4370 armeabi-v7a ABI load log fixed. 2018-09-16 13:59:11 +03:00
Taner Sener ba7afe784d Redirection documentation updated. 2018-09-11 12:12:02 +03:00
Taner Sener e73224d560 Updated setFontDirectory usage example 2018-09-11 07:35:12 +03:00
Taner Sener 4d544fa7ca @rpath paths fixed for frameworks in ios.sh. 2018-09-07 22:23:14 +03:00
Taner Sener d500463706 Universal binary creation fixed. 2018-09-07 20:51:53 +03:00
Taner Sener a3b95188fb Updating version to v2.2 2018-09-07 16:05:51 +03:00
Taner Sener 7d27ab7be5 Merging documentation updates from master. 2018-09-07 15:42:24 +03:00
Taner Sener 7681389a9c Updated IOS test-app to v2.1.1. 2018-09-07 14:05:49 +03:00
Taner Sener e85b08e7c2 preparing IOS v2.1.1 patch, fixes #22. 2018-09-07 12:56:37 +03:00
Taner Sener d298c9ac3b burning subtitles for ios arm architectures fixed. 2018-09-07 09:52:47 +03:00
Taner Sener 5ffc79e879 Using new test-app gifs. 2018-09-05 23:02:58 +03:00
Taner Sener 2f08be1ff9 Android test-app icons updated. 2018-09-05 22:55:31 +03:00
Taner Sener 6f5262748f Using EasyTipView from cocoapods. 2018-09-05 22:41:20 +03:00
Taner Sener e2a4766c61 MinimumOSVersion defined in Info.plist for IOS. 2018-09-05 18:01:20 +03:00
Taner Sener 63e87d04ef Public site updated. 2018-09-05 15:58:54 +03:00
Taner Sener fe73ca4697 android test-app dependencies updated. 2018-09-05 14:55:39 +03:00
Taner Sener 68026adb2c README updated. 2018-09-05 13:27:58 +03:00
Taner Sener ede6a05766 video-gpl package removed, currently it has the same libraries with min-gpl. 2018-09-05 10:42:48 +03:00
Taner Sener ba6c218b21 new android release packages fixed. 2018-09-05 09:49:30 +03:00
Taner Sener 1d5b3f7603 ios release script updated. 2018-09-05 03:36:27 +03:00
Taner Sener b33891eba9 android native versions updated 2018-09-05 03:27:53 +03:00
Taner Sener f7cbe9c006 Release packages updated. 2018-09-05 02:09:28 +03:00
Taner Sener 84b740d514 Updating documentation. 2018-09-05 00:45:37 +03:00
Taner Sener 703459c2cf ios test-app icons updated. 2018-09-04 22:37:31 +03:00
Taner Sener 04d2709eb4 -d, --debug option added. 2018-09-04 22:37:31 +03:00
Taner Sener 05d2422bd5 video codec explicitly specified. 2018-09-04 21:56:55 +03:00
Taner Sener f57a3c6c05 paths fixed for subtitle tab. 2018-09-04 21:56:13 +03:00
Taner Sener 5392566ed6 x265 assembly disabled for android x86. 2018-09-04 21:25:47 +03:00
Taner Sener 58cff5c8fb android icons updated. 2018-09-04 21:25:04 +03:00
Taner Sener 2f854d843a hiding keyboard when buttons are clicked @ ios test-app command tab. 2018-09-01 22:10:46 +03:00
Taner Sener 6d02e9b0dc missing arm cpus added for ios cpu detection. 2018-09-01 22:02:58 +03:00
Taner Sener 156f51cacf ios test-app launch screen modified. 2018-09-01 21:39:42 +03:00
Taner Sener de7c992bd7 ARC enabled for ios. Fixes #16 2018-09-01 20:02:41 +03:00
Taner Sener 9ca086452c ios x265 compilation updated. 2018-09-01 19:12:26 +03:00
Taner Sener b96ac2b4b3 unnecessary log lines removed from gas-preprocessor download phase. 2018-09-01 15:38:38 +03:00
Taner Sener 05cc4f9998 Android icons updated. 2018-09-01 14:12:43 +03:00
Taner Sener 870c674e0c assembly disabled for android arm due to relocation errors. 2018-09-01 13:49:12 +03:00
Taner Sener 166404fecc SIGSEGV fixed for android x86_64 architecture. 2018-09-01 10:52:21 +03:00
Taner Sener 633238b79f README logo link updated. 2018-08-30 20:21:21 +03:00
Taner Sener b6ac3d143d README updated. 2018-08-30 20:15:18 +03:00
Taner Sener e5581f60ce android test app icon registered. 2018-08-30 19:31:26 +03:00
Taner Sener 1ad6a02bf7 ios test app icon registered. 2018-08-30 19:30:45 +03:00
Taner Sener 47d8c54da3 assembly disabled for gmp. 2018-08-30 17:41:50 +03:00
Taner Sener e1870ecde9 Using newer x264 snapshot. 2018-08-30 16:42:53 +03:00
Taner Sener 761aa55a46 Using newer libaom snapshot. 2018-08-30 16:38:46 +03:00
Taner Sener 1e67fdb1e9 Using expat v2.2.6. 2018-08-30 16:35:25 +03:00
Taner Sener da48d1edb8 README updated. 2018-08-30 16:01:28 +03:00
Taner Sener a7c009704e Test applications updated. 2018-08-14 00:11:42 +03:00
Taner Sener c144aa3058 (!received_sigterm) validation added inside ifilter_send_eof() to complete operation cancellation. 2018-08-13 23:41:42 +03:00
Taner Sener c1584b8080 Using new features in IOS test-app. Closes issues #14 and #15. 2018-08-13 10:36:30 +03:00
Taner Sener dd6341359d Bug fixes for IOS api. 2018-08-13 08:20:13 +03:00
Taner Sener 107b5f1efd Uncaught exception handler added for IOS test-app. 2018-08-13 08:15:48 +03:00
Taner Sener 529893fd84 Updated statistics forwarding rules. 2018-08-13 08:13:58 +03:00
Taner Sener 6aee1343f0 IOS API redesigned. 2018-08-12 21:48:52 +03:00
Taner Sener c0d231337e Package refactoring for RunCallback class. 2018-08-11 07:49:43 +03:00
Taner Sener 77d8e86859 Using newer gradle plugin version. 2018-08-11 02:09:57 +03:00
Taner Sener a578211c67 Android API redesigned. 2018-08-11 02:06:12 +03:00
Taner Sener ef1bbd1c78 New versions for x264 and libaom. 2018-08-09 18:27:14 +03:00
Taner Sener 502df26547 errors fixed in ios test-app vidstab tab. 2018-08-09 18:18:41 +03:00
Taner Sener fa2d24e136 Android test application updated. 2018-08-09 17:55:01 +03:00
Taner Sener 0eb3f23dde Better tooltip registration for android test-app. 2018-08-07 23:47:55 +03:00
Taner Sener 5b999a40c4 Log callback function string allocation improved. 2018-08-07 23:45:02 +03:00
Taner Sener 22bddcf207 Android test-app updated. 2018-08-07 22:52:33 +03:00
Taner Sener 49e7f5e312 info popups added for command and vid.stab tabs. 2018-08-07 09:10:16 +03:00
Taner Sener ecb97b6b9a snappy ios link options updated. 2018-08-07 01:55:04 +03:00
Taner Sener 043138e413 libjpeg-turbo ios build script updated with cmake. 2018-08-07 01:32:42 +03:00
Taner Sener 8cb63decf4 assembly disabled in gmp for android arm-v7a and arm-v7a-neon due to linking errors. 2018-08-07 00:01:44 +03:00
Taner Sener c81ee56ab4 Android log redirection errors fixed. 2018-08-06 23:52:30 +03:00
Taner Sener 0a0f008aca Updated libjpeg-turbo to v2.0.0. 2018-08-05 19:34:23 +03:00
Taner Sener 328e37db0f Updated libpng to v1.6.35. 2018-08-05 19:04:39 +03:00
Taner Sener 4f36ac31fc Updated fribidi to v1.0.5. 2018-08-05 18:56:53 +03:00
Taner Sener d0bc612062 Updated freetype to v2.9.1. 2018-08-05 18:56:53 +03:00
Taner Sener 701860d5ed Android x265 build errors fixed. 2018-08-05 18:50:42 +03:00
Taner Sener 172af56b15 asm enabled for ios i386 and x86_64 architectures 2018-08-05 16:50:55 +03:00
Taner Sener c4c5d60632 ios test-app subtitle resource path updated. 2018-08-05 13:15:19 +03:00
Taner Sener 9bea827e39 sed name collision fixed. 2018-08-05 13:14:07 +03:00
Taner Sener 71e7856102 android x265 build errors updated. 2018-08-05 12:59:53 +03:00
Taner Sener bc05d66b5b Defined platform dependent sed inline edit command. 2018-08-05 12:56:50 +03:00
Taner Sener a39d47f71a Android chromaprint build errors fixed. 2018-08-05 11:46:11 +03:00
Taner Sener 10b024082a Moving subtitle file to correct Android resource path. 2018-08-05 11:45:44 +03:00
Taner Sener d109a8d3d8 IOS test-app video positions updated. 2018-08-05 10:17:38 +03:00
Taner Sener 6c49e64b66 IOS build errors fixed. 2018-08-05 01:58:09 +03:00
Taner Sener b076562170 Using newer libaom snaphot. 2018-08-05 00:29:07 +03:00
Taner Sener 149adaed4a Using newer x264 snapshot version. 2018-08-05 00:29:07 +03:00
Taner Sener 4529ec7ba1 Removing frei0r from build scripts. 2018-08-04 15:07:15 +03:00
Taner Sener 25d576abdb Audio, subtitle and vid.stab tabs added to IOS test-app. 2018-08-04 14:37:49 +03:00
Taner Sener e2ff9c62a6 Updated video tab design for IOS test-app. 2018-08-03 23:42:47 +03:00
Taner Sener 5cdec4ed43 Less logs for android log internals. 2018-08-02 21:19:12 +03:00
Taner Sener c039a72e01 IOS test-app slideshow tab updated as video tab. 2018-08-02 21:06:37 +03:00
Taner Sener 4d544be832 IOS test-app command tab updated. 2018-08-02 19:10:31 +03:00
Taner Sener 66267ef7f0 Better os detection. 2018-08-02 18:15:54 +03:00
Taner Sener f1c0224aac null check added before calling JNIEnv->GetStringUTFChars. Fixed #9. 2018-08-02 18:01:20 +03:00
Taner Sener da6a51af70 IOS lipo path is extracted from xcrun. Fixes #12. 2018-08-02 17:53:15 +03:00
Taner Sener 4c1cd17ba2 Build fix for arm-v7a-neon architecture. 2018-08-02 17:46:09 +03:00
Taner Sener c1789def81 android/ios APIs revised; fixed #13. 2018-08-02 17:42:00 +03:00
Taner Sener c9449c894e New tabs added to ios test application. 2018-07-26 15:35:30 +03:00
Taner Sener 87d1a546ae chromaprint, x265 support 2018-07-21 19:59:03 +03:00
Taner Sener 4a221b2845 ffmpeg v4.0.2 2018-07-19 19:50:20 +03:00
Taner Sener 492626cc32 libaom v2018.07.18-snapshot 2018-07-19 17:06:44 +03:00
Taner Sener 5010b2c8d4 gnutls v3.5.19 2018-07-19 17:03:39 +03:00
Taner Sener 7c8743ba07 Creating slideshow.mp4 under documents folder for IOS test application. 2018-07-19 13:33:56 +03:00
Taner Sener c829f6660f android versions updated. 2018-07-13 20:03:30 +03:00
Taner Sener c612d2eb15 Fixed issue #8 for v2.x 2018-07-12 16:50:18 +03:00
Taner Sener 0933a77265 README updated 2018-07-12 16:45:38 +03:00
25014 changed files with 3218589 additions and 2341579 deletions
+3
View File
@@ -0,0 +1,3 @@
patreon: tanersener
open_collective: mobile-ffmpeg
custom: ['https://buymeacoff.ee/tanersener']
+33
View File
@@ -0,0 +1,33 @@
---
name: Issue Template
about: Create an issue to help us improve
---
**Description**
Description of what the issue is about.
**Expected behavior**
What you expected to happen.
**Current behavior**
What happened.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Logs**
Post logs here or paste them to [Ghostbin](https://ghostbin.co) and insert the link here.
**Environment**
- Platform: [e.g. Android/IOS]
- Architecture: [arm-v7a, arm-v7a-neon, arm64-v8a, x86, x86_64, armv7, armv7s, arm64, i386, x86_64]
- Version (if applicable) [e.g. v1.2]
- Source branch (if applicable) [e.g. master, dev-v2.x]
- Xcode version (if applicable) [e.g. 7.3.1, 9.0.1]
- Cocoapods version (if applicable) [e.g. 1.2.1]
- Android Studio version (if applicable) [e.g. 3.1]
- Android NDK version (if applicable) [e.g. 16b, 17c]
**Other**
Add any other context about the problem here.
+19
View File
@@ -0,0 +1,19 @@
name: Mark stale issues and pull requests
on:
schedule:
- cron: "0 0 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
stale-pr-message: 'This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
+174
View File
@@ -0,0 +1,174 @@
branches:
only:
- master
- development
git:
quiet: true
depth: false
jobs:
include:
- name: "Android Main Build"
language: android
os: linux
dist : trusty
addons:
apt:
packages:
- autoconf
- automake
- libtool
- pkg-config
- curl
- git
- cmake
- gcc
- gperf
- texinfo
- yasm
- bison
- autogen
- patch
android:
components:
- tools
- platform-tools
- build-tools-28.0.3
- android-24
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
install:
- echo y | sdkmanager "ndk;21.3.6528147"
- echo y | sdkmanager "cmake;3.10.2.4988404"
before_install:
- touch $HOME/.android/repositories.cfg
before_script:
- export ANDROID_NDK_ROOT=${ANDROID_HOME}ndk/21.3.6528147
- rm -f ./build.log
- wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.gz;tar zxvf nasm-2.14.02.tar.gz;cd nasm-2.14.02;./configure;make;sudo make install;cd ..
after_success:
- grep -e INFO ./build.log | grep build
after_failure:
- tail -30 ./build.log
- tail -30 ./src/ffmpeg/ffbuild/config.log
script:
- bash ./android.sh --no-output-redirection -d
- name: "Android LTS Build"
language: android
os: linux
dist : trusty
addons:
apt:
packages:
- autoconf
- automake
- libtool
- pkg-config
- curl
- git
- cmake
- gcc
- gperf
- texinfo
- yasm
- bison
- autogen
- patch
android:
components:
- tools
- platform-tools
- build-tools-28.0.3
- android-16
- android-21
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
install:
- echo y | sdkmanager "ndk;21.3.6528147"
- echo y | sdkmanager "cmake;3.10.2.4988404"
before_install:
- touch $HOME/.android/repositories.cfg
before_script:
- export ANDROID_NDK_ROOT=${ANDROID_HOME}ndk/21.3.6528147
- rm -f ./build.log
- wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.gz;tar zxvf nasm-2.14.02.tar.gz;cd nasm-2.14.02;./configure;make;sudo make install;cd ..
after_success:
- grep -e INFO ./build.log | grep build
after_failure:
- tail -30 ./build.log
- tail -30 ./src/ffmpeg/ffbuild/config.log
script:
- bash ./android.sh --lts --no-output-redirection -d
- name: "iOS Main Build"
language: objective-c
os: osx
osx_image: xcode10.2
addons:
homebrew:
packages:
- nasm
update: true
before_script:
- rm -f ./build.log
after_success:
- grep -e INFO ./build.log | grep build
after_failure:
- tail -30 ./build.log
- tail -30 ./src/ffmpeg/ffbuild/config.log
script:
- bash ./ios.sh --no-output-redirection --disable-arm64e
- name: "iOS LTS Build"
language: objective-c
osx_image: xcode7.3
os: osx
addons:
homebrew:
packages:
- nasm
update: true
before_script:
- rm -f ./build.log
after_success:
- grep -e INFO ./build.log | grep build
after_failure:
- tail -30 ./build.log
- tail -30 ./src/ffmpeg/ffbuild/config.log
script:
- bash ./ios.sh --lts --no-output-redirection --disable-armv7 --disable-armv7s --disable-i386
- name: "tvOS Main Build"
language: objective-c
os: osx
osx_image: xcode10.2
addons:
homebrew:
packages:
- nasm
update: true
before_script:
- rm -f ./build.log
after_success:
- grep -e INFO ./build.log | grep build
after_failure:
- tail -30 ./build.log
- tail -30 ./src/ffmpeg/ffbuild/config.log
script:
- bash ./tvos.sh --no-output-redirection
- name: "tvOS LTS Build"
language: objective-c
os: osx
osx_image: xcode7.3
addons:
homebrew:
packages:
- nasm
update: true
before_script:
- rm -f ./build.log
after_success:
- grep -e INFO ./build.log | grep build
after_failure:
- tail -30 ./build.log
- tail -30 ./src/ffmpeg/ffbuild/config.log
script:
- bash ./tvos.sh --lts --no-output-redirection
+513 -103
View File
@@ -1,83 +1,232 @@
# MobileFFmpeg [![Join the chat at https://gitter.im/mobile-ffmpeg/Lobby](https://badges.gitter.im/mobile-ffmpeg/Lobby.svg)](https://gitter.im/mobile-ffmpeg/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ![GitHub release](https://img.shields.io/badge/release-v2.1.1-blue.svg) ![Bintray](https://img.shields.io/badge/bintray-v2.1.1-blue.svg) ![CocoaPods](https://img.shields.io/badge/pod-v2.1.1-blue.svg)
# MobileFFmpeg [![Financial Contributors on Open Collective](https://opencollective.com/mobile-ffmpeg/all/badge.svg?label=financial+contributors)](https://opencollective.com/mobile-ffmpeg) ![GitHub release](https://img.shields.io/badge/release-v4.4-blue.svg) ![Maven Central](https://img.shields.io/maven-central/v/com.arthenica/mobile-ffmpeg-min) ![CocoaPods](https://img.shields.io/badge/pod-v4.4-blue.svg) [![Build Status](https://travis-ci.org/tanersener/mobile-ffmpeg.svg?branch=master)](https://travis-ci.org/tanersener/mobile-ffmpeg)
FFmpeg for Android and IOS
FFmpeg for Android, iOS and tvOS.
<img src="https://github.com/tanersener/mobile-ffmpeg/blob/dev-v2.x/docs/assets/mobile-ffmpeg-logo-v4.png" width="240">
Not maintained anymore as explained in [Whats next for MobileFFmpeg?](https://tanersener.medium.com/whats-next-for-mobileffmpeg-44d2fac6f09b). Superseded by [FFmpegKit](https://github.com/tanersener/ffmpeg-kit).
<img src="https://github.com/tanersener/mobile-ffmpeg/blob/master/docs/assets/mobile-ffmpeg-logo-v7.png" width="320">
### 1. Features
- Use prebuilt binaries available under `Github`/`JCenter`/`CocoaPods` or build your own version with external libraries you need
- Includes both `FFmpeg` and `FFprobe`
- Use binaries available at `Github`/`Maven Central`/`CocoaPods` or build your own version with external libraries you need
- Supports
- Both Android and IOS
- FFmpeg `v3.4.x` and `v4.0.x` releases
- 24 external libraries
- Android, iOS and tvOS
- FFmpeg `v3.4.x`, `v4.0.x`, `v4.1`, `v4.2` , `v4.3` and `v4.4-dev` releases
- 29 external libraries
`chromaprint`, `fontconfig`, `freetype`, `fribidi`, `gmp`, `gnutls`, `kvazaar`, `lame`, `libaom`, `libass`, `libiconv`, `libilbc`, `libtheora`, `libvorbis`, `libvpx`, `libwebp`, `libxml2`, `opencore-amr`, `opus`, `shine`, `snappy`, `soxr`, `speex`, `wavpack`
`chromaprint`, `fontconfig`, `freetype`, `fribidi`, `gmp`, `gnutls`, `kvazaar`, `lame`, `libaom`, `libass`, `libiconv`, `libilbc`, `libtheora`, `libvorbis`, `libvpx`, `libwebp`, `libxml2`, `opencore-amr`, `openh264`, `opus`, `sdl`, `shine`, `snappy`, `soxr`, `speex`, `tesseract`, `twolame`, `vo-amrwbenc`, `wavpack`
- 4 external libraries with GPL license
- 5 external libraries with GPL license
`vid.stab`, `x264`, `x265`, `xvidcore`
`rubberband`, `vid.stab`, `x264`, `x265`, `xvidcore`
- Exposes FFmpeg capabilities both directly from FFmpeg libraries and through MobileFFmpeg wrapper library
- Creates shared libraries (.so for Android, .dylib for IOS)
- Includes cross-compile instructions for 38 open-source libraries
- Concurrent execution
- Exposes both FFmpeg library and MobileFFmpeg wrapper library capabilities
- Includes cross-compile instructions for 47 open-source libraries
`chromaprint`, `expat`, `ffmpeg`, `fontconfig`, `freetype`, `fribidi`, `giflib`, `gmp`, `gnutls`, `kvazaar`, `lame`, `libaom`, `libass`, `libiconv`, `libilbc`, `libjpeg`, `libjpeg-turbo`, `libogg`, `libpng`, `libtheora`, `libuuid`, `libvorbis`, `libvpx`, `libwebp`, `libxml2`, `nettle`, `opencore-amr`, `opus`, `shine`, `snappy`, `soxr`, `speex`, `tiff`, `vid.stab`, `wavpack`, `x264`, `x265`, `xvidcore`
`chromaprint`, `expat`, `ffmpeg`, `fontconfig`, `freetype`, `fribidi`, `giflib`, `gmp`, `gnutls`, `kvazaar`, `lame`, `leptonica`, `libaom`, `libass`, `libiconv`, `libilbc`, `libjpeg`, `libjpeg-turbo`, `libogg`, `libpng`, `libsamplerate`, `libsndfile`, `libtheora`, `libuuid`, `libvorbis`, `libvpx`, `libwebp`, `libxml2`, `nettle`, `opencore-amr`, `openh264`, `opus`, `rubberband`, `sdl`, `shine`, `snappy`, `soxr`, `speex`, `tesseract`, `tiff`, `twolame`, `vid.stab`, `vo-amrwbenc`, `wavpack`, `x264`, `x265`, `xvidcore`
- Licensed under LGPL 3.0, can be customized to support GPL v3.0
#### 1.1 Android
- Supports `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures
- Builds `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures
- Supports `zlib` and `MediaCodec` system libraries
- Camera access on [supported devices](https://developer.android.com/ndk/guides/stable_apis#camera)
- Builds shared native libraries (.so)
- Creates Android archive with .aar extension
#### 1.2 IOS
- Supports `armv7`, `armv7s`, `arm64`, `i386` and `x86_64` architectures
- Supports `API Level 16+`
#### 1.2 iOS
- Builds `armv7`, `armv7s`, `arm64`, `arm64e`, `i386`, `x86_64` and `x86_64` (Mac Catalyst) architectures
- Supports `bzip2`, `iconv`, `libuuid`, `zlib` system libraries and `AudioToolbox`, `VideoToolbox`, `AVFoundation` system frameworks
- Objective-C API
- Camera access
- `ARC` enabled library
- Built with `-fembed-bitcode` flag
- Creates IOS dynamic universal (fat) library
- Creates IOS dynamic framework for IOS 8 or later
- Creates static frameworks, static xcframeworks and static universal (fat) libraries (.a)
- Supports `iOS SDK 9.3` or later
#### 1.3 tvOS
- Builds `arm64` and `x86_64` architectures
- Supports `bzip2`, `iconv`, `libuuid`, `zlib` system libraries and `AudioToolbox`, `VideoToolbox` system frameworks
- Objective-C API
- `ARC` enabled library
- Built with `-fembed-bitcode` flag
- Creates static frameworks and static universal (fat) libraries (.a)
- Supports `tvOS SDK 9.2` or later
### 2. Using
Prebuilt libraries are available under [Github](https://github.com/tanersener/mobile-ffmpeg/releases), [JCenter](https://bintray.com/bintray/jcenter) and [CocoaPods](https://cocoapods.org)
There are eight different prebuilt packages. Below you can see which external libraries are enabled in each of them.
Prebuilt binaries are available at [Github](https://github.com/tanersener/mobile-ffmpeg/releases), [Maven Central](https://repo1.maven.org/maven2) and [CocoaPods](https://cocoapods.org).
| min | min-gpl | https | https-gpl | audio | video | full | full-gpl |
| :----: | :----: | :----: | :----: | :----: | :----: | :----: | :----: |
| - | vid.stab<sup>3</sup> <br/> x264<sup>1</sup> <br/> x265<sup>3</sup> <br/> xvidcore<sup>1</sup> | gnutls | gnutls <br/> vid.stab<sup>3</sup> <br/> x264<sup>1</sup> <br/> x265<sup>3</sup> <br/> xvidcore<sup>1</sup> | chromaprint<sup>3</sup> <br/> lame <br/> libilbc<sup>1</sup> <br/> libvorbis <br/> opencore-amr <br/> opus<sup>1</sup> <br/> shine <br/> soxr<sup>2</sup> <br/> speex <br/> wavpack | fontconfig <br/> freetype <br/> fribidi <br/> kvazaar <br/> libaom<sup>2</sup> <br/> libass <br/> libiconv <br/> libtheora <br/> libvpx <br/> snappy<sup>1</sup> | chromaprint<sup>3</sup> <br/> fontconfig <br/> freetype <br/> fribidi <br/> gmp <br/> gnutls <br/> kvazaar <br/> lame <br/> libaom<sup>2</sup> <br/> libass <br/> libiconv <br/> libilbc<sup>1</sup> <br/> libtheora <br/> libvorbis <br/> libvpx <br/> libwebp <br/> libxml2 <br/> opencore-amr <br/> opus<sup>1</sup> <br/> shine <br/> snappy<sup>1</sup> <br/> soxr<sup>2</sup> <br/> speex <br/> wavpack | chromaprint<sup>3</sup> <br/> fontconfig <br/> freetype <br/> fribidi <br/> gmp <br/> gnutls <br/> kvazaar <br/> lame <br/> libaom<sup>2</sup> <br/> libass <br/> libiconv <br/> libilbc<sup>1</sup> <br/> libtheora <br/> libvorbis <br/> libvpx <br/> libwebp <br/> libxml2 <br/> opencore-amr <br/> opus<sup>1</sup> <br/> shine <br/> snappy<sup>1</sup> <br/> soxr<sup>2</sup> <br/> speex <br/> vid.stab<sup>3</sup> <br/> wavpack <br/> x264<sup>1</sup> <br/> x265<sup>3</sup> <br/> xvidcore<sup>1</sup> |
#### 2.1 Packages
<sup>1</sup> - Supported since `v1.1`
There are eight different `mobile-ffmpeg` packages. Below you can see which system libraries and external libraries are enabled in each of them.
<sup>2</sup> - Supported since `v2.0`
Please remember that some parts of `FFmpeg` are licensed under the `GPL` and only `GPL` licensed `mobile-ffmpeg` packages include them.
<sup>3</sup> - Supported since `v2.1`
<table>
<thead>
<tr>
<th align="center"></th>
<th align="center"><sup>min</sup></th>
<th align="center"><sup>min-gpl</sup></th>
<th align="center"><sup>https</sup></th>
<th align="center"><sup>https-gpl</sup></th>
<th align="center"><sup>audio</sup></th>
<th align="center"><sup>video</sup></th>
<th align="center"><sup>full</sup></th>
<th align="center"><sup>full-gpl</sup></th>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><sup>external libraries</sup></td>
<td align="center">-</td>
<td align="center"><sup>vid.stab</sup><br><sup>x264</sup><br><sup>x265</sup><br><sup>xvidcore</sup></td>
<td align="center"><sup>gmp</sup><br><sup>gnutls</sup></td>
<td align="center"><sup>gmp</sup><br><sup>gnutls</sup><br><sup>vid.stab</sup><br><sup>x264</sup><br><sup>x265</sup><br><sup>xvidcore</sup></td>
<td align="center"><sup>lame</sup><br><sup>libilbc</sup><br><sup>libvorbis</sup><br><sup>opencore-amr</sup><br><sup>opus</sup><br><sup>shine</sup><br><sup>soxr</sup><br><sup>speex</sup><br><sup>twolame</sup><br><sup>vo-amrwbenc</sup><br><sup>wavpack</sup></td>
<td align="center"><sup>fontconfig</sup><br><sup>freetype</sup><br><sup>fribidi</sup><br><sup>kvazaar</sup><br><sup>libaom</sup><br><sup>libass</sup><br><sup>libiconv</sup><br><sup>libtheora</sup><br><sup>libvpx</sup><br><sup>libwebp</sup><br><sup>snappy</sup></td>
<td align="center"><sup>fontconfig</sup><br><sup>freetype</sup><br><sup>fribidi</sup><br><sup>gmp</sup><br><sup>gnutls</sup><br><sup>kvazaar</sup><br><sup>lame</sup><br><sup>libaom</sup><br><sup>libass</sup><br><sup>libiconv</sup><br><sup>libilbc</sup><br><sup>libtheora</sup><br><sup>libvorbis</sup><br><sup>libvpx</sup><br><sup>libwebp</sup><br><sup>libxml2</sup><br><sup>opencore-amr</sup><br><sup>opus</sup><br><sup>shine</sup><br><sup>snappy</sup><br><sup>soxr</sup><br><sup>speex</sup><br><sup>twolame</sup><br><sup>vo-amrwbenc</sup><br><sup>wavpack</sup></td>
<td align="center"><sup>fontconfig</sup><br><sup>freetype</sup><br><sup>fribidi</sup><br><sup>gmp</sup><br><sup>gnutls</sup><br><sup>kvazaar</sup><br><sup>lame</sup><br><sup>libaom</sup><br><sup>libass</sup><br><sup>libiconv</sup><br><sup>libilbc</sup><br><sup>libtheora</sup><br><sup>libvorbis</sup><br><sup>libvpx</sup><br><sup>libwebp</sup><br><sup>libxml2</sup><br><sup>opencore-amr</sup><br><sup>opus</sup><br><sup>shine</sup><br><sup>snappy</sup><br><sup>soxr</sup><br><sup>speex</sup><br><sup>twolame</sup><br><sup>vid.stab</sup><br><sup>vo-amrwbenc</sup><br><sup>wavpack</sup><br><sup>x264</sup><br><sup>x265</sup><br><sup>xvidcore</sup></td>
</tr>
<tr>
<td align="center"><sup>android system libraries</sup></td>
<td align="center" colspan=8><sup>zlib</sup><br><sup>MediaCodec</sup></td>
</tr>
<tr>
<td align="center"><sup>ios system libraries</sup></td>
<td align="center" colspan=8><sup>zlib</sup><br><sup>AudioToolbox</sup><br><sup>AVFoundation</sup><br><sup>iconv</sup><br><sup>VideoToolbox</sup><br><sup>bzip2</sup></td>
</tr>
<tr>
<td align="center"><sup>tvos system libraries</sup></td>
<td align="center" colspan=8><sup>zlib</sup><br><sup>AudioToolbox</sup><br><sup>iconv</sup><br><sup>VideoToolbox</sup><br><sup>bzip2</sup></td>
</tr>
</tbody>
</table>
#### 2.1 Android
1. Add MobileFFmpeg dependency from `jcenter()`
- `libilbc`, `opus`, `snappy`, `x264` and `xvidcore` are supported since `v1.1`
- `libaom` and `soxr` are supported since `v2.0`
- `chromaprint`, `vid.stab` and `x265` are supported since `v2.1`
- `sdl`, `tesseract`, `twolame` external libraries; `zlib`, `MediaCodec` Android system libraries; `bzip2`, `zlib` iOS system libraries and `AudioToolbox`, `VideoToolbox`, `AVFoundation` iOS system frameworks are supported since `v3.0`
- Since `v4.2`, `chromaprint`, `sdl` and `tesseract` libraries are not included in binary releases. You can still build them and include in your releases
- `AVFoundation` is not available on `tvOS`, `VideoToolbox` is not available on `tvOS` LTS releases
- Since `v4.3.1`, `iOS` and `tvOS` releases started to use `iconv` system library instead of `iconv` external library
- `vo-amrwbenc` is supported since `v4.4`
#### 2.2 Android
- For versions `4.4` and `4.4.LTS`, add `mavenCentral()` to your `build.gradle` and make sure that it is listed
before `jcenter()`
- For `4.3.2` and older releases, add `jcenter()`
```
dependencies {`
implementation 'com.arthenica:mobile-ffmpeg-full:2.1.1'
repositories {
mavenCentral()
}
```
2. Execute commands.
1. Add MobileFFmpeg dependency to your `build.gradle` in `mobile-ffmpeg-<package name>` pattern.
```
dependencies {
implementation 'com.arthenica:mobile-ffmpeg-full:4.4'
}
```
2. Execute synchronous FFmpeg commands.
```
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.FFmpeg;
int rc = FFmpeg.execute("-i file1.mp4 -c:v mpeg4 file2.mp4");
if (rc == RETURN_CODE_SUCCESS) {
Log.i(Config.TAG, "Command execution completed successfully.");
} else if (rc == RETURN_CODE_CANCEL) {
Log.i(Config.TAG, "Command execution cancelled by user.");
} else {
Log.i(Config.TAG, String.format("Command execution failed with rc=%d.", rc));
Log.i(Config.TAG, String.format("Command execution failed with rc=%d and the output below.", rc));
Config.printLastCommandOutput(Log.INFO);
}
```
3. Stop an ongoing operation.
3. Execute asynchronous FFmpeg commands.
```
FFmpeg.cancel();
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.FFmpeg;
long executionId = FFmpeg.executeAsync("-i file1.mp4 -c:v mpeg4 file2.mp4", new ExecuteCallback() {
@Override
public void apply(final long executionId, final int returnCode) {
if (returnCode == RETURN_CODE_SUCCESS) {
Log.i(Config.TAG, "Async command execution completed successfully.");
} else if (returnCode == RETURN_CODE_CANCEL) {
Log.i(Config.TAG, "Async command execution cancelled by user.");
} else {
Log.i(Config.TAG, String.format("Async command execution failed with returnCode=%d.", returnCode));
}
}
});
```
4. Enable log callback.
4. Execute FFprobe commands.
```
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.FFprobe;
int rc = FFprobe.execute("-i file1.mp4");
if (rc == RETURN_CODE_SUCCESS) {
Log.i(Config.TAG, "Command execution completed successfully.");
} else {
Log.i(Config.TAG, String.format("Command execution failed with rc=%d and the output below.", rc));
Config.printLastCommandOutput(Log.INFO);
}
```
5. Check execution output later.
```
int rc = Config.getLastReturnCode();
if (rc == RETURN_CODE_SUCCESS) {
Log.i(Config.TAG, "Command execution completed successfully.");
} else if (rc == RETURN_CODE_CANCEL) {
Log.i(Config.TAG, "Command execution cancelled by user.");
} else {
Log.i(Config.TAG, String.format("Command execution failed with rc=%d and the output below.", rc));
Config.printLastCommandOutput(Log.INFO);
}
```
6. Stop ongoing FFmpeg operations.
- Stop all executions
```
FFmpeg.cancel();
```
- Stop a specific execution
```
FFmpeg.cancel(executionId);
```
7. Get media information for a file.
```
MediaInformation info = FFprobe.getMediaInformation("<file path or uri>");
```
8. Record video using Android camera.
```
FFmpeg.execute("-f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05 <record file path>");
```
9. Enable log callback.
```
Config.enableLogCallback(new LogCallback() {
public void apply(LogMessage message) {
@@ -86,7 +235,7 @@ There are eight different prebuilt packages. Below you can see which external li
});
```
5. Enable statistics callback.
10. Enable statistics callback.
```
Config.enableStatisticsCallback(new StatisticsCallback() {
public void apply(Statistics newStatistics) {
@@ -94,166 +243,427 @@ There are eight different prebuilt packages. Below you can see which external li
}
});
```
11. Ignore the handling of a signal.
```
Config.ignoreSignal(Signal.SIGXCPU);
```
6. Set log level.
12. List ongoing executions.
```
final List<FFmpegExecution> ffmpegExecutions = FFmpeg.listExecutions();
for (int i = 0; i < ffmpegExecutions.size(); i++) {
FFmpegExecution execution = ffmpegExecutions.get(i);
Log.d(TAG, String.format("Execution %d = id:%d, startTime:%s, command:%s.", i, execution.getExecutionId(), execution.getStartTime(), execution.getCommand()));
}
```
13. Set default log level.
```
Config.setLogLevel(Level.AV_LOG_FATAL);
```
7. Register custom fonts directory.
14. Register custom fonts directory.
```
Config.setFontDirectory(this, "<folder with fonts>", Collections.EMPTY_MAP);
```
#### 2.2 IOS
1. Add MobileFFmpeg pod to your `Podfile`
#### 2.3 iOS / tvOS
1. Add MobileFFmpeg dependency to your `Podfile` in `mobile-ffmpeg-<package name>` pattern.
- iOS
```
pod 'mobile-ffmpeg-full', '~> 2.1.1'
pod 'mobile-ffmpeg-full', '~> 4.4'
```
2. Create and execute commands.
- tvOS
```
pod 'mobile-ffmpeg-tvos-full', '~> 4.4'
```
2. Execute synchronous FFmpeg commands.
```
#import <mobileffmpeg/MobileFFmpegConfig.h>
#import <mobileffmpeg/MobileFFmpeg.h>
int rc = [MobileFFmpeg execute: @"-i file1.mp4 -c:v mpeg4 file2.mp4"];
if (rc == RETURN_CODE_SUCCESS) {
NSLog(@"Command execution completed successfully.\n");
} else if (rc == RETURN_CODE_CANCEL) {
NSLog(@"Command execution cancelled by user.\n");
} else {
NSLog(@"Command execution failed with rc=%d and output=%@.\n", rc, [MobileFFmpegConfig getLastCommandOutput]);
}
```
3. Execute asynchronous FFmpeg commands.
```
#import <mobileffmpeg/MobileFFmpegConfig.h>
#import <mobileffmpeg/MobileFFmpeg.h>
long executionId = [MobileFFmpeg executeAsync:@"-i file1.mp4 -c:v mpeg4 file2.mp4" withCallback:self];
- (void)executeCallback:(long)executionId :(int)returnCode {
if (rc == RETURN_CODE_SUCCESS) {
NSLog(@"Async command execution completed successfully.\n");
} else if (rc == RETURN_CODE_CANCEL) {
NSLog(@"Async command execution cancelled by user.\n");
} else {
NSLog(@"Async command execution failed with rc=%d.\n", rc);
}
}
```
4. Execute FFprobe commands.
```
#import <mobileffmpeg/MobileFFmpegConfig.h>
#import <mobileffmpeg/MobileFFprobe.h>
int rc = [MobileFFprobe execute: @"-i file1.mp4"];
if (rc == RETURN_CODE_SUCCESS) {
NSLog(@"Command execution completed successfully.\n");
} else if (rc == RETURN_CODE_CANCEL) {
NSLog(@"Command execution cancelled by user.\n");
} else {
NSLog(@"Command execution failed with rc=%d and output=%@.\n", rc, [MobileFFmpegConfig getLastCommandOutput]);
}
```
5. Check execution output later.
```
int rc = [MobileFFmpegConfig getLastReturnCode];
NSString *output = [MobileFFmpegConfig getLastCommandOutput];
if (rc == RETURN_CODE_SUCCESS) {
NSLog(@"Command execution completed successfully.\n");
} else if (rc == RETURN_CODE_CANCEL) {
NSLog(@"Command execution cancelled by user.\n");
} else {
NSLog(@"Command execution failed with rc=%d.\n", rc);
NSLog(@"Command execution failed with rc=%d and output=%@.\n", rc, output);
}
```
3. Stop an ongoing operation.
6. Stop ongoing FFmpeg operations.
- Stop all executions
```
[MobileFFmpeg cancel];
```
- Stop a specific execution
```
[MobileFFmpeg cancel:executionId];
```
7. Get media information for a file.
```
[MobileFFmpeg cancel];
MediaInformation *mediaInformation = [MobileFFprobe getMediaInformation:@"<file path or uri>"];
```
4. Enable log callback.
8. Record video and audio using iOS camera. This operation is not supported on `tvOS` since `AVFoundation` is not available on `tvOS`.
```
- (void)logCallback: (int)level :(NSString*)message {
[MobileFFmpeg execute: @"-f avfoundation -r 30 -video_size 1280x720 -pixel_format bgr0 -i 0:0 -vcodec h264_videotoolbox -vsync 2 -f h264 -t 00:00:05 %@", recordFilePath];
```
9. Enable log callback.
```
[MobileFFmpegConfig setLogDelegate:self];
- (void)logCallback:(long)executionId :(int)level :(NSString*)message {
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"%@", message);
});
}
...
[MobileFFmpegConfig setLogDelegate:self];
```
5. Enable statistics callback.
10. Enable statistics callback.
```
[MobileFFmpegConfig setStatisticsDelegate:self];
- (void)statisticsCallback:(Statistics *)newStatistics {
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"frame: %d, time: %d\n", newStatistics.getVideoFrameNumber, newStatistics.getTime);
});
}
...
[MobileFFmpegConfig setStatisticsDelegate:self];
```
6. Set log level.
11. Ignore the handling of a signal.
```
[MobileFFmpegConfig ignoreSignal:SIGXCPU];
```
12. List ongoing executions.
```
NSArray* ffmpegExecutions = [MobileFFmpeg listExecutions];
for (int i = 0; i < [ffmpegExecutions count]; i++) {
FFmpegExecution* execution = [ffmpegExecutions objectAtIndex:i];
NSLog(@"Execution %d = id: %ld, startTime: %@, command: %@.\n", i, [execution getExecutionId], [execution getStartTime], [execution getCommand]);
}
```
13. Set default log level.
```
[MobileFFmpegConfig setLogLevel:AV_LOG_FATAL];
```
7. Register custom fonts directory.
14. Register custom fonts directory.
```
[MobileFFmpegConfig setFontDirectory:@"<folder with fonts>" with:nil];
```
#### 2.3 Test Application
You can see how MobileFFmpeg is used inside an application by running test applications provided.
There is an Android test application under the `android/test-app` folder and an IOS test application under the `ios/test-app` folder. Both applications are identical and supports command execution, video encoding, accessing https, encoding audio, burning subtitles and video stabilization.
<img src="https://github.com/tanersener/mobile-ffmpeg/blob/master/docs/assets/ios_test_app.gif" width="240">
#### 2.4 Manual Installation
##### 2.4.1 Android
You can import `MobileFFmpeg` aar packages in `Android Studio` using the `File` -> `New` -> `New Module` -> `Import .JAR/.AAR Package` menu.
##### 2.4.2 iOS / tvOS
iOS and tvOS frameworks can be installed manually using the [Importing Frameworks](https://github.com/tanersener/mobile-ffmpeg/wiki/Importing-Frameworks) guide.
If you want to use universal binaries please refer to [Using Universal Binaries](https://github.com/tanersener/mobile-ffmpeg/wiki/Using-Universal-Binaries) guide.
#### 2.5 Test Application
You can see how MobileFFmpeg is used inside an application by running test applications provided.
There is an `Android` test application under the `android/test-app` folder, an `iOS` test application under the
`ios/test-app` folder and a `tvOS` test application under the `tvos/test-app` folder.
All applications are identical and supports command execution, video encoding, accessing https, encoding audio,
burning subtitles, video stabilisation, pipe operations and concurrent command execution.
<img src="https://github.com/tanersener/mobile-ffmpeg/blob/master/docs/assets/android_test_app.gif" width="240">
### 3. Versions
- `MobileFFmpeg v1.x` is the previous stable, includes `FFmpeg v3.4.4`
`MobileFFmpeg` version number is aligned with `FFmpeg` since version `4.2`.
- `MobileFFmpeg v2.x` is the current stable, includes `FFmpeg v4.0.2`
In previous versions, `MobileFFmpeg` version of a release and `FFmpeg` version included in that release was different.
The following table lists `FFmpeg` versions used in `MobileFFmpeg` releases.
- `dev` part in `FFmpeg` version number indicates that `FFmpeg` source is pulled from the `FFmpeg` `master` branch.
Exact version number is obtained using `git describe --tags`.
### 4. Building
#### 4.1 Prerequisites
| MobileFFmpeg Version | FFmpeg Version | Release Date |
| :----: | :----: |:----: |
| [4.4](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.4) | 4.4-dev-416 | Jul 25, 2020 |
| [4.4.LTS](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.4.LTS) | 4.4-dev-416 | Jul 24, 2020 |
| [4.3.2](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.3.2) | 4.3-dev-2955 | Apr 15, 2020 |
| [4.3.1](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.3.1) | 4.3-dev-1944 | Jan 25, 2020 |
| [4.3.1.LTS](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.3.1.LTS) | 4.3-dev-1944 | Jan 25, 2020 |
| [4.3](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.3) | 4.3-dev-1181 | Oct 27, 2019 |
| [4.2.2](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.2.2) | 4.2-dev-1824 | July 3, 2019 |
| [4.2.2.LTS](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.2.2.LTS) | 4.2-dev-1824 | July 3, 2019 |
| [4.2.1](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.2.1) | 4.2-dev-1156 | Apr 2, 2019 |
| [4.2](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.2) | 4.2-dev-480 | Jan 3, 2019 |
| [4.2.LTS](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v4.2.LTS) | 4.2-dev-480 | Jan 3, 2019 |
| [3.1](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v3.1) | 4.1-10 | Dec 11, 2018 |
| [3.0](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v3.0) | 4.1-dev-1517 | Oct 25, 2018 |
| [2.2](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v2.2) | 4.0.3 | Nov 10, 2018 |
| [2.1.1](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v2.1.1) | 4.0.2 | Sep 19, 2018 |
| [2.1](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v2.1) | 4.0.2 | Sep 5, 2018 |
| [2.0](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v2.0) | 4.0.1 | Jun 30, 2018 |
| [1.2](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v1.2) | 3.4.4 | Aug 30, 2018|
| [1.1](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v1.1) | 3.4.2 | Jun 18, 2018 |
| [1.0](https://github.com/tanersener/mobile-ffmpeg/releases/tag/v1.0) | 3.4.2 | Jun 6, 2018 |
### 4. LTS Releases
Starting from `v4.2`, `MobileFFmpeg` binaries are published in two different variants: `Main Release` and `LTS Release`.
- Main releases include complete functionality of the library and support the latest SDK/API features.
- LTS releases are customized to support a wider range of devices. They are built using older API/SDK versions, so some features are not available on them.
This table shows the differences between two variants.
| | Main Release | LTS Release |
| :----: | :----: | :----: |
| Android API Level | 24 | 16 |
| Android Camera Access | Yes | - |
| Android Architectures | arm-v7a-neon<br/>arm64-v8a<br/>x86<br/>x86-64 | arm-v7a<br/>arm-v7a-neon<br/>arm64-v8a<br/>x86<br/>x86-64 |
| Xcode Support | 10.1 | 7.3.1 |
| iOS SDK | 12.1 | 9.3 |
| iOS AVFoundation | Yes | - |
| iOS Architectures | arm64<br/>arm64e<sup>1</sup><br/>x86-64<br/>x86-64-mac-catalyst<sup>2</sup> | armv7<br/>arm64<br/>i386<br/>x86-64 |
| tvOS SDK | 10.2 | 9.2 |
| tvOS Architectures | arm64<br/>x86-64 | arm64<br/>x86-64 |
<sup>1</sup> - Included until `v4.3.2`
<sup>2</sup> - Included since `v4.3.2`
### 5. Building
Build scripts from `master` and `development` branches are tested periodically. See the latest status from the table below.
| branch | status |
| :---: | :---: |
| master | [![Build Status](https://travis-ci.org/tanersener/mobile-ffmpeg.svg?branch=master)](https://travis-ci.org/tanersener/mobile-ffmpeg) |
| development | [![Build Status](https://travis-ci.org/tanersener/mobile-ffmpeg.svg?branch=development)](https://travis-ci.org/tanersener/mobile-ffmpeg) |
#### 5.1 Prerequisites
1. Use your package manager (apt, yum, dnf, brew, etc.) to install the following packages.
```
autoconf automake libtool pkg-config curl cmake gcc gperf texinfo yasm nasm bison
autoconf automake libtool pkg-config curl cmake gcc gperf texinfo yasm nasm bison autogen patch git
```
Some of these packages are not mandatory for the default build.
Please visit [Android Prerequisites](https://github.com/tanersener/mobile-ffmpeg/wiki/Android-Prerequisites) and
[IOS Prerequisites](https://github.com/tanersener/mobile-ffmpeg/wiki/IOS-Prerequisites) for the details.
Please visit [Android Prerequisites](https://github.com/tanersener/mobile-ffmpeg/wiki/Android-Prerequisites),
[iOS Prerequisites](https://github.com/tanersener/mobile-ffmpeg/wiki/iOS-Prerequisites) and
[tvOS Prerequisites](https://github.com/tanersener/mobile-ffmpeg/wiki/tvOS-Prerequisites) for the details.
2. Android builds require these additional packages.
- **Android SDK 5.0 Lollipop (API Level 21)** or later
- **Android NDK r16b** or later with LLDB and CMake
- **gradle 4.4** or later
- **Android SDK 4.1 Jelly Bean (API Level 16)** or later
- **Android NDK r21** or later with LLDB and CMake
3. IOS builds need these extra packages and tools.
- **IOS SDK 7.0.x** or later
- **Xcode 8.x** or later
3. iOS builds need these extra packages and tools.
- **Xcode 7.3.1** or later
- **iOS SDK 9.3** or later
- **Command Line Tools**
#### 4.2 Build Scripts
Use `android.sh` and `ios.sh` to build MobileFFmpeg for each platform.
After a successful build, compiled FFmpeg and MobileFFmpeg libraries can be found under `prebuilt` directory.
4. tvOS builds need these extra packages and tools.
- **Xcode 7.3.1** or later
- **tvOS SDK 9.2** or later
- **Command Line Tools**
Both `android.sh` and `ios.sh` can be customized to override default settings,
[android.sh](https://github.com/tanersener/mobile-ffmpeg/wiki/android.sh) and
[ios.sh](https://github.com/tanersener/mobile-ffmpeg/wiki/ios.sh) wiki pages include all available build options.
##### 4.2.1 Android
#### 5.2 Build Scripts
Use `android.sh`, `ios.sh` and `tvos.sh` to build MobileFFmpeg for each platform.
All three scripts support additional options and
can be customized to enable/disable specific external libraries and/or architectures. Please refer to wiki pages of
[android.sh](https://github.com/tanersener/mobile-ffmpeg/wiki/android.sh),
[ios.sh](https://github.com/tanersener/mobile-ffmpeg/wiki/ios.sh) and
[tvos.sh](https://github.com/tanersener/mobile-ffmpeg/wiki/tvos.sh) to see all available build options.
##### 5.2.1 Android
```
export ANDROID_HOME=<Android SDK Path>
export ANDROID_NDK_ROOT=<Android NDK Path>
./android.sh
```
<img src="https://github.com/tanersener/mobile-ffmpeg/blob/master/docs/assets/android_custom.gif" width="600">
##### 4.2.2 IOS
##### 5.2.2 iOS
```
./ios.sh
./ios.sh
```
<img src="https://github.com/tanersener/mobile-ffmpeg/blob/master/docs/assets/ios_custom.gif" width="600">
#### 4.3 GPL Support
It is possible to enable GPL licensed libraries `x264`, `xvidcore` since `v1.1` and `vid.stab`, `x265` since `v2.1`
from the top level build scripts.
Their source code is not included in the repository and downloaded when enabled.
##### 5.2.3 tvOS
```
./tvos.sh
```
#### 4.4 External Libraries
`build` directory includes build scripts for external libraries. There are two scripts for each library, one for Android
and one for IOS. They include all options/flags used to cross-compile the libraries. `ASM` is enabled by most of them,
exceptions are listed under the [ASM Support](https://github.com/tanersener/mobile-ffmpeg/wiki/ASM-Support) page.
<img src="https://github.com/tanersener/mobile-ffmpeg/blob/master/docs/assets/tvos_custom.gif" width="600">
### 5. Documentation
##### 5.2.4 Building LTS Binaries
Use `--lts` option to build lts binaries for each platform.
#### 5.3 Build Output
All libraries created by the top level build scripts (`android.sh`, `ios.sh` and `tvos.sh`) can be found under
the `prebuilt` directory.
- `Android` archive (.aar file) is located under the `android-aar` folder
- `iOS` frameworks are located under the `ios-framework` folder
- `iOS` xcframeworks are located under the `ios-xcframework` folder
- `iOS` universal binaries are located under the `ios-universal` folder
- `tvOS` frameworks are located under the `tvos-framework` folder
- `tvOS` universal binaries are located under the `tvos-universal` folder
#### 5.4 GPL Support
It is possible to enable GPL licensed libraries `x264`, `xvidcore` since `v1.1`; `vid.stab`, `x265` since `v2.1` and
`rubberband` since `v4.3.2` from the top level build scripts. Their source code is not included in the repository and
downloaded when enabled.
#### 5.5 External Libraries
`build` directory includes build scripts of all external libraries. Two scripts exist for each external library,
one for `Android` and one for `iOS / tvOS`. Each of these two scripts contains options/flags used to cross-compile the
library on the specified mobile platform.
CPU optimizations (`ASM`) are enabled for most of the external libraries. Details and exceptions can be found under the
[ASM Support](https://github.com/tanersener/mobile-ffmpeg/wiki/ASM-Support) wiki page.
### 6. Documentation
A more detailed documentation is available at [Wiki](https://github.com/tanersener/mobile-ffmpeg/wiki).
### 6. License
### 7. Contributors
This project is licensed under the LGPL v3.0. However, if source code is built using optional `--enable-gpl` flag or
prebuilt binaries with `-gpl` postfix are used then MobileFFmpeg is subject to the GPL v3.0 license.
#### 7.1 Code Contributors
Source code of FFmpeg and external libraries is included in compliance with their individual licenses.
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
<a href="https://github.com/tanersener/mobile-ffmpeg/graphs/contributors"><img src="https://opencollective.com/mobile-ffmpeg/contributors.svg?width=890&button=false" /></a>
`strip-frameworks.sh` script included and distributed is published under the [Apache License version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
#### 7.2 Financial Contributors
In test applications, fonts embedded are licensed under the [SIL Open Font License](https://opensource.org/licenses/OFL-1.1); other digital assets are published in the public domain.
Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/mobile-ffmpeg/contribute)]
##### 7.2.1 Individuals
<a href="https://opencollective.com/mobile-ffmpeg"><img src="https://opencollective.com/mobile-ffmpeg/individuals.svg?width=890"></a>
##### 7.2.2 Organizations
Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/mobile-ffmpeg/contribute)]
<a href="https://opencollective.com/mobile-ffmpeg/organization/0/website"><img src="https://opencollective.com/mobile-ffmpeg/organization/0/avatar.svg"></a>
<a href="https://opencollective.com/mobile-ffmpeg/organization/1/website"><img src="https://opencollective.com/mobile-ffmpeg/organization/1/avatar.svg"></a>
<a href="https://opencollective.com/mobile-ffmpeg/organization/2/website"><img src="https://opencollective.com/mobile-ffmpeg/organization/2/avatar.svg"></a>
<a href="https://opencollective.com/mobile-ffmpeg/organization/3/website"><img src="https://opencollective.com/mobile-ffmpeg/organization/3/avatar.svg"></a>
<a href="https://opencollective.com/mobile-ffmpeg/organization/4/website"><img src="https://opencollective.com/mobile-ffmpeg/organization/4/avatar.svg"></a>
<a href="https://opencollective.com/mobile-ffmpeg/organization/5/website"><img src="https://opencollective.com/mobile-ffmpeg/organization/5/avatar.svg"></a>
<a href="https://opencollective.com/mobile-ffmpeg/organization/6/website"><img src="https://opencollective.com/mobile-ffmpeg/organization/6/avatar.svg"></a>
<a href="https://opencollective.com/mobile-ffmpeg/organization/7/website"><img src="https://opencollective.com/mobile-ffmpeg/organization/7/avatar.svg"></a>
<a href="https://opencollective.com/mobile-ffmpeg/organization/8/website"><img src="https://opencollective.com/mobile-ffmpeg/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/mobile-ffmpeg/organization/9/website"><img src="https://opencollective.com/mobile-ffmpeg/organization/9/avatar.svg"></a>
### 8. License
`MobileFFmpeg` is licensed under the LGPL v3.0. However, if source code is built using the optional `--enable-gpl` flag
or prebuilt binaries with `-gpl` postfix are used, then MobileFFmpeg is subject to the GPL v3.0 license.
The source code of all external libraries included is in compliance with their individual licenses.
`openh264` source code included in this repository is licensed under the 2-clause BSD License but this license does
not cover the `MPEG LA` licensing fees. If you build `mobile-ffmpeg` with `openh264` and distribute that library, then
you are subject to pay `MPEG LA` licensing fees. Refer to [OpenH264 FAQ](https://www.openh264.org/faq.html) page for
the details. Please note that `mobile-ffmpeg` does not publish a binary with `openh264` inside.
`strip-frameworks.sh` script included and distributed (until v4.x) is published under the
[Apache License version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
In test applications; embedded fonts are licensed under the
[SIL Open Font License](https://opensource.org/licenses/OFL-1.1), other digital assets are published in the public
domain.
Please visit [License](https://github.com/tanersener/mobile-ffmpeg/wiki/License) page for the details.
### 7. Contributing
### 9. Patents
If you have any recommendations or ideas to improve it, please feel free to submit issues or pull requests. Any help is appreciated.
It is not clearly explained in their documentation but it is believed that `FFmpeg`, `kvazaar`, `x264` and `x265`
include algorithms which are subject to software patents. If you live in a country where software algorithms are
patentable then you'll probably need to pay royalty fees to patent holders. We are not lawyers though, so we recommend
that you seek legal advice first. See [FFmpeg Patent Mini-FAQ](https://ffmpeg.org/legal.html).
### 8. See Also
`openh264` clearly states that it uses patented algorithms. Therefore, if you build mobile-ffmpeg with openh264 and
distribute that library, then you are subject to pay MPEG LA licensing fees. Refer to
[OpenH264 FAQ](https://www.openh264.org/faq.html) page for the details.
### 10. Contributing
Feel free to submit issues or pull requests.
Please note that `master` branch includes only the latest released source code. Changes planned for the next release
are implemented under the `development` branch. Therefore, if you want to create a pull request, please open it against
the `development`.
### 11. See Also
- [libav gas-preprocessor](https://github.com/libav/gas-preprocessor/raw/master/gas-preprocessor.pl)
- [FFmpeg API Documentation](https://ffmpeg.org/doxygen/4.0/index.html)
- [FFmpeg Wiki](https://trac.ffmpeg.org/wiki/WikiStart)
- [FFmpeg License and Legal Considerations](https://ffmpeg.org/legal.html)
- [FFmpeg External Library Licenses](https://www.ffmpeg.org/doxygen/4.0/md_LICENSE.html)
+700 -448
View File
File diff suppressed because it is too large Load Diff
+9 -8
View File
@@ -1,12 +1,13 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.gradle/
local.properties
.DS_Store
/build
/captures
.externalNativeBuild
/.idea/
/build/
/app/build/
/test-app/build/
/app/.cxx/
captures
.externalNativeBuild/
.idea/
/obj/
/libs/
-2
View File
@@ -1,2 +0,0 @@
/build
/local.properties
+137 -69
View File
@@ -1,4 +1,4 @@
# Doxyfile 1.8.14
# Doxyfile 1.8.18
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@@ -17,10 +17,10 @@
# Project related configuration options
#---------------------------------------------------------------------------
# This tag specifies the encoding used for all characters in the config file
# that follow. The default is UTF-8 which is also the encoding used for all text
# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
# built into libc) for the transcoding. See
# This tag specifies the encoding used for all characters in the configuration
# file that follow. The default is UTF-8 which is also the encoding used for all
# text before the first occurrence of this tag. Doxygen uses libiconv (or the
# iconv built into libc) for the transcoding. See
# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
# The default value is: UTF-8.
@@ -38,7 +38,7 @@ PROJECT_NAME = "MobileFFmpeg Android API"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 2.1.1
PROJECT_NUMBER = 4.4
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -93,6 +93,14 @@ ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all generated output in the proper direction.
# Possible values are: None, LTR, RTL and Context.
# The default value is: None.
OUTPUT_TEXT_DIRECTION = None
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
# descriptions after the members that are listed in the file and class
# documentation (similar to Javadoc). Set to NO to disable this.
@@ -189,6 +197,16 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
# such as
# /***************
# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
# Javadoc-style will behave just like regular comments and it will not be
# interpreted by doxygen.
# The default value is: NO.
JAVADOC_BANNER = NO
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
@@ -238,15 +256,13 @@ TAB_SIZE = 4
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines (in the resulting output). You can put ^^ in the value part of an
# alias to insert a newline as if a physical newline was in the original file.
# When you need a literal { or } or , in the value part of an alias you have to
# escape them by means of a backslash (\), this can lead to conflicts with the
# commands \{ and \} for these it is advised to use the version @{ and @} or use
# a double escape (\\{ and \\})
ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
@@ -275,17 +291,26 @@ OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
# sources only. Doxygen will then generate output that is more tailored for that
# language. For instance, namespaces will be presented as modules, types will be
# separated into more groups, etc.
# The default value is: NO.
OPTIMIZE_OUTPUT_SLICE = NO
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
# Fortran. In the later case the parser tries to guess whether the code is fixed
# or free formatted code, this is the default for Fortran type files), VHDL. For
# instance to make doxygen treat .inc files as Fortran files (default is PHP),
# and .f files as C (default is Fortran), use: inc=Fortran f=C.
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
# tries to guess whether the code is fixed or free formatted code, this is the
# default for Fortran type files). For instance to make doxygen treat .inc files
# as Fortran files (default is PHP), and .f files as C (default is Fortran),
# use: inc=Fortran f=C.
#
# Note: For files without extension you can use no_extension as a placeholder.
#
@@ -296,7 +321,7 @@ EXTENSION_MAPPING =
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
# documentation. See http://daringfireball.net/projects/markdown/ for details.
# documentation. See https://daringfireball.net/projects/markdown/ for details.
# The output of markdown processing is further processed by doxygen, so you can
# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
# case of backward compatibilities issues.
@@ -308,7 +333,7 @@ MARKDOWN_SUPPORT = YES
# to that level are automatically included in the table of contents, even if
# they do not have an id attribute.
# Note: This feature currently applies only to Markdown headings.
# Minimum value: 0, maximum value: 99, default value: 0.
# Minimum value: 0, maximum value: 99, default value: 5.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 0
@@ -444,6 +469,12 @@ EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
# methods of a class will be included in the documentation.
# The default value is: NO.
EXTRACT_PRIV_VIRTUAL = NO
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation.
# The default value is: NO.
@@ -498,8 +529,8 @@ HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO, these declarations will be
# included in the documentation.
# declarations. If set to NO, these declarations will be included in the
# documentation.
# The default value is: NO.
HIDE_FRIEND_COMPOUNDS = NO
@@ -522,7 +553,7 @@ INTERNAL_DOCS = NO
# names in lower-case letters. If set to YES, upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
# (including Cygwin) ands Mac users are advised to set this option to NO.
# The default value is: system dependent.
CASE_SENSE_NAMES = NO
@@ -754,7 +785,8 @@ WARN_IF_DOC_ERROR = YES
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return
# value. If set to NO, doxygen will only warn about wrong or incomplete
# parameter documentation, but not about the absence of documentation.
# parameter documentation, but not about the absence of documentation. If
# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
# The default value is: NO.
WARN_NO_PARAMDOC = NO
@@ -813,8 +845,10 @@ INPUT_ENCODING = UTF-8
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf.
# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen
# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
# *.vhdl, *.ucf, *.qsf and *.ice.
FILE_PATTERNS = *.c \
*.cc \
@@ -889,7 +923,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS = cmdutils.* ffmpeg.* ffmpeg_*
EXCLUDE_PATTERNS =
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -1011,7 +1045,7 @@ INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
# function all documented functions referencing it will be listed.
# entity all documented functions referencing it will be listed.
# The default value is: NO.
REFERENCED_BY_RELATION = NO
@@ -1048,7 +1082,7 @@ SOURCE_TOOLTIPS = YES
#
# To use it do the following:
# - Install the latest version of global
# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
# - Make sure the INPUT points to the root of the source tree
# - Run doxygen as normal
#
@@ -1226,9 +1260,9 @@ HTML_TIMESTAMP = YES
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that
# are dynamically created via Javascript. If disabled, the navigation index will
# are dynamically created via JavaScript. If disabled, the navigation index will
# consists of multiple levels of tabs that are statically embedded in every HTML
# page. Disable this option to support browsers that do not have Javascript,
# page. Disable this option to support browsers that do not have JavaScript,
# like the Qt help browser.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
@@ -1258,13 +1292,13 @@ HTML_INDEX_NUM_ENTRIES = 100
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
# generated that can be used as input for Apple's Xcode 3 integrated development
# environment (see: https://developer.apple.com/tools/xcode/), introduced with
# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
# environment (see: https://developer.apple.com/xcode/), introduced with OSX
# 10.5 (Leopard). To create a documentation set, doxygen will generate a
# Makefile in the HTML output directory. Running make will produce the docset in
# that directory and running make install will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html
# for more information.
# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
# genXcode/_index.html for more information.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
@@ -1303,7 +1337,7 @@ DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
# Windows.
#
# The HTML Help Workshop contains a compiler that can convert all HTML output
@@ -1379,7 +1413,7 @@ QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace).
# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.
@@ -1387,7 +1421,8 @@ QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders).
# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
# folders).
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.
@@ -1395,21 +1430,23 @@ QHP_VIRTUAL_FOLDER = doc
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters).
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters).
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes).
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_SECT_FILTER_ATTRS =
@@ -1493,6 +1530,17 @@ TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
# the HTML output. These images will generally look nicer at scaled resolutions.
# Possible values are: png The default and svg Looks nicer but requires the
# pdf2svg tool.
# The default value is: png.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FORMULA_FORMAT = png
# Use this tag to change the font size of LaTeX formulas included as images in
# the HTML documentation. When you change the font size after a successful
# doxygen run you need to manually remove any form_*.png images from the HTML
@@ -1513,8 +1561,14 @@ FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
# to create new LaTeX commands to be used in formulas as building blocks. See
# the section "Including formulas" for details.
FORMULA_MACROFILE =
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# https://www.mathjax.org) which uses client side Javascript for the rendering
# https://www.mathjax.org) which uses client side JavaScript for the rendering
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
@@ -1542,7 +1596,7 @@ MATHJAX_FORMAT = HTML-CSS
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
# MathJax from https://www.mathjax.org before deployment.
# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/.
# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/
@@ -1584,7 +1638,7 @@ MATHJAX_CODEFILE =
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
# implemented using a web server instead of a web client using JavaScript. There
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# setting. When disabled, doxygen will generate a PHP script for searching and
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
@@ -1668,21 +1722,35 @@ LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked.
#
# Note that when enabling USE_PDFLATEX this option is only used for generating
# bitmaps for formulas in the HTML output, but not in the Makefile that is
# written to the output directory.
# The default file is: latex.
# Note that when not enabling USE_PDFLATEX the default is latex when enabling
# USE_PDFLATEX the default is pdflatex and when in the later case latex is
# chosen this is overwritten by pdflatex. For specific output languages the
# default can have been set differently, this depends on the implementation of
# the output language.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
# index for LaTeX.
# Note: This tag is used in the Makefile / make.bat.
# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
# (.tex).
# The default file is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
MAKEINDEX_CMD_NAME = makeindex
# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
# generate index for LaTeX. In case there is no backslash (\) as first character
# it will be automatically added in the LaTeX code.
# Note: This tag is used in the generated output file (.tex).
# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
# The default value is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_MAKEINDEX_CMD = makeindex
# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
# documents. This may be useful for small projects and may help to save some
# trees in general.
@@ -1817,6 +1885,14 @@ LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
# path from which the emoji images will be read. If a relative path is entered,
# it will be relative to the LATEX_OUTPUT directory. If left blank the
# LATEX_OUTPUT directory will be used.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_EMOJI_DIRECTORY =
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
@@ -1856,9 +1932,9 @@ COMPACT_RTF = NO
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's config
# file, i.e. a series of assignments. You only have to provide replacements,
# missing definitions are set to their default value.
# Load stylesheet definitions from file. Syntax is similar to doxygen's
# configuration file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
#
# See also section "Doxygen usage" for information on how to generate the
# default style sheet that doxygen normally uses.
@@ -1867,8 +1943,8 @@ RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
# similar to doxygen's config file. A template extensions file can be generated
# using doxygen -e rtf extensionFile.
# similar to doxygen's configuration file. A template extensions file can be
# generated using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_EXTENSIONS_FILE =
@@ -1954,6 +2030,13 @@ XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
# namespace members in file scope as well, matching the HTML output.
# The default value is: NO.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_NS_MEMB_FILE_SCOPE = NO
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
@@ -2155,12 +2238,6 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
@@ -2174,15 +2251,6 @@ PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+13 -23
View File
@@ -1,15 +1,18 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
compileSdkVersion 29
ndkVersion "21.3.6528147"
defaultConfig {
minSdkVersion 21
targetSdkVersion 27
versionCode 21
versionName "2.1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
minSdkVersion 24
targetSdkVersion 29
versionCode 240440
versionName "4.4"
project.archivesBaseName = "mobile-ffmpeg"
consumerProguardFiles 'proguard-rules.pro'
}
buildTypes {
release {
minifyEnabled false
@@ -23,12 +26,8 @@ android {
}
}
libraryVariants.all { variant ->
variant.outputs.all { output ->
if (outputFile != null && outputFileName.endsWith('.aar')) {
outputFileName = "${archivesBaseName}-${android.defaultConfig.versionName}.aar"
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}
@@ -39,16 +38,7 @@ task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
}
afterEvaluate {
javadoc.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompile.classpath.files
})
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
testImplementation "androidx.test.ext:junit:1.1.1"
testImplementation "org.json:json:20190722"
}
+8 -13
View File
@@ -5,17 +5,12 @@
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keep class com.arthenica.mobileffmpeg.Config {
native <methods>;
void log(long, int, byte[]);
void statistics(long, int, float, float, long , int, double, double);
}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class com.arthenica.mobileffmpeg.AbiDetect {
native <methods>;
}
@@ -1,45 +0,0 @@
/*
* Copyright (c) 2018 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.arthenica.mobileffmpeg", appContext.getPackageName());
}
}
-7
View File
@@ -1,11 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.arthenica.mobileffmpeg">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"/>
</manifest>
+2
View File
@@ -0,0 +1,2 @@
/android_lts_support.o
/libandroidltssupport.a
@@ -0,0 +1,69 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <math.h>
#include <errno.h>
#include <malloc.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
#if __ANDROID_API__ < 17
int posix_memalign(void** memptr, size_t alignment, size_t size) {
if ((alignment & (alignment - 1)) != 0 || alignment == 0) {
return EINVAL;
}
if (alignment % sizeof(void*) != 0) {
return EINVAL;
}
*memptr = memalign(alignment, size);
if (*memptr == NULL) {
return errno;
}
return 0;
}
#endif /* __ANDROID_API__ < 17 */
double log2(double x) {
return (log(x) / M_LN2);
}
float log2f(float x) {
return (float) log2((double) x);
}
#ifdef __cplusplus
}; /* end of extern "C" */
#endif
+212 -142
View File
@@ -20,6 +20,14 @@
*/
/*
* CHANGES 01.2020
* - ffprobe support changes
* - (optindex < argc) validation in parse_options() method updated with (optindex >= argc) check
*
* CHANGES 12.2019
* - Concurrent execution support
* - log_callback_report method re-added to fix -report option issues
*
* CHANGES 08.2018
* --------------------------------------------------------
* - fftools_ prefix added to file name and parent header
@@ -85,15 +93,19 @@
static int init_report(const char *env);
extern void mobileffmpeg_log_callback_function(void *ptr, int level, const char* format, va_list vargs);
extern void (*report_callback)(int, float, float, int64_t, int, double, double);
AVDictionary *sws_dict;
AVDictionary *swr_opts;
AVDictionary *format_opts, *codec_opts, *resample_opts;
__thread char *program_name;
__thread int program_birth_year;
static FILE *report_file;
static int report_file_level = AV_LOG_DEBUG;
int hide_banner = 0;
int longjmp_value = 0;
__thread AVDictionary *sws_dict;
__thread AVDictionary *swr_opts;
__thread AVDictionary *format_opts, *codec_opts, *resample_opts;
FILE *report_file;
int report_file_level = AV_LOG_DEBUG;
__thread int hide_banner = 0;
__thread volatile int longjmp_value = 0;
enum show_muxdemuxers {
SHOW_DEFAULT,
@@ -115,9 +127,29 @@ void uninit_opts(void)
av_dict_free(&resample_opts);
}
void log_callback_report(void *ptr, int level, const char *fmt, va_list vl)
{
va_list vl2;
char line[1024];
static int print_prefix = 1;
va_copy(vl2, vl);
if (report_callback == NULL) {
av_log_default_callback(ptr, level, fmt, vl);
} else {
mobileffmpeg_log_callback_function(ptr, level, fmt, vl);
}
av_log_format_line(ptr, level, fmt, vl2, line, sizeof(line), &print_prefix);
va_end(vl2);
if (report_file_level >= level) {
fputs(line, report_file);
fflush(report_file);
}
}
void init_dynload(void)
{
#ifdef _WIN32
#if HAVE_SETDLLDIRECTORY
/* Calling SetDllDirectory with the empty string (but not NULL) removes the
* current working directory from the DLL search path as a security pre-caution. */
SetDllDirectory("");
@@ -191,7 +223,7 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
continue;
if (first) {
printf("%s\n", msg);
av_log(NULL, AV_LOG_STDERR, "%s\n", msg);
first = 0;
}
av_strlcpy(buf, po->name, sizeof(buf));
@@ -199,9 +231,9 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
av_strlcat(buf, " ", sizeof(buf));
av_strlcat(buf, po->argname, sizeof(buf));
}
printf("-%-17s %s\n", buf, po->help);
av_log(NULL, AV_LOG_STDERR, "-%-17s %s\n", buf, po->help);
}
printf("\n");
av_log(NULL, AV_LOG_STDERR, "\n");
}
void show_help_children(const AVClass *class, int flags)
@@ -209,7 +241,7 @@ void show_help_children(const AVClass *class, int flags)
const AVClass *child = NULL;
if (class->option) {
av_opt_show2(&class, NULL, flags, 0);
printf("\n");
av_log(NULL, AV_LOG_STDERR, "\n");
}
while ((child = av_opt_child_class_next(class, child)))
@@ -401,12 +433,14 @@ void parse_options(void *optctx, int argc, char **argv, const OptionDef *options
continue;
}
opt++;
if (optindex < argc) {
if (optindex >= argc) {
if ((ret = parse_option(optctx, opt, NULL, options)) < 0)
exit_program(1);
} else {
if ((ret = parse_option(optctx, opt, argv[optindex], options)) < 0)
exit_program(1);
optindex += ret;
}
optindex += ret;
} else {
if (parse_arg_function)
parse_arg_function(optctx, opt);
@@ -473,7 +507,7 @@ int locate_option(int argc, char **argv, const OptionDef *options,
return 0;
}
static void dump_argument(const char *a)
void dump_argument(const char *a)
{
const unsigned char *p;
@@ -812,7 +846,7 @@ do { \
if (optindex < argc) {
arg = argv[optindex++];
} else {
arg = "";
arg = NULL;
}
} else if (po->flags & HAS_ARG) {
GET_ARG(arg);
@@ -856,8 +890,8 @@ do { \
}
if (octx->cur_group.nb_opts || codec_opts || format_opts || resample_opts)
av_log(NULL, AV_LOG_WARNING, "Trailing options were found on the "
"commandline.\n");
av_log(NULL, AV_LOG_WARNING, "Trailing option(s) found in the "
"command: may be ignored.\n");
av_log(NULL, AV_LOG_DEBUG, "Finished splitting the commandline.\n");
@@ -983,11 +1017,12 @@ static void expand_filename_template(AVBPrint *bp, const char *template,
}
}
static int init_report(const char *env)
int init_report(const char *env)
{
char *filename_template = NULL;
char *key, *val;
int ret, count = 0;
int prog_loglevel, envlevel = 0;
time_t now;
struct tm *tm;
AVBPrint filename;
@@ -1019,6 +1054,7 @@ static int init_report(const char *env)
av_log(NULL, AV_LOG_FATAL, "Invalid report file level\n");
exit_program(1);
}
envlevel = 1;
} else {
av_log(NULL, AV_LOG_ERROR, "Unknown key '%s' in FFREPORT\n", key);
}
@@ -1026,7 +1062,7 @@ static int init_report(const char *env)
av_free(key);
}
av_bprint_init(&filename, 0, 1);
av_bprint_init(&filename, 0, AV_BPRINT_SIZE_AUTOMATIC);
expand_filename_template(&filename,
av_x_if_null(filename_template, "%p-%t.log"), tm);
av_free(filename_template);
@@ -1035,6 +1071,10 @@ static int init_report(const char *env)
return AVERROR(ENOMEM);
}
prog_loglevel = av_log_get_level();
if (!envlevel)
report_file_level = FFMAX(report_file_level, prog_loglevel);
report_file = fopen(filename.str, "w");
if (!report_file) {
int ret = AVERROR(errno);
@@ -1042,19 +1082,20 @@ static int init_report(const char *env)
filename.str, strerror(errno));
return ret;
}
av_log_set_callback(mobileffmpeg_log_callback_function);
av_log_set_callback(log_callback_report);
av_log(NULL, AV_LOG_INFO,
"%s started on %04d-%02d-%02d at %02d:%02d:%02d\n"
"Report written to \"%s\"\n",
"Report written to \"%s\"\n"
"Log level: %d\n",
program_name,
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec,
filename.str);
filename.str, report_file_level);
av_bprint_finalize(&filename, NULL);
return 0;
}
int opt_report(const char *opt)
int opt_report(void *optctx, const char *opt, const char *arg)
{
return init_report(NULL);
}
@@ -1096,7 +1137,7 @@ void print_error(const char *filename, int err)
av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr);
}
static int warned_cfg = 0;
__thread int warned_cfg = 0;
#define INDENT 1
#define SHOW_VERSION 2
@@ -1196,7 +1237,6 @@ void show_banner(int argc, char **argv, const OptionDef *options)
int show_version(void *optctx, const char *opt, const char *arg)
{
av_log_set_callback(mobileffmpeg_log_callback_function);
print_program_info (SHOW_COPYRIGHT, AV_LOG_INFO);
print_all_libs_info(SHOW_VERSION, AV_LOG_INFO);
@@ -1205,7 +1245,6 @@ int show_version(void *optctx, const char *opt, const char *arg)
int show_buildconf(void *optctx, const char *opt, const char *arg)
{
av_log_set_callback(mobileffmpeg_log_callback_function);
print_buildconf (INDENT|0, AV_LOG_INFO);
return 0;
@@ -1214,12 +1253,12 @@ int show_buildconf(void *optctx, const char *opt, const char *arg)
int show_license(void *optctx, const char *opt, const char *arg)
{
#if CONFIG_NONFREE
printf(
av_log(NULL, AV_LOG_STDERR,
"This version of %s has nonfree parts compiled in.\n"
"Therefore it is not legally redistributable.\n",
program_name );
#elif CONFIG_GPLV3
printf(
av_log(NULL, AV_LOG_STDERR,
"%s is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 3 of the License, or\n"
@@ -1234,7 +1273,7 @@ int show_license(void *optctx, const char *opt, const char *arg)
"along with %s. If not, see <http://www.gnu.org/licenses/>.\n",
program_name, program_name, program_name );
#elif CONFIG_GPL
printf(
av_log(NULL, AV_LOG_STDERR,
"%s is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 2 of the License, or\n"
@@ -1250,7 +1289,7 @@ int show_license(void *optctx, const char *opt, const char *arg)
"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
program_name, program_name, program_name );
#elif CONFIG_LGPLV3
printf(
av_log(NULL, AV_LOG_STDERR,
"%s is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU Lesser General Public License as published by\n"
"the Free Software Foundation; either version 3 of the License, or\n"
@@ -1265,7 +1304,7 @@ int show_license(void *optctx, const char *opt, const char *arg)
"along with %s. If not, see <http://www.gnu.org/licenses/>.\n",
program_name, program_name, program_name );
#else
printf(
av_log(NULL, AV_LOG_STDERR,
"%s is free software; you can redistribute it and/or\n"
"modify it under the terms of the GNU Lesser General Public\n"
"License as published by the Free Software Foundation; either\n"
@@ -1301,7 +1340,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
const char *last_name;
int is_dev;
printf("%s\n"
av_log(NULL, AV_LOG_STDERR, "%s\n"
" D. = Demuxing supported\n"
" .E = Muxing supported\n"
" --\n", device_only ? "Devices:" : "File formats:");
@@ -1346,7 +1385,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
break;
last_name = name;
printf(" %s%s %-15s %s\n",
av_log(NULL, AV_LOG_STDERR, " %s%s %-15s %s\n",
decode ? "D" : " ",
encode ? "E" : " ",
name,
@@ -1379,76 +1418,97 @@ int show_devices(void *optctx, const char *opt, const char *arg)
if (codec->field) { \
const type *p = codec->field; \
\
printf(" Supported " list_name ":"); \
av_log(NULL, AV_LOG_STDERR, " Supported " list_name ":"); \
while (*p != term) { \
get_name(*p); \
printf(" %s", name); \
av_log(NULL, AV_LOG_STDERR, " %s", name); \
p++; \
} \
printf("\n"); \
av_log(NULL, AV_LOG_STDERR, "\n"); \
} \
static void print_codec(const AVCodec *c)
{
int encoder = av_codec_is_encoder(c);
printf("%s %s [%s]:\n", encoder ? "Encoder" : "Decoder", c->name,
av_log(NULL, AV_LOG_STDERR, "%s %s [%s]:\n", encoder ? "Encoder" : "Decoder", c->name,
c->long_name ? c->long_name : "");
printf(" General capabilities: ");
av_log(NULL, AV_LOG_STDERR, " General capabilities: ");
if (c->capabilities & AV_CODEC_CAP_DRAW_HORIZ_BAND)
printf("horizband ");
av_log(NULL, AV_LOG_STDERR, "horizband ");
if (c->capabilities & AV_CODEC_CAP_DR1)
printf("dr1 ");
av_log(NULL, AV_LOG_STDERR, "dr1 ");
if (c->capabilities & AV_CODEC_CAP_TRUNCATED)
printf("trunc ");
av_log(NULL, AV_LOG_STDERR, "trunc ");
if (c->capabilities & AV_CODEC_CAP_DELAY)
printf("delay ");
av_log(NULL, AV_LOG_STDERR, "delay ");
if (c->capabilities & AV_CODEC_CAP_SMALL_LAST_FRAME)
printf("small ");
av_log(NULL, AV_LOG_STDERR, "small ");
if (c->capabilities & AV_CODEC_CAP_SUBFRAMES)
printf("subframes ");
av_log(NULL, AV_LOG_STDERR, "subframes ");
if (c->capabilities & AV_CODEC_CAP_EXPERIMENTAL)
printf("exp ");
av_log(NULL, AV_LOG_STDERR, "exp ");
if (c->capabilities & AV_CODEC_CAP_CHANNEL_CONF)
printf("chconf ");
av_log(NULL, AV_LOG_STDERR, "chconf ");
if (c->capabilities & AV_CODEC_CAP_PARAM_CHANGE)
printf("paramchange ");
av_log(NULL, AV_LOG_STDERR, "paramchange ");
if (c->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)
printf("variable ");
av_log(NULL, AV_LOG_STDERR, "variable ");
if (c->capabilities & (AV_CODEC_CAP_FRAME_THREADS |
AV_CODEC_CAP_SLICE_THREADS |
AV_CODEC_CAP_AUTO_THREADS))
printf("threads ");
av_log(NULL, AV_LOG_STDERR, "threads ");
if (c->capabilities & AV_CODEC_CAP_AVOID_PROBING)
av_log(NULL, AV_LOG_STDERR, "avoidprobe ");
if (c->capabilities & AV_CODEC_CAP_INTRA_ONLY)
av_log(NULL, AV_LOG_STDERR, "intraonly ");
if (c->capabilities & AV_CODEC_CAP_LOSSLESS)
av_log(NULL, AV_LOG_STDERR, "lossless ");
if (c->capabilities & AV_CODEC_CAP_HARDWARE)
av_log(NULL, AV_LOG_STDERR, "hardware ");
if (c->capabilities & AV_CODEC_CAP_HYBRID)
av_log(NULL, AV_LOG_STDERR, "hybrid ");
if (!c->capabilities)
printf("none");
printf("\n");
av_log(NULL, AV_LOG_STDERR, "none");
av_log(NULL, AV_LOG_STDERR, "\n");
if (c->type == AVMEDIA_TYPE_VIDEO ||
c->type == AVMEDIA_TYPE_AUDIO) {
printf(" Threading capabilities: ");
av_log(NULL, AV_LOG_STDERR, " Threading capabilities: ");
switch (c->capabilities & (AV_CODEC_CAP_FRAME_THREADS |
AV_CODEC_CAP_SLICE_THREADS |
AV_CODEC_CAP_AUTO_THREADS)) {
case AV_CODEC_CAP_FRAME_THREADS |
AV_CODEC_CAP_SLICE_THREADS: printf("frame and slice"); break;
case AV_CODEC_CAP_FRAME_THREADS: printf("frame"); break;
case AV_CODEC_CAP_SLICE_THREADS: printf("slice"); break;
case AV_CODEC_CAP_AUTO_THREADS : printf("auto"); break;
default: printf("none"); break;
AV_CODEC_CAP_SLICE_THREADS: av_log(NULL, AV_LOG_STDERR, "frame and slice"); break;
case AV_CODEC_CAP_FRAME_THREADS: av_log(NULL, AV_LOG_STDERR, "frame"); break;
case AV_CODEC_CAP_SLICE_THREADS: av_log(NULL, AV_LOG_STDERR, "slice"); break;
case AV_CODEC_CAP_AUTO_THREADS : av_log(NULL, AV_LOG_STDERR, "auto"); break;
default: av_log(NULL, AV_LOG_STDERR, "none"); break;
}
printf("\n");
av_log(NULL, AV_LOG_STDERR, "\n");
}
if (avcodec_get_hw_config(c, 0)) {
av_log(NULL, AV_LOG_STDERR, " Supported hardware devices: ");
for (int i = 0;; i++) {
const AVCodecHWConfig *config = avcodec_get_hw_config(c, i);
if (!config)
break;
av_log(NULL, AV_LOG_STDERR, "%s ", av_hwdevice_get_type_name(config->device_type));
}
av_log(NULL, AV_LOG_STDERR, "\n");
}
if (c->supported_framerates) {
const AVRational *fps = c->supported_framerates;
printf(" Supported framerates:");
av_log(NULL, AV_LOG_STDERR, " Supported framerates:");
while (fps->num) {
printf(" %d/%d", fps->num, fps->den);
av_log(NULL, AV_LOG_STDERR, " %d/%d", fps->num, fps->den);
fps++;
}
printf("\n");
av_log(NULL, AV_LOG_STDERR, "\n");
}
PRINT_CODEC_SUPPORTED(c, pix_fmts, enum AVPixelFormat, "pixel formats",
AV_PIX_FMT_NONE, GET_PIX_FMT_NAME);
@@ -1523,12 +1583,12 @@ static void print_codecs_for_id(enum AVCodecID id, int encoder)
{
const AVCodec *codec = NULL;
printf(" (%s: ", encoder ? "encoders" : "decoders");
av_log(NULL, AV_LOG_STDERR, " (%s: ", encoder ? "encoders" : "decoders");
while ((codec = next_codec_for_id(id, codec, encoder)))
printf("%s ", codec->name);
av_log(NULL, AV_LOG_STDERR, "%s ", codec->name);
printf(")");
av_log(NULL, AV_LOG_STDERR, ")");
}
int show_codecs(void *optctx, const char *opt, const char *arg)
@@ -1536,7 +1596,7 @@ int show_codecs(void *optctx, const char *opt, const char *arg)
const AVCodecDescriptor **codecs;
unsigned i, nb_codecs = get_codecs_sorted(&codecs);
printf("Codecs:\n"
av_log(NULL, AV_LOG_STDERR, "Codecs:\n"
" D..... = Decoding supported\n"
" .E.... = Encoding supported\n"
" ..V... = Video codec\n"
@@ -1553,16 +1613,16 @@ int show_codecs(void *optctx, const char *opt, const char *arg)
if (strstr(desc->name, "_deprecated"))
continue;
printf(" ");
printf(avcodec_find_decoder(desc->id) ? "D" : ".");
printf(avcodec_find_encoder(desc->id) ? "E" : ".");
av_log(NULL, AV_LOG_STDERR, " ");
av_log(NULL, AV_LOG_STDERR, avcodec_find_decoder(desc->id) ? "D" : ".");
av_log(NULL, AV_LOG_STDERR, avcodec_find_encoder(desc->id) ? "E" : ".");
printf("%c", get_media_type_char(desc->type));
printf((desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : ".");
printf((desc->props & AV_CODEC_PROP_LOSSY) ? "L" : ".");
printf((desc->props & AV_CODEC_PROP_LOSSLESS) ? "S" : ".");
av_log(NULL, AV_LOG_STDERR, "%c", get_media_type_char(desc->type));
av_log(NULL, AV_LOG_STDERR, (desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : ".");
av_log(NULL, AV_LOG_STDERR, (desc->props & AV_CODEC_PROP_LOSSY) ? "L" : ".");
av_log(NULL, AV_LOG_STDERR, (desc->props & AV_CODEC_PROP_LOSSLESS) ? "S" : ".");
printf(" %-20s %s", desc->name, desc->long_name ? desc->long_name : "");
av_log(NULL, AV_LOG_STDERR, " %-20s %s", desc->name, desc->long_name ? desc->long_name : "");
/* print decoders/encoders when there's more than one or their
* names are different from codec name */
@@ -1580,7 +1640,7 @@ int show_codecs(void *optctx, const char *opt, const char *arg)
}
}
printf("\n");
av_log(NULL, AV_LOG_STDERR, "\n");
}
av_free(codecs);
return 0;
@@ -1591,7 +1651,7 @@ static void print_codecs(int encoder)
const AVCodecDescriptor **codecs;
unsigned i, nb_codecs = get_codecs_sorted(&codecs);
printf("%s:\n"
av_log(NULL, AV_LOG_STDERR, "%s:\n"
" V..... = Video\n"
" A..... = Audio\n"
" S..... = Subtitle\n"
@@ -1607,18 +1667,18 @@ static void print_codecs(int encoder)
const AVCodec *codec = NULL;
while ((codec = next_codec_for_id(desc->id, codec, encoder))) {
printf(" %c", get_media_type_char(desc->type));
printf((codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) ? "F" : ".");
printf((codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) ? "S" : ".");
printf((codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) ? "X" : ".");
printf((codec->capabilities & AV_CODEC_CAP_DRAW_HORIZ_BAND)?"B" : ".");
printf((codec->capabilities & AV_CODEC_CAP_DR1) ? "D" : ".");
av_log(NULL, AV_LOG_STDERR, " %c", get_media_type_char(desc->type));
av_log(NULL, AV_LOG_STDERR, (codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) ? "F" : ".");
av_log(NULL, AV_LOG_STDERR, (codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) ? "S" : ".");
av_log(NULL, AV_LOG_STDERR, (codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) ? "X" : ".");
av_log(NULL, AV_LOG_STDERR, (codec->capabilities & AV_CODEC_CAP_DRAW_HORIZ_BAND)?"B" : ".");
av_log(NULL, AV_LOG_STDERR, (codec->capabilities & AV_CODEC_CAP_DR1) ? "D" : ".");
printf(" %-20s %s", codec->name, codec->long_name ? codec->long_name : "");
av_log(NULL, AV_LOG_STDERR, " %-20s %s", codec->name, codec->long_name ? codec->long_name : "");
if (strcmp(codec->name, desc->name))
printf(" (codec %s)", desc->name);
av_log(NULL, AV_LOG_STDERR, " (codec %s)", desc->name);
printf("\n");
av_log(NULL, AV_LOG_STDERR, "\n");
}
}
av_free(codecs);
@@ -1641,10 +1701,10 @@ int show_bsfs(void *optctx, const char *opt, const char *arg)
const AVBitStreamFilter *bsf = NULL;
void *opaque = NULL;
printf("Bitstream filters:\n");
av_log(NULL, AV_LOG_STDERR, "Bitstream filters:\n");
while ((bsf = av_bsf_iterate(&opaque)))
printf("%s\n", bsf->name);
printf("\n");
av_log(NULL, AV_LOG_STDERR, "%s\n", bsf->name);
av_log(NULL, AV_LOG_STDERR, "\n");
return 0;
}
@@ -1653,13 +1713,13 @@ int show_protocols(void *optctx, const char *opt, const char *arg)
void *opaque = NULL;
const char *name;
printf("Supported file protocols:\n"
av_log(NULL, AV_LOG_STDERR, "Supported file protocols:\n"
"Input:\n");
while ((name = avio_enum_protocols(&opaque, 0)))
printf(" %s\n", name);
printf("Output:\n");
av_log(NULL, AV_LOG_STDERR, " %s\n", name);
av_log(NULL, AV_LOG_STDERR, "Output:\n");
while ((name = avio_enum_protocols(&opaque, 1)))
printf(" %s\n", name);
av_log(NULL, AV_LOG_STDERR, " %s\n", name);
return 0;
}
@@ -1672,7 +1732,7 @@ int show_filters(void *optctx, const char *opt, const char *arg)
int i, j;
const AVFilterPad *pad;
printf("Filters:\n"
av_log(NULL, AV_LOG_STDERR, "Filters:\n"
" T.. = Timeline support\n"
" .S. = Slice threading\n"
" ..C = Command support\n"
@@ -1698,14 +1758,14 @@ int show_filters(void *optctx, const char *opt, const char *arg)
( i && (filter->flags & AVFILTER_FLAG_DYNAMIC_OUTPUTS))) ? 'N' : '|';
}
*descr_cur = 0;
printf(" %c%c%c %-17s %-10s %s\n",
av_log(NULL, AV_LOG_STDERR, " %c%c%c %-17s %-10s %s\n",
filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE ? 'T' : '.',
filter->flags & AVFILTER_FLAG_SLICE_THREADS ? 'S' : '.',
filter->process_command ? 'C' : '.',
filter->name, descr, filter->description);
}
#else
printf("No filters available: libavfilter disabled\n");
av_log(NULL, AV_LOG_STDERR, "No filters available: libavfilter disabled\n");
#endif
return 0;
}
@@ -1716,10 +1776,10 @@ int show_colors(void *optctx, const char *opt, const char *arg)
const uint8_t *rgb;
int i;
printf("%-32s #RRGGBB\n", "name");
av_log(NULL, AV_LOG_STDERR, "%-32s #RRGGBB\n", "name");
for (i = 0; (name = av_get_known_color_name(i, &rgb)); i++)
printf("%-32s #%02x%02x%02x\n", name, rgb[0], rgb[1], rgb[2]);
av_log(NULL, AV_LOG_STDERR, "%-32s #%02x%02x%02x\n", name, rgb[0], rgb[1], rgb[2]);
return 0;
}
@@ -1728,7 +1788,7 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg)
{
const AVPixFmtDescriptor *pix_desc = NULL;
printf("Pixel formats:\n"
av_log(NULL, AV_LOG_STDERR, "Pixel formats:\n"
"I.... = Supported Input format for conversion\n"
".O... = Supported Output format for conversion\n"
"..H.. = Hardware accelerated format\n"
@@ -1744,7 +1804,7 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg)
while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
enum AVPixelFormat av_unused pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
printf("%c%c%c%c%c %-16s %d %2d\n",
av_log(NULL, AV_LOG_STDERR, "%c%c%c%c%c %-16s %d %2d\n",
sws_isSupportedInput (pix_fmt) ? 'I' : '.',
sws_isSupportedOutput(pix_fmt) ? 'O' : '.',
pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL ? 'H' : '.',
@@ -1763,24 +1823,24 @@ int show_layouts(void *optctx, const char *opt, const char *arg)
uint64_t layout, j;
const char *name, *descr;
printf("Individual channels:\n"
av_log(NULL, AV_LOG_STDERR, "Individual channels:\n"
"NAME DESCRIPTION\n");
for (i = 0; i < 63; i++) {
name = av_get_channel_name((uint64_t)1 << i);
if (!name)
continue;
descr = av_get_channel_description((uint64_t)1 << i);
printf("%-14s %s\n", name, descr);
av_log(NULL, AV_LOG_STDERR, "%-14s %s\n", name, descr);
}
printf("\nStandard channel layouts:\n"
av_log(NULL, AV_LOG_STDERR, "\nStandard channel layouts:\n"
"NAME DECOMPOSITION\n");
for (i = 0; !av_get_standard_channel_layout(i, &layout, &name); i++) {
if (name) {
printf("%-14s ", name);
av_log(NULL, AV_LOG_STDERR, "%-14s ", name);
for (j = 1; j; j <<= 1)
if ((layout & j))
printf("%s%s", (layout & (j - 1)) ? "+" : "", av_get_channel_name(j));
printf("\n");
av_log(NULL, AV_LOG_STDERR, "%s%s", (layout & (j - 1)) ? "+" : "", av_get_channel_name(j));
av_log(NULL, AV_LOG_STDERR, "\n");
}
}
return 0;
@@ -1791,7 +1851,7 @@ int show_sample_fmts(void *optctx, const char *opt, const char *arg)
int i;
char fmt_str[128];
for (i = -1; i < AV_SAMPLE_FMT_NB; i++)
printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i));
av_log(NULL, AV_LOG_STDERR, "%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i));
return 0;
}
@@ -1839,10 +1899,10 @@ static void show_help_demuxer(const char *name)
return;
}
printf("Demuxer %s [%s]:\n", fmt->name, fmt->long_name);
av_log(NULL, AV_LOG_STDERR, "Demuxer %s [%s]:\n", fmt->name, fmt->long_name);
if (fmt->extensions)
printf(" Common extensions: %s.\n", fmt->extensions);
av_log(NULL, AV_LOG_STDERR, " Common extensions: %s.\n", fmt->extensions);
if (fmt->priv_class)
show_help_children(fmt->priv_class, AV_OPT_FLAG_DECODING_PARAM);
@@ -1858,23 +1918,23 @@ static void show_help_muxer(const char *name)
return;
}
printf("Muxer %s [%s]:\n", fmt->name, fmt->long_name);
av_log(NULL, AV_LOG_STDERR, "Muxer %s [%s]:\n", fmt->name, fmt->long_name);
if (fmt->extensions)
printf(" Common extensions: %s.\n", fmt->extensions);
av_log(NULL, AV_LOG_STDERR, " Common extensions: %s.\n", fmt->extensions);
if (fmt->mime_type)
printf(" Mime type: %s.\n", fmt->mime_type);
av_log(NULL, AV_LOG_STDERR, " Mime type: %s.\n", fmt->mime_type);
if (fmt->video_codec != AV_CODEC_ID_NONE &&
(desc = avcodec_descriptor_get(fmt->video_codec))) {
printf(" Default video codec: %s.\n", desc->name);
av_log(NULL, AV_LOG_STDERR, " Default video codec: %s.\n", desc->name);
}
if (fmt->audio_codec != AV_CODEC_ID_NONE &&
(desc = avcodec_descriptor_get(fmt->audio_codec))) {
printf(" Default audio codec: %s.\n", desc->name);
av_log(NULL, AV_LOG_STDERR, " Default audio codec: %s.\n", desc->name);
}
if (fmt->subtitle_codec != AV_CODEC_ID_NONE &&
(desc = avcodec_descriptor_get(fmt->subtitle_codec))) {
printf(" Default subtitle codec: %s.\n", desc->name);
av_log(NULL, AV_LOG_STDERR, " Default subtitle codec: %s.\n", desc->name);
}
if (fmt->priv_class)
@@ -1896,40 +1956,40 @@ static void show_help_filter(const char *name)
return;
}
printf("Filter %s\n", f->name);
av_log(NULL, AV_LOG_STDERR, "Filter %s\n", f->name);
if (f->description)
printf(" %s\n", f->description);
av_log(NULL, AV_LOG_STDERR, " %s\n", f->description);
if (f->flags & AVFILTER_FLAG_SLICE_THREADS)
printf(" slice threading supported\n");
av_log(NULL, AV_LOG_STDERR, " slice threading supported\n");
printf(" Inputs:\n");
av_log(NULL, AV_LOG_STDERR, " Inputs:\n");
count = avfilter_pad_count(f->inputs);
for (i = 0; i < count; i++) {
printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->inputs, i),
av_log(NULL, AV_LOG_STDERR, " #%d: %s (%s)\n", i, avfilter_pad_get_name(f->inputs, i),
media_type_string(avfilter_pad_get_type(f->inputs, i)));
}
if (f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS)
printf(" dynamic (depending on the options)\n");
av_log(NULL, AV_LOG_STDERR, " dynamic (depending on the options)\n");
else if (!count)
printf(" none (source filter)\n");
av_log(NULL, AV_LOG_STDERR, " none (source filter)\n");
printf(" Outputs:\n");
av_log(NULL, AV_LOG_STDERR, " Outputs:\n");
count = avfilter_pad_count(f->outputs);
for (i = 0; i < count; i++) {
printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->outputs, i),
av_log(NULL, AV_LOG_STDERR, " #%d: %s (%s)\n", i, avfilter_pad_get_name(f->outputs, i),
media_type_string(avfilter_pad_get_type(f->outputs, i)));
}
if (f->flags & AVFILTER_FLAG_DYNAMIC_OUTPUTS)
printf(" dynamic (depending on the options)\n");
av_log(NULL, AV_LOG_STDERR, " dynamic (depending on the options)\n");
else if (!count)
printf(" none (sink filter)\n");
av_log(NULL, AV_LOG_STDERR, " none (sink filter)\n");
if (f->priv_class)
show_help_children(f->priv_class, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM |
AV_OPT_FLAG_AUDIO_PARAM);
if (f->flags & AVFILTER_FLAG_SUPPORT_TIMELINE)
printf("This filter has support for timeline through the 'enable' option.\n");
av_log(NULL, AV_LOG_STDERR, "This filter has support for timeline through the 'enable' option.\n");
#else
av_log(NULL, AV_LOG_ERROR, "Build without libavfilter; "
"can not to satisfy request\n");
@@ -1941,12 +2001,15 @@ static void show_help_bsf(const char *name)
{
const AVBitStreamFilter *bsf = av_bsf_get_by_name(name);
if (!bsf) {
if (!name) {
av_log(NULL, AV_LOG_ERROR, "No bitstream filter name specified.\n");
return;
} else if (!bsf) {
av_log(NULL, AV_LOG_ERROR, "Unknown bit stream filter '%s'.\n", name);
return;
}
printf("Bit stream filter %s\n", bsf->name);
av_log(NULL, AV_LOG_STDERR, "Bit stream filter %s\n", bsf->name);
PRINT_CODEC_SUPPORTED(bsf, codec_ids, enum AVCodecID, "codecs",
AV_CODEC_ID_NONE, GET_CODEC_NAME);
if (bsf->priv_class)
@@ -1956,7 +2019,6 @@ static void show_help_bsf(const char *name)
int show_help(void *optctx, const char *opt, const char *arg)
{
char *topic, *par;
av_log_set_callback(mobileffmpeg_log_callback_function);
topic = av_strdup(arg ? arg : "");
if (!topic)
@@ -1966,7 +2028,11 @@ int show_help(void *optctx, const char *opt, const char *arg)
*par++ = 0;
if (!*topic) {
show_help_default(topic, par);
if (program_name && !strcmp(program_name, "ffmpeg")) {
show_help_default_ffmpeg(topic, par);
} else {
show_help_default_ffprobe(topic, par);
}
} else if (!strcmp(topic, "decoder")) {
show_help_codec(par, 0);
} else if (!strcmp(topic, "encoder")) {
@@ -1982,7 +2048,11 @@ int show_help(void *optctx, const char *opt, const char *arg)
} else if (!strcmp(topic, "bsf")) {
show_help_bsf(par);
} else {
show_help_default(topic, par);
if (program_name && !strcmp(program_name, "ffmpeg")) {
show_help_default_ffmpeg(topic, par);
} else {
show_help_default_ffprobe(topic, par);
}
}
av_freep(&topic);
@@ -2014,7 +2084,7 @@ FILE *get_preset_file(char *filename, size_t filename_size,
av_strlcpy(filename, preset_name, filename_size);
f = fopen(filename, "r");
} else {
#ifdef _WIN32
#if HAVE_GETMODULEHANDLE
char datadir[MAX_PATH], *ls;
base[2] = NULL;
@@ -2182,20 +2252,20 @@ static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts)
if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category))
return AVERROR(EINVAL);
printf("Auto-detected sources for %s:\n", fmt->name);
av_log(NULL, AV_LOG_STDERR, "Auto-detected sources for %s:\n", fmt->name);
if (!fmt->get_device_list) {
ret = AVERROR(ENOSYS);
printf("Cannot list sources. Not implemented.\n");
av_log(NULL, AV_LOG_STDERR, "Cannot list sources. Not implemented.\n");
goto fail;
}
if ((ret = avdevice_list_input_sources(fmt, NULL, opts, &device_list)) < 0) {
printf("Cannot list sources.\n");
av_log(NULL, AV_LOG_STDERR, "Cannot list sources.\n");
goto fail;
}
for (i = 0; i < device_list->nb_devices; i++) {
printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ",
av_log(NULL, AV_LOG_STDERR, "%s %s [%s]\n", device_list->default_device == i ? "*" : " ",
device_list->devices[i]->device_name, device_list->devices[i]->device_description);
}
@@ -2212,20 +2282,20 @@ static int print_device_sinks(AVOutputFormat *fmt, AVDictionary *opts)
if (!fmt || !fmt->priv_class || !AV_IS_OUTPUT_DEVICE(fmt->priv_class->category))
return AVERROR(EINVAL);
printf("Auto-detected sinks for %s:\n", fmt->name);
av_log(NULL, AV_LOG_STDERR, "Auto-detected sinks for %s:\n", fmt->name);
if (!fmt->get_device_list) {
ret = AVERROR(ENOSYS);
printf("Cannot list sinks. Not implemented.\n");
av_log(NULL, AV_LOG_STDERR, "Cannot list sinks. Not implemented.\n");
goto fail;
}
if ((ret = avdevice_list_output_sinks(fmt, NULL, opts, &device_list)) < 0) {
printf("Cannot list sinks.\n");
av_log(NULL, AV_LOG_STDERR, "Cannot list sinks.\n");
goto fail;
}
for (i = 0; i < device_list->nb_devices; i++) {
printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ",
av_log(NULL, AV_LOG_STDERR, "%s %s [%s]\n", device_list->default_device == i ? "*" : " ",
device_list->devices[i]->device_name, device_list->devices[i]->device_description);
}
@@ -2251,7 +2321,7 @@ static int show_sinks_sources_parse_arg(const char *arg, char **dev, AVDictionar
}
}
} else
printf("\nDevice name is not provided.\n"
av_log(NULL, AV_LOG_STDERR, "\nDevice name is not provided.\n"
"You can pass devicename[,opt1=val1[,opt2=val2...]] as an argument.\n\n");
return 0;
}
+30 -53
View File
@@ -20,6 +20,17 @@
*/
/*
* CHANGES 01.2020
* - ffprobe support changes
* - AV_LOG_STDERR introduced
*
* CHANGES 12.2019
* - Concurrent execution support
*
* CHANGES 03.2019
* --------------------------------------------------------
* - config.h include removed
*
* CHANGES 08.2018
* --------------------------------------------------------
* - fftools_ prefix added to file name and include guards
@@ -35,7 +46,6 @@
#include <stdint.h>
#include "config.h"
#include "libavcodec/avcodec.h"
#include "libavfilter/avfilter.h"
#include "libavformat/avformat.h"
@@ -45,22 +55,28 @@
#undef main /* We don't want SDL to override our main() */
#endif
/**
* Defines logs printed to stderr by ffmpeg. They are not filtered and always redirected.
*/
#define AV_LOG_STDERR -16
/**
* program name, defined by the program for show_version().
*/
extern const char program_name[];
extern __thread char *program_name;
/**
* program birth year, defined by the program for show_banner()
*/
extern const int program_birth_year;
extern __thread int program_birth_year;
extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
extern AVFormatContext *avformat_opts;
extern AVDictionary *sws_dict;
extern AVDictionary *swr_opts;
extern AVDictionary *format_opts, *codec_opts, *resample_opts;
extern int hide_banner;
extern __thread AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
extern __thread AVFormatContext *avformat_opts;
extern __thread AVDictionary *sws_dict;
extern __thread AVDictionary *swr_opts;
extern __thread AVDictionary *format_opts, *codec_opts, *resample_opts;
extern __thread int hide_banner;
extern __thread int find_stream_info;
/**
* Register a program-specific cleanup routine.
@@ -110,7 +126,7 @@ int opt_default(void *optctx, const char *opt, const char *arg);
*/
int opt_loglevel(void *optctx, const char *opt, const char *arg);
int opt_report(const char *opt);
int opt_report(void *optctx, const char *opt, const char *arg);
int opt_max_alloc(void *optctx, const char *opt, const char *arg);
@@ -212,47 +228,6 @@ typedef struct OptionDef {
void show_help_options(const OptionDef *options, const char *msg, int req_flags,
int rej_flags, int alt_flags);
#if CONFIG_AVDEVICE
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE \
{ "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \
"list sources of the input device", "device" }, \
{ "sinks" , OPT_EXIT | HAS_ARG, { .func_arg = show_sinks }, \
"list sinks of the output device", "device" }, \
#else
#define CMDUTILS_COMMON_OPTIONS_AVDEVICE
#endif
#define CMDUTILS_COMMON_OPTIONS \
{ "L", OPT_EXIT, { .func_arg = show_license }, "show license" }, \
{ "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" }, \
{ "version", OPT_EXIT, { .func_arg = show_version }, "show version" }, \
{ "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" }, \
{ "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" }, \
{ "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \
{ "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \
{ "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \
{ "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \
{ "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \
{ "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \
{ "bsfs", OPT_EXIT, { .func_arg = show_bsfs }, "show available bit stream filters" }, \
{ "protocols", OPT_EXIT, { .func_arg = show_protocols }, "show available protocols" }, \
{ "filters", OPT_EXIT, { .func_arg = show_filters }, "show available filters" }, \
{ "pix_fmts", OPT_EXIT, { .func_arg = show_pix_fmts }, "show available pixel formats" }, \
{ "layouts", OPT_EXIT, { .func_arg = show_layouts }, "show standard channel layouts" }, \
{ "sample_fmts", OPT_EXIT, { .func_arg = show_sample_fmts }, "show available audio sample formats" }, \
{ "colors", OPT_EXIT, { .func_arg = show_colors }, "show available color names" }, \
{ "loglevel", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "v", HAS_ARG, { .func_arg = opt_loglevel }, "set logging level", "loglevel" }, \
{ "report", 0, { (void*)opt_report }, "generate a report" }, \
{ "max_alloc", HAS_ARG, { .func_arg = opt_max_alloc }, "set maximum size of a single allocated block", "bytes" }, \
{ "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \
{ "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \
CMDUTILS_COMMON_OPTIONS_AVDEVICE \
/**
* Show help for all options with given flags in class and all its
* children.
@@ -260,10 +235,11 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
void show_help_children(const AVClass *class, int flags);
/**
* Per-fftool specific help handler. Implemented in each
* Per-fftool specific help handlers. Implemented in each
* fftool, called by show_help().
*/
void show_help_default(const char *opt, const char *arg);
void show_help_default_ffmpeg(const char *opt, const char *arg);
void show_help_default_ffprobe(const char *opt, const char *arg);
/**
* Generic -h handler common to all fftools.
@@ -358,6 +334,7 @@ typedef struct OptionParseContext {
* Parse an options group and write results into optctx.
*
* @param optctx an app-specific options context. NULL for global options group
* @param g option group
*/
int parse_optgroup(void *optctx, OptionGroup *g);
File diff suppressed because it is too large Load Diff
+131 -50
View File
@@ -17,6 +17,19 @@
*/
/*
* CHANGES 06.2020
* - cancel_operation() method signature updated with id
*
* CHANGES 01.2020
* - ffprobe support changes
*
* CHANGES 12.2019
* - Concurrent execution support
*
* CHANGES 03.2019
* --------------------------------------------------------
* - config.h include removed
*
* CHANGES 08.2018
* --------------------------------------------------------
* - fftools_ prefix added to file name and include guards
@@ -31,8 +44,6 @@
#ifndef FFTOOLS_FFMPEG_H
#define FFTOOLS_FFMPEG_H
#include "config.h"
#include <stdint.h>
#include <stdio.h>
#include <signal.h>
@@ -84,7 +95,7 @@ typedef struct HWAccel {
} HWAccel;
typedef struct HWDevice {
char *name;
const char *name;
enum AVHWDeviceType type;
AVBufferRef *device_ref;
} HWDevice;
@@ -496,6 +507,7 @@ typedef struct OutputStream {
AVRational frame_aspect_ratio;
/* forced key frames */
int64_t forced_kf_ref_pts;
int64_t *forced_kf_pts;
int forced_kf_count;
int forced_kf_index;
@@ -575,63 +587,61 @@ typedef struct OutputFile {
int header_written;
} OutputFile;
extern InputStream **input_streams;
extern int nb_input_streams;
extern InputFile **input_files;
extern int nb_input_files;
extern __thread InputStream **input_streams;
extern __thread int nb_input_streams;
extern __thread InputFile **input_files;
extern __thread int nb_input_files;
extern OutputStream **output_streams;
extern int nb_output_streams;
extern OutputFile **output_files;
extern int nb_output_files;
extern __thread OutputStream **output_streams;
extern __thread int nb_output_streams;
extern __thread OutputFile **output_files;
extern __thread int nb_output_files;
extern FilterGraph **filtergraphs;
extern int nb_filtergraphs;
extern __thread FilterGraph **filtergraphs;
extern __thread int nb_filtergraphs;
extern char *vstats_filename;
extern char *sdp_filename;
extern __thread char *vstats_filename;
extern __thread char *sdp_filename;
extern float audio_drift_threshold;
extern float dts_delta_threshold;
extern float dts_error_threshold;
extern __thread float audio_drift_threshold;
extern __thread float dts_delta_threshold;
extern __thread float dts_error_threshold;
extern int audio_volume;
extern int audio_sync_method;
extern int video_sync_method;
extern float frame_drop_threshold;
extern int do_benchmark;
extern int do_benchmark_all;
extern int do_deinterlace;
extern int do_hex_dump;
extern int do_pkt_dump;
extern int copy_ts;
extern int start_at_zero;
extern int copy_tb;
extern int debug_ts;
extern int exit_on_error;
extern int abort_on_flags;
extern int print_stats;
extern int qp_hist;
extern int stdin_interaction;
extern int frame_bits_per_raw_sample;
extern AVIOContext *progress_avio;
extern float max_error_rate;
extern char *videotoolbox_pixfmt;
extern __thread int audio_volume;
extern __thread int audio_sync_method;
extern __thread int video_sync_method;
extern __thread float frame_drop_threshold;
extern __thread int do_benchmark;
extern __thread int do_benchmark_all;
extern __thread int do_deinterlace;
extern __thread int do_hex_dump;
extern __thread int do_pkt_dump;
extern __thread int copy_ts;
extern __thread int start_at_zero;
extern __thread int copy_tb;
extern __thread int debug_ts;
extern __thread int exit_on_error;
extern __thread int abort_on_flags;
extern __thread int print_stats;
extern __thread int qp_hist;
extern __thread int stdin_interaction;
extern __thread int frame_bits_per_raw_sample;
extern __thread AVIOContext *progress_avio;
extern __thread float max_error_rate;
extern __thread char *videotoolbox_pixfmt;
extern int filter_nbthreads;
extern int filter_complex_nbthreads;
extern int vstats_version;
extern __thread int filter_nbthreads;
extern __thread int filter_complex_nbthreads;
extern __thread int vstats_version;
extern const AVIOInterruptCB int_cb;
extern __thread const AVIOInterruptCB int_cb;
extern const OptionDef options[];
extern const HWAccel hwaccels[];
extern AVBufferRef *hw_device_ctx;
extern __thread AVBufferRef *hw_device_ctx;
#if CONFIG_QSV
extern char *qsv_device;
extern __thread char *qsv_device;
#endif
extern HWDevice *filter_hw_device;
extern __thread HWDevice *filter_hw_device;
void term_init(void);
void term_exit(void);
@@ -678,6 +688,77 @@ int hwaccel_decode_init(AVCodecContext *avctx);
void set_report_callback(void (*callback)(int, float, float, int64_t, int, double, double));
void cancel_operation();
void cancel_operation(long id);
int opt_map(void *optctx, const char *opt, const char *arg);
int opt_map_channel(void *optctx, const char *opt, const char *arg);
int opt_recording_timestamp(void *optctx, const char *opt, const char *arg);
int opt_data_frames(void *optctx, const char *opt, const char *arg);
int opt_progress(void *optctx, const char *opt, const char *arg);
int opt_target(void *optctx, const char *opt, const char *arg);
int opt_vsync(void *optctx, const char *opt, const char *arg);
int opt_abort_on(void *optctx, const char *opt, const char *arg);
int opt_qscale(void *optctx, const char *opt, const char *arg);
int opt_profile(void *optctx, const char *opt, const char *arg);
int opt_filter_complex(void *optctx, const char *opt, const char *arg);
int opt_filter_complex_script(void *optctx, const char *opt, const char *arg);
int opt_attach(void *optctx, const char *opt, const char *arg);
int opt_video_frames(void *optctx, const char *opt, const char *arg);
int opt_video_codec(void *optctx, const char *opt, const char *arg);
int opt_sameq(void *optctx, const char *opt, const char *arg);
int opt_timecode(void *optctx, const char *opt, const char *arg);
int opt_vstats_file(void *optctx, const char *opt, const char *arg);
int opt_vstats(void *optctx, const char *opt, const char *arg);
int opt_video_frames(void *optctx, const char *opt, const char *arg);
int opt_old2new(void *optctx, const char *opt, const char *arg);
int opt_streamid(void *optctx, const char *opt, const char *arg);
int opt_bitrate(void *optctx, const char *opt, const char *arg);
int show_hwaccels(void *optctx, const char *opt, const char *arg);
int opt_video_filters(void *optctx, const char *opt, const char *arg);
int opt_audio_frames(void *optctx, const char *opt, const char *arg);
int opt_audio_qscale(void *optctx, const char *opt, const char *arg);
int opt_audio_codec(void *optctx, const char *opt, const char *arg);
int opt_channel_layout(void *optctx, const char *opt, const char *arg);
int opt_preset(void *optctx, const char *opt, const char *arg);
int opt_audio_filters(void *optctx, const char *opt, const char *arg);
int opt_subtitle_codec(void *optctx, const char *opt, const char *arg);
int opt_video_channel(void *optctx, const char *opt, const char *arg);
int opt_video_standard(void *optctx, const char *opt, const char *arg);
int opt_sdp_file(void *optctx, const char *opt, const char *arg);
int opt_data_codec(void *optctx, const char *opt, const char *arg);
int opt_init_hw_device(void *optctx, const char *opt, const char *arg);
int opt_filter_hw_device(void *optctx, const char *opt, const char *arg);
void add_input_streams(OptionsContext *o, AVFormatContext *ic);
void assert_file_overwrite(const char *filename);
void dump_attachment(AVStream *st, const char *filename);
uint8_t *get_line(AVIOContext *s);
void uninit_options(OptionsContext *o);
void init_options(OptionsContext *o);
AVDictionary *strip_specifiers(AVDictionary *dict);
void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec);
int fftools_copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o);
AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder);
AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVStream *st);
int open_input_file(OptionsContext *o, const char *filename);
int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s);
int choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream *ost);
OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type, int source_index);
void parse_matrix_coeffs(uint16_t *dest, const char *str);
uint8_t *fftools_read_file(const char *filename);
char *get_ost_filters(OptionsContext *o, AVFormatContext *oc, OutputStream *ost);
void check_streamcopy_filters(OptionsContext *o, AVFormatContext *oc, const OutputStream *ost, enum AVMediaType type);
OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
OutputStream *new_unknown_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc, int source_index);
int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata);
void init_output_filter(OutputFilter *ofilter, OptionsContext *o, AVFormatContext *oc);
int init_complex_filters(void);
int open_output_file(OptionsContext *o, const char *filename);
int opt_default_new(OptionsContext *o, const char *opt, const char *arg);
int open_files(OptionGroupList *l, const char *inout, int (*open_file)(OptionsContext*, const char*));
#endif /* FFTOOLS_FFMPEG_H */
@@ -73,6 +73,7 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx, AVCod
if (codec && codec->pix_fmts) {
const enum AVPixelFormat *p = codec->pix_fmts;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(target);
//FIXME: This should check for AV_PIX_FMT_FLAG_ALPHA after PAL8 pixel format without alpha is implemented
int has_alpha = desc ? desc->nb_components % 2 == 0 : 0;
enum AVPixelFormat best= AV_PIX_FMT_NONE;
@@ -300,10 +301,17 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
exit_program(1);
}
ist = input_streams[input_files[file_idx]->ist_index + st->index];
if (ist->user_set_discard == AVDISCARD_ALL) {
av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s "
"matches a disabled input stream.\n", p, fg->graph_desc);
exit_program(1);
}
} else {
/* find the first unused stream of corresponding type */
for (i = 0; i < nb_input_streams; i++) {
ist = input_streams[i];
if (ist->user_set_discard == AVDISCARD_ALL)
continue;
if (ist->dec_ctx->codec_type == type && ist->discard)
break;
}
@@ -739,6 +747,7 @@ static int sub2video_prepare(InputStream *ist, InputFilter *ifilter)
if (!ist->sub2video.frame)
return AVERROR(ENOMEM);
ist->sub2video.last_pts = INT64_MIN;
ist->sub2video.end_pts = INT64_MIN;
return 0;
}
@@ -782,7 +791,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
sar = ifilter->sample_aspect_ratio;
if(!sar.den)
sar = (AVRational){0,1};
av_bprint_init(&args, 0, 1);
av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC);
av_bprintf(&args,
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
"pixel_aspect=%d/%d:sws_param=flags=%d",
+10 -4
View File
@@ -17,6 +17,9 @@
*/
/*
* CHANGES 12.2019
* - Concurrent execution support
*
* CHANGES 08.2018
* --------------------------------------------------------
* - fftools_ prefix added to file name and parent header
@@ -28,8 +31,8 @@
#include "fftools_ffmpeg.h"
static int nb_hw_devices;
static HWDevice **hw_devices;
__thread int nb_hw_devices;
__thread HWDevice **hw_devices;
static HWDevice *hw_device_get_by_type(enum AVHWDeviceType type)
{
@@ -105,7 +108,7 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
// -> av_hwdevice_ctx_create_derived()
AVDictionary *options = NULL;
char *type_name = NULL, *name = NULL, *device = NULL;
const char *type_name = NULL, *name = NULL, *device = NULL;
enum AVHWDeviceType type;
HWDevice *dev, *src;
AVBufferRef *device_ref = NULL;
@@ -161,11 +164,13 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
++p;
q = strchr(p, ',');
if (q) {
if (q - p > 0) {
device = av_strndup(p, q - p);
if (!device) {
err = AVERROR(ENOMEM);
goto fail;
}
}
err = av_dict_parse_string(&options, q + 1, "=", ",", 0);
if (err < 0) {
errmsg = "failed to parse options";
@@ -174,7 +179,8 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
}
err = av_hwdevice_ctx_create(&device_ref, type,
device ? device : p, options, 0);
q ? device : p[0] ? p : NULL,
options, 0);
if (err < 0)
goto fail;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+380 -109
View File
@@ -17,28 +17,24 @@
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* CHANGES 09.2018
* --------------------------------------------------------
* - Merged with mobileffmpeg_config
*
* CHANGES 08.2018
* --------------------------------------------------------
* - Copied methods with avutil_log_ prefix from libavutil/log.c
*/
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "config.h"
#include "libavcodec/jni.h"
#include "libavutil/bprint.h"
#include "mobileffmpeg.h"
#include "fftools_ffmpeg.h"
#include "mobileffmpeg.h"
#include "mobileffprobe.h"
/** Callback data structure */
struct CallbackData {
int type; // 1 (log callback) or 2 (statistics callback)
long executionId; // execution id
int logLevel; // log level
char *logData; // log data
AVBPrint logData; // log data
int statisticsFrameNumber; // statistics frame number
float statisticsFps; // statistics fps
@@ -51,10 +47,19 @@ struct CallbackData {
struct CallbackData *next;
};
/** Execution map variables */
const int EXECUTION_MAP_SIZE = 1000;
static volatile int executionMap[EXECUTION_MAP_SIZE];
static pthread_mutex_t executionMapMutex;
/** Redirection control variables */
pthread_mutex_t lockMutex;
pthread_mutex_t monitorMutex;
pthread_cond_t monitorCondition;
static pthread_mutex_t lockMutex;
static pthread_mutex_t monitorMutex;
static pthread_cond_t monitorCondition;
/** Last command output variables */
static pthread_mutex_t logMutex;
static AVBPrint lastCommandOutput;
pthread_t callbackThread;
int redirectionEnabled;
@@ -74,33 +79,56 @@ static jmethodID logMethod;
/** Global reference of statistics redirection method in Java */
static jmethodID statisticsMethod;
/** Global reference of String class in Java */
static jclass stringClass;
/** Global reference of String constructor in Java */
static jmethodID stringConstructor;
/** Full name of the Config class */
const char *configClassName = "com/arthenica/mobileffmpeg/Config";
/** Full name of String class */
const char *stringClassName = "java/lang/String";
/** Fields that control the handling of SIGNALs */
volatile int handleSIGQUIT = 1;
volatile int handleSIGINT = 1;
volatile int handleSIGTERM = 1;
volatile int handleSIGXCPU = 1;
volatile int handleSIGPIPE = 1;
/** Holds the id of the current execution */
__thread volatile long executionId = 0;
/** Holds the default log level */
int configuredLogLevel = AV_LOG_INFO;
/** Prototypes of native functions defined by Config class. */
JNINativeMethod configMethods[] = {
{"enableNativeRedirection", "()V", (void*) Java_com_arthenica_mobileffmpeg_Config_enableNativeRedirection},
{"disableNativeRedirection", "()V", (void*) Java_com_arthenica_mobileffmpeg_Config_disableNativeRedirection},
{"setNativeLogLevel", "(I)V", (void*) Java_com_arthenica_mobileffmpeg_Config_setNativeLogLevel},
{"getNativeLogLevel", "()I", (void*) Java_com_arthenica_mobileffmpeg_Config_getNativeLogLevel}
};
/** Prototypes of native functions defined by FFmpeg class. */
JNINativeMethod ffmpegMethods[] = {
{"getNativeFFmpegVersion", "()Ljava/lang/String;", (void*) Java_com_arthenica_mobileffmpeg_Config_getNativeFFmpegVersion},
{"getNativeVersion", "()Ljava/lang/String;", (void*) Java_com_arthenica_mobileffmpeg_Config_getNativeVersion},
{"nativeExecute", "([Ljava/lang/String;)I", (void*) Java_com_arthenica_mobileffmpeg_Config_nativeExecute},
{"nativeCancel", "()V", (void*) Java_com_arthenica_mobileffmpeg_Config_nativeCancel}
{"getNativeLogLevel", "()I", (void*) Java_com_arthenica_mobileffmpeg_Config_getNativeLogLevel},
{"getNativeFFmpegVersion", "()Ljava/lang/String;", (void*) Java_com_arthenica_mobileffmpeg_Config_getNativeFFmpegVersion},
{"getNativeVersion", "()Ljava/lang/String;", (void*) Java_com_arthenica_mobileffmpeg_Config_getNativeVersion},
{"nativeFFmpegExecute", "(J[Ljava/lang/String;)I", (void*) Java_com_arthenica_mobileffmpeg_Config_nativeFFmpegExecute},
{"nativeFFmpegCancel", "(J)V", (void*) Java_com_arthenica_mobileffmpeg_Config_nativeFFmpegCancel},
{"nativeFFprobeExecute", "([Ljava/lang/String;)I", (void*) Java_com_arthenica_mobileffmpeg_Config_nativeFFprobeExecute},
{"registerNewNativeFFmpegPipe", "(Ljava/lang/String;)I", (void*) Java_com_arthenica_mobileffmpeg_Config_registerNewNativeFFmpegPipe},
{"getNativeBuildDate", "()Ljava/lang/String;", (void*) Java_com_arthenica_mobileffmpeg_Config_getNativeBuildDate},
{"setNativeEnvironmentVariable", "(Ljava/lang/String;Ljava/lang/String;)I", (void*) Java_com_arthenica_mobileffmpeg_Config_setNativeEnvironmentVariable},
{"getNativeLastCommandOutput", "()Ljava/lang/String;", (void*) Java_com_arthenica_mobileffmpeg_Config_getNativeLastCommandOutput},
{"ignoreNativeSignal", "(I)V", (void*) Java_com_arthenica_mobileffmpeg_Config_ignoreNativeSignal}
};
/** Forward declaration for function defined in fftools_ffmpeg.c */
int execute(int argc, char **argv);
/** DEFINES LINE SIZE USED FOR LOGGING */
#define LOG_LINE_SIZE 1024
int ffmpeg_execute(int argc, char **argv);
static const char *avutil_log_get_level_str(int level) {
switch (level) {
case AV_LOG_STDERR:
return "stderr";
case AV_LOG_QUIET:
return "quiet";
case AV_LOG_DEBUG:
@@ -187,6 +215,26 @@ void monitorInit() {
pthread_condattr_destroy(&cattributes);
}
void logInit() {
pthread_mutexattr_t attributes;
pthread_mutexattr_init(&attributes);
pthread_mutexattr_settype(&attributes, PTHREAD_MUTEX_RECURSIVE_NP);
pthread_mutex_init(&logMutex, &attributes);
pthread_mutexattr_destroy(&attributes);
av_bprint_init(&lastCommandOutput, 0, AV_BPRINT_SIZE_UNLIMITED);
}
void executionMapLockInit() {
pthread_mutexattr_t attributes;
pthread_mutexattr_init(&attributes);
pthread_mutexattr_settype(&attributes, PTHREAD_MUTEX_RECURSIVE_NP);
pthread_mutex_init(&executionMapMutex, &attributes);
pthread_mutexattr_destroy(&attributes);
}
void mutexUnInit() {
pthread_mutex_destroy(&lockMutex);
}
@@ -196,14 +244,54 @@ void monitorUnInit() {
pthread_cond_destroy(&monitorCondition);
}
void logUnInit() {
pthread_mutex_destroy(&logMutex);
}
void executionMapLockUnInit() {
pthread_mutex_destroy(&executionMapMutex);
}
void mutexLock() {
pthread_mutex_lock(&lockMutex);
}
void lastCommandOutputLock() {
pthread_mutex_lock(&logMutex);
}
void executionMapLock() {
pthread_mutex_lock(&executionMapMutex);
}
void mutexUnlock() {
pthread_mutex_unlock(&lockMutex);
}
void lastCommandOutputUnlock() {
pthread_mutex_unlock(&logMutex);
}
void executionMapUnlock() {
pthread_mutex_unlock(&executionMapMutex);
}
void clearLastCommandOutput() {
lastCommandOutputLock();
av_bprint_clear(&lastCommandOutput);
lastCommandOutputUnlock();
}
void appendLastCommandOutput(AVBPrint *logMessage) {
if (logMessage->len <= 0) {
return;
}
lastCommandOutputLock();
av_bprintf(&lastCommandOutput, "%s", logMessage->str);
lastCommandOutputUnlock();
}
void monitorWait(int milliSeconds) {
struct timeval tp;
struct timespec ts;
@@ -232,16 +320,19 @@ void monitorNotify() {
/**
* Adds log data to the end of callback data list.
*
* @param level log level
* @param data log data
*/
void logCallbackDataAdd(int level, const char *data) {
void logCallbackDataAdd(int level, AVBPrint *data) {
// CREATE DATA STRUCT FIRST
struct CallbackData *newData = (struct CallbackData*)malloc(sizeof(struct CallbackData));
struct CallbackData *newData = (struct CallbackData*)av_malloc(sizeof(struct CallbackData));
newData->type = 1;
newData->executionId = executionId;
newData->logLevel = level;
size_t dataSize = strlen(data) + 1;
newData->logData = (char*)malloc(dataSize);
memcpy(newData->logData, data, dataSize);
av_bprint_init(&newData->logData, 0, AV_BPRINT_SIZE_UNLIMITED);
av_bprintf(&newData->logData, "%s", data->str);
newData->next = NULL;
mutexLock();
@@ -273,8 +364,9 @@ void logCallbackDataAdd(int level, const char *data) {
void statisticsCallbackDataAdd(int frameNumber, float fps, float quality, int64_t size, int time, double bitrate, double speed) {
// CREATE DATA STRUCT FIRST
struct CallbackData *newData = (struct CallbackData*)malloc(sizeof(struct CallbackData));
struct CallbackData *newData = (struct CallbackData*)av_malloc(sizeof(struct CallbackData));
newData->type = 2;
newData->executionId = executionId;
newData->statisticsFrameNumber = frameNumber;
newData->statisticsFps = fps;
newData->statisticsQuality = quality;
@@ -308,6 +400,20 @@ void statisticsCallbackDataAdd(int frameNumber, float fps, float quality, int64_
monitorNotify();
}
/**
* Adds an execution id to the execution map.
*
* @param id execution id
*/
void addExecution(long id) {
executionMapLock();
int key = id % EXECUTION_MAP_SIZE;
executionMap[key] = 1;
executionMapUnlock();
}
/**
* Removes head of callback data list.
*/
@@ -340,48 +446,97 @@ struct CallbackData *callbackDataRemove() {
return currentData;
}
/**
* Removes an execution id from the execution map.
*
* @param id execution id
*/
void removeExecution(long id) {
executionMapLock();
int key = id % EXECUTION_MAP_SIZE;
executionMap[key] = 0;
executionMapUnlock();
}
/**
* Checks whether a cancel request for the given execution id exists in the execution map.
*
* @param id execution id
* @return 1 if exists, false otherwise
*/
int cancelRequested(long id) {
int found = 0;
executionMapLock();
int key = id % EXECUTION_MAP_SIZE;
if (executionMap[key] == 0) {
found = 1;
}
executionMapUnlock();
return found;
}
/**
* Callback function for FFmpeg logs.
*
* \param pointer to AVClass struct
* \param level
* \param format
* \param arguments
* @param ptr pointer to AVClass struct
* @param level log level
* @param format format string
* @param vargs arguments
*/
void mobileffmpeg_log_callback_function(void *ptr, int level, const char* format, va_list vargs) {
char line[LOG_LINE_SIZE];
AVBPrint fullLine;
AVBPrint part[4];
int print_prefix = 1;
if (level >= 0) {
level &= 0xff;
}
int activeLogLevel = av_log_get_level();
// AV_LOG_STDERR logs are always redirected
if ((activeLogLevel == AV_LOG_QUIET && level != AV_LOG_STDERR) || (level > activeLogLevel)) {
return;
}
av_bprint_init(&fullLine, 0, AV_BPRINT_SIZE_UNLIMITED);
avutil_log_format_line(ptr, level, format, vargs, part, &print_prefix);
snprintf(line, sizeof(line), "%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str);
avutil_log_sanitize(part[0].str);
logCallbackDataAdd(level, part[0].str);
avutil_log_sanitize(part[1].str);
logCallbackDataAdd(level, part[1].str);
avutil_log_sanitize(part[2].str);
logCallbackDataAdd(level, part[2].str);
avutil_log_sanitize(part[3].str);
logCallbackDataAdd(level, part[3].str);
// COMBINE ALL 4 LOG PARTS
av_bprintf(&fullLine, "%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str);
if (fullLine.len > 0) {
logCallbackDataAdd(level, &fullLine);
appendLastCommandOutput(&fullLine);
}
av_bprint_finalize(part, NULL);
av_bprint_finalize(part+1, NULL);
av_bprint_finalize(part+2, NULL);
av_bprint_finalize(part+3, NULL);
av_bprint_finalize(&fullLine, NULL);
}
/**
* Callback function for FFmpeg statistics.
*
* \param frameNumber last processed frame number
* \param fps frames processed per second
* \param quality quality of the output stream (video only)
* \param size size in bytes
* \param time processed output duration
* \param bitrate output bit rate in kbits/s
* \param speed processing speed = processed duration / operation duration
* @param frameNumber last processed frame number
* @param fps frames processed per second
* @param quality quality of the output stream (video only)
* @param size size in bytes
* @param time processed output duration
* @param bitrate output bit rate in kbits/s
* @param speed processing speed = processed duration / operation duration
*/
void mobileffmpeg_statistics_callback_function(int frameNumber, float fps, float quality, int64_t size, int time, double bitrate, double speed) {
statisticsCallbackDataAdd(frameNumber, fps, quality, size, time, bitrate, speed);
@@ -415,31 +570,31 @@ void *callbackThreadFunction() {
// LOG CALLBACK
size_t size = strlen(callbackData->logData);
int size = callbackData->logData.len;
jbyteArray byteArray = (jbyteArray) (*env)->NewByteArray(env, size);
(*env)->SetByteArrayRegion(env, byteArray, 0, size, (jbyte *)callbackData->logData);
(*env)->CallStaticVoidMethod(env, configClass, logMethod, callbackData->logLevel, byteArray);
(*env)->SetByteArrayRegion(env, byteArray, 0, size, callbackData->logData.str);
(*env)->CallStaticVoidMethod(env, configClass, logMethod, (jlong) callbackData->executionId, callbackData->logLevel, byteArray);
(*env)->DeleteLocalRef(env, byteArray);
// CLEAN LOG DATA
free(callbackData->logData);
av_bprint_finalize(&callbackData->logData, NULL);
} else {
// STATISTICS CALLBACK
(*env)->CallStaticVoidMethod(env, configClass, statisticsMethod,
callbackData->statisticsFrameNumber, callbackData->statisticsFps,
callbackData->statisticsQuality, callbackData->statisticsSize,
callbackData->statisticsTime, callbackData->statisticsBitrate,
callbackData->statisticsSpeed);
(jlong) callbackData->executionId, callbackData->statisticsFrameNumber,
callbackData->statisticsFps, callbackData->statisticsQuality,
callbackData->statisticsSize, callbackData->statisticsTime,
callbackData->statisticsBitrate, callbackData->statisticsSpeed);
}
// CLEAN STRUCT
callbackData->next = NULL;
free(callbackData);
av_free(callbackData);
} else {
monitorWait(100);
@@ -456,9 +611,9 @@ void *callbackThreadFunction() {
/**
* Called when 'mobileffmpeg' native library is loaded.
*
* \param vm pointer to the running virtual machine
* \param reserved reserved
* \return JNI version needed by 'mobileffmpeg' library
* @param vm pointer to the running virtual machine
* @param reserved reserved
* @return JNI version needed by 'mobileffmpeg' library
*/
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
JNIEnv *env;
@@ -473,41 +628,55 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
return JNI_FALSE;
}
if ((*env)->RegisterNatives(env, localConfigClass, ffmpegMethods, 4) < 0) {
if ((*env)->RegisterNatives(env, localConfigClass, configMethods, 12) < 0) {
LOGE("OnLoad failed to RegisterNatives for class %s.\n", configClassName);
return JNI_FALSE;
}
if ((*env)->RegisterNatives(env, localConfigClass, configMethods, 4) < 0) {
LOGE("OnLoad failed to RegisterNatives for class %s.\n", configClassName);
jclass localStringClass = (*env)->FindClass(env, stringClassName);
if (localStringClass == NULL) {
LOGE("OnLoad failed to FindClass %s.\n", stringClassName);
return JNI_FALSE;
}
(*env)->GetJavaVM(env, &globalVm);
logMethod = (*env)->GetStaticMethodID(env, localConfigClass, "log", "(I[B)V");
logMethod = (*env)->GetStaticMethodID(env, localConfigClass, "log", "(JI[B)V");
if (logMethod == NULL) {
LOGE("OnLoad thread failed to GetMethodID for %s.\n", "log");
(*globalVm)->DetachCurrentThread(globalVm);
LOGE("OnLoad thread failed to GetStaticMethodID for %s.\n", "log");
return JNI_FALSE;
}
statisticsMethod = (*env)->GetStaticMethodID(env, localConfigClass, "statistics", "(IFFJIDD)V");
statisticsMethod = (*env)->GetStaticMethodID(env, localConfigClass, "statistics", "(JIFFJIDD)V");
if (logMethod == NULL) {
LOGE("OnLoad thread failed to GetMethodID for %s.\n", "statistics");
(*globalVm)->DetachCurrentThread(globalVm);
LOGE("OnLoad thread failed to GetStaticMethodID for %s.\n", "statistics");
return JNI_FALSE;
}
stringConstructor = (*env)->GetMethodID(env, localStringClass, "<init>", "([BLjava/lang/String;)V");
if (stringConstructor == NULL) {
LOGE("OnLoad thread failed to GetMethodID for %s.\n", "<init>");
return JNI_FALSE;
}
av_jni_set_java_vm(vm, NULL);
configClass = (jclass) ((*env)->NewGlobalRef(env, localConfigClass));
stringClass = (jclass) ((*env)->NewGlobalRef(env, localStringClass));
redirectionEnabled = 0;
callbackDataHead = NULL;
callbackDataTail = NULL;
for(int i = 0; i<EXECUTION_MAP_SIZE; i++) {
executionMap[i] = 0;
}
mutexInit();
monitorInit();
logInit();
executionMapLockInit();
return JNI_VERSION_1_6;
}
@@ -515,29 +684,29 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
/**
* Sets log level.
*
* \param env pointer to native method interface
* \param reference to the class on which this method is invoked
* \param log level
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @param level log level
*/
JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_setNativeLogLevel(JNIEnv *env, jclass object, jint level) {
av_log_set_level(level);
configuredLogLevel = level;
}
/**
* Returns current log level.
*
* \param env pointer to native method interface
* \param reference to the class on which this method is invoked
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
*/
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Config_getNativeLogLevel(JNIEnv *env, jclass object) {
return av_log_get_level();
return configuredLogLevel;
}
/**
* Enables log and statistics redirection.
*
* \param env pointer to native method interface
* \param reference to the class on which this method is invoked
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
*/
JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_enableNativeRedirection(JNIEnv *env, jclass object) {
mutexLock();
@@ -563,8 +732,8 @@ JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_enableNativeRedire
/**
* Disables log and statistics redirection.
*
* \param env pointer to native method interface
* \param reference to the class on which this method is invoked
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
*/
JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_disableNativeRedirection(JNIEnv *env, jclass object) {
@@ -587,9 +756,9 @@ JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_disableNativeRedir
/**
* Returns FFmpeg version bundled within the library natively.
*
* \param env pointer to native method interface
* \param object reference to the class on which this method is invoked
* \return FFmpeg version string
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @return FFmpeg version string
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_Config_getNativeFFmpegVersion(JNIEnv *env, jclass object) {
return (*env)->NewStringUTF(env, FFMPEG_VERSION);
@@ -598,40 +767,44 @@ JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_Config_getNativeFFmpeg
/**
* Returns MobileFFmpeg library version natively.
*
* \param env pointer to native method interface
* \param object reference to the class on which this method is invoked
* \return MobileFFmpeg version string
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @return MobileFFmpeg version string
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_Config_getNativeVersion(JNIEnv *env, jclass object) {
return (*env)->NewStringUTF(env, MOBILE_FFMPEG_VERSION);
}
/**
* Synchronously executes FFmpeg command natively with arguments provided.
* Synchronously executes FFmpeg natively with arguments provided.
*
* \param env pointer to native method interface
* \param object reference to the class on which this method is invoked
* \param stringArray reference to the object holding FFmpeg command arguments
* \return zero on successful execution, non-zero on error
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @param id execution id
* @param stringArray reference to the object holding FFmpeg command arguments
* @return zero on successful execution, non-zero on error
*/
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeExecute(JNIEnv *env, jclass object, jobjectArray stringArray) {
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeFFmpegExecute(JNIEnv *env, jclass object, jlong id, jobjectArray stringArray) {
jstring *tempArray = NULL;
int argumentCount = 1;
char **argv = NULL;
// SETS DEFAULT LOG LEVEL BEFORE STARTING A NEW EXECUTION
av_log_set_level(configuredLogLevel);
if (stringArray != NULL) {
int programArgumentCount = (*env)->GetArrayLength(env, stringArray);
argumentCount = programArgumentCount + 1;
tempArray = (jstring *) malloc(sizeof(jstring) * programArgumentCount);
tempArray = (jstring *) av_malloc(sizeof(jstring) * programArgumentCount);
}
/* PRESERVE USAGE FORMAT
*
* ffmpeg <arguments>
*/
argv = (char **)malloc(sizeof(char*) * (argumentCount));
argv[0] = (char *)malloc(sizeof(char) * (strlen(LIB_NAME) + 1));
argv = (char **)av_malloc(sizeof(char*) * (argumentCount));
argv[0] = (char *)av_malloc(sizeof(char) * (strlen(LIB_NAME) + 1));
strcpy(argv[0], LIB_NAME);
// PREPARE
@@ -644,8 +817,18 @@ JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeExecute(JNIE
}
}
// LAST COMMAND OUTPUT SHOULD BE CLEARED BEFORE STARTING A NEW EXECUTION
clearLastCommandOutput();
// REGISTER THE ID BEFORE STARTING EXECUTION
executionId = (long) id;
addExecution((long) id);
// RUN
int retCode = execute(argumentCount, argv);
int retCode = ffmpeg_execute(argumentCount, argv);
// ALWAYS REMOVE THE ID FROM THE MAP
removeExecution((long) id);
// CLEANUP
if (tempArray != NULL) {
@@ -653,20 +836,108 @@ JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeExecute(JNIE
(*env)->ReleaseStringUTFChars(env, tempArray[i], argv[i + 1]);
}
free(tempArray);
av_free(tempArray);
}
free(argv[0]);
free(argv);
av_free(argv[0]);
av_free(argv);
return retCode;
}
/**
* Cancels an ongoing operation natively.
* Cancels an ongoing FFmpeg operation natively.
*
* \param env pointer to native method interface
* \param object reference to the class on which this method is invoked
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @param id execution id
*/
JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeCancel(JNIEnv *env, jclass object) {
cancel_operation();
JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeFFmpegCancel(JNIEnv *env, jclass object, jlong id) {
cancel_operation(id);
}
/**
* Creates natively a new named pipe to use in FFmpeg operations.
*
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @param ffmpegPipePath full path of ffmpeg pipe
* @return zero on successful creation, non-zero on error
*/
JNIEXPORT int JNICALL Java_com_arthenica_mobileffmpeg_Config_registerNewNativeFFmpegPipe(JNIEnv *env, jclass object, jstring ffmpegPipePath) {
const char *ffmpegPipePathString = (*env)->GetStringUTFChars(env, ffmpegPipePath, 0);
return mkfifo(ffmpegPipePathString, S_IRWXU | S_IRWXG | S_IROTH);
}
/**
* Returns MobileFFmpeg library build date natively.
*
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @return MobileFFmpeg library build date
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_Config_getNativeBuildDate(JNIEnv *env, jclass object) {
char buildDate[10];
sprintf(buildDate, "%d", MOBILE_FFMPEG_BUILD_DATE);
return (*env)->NewStringUTF(env, buildDate);
}
/**
* Sets an environment variable natively
*
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @param variableName environment variable name
* @param variableValue environment variable value
* @return zero on success, non-zero on error
*/
JNIEXPORT int JNICALL Java_com_arthenica_mobileffmpeg_Config_setNativeEnvironmentVariable(JNIEnv *env, jclass object, jstring variableName, jstring variableValue) {
const char *variableNameString = (*env)->GetStringUTFChars(env, variableName, 0);
const char *variableValueString = (*env)->GetStringUTFChars(env, variableValue, 0);
int rc = setenv(variableNameString, variableValueString, 1);
(*env)->ReleaseStringUTFChars(env, variableName, variableNameString);
(*env)->ReleaseStringUTFChars(env, variableValue, variableValueString);
return rc;
}
/**
* Returns log output of the last executed command natively.
*
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @return output of the last executed command
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_Config_getNativeLastCommandOutput(JNIEnv *env, jclass object) {
int size = lastCommandOutput.len;
if (size > 0) {
jbyteArray byteArray = (*env)->NewByteArray(env, size);
(*env)->SetByteArrayRegion(env, byteArray, 0, size, lastCommandOutput.str);
jstring charsetName = (*env)->NewStringUTF(env, "UTF-8");
return (jstring) (*env)->NewObject(env, stringClass, stringConstructor, byteArray, charsetName);
}
return (*env)->NewStringUTF(env, "");
}
/**
* Registers a new ignored signal. Ignored signals are not handled by the library.
*
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @param signum signal number
*/
JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_ignoreNativeSignal(JNIEnv *env, jclass object, jint signum) {
if (signum == SIGQUIT) {
handleSIGQUIT = 0;
} else if (signum == SIGINT) {
handleSIGINT = 0;
} else if (signum == SIGTERM) {
handleSIGTERM = 0;
} else if (signum == SIGXCPU) {
handleSIGXCPU = 0;
} else if (signum == SIGPIPE) {
handleSIGPIPE = 0;
}
}
+42 -7
View File
@@ -27,7 +27,7 @@
#include "libavutil/ffversion.h"
/** Library version string */
#define MOBILE_FFMPEG_VERSION "2.1.1"
#define MOBILE_FFMPEG_VERSION "4.4"
/** Defines tag used for Android logging. */
#define LIB_NAME "mobile-ffmpeg"
@@ -91,16 +91,51 @@ JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_Config_getNativeVersio
/*
* Class: com_arthenica_mobileffmpeg_Config
* Method: nativeExecute
* Signature: ([Ljava/lang/String;)I
* Method: nativeFFmpegExecute
* Signature: (J[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeExecute(JNIEnv *, jclass, jobjectArray);
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeFFmpegExecute(JNIEnv *, jclass, jlong id, jobjectArray);
/*
* Class: com_arthenica_mobileffmpeg_Config
* Method: nativeCancel
* Signature: ()V
* Method: nativeFFmpegCancel
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeCancel(JNIEnv *, jclass);
JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeFFmpegCancel(JNIEnv *, jclass, jlong);
/*
* Class: com_arthenica_mobileffmpeg_Config
* Method: registerNewNativeFFmpegPipe
* Signature: (Ljava/lang/String;)I
*/
JNIEXPORT int JNICALL Java_com_arthenica_mobileffmpeg_Config_registerNewNativeFFmpegPipe(JNIEnv *env, jclass object, jstring ffmpegPipePath);
/*
* Class: com_arthenica_mobileffmpeg_Config
* Method: getNativeBuildDate
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_Config_getNativeBuildDate(JNIEnv *env, jclass object);
/**
* Class: com_arthenica_mobileffmpeg_Config
* Method: setNativeEnvironmentVariable
* Signature: (Ljava/lang/String;Ljava/lang/String;)I
*/
JNIEXPORT int JNICALL Java_com_arthenica_mobileffmpeg_Config_setNativeEnvironmentVariable(JNIEnv *env, jclass object, jstring variableName, jstring variableValue);
/*
* Class: com_arthenica_mobileffmpeg_Config
* Method: getNativeLastCommandOutput
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_Config_getNativeLastCommandOutput(JNIEnv *env, jclass object);
/*
* Class: com_arthenica_mobileffmpeg_Config
* Method: ignoreNativeSignal
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_arthenica_mobileffmpeg_Config_ignoreNativeSignal(JNIEnv *env, jclass object, jint signum);
#endif /* MOBILE_FFMPEG_H */
@@ -18,6 +18,7 @@
*/
#include "cpu-features.h"
#include "fftools_ffmpeg.h"
#include "mobileffmpeg_abidetect.h"
/** Full name of the Java class that owns native functions in this file. */
@@ -25,15 +26,18 @@ const char *abiDetectClassName = "com/arthenica/mobileffmpeg/AbiDetect";
/** Prototypes of native functions defined by this file. */
JNINativeMethod abiDetectMethods[] = {
{"getAbi", "()Ljava/lang/String;", (void*) Java_com_arthenica_mobileffmpeg_AbiDetect_getAbi}
{"getNativeAbi", "()Ljava/lang/String;", (void*) Java_com_arthenica_mobileffmpeg_AbiDetect_getNativeAbi},
{"getNativeCpuAbi", "()Ljava/lang/String;", (void*) Java_com_arthenica_mobileffmpeg_AbiDetect_getNativeCpuAbi},
{"isNativeLTSBuild", "()Z", (void*) Java_com_arthenica_mobileffmpeg_AbiDetect_isNativeLTSBuild},
{"getNativeBuildConf", "()Ljava/lang/String;", (void*) Java_com_arthenica_mobileffmpeg_AbiDetect_getNativeBuildConf}
};
/**
* Called when 'abidetect' native library is loaded.
*
* \param vm pointer to the running virtual machine
* \param reserved reserved
* \return JNI version needed by 'abidetect' library
* @param vm pointer to the running virtual machine
* @param reserved reserved
* @return JNI version needed by 'abidetect' library
*/
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
JNIEnv *env;
@@ -48,7 +52,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
return JNI_FALSE;
}
if ((*env)->RegisterNatives(env, abiDetectClass, abiDetectMethods, 1) < 0) {
if ((*env)->RegisterNatives(env, abiDetectClass, abiDetectMethods, 4) < 0) {
LOGE("OnLoad failed to RegisterNatives for class %s.\n", abiDetectClassName);
return JNI_FALSE;
}
@@ -57,13 +61,36 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
}
/**
* Returns running ABI name.
* Returns loaded ABI name.
*
* \param env pointer to native method interface
* \param object reference to the class on which this method is invoked
* \return running ABI name as UTF string
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @return loaded ABI name as UTF string
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_getAbi(JNIEnv *env, jclass object) {
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_getNativeAbi(JNIEnv *env, jclass object) {
#ifdef MOBILE_FFMPEG_ARM_V7A
return (*env)->NewStringUTF(env, "arm-v7a");
#elif MOBILE_FFMPEG_ARM64_V8A
return (*env)->NewStringUTF(env, "arm64-v8a");
#elif MOBILE_FFMPEG_X86
return (*env)->NewStringUTF(env, "x86");
#elif MOBILE_FFMPEG_X86_64
return (*env)->NewStringUTF(env, "x86_64");
#else
return (*env)->NewStringUTF(env, "unknown");
#endif
}
/**
* Returns ABI name of the running cpu.
*
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @return ABI name of the running cpu as UTF string
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_getNativeCpuAbi(JNIEnv *env, jclass object) {
AndroidCpuFamily family = android_getCpuFamily();
if (family == ANDROID_CPU_FAMILY_ARM) {
@@ -89,3 +116,29 @@ JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_getAbi(JNIEn
return (*env)->NewStringUTF(env, ABI_UNKNOWN);
}
}
/**
* Returns whether MobileFFmpeg release is a long term release or not.
*
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @return yes or no
*/
JNIEXPORT jboolean JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_isNativeLTSBuild(JNIEnv *env, jclass object) {
#if defined(MOBILE_FFMPEG_LTS)
return JNI_TRUE;
#else
return JNI_FALSE;
#endif
}
/**
* Returns build configuration for FFmpeg.
*
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @return build configuration string
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_getNativeBuildConf(JNIEnv *env, jclass object) {
return (*env)->NewStringUTF(env, FFMPEG_CONFIGURATION);
}
@@ -46,9 +46,30 @@
/*
* Class: com_arthenica_mobileffmpeg_AbiDetect
* Method: getAbi
* Method: getNativeAbi
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_getAbi(JNIEnv *, jclass);
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_getNativeAbi(JNIEnv *, jclass);
/*
* Class: com_arthenica_mobileffmpeg_AbiDetect
* Method: getNativeCpuAbi
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_getNativeCpuAbi(JNIEnv *, jclass);
/**
* Class: com_arthenica_mobileffmpeg_AbiDetect
* Method: isNativeLTSBuild
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_isNativeLTSBuild(JNIEnv *, jclass);
/*
* Class: com_arthenica_mobileffmpeg_AbiDetect
* Method: getNativeBuildConf
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_arthenica_mobileffmpeg_AbiDetect_getNativeBuildConf(JNIEnv *, jclass);
#endif /* MOBILE_FFMPEG_ABIDETECT_H */
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2018 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <setjmp.h>
/** Holds information to implement exception handling. */
__thread jmp_buf ex_buf__;
@@ -24,6 +24,6 @@
#include <setjmp.h>
/** Holds information to implement exception handling. */
jmp_buf ex_buf__;
extern __thread jmp_buf ex_buf__;
#endif // MOBILE_FFMPEG_EXCEPTION_H
+96
View File
@@ -0,0 +1,96 @@
/*
* Copyright (c) 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "config.h"
#include "libavcodec/jni.h"
#include "libavutil/bprint.h"
#include "mobileffmpeg.h"
/** Forward declaration for function defined in fftools_ffprobe.c */
int ffprobe_execute(int argc, char **argv);
/** Forward declaration for function defined in mobileffmpeg.c */
void clearLastCommandOutput();
extern int configuredLogLevel;
/**
* Synchronously executes FFprobe natively with arguments provided.
*
* @param env pointer to native method interface
* @param object reference to the class on which this method is invoked
* @param stringArray reference to the object holding FFprobe command arguments
* @return zero on successful execution, non-zero on error
*/
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeFFprobeExecute(JNIEnv *env, jclass object, jobjectArray stringArray) {
jstring *tempArray = NULL;
int argumentCount = 1;
char **argv = NULL;
// SETS DEFAULT LOG LEVEL BEFORE STARTING A NEW EXECUTION
av_log_set_level(configuredLogLevel);
if (stringArray != NULL) {
int programArgumentCount = (*env)->GetArrayLength(env, stringArray);
argumentCount = programArgumentCount + 1;
tempArray = (jstring *) av_malloc(sizeof(jstring) * programArgumentCount);
}
/* PRESERVE USAGE FORMAT
*
* ffprobe <arguments>
*/
argv = (char **)av_malloc(sizeof(char*) * (argumentCount));
argv[0] = (char *)av_malloc(sizeof(char) * (strlen(LIB_NAME) + 1));
strcpy(argv[0], LIB_NAME);
// PREPARE
if (stringArray != NULL) {
for (int i = 0; i < (argumentCount - 1); i++) {
tempArray[i] = (jstring) (*env)->GetObjectArrayElement(env, stringArray, i);
if (tempArray[i] != NULL) {
argv[i + 1] = (char *) (*env)->GetStringUTFChars(env, tempArray[i], 0);
}
}
}
// LAST COMMAND OUTPUT SHOULD BE CLEARED BEFORE STARTING A NEW EXECUTION
clearLastCommandOutput();
// RUN
int retCode = ffprobe_execute(argumentCount, argv);
// CLEANUP
if (tempArray != NULL) {
for (int i = 0; i < (argumentCount - 1); i++) {
(*env)->ReleaseStringUTFChars(env, tempArray[i], argv[i + 1]);
}
av_free(tempArray);
}
av_free(argv[0]);
av_free(argv);
return retCode;
}
+32
View File
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MOBILE_FFPROBE_H
#define MOBILE_FFPROBE_H
#include <jni.h>
/*
* Class: com_arthenica_mobileffmpeg_Config
* Method: nativeFFprobeExecute
* Signature: ([Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Config_nativeFFprobeExecute(JNIEnv *, jclass, jobjectArray);
#endif /* MOBILE_FFPROBE_H */
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Taner Sener
* Copyright (c) 2018-2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
@@ -20,8 +20,7 @@
package com.arthenica.mobileffmpeg;
/**
* <p>This class is used to detect running ABI name using Android's <code>cpufeatures</code>
* library.
* <p>This class is used to detect running ABI name using Google <code>cpu-features</code> library.
*
* @author Taner Sener
* @since v1.0
@@ -29,24 +28,70 @@ package com.arthenica.mobileffmpeg;
public class AbiDetect {
static {
System.loadLibrary("mobileffmpeg-abidetect");
armV7aNeonLoaded = false;
System.loadLibrary("mobileffmpeg_abidetect");
/* ALL LIBRARIES LOADED AT STARTUP */
Config.class.getName();
FFmpeg.class.getName();
}
static final String ARM_V7A = "arm-v7a";
static final String ARM_V7A_NEON = "arm-v7a-neon";
private static boolean armV7aNeonLoaded;
/**
* Default constructor hidden.
*/
private AbiDetect() {
}
static void setArmV7aNeonLoaded(final boolean armV7aNeonLoaded) {
AbiDetect.armV7aNeonLoaded = armV7aNeonLoaded;
}
/**
* <p>Returns running ABI name.
* <p>Returns loaded ABI name.
*
* @return running ABI name
* @return loaded ABI name
*/
public native static String getAbi();
public static String getAbi() {
if (armV7aNeonLoaded) {
return ARM_V7A_NEON;
} else {
return getNativeAbi();
}
}
/**
* <p>Returns loaded ABI name.
*
* @return loaded ABI name
*/
public native static String getNativeAbi();
/**
* <p>Returns ABI name of the running cpu.
*
* @return ABI name of the running cpu
*/
public native static String getNativeCpuAbi();
/**
* <p>Returns whether MobileFFmpeg release is a long term release or not.
*
* @return yes or no
*/
native static boolean isNativeLTSBuild();
/**
* <p>Returns build configuration for <code>FFmpeg</code>.
*
* @return build configuration string
*/
native static String getNativeBuildConf();
}
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2018-2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import android.os.AsyncTask;
/**
* <p>Utility class to execute an FFmpeg command asynchronously.
*
* @author Taner Sener
*/
public class AsyncFFmpegExecuteTask extends AsyncTask<Void, Integer, Integer> {
private final String[] arguments;
private final ExecuteCallback executeCallback;
private final Long executionId;
public AsyncFFmpegExecuteTask(final String command, final ExecuteCallback executeCallback) {
this(FFmpeg.parseArguments(command), executeCallback);
}
public AsyncFFmpegExecuteTask(final String[] arguments, final ExecuteCallback executeCallback) {
this(FFmpeg.DEFAULT_EXECUTION_ID, arguments, executeCallback);
}
public AsyncFFmpegExecuteTask(final long executionId, final String command, final ExecuteCallback executeCallback) {
this(executionId, FFmpeg.parseArguments(command), executeCallback);
}
public AsyncFFmpegExecuteTask(final long executionId, final String[] arguments, final ExecuteCallback executeCallback) {
this.executionId = executionId;
this.arguments = arguments;
this.executeCallback = executeCallback;
}
@Override
protected Integer doInBackground(final Void... unused) {
return Config.ffmpegExecute(executionId, this.arguments);
}
@Override
protected void onPostExecute(final Integer rc) {
if (executeCallback != null) {
executeCallback.apply(executionId, rc);
}
}
}
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2018-2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import android.os.AsyncTask;
/**
* <p>Utility class to execute an FFprobe command asynchronously.
*
* @author Taner Sener
*/
public class AsyncFFprobeExecuteTask extends AsyncTask<Void, Integer, Integer> {
private final String[] arguments;
private final ExecuteCallback ExecuteCallback;
public AsyncFFprobeExecuteTask(final String command, final ExecuteCallback executeCallback) {
this.arguments = FFmpeg.parseArguments(command);
this.ExecuteCallback = executeCallback;
}
public AsyncFFprobeExecuteTask(final String[] arguments, final ExecuteCallback executeCallback) {
this.arguments = arguments;
ExecuteCallback = executeCallback;
}
@Override
protected Integer doInBackground(final Void... unused) {
return FFprobe.execute(this.arguments);
}
@Override
protected void onPostExecute(final Integer rc) {
if (ExecuteCallback != null) {
ExecuteCallback.apply(FFmpeg.DEFAULT_EXECUTION_ID, rc);
}
}
}
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2018-2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import android.os.AsyncTask;
import com.arthenica.mobileffmpeg.FFprobe;
import com.arthenica.mobileffmpeg.GetMediaInformationCallback;
import com.arthenica.mobileffmpeg.MediaInformation;
/**
* <p>Utility class to get media information asynchronously.
*
* @author Taner Sener
*/
public class AsyncGetMediaInformationTask extends AsyncTask<String, MediaInformation, MediaInformation> {
private final String path;
private final GetMediaInformationCallback getMediaInformationCallback;
public AsyncGetMediaInformationTask(final String path, final GetMediaInformationCallback getMediaInformationCallback) {
this.path = path;
this.getMediaInformationCallback = getMediaInformationCallback;
}
@Override
protected MediaInformation doInBackground(final String... arguments) {
return FFprobe.getMediaInformation(path);
}
@Override
protected void onPostExecute(final MediaInformation mediaInformation) {
if (getMediaInformationCallback != null) {
getMediaInformationCallback.apply(mediaInformation);
}
}
}
@@ -0,0 +1,77 @@
/*
* Copyright (c) 2019 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import android.content.Context;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CameraMetadata;
import android.os.Build;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import static android.content.Context.CAMERA_SERVICE;
import static com.arthenica.mobileffmpeg.Config.TAG;
/**
* Utility class for camera devices.
*
* @author Taner Sener
*/
class CameraSupport {
/**
* <p>Compatibility method for extracting supported camera ids.
*
* @param context application context
* @return returns the list of supported camera ids
*/
static List<String> extractSupportedCameraIds(final Context context) {
final List<String> detectedCameraIdList = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
try {
final CameraManager manager = (CameraManager) context.getSystemService(CAMERA_SERVICE);
if (manager != null) {
final String[] cameraIdList = manager.getCameraIdList();
for (String cameraId : cameraIdList) {
final CameraCharacteristics chars = manager.getCameraCharacteristics(cameraId);
final Integer cameraSupport = chars.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
if (cameraSupport != null && cameraSupport == CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
Log.d(TAG, "Detected camera with id " + cameraId + " has LEGACY hardware level which is not supported by Android Camera2 NDK API.");
} else if (cameraSupport != null) {
detectedCameraIdList.add(cameraId);
}
}
}
} catch (final CameraAccessException e) {
Log.w(TAG, "Detecting camera ids failed.", e);
}
}
return detectedCameraIdList;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Taner Sener
* Copyright (c) 2018-2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
@@ -20,49 +20,55 @@
package com.arthenica.mobileffmpeg;
import android.content.Context;
import android.system.ErrnoException;
import android.system.Os;
import android.os.Build;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import static com.arthenica.mobileffmpeg.FFmpeg.getVersion;
/**
* <p>This class is used to configure MobileFFmpeg library utilities/tools.
*
* <p>1. {@link LogCallback}: By default this class redirects FFmpeg output to Logcat. As another
* option, it is possible not to print messages to Logcat and pass them to a {@link LogCallback}
* function. This function can decide whether to print these logs, show them inside another
* container or ignore them.
* <p>1. {@link LogCallback}: This class redirects FFmpeg/FFprobe output to Logcat by default. As
* an alternative, it is possible not to print messages to Logcat and pass them to a
* {@link LogCallback} function. This function can decide whether to print these logs, show them
* inside another container or ignore them.
*
* <p>2. {@link #setLogLevel(Level)}/{@link #getLogLevel()}: Use this methods to see/control FFmpeg
* log severity.
* <p>2. {@link #setLogLevel(Level)}/{@link #getLogLevel()}: Use this methods to set/get
* FFmpeg/FFprobe log severity.
*
* <p>3. {@link StatisticsCallback}: It is possible to receive statistics about ongoing operation by
* defining a {@link StatisticsCallback} function or by calling {@link #getLastReceivedStatistics()}
* method.
* <p>3. {@link StatisticsCallback}: It is possible to receive statistics about an ongoing
* operation by defining a {@link StatisticsCallback} function or by calling
* {@link #getLastReceivedStatistics()} method.
*
* <p>4. Font configuration: It is possible to register custom fonts with
* {@link #setFontconfigConfigurationPath(String)} and
* {@link #setFontDirectory(Context, String, Map)} methods.
*
* <p>PS: This class is introduced in v2.1 as an enhanced version of older <code>Log</code> class.
*
* @author Taner Sener
* @since v2.1
*/
public class Config {
public static final int RETURN_CODE_SUCCESS = 0;
public static final int RETURN_CODE_CANCEL = 255;
private static int lastReturnCode = 0;
/**
* Defines tag used for logging.
*/
public static final String TAG = "mobile-ffmpeg";
public static final String MOBILE_FFMPEG_PIPE_PREFIX = "mf_pipe_";
private static LogCallback logCallbackFunction;
private static Level activeLogLevel;
@@ -71,41 +77,88 @@ public class Config {
private static Statistics lastReceivedStatistics;
private static int lastCreatedPipeIndex;
private static final List<FFmpegExecution> executions;
static {
Log.i(Config.TAG, "Loading mobile-ffmpeg.");
/* ALL LIBRARIES LOADED AT STARTUP */
String abiName = AbiDetect.getAbi();
Abi abi = Abi.from(abiName);
FFmpeg.class.getName();
boolean nativeFFmpegLoaded = false;
boolean nativeFFmpegTriedAndFailed = false;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
/*
* NEON supported arm-v7a library has a different name
*/
boolean nativeLibraryLoaded = false;
if (abi == Abi.ABI_ARMV7A_NEON) {
try {
System.loadLibrary("mobileffmpeg-armv7a-neon");
nativeLibraryLoaded = true;
} catch (final UnsatisfiedLinkError e) {
Log.i(Config.TAG, "NEON supported armeabi-v7a library not found. Loading default armeabi-v7a library.", e);
abi = Abi.ABI_ARMV7A;
/* LOADING LIBRARIES MANUALLY ON API < 21 */
final List<String> externalLibrariesEnabled = getExternalLibraries();
if (externalLibrariesEnabled.contains("tesseract") || externalLibrariesEnabled.contains("x265") || externalLibrariesEnabled.contains("snappy") || externalLibrariesEnabled.contains("openh264") || externalLibrariesEnabled.contains("rubberband")) {
System.loadLibrary("c++_shared");
}
if (AbiDetect.ARM_V7A.equals(AbiDetect.getNativeAbi())) {
try {
System.loadLibrary("avutil_neon");
System.loadLibrary("swscale_neon");
System.loadLibrary("swresample_neon");
System.loadLibrary("avcodec_neon");
System.loadLibrary("avformat_neon");
System.loadLibrary("avfilter_neon");
System.loadLibrary("avdevice_neon");
nativeFFmpegLoaded = true;
} catch (final UnsatisfiedLinkError e) {
Log.i(Config.TAG, "NEON supported armeabi-v7a ffmpeg library not found. Loading default armeabi-v7a library.", e);
nativeFFmpegTriedAndFailed = true;
}
}
if (!nativeFFmpegLoaded) {
System.loadLibrary("avutil");
System.loadLibrary("swscale");
System.loadLibrary("swresample");
System.loadLibrary("avcodec");
System.loadLibrary("avformat");
System.loadLibrary("avfilter");
System.loadLibrary("avdevice");
}
}
if (!nativeLibraryLoaded) {
/* ALL MOBILE-FFMPEG LIBRARIES LOADED AT STARTUP */
Abi.class.getName();
FFmpeg.class.getName();
FFprobe.class.getName();
boolean nativeMobileFFmpegLoaded = false;
if (!nativeFFmpegTriedAndFailed && AbiDetect.ARM_V7A.equals(AbiDetect.getNativeAbi())) {
try {
/*
* THE TRY TO LOAD ARM-V7A-NEON FIRST. IF NOT LOAD DEFAULT ARM-V7A
*/
System.loadLibrary("mobileffmpeg_armv7a_neon");
nativeMobileFFmpegLoaded = true;
AbiDetect.setArmV7aNeonLoaded(true);
} catch (final UnsatisfiedLinkError e) {
Log.i(Config.TAG, "NEON supported armeabi-v7a mobileffmpeg library not found. Loading default armeabi-v7a library.", e);
}
}
if (!nativeMobileFFmpegLoaded) {
System.loadLibrary("mobileffmpeg");
}
Log.i(Config.TAG, String.format("Loaded mobile-ffmpeg-%s-%s.", abi.getName(), getVersion()));
Log.i(Config.TAG, String.format("Loaded mobile-ffmpeg-%s-%s-%s-%s.", getPackageName(), AbiDetect.getAbi(), getVersion(), getBuildDate()));
/* NATIVE LOG LEVEL IS RECEIVED ONLY ON STARTUP */
activeLogLevel = Level.from(getNativeLogLevel());
lastReceivedStatistics = new Statistics();
Config.enableRedirection();
enableRedirection();
lastCreatedPipeIndex = 0;
executions = Collections.synchronizedList(new ArrayList<FFmpegExecution>());
}
/**
@@ -116,14 +169,15 @@ public class Config {
/**
* <p>Enables log and statistics redirection.
* <p>When redirection is not enabled FFmpeg logs are printed to stderr. By enabling redirection, they are routed
* to Logcat and can be routed further to a callback function.
* <p>Statistics redirection behaviour is similar. Statistics are not printed at all if redirection is not enabled.
* If it is enabled then it is possible to define a statistics callback function but if you don't, they are not
* printed anywhere and only saved as <code>lastReceivedStatistics</code> data which can be polled with
* <p>When redirection is not enabled FFmpeg/FFprobe logs are printed to stderr. By enabling
* redirection, they are routed to Logcat and can be routed further to a callback function.
* <p>Statistics redirection behaviour is similar. Statistics are not printed at all if
* redirection is not enabled. If it is enabled then it is possible to define a statistics
* callback function but if you don't, they are not printed anywhere and only saved as
* <code>lastReceivedStatistics</code> data which can be polled with
* {@link #getLastReceivedStatistics()}.
* <p>Note that redirection is enabled by default. If you do not want to use its functionality please use
* {@link #disableRedirection()} to disable it.
* <p>Note that redirection is enabled by default. If you do not want to use its functionality
* please use {@link #disableRedirection()} to disable it.
*/
public static void enableRedirection() {
enableNativeRedirection();
@@ -158,7 +212,7 @@ public class Config {
}
/**
* <p>Sets a callback function to redirect FFmpeg logs.
* <p>Sets a callback function to redirect FFmpeg/FFprobe logs.
*
* @param newLogCallback new log callback function or NULL to disable a previously defined callback
*/
@@ -178,20 +232,26 @@ public class Config {
/**
* <p>Log redirection method called by JNI/native part.
*
* @param levelValue log level as defined in {@link Level}
* @param logMessage redirected log message
* @param executionId id of the execution that generated this log, 0 by default
* @param levelValue log level as defined in {@link Level}
* @param logMessage redirected log message
*/
private static void log(final int levelValue, final byte[] logMessage) {
private static void log(final long executionId, final int levelValue, final byte[] logMessage) {
final Level level = Level.from(levelValue);
final String text = new String(logMessage);
if (activeLogLevel == Level.AV_LOG_QUIET || levelValue > activeLogLevel.getValue()) {
// AV_LOG_STDERR logs are always redirected
if ((activeLogLevel == Level.AV_LOG_QUIET && levelValue != Level.AV_LOG_STDERR.getValue()) || levelValue > activeLogLevel.getValue()) {
// LOG NEITHER PRINTED NOR FORWARDED
return;
}
if (logCallbackFunction != null) {
logCallbackFunction.apply(new LogMessage(level, text));
try {
logCallbackFunction.apply(new LogMessage(executionId, level, text));
} catch (final Exception e) {
Log.e(Config.TAG, "Exception thrown inside LogCallback block", e);
}
} else {
switch (level) {
case AV_LOG_QUIET: {
@@ -203,6 +263,7 @@ public class Config {
android.util.Log.d(TAG, text);
}
break;
case AV_LOG_STDERR:
case AV_LOG_VERBOSE: {
android.util.Log.v(TAG, text);
}
@@ -232,22 +293,27 @@ public class Config {
/**
* <p>Statistics redirection method called by JNI/native part.
*
* @param executionId id of the execution that generated this statistics, 0 by default
* @param videoFrameNumber last processed frame number for videos
* @param videoFps frames processed per second for videos
* @param videoQuality quality of the video stream
* @param size size in bytes
* @param time processed duration in milliseconds
* @param bitrate output bit rate in kbits/s
* @param speed processing speed = processed duration / operation duration
* @param videoFps frames processed per second for videos
* @param videoQuality quality of the video stream
* @param size size in bytes
* @param time processed duration in milliseconds
* @param bitrate output bit rate in kbits/s
* @param speed processing speed = processed duration / operation duration
*/
private static void statistics(final int videoFrameNumber, final float videoFps,
final float videoQuality, final long size, final int time,
final double bitrate, final double speed) {
final Statistics newStatistics = new Statistics(videoFrameNumber, videoFps, videoQuality, size, time, bitrate, speed);
private static void statistics(final long executionId, final int videoFrameNumber,
final float videoFps, final float videoQuality, final long size,
final int time, final double bitrate, final double speed) {
final Statistics newStatistics = new Statistics(executionId, videoFrameNumber, videoFps, videoQuality, size, time, bitrate, speed);
lastReceivedStatistics.update(newStatistics);
if (statisticsCallbackFunction != null) {
statisticsCallbackFunction.apply(lastReceivedStatistics);
try {
statisticsCallbackFunction.apply(lastReceivedStatistics);
} catch (final Exception e) {
Log.e(Config.TAG, "Exception thrown inside StatisticsCallback block", e);
}
}
}
@@ -271,14 +337,14 @@ public class Config {
* <p>Sets and overrides <code>fontconfig</code> configuration directory.
*
* @param path directory which contains fontconfig configuration (fonts.conf)
* @throws ErrnoException if an error occurs
* @return zero on success, non-zero on error
*/
public static void setFontconfigConfigurationPath(final String path) throws ErrnoException {
Os.setenv("FONTCONFIG_PATH", path, true);
public static int setFontconfigConfigurationPath(final String path) {
return setNativeEnvironmentVariable("FONTCONFIG_PATH", path);
}
/**
* <p>Registers fonts inside the given path, so they are available in FFmpeg filters.
* <p>Registers fonts inside the given path, so they are available to use in FFmpeg filters.
*
* <p>Note that you need to build <code>MobileFFmpeg</code> with <code>fontconfig</code>
* enabled or use a prebuilt package with <code>fontconfig</code> inside to use this feature.
@@ -348,7 +414,7 @@ public class Config {
Log.d(TAG, String.format("Font directory %s registered successfully.", fontDirectoryPath));
} catch (final ErrnoException | IOException e) {
} catch (final IOException e) {
Log.e(TAG, String.format("Failed to set font directory: %s.", fontDirectoryPath), e);
} finally {
if (reference.get() != null) {
@@ -361,6 +427,245 @@ public class Config {
}
}
/**
* <p>Returns package name.
*
* @return guessed package name according to supported external libraries
* @since 3.0
*/
public static String getPackageName() {
return Packages.getPackageName();
}
/**
* <p>Returns supported external libraries.
*
* @return list of supported external libraries
* @since 3.0
*/
public static List<String> getExternalLibraries() {
return Packages.getExternalLibraries();
}
/**
* <p>Creates a new named pipe to use in <code>FFmpeg</code> operations.
*
* <p>Please note that creator is responsible of closing created pipes.
*
* @param context application context
* @return the full path of named pipe
*/
public static String registerNewFFmpegPipe(final Context context) {
// PIPES ARE CREATED UNDER THE CACHE DIRECTORY
final File cacheDir = context.getCacheDir();
final String newFFmpegPipePath = cacheDir + File.separator + MOBILE_FFMPEG_PIPE_PREFIX + (++lastCreatedPipeIndex);
// FIRST CLOSE OLD PIPES WITH THE SAME NAME
closeFFmpegPipe(newFFmpegPipePath);
int rc = registerNewNativeFFmpegPipe(newFFmpegPipePath);
if (rc == 0) {
return newFFmpegPipePath;
} else {
Log.e(TAG, String.format("Failed to register new FFmpeg pipe %s. Operation failed with rc=%d.", newFFmpegPipePath, rc));
return null;
}
}
/**
* <p>Closes a previously created <code>FFmpeg</code> pipe.
*
* @param ffmpegPipePath full path of ffmpeg pipe
*/
public static void closeFFmpegPipe(final String ffmpegPipePath) {
File file = new File(ffmpegPipePath);
if (file.exists()) {
file.delete();
}
}
/**
* Returns the list of camera ids supported.
*
* @param context application context
* @return the list of camera ids supported or an empty list if no supported camera is found
*/
public static List<String> getSupportedCameraIds(final Context context) {
final List<String> detectedCameraIdList = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
detectedCameraIdList.addAll(CameraSupport.extractSupportedCameraIds(context));
}
return detectedCameraIdList;
}
/**
* <p>Returns FFmpeg version bundled within the library.
*
* @return FFmpeg version
*/
public static String getFFmpegVersion() {
return getNativeFFmpegVersion();
}
/**
* <p>Returns MobileFFmpeg library version.
*
* @return MobileFFmpeg version
*/
public static String getVersion() {
if (isLTSBuild()) {
return String.format("%s-lts", getNativeVersion());
} else {
return getNativeVersion();
}
}
/**
* <p>Returns whether MobileFFmpeg release is a long term release or not.
*
* @return YES or NO
*/
public static boolean isLTSBuild() {
return AbiDetect.isNativeLTSBuild();
}
/**
* <p>Returns MobileFFmpeg library build date.
*
* @return MobileFFmpeg library build date
*/
public static String getBuildDate() {
return getNativeBuildDate();
}
/**
* <p>Returns return code of last executed command.
*
* @return return code of last executed command
* @since 3.0
*/
public static int getLastReturnCode() {
return lastReturnCode;
}
/**
* <p>Returns log output of last executed single FFmpeg/FFprobe command.
*
* <p>This method does not support executing multiple concurrent commands. If you execute
* multiple commands at the same time, this method will return output from all executions.
*
* <p>Please note that disabling redirection using {@link Config#disableRedirection()} method
* also disables this functionality.
*
* @return output of the last executed command
* @since 3.0
*/
public static String getLastCommandOutput() {
String nativeLastCommandOutput = getNativeLastCommandOutput();
if (nativeLastCommandOutput != null) {
// REPLACING CH(13) WITH CH(10)
nativeLastCommandOutput = nativeLastCommandOutput.replace('\r', '\n');
}
return nativeLastCommandOutput;
}
/**
* <p>Prints the output of the last executed FFmpeg/FFprobe command to the Logcat at the
* specified priority.
*
* <p>This method does not support executing multiple concurrent commands. If you execute
* multiple commands at the same time, this method will print output from all executions.
*
* @param logPriority one of {@link Log#VERBOSE}, {@link Log#DEBUG}, {@link Log#INFO},
* {@link Log#WARN}, {@link Log#ERROR}, {@link Log#ASSERT}
* @since 4.3
*/
public static void printLastCommandOutput(int logPriority) {
final int LOGGER_ENTRY_MAX_LEN = 4 * 1000;
String buffer = getLastCommandOutput();
do {
if (buffer.length() <= LOGGER_ENTRY_MAX_LEN) {
Log.println(logPriority, Config.TAG, buffer);
buffer = "";
} else {
final int index = buffer.substring(0, LOGGER_ENTRY_MAX_LEN).lastIndexOf('\n');
if (index < 0) {
Log.println(logPriority, Config.TAG, buffer.substring(0, LOGGER_ENTRY_MAX_LEN));
buffer = buffer.substring(LOGGER_ENTRY_MAX_LEN);
} else {
Log.println(logPriority, Config.TAG, buffer.substring(0, index));
buffer = buffer.substring(index);
}
}
} while (buffer.length() > 0);
}
/**
* <p>Sets an environment variable.
*
* @param variableName environment variable name
* @param variableValue environment variable value
* @return zero on success, non-zero on error
*/
public static int setEnvironmentVariable(final String variableName, final String variableValue) {
return setNativeEnvironmentVariable(variableName, variableValue);
}
/**
* <p>Registers a new ignored signal. Ignored signals are not handled by the library.
*
* @param signal signal number to ignore
*/
public static void ignoreSignal(final Signal signal) {
ignoreNativeSignal(signal.getValue());
}
/**
* <p>Synchronously executes FFmpeg with arguments provided.
*
* @param executionId id of the execution
* @param arguments FFmpeg command options/arguments as string array
* @return zero on successful execution, 255 on user cancel and non-zero on error
*/
static int ffmpegExecute(final long executionId, final String[] arguments) {
final FFmpegExecution currentFFmpegExecution = new FFmpegExecution(executionId, arguments);
executions.add(currentFFmpegExecution);
try {
final int lastReturnCode = nativeFFmpegExecute(executionId, arguments);
Config.setLastReturnCode(lastReturnCode);
return lastReturnCode;
} finally {
executions.remove(currentFFmpegExecution);
}
}
/**
* Updates return code value for the last executed command.
*
* @param newLastReturnCode new last return code value
*/
static void setLastReturnCode(int newLastReturnCode) {
lastReturnCode = newLastReturnCode;
}
/**
* <p>Lists ongoing FFmpeg executions.
*
* @return list of ongoing FFmpeg executions
*/
static List<FFmpegExecution> listFFmpegExecutions() {
return new ArrayList<>(executions);
}
/**
* <p>Enables native redirection. Necessary for log and statistics callback functions.
*/
@@ -390,28 +695,78 @@ public class Config {
*
* @return FFmpeg version
*/
native static String getNativeFFmpegVersion();
private native static String getNativeFFmpegVersion();
/**
* <p>Returns MobileFFmpeg library version natively.
*
* @return MobileFFmpeg version
*/
native static String getNativeVersion();
private native static String getNativeVersion();
/**
* <p>Synchronously executes FFmpeg natively with arguments provided.
*
* @param arguments FFmpeg command options/arguments as string array
* @param executionId id of the execution
* @param arguments FFmpeg command options/arguments as string array
* @return zero on successful execution, 255 on user cancel and non-zero on error
*/
native static int nativeExecute(final String[] arguments);
private native static int nativeFFmpegExecute(final long executionId, final String[] arguments);
/**
* <p>Cancels an ongoing operation natively.
* <p>Cancels an ongoing FFmpeg operation natively. This function does not wait for termination
* to complete and returns immediately.
*
* <p>This function does not wait for termination to complete and returns immediately.
* @param executionId id of the execution
*/
native static void nativeCancel();
native static void nativeFFmpegCancel(final long executionId);
/**
* <p>Synchronously executes FFprobe natively with arguments provided.
*
* @param arguments FFprobe command options/arguments as string array
* @return zero on successful execution, 255 on user cancel and non-zero on error
*/
native static int nativeFFprobeExecute(final String[] arguments);
/**
* <p>Creates natively a new named pipe to use in <code>FFmpeg</code> operations.
*
* <p>Please note that creator is responsible of closing created pipes.
*
* @param ffmpegPipePath full path of ffmpeg pipe
* @return zero on successful creation, non-zero on error
*/
private native static int registerNewNativeFFmpegPipe(final String ffmpegPipePath);
/**
* <p>Returns MobileFFmpeg library build date natively.
*
* @return MobileFFmpeg library build date
*/
private native static String getNativeBuildDate();
/**
* <p>Sets an environment variable natively.
*
* @param variableName environment variable name
* @param variableValue environment variable value
* @return zero on success, non-zero on error
*/
private native static int setNativeEnvironmentVariable(final String variableName, final String variableValue);
/**
* <p>Returns log output of the last executed single command natively.
*
* @return output of the last executed single command
*/
private native static String getNativeLastCommandOutput();
/**
* <p>Registers a new ignored signal natively. Ignored signals are not handled by the library.
*
* @param signum signal number
*/
private native static void ignoreNativeSignal(final int signum);
}
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2018-2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
/**
* <p>Represents a callback function to receive an asynchronous execution result.
*
* @author Taner Sener
* @since v2.1
*/
@FunctionalInterface
public interface ExecuteCallback {
/**
* <p>Called when an asynchronous FFmpeg execution is completed.
*
* @param executionId id of the execution that completed
* @param returnCode return code of the execution completed, 0 on successful completion, 255
* on user cancel, other non-zero codes on error
*/
void apply(long executionId, int returnCode);
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Taner Sener
* Copyright (c) 2018-2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
@@ -19,24 +19,33 @@
package com.arthenica.mobileffmpeg;
import android.util.Log;
import android.os.AsyncTask;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicLong;
/**
* <p>Main class for FFmpeg operations. Provides {@link #execute(String...)} method to execute
* FFmpeg commands.
* <p>Main class for FFmpeg operations. Supports synchronous {@link #execute(String...)} and
* asynchronous {@link #executeAsync(String, ExecuteCallback)} methods to execute FFmpeg commands.
* <pre>
* int rc = FFmpeg.execute("-i", "file1.mp4", "-c:v", "libxvid", "file1.avi");
* int rc = FFmpeg.execute("-i file1.mp4 -c:v libxvid file1.avi");
* Log.i(Config.TAG, String.format("Command execution %s.", (rc == 0?"completed successfully":"failed with rc=" + rc));
* </pre>
* <pre>
* long executionId = FFmpeg.executeAsync("-i file1.mp4 -c:v libxvid file1.avi", executeCallback);
* Log.i(Config.TAG, String.format("Asynchronous execution %d started.", executionId));
* </pre>
*
* @author Taner Sener
* @since v1.0
*/
public class FFmpeg {
public static final int RETURN_CODE_SUCCESS = 0;
static final long DEFAULT_EXECUTION_ID = 0;
public static final int RETURN_CODE_CANCEL = 255;
private static final AtomicLong executionIdCounter = new AtomicLong(3000);
static {
AbiDetect.class.getName();
@@ -49,42 +58,112 @@ public class FFmpeg {
private FFmpeg() {
}
/**
* <p>Returns FFmpeg version bundled within the library.
*
* @return FFmpeg version
*/
public static String getFFmpegVersion() {
return Config.getNativeFFmpegVersion();
}
/**
* <p>Returns MobileFFmpeg library version.
*
* @return MobileFFmpeg version
*/
public static String getVersion() {
return Config.getNativeVersion();
}
/**
* <p>Synchronously executes FFmpeg with arguments provided.
*
* @param arguments FFmpeg command options/arguments as string array
* @return zero on successful execution, 255 on user cancel and non-zero on error
* @return 0 on successful execution, 255 on user cancel, other non-zero codes on error
*/
public static int execute(final String[] arguments) {
return Config.nativeExecute(arguments);
return Config.ffmpegExecute(DEFAULT_EXECUTION_ID, arguments);
}
/**
* <p>Synchronously executes FFmpeg with arguments provided.
* <p>Asynchronously executes FFmpeg with arguments provided.
*
* @param arguments FFmpeg command options/arguments in one string
* @return zero on successful execution, 255 on user cancel and non-zero on error
* @param arguments FFmpeg command options/arguments as string array
* @param executeCallback callback that will be notified when execution is completed
* @return returns a unique id that represents this execution
*/
public static int execute(final String arguments) {
return execute((arguments == null) ? new String[]{""} : arguments.split(" "));
public static long executeAsync(final String[] arguments, final ExecuteCallback executeCallback) {
final long newExecutionId = executionIdCounter.incrementAndGet();
AsyncFFmpegExecuteTask asyncFFmpegExecuteTask = new AsyncFFmpegExecuteTask(newExecutionId, arguments, executeCallback);
asyncFFmpegExecuteTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return newExecutionId;
}
/**
* <p>Asynchronously executes FFmpeg with arguments provided.
*
* @param arguments FFmpeg command options/arguments as string array
* @param executeCallback callback that will be notified when execution is completed
* @param executor executor that will be used to run this asynchronous operation
* @return returns a unique id that represents this execution
*/
public static long executeAsync(final String[] arguments, final ExecuteCallback executeCallback, final Executor executor) {
final long newExecutionId = executionIdCounter.incrementAndGet();
AsyncFFmpegExecuteTask asyncFFmpegExecuteTask = new AsyncFFmpegExecuteTask(newExecutionId, arguments, executeCallback);
asyncFFmpegExecuteTask.executeOnExecutor(executor);
return newExecutionId;
}
/**
* <p>Synchronously executes FFmpeg command provided. Command is split into arguments using
* provided delimiter character.
*
* @param command FFmpeg command
* @param delimiter delimiter used to split arguments
* @return 0 on successful execution, 255 on user cancel, other non-zero codes on error
* @since 3.0
* @deprecated argument splitting mechanism used in this method is pretty simple and prone to
* errors. Consider using a more advanced method like {@link #execute(String)} or
* {@link #execute(String[])}
*/
public static int execute(final String command, final String delimiter) {
return execute((command == null) ? new String[]{""} : command.split((delimiter == null) ? " " : delimiter));
}
/**
* <p>Synchronously executes FFmpeg command provided. Space character is used to split command
* into arguments. You can use single and double quote characters to specify arguments inside
* your command.
*
* @param command FFmpeg command
* @return 0 on successful execution, 255 on user cancel, other non-zero codes on error
*/
public static int execute(final String command) {
return execute(parseArguments(command));
}
/**
* <p>Asynchronously executes FFmpeg command provided. Space character is used to split command
* into arguments. You can use single and double quote characters to specify arguments inside
* your command.
*
* @param command FFmpeg command
* @param executeCallback callback that will be notified when execution is completed
* @return returns a unique id that represents this execution
*/
public static long executeAsync(final String command, final ExecuteCallback executeCallback) {
final long newExecutionId = executionIdCounter.incrementAndGet();
AsyncFFmpegExecuteTask asyncFFmpegExecuteTask = new AsyncFFmpegExecuteTask(newExecutionId, command, executeCallback);
asyncFFmpegExecuteTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return newExecutionId;
}
/**
* <p>Asynchronously executes FFmpeg command provided. Space character is used to split command
* into arguments. You can use single and double quote characters to specify arguments inside
* your command.
*
* @param command FFmpeg command
* @param executeCallback callback that will be notified when execution is completed
* @param executor executor that will be used to run this asynchronous operation
* @return returns a unique id that represents this execution
*/
public static long executeAsync(final String command, final ExecuteCallback executeCallback, final Executor executor) {
final long newExecutionId = executionIdCounter.incrementAndGet();
AsyncFFmpegExecuteTask asyncFFmpegExecuteTask = new AsyncFFmpegExecuteTask(newExecutionId, command, executeCallback);
asyncFFmpegExecuteTask.executeOnExecutor(executor);
return newExecutionId;
}
/**
@@ -93,7 +172,106 @@ public class FFmpeg {
* <p>This function does not wait for termination to complete and returns immediately.
*/
public static void cancel() {
Config.nativeCancel();
Config.nativeFFmpegCancel(DEFAULT_EXECUTION_ID);
}
/**
* <p>Cancels an ongoing operation.
*
* <p>This function does not wait for termination to complete and returns immediately.
*
* @param executionId id of the execution
*/
public static void cancel(final long executionId) {
Config.nativeFFmpegCancel(executionId);
}
/**
* <p>Lists ongoing executions.
*
* @return list of ongoing executions
*/
public static List<FFmpegExecution> listExecutions() {
return Config.listFFmpegExecutions();
}
/**
* <p>Parses the given command into arguments.
*
* @param command string command
* @return array of arguments
*/
static String[] parseArguments(final String command) {
final List<String> argumentList = new ArrayList<>();
StringBuilder currentArgument = new StringBuilder();
boolean singleQuoteStarted = false;
boolean doubleQuoteStarted = false;
for (int i = 0; i < command.length(); i++) {
final Character previousChar;
if (i > 0) {
previousChar = command.charAt(i - 1);
} else {
previousChar = null;
}
final char currentChar = command.charAt(i);
if (currentChar == ' ') {
if (singleQuoteStarted || doubleQuoteStarted) {
currentArgument.append(currentChar);
} else if (currentArgument.length() > 0) {
argumentList.add(currentArgument.toString());
currentArgument = new StringBuilder();
}
} else if (currentChar == '\'' && (previousChar == null || previousChar != '\\')) {
if (singleQuoteStarted) {
singleQuoteStarted = false;
} else if (doubleQuoteStarted) {
currentArgument.append(currentChar);
} else {
singleQuoteStarted = true;
}
} else if (currentChar == '\"' && (previousChar == null || previousChar != '\\')) {
if (doubleQuoteStarted) {
doubleQuoteStarted = false;
} else if (singleQuoteStarted) {
currentArgument.append(currentChar);
} else {
doubleQuoteStarted = true;
}
} else {
currentArgument.append(currentChar);
}
}
if (currentArgument.length() > 0) {
argumentList.add(currentArgument.toString());
}
return argumentList.toArray(new String[0]);
}
/**
* <p>Combines arguments into a string.
*
* @param arguments arguments
* @return string containing all arguments
*/
static String argumentsToString(final String[] arguments) {
if (arguments == null) {
return "null";
}
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < arguments.length; i++) {
if (i > 0) {
stringBuilder.append(" ");
}
stringBuilder.append(arguments[i]);
}
return stringBuilder.toString();
}
}
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import java.util.Date;
/**
* <p>Represents an ongoing FFmpeg execution.
*
* @author Taner Sener
* @since v4.4
*/
public class FFmpegExecution {
private final Date startTime;
private final long executionId;
private final String command;
public FFmpegExecution(final long executionId, final String[] arguments) {
this.startTime = new Date();
this.executionId = executionId;
this.command = FFmpeg.argumentsToString(arguments);
}
public Date getStartTime() {
return startTime;
}
public long getExecutionId() {
return executionId;
}
public String getCommand() {
return command;
}
}
@@ -0,0 +1,133 @@
/*
* Copyright (c) 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import android.util.Log;
/**
* <p>Main class for FFprobe operations. Provides {@link #execute(String...)} method to execute
* FFprobe commands.
* <pre>
* int rc = FFprobe.execute("-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4");
* Log.i(Config.TAG, String.format("Command execution %s.", (rc == 0?"completed successfully":"failed with rc=" + rc));
* </pre>
*
* @author Taner Sener
* @since v4.3.1
*/
public class FFprobe {
static {
AbiDetect.class.getName();
Config.class.getName();
}
/**
* Default constructor hidden.
*/
private FFprobe() {
}
/**
* <p>Synchronously executes FFprobe with arguments provided.
*
* @param arguments FFprobe command options/arguments as string array
* @return zero on successful execution, 255 on user cancel and non-zero on error
*/
public static int execute(final String[] arguments) {
final int lastReturnCode = Config.nativeFFprobeExecute(arguments);
Config.setLastReturnCode(lastReturnCode);
return lastReturnCode;
}
/**
* <p>Synchronously executes FFprobe command provided. Space character is used to split command
* into arguments. You can use single and double quote characters to specify arguments inside
* your command.
*
* @param command FFprobe command
* @return zero on successful execution, 255 on user cancel and non-zero on error
*/
public static int execute(final String command) {
return execute(FFmpeg.parseArguments(command));
}
/**
* <p>Returns media information for the given file.
*
* <p>This method does not support executing multiple concurrent operations. If you execute
* multiple operations (execute or getMediaInformation) at the same time, the response of this
* method is not predictable.
*
* @param path path or uri of media file
* @return media information
* @since 3.0
*/
public static MediaInformation getMediaInformation(final String path) {
return getMediaInformationFromCommandArguments(new String[]{"-v", "error", "-hide_banner", "-print_format", "json", "-show_format", "-show_streams", "-i", path});
}
/**
* <p>Returns media information for the given command.
*
* <p>This method does not support executing multiple concurrent operations. If you execute
* multiple operations (execute or getMediaInformation) at the same time, the response of this
* method is not predictable.
*
* @param command command to execute
* @return media information
* @since 4.3.3
*/
public static MediaInformation getMediaInformationFromCommand(final String command) {
return getMediaInformationFromCommandArguments(FFmpeg.parseArguments(command));
}
/**
* <p>Returns media information for given file.
*
* <p>This method does not support executing multiple concurrent operations. If you execute
* multiple operations (execute or getMediaInformation) at the same time, the response of this
* method is not predictable.
*
* @param path path or uri of media file
* @param timeout complete timeout
* @return media information
* @since 3.0
* @deprecated this method is deprecated since v4.3.1. You can still use this method but
* <code>timeout</code> parameter is not effective anymore.
*/
public static MediaInformation getMediaInformation(final String path, final Long timeout) {
return getMediaInformation(path);
}
private static MediaInformation getMediaInformationFromCommandArguments(final String[] arguments) {
final int rc = execute(arguments);
if (rc == 0) {
return MediaInformationParser.from(Config.getLastCommandOutput());
} else {
Log.w(Config.TAG, Config.getLastCommandOutput());
return null;
}
}
}
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2018-2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
/**
* <p>Represents a callback function to receive asynchronous getMediaInformation result.
*
* @author Taner Sener
*/
@FunctionalInterface
public interface GetMediaInformationCallback {
void apply(MediaInformation mediaInformation);
}
@@ -27,6 +27,14 @@ package com.arthenica.mobileffmpeg;
*/
public enum Level {
/**
* This log level is defined by MobileFFmpeg. It is used to specify logs printed to stderr by
* ffmpeg. Logs that has this level are not filtered and always redirected.
*
* @since 4.3.1
*/
AV_LOG_STDERR(-16),
/**
* Print no output.
*/
@@ -85,7 +93,9 @@ public enum Level {
* @return enumeration defined by value
*/
public static Level from(final int value) {
if (value == AV_LOG_QUIET.getValue()) {
if (value == AV_LOG_STDERR.getValue()) {
return AV_LOG_STDERR;
} else if (value == AV_LOG_QUIET.getValue()) {
return AV_LOG_QUIET;
} else if (value == AV_LOG_PANIC.getValue()) {
return AV_LOG_PANIC;
@@ -20,7 +20,7 @@
package com.arthenica.mobileffmpeg;
/**
* <p>Represents a callback function to redirect logs.
* <p>Represents a callback function to receive logs from running executions
*
* @author Taner Sener
* @since v2.1
@@ -20,21 +20,27 @@
package com.arthenica.mobileffmpeg;
/**
* <p>Represents a redirected log message.
* <p>Logs for running executions.
*
* @author Taner Sener
* @since v2.1
*/
public class LogMessage {
private final long executionId;
private final Level level;
private final String text;
public LogMessage(final Level level, final String text) {
public LogMessage(final long executionId, final Level level, final String text) {
this.executionId = executionId;
this.level = level;
this.text = text;
}
public long getExecutionId() {
return executionId;
}
public Level getLevel() {
return level;
}
@@ -43,4 +49,21 @@ public class LogMessage {
return text;
}
@Override
public String toString() {
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("LogMessage{");
stringBuilder.append("executionId=");
stringBuilder.append(executionId);
stringBuilder.append(", level=");
stringBuilder.append(level);
stringBuilder.append(", text=");
stringBuilder.append("\'");
stringBuilder.append(text);
stringBuilder.append('\'');
stringBuilder.append('}');
return stringBuilder.toString();
}
}
@@ -0,0 +1,210 @@
/*
* Copyright (c) 2018, 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import org.json.JSONObject;
import java.util.List;
/**
* Media information class.
*
* @since 3.0
*/
public class MediaInformation {
private static final String KEY_MEDIA_PROPERTIES = "format";
private static final String KEY_FILENAME = "filename";
private static final String KEY_FORMAT = "format_name";
private static final String KEY_FORMAT_LONG = "format_long_name";
private static final String KEY_START_TIME = "start_time";
private static final String KEY_DURATION = "duration";
private static final String KEY_SIZE = "size";
private static final String KEY_BIT_RATE = "bit_rate";
private static final String KEY_TAGS = "tags";
/**
* Stores all properties.
*/
private final JSONObject jsonObject;
/**
* Stores streams.
*/
private final List<StreamInformation> streams;
public MediaInformation(final JSONObject jsonObject, final List<StreamInformation> streams) {
this.jsonObject = jsonObject;
this.streams = streams;
}
/**
* Returns file name.
*
* @return media file name
*/
public String getFilename() {
return getStringProperty(KEY_FILENAME);
}
/**
* Returns format.
*
* @return media format
*/
public String getFormat() {
return getStringProperty(KEY_FORMAT);
}
/**
* Returns long format.
*
* @return media long format
*/
public String getLongFormat() {
return getStringProperty(KEY_FORMAT_LONG);
}
/**
* Returns duration.
*
* @return media duration in milliseconds
*/
public String getDuration() {
return getStringProperty(KEY_DURATION);
}
/**
* Returns start time.
*
* @return media start time in milliseconds
*/
public String getStartTime() {
return getStringProperty(KEY_START_TIME);
}
/**
* Returns size.
*
* @return media size in bytes
*/
public String getSize() {
return getStringProperty(KEY_SIZE);
}
/**
* Returns bitrate.
*
* @return media bitrate in kb/s
*/
public String getBitrate() {
return getStringProperty(KEY_BIT_RATE);
}
/**
* Returns all tags.
*
* @return tags dictionary
*/
public JSONObject getTags() {
return getProperties(KEY_TAGS);
}
/**
* Returns all streams.
*
* @return list of streams
*/
public List<StreamInformation> getStreams() {
return streams;
}
/**
* Returns the media property associated with the key.
*
* @param key property key
* @return media property as string or null if the key is not found
*/
public String getStringProperty(final String key) {
JSONObject mediaProperties = getMediaProperties();
if (mediaProperties == null) {
return null;
}
if (mediaProperties.has(key)) {
return mediaProperties.optString(key);
} else {
return null;
}
}
/**
* Returns the media property associated with the key.
*
* @param key property key
* @return media property as Long or null if the key is not found
*/
public Long getNumberProperty(String key) {
JSONObject mediaProperties = getMediaProperties();
if (mediaProperties == null) {
return null;
}
if (mediaProperties.has(key)) {
return mediaProperties.optLong(key);
} else {
return null;
}
}
/**
* Returns the media properties associated with the key.
*
* @param key properties key
* @return media properties as a JSONObject or null if the key is not found
*/
public JSONObject getProperties(String key) {
JSONObject mediaProperties = getMediaProperties();
if (mediaProperties == null) {
return null;
}
return mediaProperties.optJSONObject(key);
}
/**
* Returns all media properties.
*
* @return all media properties as a JSONObject or null if no media properties are defined
*/
public JSONObject getMediaProperties() {
return jsonObject.optJSONObject(KEY_MEDIA_PROPERTIES);
}
/**
* Returns all properties defined.
*
* @return all properties as a JSONObject or null if no properties are defined
*/
public JSONObject getAllProperties() {
return jsonObject;
}
}
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2018, 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* Helper class for parsing {@link MediaInformation}.
*
* @since 3.0
*/
public class MediaInformationParser {
/**
* Extracts MediaInformation from the given ffprobe json output.
*
* @param ffprobeJsonOutput ffprobe json output
* @return created {@link MediaInformation} instance of null if a parsing error occurs
*/
public static MediaInformation from(final String ffprobeJsonOutput) {
try {
return fromWithError(ffprobeJsonOutput);
} catch (JSONException e) {
Log.e(Config.TAG, "MediaInformation parsing failed.", e);
e.printStackTrace();
return null;
}
}
/**
* Extracts MediaInformation from the given ffprobe json output.
*
* @param ffprobeJsonOutput ffprobe json output
* @return created {@link MediaInformation} instance
* @throws JSONException if a parsing error occurs
*/
public static MediaInformation fromWithError(final String ffprobeJsonOutput) throws JSONException {
JSONObject jsonObject = new JSONObject(ffprobeJsonOutput);
JSONArray streamArray = jsonObject.optJSONArray("streams");
ArrayList<StreamInformation> arrayList = new ArrayList<>();
for (int i = 0; streamArray != null && i < streamArray.length(); i++) {
JSONObject streamObject = streamArray.optJSONObject(i);
if (streamObject != null) {
arrayList.add(new StreamInformation(streamObject));
}
}
return new MediaInformation(jsonObject, arrayList);
}
}
@@ -0,0 +1,275 @@
/*
* Copyright (c) 2018 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* <p>Provides helper methods to extract binary package information.
*
* @since 3.0
*/
class Packages {
private static final List<String> supportedExternalLibraries;
static {
supportedExternalLibraries = new ArrayList<>();
supportedExternalLibraries.add("fontconfig");
supportedExternalLibraries.add("freetype");
supportedExternalLibraries.add("fribidi");
supportedExternalLibraries.add("gmp");
supportedExternalLibraries.add("gnutls");
supportedExternalLibraries.add("kvazaar");
supportedExternalLibraries.add("mp3lame");
supportedExternalLibraries.add("libaom");
supportedExternalLibraries.add("libass");
supportedExternalLibraries.add("iconv");
supportedExternalLibraries.add("libilbc");
supportedExternalLibraries.add("libtheora");
supportedExternalLibraries.add("libvidstab");
supportedExternalLibraries.add("libvorbis");
supportedExternalLibraries.add("libvpx");
supportedExternalLibraries.add("libwebp");
supportedExternalLibraries.add("libxml2");
supportedExternalLibraries.add("opencore-amr");
supportedExternalLibraries.add("openh264");
supportedExternalLibraries.add("opus");
supportedExternalLibraries.add("rubberband");
supportedExternalLibraries.add("sdl2");
supportedExternalLibraries.add("shine");
supportedExternalLibraries.add("snappy");
supportedExternalLibraries.add("soxr");
supportedExternalLibraries.add("speex");
supportedExternalLibraries.add("tesseract");
supportedExternalLibraries.add("twolame");
supportedExternalLibraries.add("wavpack");
supportedExternalLibraries.add("x264");
supportedExternalLibraries.add("x265");
supportedExternalLibraries.add("xvid");
}
/**
* Returns enabled external libraries by FFmpeg.
*
* @return enabled external libraries
*/
static List<String> getExternalLibraries() {
final String buildConfiguration = AbiDetect.getNativeBuildConf();
final List<String> enabledLibraryList = new ArrayList<>();
for (String supportedExternalLibrary : supportedExternalLibraries) {
if (buildConfiguration.contains("enable-" + supportedExternalLibrary) ||
buildConfiguration.contains("enable-lib" + supportedExternalLibrary)) {
enabledLibraryList.add(supportedExternalLibrary);
}
}
Collections.sort(enabledLibraryList);
return enabledLibraryList;
}
/**
* Returns MobileFFmpeg binary package name.
*
* @return guessed MobileFFmpeg binary package name
*/
static String getPackageName() {
final List<String> externalLibraryList = getExternalLibraries();
final boolean speex = externalLibraryList.contains("speex");
final boolean fribidi = externalLibraryList.contains("fribidi");
final boolean gnutls = externalLibraryList.contains("gnutls");
final boolean xvid = externalLibraryList.contains("xvid");
boolean minGpl = false;
boolean https = false;
boolean httpsGpl = false;
boolean audio = false;
boolean video = false;
boolean full = false;
boolean fullGpl = false;
if (speex && fribidi) {
if (xvid) {
fullGpl = true;
} else {
full = true;
}
} else if (speex) {
audio = true;
} else if (fribidi) {
video = true;
} else if (xvid) {
if (gnutls) {
httpsGpl = true;
} else {
minGpl = true;
}
} else {
if (gnutls) {
https = true;
}
}
if (fullGpl) {
if (externalLibraryList.contains("fontconfig") &&
externalLibraryList.contains("freetype") &&
externalLibraryList.contains("fribidi") &&
externalLibraryList.contains("gmp") &&
externalLibraryList.contains("gnutls") &&
externalLibraryList.contains("kvazaar") &&
externalLibraryList.contains("mp3lame") &&
externalLibraryList.contains("libaom") &&
externalLibraryList.contains("libass") &&
externalLibraryList.contains("iconv") &&
externalLibraryList.contains("libilbc") &&
externalLibraryList.contains("libtheora") &&
externalLibraryList.contains("libvidstab") &&
externalLibraryList.contains("libvorbis") &&
externalLibraryList.contains("libvpx") &&
externalLibraryList.contains("libwebp") &&
externalLibraryList.contains("libxml2") &&
externalLibraryList.contains("opencore-amr") &&
externalLibraryList.contains("opus") &&
externalLibraryList.contains("shine") &&
externalLibraryList.contains("snappy") &&
externalLibraryList.contains("soxr") &&
externalLibraryList.contains("speex") &&
externalLibraryList.contains("twolame") &&
externalLibraryList.contains("wavpack") &&
externalLibraryList.contains("x264") &&
externalLibraryList.contains("x265") &&
externalLibraryList.contains("xvid")) {
return "full-gpl";
} else {
return "custom";
}
}
if (full) {
if (externalLibraryList.contains("fontconfig") &&
externalLibraryList.contains("freetype") &&
externalLibraryList.contains("fribidi") &&
externalLibraryList.contains("gmp") &&
externalLibraryList.contains("gnutls") &&
externalLibraryList.contains("kvazaar") &&
externalLibraryList.contains("mp3lame") &&
externalLibraryList.contains("libaom") &&
externalLibraryList.contains("libass") &&
externalLibraryList.contains("iconv") &&
externalLibraryList.contains("libilbc") &&
externalLibraryList.contains("libtheora") &&
externalLibraryList.contains("libvorbis") &&
externalLibraryList.contains("libvpx") &&
externalLibraryList.contains("libwebp") &&
externalLibraryList.contains("libxml2") &&
externalLibraryList.contains("opencore-amr") &&
externalLibraryList.contains("opus") &&
externalLibraryList.contains("shine") &&
externalLibraryList.contains("snappy") &&
externalLibraryList.contains("soxr") &&
externalLibraryList.contains("speex") &&
externalLibraryList.contains("twolame") &&
externalLibraryList.contains("wavpack")) {
return "full";
} else {
return "custom";
}
}
if (video) {
if (externalLibraryList.contains("fontconfig") &&
externalLibraryList.contains("freetype") &&
externalLibraryList.contains("fribidi") &&
externalLibraryList.contains("kvazaar") &&
externalLibraryList.contains("libaom") &&
externalLibraryList.contains("libass") &&
externalLibraryList.contains("iconv") &&
externalLibraryList.contains("libtheora") &&
externalLibraryList.contains("libvpx") &&
externalLibraryList.contains("libwebp") &&
externalLibraryList.contains("snappy")) {
return "video";
} else {
return "custom";
}
}
if (audio) {
if (externalLibraryList.contains("mp3lame") &&
externalLibraryList.contains("libilbc") &&
externalLibraryList.contains("libvorbis") &&
externalLibraryList.contains("opencore-amr") &&
externalLibraryList.contains("opus") &&
externalLibraryList.contains("shine") &&
externalLibraryList.contains("soxr") &&
externalLibraryList.contains("speex") &&
externalLibraryList.contains("twolame") &&
externalLibraryList.contains("wavpack")) {
return "audio";
} else {
return "custom";
}
}
if (httpsGpl) {
if (externalLibraryList.contains("gmp") &&
externalLibraryList.contains("gnutls") &&
externalLibraryList.contains("libvidstab") &&
externalLibraryList.contains("x264") &&
externalLibraryList.contains("x265") &&
externalLibraryList.contains("xvid")) {
return "https-gpl";
} else {
return "custom";
}
}
if (https) {
if (externalLibraryList.contains("gmp") &&
externalLibraryList.contains("gnutls")) {
return "https";
} else {
return "custom";
}
}
if (minGpl) {
if (externalLibraryList.contains("libvidstab") &&
externalLibraryList.contains("x264") &&
externalLibraryList.contains("x265") &&
externalLibraryList.contains("xvid")) {
return "min-gpl";
} else {
return "custom";
}
}
if (externalLibraryList.size() == 0) {
return "min";
} else {
return "custom";
}
}
}
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
/**
* <p>Lists signals handled by MobileFFmpeg library.
*
* @author Taner Sener
* @since v4.4
*/
public enum Signal {
SIGINT(2),
SIGQUIT(3),
SIGPIPE(13),
SIGTERM(15),
SIGXCPU(24);
private int value;
Signal(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
@@ -20,13 +20,14 @@
package com.arthenica.mobileffmpeg;
/**
* <p>Represents statistics data.
* <p>Statistics for running executions.
*
* @author Taner Sener
* @since v2.1
*/
public class Statistics {
private long executionId;
private int videoFrameNumber;
private float videoFps;
private float videoQuality;
@@ -36,6 +37,7 @@ public class Statistics {
private double speed;
public Statistics() {
executionId = 0;
videoFrameNumber = 0;
videoFps = 0;
videoQuality = 0;
@@ -45,7 +47,8 @@ public class Statistics {
speed = 0;
}
public Statistics(int videoFrameNumber, float videoFps, float videoQuality, long size, int time, double bitrate, double speed) {
public Statistics(long executionId, int videoFrameNumber, float videoFps, float videoQuality, long size, int time, double bitrate, double speed) {
this.executionId = executionId;
this.videoFrameNumber = videoFrameNumber;
this.videoFps = videoFps;
this.videoQuality = videoQuality;
@@ -57,35 +60,44 @@ public class Statistics {
public void update(final Statistics newStatistics) {
if (newStatistics != null) {
this.executionId = newStatistics.getExecutionId();
if (newStatistics.getVideoFrameNumber() > 0) {
this.videoFrameNumber = newStatistics.getVideoFrameNumber();
}
if (newStatistics.getVideoFps() > 0){
if (newStatistics.getVideoFps() > 0) {
this.videoFps = newStatistics.getVideoFps();
}
if (newStatistics.getVideoQuality() > 0){
if (newStatistics.getVideoQuality() > 0) {
this.videoQuality = newStatistics.getVideoQuality();
}
if (newStatistics.getSize() > 0){
if (newStatistics.getSize() > 0) {
this.size = newStatistics.getSize();
}
if (newStatistics.getTime() > 0){
if (newStatistics.getTime() > 0) {
this.time = newStatistics.getTime();
}
if (newStatistics.getBitrate() > 0){
if (newStatistics.getBitrate() > 0) {
this.bitrate = newStatistics.getBitrate();
}
if (newStatistics.getSpeed() > 0){
if (newStatistics.getSpeed() > 0) {
this.speed = newStatistics.getSpeed();
}
}
}
public long getExecutionId() {
return executionId;
}
public void setExecutionId(long executionId) {
this.executionId = executionId;
}
public int getVideoFrameNumber() {
return videoFrameNumber;
}
@@ -142,4 +154,30 @@ public class Statistics {
this.speed = speed;
}
@Override
public String toString() {
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Statistics{");
stringBuilder.append("executionId=");
stringBuilder.append(executionId);
stringBuilder.append(", videoFrameNumber=");
stringBuilder.append(videoFrameNumber);
stringBuilder.append(", videoFps=");
stringBuilder.append(videoFps);
stringBuilder.append(", videoQuality=");
stringBuilder.append(videoQuality);
stringBuilder.append(", size=");
stringBuilder.append(size);
stringBuilder.append(", time=");
stringBuilder.append(time);
stringBuilder.append(", bitrate=");
stringBuilder.append(bitrate);
stringBuilder.append(", speed=");
stringBuilder.append(speed);
stringBuilder.append('}');
return stringBuilder.toString();
}
}
@@ -20,7 +20,7 @@
package com.arthenica.mobileffmpeg;
/**
* <p>Represents a callback function to receive statistics of running operation.
* <p>Represents a callback function to receive statistics from running executions.
*
* @author Taner Sener
* @since v2.1
@@ -0,0 +1,283 @@
/*
* Copyright (c) 2018, 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import org.json.JSONObject;
/**
* Stream information class.
*
* @since 3.0
*/
public class StreamInformation {
private static final String KEY_INDEX = "index";
private static final String KEY_TYPE = "codec_type";
private static final String KEY_CODEC = "codec_name";
private static final String KEY_CODEC_LONG = "codec_long_name";
private static final String KEY_FORMAT = "pix_fmt";
private static final String KEY_WIDTH = "width";
private static final String KEY_HEIGHT = "height";
private static final String KEY_BIT_RATE = "bit_rate";
private static final String KEY_SAMPLE_RATE = "sample_rate";
private static final String KEY_SAMPLE_FORMAT = "sample_fmt";
private static final String KEY_CHANNEL_LAYOUT = "channel_layout";
private static final String KEY_SAMPLE_ASPECT_RATIO = "sample_aspect_ratio";
private static final String KEY_DISPLAY_ASPECT_RATIO = "display_aspect_ratio";
private static final String KEY_AVERAGE_FRAME_RATE = "avg_frame_rate";
private static final String KEY_REAL_FRAME_RATE = "r_frame_rate";
private static final String KEY_TIME_BASE = "time_base";
private static final String KEY_CODEC_TIME_BASE = "codec_time_base";
private static final String KEY_TAGS = "tags";
/**
* Stores all properties.
*/
private final JSONObject jsonObject;
public StreamInformation(final JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
/**
* Returns stream index.
*
* @return stream index, starting from zero
*/
public Long getIndex() {
return getNumberProperty(KEY_INDEX);
}
/**
* Returns stream type.
*
* @return stream type; audio or video
*/
public String getType() {
return getStringProperty(KEY_TYPE);
}
/**
* Returns stream codec.
*
* @return stream codec
*/
public String getCodec() {
return getStringProperty(KEY_CODEC);
}
/**
* Returns full stream codec.
*
* @return stream codec with additional profile and mode information
*/
public String getFullCodec() {
return getStringProperty(KEY_CODEC_LONG);
}
/**
* Returns stream format.
*
* @return stream format
*/
public String getFormat() {
return getStringProperty(KEY_FORMAT);
}
/**
* Returns width.
*
* @return width in pixels
*/
public Long getWidth() {
return getNumberProperty(KEY_WIDTH);
}
/**
* Returns height.
*
* @return height in pixels
*/
public Long getHeight() {
return getNumberProperty(KEY_HEIGHT);
}
/**
* Returns bitrate.
*
* @return bitrate in kb/s
*/
public String getBitrate() {
return getStringProperty(KEY_BIT_RATE);
}
/**
* Returns sample rate.
*
* @return sample rate in hz
*/
public String getSampleRate() {
return getStringProperty(KEY_SAMPLE_RATE);
}
/**
* Returns sample format.
*
* @return sample format
*/
public String getSampleFormat() {
return getStringProperty(KEY_SAMPLE_FORMAT);
}
/**
* Returns channel layout.
*
* @return channel layout
*/
public String getChannelLayout() {
return getStringProperty(KEY_CHANNEL_LAYOUT);
}
/**
* Returns sample aspect ratio.
*
* @return sample aspect ratio
*/
public String getSampleAspectRatio() {
return getStringProperty(KEY_SAMPLE_ASPECT_RATIO);
}
/**
* Returns display aspect ratio.
*
* @return display aspect ratio
*/
public String getDisplayAspectRatio() {
return getStringProperty(KEY_DISPLAY_ASPECT_RATIO);
}
/**
* Returns display aspect ratio.
*
* @return average frame rate in fps
*/
public String getAverageFrameRate() {
return getStringProperty(KEY_AVERAGE_FRAME_RATE);
}
/**
* Returns real frame rate.
*
* @return real frame rate in tbr
*/
public String getRealFrameRate() {
return getStringProperty(KEY_REAL_FRAME_RATE);
}
/**
* Returns time base.
*
* @return time base in tbn
*/
public String getTimeBase() {
return getStringProperty(KEY_TIME_BASE);
}
/**
* Returns codec time base.
*
* @return codec time base in tbc
*/
public String getCodecTimeBase() {
return getStringProperty(KEY_CODEC_TIME_BASE);
}
/**
* Returns all tags.
*
* @return tags dictionary
*/
public JSONObject getTags() {
return getProperties(KEY_TAGS);
}
/**
* Returns the stream property associated with the key.
*
* @param key property key
* @return stream property as string or null if the key is not found
*/
public String getStringProperty(final String key) {
JSONObject mediaProperties = getAllProperties();
if (mediaProperties == null) {
return null;
}
if (mediaProperties.has(key)) {
return mediaProperties.optString(key);
} else {
return null;
}
}
/**
* Returns the stream property associated with the key.
*
* @param key property key
* @return stream property as Long or null if the key is not found
*/
public Long getNumberProperty(String key) {
JSONObject mediaProperties = getAllProperties();
if (mediaProperties == null) {
return null;
}
if (mediaProperties.has(key)) {
return mediaProperties.optLong(key);
} else {
return null;
}
}
/**
* Returns the stream properties associated with the key.
*
* @param key properties key
* @return stream properties as a JSONObject or null if the key is not found
*/
public JSONObject getProperties(String key) {
JSONObject mediaProperties = getAllProperties();
if (mediaProperties == null) {
return null;
}
return mediaProperties.optJSONObject(key);
}
/**
* Returns all stream properties defined.
*
* @return all stream properties as a JSONObject or null if no properties are defined
*/
public JSONObject getAllProperties() {
return jsonObject;
}
}
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2018 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg.util;
public class Pair<A, B> {
/**
* The first element of the pair.
*/
protected A first;
/**
* The second element of the pair.
*/
protected B second;
public Pair(final A first, final B second) {
this.first = first;
this.second = second;
}
public A getFirst() {
return first;
}
public B getSecond() {
return second;
}
}
@@ -1,33 +0,0 @@
/*
* Copyright (c) 2018 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg.util;
/**
* <p>Represents a callback function to receive run result.
*
* @author Taner Sener
* @since v2.1
*/
@FunctionalInterface
public interface RunCallback {
void apply(final int returnCode);
}
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2018 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg.util;
public class Trio<A, B, C> {
/**
* The first element of the trio.
*/
protected final A first;
/**
* The second element of the trio.
*/
protected final B second;
/**
* The third element of the trio.
*/
protected final C third;
public Trio(final A first, final B second, final C third) {
this.first = first;
this.second = second;
this.third = third;
}
public A getFirst() {
return first;
}
public B getSecond() {
return second;
}
public C getThird() {
return third;
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

@@ -1,3 +0,0 @@
<resources>
<string name="app_name">MobileFFmpeg</string>
</resources>
@@ -1,11 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

@@ -0,0 +1,186 @@
/*
* Copyright (c) 2018, 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* <p>Tests for {@link Config} class.
*/
public class ConfigTest {
private static final String externalLibrariesCommandOutput = " configuration:\n" +
" --cross-prefix=i686-linux-android-\n" +
" --sysroot=/Users/taner/Library/Android/sdk/ndk-bundle/toolchains/mobile-ffmpeg-i686/sysroot\n" +
" --prefix=/Users/taner/Projects/mobile-ffmpeg/prebuilt/android-x86/ffmpeg\n" +
" --pkg-config=/usr/local/bin/pkg-config --extra-cflags='-march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -Wno-unused-function -fstrict-aliasing -fPIC -DANDROID -D__ANDROID__ -D__ANDROID_API__=21 -O2 -I/Users/taner/Library/Android/sdk/ndk-bundle/toolchains/mobile-ffmpeg-i686/sysroot/usr/include -I/Users/taner/Library/Android/sdk/ndk-bundle/toolchains/mobile-ffmpeg-i686/sysroot/usr/local/include'\n" +
" --extra-cxxflags='-std=c++11 -fno-exceptions -fno-rtti'\n" +
" --extra-ldflags='-march=i686 -Wl,--gc-sections,--icf=safe -lc -lm -ldl -llog -lc++_shared -L/Users/taner/Library/Android/sdk/ndk-bundle/toolchains/mobile-ffmpeg-i686/i686-linux-android/lib -L/Users/taner/Library/Android/sdk/ndk-bundle/toolchains/mobile-ffmpeg-i686/sysroot/usr/lib -L/Users/taner/Library/Android/sdk/ndk-bundle/toolchains/mobile-ffmpeg-i686/lib -L/Users/taner/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-x86/usr/lib'\n" +
" --enable-version3\n" +
" --arch=i686\n" +
" --cpu=i686\n" +
" --target-os=android\n" +
" --disable-neon\n" +
" --disable-asm\n" +
" --disable-inline-asm\n" +
" --enable-cross-compile\n" +
" --enable-pic\n" +
" --enable-jni\n" +
" --enable-libvorbis\n" +
" --enable-optimizations\n" +
" --enable-swscale\n" +
" --enable-shared\n" +
" --enable-v4l2-m2m\n" +
" --enable-small\n" +
" --disable-openssl\n" +
" --disable-xmm-clobber-test\n" +
" --disable-debug\n" +
" --disable-neon-clobber-test\n" +
" --disable-programs\n" +
" --disable-postproc\n" +
" --disable-doc\n" +
" --disable-htmlpages\n" +
" --disable-manpages\n" +
" --disable-podpages\n" +
" --disable-txtpages\n" +
" --disable-static\n" +
" --disable-sndio\n" +
" --disable-schannel\n" +
" --disable-securetransport\n" +
" --disable-xlib\n" +
" --disable-cuda\n" +
" --disable-cuvid\n" +
" --disable-nvenc\n" +
" --disable-vaapi\n" +
" --disable-vdpau\n" +
" --disable-videotoolbox\n" +
" --disable-audiotoolbox\n" +
" --disable-appkit\n" +
" --disable-alsa\n" +
" --disable-cuda\n" +
" --disable-cuvid\n" +
" --disable-nvenc\n" +
" --disable-vaapi\n" +
" --disable-vdpau\n" +
" --disable-zlib\n";
@Test
public void getExternalLibraries() {
final List<String> supportedExternalLibraries = new ArrayList<>();
supportedExternalLibraries.add("chromaprint");
supportedExternalLibraries.add("fontconfig");
supportedExternalLibraries.add("freetype");
supportedExternalLibraries.add("fribidi");
supportedExternalLibraries.add("gmp");
supportedExternalLibraries.add("gnutls");
supportedExternalLibraries.add("kvazaar");
supportedExternalLibraries.add("lame");
supportedExternalLibraries.add("libaom");
supportedExternalLibraries.add("libass");
supportedExternalLibraries.add("libiconv");
supportedExternalLibraries.add("libilbc");
supportedExternalLibraries.add("libtheora");
supportedExternalLibraries.add("libvidstab");
supportedExternalLibraries.add("libvorbis");
supportedExternalLibraries.add("libvpx");
supportedExternalLibraries.add("libwebp");
supportedExternalLibraries.add("libxml2");
supportedExternalLibraries.add("opencore-amr");
supportedExternalLibraries.add("opus");
supportedExternalLibraries.add("shine");
supportedExternalLibraries.add("sdl");
supportedExternalLibraries.add("snappy");
supportedExternalLibraries.add("soxr");
supportedExternalLibraries.add("speex");
supportedExternalLibraries.add("tesseract");
supportedExternalLibraries.add("twolame");
supportedExternalLibraries.add("wavpack");
supportedExternalLibraries.add("x264");
supportedExternalLibraries.add("x265");
supportedExternalLibraries.add("xvidcore");
supportedExternalLibraries.add("android-zlib");
supportedExternalLibraries.add("android-media-codec");
final List<String> enabledList = new ArrayList<>();
for (String supportedExternalLibrary : supportedExternalLibraries) {
if (externalLibrariesCommandOutput.contains("enable-" + supportedExternalLibrary) ||
externalLibrariesCommandOutput.contains("enable-lib" + supportedExternalLibrary)) {
enabledList.add(supportedExternalLibrary);
}
}
Collections.sort(enabledList);
Assert.assertNotNull(enabledList);
Assert.assertEquals(1, enabledList.size());
}
@Test
public void getPackageName() {
Assert.assertEquals("min", listToPackageName(Collections.singletonList("")));
Assert.assertEquals("min-gpl", listToPackageName(Collections.singletonList("xvidcore")));
Assert.assertEquals("full-gpl", listToPackageName(Arrays.asList("gnutls", "speex", "fribidi", "xvidcore")));
Assert.assertEquals("full", listToPackageName(Arrays.asList("fribidi", "speex")));
Assert.assertEquals("video", listToPackageName(Collections.singletonList("fribidi")));
Assert.assertEquals("audio", listToPackageName(Collections.singletonList("speex")));
Assert.assertEquals("https", listToPackageName(Collections.singletonList("gnutls")));
Assert.assertEquals("https-gpl", listToPackageName(Arrays.asList("gnutls", "xvidcore")));
}
private String listToPackageName(final List<String> externalLibraryList) {
boolean speex = externalLibraryList.contains("speex");
boolean fribidi = externalLibraryList.contains("fribidi");
boolean gnutls = externalLibraryList.contains("gnutls");
boolean xvidcore = externalLibraryList.contains("xvidcore");
if (speex && fribidi) {
if (xvidcore) {
return "full-gpl";
} else {
return "full";
}
} else if (speex) {
return "audio";
} else if (fribidi) {
return "video";
} else if (xvidcore) {
if (gnutls) {
return "https-gpl";
} else {
return "min-gpl";
}
} else {
if (gnutls) {
return "https";
} else {
return "min";
}
}
}
}
@@ -1,36 +0,0 @@
/*
* Copyright (c) 2018 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
@@ -0,0 +1,746 @@
/*
* Copyright (c) 2018, 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
/**
* <p>Tests for {@link FFmpeg} class.
*/
public class FFmpegTest {
private static final String MEDIA_INFORMATION_MP3 =
"{\n" +
" \"streams\": [\n" +
" {\n" +
" \"index\": 0,\n" +
" \"codec_name\": \"mp3\",\n" +
" \"codec_long_name\": \"MP3 (MPEG audio layer 3)\",\n" +
" \"codec_type\": \"audio\",\n" +
" \"codec_time_base\": \"1/44100\",\n" +
" \"codec_tag_string\": \"[0][0][0][0]\",\n" +
" \"codec_tag\": \"0x0000\",\n" +
" \"sample_fmt\": \"fltp\",\n" +
" \"sample_rate\": \"44100\",\n" +
" \"channels\": 2,\n" +
" \"channel_layout\": \"stereo\",\n" +
" \"bits_per_sample\": 0,\n" +
" \"r_frame_rate\": \"0/0\",\n" +
" \"avg_frame_rate\": \"0/0\",\n" +
" \"time_base\": \"1/14112000\",\n" +
" \"start_pts\": 169280,\n" +
" \"start_time\": \"0.011995\",\n" +
" \"duration_ts\": 4622376960,\n" +
" \"duration\": \"327.549388\",\n" +
" \"bit_rate\": \"320000\",\n" +
" \"disposition\": {\n" +
" \"default\": 0,\n" +
" \"dub\": 0,\n" +
" \"original\": 0,\n" +
" \"comment\": 0,\n" +
" \"lyrics\": 0,\n" +
" \"karaoke\": 0,\n" +
" \"forced\": 0,\n" +
" \"hearing_impaired\": 0,\n" +
" \"visual_impaired\": 0,\n" +
" \"clean_effects\": 0,\n" +
" \"attached_pic\": 0,\n" +
" \"timed_thumbnails\": 0\n" +
" },\n" +
" \"tags\": {\n" +
" \"encoder\": \"Lavf\"\n" +
" }\n" +
" }\n" +
" ],\n" +
" \"format\": {\n" +
" \"filename\": \"sample.mp3\",\n" +
" \"nb_streams\": 1,\n" +
" \"nb_programs\": 0,\n" +
" \"format_name\": \"mp3\",\n" +
" \"format_long_name\": \"MP2/3 (MPEG audio layer 2/3)\",\n" +
" \"start_time\": \"0.011995\",\n" +
" \"duration\": \"327.549388\",\n" +
" \"size\": \"13103064\",\n" +
" \"bit_rate\": \"320026\",\n" +
" \"probe_score\": 51,\n" +
" \"tags\": {\n" +
" \"encoder\": \"Lavf58.20.100\",\n" +
" \"album\": \"Impact\",\n" +
" \"artist\": \"Kevin MacLeod\",\n" +
" \"comment\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit finito.\",\n" +
" \"genre\": \"Cinematic\",\n" +
" \"title\": \"Impact Moderato\"\n" +
" }\n" +
" }\n" +
"}";
private static final String MEDIA_INFORMATION_JPG =
"{\n" +
" \"streams\": [\n" +
" {\n" +
" \"index\": 0,\n" +
" \"codec_name\": \"mjpeg\",\n" +
" \"codec_long_name\": \"Motion JPEG\",\n" +
" \"profile\": \"Baseline\",\n" +
" \"codec_type\": \"video\",\n" +
" \"codec_time_base\": \"0/1\",\n" +
" \"codec_tag_string\": \"[0][0][0][0]\",\n" +
" \"codec_tag\": \"0x0000\",\n" +
" \"width\": 1496,\n" +
" \"height\": 1729,\n" +
" \"coded_width\": 1496,\n" +
" \"coded_height\": 1729,\n" +
" \"has_b_frames\": 0,\n" +
" \"sample_aspect_ratio\": \"1:1\",\n" +
" \"display_aspect_ratio\": \"1496:1729\",\n" +
" \"pix_fmt\": \"yuvj444p\",\n" +
" \"level\": -99,\n" +
" \"color_range\": \"pc\",\n" +
" \"color_space\": \"bt470bg\",\n" +
" \"chroma_location\": \"center\",\n" +
" \"refs\": 1,\n" +
" \"r_frame_rate\": \"25/1\",\n" +
" \"avg_frame_rate\": \"0/0\",\n" +
" \"time_base\": \"1/25\",\n" +
" \"start_pts\": 0,\n" +
" \"start_time\": \"0.000000\",\n" +
" \"duration_ts\": 1,\n" +
" \"duration\": \"0.040000\",\n" +
" \"bits_per_raw_sample\": \"8\",\n" +
" \"disposition\": {\n" +
" \"default\": 0,\n" +
" \"dub\": 0,\n" +
" \"original\": 0,\n" +
" \"comment\": 0,\n" +
" \"lyrics\": 0,\n" +
" \"karaoke\": 0,\n" +
" \"forced\": 0,\n" +
" \"hearing_impaired\": 0,\n" +
" \"visual_impaired\": 0,\n" +
" \"clean_effects\": 0,\n" +
" \"attached_pic\": 0,\n" +
" \"timed_thumbnails\": 0\n" +
" }\n" +
" }\n" +
" ],\n" +
" \"format\": {\n" +
" \"filename\": \"sample.jpg\",\n" +
" \"nb_streams\": 1,\n" +
" \"nb_programs\": 0,\n" +
" \"format_name\": \"image2\",\n" +
" \"format_long_name\": \"image2 sequence\",\n" +
" \"start_time\": \"0.000000\",\n" +
" \"duration\": \"0.040000\",\n" +
" \"size\": \"1659050\",\n" +
" \"bit_rate\": \"331810000\",\n" +
" \"probe_score\": 50\n" +
" }\n" +
"}";
private static final String MEDIA_INFORMATION_GIF =
"{\n" +
" \"streams\": [\n" +
" {\n" +
" \"index\": 0,\n" +
" \"codec_name\": \"gif\",\n" +
" \"codec_long_name\": \"CompuServe GIF (Graphics Interchange Format)\",\n" +
" \"codec_type\": \"video\",\n" +
" \"codec_time_base\": \"12/133\",\n" +
" \"codec_tag_string\": \"[0][0][0][0]\",\n" +
" \"codec_tag\": \"0x0000\",\n" +
" \"width\": 400,\n" +
" \"height\": 400,\n" +
" \"coded_width\": 400,\n" +
" \"coded_height\": 400,\n" +
" \"has_b_frames\": 0,\n" +
" \"pix_fmt\": \"bgra\",\n" +
" \"level\": -99,\n" +
" \"refs\": 1,\n" +
" \"r_frame_rate\": \"100/9\",\n" +
" \"avg_frame_rate\": \"133/12\",\n" +
" \"time_base\": \"1/100\",\n" +
" \"start_pts\": 0,\n" +
" \"start_time\": \"0.000000\",\n" +
" \"duration_ts\": 396,\n" +
" \"duration\": \"3.960000\",\n" +
" \"nb_frames\": \"44\",\n" +
" \"disposition\": {\n" +
" \"default\": 0,\n" +
" \"dub\": 0,\n" +
" \"original\": 0,\n" +
" \"comment\": 0,\n" +
" \"lyrics\": 0,\n" +
" \"karaoke\": 0,\n" +
" \"forced\": 0,\n" +
" \"hearing_impaired\": 0,\n" +
" \"visual_impaired\": 0,\n" +
" \"clean_effects\": 0,\n" +
" \"attached_pic\": 0,\n" +
" \"timed_thumbnails\": 0\n" +
" }\n" +
" }\n" +
" ],\n" +
" \"format\": {\n" +
" \"filename\": \"sample.gif\",\n" +
" \"nb_streams\": 1,\n" +
" \"nb_programs\": 0,\n" +
" \"format_name\": \"gif\",\n" +
" \"format_long_name\": \"CompuServe Graphics Interchange Format (GIF)\",\n" +
" \"start_time\": \"0.000000\",\n" +
" \"duration\": \"3.960000\",\n" +
" \"size\": \"1001718\",\n" +
" \"bit_rate\": \"2023672\",\n" +
" \"probe_score\": 100\n" +
" }\n" +
"}";
private static final String MEDIA_INFORMATION_MP4 =
"{\n" +
" \"streams\": [\n" +
" {\n" +
" \"index\": 0,\n" +
" \"codec_name\": \"h264\",\n" +
" \"codec_long_name\": \"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10\",\n" +
" \"profile\": \"Main\",\n" +
" \"codec_type\": \"video\",\n" +
" \"codec_time_base\": \"1/60\",\n" +
" \"codec_tag_string\": \"avc1\",\n" +
" \"codec_tag\": \"0x31637661\",\n" +
" \"width\": 1280,\n" +
" \"height\": 720,\n" +
" \"coded_width\": 1280,\n" +
" \"coded_height\": 720,\n" +
" \"has_b_frames\": 0,\n" +
" \"sample_aspect_ratio\": \"1:1\",\n" +
" \"display_aspect_ratio\": \"16:9\",\n" +
" \"pix_fmt\": \"yuv420p\",\n" +
" \"level\": 42,\n" +
" \"chroma_location\": \"left\",\n" +
" \"refs\": 1,\n" +
" \"is_avc\": \"true\",\n" +
" \"nal_length_size\": \"4\",\n" +
" \"r_frame_rate\": \"30/1\",\n" +
" \"avg_frame_rate\": \"30/1\",\n" +
" \"time_base\": \"1/15360\",\n" +
" \"start_pts\": 0,\n" +
" \"start_time\": \"0.000000\",\n" +
" \"duration_ts\": 215040,\n" +
" \"duration\": \"14.000000\",\n" +
" \"bit_rate\": \"9166570\",\n" +
" \"bits_per_raw_sample\": \"8\",\n" +
" \"nb_frames\": \"420\",\n" +
" \"disposition\": {\n" +
" \"default\": 1,\n" +
" \"dub\": 0,\n" +
" \"original\": 0,\n" +
" \"comment\": 0,\n" +
" \"lyrics\": 0,\n" +
" \"karaoke\": 0,\n" +
" \"forced\": 0,\n" +
" \"hearing_impaired\": 0,\n" +
" \"visual_impaired\": 0,\n" +
" \"clean_effects\": 0,\n" +
" \"attached_pic\": 0,\n" +
" \"timed_thumbnails\": 0\n" +
" },\n" +
" \"tags\": {\n" +
" \"language\": \"und\",\n" +
" \"handler_name\": \"VideoHandler\"\n" +
" }\n" +
" }\n" +
" ],\n" +
" \"format\": {\n" +
" \"filename\": \"sample.mp4\",\n" +
" \"nb_streams\": 1,\n" +
" \"nb_programs\": 0,\n" +
" \"format_name\": \"mov,mp4,m4a,3gp,3g2,mj2\",\n" +
" \"format_long_name\": \"QuickTime / MOV\",\n" +
" \"start_time\": \"0.000000\",\n" +
" \"duration\": \"14.000000\",\n" +
" \"size\": \"16044159\",\n" +
" \"bit_rate\": \"9168090\",\n" +
" \"probe_score\": 100,\n" +
" \"tags\": {\n" +
" \"major_brand\": \"isom\",\n" +
" \"minor_version\": \"512\",\n" +
" \"compatible_brands\": \"isomiso2avc1mp41\",\n" +
" \"encoder\": \"Lavf58.33.100\"\n" +
" }\n" +
" }\n" +
"}";
private static final String MEDIA_INFORMATION_PNG =
"{\n" +
" \"streams\": [\n" +
" {\n" +
" \"index\": 0,\n" +
" \"codec_name\": \"png\",\n" +
" \"codec_long_name\": \"PNG (Portable Network Graphics) image\",\n" +
" \"codec_type\": \"video\",\n" +
" \"codec_time_base\": \"0/1\",\n" +
" \"codec_tag_string\": \"[0][0][0][0]\",\n" +
" \"codec_tag\": \"0x0000\",\n" +
" \"width\": 1198,\n" +
" \"height\": 1198,\n" +
" \"coded_width\": 1198,\n" +
" \"coded_height\": 1198,\n" +
" \"has_b_frames\": 0,\n" +
" \"sample_aspect_ratio\": \"1:1\",\n" +
" \"display_aspect_ratio\": \"1:1\",\n" +
" \"pix_fmt\": \"pal8\",\n" +
" \"level\": -99,\n" +
" \"color_range\": \"pc\",\n" +
" \"refs\": 1,\n" +
" \"r_frame_rate\": \"25/1\",\n" +
" \"avg_frame_rate\": \"0/0\",\n" +
" \"time_base\": \"1/25\",\n" +
" \"disposition\": {\n" +
" \"default\": 0,\n" +
" \"dub\": 0,\n" +
" \"original\": 0,\n" +
" \"comment\": 0,\n" +
" \"lyrics\": 0,\n" +
" \"karaoke\": 0,\n" +
" \"forced\": 0,\n" +
" \"hearing_impaired\": 0,\n" +
" \"visual_impaired\": 0,\n" +
" \"clean_effects\": 0,\n" +
" \"attached_pic\": 0,\n" +
" \"timed_thumbnails\": 0\n" +
" }\n" +
" }\n" +
" ],\n" +
" \"format\": {\n" +
" \"filename\": \"sample.png\",\n" +
" \"nb_streams\": 1,\n" +
" \"nb_programs\": 0,\n" +
" \"format_name\": \"png_pipe\",\n" +
" \"format_long_name\": \"piped png sequence\",\n" +
" \"size\": \"31533\",\n" +
" \"probe_score\": 99\n" +
" }\n" +
"}";
private static final String MEDIA_INFORMATION_OGG =
"{\n" +
" \"streams\": [\n" +
" {\n" +
" \"index\": 0,\n" +
" \"codec_name\": \"theora\",\n" +
" \"codec_long_name\": \"Theora\",\n" +
" \"codec_type\": \"video\",\n" +
" \"codec_time_base\": \"1/25\",\n" +
" \"codec_tag_string\": \"[0][0][0][0]\",\n" +
" \"codec_tag\": \"0x0000\",\n" +
" \"width\": 1920,\n" +
" \"height\": 1080,\n" +
" \"coded_width\": 1920,\n" +
" \"coded_height\": 1088,\n" +
" \"has_b_frames\": 0,\n" +
" \"pix_fmt\": \"yuv420p\",\n" +
" \"level\": -99,\n" +
" \"color_space\": \"bt470bg\",\n" +
" \"color_transfer\": \"bt709\",\n" +
" \"color_primaries\": \"bt470bg\",\n" +
" \"chroma_location\": \"center\",\n" +
" \"refs\": 1,\n" +
" \"r_frame_rate\": \"25/1\",\n" +
" \"avg_frame_rate\": \"25/1\",\n" +
" \"time_base\": \"1/25\",\n" +
" \"start_pts\": 0,\n" +
" \"start_time\": \"0.000000\",\n" +
" \"duration_ts\": 813,\n" +
" \"duration\": \"32.520000\",\n" +
" \"disposition\": {\n" +
" \"default\": 0,\n" +
" \"dub\": 0,\n" +
" \"original\": 0,\n" +
" \"comment\": 0,\n" +
" \"lyrics\": 0,\n" +
" \"karaoke\": 0,\n" +
" \"forced\": 0,\n" +
" \"hearing_impaired\": 0,\n" +
" \"visual_impaired\": 0,\n" +
" \"clean_effects\": 0,\n" +
" \"attached_pic\": 0,\n" +
" \"timed_thumbnails\": 0\n" +
" },\n" +
" \"tags\": {\n" +
" \"ENCODER\": \"ffmpeg2theora 0.19\"\n" +
" }\n" +
" },\n" +
" {\n" +
" \"index\": 1,\n" +
" \"codec_name\": \"vorbis\",\n" +
" \"codec_long_name\": \"Vorbis\",\n" +
" \"codec_type\": \"audio\",\n" +
" \"codec_time_base\": \"1/48000\",\n" +
" \"codec_tag_string\": \"[0][0][0][0]\",\n" +
" \"codec_tag\": \"0x0000\",\n" +
" \"sample_fmt\": \"fltp\",\n" +
" \"sample_rate\": \"48000\",\n" +
" \"channels\": 2,\n" +
" \"channel_layout\": \"stereo\",\n" +
" \"bits_per_sample\": 0,\n" +
" \"r_frame_rate\": \"0/0\",\n" +
" \"avg_frame_rate\": \"0/0\",\n" +
" \"time_base\": \"1/48000\",\n" +
" \"start_pts\": 0,\n" +
" \"start_time\": \"0.000000\",\n" +
" \"duration_ts\": 1583850,\n" +
" \"duration\": \"32.996875\",\n" +
" \"bit_rate\": \"80000\",\n" +
" \"disposition\": {\n" +
" \"default\": 0,\n" +
" \"dub\": 0,\n" +
" \"original\": 0,\n" +
" \"comment\": 0,\n" +
" \"lyrics\": 0,\n" +
" \"karaoke\": 0,\n" +
" \"forced\": 0,\n" +
" \"hearing_impaired\": 0,\n" +
" \"visual_impaired\": 0,\n" +
" \"clean_effects\": 0,\n" +
" \"attached_pic\": 0,\n" +
" \"timed_thumbnails\": 0\n" +
" },\n" +
" \"tags\": {\n" +
" \"ENCODER\": \"ffmpeg2theora 0.19\"\n" +
" }\n" +
" }\n" +
" ],\n" +
" \"format\": {\n" +
" \"filename\": \"sample.ogg\",\n" +
" \"nb_streams\": 2,\n" +
" \"nb_programs\": 0,\n" +
" \"format_name\": \"ogg\",\n" +
" \"format_long_name\": \"Ogg\",\n" +
" \"start_time\": \"0.000000\",\n" +
" \"duration\": \"32.996875\",\n" +
" \"size\": \"27873937\",\n" +
" \"bit_rate\": \"6757958\",\n" +
" \"probe_score\": 100\n" +
" }\n" +
"}";
@Test
public void mediaInformationMp3() {
MediaInformation mediaInformation = MediaInformationParser.from(MEDIA_INFORMATION_MP3);
Assert.assertNotNull(mediaInformation);
assertMediaInput(mediaInformation, "mp3", "sample.mp3");
assertMediaDuration(mediaInformation, "327.549388", "0.011995", "320026");
assertTag(mediaInformation, "comment", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit finito.");
assertTag(mediaInformation, "album", "Impact");
assertTag(mediaInformation, "title", "Impact Moderato");
assertTag(mediaInformation, "artist", "Kevin MacLeod");
Assert.assertNotNull(mediaInformation.getStreams());
Assert.assertEquals(1, mediaInformation.getStreams().size());
assertAudioStream(mediaInformation.getStreams().get(0), 0L, "mp3", "MP3 (MPEG audio layer 3)", "44100", "stereo", "fltp", "320000");
}
@Test
public void mediaInformationJpg() {
MediaInformation mediaInformation = MediaInformationParser.from(MEDIA_INFORMATION_JPG);
Assert.assertNotNull(mediaInformation);
assertMediaInput(mediaInformation, "image2", "sample.jpg");
assertMediaDuration(mediaInformation, "0.040000", "0.000000", "331810000");
Assert.assertNotNull(mediaInformation.getStreams());
Assert.assertEquals(1, mediaInformation.getStreams().size());
assertVideoStream(mediaInformation.getStreams().get(0), 0L, "mjpeg", "Motion JPEG", "yuvj444p", 1496L, 1729L, "1:1", "1496:1729", null, "0/0", "25/1", "1/25", "0/1");
}
@Test
public void mediaInformationGif() {
MediaInformation mediaInformation = MediaInformationParser.from(MEDIA_INFORMATION_GIF);
Assert.assertNotNull(mediaInformation);
assertMediaInput(mediaInformation, "gif", "sample.gif");
assertMediaDuration(mediaInformation, "3.960000", "0.000000", "2023672");
Assert.assertNotNull(mediaInformation.getStreams());
Assert.assertEquals(1, mediaInformation.getStreams().size());
assertVideoStream(mediaInformation.getStreams().get(0), 0L, "gif", "CompuServe GIF (Graphics Interchange Format)", "bgra", 400L, 400L, null, null, null, "133/12", "100/9", "1/100", "12/133");
}
@Test
public void mediaInformationMp4() {
MediaInformation mediaInformation = MediaInformationParser.from(MEDIA_INFORMATION_MP4);
Assert.assertNotNull(mediaInformation);
assertMediaInput(mediaInformation, "mov,mp4,m4a,3gp,3g2,mj2", "sample.mp4");
assertMediaDuration(mediaInformation, "14.000000", "0.000000", "9168090");
assertTag(mediaInformation, "major_brand", "isom");
assertTag(mediaInformation, "minor_version", "512");
assertTag(mediaInformation, "compatible_brands", "isomiso2avc1mp41");
assertTag(mediaInformation, "encoder", "Lavf58.33.100");
Assert.assertNotNull(mediaInformation.getStreams());
Assert.assertEquals(1, mediaInformation.getStreams().size());
assertVideoStream(mediaInformation.getStreams().get(0), 0L, "h264", "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", "yuv420p", 1280L, 720L, "1:1", "16:9", "9166570", "30/1", "30/1", "1/15360", "1/60");
assertStreamTag(mediaInformation.getStreams().get(0), "language", "und");
assertStreamTag(mediaInformation.getStreams().get(0), "handler_name", "VideoHandler");
}
@Test
public void mediaInformationPng() {
MediaInformation mediaInformation = MediaInformationParser.from(MEDIA_INFORMATION_PNG);
Assert.assertNotNull(mediaInformation);
assertMediaInput(mediaInformation, "png_pipe", "sample.png");
assertMediaDuration(mediaInformation, null, null, null);
Assert.assertNotNull(mediaInformation.getStreams());
Assert.assertEquals(1, mediaInformation.getStreams().size());
assertVideoStream(mediaInformation.getStreams().get(0), 0L, "png", "PNG (Portable Network Graphics) image", "pal8", 1198L, 1198L, "1:1", "1:1", null, "0/0", "25/1", "1/25", "0/1");
}
@Test
public void mediaInformationOgg() {
MediaInformation mediaInformation = MediaInformationParser.from(MEDIA_INFORMATION_OGG);
Assert.assertNotNull(mediaInformation);
assertMediaInput(mediaInformation, "ogg", "sample.ogg");
assertMediaDuration(mediaInformation, "32.996875", "0.000000", "6757958");
Assert.assertNotNull(mediaInformation.getStreams());
Assert.assertEquals(2, mediaInformation.getStreams().size());
assertVideoStream(mediaInformation.getStreams().get(0), 0L, "theora", "Theora", "yuv420p", 1920L, 1080L, null, null, null, "25/1", "25/1", "1/25", "1/25");
assertAudioStream(mediaInformation.getStreams().get(1), 1L, "vorbis", "Vorbis", "48000", "stereo", "fltp", "80000");
assertStreamTag(mediaInformation.getStreams().get(0), "ENCODER", "ffmpeg2theora 0.19");
assertStreamTag(mediaInformation.getStreams().get(1), "ENCODER", "ffmpeg2theora 0.19");
}
@Test
public void parseSimpleCommand() {
final String[] argumentArray = FFmpeg.parseArguments("-hide_banner -loop 1 -i file.jpg -filter_complex [0:v]setpts=PTS-STARTPTS[video] -map [video] -vsync 2 -async 1 video.mp4");
Assert.assertNotNull(argumentArray);
Assert.assertEquals(14, argumentArray.length);
Assert.assertEquals("-hide_banner", argumentArray[0]);
Assert.assertEquals("-loop", argumentArray[1]);
Assert.assertEquals("1", argumentArray[2]);
Assert.assertEquals("-i", argumentArray[3]);
Assert.assertEquals("file.jpg", argumentArray[4]);
Assert.assertEquals("-filter_complex", argumentArray[5]);
Assert.assertEquals("[0:v]setpts=PTS-STARTPTS[video]", argumentArray[6]);
Assert.assertEquals("-map", argumentArray[7]);
Assert.assertEquals("[video]", argumentArray[8]);
Assert.assertEquals("-vsync", argumentArray[9]);
Assert.assertEquals("2", argumentArray[10]);
Assert.assertEquals("-async", argumentArray[11]);
Assert.assertEquals("1", argumentArray[12]);
Assert.assertEquals("video.mp4", argumentArray[13]);
}
@Test
public void parseSingleQuotesInCommand() {
String[] argumentArray = FFmpeg.parseArguments("-loop 1 'file one.jpg' -filter_complex '[0:v]setpts=PTS-STARTPTS[video]' -map [video] video.mp4 ");
Assert.assertNotNull(argumentArray);
Assert.assertEquals(8, argumentArray.length);
Assert.assertEquals("-loop", argumentArray[0]);
Assert.assertEquals("1", argumentArray[1]);
Assert.assertEquals("file one.jpg", argumentArray[2]);
Assert.assertEquals("-filter_complex", argumentArray[3]);
Assert.assertEquals("[0:v]setpts=PTS-STARTPTS[video]", argumentArray[4]);
Assert.assertEquals("-map", argumentArray[5]);
Assert.assertEquals("[video]", argumentArray[6]);
Assert.assertEquals("video.mp4", argumentArray[7]);
}
@Test
public void parseDoubleQuotesInCommand() {
String[] argumentArray = FFmpeg.parseArguments("-loop 1 \"file one.jpg\" -filter_complex \"[0:v]setpts=PTS-STARTPTS[video]\" -map [video] video.mp4 ");
Assert.assertNotNull(argumentArray);
Assert.assertEquals(8, argumentArray.length);
Assert.assertEquals("-loop", argumentArray[0]);
Assert.assertEquals("1", argumentArray[1]);
Assert.assertEquals("file one.jpg", argumentArray[2]);
Assert.assertEquals("-filter_complex", argumentArray[3]);
Assert.assertEquals("[0:v]setpts=PTS-STARTPTS[video]", argumentArray[4]);
Assert.assertEquals("-map", argumentArray[5]);
Assert.assertEquals("[video]", argumentArray[6]);
Assert.assertEquals("video.mp4", argumentArray[7]);
argumentArray = FFmpeg.parseArguments(" -i file:///tmp/input.mp4 -vcodec libx264 -vf \"scale=1024:1024,pad=width=1024:height=1024:x=0:y=0:color=black\" -acodec copy -q:v 0 -q:a 0 video.mp4");
Assert.assertNotNull(argumentArray);
Assert.assertEquals(13, argumentArray.length);
Assert.assertEquals("-i", argumentArray[0]);
Assert.assertEquals("file:///tmp/input.mp4", argumentArray[1]);
Assert.assertEquals("-vcodec", argumentArray[2]);
Assert.assertEquals("libx264", argumentArray[3]);
Assert.assertEquals("-vf", argumentArray[4]);
Assert.assertEquals("scale=1024:1024,pad=width=1024:height=1024:x=0:y=0:color=black", argumentArray[5]);
Assert.assertEquals("-acodec", argumentArray[6]);
Assert.assertEquals("copy", argumentArray[7]);
Assert.assertEquals("-q:v", argumentArray[8]);
Assert.assertEquals("0", argumentArray[9]);
Assert.assertEquals("-q:a", argumentArray[10]);
Assert.assertEquals("0", argumentArray[11]);
Assert.assertEquals("video.mp4", argumentArray[12]);
}
@Test
public void parseDoubleQuotesAndEscapesInCommand() {
String[] argumentArray = FFmpeg.parseArguments(" -i file:///tmp/input.mp4 -vf \"subtitles=file:///tmp/subtitles.srt:force_style=\'FontSize=16,PrimaryColour=&HFFFFFF&\'\" -vcodec libx264 -acodec copy -q:v 0 -q:a 0 video.mp4");
Assert.assertNotNull(argumentArray);
Assert.assertEquals(13, argumentArray.length);
Assert.assertEquals("-i", argumentArray[0]);
Assert.assertEquals("file:///tmp/input.mp4", argumentArray[1]);
Assert.assertEquals("-vf", argumentArray[2]);
Assert.assertEquals("subtitles=file:///tmp/subtitles.srt:force_style='FontSize=16,PrimaryColour=&HFFFFFF&'", argumentArray[3]);
Assert.assertEquals("-vcodec", argumentArray[4]);
Assert.assertEquals("libx264", argumentArray[5]);
Assert.assertEquals("-acodec", argumentArray[6]);
Assert.assertEquals("copy", argumentArray[7]);
Assert.assertEquals("-q:v", argumentArray[8]);
Assert.assertEquals("0", argumentArray[9]);
Assert.assertEquals("-q:a", argumentArray[10]);
Assert.assertEquals("0", argumentArray[11]);
Assert.assertEquals("video.mp4", argumentArray[12]);
argumentArray = FFmpeg.parseArguments(" -i file:///tmp/input.mp4 -vf \"subtitles=file:///tmp/subtitles.srt:force_style=\\\"FontSize=16,PrimaryColour=&HFFFFFF&\\\"\" -vcodec libx264 -acodec copy -q:v 0 -q:a 0 video.mp4");
Assert.assertNotNull(argumentArray);
Assert.assertEquals(13, argumentArray.length);
Assert.assertEquals("-i", argumentArray[0]);
Assert.assertEquals("file:///tmp/input.mp4", argumentArray[1]);
Assert.assertEquals("-vf", argumentArray[2]);
Assert.assertEquals("subtitles=file:///tmp/subtitles.srt:force_style=\\\"FontSize=16,PrimaryColour=&HFFFFFF&\\\"", argumentArray[3]);
Assert.assertEquals("-vcodec", argumentArray[4]);
Assert.assertEquals("libx264", argumentArray[5]);
Assert.assertEquals("-acodec", argumentArray[6]);
Assert.assertEquals("copy", argumentArray[7]);
Assert.assertEquals("-q:v", argumentArray[8]);
Assert.assertEquals("0", argumentArray[9]);
Assert.assertEquals("-q:a", argumentArray[10]);
Assert.assertEquals("0", argumentArray[11]);
Assert.assertEquals("video.mp4", argumentArray[12]);
}
@Test
public void argumentsToString() {
Assert.assertEquals("null", argumentsToString(null));
Assert.assertEquals("-i input.mp4 -vf filter -c:v mpeg4 output.mp4", argumentsToString(new String[]{"-i", "input.mp4", "-vf", "filter", "-c:v", "mpeg4", "output.mp4"}));
}
public String argumentsToString(final String[] arguments) {
return FFmpeg.argumentsToString(arguments);
}
private void assertMediaInput(MediaInformation mediaInformation, String format, String filename) {
Assert.assertEquals(format, mediaInformation.getFormat());
Assert.assertEquals(filename, mediaInformation.getFilename());
}
private void assertMediaDuration(MediaInformation mediaInformation, String duration, String startTime, String bitrate) {
Assert.assertEquals(duration, mediaInformation.getDuration());
Assert.assertEquals(startTime, mediaInformation.getStartTime());
Assert.assertEquals(bitrate, mediaInformation.getBitrate());
}
private void assertTag(MediaInformation mediaInformation, String expectedKey, String expectedValue) {
JSONObject tags = mediaInformation.getTags();
Assert.assertNotNull(tags);
try {
String value = tags.getString(expectedKey);
Assert.assertEquals(expectedValue, value);
} catch (JSONException e) {
e.printStackTrace();
Assert.fail(expectedKey + " not found");
}
}
private void assertStreamTag(StreamInformation streamInformation, String expectedKey, String expectedValue) {
JSONObject tags = streamInformation.getTags();
Assert.assertNotNull(tags);
try {
String value = tags.getString(expectedKey);
Assert.assertEquals(expectedValue, value);
} catch (JSONException e) {
e.printStackTrace();
Assert.fail(expectedKey + " not found");
}
}
private void assertStream(StreamInformation streamInformation, Long index, String type, String codec, String fullCodec, String bitrate) {
Assert.assertEquals(index, streamInformation.getIndex());
Assert.assertEquals(type, streamInformation.getType());
Assert.assertEquals(codec, streamInformation.getCodec());
Assert.assertEquals(fullCodec, streamInformation.getFullCodec());
Assert.assertEquals(bitrate, streamInformation.getBitrate());
}
private void assertAudioStream(StreamInformation streamInformation, Long index, String codec, String fullCodec, String sampleRate, String channelLayout, String sampleFormat, String bitrate) {
Assert.assertEquals(index, streamInformation.getIndex());
Assert.assertEquals("audio", streamInformation.getType());
Assert.assertEquals(codec, streamInformation.getCodec());
Assert.assertEquals(fullCodec, streamInformation.getFullCodec());
Assert.assertEquals(sampleRate, streamInformation.getSampleRate());
Assert.assertEquals(channelLayout, streamInformation.getChannelLayout());
Assert.assertEquals(sampleFormat, streamInformation.getSampleFormat());
Assert.assertEquals(bitrate, streamInformation.getBitrate());
}
private void assertVideoStream(StreamInformation streamInformation, Long index, String codec, String fullCodec, String format, Long width, Long height, String sar, String dar, String bitrate, String averageFrameRate, String realFrameRate, String timeBase, String codecTimeBase) {
Assert.assertEquals(index, streamInformation.getIndex());
Assert.assertEquals("video", streamInformation.getType());
Assert.assertEquals(codec, streamInformation.getCodec());
Assert.assertEquals(fullCodec, streamInformation.getFullCodec());
Assert.assertEquals(format, streamInformation.getFormat());
Assert.assertEquals(width, streamInformation.getWidth());
Assert.assertEquals(height, streamInformation.getHeight());
Assert.assertEquals(sar, streamInformation.getSampleAspectRatio());
Assert.assertEquals(dar, streamInformation.getDisplayAspectRatio());
Assert.assertEquals(bitrate, streamInformation.getBitrate());
Assert.assertEquals(averageFrameRate, streamInformation.getAverageFrameRate());
Assert.assertEquals(realFrameRate, streamInformation.getRealFrameRate());
Assert.assertEquals(timeBase, streamInformation.getTimeBase());
Assert.assertEquals(codecTimeBase, streamInformation.getCodecTimeBase());
}
}
+2 -3
View File
@@ -1,14 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.6.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -18,6 +16,7 @@ buildscript {
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
+2
View File
@@ -9,6 +9,8 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
#Thu Mar 15 21:50:32 EET 2018
#Sat May 09 20:36:16 IDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
+56 -44
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
##############################################################################
##
@@ -6,42 +6,6 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
@@ -60,6 +24,46 @@ cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -85,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -150,11 +154,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored Regular → Executable
+4 -10
View File
@@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
+1
View File
@@ -1 +1,2 @@
/Application.mk
/Android.mk.tmp
+94 -42
View File
@@ -1,52 +1,104 @@
LOCAL_PATH := $(call my-dir)
$(call import-add-path, $(LOCAL_PATH))
MY_LOCAL_PATH := $(call my-dir)
$(call import-add-path, $(MY_LOCAL_PATH))
MY_ARMV7 := false
MY_ARMV7_NEON := false
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
ifeq ("$(shell test -e $(MY_LOCAL_PATH)/../build/.armv7 && echo armv7)","armv7")
MY_ARMV7 := true
endif
ifeq ("$(shell test -e $(MY_LOCAL_PATH)/../build/.armv7neon && echo armv7neon)","armv7neon")
MY_ARMV7_NEON := true
endif
endif
ifeq ($(MY_ARMV7_NEON), true)
FFMPEG_INCLUDES := $(MY_LOCAL_PATH)/../../prebuilt/android-$(TARGET_ARCH)/neon/ffmpeg/include
$(call import-module, cpu-features/neon)
else
FFMPEG_INCLUDES := $(MY_LOCAL_PATH)/../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/include
$(call import-module, cpu-features)
endif
MY_ARM_MODE := arm
MY_PATH := ../app/src/main/cpp
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := cpufeatures
LOCAL_SRC_FILES := $(NDK_ROOT)/sources/android/cpufeatures/cpu-features.c
LOCAL_CFLAGS := -Wall -Wextra -Werror
LOCAL_EXPORT_C_INCLUDES := $(NDK_ROOT)/sources/android/cpufeatures
LOCAL_EXPORT_LDLIBS := -ldl
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := mobileffmpeg-abidetect
LOCAL_SRC_FILES := $(MY_PATH)/mobileffmpeg_abidetect.c
LOCAL_CFLAGS := -Wall -Wextra -Werror -Wno-unused-parameter -I${LOCAL_PATH}/../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/include -I$(NDK_ROOT)/sources/android/cpufeatures
LOCAL_LDLIBS := -llog -lz -landroid
LOCAL_SHARED_LIBRARIES := cpufeatures
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := mobileffmpeg
LOCAL_SRC_FILES := $(MY_PATH)/mobileffmpeg.c $(MY_PATH)/fftools_cmdutils.c $(MY_PATH)/fftools_ffmpeg.c $(MY_PATH)/fftools_ffmpeg_opt.c $(MY_PATH)/fftools_ffmpeg_hw.c $(MY_PATH)/fftools_ffmpeg_filter.c
LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter -Wno-switch -Wno-sign-compare -I${LOCAL_PATH}/../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/include
LOCAL_LDLIBS := -llog -lz -landroid
LOCAL_SHARED_LIBRARIES := c++_shared libavfilter libavformat libavcodec libavutil libswresample libavdevice libswscale
include $(BUILD_SHARED_LIBRARY)
MY_ARM_NEON := false
LOCAL_PATH := $(MY_LOCAL_PATH)/../app/src/main/cpp
# DEFINE ARCH FLAGS
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
ifeq ("$(shell test -e $(LOCAL_PATH)/../build/.neon && echo neon)","neon")
MY_ARCH_FLAGS := ARM_V7A
MY_ARM_NEON := false
endif
ifeq ($(TARGET_ARCH_ABI), arm64-v8a)
MY_ARCH_FLAGS := ARM64_V8A
MY_ARM_NEON := true
endif
ifeq ($(TARGET_ARCH_ABI), x86)
MY_ARCH_FLAGS := X86
endif
ifeq ($(TARGET_ARCH_ABI), x86_64)
MY_ARCH_FLAGS := X86_64
endif
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := mobileffmpeg-armv7a-neon
LOCAL_SRC_FILES := $(MY_PATH)/mobileffmpeg.c $(MY_PATH)/fftools_cmdutils.c $(MY_PATH)/fftools_ffmpeg.c $(MY_PATH)/fftools_ffmpeg_opt.c $(MY_PATH)/fftools_ffmpeg_hw.c $(MY_PATH)/fftools_ffmpeg_filter.c
LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter -Wno-switch -Wno-sign-compare -I${LOCAL_PATH}/../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/include
LOCAL_LDLIBS := -llog -lz -landroid
LOCAL_SHARED_LIBRARIES := c++_shared libavcodec-neon libavfilter-neon libswscale-neon libavformat libavutil libswresample libavdevice
LOCAL_ARM_NEON := true
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := mobileffmpeg_abidetect
LOCAL_SRC_FILES := mobileffmpeg_abidetect.c
LOCAL_CFLAGS := -Wall -Wextra -Werror -Wno-unused-parameter -DMOBILE_FFMPEG_${MY_ARCH_FLAGS}
LOCAL_C_INCLUDES := $(FFMPEG_INCLUDES)
LOCAL_LDLIBS := -llog -lz -landroid
LOCAL_STATIC_LIBRARIES := cpu-features
LOCAL_ARM_NEON := ${MY_ARM_NEON}
include $(BUILD_SHARED_LIBRARY)
$(call import-module, ffmpeg/neon)
ifeq ($(TARGET_PLATFORM),android-16)
MY_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c
else ifeq ($(TARGET_PLATFORM),android-17)
MY_SRC_FILES := mobileffmpeg.c mobileffprobe.c android_lts_support.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c
else
MY_SRC_FILES := mobileffmpeg.c mobileffprobe.c mobileffmpeg_exception.c fftools_cmdutils.c fftools_ffmpeg.c fftools_ffprobe.c fftools_ffmpeg_opt.c fftools_ffmpeg_hw.c fftools_ffmpeg_filter.c
endif
MY_CFLAGS := -Wall -Werror -Wno-unused-parameter -Wno-switch -Wno-sign-compare
MY_LDLIBS := -llog -lz -landroid
MY_BUILD_GENERIC_MOBILE_FFMPEG := true
ifeq ($(MY_ARMV7_NEON), true)
include $(CLEAR_VARS)
LOCAL_PATH := $(MY_LOCAL_PATH)/../app/src/main/cpp
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := mobileffmpeg_armv7a_neon
LOCAL_SRC_FILES := $(MY_SRC_FILES)
LOCAL_CFLAGS := $(MY_CFLAGS)
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_SHARED_LIBRARIES := libavcodec_neon libavfilter_neon libswscale_neon libavformat_neon libavutil_neon libswresample_neon libavdevice_neon
ifeq ($(APP_STL), c++_shared)
LOCAL_SHARED_LIBRARIES += c++_shared # otherwise NDK will not add the library for packaging
endif
LOCAL_ARM_NEON := true
include $(BUILD_SHARED_LIBRARY)
$(call import-module, ffmpeg/neon)
ifneq ($(MY_ARMV7), true)
MY_BUILD_GENERIC_MOBILE_FFMPEG := false
endif
endif
$(call import-module, ffmpeg)
ifeq ($(MY_BUILD_GENERIC_MOBILE_FFMPEG), true)
include $(CLEAR_VARS)
LOCAL_PATH := $(MY_LOCAL_PATH)/../app/src/main/cpp
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := mobileffmpeg
LOCAL_SRC_FILES := $(MY_SRC_FILES)
LOCAL_CFLAGS := $(MY_CFLAGS)
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_SHARED_LIBRARIES := libavfilter libavformat libavcodec libavutil libswresample libavdevice libswscale
ifeq ($(APP_STL), c++_shared)
LOCAL_SHARED_LIBRARIES += c++_shared # otherwise NDK will not add the library for packaging
endif
LOCAL_ARM_NEON := ${MY_ARM_NEON}
include $(BUILD_SHARED_LIBRARY)
$(call import-module, ffmpeg)
endif
+8
View File
@@ -0,0 +1,8 @@
LOCAL_PATH := $(call my-dir)/../../../prebuilt/android-$(TARGET_ARCH)/cpu-features/lib
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := cpu-features
LOCAL_SRC_FILES := libndk_compat.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include/ndk_compat
include $(PREBUILT_STATIC_LIBRARY)
+8
View File
@@ -0,0 +1,8 @@
LOCAL_PATH := $(call my-dir)/../../../../prebuilt/android-$(TARGET_ARCH)/neon/cpu-features/lib
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := cpu-features
LOCAL_SRC_FILES := libndk_compat.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include/ndk_compat
include $(PREBUILT_STATIC_LIBRARY)
+9 -9
View File
@@ -1,46 +1,46 @@
LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(call my-dir)/../../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/lib
MY_ARM_MODE := arm
MY_FFMPEG_LIB := ../../../prebuilt/android-$(TARGET_ARCH)/ffmpeg/lib
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libavcodec
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libavcodec.so
LOCAL_SRC_FILES := libavcodec.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libavfilter
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libavfilter.so
LOCAL_SRC_FILES := libavfilter.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libavdevice
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libavdevice.so
LOCAL_SRC_FILES := libavdevice.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libavformat
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libavformat.so
LOCAL_SRC_FILES := libavformat.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libavutil
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libavutil.so
LOCAL_SRC_FILES := libavutil.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libswresample
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libswresample.so
LOCAL_SRC_FILES := libswresample.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libswscale
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libswscale.so
LOCAL_SRC_FILES := libswscale.so
include $(PREBUILT_SHARED_LIBRARY)
+24 -16
View File
@@ -1,53 +1,61 @@
LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(call my-dir)/../../../../prebuilt/android-$(TARGET_ARCH)/neon/ffmpeg/lib
MY_ARM_MODE := arm
MY_FFMPEG_LIB := ../../../../prebuilt/android-$(TARGET_ARCH)/neon/ffmpeg/lib
MY_ARM_NEON := true
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libavcodec-neon
LOCAL_ARM_NEON := ${MY_ARM_NEON}
LOCAL_MODULE := libavcodec_neon
LOCAL_MODULE_FILENAME := $(LOCAL_MODULE)
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libavcodec.so
LOCAL_SRC_FILES := libavcodec_neon.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libavfilter-neon
LOCAL_ARM_NEON := ${MY_ARM_NEON}
LOCAL_MODULE := libavfilter_neon
LOCAL_MODULE_FILENAME := $(LOCAL_MODULE)
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libavfilter.so
LOCAL_SRC_FILES := libavfilter_neon.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libavdevice-neon
LOCAL_ARM_NEON := ${MY_ARM_NEON}
LOCAL_MODULE := libavdevice_neon
LOCAL_MODULE_FILENAME := $(LOCAL_MODULE)
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libavdevice.so
LOCAL_SRC_FILES := libavdevice_neon.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libavformat-neon
LOCAL_ARM_NEON := ${MY_ARM_NEON}
LOCAL_MODULE := libavformat_neon
LOCAL_MODULE_FILENAME := $(LOCAL_MODULE)
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libavformat.so
LOCAL_SRC_FILES := libavformat_neon.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libavutil-neon
LOCAL_ARM_NEON := ${MY_ARM_NEON}
LOCAL_MODULE := libavutil_neon
LOCAL_MODULE_FILENAME := $(LOCAL_MODULE)
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libavutil.so
LOCAL_SRC_FILES := libavutil_neon.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libswresample-neon
LOCAL_ARM_NEON := ${MY_ARM_NEON}
LOCAL_MODULE := libswresample_neon
LOCAL_MODULE_FILENAME := $(LOCAL_MODULE)
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libswresample.so
LOCAL_SRC_FILES := libswresample_neon.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := $(MY_ARM_MODE)
LOCAL_MODULE := libswscale-neon
LOCAL_ARM_NEON := ${MY_ARM_NEON}
LOCAL_MODULE := libswscale_neon
LOCAL_MODULE_FILENAME := $(LOCAL_MODULE)
LOCAL_SRC_FILES := $(MY_FFMPEG_LIB)/libswscale.so
LOCAL_SRC_FILES := libswscale_neon.so
include $(PREBUILT_SHARED_LIBRARY)
+3
View File
@@ -1 +1,4 @@
include ':app', ':test-app'
include ':mobile-ffmpeg'
project(':mobile-ffmpeg').projectDir = new File('..')
rootProject.name='Mobile FFmpeg (android)'
-4
View File
@@ -1,4 +0,0 @@
/build
/.idea/
/gradle/
/local.properties
+45 -17
View File
@@ -1,31 +1,59 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
signingConfigs {
localConfig {
keyAlias 'androiddebugkey'
storeFile file(System.getProperty("user.home") + '/.android/debug.keystore')
storePassword 'android'
keyPassword 'android'
}
}
compileSdkVersion 29
defaultConfig {
applicationId "com.arthenica.mobileffmpeg.test"
minSdkVersion 21
targetSdkVersion 27
versionCode 21
versionName "2.1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
minSdkVersion 16
targetSdkVersion 29
versionCode 160440
versionName "4.4.LTS"
}
buildTypes {
release {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.localConfig
}
}
splits {
abi {
enable true
reset()
include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
universalApk false
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.arthenica:mobile-ffmpeg-full:2.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
ext.abiCodes = ['x86':1, 'x86_64':2, 'armeabi-v7a':3, 'arm64-v8a':4]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->
variant.outputs.each {
output ->
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
output.versionCodeOverride = baseAbiVersionCode + variant.versionCode
}
}
dependencies {
// implementation project(':app')
implementation 'com.arthenica:mobile-ffmpeg-full:4.4.LTS'
implementation 'com.arthenica:smart-exception-java:0.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
Vendored Executable
+172
View File
@@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored Executable
+84
View File
@@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
-15
View File
@@ -4,18 +4,3 @@
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -1,45 +0,0 @@
/*
* Copyright (c) 2018 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg.test;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.arthenica.mobileffmpeg.test", appContext.getPackageName());
}
}
@@ -7,18 +7,20 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<application
android:allowBackup="true"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:largeHeap="true"
android:theme="@style/AppTheme"
tools:replace="android:icon">
<activity android:name="com.arthenica.mobileffmpeg.test.MainActivity"
android:theme="@style/AppTheme">
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.arthenica.mobileffmpeg.test.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@@ -21,91 +21,81 @@ package com.arthenica.mobileffmpeg.test;
import android.app.AlertDialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.FFmpeg;
import com.arthenica.mobileffmpeg.LogCallback;
import com.arthenica.mobileffmpeg.LogMessage;
import com.arthenica.mobileffmpeg.util.RunCallback;
import com.arthenica.mobileffmpeg.util.DialogUtil;
import com.arthenica.mobileffmpeg.ExecuteCallback;
import java.io.File;
import java.util.concurrent.Callable;
import static com.arthenica.mobileffmpeg.FFmpeg.RETURN_CODE_SUCCESS;
import static com.arthenica.mobileffmpeg.Config.RETURN_CODE_SUCCESS;
import static com.arthenica.mobileffmpeg.test.MainActivity.TAG;
public class AudioTabFragment extends Fragment implements AdapterView.OnItemSelectedListener {
private MainActivity mainActivity;
private AlertDialog progressDialog;
private Button encodeButton;
private TextView outputText;
private String selectedCodec;
@Override
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_audio_tab, container, false);
public AudioTabFragment() {
super(R.layout.fragment_audio_tab);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (getView() != null) {
Spinner audioCodecSpinner = getView().findViewById(R.id.audioCodecSpinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(mainActivity,
R.array.audio_codec, R.layout.spinner_item);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
audioCodecSpinner.setAdapter(adapter);
audioCodecSpinner.setOnItemSelectedListener(this);
Spinner audioCodecSpinner = view.findViewById(R.id.audioCodecSpinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(requireContext(),
R.array.audio_codec, R.layout.spinner_item);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
audioCodecSpinner.setAdapter(adapter);
audioCodecSpinner.setOnItemSelectedListener(this);
encodeButton = getView().findViewById(R.id.encodeButton);
encodeButton.setOnClickListener(new View.OnClickListener() {
encodeButton = view.findViewById(R.id.encodeButton);
encodeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
encodeAudio();
}
});
encodeButton.setEnabled(false);
@Override
public void onClick(View v) {
encodeAudio();
// encodeChromaprint();
}
});
encodeButton.setEnabled(false);
outputText = getView().findViewById(R.id.outputText);
outputText.setMovementMethod(new ScrollingMovementMethod());
}
outputText = view.findViewById(R.id.outputText);
outputText.setMovementMethod(new ScrollingMovementMethod());
progressDialog = mainActivity.createProgressDialog("Encoding audio");
progressDialog = DialogUtil.createProgressDialog(requireContext(), "Encoding audio");
selectedCodec = getResources().getStringArray(R.array.audio_codec)[0];
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
setActive();
}
public void onResume() {
super.onResume();
setActive();
}
public void setMainActivity(MainActivity mainActivity) {
this.mainActivity = mainActivity;
}
public static AudioTabFragment newInstance(final MainActivity mainActivity) {
final AudioTabFragment fragment = new AudioTabFragment();
fragment.setMainActivity(mainActivity);
return fragment;
public static AudioTabFragment newInstance() {
return new AudioTabFragment();
}
public void enableLogCallback() {
@@ -113,7 +103,7 @@ public class AudioTabFragment extends Fragment implements AdapterView.OnItemSele
@Override
public void apply(final LogMessage message) {
MainActivity.addUIAction(new Callable() {
MainActivity.addUIAction(new Callable<Object>() {
@Override
public Object call() {
@@ -155,26 +145,26 @@ public class AudioTabFragment extends Fragment implements AdapterView.OnItemSele
clearLog();
android.util.Log.d(TAG, String.format("FFmpeg process started with arguments\n'%s'", ffmpegCommand));
android.util.Log.d(TAG, String.format("FFmpeg process started with arguments\n'%s'.", ffmpegCommand));
MainActivity.executeAsync(new RunCallback() {
MainActivity.executeAsync(new ExecuteCallback() {
@Override
public void apply(final int returnCode) {
android.util.Log.d(TAG, String.format("FFmpeg process exited with rc %d", returnCode));
public void apply(final long executionId, final int returnCode) {
android.util.Log.d(TAG, String.format("FFmpeg process exited with rc %d.", returnCode));
hideProgressDialog();
MainActivity.addUIAction(new Callable() {
MainActivity.addUIAction(new Callable<Object>() {
@Override
public Object call() {
if (returnCode == RETURN_CODE_SUCCESS) {
Popup.show(mainActivity, "Encode completed successfully.");
Popup.show(requireContext(), "Encode completed successfully.");
android.util.Log.d(TAG, "Encode completed successfully.");
} else {
Popup.show(mainActivity, "Encode failed. Please check log for the details.");
android.util.Log.d(TAG, String.format("Encode failed with rc=%d", returnCode));
Popup.show(requireContext(), "Encode failed. Please check log for the details.");
android.util.Log.d(TAG, String.format("Encode failed with rc=%d.", returnCode));
}
return null;
@@ -184,6 +174,20 @@ public class AudioTabFragment extends Fragment implements AdapterView.OnItemSele
}, ffmpegCommand);
}
protected void encodeChromaprint() {
File audioSampleFile = getAudioSampleFile();
Log.d(TAG, "Testing AUDIO encoding with 'chromaprint' muxer");
final String ffmpegCommand = String.format("-v quiet -i %s -f chromaprint -fp_format 2 -", audioSampleFile.getAbsolutePath());
Log.d(TAG, String.format("FFmpeg process started with arguments\n'%s'.", ffmpegCommand));
int returnCode = FFmpeg.execute(ffmpegCommand);
Log.d(TAG, String.format("FFmpeg process exited with rc %d.", returnCode));
}
public void createAudioSample() {
android.util.Log.d(TAG, "Creating AUDIO sample before the test.");
@@ -192,17 +196,17 @@ public class AudioTabFragment extends Fragment implements AdapterView.OnItemSele
audioSampleFile.delete();
}
String ffmpegCommand = String.format("-y -f lavfi -i sine=frequency=1000:duration=5 -c:a pcm_s16le %s", audioSampleFile.getAbsolutePath());
String ffmpegCommand = String.format("-hide_banner -y -f lavfi -i sine=frequency=1000:duration=5 -c:a pcm_s16le %s", audioSampleFile.getAbsolutePath());
android.util.Log.d(TAG, String.format("Sample file is created with '%s'", ffmpegCommand));
android.util.Log.d(TAG, String.format("Sample file is created with '%s'.", ffmpegCommand));
int result = FFmpeg.execute(ffmpegCommand);
if (result == 0) {
encodeButton.setEnabled(true);
android.util.Log.d(TAG, "AUDIO sample created");
} else {
android.util.Log.d(TAG, String.format("Creating AUDIO sample failed with rc=%d", result));
Popup.show(mainActivity, "Creating AUDIO sample failed. Please check log for the details.");
android.util.Log.d(TAG, String.format("Creating AUDIO sample failed with rc=%d.", result));
Popup.show(requireContext(), "Creating AUDIO sample failed. Please check log for the details.");
}
}
@@ -211,6 +215,9 @@ public class AudioTabFragment extends Fragment implements AdapterView.OnItemSele
String extension;
switch (audioCodec) {
case "mp2 (twolame)":
extension = "mpg";
break;
case "mp3 (liblame)":
case "mp3 (libshine)":
extension = "mp3";
@@ -221,7 +228,10 @@ public class AudioTabFragment extends Fragment implements AdapterView.OnItemSele
case "opus":
extension = "opus";
break;
case "amr":
case "amr-nb":
extension = "amr";
break;
case "amr-wb":
extension = "amr";
break;
case "ilbc":
@@ -241,11 +251,11 @@ public class AudioTabFragment extends Fragment implements AdapterView.OnItemSele
}
final String audio = "audio." + extension;
return new File(mainActivity.getFilesDir(), audio);
return new File(requireContext().getFilesDir(), audio);
}
public File getAudioSampleFile() {
return new File(mainActivity.getFilesDir(), "audio-sample.wav");
return new File(requireContext().getFilesDir(), "audio-sample.wav");
}
public void setActive() {
@@ -253,7 +263,7 @@ public class AudioTabFragment extends Fragment implements AdapterView.OnItemSele
disableLogCallback();
createAudioSample();
enableLogCallback();
Popup.show(mainActivity, Tooltip.AUDIO_TEST_TOOLTIP_TEXT);
Popup.show(requireContext(), Tooltip.AUDIO_TEST_TOOLTIP_TEXT);
}
public void appendLog(final String logMessage) {
@@ -278,26 +288,30 @@ public class AudioTabFragment extends Fragment implements AdapterView.OnItemSele
String audioOutputFile = getAudioOutputFile().getAbsolutePath();
switch (audioCodec) {
case "mp2 (twolame)":
return String.format("-hide_banner -y -i %s -c:a mp2 -b:a 192k %s", audioSampleFile, audioOutputFile);
case "mp3 (liblame)":
return String.format("-y -i %s -c:a libmp3lame -qscale:a 2 %s", audioSampleFile, audioOutputFile);
return String.format("-hide_banner -y -i %s -c:a libmp3lame -qscale:a 2 %s", audioSampleFile, audioOutputFile);
case "mp3 (libshine)":
return String.format("-y -i %s -c:a libshine -qscale:a 2 %s", audioSampleFile, audioOutputFile);
return String.format("-hide_banner -y -i %s -c:a libshine -qscale:a 2 %s", audioSampleFile, audioOutputFile);
case "vorbis":
return String.format("-y -i %s -c:a libvorbis -b:a 64k %s", audioSampleFile, audioOutputFile);
return String.format("-hide_banner -y -i %s -c:a libvorbis -b:a 64k %s", audioSampleFile, audioOutputFile);
case "opus":
return String.format("-y -i %s -c:a libopus -b:a 64k -vbr on -compression_level 10 %s", audioSampleFile, audioOutputFile);
case "amr":
return String.format("-y -i %s -ar 8000 -ab 12.2k %s", audioSampleFile, audioOutputFile);
return String.format("-hide_banner -y -i %s -c:a libopus -b:a 64k -vbr on -compression_level 10 %s", audioSampleFile, audioOutputFile);
case "amr-nb":
return String.format("-hide_banner -y -i %s -ar 8000 -ab 12.2k -c:a libopencore_amrnb %s", audioSampleFile, audioOutputFile);
case "amr-wb":
return String.format("-hide_banner -y -i %s -ar 8000 -ab 12.2k -c:a libvo_amrwbenc -strict experimental %s", audioSampleFile, audioOutputFile);
case "ilbc":
return String.format("-y -i %s -c:a ilbc -ar 8000 -b:a 15200 %s", audioSampleFile, audioOutputFile);
return String.format("-hide_banner -y -i %s -c:a ilbc -ar 8000 -b:a 15200 %s", audioSampleFile, audioOutputFile);
case "speex":
return String.format("-y -i %s -c:a libspeex -ar 16000 %s", audioSampleFile, audioOutputFile);
return String.format("-hide_banner -y -i %s -c:a libspeex -ar 16000 %s", audioSampleFile, audioOutputFile);
case "wavpack":
return String.format("-y -i %s -c:a wavpack -b:a 64k %s", audioSampleFile, audioOutputFile);
return String.format("-hide_banner -y -i %s -c:a wavpack -b:a 64k %s", audioSampleFile, audioOutputFile);
default:
// soxr
return String.format("-y -i %s -af aresample=resampler=soxr -ar 44100 %s", audioSampleFile, audioOutputFile);
return String.format("-hide_banner -y -i %s -af aresample=resampler=soxr -ar 44100 %s", audioSampleFile, audioOutputFile);
}
}
@@ -20,81 +20,72 @@
package com.arthenica.mobileffmpeg.test;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.util.AndroidRuntimeException;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.FFmpeg;
import com.arthenica.mobileffmpeg.FFprobe;
import com.arthenica.mobileffmpeg.LogCallback;
import com.arthenica.mobileffmpeg.LogMessage;
import com.arthenica.mobileffmpeg.util.RunCallback;
import java.util.concurrent.Callable;
public class CommandTabFragment extends Fragment {
private MainActivity mainActivity;
private EditText commandText;
private TextView outputText;
@Override
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_command_tab, container, false);
public CommandTabFragment() {
super(R.layout.fragment_command_tab);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (getView() != null) {
commandText = getView().findViewById(R.id.commandText);
commandText = view.findViewById(R.id.commandText);
View runButton = getView().findViewById(R.id.runButton);
runButton.setOnClickListener(new View.OnClickListener() {
View runFFmpegButton = view.findViewById(R.id.runFFmpegButton);
runFFmpegButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
runFFmpeg();
}
});
@Override
public void onClick(View v) {
runFFmpeg();
}
});
View runAsyncButton = getView().findViewById(R.id.runAsyncButton);
runAsyncButton.setOnClickListener(new View.OnClickListener() {
View runFFprobeButton = view.findViewById(R.id.runFFprobeButton);
runFFprobeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
runFFmpegAsync();
}
});
@Override
public void onClick(View v) {
runFFprobe();
}
});
outputText = getView().findViewById(R.id.outputText);
outputText.setMovementMethod(new ScrollingMovementMethod());
}
outputText = view.findViewById(R.id.outputText);
outputText.setMovementMethod(new ScrollingMovementMethod());
Log.d(MainActivity.TAG, "Last command output was: " + Config.getLastCommandOutput());
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
setActive();
}
public void onResume() {
super.onResume();
setActive();
}
public void setMainActivity(MainActivity mainActivity) {
this.mainActivity = mainActivity;
}
public static CommandTabFragment newInstance(final MainActivity mainActivity) {
final CommandTabFragment fragment = new CommandTabFragment();
fragment.setMainActivity(mainActivity);
return fragment;
public static CommandTabFragment newInstance() {
return new CommandTabFragment();
}
public void enableLogCallback() {
@@ -110,6 +101,8 @@ public class CommandTabFragment extends Fragment {
return null;
}
});
throw new AndroidRuntimeException("I am test exception thrown by test application");
}
});
}
@@ -117,55 +110,45 @@ public class CommandTabFragment extends Fragment {
public void runFFmpeg() {
clearLog();
final String ffmpegCommand = commandText.getText().toString();
final String ffmpegCommand = String.format("%s", commandText.getText().toString());
android.util.Log.d(MainActivity.TAG, "Testing COMMAND synchronously.");
android.util.Log.d(MainActivity.TAG, String.format("Current log level is %s.", Config.getLogLevel()));
android.util.Log.d(MainActivity.TAG, "Testing FFmpeg COMMAND synchronously.");
android.util.Log.d(MainActivity.TAG, String.format("FFmpeg process started with arguments\n\'%s\'", ffmpegCommand));
int result = FFmpeg.execute(ffmpegCommand);
android.util.Log.d(MainActivity.TAG, String.format("FFmpeg process exited with rc %d", result));
android.util.Log.d(MainActivity.TAG, String.format("FFmpeg process exited with rc %d.", result));
if (result != 0) {
Popup.show(mainActivity, "Command failed. Please check output for the details.");
Popup.show(requireContext(), "Command failed. Please check output for the details.");
}
}
public void runFFmpegAsync() {
public void runFFprobe() {
clearLog();
final String ffmpegCommand = commandText.getText().toString();
final String ffprobeCommand = String.format("%s", commandText.getText().toString());
android.util.Log.d(MainActivity.TAG, "Testing COMMAND asynchronously.");
android.util.Log.d(MainActivity.TAG, "Testing FFprobe COMMAND synchronously.");
android.util.Log.d(MainActivity.TAG, String.format("FFmpeg process started with arguments\n\'%s\'", ffmpegCommand));
android.util.Log.d(MainActivity.TAG, String.format("FFprobe process started with arguments\n\'%s\'", ffprobeCommand));
MainActivity.executeAsync(new RunCallback() {
int result = FFprobe.execute(ffprobeCommand);
@Override
public void apply(int result) {
android.util.Log.d(MainActivity.TAG, String.format("FFprobe process exited with rc %d.", result));
android.util.Log.d(MainActivity.TAG, String.format("FFmpeg process exited with rc %d", result));
if (result != 0) {
MainActivity.addUIAction(new Callable() {
@Override
public Object call() {
Popup.show(mainActivity, "Command failed. Please check output for the details.");
return null;
}
});
}
}
}, ffmpegCommand);
if (result != 0) {
Popup.show(requireContext(), "Command failed. Please check output for the details.");
}
}
public void setActive() {
android.util.Log.i(MainActivity.TAG, "Command Tab Activated");
private void setActive() {
Log.i(MainActivity.TAG, "Command Tab Activated");
enableLogCallback();
Popup.show(mainActivity, Tooltip.COMMAND_TEST_TOOLTIP_TEXT);
Popup.show(requireContext(), Tooltip.COMMAND_TEST_TOOLTIP_TEXT);
}
public void appendLog(final String logMessage) {
@@ -0,0 +1,273 @@
/*
* Copyright (c) 2020 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg.test;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.ExecuteCallback;
import com.arthenica.mobileffmpeg.FFmpeg;
import com.arthenica.mobileffmpeg.FFmpegExecution;
import com.arthenica.mobileffmpeg.LogCallback;
import com.arthenica.mobileffmpeg.LogMessage;
import com.arthenica.mobileffmpeg.util.ResourcesUtil;
import com.arthenica.smartexception.java.Exceptions;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.Callable;
import static com.arthenica.mobileffmpeg.Config.RETURN_CODE_CANCEL;
import static com.arthenica.mobileffmpeg.test.MainActivity.TAG;
public class ConcurrentExecutionTabFragment extends Fragment {
private TextView outputText;
private long executionId1;
private long executionId2;
private long executionId3;
public ConcurrentExecutionTabFragment() {
super(R.layout.fragment_concurrent_tab);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
View encodeButton1 = view.findViewById(R.id.encodeButton1);
if (encodeButton1 != null) {
encodeButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
encodeVideo(1);
}
});
}
View encodeButton2 = view.findViewById(R.id.encodeButton2);
if (encodeButton2 != null) {
encodeButton2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
encodeVideo(2);
}
});
}
View encodeButton3 = view.findViewById(R.id.encodeButton3);
if (encodeButton3 != null) {
encodeButton3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
encodeVideo(3);
}
});
}
View cancelButton1 = view.findViewById(R.id.cancelButton1);
if (cancelButton1 != null) {
cancelButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancel(1);
}
});
}
View cancelButton2 = view.findViewById(R.id.cancelButton2);
if (cancelButton2 != null) {
cancelButton2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancel(2);
}
});
}
View cancelButton3 = view.findViewById(R.id.cancelButton3);
if (cancelButton3 != null) {
cancelButton3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancel(3);
}
});
}
View cancelButtonAll = view.findViewById(R.id.cancelButtonAll);
if (cancelButtonAll != null) {
cancelButtonAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancel(0);
}
});
}
outputText = view.findViewById(R.id.outputText);
outputText.setMovementMethod(new ScrollingMovementMethod());
}
@Override
public void onResume() {
super.onResume();
setActive();
}
public static ConcurrentExecutionTabFragment newInstance() {
return new ConcurrentExecutionTabFragment();
}
public void enableLogCallback() {
Config.enableLogCallback(new LogCallback() {
@Override
public void apply(final LogMessage message) {
MainActivity.addUIAction(new Callable<Object>() {
@Override
public Object call() {
appendLog(String.format(Locale.getDefault(), "%d:%s", message.getExecutionId(), message.getText()));
return null;
}
});
}
});
}
public void encodeVideo(final int buttonNumber) {
final File image1File = new File(requireContext().getCacheDir(), "colosseum.jpg");
final File image2File = new File(requireContext().getCacheDir(), "pyramid.jpg");
final File image3File = new File(requireContext().getCacheDir(), "tajmahal.jpg");
final File videoFile = new File(requireContext().getFilesDir(), String.format(Locale.getDefault(), "video%d.mp4", buttonNumber));
try {
Log.d(TAG, String.format("Testing CONCURRENT EXECUTION for button %d.", buttonNumber));
ResourcesUtil.resourceToFile(getResources(), R.drawable.colosseum, image1File);
ResourcesUtil.resourceToFile(getResources(), R.drawable.pyramid, image2File);
ResourcesUtil.resourceToFile(getResources(), R.drawable.tajmahal, image3File);
final String ffmpegCommand = Video.generateEncodeVideoScript(image1File.getAbsolutePath(), image2File.getAbsolutePath(), image3File.getAbsolutePath(), videoFile.getAbsolutePath(), "mpeg4", "");
Log.d(TAG, String.format("FFmpeg process starting for button %d with arguments\n'%s'.", buttonNumber, ffmpegCommand));
long executionId = FFmpeg.executeAsync(ffmpegCommand, new ExecuteCallback() {
@Override
public void apply(final long executionId, final int returnCode) {
if (returnCode == RETURN_CODE_CANCEL) {
Log.d(TAG, String.format("FFmpeg process ended with cancel for button %d with executionId %d.", buttonNumber, executionId));
} else {
Log.d(TAG, String.format("FFmpeg process ended with rc %d for button %d with executionId %d.", returnCode, buttonNumber, executionId));
}
}
});
Log.d(TAG, String.format("Async FFmpeg process started for button %d with executionId %d.", buttonNumber, executionId));
switch (buttonNumber) {
case 1: {
executionId1 = executionId;
}
break;
case 2: {
executionId2 = executionId;
}
break;
default: {
executionId3 = executionId;
}
}
} catch (IOException e) {
Log.e(TAG, String.format("Encode video failed %s.", Exceptions.getStackTraceString(e)));
Popup.show(requireContext(), "Encode video failed");
}
listFFmpegExecutions();
}
public void listFFmpegExecutions() {
final List<FFmpegExecution> ffmpegExecutions = FFmpeg.listExecutions();
Log.d(TAG, "Listing ongoing FFmpeg executions.");
for (int i = 0; i < ffmpegExecutions.size(); i++) {
FFmpegExecution execution = ffmpegExecutions.get(i);
Log.d(TAG, String.format("Execution %d = id:%d, startTime:%s, command:%s.", i, execution.getExecutionId(), execution.getStartTime(), execution.getCommand()));
}
Log.d(TAG, "Listed ongoing FFmpeg executions.");
}
public void cancel(final int buttonNumber) {
long executionId = 0;
switch (buttonNumber) {
case 1: {
executionId = executionId1;
}
break;
case 2: {
executionId = executionId2;
}
break;
case 3: {
executionId = executionId3;
}
}
Log.d(TAG, String.format("Cancelling FFmpeg process for button %d with executionId %d.", buttonNumber, executionId));
if (executionId == 0) {
FFmpeg.cancel();
} else {
FFmpeg.cancel(executionId);
}
}
public void setActive() {
Log.i(MainActivity.TAG, "Concurrent Execution Tab Activated");
enableLogCallback();
Popup.show(requireContext(), Tooltip.CONCURRENT_EXECUTION_TEST_TOOLTIP_TEXT);
}
public void appendLog(final String logMessage) {
outputText.append(logMessage);
}
}
@@ -20,73 +20,66 @@
package com.arthenica.mobileffmpeg.test;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.FFmpeg;
import com.arthenica.mobileffmpeg.FFprobe;
import com.arthenica.mobileffmpeg.LogCallback;
import com.arthenica.mobileffmpeg.LogMessage;
import com.arthenica.mobileffmpeg.MediaInformation;
import com.arthenica.mobileffmpeg.StreamInformation;
import org.json.JSONObject;
import java.util.Iterator;
import java.util.concurrent.Callable;
public class HttpsTabFragment extends Fragment {
public static final String HTTPS_TEST_DEFAULT_URL = "https://download.blender.org/peach/trailer/trailer_400p.ogg";
public static final String HTTPS_TEST_DEFAULT_URL = "https://download.blender.org/peach/trailer/trailer_1080p.ogg";
private MainActivity mainActivity;
private EditText urlText;
private TextView outputText;
@Override
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_https_tab, container, false);
public HttpsTabFragment() {
super(R.layout.fragment_https_tab);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (getView() != null) {
urlText = getView().findViewById(R.id.urlText);
urlText = view.findViewById(R.id.urlText);
View getInfoButton = getView().findViewById(R.id.getInfoButton);
getInfoButton.setOnClickListener(new View.OnClickListener() {
View getInfoButton = view.findViewById(R.id.getInfoButton);
getInfoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getInfo();
}
});
@Override
public void onClick(View v) {
getInfo();
}
});
outputText = getView().findViewById(R.id.outputText);
outputText.setMovementMethod(new ScrollingMovementMethod());
}
outputText = view.findViewById(R.id.outputText);
outputText.setMovementMethod(new ScrollingMovementMethod());
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
setActive();
}
public void onResume() {
super.onResume();
setActive();
}
public void setMainActivity(MainActivity mainActivity) {
this.mainActivity = mainActivity;
}
public static HttpsTabFragment newInstance(final MainActivity mainActivity) {
final HttpsTabFragment fragment = new HttpsTabFragment();
fragment.setMainActivity(mainActivity);
return fragment;
public static HttpsTabFragment newInstance() {
return new HttpsTabFragment();
}
public void enableLogCallback() {
@@ -113,26 +106,117 @@ public class HttpsTabFragment extends Fragment {
if (testUrl.isEmpty()) {
testUrl = HTTPS_TEST_DEFAULT_URL;
urlText.setText(testUrl);
android.util.Log.d(MainActivity.TAG, String.format("Testing HTTPS with default url '%s'", testUrl));
android.util.Log.d(MainActivity.TAG, String.format("Testing HTTPS with default url '%s'.", testUrl));
} else {
android.util.Log.d(MainActivity.TAG, String.format("Testing HTTPS with url '%s'", testUrl));
android.util.Log.d(MainActivity.TAG, String.format("Testing HTTPS with url '%s'.", testUrl));
}
// HTTPS COMMAND ARGUMENTS
final String ffmpegCommand = String.format("-hide_banner -i %s", testUrl);
MediaInformation information = FFprobe.getMediaInformation(testUrl);
if (information == null) {
appendLog("Get media information failed\n");
} else {
appendLog("Media information for " + information.getFilename() + "\n");
android.util.Log.d(MainActivity.TAG, String.format("FFmpeg process started with arguments\n'%s'", ffmpegCommand));
if (information.getFormat() != null) {
appendLog("Format: " + information.getFormat() + "\n");
}
if (information.getBitrate() != null) {
appendLog("Bitrate: " + information.getBitrate() + "\n");
}
if (information.getDuration() != null) {
appendLog("Duration: " + information.getDuration() + "\n");
}
if (information.getStartTime() != null) {
appendLog("Start time: " + information.getStartTime() + "\n");
}
if (information.getTags() != null) {
JSONObject tags = information.getTags();
if (tags != null) {
Iterator<String> keys = tags.keys();
while (keys.hasNext()) {
String next = keys.next();
appendLog("Tag: " + next + ":" + tags.optString(next) + "\n");
}
}
}
if (information.getStreams() != null) {
for (StreamInformation stream : information.getStreams()) {
if (stream.getIndex() != null) {
appendLog("Stream index: " + stream.getIndex() + "\n");
}
if (stream.getType() != null) {
appendLog("Stream type: " + stream.getType() + "\n");
}
if (stream.getCodec() != null) {
appendLog("Stream codec: " + stream.getCodec() + "\n");
}
if (stream.getFullCodec() != null) {
appendLog("Stream full codec: " + stream.getFullCodec() + "\n");
}
if (stream.getFormat() != null) {
appendLog("Stream format: " + stream.getFormat() + "\n");
}
// EXECUTE
int result = FFmpeg.execute(ffmpegCommand);
if (stream.getWidth() != null) {
appendLog("Stream width: " + stream.getWidth() + "\n");
}
if (stream.getHeight() != null) {
appendLog("Stream height: " + stream.getHeight() + "\n");
}
android.util.Log.d(MainActivity.TAG, String.format("FFmpeg process exited with rc %d", result));
if (stream.getBitrate() != null) {
appendLog("Stream bitrate: " + stream.getBitrate() + "\n");
}
if (stream.getSampleRate() != null) {
appendLog("Stream sample rate: " + stream.getSampleRate() + "\n");
}
if (stream.getSampleFormat() != null) {
appendLog("Stream sample format: " + stream.getSampleFormat() + "\n");
}
if (stream.getChannelLayout() != null) {
appendLog("Stream channel layout: " + stream.getChannelLayout() + "\n");
}
if (stream.getSampleAspectRatio() != null) {
appendLog("Stream sample aspect ratio: " + stream.getSampleAspectRatio() + "\n");
}
if (stream.getDisplayAspectRatio() != null) {
appendLog("Stream display ascpect ratio: " + stream.getDisplayAspectRatio() + "\n");
;
}
if (stream.getAverageFrameRate() != null) {
appendLog("Stream average frame rate: " + stream.getAverageFrameRate() + "\n");
}
if (stream.getRealFrameRate() != null) {
appendLog("Stream real frame rate: " + stream.getRealFrameRate() + "\n");
}
if (stream.getTimeBase() != null) {
appendLog("Stream time base: " + stream.getTimeBase() + "\n");
}
if (stream.getCodecTimeBase() != null) {
appendLog("Stream codec time base: " + stream.getCodecTimeBase() + "\n");
}
if (stream.getTags() != null) {
JSONObject tags = stream.getTags();
if (tags != null) {
Iterator<String> keys = tags.keys();
while (keys.hasNext()) {
String next = keys.next();
appendLog(String.format("Stream tag: %s:%s\n", next, tags.optString(next)));
}
}
}
}
}
}
}
public void setActive() {
android.util.Log.i(MainActivity.TAG, "Https Tab Activated");
Log.i(MainActivity.TAG, "Https Tab Activated");
enableLogCallback();
Popup.show(mainActivity, Tooltip.HTTPS_TEST_TOOLTIP_TEXT);
Popup.show(requireContext(), Tooltip.HTTPS_TEST_TOOLTIP_TEXT);
}
public void appendLog(final String logMessage) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Taner Sener
* Copyright (c) 2018-2019 Taner Sener
*
* This file is part of MobileFFmpeg.
*
@@ -20,53 +20,50 @@
package com.arthenica.mobileffmpeg.test;
import android.Manifest;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.ActivityCompat;
import android.support.v4.view.PagerTabStrip;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.viewpager.widget.PagerTabStrip;
import androidx.viewpager.widget.ViewPager;
import com.arthenica.mobileffmpeg.AsyncFFmpegExecuteTask;
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.FFmpeg;
import com.arthenica.mobileffmpeg.util.RunCallback;
import com.arthenica.mobileffmpeg.util.AsynchronousTaskService;
import com.arthenica.mobileffmpeg.ExecuteCallback;
import com.arthenica.mobileffmpeg.Level;
import com.arthenica.mobileffmpeg.Signal;
import com.arthenica.mobileffmpeg.util.ResourcesUtil;
import com.arthenica.smartexception.java.Exceptions;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Future;
public class MainActivity extends AppCompatActivity {
public static final String TAG = "mobile-ffmpeg-test";
public static final int REQUEST_EXTERNAL_STORAGE = 1;
public static String[] PERMISSIONS_STORAGE = {
public static String[] PERMISSIONS_ALL = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA
};
protected static final AsynchronousTaskService asynchronousTaskService = new AsynchronousTaskService();
static {
Exceptions.registerRootPackage("com.arthenica");
}
protected static final Queue<Callable> actionQueue = new ConcurrentLinkedQueue<>();
protected static final Queue<Callable<Object>> actionQueue = new ConcurrentLinkedQueue<>();
protected static final Handler handler = new Handler();
@@ -74,7 +71,7 @@ public class MainActivity extends AppCompatActivity {
@Override
public void run() {
Callable callable;
Callable<Object> callable;
do {
callable = actionQueue.poll();
@@ -82,7 +79,7 @@ public class MainActivity extends AppCompatActivity {
try {
callable.call();
} catch (final Exception e) {
android.util.Log.e(MainActivity.TAG, "Running UI action received error.", e);
android.util.Log.e(TAG, String.format("Running UI action received error.%s.", Exceptions.getStackTraceString(e)));
}
}
} while (callable != null);
@@ -97,12 +94,6 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
android.support.v7.app.ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
supportActionBar.setCustomView(R.layout.action_bar);
}
PagerTabStrip pagerTabStrip = findViewById(R.id.pagerTabStrip);
if (pagerTabStrip != null) {
pagerTabStrip.setDrawFullUnderline(false);
@@ -111,7 +102,7 @@ public class MainActivity extends AppCompatActivity {
}
final ViewPager viewPager = findViewById(R.id.pager);
viewPager.setAdapter(new PagerAdapter(getSupportFragmentManager(), this, 6));
viewPager.setAdapter(new PagerAdapter(getSupportFragmentManager(), this));
waitForUIAction();
@@ -119,7 +110,19 @@ public class MainActivity extends AppCompatActivity {
int permission = ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (permission != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
PERMISSIONS_STORAGE,
PERMISSIONS_ALL,
REQUEST_EXTERNAL_STORAGE);
}
permission = ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);
if (permission != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
PERMISSIONS_ALL,
REQUEST_EXTERNAL_STORAGE);
}
permission = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
if (permission != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
PERMISSIONS_ALL,
REQUEST_EXTERNAL_STORAGE);
}
@@ -127,8 +130,13 @@ public class MainActivity extends AppCompatActivity {
registerAppFont();
Log.d(TAG, "Application fonts registered.");
} catch (final IOException e) {
Log.e(TAG, "Font registration failed.", e);
Log.e(TAG, String.format("Font registration failed.%s.", Exceptions.getStackTraceString(e)));
}
Log.d(TAG, "Listing supported camera ids.");
listSupportedCameraIds();
Config.ignoreSignal(Signal.SIGXCPU);
Config.setLogLevel(Level.AV_LOG_DEBUG);
}
@Override
@@ -139,118 +147,46 @@ public class MainActivity extends AppCompatActivity {
}
/**
* <p>Starts a new asynchronous FFmpeg operation with arguments provided.
* <p>Starts a new asynchronous FFmpeg operation with command provided.
*
* @param runCallback callback function to receive result of this execution
* @param arguments FFmpeg command options/arguments
* @return <code>Future</code> instance of asynchronous operation started
* @param ExecuteCallback callback function to receive result of this execution
* @param command FFmpeg command
*/
public static Future executeAsync(final RunCallback runCallback, final String arguments) {
return asynchronousTaskService.runAsynchronously(new Callable<Integer>() {
@Override
public Integer call() {
int returnCode = FFmpeg.execute(arguments);
if (runCallback != null) {
runCallback.apply(returnCode);
}
return returnCode;
}
});
public static void executeAsync(final ExecuteCallback ExecuteCallback, final String command) {
final AsyncFFmpegExecuteTask asyncCommandTask = new AsyncFFmpegExecuteTask(command, ExecuteCallback);
asyncCommandTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public static void waitForUIAction() {
handler.postDelayed(runnable, 250);
}
public static void addUIAction(final Callable callable) {
public static void addUIAction(final Callable<Object> callable) {
actionQueue.add(callable);
}
public AlertDialog createProgressDialog(final String text) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (inflater != null) {
View dialogView = inflater.inflate(R.layout.progress_dialog_layout, null);
builder.setView(dialogView);
TextView textView = dialogView.findViewById(R.id.progressDialogText);
if (textView != null) {
textView.setText(text);
}
}
builder.setCancelable(false);
return builder.create();
}
public AlertDialog createCancellableProgressDialog(final String text, final View.OnClickListener onClickListener) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (inflater != null) {
View dialogView = inflater.inflate(R.layout.cancellable_progress_dialog_layout, null);
builder.setView(dialogView);
TextView textView = dialogView.findViewById(R.id.progressDialogText);
if (textView != null) {
textView.setText(text);
}
Button cancelButton = dialogView.findViewById(R.id.cancelButton);
if (cancelButton != null) {
cancelButton.setOnClickListener(onClickListener);
}
}
builder.setCancelable(false);
return builder.create();
}
protected void resourceToFile(final int resourceId, final File file) throws IOException {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resourceId);
if (file.exists()) {
file.delete();
}
FileOutputStream outputStream = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
outputStream.flush();
outputStream.close();
}
protected void rawResourceToFile(final int resourceId, final File file) throws IOException {
final InputStream inputStream = getResources().openRawResource(resourceId);
if (file.exists()) {
file.delete();
}
final FileOutputStream outputStream = new FileOutputStream(file);
try {
final byte[] buffer = new byte[1024];
int readSize;
while ((readSize = inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, readSize);
}
} catch (final IOException e) {
Log.e(TAG, "Saving raw resource failed.", e);
} finally {
inputStream.close();
outputStream.flush();
outputStream.close();
}
}
protected void registerAppFont() throws IOException {
final File cacheDirectory = getCacheDir();
// SAVE FONTS
rawResourceToFile(R.raw.doppioone_regular, new File(cacheDirectory, "doppioone_regular.ttf"));
rawResourceToFile(R.raw.truenorg, new File(cacheDirectory, "truenorg.otf"));
ResourcesUtil.rawResourceToFile(getResources(), R.raw.doppioone_regular, new File(cacheDirectory, "doppioone_regular.ttf"));
ResourcesUtil.rawResourceToFile(getResources(), R.raw.truenorg, new File(cacheDirectory, "truenorg.otf"));
final HashMap<String, String> fontNameMapping = new HashMap<>();
fontNameMapping.put("MyFontName", "Doppio One");
Config.setFontDirectory(this, cacheDirectory.getAbsolutePath(), fontNameMapping);
// Config.setFontDirectory(this, cacheDirectory.getAbsolutePath(), null);
Config.setEnvironmentVariable("FFREPORT", String.format("file=%s", new File(cacheDirectory.getAbsolutePath(), "ffreport.txt").getAbsolutePath()));
}
protected void listSupportedCameraIds() {
final List<String> supportedCameraIds = Config.getSupportedCameraIds(this);
if (supportedCameraIds.size() == 0) {
android.util.Log.d(MainActivity.TAG, "No supported cameras found.");
} else {
for (String supportedCameraId : supportedCameraIds) {
android.util.Log.d(MainActivity.TAG, "Supported camera detected: " + supportedCameraId);
}
}
}
}
@@ -19,41 +19,48 @@
package com.arthenica.mobileffmpeg.test;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.content.Context;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
public class PagerAdapter extends FragmentPagerAdapter {
private final MainActivity mainActivity;
private int numberOfTabs;
private static final int NUMBER_OF_TABS = 8;
PagerAdapter(final FragmentManager fragmentManager, final MainActivity mainActivity, final int numberOfTabs) {
super(fragmentManager);
private final Context context;
this.mainActivity = mainActivity;
this.numberOfTabs = numberOfTabs;
PagerAdapter(FragmentManager fragmentManager, Context context) {
super(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
this.context = context;
}
@Override
public Fragment getItem(final int position) {
switch (position) {
case 0: {
return CommandTabFragment.newInstance(mainActivity);
return CommandTabFragment.newInstance();
}
case 1: {
return VideoTabFragment.newInstance(mainActivity);
return VideoTabFragment.newInstance();
}
case 2: {
return HttpsTabFragment.newInstance(mainActivity);
return HttpsTabFragment.newInstance();
}
case 3: {
return AudioTabFragment.newInstance(mainActivity);
return AudioTabFragment.newInstance();
}
case 4: {
return SubtitleTabFragment.newInstance(mainActivity);
return SubtitleTabFragment.newInstance();
}
case 5: {
return VidStabTabFragment.newInstance(mainActivity);
return VidStabTabFragment.newInstance();
}
case 6: {
return PipeTabFragment.newInstance();
}
case 7: {
return ConcurrentExecutionTabFragment.newInstance();
}
default: {
return null;
@@ -63,29 +70,35 @@ public class PagerAdapter extends FragmentPagerAdapter {
@Override
public int getCount() {
return numberOfTabs;
return NUMBER_OF_TABS;
}
@Override
public CharSequence getPageTitle(final int position) {
switch (position) {
case 0: {
return mainActivity.getString(R.string.command_tab);
return context.getString(R.string.command_tab);
}
case 1: {
return mainActivity.getString(R.string.video_tab);
return context.getString(R.string.video_tab);
}
case 2: {
return mainActivity.getString(R.string.https_tab);
return context.getString(R.string.https_tab);
}
case 3: {
return mainActivity.getString(R.string.audio_tab);
return context.getString(R.string.audio_tab);
}
case 4: {
return mainActivity.getString(R.string.subtitle_tab);
return context.getString(R.string.subtitle_tab);
}
case 5: {
return mainActivity.getString(R.string.vidstab_tab);
return context.getString(R.string.vidstab_tab);
}
case 6: {
return context.getString(R.string.pipe_tab);
}
case 7: {
return context.getString(R.string.concurrent_tab);
}
default: {
return null;
@@ -0,0 +1,272 @@
/*
* Copyright (c) 2018 Taner Sener
*
* This file is part of MobileFFmpeg.
*
* MobileFFmpeg is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MobileFFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.arthenica.mobileffmpeg.test;
import android.app.AlertDialog;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.MediaController;
import android.widget.TextView;
import android.widget.VideoView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.ExecuteCallback;
import com.arthenica.mobileffmpeg.LogCallback;
import com.arthenica.mobileffmpeg.LogMessage;
import com.arthenica.mobileffmpeg.Statistics;
import com.arthenica.mobileffmpeg.StatisticsCallback;
import com.arthenica.mobileffmpeg.util.AsyncCatImageTask;
import com.arthenica.mobileffmpeg.util.DialogUtil;
import com.arthenica.mobileffmpeg.util.ResourcesUtil;
import com.arthenica.smartexception.java.Exceptions;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.concurrent.Callable;
import static com.arthenica.mobileffmpeg.Config.RETURN_CODE_SUCCESS;
import static com.arthenica.mobileffmpeg.test.MainActivity.TAG;
public class PipeTabFragment extends Fragment {
private VideoView videoView;
private AlertDialog progressDialog;
private Statistics statistics;
public PipeTabFragment() {
super(R.layout.fragment_pipe_tab);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
View createButton = view.findViewById(R.id.createButton);
if (createButton != null) {
createButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
createVideo();
}
});
}
videoView = view.findViewById(R.id.videoPlayerFrame);
progressDialog = DialogUtil.createProgressDialog(requireContext(), "Creating video");
}
@Override
public void onResume() {
super.onResume();
setActive();
}
public static PipeTabFragment newInstance() {
return new PipeTabFragment();
}
public void enableLogCallback() {
Config.enableLogCallback(new LogCallback() {
@Override
public void apply(LogMessage message) {
Log.d(MainActivity.TAG, message.getText());
}
});
}
public void enableStatisticsCallback() {
Config.enableStatisticsCallback(new StatisticsCallback() {
@Override
public void apply(final Statistics newStatistics) {
MainActivity.addUIAction(new Callable<Object>() {
@Override
public Object call() {
PipeTabFragment.this.statistics = newStatistics;
updateProgressDialog();
return null;
}
});
}
});
}
void startAsyncCatImageProcess(final String imagePath, final String namedPipePath) {
AsyncCatImageTask asyncTask = new AsyncCatImageTask();
asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, imagePath, namedPipePath);
}
public void createVideo() {
final File image1File = new File(requireContext().getCacheDir(), "colosseum.jpg");
final File image2File = new File(requireContext().getCacheDir(), "pyramid.jpg");
final File image3File = new File(requireContext().getCacheDir(), "tajmahal.jpg");
final File videoFile = getVideoFile();
String pipe1 = Config.registerNewFFmpegPipe(requireContext());
String pipe2 = Config.registerNewFFmpegPipe(requireContext());
String pipe3 = Config.registerNewFFmpegPipe(requireContext());
try {
// IF VIDEO IS PLAYING STOP PLAYBACK
videoView.stopPlayback();
if (videoFile.exists()) {
videoFile.delete();
}
Log.d(TAG, "Testing PIPE with 'mpeg4' codec");
showProgressDialog();
ResourcesUtil.resourceToFile(getResources(), R.drawable.colosseum, image1File);
ResourcesUtil.resourceToFile(getResources(), R.drawable.pyramid, image2File);
ResourcesUtil.resourceToFile(getResources(), R.drawable.tajmahal, image3File);
final String ffmpegCommand = Video.generateCreateVideoWithPipesScript(pipe1, pipe2, pipe3, videoFile.getAbsolutePath());
Log.d(TAG, String.format("FFmpeg process started with arguments\n'%s'.", ffmpegCommand));
MainActivity.executeAsync(new ExecuteCallback() {
@Override
public void apply(final long executionId, final int returnCode) {
Log.d(TAG, String.format("FFmpeg process exited with rc %d.", returnCode));
hideProgressDialog();
MainActivity.addUIAction(new Callable<Object>() {
@Override
public Object call() {
if (returnCode == RETURN_CODE_SUCCESS) {
Log.d(TAG, "Create completed successfully; playing video.");
playVideo();
} else {
Popup.show(requireContext(), "Create failed. Please check log for the details.");
Log.d(TAG, String.format("Create failed with rc=%d.", returnCode));
}
return null;
}
});
}
}, ffmpegCommand);
// START ASYNC PROCESSES AFTER INITIATING FFMPEG COMMAND
startAsyncCatImageProcess(image1File.getAbsolutePath(), pipe1);
startAsyncCatImageProcess(image2File.getAbsolutePath(), pipe2);
startAsyncCatImageProcess(image3File.getAbsolutePath(), pipe3);
} catch (IOException e) {
Log.e(TAG, String.format("Create video failed %s.", Exceptions.getStackTraceString(e)));
Popup.show(requireContext(), "Create video failed");
}
}
protected void playVideo() {
MediaController mediaController = new MediaController(requireContext());
mediaController.setAnchorView(videoView);
videoView.setVideoURI(Uri.parse("file://" + getVideoFile().getAbsolutePath()));
videoView.setMediaController(mediaController);
videoView.requestFocus();
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
videoView.setBackgroundColor(0x00000000);
}
});
videoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
videoView.stopPlayback();
return false;
}
});
videoView.start();
}
protected File getVideoFile() {
return new File(requireContext().getFilesDir(), "video.mp4");
}
public void setActive() {
Log.i(MainActivity.TAG, "Pipe Tab Activated");
enableLogCallback();
enableStatisticsCallback();
Popup.show(requireContext(), Tooltip.PIPE_TEST_TOOLTIP_TEXT);
}
protected void showProgressDialog() {
// CLEAN STATISTICS
statistics = null;
Config.resetStatistics();
progressDialog.show();
}
protected void updateProgressDialog() {
if (statistics == null) {
return;
}
int timeInMilliseconds = this.statistics.getTime();
if (timeInMilliseconds > 0) {
int totalVideoDuration = 9000;
String completePercentage = new BigDecimal(timeInMilliseconds).multiply(new BigDecimal(100)).divide(new BigDecimal(totalVideoDuration), 0, BigDecimal.ROUND_HALF_UP).toString();
TextView textView = progressDialog.findViewById(R.id.progressDialogText);
if (textView != null) {
textView.setText(String.format("Creating video: %% %s.", completePercentage));
}
}
}
protected void hideProgressDialog() {
progressDialog.dismiss();
MainActivity.addUIAction(new Callable<Object>() {
@Override
public Object call() {
PipeTabFragment.this.progressDialog = DialogUtil.createProgressDialog(requireContext(), "Creating video");
return null;
}
});
}
}
@@ -23,32 +23,34 @@ import android.app.AlertDialog;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.MediaController;
import android.widget.TextView;
import android.widget.VideoView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.arthenica.mobileffmpeg.Config;
import com.arthenica.mobileffmpeg.ExecuteCallback;
import com.arthenica.mobileffmpeg.FFmpeg;
import com.arthenica.mobileffmpeg.LogCallback;
import com.arthenica.mobileffmpeg.LogMessage;
import com.arthenica.mobileffmpeg.Statistics;
import com.arthenica.mobileffmpeg.StatisticsCallback;
import com.arthenica.mobileffmpeg.util.RunCallback;
import com.arthenica.mobileffmpeg.util.DialogUtil;
import com.arthenica.mobileffmpeg.util.ResourcesUtil;
import com.arthenica.smartexception.java.Exceptions;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.concurrent.Callable;
import static com.arthenica.mobileffmpeg.FFmpeg.RETURN_CODE_CANCEL;
import static com.arthenica.mobileffmpeg.FFmpeg.RETURN_CODE_SUCCESS;
import static com.arthenica.mobileffmpeg.Config.RETURN_CODE_CANCEL;
import static com.arthenica.mobileffmpeg.Config.RETURN_CODE_SUCCESS;
import static com.arthenica.mobileffmpeg.test.MainActivity.TAG;
public class SubtitleTabFragment extends Fragment {
@@ -59,54 +61,43 @@ public class SubtitleTabFragment extends Fragment {
BURNING
}
private MainActivity mainActivity;
private VideoView videoView;
private AlertDialog createProgressDialog;
private AlertDialog burnProgressDialog;
private Statistics statistics;
private State state;
private Long executionId;
@Override
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_subtitle_tab, container, false);
public SubtitleTabFragment() {
super(R.layout.fragment_subtitle_tab);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (getView() != null) {
View burnSubtitlesButton = getView().findViewById(R.id.burnSubtitlesButton);
burnSubtitlesButton.setOnClickListener(new View.OnClickListener() {
View burnSubtitlesButton = view.findViewById(R.id.burnSubtitlesButton);
burnSubtitlesButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
burnSubtitles();
}
});
@Override
public void onClick(View v) {
burnSubtitles();
}
});
videoView = getView().findViewById(R.id.videoPlayerFrame);
}
videoView = view.findViewById(R.id.videoPlayerFrame);
state = State.IDLE;
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
setActive();
}
public void onResume() {
super.onResume();
setActive();
}
public void setMainActivity(MainActivity mainActivity) {
this.mainActivity = mainActivity;
}
public static SubtitleTabFragment newInstance(final MainActivity mainActivity) {
final SubtitleTabFragment fragment = new SubtitleTabFragment();
fragment.setMainActivity(mainActivity);
return fragment;
public static SubtitleTabFragment newInstance() {
return new SubtitleTabFragment();
}
public void enableLogCallback() {
@@ -114,7 +105,7 @@ public class SubtitleTabFragment extends Fragment {
@Override
public void apply(LogMessage message) {
android.util.Log.d(MainActivity.TAG, message.getText());
Log.d(MainActivity.TAG, message.getText());
}
});
}
@@ -138,9 +129,9 @@ public class SubtitleTabFragment extends Fragment {
}
public void burnSubtitles() {
final File image1File = new File(mainActivity.getCacheDir(), "colosseum.jpg");
final File image2File = new File(mainActivity.getCacheDir(), "pyramid.jpg");
final File image3File = new File(mainActivity.getCacheDir(), "tajmahal.jpg");
final File image1File = new File(requireContext().getCacheDir(), "colosseum.jpg");
final File image2File = new File(requireContext().getCacheDir(), "pyramid.jpg");
final File image3File = new File(requireContext().getCacheDir(), "tajmahal.jpg");
final File videoFile = getVideoFile();
final File videoWithSubtitlesFile = getVideoWithSubtitlesFile();
@@ -161,32 +152,31 @@ public class SubtitleTabFragment extends Fragment {
showCreateProgressDialog();
mainActivity.resourceToFile(R.drawable.colosseum, image1File);
mainActivity.resourceToFile(R.drawable.pyramid, image2File);
mainActivity.resourceToFile(R.drawable.tajmahal, image3File);
mainActivity.rawResourceToFile(R.raw.subtitle, getSubtitleFile());
ResourcesUtil.resourceToFile(getResources(), R.drawable.colosseum, image1File);
ResourcesUtil.resourceToFile(getResources(), R.drawable.pyramid, image2File);
ResourcesUtil.resourceToFile(getResources(), R.drawable.tajmahal, image3File);
ResourcesUtil.rawResourceToFile(getResources(), R.raw.subtitle, getSubtitleFile());
final String ffmpegCommand = Video.generateEncodeVideoScript(image1File.getAbsolutePath(), image2File.getAbsolutePath(), image3File.getAbsolutePath(), videoFile.getAbsolutePath(), "mpeg4", "");
Log.d(TAG, String.format("FFmpeg process started with arguments\n'%s'", ffmpegCommand));
Log.d(TAG, String.format("FFmpeg process started with arguments\n'%s'.", ffmpegCommand));
state = State.CREATING;
MainActivity.executeAsync(new RunCallback() {
executionId = FFmpeg.executeAsync(ffmpegCommand, new ExecuteCallback() {
@Override
public void apply(final int returnCode) {
Log.d(TAG, String.format("FFmpeg process exited with rc %d", returnCode));
state = State.IDLE;
public void apply(final long executionId, final int returnCode) {
Log.d(TAG, String.format("FFmpeg process exited with rc %d.", returnCode));
hideCreateProgressDialog();
MainActivity.addUIAction(new Callable() {
if (returnCode == RETURN_CODE_SUCCESS) {
@Override
public Object call() {
if (returnCode == RETURN_CODE_SUCCESS) {
MainActivity.addUIAction(new Callable<Object>() {
@Override
public Object call() {
Log.d(TAG, "Create completed successfully; burning subtitles.");
@@ -194,21 +184,19 @@ public class SubtitleTabFragment extends Fragment {
showBurnProgressDialog();
Log.d(TAG, String.format("FFmpeg process started with arguments\n'%s'", burnSubtitlesCommand));
Log.d(TAG, String.format("FFmpeg process started with arguments\n'%s'.", burnSubtitlesCommand));
state = State.BURNING;
MainActivity.executeAsync(new RunCallback() {
FFmpeg.executeAsync(burnSubtitlesCommand, new ExecuteCallback() {
@Override
public void apply(final int returnCode) {
Log.d(TAG, String.format("FFmpeg process exited with rc %d", returnCode));
state = State.IDLE;
public void apply(final long executionId, final int returnCode) {
Log.d(TAG, String.format("FFmpeg process exited with rc %d.", returnCode));
hideBurnProgressDialog();
MainActivity.addUIAction(new Callable() {
MainActivity.addUIAction(new Callable<Object>() {
@Override
public Object call() {
@@ -216,41 +204,36 @@ public class SubtitleTabFragment extends Fragment {
Log.d(TAG, "Burn subtitles completed successfully; playing video.");
playVideo();
} else if (returnCode == RETURN_CODE_CANCEL) {
Popup.show(mainActivity, "Burn subtitles operation cancelled.");
Log.d(TAG, "Burn subtitles operation cancelled");
Popup.show(requireContext(), "Burn subtitles operation cancelled.");
Log.e(TAG, "Burn subtitles operation cancelled");
} else {
Popup.show(mainActivity, "Burn subtitles failed. Please check log for the details.");
Log.d(TAG, String.format("Burn subtitles failed with rc=%d", returnCode));
Popup.show(requireContext(), "Burn subtitles failed. Please check log for the details.");
Log.e(TAG, String.format("Burn subtitles failed with rc=%d.", returnCode));
}
return null;
}
});
}
}, burnSubtitlesCommand);
});
} else if (returnCode == RETURN_CODE_CANCEL) {
Popup.show(mainActivity, "Create operation cancelled.");
Log.d(TAG, "Create operation cancelled");
} else {
Popup.show(mainActivity, "Create video failed. Please check log for the details.");
Log.d(TAG, String.format("Create failed with rc=%d", returnCode));
return null;
}
return null;
}
});
});
}
}
}, ffmpegCommand);
});
Log.d(TAG, String.format("FFmpeg started execution id: %d.", executionId));
} catch (IOException e) {
Log.e(TAG, "Burn subtitles failed", e);
Popup.show(mainActivity, "Burn subtitles failed");
Log.e(TAG, String.format("Burn subtitles failed %s.", Exceptions.getStackTraceString(e)));
Popup.show(requireContext(), "Burn subtitles failed");
}
}
protected void playVideo() {
MediaController mediaController = new MediaController(mainActivity);
MediaController mediaController = new MediaController(requireContext());
mediaController.setAnchorView(videoView);
videoView.setVideoURI(Uri.parse("file://" + getVideoWithSubtitlesFile().getAbsolutePath()));
videoView.setMediaController(mediaController);
@@ -274,22 +257,22 @@ public class SubtitleTabFragment extends Fragment {
}
public File getSubtitleFile() {
return new File(mainActivity.getCacheDir(), "subtitle.srt");
return new File(requireContext().getCacheDir(), "subtitle.srt");
}
public File getVideoFile() {
return new File(mainActivity.getFilesDir(), "video.mp4");
return new File(requireContext().getFilesDir(), "video.mp4");
}
public File getVideoWithSubtitlesFile() {
return new File(mainActivity.getFilesDir(), "video-with-subtitles.mp4");
return new File(requireContext().getFilesDir(), "video-with-subtitles.mp4");
}
public void setActive() {
android.util.Log.i(MainActivity.TAG, "Subtitle Tab Activated");
Log.i(MainActivity.TAG, "Subtitle Tab Activated");
enableLogCallback();
enableStatisticsCallback();
Popup.show(mainActivity, Tooltip.SUBTITLE_TEST_TOOLTIP_TEXT);
Popup.show(requireContext(), Tooltip.SUBTITLE_TEST_TOOLTIP_TEXT);
}
protected void showCreateProgressDialog() {
@@ -298,11 +281,14 @@ public class SubtitleTabFragment extends Fragment {
statistics = null;
Config.resetStatistics();
createProgressDialog = mainActivity.createCancellableProgressDialog("Creating video", new View.OnClickListener() {
createProgressDialog = DialogUtil.createCancellableProgressDialog(requireContext(), "Creating video", new View.OnClickListener() {
@Override
public void onClick(View v) {
FFmpeg.cancel();
if (executionId != null) {
Log.d(TAG, String.format("Cancelling FFmpeg execution with executionId %d.", executionId));
FFmpeg.cancel(executionId);
}
}
});
createProgressDialog.show();
@@ -321,12 +307,12 @@ public class SubtitleTabFragment extends Fragment {
if (state == State.CREATING) {
TextView textView = createProgressDialog.findViewById(R.id.progressDialogText);
if (textView != null) {
textView.setText(String.format("Creating video: %% %s", completePercentage));
textView.setText(String.format("Creating video: %% %s.", completePercentage));
}
} else if (state == State.BURNING) {
TextView textView = burnProgressDialog.findViewById(R.id.progressDialogText);
if (textView != null) {
textView.setText(String.format("Burning subtitles: %% %s", completePercentage));
textView.setText(String.format("Burning subtitles: %% %s.", completePercentage));
}
}
@@ -342,7 +328,7 @@ public class SubtitleTabFragment extends Fragment {
statistics = null;
Config.resetStatistics();
burnProgressDialog = mainActivity.createCancellableProgressDialog("Burning subtitles", new View.OnClickListener() {
burnProgressDialog = DialogUtil.createCancellableProgressDialog(requireContext(), "Burning subtitles", new View.OnClickListener() {
@Override
public void onClick(View v) {
FFmpeg.cancel();
@@ -39,4 +39,10 @@ public interface Tooltip {
// VID.STAB TEST
String VIDSTAB_TEST_TOOLTIP_TEXT = "Click the button to stabilize video. Original video will play above and stabilized video will play below";
// PIPE TEST
String PIPE_TEST_TOOLTIP_TEXT = "Click the button to create a video using pipe redirection. Created video will play inside the frame below";
// CONCURRENT EXECUTION TEST
String CONCURRENT_EXECUTION_TEST_TOOLTIP_TEXT = " Use ENCODE nad CANCEL buttons to start/stop multiple execution";
}

Some files were not shown because too many files have changed in this diff Show More