Commit 210bdda1 authored by Felix Paul Kühne's avatar Felix Paul Kühne

eyetv: drop legacy NSAutoreleasePool pattern

parent 4126a32c
...@@ -86,57 +86,57 @@ static int Control(access_t *, int, va_list); ...@@ -86,57 +86,57 @@ static int Control(access_t *, int, va_list);
static void selectChannel(vlc_object_t *p_this, int theChannelNum) static void selectChannel(vlc_object_t *p_this, int theChannelNum)
{ {
NSAppleScript *script; @autoreleasepool {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAppleScript *script;
switch(theChannelNum) { switch(theChannelNum) {
case -2: // Composite case -2: // Composite
script = [[NSAppleScript alloc] initWithSource: script = [[NSAppleScript alloc] initWithSource:
@"tell application \"EyeTV\"\n" @"tell application \"EyeTV\"\n"
" input_change input source composite video input\n" " input_change input source composite video input\n"
" volume_change level 0\n" " volume_change level 0\n"
" show player_window\n" " show player_window\n"
" tell application \"System Events\" to set visible of process \"EyeTV\" to false\n" " tell application \"System Events\" to set visible of process \"EyeTV\" to false\n"
"end tell"]; "end tell"];
break; break;
case -1: // S-Video case -1: // S-Video
script = [[NSAppleScript alloc] initWithSource: script = [[NSAppleScript alloc] initWithSource:
@"tell application \"EyeTV\"\n" @"tell application \"EyeTV\"\n"
" input_change input source S video input\n" " input_change input source S video input\n"
" volume_change level 0\n" " volume_change level 0\n"
" show player_window\n" " show player_window\n"
" tell application \"System Events\" to set visible of process \"EyeTV\" to false\n" " tell application \"System Events\" to set visible of process \"EyeTV\" to false\n"
"end tell"]; "end tell"];
break; break;
case 0: // Last case 0: // Last
script = [[NSAppleScript alloc] initWithSource: script = [[NSAppleScript alloc] initWithSource:
@"tell application \"EyeTV\"\n" @"tell application \"EyeTV\"\n"
" volume_change level 0\n" " volume_change level 0\n"
" show player_window\n" " show player_window\n"
" tell application \"System Events\" to set visible of process \"EyeTV\" to false\n" " tell application \"System Events\" to set visible of process \"EyeTV\" to false\n"
"end tell"]; "end tell"];
break; break;
default: default:
if (theChannelNum > 0) { if (theChannelNum > 0) {
NSString *channel_change = [NSString stringWithFormat: NSString *channel_change = [NSString stringWithFormat:
@"tell application \"EyeTV\"\n" @"tell application \"EyeTV\"\n"
" channel_change channel number %d\n" " channel_change channel number %d\n"
" volume_change level 0\n" " volume_change level 0\n"
" show player_window\n" " show player_window\n"
" tell application \"System Events\" to set visible of process \"EyeTV\" to false\n" " tell application \"System Events\" to set visible of process \"EyeTV\" to false\n"
"end tell", theChannelNum]; "end tell", theChannelNum];
script = [[NSAppleScript alloc] initWithSource:channel_change]; script = [[NSAppleScript alloc] initWithSource:channel_change];
} }
else else
return; return;
} }
NSDictionary *errorDict; NSDictionary *errorDict;
NSAppleEventDescriptor *descriptor = [script executeAndReturnError:&errorDict]; NSAppleEventDescriptor *descriptor = [script executeAndReturnError:&errorDict];
if (nil == descriptor) { if (nil == descriptor) {
NSString *errorString = [errorDict objectForKey:NSAppleScriptErrorMessage]; NSString *errorString = [errorDict objectForKey:NSAppleScriptErrorMessage];
msg_Err(p_this, "EyeTV source change failed with error status '%s'", [errorString UTF8String]); msg_Err(p_this, "EyeTV source change failed with error status '%s'", [errorString UTF8String]);
}
[script release];
} }
[script release];
[pool release];
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment