summaryrefslogtreecommitdiffstats
path: root/macosx/HandBrakeXPCService/main.m
blob: e127c9a5b844d55ea9443b5685c32f58a7d45ab3 (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
/*  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>
#import "HandBrakeXPCService.h"

@interface HBXPCServiceDelegate : NSObject <NSXPCListenerDelegate>
@end

@implementation HBXPCServiceDelegate

- (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
    newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(HBRemoteCoreProtocol)];
    newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(HBRemoteProgressProtocol)];

    HandBrakeXPCService *exportedObject = [[HandBrakeXPCService alloc] initWithConnection:newConnection];
    newConnection.exportedObject = exportedObject;

    [newConnection resume];
    
    return YES;
}

@end

int main(int argc, const char *argv[])
{
    HBXPCServiceDelegate *delegate = [HBXPCServiceDelegate new];
    
    NSXPCListener *listener = [NSXPCListener serviceListener];
    listener.delegate = delegate;
    
    [listener resume];

    return 0;
}