forked from wjhwsh/VideoPlayer-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRendererFactory.m
50 lines (39 loc) · 1.3 KB
/
RendererFactory.m
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
//
// RendererFactory.m
// FFmpegPlayTest
//
// Created by Jack on 11/6/12.
// Copyright (c) 2012 Jack. All rights reserved.
//
#import "RendererFactory.h"
#import "ES1Renderer.h"
#import "ES2Renderer.h"
@implementation RendererFactory
//------------------------------------------------------------------------------
+ (id<Renderer>) createRenderer
{
id<Renderer> renderer = nil;
renderer = [[ES2Renderer alloc] init];
if (!renderer) {
renderer = [[ES1Renderer alloc] init];
}
return renderer;
}
//------------------------------------------------------------------------------
+ (id<Renderer>) createRendererWithDelegate:(id<RendererDelegate>)delegate
{
id<Renderer> renderer = [RendererFactory createRenderer];
[renderer setDelegate:delegate];
return renderer;
}
//------------------------------------------------------------------------------
+ (id<Renderer>) createRendererWithDelegate: (id<RendererDelegate>)delegate
videoSource: (id<VideoScreenSource>) source
screen: (id<VideoScreen>) screen
{
id<Renderer> renderer = [RendererFactory createRendererWithDelegate:delegate];
[renderer setVideoScreen:screen];
[renderer setVideoSource:source];
return renderer;
}
@end