| 1 | --- modules/gui/macosx/orig.open.m 2016-12-17 19:55:54.000000000 +0100 |
| 2 | +++ modules/gui/macosx/open.m 2016-12-17 20:26:12.000000000 +0100 |
| 3 | @@ -40,7 +40,14 @@ |
| 4 | #import <IOKit/storage/IODVDMedia.h> |
| 5 | #import <IOKit/storage/IOBDMedia.h> |
| 6 | #import <Cocoa/Cocoa.h> |
| 7 | +#import <AvailabilityMacros.h> |
| 8 | +#if defined(MAC_OS_X_VERSION_10_12) \ |
| 9 | + && ((MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12)) |
| 10 | +#warning "Excluding all code and features based on QTKit" |
| 11 | +#else |
| 12 | #import <QTKit/QTKit.h> |
| 13 | +#define HAVE_QTKIT |
| 14 | +#endif |
| 15 | |
| 16 | #import "intf.h" |
| 17 | #import "playlist.h" |
| 18 | @@ -51,8 +58,10 @@ |
| 19 | |
| 20 | #import <vlc_url.h> |
| 21 | |
| 22 | +#ifdef HAVE_QTKIT |
| 23 | NSArray *qtkvideoDevices; |
| 24 | NSArray *qtkaudioDevices; |
| 25 | +#endif |
| 26 | #define setEyeTVUnconnected \ |
| 27 | [o_capture_lbl setStringValue: _NS("No device is selected")]; \ |
| 28 | [o_capture_long_lbl setStringValue: _NS("No device is selected.\n\nChoose available device in above pull-down menu.\n")]; \ |
| 29 | @@ -207,7 +216,9 @@ |
| 30 | [o_screen_width_lbl setStringValue: [NSString stringWithFormat:@"%@:",_NS("Subscreen width")]]; |
| 31 | [o_screen_height_lbl setStringValue: [NSString stringWithFormat:@"%@:",_NS("Subscreen height")]]; |
| 32 | [o_screen_follow_mouse_ckb setTitle: _NS("Follow the mouse")]; |
| 33 | +#ifdef HAVE_QTKIT |
| 34 | [o_screen_qtk_audio_ckb setTitle: _NS("Capture Audio")]; |
| 35 | +#endif |
| 36 | [o_eyetv_currentChannel_lbl setStringValue: _NS("Current channel:")]; |
| 37 | [o_eyetv_previousProgram_btn setTitle: _NS("Previous Channel")]; |
| 38 | [o_eyetv_nextProgram_btn setTitle: _NS("Next Channel")]; |
| 39 | @@ -223,6 +234,7 @@ |
| 40 | [o_file_starttime_fld setFormatter:[[[PositionFormatter alloc] init] autorelease]]; |
| 41 | [o_file_stoptime_fld setFormatter:[[[PositionFormatter alloc] init] autorelease]]; |
| 42 | |
| 43 | +#ifdef HAVE_QTKIT |
| 44 | [self qtkvideoDevices]; |
| 45 | [o_qtk_video_device_pop removeAllItems]; |
| 46 | msg_Dbg(VLCIntf, "Found %lu video capture devices", [qtkvideoDevices count]); |
| 47 | @@ -275,6 +287,7 @@ |
| 48 | [o_screen_qtk_audio_pop addItemWithTitle: _NS("None")]; |
| 49 | [qtkaudio_currdevice_uid release]; |
| 50 | } |
| 51 | +#endif |
| 52 | |
| 53 | [self setSubPanel]; |
| 54 | |
| 55 | @@ -321,7 +334,9 @@ |
| 56 | [[sharedWorkspace notificationCenter] addObserver:self selector:@selector(scanOpticalMedia:) name:NSWorkspaceDidMountNotification object:nil]; |
| 57 | [[sharedWorkspace notificationCenter] addObserver:self selector:@selector(scanOpticalMedia:) name:NSWorkspaceDidUnmountNotification object:nil]; |
| 58 | |
| 59 | +#ifdef HAVE_QTKIT |
| 60 | [self qtkToggleUIElements:nil]; |
| 61 | +#endif |
| 62 | [self scanOpticalMedia:nil]; |
| 63 | |
| 64 | [self setMRL: @""]; |
| 65 | @@ -504,16 +519,20 @@ |
| 66 | [o_options addObject: @"screen-follow-mouse"]; |
| 67 | else |
| 68 | [o_options addObject: @"no-screen-follow-mouse"]; |
| 69 | +#ifdef HAVE_QTKIT |
| 70 | if ([o_screen_qtk_audio_ckb state] && qtkaudio_currdevice_uid) |
| 71 | [o_options addObject: [NSString stringWithFormat: @"input-slave=qtsound://%@", qtkaudio_currdevice_uid]]; |
| 72 | +#endif |
| 73 | } |
| 74 | else if ([[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Input Devices")]) { |
| 75 | +#ifdef HAVE_QTKIT |
| 76 | if ([o_qtk_video_ckb state]) { |
| 77 | [o_options addObject: [NSString stringWithFormat: @"qtcapture-width=%i", [o_capture_width_fld intValue]]]; |
| 78 | [o_options addObject: [NSString stringWithFormat: @"qtcapture-height=%i", [o_capture_height_fld intValue]]]; |
| 79 | if ([o_qtk_audio_ckb state] && qtkaudio_currdevice_uid) |
| 80 | [o_options addObject: [NSString stringWithFormat: @"input-slave=qtsound://%@", qtkaudio_currdevice_uid]]; |
| 81 | } |
| 82 | +#endif |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | @@ -539,11 +558,14 @@ |
| 87 | [o_screen_width_stp setMaxValue: item->rect.size.width]; |
| 88 | [o_screen_height_stp setMaxValue: item->rect.size.height]; |
| 89 | |
| 90 | +#ifdef HAVE_QTKIT |
| 91 | [o_screen_qtk_audio_pop setEnabled: [o_screen_qtk_audio_ckb state]]; |
| 92 | +#endif |
| 93 | } |
| 94 | |
| 95 | - (IBAction)qtkChanged:(id)sender |
| 96 | { |
| 97 | +#ifdef HAVE_QTKIT |
| 98 | NSInteger i_selectedDevice = [o_qtk_video_device_pop indexOfSelectedItem]; |
| 99 | if ([qtkvideoDevices count] >= 1) { |
| 100 | NSValue *sizes = [[[[qtkvideoDevices objectAtIndex:i_selectedDevice] formatDescriptions] objectAtIndex:0] attributeForKey: QTFormatDescriptionVideoEncodedPixelsSizeAttribute]; |
| 101 | @@ -554,20 +576,24 @@ |
| 102 | [o_capture_height_stp setIntValue: [o_capture_height_fld intValue]]; |
| 103 | qtk_currdevice_uid = [[(QTCaptureDevice *)[qtkvideoDevices objectAtIndex:i_selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; |
| 104 | } |
| 105 | +#endif |
| 106 | } |
| 107 | |
| 108 | - (IBAction)qtkAudioChanged:(id)sender |
| 109 | { |
| 110 | +#ifdef HAVE_QTKIT |
| 111 | NSInteger i_selectedDevice = [o_qtk_audio_device_pop indexOfSelectedItem]; |
| 112 | if ([qtkaudioDevices count] >= 1) { |
| 113 | qtkaudio_currdevice_uid = [[(QTCaptureDevice *)[qtkaudioDevices objectAtIndex:i_selectedDevice] uniqueID] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; |
| 114 | } |
| 115 | [o_screen_qtk_audio_pop selectItemAtIndex: i_selectedDevice]; |
| 116 | [o_qtk_audio_device_pop selectItemAtIndex: i_selectedDevice]; |
| 117 | +#endif |
| 118 | } |
| 119 | |
| 120 | - (IBAction)qtkToggleUIElements:(id)sender |
| 121 | { |
| 122 | +#ifdef HAVE_QTKIT |
| 123 | [o_qtk_audio_device_pop setEnabled:[o_qtk_audio_ckb state]]; |
| 124 | BOOL b_state = [o_qtk_video_ckb state]; |
| 125 | [o_qtk_video_device_pop setEnabled:b_state]; |
| 126 | @@ -578,6 +604,7 @@ |
| 127 | [self qtkAudioChanged:sender]; |
| 128 | [self qtkChanged:sender]; |
| 129 | [self openCaptureModeChanged:sender]; |
| 130 | +#endif |
| 131 | } |
| 132 | |
| 133 | #pragma mark - |
| 134 | @@ -1402,18 +1429,22 @@ |
| 135 | } |
| 136 | } |
| 137 | else if ([[[o_capture_mode_pop selectedItem] title] isEqualToString: _NS("Input Devices")]) { |
| 138 | +#ifdef HAVE_QTKIT |
| 139 | [self showCaptureView: o_qtk_view]; |
| 140 | if ([o_capture_width_fld intValue] <= 0) |
| 141 | [self qtkChanged:nil]; |
| 142 | |
| 143 | [self qtkAudioChanged:nil]; |
| 144 | +#endif |
| 145 | |
| 146 | [self setMRL: @""]; |
| 147 | |
| 148 | +#ifdef HAVE_QTKIT |
| 149 | if ([o_qtk_video_ckb state] && qtk_currdevice_uid) |
| 150 | [self setMRL:[NSString stringWithFormat:@"qtcapture://%@", qtk_currdevice_uid]]; |
| 151 | else if ([o_qtk_audio_ckb state] && qtkaudio_currdevice_uid) |
| 152 | [self setMRL:[NSString stringWithFormat:@"qtsound://%@", qtkaudio_currdevice_uid]]; |
| 153 | +#endif |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | @@ -1597,28 +1628,40 @@ |
| 158 | |
| 159 | - (NSArray *)qtkvideoDevices |
| 160 | { |
| 161 | +#ifdef HAVE_QTKIT |
| 162 | if (!qtkvideoDevices) |
| 163 | [self qtkrefreshVideoDevices]; |
| 164 | return qtkvideoDevices; |
| 165 | +#else |
| 166 | + return NULL; |
| 167 | +#endif |
| 168 | } |
| 169 | |
| 170 | - (void)qtkrefreshVideoDevices |
| 171 | { |
| 172 | +#ifdef HAVE_QTKIT |
| 173 | [qtkvideoDevices release]; |
| 174 | qtkvideoDevices = [[[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo] arrayByAddingObjectsFromArray:[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeMuxed]] retain]; |
| 175 | +#endif |
| 176 | } |
| 177 | |
| 178 | - (NSArray *)qtkaudioDevices |
| 179 | { |
| 180 | +#ifdef HAVE_QTKIT |
| 181 | if (!qtkaudioDevices) |
| 182 | [self qtkrefreshAudioDevices]; |
| 183 | return qtkaudioDevices; |
| 184 | +#else |
| 185 | + return NULL; |
| 186 | +#endif |
| 187 | } |
| 188 | |
| 189 | - (void)qtkrefreshAudioDevices |
| 190 | { |
| 191 | +#ifdef HAVE_QTKIT |
| 192 | [qtkaudioDevices release]; |
| 193 | qtkaudioDevices = [[[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeSound] arrayByAddingObjectsFromArray:[QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeMuxed]] retain]; |
| 194 | +#endif |
| 195 | } |
| 196 | |
| 197 | @end |