]> git.sesse.net Git - vlc/blob - modules/gui/macosx/wizard.m
macosx/wizard: allow partial extract values to be entered in a sane manner (close...
[vlc] / modules / gui / macosx / wizard.m
1 /*****************************************************************************
2  * wizard.m: MacOS X Streaming Wizard
3  *****************************************************************************
4  * Copyright (C) 2005-2012 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Authors: Felix Paul Kühne <fkuehne at videolan dot org>,
8  *          Brendon Justin <brendonjustin at gmail.com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25
26 /*****************************************************************************
27  * Note: this code is partially based upon ../wxwidgets/wizard.cpp and
28  *         ../wxwidgets/streamdata.h; both written by Clément Stenac.
29  *****************************************************************************/
30
31
32 /*****************************************************************************
33  * Preamble
34  *****************************************************************************/
35 #import "CompatibilityFixes.h"
36 #import "wizard.h"
37 #import "intf.h"
38 #import "playlist.h"
39 #import <vlc_interface.h>
40
41 /*****************************************************************************
42  * VLCWizard implementation
43  *****************************************************************************/
44
45 @implementation VLCWizard
46
47 static VLCWizard *_o_sharedInstance = nil;
48
49 + (VLCWizard *)sharedInstance
50 {
51     return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
52 }
53
54 - (id)init
55 {
56     if (_o_sharedInstance) {
57         [self dealloc];
58     } else {
59         _o_sharedInstance = [super init];
60     }
61
62     return _o_sharedInstance;
63 }
64
65 - (void)dealloc
66 {
67     [o_userSelections release];
68     [o_videoCodecs release];
69     [o_audioCodecs release];
70     [o_encapFormats release];
71     [super dealloc];
72 }
73
74 - (void)awakeFromNib
75 {
76     if (!OSX_SNOW_LEOPARD)
77         [o_wizard_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
78
79     /* some minor cleanup */
80     [o_t2_tbl_plst setEnabled:NO];
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",
87         @"128", @"64", @"32", @"16", nil ];
88     [o_t4_pop_audioBitrate removeAllItems];
89     [o_t4_pop_audioBitrate addItemsWithTitles: audioBitratesArray];
90     [o_t4_pop_audioBitrate selectItemWithTitle: @"192"];
91
92     /* add video-bitrates for transcoding */
93     NSArray * videoBitratesArray;
94     videoBitratesArray = [NSArray arrayWithObjects: @"3072", @"2048", @"1024",
95         @"768", @"512", @"256", @"192", @"128", @"64", @"32", @"16", nil ];
96     [o_t4_pop_videoBitrate removeAllItems];
97     [o_t4_pop_videoBitrate addItemsWithTitles: videoBitratesArray];
98     [o_t4_pop_videoBitrate selectItemWithTitle: @"1024"];
99
100     /* fill 2 global arrays with arrays containing all codec-related information
101      * - one array per codec named by its short name to define the encap-compability,
102      *     cmd-names, real names, more info in the order: realName, shortName,
103      *     moreInfo, encaps */
104     NSArray * o_mp1v;
105     NSArray * o_mp2v;
106     NSArray * o_mp4v;
107     NSArray * o_div1;
108     NSArray * o_div2;
109     NSArray * o_div3;
110     NSArray * o_h263;
111     NSArray * o_h264;
112     NSArray * o_wmv1;
113     NSArray * o_wmv2;
114     NSArray * o_mjpg;
115     NSArray * o_theo;
116     NSArray * o_dummyVid;
117     o_mp1v = [NSArray arrayWithObjects: @"MPEG-1 Video", @"mp1v",
118         _NS("MPEG-1 Video codec (usable with MPEG PS, MPEG TS, MPEG1, OGG "
119         "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_OGG", @"MUX_RAW",
120         @"NO", @"NO", @"NO", @"NO", nil];
121     o_mp2v = [NSArray arrayWithObjects: @"MPEG-2 Video", @"mp2v",
122         _NS("MPEG-2 Video codec (usable with MPEG PS, MPEG TS, MPEG1, OGG "
123         "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_OGG", @"MUX_RAW",
124         @"NO", @"NO", @"NO", @"NO", nil];
125     o_mp4v = [NSArray arrayWithObjects: @"MPEG-4 Video", @"mp4v",
126         _NS("MPEG-4 Video codec (useable with MPEG PS, MPEG TS, MPEG1, ASF, "
127         "MP4, OGG and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF",
128         @"MUX_MP4", @"MUX_OGG", @"MUX_RAW", @"NO", @"NO", nil];
129     o_div1 = [NSArray arrayWithObjects: @"DIVX 1", @"DIV1",
130         _NS("DivX first version (useable with MPEG TS, MPEG1, ASF and OGG)"),
131         @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO",
132         @"NO", @"NO", nil];
133     o_div2 = [NSArray arrayWithObjects: @"DIVX 2", @"DIV2",
134         _NS("DivX second version (useable with MPEG TS, MPEG1, ASF and OGG)"),
135         @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO",
136         @"NO", @"NO", nil];
137     o_div3 = [NSArray arrayWithObjects: @"DIVX 3", @"DIV3",
138         _NS("DivX third version (useable with MPEG TS, MPEG1, ASF and OGG)"),
139         @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO",
140         @"NO", @"NO", nil];
141     o_h263 = [NSArray arrayWithObjects: @"H.263", @"h263",
142         _NS("H263 is a video codec optimized for videoconference "
143         "(low rates, useable with MPEG TS)"), @"MUX_TS", @"NO", @"NO", @"NO",
144         @"NO", @"NO", @"NO", @"NO", @"NO", nil];
145     o_h264 = [NSArray arrayWithObjects: @"H.264", @"h264",
146         _NS("H264 is a new video codec (useable with MPEG TS and MP4)"),
147         @"MUX_TS", @"MUX_MP4", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO",
148         @"NO", nil];
149     o_wmv1 = [NSArray arrayWithObjects: @"WMV 1", @"WMV1",
150         _NS("WMV (Windows Media Video) 1 (useable with MPEG TS, MPEG1, ASF and "
151         "OGG)"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO",
152         @"NO", @"NO", @"NO", nil];
153     o_wmv2 = [NSArray arrayWithObjects: @"WMV 2", @"WMV2",
154         _NS("WMV (Windows Media Video) 2 (useable with MPEG TS, MPEG1, ASF and "
155         "OGG)"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO",
156         @"NO", @"NO", @"NO", nil];
157     o_mjpg = [NSArray arrayWithObjects: @"MJPEG", @"MJPG",
158         _NS("MJPEG consists of a series of JPEG pictures (useable with MPEG TS,"
159         " MPEG1, ASF and OGG)"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG",
160         @"NO", @"NO", @"NO", @"NO", @"NO", nil];
161     o_theo = [NSArray arrayWithObjects: @"Theora", @"theo",
162         _NS("Theora is a free general-purpose codec (useable with MPEG TS "
163         "and OGG)"), @"MUX_TS", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO",
164         @"NO", @"NO", nil];
165     o_dummyVid = [NSArray arrayWithObjects: @"Dummy", @"dummy",
166         _NS("Dummy codec (do not transcode, useable with all encapsulation "
167         "formats)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4",
168         @"MUX_OGG", @"MUX_WAV", @"MUX_RAW", @"MUX_MOV", nil];
169     o_videoCodecs = [[NSArray alloc] initWithObjects: o_mp1v, o_mp2v, o_mp4v,
170         o_div1, o_div2, o_div3, o_h263, o_h264, o_wmv1, o_wmv2, o_mjpg, o_theo,
171         o_dummyVid, nil];
172
173
174     NSArray * o_mpga;
175     NSArray * o_mp3;
176     NSArray * o_mp4a;
177     NSArray * o_a52;
178     NSArray * o_vorb;
179     NSArray * o_flac;
180     NSArray * o_spx;
181     NSArray * o_s16l;
182     NSArray * o_fl32;
183     NSArray * o_dummyAud;
184     o_mpga = [NSArray arrayWithObjects: @"MPEG Audio", @"mpga",
185         _NS("The standard MPEG audio (1/2) format (useable with MPEG PS, MPEG TS, "
186         "MPEG1, ASF, OGG and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG",
187         @"MUX_ASF", @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", nil];
188     o_mp3 = [NSArray arrayWithObjects: @"MP3", @"mp3",
189         _NS("MPEG Audio Layer 3 (useable with MPEG PS, MPEG TS, MPEG1, ASF, OGG "
190         "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG",
191         @"MUX_RAW", @"-1", @"-1", @"-1", nil];
192     o_mp4a = [NSArray arrayWithObjects: @"MPEG 4 Audio", @"mp4a",
193         _NS("Audio format for MPEG4 (useable with MPEG TS and MPEG4)"), @"MUX_TS",
194         @"MUX_MP4", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
195     o_a52 = [NSArray arrayWithObjects: @"A/52", @"a52",
196         _NS("DVD audio format (useable with MPEG PS, MPEG TS, MPEG1, ASF, OGG "
197         "and RAW)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG",
198         @"MUX_RAW", @"-1", @"-1", @"-1", nil];
199     o_vorb = [NSArray arrayWithObjects: @"Vorbis", @"vorb",
200         _NS("Vorbis is a free audio codec (useable with OGG)"), @"MUX_OGG",
201         @"-1",  @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
202     o_flac = [NSArray arrayWithObjects: @"FLAC", @"flac",
203         _NS("FLAC is a lossless audio codec (useable with OGG and RAW)"),
204         @"MUX_OGG", @"MUX_RAW", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1",
205         @"-1", nil];
206     o_spx = [NSArray arrayWithObjects: @"Speex", @"spx",
207         _NS("A free audio codec dedicated to compression of voice (useable "
208         "with OGG)"), @"MUX_OGG", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1",
209         @"-1", @"-1", nil];
210     o_s16l = [NSArray arrayWithObjects: @"Uncompressed, integer", @"s16l",
211         _NS("Uncompressed audio samples (useable with WAV)"), @"MUX_WAV",
212         @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
213     o_fl32 = [NSArray arrayWithObjects: @"Uncompressed, floating point", @"fl32",
214         _NS("Uncompressed audio samples (useable with WAV)"), @"MUX_WAV",
215         @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", nil];
216     o_dummyAud = [NSArray arrayWithObjects: @"Dummy", @"dummy",
217         _NS("Dummy codec (do not transcode, useable with all encapsulation "
218         "formats)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4",
219         @"MUX_OGG", @"MUX_RAW", @"MUX_MOV", @"MUX_WAV", nil];
220     o_audioCodecs = [[NSArray alloc] initWithObjects: o_mpga, o_mp3, o_mp4a,
221         o_a52, o_vorb, o_flac, o_spx, o_s16l, o_fl32, o_dummyAud, nil];
222
223
224     /* fill another global array with all information about the encap-formats
225      * note that the order of the formats inside the g. array is the same as on
226      * the encap-tab */
227     NSArray * o_ps;
228     NSArray * o_ts;
229     NSArray * o_mpeg;
230     NSArray * o_ogg;
231     NSArray * o_raw;
232     NSArray * o_asf;
233     NSArray * o_mp4;
234     NSArray * o_mov;
235     NSArray * o_wav;
236     NSArray * o_asfh;
237     o_ps = [NSArray arrayWithObjects: @"ps", @"MPEG PS",
238         _NS("MPEG Program Stream"), @"mpg", nil];
239     o_ts = [NSArray arrayWithObjects: @"ts", @"MPEG TS",
240         _NS("MPEG Transport Stream"), nil];
241     o_mpeg = [NSArray arrayWithObjects: @"ps", @"MPEG 1",
242         _NS("MPEG 1 Format"), @"mpg", nil];
243     o_ogg = [NSArray arrayWithObjects: @"ogg", @"OGG", @"OGG", nil];
244     o_raw = [NSArray arrayWithObjects: @"raw", @"RAW", @"RAW", nil];
245     o_asf = [NSArray arrayWithObjects: @"asf", @"ASF", @"ASF", nil];
246     o_mp4 = [NSArray arrayWithObjects: @"mp4", @"MP4", @"MPEG4", nil];
247     o_mov = [NSArray arrayWithObjects: @"mov", @"MOV", @"MOV", nil];
248     o_wav = [NSArray arrayWithObjects: @"wav", @"WAV", @"WAV", nil];
249     o_asfh = [NSArray arrayWithObjects: @"asfh", @"ASFH", @"ASFH", nil];
250     o_encapFormats = [[NSArray alloc] initWithObjects: o_ps, o_ts, o_mpeg,
251         o_ogg, o_raw, o_asf, o_mp4, o_mov, o_wav, o_asfh, nil];
252
253     /* yet another array on streaming methods including help texts */
254     NSArray * o_http;
255     NSArray * o_mms;
256     NSArray * o_udp_uni;
257     NSArray * o_udp_multi;
258     NSArray * o_rtp_uni;
259     NSArray * o_rtp_multi;
260     o_http = [NSArray arrayWithObjects: @"http", @"HTTP", _NS("Enter the local "
261         "addresses you want to listen requests on. Do not enter anything if "
262         "you want to listen on all the network interfaces. This is generally "
263         "the best thing to do. Other computers can then access the stream at "
264         "http://yourip:8080 by default.") , _NS("Use this to stream to several "
265         "computers. This method is not the most efficient, as the server needs "\
266         "to send the stream several times, but generally the most compatible"), nil];
267     o_mms = [NSArray arrayWithObjects: @"mmsh", @"MMS", _NS("Enter the local "
268         "addresses you want to listen requests on. Do not enter anything if "
269         "you want to listen on all the network interfaces. This is generally "
270         "the best thing to do. Other computers can then access the stream at "
271         "mms://yourip:8080 by default."), _NS("Use this to stream to several "
272         "computers using the Microsoft MMS protocol. This protocol is used as "
273         "transport method by many Microsoft's softwares. Note that only a "
274         "small part of the MMS protocol is supported (MMS encapsulated in "
275         "HTTP)." ), nil];
276     o_udp_uni = [NSArray arrayWithObjects: @"udp", @"UDP-Unicast", _NS("Enter "
277         "the address of the computer to stream to."), _NS("Use this to stream "
278         "to a single computer."), nil];
279     o_udp_multi = [NSArray arrayWithObjects: @"udp", @"UDP-Multicast", _NS("Enter "
280         "the multicast address to stream to in this field. This must be an IP "
281         "address between 224.0.0.0 and 239.255.255.255. For a private use, "
282         "enter an address beginning with 239.255."), _NS("Use this to stream "
283         "to a dynamic group of computers on a multicast-enabled network. This "
284         "is the most efficient method to stream to several computers, but it "
285         "won't work over the Internet."), nil];
286     o_rtp_uni = [NSArray arrayWithObjects: @"rtp", @"RTP-Unicast", _NS("Enter the "
287         "address of the computer to stream to.") , _NS("Use this to stream "
288         "to a single computer. RTP headers will be added to the stream"), nil];
289     o_rtp_multi = [NSArray arrayWithObjects: @"rtp", @"RTP-Multicast", _NS("Enter "
290         "the multicast address to stream to in this field. This must be an IP "
291         "address between 224.0.0.0 and 239.255.255.255. For a private use, "
292         "enter an address beginning with 239.255."), _NS("Use this to stream "
293         "to a dynamic group of computers on a multicast-enabled network. This "
294         "is the most efficient method to stream to several computers, but it "
295         "won't work over Internet. RTP headers will be added to the stream"), nil];
296     o_strmgMthds = [[NSArray alloc] initWithObjects: o_http, o_mms,
297         o_udp_uni, o_udp_multi, o_rtp_uni, o_rtp_multi, nil];
298 }
299
300 - (void)showWizard
301 {
302     /* just present the window to the user */
303     [o_wizard_window center];
304     [o_wizard_window displayIfNeeded];
305     [o_wizard_window makeKeyAndOrderFront:nil];
306 }
307
308 - (void)resetWizard
309 {
310     /* go to the front page and clean up a bit */
311     [o_userSelections removeAllObjects];
312     [o_btn_forward setTitle: _NS("Next")];
313     [o_tab_pageHolder selectFirstTabViewItem:self];
314 }
315
316 - (void)initStrings
317 {
318     /* localise all strings to the users lang */
319     /* method is called from intf.m (in method showWizard) */
320
321     /* general items */
322     [o_btn_backward setTitle: _NS("Back")];
323     [o_btn_cancel setTitle: _NS("Cancel")];
324     [o_btn_forward setTitle: _NS("Next")];
325     [o_wizard_window setTitle: _NS("Streaming/Transcoding Wizard")];
326
327     /* page one ("Hello") */
328     [o_t1_txt_title setStringValue: _NS("Streaming/Transcoding Wizard")];
329     [o_t1_txt_text setStringValue: _NS("This wizard allows configuring "
330         "simple streaming or transcoding setups.")];
331     [o_t1_btn_mrInfo_strmg setTitle: _NS("More Info")];
332     [o_t1_btn_mrInfo_trnscd setTitle: _NS("More Info")];
333     [o_t1_txt_notice setStringValue: _NS("This wizard only gives access to "
334         "a small subset of VLC's streaming and transcoding capabilities. "
335         "The Open and 'Saving/Streaming' dialogs will give access to more "
336         "features.")];
337     [[o_t1_matrix_strmgOrTrnscd cellAtRow:0 column:0] setTitle:
338         _NS("Stream to network")];
339     [[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setTitle:
340         _NS("Transcode/Save to file")];
341
342     /* page two ("Input") */
343     [o_t2_title setStringValue: _NS("Choose input")];
344     [o_t2_text setStringValue: _NS("Choose here your input stream.")];
345     [[o_t2_matrix_inputSourceType cellAtRow:0 column:0] setTitle:
346         _NS("Select a stream")];
347     [[o_t2_matrix_inputSourceType cellAtRow:1 column:0] setTitle:
348         _NS("Existing playlist item")];
349     [o_t2_btn_chooseFile setTitle: _NS("Choose...")];
350     [[[o_t2_tbl_plst tableColumnWithIdentifier:@"name"] headerCell]
351         setStringValue: _NS("Title")];
352     [[[o_t2_tbl_plst tableColumnWithIdentifier:@"artist"] headerCell]
353         setStringValue: _NS("Author")];
354     [[[o_t2_tbl_plst tableColumnWithIdentifier:@"duration"] headerCell]
355      setStringValue: _NS("Duration")];
356     [o_t2_box_prtExtrct setTitle: _NS("Partial Extract")];
357     [o_t2_ckb_enblPartExtrct setTitle: _NS("Enable")];
358     [o_t2_ckb_enblPartExtrct setToolTip: _NS("This can be used to read only a "
359         "part of the stream. It must be possible to control the incoming "
360         "stream (for example, a file or a disc, but not an UDP network stream.) "
361         "The starting and ending times can be given in seconds.")];
362     [o_t2_txt_prtExtrctFrom setStringValue: _NS("From")];
363     [o_t2_txt_prtExtrctTo setStringValue: _NS("To")];
364
365     /* page three ("Streaming 1") */
366     [o_t3_txt_title setStringValue: _NS("Streaming")];
367     [o_t3_txt_text setStringValue: _NS("This page allows selecting how "
368         "the input stream will be sent.")];
369     [o_t3_box_dest setTitle: _NS("Destination")];
370     [o_t3_box_strmgMthd setTitle: _NS("Streaming method")];
371     [o_t3_txt_destInfo setStringValue: _NS("Address of the computer "
372         "to stream to.")];
373     [[o_t3_matrix_stmgMhd cellAtRow:0 column:0] setTitle: _NS("UDP Unicast")];
374     [[o_t3_matrix_stmgMhd cellAtRow:0 column:1] setTitle: _NS("UDP Multicast")];
375     [o_t3_txt_strgMthdInfo setStringValue: _NS("Use this to stream to a single "
376         "computer.")];
377
378     /* page four ("Transcode 1") */
379     [o_t4_title setStringValue: _NS("Transcode")];
380     [o_t4_text setStringValue: _NS("This page allows changing the compression "
381         "format of the audio or video tracks. To change only "
382         "the container format, proceed to next page.")];
383     [o_t4_box_audio setTitle: _NS("Audio")];
384     [o_t4_box_video setTitle: _NS("Video")];
385     [o_t4_ckb_audio setTitle: _NS("Transcode audio")];
386     [o_t4_ckb_video setTitle: _NS("Transcode video")];
387     [o_t4_txt_videoBitrate setStringValue: _NS("Bitrate (kb/s)")];
388     [o_t4_txt_videoCodec setStringValue: _NS("Codec")];
389     [o_t4_txt_hintAudio setStringValue: _NS("Enabling this allows transcoding "\
390     "the audio track if one is present in the stream.")];
391     [o_t4_txt_hintVideo setStringValue: _NS("Enabling this allows transcoding "\
392     "the video track if one is present in the stream.")];
393
394     /* page five ("Encap") */
395     [o_t5_title setStringValue: _NS("Encapsulation format")];
396     [o_t5_text setStringValue: _NS("This page allows selecting how the "
397         "stream will be encapsulated. Depending on previously chosen settings "
398         "all formats won't be available.")];
399
400     /* page six ("Streaming 2") */
401     [o_t6_title setStringValue: _NS("Additional streaming options")];
402     [o_t6_text setStringValue: _NS("In this page, a few "
403                               "additional streaming parameters can be set.")];
404     [o_t6_txt_ttl setStringValue: _NS("Time-To-Live (TTL)")];
405     [o_t6_btn_mrInfo_ttl setTitle: _NS("More Info")];
406     [o_t6_ckb_sap setTitle: _NS("SAP Announce")];
407     [o_t6_btn_mrInfo_sap setTitle: _NS("More Info")];
408     [o_t6_ckb_local setTitle: _NS("Local playback")];
409     [o_t6_btn_mrInfo_local setTitle: _NS("More Info")];
410     [o_t6_ckb_soverlay setTitle: _NS("Add Subtitles to transcoded video")];
411
412     /* page seven ("Transcode 2") */
413     [o_t7_title setStringValue: _NS("Additional transcode options")];
414     [o_t7_text setStringValue: _NS("In this page, a few "
415                               "additional transcoding parameters can be set.")];
416     [o_t7_txt_saveFileTo setStringValue: _NS("Select the file to save to")];
417     [o_t7_btn_chooseFile setTitle: _NS("Choose...")];
418     [o_t7_ckb_local setTitle: _NS("Local playback")];
419     [o_t7_ckb_soverlay setTitle: _NS("Add Subtitles to transcoded video")];
420     [o_t7_ckb_soverlay setToolTip: _NS("Adds available subtitles directly to "
421                                        "the video. These cannot be disabled "
422                                        "by the receiving user as they become "
423                                        "part of the image.")];
424     [o_t7_btn_mrInfo_local setTitle: _NS("More Info")];
425
426     /* page eight ("Summary") */
427     [o_t8_txt_text setStringValue: _NS("This page lists all the settings. "
428         "Click \"Finish\" to start streaming or transcoding.")];
429     [o_t8_txt_title setStringValue: _NS("Summary")];
430     [o_t8_txt_destination setStringValue: [_NS("Destination")
431         stringByAppendingString: @":"]];
432     [o_t8_txt_encapFormat setStringValue: [_NS("Encap. format")
433         stringByAppendingString: @":"]];
434     [o_t8_txt_inputStream setStringValue: [_NS("Input stream")
435         stringByAppendingString: @":"]];
436     [o_t8_txt_partExtract setStringValue: [_NS("Partial Extract")
437         stringByAppendingString: @":"]];
438     [o_t8_txt_sap setStringValue: [_NS("SAP Announce")
439         stringByAppendingString: @":"]];
440     [o_t8_txt_saveFileTo setStringValue: [_NS("Save file to")
441         stringByAppendingString: @":"]];
442     [o_t8_txt_strmgMthd setStringValue: [_NS("Streaming method")
443         stringByAppendingString: @":"]];
444     [o_t8_txt_trnscdAudio setStringValue: [_NS("Transcode audio")
445         stringByAppendingString: @":"]];
446     [o_t8_txt_trnscdVideo setStringValue: [_NS("Transcode video")
447         stringByAppendingString: @":"]];
448     [o_t8_txt_soverlay setStringValue: [_NS("Include subtitles")
449         stringByAppendingString: @":"]];
450     [o_t8_txt_local setStringValue: [_NS("Local playback")
451         stringByAppendingString: @":"]];
452 }
453
454 - (void)initWithExtractValuesFrom: (NSString *)from
455                                to: (NSString *)to
456                            ofItem: (NSString *)item
457 {
458     [self resetWizard];
459     msg_Dbg(VLCIntf, "wizard was reseted");
460     [o_userSelections setObject:@"trnscd" forKey:@"trnscdOrStrmg"];
461     [o_btn_backward setEnabled:YES];
462     [o_tab_pageHolder selectTabViewItemAtIndex:1];
463     [o_t2_fld_prtExtrctFrom setStringValue: from];
464     [o_t2_fld_prtExtrctTo setStringValue: to];
465     [o_t2_fld_pathToNewStrm setStringValue: item];
466     [o_t1_matrix_strmgOrTrnscd selectCellAtRow:1 column:0];
467     [[o_t1_matrix_strmgOrTrnscd cellAtRow:0 column:0] setState: NSOffState];
468     [o_t2_ckb_enblPartExtrct setState: NSOnState];
469     [self t2_enableExtract: nil];
470     msg_Dbg(VLCIntf, "wizard interface is set");
471
472     [o_wizard_window center];
473     [o_wizard_window display];
474     [o_wizard_window makeKeyAndOrderFront:nil];
475     msg_Dbg(VLCIntf, "wizard window displayed");
476 }
477
478 - (IBAction)cancelRun:(id)sender
479 {
480     [o_wizard_window close];
481 }
482
483 - (id)playlistWizard
484 {
485     return o_playlist_wizard;
486 }
487
488 - (IBAction)nextTab:(id)sender
489 {
490     NSString * selectedTabViewItemLabel = [[o_tab_pageHolder selectedTabViewItem] label];
491     if ([selectedTabViewItemLabel isEqualToString: @"Hello"])
492     {
493         /* check whether the user wants to stream or just to transcode;
494          * store information for later usage */
495         NSString *o_mode;
496         o_mode = [[o_t1_matrix_strmgOrTrnscd selectedCell] title];
497         if( [o_mode isEqualToString: _NS("Stream to network")] )
498         {
499             /* we will be streaming */
500             [o_userSelections setObject:@"strmg" forKey:@"trnscdOrStrmg"];
501         }
502         else
503         {
504             /* we will just do some transcoding */
505             [o_userSelections setObject:@"trnscd" forKey:@"trnscdOrStrmg"];
506         }
507         [o_btn_backward setEnabled:YES];
508         [o_tab_pageHolder selectTabViewItemAtIndex:1];
509
510         /* Fill the playlist with current playlist items */
511         [o_playlist_wizard reloadOutlineView];
512
513     }
514     else if ([selectedTabViewItemLabel isEqualToString: @"Input"])
515     {
516         /* check whether partialExtract is enabled and store the values, if needed */
517         if ([o_t2_ckb_enblPartExtrct state] == NSOnState)
518         {
519             [o_userSelections setObject:@"YES" forKey:@"partExtract"];
520             [o_userSelections setObject:[o_t2_fld_prtExtrctFrom stringValue]
521                 forKey:@"partExtractFrom"];
522             [o_userSelections setObject:[o_t2_fld_prtExtrctTo stringValue]
523                 forKey:@"partExtractTo"];
524         }else{
525             [o_userSelections setObject:@"NO" forKey:@"partExtract"];
526         }
527
528         /* check whether we use an existing pl-item or add an new one;
529          * store the path or the index and set a flag.
530          * complain to the user if s/he didn't provide a path */
531         NSString *o_mode;
532         BOOL stop;
533         stop = NO;
534         o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
535         if( [o_mode isEqualToString: _NS("Select a stream")] )
536         {
537             [o_userSelections setObject:@"YES" forKey:@"newStrm"];
538             if ([[o_t2_fld_pathToNewStrm stringValue] isEqualToString: @""])
539             {
540                 /* set a flag that no file is selected */
541                 stop = YES;
542             }
543             else
544             {
545                 [o_userSelections setObject:[NSArray arrayWithObject:
546                     [o_t2_fld_pathToNewStrm stringValue]] forKey:@"pathToStrm"];
547             }
548         }
549         else
550         {
551             if ([o_t2_tbl_plst numberOfSelectedRows] > 0)
552             {
553                 NSIndexSet * selectedIndexes = [o_t2_tbl_plst selectedRowIndexes];
554                 NSUInteger count = [selectedIndexes count];
555                 NSMutableArray * tempArray = [[NSMutableArray alloc] init];
556                 for( NSUInteger x = 0; x < count; x++ )
557                 {
558                     playlist_item_t *p_item = [[o_t2_tbl_plst itemAtRow: [selectedIndexes indexGreaterThanOrEqualToIndex: x]] pointerValue];
559
560                     if( p_item->i_children <= 0 )
561                     {
562                         char *psz_uri = input_item_GetURI( p_item->p_input );
563                         [tempArray addObject: [NSString stringWithUTF8String: psz_uri]];
564                         free( psz_uri );
565                         stop = NO;
566                     }
567                     else
568                         stop = YES;
569                 }
570                 [o_userSelections setObject:[NSArray arrayWithArray: tempArray] forKey:@"pathToStrm"];
571                 [tempArray release];
572             }
573             else
574             {
575                 /* set a flag that no item is selected */
576                 stop = YES;
577             }
578         }
579
580         /* show either "Streaming 1" or "Transcode 1" to the user */
581         if (stop == NO)
582         {
583             if ([[o_userSelections objectForKey:@"trnscdOrStrmg"]
584                 isEqualToString:@"strmg"])
585             {
586                 /* we are streaming */
587                 [o_tab_pageHolder selectTabViewItemAtIndex:2];
588             }else{
589                 /* we are just transcoding */
590
591                 /* rebuild the menues for the codec-selections */
592                 [self rebuildCodecMenus];
593
594                 [o_tab_pageHolder selectTabViewItemAtIndex:3];
595             }
596         } else {
597             /* show a sheet that the user didn't select a file */
598             NSBeginInformationalAlertSheet(_NS("No input selected"),
599                 _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
600                 _NS("No new stream or valid playlist item has been selected.\n\n"
601                 "Choose one before going to the next page."));
602         }
603     }
604     else if ([selectedTabViewItemLabel isEqualToString: @"Streaming 1"])
605     {
606         /* rebuild the menues for the codec-selections */
607         [self rebuildCodecMenus];
608
609         /* check which streaming method is selected and store it */
610         int mode;
611         mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
612         if( mode == 0 )
613         {
614             /* HTTP Streaming */
615             [o_userSelections setObject:@"0" forKey:@"stmgMhd"];
616
617             /* disable all codecs which don't support MPEG PS, MPEG TS, MPEG 1,
618              * OGG, RAW or ASF */
619             [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
620             [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating point"];
621
622         } else if ( mode == 1 )
623         {
624             /* MMS Streaming */
625             [o_userSelections setObject:@"1" forKey:@"stmgMhd"];
626
627             /* disable all codecs which don't support ASF / ASFH */
628             [o_t4_pop_audioCodec removeItemWithTitle:@"Vorbis"];
629             [o_t4_pop_audioCodec removeItemWithTitle:@"FLAC"];
630             [o_t4_pop_audioCodec removeItemWithTitle:@"Speex"];
631             [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
632             [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating point"];
633
634             [o_t4_pop_videoCodec removeItemWithTitle:@"MPEG-1 Video"];
635             [o_t4_pop_videoCodec removeItemWithTitle:@"MPEG-2 Video"];
636             [o_t4_pop_videoCodec removeItemWithTitle:@"H.263"];
637             [o_t4_pop_videoCodec removeItemWithTitle:@"H.264"];
638             [o_t4_pop_videoCodec removeItemWithTitle:@"MJPEG"];
639             [o_t4_pop_videoCodec removeItemWithTitle:@"Theora"];
640         } else {
641             /* RTP/UDP Unicast/Multicast Streaming */
642             [o_userSelections setObject: [[NSNumber numberWithInt: mode]
643                 stringValue] forKey:@"stmgMhd"];
644
645             /* disable all codecs which don't support MPEG-TS */
646             [o_t4_pop_audioCodec removeItemWithTitle:@"Vorbis"];
647             [o_t4_pop_audioCodec removeItemWithTitle:@"FLAC"];
648             [o_t4_pop_audioCodec removeItemWithTitle:@"Speex"];
649             [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
650             [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating point"];
651         }
652
653         /* store the destination and check whether is it empty */
654         if([[o_userSelections objectForKey:@"stmgMhd"] intValue] >=2 )
655         {
656            /* empty field is valid for HTTP and MMS */
657             if( [[o_t3_fld_address stringValue] isEqualToString: @""] )
658             {
659                 /* complain to the user that "" is no valid dest. */
660                 NSBeginInformationalAlertSheet(_NS("No valid destination"),
661                     _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
662                     _NS("A valid destination has to be selected "
663                     "Enter either a Unicast-IP or a Multicast-IP."
664                     "\n\nIf you don't know what this means, have a look at "
665                     "the VLC Streaming HOWTO and the help texts in this "
666                     "window."));
667             } else {
668                 /* FIXME: check whether the entered IP is really valid */
669                 [o_userSelections setObject:[o_t3_fld_address stringValue]
670                     forKey:@"stmgDest"];
671                 /* let's go to the transcode-1-tab */
672                 [o_tab_pageHolder selectTabViewItemAtIndex:3];
673             }
674         } else {
675             [o_userSelections setObject:[o_t3_fld_address stringValue]
676                 forKey:@"stmgDest"];
677             /* let's go to the transcode-1-tab */
678             [o_tab_pageHolder selectTabViewItemAtIndex:3];
679         }
680     }
681     else if ([selectedTabViewItemLabel isEqualToString: @"Transcode 1"])
682     {
683         /* check whether the user wants to transcode the video-track and store
684          * the related options */
685         if ([o_t4_ckb_video state] == NSOnState)
686         {
687             NSNumber * theNum;
688             theNum = [NSNumber numberWithInt:[[o_t4_pop_videoCodec selectedItem]tag]];
689             [o_userSelections setObject:@"YES" forKey:@"trnscdVideo"];
690             [o_userSelections setObject:[o_t4_pop_videoBitrate titleOfSelectedItem]
691                 forKey:@"trnscdVideoBitrate"];
692             [o_userSelections setObject:theNum forKey:@"trnscdVideoCodec"];
693         } else {
694             [o_userSelections setObject:@"NO" forKey:@"trnscdVideo"];
695         }
696
697         /* check whether the user wants to transcode the audio-track and store
698          * the related options */
699         if ([o_t4_ckb_audio state] == NSOnState)
700         {
701             NSNumber * theNum;
702             theNum = [NSNumber numberWithInt:[[o_t4_pop_audioCodec selectedItem]tag]];
703             [o_userSelections setObject:@"YES" forKey:@"trnscdAudio"];
704             [o_userSelections setObject:[o_t4_pop_audioBitrate titleOfSelectedItem]
705                 forKey:@"trnscdAudioBitrate"];
706             [o_userSelections setObject:theNum forKey:@"trnscdAudioCodec"];
707         } else {
708             [o_userSelections setObject:@"NO" forKey:@"trnscdAudio"];
709         }
710
711         /* store the currently selected item for further reference */
712         int i_temp = [[o_t5_matrix_encap selectedCell] tag];
713
714         /* disable all encap-formats */
715         [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
716         [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
717         [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
718         [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
719         [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
720         [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
721         [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
722         [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
723         [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
724         [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
725         [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
726
727         /* re-enable the encap-formats supported by the chosen codecs */
728         /* FIXME: the following is a really bad coding-style. feel free to mail
729             me ideas how to make this nicer, if you want to -- FK, 7/11/05 */
730
731         if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualTo: @"YES"])
732         {
733             NSInteger i_selectedAudioCodec = [[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue];
734
735             if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
736             {
737                 NSInteger i_selectedVideoCodec = [[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue];
738
739                 /* we are transcoding both audio and video, so we need to check both deps */
740                 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_PS"])
741                 {
742                     if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_PS"])
743                     {
744                         [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
745                         [o_t5_matrix_encap selectCellAtRow:0 column:0];
746                     }
747                 }
748                 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_TS"])
749                 {
750                     if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_TS"])
751                     {
752                         [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
753                         [o_t5_matrix_encap selectCellAtRow:1 column:0];
754                     }
755                 }
756                 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MPEG"])
757                 {
758                     if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MPEG"])
759                     {
760                         [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
761                         [o_t5_matrix_encap selectCellAtRow:2 column:0];
762                     }
763                 }
764                 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_OGG"])
765                 {
766                     if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_OGG"])
767                     {
768                         [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
769                         [o_t5_matrix_encap selectCellAtRow:3 column:0];
770                     }
771                 }
772                 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_RAW"])
773                 {
774                     if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_RAW"])
775                     {
776                         [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
777                         [o_t5_matrix_encap selectCellAtRow:4 column:0];
778                     }
779                 }
780                 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_ASF"])
781                 {
782                     if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_ASF"])
783                     {
784                         [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
785                         [o_t5_matrix_encap selectCellAtRow:5 column:0];
786                     }
787                 }
788                 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MP4"])
789                 {
790                     if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MP4"])
791                     {
792                         [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
793                         [o_t5_matrix_encap selectCellAtRow:6 column:0];
794                     }
795                 }
796                 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MOV"])
797                 {
798                     if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MOV"])
799                     {
800                         [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
801                         [o_t5_matrix_encap selectCellAtRow:7 column:0];
802                     }
803                 }
804                 if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_WAV"])
805                 {
806                     if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_WAV"])
807                     {
808                         [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
809                         [o_t5_matrix_encap selectCellAtRow:8 column:0];
810                     }
811                 }
812
813             } else {
814
815                 /* we just transcoding the audio */
816
817                 /* select formats supported by the audio codec */
818                 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_PS"])
819                 {
820                     [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
821                     [o_t5_matrix_encap selectCellAtRow:0 column:0];
822                 }
823                 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_TS"])
824                 {
825                     [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
826                     [o_t5_matrix_encap selectCellAtRow:1 column:0];
827                 }
828                 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MPEG"])
829                 {
830                     [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
831                     [o_t5_matrix_encap selectCellAtRow:2 column:0];
832                 }
833                 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_OGG"])
834                 {
835                     [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
836                     [o_t5_matrix_encap selectCellAtRow:3 column:0];
837                 }
838                 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_RAW"])
839                 {
840                     [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
841                     [o_t5_matrix_encap selectCellAtRow:4 column:0];
842                 }
843                 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_ASF"])
844                 {
845                     [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
846                     [o_t5_matrix_encap selectCellAtRow:5 column:0];
847                 }
848                 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MP4"])
849                 {
850                     [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
851                     [o_t5_matrix_encap selectCellAtRow:6 column:0];
852                 }
853                 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_MOV"])
854                 {
855                     [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
856                     [o_t5_matrix_encap selectCellAtRow:7 column:0];
857                 }
858                 if ([[o_audioCodecs objectAtIndex:i_selectedAudioCodec] containsObject: @"MUX_WAV"])
859                 {
860                     [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
861                     [o_t5_matrix_encap selectCellAtRow:8 column:0];
862                 }
863             }
864         }
865         else if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
866         {
867             /* we are just transcoding the video */
868
869             /* select formats supported by the video-codec */
870             NSInteger i_selectedVideoCodec = [[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue];
871
872             if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_PS"])
873             {
874                 [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
875                 [o_t5_matrix_encap selectCellAtRow:0 column:0];
876             }
877             if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_TS"])
878             {
879                 [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
880                 [o_t5_matrix_encap selectCellAtRow:1 column:0];
881             }
882             if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MPEG"])
883             {
884                 [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
885                 [o_t5_matrix_encap selectCellAtRow:2 column:0];
886             }
887             if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_OGG"])
888             {
889                 [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
890                 [o_t5_matrix_encap selectCellAtRow:3 column:0];
891             }
892             if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_RAW"])
893             {
894                 [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
895                 [o_t5_matrix_encap selectCellAtRow:4 column:0];
896             }
897             if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_ASF"])
898             {
899                 [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
900                 [o_t5_matrix_encap selectCellAtRow:5 column:0];
901             }
902             if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MP4"])
903             {
904                 [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
905                 [o_t5_matrix_encap selectCellAtRow:6 column:0];
906             }
907             if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_MOV"])
908             {
909                 [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
910                 [o_t5_matrix_encap selectCellAtRow:7 column:0];
911             }
912             if ([[o_videoCodecs objectAtIndex:i_selectedVideoCodec] containsObject: @"MUX_WAV"])
913             {
914                 [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
915                 [o_t5_matrix_encap selectCellAtRow:8 column:0];
916             }
917         } else {
918             /* we don't do any transcoding
919              * -> enabled the encap-formats allowed when streaming content via
920              * http plus MP4 since this should work fine in most cases */
921
922             /* FIXME: choose a selection of encap-formats based upon the
923              * actually used codecs */
924
925             /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW, ASF, MP4 and MOV
926              * select MPEG PS */
927             [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
928             [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
929             [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
930             [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
931             [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
932             [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
933             [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
934             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
935             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
936             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
937             [o_t5_matrix_encap selectCellAtRow:0 column:0];
938         }
939
940         NSInteger i_streamingMethod = [[o_userSelections objectForKey:@"stmgMhd"] intValue];
941         if ( i_streamingMethod == 1 )
942         {
943             /* if MMS is the streaming protocol, only ASFH is available */
944             [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
945             [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
946             [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
947             [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
948             [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
949             [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
950             [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
951             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
952             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
953             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
954             [o_t5_matrix_encap selectCellAtRow:9 column:0];
955         }
956         else if ( i_streamingMethod == 0 )
957         {
958             /* if HTTP is the streaming protocol, disable all unsupported
959              * encap-formats, but don't touch the other ones selected above */
960             [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
961             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
962             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
963             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
964         }
965         else if ( i_streamingMethod >= 2 )
966         {
967             /* if UDP/RTP is the streaming protocol, only MPEG-TS is available */
968             [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
969             [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
970             [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
971             [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
972             [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
973             [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
974             [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
975             [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
976             [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
977             [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
978             [o_t5_matrix_encap selectCellAtRow:1 column:0];
979         }
980
981         BOOL anythingEnabled;
982         anythingEnabled = NO;
983         NSUInteger count = [o_t5_matrix_encap numberOfRows];
984         for (NSUInteger x = 0; x < count; x++ )
985         {
986             if ([[o_t5_matrix_encap cellAtRow:x column:0] isEnabled])
987                 anythingEnabled = YES;
988         }
989
990         if (anythingEnabled == YES)
991         {
992             /* re-select the previously chosen item, if available */
993             if( [[o_t5_matrix_encap cellWithTag: i_temp] isEnabled] )
994                 [o_t5_matrix_encap selectCellWithTag: i_temp];
995
996             /* go the encap-tab */
997             [o_tab_pageHolder selectTabViewItemAtIndex:4];
998         } else {
999             /* show a sheet that the selected codecs are not compatible */
1000             NSBeginInformationalAlertSheet(_NS("Invalid selection"), _NS("OK"),
1001                 @"", @"", o_wizard_window, nil, nil, nil, nil, _NS("The "
1002                 "chosen codecs are not compatible with each other. For example: "
1003                 "It is not possible to mix uncompressed audio with any video codec.\n\n"
1004                 "Correct your selection and try again."));
1005         }
1006
1007     }
1008     else if ([selectedTabViewItemLabel isEqualToString: @"Encap"])
1009     {
1010         /* get the chosen encap format and store it */
1011         NSNumber * theNum;
1012         theNum = [NSNumber numberWithInt:[[o_t5_matrix_encap selectedCell] tag]];
1013         [o_userSelections setObject:[theNum stringValue] forKey:@"encapFormat"];
1014
1015         /* show either "Streaming 2" or "Transcode 2" to the user */
1016         if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1017         {
1018             /* we are streaming */
1019             [o_tab_pageHolder selectTabViewItemAtIndex:5];
1020         }else{
1021             /* we are just transcoding */
1022             [o_tab_pageHolder selectTabViewItemAtIndex:6];
1023             /* in case that we are processing multiple items, let the user
1024              * select a folder instead of a localtion for a single item */
1025             if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
1026             {
1027                 [o_t7_txt_saveFileTo setStringValue:
1028                     _NS("Select the directory to save to")];
1029             }
1030             else
1031             {
1032                 [o_t7_txt_saveFileTo setStringValue:
1033                     _NS("Select the file to save to")];
1034             }
1035         }
1036     }
1037     else if ([selectedTabViewItemLabel isEqualToString: @"Streaming 2"])
1038     {
1039         /* store the chosen TTL */
1040         [o_userSelections setObject:[o_t6_fld_ttl stringValue] forKey:@"ttl"];
1041
1042         /* check whether SAP is enabled and store the announce, if needed */
1043         if ([o_t6_ckb_sap state] == NSOnState)
1044         {
1045             [o_userSelections setObject:@"YES" forKey:@"sap"];
1046             [o_userSelections setObject:[o_t6_fld_sap stringValue] forKey:@"sapText"];
1047         } else {
1048             [o_userSelections setObject:@"NO" forKey:@"sap"];
1049         }
1050
1051         /* local playback? */
1052         if ([o_t6_ckb_local state] == NSOnState)
1053         {
1054             [o_userSelections setObject:@"YES" forKey:@"localPb"];
1055         } else {
1056             [o_userSelections setObject:@"NO" forKey:@"localPb"];
1057         }
1058
1059         /* include subtitles? */
1060         [o_userSelections setObject:
1061             [[NSNumber numberWithInt:[o_t6_ckb_soverlay state]] stringValue]
1062                              forKey: @"soverlay"];
1063
1064         /* go to "Summary" */
1065         [self showSummary];
1066     }
1067     else if ([selectedTabViewItemLabel isEqualToString: @"Transcode 2"])
1068     {
1069         /* local playback? */
1070         if ([o_t7_ckb_local state] == NSOnState)
1071         {
1072             [o_userSelections setObject:@"YES" forKey:@"localPb"];
1073         } else {
1074             [o_userSelections setObject:@"NO" forKey:@"localPb"];
1075         }
1076
1077         /* check whether the path != "" and store it */
1078         if( [[o_t7_fld_filePath stringValue] isEqualToString: @""] )
1079         {
1080             /* complain to the user that "" is no valid path for a folder/file */
1081             if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
1082                 NSBeginInformationalAlertSheet(_NS("No folder selected"),
1083                     _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1084                     @"%@\n\n%@", _NS("A directory "
1085                     "where to save the files has to be selected."),
1086                     _NS("Enter either a valid path or use the \"Choose...\" "
1087                     "button to select a location."));
1088             else
1089                 NSBeginInformationalAlertSheet(_NS("No file selected"),
1090                     _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1091                     @"%@\n\n%@", _NS("A file "
1092                     "where to save the stream has to be selected."),
1093                     _NS("Enter either a valid path or use the \"Choose\" "
1094                     "button to select a location."));
1095         } else {
1096             /* create a string containing the requested suffix for later usage */
1097             NSString * theEncapFormat = [[o_encapFormats objectAtIndex:
1098                 [[o_userSelections objectForKey:@"encapFormat"] intValue]]
1099                 objectAtIndex:0];
1100             if( theEncapFormat == @"ps" )
1101                 theEncapFormat = @"mpg";
1102
1103             /* look whether we need to process multiple items or not.
1104              * choose a faster variant if we just want a single item */
1105             if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
1106             {
1107                 NSMutableArray * tempArray = [[NSMutableArray alloc] init];
1108                 int x = 0;
1109                 int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
1110                 NSMutableString * tempString = [[NSMutableString alloc] init];
1111                 while( x != y )
1112                 {
1113                     NSString * fileNameToUse;
1114                     /* check whether the extension is hidden or not.
1115                      * if not, remove it
1116                      * we need the casting to make GCC4 happy */
1117                     if( [[[NSFileManager defaultManager] attributesOfItemAtPath:
1118                         [[o_userSelections objectForKey:@"pathToStrm"]
1119                          objectAtIndex: x] error:nil] objectForKey:
1120                         NSFileExtensionHidden] )
1121                         fileNameToUse = [NSString stringWithString:
1122                             [[NSFileManager defaultManager] displayNameAtPath:
1123                             [[o_userSelections objectForKey:@"pathToStrm"]
1124                             objectAtIndex: x]]];
1125                     else
1126                     {
1127                         int z = 0;
1128                         int count = [[[[NSFileManager defaultManager]
1129                             displayNameAtPath:
1130                             [[o_userSelections objectForKey:@"pathToStrm"]
1131                             objectAtIndex: x]]
1132                             componentsSeparatedByString: @"."] count];
1133                         fileNameToUse = @"";
1134                         while( z < (count - 1) )
1135                         {
1136                             fileNameToUse = [fileNameToUse stringByAppendingString:
1137                                 [[[[NSFileManager defaultManager]
1138                                 displayNameAtPath:
1139                                 [[o_userSelections objectForKey:@"pathToStrm"]
1140                                 objectAtIndex: x]]
1141                                 componentsSeparatedByString: @"."]
1142                                 objectAtIndex: z]];
1143                             z += 1;
1144                         }
1145                     }
1146                     tempString = [NSString stringWithFormat: @"%@%@.%@",
1147                         [o_t7_fld_filePath stringValue],
1148                         fileNameToUse, theEncapFormat];
1149                     if( [[NSFileManager defaultManager] fileExistsAtPath:
1150                         tempString] )
1151                     {
1152                         /* we don't wanna overwrite existing files, so add an
1153                          * int to the file-name */
1154                         int additionalInt = 1;
1155                         while( additionalInt < 100 )
1156                         {
1157                             tempString = [NSString stringWithFormat:@"%@%@ %i.%@",
1158                                 [o_t7_fld_filePath stringValue],
1159                                 fileNameToUse, additionalInt, theEncapFormat];
1160                             if(! [[NSFileManager defaultManager]
1161                                 fileExistsAtPath: tempString] )
1162                                 break;
1163                             additionalInt += 1;
1164                         }
1165                         if( additionalInt >= 100 )
1166                             msg_Err( VLCIntf, "Files with the same name are "
1167                                 "already present in the destination directory. "
1168                                 "Delete these files or choose a different directory." );
1169                     }
1170                     [tempArray addObject: [tempString retain]];
1171                     x += 1;
1172                 }
1173                 [o_userSelections setObject: [NSArray arrayWithArray:tempArray]
1174                     forKey: @"trnscdFilePath"];
1175                 [tempArray release];
1176                 [tempString release];
1177             }
1178             else
1179             {
1180                 /* we don't need to check for existing items because Cocoa
1181                  * does that already when we are asking the user for a location
1182                  * to save her file */
1183                 [o_userSelections setObject: [NSArray arrayWithObject:
1184                     [o_t7_fld_filePath stringValue]] forKey: @"trnscdFilePath"];
1185             }
1186
1187             /* include subtitles ? */
1188             [o_userSelections setObject:
1189                 [[NSNumber numberWithInt:[o_t7_ckb_soverlay state]] stringValue]
1190                                  forKey: @"soverlay"];
1191
1192             /* go to "Summary" */
1193             [self showSummary];
1194         }
1195     }
1196     else if ([selectedTabViewItemLabel isEqualToString: @"Summary"])
1197     {
1198         intf_thread_t * p_intf = VLCIntf;
1199
1200         playlist_t * p_playlist = pl_Get( p_intf );
1201
1202         int x = 0;
1203         int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
1204         while( x != y )
1205         {
1206             /* we need a temp. variable here to work-around a GCC4-bug */
1207             NSString *tempString = [NSString stringWithFormat:
1208                 @"%@ (%i/%i)", _NS("Streaming/Transcoding Wizard"),
1209                 ( x + 1 ), y];
1210             input_item_t *p_input = input_item_New(
1211                 [[[o_userSelections objectForKey:@"pathToStrm"]
1212                 objectAtIndex:x] UTF8String],
1213                 [tempString UTF8String] );
1214
1215             /* use the MRL from the text field, in case the user
1216              * modified it */
1217             input_item_AddOption( p_input, [[o_t8_fld_mrl stringValue] UTF8String], VLC_INPUT_OPTION_TRUSTED );
1218
1219             if(! [[o_userSelections objectForKey:@"partExtractFrom"]
1220                 isEqualToString:@""]) {
1221                 NSArray * components = [o_userSelections objectForKey: @"partExtractFrom"] componentsSeparatedByString:@":"];
1222                 NSUInteger componentCount = [components count];
1223                 NSUInteger time = 0;
1224                 if (componentCount == 1)
1225                     time = 1000000 * ([[components objectAtIndex:0] intValue]);
1226                 else if (componentCount == 2)
1227                     time = 1000000 * ([[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue]);
1228                 else if (componentCount == 3)
1229                     time = 1000000 * ([[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue]);
1230                 else
1231                     msg_Err(VLCIntf, "Invalid string format for time");
1232                 input_item_AddOption(p_input, [[NSString stringWithFormat: @"start-time=%lu", time] UTF8String], VLC_INPUT_OPTION_TRUSTED);
1233             }
1234
1235             if(! [[o_userSelections objectForKey:@"partExtractTo"]
1236                 isEqualToString:@""]) {
1237                 NSArray * components = [[o_userSelections
1238                     objectForKey: @"partExtractTo"] componentsSeparatedByString:@":"];
1239                 NSUInteger componentCount = [components count];
1240                 NSUInteger time = 0;
1241                 if (componentCount == 1)
1242                     time = 1000000 * ([[components objectAtIndex:0] intValue]);
1243                 else if (componentCount == 2)
1244                     time = 1000000 * ([[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue]);
1245                 else if (componentCount == 3)
1246                     time = 1000000 * ([[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue]);
1247                 else
1248                     msg_Err(VLCIntf, "Invalid string format for time");
1249                 input_item_AddOption(p_input, [[NSString stringWithFormat: @"stop-time=%lu", time] UTF8String], VLC_INPUT_OPTION_TRUSTED);
1250             }
1251
1252             input_item_AddOption( p_input, [[NSString stringWithFormat:
1253                 @"ttl=%@", [o_userSelections objectForKey:@"ttl"]]
1254                 UTF8String],
1255                 VLC_INPUT_OPTION_TRUSTED );
1256
1257             int returnValue = playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked );
1258
1259             if( x == 0 && returnValue != VLC_SUCCESS)
1260             {
1261                 /* play the first item and add the others afterwards */
1262                 PL_LOCK;
1263                 playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
1264                 playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
1265                           p_item );
1266                 PL_UNLOCK;
1267             }
1268
1269             vlc_gc_decref( p_input );
1270             x += 1;
1271         }
1272
1273         /* close the window, since we are done */
1274         [o_wizard_window close];
1275     }
1276 }
1277
1278 - (void)rebuildCodecMenus
1279 {
1280     int savePreviousSel = 0;
1281     savePreviousSel = [o_t4_pop_videoCodec indexOfSelectedItem];
1282     [o_t4_pop_videoCodec removeAllItems];
1283     NSUInteger count = [o_videoCodecs count];
1284     for (NSUInteger x = 0; x < count; x++ )
1285     {
1286         [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x]
1287             objectAtIndex:0]];
1288         [[o_t4_pop_videoCodec lastItem] setTag:x];
1289     }
1290     if( savePreviousSel >= 0 )
1291         [o_t4_pop_videoCodec selectItemAtIndex: savePreviousSel];
1292
1293     savePreviousSel = [o_t4_pop_audioCodec indexOfSelectedItem];
1294     [o_t4_pop_audioCodec removeAllItems];
1295     count = [o_audioCodecs count];
1296     for (NSUInteger x = 0; x < count; x++)
1297     {
1298         [o_t4_pop_audioCodec addItemWithTitle:[[o_audioCodecs objectAtIndex:x]
1299             objectAtIndex:0]];
1300         [[o_t4_pop_audioCodec lastItem] setTag:x];
1301     }
1302     if( savePreviousSel >= 0 )
1303         [o_t4_pop_audioCodec selectItemAtIndex: savePreviousSel];
1304 }
1305
1306 - (void)showSummary
1307 {
1308     [o_btn_forward setTitle: _NS("Finish")];
1309     /* if we will transcode multiple items, just give their number; otherwise
1310      * print the URI of the single item */
1311     if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
1312         [o_t8_fld_inptStream setStringValue: [NSString stringWithFormat:
1313             _NS("%i items"),
1314             [[o_userSelections objectForKey:@"pathToStrm"] count]]];
1315     else
1316         [o_t8_fld_inptStream setStringValue:
1317             [[o_userSelections objectForKey:@"pathToStrm"] objectAtIndex: 0]];
1318
1319     if ([[o_userSelections objectForKey:@"localPb"] isEqualToString: @"YES"])
1320     {
1321         [o_t8_fld_local setStringValue: _NS("yes")];
1322     } else {
1323         [o_t8_fld_local setStringValue: _NS("no")];
1324     }
1325
1326     if ([[o_userSelections objectForKey:@"partExtract"] isEqualToString: @"YES"])
1327     {
1328         [o_t8_fld_partExtract setStringValue: [NSString stringWithFormat:
1329             _NS("yes: from %@ to %@"),
1330             [o_userSelections objectForKey:@"partExtractFrom"],
1331             [o_userSelections objectForKey:@"partExtractTo"]]];
1332     } else {
1333         [o_t8_fld_partExtract setStringValue: _NS("no")];
1334     }
1335
1336     if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
1337     {
1338         [o_t8_fld_trnscdVideo setStringValue: [NSString stringWithFormat:
1339             _NS("yes: %@ @ %@ kb/s"),
1340             [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
1341             @"trnscdVideoCodec"] intValue]] objectAtIndex:0],
1342             [o_userSelections objectForKey:@"trnscdVideoBitrate"]]];
1343     }
1344     else
1345     {
1346         [o_t8_fld_trnscdVideo setStringValue: _NS("no")];
1347     }
1348
1349     if ([[o_userSelections objectForKey:@"soverlay"] isEqualToString:@"1"])
1350         [o_t8_fld_soverlay setStringValue: _NS("yes")];
1351     else
1352         [o_t8_fld_soverlay setStringValue: _NS("no")];
1353
1354     if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
1355     {
1356         [o_t8_fld_trnscdAudio setStringValue: [NSString stringWithFormat:
1357             _NS("yes: %@ @ %@ kb/s"),
1358             [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
1359                 @"trnscdAudioCodec"] intValue]] objectAtIndex:0],
1360             [o_userSelections objectForKey:@"trnscdAudioBitrate"]]];
1361     }
1362     else
1363     {
1364         [o_t8_fld_trnscdAudio setStringValue: _NS("no")];
1365     }
1366
1367     if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1368     {
1369         /* we are streaming and perhaps also transcoding */
1370         [o_t8_fld_saveFileTo setStringValue: @"-"];
1371         [o_t8_fld_strmgMthd setStringValue: [[o_strmgMthds objectAtIndex:
1372             [[o_userSelections objectForKey:@"stmgMhd"] intValue]]
1373             objectAtIndex:1]];
1374         [o_t8_fld_destination setStringValue: [o_userSelections objectForKey:
1375             @"stmgDest"]];
1376         [o_t8_fld_ttl setStringValue: [o_userSelections objectForKey:@"ttl"]];
1377         if ([[o_userSelections objectForKey:@"sap"] isEqualToString: @"YES"])
1378         {
1379             [o_t8_fld_sap setStringValue:
1380                 [_NS("yes") stringByAppendingFormat: @": \"%@\"",
1381                     [o_userSelections objectForKey:@"sapText"]]];
1382         }else{
1383             [o_t8_fld_sap setStringValue: _NS("no")];
1384         }
1385     } else {
1386         /* we are transcoding */
1387         [o_t8_fld_strmgMthd setStringValue: @"-"];
1388         [o_t8_fld_destination setStringValue: @"-"];
1389         [o_t8_fld_ttl setStringValue: @"-"];
1390         [o_t8_fld_sap setStringValue: @"-"];
1391         /* do only show the destination of the first item and add a counter, if needed */
1392         if( [[o_userSelections objectForKey: @"trnscdFilePath"] count] > 1 )
1393             [o_t8_fld_saveFileTo setStringValue:
1394                 [NSString stringWithFormat: @"%@ (+%li)",
1395                 [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex:0],
1396                 ([[o_userSelections objectForKey: @"trnscdFilePath"] count] - 1)]];
1397         else
1398             [o_t8_fld_saveFileTo setStringValue:
1399                 [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex:0]];
1400     }
1401     [o_t8_fld_encapFormat setStringValue: [[o_encapFormats objectAtIndex:
1402         [[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:1]];
1403
1404     [self createOpts];
1405     [o_t8_fld_mrl setStringValue: [[o_userSelections objectForKey:@"opts"]
1406         objectAtIndex: 0]];
1407
1408     [o_tab_pageHolder selectTabViewItemAtIndex:7];
1409 }
1410
1411 - (void) createOpts
1412 {
1413     NSMutableString * o_opts_string = [NSMutableString stringWithString:@""];
1414     NSMutableString *o_trnscdCmd = [NSMutableString stringWithString:@""];
1415     NSMutableString *o_duplicateCmd = [NSMutableString stringWithString:@""];
1416     int x = 0;
1417     int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
1418     NSMutableArray * tempArray = [[NSMutableArray alloc] init];
1419
1420     /* loop to create an opt-string for each item we're processing */
1421     while( x != y )
1422     {
1423         /* check whether we transcode the audio and/or the video and compose a
1424          * string reflecting the settings, if needed */
1425         if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
1426         {
1427             [o_trnscdCmd appendString: @"transcode{"];
1428             [o_trnscdCmd appendFormat: @"vcodec=%@,vb=%i",
1429                 [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdVideoCodec"] intValue]] objectAtIndex:1],
1430                 [[o_userSelections objectForKey:@"trnscdVideoBitrate"] intValue]];
1431             if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
1432             {
1433                 [o_trnscdCmd appendString: @","];
1434             }
1435             else
1436             {
1437                 [o_trnscdCmd appendString: @"}:"];
1438             }
1439         }
1440
1441         /* check whether the user requested local playback. if yes, prepare the
1442          * string, if not, let it empty */
1443         if ([[o_userSelections objectForKey:@"localPb"] isEqualToString:@"YES"])
1444         {
1445             [o_duplicateCmd appendString: @"duplicate{dst=display,dst=\""];
1446         }
1447
1448         if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
1449         {
1450             if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"NO"])
1451             {
1452                 /* in case we transcode the audio only, add this */
1453                 [o_trnscdCmd appendString: @"transcode{"];
1454             }
1455             [o_trnscdCmd appendFormat: @"acodec=%@,ab=%i}:",
1456                 [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:@"trnscdAudioCodec"] intValue]] objectAtIndex:1],
1457                 [[o_userSelections objectForKey:@"trnscdAudioBitrate"] intValue]];
1458         }
1459
1460         if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"trnscd"])
1461         {
1462             /* we are just transcoding and dumping the stuff to a file */
1463             [o_opts_string appendFormat:
1464                 @":sout=#%@%@standard{mux=%@,dst=%@,access=file}",
1465                 o_duplicateCmd,
1466                 o_trnscdCmd,
1467                 [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0],
1468                 [[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex: x]];
1469         }
1470         else
1471         {
1472
1473             /* we are streaming */
1474             if ([[o_userSelections objectForKey:@"sap"] isEqualToString:@"YES"])
1475             {
1476                 /* SAP-Announcement is requested */
1477                 NSMutableString *o_sap_option = [NSMutableString stringWithString:@""];
1478                 if([[o_userSelections objectForKey:@"sapText"] isEqualToString:@""])
1479                 {
1480                     [o_sap_option appendString: @"sap"];
1481                 }
1482                 else
1483                 {
1484                     [o_sap_option appendFormat: @"sap,name=\"%@\"",
1485                         [o_userSelections objectForKey:@"sapText"]];
1486                 }
1487                 if( [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp" )
1488                 {
1489                     /* RTP is no access out, but a stream out module */
1490                     [o_opts_string appendFormat:
1491                                              @":sout=#%@%@rtp{mux=%@,dst=%@,%@}",
1492                         o_duplicateCmd, o_trnscdCmd,
1493                         [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1494                         [o_userSelections objectForKey: @"stmgDest"],
1495                         o_sap_option];
1496                 }
1497                 else
1498                 {
1499                     [o_opts_string appendFormat:
1500                                              @":sout=#%@%@standard{mux=%@,dst=%@,access=%@,%@}",
1501                         o_duplicateCmd, o_trnscdCmd,
1502                         [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1503                         [o_userSelections objectForKey: @"stmgDest"],
1504                         [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0],
1505                         o_sap_option];
1506                 }
1507             }
1508             else
1509             {
1510                 /* no SAP, just streaming */
1511                 if( [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp" )
1512                 {
1513                     /* RTP is different from the other protocols, as it isn't provided through an access out module anymore */
1514                     [o_opts_string appendFormat:
1515                                              @":sout=#%@%@rtp{mux=%@,dst=%@}",
1516                         o_duplicateCmd,
1517                         o_trnscdCmd,
1518                         [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1519                         [o_userSelections objectForKey: @"stmgDest"]];
1520                 }
1521                 else
1522                 {
1523                     /* all other protocols are cool */
1524                     [o_opts_string appendFormat:
1525                                              @":sout=#%@%@standard{mux=%@,dst=%@,access=%@}",
1526                         o_duplicateCmd,
1527                         o_trnscdCmd,
1528                         [[o_encapFormats objectAtIndex: [[o_userSelections objectForKey: @"encapFormat"] intValue]] objectAtIndex:0],
1529                         [o_userSelections objectForKey: @"stmgDest"],
1530                         [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0]];
1531                 }
1532             }
1533         }
1534
1535         /* check whether the user requested local playback. if yes, close the
1536          * string with an additional bracket */
1537         if ([[o_userSelections objectForKey:@"localPb"] isEqualToString:@"YES"])
1538         {
1539             [o_opts_string appendString: @"\"}"];
1540         }
1541
1542         /* add subtitles to the video if desired */
1543         if ([[o_userSelections objectForKey:@"soverlay"] intValue] > 0)
1544             [o_opts_string appendString: @" --sout-transcode-soverlay"];
1545
1546         [tempArray addObject: o_opts_string];
1547
1548         o_opts_string = [NSMutableString stringWithString:@""];
1549         o_trnscdCmd = [NSMutableString stringWithString:@""];
1550         o_duplicateCmd = [NSMutableString stringWithString:@""];
1551         x += 1;
1552     }
1553     [o_userSelections setObject:[NSArray arrayWithArray: tempArray] forKey:@"opts"];
1554     [tempArray release];
1555 }
1556
1557 - (IBAction)prevTab:(id)sender
1558 {
1559     NSString * selectedTabViewItemLabel = [[o_tab_pageHolder selectedTabViewItem] label];
1560
1561     if ([selectedTabViewItemLabel isEqualToString: @"Summary"])
1562     {
1563         /* check whether we are streaming or transcoding and go back */
1564         if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1565         {
1566             /* show "Streaming 2" */
1567             [o_tab_pageHolder selectTabViewItemAtIndex:5];
1568         }else{
1569             /* show "Transcode 2" */
1570             [o_tab_pageHolder selectTabViewItemAtIndex:6];
1571         }
1572         /* rename the forward-button */
1573         [o_btn_forward setTitle: _NS("Next")];
1574     }
1575     else if ([selectedTabViewItemLabel isEqualToString: @"Transcode 2"])
1576     {
1577         /* show "Encap" */
1578         [o_tab_pageHolder selectTabViewItemAtIndex:4];
1579     }
1580     else if ([selectedTabViewItemLabel isEqualToString: @"Streaming 2"])
1581     {
1582         /* show "Encap" */
1583         [o_tab_pageHolder selectTabViewItemAtIndex:4];
1584     }
1585     else if ([selectedTabViewItemLabel isEqualToString: @"Encap"])
1586     {
1587         /* show "Transcode 1" */
1588         [o_tab_pageHolder selectTabViewItemAtIndex:3];
1589     }
1590     else if ([selectedTabViewItemLabel isEqualToString: @"Streaming 1"])
1591     {
1592         /* show "Input" */
1593         [o_tab_pageHolder selectTabViewItemAtIndex:1];
1594     }
1595     else if ([selectedTabViewItemLabel isEqualToString: @"Transcode 1"])
1596     {
1597         if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
1598         {
1599             /* show "Streaming 1" */
1600             [o_tab_pageHolder selectTabViewItemAtIndex:2];
1601         }else{
1602             /* show "Input" */
1603             [o_tab_pageHolder selectTabViewItemAtIndex:1];
1604         }
1605     }
1606     else if ([selectedTabViewItemLabel isEqualToString: @"Input"])
1607     {
1608         /* reset the wizard before going backwards. Otherwise, we might get
1609          * unwanted behaviour in the Encap-Selection */
1610         [self resetWizard];
1611         /* show "Hello" */
1612         [o_tab_pageHolder selectTabViewItemAtIndex:0];
1613         /* disable backwards-btn */
1614         [o_btn_backward setEnabled:NO];
1615     }
1616 }
1617
1618 - (IBAction)t1_mrInfo_streaming:(id)sender
1619 {
1620     /* show a sheet for the help */
1621     NSBeginInformationalAlertSheet(_NS("Stream to network"),
1622         _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1623         _NS("This allows streaming on a network."));
1624 }
1625
1626 - (IBAction)t1_mrInfo_transcode:(id)sender
1627 {
1628     /* show a sheet for the help */
1629     NSBeginInformationalAlertSheet(_NS("Transcode/Save to file"),
1630         _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1631         _NS("This allows saving a stream to a file. The "
1632         "can be reencoded on the fly. Whatever "
1633         "VLC can read can be saved.\nPlease note that VLC is not very suited "
1634         "for file to file transcoding. Its transcoding "
1635         "features are however useful to save network streams, for example."));
1636 }
1637
1638 - (IBAction)t2_addNewStream:(id)sender
1639 {
1640     NSOpenPanel * openPanel = [NSOpenPanel openPanel];
1641     SEL sel = @selector(t2_getNewStreamFromDialog:returnCode:contextInfo:);
1642     [openPanel beginSheetModalForWindow: o_wizard_window completionHandler: ^(NSInteger returnCode) {
1643         if (returnCode == NSOKButton)
1644             [o_t2_fld_pathToNewStrm setStringValue: [[openPanel URL] absoluteString]];
1645     }];
1646 }
1647
1648 - (IBAction)t2_chooseStreamOrPlst:(id)sender
1649 {
1650     /* enable and disable the respective items depending on user's choice */
1651     NSString *o_mode;
1652     o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
1653
1654     if( [o_mode isEqualToString: _NS("Select a stream")] )
1655     {
1656         [o_t2_btn_chooseFile setEnabled:YES];
1657         [o_t2_fld_pathToNewStrm setEnabled:YES];
1658         [o_t2_tbl_plst setEnabled:NO];
1659     } else {
1660         [o_t2_btn_chooseFile setEnabled:NO];
1661         [o_t2_fld_pathToNewStrm setEnabled:NO];
1662         [o_t2_tbl_plst setEnabled:YES];
1663     }
1664 }
1665
1666 - (IBAction)t2_enableExtract:(id)sender
1667 {
1668     /* enable/disable the respective items */
1669     if([o_t2_ckb_enblPartExtrct state] == NSOnState)
1670     {
1671         [o_t2_fld_prtExtrctFrom setEnabled:YES];
1672         [o_t2_fld_prtExtrctTo setEnabled:YES];
1673     } else {
1674         [o_t2_fld_prtExtrctFrom setEnabled:NO];
1675         [o_t2_fld_prtExtrctTo setEnabled:NO];
1676         [o_t2_fld_prtExtrctFrom setStringValue:@""];
1677         [o_t2_fld_prtExtrctTo setStringValue:@""];
1678     }
1679 }
1680
1681 - (IBAction)t3_strmMthdChanged:(id)sender
1682 {
1683     /* change the captions of o_t3_txt_destInfo according to the chosen
1684      * streaming method */
1685     int mode;
1686     mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
1687     if( mode == 0 )
1688     {
1689         /* HTTP */
1690         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:0]
1691             objectAtIndex:2]];
1692         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:0]
1693             objectAtIndex:3]];
1694     }
1695     else if( mode == 1 )
1696     {
1697         /* MMS */
1698         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:1]
1699             objectAtIndex:2]];
1700         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:1]
1701             objectAtIndex:3]];
1702     }
1703     else if( mode == 2 )
1704     {
1705         /* UDP-Unicast */
1706         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:2]
1707             objectAtIndex:2]];
1708         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:2]
1709         objectAtIndex:3]];
1710     }
1711     else if( mode == 3 )
1712     {
1713         /* UDP-Multicast */
1714         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:3]
1715             objectAtIndex:2]];
1716         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:3]
1717         objectAtIndex:3]];
1718     }
1719     else if( mode == 4 )
1720     {
1721         /* RTP-Unicast */
1722         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:4]
1723             objectAtIndex:2]];
1724         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:4]
1725             objectAtIndex:3]];
1726     }
1727     else if( mode == 5 )
1728     {
1729         /* RTP-Multicast */
1730         [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:5]
1731             objectAtIndex:2]];
1732         [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:5]
1733         objectAtIndex:3]];
1734     }
1735 }
1736
1737 - (IBAction)t4_AudCdcChanged:(id)sender
1738 {
1739     /* update codec info */
1740     [o_t4_txt_hintAudio setStringValue:[[o_audioCodecs objectAtIndex:
1741         [[o_t4_pop_audioCodec selectedItem]tag]] objectAtIndex:2]];
1742 }
1743
1744 - (IBAction)t4_enblAudTrnscd:(id)sender
1745 {
1746     /* enable/disable the respective items */
1747     if([o_t4_ckb_audio state] == NSOnState)
1748     {
1749         [o_t4_pop_audioCodec setEnabled:YES];
1750         [o_t4_pop_audioBitrate setEnabled:YES];
1751         [o_t4_txt_hintAudio setStringValue: _NS("Select your audio codec. "
1752         "Click one to get more information.")];
1753     } else {
1754         [o_t4_pop_audioCodec setEnabled:NO];
1755         [o_t4_pop_audioBitrate setEnabled:NO];
1756         [o_t4_txt_hintAudio setStringValue: _NS("Enabling this allows transcoding "
1757         "the audio track if one is present in the stream.")];
1758     }
1759 }
1760
1761 - (IBAction)t4_enblVidTrnscd:(id)sender
1762 {
1763     /* enable/disable the respective items */
1764     if([o_t4_ckb_video state] == NSOnState)
1765     {
1766         [o_t4_pop_videoCodec setEnabled:YES];
1767         [o_t4_pop_videoBitrate setEnabled:YES];
1768         [o_t4_txt_hintVideo setStringValue: _NS("Select your video codec. "\
1769         "Click one to get more information.")];
1770     } else {
1771         [o_t4_pop_videoCodec setEnabled:NO];
1772         [o_t4_pop_videoBitrate setEnabled:NO];
1773         [o_t4_txt_hintVideo setStringValue: _NS("Enabling this allows transcoding "
1774         "the video track if one is present in the stream.")];
1775
1776     }
1777 }
1778
1779 - (IBAction)t4_VidCdcChanged:(id)sender
1780 {
1781     /* update codec info */
1782     [o_t4_txt_hintVideo setStringValue:[[o_videoCodecs objectAtIndex:
1783         [[o_t4_pop_videoCodec selectedItem]tag]] objectAtIndex:2]];
1784 }
1785
1786 - (IBAction)t6_enblSapAnnce:(id)sender
1787 {
1788     /* enable/disable input fld */
1789     if([o_t6_ckb_sap state] == NSOnState)
1790     {
1791         [o_t6_fld_sap setEnabled:YES];
1792     } else {
1793         [o_t6_fld_sap setEnabled:NO];
1794         [o_t6_fld_sap setStringValue:@""];
1795     }
1796 }
1797
1798 - (IBAction)t6_mrInfo_ttl:(id)sender
1799 {
1800     /* show a sheet for the help */
1801     NSBeginInformationalAlertSheet(_NS("Time-To-Live (TTL)"),
1802         _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1803         _NS("This allows defining the TTL (Time-To-Live) of the stream. "
1804             "This parameter is the maximum number of routers your stream can "
1805             "go through. If you don't know what it means, or if you want to "
1806             "stream on your local network only, leave this setting to 1."));
1807 }
1808
1809 - (IBAction)t6_mrInfo_sap:(id)sender
1810 {
1811     /* show a sheet for the help */
1812     NSBeginInformationalAlertSheet(_NS("SAP Announce"),
1813         _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1814         _NS("When streaming using UDP, the streams can be "
1815         "announced using the SAP/SDP announcing protocol. This "
1816         "way, the clients won't have to type in the multicast address, it "
1817         "will appear in their playlist if they enable the SAP extra "
1818         "interface.\nIf you want to give a name to your stream, enter it "
1819         "here, else, a default name will be used."));
1820 }
1821
1822 - (IBAction)t67_mrInfo_local:(id)sender
1823 {
1824     /* show a sheet for the help */
1825     NSBeginInformationalAlertSheet(_NS("Local playback"),
1826             _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
1827             _NS("When this option is enabled, the stream will be both played "
1828             "and transcoded/streamed.\n\nNote that this requires much more "
1829             "CPU power than simple transcoding or streaming."));
1830 }
1831
1832 - (IBAction)t7_selectTrnscdDestFile:(id)sender
1833 {
1834     /* provide a save-to-dialogue, so the user can choose a location for
1835      * his/her new file. We take a modified NSOpenPanel to select a folder
1836      * and a plain NSSavePanel to save a single file. */
1837
1838     if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
1839     {
1840         NSOpenPanel * saveFolderPanel = [[NSOpenPanel alloc] init];
1841
1842         [saveFolderPanel setCanChooseDirectories: YES];
1843         [saveFolderPanel setCanChooseFiles: NO];
1844         [saveFolderPanel setCanSelectHiddenExtension: NO];
1845         [saveFolderPanel setCanCreateDirectories: YES];
1846         [saveFolderPanel beginSheetModalForWindow: o_wizard_window completionHandler:^(NSInteger returnCode) {
1847             if (returnCode == NSOKButton)
1848                 [o_t7_fld_filePath setStringValue: [NSString stringWithFormat: @"%@/", [[saveFolderPanel URL] path]]];
1849         }];
1850         [saveFolderPanel release];
1851     }
1852     else
1853     {
1854         NSSavePanel * saveFilePanel = [[NSSavePanel alloc] init];
1855
1856         /* don't use ".ps" as suffix, since the OSX Finder confuses our
1857          * creations with PostScript-files and wants to open them with
1858          * Preview.app */
1859         NSString * theEncapFormat = [[o_encapFormats objectAtIndex:
1860         [[o_userSelections objectForKey:@"encapFormat"] intValue]]
1861         objectAtIndex:0];
1862         if( theEncapFormat != @"ps" )
1863             [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:theEncapFormat]];
1864         else
1865             [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:@"mpg"]];
1866
1867         [saveFilePanel setCanSelectHiddenExtension: YES];
1868         [saveFilePanel setCanCreateDirectories: YES];
1869         [saveFilePanel beginSheetModalForWindow: o_wizard_window completionHandler:^(NSInteger returnCode) {
1870             if (returnCode == NSOKButton)
1871                 [o_t7_fld_filePath setStringValue:[[saveFilePanel URL] path]];
1872         }];
1873         [saveFilePanel release];
1874     }
1875 }
1876
1877 @end