1 /*****************************************************************************
2 * wizard.m: MacOS X Streaming Wizard
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
7 * Authors: Felix Kühne <fkuehne@users.sf.net>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
25 /*****************************************************************************
26 * Note: this code is partially based upon ../wxwindows/wizard.cpp and
27 * ../wxwindows/streamdata.h; both written by Clément Stenac.
28 *****************************************************************************/
31 - start of the streaming/transcoding
32 - l10n string fixes (both in OSX and WX)
33 - fill the playlist-table on t2
34 - implement l10n on t8?
39 /*****************************************************************************
41 *****************************************************************************/
46 /*****************************************************************************
47 * VLCWizard implementation
48 *****************************************************************************/
50 @implementation VLCWizard
52 static VLCWizard *_o_sharedInstance = nil;
54 + (VLCWizard *)sharedInstance
56 return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
61 if (_o_sharedInstance) {
64 _o_sharedInstance = [super init];
67 return _o_sharedInstance;
72 /* some minor cleanup */
73 [o_t2_tbl_plst setEnabled:NO];
74 [o_wizardhelp_window setExcludedFromWindowsMenu:YES];
75 o_userSelections = [[NSMutableDictionary alloc] init];
76 [o_btn_backward setEnabled:NO];
78 /* add audio-bitrates for transcoding */
79 NSArray * audioBitratesArray;
80 audioBitratesArray = [NSArray arrayWithObjects: @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
81 [o_t4_pop_audioBitrate removeAllItems];
82 [o_t4_pop_audioBitrate addItemsWithTitles: audioBitratesArray];
83 [o_t4_pop_audioBitrate selectItemWithTitle: @"192"];
85 /* add video-bitrates for transcoding */
86 NSArray * videoBitratesArray;
87 videoBitratesArray = [NSArray arrayWithObjects: @"3072", @"2048", @"1024", @"768", @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
88 [o_t4_pop_videoBitrate removeAllItems];
89 [o_t4_pop_videoBitrate addItemsWithTitles: videoBitratesArray];
90 [o_t4_pop_videoBitrate selectItemWithTitle: @"1024"];
92 /* fill 2 global arrays with arrays containing all codec-related information
93 * - one array per codec named by its short name to define the encap-compability,
94 * cmd-names, real names, more info in the order: realName, shortName,
108 NSArray * o_dummyVid;
109 o_mp1v = [NSArray arrayWithObjects: @"MPEG-1 Video", @"mp1v", _NS("MPEG-1 Video codec"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_OGG", @"MUX_RAW", @"NO", @"NO", @"NO", @"NO", nil];
110 o_mp2v = [NSArray arrayWithObjects: @"MPEG-2 Video", @"mp2v", _NS("MPEG-2 Video codec"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_OGG", @"MUX_RAW", @"NO", @"NO", @"NO", @"NO", nil];
111 o_mp4v = [NSArray arrayWithObjects: @"MPEG-4 Video", @"mp4v", _NS("MPEG-4 Video codec"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4", @"MUX_OGG", @"MUX_RAW", @"NO", @"NO", nil];
112 o_div1 = [NSArray arrayWithObjects: @"DIVX 1", @"DIV1", _NS("DivX first version"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
113 o_div2 = [NSArray arrayWithObjects: @"DIVX 2", @"DIV2", _NS("DivX second version"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
114 o_div3 = [NSArray arrayWithObjects: @"DIVX 3", @"DIV3", _NS("DivX third version"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
115 o_h263 = [NSArray arrayWithObjects: @"H 263", @"H263", _NS("H263 is a video codec optimized for videoconference (low rates)"), @"MUX_TS", @"MUX_AVI", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
116 o_h264 = [NSArray arrayWithObjects: @"H 264", @"H264", _NS("H264 is a new video codec"), @"MUX_TS", @"MUX_AVI", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
117 o_wmv1 = [NSArray arrayWithObjects: @"WMV 1", @"WMV1", _NS("WMV (Windows Media Video) 1"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
118 o_wmv2 = [NSArray arrayWithObjects: @"WMV 2", @"WMV2", _NS("WMV (Windows Media Video) 2"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
119 o_mjpg = [NSArray arrayWithObjects: @"MJPEG", @"MJPG", _NS("MJPEG consists of a series of JPEG pictures"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
120 o_theo = [NSArray arrayWithObjects: @"Theora", @"theo", _NS("Theora is a free general-purpose codec"), @"MUX_TS", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
121 o_dummyVid = [NSArray arrayWithObjects: @"Dummy", @"dummy", _NS("Dummy codec (do not transcode)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4", @"MUX_OGG", @"MUX_WAV", @"MUX_RAW", @"MUX_MOV", nil];
122 o_videoCodecs = [[NSArray alloc] initWithObjects: o_mp1v, o_mp2v, o_mp4v, o_div1, o_div2, o_div3, o_h263, o_h264, o_wmv1, o_wmv2, o_mjpg, o_theo, o_dummyVid, nil];
123 [o_t4_pop_videoCodec removeAllItems];
126 while (x != [o_videoCodecs count])
128 [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x] objectAtIndex:0]];
141 NSArray * o_dummyAud;
142 o_mpga = [NSArray arrayWithObjects: @"MPEG Audio", @"mpga", _NS("The standard MPEG audio (1/2) format"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", nil];
143 o_mp3 = [NSArray arrayWithObjects: @"MP3", @"mp3", _NS("MPEG Audio Layer 3"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", nil];
144 o_mp4a = [NSArray arrayWithObjects: @"MPEG 4 Audio", @"mp4a", _NS("Audio format for MPEG4"), @"MUX_TS", @"MUX_MP4", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
145 o_a52 = [NSArray arrayWithObjects: @"A/52", @"a52", _NS("DVD audio format"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", nil];
146 o_vorb = [NSArray arrayWithObjects: @"Vorbis", @"vorb", _NS("Vorbis is a free audio codec"), @"MUX_OGG", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
147 o_flac = [NSArray arrayWithObjects: @"FLAC", @"flac", _NS("FLAC is a lossless audio codec"), @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
148 o_spx = [NSArray arrayWithObjects: @"Speex", @"spx", _NS("A free audio codec dedicated to compression of voice"), @"MUX_OGG", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
149 o_s16l = [NSArray arrayWithObjects: @"Uncompressed, integer", @"s16l", _NS("Uncompressed audio samples"), @"MUX_WAV", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
150 o_fl32 = [NSArray arrayWithObjects: @"Uncompressed, floating", @"fl32", _NS("Uncompressed audio samples"), @"MUX_WAV", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
151 o_dummyAud = [NSArray arrayWithObjects: @"Dummy", @"dummy", _NS("Dummy codec (do not transcode)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4", @"MUX_OGG", @"MUX_RAW", @"MUX_MOV", @"MUX_WAV", nil];
152 o_audioCodecs = [[NSArray alloc] initWithObjects: o_mpga, o_mp3, o_mp4a, o_a52, o_vorb, o_flac, o_spx, o_s16l, o_fl32, o_dummyAud, nil];
153 [o_t4_pop_audioCodec removeAllItems];
155 while (x != [o_audioCodecs count])
157 [o_t4_pop_audioCodec addItemWithTitle:[[o_audioCodecs objectAtIndex:x] objectAtIndex:0]];
164 /* just present the window to the user */
165 [o_tab_pageHolder selectFirstTabViewItem:self];
169 [o_wizard_window center];
170 [o_wizard_window displayIfNeeded];
171 [o_wizard_window makeKeyAndOrderFront:nil];
176 /* reset the wizard-window to its default values */
178 [o_userSelections removeAllObjects];
179 [o_t1_matrix_strmgOrTrnscd selectCellAtRow:0 column:0];
180 [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setState: NSOffState];
181 [o_btn_forward setTitle: [_NS("Next") stringByAppendingString:@" >"]];
184 [o_t2_fld_pathToNewStrm setStringValue: @""];
185 [o_t2_ckb_enblPartExtrct setState: NSOffState];
186 [self t2_enableExtract:nil];
187 [o_t2_matrix_inputSourceType selectCellAtRow:0 column:0];
188 [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setState: NSOffState];
189 /* FIXME: we need to refresh the playlist-table as well */
190 [o_t2_tbl_plst setEnabled:NO];
191 [o_t2_fld_pathToNewStrm setEnabled:YES];
192 [o_t2_btn_chooseFile setEnabled:YES];
195 [o_t3_fld_address setStringValue: @""];
196 [o_t3_matrix_stmgMhd selectCellAtRow:0 column:0];
197 [[o_t3_matrix_stmgMhd cellAtRow:1 column:1] setState: NSOffState];
198 [[o_t3_matrix_stmgMhd cellAtRow:1 column:2] setState: NSOffState];
201 [o_t4_ckb_audio setState: NSOffState];
202 [o_t4_ckb_video setState: NSOffState];
203 [self t4_enblVidTrnscd:nil];
204 [self t4_enblAudTrnscd:nil];
207 [o_t6_fld_ttl setStringValue: @"1"];
208 [o_t6_ckb_sap setState: NSOffState];
209 [self t6_enblSapAnnce:nil];
212 [o_t7_fld_filePath setStringValue: @""];
217 /* localise all strings to the users lang */
218 /* method is called from intf.m (in method openWizard) */
221 [o_btn_backward setTitle: [@"< " stringByAppendingString: _NS("Back")]];
222 [o_btn_cancel setTitle: _NS("Cancel")];
223 [o_btn_forward setTitle: [_NS("Next") stringByAppendingString:@" >"]];
224 [o_wizard_window setTitle: _NS("Streaming/Transcoding Wizard")];
226 /* page one ("Hello") */
227 [o_t1_txt_title setStringValue: _NS("Streaming/Transcoding Wizard")];
228 [o_t1_txt_text setStringValue: _NS("This wizard helps you to stream, transcode or save a stream")];
229 [o_t1_btn_mrInfo_strmg setTitle: _NS("More Info")];
230 [o_t1_btn_mrInfo_trnscd setTitle: _NS("More Info")];
231 [o_t1_txt_notice setStringValue: _NS("This wizard only gives access to a small subset of VLC's streaming and transcoding capabilities. Use the Open and Stream Output dialogs to get all of them")];
232 [[o_t1_matrix_strmgOrTrnscd cellAtRow:0 column:0] setTitle: _NS("Stream to network")];
233 [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setTitle: _NS("Transcode/Save to file")];
235 /* page two ("Input") */
236 [o_t2_title setStringValue: _NS("Choose input")];
237 [o_t2_text setStringValue: _NS("Choose here your input stream")];
238 [[o_t2_matrix_inputSourceType cellAtRow:0 column:0] setTitle: _NS("Select a stream")];
239 [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setTitle: _NS("Existing playlist item")];
240 [o_t2_btn_chooseFile setTitle: _NS("Choose...")];
241 [[[o_t2_tbl_plst tableColumnWithIdentifier:@"name"] headerCell] setStringValue: _NS("Name")];
242 [[[o_t2_tbl_plst tableColumnWithIdentifier:@"uri"] headerCell] setStringValue: _NS("URI")];
243 [o_t2_box_prtExtrct setTitle: _NS("Partial Extract")];
244 [o_t2_ckb_enblPartExtrct setTitle: _NS("Enable")];
245 [o_t2_txt_prtExtrctFrom setStringValue: _NS("From")];
246 [o_t2_txt_prtExtrctTo setStringValue: _NS("To")];
248 /* page three ("Streaming 1") */
249 [o_t3_txt_title setStringValue: _NS("Streaming")];
250 [o_t3_txt_text setStringValue: _NS("In this page, you will select how your input stream will be sent.")];
251 [o_t3_box_dest setTitle: _NS("Destination")];
252 [o_t3_box_strmgMthd setTitle: _NS("Streaming method")];
253 [o_t3_txt_destInfo setStringValue: _NS("Enter the address of the computer to stream to")];
254 [[o_t3_matrix_stmgMhd cellAtRow:1 column:0] setTitle: _NS("UDP Unicast")];
255 [[o_t3_matrix_stmgMhd cellAtRow:1 column:1] setTitle: _NS("UDP Multicast")];
257 /* page four ("Transcode 1") */
258 [o_t4_title setStringValue: _NS("Transcode")];
259 [o_t4_text setStringValue: _NS("If you want to change the compression format of the audio or video tracks, fill in this page. (If you only want to change the container format, proceed to next page).")];
260 [o_t4_box_audio setTitle: _NS("Audio")];
261 [o_t4_box_video setTitle: _NS("Video")];
262 [o_t4_ckb_audio setTitle: _NS("Transcode audio")];
263 [o_t4_ckb_video setTitle: _NS("Transcode video")];
264 [o_t4_txt_videoBitrate setStringValue: _NS("Bitrate (kb/s)")];
265 [o_t4_txt_videoCodec setStringValue: _NS("Codec")];
266 [o_t4_txt_hintAudio setStringValue: _NS("If your stream has audio and you want to " \
267 "transcode it, enable this")];
268 [o_t4_txt_hintVideo setStringValue: _NS("If your stream has video and you want to " \
269 "transcode it, enable this")];
271 /* page five ("Encap") */
272 [o_t5_title setStringValue: _NS("Encapsulation format")];
273 [o_t5_text setStringValue: _NS("In this page, you will select how the stream will be "\
274 "encapsulated. Depending on the choices you made, all "\
275 "formats won't be available.")];
277 /* page six ("Streaming 2") */
278 [o_t6_title setStringValue: _NS("Additional streaming options")];
279 [o_t6_text setStringValue: _NS("In this page, you will define a few " \
280 "additional parameters for your stream.")];
281 [o_t6_txt_ttl setStringValue: _NS("Time-To-Live (TTL)")];
282 [o_t6_btn_mrInfo_ttl setTitle: _NS("More Info")];
283 [o_t6_ckb_sap setTitle: _NS("SAP Announce")];
284 [o_t6_btn_mrInfo_sap setTitle: _NS("More Info")];
286 /* page seven ("Transcode 2") */
287 [o_t7_title setStringValue: _NS("Additional transcode options")];
288 [o_t7_text setStringValue: _NS("In this page, you will define a few " \
289 "additionnal parameters for your transcoding.")];
290 [o_t7_txt_saveFileTo setStringValue: _NS("Select the file to save to")];
291 [o_t7_btn_chooseFile setTitle: _NS("Choose...")];
293 /* page eight ("Summary") */
294 /* FIXME: currently not implemented as it unsure whether we show this tab
295 * to the public or use it for debugging only */
297 /* wizard help window */
298 [o_wh_btn_okay setTitle: _NS("OK")];
301 - (IBAction)cancelRun:(id)sender
303 [o_wizard_window close];
306 - (IBAction)nextTab:(id)sender
308 if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Hello"])
310 /* check whether the user wants to stream or just to transcode;
311 * store information for later usage */
313 o_mode = [[o_t1_matrix_strmgOrTrnscd selectedCell] title];
314 if( [o_mode isEqualToString: _NS("Stream to network")] )
316 [o_userSelections setObject:@"strmg" forKey:@"trnscdOrStrmg"];
318 [o_userSelections setObject:@"trnscd" forKey:@"trnscdOrStrmg"];
320 [o_btn_backward setEnabled:YES];
321 [o_tab_pageHolder selectTabViewItemAtIndex:1];
323 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Input"])
325 /* check whether partialExtract is enabled and store the values, if needed */
326 if ([o_t2_ckb_enblPartExtrct state] == NSOnState)
328 [o_userSelections setObject:@"YES" forKey:@"partExtract"];
329 [o_userSelections setObject:[o_t2_fld_prtExtrctFrom stringValue] forKey:@"partExtractFrom"];
330 [o_userSelections setObject:[o_t2_fld_prtExtrctTo stringValue] forKey:@"partExtractTo"];
332 [o_userSelections setObject:@"NO" forKey:@"partExtract"];
335 /* check whether we use an existing pl-item or add an new one;
336 * store the path or the index and set a flag.
337 * complain to the user if s/he didn't provide a path */
339 o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
340 if( [o_mode isEqualToString: _NS("Select a stream")] )
342 [o_userSelections setObject:@"YES" forKey:@"newStrm"];
343 if ([[o_t2_fld_pathToNewStrm stringValue] isEqualToString: @""])
345 /* FIXME: we should complain to the user that s/he didn't provide a path */
347 [o_userSelections setObject:[o_t2_fld_pathToNewStrm stringValue] forKey:@"pathToNewStrm"];
350 [o_userSelections setObject:@"NO" forKey:@"newStrm"];
351 NSNumber * myNumber = [[NSNumber alloc] initWithInt:[o_t2_tbl_plst selectedRow]];
352 [o_userSelections setObject:myNumber forKey:@"plItemIndex"];
355 /* show either "Streaming 1" or "Transcode 1" to the user */
356 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
358 /* we are streaming */
359 [o_tab_pageHolder selectTabViewItemAtIndex:2];
361 /* we are just transcoding */
362 [o_tab_pageHolder selectTabViewItemAtIndex:3];
365 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 1"])
367 /* check which streaming method is selected and store it */
369 o_mode = [[o_t3_matrix_stmgMhd selectedCell] title];
370 if( [o_mode isEqualToString: _NS("HTTP")] )
372 [o_userSelections setObject:@"HTTP" forKey:@"stmgMhd"];
373 /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF; select MPEG PS */
374 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
375 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
376 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
377 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
378 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
379 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
380 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
381 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
382 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
383 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
384 [o_t5_matrix_encap selectCellAtRow:0 column:0];
386 if( [o_mode isEqualToString: _NS("UDP Unicast")] )
388 [o_userSelections setObject:@"UDP-Unicast" forKey:@"stmgMhd"];
390 [o_userSelections setObject:@"UDP-Multicast" forKey:@"stmgMhd"];
392 /* disable all encap-formats but MPEG-TS and select it */
393 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
394 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
395 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
396 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
397 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
398 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
399 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
400 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
401 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
402 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
403 [o_t5_matrix_encap selectCellAtRow:1 column:0];
406 /* store the destination and check whether is it empty */
407 if( [[o_t3_fld_address stringValue] isEqualToString: @""] )
408 { /* FIXME: complain to the user that "" is no valid dest. */
410 [o_userSelections setObject:[o_t3_fld_address stringValue] forKey:@"stmgDest"];
413 /* let's go to the encap-tab */
414 [o_tab_pageHolder selectTabViewItemAtIndex:4];
416 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 1"])
418 /* check whether the user wants to transcode the video-track and store the related options */
419 if ([o_t4_ckb_video state] == NSOnState)
422 theNum = [NSNumber numberWithInt:[o_t4_pop_videoCodec indexOfSelectedItem]];
423 [o_userSelections setObject:@"YES" forKey:@"trnscdVideo"];
424 [o_userSelections setObject:[o_t4_pop_videoBitrate titleOfSelectedItem] forKey:@"trnscdVideoBitrate"];
425 [o_userSelections setObject:theNum forKey:@"trnscdVideoCodec"];
427 [o_userSelections setObject:@"NO" forKey:@"trnscdVideo"];
430 /* check whether the user wants to transcode the audio-track and store the related options */
431 if ([o_t4_ckb_audio state] == NSOnState)
434 theNum = [NSNumber numberWithInt:[o_t4_pop_audioCodec indexOfSelectedItem]];
435 [o_userSelections setObject:@"YES" forKey:@"trnscdAudio"];
436 [o_userSelections setObject:[o_t4_pop_audioBitrate titleOfSelectedItem] forKey:@"trnscdAudioBitrate"];
437 [o_userSelections setObject:theNum forKey:@"trnscdAudioCodec"];
439 [o_userSelections setObject:@"NO" forKey:@"trnscdAudio"];
442 /* disable all encap-formats */
443 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
444 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
445 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
446 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
447 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
448 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
449 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
450 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
451 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
452 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
454 /* re-enable the encap-formats supported by the chosen codecs */
455 /* FIXME: the following is a really bad coding-style. feel free to write
456 me ideas how to make this nicer, if you want to -- FK, 7/11/05 */
458 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualTo: @"YES"])
460 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
462 /* we are transcoding both audio and video, so we need to check both deps */
463 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_PS"])
465 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_PS"])
467 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
468 [o_t5_matrix_encap selectCellAtRow:0 column:0];
471 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_TS"])
473 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_TS"])
475 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
476 [o_t5_matrix_encap selectCellAtRow:1 column:0];
479 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MPEG"])
481 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MPEG"])
483 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
484 [o_t5_matrix_encap selectCellAtRow:2 column:0];
487 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_OGG"])
489 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_OGG"])
491 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
492 [o_t5_matrix_encap selectCellAtRow:3 column:0];
495 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_RAW"])
497 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_RAW"])
499 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
500 [o_t5_matrix_encap selectCellAtRow:4 column:0];
503 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_ASF"])
505 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_ASF"])
507 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
508 [o_t5_matrix_encap selectCellAtRow:5 column:0];
511 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
513 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
515 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
516 [o_t5_matrix_encap selectCellAtRow:6 column:0];
519 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
521 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
523 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
524 [o_t5_matrix_encap selectCellAtRow:7 column:0];
527 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
529 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
531 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
532 [o_t5_matrix_encap selectCellAtRow:8 column:0];
535 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
537 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
539 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
540 [o_t5_matrix_encap selectCellAtRow:9 column:0];
546 /* we just transcoding the audio */
548 /* select formats supported by the audio codec */
549 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_PS"])
551 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
552 [o_t5_matrix_encap selectCellAtRow:0 column:0];
554 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_TS"])
556 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
557 [o_t5_matrix_encap selectCellAtRow:1 column:0];
559 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MPEG"])
561 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
562 [o_t5_matrix_encap selectCellAtRow:2 column:0];
564 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_OGG"])
566 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
567 [o_t5_matrix_encap selectCellAtRow:3 column:0];
569 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_RAW"])
571 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
572 [o_t5_matrix_encap selectCellAtRow:4 column:0];
574 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_ASF"])
576 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
577 [o_t5_matrix_encap selectCellAtRow:5 column:0];
579 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
581 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
582 [o_t5_matrix_encap selectCellAtRow:6 column:0];
584 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
586 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
587 [o_t5_matrix_encap selectCellAtRow:7 column:0];
589 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
591 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
592 [o_t5_matrix_encap selectCellAtRow:8 column:0];
594 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
596 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
597 [o_t5_matrix_encap selectCellAtRow:9 column:0];
601 else if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
603 /* we are just transcoding the video */
605 /* select formats supported by the video-codec */
607 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_PS"])
609 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
610 [o_t5_matrix_encap selectCellAtRow:0 column:0];
612 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_TS"])
614 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
615 [o_t5_matrix_encap selectCellAtRow:1 column:0];
617 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MPEG"])
619 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
620 [o_t5_matrix_encap selectCellAtRow:2 column:0];
622 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_OGG"])
624 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
625 [o_t5_matrix_encap selectCellAtRow:3 column:0];
627 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_RAW"])
629 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
630 [o_t5_matrix_encap selectCellAtRow:4 column:0];
632 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_ASF"])
634 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
635 [o_t5_matrix_encap selectCellAtRow:5 column:0];
637 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
639 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
640 [o_t5_matrix_encap selectCellAtRow:6 column:0];
642 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
644 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
645 [o_t5_matrix_encap selectCellAtRow:7 column:0];
647 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
649 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
650 [o_t5_matrix_encap selectCellAtRow:8 column:0];
652 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
654 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
655 [o_t5_matrix_encap selectCellAtRow:9 column:0];
658 /* we don't do any transcoding
659 * -> enabled the encap-formats allowed when streaming content via http
660 * since this should work fine in most cases */
661 /* FIXME: choose a selection of encap-formats based upon the actually used codecs */
663 /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF; select MPEG PS */
664 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
665 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
666 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
667 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
668 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
669 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
670 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
671 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
672 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
673 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
674 [o_t5_matrix_encap selectCellAtRow:0 column:0];
677 BOOL anythingEnabled;
679 anythingEnabled = NO;
680 while (x != [o_t5_matrix_encap numberOfRows])
682 if ([[o_t5_matrix_encap cellAtRow:x column:0] isEnabled])
684 anythingEnabled = YES;
688 if (anythingEnabled == YES)
690 [o_tab_pageHolder selectTabViewItemAtIndex:4];
692 /* show a sheet that the selected codecs are not compatible */
693 [o_wh_txt_title setStringValue: _NS("Invalid selection")];
694 [o_wh_txt_text setStringValue: _NS("Your chosen codecs are " \
695 "not compatible with each other. For example: you cannot " \
696 "mix uncompressed audio with any video codec.\n\n" \
697 "Correct your selection and try again.")];
698 [NSApp beginSheet: o_wizardhelp_window
699 modalForWindow: o_wizard_window
700 modalDelegate: o_wizardhelp_window
706 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Encap"])
708 /* get the chosen encap format and store it */
709 [o_userSelections setObject:[[o_t5_matrix_encap selectedCell] title] forKey:@"encapFormat"];
711 /* show either "Streaming 2" or "Transcode 2" to the user */
712 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
714 /* we are streaming */
715 [o_tab_pageHolder selectTabViewItemAtIndex:5];
717 /* we are just transcoding */
718 [o_tab_pageHolder selectTabViewItemAtIndex:6];
721 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 2"])
723 /* store the chosen TTL */
724 [o_userSelections setObject:[o_t6_fld_ttl stringValue] forKey:@"ttl"];
726 /* check whether SAP is enabled and store the announce, if needed */
727 if ([o_t6_ckb_sap state] == NSOnState)
729 [o_userSelections setObject:@"YES" forKey:@"sap"];
730 [o_userSelections setObject:[o_t6_fld_sap stringValue] forKey:@"sapText"];
732 [o_userSelections setObject:@"NO" forKey:@"sap"];
735 /* go to "Summary" */
738 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 2"])
740 /* check whether the path != "" and store it */
741 if( [[o_t7_fld_filePath stringValue] isEqualToString: @""] )
742 { /* FIXME: complain to the user that "" is no valid path */
744 [o_userSelections setObject:[o_t7_fld_filePath stringValue] forKey:@"trnscdFilePath"];
747 /* go to "Summary" */
754 [o_btn_forward setTitle: _NS("Finish")];
755 if ([[o_userSelections objectForKey:@"newStrm"] isEqualToString: @"YES"])
757 [o_t8_fld_inptStream setStringValue:[o_userSelections objectForKey:@"pathToNewStrm"]];
759 [o_t8_fld_inptStream setStringValue:[[o_userSelections objectForKey:@"plItemIndex"] stringValue]];
761 if ([[o_userSelections objectForKey:@"partExtract"] isEqualToString: @"YES"])
763 [o_t8_fld_partExtract setStringValue: [[[[[_NS("yes") stringByAppendingString:@" - "] stringByAppendingString: _NS("from ")] stringByAppendingString: [o_userSelections objectForKey:@"partExtractFrom"]] stringByAppendingString: _NS(" to ")] stringByAppendingString: [o_userSelections objectForKey:@"partExtractTo"]]];
765 [o_t8_fld_partExtract setStringValue: _NS("no")];
768 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
770 /* we are streaming; no transcoding allowed atm */
771 [o_t8_fld_saveFileTo setStringValue: @"-"];
772 [o_t8_fld_trnscdAudio setStringValue: @"-"];
773 [o_t8_fld_trnscdVideo setStringValue: @"-"];
774 [o_t8_fld_strmgMthd setStringValue: [o_userSelections objectForKey:@"stmgMhd"]];
775 [o_t8_fld_destination setStringValue: [o_userSelections objectForKey:@"stmgDest"]];
776 [o_t8_fld_ttl setStringValue: [o_userSelections objectForKey:@"ttl"]];
777 if ([[o_userSelections objectForKey:@"sap"] isEqualToString: @"YES"])
779 [o_t8_fld_sap setStringValue: [[_NS("yes") stringByAppendingString:@": "] stringByAppendingString:[o_userSelections objectForKey:@"sapText"]]];
781 [o_t8_fld_sap setStringValue: _NS("no")];
784 /* we are transcoding */
785 [o_t8_fld_strmgMthd setStringValue: @"-"];
786 [o_t8_fld_destination setStringValue: @"-"];
787 [o_t8_fld_ttl setStringValue: @"-"];
788 [o_t8_fld_sap setStringValue: @"-"];
789 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
791 [o_t8_fld_trnscdVideo setStringValue: [[[[[_NS("yes") stringByAppendingString:@": "] stringByAppendingString: [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] objectAtIndex:0]] stringByAppendingString:@" @ "] stringByAppendingString: [o_userSelections objectForKey:@"trnscdVideoBitrate"]] stringByAppendingString:@" kb/s"]];
793 [o_t8_fld_trnscdVideo setStringValue: _NS("no")];
795 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
797 [o_t8_fld_trnscdAudio setStringValue: [[[[[_NS("yes") stringByAppendingString:@": "] stringByAppendingString: [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] objectAtIndex:0]] stringByAppendingString:@" @ "] stringByAppendingString: [o_userSelections objectForKey:@"trnscdAudioBitrate"]] stringByAppendingString:@" kb/s"]];
799 [o_t8_fld_trnscdAudio setStringValue: _NS("no")];
801 [o_t8_fld_saveFileTo setStringValue: [o_userSelections objectForKey:@"trnscdFilePath"]];
803 [o_t8_fld_encapFormat setStringValue: [o_userSelections objectForKey:@"encapFormat"]];
804 [o_tab_pageHolder selectTabViewItemAtIndex:7];
807 - (IBAction)prevTab:(id)sender
809 if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Summary"])
811 /* check whether we are streaming or transcoding and go back */
812 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
814 /* show "Streaming 2" */
815 [o_tab_pageHolder selectTabViewItemAtIndex:5];
817 /* show "Transcode 2" */
818 [o_tab_pageHolder selectTabViewItemAtIndex:6];
820 /* rename the forward-button */
821 [o_btn_forward setTitle: [_NS("Next") stringByAppendingString:@" >"]];
823 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 2"])
826 [o_tab_pageHolder selectTabViewItemAtIndex:4];
828 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 2"])
831 [o_tab_pageHolder selectTabViewItemAtIndex:4];
833 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Encap"])
835 /* check whether we are streaming or transcoding and go back */
836 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
838 /* show "Streaming 1" */
839 [o_tab_pageHolder selectTabViewItemAtIndex:2];
841 /* show "Transcode 2" */
842 [o_tab_pageHolder selectTabViewItemAtIndex:3];
845 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 1"])
848 [o_tab_pageHolder selectTabViewItemAtIndex:1];
850 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 1"])
853 [o_tab_pageHolder selectTabViewItemAtIndex:1];
855 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Input"])
858 [o_tab_pageHolder selectTabViewItemAtIndex:0];
859 /* disable backwards-btn */
860 [o_btn_backward setEnabled:NO];
864 - (IBAction)t1_mrInfo_streaming:(id)sender
866 /* show a sheet for the help */
867 /* since NSAlert does not exist on OSX < 10.3, we use our own implementation */
868 [o_wh_txt_title setStringValue: _NS("Stream to network")];
869 [o_wh_txt_text setStringValue: _NS("Use this to stream on a network.")];
870 [NSApp beginSheet: o_wizardhelp_window
871 modalForWindow: o_wizard_window
872 modalDelegate: o_wizardhelp_window
877 - (IBAction)t1_mrInfo_transcode:(id)sender
879 /* show a sheet for the help */
880 [o_wh_txt_title setStringValue: _NS("Transcode/Save to file")];
881 [o_wh_txt_text setStringValue: _NS("Use this to save a stream to a file. You "\
882 "have the possibility to reencode the stream. You can save whatever "\
883 "VLC can read.\nPlease notice that VLC is not very suited " \
884 "for file to file transcoding. You should use its transcoding " \
885 "features to save network streams, for example.")];
886 [NSApp beginSheet: o_wizardhelp_window
887 modalForWindow: o_wizard_window
888 modalDelegate: o_wizardhelp_window
893 - (IBAction)t2_addNewStream:(id)sender
895 NSOpenPanel * openPanel = [NSOpenPanel openPanel];
896 SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
897 [openPanel beginSheetForDirectory:nil file:nil types:nil modalForWindow:o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
900 - (void)t2_getNewStreamFromDialog: (NSOpenPanel *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
902 if (returnCode == NSOKButton)
904 [o_t2_fld_pathToNewStrm setStringValue:[sheet filename]];
905 /* FIXME: store path in a global variable */
909 - (IBAction)t2_chooseStreamOrPlst:(id)sender
911 /* enable and disable the respective items depending on user's choice */
913 o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
915 if( [o_mode isEqualToString: _NS("Select a stream")] )
917 [o_t2_btn_chooseFile setEnabled:YES];
918 [o_t2_fld_pathToNewStrm setEnabled:YES];
919 [o_t2_tbl_plst setEnabled:NO];
921 [o_t2_btn_chooseFile setEnabled:NO];
922 [o_t2_fld_pathToNewStrm setEnabled:NO];
923 [o_t2_tbl_plst setEnabled:YES];
927 - (IBAction)t2_enableExtract:(id)sender
929 /* enable/disable the respective items */
930 if([o_t2_ckb_enblPartExtrct state] == NSOnState)
932 [o_t2_fld_prtExtrctFrom setEnabled:YES];
933 [o_t2_fld_prtExtrctTo setEnabled:YES];
935 [o_t2_fld_prtExtrctFrom setEnabled:NO];
936 [o_t2_fld_prtExtrctTo setEnabled:NO];
937 [o_t2_fld_prtExtrctFrom setStringValue:@""];
938 [o_t2_fld_prtExtrctTo setStringValue:@""];
942 - (IBAction)t3_addressEntered:(id)sender
944 /* check whether the entered address is valid */
947 - (IBAction)t4_AudCdcChanged:(id)sender
949 /* update codec info */
950 [o_t4_txt_hintAudio setStringValue:[[o_audioCodecs objectAtIndex:[o_t4_pop_audioCodec indexOfSelectedItem]] objectAtIndex:2]];
953 - (IBAction)t4_enblAudTrnscd:(id)sender
955 /* enable/disable the respective items */
956 if([o_t4_ckb_audio state] == NSOnState)
958 [o_t4_pop_audioCodec setEnabled:YES];
959 [o_t4_pop_audioBitrate setEnabled:YES];
960 [o_t4_txt_hintAudio setStringValue: _NS("Select your audio codec. "\
961 "Click one to get more information.")];
963 [o_t4_pop_audioCodec setEnabled:NO];
964 [o_t4_pop_audioBitrate setEnabled:NO];
965 [o_t4_txt_hintAudio setStringValue: _NS("If your stream has audio " \
966 "and you want to transcode it, enable this.")];
970 - (IBAction)t4_enblVidTrnscd:(id)sender
972 /* enable/disable the respective items */
973 if([o_t4_ckb_video state] == NSOnState)
975 [o_t4_pop_videoCodec setEnabled:YES];
976 [o_t4_pop_videoBitrate setEnabled:YES];
977 [o_t4_txt_hintVideo setStringValue: _NS("Select your video codec. "\
978 "Click one to get more information.")];
980 [o_t4_pop_videoCodec setEnabled:NO];
981 [o_t4_pop_videoBitrate setEnabled:NO];
982 [o_t4_txt_hintVideo setStringValue: _NS("If your stream has video " \
983 "and you want to transcode it, enable this.")];
987 - (IBAction)t4_VidCdcChanged:(id)sender
989 /* update codec info */
990 [o_t4_txt_hintVideo setStringValue:[[o_videoCodecs objectAtIndex:[o_t4_pop_videoCodec indexOfSelectedItem]] objectAtIndex:2]];
993 - (IBAction)t6_enblSapAnnce:(id)sender
995 /* enable/disable input fld */
996 if([o_t6_ckb_sap state] == NSOnState)
998 [o_t6_fld_sap setEnabled:YES];
1000 [o_t6_fld_sap setEnabled:NO];
1001 [o_t6_fld_sap setStringValue:@""];
1005 - (IBAction)t6_mrInfo_ttl:(id)sender
1007 /* show a sheet for the help */
1008 [o_wh_txt_title setStringValue: _NS("Time-To-Live (TTL)")];
1009 [o_wh_txt_text setStringValue: _NS("Define the TTL (Time-To-Live) of the stream. "\
1010 "This parameter is the maximum number of routers your stream can go "
1011 "through. If you don't know what it means, or if you want to stream on " \
1012 "your local network only, leave this setting to 1.")];
1013 [NSApp beginSheet: o_wizardhelp_window
1014 modalForWindow: o_wizard_window
1015 modalDelegate: o_wizardhelp_window
1020 - (IBAction)t6_mrInfo_sap:(id)sender
1022 /* show a sheet for the help */
1023 [o_wh_txt_title setStringValue: _NS("SAP Announce")];
1024 [o_wh_txt_text setStringValue: _NS("When streaming using UDP, you can " \
1025 "announce your streams using the SAP/SDP announcing protocol. This " \
1026 "way, the clients won't have to type in the multicast address, it " \
1027 "will appear in their playlist if they enable the SAP extra interface.\n" \
1028 "If you want to give a name to your stream, enter it here, " \
1029 "else, a default name will be used.")];
1030 [NSApp beginSheet: o_wizardhelp_window
1031 modalForWindow: o_wizard_window
1032 modalDelegate: o_wizardhelp_window
1037 - (IBAction)t7_selectTrnscdDestFile:(id)sender
1039 /* provide a save-to-dialogue, so the user can choose a location for his/her new file */
1040 NSSavePanel * savePanel = [NSSavePanel savePanel];
1041 SEL sel = @selector(t7_getTrnscdDestFile:returnCode:contextInfo:);
1042 [savePanel beginSheetForDirectory:nil file:nil modalForWindow:o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
1043 /* FIXME: insert a suffix in file depending on the chosen encap-format instead of providing file:nil */
1046 - (void)t7_getTrnscdDestFile: (NSSavePanel *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
1048 if (returnCode == NSOKButton)
1050 [o_t7_fld_filePath setStringValue:[sheet filename]];
1051 /* FIXME: add a suffix depending on the chosen encap-format, if needed */
1055 - (IBAction)wh_closeSheet:(id)sender
1057 /* close the help sheet */
1058 [NSApp endSheet:o_wizardhelp_window];
1059 [o_wizardhelp_window close];
1064 [o_userSelections release];
1065 [o_videoCodecs release];
1066 [o_audioCodecs release];