StreamInformation.m
Go to the documentation of this file.
/*
* Copyright (c) 2018-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/>.
*/
#import "StreamInformation.h"
NSString* const StreamKeyIndex = @"index";
NSString* const StreamKeyType = @"codec_type";
NSString* const StreamKeyCodec = @"codec_name";
NSString* const StreamKeyCodecLong = @"codec_long_name";
NSString* const StreamKeyFormat = @"pix_fmt";
NSString* const StreamKeyWidth = @"width";
NSString* const StreamKeyHeight = @"height";
NSString* const StreamKeyBitRate = @"bit_rate";
NSString* const StreamKeySampleRate = @"sample_rate";
NSString* const StreamKeySampleFormat = @"sample_fmt";
NSString* const StreamKeyChannelLayout = @"channel_layout";
NSString* const StreamKeySampleAspectRatio = @"sample_aspect_ratio";
NSString* const StreamKeyDisplayAspectRatio = @"display_aspect_ratio";
NSString* const StreamKeyAverageFrameRate = @"avg_frame_rate";
NSString* const StreamKeyRealFrameRate = @"r_frame_rate";
NSString* const StreamKeyTimeBase = @"time_base";
NSString* const StreamKeyCodecTimeBase = @"codec_time_base";
NSString* const StreamKeyTags = @"tags";
@implementation StreamInformation {
NSDictionary *dictionary;
}
- (instancetype)init:(NSDictionary*)streamDictionary {
self = [super init];
if (self) {
dictionary = streamDictionary;
}
return self;
}
- (NSNumber*)getIndex {
return [self getNumberProperty:StreamKeyIndex];
}
- (NSString*)getType {
return [self getStringProperty:StreamKeyType];
}
- (NSString*)getCodec {
return [self getStringProperty:StreamKeyCodec];
}
- (NSString*)getFullCodec {
return [self getStringProperty:StreamKeyCodecLong];
}
- (NSString*)getFormat {
return [self getStringProperty:StreamKeyFormat];
}
- (NSNumber*)getWidth {
return [self getNumberProperty:StreamKeyWidth];
}
- (NSNumber*)getHeight {
return [self getNumberProperty:StreamKeyHeight];
}
- (NSString*)getBitrate {
return [self getStringProperty:StreamKeyBitRate];
}
- (NSString*)getSampleRate {
return [self getStringProperty:StreamKeySampleRate];
}
- (NSString*)getSampleFormat {
return [self getStringProperty:StreamKeySampleFormat];
}
- (NSString*)getChannelLayout {
return [self getStringProperty:StreamKeyChannelLayout];
}
- (NSString*)getSampleAspectRatio {
return [self getStringProperty:StreamKeySampleAspectRatio];
}
- (NSString*)getDisplayAspectRatio {
return [self getStringProperty:StreamKeyDisplayAspectRatio];
}
- (NSString*)getAverageFrameRate {
return [self getStringProperty:StreamKeyAverageFrameRate];
}
- (NSString*)getRealFrameRate {
return [self getStringProperty:StreamKeyRealFrameRate];
}
- (NSString*)getTimeBase {
return [self getStringProperty:StreamKeyTimeBase];
}
- (NSString*)getCodecTimeBase {
return [self getStringProperty:StreamKeyCodecTimeBase];
}
- (NSDictionary*)getTags {
return [self getProperties:StreamKeyTags];
}
- (NSString*)getStringProperty:(NSString*)key {
NSDictionary* allProperties = [self getAllProperties];
if (allProperties == nil) {
return nil;
}
return allProperties[key];
}
- (NSNumber*)getNumberProperty:(NSString*)key {
NSDictionary* mediaProperties = [self getAllProperties];
if (mediaProperties == nil) {
return nil;
}
return mediaProperties[key];
}
- (NSDictionary*)getProperties:(NSString*)key {
NSDictionary* allProperties = [self getAllProperties];
if (allProperties == nil) {
return nil;
}
return allProperties[key];
}
- (NSDictionary*)getAllProperties {
return dictionary;
}
@end
StreamInformation.h
StreamKeyTags
NSString *const StreamKeyTags
Definition: StreamInformation.m:39
StreamKeyChannelLayout
NSString *const StreamKeyChannelLayout
Definition: StreamInformation.m:32
StreamKeyFormat
NSString *const StreamKeyFormat
Definition: StreamInformation.m:26
StreamKeyDisplayAspectRatio
NSString *const StreamKeyDisplayAspectRatio
Definition: StreamInformation.m:34
StreamKeyType
NSString *const StreamKeyType
Definition: StreamInformation.m:23
StreamKeyBitRate
NSString *const StreamKeyBitRate
Definition: StreamInformation.m:29
StreamKeyHeight
NSString *const StreamKeyHeight
Definition: StreamInformation.m:28
StreamKeySampleAspectRatio
NSString *const StreamKeySampleAspectRatio
Definition: StreamInformation.m:33
StreamKeyCodec
NSString *const StreamKeyCodec
Definition: StreamInformation.m:24
StreamKeyCodecLong
NSString *const StreamKeyCodecLong
Definition: StreamInformation.m:25
StreamKeyWidth
NSString *const StreamKeyWidth
Definition: StreamInformation.m:27
StreamKeyTimeBase
NSString *const StreamKeyTimeBase
Definition: StreamInformation.m:37
StreamKeyIndex
NSString *const StreamKeyIndex
Definition: StreamInformation.m:22
StreamKeySampleRate
NSString *const StreamKeySampleRate
Definition: StreamInformation.m:30
StreamKeyRealFrameRate
NSString *const StreamKeyRealFrameRate
Definition: StreamInformation.m:36
StreamKeySampleFormat
NSString *const StreamKeySampleFormat
Definition: StreamInformation.m:31
StreamKeyCodecTimeBase
NSString *const StreamKeyCodecTimeBase
Definition: StreamInformation.m:38
StreamKeyAverageFrameRate
NSString *const StreamKeyAverageFrameRate
Definition: StreamInformation.m:35
StreamInformation
Definition: StreamInformation.h:48