Skip to content

Commit

Permalink
Added new playback method for custom outputs
Browse files Browse the repository at this point in the history
updates ap4y#20
  • Loading branch information
ap4y committed Nov 5, 2013
1 parent c1dabfa commit b943430
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 7 additions & 0 deletions OrigamiEngine/ORGMEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ typedef enum : NSInteger {
*/
@property (unsafe_unretained, nonatomic) id<ORGMEngineDelegate> delegate;

/**
Starts new playback process from corresponding source with provided output type of output unit.
@param outputUnitClass Class that will be used during output unit initialisation. Must be subclass of ORGMOutputUnit.
*/
- (void)playUrl:(NSURL *)url withOutputUnitClass:(Class)outputUnitClass;

/**
Starts new playback process from corresponding source.
Expand Down
15 changes: 13 additions & 2 deletions OrigamiEngine/ORGMEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ - (void)dealloc {

#pragma mark - public

- (void)playUrl:(NSURL *)url {
- (void)playUrl:(NSURL *)url withOutputUnitClass:(Class)outputUnitClass {
if (!outputUnitClass || ![outputUnitClass isSubclassOfClass:[ORGMOutputUnit class]]) {

@throw [NSException exceptionWithName:NSInternalInconsistencyException
reason:NSLocalizedString(@"Output unit should be subclass of ORGMOutputUnit", nil)
userInfo:nil];
}

dispatch_async([ORGMQueues processing_queue], ^{
self.currentError = nil;
Expand All @@ -86,7 +92,7 @@ - (void)playUrl:(NSURL *)url {
self.converter = converter;
[converter release];

ORGMOutputUnit *output = [[ORGMOutputUnit alloc] initWithConverter:_converter];
ORGMOutputUnit *output = [[outputUnitClass alloc] initWithConverter:_converter];
output.outputFormat = _outputFormat;
self.output = output;
[output release];
Expand All @@ -105,6 +111,11 @@ - (void)playUrl:(NSURL *)url {
});
}

- (void)playUrl:(NSURL *)url {

[self playUrl:url withOutputUnitClass:[ORGMOutputUnit class]];
}

- (void)pause {
if (_currentState != ORGMEngineStatePlaying)
return;
Expand Down

0 comments on commit b943430

Please sign in to comment.