11package com.coder.ffmpeg.jni
22
33import android.content.Context
4+ import com.coder.ffmpeg.BuildConfig
45import java.io.File
56import java.io.FileOutputStream
67import java.io.IOException
@@ -15,25 +16,53 @@ class FFmpegConfig {
1516 init {
1617 System .loadLibrary(" ffmpeg-org" )
1718 System .loadLibrary(" ffmpeg-command" )
19+
20+ nativeInit()
1821 }
1922
23+ /* *
24+ * native Init, for basic config
25+ */
26+ private external fun nativeInit ()
27+
28+ /* *
29+ * Whether to enable debugging mode
30+ * @param debug true or false
31+ */
32+ private external fun nativeSetDebug (debug : Boolean )
33+
2034 /* *
2135 * Whether to enable debugging mode
2236 * @param debug true or false
2337 */
24- external fun setDebug (debug : Boolean )
38+ @JvmStatic
39+ fun setDebug (debug : Boolean ) {
40+ nativeSetDebug(debug)
41+ }
2542
2643 /* *
2744 * Set the env of native
2845 * @param name env name
2946 * @param value env value
3047 */
31- private external fun setNativeEnv (name : String , value : String )
48+ private external fun nativeSetNativeEnv (name : String , value : String )
49+
50+ /* *
51+ * Set the env of native
52+ * @param name env name
53+ * @param value env value
54+ */
55+ @JvmStatic
56+ private fun setNativeEnv (name : String , value : String ) {
57+ nativeSetNativeEnv(name, value)
58+ }
59+
3260 /* *
3361 * Set font config dir for fontconfig
3462 * Note:It's a config dir not font dir
3563 * @param configPath the font config dir
3664 */
65+ @JvmStatic
3766 fun setFontConfigPath (configPath : String ) {
3867 setNativeEnv(" FONTCONFIG_PATH" , configPath)
3968 }
@@ -43,6 +72,7 @@ class FFmpegConfig {
4372 * Note:It's a config file not font file
4473 * @param configFile the font config file
4574 */
75+ @JvmStatic
4676 fun setFontConfigFile (configFile : String ) {
4777 setNativeEnv(" FONTCONFIG_FILE" , configFile)
4878 }
@@ -53,6 +83,7 @@ class FFmpegConfig {
5383 * @param fontDir the font dir contain fonts (.ttf and .otf files)
5484 * @param fontNameMapping
5585 */
86+ @JvmStatic
5687 fun setFontDir (context : Context , fontDir : String , fontNameMapping : Map <String , String >){
5788 setFontDirList(context, Collections .singletonList(fontDir),fontNameMapping)
5889 }
@@ -61,6 +92,7 @@ class FFmpegConfig {
6192 * @param context context for application
6293 * @param fontDirList list of directories that contain fonts (.ttf and .otf files)
6394 */
95+ @JvmStatic
6496 fun setFontDirList (context : Context , fontDirList : List <String >, fontNameMapping : Map <String , String >) {
6597 var validFontNameMappingCount = 0
6698 val cacheDir = context.cacheDir
@@ -121,8 +153,9 @@ class FFmpegConfig {
121153 }
122154 }
123155
156+ @JvmStatic
124157 fun getRepo ():String {
125- return " ffmpeg-lite "
158+ return BuildConfig . MODULE_NAME
126159 }
127160 }
128161}
0 commit comments