summaryrefslogtreecommitdiffstats
path: root/macosx/HBRedirect.h
blob: 3e15df73dfc2e83a2b10be8c00bd27148bb03ea2 (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
/*  This file is part of the HandBrake source code.
 Homepage: <http://handbrake.fr/>.
 It may be used under the terms of the GNU General Public License. */

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, HBRedirectType) {
    HBRedirectTypeOutput,
    HBRedirectTypeError
};

@protocol HBOutputRedirectListening <NSObject>

- (void)redirect:(NSString *)text type:(HBRedirectType)type;

@end

@interface HBRedirect : NSObject

+ (instancetype)stdoutRedirect;
+ (instancetype)stderrRedirect;

- (void)addListener:(id <HBOutputRedirectListening>)aListener queue:(dispatch_queue_t)queue;
- (void)removeListener:(id <HBOutputRedirectListening>)aListener;

// Methods to subclass

- (instancetype)initWithType:(HBRedirectType)type;
- (void)forwardOutput:(NSString *)text;
- (void)startRedirect;
- (void)stopRedirect;

@end

NS_ASSUME_NONNULL_END