{
self = [super init];
if (self) {
+ NSParameterAssert(title);
+ NSParameterAssert(fileURL);
+ NSParameterAssert(preset);
+
_title = title;
_fileURL = [fileURL copy];
_subtitlesDefaults = [[HBSubtitlesDefaults alloc] init];
_video = [[HBVideo alloc] init];
- _picture = [[HBPicture alloc] init];
+ _picture = [[HBPicture alloc] initWithTitle:title];
_filters = [[HBFilters alloc] init];
[self applyPreset:preset];
/**
* HBTitles is an interface to the low-level hb_title_t.
- * the properties ara lazy-loaded.
+ * the properties are lazy-loaded.
*/
@interface HBTitle : NSObject
@property (nonatomic, readonly) NSString *name;
@property (nonatomic, readonly, getter=isFeatured) BOOL featured;
-@property (nonatomic, readonly) hb_title_t *title;
+@property (nonatomic, readonly) hb_title_t *hb_title;
@property (nonatomic, readonly) NSArray *audioTracks;
@property (nonatomic, readonly) NSArray *subtitlesTracks;
return nil;
}
+ _hb_title = title;
_featured = featured;
}
{
if (!_name)
{
- if (self.title->type == HB_BD_TYPE)
- {
- _name = [NSString stringWithFormat:@"%s %d (%05d.MPLS) - %02dh%02dm%02ds",
- self.title->name, self.title->index, self.title->playlist,
- self.title->hours, self.title->minutes, self.title->seconds];
- }
- else
- {
- _name = [NSString stringWithFormat:@"%s %d - %02dh%02dm%02ds",
- self.title->name, self.title->index,
- self.title->hours, self.title->minutes, self.title->seconds];
- }
-
- [_name retain];
+ _name = [@(self.hb_title->name) retain];
}
return _name;
}
+- (NSString *)description
+{
+ if (self.hb_title->type == HB_BD_TYPE)
+ {
+ return [NSString stringWithFormat:@"%@ %d (%05d.MPLS) - %02dh%02dm%02ds",
+ @(self.hb_title->name), self.hb_title->index, self.hb_title->playlist,
+ self.hb_title->hours, self.hb_title->minutes, self.hb_title->seconds];
+ }
+ else
+ {
+ return [NSString stringWithFormat:@"%@ %d - %02dh%02dm%02ds",
+ @(self.hb_title->name), self.hb_title->index,
+ self.hb_title->hours, self.hb_title->minutes, self.hb_title->seconds];
+ }
+}
+
- (NSArray *)audioTracks
{
if (!_audioTracks)
{
NSMutableArray *tracks = [NSMutableArray array];
hb_audio_config_t *audio;
- hb_list_t *list = self.title->list_audio;
+ hb_list_t *list = self.hb_title->list_audio;
int count = hb_list_count(list);
// Initialize the audio list of available audio tracks from this title
{
NSMutableArray *tracks = [NSMutableArray array];
hb_subtitle_t *subtitle;
- hb_list_t *list = self.title->list_audio;
+ hb_list_t *list = self.hb_title->list_audio;
int count = hb_list_count(list);
NSMutableArray *forcedSourceNamesArray = [[NSMutableArray alloc] init];
for (int i = 0; i < count; i++)
{
- subtitle = (hb_subtitle_t *)hb_list_item(self.title->list_subtitle, i);
+ subtitle = (hb_subtitle_t *)hb_list_item(self.hb_title->list_subtitle, i);
/* Human-readable representation of subtitle->source */
NSString *bitmapOrText = subtitle->format == PICTURESUB ? @"Bitmap" : @"Text";
{
NSMutableArray *chapters = [NSMutableArray array];
- for (int i = 0; i < hb_list_count(self.title->job->list_chapter); i++)
+ for (int i = 0; i < hb_list_count(self.hb_title->list_chapter); i++)
{
- hb_chapter_t *chapter = hb_list_item(self.title->job->list_chapter, i);
+ hb_chapter_t *chapter = hb_list_item(self.hb_title->list_chapter, i);
if (chapter != NULL)
{