Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

Commit

Permalink
changed return types on plugin to be able to return null. fixed null …
Browse files Browse the repository at this point in the history
…checks on example. set example to use full-gpl package since video stabilization is not in full
  • Loading branch information
ibedek committed Mar 11, 2021
1 parent 7cfa597 commit 4c170f9
Show file tree
Hide file tree
Showing 17 changed files with 243 additions and 243 deletions.
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ subprojects {
project.evaluationDependsOn(':app')
}

ext.flutterFFmpegPackage = 'full'
ext.flutterFFmpegPackage = 'full-gpl'

task clean(type: Delete) {
delete rootProject.buildDir
Expand Down
14 changes: 7 additions & 7 deletions example/lib/audio_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ import 'package:flutter_ffmpeg_example/video_util.dart';
import 'util.dart';

class AudioTab {
RefreshablePlayerDialogFactory _refreshablePlayerDialogFactory;
String _selectedCodec;
String _outputText;
late RefreshablePlayerDialogFactory _refreshablePlayerDialogFactory;
late String _selectedCodec;
String _outputText = "";

void init(RefreshablePlayerDialogFactory refreshablePlayerDialogFactory) {
_refreshablePlayerDialogFactory = refreshablePlayerDialogFactory;
List<DropdownMenuItem<String>> videoCodecList = getAudioCodecList();
_selectedCodec = videoCodecList[0].value;
_selectedCodec = videoCodecList[0].value!;
clearLog();
}

Expand All @@ -65,8 +65,8 @@ class AudioTab {
_outputText = "";
}

void changedAudioCodec(String selectedCodec) {
_selectedCodec = selectedCodec;
void changedAudioCodec(String? selectedCodec) {
_selectedCodec = selectedCodec!;
_refreshablePlayerDialogFactory.refresh();
}

Expand Down Expand Up @@ -222,7 +222,7 @@ class AudioTab {
}

List<DropdownMenuItem<String>> getAudioCodecList() {
List<DropdownMenuItem<String>> list = List.empty();
List<DropdownMenuItem<String>> list = List.empty(growable: true);

list.add(new DropdownMenuItem(
value: "mp2 (twolame)",
Expand Down
6 changes: 3 additions & 3 deletions example/lib/command_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import 'flutter_ffmpeg_api_wrapper.dart';
import 'util.dart';

class CommandTab {
Refreshable _refreshable;
TextEditingController _commandText;
String _outputText;
late Refreshable _refreshable;
late TextEditingController _commandText;
String _outputText = "";

void init(Refreshable refreshable) {
_refreshable = refreshable;
Expand Down
10 changes: 5 additions & 5 deletions example/lib/concurrent_execution_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import 'package:flutter_ffmpeg_example/video_util.dart';
import 'util.dart';

class ConcurrentExecutionTab {
Refreshable _refreshable;
String _outputText;
int _executionId1;
int _executionId2;
int _executionId3;
late Refreshable _refreshable;
String _outputText = "";
late int _executionId1;
late int _executionId2;
late int _executionId3;

void init(Refreshable refreshable) {
_refreshable = refreshable;
Expand Down
6 changes: 3 additions & 3 deletions example/lib/flutter_ffmpeg_api_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ final FlutterFFmpegConfig _flutterFFmpegConfig = new FlutterFFmpegConfig();
final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();
final FlutterFFprobe _flutterFFprobe = new FlutterFFprobe();

void enableLogCallback(LogCallback callback) {
void enableLogCallback(LogCallback? callback) {
_flutterFFmpegConfig.enableLogCallback(callback);
}

void enableStatisticsCallback(StatisticsCallback callback) {
void enableStatisticsCallback(StatisticsCallback? callback) {
_flutterFFmpegConfig.enableStatisticsCallback(callback);
}

Expand Down Expand Up @@ -153,6 +153,6 @@ Future<List<FFmpegExecution>> listFFmpegExecutions() async {
return await _flutterFFmpeg.listExecutions();
}

List<String> parseArguments(command) {
List<String>? parseArguments(command) {
return FlutterFFmpeg.parseArguments(command);
}
123 changes: 59 additions & 64 deletions example/lib/https_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class HttpsTab {
static const String HTTPS_TEST_DEFAULT_URL =
"https://download.blender.org/peach/trailer/trailer_1080p.ogg";

Refreshable _refreshable;
TextEditingController _urlText;
String _outputText;
late Refreshable _refreshable;
late TextEditingController _urlText;
String _outputText = "";

void init(Refreshable refreshable) {
_refreshable = refreshable;
Expand Down Expand Up @@ -79,107 +79,102 @@ class HttpsTab {
getMediaInformation(testUrl).then((information) {
if (information.getMediaProperties() != null) {
ffprint("---");
if (information.getMediaProperties().containsKey('filename')) {
ffprint('Path: ${information.getMediaProperties()['filename']}');
Map<dynamic, dynamic> mediaProperties =
information.getMediaProperties()!;
if (mediaProperties.containsKey('filename')) {
ffprint('Path: ${mediaProperties['filename']}');
}
if (information.getMediaProperties().containsKey('format_name')) {
ffprint("Format: " + information.getMediaProperties()['format_name']);
if (mediaProperties.containsKey('format_name')) {
ffprint("Format: " + mediaProperties['format_name']);
}
if (information.getMediaProperties().containsKey('bit_rate')) {
ffprint("Bitrate: " + information.getMediaProperties()['bit_rate']);
if (mediaProperties.containsKey('bit_rate')) {
ffprint("Bitrate: " + mediaProperties['bit_rate']);
}
if (information.getMediaProperties().containsKey('duration')) {
ffprint("Duration: " + information.getMediaProperties()['duration']);
if (mediaProperties.containsKey('duration')) {
ffprint("Duration: " + mediaProperties['duration']);
}
if (information.getMediaProperties().containsKey('start_time')) {
ffprint(
"Start time: " + information.getMediaProperties()['start_time']);
if (mediaProperties.containsKey('start_time')) {
ffprint("Start time: " + mediaProperties['start_time']);
}
if (information.getMediaProperties().containsKey('nb_streams')) {
ffprint("Number of streams: " +
information.getMediaProperties()['nb_streams'].toString());
if (mediaProperties.containsKey('nb_streams')) {
ffprint(
"Number of streams: " + mediaProperties['nb_streams'].toString());
}
Map<dynamic, dynamic> tags = information.getMediaProperties()['tags'];
Map<dynamic, dynamic>? tags = mediaProperties['tags'];
if (tags != null) {
tags.forEach((key, value) {
ffprint("Tag: " + key + ":" + value);
});
}

List<StreamInformation> streams = information.getStreams();
List<StreamInformation>? streams = information.getStreams();
if (streams != null) {
for (var i = 0; i < streams.length; ++i) {
StreamInformation stream = streams[i];
ffprint("---");
if (stream.getAllProperties().containsKey('index')) {
ffprint("Stream index: " +
stream.getAllProperties()['index'].toString());
}
if (stream.getAllProperties().containsKey('codec_type')) {
ffprint(
"Stream type: " + stream.getAllProperties()['codec_type']);
Map<dynamic, dynamic> streamProperties = stream.getAllProperties();
if (streamProperties.containsKey('index')) {
ffprint("Stream index: " + streamProperties['index'].toString());
}
if (stream.getAllProperties().containsKey('codec_name')) {
ffprint(
"Stream codec: " + stream.getAllProperties()['codec_name']);
if (streamProperties.containsKey('codec_type')) {
ffprint("Stream type: " + streamProperties['codec_type']);
}
if (stream.getAllProperties().containsKey('codec_long_name')) {
ffprint("Stream full codec: " +
stream.getAllProperties()['codec_long_name']);
if (streamProperties.containsKey('codec_name')) {
ffprint("Stream codec: " + streamProperties['codec_name']);
}
if (stream.getAllProperties().containsKey('pix_fmt')) {
ffprint("Stream format: " + stream.getAllProperties()['pix_fmt']);
if (streamProperties.containsKey('codec_long_name')) {
ffprint(
"Stream full codec: " + streamProperties['codec_long_name']);
}
if (stream.getAllProperties().containsKey('width')) {
ffprint("Stream width: " +
stream.getAllProperties()['width'].toString());
if (streamProperties.containsKey('pix_fmt')) {
ffprint("Stream format: " + streamProperties['pix_fmt']);
}
if (stream.getAllProperties().containsKey('height')) {
ffprint("Stream height: " +
stream.getAllProperties()['height'].toString());
if (streamProperties.containsKey('width')) {
ffprint("Stream width: " + streamProperties['width'].toString());
}
if (stream.getAllProperties().containsKey('bit_rate')) {
if (streamProperties.containsKey('height')) {
ffprint(
"Stream bitrate: " + stream.getAllProperties()['bit_rate']);
"Stream height: " + streamProperties['height'].toString());
}
if (stream.getAllProperties().containsKey('sample_rate')) {
ffprint("Stream sample rate: " +
stream.getAllProperties()['sample_rate']);
if (streamProperties.containsKey('bit_rate')) {
ffprint("Stream bitrate: " + streamProperties['bit_rate']);
}
if (stream.getAllProperties().containsKey('sample_fmt')) {
ffprint("Stream sample format: " +
stream.getAllProperties()['sample_fmt']);
if (streamProperties.containsKey('sample_rate')) {
ffprint("Stream sample rate: " + streamProperties['sample_rate']);
}
if (streamProperties.containsKey('sample_fmt')) {
ffprint(
"Stream sample format: " + streamProperties['sample_fmt']);
}
if (stream.getAllProperties().containsKey('channel_layout')) {
if (streamProperties.containsKey('channel_layout')) {
ffprint("Stream channel layout: " +
stream.getAllProperties()['channel_layout']);
streamProperties['channel_layout']);
}
if (stream.getAllProperties().containsKey('sample_aspect_ratio')) {
if (streamProperties.containsKey('sample_aspect_ratio')) {
ffprint("Stream sample aspect ratio: " +
stream.getAllProperties()['sample_aspect_ratio']);
streamProperties['sample_aspect_ratio']);
}
if (stream.getAllProperties().containsKey('display_aspect_ratio')) {
if (streamProperties.containsKey('display_aspect_ratio')) {
ffprint("Stream display aspect ratio: " +
stream.getAllProperties()['display_aspect_ratio']);
streamProperties['display_aspect_ratio']);
}
if (stream.getAllProperties().containsKey('avg_frame_rate')) {
if (streamProperties.containsKey('avg_frame_rate')) {
ffprint("Stream average frame rate: " +
stream.getAllProperties()['avg_frame_rate']);
streamProperties['avg_frame_rate']);
}
if (stream.getAllProperties().containsKey('r_frame_rate')) {
if (streamProperties.containsKey('r_frame_rate')) {
ffprint("Stream real frame rate: " +
stream.getAllProperties()['r_frame_rate']);
streamProperties['r_frame_rate']);
}
if (stream.getAllProperties().containsKey('time_base')) {
ffprint("Stream time base: " +
stream.getAllProperties()['time_base']);
if (streamProperties.containsKey('time_base')) {
ffprint("Stream time base: " + streamProperties['time_base']);
}
if (stream.getAllProperties().containsKey('codec_time_base')) {
if (streamProperties.containsKey('codec_time_base')) {
ffprint("Stream codec time base: " +
stream.getAllProperties()['codec_time_base']);
streamProperties['codec_time_base']);
}

Map<dynamic, dynamic> tags = stream.getAllProperties()['tags'];
Map<dynamic, dynamic>? tags = streamProperties['tags'];
if (tags != null) {
tags.forEach((key, value) {
ffprint("Stream tag: " + key + ":" + value);
Expand Down
Loading

0 comments on commit 4c170f9

Please sign in to comment.