Skip to content

Commit

Permalink
[new] add isFiltersEnabled param to extractCover
Browse files Browse the repository at this point in the history
  • Loading branch information
Mael Le Goff committed Mar 11, 2022
1 parent 63746c7 commit 2f72a88
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/domain/bloc/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ class VideoEditorController extends ChangeNotifier {
///The [preset] is the `compress quality` **(Only available on min-gpl-lts package)**.
///A slower preset will provide better compression (compression is quality per filesize).
///**More info about presets**: https://ffmpeg.org/ffmpeg-formats.htmlhttps://trac.ffmpeg.org/wiki/Encode/H.264
///
///Set [isFiltersEnabled] to `false` if you do not want to apply any changes
Future<void> exportVideo({
required void Function(File? file) onCompleted,
String? name,
Expand Down Expand Up @@ -530,6 +532,8 @@ class VideoEditorController extends ChangeNotifier {
///The [scale] is `scale=width*scale:height*scale` and reduce or increase cover size.
///
///The [quality] of the exported image (from 0 to 100)
///
///Set [isFiltersEnabled] to `false` if you do not want to apply any changes
Future<void> extractCover({
required void Function(File? file) onCompleted,
String? name,
Expand All @@ -538,6 +542,7 @@ class VideoEditorController extends ChangeNotifier {
double scale = 1.0,
int quality = 100,
void Function(Statistics)? onProgress,
bool isFiltersEnabled = true,
}) async {
// final FlutterFFmpegConfig _config = FlutterFFmpegConfig();
final String tempPath = outDir ?? (await getTemporaryDirectory()).path;
Expand Down Expand Up @@ -568,8 +573,9 @@ class VideoEditorController extends ChangeNotifier {
//----------------//
final List<String> filters = [crop, scaleInstruction, rotation];
filters.removeWhere((item) => item.isEmpty);
final String filter =
filters.isNotEmpty ? "-filter:v " + filters.join(",") : "";
final String filter = filters.isNotEmpty && isFiltersEnabled
? "-filter:v " + filters.join(",")
: "";
final String execute = "-i \'$_coverPath\' $filter -y $outputPath";

//------------------//
Expand Down

0 comments on commit 2f72a88

Please sign in to comment.