|
|
@ -40,8 +40,7 @@ import 'statistics_callback.dart'; |
|
|
|
class FFmpegKitConfig { |
|
|
|
class FFmpegKitConfig { |
|
|
|
static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance; |
|
|
|
static FFmpegKitPlatform _platform = FFmpegKitPlatform.instance; |
|
|
|
|
|
|
|
|
|
|
|
static LogRedirectionStrategy _globalLogRedirectionStrategy = |
|
|
|
static LogRedirectionStrategy _globalLogRedirectionStrategy = LogRedirectionStrategy.printLogsWhenNoCallbacksDefined; |
|
|
|
LogRedirectionStrategy.printLogsWhenNoCallbacksDefined; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int _activeLogLevel = Level.avLogTrace; |
|
|
|
static int _activeLogLevel = Level.avLogTrace; |
|
|
|
|
|
|
|
|
|
|
@ -100,8 +99,7 @@ class FFmpegKitConfig { |
|
|
|
/// |
|
|
|
/// |
|
|
|
/// Note that you need to use a package with "fontconfig" inside to be able |
|
|
|
/// Note that you need to use a package with "fontconfig" inside to be able |
|
|
|
/// to use fonts in "FFmpeg". |
|
|
|
/// to use fonts in "FFmpeg". |
|
|
|
static Future<void> setFontDirectory(String path, |
|
|
|
static Future<void> setFontDirectory(String path, [Map<String, String>? mapping = null]) async { |
|
|
|
[Map<String, String>? mapping = null]) async { |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform.ffmpegKitConfigSetFontDirectory(path, mapping); |
|
|
|
return _platform.ffmpegKitConfigSetFontDirectory(path, mapping); |
|
|
@ -116,12 +114,13 @@ class FFmpegKitConfig { |
|
|
|
/// |
|
|
|
/// |
|
|
|
/// Note that you need to use a package with "fontconfig" inside to be able |
|
|
|
/// Note that you need to use a package with "fontconfig" inside to be able |
|
|
|
/// to use fonts in "FFmpeg". |
|
|
|
/// to use fonts in "FFmpeg". |
|
|
|
static Future<void> setFontDirectoryList(List<String> fontDirectoryList, |
|
|
|
static Future<void> setFontDirectoryList( |
|
|
|
[Map<String, String>? mapping = null]) async { |
|
|
|
List<String> fontDirectoryList, [ |
|
|
|
|
|
|
|
Map<String, String>? mapping = null, |
|
|
|
|
|
|
|
]) async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform.ffmpegKitConfigSetFontDirectoryList( |
|
|
|
return _platform.ffmpegKitConfigSetFontDirectoryList(fontDirectoryList, mapping); |
|
|
|
fontDirectoryList, mapping); |
|
|
|
|
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin setFontDirectoryList error: ${e.message}"); |
|
|
|
print("Plugin setFontDirectoryList error: ${e.message}"); |
|
|
|
return Future.error("setFontDirectoryList failed.", stack); |
|
|
|
return Future.error("setFontDirectoryList failed.", stack); |
|
|
@ -221,8 +220,7 @@ class FFmpegKitConfig { |
|
|
|
static Future<void> ffmpegExecute(FFmpegSession ffmpegSession) async { |
|
|
|
static Future<void> ffmpegExecute(FFmpegSession ffmpegSession) async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform |
|
|
|
return _platform.ffmpegKitConfigFFmpegExecute(ffmpegSession.getSessionId()); |
|
|
|
.ffmpegKitConfigFFmpegExecute(ffmpegSession.getSessionId()); |
|
|
|
|
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin ffmpegExecute error: ${e.message}"); |
|
|
|
print("Plugin ffmpegExecute error: ${e.message}"); |
|
|
|
return Future.error("ffmpegExecute failed.", stack); |
|
|
|
return Future.error("ffmpegExecute failed.", stack); |
|
|
@ -233,8 +231,7 @@ class FFmpegKitConfig { |
|
|
|
static Future<void> ffprobeExecute(FFprobeSession ffprobeSession) async { |
|
|
|
static Future<void> ffprobeExecute(FFprobeSession ffprobeSession) async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform |
|
|
|
return _platform.ffmpegKitConfigFFprobeExecute(ffprobeSession.getSessionId()); |
|
|
|
.ffmpegKitConfigFFprobeExecute(ffprobeSession.getSessionId()); |
|
|
|
|
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin ffprobeExecute error: ${e.message}"); |
|
|
|
print("Plugin ffprobeExecute error: ${e.message}"); |
|
|
|
return Future.error("ffprobeExecute failed.", stack); |
|
|
|
return Future.error("ffprobeExecute failed.", stack); |
|
|
@ -243,12 +240,12 @@ class FFmpegKitConfig { |
|
|
|
|
|
|
|
|
|
|
|
/// Synchronously executes the media information session provided. |
|
|
|
/// Synchronously executes the media information session provided. |
|
|
|
static Future<void> getMediaInformationExecute( |
|
|
|
static Future<void> getMediaInformationExecute( |
|
|
|
MediaInformationSession mediaInformationSession, |
|
|
|
MediaInformationSession mediaInformationSession, [ |
|
|
|
[int? waitTimeout = null]) async { |
|
|
|
int? waitTimeout = null, |
|
|
|
|
|
|
|
]) async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform.ffmpegKitConfigGetMediaInformationExecute( |
|
|
|
return _platform.ffmpegKitConfigGetMediaInformationExecute(mediaInformationSession.getSessionId(), waitTimeout); |
|
|
|
mediaInformationSession.getSessionId(), waitTimeout); |
|
|
|
|
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin getMediaInformationExecute error: ${e.message}"); |
|
|
|
print("Plugin getMediaInformationExecute error: ${e.message}"); |
|
|
|
return Future.error("getMediaInformationExecute failed.", stack); |
|
|
|
return Future.error("getMediaInformationExecute failed.", stack); |
|
|
@ -262,8 +259,7 @@ class FFmpegKitConfig { |
|
|
|
static Future<void> asyncFFmpegExecute(FFmpegSession ffmpegSession) async { |
|
|
|
static Future<void> asyncFFmpegExecute(FFmpegSession ffmpegSession) async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform |
|
|
|
return _platform.ffmpegKitConfigAsyncFFmpegExecute(ffmpegSession.getSessionId()); |
|
|
|
.ffmpegKitConfigAsyncFFmpegExecute(ffmpegSession.getSessionId()); |
|
|
|
|
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin asyncFFmpegExecute error: ${e.message}"); |
|
|
|
print("Plugin asyncFFmpegExecute error: ${e.message}"); |
|
|
|
return Future.error("asyncFFmpegExecute failed.", stack); |
|
|
|
return Future.error("asyncFFmpegExecute failed.", stack); |
|
|
@ -277,8 +273,7 @@ class FFmpegKitConfig { |
|
|
|
static Future<void> asyncFFprobeExecute(FFprobeSession ffprobeSession) async { |
|
|
|
static Future<void> asyncFFprobeExecute(FFprobeSession ffprobeSession) async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform |
|
|
|
return _platform.ffmpegKitConfigAsyncFFprobeExecute(ffprobeSession.getSessionId()); |
|
|
|
.ffmpegKitConfigAsyncFFprobeExecute(ffprobeSession.getSessionId()); |
|
|
|
|
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin asyncFFprobeExecute error: ${e.message}"); |
|
|
|
print("Plugin asyncFFprobeExecute error: ${e.message}"); |
|
|
|
return Future.error("asyncFFprobeExecute failed.", stack); |
|
|
|
return Future.error("asyncFFprobeExecute failed.", stack); |
|
|
@ -290,12 +285,15 @@ class FFmpegKitConfig { |
|
|
|
/// Note that this method returns immediately and does not wait the execution to complete. You must use an |
|
|
|
/// Note that this method returns immediately and does not wait the execution to complete. You must use an |
|
|
|
/// [MediaInformationSessionCompleteCallback] if you want to be notified about the result. |
|
|
|
/// [MediaInformationSessionCompleteCallback] if you want to be notified about the result. |
|
|
|
static Future<void> asyncGetMediaInformationExecute( |
|
|
|
static Future<void> asyncGetMediaInformationExecute( |
|
|
|
MediaInformationSession mediaInformationSession, |
|
|
|
MediaInformationSession mediaInformationSession, [ |
|
|
|
[int? waitTimeout = null]) async { |
|
|
|
int? waitTimeout = null, |
|
|
|
|
|
|
|
]) async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform.ffmpegKitConfigAsyncGetMediaInformationExecute( |
|
|
|
return _platform.ffmpegKitConfigAsyncGetMediaInformationExecute( |
|
|
|
mediaInformationSession.getSessionId(), waitTimeout); |
|
|
|
mediaInformationSession.getSessionId(), |
|
|
|
|
|
|
|
waitTimeout, |
|
|
|
|
|
|
|
); |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin asyncGetMediaInformationExecute error: ${e.message}"); |
|
|
|
print("Plugin asyncGetMediaInformationExecute error: ${e.message}"); |
|
|
|
return Future.error("asyncGetMediaInformationExecute failed.", stack); |
|
|
|
return Future.error("asyncGetMediaInformationExecute failed.", stack); |
|
|
@ -308,17 +306,16 @@ class FFmpegKitConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Sets a global callback to redirect FFmpeg statistics. |
|
|
|
/// Sets a global callback to redirect FFmpeg statistics. |
|
|
|
static void enableStatisticsCallback( |
|
|
|
static void enableStatisticsCallback([StatisticsCallback? statisticsCallback = null]) { |
|
|
|
[StatisticsCallback? statisticsCallback = null]) { |
|
|
|
|
|
|
|
FFmpegKitFactory.setGlobalStatisticsCallback(statisticsCallback); |
|
|
|
FFmpegKitFactory.setGlobalStatisticsCallback(statisticsCallback); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Sets a global FFmpegSessionCompleteCallback to receive execution results |
|
|
|
/// Sets a global FFmpegSessionCompleteCallback to receive execution results |
|
|
|
/// for FFmpeg sessions. |
|
|
|
/// for FFmpeg sessions. |
|
|
|
static void enableFFmpegSessionCompleteCallback( |
|
|
|
static void enableFFmpegSessionCompleteCallback([ |
|
|
|
[FFmpegSessionCompleteCallback? ffmpegSessionCompleteCallback = null]) { |
|
|
|
FFmpegSessionCompleteCallback? ffmpegSessionCompleteCallback = null, |
|
|
|
FFmpegKitFactory.setGlobalFFmpegSessionCompleteCallback( |
|
|
|
]) { |
|
|
|
ffmpegSessionCompleteCallback); |
|
|
|
FFmpegKitFactory.setGlobalFFmpegSessionCompleteCallback(ffmpegSessionCompleteCallback); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns the global FFmpegSessionCompleteCallback set. |
|
|
|
/// Returns the global FFmpegSessionCompleteCallback set. |
|
|
@ -327,10 +324,10 @@ class FFmpegKitConfig { |
|
|
|
|
|
|
|
|
|
|
|
/// Sets a global FFprobeSessionCompleteCallback to receive execution results |
|
|
|
/// Sets a global FFprobeSessionCompleteCallback to receive execution results |
|
|
|
/// for FFprobe sessions. |
|
|
|
/// for FFprobe sessions. |
|
|
|
static void enableFFprobeSessionCompleteCallback( |
|
|
|
static void enableFFprobeSessionCompleteCallback([ |
|
|
|
[FFprobeSessionCompleteCallback? ffprobeSessionCompleteCallback = null]) { |
|
|
|
FFprobeSessionCompleteCallback? ffprobeSessionCompleteCallback = null, |
|
|
|
FFmpegKitFactory.setGlobalFFprobeSessionCompleteCallback( |
|
|
|
]) { |
|
|
|
ffprobeSessionCompleteCallback); |
|
|
|
FFmpegKitFactory.setGlobalFFprobeSessionCompleteCallback(ffprobeSessionCompleteCallback); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns the global FFprobeSessionCompleteCallback set. |
|
|
|
/// Returns the global FFprobeSessionCompleteCallback set. |
|
|
@ -339,16 +336,14 @@ class FFmpegKitConfig { |
|
|
|
|
|
|
|
|
|
|
|
/// Sets a global MediaInformationSessionCompleteCallback to receive |
|
|
|
/// Sets a global MediaInformationSessionCompleteCallback to receive |
|
|
|
/// execution results for MediaInformation sessions. |
|
|
|
/// execution results for MediaInformation sessions. |
|
|
|
static void enableMediaInformationSessionCompleteCallback( |
|
|
|
static void enableMediaInformationSessionCompleteCallback([ |
|
|
|
[MediaInformationSessionCompleteCallback? |
|
|
|
MediaInformationSessionCompleteCallback? mediaInformationSessionCompleteCallback = null, |
|
|
|
mediaInformationSessionCompleteCallback = null]) { |
|
|
|
]) { |
|
|
|
FFmpegKitFactory.setGlobalMediaInformationSessionCompleteCallback( |
|
|
|
FFmpegKitFactory.setGlobalMediaInformationSessionCompleteCallback(mediaInformationSessionCompleteCallback); |
|
|
|
mediaInformationSessionCompleteCallback); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns the global MediaInformationSessionCompleteCallback set. |
|
|
|
/// Returns the global MediaInformationSessionCompleteCallback set. |
|
|
|
static MediaInformationSessionCompleteCallback? |
|
|
|
static MediaInformationSessionCompleteCallback? getMediaInformationSessionCompleteCallback() => |
|
|
|
getMediaInformationSessionCompleteCallback() => |
|
|
|
|
|
|
|
FFmpegKitFactory.getGlobalMediaInformationSessionCompleteCallback(); |
|
|
|
FFmpegKitFactory.getGlobalMediaInformationSessionCompleteCallback(); |
|
|
|
|
|
|
|
|
|
|
|
/// Returns the current log level. |
|
|
|
/// Returns the current log level. |
|
|
@ -404,8 +399,7 @@ class FFmpegKitConfig { |
|
|
|
/// Note that this method is Android only. It will fail if called on other |
|
|
|
/// Note that this method is Android only. It will fail if called on other |
|
|
|
/// platforms. It also requires API Level ≥ 19. On older API levels it |
|
|
|
/// platforms. It also requires API Level ≥ 19. On older API levels it |
|
|
|
/// returns an empty url. |
|
|
|
/// returns an empty url. |
|
|
|
static Future<String?> getSafParameter( |
|
|
|
static Future<String?> getSafParameter(String uriString, String openMode) async { |
|
|
|
String uriString, String openMode) async { |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform.ffmpegKitConfigGetSafParameter(uriString, openMode); |
|
|
|
return _platform.ffmpegKitConfigGetSafParameter(uriString, openMode); |
|
|
@ -441,9 +435,7 @@ class FFmpegKitConfig { |
|
|
|
static Future<Session?> getSession(int sessionId) async { |
|
|
|
static Future<Session?> getSession(int sessionId) async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform |
|
|
|
return _platform.ffmpegKitConfigGetSession(sessionId).then(FFmpegKitFactory.mapToNullableSession); |
|
|
|
.ffmpegKitConfigGetSession(sessionId) |
|
|
|
|
|
|
|
.then(FFmpegKitFactory.mapToNullableSession); |
|
|
|
|
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin getSession error: ${e.message}"); |
|
|
|
print("Plugin getSession error: ${e.message}"); |
|
|
|
return Future.error("getSession failed.", stack); |
|
|
|
return Future.error("getSession failed.", stack); |
|
|
@ -454,9 +446,7 @@ class FFmpegKitConfig { |
|
|
|
static Future<Session?> getLastSession() async { |
|
|
|
static Future<Session?> getLastSession() async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform |
|
|
|
return _platform.ffmpegKitConfigGetLastSession().then(FFmpegKitFactory.mapToNullableSession); |
|
|
|
.ffmpegKitConfigGetLastSession() |
|
|
|
|
|
|
|
.then(FFmpegKitFactory.mapToNullableSession); |
|
|
|
|
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin getLastSession error: ${e.message}"); |
|
|
|
print("Plugin getLastSession error: ${e.message}"); |
|
|
|
return Future.error("getLastSession failed.", stack); |
|
|
|
return Future.error("getLastSession failed.", stack); |
|
|
@ -467,9 +457,7 @@ class FFmpegKitConfig { |
|
|
|
static Future<Session?> getLastCompletedSession() async { |
|
|
|
static Future<Session?> getLastCompletedSession() async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform |
|
|
|
return _platform.ffmpegKitConfigGetLastCompletedSession().then(FFmpegKitFactory.mapToNullableSession); |
|
|
|
.ffmpegKitConfigGetLastCompletedSession() |
|
|
|
|
|
|
|
.then(FFmpegKitFactory.mapToNullableSession); |
|
|
|
|
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin getLastCompletedSession error: ${e.message}"); |
|
|
|
print("Plugin getLastCompletedSession error: ${e.message}"); |
|
|
|
return Future.error("getLastCompletedSession failed.", stack); |
|
|
|
return Future.error("getLastCompletedSession failed.", stack); |
|
|
@ -485,8 +473,7 @@ class FFmpegKitConfig { |
|
|
|
return List.empty(); |
|
|
|
return List.empty(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return sessions |
|
|
|
return sessions |
|
|
|
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( |
|
|
|
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>)) |
|
|
|
sessionObject as Map<dynamic, dynamic>)) |
|
|
|
|
|
|
|
.toList(); |
|
|
|
.toList(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -517,8 +504,7 @@ class FFmpegKitConfig { |
|
|
|
return List.empty(); |
|
|
|
return List.empty(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return sessions |
|
|
|
return sessions |
|
|
|
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( |
|
|
|
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>)) |
|
|
|
sessionObject as Map<dynamic, dynamic>)) |
|
|
|
|
|
|
|
.map((session) => session as FFmpegSession) |
|
|
|
.map((session) => session as FFmpegSession) |
|
|
|
.toList(); |
|
|
|
.toList(); |
|
|
|
} |
|
|
|
} |
|
|
@ -538,8 +524,7 @@ class FFmpegKitConfig { |
|
|
|
return List.empty(); |
|
|
|
return List.empty(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return sessions |
|
|
|
return sessions |
|
|
|
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( |
|
|
|
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>)) |
|
|
|
sessionObject as Map<dynamic, dynamic>)) |
|
|
|
|
|
|
|
.map((session) => session as FFprobeSession) |
|
|
|
.map((session) => session as FFprobeSession) |
|
|
|
.toList(); |
|
|
|
.toList(); |
|
|
|
} |
|
|
|
} |
|
|
@ -551,19 +536,15 @@ class FFmpegKitConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns all MediaInformation sessions in the session history. |
|
|
|
/// Returns all MediaInformation sessions in the session history. |
|
|
|
static Future<List<MediaInformationSession>> |
|
|
|
static Future<List<MediaInformationSession>> getMediaInformationSessions() async { |
|
|
|
getMediaInformationSessions() async { |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
await FFmpegKitConfig.init(); |
|
|
|
await FFmpegKitConfig.init(); |
|
|
|
return _platform |
|
|
|
return _platform.ffprobeKitListMediaInformationSessions().then((sessions) { |
|
|
|
.ffprobeKitListMediaInformationSessions() |
|
|
|
|
|
|
|
.then((sessions) { |
|
|
|
|
|
|
|
if (sessions == null) { |
|
|
|
if (sessions == null) { |
|
|
|
return List.empty(); |
|
|
|
return List.empty(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return sessions |
|
|
|
return sessions |
|
|
|
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( |
|
|
|
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>)) |
|
|
|
sessionObject as Map<dynamic, dynamic>)) |
|
|
|
|
|
|
|
.map((session) => session as MediaInformationSession) |
|
|
|
.map((session) => session as MediaInformationSession) |
|
|
|
.toList(); |
|
|
|
.toList(); |
|
|
|
} |
|
|
|
} |
|
|
@ -575,19 +556,15 @@ class FFmpegKitConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns sessions that have [sessionState]. |
|
|
|
/// Returns sessions that have [sessionState]. |
|
|
|
static Future<List<Session>> getSessionsByState( |
|
|
|
static Future<List<Session>> getSessionsByState(SessionState sessionState) async { |
|
|
|
SessionState sessionState) async { |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform |
|
|
|
return _platform.ffmpegKitConfigGetSessionsByState(sessionState.index).then((sessions) { |
|
|
|
.ffmpegKitConfigGetSessionsByState(sessionState.index) |
|
|
|
|
|
|
|
.then((sessions) { |
|
|
|
|
|
|
|
if (sessions == null) { |
|
|
|
if (sessions == null) { |
|
|
|
return List.empty(); |
|
|
|
return List.empty(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return sessions |
|
|
|
return sessions |
|
|
|
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession( |
|
|
|
.map((dynamic sessionObject) => FFmpegKitFactory.mapToSession(sessionObject as Map<dynamic, dynamic>)) |
|
|
|
sessionObject as Map<dynamic, dynamic>)) |
|
|
|
|
|
|
|
.toList(); |
|
|
|
.toList(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -598,12 +575,10 @@ class FFmpegKitConfig { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns the active log redirection strategy. |
|
|
|
/// Returns the active log redirection strategy. |
|
|
|
static LogRedirectionStrategy getLogRedirectionStrategy() => |
|
|
|
static LogRedirectionStrategy getLogRedirectionStrategy() => _globalLogRedirectionStrategy; |
|
|
|
_globalLogRedirectionStrategy; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Sets the log redirection strategy. |
|
|
|
/// Sets the log redirection strategy. |
|
|
|
static void setLogRedirectionStrategy( |
|
|
|
static void setLogRedirectionStrategy(LogRedirectionStrategy logRedirectionStrategy) { |
|
|
|
LogRedirectionStrategy logRedirectionStrategy) { |
|
|
|
|
|
|
|
_globalLogRedirectionStrategy = logRedirectionStrategy; |
|
|
|
_globalLogRedirectionStrategy = logRedirectionStrategy; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -630,8 +605,6 @@ class FFmpegKitConfig { |
|
|
|
return "FAILED"; |
|
|
|
return "FAILED"; |
|
|
|
case SessionState.completed: |
|
|
|
case SessionState.completed: |
|
|
|
return "COMPLETED"; |
|
|
|
return "COMPLETED"; |
|
|
|
default: |
|
|
|
|
|
|
|
return ""; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -660,8 +633,7 @@ class FFmpegKitConfig { |
|
|
|
argumentList.add(currentArgument.toString()); |
|
|
|
argumentList.add(currentArgument.toString()); |
|
|
|
currentArgument = new StringBuffer(); |
|
|
|
currentArgument = new StringBuffer(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (currentChar == '\''.codeUnitAt(0) && |
|
|
|
} else if (currentChar == '\''.codeUnitAt(0) && (previousChar == null || previousChar != '\\'.codeUnitAt(0))) { |
|
|
|
(previousChar == null || previousChar != '\\'.codeUnitAt(0))) { |
|
|
|
|
|
|
|
if (singleQuoteStarted) { |
|
|
|
if (singleQuoteStarted) { |
|
|
|
singleQuoteStarted = false; |
|
|
|
singleQuoteStarted = false; |
|
|
|
} else if (doubleQuoteStarted) { |
|
|
|
} else if (doubleQuoteStarted) { |
|
|
@ -669,8 +641,7 @@ class FFmpegKitConfig { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
singleQuoteStarted = true; |
|
|
|
singleQuoteStarted = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (currentChar == '\"'.codeUnitAt(0) && |
|
|
|
} else if (currentChar == '\"'.codeUnitAt(0) && (previousChar == null || previousChar != '\\'.codeUnitAt(0))) { |
|
|
|
(previousChar == null || previousChar != '\\'.codeUnitAt(0))) { |
|
|
|
|
|
|
|
if (doubleQuoteStarted) { |
|
|
|
if (doubleQuoteStarted) { |
|
|
|
doubleQuoteStarted = false; |
|
|
|
doubleQuoteStarted = false; |
|
|
|
} else if (singleQuoteStarted) { |
|
|
|
} else if (singleQuoteStarted) { |
|
|
@ -782,8 +753,7 @@ class FFmpegKitConfig { |
|
|
|
/// |
|
|
|
/// |
|
|
|
/// Note that this method is Android only. It will fail if called on other |
|
|
|
/// Note that this method is Android only. It will fail if called on other |
|
|
|
/// platforms. |
|
|
|
/// platforms. |
|
|
|
static Future<String?> selectDocumentForRead( |
|
|
|
static Future<String?> selectDocumentForRead([String? type = null, List<String>? extraTypes = null]) async { |
|
|
|
[String? type = null, List<String>? extraTypes = null]) async { |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform.ffmpegKitConfigSelectDocumentForRead(type, extraTypes); |
|
|
|
return _platform.ffmpegKitConfigSelectDocumentForRead(type, extraTypes); |
|
|
@ -799,14 +769,14 @@ class FFmpegKitConfig { |
|
|
|
/// |
|
|
|
/// |
|
|
|
/// Note that this method is Android only. It will fail if called on other |
|
|
|
/// Note that this method is Android only. It will fail if called on other |
|
|
|
/// platforms. |
|
|
|
/// platforms. |
|
|
|
static Future<String?> selectDocumentForWrite( |
|
|
|
static Future<String?> selectDocumentForWrite([ |
|
|
|
[String? title = null, |
|
|
|
String? title = null, |
|
|
|
String? type = null, |
|
|
|
String? type = null, |
|
|
|
List<String>? extraTypes = null]) async { |
|
|
|
List<String>? extraTypes = null, |
|
|
|
|
|
|
|
]) async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await init(); |
|
|
|
await init(); |
|
|
|
return _platform.ffmpegKitConfigSelectDocumentForWrite( |
|
|
|
return _platform.ffmpegKitConfigSelectDocumentForWrite(title, type, extraTypes); |
|
|
|
title, type, extraTypes); |
|
|
|
|
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
} on PlatformException catch (e, stack) { |
|
|
|
print("Plugin selectDocumentForWrite error: ${e.message}"); |
|
|
|
print("Plugin selectDocumentForWrite error: ${e.message}"); |
|
|
|
return Future.error("selectDocumentForWrite failed.", stack); |
|
|
|
return Future.error("selectDocumentForWrite failed.", stack); |
|
|
|