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 - MRL composition when streaming
32 - putting the MRL and the next item to the playlist
33 - l10n string fixes (both in OSX and WX)
34 - fill the playlist-table on t2
35 - implement l10n on t8?
40 /*****************************************************************************
42 *****************************************************************************/
47 /*****************************************************************************
48 * VLCWizard implementation
49 *****************************************************************************/
51 @implementation VLCWizard
53 static VLCWizard *_o_sharedInstance = nil;
55 + (VLCWizard *)sharedInstance
57 return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
62 if (_o_sharedInstance) {
65 _o_sharedInstance = [super init];
68 return _o_sharedInstance;
73 /* some minor cleanup */
74 [o_t2_tbl_plst setEnabled:NO];
75 [o_wizardhelp_window setExcludedFromWindowsMenu:YES];
76 o_userSelections = [[NSMutableDictionary alloc] init];
77 [o_btn_backward setEnabled:NO];
79 /* add audio-bitrates for transcoding */
80 NSArray * audioBitratesArray;
81 audioBitratesArray = [NSArray arrayWithObjects: @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
82 [o_t4_pop_audioBitrate removeAllItems];
83 [o_t4_pop_audioBitrate addItemsWithTitles: audioBitratesArray];
84 [o_t4_pop_audioBitrate selectItemWithTitle: @"192"];
86 /* add video-bitrates for transcoding */
87 NSArray * videoBitratesArray;
88 videoBitratesArray = [NSArray arrayWithObjects: @"3072", @"2048", @"1024", @"768", @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
89 [o_t4_pop_videoBitrate removeAllItems];
90 [o_t4_pop_videoBitrate addItemsWithTitles: videoBitratesArray];
91 [o_t4_pop_videoBitrate selectItemWithTitle: @"1024"];
93 /* fill 2 global arrays with arrays containing all codec-related information
94 * - one array per codec named by its short name to define the encap-compability,
95 * cmd-names, real names, more info in the order: realName, shortName,
109 NSArray * o_dummyVid;
110 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];
111 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];
112 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];
113 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];
114 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];
115 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];
116 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];
117 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];
118 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];
119 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];
120 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];
121 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];
122 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];
123 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];
124 [o_t4_pop_videoCodec removeAllItems];
127 while (x != [o_videoCodecs count])
129 [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x] objectAtIndex:0]];
142 NSArray * o_dummyAud;
143 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];
144 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];
145 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];
146 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];
147 o_vorb = [NSArray arrayWithObjects: @"Vorbis", @"vorb", _NS("Vorbis is a free audio codec"), @"MUX_OGG", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
148 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];
149 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];
150 o_s16l = [NSArray arrayWithObjects: @"Uncompressed, integer", @"s16l", _NS("Uncompressed audio samples"), @"MUX_WAV", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
151 o_fl32 = [NSArray arrayWithObjects: @"Uncompressed, floating", @"fl32", _NS("Uncompressed audio samples"), @"MUX_WAV", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
152 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];
153 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];
154 [o_t4_pop_audioCodec removeAllItems];
156 while (x != [o_audioCodecs count])
158 [o_t4_pop_audioCodec addItemWithTitle:[[o_audioCodecs objectAtIndex:x] objectAtIndex:0]];
163 /* fill another global array with all information about the encap-formats
164 * note that the order of the formats inside the g. array is the same as on
176 o_ps = [NSArray arrayWithObjects: @"ps", @"MPEG PS", _NS("MPEG Program Stream"), nil];
177 o_ts = [NSArray arrayWithObjects: @"ts", @"MPEG TS", _NS("MPEG Transport Stream"), nil];
178 o_mpeg = [NSArray arrayWithObjects: @"ps", @"MPEG 1", _NS("MPEG 1 Format"), nil];
179 o_ogg = [NSArray arrayWithObjects: @"ogg", @"OGG", @"OGG", nil];
180 o_raw = [NSArray arrayWithObjects: @"raw", @"RAW", @"RAW", nil];
181 o_asf = [NSArray arrayWithObjects: @"asf", @"ASF", @"ASF", nil];
182 o_avi = [NSArray arrayWithObjects: @"avi", @"AVI", @"AVI", nil];
183 o_mp4 = [NSArray arrayWithObjects: @"mp4", @"MP4", @"MPEG4", nil];
184 o_mov = [NSArray arrayWithObjects: @"mov", @"MOV", @"MOV", nil];
185 o_wav = [NSArray arrayWithObjects: @"wav", @"WAV", @"WAV", nil];
186 o_encapFormats = [[NSArray alloc] initWithObjects: o_ps, o_ts, o_mpeg, o_ogg, o_raw, o_asf, o_avi, o_mp4, o_mov, o_wav, nil];
191 /* just present the window to the user */
192 [o_tab_pageHolder selectFirstTabViewItem:self];
196 [o_wizard_window center];
197 [o_wizard_window displayIfNeeded];
198 [o_wizard_window makeKeyAndOrderFront:nil];
203 /* reset the wizard-window to its default values */
205 [o_userSelections removeAllObjects];
206 [o_t1_matrix_strmgOrTrnscd selectCellAtRow:0 column:0];
207 [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setState: NSOffState];
208 [o_btn_forward setTitle: [_NS("Next") stringByAppendingString:@" >"]];
211 [o_t2_fld_pathToNewStrm setStringValue: @""];
212 [o_t2_ckb_enblPartExtrct setState: NSOffState];
213 [self t2_enableExtract:nil];
214 [o_t2_matrix_inputSourceType selectCellAtRow:0 column:0];
215 [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setState: NSOffState];
216 /* FIXME: we need to refresh the playlist-table as well */
217 [o_t2_tbl_plst setEnabled:NO];
218 [o_t2_fld_pathToNewStrm setEnabled:YES];
219 [o_t2_btn_chooseFile setEnabled:YES];
222 [o_t3_fld_address setStringValue: @""];
223 [o_t3_matrix_stmgMhd selectCellAtRow:0 column:0];
224 [[o_t3_matrix_stmgMhd cellAtRow:1 column:1] setState: NSOffState];
225 [[o_t3_matrix_stmgMhd cellAtRow:1 column:2] setState: NSOffState];
228 [o_t4_ckb_audio setState: NSOffState];
229 [o_t4_ckb_video setState: NSOffState];
230 [self t4_enblVidTrnscd:nil];
231 [self t4_enblAudTrnscd:nil];
234 [o_t6_fld_ttl setStringValue: @"1"];
235 [o_t6_ckb_sap setState: NSOffState];
236 [self t6_enblSapAnnce:nil];
239 [o_t7_fld_filePath setStringValue: @""];
244 /* localise all strings to the users lang */
245 /* method is called from intf.m (in method openWizard) */
248 [o_btn_backward setTitle: [@"< " stringByAppendingString: _NS("Back")]];
249 [o_btn_cancel setTitle: _NS("Cancel")];
250 [o_btn_forward setTitle: [_NS("Next") stringByAppendingString:@" >"]];
251 [o_wizard_window setTitle: _NS("Streaming/Transcoding Wizard")];
253 /* page one ("Hello") */
254 [o_t1_txt_title setStringValue: _NS("Streaming/Transcoding Wizard")];
255 [o_t1_txt_text setStringValue: _NS("This wizard helps you to stream, transcode or save a stream")];
256 [o_t1_btn_mrInfo_strmg setTitle: _NS("More Info")];
257 [o_t1_btn_mrInfo_trnscd setTitle: _NS("More Info")];
258 [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")];
259 [[o_t1_matrix_strmgOrTrnscd cellAtRow:0 column:0] setTitle: _NS("Stream to network")];
260 [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setTitle: _NS("Transcode/Save to file")];
262 /* page two ("Input") */
263 [o_t2_title setStringValue: _NS("Choose input")];
264 [o_t2_text setStringValue: _NS("Choose here your input stream")];
265 [[o_t2_matrix_inputSourceType cellAtRow:0 column:0] setTitle: _NS("Select a stream")];
266 [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setTitle: _NS("Existing playlist item")];
267 [o_t2_btn_chooseFile setTitle: _NS("Choose...")];
268 [[[o_t2_tbl_plst tableColumnWithIdentifier:@"name"] headerCell] setStringValue: _NS("Name")];
269 [[[o_t2_tbl_plst tableColumnWithIdentifier:@"uri"] headerCell] setStringValue: _NS("URI")];
270 [o_t2_box_prtExtrct setTitle: _NS("Partial Extract")];
271 [o_t2_ckb_enblPartExtrct setTitle: _NS("Enable")];
272 [o_t2_txt_prtExtrctFrom setStringValue: _NS("From")];
273 [o_t2_txt_prtExtrctTo setStringValue: _NS("To")];
275 /* page three ("Streaming 1") */
276 [o_t3_txt_title setStringValue: _NS("Streaming")];
277 [o_t3_txt_text setStringValue: _NS("In this page, you will select how your input stream will be sent.")];
278 [o_t3_box_dest setTitle: _NS("Destination")];
279 [o_t3_box_strmgMthd setTitle: _NS("Streaming method")];
280 [o_t3_txt_destInfo setStringValue: _NS("Enter the address of the computer to stream to")];
281 [[o_t3_matrix_stmgMhd cellAtRow:1 column:0] setTitle: _NS("UDP Unicast")];
282 [[o_t3_matrix_stmgMhd cellAtRow:1 column:1] setTitle: _NS("UDP Multicast")];
283 [o_t3_txt_strgMthdInfo setStringValue: _NS("Use this to stream to a single computer")];
285 /* page four ("Transcode 1") */
286 [o_t4_title setStringValue: _NS("Transcode")];
287 [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).")];
288 [o_t4_box_audio setTitle: _NS("Audio")];
289 [o_t4_box_video setTitle: _NS("Video")];
290 [o_t4_ckb_audio setTitle: _NS("Transcode audio")];
291 [o_t4_ckb_video setTitle: _NS("Transcode video")];
292 [o_t4_txt_videoBitrate setStringValue: _NS("Bitrate (kb/s)")];
293 [o_t4_txt_videoCodec setStringValue: _NS("Codec")];
294 [o_t4_txt_hintAudio setStringValue: _NS("If your stream has audio and you want to " \
295 "transcode it, enable this")];
296 [o_t4_txt_hintVideo setStringValue: _NS("If your stream has video and you want to " \
297 "transcode it, enable this")];
299 /* page five ("Encap") */
300 [o_t5_title setStringValue: _NS("Encapsulation format")];
301 [o_t5_text setStringValue: _NS("In this page, you will select how the stream will be "\
302 "encapsulated. Depending on the choices you made, all "\
303 "formats won't be available.")];
305 /* page six ("Streaming 2") */
306 [o_t6_title setStringValue: _NS("Additional streaming options")];
307 [o_t6_text setStringValue: _NS("In this page, you will define a few " \
308 "additional parameters for your stream.")];
309 [o_t6_txt_ttl setStringValue: _NS("Time-To-Live (TTL)")];
310 [o_t6_btn_mrInfo_ttl setTitle: _NS("More Info")];
311 [o_t6_ckb_sap setTitle: _NS("SAP Announce")];
312 [o_t6_btn_mrInfo_sap setTitle: _NS("More Info")];
314 /* page seven ("Transcode 2") */
315 [o_t7_title setStringValue: _NS("Additional transcode options")];
316 [o_t7_text setStringValue: _NS("In this page, you will define a few " \
317 "additionnal parameters for your transcoding.")];
318 [o_t7_txt_saveFileTo setStringValue: _NS("Select the file to save to")];
319 [o_t7_btn_chooseFile setTitle: _NS("Choose...")];
321 /* page eight ("Summary") */
322 /* FIXME: currently not implemented as it unsure whether we show this tab
323 * to the public or use it for debugging only */
325 /* wizard help window */
326 [o_wh_btn_okay setTitle: _NS("OK")];
329 - (IBAction)cancelRun:(id)sender
331 [o_wizard_window close];
334 - (IBAction)nextTab:(id)sender
336 if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Hello"])
338 /* check whether the user wants to stream or just to transcode;
339 * store information for later usage */
341 o_mode = [[o_t1_matrix_strmgOrTrnscd selectedCell] title];
342 if( [o_mode isEqualToString: _NS("Stream to network")] )
344 [o_userSelections setObject:@"strmg" forKey:@"trnscdOrStrmg"];
346 [o_userSelections setObject:@"trnscd" forKey:@"trnscdOrStrmg"];
348 [o_btn_backward setEnabled:YES];
349 [o_tab_pageHolder selectTabViewItemAtIndex:1];
351 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Input"])
353 /* check whether partialExtract is enabled and store the values, if needed */
354 if ([o_t2_ckb_enblPartExtrct state] == NSOnState)
356 [o_userSelections setObject:@"YES" forKey:@"partExtract"];
357 [o_userSelections setObject:[o_t2_fld_prtExtrctFrom stringValue] forKey:@"partExtractFrom"];
358 [o_userSelections setObject:[o_t2_fld_prtExtrctTo stringValue] forKey:@"partExtractTo"];
360 [o_userSelections setObject:@"NO" forKey:@"partExtract"];
363 /* check whether we use an existing pl-item or add an new one;
364 * store the path or the index and set a flag.
365 * complain to the user if s/he didn't provide a path */
369 o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
370 if( [o_mode isEqualToString: _NS("Select a stream")] )
372 [o_userSelections setObject:@"YES" forKey:@"newStrm"];
373 if ([[o_t2_fld_pathToNewStrm stringValue] isEqualToString: @""])
375 /* set a flag that no file is selected */
378 [o_userSelections setObject:[o_t2_fld_pathToNewStrm stringValue] forKey:@"pathToNewStrm"];
381 if ([o_t2_tbl_plst selectedRow] != -1)
383 [o_userSelections setObject:@"NO" forKey:@"newStrm"];
384 NSNumber * myNumber = [[NSNumber alloc] initWithInt:[o_t2_tbl_plst selectedRow]];
385 [o_userSelections setObject:myNumber forKey:@"plItemIndex"];
387 /* set a flag that no item is selected */
392 /* show either "Streaming 1" or "Transcode 1" to the user */
395 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
397 /* we are streaming */
398 [o_tab_pageHolder selectTabViewItemAtIndex:2];
400 /* we are just transcoding */
401 [o_tab_pageHolder selectTabViewItemAtIndex:3];
404 /* show a sheet that the user didn't select a file */
405 [o_wh_txt_title setStringValue: _NS("No input selected")];
406 [o_wh_txt_text setStringValue: _NS("You selected neither " \
407 "a new stream nor an existing playlist item. VLC is unable to " \
408 "guess, which input you want use. \n\n Choose one " \
409 "before going to the next page.")];
410 [NSApp beginSheet: o_wizardhelp_window
411 modalForWindow: o_wizard_window
412 modalDelegate: o_wizardhelp_window
417 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 1"])
419 /* check which streaming method is selected and store it */
421 o_mode = [[o_t3_matrix_stmgMhd selectedCell] title];
422 if( [o_mode isEqualToString: _NS("HTTP")] )
424 [o_userSelections setObject:@"HTTP" forKey:@"stmgMhd"];
425 /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF; select MPEG PS */
426 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
427 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
428 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
429 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
430 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
431 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
432 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
433 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
434 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
435 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
436 [o_t5_matrix_encap selectCellAtRow:0 column:0];
438 if( [o_mode isEqualToString: _NS("UDP Unicast")] )
440 [o_userSelections setObject:@"UDP-Unicast" forKey:@"stmgMhd"];
442 [o_userSelections setObject:@"UDP-Multicast" forKey:@"stmgMhd"];
444 /* disable all encap-formats but MPEG-TS and select it */
445 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
446 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
447 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
448 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
449 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
450 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
451 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
452 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
453 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
454 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
455 [o_t5_matrix_encap selectCellAtRow:1 column:0];
458 /* store the destination and check whether is it empty */
459 if(! [o_mode isEqualToString: _NS("HTTP")] )
461 /* empty field is valid for HTTP */
463 if( [[o_t3_fld_address stringValue] isEqualToString: @""] )
466 /* complain to the user that "" is no valid dest. */
467 [o_wh_txt_title setStringValue: _NS("No valid destination")];
468 [o_wh_txt_text setStringValue: _NS("You need to enter " \
469 "a valid destination you want to stream to. Enter either a " \
470 "Unicast-IP or a Multicast-IP.\n\n If you don't know "
471 "what this means, have a look at the VLC Streaming HOWTO and " \
472 "the help texts in this window." )];
473 [NSApp beginSheet: o_wizardhelp_window
474 modalForWindow: o_wizard_window
475 modalDelegate: o_wizardhelp_window
479 /* FIXME: stupid code duplication, should be solved by a GoTo-like-thing -- FK */
480 [o_userSelections setObject:[o_t3_fld_address stringValue] forKey:@"stmgDest"];
481 /* let's go to the encap-tab */
482 [o_tab_pageHolder selectTabViewItemAtIndex:4];
485 [o_userSelections setObject:[o_t3_fld_address stringValue] forKey:@"stmgDest"];
486 /* let's go to the encap-tab */
487 [o_tab_pageHolder selectTabViewItemAtIndex:4];
490 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 1"])
492 /* check whether the user wants to transcode the video-track and store the related options */
493 if ([o_t4_ckb_video state] == NSOnState)
496 theNum = [NSNumber numberWithInt:[o_t4_pop_videoCodec indexOfSelectedItem]];
497 [o_userSelections setObject:@"YES" forKey:@"trnscdVideo"];
498 [o_userSelections setObject:[o_t4_pop_videoBitrate titleOfSelectedItem] forKey:@"trnscdVideoBitrate"];
499 [o_userSelections setObject:theNum forKey:@"trnscdVideoCodec"];
501 [o_userSelections setObject:@"NO" forKey:@"trnscdVideo"];
504 /* check whether the user wants to transcode the audio-track and store the related options */
505 if ([o_t4_ckb_audio state] == NSOnState)
508 theNum = [NSNumber numberWithInt:[o_t4_pop_audioCodec indexOfSelectedItem]];
509 [o_userSelections setObject:@"YES" forKey:@"trnscdAudio"];
510 [o_userSelections setObject:[o_t4_pop_audioBitrate titleOfSelectedItem] forKey:@"trnscdAudioBitrate"];
511 [o_userSelections setObject:theNum forKey:@"trnscdAudioCodec"];
513 [o_userSelections setObject:@"NO" forKey:@"trnscdAudio"];
516 /* disable all encap-formats */
517 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
518 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
519 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
520 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
521 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
522 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
523 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
524 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
525 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
526 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
528 /* re-enable the encap-formats supported by the chosen codecs */
529 /* FIXME: the following is a really bad coding-style. feel free to write
530 me ideas how to make this nicer, if you want to -- FK, 7/11/05 */
532 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualTo: @"YES"])
534 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
536 /* we are transcoding both audio and video, so we need to check both deps */
537 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_PS"])
539 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_PS"])
541 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
542 [o_t5_matrix_encap selectCellAtRow:0 column:0];
545 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_TS"])
547 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_TS"])
549 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
550 [o_t5_matrix_encap selectCellAtRow:1 column:0];
553 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MPEG"])
555 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MPEG"])
557 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
558 [o_t5_matrix_encap selectCellAtRow:2 column:0];
561 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_OGG"])
563 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_OGG"])
565 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
566 [o_t5_matrix_encap selectCellAtRow:3 column:0];
569 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_RAW"])
571 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_RAW"])
573 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
574 [o_t5_matrix_encap selectCellAtRow:4 column:0];
577 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_ASF"])
579 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_ASF"])
581 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
582 [o_t5_matrix_encap selectCellAtRow:5 column:0];
585 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
587 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
589 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
590 [o_t5_matrix_encap selectCellAtRow:6 column:0];
593 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
595 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
597 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
598 [o_t5_matrix_encap selectCellAtRow:7 column:0];
601 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
603 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
605 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
606 [o_t5_matrix_encap selectCellAtRow:8 column:0];
609 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
611 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
613 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
614 [o_t5_matrix_encap selectCellAtRow:9 column:0];
620 /* we just transcoding the audio */
622 /* select formats supported by the audio codec */
623 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_PS"])
625 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
626 [o_t5_matrix_encap selectCellAtRow:0 column:0];
628 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_TS"])
630 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
631 [o_t5_matrix_encap selectCellAtRow:1 column:0];
633 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MPEG"])
635 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
636 [o_t5_matrix_encap selectCellAtRow:2 column:0];
638 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_OGG"])
640 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
641 [o_t5_matrix_encap selectCellAtRow:3 column:0];
643 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_RAW"])
645 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
646 [o_t5_matrix_encap selectCellAtRow:4 column:0];
648 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_ASF"])
650 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
651 [o_t5_matrix_encap selectCellAtRow:5 column:0];
653 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
655 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
656 [o_t5_matrix_encap selectCellAtRow:6 column:0];
658 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
660 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
661 [o_t5_matrix_encap selectCellAtRow:7 column:0];
663 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
665 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
666 [o_t5_matrix_encap selectCellAtRow:8 column:0];
668 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
670 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
671 [o_t5_matrix_encap selectCellAtRow:9 column:0];
675 else if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
677 /* we are just transcoding the video */
679 /* select formats supported by the video-codec */
681 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_PS"])
683 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
684 [o_t5_matrix_encap selectCellAtRow:0 column:0];
686 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_TS"])
688 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
689 [o_t5_matrix_encap selectCellAtRow:1 column:0];
691 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MPEG"])
693 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
694 [o_t5_matrix_encap selectCellAtRow:2 column:0];
696 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_OGG"])
698 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
699 [o_t5_matrix_encap selectCellAtRow:3 column:0];
701 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_RAW"])
703 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
704 [o_t5_matrix_encap selectCellAtRow:4 column:0];
706 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_ASF"])
708 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
709 [o_t5_matrix_encap selectCellAtRow:5 column:0];
711 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
713 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
714 [o_t5_matrix_encap selectCellAtRow:6 column:0];
716 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
718 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
719 [o_t5_matrix_encap selectCellAtRow:7 column:0];
721 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
723 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
724 [o_t5_matrix_encap selectCellAtRow:8 column:0];
726 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
728 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
729 [o_t5_matrix_encap selectCellAtRow:9 column:0];
732 /* we don't do any transcoding
733 * -> enabled the encap-formats allowed when streaming content via http
734 * since this should work fine in most cases */
735 /* FIXME: choose a selection of encap-formats based upon the actually used codecs */
737 /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF; select MPEG PS */
738 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
739 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
740 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
741 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
742 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
743 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
744 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
745 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
746 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
747 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
748 [o_t5_matrix_encap selectCellAtRow:0 column:0];
751 BOOL anythingEnabled;
753 anythingEnabled = NO;
754 while (x != [o_t5_matrix_encap numberOfRows])
756 if ([[o_t5_matrix_encap cellAtRow:x column:0] isEnabled])
758 anythingEnabled = YES;
762 if (anythingEnabled == YES)
764 [o_tab_pageHolder selectTabViewItemAtIndex:4];
766 /* show a sheet that the selected codecs are not compatible */
767 [o_wh_txt_title setStringValue: _NS("Invalid selection")];
768 [o_wh_txt_text setStringValue: _NS("Your chosen codecs are " \
769 "not compatible with each other. For example: you cannot " \
770 "mix uncompressed audio with any video codec.\n\n" \
771 "Correct your selection and try again.")];
772 [NSApp beginSheet: o_wizardhelp_window
773 modalForWindow: o_wizard_window
774 modalDelegate: o_wizardhelp_window
780 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Encap"])
782 /* get the chosen encap format and store it */
784 theNum = [NSNumber numberWithInt:[[o_t5_matrix_encap selectedCell] tag]];
785 [o_userSelections setObject:[theNum stringValue] forKey:@"encapFormat"];
787 /* show either "Streaming 2" or "Transcode 2" to the user */
788 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
790 /* we are streaming */
791 [o_tab_pageHolder selectTabViewItemAtIndex:5];
793 /* we are just transcoding */
794 [o_tab_pageHolder selectTabViewItemAtIndex:6];
797 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 2"])
799 /* store the chosen TTL */
800 [o_userSelections setObject:[o_t6_fld_ttl stringValue] forKey:@"ttl"];
802 /* check whether SAP is enabled and store the announce, if needed */
803 if ([o_t6_ckb_sap state] == NSOnState)
805 [o_userSelections setObject:@"YES" forKey:@"sap"];
806 [o_userSelections setObject:[o_t6_fld_sap stringValue] forKey:@"sapText"];
808 [o_userSelections setObject:@"NO" forKey:@"sap"];
811 /* go to "Summary" */
814 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 2"])
816 /* check whether the path != "" and store it */
817 if( [[o_t7_fld_filePath stringValue] isEqualToString: @""] )
818 { /* complain to the user that "" is no valid path */
819 [o_wh_txt_title setStringValue: _NS("No file selected")];
820 [o_wh_txt_text setStringValue: _NS("You you need to select " \
821 "a file, you want to save to. \n\n Enter either a valid path or " \
822 "choose a location through the button's dialog-box.")];
823 [NSApp beginSheet: o_wizardhelp_window
824 modalForWindow: o_wizard_window
825 modalDelegate: o_wizardhelp_window
829 [o_userSelections setObject:[o_t7_fld_filePath stringValue] forKey:@"trnscdFilePath"];
831 /* go to "Summary" */
839 [o_btn_forward setTitle: _NS("Finish")];
840 if ([[o_userSelections objectForKey:@"newStrm"] isEqualToString: @"YES"])
842 [o_t8_fld_inptStream setStringValue:[o_userSelections objectForKey:@"pathToNewStrm"]];
844 [o_t8_fld_inptStream setStringValue:[[o_userSelections objectForKey:@"plItemIndex"] stringValue]];
846 if ([[o_userSelections objectForKey:@"partExtract"] isEqualToString: @"YES"])
848 [o_t8_fld_partExtract setStringValue: [[[[[_NS("yes") stringByAppendingString:@" - "] stringByAppendingString: _NS("from ")] stringByAppendingString: [o_userSelections objectForKey:@"partExtractFrom"]] stringByAppendingString: _NS(" to ")] stringByAppendingString: [o_userSelections objectForKey:@"partExtractTo"]]];
850 [o_t8_fld_partExtract setStringValue: _NS("no")];
853 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
855 /* we are streaming; no transcoding allowed atm */
856 [o_t8_fld_saveFileTo setStringValue: @"-"];
857 [o_t8_fld_trnscdAudio setStringValue: @"-"];
858 [o_t8_fld_trnscdVideo setStringValue: @"-"];
859 [o_t8_fld_strmgMthd setStringValue: [o_userSelections objectForKey:@"stmgMhd"]];
860 [o_t8_fld_destination setStringValue: [o_userSelections objectForKey:@"stmgDest"]];
861 [o_t8_fld_ttl setStringValue: [o_userSelections objectForKey:@"ttl"]];
862 if ([[o_userSelections objectForKey:@"sap"] isEqualToString: @"YES"])
864 [o_t8_fld_sap setStringValue: [[_NS("yes") stringByAppendingString:@": "] stringByAppendingString:[o_userSelections objectForKey:@"sapText"]]];
866 [o_t8_fld_sap setStringValue: _NS("no")];
869 /* we are transcoding */
870 [o_t8_fld_strmgMthd setStringValue: @"-"];
871 [o_t8_fld_destination setStringValue: @"-"];
872 [o_t8_fld_ttl setStringValue: @"-"];
873 [o_t8_fld_sap setStringValue: @"-"];
874 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
876 [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"]];
878 [o_t8_fld_trnscdVideo setStringValue: _NS("no")];
880 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
882 [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"]];
884 [o_t8_fld_trnscdAudio setStringValue: _NS("no")];
886 [o_t8_fld_saveFileTo setStringValue: [o_userSelections objectForKey:@"trnscdFilePath"]];
888 [o_t8_fld_encapFormat setStringValue: [[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:1]];
891 [o_t8_fld_mrl setStringValue: o_mrl];
893 [o_tab_pageHolder selectTabViewItemAtIndex:7];
898 NSMutableString * o_mrl_string = [NSMutableString stringWithString:@""];
899 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
901 /* we are streaming, no transcoding allowed atm */
902 /* FIXME: implementation missing */
904 /* we are just transcoding and dumping the stuff to a file */
905 NSMutableString *o_trnscdCmd = [NSMutableString stringWithString:@""];
906 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
908 [o_trnscdCmd appendString: @"transcode{"];
909 [o_trnscdCmd appendFormat: @"vcodec=%s,vb=%i", [[[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] objectAtIndex:1] UTF8String], [[o_userSelections objectForKey:@"trnscdVideoBitrate"] intValue]];
910 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
912 [o_trnscdCmd appendString: @","];
915 [o_trnscdCmd appendString: @"}:"];
918 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
920 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"NO"])
922 /* in case we transcode the audio only, add this */
923 [o_trnscdCmd appendString: @"transcode{"];
925 [o_trnscdCmd appendFormat: @"acodec=%s,ab=%i}:", [[[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] objectAtIndex:1] UTF8String], [[o_userSelections objectForKey:@"trnscdAudioBitrate"] intValue]];
927 [o_mrl_string appendFormat:
928 @":sout=#%sstandard{mux=%s,url=%s,access=file}", [o_trnscdCmd UTF8String],
929 [[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0] UTF8String], [[o_userSelections objectForKey:@"trnscdFilePath"] UTF8String]];
932 o_mrl = [[NSString alloc] initWithString: o_mrl_string];
935 - (IBAction)prevTab:(id)sender
937 if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Summary"])
939 /* check whether we are streaming or transcoding and go back */
940 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
942 /* show "Streaming 2" */
943 [o_tab_pageHolder selectTabViewItemAtIndex:5];
945 /* show "Transcode 2" */
946 [o_tab_pageHolder selectTabViewItemAtIndex:6];
948 /* rename the forward-button */
949 [o_btn_forward setTitle: [_NS("Next") stringByAppendingString:@" >"]];
951 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 2"])
954 [o_tab_pageHolder selectTabViewItemAtIndex:4];
956 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 2"])
959 [o_tab_pageHolder selectTabViewItemAtIndex:4];
961 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Encap"])
963 /* check whether we are streaming or transcoding and go back */
964 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
966 /* show "Streaming 1" */
967 [o_tab_pageHolder selectTabViewItemAtIndex:2];
969 /* show "Transcode 2" */
970 [o_tab_pageHolder selectTabViewItemAtIndex:3];
973 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 1"])
976 [o_tab_pageHolder selectTabViewItemAtIndex:1];
978 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 1"])
981 [o_tab_pageHolder selectTabViewItemAtIndex:1];
983 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Input"])
986 [o_tab_pageHolder selectTabViewItemAtIndex:0];
987 /* disable backwards-btn */
988 [o_btn_backward setEnabled:NO];
992 - (IBAction)t1_mrInfo_streaming:(id)sender
994 /* show a sheet for the help */
995 /* since NSAlert does not exist on OSX < 10.3, we use our own implementation */
996 [o_wh_txt_title setStringValue: _NS("Stream to network")];
997 [o_wh_txt_text setStringValue: _NS("Use this to stream on a network.")];
998 [NSApp beginSheet: o_wizardhelp_window
999 modalForWindow: o_wizard_window
1000 modalDelegate: o_wizardhelp_window
1005 - (IBAction)t1_mrInfo_transcode:(id)sender
1007 /* show a sheet for the help */
1008 [o_wh_txt_title setStringValue: _NS("Transcode/Save to file")];
1009 [o_wh_txt_text setStringValue: _NS("Use this to save a stream to a file. You "\
1010 "have the possibility to reencode the stream. You can save whatever "\
1011 "VLC can read.\nPlease notice that VLC is not very suited " \
1012 "for file to file transcoding. You should use its transcoding " \
1013 "features to save network streams, for example.")];
1014 [NSApp beginSheet: o_wizardhelp_window
1015 modalForWindow: o_wizard_window
1016 modalDelegate: o_wizardhelp_window
1021 - (IBAction)t2_addNewStream:(id)sender
1023 NSOpenPanel * openPanel = [NSOpenPanel openPanel];
1024 SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
1025 [openPanel beginSheetForDirectory:nil file:nil types:nil modalForWindow:o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
1028 - (void)t2_getNewStreamFromDialog: (NSOpenPanel *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
1030 if (returnCode == NSOKButton)
1032 [o_t2_fld_pathToNewStrm setStringValue:[sheet filename]];
1036 - (IBAction)t2_chooseStreamOrPlst:(id)sender
1038 /* enable and disable the respective items depending on user's choice */
1040 o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
1042 if( [o_mode isEqualToString: _NS("Select a stream")] )
1044 [o_t2_btn_chooseFile setEnabled:YES];
1045 [o_t2_fld_pathToNewStrm setEnabled:YES];
1046 [o_t2_tbl_plst setEnabled:NO];
1048 [o_t2_btn_chooseFile setEnabled:NO];
1049 [o_t2_fld_pathToNewStrm setEnabled:NO];
1050 [o_t2_tbl_plst setEnabled:YES];
1054 - (IBAction)t2_enableExtract:(id)sender
1056 /* enable/disable the respective items */
1057 if([o_t2_ckb_enblPartExtrct state] == NSOnState)
1059 [o_t2_fld_prtExtrctFrom setEnabled:YES];
1060 [o_t2_fld_prtExtrctTo setEnabled:YES];
1062 [o_t2_fld_prtExtrctFrom setEnabled:NO];
1063 [o_t2_fld_prtExtrctTo setEnabled:NO];
1064 [o_t2_fld_prtExtrctFrom setStringValue:@""];
1065 [o_t2_fld_prtExtrctTo setStringValue:@""];
1069 - (IBAction)t3_addressEntered:(id)sender
1071 /* check whether the entered address is valid */
1074 - (IBAction)t3_strmMthdChanged:(id)sender
1076 /* change the captions of o_t3_txt_destInfo according to the chosen
1077 * streaming method */
1079 o_mode = [[NSNumber alloc] initWithInt:[[o_t3_matrix_stmgMhd selectedCell] tag]];
1080 if( [o_mode intValue] == 2 )
1082 [o_t3_txt_destInfo setStringValue: _NS("Enter the local addresses you " \
1083 "want to listen to. Do not enter anything if you want to listen " \
1084 "to all adresses or if you don't understand. This is generally " \
1085 "the best thing to do. Other computers can then access the stream " \
1086 "at http://yourip:8080 by default") ];
1087 [o_t3_txt_strgMthdInfo setStringValue: _NS("Use this to stream to " \
1088 "several computers. This method is less efficient, as the server " \
1089 "needs to send several times the stream.")];
1091 else if( [o_mode intValue] == 1 )
1093 [o_t3_txt_destInfo setStringValue: _NS("Enter the multicast address " \
1094 "to stream to in this field. This must be an IP address between " \
1095 "224.0.0.0 an 239.255.255.255 For a private use, enter an " \
1096 "address beginning with 239.255")];
1097 [o_t3_txt_strgMthdInfo setStringValue: _NS("Use this to stream to a " \
1098 "dynamic group of computers on a multicast-enabled network. This " \
1099 "is the most efficient method to stream to several computers, but " \
1100 "it does not work over Internet.")];
1102 else if( [o_mode intValue] == 0 )
1104 [o_t3_txt_destInfo setStringValue: _NS("Enter the address of the " \
1105 "computer to stream to")];
1106 [o_t3_txt_strgMthdInfo setStringValue: _NS("Use this to stream to a " \
1107 "single computer")];
1112 - (IBAction)t4_AudCdcChanged:(id)sender
1114 /* update codec info */
1115 [o_t4_txt_hintAudio setStringValue:[[o_audioCodecs objectAtIndex:[o_t4_pop_audioCodec indexOfSelectedItem]] objectAtIndex:2]];
1118 - (IBAction)t4_enblAudTrnscd:(id)sender
1120 /* enable/disable the respective items */
1121 if([o_t4_ckb_audio state] == NSOnState)
1123 [o_t4_pop_audioCodec setEnabled:YES];
1124 [o_t4_pop_audioBitrate setEnabled:YES];
1125 [o_t4_txt_hintAudio setStringValue: _NS("Select your audio codec. "\
1126 "Click one to get more information.")];
1128 [o_t4_pop_audioCodec setEnabled:NO];
1129 [o_t4_pop_audioBitrate setEnabled:NO];
1130 [o_t4_txt_hintAudio setStringValue: _NS("If your stream has audio " \
1131 "and you want to transcode it, enable this.")];
1135 - (IBAction)t4_enblVidTrnscd:(id)sender
1137 /* enable/disable the respective items */
1138 if([o_t4_ckb_video state] == NSOnState)
1140 [o_t4_pop_videoCodec setEnabled:YES];
1141 [o_t4_pop_videoBitrate setEnabled:YES];
1142 [o_t4_txt_hintVideo setStringValue: _NS("Select your video codec. "\
1143 "Click one to get more information.")];
1145 [o_t4_pop_videoCodec setEnabled:NO];
1146 [o_t4_pop_videoBitrate setEnabled:NO];
1147 [o_t4_txt_hintVideo setStringValue: _NS("If your stream has video " \
1148 "and you want to transcode it, enable this.")];
1152 - (IBAction)t4_VidCdcChanged:(id)sender
1154 /* update codec info */
1155 [o_t4_txt_hintVideo setStringValue:[[o_videoCodecs objectAtIndex:[o_t4_pop_videoCodec indexOfSelectedItem]] objectAtIndex:2]];
1158 - (IBAction)t6_enblSapAnnce:(id)sender
1160 /* enable/disable input fld */
1161 if([o_t6_ckb_sap state] == NSOnState)
1163 [o_t6_fld_sap setEnabled:YES];
1165 [o_t6_fld_sap setEnabled:NO];
1166 [o_t6_fld_sap setStringValue:@""];
1170 - (IBAction)t6_mrInfo_ttl:(id)sender
1172 /* show a sheet for the help */
1173 [o_wh_txt_title setStringValue: _NS("Time-To-Live (TTL)")];
1174 [o_wh_txt_text setStringValue: _NS("Define the TTL (Time-To-Live) of the stream. "\
1175 "This parameter is the maximum number of routers your stream can go "
1176 "through. If you don't know what it means, or if you want to stream on " \
1177 "your local network only, leave this setting to 1.")];
1178 [NSApp beginSheet: o_wizardhelp_window
1179 modalForWindow: o_wizard_window
1180 modalDelegate: o_wizardhelp_window
1185 - (IBAction)t6_mrInfo_sap:(id)sender
1187 /* show a sheet for the help */
1188 [o_wh_txt_title setStringValue: _NS("SAP Announce")];
1189 [o_wh_txt_text setStringValue: _NS("When streaming using UDP, you can " \
1190 "announce your streams using the SAP/SDP announcing protocol. This " \
1191 "way, the clients won't have to type in the multicast address, it " \
1192 "will appear in their playlist if they enable the SAP extra interface.\n" \
1193 "If you want to give a name to your stream, enter it here, " \
1194 "else, a default name will be used.")];
1195 [NSApp beginSheet: o_wizardhelp_window
1196 modalForWindow: o_wizard_window
1197 modalDelegate: o_wizardhelp_window
1202 - (IBAction)t7_selectTrnscdDestFile:(id)sender
1204 /* provide a save-to-dialogue, so the user can choose a location for his/her new file */
1205 NSSavePanel * savePanel = [NSSavePanel savePanel];
1206 SEL sel = @selector(t7_getTrnscdDestFile:returnCode:contextInfo:);
1207 [savePanel setRequiredFileType:[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0]];
1208 [savePanel setCanSelectHiddenExtension:YES];
1209 [savePanel beginSheetForDirectory:nil file:nil modalForWindow:o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
1212 - (void)t7_getTrnscdDestFile: (NSSavePanel *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
1214 if (returnCode == NSOKButton)
1216 /* add a suffix depending on the chosen encap-format and output path to text-field*/
1217 [o_t7_fld_filePath setStringValue:[sheet filename]];
1221 - (IBAction)wh_closeSheet:(id)sender
1223 /* close the help sheet */
1224 [NSApp endSheet:o_wizardhelp_window];
1225 [o_wizardhelp_window close];
1230 [o_userSelections release];
1231 [o_videoCodecs release];
1232 [o_audioCodecs release];
1233 [o_encapFormats release];