summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLStreamingMediaManager.m
blob: ade1165e7a328696d77a94c3bdd02063adf503c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//
//  SDLStreamingDataManager.m
//  SmartDeviceLink-iOS
//
//  Created by Joel Fischer on 8/11/15.
//  Copyright (c) 2015 smartdevicelink. All rights reserved.
//

#import "SDLStreamingMediaManager.h"

#import "SDLAudioStreamManager.h"
#import "SDLConnectionManagerType.h"
#import "SDLStreamingMediaConfiguration.h"
#import "SDLStreamingMediaManagerDataSource.h"
#import "SDLStreamingMediaLifecycleManager.h"
#import "SDLTouchManager.h"


NS_ASSUME_NONNULL_BEGIN

@interface SDLStreamingMediaManager ()

@property (strong, nonatomic) SDLStreamingMediaLifecycleManager *lifecycleManager;

@end


@implementation SDLStreamingMediaManager

#pragma mark - Public
#pragma mark Lifecycle

- (instancetype)initWithConnectionManager:(id<SDLConnectionManagerType>)connectionManager configuration:(SDLStreamingMediaConfiguration *)configuration {
    self = [super init];
    if (!self) {
        return nil;
    }
    
    _lifecycleManager = [[SDLStreamingMediaLifecycleManager alloc] initWithConnectionManager:connectionManager configuration:configuration];

    return self;
}

- (void)startWithProtocol:(SDLProtocol *)protocol {
    [self.lifecycleManager startWithProtocol:protocol];
}

- (void)stop {
    [self.lifecycleManager stop];
}

- (BOOL)sendVideoData:(CVImageBufferRef)imageBuffer {
    return [self.lifecycleManager sendVideoData:imageBuffer];
}

- (BOOL)sendVideoData:(CVImageBufferRef)imageBuffer presentationTimestamp:(CMTime)presentationTimestamp {
    return [self.lifecycleManager sendVideoData:imageBuffer presentationTimestamp:presentationTimestamp];
}

- (BOOL)sendAudioData:(NSData*)audioData {
    return [self.lifecycleManager sendAudioData:audioData];
}


#pragma mark - Getters

- (SDLTouchManager *)touchManager {
    return self.lifecycleManager.touchManager;
}

- (SDLAudioStreamManager *)audioManager {
    return self.lifecycleManager.audioManager;
}

- (UIViewController *)rootViewController {
    return self.lifecycleManager.rootViewController;
}

- (nullable id<SDLFocusableItemLocatorType>)focusableItemManager {
    return self.lifecycleManager.focusableItemManager;
}

- (BOOL)isStreamingSupported {
    return self.lifecycleManager.isStreamingSupported;
}

- (BOOL)isAudioConnected {
    return self.lifecycleManager.isAudioConnected;
}

- (BOOL)isVideoConnected {
    return self.lifecycleManager.isVideoConnected;
}

- (BOOL)isAudioEncrypted {
    return self.lifecycleManager.isAudioEncrypted;
}

- (BOOL)isVideoEncrypted {
    return self.lifecycleManager.isVideoEncrypted;
}
    
- (BOOL)isVideoStreamingPaused {
    return self.lifecycleManager.isVideoStreamingPaused;
}

- (CGSize)screenSize {
    return self.lifecycleManager.screenSize;
}

- (nullable SDLVideoStreamingFormat *)videoFormat {
    return self.lifecycleManager.videoFormat;
}

- (NSArray<SDLVideoStreamingFormat *> *)supportedFormats {
    return self.lifecycleManager.supportedFormats;
}

- (CVPixelBufferPoolRef __nullable)pixelBufferPool {
    return self.lifecycleManager.pixelBufferPool;
}

- (SDLStreamingEncryptionFlag)requestedEncryptionType {
    return self.lifecycleManager.requestedEncryptionType;
}

#pragma mark - Setters
- (void)setRootViewController:(UIViewController *)rootViewController {
    self.lifecycleManager.rootViewController = rootViewController;
}

- (void)setRequestedEncryptionType:(SDLStreamingEncryptionFlag)requestedEncryptionType {
    self.lifecycleManager.requestedEncryptionType = requestedEncryptionType;
}

@end

NS_ASSUME_NONNULL_END