diff --git a/flutter/flutter/lib/chapter.dart b/flutter/flutter/lib/chapter.dart
new file mode 100644
index 0000000..2dc47c3
--- /dev/null
+++ b/flutter/flutter/lib/chapter.dart
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2019-2021 Taner Sener
+ *
+ * This file is part of FFmpegKit.
+ *
+ * FFmpegKit 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.
+ *
+ * FFmpegKit 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 FFmpegKit. If not, see .
+ */
+
+class Chapter {
+ int id;
+ String timeBase;
+ int start;
+ int end;
+ String startTime;
+ String endTime;
+ Tags tags;
+
+ Chapter(this.id, this.timeBase, this.start, this.end, this.startTime,
+ this.endTime, this.tags);
+}
+
+class Tags {
+ String title;
+
+ Tags(this.title);
+}
diff --git a/flutter/flutter/lib/media_information.dart b/flutter/flutter/lib/media_information.dart
index 44dba7e..cc30e2a 100644
--- a/flutter/flutter/lib/media_information.dart
+++ b/flutter/flutter/lib/media_information.dart
@@ -17,6 +17,7 @@
* along with FFmpegKit. If not, see .
*/
+import 'chapter.dart';
import 'stream_information.dart';
/// Media information class.
@@ -87,6 +88,28 @@ class MediaInformation {
return list;
}
+ /// Returns all chapters
+ List getChapters() {
+ final List list = List.empty(growable: true);
+ List chapters = List.empty(growable: true);
+ if (_allProperties?["chapters"] != null) {
+ chapters = [];
+ _allProperties!['chapters'].forEach((dynamic chapter) {
+ final int id = chapter['id'];
+ final String timeBase = chapter['time_base'];
+ final int start = chapter['start'];
+ final int end = chapter['end'];
+ final String startTime = chapter['start_time'];
+ final String endTime = chapter['end_time'];
+ final Tags tags = Tags(chapter['tags']['title'] ?? "");
+ chapters.add(
+ new Chapter(id, timeBase, start, end, startTime, endTime, tags));
+ });
+ }
+ list.addAll(chapters);
+ return list;
+ }
+
/// Returns all media properties.
Map? getMediaProperties() =>
this._allProperties?[keyMediaProperties];