summaryrefslogtreecommitdiffstats
path: root/macosx/HBAudioTrack.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2019-08-13 10:27:05 +0200
committerDamiano Galassi <[email protected]>2019-08-13 10:27:05 +0200
commitf2a619679551fd988c4e28bf68108f174d64fb3d (patch)
tree3b7b294d44d5afd20a864c2b9d2f3676f7a4749a /macosx/HBAudioTrack.m
parent5b3c3c620855130c7bcd47685ad69a765e0cfd7b (diff)
MacGui: convert the last usage of NSDictionary to a proper class, fix external subtitles tracks when sandboxed. Add initial support to the model to store the track title.
Diffstat (limited to 'macosx/HBAudioTrack.m')
-rw-r--r--macosx/HBAudioTrack.m38
1 files changed, 17 insertions, 21 deletions
diff --git a/macosx/HBAudioTrack.m b/macosx/HBAudioTrack.m
index c854d7fdc..c3cc22c3e 100644
--- a/macosx/HBAudioTrack.m
+++ b/macosx/HBAudioTrack.m
@@ -8,17 +8,9 @@
#import "HBAudioController.h"
#import "HBJob.h"
#import "HBCodingUtilities.h"
+#import "HBTitle.h"
#import "hb.h"
-NSString *keyAudioTrackIndex = @"keyAudioTrackIndex";
-NSString *keyAudioTrackName = @"keyAudioTrackName";
-NSString *keyAudioInputBitrate = @"keyAudioInputBitrate";
-NSString *keyAudioInputSampleRate = @"keyAudioInputSampleRate";
-NSString *keyAudioInputCodec = @"keyAudioInputCodec";
-NSString *keyAudioInputCodecParam = @"keyAudioInputCodecParam";
-NSString *keyAudioInputChannelLayout = @"keyAudioInputChannelLayout";
-NSString *keyAudioTrackLanguageIsoCode = @"keyAudioTrackLanguageIsoCode";
-
#define DEFAULT_SAMPLERATE 48000
@interface HBAudioTrack ()
@@ -230,8 +222,8 @@ NSString *keyAudioTrackLanguageIsoCode = @"keyAudioTrackLanguageIsoCode";
{
if (proposedEncoder)
{
- NSDictionary *sourceTrack = [_dataSource sourceTrackAtIndex:_sourceTrackIdx];
- int inputCodec = [sourceTrack[keyAudioInputCodec] intValue];
+ HBTitleAudioTrack *sourceTrack = [_dataSource sourceTrackAtIndex:_sourceTrackIdx];
+ int inputCodec = sourceTrack.codec;
hb_encoder_t *proposedEncoderInfo = hb_audio_encoder_get_from_codec(proposedEncoder);
@@ -261,8 +253,8 @@ NSString *keyAudioTrackLanguageIsoCode = @"keyAudioTrackLanguageIsoCode";
- (int)sanatizeMixdownValue:(int)proposedMixdown
{
- NSDictionary *sourceTrack = [_dataSource sourceTrackAtIndex:_sourceTrackIdx];
- unsigned long long channelLayout = [sourceTrack[keyAudioInputChannelLayout] unsignedLongLongValue];
+ HBTitleAudioTrack *sourceTrack = [_dataSource sourceTrackAtIndex:_sourceTrackIdx];
+ uint64_t channelLayout = sourceTrack.channelLayout;
if (!hb_mixdown_is_supported(proposedMixdown, self.encoder, channelLayout))
{
@@ -308,8 +300,8 @@ NSString *keyAudioTrackLanguageIsoCode = @"keyAudioTrackLanguageIsoCode";
{
NSMutableArray<NSString *> *encoders = [[NSMutableArray alloc] init];
- NSDictionary *sourceTrack = [_dataSource sourceTrackAtIndex:_sourceTrackIdx];
- int inputCodec = [sourceTrack[keyAudioInputCodec] intValue];
+ HBTitleAudioTrack *sourceTrack = [_dataSource sourceTrackAtIndex:_sourceTrackIdx];
+ int inputCodec = sourceTrack.codec;
for (const hb_encoder_t *audio_encoder = hb_audio_encoder_get_next(NULL);
audio_encoder != NULL;
@@ -339,8 +331,8 @@ NSString *keyAudioTrackLanguageIsoCode = @"keyAudioTrackLanguageIsoCode";
{
NSMutableArray<NSString *> *mixdowns = [[NSMutableArray alloc] init];
- NSDictionary *sourceTrack = [_dataSource sourceTrackAtIndex:_sourceTrackIdx];
- unsigned long long channelLayout = [sourceTrack[keyAudioInputChannelLayout] unsignedLongLongValue];
+ HBTitleAudioTrack *sourceTrack = [_dataSource sourceTrackAtIndex:_sourceTrackIdx];
+ uint64_t channelLayout = sourceTrack.channelLayout;
for (const hb_mixdown_t *mixdown = hb_mixdown_get_next(NULL);
mixdown != NULL;
@@ -438,10 +430,10 @@ NSString *keyAudioTrackLanguageIsoCode = @"keyAudioTrackLanguageIsoCode";
if (retval)
{
- NSDictionary *sourceTrack = [_dataSource sourceTrackAtIndex:_sourceTrackIdx];
+ HBTitleAudioTrack *sourceTrack = [_dataSource sourceTrackAtIndex:_sourceTrackIdx];
- int inputCodec = [sourceTrack[keyAudioInputCodec] intValue];
- int inputCodecParam = [sourceTrack[keyAudioInputCodecParam] intValue];
+ int inputCodec = sourceTrack.codec;
+ int inputCodecParam = sourceTrack.codecParam;
if (!hb_audio_can_apply_drc(inputCodec, inputCodecParam, self.encoder))
{
retval = NO;
@@ -539,7 +531,7 @@ NSString *keyAudioTrackLanguageIsoCode = @"keyAudioTrackLanguageIsoCode";
- (void)encodeWithCoder:(NSCoder *)coder
{
- [coder encodeInt:3 forKey:@"HBAudioTrackVersion"];
+ [coder encodeInt:4 forKey:@"HBAudioTrackVersion"];
encodeInteger(_sourceTrackIdx);
encodeInt(_container);
@@ -551,6 +543,8 @@ NSString *keyAudioTrackLanguageIsoCode = @"keyAudioTrackLanguageIsoCode";
encodeDouble(_gain);
encodeDouble(_drc);
+
+ encodeObject(_title);
}
- (instancetype)initWithCoder:(NSCoder *)decoder
@@ -568,6 +562,8 @@ NSString *keyAudioTrackLanguageIsoCode = @"keyAudioTrackLanguageIsoCode";
decodeDouble(_gain);
decodeDouble(_drc);
+ decodeObject(_title, NSString);
+
return self;
fail: