summaryrefslogtreecommitdiffstats
path: root/macosx/HandBrakeXPCService/main.m
blob: 2cd50f60203b4f646421ab11854361499a14df92 (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
/*  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"

@import HandBrakeKit;

@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[])
{
    HBUtilities.resolveBookmarks = NO;

    HBXPCServiceDelegate *delegate = [HBXPCServiceDelegate new];

    NSXPCListener *listener = [NSXPCListener serviceListener];
    listener.delegate = delegate;

    [listener resume];

    return 0;
}