]> git.sesse.net Git - vlc/blob - modules/gui/macosx/wizard.m
* Implements selection of a playlist item in the wizard
[vlc] / modules / gui / macosx / wizard.m
1 /*****************************************************************************
2  * wizard.m: MacOS X Streaming Wizard
3  *****************************************************************************
4  * Copyright (C) 2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Felix Kühne <fkuehne@users.sf.net>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24
25 /*****************************************************************************
26  * Note: this code is partially based upon ../wxwindows/wizard.cpp and
27  *         ../wxwindows/streamdata.h; both written by Clément Stenac.
28  *****************************************************************************/
29
30 /* TODO:
31     - fill the playlist-table on t2
32     - see FIXME's
33 */
34
35
36 /*****************************************************************************
37  * Preamble
38  *****************************************************************************/
39 #import "wizard.h"
40 #import "intf.h"
41 #import "network.h"
42 #import "playlist.h"
43
44 /*****************************************************************************
45  * VLCWizard implementation
46  *****************************************************************************/
47
48 @implementation VLCWizard
49
50 static VLCWizard *_o_sharedInstance = nil;
51
52 + (VLCWizard *)sharedInstance
53 {
54     return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
55 }
56
57 - (id)init
58 {
59     if (_o_sharedInstance) {
60         [self dealloc];
61     } else {
62         _o_sharedInstance = [super init];
63     }
64
65     return _o_sharedInstance;
66 }
67
68 - (void)dealloc
69 {
70     [o_userSelections release];
71     [o_videoCodecs release];
72     [o_audioCodecs release];
73     [o_encapFormats release];
74     [super dealloc];
75 }
76
77 - (void)awakeFromNib
78 {
79     /* some minor cleanup */
80     [o_t2_tbl_plst setEnabled:NO];
81     [o_wizardhelp_window setExcludedFromWindowsMenu:YES];
82     o_userSelections = [[NSMutableDictionary alloc] init];
83     [o_btn_backward setEnabled:NO];
84
85     /* add audio-bitrates for transcoding */
86     NSArray * audioBitratesArray;
87     audioBitratesArray = [NSArray arrayWithObjects: @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
88     [o_t4_pop_audioBitrate removeAllItems];
89     [o_t4_pop_audioBitrate addItemsWithTitles: audioBitratesArray];
90     [o_t4_pop_audioBitrate selectItemWithTitle: @"192"];
91
92     /* add video-bitrates for transcoding */
93     NSArray * videoBitratesArray;
94     videoBitratesArray = [NSArray arrayWithObjects: @"3072", @"2048", @"1024", @"768", @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
95     [o_t4_pop_videoBitrate removeAllItems];
96     [o_t4_pop_videoBitrate addItemsWithTitles: videoBitratesArray];
97     [o_t4_pop_videoBitrate selectItemWithTitle: @"1024"];
98
99     /* fill 2 global arrays with arrays containing all codec-related information
100      * - one array per codec named by its short name to define the encap-compability,
101      *     cmd-names, real names, more info in the order: realName, shortName,
102      *     moreInfo, encaps */
103     NSArray * o_mp1v;
104     NSArray * o_mp2v;
105     NSArray * o_mp4v;
106     NSArray * o_div1;
107     NSArray * o_div2;
108     NSArray * o_div3;
109     NSArray * o_h263;
110     NSArray * o_h264;
111     NSArray * o_wmv1;
112     NSArray * o_wmv2;
113     NSArray * o_mjpg;
114     NSArray * o_theo;
115     NSArray * o_dummyVid;
116     o_mp1v = [NSArray arrayWithObjects: @"MPEG-1 Video", @"mp1v", _NS("MPEG-1 Video codec"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_OGG", @"MUX_RAW", @"NO", @"NO", @"NO", @"NO", nil];
117     o_mp2v = [NSArray arrayWithObjects: @"MPEG-2 Video", @"mp2v", _NS("MPEG-2 Video codec"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_OGG", @"MUX_RAW", @"NO", @"NO", @"NO", @"NO", nil];
118     o_mp4v = [NSArray arrayWithObjects: @"MPEG-4 Video", @"mp4v", _NS("MPEG-4 Video codec"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4", @"MUX_OGG", @"MUX_RAW", @"NO", @"NO", nil];
119     o_div1 = [NSArray arrayWithObjects: @"DIVX 1", @"DIV1", _NS("DivX first version"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
120     o_div2 = [NSArray arrayWithObjects: @"DIVX 2", @"DIV2", _NS("DivX second version"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
121     o_div3 = [NSArray arrayWithObjects: @"DIVX 3", @"DIV3", _NS("DivX third version"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
122     o_h263 = [NSArray arrayWithObjects: @"H 263", @"H263", _NS("H263 is a video codec optimized for videoconference (low rates)"), @"MUX_TS", @"MUX_AVI", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
123     o_h264 = [NSArray arrayWithObjects: @"H 264", @"H264", _NS("H264 is a new video codec"), @"MUX_TS", @"MUX_AVI", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
124     o_wmv1 = [NSArray arrayWithObjects: @"WMV 1", @"WMV1", _NS("WMV (Windows Media Video) 1"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
125     o_wmv2 = [NSArray arrayWithObjects: @"WMV 2", @"WMV2", _NS("WMV (Windows Media Video) 2"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
126     o_mjpg = [NSArray arrayWithObjects: @"MJPEG", @"MJPG", _NS("MJPEG consists of a series of JPEG pictures"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
127     o_theo = [NSArray arrayWithObjects: @"Theora", @"theo", _NS("Theora is a free general-purpose codec"), @"MUX_TS", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
128     o_dummyVid = [NSArray arrayWithObjects: @"Dummy", @"dummy", _NS("Dummy codec (do not transcode)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4", @"MUX_OGG", @"MUX_WAV", @"MUX_RAW", @"MUX_MOV", nil];
129     o_videoCodecs = [[NSArray alloc] initWithObjects: o_mp1v, o_mp2v, o_mp4v, o_div1, o_div2, o_div3, o_h263, o_h264, o_wmv1, o_wmv2, o_mjpg, o_theo, o_dummyVid, nil];
130     [o_t4_pop_videoCodec removeAllItems];
131     unsigned int x;
132     x = 0;
133     while (x != [o_videoCodecs count])
134     {
135         [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x] objectAtIndex:0]];
136         x = (x + 1);
137     }
138
139     NSArray * o_mpga;
140     NSArray * o_mp3;
141     NSArray * o_mp4a;
142     NSArray * o_a52;
143     NSArray * o_vorb;
144     NSArray * o_flac;
145     NSArray * o_spx;
146     NSArray * o_s16l;
147     NSArray * o_fl32;
148     NSArray * o_dummyAud;
149     o_mpga = [NSArray arrayWithObjects: @"MPEG Audio", @"mpga", _NS("The standard MPEG audio (1/2) format"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", nil];
150     o_mp3 = [NSArray arrayWithObjects: @"MP3", @"mp3", _NS("MPEG Audio Layer 3"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", nil];
151     o_mp4a = [NSArray arrayWithObjects: @"MPEG 4 Audio", @"mp4a", _NS("Audio format for MPEG4"), @"MUX_TS", @"MUX_MP4", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
152     o_a52 = [NSArray arrayWithObjects: @"A/52", @"a52", _NS("DVD audio format"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", nil];
153     o_vorb = [NSArray arrayWithObjects: @"Vorbis", @"vorb", _NS("Vorbis is a free audio codec"), @"MUX_OGG", @"-1",  @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
154     o_flac = [NSArray arrayWithObjects: @"FLAC", @"flac", _NS("FLAC is a lossless audio codec"), @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
155     o_spx = [NSArray arrayWithObjects: @"Speex", @"spx", _NS("A free audio codec dedicated to compression of voice"), @"MUX_OGG", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
156     o_s16l = [NSArray arrayWithObjects: @"Uncompressed, integer", @"s16l", _NS("Uncompressed audio samples"), @"MUX_WAV", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
157     o_fl32 = [NSArray arrayWithObjects: @"Uncompressed, floating", @"fl32", _NS("Uncompressed audio samples"), @"MUX_WAV", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
158     o_dummyAud = [NSArray arrayWithObjects: @"Dummy", @"dummy", _NS("Dummy codec (do not transcode)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4", @"MUX_OGG", @"MUX_RAW", @"MUX_MOV", @"MUX_WAV", nil];
159     o_audioCodecs = [[NSArray alloc] initWithObjects: o_mpga, o_mp3, o_mp4a, o_a52, o_vorb, o_flac, o_spx, o_s16l, o_fl32, o_dummyAud, nil];
160     [o_t4_pop_audioCodec removeAllItems];
161     x = 0;
162     while (x != [o_audioCodecs count])
163     {
164         [o_t4_pop_audioCodec addItemWithTitle:[[o_audioCodecs objectAtIndex:x] objectAtIndex:0]];
165         x = (x + 1);
166     }
167
168
169     /* fill another global array with all information about the encap-formats
170      * note that the order of the formats inside the g. array is the same as on
171      * the encap-tab */
172     NSArray * o_ps;
173     NSArray * o_ts;
174     NSArray * o_mpeg;
175     NSArray * o_ogg;
176     NSArray * o_raw;
177     NSArray * o_asf;
178     NSArray * o_avi;
179     NSArray * o_mp4;
180     NSArray * o_mov;
181     NSArray * o_wav;
182     o_ps = [NSArray arrayWithObjects: @"ps", @"MPEG PS", _NS("MPEG Program Stream"), nil];
183     o_ts = [NSArray arrayWithObjects: @"ts", @"MPEG TS", _NS("MPEG Transport Stream"), nil];
184     o_mpeg = [NSArray arrayWithObjects: @"ps", @"MPEG 1", _NS("MPEG 1 Format"), nil];
185     o_ogg = [NSArray arrayWithObjects: @"ogg", @"OGG", @"OGG", nil];
186     o_raw = [NSArray arrayWithObjects: @"raw", @"RAW", @"RAW", nil];
187     o_asf = [NSArray arrayWithObjects: @"asf", @"ASF", @"ASF", nil];
188     o_avi = [NSArray arrayWithObjects: @"avi", @"AVI", @"AVI", nil];
189     o_mp4 = [NSArray arrayWithObjects: @"mp4", @"MP4", @"MPEG4", nil];
190     o_mov = [NSArray arrayWithObjects: @"mov", @"MOV", @"MOV", nil];
191     o_wav = [NSArray arrayWithObjects: @"wav", @"WAV", @"WAV", nil];
192     o_encapFormats = [[NSArray alloc] initWithObjects: o_ps, o_ts, o_mpeg, o_ogg, o_raw, o_asf, o_avi, o_mp4, o_mov, o_wav, nil];
193
194     /* yet another array on streaming methods including help texts */
195     NSArray * o_http;
196     NSArray * o_udp_uni;
197     NSArray * o_udp_multi;
198     o_http = [NSArray arrayWithObjects: @"http", @"HTTP", _NS("Enter the local " \
199         "addresses you want to listen to. Do not enter anything if you want to " \
200         "listen to all adresses or if you don't understand. This is generally " \
201         "the best thing to do. Other computers can then access the stream at " \
202         "http://yourip:8080 by default.") , _NS("Use this to stream to several " \
203         "computers. This method is less efficient, as the server needs to send " \
204         "the stream several times."), nil];
205     o_udp_multi = [NSArray arrayWithObjects: @"udp", @"UDP-Multicast", _NS("Enter " \
206         "the multicast address to stream to in this field. This must be an IP " \
207         "address between 224.0.0.0 and 239.255.255.255. For a private use, " \
208         "enter an address beginning with 239.255."), _NS("Use this to stream " \
209         "to a dynamic group of computers on a multicast-enabled network. This " \
210         "is the most efficient method to stream to several computers, but it " \
211         "does not work over Internet."), nil];
212     o_udp_uni = [NSArray arrayWithObjects: @"udp", @"UDP-Unicast", _NS("Enter " \
213         "the address of the computer to stream to."), _NS("Use this to stream " \
214         "to a single computer."), nil];
215     o_strmgMthds = [[NSArray alloc] initWithObjects: o_http, o_udp_multi, o_udp_uni, nil];
216 }
217
218 - (void)showWizard
219 {
220     /* just present the window to the user */
221     [o_tab_pageHolder selectFirstTabViewItem:self];
222
223     [self resetWizard];
224
225     [o_wizard_window center];
226     [o_wizard_window displayIfNeeded];
227     [o_wizard_window makeKeyAndOrderFront:nil];
228 }
229
230 - (void)resetWizard
231 {
232     /* reset the wizard-window to its default values */
233
234     [o_userSelections removeAllObjects];
235     [o_t1_matrix_strmgOrTrnscd selectCellAtRow:0 column:0];
236     [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setState: NSOffState];
237     [o_btn_forward setTitle: _NS("Next")];
238
239     /* "Input" */
240     [o_t2_fld_pathToNewStrm setStringValue: @""];
241     [o_t2_ckb_enblPartExtrct setState: NSOffState];
242     [self t2_enableExtract:nil];
243     [o_t2_matrix_inputSourceType selectCellAtRow:0 column:0];
244     [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setState: NSOffState];
245     /* FIXME: we need to refresh the playlist-table as well */
246     [o_t2_fld_pathToNewStrm setEnabled:YES];
247     [o_t2_btn_chooseFile setEnabled:YES];
248     [o_t2_tbl_plst setEnabled:NO];
249
250     /* "Streaming 1" */
251     [o_t3_fld_address setStringValue: @""];
252     [o_t3_matrix_stmgMhd selectCellAtRow:0 column:0];
253     [[o_t3_matrix_stmgMhd cellAtRow:1 column:1] setState: NSOffState];
254     [[o_t3_matrix_stmgMhd cellAtRow:1 column:2] setState: NSOffState];
255
256     /* "Transcode 1" */
257     [o_t4_ckb_audio setState: NSOffState];
258     [o_t4_ckb_video setState: NSOffState];
259     [self t4_enblVidTrnscd:nil];
260     [self t4_enblAudTrnscd:nil];
261
262     /* "Streaming 2" */
263     [o_t6_fld_ttl setStringValue: @"1"];
264     [o_t6_ckb_sap setState: NSOffState];
265     [self t6_enblSapAnnce:nil];
266
267     /* "Transcode 2" */
268     [o_t7_fld_filePath setStringValue: @""];
269 }
270
271 - (void)initStrings
272 {
273     /* localise all strings to the users lang */
274     /* method is called from intf.m (in method openWizard) */
275
276     /* general items */
277     [o_btn_backward setTitle: _NS("Back")];
278     [o_btn_cancel setTitle: _NS("Cancel")];
279     [o_btn_forward setTitle: _NS("Next")];
280     [o_wizard_window setTitle: _NS("Streaming/Transcoding Wizard")];
281
282     /* page one ("Hello") */
283     [o_t1_txt_title setStringValue: _NS("Streaming/Transcoding Wizard")];
284     [o_t1_txt_text setStringValue: _NS("This wizard helps you to stream, transcode or save a stream.")];
285     [o_t1_btn_mrInfo_strmg setTitle: _NS("More Info")];
286     [o_t1_btn_mrInfo_trnscd setTitle: _NS("More Info")];
287     [o_t1_txt_notice setStringValue: _NS("This wizard only gives access to a small subset of VLC's streaming and transcoding capabilities. Use the Open and Stream Output dialogs to get all of them.")];
288     [[o_t1_matrix_strmgOrTrnscd cellAtRow:0 column:0] setTitle: _NS("Stream to network")];
289     [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setTitle: _NS("Transcode/Save to file")];
290
291     /* page two ("Input") */
292     [o_t2_title setStringValue: _NS("Choose input")];
293     [o_t2_text setStringValue: _NS("Choose here your input stream.")];
294     [[o_t2_matrix_inputSourceType cellAtRow:0 column:0] setTitle: _NS("Select a stream")];
295     [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setTitle: _NS("Existing playlist item")];
296     [o_t2_btn_chooseFile setTitle: _NS("Choose...")];
297 //    [[[o_t2_tbl_plst tableColumnWithIdentifier:@"name"] headerCell] setStringValue: _NS("Name")];
298 //    [[[o_t2_tbl_plst tableColumnWithIdentifier:@"uri"] headerCell] setStringValue: _NS("URI")];
299     [o_t2_box_prtExtrct setTitle: _NS("Partial Extract")];
300     [o_t2_ckb_enblPartExtrct setTitle: _NS("Enable")];
301     [o_t2_ckb_enblPartExtrct setToolTip: _NS("Use this to read only a part of " \
302         "the stream. You must be able to control the incoming stream " \
303         "(for example, a file or a disc, but not an UDP network stream.)\n" \
304         "Enter the starting and ending times (in seconds).")];
305     [o_t2_txt_prtExtrctFrom setStringValue: _NS("From")];
306     [o_t2_txt_prtExtrctTo setStringValue: _NS("To")];
307
308     /* page three ("Streaming 1") */
309     [o_t3_txt_title setStringValue: _NS("Streaming")];
310     [o_t3_txt_text setStringValue: _NS("In this page, you will select how your input stream will be sent.")];
311     [o_t3_box_dest setTitle: _NS("Destination")];
312     [o_t3_box_strmgMthd setTitle: _NS("Streaming method")];
313     [o_t3_txt_destInfo setStringValue: _NS("Enter the address of the computer to stream to.")];
314     [[o_t3_matrix_stmgMhd cellAtRow:1 column:0] setTitle: _NS("UDP Unicast")];
315     [[o_t3_matrix_stmgMhd cellAtRow:1 column:1] setTitle: _NS("UDP Multicast")];
316     [o_t3_txt_strgMthdInfo setStringValue: _NS("Use this to stream to a single computer.")];
317
318     /* page four ("Transcode 1") */
319     [o_t4_title setStringValue: _NS("Transcode")];
320     [o_t4_text setStringValue: _NS("If you want to change the compression format of the audio or video tracks, fill in this page. (If you only want to change the container format, proceed to next page.)")];
321     [o_t4_box_audio setTitle: _NS("Audio")];
322     [o_t4_box_video setTitle: _NS("Video")];
323     [o_t4_ckb_audio setTitle: _NS("Transcode audio")];
324     [o_t4_ckb_video setTitle: _NS("Transcode video")];
325     [o_t4_txt_videoBitrate setStringValue: _NS("Bitrate (kb/s)")];
326     [o_t4_txt_videoCodec setStringValue: _NS("Codec")];
327     [o_t4_txt_hintAudio setStringValue: _NS("If your stream has audio and you want to " \
328                          "transcode it, enable this.")];
329     [o_t4_txt_hintVideo setStringValue: _NS("If your stream has video and you want to " \
330                          "transcode it, enable this.")];
331
332     /* page five ("Encap") */
333     [o_t5_title setStringValue: _NS("Encapsulation format")];
334     [o_t5_text setStringValue: _NS("In this page, you will select how the stream will be "\
335                      "encapsulated. Depending on the choices you made, all "\
336                      "formats won't be available.")];
337
338     /* page six ("Streaming 2") */
339     [o_t6_title setStringValue: _NS("Additional streaming options")];
340     [o_t6_text setStringValue: _NS("In this page, you will define a few " \
341                               "additional parameters for your stream.")];
342     [o_t6_txt_ttl setStringValue: _NS("Time-To-Live (TTL)")];
343     [o_t6_btn_mrInfo_ttl setTitle: _NS("More Info")];
344     [o_t6_ckb_sap setTitle: _NS("SAP Announce")];
345     [o_t6_btn_mrInfo_sap setTitle: _NS("More Info")];
346
347     /* page seven ("Transcode 2") */
348     [o_t7_title setStringValue: _NS("Additional transcode options")];
349     [o_t7_text setStringValue: _NS("In this page, you will define a few " \
350                               "additionnal parameters for your transcoding.")];
351     [o_t7_txt_saveFileTo setStringValue: _NS("Select the file to save to")];
352     [o_t7_btn_chooseFile setTitle: _NS("Choose...")];
353
354     /* page eight ("Summary") */
355     [o_t8_txt_text setStringValue: _NS("This page lists all your selections. " \
356         "Click \"Finish\" to start your streaming or transcoding.")];
357     [o_t8_txt_title setStringValue: _NS("Summary")];
358     [o_t8_txt_destination setStringValue: [_NS("Destination") stringByAppendingString: @":"]];
359     [o_t8_txt_encapFormat setStringValue: [_NS("Encap. format") stringByAppendingString: @":"]];
360     [o_t8_txt_inputStream setStringValue: [_NS("Input stream") stringByAppendingString: @":"]];
361     [o_t8_txt_partExtract setStringValue: [_NS("Partial Extract") stringByAppendingString: @":"]];
362     [o_t8_txt_sap setStringValue: [_NS("SAP Announce") stringByAppendingString: @":"]];
363     [o_t8_txt_saveFileTo setStringValue: [_NS("Save file to") stringByAppendingString: @":"]];
364     [o_t8_txt_strmgMthd setStringValue: [_NS("Streaming method") stringByAppendingString: @":"]];
365     [o_t8_txt_trnscdAudio setStringValue: [_NS("Transcode audio") stringByAppendingString: @":"]];
366     [o_t8_txt_trnscdVideo setStringValue: [_NS("Transcode video") stringByAppendingString: @":"]];
367
368     /* wizard help window */
369     [o_wh_btn_okay setTitle: _NS("OK")];
370 }
371
372 - (IBAction)cancelRun:(id)sender
373 {
374     [o_wizard_window close];
375 }
376
377 - (IBAction)nextTab:(id)sender
378 {
379     if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Hello"])
380     {
381         /* check whether the user wants to stream or just to transcode;
382          * store information for later usage */
383         NSString *o_mode;
384         o_mode = [[o_t1_matrix_strmgOrTrnscd selectedCell] title];
385         if( [o_mode isEqualToString: _NS("Stream to network")] )
386         {
387             [o_userSelections setObject:@"strmg" forKey:@"trnscdOrStrmg"];
388         }else{
389             [o_userSelections setObject:@"trnscd" forKey:@"trnscdOrStrmg"];
390         }
391         [o_btn_backward setEnabled:YES];
392         [o_tab_pageHolder selectTabViewItemAtIndex:1];
393
394         /* Fill the playlist with current playlist items */
395         [o_playlist_wizard reloadOutlineView];
396
397     }
398     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Input"])
399     {
400         /* check whether partialExtract is enabled and store the values, if needed */
401         if ([o_t2_ckb_enblPartExtrct state] == NSOnState)
402         {
403             [o_userSelections setObject:@"YES" forKey:@"partExtract"];
404             [o_userSelections setObject:[o_t2_fld_prtExtrctFrom stringValue] forKey:@"partExtractFrom"];
405             [o_userSelections setObject:[o_t2_fld_prtExtrctTo stringValue] forKey:@"partExtractTo"];
406         }else{
407             [o_userSelections setObject:@"NO" forKey:@"partExtract"];
408         }
409
410         /* check whether we use an existing pl-item or add an new one;
411          * store the path or the index and set a flag.
412          * complain to the user if s/he didn't provide a path */
413         NSString *o_mode;
414         BOOL stop;
415         stop = NO;
416         o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
417         if( [o_mode isEqualToString: _NS("Select a stream")] )
418         {
419             [o_userSelections setObject:@"YES" forKey:@"newStrm"];
420             if ([[o_t2_fld_pathToNewStrm stringValue] isEqualToString: @""])
421             {
422                 /* set a flag that no file is selected */
423                 stop = YES;
424             }
425             else
426             {
427                 [o_userSelections setObject:[@"file://" stringByAppendingString:[o_t2_fld_pathToNewStrm stringValue]] forKey:@"pathToStrm"];
428             }
429         }
430         else
431         {
432             if ([o_t2_tbl_plst selectedRow] != -1)
433             {
434                 playlist_item_t *p_item =
435                                     [o_playlist_wizard selectedPlaylistItem];
436                 if( p_item->i_children <= 0 )
437                 {
438                     [o_userSelections setObject: [NSString stringWithFormat:
439                         @"%s", p_item->input.psz_uri] forKey:@"pathToStrm"];
440                 }
441                 else
442                 stop = YES;
443                 /* FIXME: put the path of the selected pl-item to pathToStrm */
444             } else {
445                 /* set a flag that no item is selected */
446                 stop = YES;
447             }
448         }
449
450         /* show either "Streaming 1" or "Transcode 1" to the user */
451         if (stop == NO)
452         {
453             if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
454             {
455                 /* we are streaming */
456                 [o_tab_pageHolder selectTabViewItemAtIndex:2];
457             }else{
458                 /* we are just transcoding */
459                 [o_tab_pageHolder selectTabViewItemAtIndex:3];
460             }
461         } else {
462             /* show a sheet that the user didn't select a file */
463             NSBeginInformationalAlertSheet(_NS("No input selected"), _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, _NS("You selected neither " \
464                 "a new stream nor a valid playlist item. VLC is unable to " \
465                 "guess, which input you want use. \n\n Choose one " \
466                 "before going to the next page."));
467         }
468     }
469     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 1"])
470     {
471         /* check which streaming method is selected and store it */
472         NSString *o_mode;
473         o_mode = [[o_t3_matrix_stmgMhd selectedCell] title];
474         if( [o_mode isEqualToString: @"HTTP"] )
475         {
476             [o_userSelections setObject:@"0" forKey:@"stmgMhd"];
477             /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF; select MPEG PS */
478             [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
479             [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
480             [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
481             [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
482             [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
483             [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
484             [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
485             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
486             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
487             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
488             [o_t5_matrix_encap selectCellAtRow:0 column:0];
489         } else {
490             if( [o_mode isEqualToString: _NS("UDP Unicast")] )
491             {
492                 [o_userSelections setObject:@"2" forKey:@"stmgMhd"];
493             } else {
494                 [o_userSelections setObject:@"1" forKey:@"stmgMhd"];
495             }
496             /* disable all encap-formats but MPEG-TS and select it */
497             [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
498             [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
499             [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
500             [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
501             [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
502             [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
503             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
504             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
505             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
506             [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
507             [o_t5_matrix_encap selectCellAtRow:1 column:0];
508         }
509
510         /* store the destination and check whether is it empty */
511         if(! [o_mode isEqualToString: @"HTTP"] )
512         {
513             /* empty field is valid for HTTP */
514             if( [[o_t3_fld_address stringValue] isEqualToString: @""] )
515             {
516                 /* complain to the user that "" is no valid dest. */
517                 NSBeginInformationalAlertSheet(_NS("No valid destination"), _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, _NS("You need to enter " \
518                 "a valid destination you want to stream to. Enter either a " \
519                 "Unicast-IP or a Multicast-IP.\n\n If you don't know "
520                 "what this means, have a look at the VLC Streaming HOWTO and " \
521                 "the help texts in this window."));
522             } else {
523                 /* FIXME: check whether the entered IP is really valid */
524                 [o_userSelections setObject:[o_t3_fld_address stringValue] forKey:@"stmgDest"];
525                 /* let's go to the encap-tab */
526                 [o_tab_pageHolder selectTabViewItemAtIndex:4];
527             }
528         } else {
529             [o_userSelections setObject:[o_t3_fld_address stringValue] forKey:@"stmgDest"];
530             /* let's go to the encap-tab */
531             [o_tab_pageHolder selectTabViewItemAtIndex:4];
532         }
533     }
534     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 1"])
535     {
536         /* check whether the user wants to transcode the video-track and store the related options */
537         if ([o_t4_ckb_video state] == NSOnState)
538         {
539             NSNumber * theNum;
540             theNum = [NSNumber numberWithInt:[o_t4_pop_videoCodec indexOfSelectedItem]];
541             [o_userSelections setObject:@"YES" forKey:@"trnscdVideo"];
542             [o_userSelections setObject:[o_t4_pop_videoBitrate titleOfSelectedItem] forKey:@"trnscdVideoBitrate"];
543             [o_userSelections setObject:theNum forKey:@"trnscdVideoCodec"];
544         } else {
545             [o_userSelections setObject:@"NO" forKey:@"trnscdVideo"];
546         }
547
548         /* check whether the user wants to transcode the audio-track and store the related options */
549         if ([o_t4_ckb_audio state] == NSOnState)
550         {
551             NSNumber * theNum;
552             theNum = [NSNumber numberWithInt:[o_t4_pop_audioCodec indexOfSelectedItem]];
553             [o_userSelections setObject:@"YES" forKey:@"trnscdAudio"];
554             [o_userSelections setObject:[o_t4_pop_audioBitrate titleOfSelectedItem] forKey:@"trnscdAudioBitrate"];
555             [o_userSelections setObject:theNum forKey:@"trnscdAudioCodec"];
556         } else {
557             [o_userSelections setObject:@"NO" forKey:@"trnscdAudio"];
558         }
559
560         /* disable all encap-formats */
561         [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
562         [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
563         [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
564         [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
565         [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
566         [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
567         [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
568         [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
569         [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
570         [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
571
572         /* re-enable the encap-formats supported by the chosen codecs */
573         /* FIXME: the following is a really bad coding-style. feel free to mail
574             me ideas how to make this nicer, if you want to -- FK, 7/11/05 */
575
576         if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualTo: @"YES"])
577         {
578             if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
579             {
580                 /* we are transcoding both audio and video, so we need to check both deps */
581                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_PS"])
582                 {
583                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_PS"])
584                     {
585                         [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
586                         [o_t5_matrix_encap selectCellAtRow:0 column:0];
587                     }
588                 }
589                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_TS"])
590                 {
591                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_TS"])
592                     {
593                         [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
594                         [o_t5_matrix_encap selectCellAtRow:1 column:0];
595                     }
596                 }
597                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MPEG"])
598                 {
599                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MPEG"])
600                     {
601                         [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
602                         [o_t5_matrix_encap selectCellAtRow:2 column:0];
603                     }
604                 }
605                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_OGG"])
606                 {
607                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_OGG"])
608                     {
609                         [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
610                         [o_t5_matrix_encap selectCellAtRow:3 column:0];
611                     }
612                 }
613                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_RAW"])
614                 {
615                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_RAW"])
616                     {
617                         [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
618                         [o_t5_matrix_encap selectCellAtRow:4 column:0];
619                     }
620                 }
621                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_ASF"])
622                 {
623                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_ASF"])
624                     {
625                         [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
626                         [o_t5_matrix_encap selectCellAtRow:5 column:0];
627                     }
628                 }
629                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
630                 {
631                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
632                     {
633                         [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
634                         [o_t5_matrix_encap selectCellAtRow:6 column:0];
635                     }
636                 }
637                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
638                 {
639                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
640                     {
641                         [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
642                         [o_t5_matrix_encap selectCellAtRow:7 column:0];
643                     }
644                 }
645                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
646                 {
647                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
648                     {
649                         [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
650                         [o_t5_matrix_encap selectCellAtRow:8 column:0];
651                     }
652                 }
653                 if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
654                 {
655                     if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
656                     {
657                         [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
658                         [o_t5_matrix_encap selectCellAtRow:9 column:0];
659                     }
660                 }
661
662             } else {
663
664                 /* we just transcoding the audio */
665
666                 /* select formats supported by the audio codec */
667                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_PS"])
668                 {
669                     [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
670                     [o_t5_matrix_encap selectCellAtRow:0 column:0];
671                 }
672                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_TS"])
673                 {
674                     [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
675                     [o_t5_matrix_encap selectCellAtRow:1 column:0];
676                 }
677                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MPEG"])
678                 {
679                     [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
680                     [o_t5_matrix_encap selectCellAtRow:2 column:0];
681                 }
682                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_OGG"])
683                 {
684                     [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
685                     [o_t5_matrix_encap selectCellAtRow:3 column:0];
686                 }
687                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_RAW"])
688                 {
689                     [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
690                     [o_t5_matrix_encap selectCellAtRow:4 column:0];
691                 }
692                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_ASF"])
693                 {
694                     [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
695                     [o_t5_matrix_encap selectCellAtRow:5 column:0];
696                 }
697                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
698                 {
699                     [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
700                     [o_t5_matrix_encap selectCellAtRow:6 column:0];
701                 }
702                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
703                 {
704                     [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
705                     [o_t5_matrix_encap selectCellAtRow:7 column:0];
706                 }
707                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
708                 {
709                     [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
710                     [o_t5_matrix_encap selectCellAtRow:8 column:0];
711                 }
712                 if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
713                 {
714                     [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
715                     [o_t5_matrix_encap selectCellAtRow:9 column:0];
716                 }
717             }
718         }
719         else if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
720         {
721             /* we are just transcoding the video */
722
723             /* select formats supported by the video-codec */
724
725             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_PS"])
726             {
727                 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
728                 [o_t5_matrix_encap selectCellAtRow:0 column:0];
729             }
730             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_TS"])
731             {
732                 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
733                 [o_t5_matrix_encap selectCellAtRow:1 column:0];
734             }
735             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MPEG"])
736             {
737                 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
738                 [o_t5_matrix_encap selectCellAtRow:2 column:0];
739             }
740             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_OGG"])
741             {
742                 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
743                 [o_t5_matrix_encap selectCellAtRow:3 column:0];
744             }
745             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_RAW"])
746             {
747                 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
748                 [o_t5_matrix_encap selectCellAtRow:4 column:0];
749             }
750             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_ASF"])
751             {
752                 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
753                 [o_t5_matrix_encap selectCellAtRow:5 column:0];
754             }
755             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
756             {
757                 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
758                 [o_t5_matrix_encap selectCellAtRow:6 column:0];
759             }
760             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
761             {
762                 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
763                 [o_t5_matrix_encap selectCellAtRow:7 column:0];
764             }
765             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
766             {
767                 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
768                 [o_t5_matrix_encap selectCellAtRow:8 column:0];
769             }
770             if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
771             {
772                 [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
773                 [o_t5_matrix_encap selectCellAtRow:9 column:0];
774             }
775         } else {
776             /* we don't do any transcoding
777              * -> enabled the encap-formats allowed when streaming content via http
778              * since this should work fine in most cases */
779             /* FIXME: choose a selection of encap-formats based upon the actually used codecs */
780
781             /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF; select MPEG PS */
782             [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
783             [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
784             [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
785             [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
786             [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
787             [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
788             [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
789             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
790             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
791             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
792             [o_t5_matrix_encap selectCellAtRow:0 column:0];
793         }
794         int x;
795         BOOL anythingEnabled;
796         x = 0;
797         anythingEnabled = NO;
798         while (x != [o_t5_matrix_encap numberOfRows])
799         {
800             if ([[o_t5_matrix_encap cellAtRow:x column:0] isEnabled])
801             {
802                 anythingEnabled = YES;
803             }
804             x = (x + 1);
805         }
806         if (anythingEnabled == YES)
807         {
808         [o_tab_pageHolder selectTabViewItemAtIndex:4];
809         } else {
810             /* show a sheet that the selected codecs are not compatible */
811             NSBeginInformationalAlertSheet(_NS("Invalid selection"), _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, _NS("Your chosen codecs are " \
812                 "not compatible with each other. For example: you cannot " \
813                 "mix uncompressed audio with any video codec.\n\n" \
814                 "Correct your selection and try again."));
815         }
816
817     }
818     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Encap"])
819     {
820         /* get the chosen encap format and store it */
821         NSNumber * theNum;
822         theNum = [NSNumber numberWithInt:[[o_t5_matrix_encap selectedCell] tag]];
823         [o_userSelections setObject:[theNum stringValue] forKey:@"encapFormat"];
824
825         /* show either "Streaming 2" or "Transcode 2" to the user */
826         if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
827         {
828             /* we are streaming */
829             [o_tab_pageHolder selectTabViewItemAtIndex:5];
830         }else{
831             /* we are just transcoding */
832             [o_tab_pageHolder selectTabViewItemAtIndex:6];
833         }
834     }
835     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 2"])
836     {
837         /* store the chosen TTL */
838         [o_userSelections setObject:[o_t6_fld_ttl stringValue] forKey:@"ttl"];
839
840         /* check whether SAP is enabled and store the announce, if needed */
841         if ([o_t6_ckb_sap state] == NSOnState)
842         {
843             [o_userSelections setObject:@"YES" forKey:@"sap"];
844             [o_userSelections setObject:[o_t6_fld_sap stringValue] forKey:@"sapText"];
845         } else {
846             [o_userSelections setObject:@"NO" forKey:@"sap"];
847         }
848
849         /* go to "Summary" */
850         [self showSummary];
851     }
852     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 2"])
853     {
854         /* check whether the path != "" and store it */
855         if( [[o_t7_fld_filePath stringValue] isEqualToString: @""] )
856         {
857             /* complain to the user that "" is no valid path */
858             NSBeginInformationalAlertSheet(_NS("No file selected"), _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, _NS("You you need to select a file, you want to save to. " \
859                 "\n\n Enter either a valid path or choose a location through " \
860                 "the button's dialog-box."));
861         } else {
862             [o_userSelections setObject:[o_t7_fld_filePath stringValue] forKey:@"trnscdFilePath"];
863
864             /* go to "Summary" */
865             [self showSummary];
866         }
867     }
868     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Summary"])
869     {
870         intf_thread_t * p_intf = VLCIntf;
871
872         playlist_t * p_playlist = (playlist_t *)vlc_object_find( p_intf,
873                             VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
874         if( p_playlist )
875         {
876             playlist_item_t *p_item = playlist_ItemNew( p_playlist, [[o_userSelections objectForKey:@"pathToStrm"] UTF8String], _("Streaming/Transcoding Wizard") );
877             playlist_ItemAddOption( p_item, [[o_userSelections objectForKey:@"opts"] UTF8String]);
878
879             if(! [[o_userSelections objectForKey:@"partExtractFrom"] isEqualToString:@""] )
880             {
881                 playlist_ItemAddOption( p_item, [[@"start-time=" stringByAppendingString: [o_userSelections objectForKey:@"partExtractFrom"]] UTF8String] );
882             }
883
884             if(! [[o_userSelections objectForKey:@"partExtractTo"] isEqualToString:@""] )
885             {
886                 playlist_ItemAddOption( p_item, [[@"stop-time=" stringByAppendingString: [o_userSelections objectForKey:@"partExtractTo"]] UTF8String] );
887             }
888
889             playlist_ItemAddOption( p_item, [[@"ttl=" stringByAppendingString: [o_userSelections objectForKey:@"ttl"]] UTF8String] );
890
891             playlist_AddItem( p_playlist, p_item, PLAYLIST_GO, PLAYLIST_END );
892
893             msg_Warn(p_intf, "updating the playlist-table is not implemented!");
894
895             playlist_ViewUpdate( p_playlist, VIEW_CATEGORY );
896
897             vlc_object_release(p_playlist);
898         } else {
899             msg_Err( p_intf, "Uh Oh! Unable to find playlist!" );
900         }
901
902         /* close the window, since we are done */
903         [o_wizard_window close];
904     }
905 }
906
907 - (void)showSummary
908 {
909     [o_btn_forward setTitle: _NS("Finish")];
910     [o_t8_fld_inptStream setStringValue:[o_userSelections objectForKey:@"pathToStrm"]];
911
912     if ([[o_userSelections objectForKey:@"partExtract"] isEqualToString: @"YES"])
913     {
914         [o_t8_fld_partExtract setStringValue: [[[[[_NS("yes") stringByAppendingString:@" - "] stringByAppendingString: _NS("from ")] stringByAppendingString: [o_userSelections objectForKey:@"partExtractFrom"]] stringByAppendingString: _NS(" to ")] stringByAppendingString: [o_userSelections objectForKey:@"partExtractTo"]]];
915     } else {
916         [o_t8_fld_partExtract setStringValue: _NS("no")];
917     }
918
919     if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
920     {
921         /* we are streaming; no transcoding allowed atm */
922         [o_t8_fld_saveFileTo setStringValue: @"-"];
923         [o_t8_fld_trnscdAudio setStringValue: @"-"];
924         [o_t8_fld_trnscdVideo setStringValue: @"-"];
925         [o_t8_fld_strmgMthd setStringValue: [[o_strmgMthds objectAtIndex:[[o_userSelections objectForKey:@"stmgMhd"] intValue]] objectAtIndex:1]];
926         [o_t8_fld_destination setStringValue: [o_userSelections objectForKey:@"stmgDest"]];
927         [o_t8_fld_ttl setStringValue: [o_userSelections objectForKey:@"ttl"]];
928         if ([[o_userSelections objectForKey:@"sap"] isEqualToString: @"YES"])
929         {
930             [o_t8_fld_sap setStringValue: [[_NS("yes") stringByAppendingString:@": "] stringByAppendingString:[o_userSelections objectForKey:@"sapText"]]];
931         }else{
932             [o_t8_fld_sap setStringValue: _NS("no")];
933         }
934     } else {
935         /* we are transcoding */
936         [o_t8_fld_strmgMthd setStringValue: @"-"];
937         [o_t8_fld_destination setStringValue: @"-"];
938         [o_t8_fld_ttl setStringValue: @"-"];
939         [o_t8_fld_sap setStringValue: @"-"];
940         if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
941         {
942             [o_t8_fld_trnscdVideo setStringValue: [[[[[_NS("yes") stringByAppendingString:@": "] stringByAppendingString: [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] objectAtIndex:0]] stringByAppendingString:@" @ "] stringByAppendingString: [o_userSelections objectForKey:@"trnscdVideoBitrate"]] stringByAppendingString:@" kb/s"]];
943         }else{
944             [o_t8_fld_trnscdVideo setStringValue: _NS("no")];
945         }
946         if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
947         {
948             [o_t8_fld_trnscdAudio setStringValue: [[[[[_NS("yes") stringByAppendingString:@": "] stringByAppendingString: [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] objectAtIndex:0]] stringByAppendingString:@" @ "] stringByAppendingString: [o_userSelections objectForKey:@"trnscdAudioBitrate"]] stringByAppendingString:@" kb/s"]];
949         }else{
950             [o_t8_fld_trnscdAudio setStringValue: _NS("no")];
951         }
952         [o_t8_fld_saveFileTo setStringValue: [o_userSelections objectForKey:@"trnscdFilePath"]];
953     }
954     [o_t8_fld_encapFormat setStringValue: [[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:1]];
955
956     [self createOpts];
957     [o_t8_fld_mrl setStringValue: [o_userSelections objectForKey:@"opts"]];
958
959     [o_tab_pageHolder selectTabViewItemAtIndex:7];
960 }
961
962 - (void) createOpts
963 {
964     NSMutableString * o_opts_string = [NSMutableString stringWithString:@""];
965
966     if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"trnscd"])
967     {
968         /* we are just transcoding and dumping the stuff to a file */
969         NSMutableString *o_trnscdCmd = [NSMutableString stringWithString:@""];
970         if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
971         {
972             [o_trnscdCmd appendString: @"transcode{"];
973             [o_trnscdCmd appendFormat: @"vcodec=%s,vb=%i", [[[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] objectAtIndex:1] UTF8String],  [[o_userSelections objectForKey:@"trnscdVideoBitrate"] intValue]];
974             if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
975             {
976                 [o_trnscdCmd appendString: @","];
977             } else
978             {
979                 [o_trnscdCmd appendString: @"}:"];
980             }
981         }
982         if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
983         {
984             if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"NO"])
985             {
986                 /* in case we transcode the audio only, add this */
987                 [o_trnscdCmd appendString: @"transcode{"];
988             }
989             [o_trnscdCmd appendFormat: @"acodec=%s,ab=%i}:", [[[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] objectAtIndex:1] UTF8String],  [[o_userSelections objectForKey:@"trnscdAudioBitrate"] intValue]];
990         }
991         [o_opts_string appendFormat: @":sout=#%sstandard{mux=%s,url=%s,access=file}", [o_trnscdCmd UTF8String], [[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0] UTF8String], [[o_userSelections objectForKey:@"trnscdFilePath"] UTF8String]];
992
993     } else {
994
995         /* we are streaming - no transcoding allowed atm, since we mirror the wx-wizard */
996         if ([[o_userSelections objectForKey:@"sap"] isEqualToString:@"YES"])
997         {
998             /* SAP-Announcement is requested */
999             NSMutableString *o_sap_option = [NSMutableString stringWithString:@""];
1000             if([[o_userSelections objectForKey:@"sapText"] isEqualToString:@""])
1001             {
1002                 [o_sap_option appendString: @"sap"];
1003             } else {
1004                 [o_sap_option appendFormat: @"sap,name=\"%s\"",[[o_userSelections objectForKey:@"sapText"] UTF8String]];
1005             }
1006             [o_opts_string appendFormat: @":sout=#standard{mux=%s,url=%s,access=%s,%s}", [[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0] UTF8String], [[o_userSelections objectForKey:@"stmgDest"] UTF8String], [[[o_strmgMthds objectAtIndex:[[o_userSelections objectForKey:@"stmgMhd"] intValue]] objectAtIndex:0] UTF8String], [o_sap_option UTF8String]];
1007         } else {
1008             /* no SAP, just streaming */
1009             [o_opts_string appendFormat: @":sout=#standard{mux=%s,url=%s,access=%s}", [[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0] UTF8String], [[o_userSelections objectForKey:@"stmgDest"] UTF8String], [[[o_strmgMthds objectAtIndex:[[o_userSelections objectForKey:@"stmgMhd"] intValue]] objectAtIndex:0] UTF8String]];
1010         }
1011     }
1012
1013     [o_userSelections setObject:o_opts_string forKey:@"opts"];
1014 }
1015
1016 - (IBAction)prevTab:(id)sender
1017 {
1018     if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Summary"])
1019     {
1020         /* check whether we are streaming or transcoding and go back */
1021         if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1022         {
1023             /* show "Streaming 2" */
1024             [o_tab_pageHolder selectTabViewItemAtIndex:5];
1025         }else{
1026             /* show "Transcode 2" */
1027             [o_tab_pageHolder selectTabViewItemAtIndex:6];
1028         }
1029         /* rename the forward-button */
1030         [o_btn_forward setTitle: _NS("Next")];
1031     }
1032     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 2"])
1033     {
1034         /* show "Encap" */
1035         [o_tab_pageHolder selectTabViewItemAtIndex:4];
1036     }
1037     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 2"])
1038     {
1039         /* show "Encap" */
1040         [o_tab_pageHolder selectTabViewItemAtIndex:4];
1041     }
1042     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Encap"])
1043     {
1044         /* check whether we are streaming or transcoding and go back */
1045         if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1046         {
1047             /* show "Streaming 1" */
1048             [o_tab_pageHolder selectTabViewItemAtIndex:2];
1049         }else{
1050             /* show "Transcode 2" */
1051             [o_tab_pageHolder selectTabViewItemAtIndex:3];
1052         }
1053     }
1054     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Streaming 1"])
1055     {
1056         /* show "Input" */
1057         [o_tab_pageHolder selectTabViewItemAtIndex:1];
1058     }
1059     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Transcode 1"])
1060     {
1061         /* show "Input" */
1062         [o_tab_pageHolder selectTabViewItemAtIndex:1];
1063     }
1064     else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Input"])
1065     {
1066         /* show "Hello" */
1067         [o_tab_pageHolder selectTabViewItemAtIndex:0];
1068         /* disable backwards-btn */
1069         [o_btn_backward setEnabled:NO];
1070     }
1071 }
1072
1073 - (IBAction)t1_mrInfo_streaming:(id)sender
1074 {
1075     /* show a sheet for the help */
1076     /* since NSAlert does not exist on OSX < 10.3, we use our own implementation */
1077     [o_wh_txt_title setStringValue: _NS("Stream to network")];
1078     [o_wh_txt_text setStringValue: _NS("Use this to stream on a network.")];
1079     [NSApp beginSheet: o_wizardhelp_window
1080             modalForWindow: o_wizard_window
1081             modalDelegate: o_wizardhelp_window
1082             didEndSelector: nil
1083             contextInfo: nil];
1084 }
1085
1086 - (IBAction)t1_mrInfo_transcode:(id)sender
1087 {
1088     /* show a sheet for the help */
1089     [o_wh_txt_title setStringValue: _NS("Transcode/Save to file")];
1090     [o_wh_txt_text setStringValue: _NS("Use this to save a stream to a file. You "\
1091         "have the possibility to reencode the stream. You can save whatever "\
1092         "VLC can read.\nPlease notice that VLC is not very suited " \
1093         "for file to file transcoding. You should use its transcoding " \
1094         "features to save network streams, for example.")];
1095     [NSApp beginSheet: o_wizardhelp_window
1096             modalForWindow: o_wizard_window
1097             modalDelegate: o_wizardhelp_window
1098             didEndSelector: nil
1099             contextInfo: nil];
1100 }
1101
1102 - (IBAction)t2_addNewStream:(id)sender
1103 {
1104     NSOpenPanel * openPanel = [NSOpenPanel openPanel];
1105     SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
1106     [openPanel beginSheetForDirectory:nil file:nil types:nil modalForWindow:o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
1107 }
1108
1109 - (void)t2_getNewStreamFromDialog: (NSOpenPanel *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
1110 {
1111     if (returnCode == NSOKButton)
1112     {
1113         [o_t2_fld_pathToNewStrm setStringValue:[sheet filename]];
1114     }
1115 }
1116
1117 - (IBAction)t2_chooseStreamOrPlst:(id)sender
1118 {
1119     /* enable and disable the respective items depending on user's choice */
1120     NSString *o_mode;
1121     o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
1122
1123     if( [o_mode isEqualToString: _NS("Select a stream")] )
1124     {
1125         [o_t2_btn_chooseFile setEnabled:YES];
1126         [o_t2_fld_pathToNewStrm setEnabled:YES];
1127         [o_t2_tbl_plst setEnabled:NO];
1128     } else {
1129         [o_t2_btn_chooseFile setEnabled:NO];
1130         [o_t2_fld_pathToNewStrm setEnabled:NO];
1131         [o_t2_tbl_plst setEnabled:YES];
1132     }
1133 }
1134
1135 - (IBAction)t2_enableExtract:(id)sender
1136 {
1137     /* enable/disable the respective items */
1138     if([o_t2_ckb_enblPartExtrct state] == NSOnState)
1139     {
1140         [o_t2_fld_prtExtrctFrom setEnabled:YES];
1141         [o_t2_fld_prtExtrctTo setEnabled:YES];
1142     } else {
1143         [o_t2_fld_prtExtrctFrom setEnabled:NO];
1144         [o_t2_fld_prtExtrctTo setEnabled:NO];
1145         [o_t2_fld_prtExtrctFrom setStringValue:@""];
1146         [o_t2_fld_prtExtrctTo setStringValue:@""];
1147     }
1148 }
1149
1150 - (IBAction)t3_strmMthdChanged:(id)sender
1151 {
1152     /* change the captions of o_t3_txt_destInfo according to the chosen
1153      * streaming method */
1154     NSNumber * o_mode;
1155     o_mode = [[NSNumber alloc] initWithInt:[[o_t3_matrix_stmgMhd selectedCell] tag]];
1156     if( [o_mode intValue] == 2 )
1157     {
1158         /* HTTP */
1159         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:0] objectAtIndex:2]];
1160         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:0] objectAtIndex:3]];
1161     }
1162     else if( [o_mode intValue] == 1 )
1163     {
1164         /* UDP-Multicast */
1165         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:1] objectAtIndex:2]];
1166         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:1] objectAtIndex:3]];
1167     }
1168     else if( [o_mode intValue] == 0 )
1169     {
1170         /* UDP-Unicast */
1171         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:2] objectAtIndex:2]];
1172         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:2] objectAtIndex:3]];    }
1173     [o_mode release];
1174 }
1175
1176 - (IBAction)t4_AudCdcChanged:(id)sender
1177 {
1178     /* update codec info */
1179     [o_t4_txt_hintAudio setStringValue:[[o_audioCodecs objectAtIndex:[o_t4_pop_audioCodec indexOfSelectedItem]] objectAtIndex:2]];
1180 }
1181
1182 - (IBAction)t4_enblAudTrnscd:(id)sender
1183 {
1184     /* enable/disable the respective items */
1185     if([o_t4_ckb_audio state] == NSOnState)
1186     {
1187         [o_t4_pop_audioCodec setEnabled:YES];
1188         [o_t4_pop_audioBitrate setEnabled:YES];
1189         [o_t4_txt_hintAudio setStringValue: _NS("Select your audio codec. "\
1190         "Click one to get more information.")];
1191     } else {
1192         [o_t4_pop_audioCodec setEnabled:NO];
1193         [o_t4_pop_audioBitrate setEnabled:NO];
1194         [o_t4_txt_hintAudio setStringValue: _NS("If your stream has audio " \
1195         "and you want to transcode it, enable this.")];
1196     }
1197 }
1198
1199 - (IBAction)t4_enblVidTrnscd:(id)sender
1200 {
1201     /* enable/disable the respective items */
1202     if([o_t4_ckb_video state] == NSOnState)
1203     {
1204         [o_t4_pop_videoCodec setEnabled:YES];
1205         [o_t4_pop_videoBitrate setEnabled:YES];
1206         [o_t4_txt_hintVideo setStringValue: _NS("Select your video codec. "\
1207         "Click one to get more information.")];
1208     } else {
1209         [o_t4_pop_videoCodec setEnabled:NO];
1210         [o_t4_pop_videoBitrate setEnabled:NO];
1211         [o_t4_txt_hintVideo setStringValue: _NS("If your stream has video " \
1212         "and you want to transcode it, enable this.")];
1213     }
1214 }
1215
1216 - (IBAction)t4_VidCdcChanged:(id)sender
1217 {
1218     /* update codec info */
1219     [o_t4_txt_hintVideo setStringValue:[[o_videoCodecs objectAtIndex:[o_t4_pop_videoCodec indexOfSelectedItem]] objectAtIndex:2]];
1220 }
1221
1222 - (IBAction)t6_enblSapAnnce:(id)sender
1223 {
1224     /* enable/disable input fld */
1225     if([o_t6_ckb_sap state] == NSOnState)
1226     {
1227         [o_t6_fld_sap setEnabled:YES];
1228     } else {
1229         [o_t6_fld_sap setEnabled:NO];
1230         [o_t6_fld_sap setStringValue:@""];
1231     }
1232 }
1233
1234 - (IBAction)t6_mrInfo_ttl:(id)sender
1235 {
1236     /* show a sheet for the help */
1237     [o_wh_txt_title setStringValue: _NS("Time-To-Live (TTL)")];
1238     [o_wh_txt_text setStringValue: _NS("Define the TTL (Time-To-Live) of the stream. "\
1239             "This parameter is the maximum number of routers your stream can go "
1240             "through. If you don't know what it means, or if you want to stream on " \
1241             "your local network only, leave this setting to 1.")];
1242     [NSApp beginSheet: o_wizardhelp_window
1243             modalForWindow: o_wizard_window
1244             modalDelegate: o_wizardhelp_window
1245             didEndSelector: nil
1246             contextInfo: nil];
1247 }
1248
1249 - (IBAction)t6_mrInfo_sap:(id)sender
1250 {
1251     /* show a sheet for the help */
1252     [o_wh_txt_title setStringValue: _NS("SAP Announce")];
1253     [o_wh_txt_text setStringValue: _NS("When streaming using UDP, you can " \
1254         "announce your streams using the SAP/SDP announcing protocol. This " \
1255         "way, the clients won't have to type in the multicast address, it " \
1256         "will appear in their playlist if they enable the SAP extra interface.\n" \
1257         "If you want to give a name to your stream, enter it here, " \
1258         "else, a default name will be used.")];
1259     [NSApp beginSheet: o_wizardhelp_window
1260             modalForWindow: o_wizard_window
1261             modalDelegate: o_wizardhelp_window
1262             didEndSelector: nil
1263             contextInfo: nil];
1264 }
1265
1266 - (IBAction)t7_selectTrnscdDestFile:(id)sender
1267 {
1268     /* provide a save-to-dialogue, so the user can choose a location for his/her new file */
1269     NSSavePanel * savePanel = [NSSavePanel savePanel];
1270     SEL sel = @selector(t7_getTrnscdDestFile:returnCode:contextInfo:);
1271     [savePanel setRequiredFileType:[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0]];
1272     [savePanel setCanSelectHiddenExtension:YES];
1273     [savePanel beginSheetForDirectory:nil file:nil modalForWindow:o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
1274 }
1275
1276 - (void)t7_getTrnscdDestFile: (NSSavePanel *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
1277 {
1278     if (returnCode == NSOKButton)
1279     {
1280         /* output returned path to text-field */
1281         [o_t7_fld_filePath setStringValue:[sheet filename]];
1282     }
1283 }
1284
1285 - (IBAction)wh_closeSheet:(id)sender
1286 {
1287     /* close the help sheet */
1288     [NSApp endSheet:o_wizardhelp_window];
1289     [o_wizardhelp_window close];
1290 }
1291
1292 @end