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 - l10n string fixes (both in OSX and WX)
32 - fill the playlist-table on t2
33 - implement l10n on t8
38 /*****************************************************************************
40 *****************************************************************************/
44 /*****************************************************************************
45 * VLCWizard implementation
46 *****************************************************************************/
48 @implementation VLCWizard
50 static VLCWizard *_o_sharedInstance = nil;
52 + (VLCWizard *)sharedInstance
54 return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
59 if (_o_sharedInstance) {
62 _o_sharedInstance = [super init];
65 return _o_sharedInstance;
70 [o_userSelections release];
71 [o_videoCodecs release];
72 [o_audioCodecs release];
73 [o_encapFormats release];
79 /* some minor cleanup */
80 [o_t2_tbl_plst setEnabled:NO];
81 [o_wizardhelp_window setExcludedFromWindowsMenu:YES];
82 o_userSelections = [[NSMutableDictionary alloc] init];
83 [o_btn_backward setEnabled:NO];
85 /* add audio-bitrates for transcoding */
86 NSArray * audioBitratesArray;
87 audioBitratesArray = [NSArray arrayWithObjects: @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
88 [o_t4_pop_audioBitrate removeAllItems];
89 [o_t4_pop_audioBitrate addItemsWithTitles: audioBitratesArray];
90 [o_t4_pop_audioBitrate selectItemWithTitle: @"192"];
92 /* add video-bitrates for transcoding */
93 NSArray * videoBitratesArray;
94 videoBitratesArray = [NSArray arrayWithObjects: @"3072", @"2048", @"1024", @"768", @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
95 [o_t4_pop_videoBitrate removeAllItems];
96 [o_t4_pop_videoBitrate addItemsWithTitles: videoBitratesArray];
97 [o_t4_pop_videoBitrate selectItemWithTitle: @"1024"];
99 /* fill 2 global arrays with arrays containing all codec-related information
100 * - one array per codec named by its short name to define the encap-compability,
101 * cmd-names, real names, more info in the order: realName, shortName,
102 * moreInfo, encaps */
115 NSArray * o_dummyVid;
116 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];
117 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];
118 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];
119 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];
120 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];
121 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];
122 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];
123 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];
124 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];
125 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];
126 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];
127 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];
128 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];
129 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];
130 [o_t4_pop_videoCodec removeAllItems];
133 while (x != [o_videoCodecs count])
135 [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x] objectAtIndex:0]];
148 NSArray * o_dummyAud;
149 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];
150 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];
151 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];
152 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];
153 o_vorb = [NSArray arrayWithObjects: @"Vorbis", @"vorb", _NS("Vorbis is a free audio codec"), @"MUX_OGG", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
154 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];
155 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];
156 o_s16l = [NSArray arrayWithObjects: @"Uncompressed, integer", @"s16l", _NS("Uncompressed audio samples"), @"MUX_WAV", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
157 o_fl32 = [NSArray arrayWithObjects: @"Uncompressed, floating", @"fl32", _NS("Uncompressed audio samples"), @"MUX_WAV", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
158 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];
159 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];
160 [o_t4_pop_audioCodec removeAllItems];
162 while (x != [o_audioCodecs count])
164 [o_t4_pop_audioCodec addItemWithTitle:[[o_audioCodecs objectAtIndex:x] objectAtIndex:0]];
169 /* fill another global array with all information about the encap-formats
170 * note that the order of the formats inside the g. array is the same as on
182 o_ps = [NSArray arrayWithObjects: @"ps", @"MPEG PS", _NS("MPEG Program Stream"), nil];
183 o_ts = [NSArray arrayWithObjects: @"ts", @"MPEG TS", _NS("MPEG Transport Stream"), nil];
184 o_mpeg = [NSArray arrayWithObjects: @"ps", @"MPEG 1", _NS("MPEG 1 Format"), nil];
185 o_ogg = [NSArray arrayWithObjects: @"ogg", @"OGG", @"OGG", nil];
186 o_raw = [NSArray arrayWithObjects: @"raw", @"RAW", @"RAW", nil];
187 o_asf = [NSArray arrayWithObjects: @"asf", @"ASF", @"ASF", nil];
188 o_avi = [NSArray arrayWithObjects: @"avi", @"AVI", @"AVI", nil];
189 o_mp4 = [NSArray arrayWithObjects: @"mp4", @"MP4", @"MPEG4", nil];
190 o_mov = [NSArray arrayWithObjects: @"mov", @"MOV", @"MOV", nil];
191 o_wav = [NSArray arrayWithObjects: @"wav", @"WAV", @"WAV", nil];
192 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];
194 /* yet another array on streaming methods including help texts */
197 NSArray * o_udp_multi;
198 o_http = [NSArray arrayWithObjects: @"http", @"HTTP", _NS("Enter the local " \
199 "addresses you want to listen to. Do not enter anything if you want to " \
200 "listen to all adresses or if you don't understand. This is generally " \
201 "the best thing to do. Other computers can then access the stream at " \
202 "http://yourip:8080 by default") , _NS("Use this to stream to several " \
203 "computers. This method is less efficient, as the server needs to send " \
204 "several times the stream."), nil];
205 o_udp_multi = [NSArray arrayWithObjects: @"udp", @"UDP-Multicast", _NS("Enter " \
206 "the multicast address to stream to in this field. This must be an IP " \
207 "address between 224.0.0.0 and 239.255.255.255. For a private use, " \
208 "enter an address beginning with 239.255."), _NS("Use this to stream " \
209 "to a dynamic group of computers on a multicast-enabled network. This " \
210 "is the most efficient method to stream to several computers, but it " \
211 "does not work over Internet."), nil];
212 o_udp_uni = [NSArray arrayWithObjects: @"udp", @"UDP-Unicast", _NS("Enter " \
213 "the address of the computer to stream to"), _NS("Use this to stream " \
214 "to a single computer"), nil];
215 o_strmgMthds = [[NSArray alloc] initWithObjects: o_http, o_udp_multi, o_udp_uni, nil];
220 /* just present the window to the user */
221 [o_tab_pageHolder selectFirstTabViewItem:self];
225 [o_wizard_window center];
226 [o_wizard_window displayIfNeeded];
227 [o_wizard_window makeKeyAndOrderFront:nil];
232 /* reset the wizard-window to its default values */
234 [o_userSelections removeAllObjects];
235 [o_t1_matrix_strmgOrTrnscd selectCellAtRow:0 column:0];
236 [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setState: NSOffState];
237 [o_btn_forward setTitle: [_NS("Next") stringByAppendingString:@" >"]];
240 [o_t2_fld_pathToStrm setStringValue: @""];
241 [o_t2_ckb_enblPartExtrct setState: NSOffState];
242 [self t2_enableExtract:nil];
243 [o_t2_matrix_inputSourceType selectCellAtRow:0 column:0];
244 [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setState: NSOffState];
245 /* FIXME: we need to refresh the playlist-table as well */
246 [o_t2_tbl_plst setEnabled:NO];
247 [o_t2_fld_pathToStrm setEnabled:YES];
248 [o_t2_btn_chooseFile setEnabled:YES];
251 [o_t3_fld_address setStringValue: @""];
252 [o_t3_matrix_stmgMhd selectCellAtRow:0 column:0];
253 [[o_t3_matrix_stmgMhd cellAtRow:1 column:1] setState: NSOffState];
254 [[o_t3_matrix_stmgMhd cellAtRow:1 column:2] setState: NSOffState];
257 [o_t4_ckb_audio setState: NSOffState];
258 [o_t4_ckb_video setState: NSOffState];
259 [self t4_enblVidTrnscd:nil];
260 [self t4_enblAudTrnscd:nil];
263 [o_t6_fld_ttl setStringValue: @"1"];
264 [o_t6_ckb_sap setState: NSOffState];
265 [self t6_enblSapAnnce:nil];
268 [o_t7_fld_filePath setStringValue: @""];
273 /* localise all strings to the users lang */
274 /* method is called from intf.m (in method openWizard) */
277 [o_btn_backward setTitle: _NS("Back")];
278 [o_btn_cancel setTitle: _NS("Cancel")];
279 [o_btn_forward setTitle: _NS("Next")];
280 [o_wizard_window setTitle: _NS("Streaming/Transcoding Wizard")];
282 /* page one ("Hello") */
283 [o_t1_txt_title setStringValue: _NS("Streaming/Transcoding Wizard")];
284 [o_t1_txt_text setStringValue: _NS("This wizard helps you to stream, transcode or save a stream")];
285 [o_t1_btn_mrInfo_strmg setTitle: _NS("More Info")];
286 [o_t1_btn_mrInfo_trnscd setTitle: _NS("More Info")];
287 [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")];
288 [[o_t1_matrix_strmgOrTrnscd cellAtRow:0 column:0] setTitle: _NS("Stream to network")];
289 [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setTitle: _NS("Transcode/Save to file")];
291 /* page two ("Input") */
292 [o_t2_title setStringValue: _NS("Choose input")];
293 [o_t2_text setStringValue: _NS("Choose here your input stream")];
294 [[o_t2_matrix_inputSourceType cellAtRow:0 column:0] setTitle: _NS("Select a stream")];
295 [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setTitle: _NS("Existing playlist item")];
296 [o_t2_btn_chooseFile setTitle: _NS("Choose...")];
297 [[[o_t2_tbl_plst tableColumnWithIdentifier:@"name"] headerCell] setStringValue: _NS("Name")];
298 [[[o_t2_tbl_plst tableColumnWithIdentifier:@"uri"] headerCell] setStringValue: _NS("URI")];
299 [o_t2_box_prtExtrct setTitle: _NS("Partial Extract")];
300 [o_t2_ckb_enblPartExtrct setTitle: _NS("Enable")];
301 [o_t2_txt_prtExtrctFrom setStringValue: _NS("From")];
302 [o_t2_txt_prtExtrctTo setStringValue: _NS("To")];
304 /* page three ("Streaming 1") */
305 [o_t3_txt_title setStringValue: _NS("Streaming")];
306 [o_t3_txt_text setStringValue: _NS("In this page, you will select how your input stream will be sent.")];
307 [o_t3_box_dest setTitle: _NS("Destination")];
308 [o_t3_box_strmgMthd setTitle: _NS("Streaming method")];
309 [o_t3_txt_destInfo setStringValue: _NS("Enter the address of the computer to stream to")];
310 [[o_t3_matrix_stmgMhd cellAtRow:1 column:0] setTitle: _NS("UDP Unicast")];
311 [[o_t3_matrix_stmgMhd cellAtRow:1 column:1] setTitle: _NS("UDP Multicast")];
312 [o_t3_txt_strgMthdInfo setStringValue: _NS("Use this to stream to a single computer")];
314 /* page four ("Transcode 1") */
315 [o_t4_title setStringValue: _NS("Transcode")];
316 [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).")];
317 [o_t4_box_audio setTitle: _NS("Audio")];
318 [o_t4_box_video setTitle: _NS("Video")];
319 [o_t4_ckb_audio setTitle: _NS("Transcode audio")];
320 [o_t4_ckb_video setTitle: _NS("Transcode video")];
321 [o_t4_txt_videoBitrate setStringValue: _NS("Bitrate (kb/s)")];
322 [o_t4_txt_videoCodec setStringValue: _NS("Codec")];
323 [o_t4_txt_hintAudio setStringValue: _NS("If your stream has audio and you want to " \
324 "transcode it, enable this")];
325 [o_t4_txt_hintVideo setStringValue: _NS("If your stream has video and you want to " \
326 "transcode it, enable this")];
328 /* page five ("Encap") */
329 [o_t5_title setStringValue: _NS("Encapsulation format")];
330 [o_t5_text setStringValue: _NS("In this page, you will select how the stream will be "\
331 "encapsulated. Depending on the choices you made, all "\
332 "formats won't be available.")];
334 /* page six ("Streaming 2") */
335 [o_t6_title setStringValue: _NS("Additional streaming options")];
336 [o_t6_text setStringValue: _NS("In this page, you will define a few " \
337 "additional parameters for your stream.")];
338 [o_t6_txt_ttl setStringValue: _NS("Time-To-Live (TTL)")];
339 [o_t6_btn_mrInfo_ttl setTitle: _NS("More Info")];
340 [o_t6_ckb_sap setTitle: _NS("SAP Announce")];
341 [o_t6_btn_mrInfo_sap setTitle: _NS("More Info")];
343 /* page seven ("Transcode 2") */
344 [o_t7_title setStringValue: _NS("Additional transcode options")];
345 [o_t7_text setStringValue: _NS("In this page, you will define a few " \
346 "additionnal parameters for your transcoding.")];
347 [o_t7_txt_saveFileTo setStringValue: _NS("Select the file to save to")];
348 [o_t7_btn_chooseFile setTitle: _NS("Choose...")];
350 /* page eight ("Summary") */
351 /* FIXME: currently not implemented as it unsure whether we show this tab
352 * to the public or use it for debugging only */
354 /* wizard help window */
355 [o_wh_btn_okay setTitle: _NS("OK")];
358 - (IBAction)cancelRun:(id)sender
360 [o_wizard_window close];
363 - (IBAction)nextTab:(id)sender
365 if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Hello"])
367 /* check whether the user wants to stream or just to transcode;
368 * store information for later usage */
370 o_mode = [[o_t1_matrix_strmgOrTrnscd selectedCell] title];
371 if( [o_mode isEqualToString: _NS("Stream to network")] )
373 [o_userSelections setObject:@"strmg" forKey:@"trnscdOrStrmg"];
375 [o_userSelections setObject:@"trnscd" forKey:@"trnscdOrStrmg"];
377 [o_btn_backward setEnabled:YES];
378 [o_tab_pageHolder selectTabViewItemAtIndex:1];
380 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Input"])
382 /* check whether partialExtract is enabled and store the values, if needed */
383 if ([o_t2_ckb_enblPartExtrct state] == NSOnState)
385 [o_userSelections setObject:@"YES" forKey:@"partExtract"];
386 [o_userSelections setObject:[o_t2_fld_prtExtrctFrom stringValue] forKey:@"partExtractFrom"];
387 [o_userSelections setObject:[o_t2_fld_prtExtrctTo stringValue] forKey:@"partExtractTo"];
389 [o_userSelections setObject:@"NO" forKey:@"partExtract"];
392 /* check whether we use an existing pl-item or add an new one;
393 * store the path or the index and set a flag.
394 * complain to the user if s/he didn't provide a path */
398 o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
399 if( [o_mode isEqualToString: _NS("Select a stream")] )
401 [o_userSelections setObject:@"YES" forKey:@"newStrm"];
402 if ([[o_t2_fld_pathToStrm stringValue] isEqualToString: @""])
404 /* set a flag that no file is selected */
407 [o_userSelections setObject:[o_t2_fld_pathToStrm stringValue] forKey:@"pathToStrm"];
410 if ([o_t2_tbl_plst selectedRow] != -1)
412 /* FIXME: put the path of the selected pl-item to pathToStrm */
414 /* set a flag that no item is selected */
419 /* show either "Streaming 1" or "Transcode 1" to the user */
422 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
424 /* we are streaming */
425 [o_tab_pageHolder selectTabViewItemAtIndex:2];
427 /* we are just transcoding */
428 [o_tab_pageHolder selectTabViewItemAtIndex:3];
431 /* show a sheet that the user didn't select a file */
432 [o_wh_txt_title setStringValue: _NS("No input selected")];
433 [o_wh_txt_text setStringValue: _NS("You selected neither " \
434 "a new stream nor an existing playlist item. VLC is unable to " \
435 "guess, which input you want use. \n\n Choose one " \
436 "before going to the next page.")];
437 [NSApp beginSheet: o_wizardhelp_window
438 modalForWindow: o_wizard_window
439 modalDelegate: o_wizardhelp_window
444 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 1"])
446 /* check which streaming method is selected and store it */
448 o_mode = [[o_t3_matrix_stmgMhd selectedCell] title];
449 if( [o_mode isEqualToString: @"HTTP"] )
451 [o_userSelections setObject:@"0" forKey:@"stmgMhd"];
452 /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF; select MPEG PS */
453 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
454 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
455 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
456 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
457 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
458 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
459 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
460 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
461 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
462 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
463 [o_t5_matrix_encap selectCellAtRow:0 column:0];
465 if( [o_mode isEqualToString: _NS("UDP Unicast")] )
467 [o_userSelections setObject:@"2" forKey:@"stmgMhd"];
469 [o_userSelections setObject:@"1" forKey:@"stmgMhd"];
471 /* disable all encap-formats but MPEG-TS and select it */
472 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
473 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
474 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
475 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
476 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
477 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
478 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
479 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
480 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
481 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
482 [o_t5_matrix_encap selectCellAtRow:1 column:0];
485 /* store the destination and check whether is it empty */
486 if(! [o_mode isEqualToString: @"HTTP"] )
488 /* empty field is valid for HTTP */
490 if( [[o_t3_fld_address stringValue] isEqualToString: @""] )
493 /* complain to the user that "" is no valid dest. */
494 [o_wh_txt_title setStringValue: _NS("No valid destination")];
495 [o_wh_txt_text setStringValue: _NS("You need to enter " \
496 "a valid destination you want to stream to. Enter either a " \
497 "Unicast-IP or a Multicast-IP.\n\n If you don't know "
498 "what this means, have a look at the VLC Streaming HOWTO and " \
499 "the help texts in this window." )];
500 [NSApp beginSheet: o_wizardhelp_window
501 modalForWindow: o_wizard_window
502 modalDelegate: o_wizardhelp_window
506 /* FIXME: stupid code duplication, should be solved by a GoTo-like-thing -- FK */
507 [o_userSelections setObject:[o_t3_fld_address stringValue] forKey:@"stmgDest"];
508 /* let's go to the encap-tab */
509 [o_tab_pageHolder selectTabViewItemAtIndex:4];
512 [o_userSelections setObject:[o_t3_fld_address stringValue] forKey:@"stmgDest"];
513 /* let's go to the encap-tab */
514 [o_tab_pageHolder selectTabViewItemAtIndex:4];
517 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 1"])
519 /* check whether the user wants to transcode the video-track and store the related options */
520 if ([o_t4_ckb_video state] == NSOnState)
523 theNum = [NSNumber numberWithInt:[o_t4_pop_videoCodec indexOfSelectedItem]];
524 [o_userSelections setObject:@"YES" forKey:@"trnscdVideo"];
525 [o_userSelections setObject:[o_t4_pop_videoBitrate titleOfSelectedItem] forKey:@"trnscdVideoBitrate"];
526 [o_userSelections setObject:theNum forKey:@"trnscdVideoCodec"];
528 [o_userSelections setObject:@"NO" forKey:@"trnscdVideo"];
531 /* check whether the user wants to transcode the audio-track and store the related options */
532 if ([o_t4_ckb_audio state] == NSOnState)
535 theNum = [NSNumber numberWithInt:[o_t4_pop_audioCodec indexOfSelectedItem]];
536 [o_userSelections setObject:@"YES" forKey:@"trnscdAudio"];
537 [o_userSelections setObject:[o_t4_pop_audioBitrate titleOfSelectedItem] forKey:@"trnscdAudioBitrate"];
538 [o_userSelections setObject:theNum forKey:@"trnscdAudioCodec"];
540 [o_userSelections setObject:@"NO" forKey:@"trnscdAudio"];
543 /* disable all encap-formats */
544 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
545 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
546 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
547 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
548 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
549 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
550 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
551 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
552 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
553 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
555 /* re-enable the encap-formats supported by the chosen codecs */
556 /* FIXME: the following is a really bad coding-style. feel free to mail
557 me ideas how to make this nicer, if you want to -- FK, 7/11/05 */
559 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualTo: @"YES"])
561 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
563 /* we are transcoding both audio and video, so we need to check both deps */
564 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_PS"])
566 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_PS"])
568 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
569 [o_t5_matrix_encap selectCellAtRow:0 column:0];
572 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_TS"])
574 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_TS"])
576 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
577 [o_t5_matrix_encap selectCellAtRow:1 column:0];
580 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MPEG"])
582 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MPEG"])
584 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
585 [o_t5_matrix_encap selectCellAtRow:2 column:0];
588 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_OGG"])
590 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_OGG"])
592 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
593 [o_t5_matrix_encap selectCellAtRow:3 column:0];
596 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_RAW"])
598 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_RAW"])
600 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
601 [o_t5_matrix_encap selectCellAtRow:4 column:0];
604 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_ASF"])
606 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_ASF"])
608 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
609 [o_t5_matrix_encap selectCellAtRow:5 column:0];
612 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
614 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
616 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
617 [o_t5_matrix_encap selectCellAtRow:6 column:0];
620 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
622 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
624 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
625 [o_t5_matrix_encap selectCellAtRow:7 column:0];
628 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
630 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
632 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
633 [o_t5_matrix_encap selectCellAtRow:8 column:0];
636 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
638 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
640 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
641 [o_t5_matrix_encap selectCellAtRow:9 column:0];
647 /* we just transcoding the audio */
649 /* select formats supported by the audio codec */
650 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_PS"])
652 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
653 [o_t5_matrix_encap selectCellAtRow:0 column:0];
655 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_TS"])
657 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
658 [o_t5_matrix_encap selectCellAtRow:1 column:0];
660 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MPEG"])
662 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
663 [o_t5_matrix_encap selectCellAtRow:2 column:0];
665 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_OGG"])
667 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
668 [o_t5_matrix_encap selectCellAtRow:3 column:0];
670 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_RAW"])
672 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
673 [o_t5_matrix_encap selectCellAtRow:4 column:0];
675 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_ASF"])
677 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
678 [o_t5_matrix_encap selectCellAtRow:5 column:0];
680 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
682 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
683 [o_t5_matrix_encap selectCellAtRow:6 column:0];
685 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
687 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
688 [o_t5_matrix_encap selectCellAtRow:7 column:0];
690 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
692 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
693 [o_t5_matrix_encap selectCellAtRow:8 column:0];
695 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
697 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
698 [o_t5_matrix_encap selectCellAtRow:9 column:0];
702 else if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
704 /* we are just transcoding the video */
706 /* select formats supported by the video-codec */
708 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_PS"])
710 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
711 [o_t5_matrix_encap selectCellAtRow:0 column:0];
713 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_TS"])
715 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
716 [o_t5_matrix_encap selectCellAtRow:1 column:0];
718 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MPEG"])
720 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
721 [o_t5_matrix_encap selectCellAtRow:2 column:0];
723 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_OGG"])
725 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
726 [o_t5_matrix_encap selectCellAtRow:3 column:0];
728 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_RAW"])
730 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
731 [o_t5_matrix_encap selectCellAtRow:4 column:0];
733 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_ASF"])
735 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
736 [o_t5_matrix_encap selectCellAtRow:5 column:0];
738 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
740 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
741 [o_t5_matrix_encap selectCellAtRow:6 column:0];
743 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
745 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
746 [o_t5_matrix_encap selectCellAtRow:7 column:0];
748 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
750 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
751 [o_t5_matrix_encap selectCellAtRow:8 column:0];
753 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
755 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
756 [o_t5_matrix_encap selectCellAtRow:9 column:0];
759 /* we don't do any transcoding
760 * -> enabled the encap-formats allowed when streaming content via http
761 * since this should work fine in most cases */
762 /* FIXME: choose a selection of encap-formats based upon the actually used codecs */
764 /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF; select MPEG PS */
765 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
766 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
767 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
768 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
769 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
770 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
771 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
772 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
773 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
774 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
775 [o_t5_matrix_encap selectCellAtRow:0 column:0];
778 BOOL anythingEnabled;
780 anythingEnabled = NO;
781 while (x != [o_t5_matrix_encap numberOfRows])
783 if ([[o_t5_matrix_encap cellAtRow:x column:0] isEnabled])
785 anythingEnabled = YES;
789 if (anythingEnabled == YES)
791 [o_tab_pageHolder selectTabViewItemAtIndex:4];
793 /* show a sheet that the selected codecs are not compatible */
794 [o_wh_txt_title setStringValue: _NS("Invalid selection")];
795 [o_wh_txt_text setStringValue: _NS("Your chosen codecs are " \
796 "not compatible with each other. For example: you cannot " \
797 "mix uncompressed audio with any video codec.\n\n" \
798 "Correct your selection and try again.")];
799 [NSApp beginSheet: o_wizardhelp_window
800 modalForWindow: o_wizard_window
801 modalDelegate: o_wizardhelp_window
807 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Encap"])
809 /* get the chosen encap format and store it */
811 theNum = [NSNumber numberWithInt:[[o_t5_matrix_encap selectedCell] tag]];
812 [o_userSelections setObject:[theNum stringValue] forKey:@"encapFormat"];
814 /* show either "Streaming 2" or "Transcode 2" to the user */
815 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
817 /* we are streaming */
818 [o_tab_pageHolder selectTabViewItemAtIndex:5];
820 /* we are just transcoding */
821 [o_tab_pageHolder selectTabViewItemAtIndex:6];
824 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 2"])
826 /* store the chosen TTL */
827 [o_userSelections setObject:[o_t6_fld_ttl stringValue] forKey:@"ttl"];
829 /* check whether SAP is enabled and store the announce, if needed */
830 if ([o_t6_ckb_sap state] == NSOnState)
832 [o_userSelections setObject:@"YES" forKey:@"sap"];
833 [o_userSelections setObject:[o_t6_fld_sap stringValue] forKey:@"sapText"];
835 [o_userSelections setObject:@"NO" forKey:@"sap"];
838 /* go to "Summary" */
841 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 2"])
843 /* check whether the path != "" and store it */
844 if( [[o_t7_fld_filePath stringValue] isEqualToString: @""] )
845 { /* complain to the user that "" is no valid path */
846 [o_wh_txt_title setStringValue: _NS("No file selected")];
847 [o_wh_txt_text setStringValue: _NS("You you need to select " \
848 "a file, you want to save to. \n\n Enter either a valid path or " \
849 "choose a location through the button's dialog-box.")];
850 [NSApp beginSheet: o_wizardhelp_window
851 modalForWindow: o_wizard_window
852 modalDelegate: o_wizardhelp_window
856 [o_userSelections setObject:[o_t7_fld_filePath stringValue] forKey:@"trnscdFilePath"];
858 /* go to "Summary" */
862 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Summary"])
864 intf_thread_t * p_intf = VLCIntf;
866 playlist_t * p_playlist = (playlist_t *)vlc_object_find( p_intf,
867 VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
870 playlist_item_t *p_item = playlist_ItemNew( p_playlist, [[@"file://" stringByAppendingString: [o_userSelections objectForKey:@"pathToStrm"]] UTF8String], _("Streaming/Transcoding Wizard") );
871 playlist_ItemAddOption( p_item, [[o_userSelections objectForKey:@"opts"] UTF8String]);
873 if(! [[o_userSelections objectForKey:@"partExtractFrom"] isEqualToString:@""] )
875 playlist_ItemAddOption( p_item, [[@"start-time=" stringByAppendingString: [o_userSelections objectForKey:@"partExtractFrom"]] UTF8String] );
878 if(! [[o_userSelections objectForKey:@"partExtractTo"] isEqualToString:@""] )
880 playlist_ItemAddOption( p_item, [[@"stop-time=" stringByAppendingString: [o_userSelections objectForKey:@"partExtractTo"]] UTF8String] );
883 playlist_ItemAddOption( p_item, [[@"ttl=" stringByAppendingString: [o_userSelections objectForKey:@"ttl"]] UTF8String] );
885 playlist_AddItem( p_playlist, p_item, PLAYLIST_GO, PLAYLIST_END );
887 msg_Warn(p_intf, "updating the playlist-table is not implemented!");
889 playlist_ViewUpdate( p_playlist, VIEW_CATEGORY );
891 vlc_object_release(p_playlist);
893 msg_Err( p_intf, "Uh Oh! Unable to find playlist!" );
896 /* close the window, since we are done */
897 [o_wizard_window close];
903 [o_btn_forward setTitle: _NS("Finish")];
904 [o_t8_fld_inptStream setStringValue:[o_userSelections objectForKey:@"pathToStrm"]];
906 if ([[o_userSelections objectForKey:@"partExtract"] isEqualToString: @"YES"])
908 [o_t8_fld_partExtract setStringValue: [[[[[_NS("yes") stringByAppendingString:@" - "] stringByAppendingString: _NS("from ")] stringByAppendingString: [o_userSelections objectForKey:@"partExtractFrom"]] stringByAppendingString: _NS(" to ")] stringByAppendingString: [o_userSelections objectForKey:@"partExtractTo"]]];
910 [o_t8_fld_partExtract setStringValue: _NS("no")];
913 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
915 /* we are streaming; no transcoding allowed atm */
916 [o_t8_fld_saveFileTo setStringValue: @"-"];
917 [o_t8_fld_trnscdAudio setStringValue: @"-"];
918 [o_t8_fld_trnscdVideo setStringValue: @"-"];
919 [o_t8_fld_strmgMthd setStringValue: [[o_strmgMthds objectAtIndex:[[o_userSelections objectForKey:@"stmgMhd"] intValue]] objectAtIndex:1]];
920 [o_t8_fld_destination setStringValue: [o_userSelections objectForKey:@"stmgDest"]];
921 [o_t8_fld_ttl setStringValue: [o_userSelections objectForKey:@"ttl"]];
922 if ([[o_userSelections objectForKey:@"sap"] isEqualToString: @"YES"])
924 [o_t8_fld_sap setStringValue: [[_NS("yes") stringByAppendingString:@": "] stringByAppendingString:[o_userSelections objectForKey:@"sapText"]]];
926 [o_t8_fld_sap setStringValue: _NS("no")];
929 /* we are transcoding */
930 [o_t8_fld_strmgMthd setStringValue: @"-"];
931 [o_t8_fld_destination setStringValue: @"-"];
932 [o_t8_fld_ttl setStringValue: @"-"];
933 [o_t8_fld_sap setStringValue: @"-"];
934 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
936 [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"]];
938 [o_t8_fld_trnscdVideo setStringValue: _NS("no")];
940 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
942 [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"]];
944 [o_t8_fld_trnscdAudio setStringValue: _NS("no")];
946 [o_t8_fld_saveFileTo setStringValue: [o_userSelections objectForKey:@"trnscdFilePath"]];
948 [o_t8_fld_encapFormat setStringValue: [[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:1]];
951 [o_t8_fld_mrl setStringValue: [o_userSelections objectForKey:@"opts"]];
953 [o_tab_pageHolder selectTabViewItemAtIndex:7];
958 NSMutableString * o_opts_string = [NSMutableString stringWithString:@""];
960 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"trnscd"])
962 /* we are just transcoding and dumping the stuff to a file */
963 NSMutableString *o_trnscdCmd = [NSMutableString stringWithString:@""];
964 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
966 [o_trnscdCmd appendString: @"transcode{"];
967 [o_trnscdCmd appendFormat: @"vcodec=%s,vb=%i", [[[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] objectAtIndex:1] UTF8String], [[o_userSelections objectForKey:@"trnscdVideoBitrate"] intValue]];
968 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
970 [o_trnscdCmd appendString: @","];
973 [o_trnscdCmd appendString: @"}:"];
976 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
978 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"NO"])
980 /* in case we transcode the audio only, add this */
981 [o_trnscdCmd appendString: @"transcode{"];
983 [o_trnscdCmd appendFormat: @"acodec=%s,ab=%i}:", [[[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] objectAtIndex:1] UTF8String], [[o_userSelections objectForKey:@"trnscdAudioBitrate"] intValue]];
985 [o_opts_string appendFormat: @":sout=#%sstandard{mux=%s,url=%s,access=file}", [o_trnscdCmd UTF8String], [[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0] UTF8String], [[o_userSelections objectForKey:@"trnscdFilePath"] UTF8String]];
989 /* we are streaming - no transcoding allowed atm, since we mirror the wx-wizard */
990 if ([[o_userSelections objectForKey:@"sap"] isEqualToString:@"YES"])
992 /* SAP-Announcement is requested */
993 NSMutableString *o_sap_option = [NSMutableString stringWithString:@""];
994 if([[o_userSelections objectForKey:@"sapText"] isEqualToString:@""])
996 [o_sap_option appendString: @"sap"];
998 [o_sap_option appendFormat: @"sap,name=\"%s\"",[[o_userSelections objectForKey:@"sapText"] UTF8String]];
1000 [o_opts_string appendFormat: @":sout=#standard{mux=%s,url=%s,access=%s,%s}", [[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0] UTF8String], [[o_userSelections objectForKey:@"stmgDest"] UTF8String], [[[o_strmgMthds objectAtIndex:[[o_userSelections objectForKey:@"stmgMhd"] intValue]] objectAtIndex:0] UTF8String], [o_sap_option UTF8String]];
1002 /* no SAP, just streaming */
1003 [o_opts_string appendFormat: @":sout=#standard{mux=%s,url=%s,access=%s}", [[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0] UTF8String], [[o_userSelections objectForKey:@"stmgDest"] UTF8String], [[[o_strmgMthds objectAtIndex:[[o_userSelections objectForKey:@"stmgMhd"] intValue]] objectAtIndex:0] UTF8String]];
1007 [o_userSelections setObject:o_opts_string forKey:@"opts"];
1010 - (IBAction)prevTab:(id)sender
1012 if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Summary"])
1014 /* check whether we are streaming or transcoding and go back */
1015 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1017 /* show "Streaming 2" */
1018 [o_tab_pageHolder selectTabViewItemAtIndex:5];
1020 /* show "Transcode 2" */
1021 [o_tab_pageHolder selectTabViewItemAtIndex:6];
1023 /* rename the forward-button */
1024 [o_btn_forward setTitle: _NS("Next")];
1026 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 2"])
1029 [o_tab_pageHolder selectTabViewItemAtIndex:4];
1031 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 2"])
1034 [o_tab_pageHolder selectTabViewItemAtIndex:4];
1036 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Encap"])
1038 /* check whether we are streaming or transcoding and go back */
1039 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1041 /* show "Streaming 1" */
1042 [o_tab_pageHolder selectTabViewItemAtIndex:2];
1044 /* show "Transcode 2" */
1045 [o_tab_pageHolder selectTabViewItemAtIndex:3];
1048 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 1"])
1051 [o_tab_pageHolder selectTabViewItemAtIndex:1];
1053 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 1"])
1056 [o_tab_pageHolder selectTabViewItemAtIndex:1];
1058 else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Input"])
1061 [o_tab_pageHolder selectTabViewItemAtIndex:0];
1062 /* disable backwards-btn */
1063 [o_btn_backward setEnabled:NO];
1067 - (IBAction)t1_mrInfo_streaming:(id)sender
1069 /* show a sheet for the help */
1070 /* since NSAlert does not exist on OSX < 10.3, we use our own implementation */
1071 [o_wh_txt_title setStringValue: _NS("Stream to network")];
1072 [o_wh_txt_text setStringValue: _NS("Use this to stream on a network.")];
1073 [NSApp beginSheet: o_wizardhelp_window
1074 modalForWindow: o_wizard_window
1075 modalDelegate: o_wizardhelp_window
1080 - (IBAction)t1_mrInfo_transcode:(id)sender
1082 /* show a sheet for the help */
1083 [o_wh_txt_title setStringValue: _NS("Transcode/Save to file")];
1084 [o_wh_txt_text setStringValue: _NS("Use this to save a stream to a file. You "\
1085 "have the possibility to reencode the stream. You can save whatever "\
1086 "VLC can read.\nPlease notice that VLC is not very suited " \
1087 "for file to file transcoding. You should use its transcoding " \
1088 "features to save network streams, for example.")];
1089 [NSApp beginSheet: o_wizardhelp_window
1090 modalForWindow: o_wizard_window
1091 modalDelegate: o_wizardhelp_window
1096 - (IBAction)t2_addNewStream:(id)sender
1098 NSOpenPanel * openPanel = [NSOpenPanel openPanel];
1099 SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
1100 [openPanel beginSheetForDirectory:nil file:nil types:nil modalForWindow:o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
1103 - (void)t2_getNewStreamFromDialog: (NSOpenPanel *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
1105 if (returnCode == NSOKButton)
1107 [o_t2_fld_pathToStrm setStringValue:[sheet filename]];
1111 - (IBAction)t2_chooseStreamOrPlst:(id)sender
1113 /* enable and disable the respective items depending on user's choice */
1115 o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
1117 if( [o_mode isEqualToString: _NS("Select a stream")] )
1119 [o_t2_btn_chooseFile setEnabled:YES];
1120 [o_t2_fld_pathToStrm setEnabled:YES];
1121 [o_t2_tbl_plst setEnabled:NO];
1123 [o_t2_btn_chooseFile setEnabled:NO];
1124 [o_t2_fld_pathToStrm setEnabled:NO];
1125 [o_t2_tbl_plst setEnabled:YES];
1129 - (IBAction)t2_enableExtract:(id)sender
1131 /* enable/disable the respective items */
1132 if([o_t2_ckb_enblPartExtrct state] == NSOnState)
1134 [o_t2_fld_prtExtrctFrom setEnabled:YES];
1135 [o_t2_fld_prtExtrctTo setEnabled:YES];
1137 [o_t2_fld_prtExtrctFrom setEnabled:NO];
1138 [o_t2_fld_prtExtrctTo setEnabled:NO];
1139 [o_t2_fld_prtExtrctFrom setStringValue:@""];
1140 [o_t2_fld_prtExtrctTo setStringValue:@""];
1144 - (IBAction)t3_addressEntered:(id)sender
1146 /* check whether the entered address is valid */
1149 - (IBAction)t3_strmMthdChanged:(id)sender
1151 /* change the captions of o_t3_txt_destInfo according to the chosen
1152 * streaming method */
1154 o_mode = [[NSNumber alloc] initWithInt:[[o_t3_matrix_stmgMhd selectedCell] tag]];
1155 if( [o_mode intValue] == 2 )
1158 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:0] objectAtIndex:2]];
1159 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:0] objectAtIndex:3]];
1161 else if( [o_mode intValue] == 1 )
1164 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:1] objectAtIndex:2]];
1165 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:1] objectAtIndex:3]];
1167 else if( [o_mode intValue] == 0 )
1170 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:2] objectAtIndex:2]];
1171 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:2] objectAtIndex:3]]; }
1175 - (IBAction)t4_AudCdcChanged:(id)sender
1177 /* update codec info */
1178 [o_t4_txt_hintAudio setStringValue:[[o_audioCodecs objectAtIndex:[o_t4_pop_audioCodec indexOfSelectedItem]] objectAtIndex:2]];
1181 - (IBAction)t4_enblAudTrnscd:(id)sender
1183 /* enable/disable the respective items */
1184 if([o_t4_ckb_audio state] == NSOnState)
1186 [o_t4_pop_audioCodec setEnabled:YES];
1187 [o_t4_pop_audioBitrate setEnabled:YES];
1188 [o_t4_txt_hintAudio setStringValue: _NS("Select your audio codec. "\
1189 "Click one to get more information.")];
1191 [o_t4_pop_audioCodec setEnabled:NO];
1192 [o_t4_pop_audioBitrate setEnabled:NO];
1193 [o_t4_txt_hintAudio setStringValue: _NS("If your stream has audio " \
1194 "and you want to transcode it, enable this.")];
1198 - (IBAction)t4_enblVidTrnscd:(id)sender
1200 /* enable/disable the respective items */
1201 if([o_t4_ckb_video state] == NSOnState)
1203 [o_t4_pop_videoCodec setEnabled:YES];
1204 [o_t4_pop_videoBitrate setEnabled:YES];
1205 [o_t4_txt_hintVideo setStringValue: _NS("Select your video codec. "\
1206 "Click one to get more information.")];
1208 [o_t4_pop_videoCodec setEnabled:NO];
1209 [o_t4_pop_videoBitrate setEnabled:NO];
1210 [o_t4_txt_hintVideo setStringValue: _NS("If your stream has video " \
1211 "and you want to transcode it, enable this.")];
1215 - (IBAction)t4_VidCdcChanged:(id)sender
1217 /* update codec info */
1218 [o_t4_txt_hintVideo setStringValue:[[o_videoCodecs objectAtIndex:[o_t4_pop_videoCodec indexOfSelectedItem]] objectAtIndex:2]];
1221 - (IBAction)t6_enblSapAnnce:(id)sender
1223 /* enable/disable input fld */
1224 if([o_t6_ckb_sap state] == NSOnState)
1226 [o_t6_fld_sap setEnabled:YES];
1228 [o_t6_fld_sap setEnabled:NO];
1229 [o_t6_fld_sap setStringValue:@""];
1233 - (IBAction)t6_mrInfo_ttl:(id)sender
1235 /* show a sheet for the help */
1236 [o_wh_txt_title setStringValue: _NS("Time-To-Live (TTL)")];
1237 [o_wh_txt_text setStringValue: _NS("Define the TTL (Time-To-Live) of the stream. "\
1238 "This parameter is the maximum number of routers your stream can go "
1239 "through. If you don't know what it means, or if you want to stream on " \
1240 "your local network only, leave this setting to 1.")];
1241 [NSApp beginSheet: o_wizardhelp_window
1242 modalForWindow: o_wizard_window
1243 modalDelegate: o_wizardhelp_window
1248 - (IBAction)t6_mrInfo_sap:(id)sender
1250 /* show a sheet for the help */
1251 [o_wh_txt_title setStringValue: _NS("SAP Announce")];
1252 [o_wh_txt_text setStringValue: _NS("When streaming using UDP, you can " \
1253 "announce your streams using the SAP/SDP announcing protocol. This " \
1254 "way, the clients won't have to type in the multicast address, it " \
1255 "will appear in their playlist if they enable the SAP extra interface.\n" \
1256 "If you want to give a name to your stream, enter it here, " \
1257 "else, a default name will be used.")];
1258 [NSApp beginSheet: o_wizardhelp_window
1259 modalForWindow: o_wizard_window
1260 modalDelegate: o_wizardhelp_window
1265 - (IBAction)t7_selectTrnscdDestFile:(id)sender
1267 /* provide a save-to-dialogue, so the user can choose a location for his/her new file */
1268 NSSavePanel * savePanel = [NSSavePanel savePanel];
1269 SEL sel = @selector(t7_getTrnscdDestFile:returnCode:contextInfo:);
1270 [savePanel setRequiredFileType:[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0]];
1271 [savePanel setCanSelectHiddenExtension:YES];
1272 [savePanel beginSheetForDirectory:nil file:nil modalForWindow:o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
1275 - (void)t7_getTrnscdDestFile: (NSSavePanel *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
1277 if (returnCode == NSOKButton)
1279 /* output returned path to text-field */
1280 [o_t7_fld_filePath setStringValue:[sheet filename]];
1284 - (IBAction)wh_closeSheet:(id)sender
1286 /* close the help sheet */
1287 [NSApp endSheet:o_wizardhelp_window];
1288 [o_wizardhelp_window close];