1 /*****************************************************************************
2 * wizard.m: MacOS X Streaming Wizard
3 *****************************************************************************
4 * Copyright (C) 2005-2012 VLC authors and VideoLAN
7 * Authors: Felix Paul Kühne <fkuehne at videolan dot org>,
8 * Brendon Justin <brendonjustin at gmail.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
26 /*****************************************************************************
27 * Note: this code is partially based upon ../wxwidgets/wizard.cpp and
28 * ../wxwidgets/streamdata.h; both written by Clément Stenac.
29 *****************************************************************************/
32 /*****************************************************************************
34 *****************************************************************************/
35 #import "CompatibilityFixes.h"
39 #import <vlc_interface.h>
41 /*****************************************************************************
42 * VLCWizard implementation
43 *****************************************************************************/
45 @implementation VLCWizard
47 static VLCWizard *_o_sharedInstance = nil;
49 + (VLCWizard *)sharedInstance
51 return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
56 if (_o_sharedInstance) {
59 _o_sharedInstance = [super init];
62 return _o_sharedInstance;
67 [o_userSelections release];
68 [o_videoCodecs release];
69 [o_audioCodecs release];
70 [o_encapFormats release];
76 if (!OSX_SNOW_LEOPARD)
77 [o_wizard_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
79 /* some minor cleanup */
80 [o_t2_tbl_plst setEnabled:NO];
81 o_userSelections = [[NSMutableDictionary alloc] init];
82 [o_btn_backward setEnabled:NO];
84 /* add audio-bitrates for transcoding */
85 NSArray * audioBitratesArray;
86 audioBitratesArray = [NSArray arrayWithObjects: @"512", @"256", @"192",
87 @"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",
95 @"768", @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
96 [o_t4_pop_videoBitrate removeAllItems];
97 [o_t4_pop_videoBitrate addItemsWithTitles: videoBitratesArray];
98 [o_t4_pop_videoBitrate selectItemWithTitle: @"1024"];
100 /* fill 2 global arrays with arrays containing all codec-related information
101 * - one array per codec named by its short name to define the encap-compability,
102 * cmd-names, real names, more info in the order: realName, shortName,
103 * moreInfo, encaps */
116 NSArray * o_dummyVid;
117 o_mp1v = [NSArray arrayWithObjects: @"MPEG-1 Video", @"mp1v",
118 _NS("MPEG-1 Video codec (usable with MPEG PS, MPEG TS, MPEG1, OGG "
119 "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_OGG", @"MUX_RAW",
120 @"NO", @"NO", @"NO", @"NO", nil];
121 o_mp2v = [NSArray arrayWithObjects: @"MPEG-2 Video", @"mp2v",
122 _NS("MPEG-2 Video codec (usable with MPEG PS, MPEG TS, MPEG1, OGG "
123 "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_OGG", @"MUX_RAW",
124 @"NO", @"NO", @"NO", @"NO", nil];
125 o_mp4v = [NSArray arrayWithObjects: @"MPEG-4 Video", @"mp4v",
126 _NS("MPEG-4 Video codec (useable with MPEG PS, MPEG TS, MPEG1, ASF, "
127 "MP4, OGG and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF",
128 @"MUX_MP4", @"MUX_OGG", @"MUX_RAW", @"NO", @"NO", nil];
129 o_div1 = [NSArray arrayWithObjects: @"DIVX 1", @"DIV1",
130 _NS("DivX first version (useable with MPEG TS, MPEG1, ASF and OGG)"),
131 @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO",
133 o_div2 = [NSArray arrayWithObjects: @"DIVX 2", @"DIV2",
134 _NS("DivX second version (useable with MPEG TS, MPEG1, ASF and OGG)"),
135 @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO",
137 o_div3 = [NSArray arrayWithObjects: @"DIVX 3", @"DIV3",
138 _NS("DivX third version (useable with MPEG TS, MPEG1, ASF and OGG)"),
139 @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO",
141 o_h263 = [NSArray arrayWithObjects: @"H.263", @"h263",
142 _NS("H263 is a video codec optimized for videoconference "
143 "(low rates, useable with MPEG TS)"), @"MUX_TS", @"NO", @"NO", @"NO",
144 @"NO", @"NO", @"NO", @"NO", @"NO", nil];
145 o_h264 = [NSArray arrayWithObjects: @"H.264", @"h264",
146 _NS("H264 is a new video codec (useable with MPEG TS and MP4)"),
147 @"MUX_TS", @"MUX_MP4", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO",
149 o_wmv1 = [NSArray arrayWithObjects: @"WMV 1", @"WMV1",
150 _NS("WMV (Windows Media Video) 1 (useable with MPEG TS, MPEG1, ASF and "
151 "OGG)"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO",
152 @"NO", @"NO", @"NO", nil];
153 o_wmv2 = [NSArray arrayWithObjects: @"WMV 2", @"WMV2",
154 _NS("WMV (Windows Media Video) 2 (useable with MPEG TS, MPEG1, ASF and "
155 "OGG)"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO",
156 @"NO", @"NO", @"NO", nil];
157 o_mjpg = [NSArray arrayWithObjects: @"MJPEG", @"MJPG",
158 _NS("MJPEG consists of a series of JPEG pictures (useable with MPEG TS,"
159 " MPEG1, ASF and OGG)"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG",
160 @"NO", @"NO", @"NO", @"NO", @"NO", nil];
161 o_theo = [NSArray arrayWithObjects: @"Theora", @"theo",
162 _NS("Theora is a free general-purpose codec (useable with MPEG TS "
163 "and OGG)"), @"MUX_TS", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO",
165 o_dummyVid = [NSArray arrayWithObjects: @"Dummy", @"dummy",
166 _NS("Dummy codec (do not transcode, useable with all encapsulation "
167 "formats)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4",
168 @"MUX_OGG", @"MUX_WAV", @"MUX_RAW", @"MUX_MOV", nil];
169 o_videoCodecs = [[NSArray alloc] initWithObjects: o_mp1v, o_mp2v, o_mp4v,
170 o_div1, o_div2, o_div3, o_h263, o_h264, o_wmv1, o_wmv2, o_mjpg, o_theo,
183 NSArray * o_dummyAud;
184 o_mpga = [NSArray arrayWithObjects: @"MPEG Audio", @"mpga",
185 _NS("The standard MPEG audio (1/2) format (useable with MPEG PS, MPEG TS, "
186 "MPEG1, ASF, OGG and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG",
187 @"MUX_ASF", @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", nil];
188 o_mp3 = [NSArray arrayWithObjects: @"MP3", @"mp3",
189 _NS("MPEG Audio Layer 3 (useable with MPEG PS, MPEG TS, MPEG1, ASF, OGG "
190 "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG",
191 @"MUX_RAW", @"-1", @"-1", @"-1", nil];
192 o_mp4a = [NSArray arrayWithObjects: @"MPEG 4 Audio", @"mp4a",
193 _NS("Audio format for MPEG4 (useable with MPEG TS and MPEG4)"), @"MUX_TS",
194 @"MUX_MP4", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
195 o_a52 = [NSArray arrayWithObjects: @"A/52", @"a52",
196 _NS("DVD audio format (useable with MPEG PS, MPEG TS, MPEG1, ASF, OGG "
197 "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG",
198 @"MUX_RAW", @"-1", @"-1", @"-1", nil];
199 o_vorb = [NSArray arrayWithObjects: @"Vorbis", @"vorb",
200 _NS("Vorbis is a free audio codec (useable with OGG)"), @"MUX_OGG",
201 @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
202 o_flac = [NSArray arrayWithObjects: @"FLAC", @"flac",
203 _NS("FLAC is a lossless audio codec (useable with OGG and RAW)"),
204 @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1",
206 o_spx = [NSArray arrayWithObjects: @"Speex", @"spx",
207 _NS("A free audio codec dedicated to compression of voice (useable "
208 "with OGG)"), @"MUX_OGG", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1",
210 o_s16l = [NSArray arrayWithObjects: @"Uncompressed, integer", @"s16l",
211 _NS("Uncompressed audio samples (useable with WAV)"), @"MUX_WAV",
212 @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
213 o_fl32 = [NSArray arrayWithObjects: @"Uncompressed, floating point", @"fl32",
214 _NS("Uncompressed audio samples (useable with WAV)"), @"MUX_WAV",
215 @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
216 o_dummyAud = [NSArray arrayWithObjects: @"Dummy", @"dummy",
217 _NS("Dummy codec (do not transcode, useable with all encapsulation "
218 "formats)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4",
219 @"MUX_OGG", @"MUX_RAW", @"MUX_MOV", @"MUX_WAV", nil];
220 o_audioCodecs = [[NSArray alloc] initWithObjects: o_mpga, o_mp3, o_mp4a,
221 o_a52, o_vorb, o_flac, o_spx, o_s16l, o_fl32, o_dummyAud, nil];
224 /* fill another global array with all information about the encap-formats
225 * note that the order of the formats inside the g. array is the same as on
237 o_ps = [NSArray arrayWithObjects: @"ps", @"MPEG PS",
238 _NS("MPEG Program Stream"), @"mpg", nil];
239 o_ts = [NSArray arrayWithObjects: @"ts", @"MPEG TS",
240 _NS("MPEG Transport Stream"), nil];
241 o_mpeg = [NSArray arrayWithObjects: @"ps", @"MPEG 1",
242 _NS("MPEG 1 Format"), @"mpg", nil];
243 o_ogg = [NSArray arrayWithObjects: @"ogg", @"OGG", @"OGG", nil];
244 o_raw = [NSArray arrayWithObjects: @"raw", @"RAW", @"RAW", nil];
245 o_asf = [NSArray arrayWithObjects: @"asf", @"ASF", @"ASF", nil];
246 o_mp4 = [NSArray arrayWithObjects: @"mp4", @"MP4", @"MPEG4", nil];
247 o_mov = [NSArray arrayWithObjects: @"mov", @"MOV", @"MOV", nil];
248 o_wav = [NSArray arrayWithObjects: @"wav", @"WAV", @"WAV", nil];
249 o_asfh = [NSArray arrayWithObjects: @"asfh", @"ASFH", @"ASFH", nil];
250 o_encapFormats = [[NSArray alloc] initWithObjects: o_ps, o_ts, o_mpeg,
251 o_ogg, o_raw, o_asf, o_mp4, o_mov, o_wav, o_asfh, nil];
253 /* yet another array on streaming methods including help texts */
257 NSArray * o_udp_multi;
259 NSArray * o_rtp_multi;
260 o_http = [NSArray arrayWithObjects: @"http", @"HTTP", _NS("Enter the local "
261 "addresses you want to listen requests on. Do not enter anything if "
262 "you want to listen on all the network interfaces. This is generally "
263 "the best thing to do. Other computers can then access the stream at "
264 "http://yourip:8080 by default.") , _NS("Use this to stream to several "
265 "computers. This method is not the most efficient, as the server needs "\
266 "to send the stream several times, but generally the most compatible"), nil];
267 o_mms = [NSArray arrayWithObjects: @"mmsh", @"MMS", _NS("Enter the local "
268 "addresses you want to listen requests on. Do not enter anything if "
269 "you want to listen on all the network interfaces. This is generally "
270 "the best thing to do. Other computers can then access the stream at "
271 "mms://yourip:8080 by default."), _NS("Use this to stream to several "
272 "computers using the Microsoft MMS protocol. This protocol is used as "
273 "transport method by many Microsoft's softwares. Note that only a "
274 "small part of the MMS protocol is supported (MMS encapsulated in "
276 o_udp_uni = [NSArray arrayWithObjects: @"udp", @"UDP-Unicast", _NS("Enter "
277 "the address of the computer to stream to."), _NS("Use this to stream "
278 "to a single computer."), nil];
279 o_udp_multi = [NSArray arrayWithObjects: @"udp", @"UDP-Multicast", _NS("Enter "
280 "the multicast address to stream to in this field. This must be an IP "
281 "address between 224.0.0.0 and 239.255.255.255. For a private use, "
282 "enter an address beginning with 239.255."), _NS("Use this to stream "
283 "to a dynamic group of computers on a multicast-enabled network. This "
284 "is the most efficient method to stream to several computers, but it "
285 "won't work over the Internet."), nil];
286 o_rtp_uni = [NSArray arrayWithObjects: @"rtp", @"RTP-Unicast", _NS("Enter the "
287 "address of the computer to stream to.") , _NS("Use this to stream "
288 "to a single computer. RTP headers will be added to the stream"), nil];
289 o_rtp_multi = [NSArray arrayWithObjects: @"rtp", @"RTP-Multicast", _NS("Enter "
290 "the multicast address to stream to in this field. This must be an IP "
291 "address between 224.0.0.0 and 239.255.255.255. For a private use, "
292 "enter an address beginning with 239.255."), _NS("Use this to stream "
293 "to a dynamic group of computers on a multicast-enabled network. This "
294 "is the most efficient method to stream to several computers, but it "
295 "won't work over Internet. RTP headers will be added to the stream"), nil];
296 o_strmgMthds = [[NSArray alloc] initWithObjects: o_http, o_mms,
297 o_udp_uni, o_udp_multi, o_rtp_uni, o_rtp_multi, nil];
302 /* just present the window to the user */
303 [o_wizard_window center];
304 [o_wizard_window displayIfNeeded];
305 [o_wizard_window makeKeyAndOrderFront:nil];
310 /* go to the front page and clean up a bit */
311 [o_userSelections removeAllObjects];
312 [o_btn_forward setTitle: _NS("Next")];
313 [o_tab_pageHolder selectFirstTabViewItem:self];
318 /* localise all strings to the users lang */
319 /* method is called from intf.m (in method showWizard) */
322 [o_btn_backward setTitle: _NS("Back")];
323 [o_btn_cancel setTitle: _NS("Cancel")];
324 [o_btn_forward setTitle: _NS("Next")];
325 [o_wizard_window setTitle: _NS("Streaming/Transcoding Wizard")];
327 /* page one ("Hello") */
328 [o_t1_txt_title setStringValue: _NS("Streaming/Transcoding Wizard")];
329 [o_t1_txt_text setStringValue: _NS("This wizard allows configuring "
330 "simple streaming or transcoding setups.")];
331 [o_t1_btn_mrInfo_strmg setTitle: _NS("More Info")];
332 [o_t1_btn_mrInfo_trnscd setTitle: _NS("More Info")];
333 [o_t1_txt_notice setStringValue: _NS("This wizard only gives access to "
334 "a small subset of VLC's streaming and transcoding capabilities. "
335 "The Open and 'Saving/Streaming' dialogs will give access to more "
337 [[o_t1_matrix_strmgOrTrnscd cellAtRow:0 column:0] setTitle:
338 _NS("Stream to network")];
339 [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setTitle:
340 _NS("Transcode/Save to file")];
342 /* page two ("Input") */
343 [o_t2_title setStringValue: _NS("Choose input")];
344 [o_t2_text setStringValue: _NS("Choose here your input stream.")];
345 [[o_t2_matrix_inputSourceType cellAtRow:0 column:0] setTitle:
346 _NS("Select a stream")];
347 [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setTitle:
348 _NS("Existing playlist item")];
349 [o_t2_btn_chooseFile setTitle: _NS("Choose...")];
350 [[[o_t2_tbl_plst tableColumnWithIdentifier:@"name"] headerCell]
351 setStringValue: _NS("Title")];
352 [[[o_t2_tbl_plst tableColumnWithIdentifier:@"artist"] headerCell]
353 setStringValue: _NS("Author")];
354 [[[o_t2_tbl_plst tableColumnWithIdentifier:@"duration"] headerCell]
355 setStringValue: _NS("Duration")];
356 [o_t2_box_prtExtrct setTitle: _NS("Partial Extract")];
357 [o_t2_ckb_enblPartExtrct setTitle: _NS("Enable")];
358 [o_t2_ckb_enblPartExtrct setToolTip: _NS("This can be used to read only a "
359 "part of the stream. It must be possible to control the incoming "
360 "stream (for example, a file or a disc, but not an UDP network stream.) "
361 "The starting and ending times can be given in seconds.")];
362 [o_t2_txt_prtExtrctFrom setStringValue: _NS("From")];
363 [o_t2_txt_prtExtrctTo setStringValue: _NS("To")];
365 /* page three ("Streaming 1") */
366 [o_t3_txt_title setStringValue: _NS("Streaming")];
367 [o_t3_txt_text setStringValue: _NS("This page allows selecting how "
368 "the input stream will be sent.")];
369 [o_t3_box_dest setTitle: _NS("Destination")];
370 [o_t3_box_strmgMthd setTitle: _NS("Streaming method")];
371 [o_t3_txt_destInfo setStringValue: _NS("Address of the computer "
373 [[o_t3_matrix_stmgMhd cellAtRow:0 column:0] setTitle: _NS("UDP Unicast")];
374 [[o_t3_matrix_stmgMhd cellAtRow:0 column:1] setTitle: _NS("UDP Multicast")];
375 [o_t3_txt_strgMthdInfo setStringValue: _NS("Use this to stream to a single "
378 /* page four ("Transcode 1") */
379 [o_t4_title setStringValue: _NS("Transcode")];
380 [o_t4_text setStringValue: _NS("This page allows changing the compression "
381 "format of the audio or video tracks. To change only "
382 "the container format, proceed to next page.")];
383 [o_t4_box_audio setTitle: _NS("Audio")];
384 [o_t4_box_video setTitle: _NS("Video")];
385 [o_t4_ckb_audio setTitle: _NS("Transcode audio")];
386 [o_t4_ckb_video setTitle: _NS("Transcode video")];
387 [o_t4_txt_videoBitrate setStringValue: _NS("Bitrate (kb/s)")];
388 [o_t4_txt_videoCodec setStringValue: _NS("Codec")];
389 [o_t4_txt_hintAudio setStringValue: _NS("Enabling this allows transcoding "\
390 "the audio track if one is present in the stream.")];
391 [o_t4_txt_hintVideo setStringValue: _NS("Enabling this allows transcoding "\
392 "the video track if one is present in the stream.")];
394 /* page five ("Encap") */
395 [o_t5_title setStringValue: _NS("Encapsulation format")];
396 [o_t5_text setStringValue: _NS("This page allows selecting how the "
397 "stream will be encapsulated. Depending on previously chosen settings "
398 "all formats won't be available.")];
400 /* page six ("Streaming 2") */
401 [o_t6_title setStringValue: _NS("Additional streaming options")];
402 [o_t6_text setStringValue: _NS("In this page, a few "
403 "additional streaming parameters can be set.")];
404 [o_t6_txt_ttl setStringValue: _NS("Time-To-Live (TTL)")];
405 [o_t6_btn_mrInfo_ttl setTitle: _NS("More Info")];
406 [o_t6_ckb_sap setTitle: _NS("SAP Announce")];
407 [o_t6_btn_mrInfo_sap setTitle: _NS("More Info")];
408 [o_t6_ckb_local setTitle: _NS("Local playback")];
409 [o_t6_btn_mrInfo_local setTitle: _NS("More Info")];
410 [o_t6_ckb_soverlay setTitle: _NS("Add Subtitles to transcoded video")];
412 /* page seven ("Transcode 2") */
413 [o_t7_title setStringValue: _NS("Additional transcode options")];
414 [o_t7_text setStringValue: _NS("In this page, a few "
415 "additional transcoding parameters can be set.")];
416 [o_t7_txt_saveFileTo setStringValue: _NS("Select the file to save to")];
417 [o_t7_btn_chooseFile setTitle: _NS("Choose...")];
418 [o_t7_ckb_local setTitle: _NS("Local playback")];
419 [o_t7_ckb_soverlay setTitle: _NS("Add Subtitles to transcoded video")];
420 [o_t7_ckb_soverlay setToolTip: _NS("Adds available subtitles directly to "
421 "the video. These cannot be disabled "
422 "by the receiving user as they become "
423 "part of the image.")];
424 [o_t7_btn_mrInfo_local setTitle: _NS("More Info")];
426 /* page eight ("Summary") */
427 [o_t8_txt_text setStringValue: _NS("This page lists all the settings. "
428 "Click \"Finish\" to start streaming or transcoding.")];
429 [o_t8_txt_title setStringValue: _NS("Summary")];
430 [o_t8_txt_destination setStringValue: [_NS("Destination")
431 stringByAppendingString: @":"]];
432 [o_t8_txt_encapFormat setStringValue: [_NS("Encap. format")
433 stringByAppendingString: @":"]];
434 [o_t8_txt_inputStream setStringValue: [_NS("Input stream")
435 stringByAppendingString: @":"]];
436 [o_t8_txt_partExtract setStringValue: [_NS("Partial Extract")
437 stringByAppendingString: @":"]];
438 [o_t8_txt_sap setStringValue: [_NS("SAP Announce")
439 stringByAppendingString: @":"]];
440 [o_t8_txt_saveFileTo setStringValue: [_NS("Save file to")
441 stringByAppendingString: @":"]];
442 [o_t8_txt_strmgMthd setStringValue: [_NS("Streaming method")
443 stringByAppendingString: @":"]];
444 [o_t8_txt_trnscdAudio setStringValue: [_NS("Transcode audio")
445 stringByAppendingString: @":"]];
446 [o_t8_txt_trnscdVideo setStringValue: [_NS("Transcode video")
447 stringByAppendingString: @":"]];
448 [o_t8_txt_soverlay setStringValue: [_NS("Include subtitles")
449 stringByAppendingString: @":"]];
450 [o_t8_txt_local setStringValue: [_NS("Local playback")
451 stringByAppendingString: @":"]];
454 - (void)initWithExtractValuesFrom: (NSString *)from
456 ofItem: (NSString *)item
459 msg_Dbg(VLCIntf, "wizard was reseted");
460 [o_userSelections setObject:@"trnscd" forKey:@"trnscdOrStrmg"];
461 [o_btn_backward setEnabled:YES];
462 [o_tab_pageHolder selectTabViewItemAtIndex:1];
463 [o_t2_fld_prtExtrctFrom setStringValue: from];
464 [o_t2_fld_prtExtrctTo setStringValue: to];
465 [o_t2_fld_pathToNewStrm setStringValue: item];
466 [o_t1_matrix_strmgOrTrnscd selectCellAtRow:1 column:0];
467 [[o_t1_matrix_strmgOrTrnscd cellAtRow:0 column:0] setState: NSOffState];
468 [o_t2_ckb_enblPartExtrct setState: NSOnState];
469 [self t2_enableExtract: nil];
470 msg_Dbg(VLCIntf, "wizard interface is set");
472 [o_wizard_window center];
473 [o_wizard_window display];
474 [o_wizard_window makeKeyAndOrderFront:nil];
475 msg_Dbg(VLCIntf, "wizard window displayed");
478 - (IBAction)cancelRun:(id)sender
480 [o_wizard_window close];
485 return o_playlist_wizard;
488 - (IBAction)nextTab:(id)sender
490 NSString * selectedTabViewItemLabel = [[o_tab_pageHolder selectedTabViewItem] label];
491 if ([selectedTabViewItemLabel isEqualToString: @"Hello"])
493 /* check whether the user wants to stream or just to transcode;
494 * store information for later usage */
496 o_mode = [[o_t1_matrix_strmgOrTrnscd selectedCell] title];
497 if ([o_mode isEqualToString: _NS("Stream to network")])
499 /* we will be streaming */
500 [o_userSelections setObject:@"strmg" forKey:@"trnscdOrStrmg"];
504 /* we will just do some transcoding */
505 [o_userSelections setObject:@"trnscd" forKey:@"trnscdOrStrmg"];
507 [o_btn_backward setEnabled:YES];
508 [o_tab_pageHolder selectTabViewItemAtIndex:1];
510 /* Fill the playlist with current playlist items */
511 [o_playlist_wizard reloadOutlineView];
514 else if ([selectedTabViewItemLabel isEqualToString: @"Input"])
516 /* check whether partialExtract is enabled and store the values, if needed */
517 if ([o_t2_ckb_enblPartExtrct state] == NSOnState)
519 [o_userSelections setObject:@"YES" forKey:@"partExtract"];
520 [o_userSelections setObject:[o_t2_fld_prtExtrctFrom stringValue]
521 forKey:@"partExtractFrom"];
522 [o_userSelections setObject:[o_t2_fld_prtExtrctTo stringValue]
523 forKey:@"partExtractTo"];
525 [o_userSelections setObject:@"NO" forKey:@"partExtract"];
528 /* check whether we use an existing pl-item or add an new one;
529 * store the path or the index and set a flag.
530 * complain to the user if s/he didn't provide a path */
534 o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
535 if ([o_mode isEqualToString: _NS("Select a stream")])
537 [o_userSelections setObject:@"YES" forKey:@"newStrm"];
538 if ([[o_t2_fld_pathToNewStrm stringValue] isEqualToString: @""])
540 /* set a flag that no file is selected */
545 [o_userSelections setObject:[NSArray arrayWithObject:
546 [o_t2_fld_pathToNewStrm stringValue]] forKey:@"pathToStrm"];
551 if ([o_t2_tbl_plst numberOfSelectedRows] > 0)
553 NSIndexSet * selectedIndexes = [o_t2_tbl_plst selectedRowIndexes];
554 NSUInteger count = [selectedIndexes count];
555 NSMutableArray * tempArray = [[NSMutableArray alloc] init];
556 for( NSUInteger x = 0; x < count; x++)
558 playlist_item_t *p_item = [[o_t2_tbl_plst itemAtRow: [selectedIndexes indexGreaterThanOrEqualToIndex: x]] pointerValue];
560 if (p_item->i_children <= 0)
562 char *psz_uri = input_item_GetURI( p_item->p_input);
563 [tempArray addObject: [NSString stringWithUTF8String: psz_uri]];
570 [o_userSelections setObject:[NSArray arrayWithArray: tempArray] forKey:@"pathToStrm"];
575 /* set a flag that no item is selected */
580 /* show either "Streaming 1" or "Transcode 1" to the user */
583 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"]
584 isEqualToString:@"strmg"])
586 /* we are streaming */
587 [o_tab_pageHolder selectTabViewItemAtIndex:2];
589 /* we are just transcoding */
591 /* rebuild the menues for the codec-selections */
592 [self rebuildCodecMenus];
594 [o_tab_pageHolder selectTabViewItemAtIndex:3];
597 /* show a sheet that the user didn't select a file */
598 NSBeginInformationalAlertSheet(_NS("No input selected"),
599 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
600 _NS("No new stream or valid playlist item has been selected.\n\n"
601 "Choose one before going to the next page."));
604 else if ([selectedTabViewItemLabel isEqualToString: @"Streaming 1"])
606 /* rebuild the menues for the codec-selections */
607 [self rebuildCodecMenus];
609 /* check which streaming method is selected and store it */
611 mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
615 [o_userSelections setObject:@"0" forKey:@"stmgMhd"];
617 /* disable all codecs which don't support MPEG PS, MPEG TS, MPEG 1,
619 [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
620 [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating point"];
622 } else if ( mode == 1)
625 [o_userSelections setObject:@"1" forKey:@"stmgMhd"];
627 /* disable all codecs which don't support ASF / ASFH */
628 [o_t4_pop_audioCodec removeItemWithTitle:@"Vorbis"];
629 [o_t4_pop_audioCodec removeItemWithTitle:@"FLAC"];
630 [o_t4_pop_audioCodec removeItemWithTitle:@"Speex"];
631 [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
632 [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating point"];
634 [o_t4_pop_videoCodec removeItemWithTitle:@"MPEG-1 Video"];
635 [o_t4_pop_videoCodec removeItemWithTitle:@"MPEG-2 Video"];
636 [o_t4_pop_videoCodec removeItemWithTitle:@"H.263"];
637 [o_t4_pop_videoCodec removeItemWithTitle:@"H.264"];
638 [o_t4_pop_videoCodec removeItemWithTitle:@"MJPEG"];
639 [o_t4_pop_videoCodec removeItemWithTitle:@"Theora"];
641 /* RTP/UDP Unicast/Multicast Streaming */
642 [o_userSelections setObject: [[NSNumber numberWithInt: mode]
643 stringValue] forKey:@"stmgMhd"];
645 /* disable all codecs which don't support MPEG-TS */
646 [o_t4_pop_audioCodec removeItemWithTitle:@"Vorbis"];
647 [o_t4_pop_audioCodec removeItemWithTitle:@"FLAC"];
648 [o_t4_pop_audioCodec removeItemWithTitle:@"Speex"];
649 [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
650 [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating point"];
653 /* store the destination and check whether is it empty */
654 if([[o_userSelections objectForKey:@"stmgMhd"] intValue] >=2)
656 /* empty field is valid for HTTP and MMS */
657 if ([[o_t3_fld_address stringValue] isEqualToString: @""])
659 /* complain to the user that "" is no valid dest. */
660 NSBeginInformationalAlertSheet(_NS("No valid destination"),
661 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
662 _NS("A valid destination has to be selected "
663 "Enter either a Unicast-IP or a Multicast-IP."
664 "\n\nIf you don't know what this means, have a look at "
665 "the VLC Streaming HOWTO and the help texts in this "
668 /* FIXME: check whether the entered IP is really valid */
669 [o_userSelections setObject:[o_t3_fld_address stringValue]
671 /* let's go to the transcode-1-tab */
672 [o_tab_pageHolder selectTabViewItemAtIndex:3];
675 [o_userSelections setObject:[o_t3_fld_address stringValue]
677 /* let's go to the transcode-1-tab */
678 [o_tab_pageHolder selectTabViewItemAtIndex:3];
681 else if ([selectedTabViewItemLabel isEqualToString: @"Transcode 1"])
683 /* check whether the user wants to transcode the video-track and store
684 * the related options */
685 if ([o_t4_ckb_video state] == NSOnState)
688 theNum = [NSNumber numberWithInt:[[o_t4_pop_videoCodec selectedItem]tag]];
689 [o_userSelections setObject:@"YES" forKey:@"trnscdVideo"];
690 [o_userSelections setObject:[o_t4_pop_videoBitrate titleOfSelectedItem]
691 forKey:@"trnscdVideoBitrate"];
692 [o_userSelections setObject:theNum forKey:@"trnscdVideoCodec"];
694 [o_userSelections setObject:@"NO" forKey:@"trnscdVideo"];
697 /* check whether the user wants to transcode the audio-track and store
698 * the related options */
699 if ([o_t4_ckb_audio state] == NSOnState)
702 theNum = [NSNumber numberWithInt:[[o_t4_pop_audioCodec selectedItem]tag]];
703 [o_userSelections setObject:@"YES" forKey:@"trnscdAudio"];
704 [o_userSelections setObject:[o_t4_pop_audioBitrate titleOfSelectedItem]
705 forKey:@"trnscdAudioBitrate"];
706 [o_userSelections setObject:theNum forKey:@"trnscdAudioCodec"];
708 [o_userSelections setObject:@"NO" forKey:@"trnscdAudio"];
711 /* store the currently selected item for further reference */
712 int i_temp = [[o_t5_matrix_encap selectedCell] tag];
714 /* disable all encap-formats */
715 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
716 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
717 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
718 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
719 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
720 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
721 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
722 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
723 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
724 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
725 [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
727 /* re-enable the encap-formats supported by the chosen codecs */
728 /* FIXME: the following is a really bad coding-style. feel free to mail
729 me ideas how to make this nicer, if you want to -- FK, 7/11/05 */
731 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualTo: @"YES"])
733 NSInteger i_selectedAudioCodec = [[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue];
735 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
737 NSInteger i_selectedVideoCodec = [[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue];
739 /* we are transcoding both audio and video, so we need to check both deps */
740 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_PS"])
742 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_PS"])
744 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
745 [o_t5_matrix_encap selectCellAtRow:0 column:0];
748 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_TS"])
750 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_TS"])
752 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
753 [o_t5_matrix_encap selectCellAtRow:1 column:0];
756 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MPEG"])
758 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MPEG"])
760 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
761 [o_t5_matrix_encap selectCellAtRow:2 column:0];
764 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_OGG"])
766 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_OGG"])
768 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
769 [o_t5_matrix_encap selectCellAtRow:3 column:0];
772 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_RAW"])
774 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_RAW"])
776 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
777 [o_t5_matrix_encap selectCellAtRow:4 column:0];
780 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_ASF"])
782 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_ASF"])
784 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
785 [o_t5_matrix_encap selectCellAtRow:5 column:0];
788 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MP4"])
790 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MP4"])
792 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
793 [o_t5_matrix_encap selectCellAtRow:6 column:0];
796 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MOV"])
798 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MOV"])
800 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
801 [o_t5_matrix_encap selectCellAtRow:7 column:0];
804 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_WAV"])
806 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_WAV"])
808 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
809 [o_t5_matrix_encap selectCellAtRow:8 column:0];
815 /* we just transcoding the audio */
817 /* select formats supported by the audio codec */
818 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_PS"])
820 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
821 [o_t5_matrix_encap selectCellAtRow:0 column:0];
823 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_TS"])
825 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
826 [o_t5_matrix_encap selectCellAtRow:1 column:0];
828 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MPEG"])
830 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
831 [o_t5_matrix_encap selectCellAtRow:2 column:0];
833 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_OGG"])
835 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
836 [o_t5_matrix_encap selectCellAtRow:3 column:0];
838 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_RAW"])
840 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
841 [o_t5_matrix_encap selectCellAtRow:4 column:0];
843 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_ASF"])
845 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
846 [o_t5_matrix_encap selectCellAtRow:5 column:0];
848 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MP4"])
850 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
851 [o_t5_matrix_encap selectCellAtRow:6 column:0];
853 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MOV"])
855 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
856 [o_t5_matrix_encap selectCellAtRow:7 column:0];
858 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_WAV"])
860 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
861 [o_t5_matrix_encap selectCellAtRow:8 column:0];
865 else if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
867 /* we are just transcoding the video */
869 /* select formats supported by the video-codec */
870 NSInteger i_selectedVideoCodec = [[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue];
872 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_PS"])
874 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
875 [o_t5_matrix_encap selectCellAtRow:0 column:0];
877 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_TS"])
879 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
880 [o_t5_matrix_encap selectCellAtRow:1 column:0];
882 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MPEG"])
884 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
885 [o_t5_matrix_encap selectCellAtRow:2 column:0];
887 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_OGG"])
889 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
890 [o_t5_matrix_encap selectCellAtRow:3 column:0];
892 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_RAW"])
894 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
895 [o_t5_matrix_encap selectCellAtRow:4 column:0];
897 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_ASF"])
899 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
900 [o_t5_matrix_encap selectCellAtRow:5 column:0];
902 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MP4"])
904 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
905 [o_t5_matrix_encap selectCellAtRow:6 column:0];
907 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MOV"])
909 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
910 [o_t5_matrix_encap selectCellAtRow:7 column:0];
912 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_WAV"])
914 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
915 [o_t5_matrix_encap selectCellAtRow:8 column:0];
918 /* we don't do any transcoding
919 * -> enabled the encap-formats allowed when streaming content via
920 * http plus MP4 since this should work fine in most cases */
922 /* FIXME: choose a selection of encap-formats based upon the
923 * actually used codecs */
925 /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW, ASF, MP4 and MOV
927 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
928 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
929 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
930 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
931 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
932 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
933 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
934 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
935 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
936 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
937 [o_t5_matrix_encap selectCellAtRow:0 column:0];
940 NSInteger i_streamingMethod = [[o_userSelections objectForKey:@"stmgMhd"] intValue];
941 if ( i_streamingMethod == 1)
943 /* if MMS is the streaming protocol, only ASFH is available */
944 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
945 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
946 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
947 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
948 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
949 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
950 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
951 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
952 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
953 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
954 [o_t5_matrix_encap selectCellAtRow:9 column:0];
956 else if ( i_streamingMethod == 0)
958 /* if HTTP is the streaming protocol, disable all unsupported
959 * encap-formats, but don't touch the other ones selected above */
960 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
961 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
962 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
963 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
965 else if ( i_streamingMethod >= 2)
967 /* if UDP/RTP is the streaming protocol, only MPEG-TS is available */
968 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
969 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
970 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
971 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
972 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
973 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
974 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
975 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
976 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
977 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
978 [o_t5_matrix_encap selectCellAtRow:1 column:0];
981 BOOL anythingEnabled;
982 anythingEnabled = NO;
983 NSUInteger count = [o_t5_matrix_encap numberOfRows];
984 for (NSUInteger x = 0; x < count; x++)
986 if ([[o_t5_matrix_encap cellAtRow:x column:0] isEnabled])
987 anythingEnabled = YES;
990 if (anythingEnabled == YES)
992 /* re-select the previously chosen item, if available */
993 if ([[o_t5_matrix_encap cellWithTag: i_temp] isEnabled])
994 [o_t5_matrix_encap selectCellWithTag: i_temp];
996 /* go the encap-tab */
997 [o_tab_pageHolder selectTabViewItemAtIndex:4];
999 /* show a sheet that the selected codecs are not compatible */
1000 NSBeginInformationalAlertSheet(_NS("Invalid selection"), _NS("OK"),
1001 @"", @"", o_wizard_window, nil, nil, nil, nil, _NS("The "
1002 "chosen codecs are not compatible with each other. For example: "
1003 "It is not possible to mix uncompressed audio with any video codec.\n\n"
1004 "Correct your selection and try again."));
1008 else if ([selectedTabViewItemLabel isEqualToString: @"Encap"])
1010 /* get the chosen encap format and store it */
1012 theNum = [NSNumber numberWithInt:[[o_t5_matrix_encap selectedCell] tag]];
1013 [o_userSelections setObject:[theNum stringValue] forKey:@"encapFormat"];
1015 /* show either "Streaming 2" or "Transcode 2" to the user */
1016 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1018 /* we are streaming */
1019 [o_tab_pageHolder selectTabViewItemAtIndex:5];
1021 /* we are just transcoding */
1022 [o_tab_pageHolder selectTabViewItemAtIndex:6];
1023 /* in case that we are processing multiple items, let the user
1024 * select a folder instead of a localtion for a single item */
1025 if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
1027 [o_t7_txt_saveFileTo setStringValue:
1028 _NS("Select the directory to save to")];
1032 [o_t7_txt_saveFileTo setStringValue:
1033 _NS("Select the file to save to")];
1037 else if ([selectedTabViewItemLabel isEqualToString: @"Streaming 2"])
1039 /* store the chosen TTL */
1040 [o_userSelections setObject:[o_t6_fld_ttl stringValue] forKey:@"ttl"];
1042 /* check whether SAP is enabled and store the announce, if needed */
1043 if ([o_t6_ckb_sap state] == NSOnState)
1045 [o_userSelections setObject:@"YES" forKey:@"sap"];
1046 [o_userSelections setObject:[o_t6_fld_sap stringValue] forKey:@"sapText"];
1048 [o_userSelections setObject:@"NO" forKey:@"sap"];
1051 /* local playback? */
1052 if ([o_t6_ckb_local state] == NSOnState)
1054 [o_userSelections setObject:@"YES" forKey:@"localPb"];
1056 [o_userSelections setObject:@"NO" forKey:@"localPb"];
1059 /* include subtitles? */
1060 [o_userSelections setObject:
1061 [[NSNumber numberWithInt:[o_t6_ckb_soverlay state]] stringValue]
1062 forKey: @"soverlay"];
1064 /* go to "Summary" */
1067 else if ([selectedTabViewItemLabel isEqualToString: @"Transcode 2"])
1069 /* local playback? */
1070 if ([o_t7_ckb_local state] == NSOnState)
1072 [o_userSelections setObject:@"YES" forKey:@"localPb"];
1074 [o_userSelections setObject:@"NO" forKey:@"localPb"];
1077 /* check whether the path != "" and store it */
1078 if ([[o_t7_fld_filePath stringValue] isEqualToString: @""])
1080 /* complain to the user that "" is no valid path for a folder/file */
1081 if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
1082 NSBeginInformationalAlertSheet(_NS("No folder selected"),
1083 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1084 @"%@\n\n%@", _NS("A directory "
1085 "where to save the files has to be selected."),
1086 _NS("Enter either a valid path or use the \"Choose...\" "
1087 "button to select a location."));
1089 NSBeginInformationalAlertSheet(_NS("No file selected"),
1090 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1091 @"%@\n\n%@", _NS("A file "
1092 "where to save the stream has to be selected."),
1093 _NS("Enter either a valid path or use the \"Choose\" "
1094 "button to select a location."));
1096 /* create a string containing the requested suffix for later usage */
1097 NSString * theEncapFormat = [[o_encapFormats objectAtIndex:
1098 [[o_userSelections objectForKey:@"encapFormat"] intValue]]
1100 if (theEncapFormat == @"ps")
1101 theEncapFormat = @"mpg";
1103 /* look whether we need to process multiple items or not.
1104 * choose a faster variant if we just want a single item */
1105 if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
1107 NSMutableArray * tempArray = [[NSMutableArray alloc] init];
1109 int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
1110 NSMutableString * tempString = [[NSMutableString alloc] init];
1113 NSString * fileNameToUse;
1114 /* check whether the extension is hidden or not.
1116 * we need the casting to make GCC4 happy */
1117 if ([[[NSFileManager defaultManager] attributesOfItemAtPath:
1118 [[o_userSelections objectForKey:@"pathToStrm"]
1119 objectAtIndex: x] error:nil] objectForKey:
1120 NSFileExtensionHidden])
1121 fileNameToUse = [NSString stringWithString:
1122 [[NSFileManager defaultManager] displayNameAtPath:
1123 [[o_userSelections objectForKey:@"pathToStrm"]
1124 objectAtIndex: x]]];
1128 int count = [[[[NSFileManager defaultManager]
1130 [[o_userSelections objectForKey:@"pathToStrm"]
1132 componentsSeparatedByString: @"."] count];
1133 fileNameToUse = @"";
1134 while( z < (count - 1))
1136 fileNameToUse = [fileNameToUse stringByAppendingString:
1137 [[[[NSFileManager defaultManager]
1139 [[o_userSelections objectForKey:@"pathToStrm"]
1141 componentsSeparatedByString: @"."]
1146 tempString = [NSString stringWithFormat: @"%@%@.%@",
1147 [o_t7_fld_filePath stringValue],
1148 fileNameToUse, theEncapFormat];
1149 if ([[NSFileManager defaultManager] fileExistsAtPath:
1152 /* we don't wanna overwrite existing files, so add an
1153 * int to the file-name */
1154 int additionalInt = 1;
1155 while( additionalInt < 100)
1157 tempString = [NSString stringWithFormat:@"%@%@ %i.%@",
1158 [o_t7_fld_filePath stringValue],
1159 fileNameToUse, additionalInt, theEncapFormat];
1160 if(! [[NSFileManager defaultManager]
1161 fileExistsAtPath: tempString])
1165 if (additionalInt >= 100)
1166 msg_Err( VLCIntf, "Files with the same name are "
1167 "already present in the destination directory. "
1168 "Delete these files or choose a different directory.");
1170 [tempArray addObject: [tempString retain]];
1173 [o_userSelections setObject: [NSArray arrayWithArray:tempArray]
1174 forKey: @"trnscdFilePath"];
1175 [tempArray release];
1176 [tempString release];
1180 /* we don't need to check for existing items because Cocoa
1181 * does that already when we are asking the user for a location
1182 * to save her file */
1183 [o_userSelections setObject: [NSArray arrayWithObject:
1184 [o_t7_fld_filePath stringValue]] forKey: @"trnscdFilePath"];
1187 /* include subtitles ? */
1188 [o_userSelections setObject:
1189 [[NSNumber numberWithInt:[o_t7_ckb_soverlay state]] stringValue]
1190 forKey: @"soverlay"];
1192 /* go to "Summary" */
1196 else if ([selectedTabViewItemLabel isEqualToString: @"Summary"])
1198 intf_thread_t * p_intf = VLCIntf;
1200 playlist_t * p_playlist = pl_Get( p_intf);
1203 int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
1206 /* we need a temp. variable here to work-around a GCC4-bug */
1207 NSString *tempString = [NSString stringWithFormat:
1208 @"%@ (%i/%i)", _NS("Streaming/Transcoding Wizard"),
1210 input_item_t *p_input = input_item_New(
1211 [[[o_userSelections objectForKey:@"pathToStrm"]
1212 objectAtIndex:x] UTF8String],
1213 [tempString UTF8String]);
1215 /* use the MRL from the text field, in case the user
1217 input_item_AddOption( p_input, [[o_t8_fld_mrl stringValue] UTF8String], VLC_INPUT_OPTION_TRUSTED);
1219 if(! [[o_userSelections objectForKey:@"partExtractFrom"]
1220 isEqualToString:@""]) {
1221 NSArray * components = [[o_userSelections objectForKey: @"partExtractFrom"] componentsSeparatedByString:@":"];
1222 NSUInteger componentCount = [components count];
1223 NSUInteger time = 0;
1224 if (componentCount == 1)
1225 time = 1000000 * ([[components objectAtIndex:0] intValue]);
1226 else if (componentCount == 2)
1227 time = 1000000 * ([[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue]);
1228 else if (componentCount == 3)
1229 time = 1000000 * ([[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue]);
1231 msg_Err(VLCIntf, "Invalid string format for time");
1232 input_item_AddOption(p_input, [[NSString stringWithFormat: @"start-time=%lu", time] UTF8String], VLC_INPUT_OPTION_TRUSTED);
1235 if(! [[o_userSelections objectForKey:@"partExtractTo"]
1236 isEqualToString:@""]) {
1237 NSArray * components = [[o_userSelections objectForKey: @"partExtractTo"] componentsSeparatedByString:@":"];
1238 NSUInteger componentCount = [components count];
1239 NSUInteger time = 0;
1240 if (componentCount == 1)
1241 time = 1000000 * ([[components objectAtIndex:0] intValue]);
1242 else if (componentCount == 2)
1243 time = 1000000 * ([[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue]);
1244 else if (componentCount == 3)
1245 time = 1000000 * ([[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue]);
1247 msg_Err(VLCIntf, "Invalid string format for time");
1248 input_item_AddOption(p_input, [[NSString stringWithFormat: @"stop-time=%lu", time] UTF8String], VLC_INPUT_OPTION_TRUSTED);
1251 input_item_AddOption( p_input, [[NSString stringWithFormat:
1252 @"ttl=%@", [o_userSelections objectForKey:@"ttl"]]
1254 VLC_INPUT_OPTION_TRUSTED);
1256 int returnValue = playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked);
1258 if (x == 0 && returnValue != VLC_SUCCESS)
1260 /* play the first item and add the others afterwards */
1262 playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input);
1263 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
1268 vlc_gc_decref( p_input);
1272 /* close the window, since we are done */
1273 [o_wizard_window close];
1277 - (void)rebuildCodecMenus
1279 int savePreviousSel = 0;
1280 savePreviousSel = [o_t4_pop_videoCodec indexOfSelectedItem];
1281 [o_t4_pop_videoCodec removeAllItems];
1282 NSUInteger count = [o_videoCodecs count];
1283 for (NSUInteger x = 0; x < count; x++)
1285 [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x]
1287 [[o_t4_pop_videoCodec lastItem] setTag:x];
1289 if (savePreviousSel >= 0)
1290 [o_t4_pop_videoCodec selectItemAtIndex: savePreviousSel];
1292 savePreviousSel = [o_t4_pop_audioCodec indexOfSelectedItem];
1293 [o_t4_pop_audioCodec removeAllItems];
1294 count = [o_audioCodecs count];
1295 for (NSUInteger x = 0; x < count; x++)
1297 [o_t4_pop_audioCodec addItemWithTitle:[[o_audioCodecs objectAtIndex:x]
1299 [[o_t4_pop_audioCodec lastItem] setTag:x];
1301 if (savePreviousSel >= 0)
1302 [o_t4_pop_audioCodec selectItemAtIndex: savePreviousSel];
1307 [o_btn_forward setTitle: _NS("Finish")];
1308 /* if we will transcode multiple items, just give their number; otherwise
1309 * print the URI of the single item */
1310 if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
1311 [o_t8_fld_inptStream setStringValue: [NSString stringWithFormat:
1313 [[o_userSelections objectForKey:@"pathToStrm"] count]]];
1315 [o_t8_fld_inptStream setStringValue:
1316 [[o_userSelections objectForKey:@"pathToStrm"] objectAtIndex: 0]];
1318 if ([[o_userSelections objectForKey:@"localPb"] isEqualToString: @"YES"])
1320 [o_t8_fld_local setStringValue: _NS("yes")];
1322 [o_t8_fld_local setStringValue: _NS("no")];
1325 if ([[o_userSelections objectForKey:@"partExtract"] isEqualToString: @"YES"])
1327 [o_t8_fld_partExtract setStringValue: [NSString stringWithFormat:
1328 _NS("yes: from %@ to %@"),
1329 [o_userSelections objectForKey:@"partExtractFrom"],
1330 [o_userSelections objectForKey:@"partExtractTo"]]];
1332 [o_t8_fld_partExtract setStringValue: _NS("no")];
1335 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
1337 [o_t8_fld_trnscdVideo setStringValue: [NSString stringWithFormat:
1338 _NS("yes: %@ @ %@ kb/s"),
1339 [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
1340 @"trnscdVideoCodec"] intValue]] objectAtIndex:0],
1341 [o_userSelections objectForKey:@"trnscdVideoBitrate"]]];
1345 [o_t8_fld_trnscdVideo setStringValue: _NS("no")];
1348 if ([[o_userSelections objectForKey:@"soverlay"] isEqualToString:@"1"])
1349 [o_t8_fld_soverlay setStringValue: _NS("yes")];
1351 [o_t8_fld_soverlay setStringValue: _NS("no")];
1353 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
1355 [o_t8_fld_trnscdAudio setStringValue: [NSString stringWithFormat:
1356 _NS("yes: %@ @ %@ kb/s"),
1357 [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
1358 @"trnscdAudioCodec"] intValue]] objectAtIndex:0],
1359 [o_userSelections objectForKey:@"trnscdAudioBitrate"]]];
1363 [o_t8_fld_trnscdAudio setStringValue: _NS("no")];
1366 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1368 /* we are streaming and perhaps also transcoding */
1369 [o_t8_fld_saveFileTo setStringValue: @"-"];
1370 [o_t8_fld_strmgMthd setStringValue: [[o_strmgMthds objectAtIndex:
1371 [[o_userSelections objectForKey:@"stmgMhd"] intValue]]
1373 [o_t8_fld_destination setStringValue: [o_userSelections objectForKey:
1375 [o_t8_fld_ttl setStringValue: [o_userSelections objectForKey:@"ttl"]];
1376 if ([[o_userSelections objectForKey:@"sap"] isEqualToString: @"YES"])
1378 [o_t8_fld_sap setStringValue:
1379 [_NS("yes") stringByAppendingFormat: @": \"%@\"",
1380 [o_userSelections objectForKey:@"sapText"]]];
1382 [o_t8_fld_sap setStringValue: _NS("no")];
1385 /* we are transcoding */
1386 [o_t8_fld_strmgMthd setStringValue: @"-"];
1387 [o_t8_fld_destination setStringValue: @"-"];
1388 [o_t8_fld_ttl setStringValue: @"-"];
1389 [o_t8_fld_sap setStringValue: @"-"];
1390 /* do only show the destination of the first item and add a counter, if needed */
1391 if ([[o_userSelections objectForKey: @"trnscdFilePath"] count] > 1)
1392 [o_t8_fld_saveFileTo setStringValue:
1393 [NSString stringWithFormat: @"%@ (+%li)",
1394 [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex:0],
1395 ([[o_userSelections objectForKey: @"trnscdFilePath"] count] - 1)]];
1397 [o_t8_fld_saveFileTo setStringValue:
1398 [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex:0]];
1400 [o_t8_fld_encapFormat setStringValue: [[o_encapFormats objectAtIndex:
1401 [[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:1]];
1404 [o_t8_fld_mrl setStringValue: [[o_userSelections objectForKey:@"opts"]
1407 [o_tab_pageHolder selectTabViewItemAtIndex:7];
1412 NSMutableString * o_opts_string = [NSMutableString stringWithString:@""];
1413 NSMutableString *o_trnscdCmd = [NSMutableString stringWithString:@""];
1414 NSMutableString *o_duplicateCmd = [NSMutableString stringWithString:@""];
1416 int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
1417 NSMutableArray * tempArray = [[NSMutableArray alloc] init];
1419 /* loop to create an opt-string for each item we're processing */
1422 /* check whether we transcode the audio and/or the video and compose a
1423 * string reflecting the settings, if needed */
1424 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
1426 [o_trnscdCmd appendString: @"transcode{"];
1427 [o_trnscdCmd appendFormat: @"vcodec=%@,vb=%i",
1428 [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] objectAtIndex:1],
1429 [[o_userSelections objectForKey:@"trnscdVideoBitrate"] intValue]];
1430 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
1432 [o_trnscdCmd appendString: @","];
1436 [o_trnscdCmd appendString: @"}:"];
1440 /* check whether the user requested local playback. if yes, prepare the
1441 * string, if not, let it empty */
1442 if ([[o_userSelections objectForKey:@"localPb"] isEqualToString:@"YES"])
1444 [o_duplicateCmd appendString: @"duplicate{dst=display,dst=\""];
1447 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
1449 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"NO"])
1451 /* in case we transcode the audio only, add this */
1452 [o_trnscdCmd appendString: @"transcode{"];
1454 [o_trnscdCmd appendFormat: @"acodec=%@,ab=%i}:",
1455 [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] objectAtIndex:1],
1456 [[o_userSelections objectForKey:@"trnscdAudioBitrate"] intValue]];
1459 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"trnscd"])
1461 /* we are just transcoding and dumping the stuff to a file */
1462 [o_opts_string appendFormat:
1463 @":sout=#%@%@standard{mux=%@,dst=%@,access=file}",
1466 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0],
1467 [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex: x]];
1472 /* we are streaming */
1473 if ([[o_userSelections objectForKey:@"sap"] isEqualToString:@"YES"])
1475 /* SAP-Announcement is requested */
1476 NSMutableString *o_sap_option = [NSMutableString stringWithString:@""];
1477 if([[o_userSelections objectForKey:@"sapText"] isEqualToString:@""])
1479 [o_sap_option appendString: @"sap"];
1483 [o_sap_option appendFormat: @"sap,name=\"%@\"",
1484 [o_userSelections objectForKey:@"sapText"]];
1486 if ([[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp")
1488 /* RTP is no access out, but a stream out module */
1489 [o_opts_string appendFormat:
1490 @":sout=#%@%@rtp{mux=%@,dst=%@,%@}",
1491 o_duplicateCmd, o_trnscdCmd,
1492 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1493 [o_userSelections objectForKey: @"stmgDest"],
1498 [o_opts_string appendFormat:
1499 @":sout=#%@%@standard{mux=%@,dst=%@,access=%@,%@}",
1500 o_duplicateCmd, o_trnscdCmd,
1501 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1502 [o_userSelections objectForKey: @"stmgDest"],
1503 [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0],
1509 /* no SAP, just streaming */
1510 if ([[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp")
1512 /* RTP is different from the other protocols, as it isn't provided through an access out module anymore */
1513 [o_opts_string appendFormat:
1514 @":sout=#%@%@rtp{mux=%@,dst=%@}",
1517 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1518 [o_userSelections objectForKey: @"stmgDest"]];
1522 /* all other protocols are cool */
1523 [o_opts_string appendFormat:
1524 @":sout=#%@%@standard{mux=%@,dst=%@,access=%@}",
1527 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1528 [o_userSelections objectForKey: @"stmgDest"],
1529 [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0]];
1534 /* check whether the user requested local playback. if yes, close the
1535 * string with an additional bracket */
1536 if ([[o_userSelections objectForKey:@"localPb"] isEqualToString:@"YES"])
1538 [o_opts_string appendString: @"\"}"];
1541 /* add subtitles to the video if desired */
1542 if ([[o_userSelections objectForKey:@"soverlay"] intValue] > 0)
1543 [o_opts_string appendString: @" --sout-transcode-soverlay"];
1545 [tempArray addObject: o_opts_string];
1547 o_opts_string = [NSMutableString stringWithString:@""];
1548 o_trnscdCmd = [NSMutableString stringWithString:@""];
1549 o_duplicateCmd = [NSMutableString stringWithString:@""];
1552 [o_userSelections setObject:[NSArray arrayWithArray: tempArray] forKey:@"opts"];
1553 [tempArray release];
1556 - (IBAction)prevTab:(id)sender
1558 NSString * selectedTabViewItemLabel = [[o_tab_pageHolder selectedTabViewItem] label];
1560 if ([selectedTabViewItemLabel isEqualToString: @"Summary"])
1562 /* check whether we are streaming or transcoding and go back */
1563 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1565 /* show "Streaming 2" */
1566 [o_tab_pageHolder selectTabViewItemAtIndex:5];
1568 /* show "Transcode 2" */
1569 [o_tab_pageHolder selectTabViewItemAtIndex:6];
1571 /* rename the forward-button */
1572 [o_btn_forward setTitle: _NS("Next")];
1574 else if ([selectedTabViewItemLabel isEqualToString: @"Transcode 2"])
1577 [o_tab_pageHolder selectTabViewItemAtIndex:4];
1579 else if ([selectedTabViewItemLabel isEqualToString: @"Streaming 2"])
1582 [o_tab_pageHolder selectTabViewItemAtIndex:4];
1584 else if ([selectedTabViewItemLabel isEqualToString: @"Encap"])
1586 /* show "Transcode 1" */
1587 [o_tab_pageHolder selectTabViewItemAtIndex:3];
1589 else if ([selectedTabViewItemLabel isEqualToString: @"Streaming 1"])
1592 [o_tab_pageHolder selectTabViewItemAtIndex:1];
1594 else if ([selectedTabViewItemLabel isEqualToString: @"Transcode 1"])
1596 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1598 /* show "Streaming 1" */
1599 [o_tab_pageHolder selectTabViewItemAtIndex:2];
1602 [o_tab_pageHolder selectTabViewItemAtIndex:1];
1605 else if ([selectedTabViewItemLabel isEqualToString: @"Input"])
1607 /* reset the wizard before going backwards. Otherwise, we might get
1608 * unwanted behaviour in the Encap-Selection */
1611 [o_tab_pageHolder selectTabViewItemAtIndex:0];
1612 /* disable backwards-btn */
1613 [o_btn_backward setEnabled:NO];
1617 - (IBAction)t1_mrInfo_streaming:(id)sender
1619 /* show a sheet for the help */
1620 NSBeginInformationalAlertSheet(_NS("Stream to network"),
1621 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1622 _NS("This allows streaming on a network."));
1625 - (IBAction)t1_mrInfo_transcode:(id)sender
1627 /* show a sheet for the help */
1628 NSBeginInformationalAlertSheet(_NS("Transcode/Save to file"),
1629 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1630 _NS("This allows saving a stream to a file. The "
1631 "can be reencoded on the fly. Whatever "
1632 "VLC can read can be saved.\nPlease note that VLC is not very suited "
1633 "for file to file transcoding. Its transcoding "
1634 "features are however useful to save network streams, for example."));
1637 - (IBAction)t2_addNewStream:(id)sender
1639 NSOpenPanel * openPanel = [NSOpenPanel openPanel];
1640 SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
1641 [openPanel beginSheetModalForWindow: o_wizard_window completionHandler: ^(NSInteger returnCode) {
1642 if (returnCode == NSOKButton)
1643 [o_t2_fld_pathToNewStrm setStringValue: [[openPanel URL] absoluteString]];
1647 - (IBAction)t2_chooseStreamOrPlst:(id)sender
1649 /* enable and disable the respective items depending on user's choice */
1651 o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
1653 if ([o_mode isEqualToString: _NS("Select a stream")])
1655 [o_t2_btn_chooseFile setEnabled:YES];
1656 [o_t2_fld_pathToNewStrm setEnabled:YES];
1657 [o_t2_tbl_plst setEnabled:NO];
1659 [o_t2_btn_chooseFile setEnabled:NO];
1660 [o_t2_fld_pathToNewStrm setEnabled:NO];
1661 [o_t2_tbl_plst setEnabled:YES];
1665 - (IBAction)t2_enableExtract:(id)sender
1667 /* enable/disable the respective items */
1668 if([o_t2_ckb_enblPartExtrct state] == NSOnState)
1670 [o_t2_fld_prtExtrctFrom setEnabled:YES];
1671 [o_t2_fld_prtExtrctTo setEnabled:YES];
1673 [o_t2_fld_prtExtrctFrom setEnabled:NO];
1674 [o_t2_fld_prtExtrctTo setEnabled:NO];
1675 [o_t2_fld_prtExtrctFrom setStringValue:@""];
1676 [o_t2_fld_prtExtrctTo setStringValue:@""];
1680 - (IBAction)t3_strmMthdChanged:(id)sender
1682 /* change the captions of o_t3_txt_destInfo according to the chosen
1683 * streaming method */
1685 mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
1689 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:0]
1691 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:0]
1697 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:1]
1699 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:1]
1705 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:2]
1707 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:2]
1713 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:3]
1715 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:3]
1721 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:4]
1723 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:4]
1729 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:5]
1731 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:5]
1736 - (IBAction)t4_AudCdcChanged:(id)sender
1738 /* update codec info */
1739 [o_t4_txt_hintAudio setStringValue:[[o_audioCodecs objectAtIndex:
1740 [[o_t4_pop_audioCodec selectedItem]tag]] objectAtIndex:2]];
1743 - (IBAction)t4_enblAudTrnscd:(id)sender
1745 /* enable/disable the respective items */
1746 if([o_t4_ckb_audio state] == NSOnState)
1748 [o_t4_pop_audioCodec setEnabled:YES];
1749 [o_t4_pop_audioBitrate setEnabled:YES];
1750 [o_t4_txt_hintAudio setStringValue: _NS("Select your audio codec. "
1751 "Click one to get more information.")];
1753 [o_t4_pop_audioCodec setEnabled:NO];
1754 [o_t4_pop_audioBitrate setEnabled:NO];
1755 [o_t4_txt_hintAudio setStringValue: _NS("Enabling this allows transcoding "
1756 "the audio track if one is present in the stream.")];
1760 - (IBAction)t4_enblVidTrnscd:(id)sender
1762 /* enable/disable the respective items */
1763 if([o_t4_ckb_video state] == NSOnState)
1765 [o_t4_pop_videoCodec setEnabled:YES];
1766 [o_t4_pop_videoBitrate setEnabled:YES];
1767 [o_t4_txt_hintVideo setStringValue: _NS("Select your video codec. "\
1768 "Click one to get more information.")];
1770 [o_t4_pop_videoCodec setEnabled:NO];
1771 [o_t4_pop_videoBitrate setEnabled:NO];
1772 [o_t4_txt_hintVideo setStringValue: _NS("Enabling this allows transcoding "
1773 "the video track if one is present in the stream.")];
1778 - (IBAction)t4_VidCdcChanged:(id)sender
1780 /* update codec info */
1781 [o_t4_txt_hintVideo setStringValue:[[o_videoCodecs objectAtIndex:
1782 [[o_t4_pop_videoCodec selectedItem]tag]] objectAtIndex:2]];
1785 - (IBAction)t6_enblSapAnnce:(id)sender
1787 /* enable/disable input fld */
1788 if([o_t6_ckb_sap state] == NSOnState)
1790 [o_t6_fld_sap setEnabled:YES];
1792 [o_t6_fld_sap setEnabled:NO];
1793 [o_t6_fld_sap setStringValue:@""];
1797 - (IBAction)t6_mrInfo_ttl:(id)sender
1799 /* show a sheet for the help */
1800 NSBeginInformationalAlertSheet(_NS("Time-To-Live (TTL)"),
1801 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1802 _NS("This allows defining the TTL (Time-To-Live) of the stream. "
1803 "This parameter is the maximum number of routers your stream can "
1804 "go through. If you don't know what it means, or if you want to "
1805 "stream on your local network only, leave this setting to 1."));
1808 - (IBAction)t6_mrInfo_sap:(id)sender
1810 /* show a sheet for the help */
1811 NSBeginInformationalAlertSheet(_NS("SAP Announce"),
1812 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1813 _NS("When streaming using UDP, the streams can be "
1814 "announced using the SAP/SDP announcing protocol. This "
1815 "way, the clients won't have to type in the multicast address, it "
1816 "will appear in their playlist if they enable the SAP extra "
1817 "interface.\nIf you want to give a name to your stream, enter it "
1818 "here, else, a default name will be used."));
1821 - (IBAction)t67_mrInfo_local:(id)sender
1823 /* show a sheet for the help */
1824 NSBeginInformationalAlertSheet(_NS("Local playback"),
1825 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1826 _NS("When this option is enabled, the stream will be both played "
1827 "and transcoded/streamed.\n\nNote that this requires much more "
1828 "CPU power than simple transcoding or streaming."));
1831 - (IBAction)t7_selectTrnscdDestFile:(id)sender
1833 /* provide a save-to-dialogue, so the user can choose a location for
1834 * his/her new file. We take a modified NSOpenPanel to select a folder
1835 * and a plain NSSavePanel to save a single file. */
1837 if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
1839 NSOpenPanel * saveFolderPanel = [[NSOpenPanel alloc] init];
1841 [saveFolderPanel setCanChooseDirectories: YES];
1842 [saveFolderPanel setCanChooseFiles: NO];
1843 [saveFolderPanel setCanSelectHiddenExtension: NO];
1844 [saveFolderPanel setCanCreateDirectories: YES];
1845 [saveFolderPanel beginSheetModalForWindow: o_wizard_window completionHandler:^(NSInteger returnCode) {
1846 if (returnCode == NSOKButton)
1847 [o_t7_fld_filePath setStringValue: [NSString stringWithFormat: @"%@/", [[saveFolderPanel URL] path]]];
1849 [saveFolderPanel release];
1853 NSSavePanel * saveFilePanel = [[NSSavePanel alloc] init];
1855 /* don't use ".ps" as suffix, since the OSX Finder confuses our
1856 * creations with PostScript-files and wants to open them with
1858 NSString * theEncapFormat = [[o_encapFormats objectAtIndex:
1859 [[o_userSelections objectForKey:@"encapFormat"] intValue]]
1861 if (theEncapFormat != @"ps")
1862 [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:theEncapFormat]];
1864 [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:@"mpg"]];
1866 [saveFilePanel setCanSelectHiddenExtension: YES];
1867 [saveFilePanel setCanCreateDirectories: YES];
1868 [saveFilePanel beginSheetModalForWindow: o_wizard_window completionHandler:^(NSInteger returnCode) {
1869 if (returnCode == NSOKButton)
1870 [o_t7_fld_filePath setStringValue:[[saveFilePanel URL] path]];
1872 [saveFilePanel release];