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];
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 impossibleto 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:@""] )
1222 input_item_AddOption( p_input, [[NSString
1223 stringWithFormat: @"start-time=%@", [o_userSelections
1224 objectForKey: @"partExtractFrom"]] UTF8String],
1225 VLC_INPUT_OPTION_TRUSTED );
1228 if(! [[o_userSelections objectForKey:@"partExtractTo"]
1229 isEqualToString:@""] )
1231 input_item_AddOption( p_input, [[NSString
1232 stringWithFormat: @"stop-time=%@", [o_userSelections
1233 objectForKey: @"partExtractTo"]] UTF8String],
1234 VLC_INPUT_OPTION_TRUSTED );
1237 input_item_AddOption( p_input, [[NSString stringWithFormat:
1238 @"ttl=%@", [o_userSelections objectForKey:@"ttl"]]
1240 VLC_INPUT_OPTION_TRUSTED );
1242 /* FIXME: playlist_AddInput() can fail */
1243 playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP,
1244 PLAYLIST_END, true, pl_Unlocked );
1248 /* play the first item and add the others afterwards */
1250 playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
1251 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
1256 vlc_gc_decref( p_input );
1260 /* close the window, since we are done */
1261 [o_wizard_window close];
1265 - (void)rebuildCodecMenus
1267 int savePreviousSel = 0;
1268 savePreviousSel = [o_t4_pop_videoCodec indexOfSelectedItem];
1269 [o_t4_pop_videoCodec removeAllItems];
1270 NSUInteger count = [o_videoCodecs count];
1271 for (NSUInteger x = 0; x < count; x++ )
1273 [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x]
1275 [[o_t4_pop_videoCodec lastItem] setTag:x];
1277 if( savePreviousSel >= 0 )
1278 [o_t4_pop_videoCodec selectItemAtIndex: savePreviousSel];
1280 savePreviousSel = [o_t4_pop_audioCodec indexOfSelectedItem];
1281 [o_t4_pop_audioCodec removeAllItems];
1282 count = [o_audioCodecs count];
1283 for (NSUInteger x = 0; x < count; x++)
1285 [o_t4_pop_audioCodec addItemWithTitle:[[o_audioCodecs objectAtIndex:x]
1287 [[o_t4_pop_audioCodec lastItem] setTag:x];
1289 if( savePreviousSel >= 0 )
1290 [o_t4_pop_audioCodec selectItemAtIndex: savePreviousSel];
1295 [o_btn_forward setTitle: _NS("Finish")];
1296 /* if we will transcode multiple items, just give their number; otherwise
1297 * print the URI of the single item */
1298 if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
1299 [o_t8_fld_inptStream setStringValue: [NSString stringWithFormat:
1301 [[o_userSelections objectForKey:@"pathToStrm"] count]]];
1303 [o_t8_fld_inptStream setStringValue:
1304 [[o_userSelections objectForKey:@"pathToStrm"] objectAtIndex: 0]];
1306 if ([[o_userSelections objectForKey:@"localPb"] isEqualToString: @"YES"])
1308 [o_t8_fld_local setStringValue: _NS("yes")];
1310 [o_t8_fld_local setStringValue: _NS("no")];
1313 if ([[o_userSelections objectForKey:@"partExtract"] isEqualToString: @"YES"])
1315 [o_t8_fld_partExtract setStringValue: [NSString stringWithFormat:
1316 _NS("yes: from %@ to %@ secs"),
1317 [o_userSelections objectForKey:@"partExtractFrom"],
1318 [o_userSelections objectForKey:@"partExtractTo"]]];
1320 [o_t8_fld_partExtract setStringValue: _NS("no")];
1323 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
1325 [o_t8_fld_trnscdVideo setStringValue: [NSString stringWithFormat:
1326 _NS("yes: %@ @ %@ kb/s"),
1327 [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
1328 @"trnscdVideoCodec"] intValue]] objectAtIndex:0],
1329 [o_userSelections objectForKey:@"trnscdVideoBitrate"]]];
1333 [o_t8_fld_trnscdVideo setStringValue: _NS("no")];
1336 if ([[o_userSelections objectForKey:@"soverlay"] isEqualToString:@"1"])
1337 [o_t8_fld_soverlay setStringValue: _NS("yes")];
1339 [o_t8_fld_soverlay setStringValue: _NS("no")];
1341 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
1343 [o_t8_fld_trnscdAudio setStringValue: [NSString stringWithFormat:
1344 _NS("yes: %@ @ %@ kb/s"),
1345 [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
1346 @"trnscdAudioCodec"] intValue]] objectAtIndex:0],
1347 [o_userSelections objectForKey:@"trnscdAudioBitrate"]]];
1351 [o_t8_fld_trnscdAudio setStringValue: _NS("no")];
1354 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1356 /* we are streaming and perhaps also transcoding */
1357 [o_t8_fld_saveFileTo setStringValue: @"-"];
1358 [o_t8_fld_strmgMthd setStringValue: [[o_strmgMthds objectAtIndex:
1359 [[o_userSelections objectForKey:@"stmgMhd"] intValue]]
1361 [o_t8_fld_destination setStringValue: [o_userSelections objectForKey:
1363 [o_t8_fld_ttl setStringValue: [o_userSelections objectForKey:@"ttl"]];
1364 if ([[o_userSelections objectForKey:@"sap"] isEqualToString: @"YES"])
1366 [o_t8_fld_sap setStringValue:
1367 [_NS("yes") stringByAppendingFormat: @": \"%@\"",
1368 [o_userSelections objectForKey:@"sapText"]]];
1370 [o_t8_fld_sap setStringValue: _NS("no")];
1373 /* we are transcoding */
1374 [o_t8_fld_strmgMthd setStringValue: @"-"];
1375 [o_t8_fld_destination setStringValue: @"-"];
1376 [o_t8_fld_ttl setStringValue: @"-"];
1377 [o_t8_fld_sap setStringValue: @"-"];
1378 /* do only show the destination of the first item and add a counter, if needed */
1379 if( [[o_userSelections objectForKey: @"trnscdFilePath"] count] > 1 )
1380 [o_t8_fld_saveFileTo setStringValue:
1381 [NSString stringWithFormat: @"%@ (+%li)",
1382 [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex:0],
1383 ([[o_userSelections objectForKey: @"trnscdFilePath"] count] - 1)]];
1385 [o_t8_fld_saveFileTo setStringValue:
1386 [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex:0]];
1388 [o_t8_fld_encapFormat setStringValue: [[o_encapFormats objectAtIndex:
1389 [[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:1]];
1392 [o_t8_fld_mrl setStringValue: [[o_userSelections objectForKey:@"opts"]
1395 [o_tab_pageHolder selectTabViewItemAtIndex:7];
1400 NSMutableString * o_opts_string = [NSMutableString stringWithString:@""];
1401 NSMutableString *o_trnscdCmd = [NSMutableString stringWithString:@""];
1402 NSMutableString *o_duplicateCmd = [NSMutableString stringWithString:@""];
1404 int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
1405 NSMutableArray * tempArray = [[NSMutableArray alloc] init];
1407 /* loop to create an opt-string for each item we're processing */
1410 /* check whether we transcode the audio and/or the video and compose a
1411 * string reflecting the settings, if needed */
1412 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
1414 [o_trnscdCmd appendString: @"transcode{"];
1415 [o_trnscdCmd appendFormat: @"vcodec=%@,vb=%i",
1416 [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] objectAtIndex:1],
1417 [[o_userSelections objectForKey:@"trnscdVideoBitrate"] intValue]];
1418 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
1420 [o_trnscdCmd appendString: @","];
1424 [o_trnscdCmd appendString: @"}:"];
1428 /* check whether the user requested local playback. if yes, prepare the
1429 * string, if not, let it empty */
1430 if ([[o_userSelections objectForKey:@"localPb"] isEqualToString:@"YES"])
1432 [o_duplicateCmd appendString: @"duplicate{dst=display,dst=\""];
1435 if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
1437 if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"NO"])
1439 /* in case we transcode the audio only, add this */
1440 [o_trnscdCmd appendString: @"transcode{"];
1442 [o_trnscdCmd appendFormat: @"acodec=%@,ab=%i}:",
1443 [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] objectAtIndex:1],
1444 [[o_userSelections objectForKey:@"trnscdAudioBitrate"] intValue]];
1447 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"trnscd"])
1449 /* we are just transcoding and dumping the stuff to a file */
1450 [o_opts_string appendFormat:
1451 @":sout=#%@%@standard{mux=%@,dst=%@,access=file}",
1454 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0],
1455 [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex: x]];
1460 /* we are streaming */
1461 if ([[o_userSelections objectForKey:@"sap"] isEqualToString:@"YES"])
1463 /* SAP-Announcement is requested */
1464 NSMutableString *o_sap_option = [NSMutableString stringWithString:@""];
1465 if([[o_userSelections objectForKey:@"sapText"] isEqualToString:@""])
1467 [o_sap_option appendString: @"sap"];
1471 [o_sap_option appendFormat: @"sap,name=\"%@\"",
1472 [o_userSelections objectForKey:@"sapText"]];
1474 if( [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp" )
1476 /* RTP is no access out, but a stream out module */
1477 [o_opts_string appendFormat:
1478 @":sout=#%@%@rtp{mux=%@,dst=%@,%@}",
1479 o_duplicateCmd, o_trnscdCmd,
1480 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1481 [o_userSelections objectForKey: @"stmgDest"],
1486 [o_opts_string appendFormat:
1487 @":sout=#%@%@standard{mux=%@,dst=%@,access=%@,%@}",
1488 o_duplicateCmd, o_trnscdCmd,
1489 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1490 [o_userSelections objectForKey: @"stmgDest"],
1491 [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0],
1497 /* no SAP, just streaming */
1498 if( [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp" )
1500 /* RTP is different from the other protocols, as it isn't provided through an access out module anymore */
1501 [o_opts_string appendFormat:
1502 @":sout=#%@%@rtp{mux=%@,dst=%@}",
1505 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1506 [o_userSelections objectForKey: @"stmgDest"]];
1510 /* all other protocols are cool */
1511 [o_opts_string appendFormat:
1512 @":sout=#%@%@standard{mux=%@,dst=%@,access=%@}",
1515 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1516 [o_userSelections objectForKey: @"stmgDest"],
1517 [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0]];
1522 /* check whether the user requested local playback. if yes, close the
1523 * string with an additional bracket */
1524 if ([[o_userSelections objectForKey:@"localPb"] isEqualToString:@"YES"])
1526 [o_opts_string appendString: @"\"}"];
1529 /* add subtitles to the video if desired */
1530 if ([[o_userSelections objectForKey:@"soverlay"] intValue] > 0)
1531 [o_opts_string appendString: @" --sout-transcode-soverlay"];
1533 [tempArray addObject: o_opts_string];
1535 o_opts_string = [NSMutableString stringWithString:@""];
1536 o_trnscdCmd = [NSMutableString stringWithString:@""];
1537 o_duplicateCmd = [NSMutableString stringWithString:@""];
1540 [o_userSelections setObject:[NSArray arrayWithArray: tempArray] forKey:@"opts"];
1541 [tempArray release];
1544 - (IBAction)prevTab:(id)sender
1546 NSString * selectedTabViewItemLabel = [[o_tab_pageHolder selectedTabViewItem] label];
1548 if ([selectedTabViewItemLabel isEqualToString: @"Summary"])
1550 /* check whether we are streaming or transcoding and go back */
1551 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1553 /* show "Streaming 2" */
1554 [o_tab_pageHolder selectTabViewItemAtIndex:5];
1556 /* show "Transcode 2" */
1557 [o_tab_pageHolder selectTabViewItemAtIndex:6];
1559 /* rename the forward-button */
1560 [o_btn_forward setTitle: _NS("Next")];
1562 else if ([selectedTabViewItemLabel isEqualToString: @"Transcode 2"])
1565 [o_tab_pageHolder selectTabViewItemAtIndex:4];
1567 else if ([selectedTabViewItemLabel isEqualToString: @"Streaming 2"])
1570 [o_tab_pageHolder selectTabViewItemAtIndex:4];
1572 else if ([selectedTabViewItemLabel isEqualToString: @"Encap"])
1574 /* show "Transcode 1" */
1575 [o_tab_pageHolder selectTabViewItemAtIndex:3];
1577 else if ([selectedTabViewItemLabel isEqualToString: @"Streaming 1"])
1580 [o_tab_pageHolder selectTabViewItemAtIndex:1];
1582 else if ([selectedTabViewItemLabel isEqualToString: @"Transcode 1"])
1584 if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1586 /* show "Streaming 1" */
1587 [o_tab_pageHolder selectTabViewItemAtIndex:2];
1590 [o_tab_pageHolder selectTabViewItemAtIndex:1];
1593 else if ([selectedTabViewItemLabel isEqualToString: @"Input"])
1595 /* reset the wizard before going backwards. Otherwise, we might get
1596 * unwanted behaviour in the Encap-Selection */
1599 [o_tab_pageHolder selectTabViewItemAtIndex:0];
1600 /* disable backwards-btn */
1601 [o_btn_backward setEnabled:NO];
1605 - (IBAction)t1_mrInfo_streaming:(id)sender
1607 /* show a sheet for the help */
1608 NSBeginInformationalAlertSheet(_NS("Stream to network"),
1609 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1610 _NS("This allows streaming on a network."));
1613 - (IBAction)t1_mrInfo_transcode:(id)sender
1615 /* show a sheet for the help */
1616 NSBeginInformationalAlertSheet(_NS("Transcode/Save to file"),
1617 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1618 _NS("This allows saving a stream to a file. The "
1619 "can be reencoded on the fly. Whatever "
1620 "VLC can read can be saved.\nPlease note that VLC is not very suited "
1621 "for file to file transcoding. Its transcoding "
1622 "features are however useful to save network streams, for example."));
1625 - (IBAction)t2_addNewStream:(id)sender
1627 NSOpenPanel * openPanel = [NSOpenPanel openPanel];
1628 SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
1629 [openPanel beginSheetForDirectory:nil file:nil types:nil modalForWindow:
1630 o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
1633 - (void)t2_getNewStreamFromDialog: (NSOpenPanel *)sheet
1634 returnCode: (int)returnCode
1635 contextInfo: (void *)contextInfo
1637 if (returnCode == NSOKButton)
1639 [o_t2_fld_pathToNewStrm setStringValue: [[sheet URL] absoluteString]];
1643 - (IBAction)t2_chooseStreamOrPlst:(id)sender
1645 /* enable and disable the respective items depending on user's choice */
1647 o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
1649 if( [o_mode isEqualToString: _NS("Select a stream")] )
1651 [o_t2_btn_chooseFile setEnabled:YES];
1652 [o_t2_fld_pathToNewStrm setEnabled:YES];
1653 [o_t2_tbl_plst setEnabled:NO];
1655 [o_t2_btn_chooseFile setEnabled:NO];
1656 [o_t2_fld_pathToNewStrm setEnabled:NO];
1657 [o_t2_tbl_plst setEnabled:YES];
1661 - (IBAction)t2_enableExtract:(id)sender
1663 /* enable/disable the respective items */
1664 if([o_t2_ckb_enblPartExtrct state] == NSOnState)
1666 [o_t2_fld_prtExtrctFrom setEnabled:YES];
1667 [o_t2_fld_prtExtrctTo setEnabled:YES];
1669 [o_t2_fld_prtExtrctFrom setEnabled:NO];
1670 [o_t2_fld_prtExtrctTo setEnabled:NO];
1671 [o_t2_fld_prtExtrctFrom setStringValue:@""];
1672 [o_t2_fld_prtExtrctTo setStringValue:@""];
1676 - (IBAction)t3_strmMthdChanged:(id)sender
1678 /* change the captions of o_t3_txt_destInfo according to the chosen
1679 * streaming method */
1681 mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
1685 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:0]
1687 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:0]
1690 else if( mode == 1 )
1693 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:1]
1695 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:1]
1698 else if( mode == 2 )
1701 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:2]
1703 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:2]
1706 else if( mode == 3 )
1709 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:3]
1711 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:3]
1714 else if( mode == 4 )
1717 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:4]
1719 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:4]
1722 else if( mode == 5 )
1725 [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:5]
1727 [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:5]
1732 - (IBAction)t4_AudCdcChanged:(id)sender
1734 /* update codec info */
1735 [o_t4_txt_hintAudio setStringValue:[[o_audioCodecs objectAtIndex:
1736 [[o_t4_pop_audioCodec selectedItem]tag]] objectAtIndex:2]];
1739 - (IBAction)t4_enblAudTrnscd:(id)sender
1741 /* enable/disable the respective items */
1742 if([o_t4_ckb_audio state] == NSOnState)
1744 [o_t4_pop_audioCodec setEnabled:YES];
1745 [o_t4_pop_audioBitrate setEnabled:YES];
1746 [o_t4_txt_hintAudio setStringValue: _NS("Select your audio codec. "
1747 "Click one to get more information.")];
1749 [o_t4_pop_audioCodec setEnabled:NO];
1750 [o_t4_pop_audioBitrate setEnabled:NO];
1751 [o_t4_txt_hintAudio setStringValue: _NS("Enabling this allows transcoding "
1752 "the audio track if one is present in the stream.")];
1756 - (IBAction)t4_enblVidTrnscd:(id)sender
1758 /* enable/disable the respective items */
1759 if([o_t4_ckb_video state] == NSOnState)
1761 [o_t4_pop_videoCodec setEnabled:YES];
1762 [o_t4_pop_videoBitrate setEnabled:YES];
1763 [o_t4_txt_hintVideo setStringValue: _NS("Select your video codec. "\
1764 "Click one to get more information.")];
1766 [o_t4_pop_videoCodec setEnabled:NO];
1767 [o_t4_pop_videoBitrate setEnabled:NO];
1768 [o_t4_txt_hintVideo setStringValue: _NS("Enabling this allows transcoding "
1769 "the video track if one is present in the stream.")];
1774 - (IBAction)t4_VidCdcChanged:(id)sender
1776 /* update codec info */
1777 [o_t4_txt_hintVideo setStringValue:[[o_videoCodecs objectAtIndex:
1778 [[o_t4_pop_videoCodec selectedItem]tag]] objectAtIndex:2]];
1781 - (IBAction)t6_enblSapAnnce:(id)sender
1783 /* enable/disable input fld */
1784 if([o_t6_ckb_sap state] == NSOnState)
1786 [o_t6_fld_sap setEnabled:YES];
1788 [o_t6_fld_sap setEnabled:NO];
1789 [o_t6_fld_sap setStringValue:@""];
1793 - (IBAction)t6_mrInfo_ttl:(id)sender
1795 /* show a sheet for the help */
1796 NSBeginInformationalAlertSheet(_NS("Time-To-Live (TTL)"),
1797 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1798 _NS("This allows defining the TTL (Time-To-Live) of the stream. "
1799 "This parameter is the maximum number of routers your stream can "
1800 "go through. If you don't know what it means, or if you want to "
1801 "stream on your local network only, leave this setting to 1."));
1804 - (IBAction)t6_mrInfo_sap:(id)sender
1806 /* show a sheet for the help */
1807 NSBeginInformationalAlertSheet(_NS("SAP Announce"),
1808 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1809 _NS("When streaming using UDP, the streams can be "
1810 "announced using the SAP/SDP announcing protocol. This "
1811 "way, the clients won't have to type in the multicast address, it "
1812 "will appear in their playlist if they enable the SAP extra "
1813 "interface.\nIf you want to give a name to your stream, enter it "
1814 "here, else, a default name will be used."));
1817 - (IBAction)t67_mrInfo_local:(id)sender
1819 /* show a sheet for the help */
1820 NSBeginInformationalAlertSheet(_NS("Local playback"),
1821 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1822 _NS("When this option is enabled, the stream will be both played "
1823 "and transcoded/streamed.\n\nNote that this requires much more "
1824 "CPU power than simple transcoding or streaming."));
1827 - (IBAction)t7_selectTrnscdDestFile:(id)sender
1829 /* provide a save-to-dialogue, so the user can choose a location for
1830 * his/her new file. We take a modified NSOpenPanel to select a folder
1831 * and a plain NSSavePanel to save a single file. */
1833 SEL sel = @selector(t7_getTrnscdDestFile:returnCode:contextInfo:);
1835 if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
1837 NSOpenPanel * saveFolderPanel = [[NSOpenPanel alloc] init];
1839 [saveFolderPanel setCanChooseDirectories: YES];
1840 [saveFolderPanel setCanChooseFiles: NO];
1841 [saveFolderPanel setCanSelectHiddenExtension: NO];
1842 [saveFolderPanel setCanCreateDirectories: YES];
1843 [saveFolderPanel beginSheetForDirectory:nil file:nil modalForWindow:
1844 o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
1848 NSSavePanel * saveFilePanel = [[NSSavePanel alloc] init];
1850 /* don't use ".ps" as suffix, since the OSX Finder confuses our
1851 * creations with PostScript-files and wants to open them with
1853 NSString * theEncapFormat = [[o_encapFormats objectAtIndex:
1854 [[o_userSelections objectForKey:@"encapFormat"] intValue]]
1856 if( theEncapFormat != @"ps" )
1857 [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:theEncapFormat]];
1859 [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:@"mpg"]];
1861 [saveFilePanel setCanSelectHiddenExtension: YES];
1862 [saveFilePanel setCanCreateDirectories: YES];
1863 [saveFilePanel beginSheetForDirectory:nil file:nil modalForWindow:
1864 o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
1868 - (void)t7_getTrnscdDestFile: (NSOpenPanel *)sheet returnCode:
1869 (int)returnCode contextInfo: (void *)contextInfo
1871 if (returnCode == NSOKButton)
1873 /* output returned path to text-field, add a / to the end if the user
1874 * selected a folder */
1875 if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
1876 [o_t7_fld_filePath setStringValue: [NSString stringWithFormat:
1877 @"%@/", [[sheet URL] path]]];
1879 [o_t7_fld_filePath setStringValue:[[sheet URL] path]];