implement get chapters api in media information
This commit is contained in:
parent
6bb4fc3352
commit
203783f97c
37
flutter/flutter/lib/chapter.dart
Normal file
37
flutter/flutter/lib/chapter.dart
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
@ -17,6 +17,7 @@
|
|||||||
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import 'chapter.dart';
|
||||||
import 'stream_information.dart';
|
import 'stream_information.dart';
|
||||||
|
|
||||||
/// Media information class.
|
/// Media information class.
|
||||||
@ -87,6 +88,28 @@ class MediaInformation {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns all chapters
|
||||||
|
List<Chapter> getChapters() {
|
||||||
|
final List<Chapter> list = List<Chapter>.empty(growable: true);
|
||||||
|
List<Chapter> chapters = List.empty(growable: true);
|
||||||
|
if (_allProperties?["chapters"] != null) {
|
||||||
|
chapters = <Chapter>[];
|
||||||
|
_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.
|
/// Returns all media properties.
|
||||||
Map<dynamic, dynamic>? getMediaProperties() =>
|
Map<dynamic, dynamic>? getMediaProperties() =>
|
||||||
this._allProperties?[keyMediaProperties];
|
this._allProperties?[keyMediaProperties];
|
||||||
|
Loading…
Reference in New Issue
Block a user