refactor media information classes

This commit is contained in:
Taner Sener 2022-08-23 23:47:48 +01:00
parent c3d1bff355
commit fb8992a96c
3 changed files with 41 additions and 27 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Taner Sener
* Copyright (c) 2021-2022 Taner Sener
*
* This file is part of FFmpegKit.
*
@ -51,7 +51,7 @@ class Chapter {
String? getEndTime() => this.getStringProperty(Chapter.keyEndTime);
/// Returns all tags.
Map<dynamic, dynamic>? getTags() => this.getProperties(Chapter.keyTags);
Map<dynamic, dynamic>? getTags() => this.getProperty(Chapter.keyTags);
/// Returns the chapter property associated with the key.
String? getStringProperty(String key) => this._allProperties?[key];
@ -59,8 +59,8 @@ class Chapter {
/// Returns the chapter property associated with the key.
num? getNumberProperty(String key) => this._allProperties?[key];
/// Returns the chapter properties associated with the key.
dynamic getProperties(String key) => this._allProperties?[key];
/// Returns the chapter property associated with the key.
dynamic getProperty(String key) => this._allProperties?[key];
/// Returns all properties found.
Map<dynamic, dynamic>? getAllProperties() => this._allProperties;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021 Taner Sener
* Copyright (c) 2019-2022 Taner Sener
*
* This file is part of FFmpegKit.
*
@ -22,7 +22,7 @@ import 'stream_information.dart';
/// Media information class.
class MediaInformation {
static const keyMediaProperties = "format";
static const keyFormatProperties = "format";
static const keyFilename = "filename";
static const keyFormat = "format_name";
static const keyFormatLong = "format_long_name";
@ -38,40 +38,54 @@ class MediaInformation {
MediaInformation(this._allProperties);
/// Returns file name.
String? getFilename() => this.getStringProperty(MediaInformation.keyFilename);
String? getFilename() =>
this.getStringFormatProperty(MediaInformation.keyFilename);
/// Returns format.
String? getFormat() => this.getStringProperty(MediaInformation.keyFormat);
String? getFormat() =>
this.getStringFormatProperty(MediaInformation.keyFormat);
/// Returns long format.
String? getLongFormat() =>
this.getStringProperty(MediaInformation.keyFormatLong);
this.getStringFormatProperty(MediaInformation.keyFormatLong);
/// Returns duration.
String? getDuration() => this.getStringProperty(MediaInformation.keyDuration);
String? getDuration() =>
this.getStringFormatProperty(MediaInformation.keyDuration);
/// Returns start time.
String? getStartTime() =>
this.getStringProperty(MediaInformation.keyStartTime);
this.getStringFormatProperty(MediaInformation.keyStartTime);
/// Returns size.
String? getSize() => this.getStringProperty(MediaInformation.keySize);
String? getSize() => this.getStringFormatProperty(MediaInformation.keySize);
/// Returns bitrate.
String? getBitrate() => this.getStringProperty(MediaInformation.keyBitRate);
String? getBitrate() =>
this.getStringFormatProperty(MediaInformation.keyBitRate);
/// Returns all tags.
Map<dynamic, dynamic>? getTags() =>
this.getProperties(StreamInformation.keyTags);
this.getFormatProperty(StreamInformation.keyTags);
/// Returns the media property associated with the key.
String? getStringProperty(String key) => this.getMediaProperties()?[key];
/// Returns the property associated with the key.
String? getStringProperty(String key) => this.getAllProperties()?[key];
/// Returns the media property associated with the key.
num? getNumberProperty(String key) => this.getMediaProperties()?[key];
/// Returns the property associated with the key.
num? getNumberProperty(String key) => this.getAllProperties()?[key];
/// Returns the media properties associated with the key.
dynamic getProperties(String key) => this.getMediaProperties()?[key];
/// Returns the property associated with the key.
dynamic getProperty(String key) => this.getAllProperties()?[key];
/// Returns the format property associated with the key.
String? getStringFormatProperty(String key) =>
this.getFormatProperties()?[key];
/// Returns the format property associated with the key.
num? getNumberFormatProperty(String key) => this.getFormatProperties()?[key];
/// Returns the format property associated with the key.
dynamic getFormatProperty(String key) => this.getFormatProperties()?[key];
/// Returns all streams found as a list.
List<StreamInformation> getStreams() {
@ -102,9 +116,9 @@ class MediaInformation {
return list;
}
/// Returns all media properties.
Map<dynamic, dynamic>? getMediaProperties() =>
this._allProperties?[keyMediaProperties];
/// Returns all format properties found.
Map<dynamic, dynamic>? getFormatProperties() =>
this._allProperties?[keyFormatProperties];
/// Returns all properties found, including stream properties.
Map<dynamic, dynamic>? getAllProperties() => this._allProperties;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021 Taner Sener
* Copyright (c) 2019-2022 Taner Sener
*
* This file is part of FFmpegKit.
*
@ -108,7 +108,7 @@ class StreamInformation {
/// Returns all tags.
Map<dynamic, dynamic>? getTags() =>
this.getProperties(StreamInformation.keyTags);
this.getProperty(StreamInformation.keyTags);
/// Returns the stream property associated with the key.
String? getStringProperty(String key) => this._allProperties?[key];
@ -116,8 +116,8 @@ class StreamInformation {
/// Returns the stream property associated with the key.
num? getNumberProperty(String key) => this._allProperties?[key];
/// Returns the stream properties associated with the key.
dynamic getProperties(String key) => this._allProperties?[key];
/// Returns the stream property associated with the key.
dynamic getProperty(String key) => this._allProperties?[key];
/// Returns all properties found.
Map<dynamic, dynamic>? getAllProperties() => this._allProperties;