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