/*****************************************************************************
* wizard.m: MacOS X Streaming Wizard
*****************************************************************************
- * Copyright (C) 2005 the VideoLAN team
+ * Copyright (C) 2005-2006 the VideoLAN team
* $Id$
*
- * Authors: Felix Kühne <fkuehne@users.sf.net>
+ * Authors: Felix Kühne <fkuehne@users.sf.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
- * Note: this code is partially based upon ../wxwindows/wizard.cpp and
- * ../wxwindows/streamdata.h; both written by Clément Stenac.
+ * Note: this code is partially based upon ../wxwidgets/wizard.cpp and
+ * ../wxwidgets/streamdata.h; both written by Clément Stenac.
*****************************************************************************/
-/* TODO:
- - fill the playlist-table on t2
- - see FIXME's
-*/
-
/*****************************************************************************
* Preamble
#import "intf.h"
#import "network.h"
#import "playlist.h"
+#import <vlc/intf.h>
/*****************************************************************************
* VLCWizard implementation
{
/* some minor cleanup */
[o_t2_tbl_plst setEnabled:NO];
- [o_wizardhelp_window setExcludedFromWindowsMenu:YES];
o_userSelections = [[NSMutableDictionary alloc] init];
[o_btn_backward setEnabled:NO];
_NS("DivX third version (useable with MPEG TS, MPEG1, ASF and OGG)"), \
@"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", @"NO", @"NO", @"NO", \
@"NO", @"NO", nil];
- o_h263 = [NSArray arrayWithObjects: @"H 263", @"H263", \
+ o_h263 = [NSArray arrayWithObjects: @"H.263", @"h263", \
_NS("H263 is a video codec optimized for videoconference " \
"(low rates, useable with MPEG TS)"), @"MUX_TS", @"NO", @"NO", @"NO", \
@"NO", @"NO", @"NO", @"NO", @"NO", nil];
- o_h264 = [NSArray arrayWithObjects: @"H 264", @"H264", \
+ o_h264 = [NSArray arrayWithObjects: @"H.264", @"h264", \
_NS("H264 is a new video codec (useable with MPEG TS and MP4)"), \
@"MUX_TS", @"MUX_MP4", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", \
@"NO", nil];
" MPEG1, ASF and OGG)"), @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_OGG", \
@"NO", @"NO", @"NO", @"NO", @"NO", nil];
o_theo = [NSArray arrayWithObjects: @"Theora", @"theo", \
- _NS("Theora is a free general-purpose codec (useable with MPEG TS)"), \
- @"MUX_TS", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", @"NO", nil];
+ _NS("Theora is a free general-purpose codec (useable with MPEG TS " \
+ "and OGG)"), @"MUX_TS", @"MUX_OGG", @"NO", @"NO", @"NO", @"NO", @"NO", \
+ @"NO", @"NO", nil];
o_dummyVid = [NSArray arrayWithObjects: @"Dummy", @"dummy", \
_NS("Dummy codec (do not transcode, useable with all encapsulation " \
"formats)"), @"MUX_PS", @"MUX_TS", @"MUX_MPEG", @"MUX_ASF", @"MUX_MP4", \
o_videoCodecs = [[NSArray alloc] initWithObjects: o_mp1v, o_mp2v, o_mp4v, \
o_div1, o_div2, o_div3, o_h263, o_h264, o_wmv1, o_wmv2, o_mjpg, o_theo, \
o_dummyVid, nil];
- [o_t4_pop_videoCodec removeAllItems];
- unsigned int x;
- x = 0;
- while (x != [o_videoCodecs count])
- {
- [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x] \
- objectAtIndex:0]];
- x = (x + 1);
- }
+
NSArray * o_mpga;
NSArray * o_mp3;
@"-1", nil];
o_spx = [NSArray arrayWithObjects: @"Speex", @"spx", \
_NS("A free audio codec dedicated to compression of voice (useable " \
- "with OGG"), @"MUX_OGG", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", \
+ "with OGG)"), @"MUX_OGG", @"-1", @"-1", @"-1", @"-1", @"-1", @"-1", \
@"-1", @"-1", nil];
o_s16l = [NSArray arrayWithObjects: @"Uncompressed, integer", @"s16l", \
_NS("Uncompressed audio samples (useable with WAV)"), @"MUX_WAV", \
@"MUX_OGG", @"MUX_RAW", @"MUX_MOV", @"MUX_WAV", nil];
o_audioCodecs = [[NSArray alloc] initWithObjects: o_mpga, o_mp3, o_mp4a, \
o_a52, o_vorb, o_flac, o_spx, o_s16l, o_fl32, o_dummyAud, nil];
- [o_t4_pop_audioCodec removeAllItems];
- x = 0;
- while (x != [o_audioCodecs count])
- {
- [o_t4_pop_audioCodec addItemWithTitle:[[o_audioCodecs objectAtIndex:x] objectAtIndex:0]];
- x = (x + 1);
- }
/* fill another global array with all information about the encap-formats
NSArray * o_wav;
NSArray * o_asfh;
o_ps = [NSArray arrayWithObjects: @"ps", @"MPEG PS", \
- _NS("MPEG Program Stream"), nil];
+ _NS("MPEG Program Stream"), @"mpg", nil];
o_ts = [NSArray arrayWithObjects: @"ts", @"MPEG TS", \
_NS("MPEG Transport Stream"), nil];
o_mpeg = [NSArray arrayWithObjects: @"ps", @"MPEG 1", \
- _NS("MPEG 1 Format"), nil];
+ _NS("MPEG 1 Format"), @"mpg", nil];
o_ogg = [NSArray arrayWithObjects: @"ogg", @"OGG", @"OGG", nil];
o_raw = [NSArray arrayWithObjects: @"raw", @"RAW", @"RAW", nil];
o_asf = [NSArray arrayWithObjects: @"asf", @"ASF", @"ASF", nil];
NSArray * o_mms;
NSArray * o_udp_uni;
NSArray * o_udp_multi;
+ NSArray * o_rtp_uni;
+ NSArray * o_rtp_multi;
o_http = [NSArray arrayWithObjects: @"http", @"HTTP", _NS("Enter the local " \
"addresses you want to listen to. Do not enter anything if you want to " \
"listen to all adresses or if you don't understand. This is generally " \
"to a dynamic group of computers on a multicast-enabled network. This " \
"is the most efficient method to stream to several computers, but it " \
"does not work over Internet."), nil];
+ o_rtp_uni = [NSArray arrayWithObjects: @"rtp", @"RTP-Unicast", _NS("Enter the " \
+ "address of the computer to stream to.") , _NS("Use this to stream " \
+ "to a single computer."), nil];
+ o_rtp_multi = [NSArray arrayWithObjects: @"rtp", @"RTP-Multicast", _NS("Enter " \
+ "the multicast address to stream to in this field. This must be an IP " \
+ "address between 224.0.0.0 and 239.255.255.255. For a private use, " \
+ "enter an address beginning with 239.255."), _NS("Use this to stream " \
+ "to a dynamic group of computers on a multicast-enabled network. This " \
+ "is the most efficient method to stream to several computers, but it " \
+ "does not work over Internet."), nil];
o_strmgMthds = [[NSArray alloc] initWithObjects: o_http, o_mms, \
- o_udp_uni, o_udp_multi, nil];
+ o_udp_uni, o_udp_multi, o_rtp_uni, o_rtp_multi, nil];
}
- (void)showWizard
{
/* just present the window to the user */
- [o_tab_pageHolder selectFirstTabViewItem:self];
-
- [self resetWizard];
-
[o_wizard_window center];
[o_wizard_window displayIfNeeded];
[o_wizard_window makeKeyAndOrderFront:nil];
- (void)resetWizard
{
- /* reset the wizard-window to its default values */
+ /* get the current state of our setting to keep the selections or not */
+ keepSettingsOrNot = (BOOL *)config_GetInt( VLCIntf, "macosx-wizard-keep" );
+ /* go to the front page and clean up a bit */
[o_userSelections removeAllObjects];
+ [o_btn_forward setTitle: _NS("Next")];
+ [o_tab_pageHolder selectFirstTabViewItem:self];
+
+
+ if( keepSettingsOrNot )
+ return;
+
+ /* reset the wizard-window to its default values if wanted */
[o_t1_matrix_strmgOrTrnscd selectCellAtRow:0 column:0];
[[o_t1_matrix_strmgOrTrnscd cellAtRow:1 column:0] setState: NSOffState];
- [o_btn_forward setTitle: _NS("Next")];
/* "Input" */
[o_t2_fld_pathToNewStrm setStringValue: @""];
- (void)initStrings
{
/* localise all strings to the users lang */
- /* method is called from intf.m (in method openWizard) */
+ /* method is called from intf.m (in method showWizard) */
/* general items */
[o_btn_backward setTitle: _NS("Back")];
setStringValue: _NS("Author")];
[o_t2_box_prtExtrct setTitle: _NS("Partial Extract")];
[o_t2_ckb_enblPartExtrct setTitle: _NS("Enable")];
- [o_t2_ckb_enblPartExtrct setToolTip: _NS("Use this to read only a part of " \
+ [o_t2_ckb_enblPartExtrct setToolTip: _NS("Use this to read only a part of "\
"the stream. You must be able to control the incoming stream " \
- "(for example, a file or a disc, but not an UDP network stream.)\n" \
+ "(for example, a file or a disc, but not an UDP network stream.) " \
"Enter the starting and ending times (in seconds).")];
[o_t2_txt_prtExtrctFrom setStringValue: _NS("From")];
[o_t2_txt_prtExtrctTo setStringValue: _NS("To")];
[o_t6_btn_mrInfo_ttl setTitle: _NS("More Info")];
[o_t6_ckb_sap setTitle: _NS("SAP Announce")];
[o_t6_btn_mrInfo_sap setTitle: _NS("More Info")];
+ [o_t6_ckb_local setTitle: _NS("Local playback")];
+ [o_t6_btn_mrInfo_local setTitle: _NS("More Info")];
/* page seven ("Transcode 2") */
[o_t7_title setStringValue: _NS("Additional transcode options")];
[o_t7_text setStringValue: _NS("In this page, you will define a few " \
- "additionnal parameters for your transcoding.")];
+ "additional parameters for your transcoding.")];
[o_t7_txt_saveFileTo setStringValue: _NS("Select the file to save to")];
[o_t7_btn_chooseFile setTitle: _NS("Choose...")];
+ [o_t7_ckb_local setTitle: _NS("Local playback")];
+ [o_t7_btn_mrInfo_local setTitle: _NS("More Info")];
+ [o_t7_txt_note_saveFolderTo setStringValue: _NS("Note that your input " \
+ "files will keep their original names when being saved in the folder " \
+ "you selected. Existing files may be overwritten.")];
/* page eight ("Summary") */
[o_t8_txt_text setStringValue: _NS("This page lists all your selections. " \
stringByAppendingString: @":"]];
[o_t8_txt_trnscdVideo setStringValue: [_NS("Transcode video") \
stringByAppendingString: @":"]];
+ [o_t8_txt_local setStringValue: [_NS("Local playback") \
+ stringByAppendingString: @":"]];
+}
- /* wizard help window */
- [o_wh_btn_okay setTitle: _NS("OK")];
+- (void)initWithExtractValuesFrom: (NSString *)from to: (NSString *)to \
+ ofItem: (NSString *)item
+{
+ [self resetWizard];
+ msg_Dbg(VLCIntf, "wizard was reseted");
+ [o_userSelections setObject:@"trnscd" forKey:@"trnscdOrStrmg"];
+ [o_btn_backward setEnabled:YES];
+ [o_tab_pageHolder selectTabViewItemAtIndex:1];
+ [o_t2_fld_prtExtrctFrom setStringValue: from];
+ [o_t2_fld_prtExtrctTo setStringValue: to];
+ [o_t2_fld_pathToNewStrm setStringValue: item];
+ [o_t1_matrix_strmgOrTrnscd selectCellAtRow:1 column:0];
+ [[o_t1_matrix_strmgOrTrnscd cellAtRow:0 column:0] setState: NSOffState];
+ [o_t2_ckb_enblPartExtrct setState: NSOnState];
+ [self t2_enableExtract: nil];
+ msg_Dbg(VLCIntf, "wizard interface is set");
+
+ [o_wizard_window center];
+ [o_wizard_window display];
+ [o_wizard_window makeKeyAndOrderFront:nil];
+ msg_Dbg(VLCIntf, "wizard window displayed");
}
- (IBAction)cancelRun:(id)sender
o_mode = [[o_t1_matrix_strmgOrTrnscd selectedCell] title];
if( [o_mode isEqualToString: _NS("Stream to network")] )
{
+ /* we will be streaming */
[o_userSelections setObject:@"strmg" forKey:@"trnscdOrStrmg"];
- }else{
+ }
+ else
+ {
+ /* we will just do some transcoding */
[o_userSelections setObject:@"trnscd" forKey:@"trnscdOrStrmg"];
}
[o_btn_backward setEnabled:YES];
}
else
{
- [o_userSelections setObject:[o_t2_fld_pathToNewStrm stringValue] \
- forKey:@"pathToStrm"];
+ [o_userSelections setObject:[NSArray arrayWithObject:
+ [o_t2_fld_pathToNewStrm stringValue]] forKey:@"pathToStrm"];
}
}
else
{
- if ([o_t2_tbl_plst selectedRow] != -1)
+ if ([o_t2_tbl_plst numberOfSelectedRows] > 0)
{
- playlist_item_t *p_item =
- [o_playlist_wizard selectedPlaylistItem];
- if( p_item->i_children <= 0 )
+ int x = 0;
+ int y = [[o_t2_tbl_plst selectedRowIndexes] count];
+ NSMutableArray * tempArray = [[NSMutableArray alloc] init];
+ while( x != y )
{
- [o_userSelections setObject: [NSString stringWithFormat:
- @"%s", p_item->input.psz_uri] forKey:@"pathToStrm"];
+ playlist_item_t *p_item =
+ [[o_t2_tbl_plst itemAtRow:
+ [[o_t2_tbl_plst selectedRowIndexes]
+ indexGreaterThanOrEqualToIndex: x]] pointerValue];
+
+ if( p_item->i_children <= 0 )
+ {
+ [tempArray addObject: [NSString stringWithUTF8String:
+ p_item->input.psz_uri]];
+ stop = NO;
+ }
+ else
+ stop = YES;
+ x += 1;
}
- else
- stop = YES;
- } else {
+ [o_userSelections setObject:[NSArray arrayWithArray: tempArray]
+ forKey:@"pathToStrm"];
+ [tempArray release];
+ }
+ else
+ {
/* set a flag that no item is selected */
stop = YES;
}
[o_tab_pageHolder selectTabViewItemAtIndex:2];
}else{
/* we are just transcoding */
+
+ /* rebuild the menues for the codec-selections */
+ [self rebuildCodecMenus];
+
[o_tab_pageHolder selectTabViewItemAtIndex:3];
}
} else {
/* show a sheet that the user didn't select a file */
NSBeginInformationalAlertSheet(_NS("No input selected"), \
_NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, \
- _NS("You selected neither a new stream nor a valid playlist " \
- "item. VLC is unable to guess, which input you want use. "\
- "\n\n Choose one before going to the next page."));
+ _NS("You have selected neither a new stream nor a valid " \
+ "playlist item. VLC is unable to guess, which input you " \
+ "want use.\n\nChoose one before going to the next page."));
}
}
else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: \
@"Streaming 1"])
{
+ /* rebuild the menues for the codec-selections */
+ [self rebuildCodecMenus];
+
/* check which streaming method is selected and store it */
- NSString *o_mode;
- o_mode = [[o_t3_matrix_stmgMhd selectedCell] title];
- if( [o_mode isEqualToString: @"HTTP"] )
+ int mode;
+ mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
+ if( mode == 0 )
{
+ /* HTTP Streaming */
[o_userSelections setObject:@"0" forKey:@"stmgMhd"];
- /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF; select MPEG PS */
- [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
- [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
- [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
- [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
- [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
- [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
- [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
- [o_t5_matrix_encap selectCellAtRow:0 column:0];
- } else if ([o_mode isEqualToString: @"MMS"])
+
+ /* disable all codecs which don't support MPEG PS, MPEG TS, MPEG 1,
+ * OGG, RAW or ASF */
+ [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
+ [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating"];
+
+ } else if ( mode == 1 )
{
+ /* MMS Streaming */
[o_userSelections setObject:@"1" forKey:@"stmgMhd"];
- [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:YES];
- [o_t5_matrix_encap selectCellAtRow:10 column:0];
+
+ /* disable all codecs which don't support ASF / ASFH */
+ [o_t4_pop_audioCodec removeItemWithTitle:@"MPEG 4 Audio"];
+ [o_t4_pop_audioCodec removeItemWithTitle:@"Vorbis"];
+ [o_t4_pop_audioCodec removeItemWithTitle:@"FLAC"];
+ [o_t4_pop_audioCodec removeItemWithTitle:@"Speex"];
+ [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
+ [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating"];
+
+ [o_t4_pop_videoCodec removeItemWithTitle:@"MPEG-1 Video"];
+ [o_t4_pop_videoCodec removeItemWithTitle:@"MPEG-2 Video"];
+ [o_t4_pop_videoCodec removeItemWithTitle:@"H.263"];
+ [o_t4_pop_videoCodec removeItemWithTitle:@"H.264"];
+ [o_t4_pop_videoCodec removeItemWithTitle:@"MJPEG"];
+ [o_t4_pop_videoCodec removeItemWithTitle:@"Theora"];
} else {
- if( [o_mode isEqualToString: _NS("UDP Unicast")] )
- {
- [o_userSelections setObject:@"2" forKey:@"stmgMhd"];
- } else {
- [o_userSelections setObject:@"3" forKey:@"stmgMhd"];
- }
- /* disable all encap-formats but MPEG-TS and select it */
- [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
- [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
- [o_t5_matrix_encap selectCellAtRow:1 column:0];
+ /* RTP/UDP Unicast/Multicast Streaming */
+
+ [o_userSelections setObject: [[NSNumber numberWithInt: mode] \
+ stringValue] forKey:@"stmgMhd"];
+
+ /* disable all codecs which don't support MPEG-TS */
+ [o_t4_pop_audioCodec removeItemWithTitle:@"Vorbis"];
+ [o_t4_pop_audioCodec removeItemWithTitle:@"FLAC"];
+ [o_t4_pop_audioCodec removeItemWithTitle:@"Speex"];
+ [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
+ [o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating"];
}
/* store the destination and check whether is it empty */
_NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, \
_NS("You need to enter a valid destination you want to "\
"stream to. Enter either a Unicast-IP or a Multicast-IP." \
- "\n\n If you don't know what this means, have a look at " \
+ "\n\nIf you don't know what this means, have a look at " \
"the VLC Streaming HOWTO and the help texts in this " \
"window."));
} else {
/* FIXME: check whether the entered IP is really valid */
[o_userSelections setObject:[o_t3_fld_address stringValue] \
forKey:@"stmgDest"];
- /* let's go to the encap-tab */
- [o_tab_pageHolder selectTabViewItemAtIndex:4];
+ /* let's go to the transcode-1-tab */
+ [o_tab_pageHolder selectTabViewItemAtIndex:3];
}
} else {
[o_userSelections setObject:[o_t3_fld_address stringValue] \
forKey:@"stmgDest"];
- /* let's go to the encap-tab */
- [o_tab_pageHolder selectTabViewItemAtIndex:4];
+ /* let's go to the transcode-1-tab */
+ [o_tab_pageHolder selectTabViewItemAtIndex:3];
}
}
else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: \
[[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
[[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
[[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
/* re-enable the encap-formats supported by the chosen codecs */
/* FIXME: the following is a really bad coding-style. feel free to mail
}
} else {
/* we don't do any transcoding
- * -> enabled the encap-formats allowed when streaming content via http
- * since this should work fine in most cases */
+ * -> enabled the encap-formats allowed when streaming content via
+ * http plus MP4 since this should work fine in most cases */
+
/* FIXME: choose a selection of encap-formats based upon the
* actually used codecs */
- /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF; select MPEG PS */
+ /* enable MPEG PS, MPEG TS, MPEG 1, OGG, RAW, ASF, MP4 and MOV
+ * select MPEG PS */
[[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
[[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
[[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
[[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
[[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
[[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
+ [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
+ [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
+ [o_t5_matrix_encap selectCellAtRow:0 column:0];
+ }
+
+ if ( [o_userSelections objectForKey:@"stmgMhd"] == @"1" )
+ {
+ /* if MMS is the streaming protocol, only ASFH is available */
+ [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
[[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
[[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
[[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
- [o_t5_matrix_encap selectCellAtRow:0 column:0];
+ [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:10 column:0];
+ }
+ else if ( [o_userSelections objectForKey:@"stmgMhd"] == @"0" )
+ {
+ /* if HTTP is the streaming protocol, disable all unsupported
+ * encap-formats, but don't touch the other ones selected above */
+ [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
+ }
+ else if ( [[o_userSelections objectForKey:@"stmgMhd"] intValue] >= 2 )
+ {
+ /* if UDP/RTP is the streaming protocol, only MPEG-TS is available */
+ [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:10 column:0] setEnabled:NO];
+ [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:1 column:0];
}
int x;
BOOL anythingEnabled;
{
anythingEnabled = YES;
}
- x = (x + 1);
+ x += 1;
}
if (anythingEnabled == YES)
{
- [o_tab_pageHolder selectTabViewItemAtIndex:4];
+ /* go the encap-tab */
+ [o_tab_pageHolder selectTabViewItemAtIndex:4];
} else {
/* show a sheet that the selected codecs are not compatible */
NSBeginInformationalAlertSheet(_NS("Invalid selection"), _NS("OK"), \
}else{
/* we are just transcoding */
[o_tab_pageHolder selectTabViewItemAtIndex:6];
+ /* in case that we are processing multiple items, let the user
+ * select a folder instead of a localtion for a single item */
+ if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+ {
+ [o_t7_txt_saveFileTo setStringValue:
+ _NS("Select the folder to save to")];
+ [o_t7_txt_note_saveFolderTo setHidden: NO];
+ }
+ else
+ {
+ [o_t7_txt_saveFileTo setStringValue:
+ _NS("Select the file to save to")];
+ [o_t7_txt_note_saveFolderTo setHidden: YES];
+ }
}
}
else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: \
} else {
[o_userSelections setObject:@"NO" forKey:@"sap"];
}
-
+
+ /* local playback? */
+ if ([o_t6_ckb_local state] == NSOnState)
+ {
+ [o_userSelections setObject:@"YES" forKey:@"localPb"];
+ } else {
+ [o_userSelections setObject:@"NO" forKey:@"localPb"];
+ }
+
/* go to "Summary" */
[self showSummary];
}
else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: \
@"Transcode 2"])
{
+ /* local playback? */
+ if ([o_t7_ckb_local state] == NSOnState)
+ {
+ [o_userSelections setObject:@"YES" forKey:@"localPb"];
+ } else {
+ [o_userSelections setObject:@"NO" forKey:@"localPb"];
+ }
+
/* check whether the path != "" and store it */
if( [[o_t7_fld_filePath stringValue] isEqualToString: @""] )
{
- /* complain to the user that "" is no valid path */
- NSBeginInformationalAlertSheet(_NS("No file selected"), _NS("OK"), \
- @"", @"", o_wizard_window, nil, nil, nil, nil, _NS("You you " \
- "need to select a file, you want to save to. \n\n Enter either " \
- "a valid path or choose a location through the button's " \
- "dialog-box."));
+ /* complain to the user that "" is no valid path for a folder/file */
+ if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+ NSBeginInformationalAlertSheet(_NS("No folder selected"), \
+ _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, \
+ [NSString stringWithFormat: @"%@\n\n%@", _NS("You you " \
+ "need to select a folder, you want to save your files to."),
+ _NS("Enter either a valid path or choose a location " \
+ "through the button's dialog-box.")]);
+ else
+ NSBeginInformationalAlertSheet(_NS("No file selected"), \
+ _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, \
+ [NSString stringWithFormat: @"%@\n\n%@", _NS("You you " \
+ "need to select a file, you want to save to."),
+ _NS("Enter either a valid path or choose a location " \
+ "through the button's dialog-box.")]);
} else {
- [o_userSelections setObject:[o_t7_fld_filePath stringValue] forKey: \
- @"trnscdFilePath"];
+ if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+ {
+ NSMutableArray * tempArray = [[NSMutableArray alloc] init];
+ NSString * theEncapFormat = [[o_encapFormats objectAtIndex: \
+ [[o_userSelections objectForKey:@"encapFormat"] intValue]] \
+ objectAtIndex:0];
+ if( theEncapFormat == @"ps" )
+ theEncapFormat = @"mpg";
+ int x = 0;
+ int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
+ while( x != y )
+ {
+ [tempArray addObject:[NSString stringWithFormat: @"%@%@.%@",
+ [o_t7_fld_filePath stringValue],
+ [[NSFileManager defaultManager] displayNameAtPath:
+ [[o_userSelections objectForKey:@"pathToStrm"]
+ objectAtIndex: x]],theEncapFormat]];
+ x += 1;
+ }
+ [o_userSelections setObject: [NSArray arrayWithArray:tempArray]
+ forKey: @"trnscdFilePath"];
+ [tempArray release];
+ }
+ else
+ {
+ [o_userSelections setObject: [NSArray arrayWithObject: \
+ [o_t7_fld_filePath stringValue]] forKey: @"trnscdFilePath"];
+ }
/* go to "Summary" */
[self showSummary];
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
if( p_playlist )
{
- playlist_item_t *p_item = playlist_ItemNew( p_playlist, [[o_userSelections \
- objectForKey:@"pathToStrm"] UTF8String], _("Streaming/Transcoding Wizard") );
- playlist_ItemAddOption( p_item, [[o_userSelections objectForKey:@"opts"] UTF8String]);
-
- if(! [[o_userSelections objectForKey:@"partExtractFrom"] isEqualToString:@""] )
+ int x = 0;
+ int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
+ while( x != y )
{
- playlist_ItemAddOption( p_item, [[@"start-time=" \
- stringByAppendingString: [o_userSelections \
- objectForKey:@"partExtractFrom"]] UTF8String] );
- }
+ /* we need a temp. variable here to work-around a GCC4-bug */
+ NSString *tempString = [NSString stringWithFormat: \
+ @"%@ (%i/%i)", _NS("Streaming/Transcoding Wizard"), \
+ ( x + 1 ), y];
+ playlist_item_t *p_item = playlist_ItemNew( p_playlist, \
+ [[[o_userSelections objectForKey:@"pathToStrm"] \
+ objectAtIndex:x] UTF8String], \
+ [tempString UTF8String] );
+ playlist_ItemAddOption( p_item, [[[o_userSelections \
+ objectForKey:@"opts"] objectAtIndex: x] UTF8String]);
+
+ if(! [[o_userSelections objectForKey:@"partExtractFrom"] \
+ isEqualToString:@""] )
+ {
+ playlist_ItemAddOption( p_item, [[NSString \
+ stringWithFormat: @"start-time=%@", [o_userSelections \
+ objectForKey: @"partExtractFrom"]] UTF8String] );
+ }
- if(! [[o_userSelections objectForKey:@"partExtractTo"] isEqualToString:@""] )
- {
- playlist_ItemAddOption( p_item, [[@"stop-time=" \
- stringByAppendingString: [o_userSelections objectForKey: \
- @"partExtractTo"]] UTF8String] );
- }
+ if(! [[o_userSelections objectForKey:@"partExtractTo"] \
+ isEqualToString:@""] )
+ {
+ playlist_ItemAddOption( p_item, [[NSString \
+ stringWithFormat: @"stop-time=%@", [o_userSelections \
+ objectForKey: @"partExtractTo"]] UTF8String] );
+ }
- playlist_ItemAddOption( p_item, [[@"ttl=" stringByAppendingString: \
- [o_userSelections objectForKey:@"ttl"]] UTF8String] );
+ playlist_ItemAddOption( p_item, [[NSString stringWithFormat: \
+ @"ttl=%@", [o_userSelections objectForKey:@"ttl"]] \
+ UTF8String] );
+
+ playlist_AddItem( p_playlist, p_item, PLAYLIST_STOP, PLAYLIST_END );
+
+ if( x == 0 )
+ /* play the first item and add the others afterwards */
+ playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
+
+ x += 1;
+ }
- playlist_AddItem( p_playlist, p_item, PLAYLIST_GO, PLAYLIST_END );
-
playlist_ViewUpdate( p_playlist, VIEW_CATEGORY );
vlc_object_release(p_playlist);
}
}
+- (void)rebuildCodecMenus
+{
+ int savePreviousSel = 0;
+ savePreviousSel = [o_t4_pop_videoCodec indexOfSelectedItem];
+ [o_t4_pop_videoCodec removeAllItems];
+ unsigned int x;
+ x = 0;
+ while (x != [o_videoCodecs count])
+ {
+ [o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x] \
+ objectAtIndex:0]];
+ x += 1;
+ }
+ if( keepSettingsOrNot && savePreviousSel >= 0 )
+ [o_t4_pop_videoCodec selectItemAtIndex: savePreviousSel];
+
+ savePreviousSel = [o_t4_pop_audioCodec indexOfSelectedItem];
+ [o_t4_pop_audioCodec removeAllItems];
+ x = 0;
+ while (x != [o_audioCodecs count])
+ {
+ [o_t4_pop_audioCodec addItemWithTitle:[[o_audioCodecs objectAtIndex:x] \
+ objectAtIndex:0]];
+ x += 1;
+ }
+ if( keepSettingsOrNot && savePreviousSel >= 0 )
+ [o_t4_pop_audioCodec selectItemAtIndex: savePreviousSel];
+}
+
- (void)showSummary
{
[o_btn_forward setTitle: _NS("Finish")];
- [o_t8_fld_inptStream setStringValue:[o_userSelections objectForKey:@"pathToStrm"]];
+ /* if we will transcode multiple items, just give their number; otherwise
+ * print the URI of the single item */
+ if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+ [o_t8_fld_inptStream setStringValue: [NSString stringWithFormat:
+ _NS("%i items"),
+ [[o_userSelections objectForKey:@"pathToStrm"] count]]];
+ else
+ [o_t8_fld_inptStream setStringValue:
+ [[o_userSelections objectForKey:@"pathToStrm"] objectAtIndex: 0]];
+
+ if ([[o_userSelections objectForKey:@"localPb"] isEqualToString: @"YES"])
+ {
+ [o_t8_fld_local setStringValue: _NS("yes")];
+ } else {
+ [o_t8_fld_local setStringValue: _NS("no")];
+ }
if ([[o_userSelections objectForKey:@"partExtract"] isEqualToString: @"YES"])
{
- [o_t8_fld_partExtract setStringValue: [[[[[_NS("yes") \
- stringByAppendingString:@" - "] stringByAppendingString: \
- _NS("from ")] stringByAppendingString: [o_userSelections \
- objectForKey:@"partExtractFrom"]] stringByAppendingString: \
- _NS(" to ")] stringByAppendingString: [o_userSelections \
- objectForKey:@"partExtractTo"]]];
+ [o_t8_fld_partExtract setStringValue: [NSString stringWithFormat:
+ _NS("yes: from %@ to %@ secs"),
+ [o_userSelections objectForKey:@"partExtractFrom"],
+ [o_userSelections objectForKey:@"partExtractTo"]]];
} else {
[o_t8_fld_partExtract setStringValue: _NS("no")];
}
+ if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
+ {
+ [o_t8_fld_trnscdVideo setStringValue: [NSString stringWithFormat:
+ _NS("yes: %@ @ %@ kb/s"),
+ [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey: \
+ @"trnscdVideoCodec"] intValue]] objectAtIndex:0],
+ [o_userSelections objectForKey:@"trnscdVideoBitrate"]]];
+ }
+ else
+ {
+ [o_t8_fld_trnscdVideo setStringValue: _NS("no")];
+ }
+ if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
+ {
+ [o_t8_fld_trnscdAudio setStringValue: [NSString stringWithFormat:
+ _NS("yes: %@ @ %@ kb/s"),
+ [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey: \
+ @"trnscdAudioCodec"] intValue]] objectAtIndex:0],
+ [o_userSelections objectForKey:@"trnscdAudioBitrate"]]];
+ }
+ else
+ {
+ [o_t8_fld_trnscdAudio setStringValue: _NS("no")];
+ }
+
+
if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
{
- /* we are streaming; no transcoding allowed atm */
+ /* we are streaming and perhaps also transcoding */
[o_t8_fld_saveFileTo setStringValue: @"-"];
- [o_t8_fld_trnscdAudio setStringValue: @"-"];
- [o_t8_fld_trnscdVideo setStringValue: @"-"];
[o_t8_fld_strmgMthd setStringValue: [[o_strmgMthds objectAtIndex: \
[[o_userSelections objectForKey:@"stmgMhd"] intValue]] \
objectAtIndex:1]];
[o_t8_fld_ttl setStringValue: [o_userSelections objectForKey:@"ttl"]];
if ([[o_userSelections objectForKey:@"sap"] isEqualToString: @"YES"])
{
- [o_t8_fld_sap setStringValue: [[_NS("yes") stringByAppendingString:@": "] stringByAppendingString:[o_userSelections objectForKey:@"sapText"]]];
+ [o_t8_fld_sap setStringValue:
+ [_NS("yes") stringByAppendingFormat: @": \"%@\"",
+ [o_userSelections objectForKey:@"sapText"]]];
}else{
[o_t8_fld_sap setStringValue: _NS("no")];
}
[o_t8_fld_destination setStringValue: @"-"];
[o_t8_fld_ttl setStringValue: @"-"];
[o_t8_fld_sap setStringValue: @"-"];
- if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
- {
- [o_t8_fld_trnscdVideo setStringValue: [[[[[_NS("yes") \
- stringByAppendingString:@": "] stringByAppendingString: \
- [[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey: \
- @"trnscdVideoCodec"] intValue]] objectAtIndex:0]] \
- stringByAppendingString:@" @ "] stringByAppendingString: \
- [o_userSelections objectForKey:@"trnscdVideoBitrate"]] \
- stringByAppendingString:@" kb/s"]];
- }else{
- [o_t8_fld_trnscdVideo setStringValue: _NS("no")];
- }
- if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
- {
- [o_t8_fld_trnscdAudio setStringValue: [[[[[_NS("yes") \
- stringByAppendingString:@": "] stringByAppendingString: \
- [[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey: \
- @"trnscdAudioCodec"] intValue]] objectAtIndex:0]] \
- stringByAppendingString:@" @ "] stringByAppendingString: \
- [o_userSelections objectForKey:@"trnscdAudioBitrate"]] \
- stringByAppendingString:@" kb/s"]];
- }else{
- [o_t8_fld_trnscdAudio setStringValue: _NS("no")];
- }
[o_t8_fld_saveFileTo setStringValue: [o_userSelections objectForKey: \
@"trnscdFilePath"]];
}
[[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:1]];
[self createOpts];
- [o_t8_fld_mrl setStringValue: [o_userSelections objectForKey:@"opts"]];
+ [o_t8_fld_mrl setStringValue: [[o_userSelections objectForKey:@"opts"]
+ objectAtIndex: 0]];
[o_tab_pageHolder selectTabViewItemAtIndex:7];
}
- (void) createOpts
{
NSMutableString * o_opts_string = [NSMutableString stringWithString:@""];
-
- if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"trnscd"])
+ NSMutableString *o_trnscdCmd = [NSMutableString stringWithString:@""];
+ NSMutableString *o_duplicateCmd = [NSMutableString stringWithString:@""];
+ int x = 0;
+ int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
+ NSMutableArray * tempArray = [[NSMutableArray alloc] init];
+
+ /* loop to create an opt-string for each item we're processing */
+ while( x != y )
{
- /* we are just transcoding and dumping the stuff to a file */
- NSMutableString *o_trnscdCmd = [NSMutableString stringWithString:@""];
+ /* check whether we transcode the audio and/or the video and compose a
+ * string reflecting the settings, if needed */
if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"YES"])
{
[o_trnscdCmd appendString: @"transcode{"];
if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
{
[o_trnscdCmd appendString: @","];
- }
+ }
else
{
[o_trnscdCmd appendString: @"}:"];
}
}
+
+ /* check whether the user requested local playback. if yes, prepare the
+ * string, if not, let it empty */
+ if ([[o_userSelections objectForKey:@"localPb"] isEqualToString:@"YES"])
+ {
+ [o_duplicateCmd appendString: @"duplicate{dst=display,dst=\""];
+ }
+
if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualToString:@"YES"])
{
if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualToString:@"NO"])
intValue]] objectAtIndex:1] UTF8String], [[o_userSelections \
objectForKey:@"trnscdAudioBitrate"] intValue]];
}
- [o_opts_string appendFormat: @":sout=#%sstandard{mux=%s,url=%s,access=file}", \
- [o_trnscdCmd UTF8String], [[[o_encapFormats objectAtIndex: \
- [[o_userSelections objectForKey:@"encapFormat"] intValue]] \
- objectAtIndex:0] UTF8String], [[o_userSelections objectForKey: \
- @"trnscdFilePath"] UTF8String]];
-
- } else {
-
- /* we are streaming - no transcoding allowed atm, since we mirror the wx-wizard */
- if ([[o_userSelections objectForKey:@"sap"] isEqualToString:@"YES"])
+
+ if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"trnscd"])
{
- /* SAP-Announcement is requested */
- NSMutableString *o_sap_option = [NSMutableString stringWithString:@""];
- if([[o_userSelections objectForKey:@"sapText"] isEqualToString:@""])
+ /* we are just transcoding and dumping the stuff to a file */
+ [o_opts_string appendFormat: \
+ @":sout=#%s%sstandard{mux=%s,dst=%s,access=file}", [o_duplicateCmd \
+ UTF8String], [o_trnscdCmd UTF8String], [[[o_encapFormats \
+ objectAtIndex: [[o_userSelections objectForKey:@"encapFormat"] \
+ intValue]] objectAtIndex:0] UTF8String], [[[o_userSelections \
+ objectForKey: @"trnscdFilePath"] objectAtIndex: x] UTF8String]];
+ }
+ else
+ {
+
+ /* we are streaming */
+ if ([[o_userSelections objectForKey:@"sap"] isEqualToString:@"YES"])
{
- [o_sap_option appendString: @"sap"];
- } else {
- [o_sap_option appendFormat: @"sap,name=\"%s\"",[[o_userSelections \
- objectForKey:@"sapText"] UTF8String]];
+ /* SAP-Announcement is requested */
+ NSMutableString *o_sap_option = [NSMutableString stringWithString:@""];
+ if([[o_userSelections objectForKey:@"sapText"] isEqualToString:@""])
+ {
+ [o_sap_option appendString: @"sap"];
+ }
+ else
+ {
+ [o_sap_option appendFormat: @"sap,name=\"%s\"", \
+ [[o_userSelections objectForKey:@"sapText"] UTF8String]];
+ }
+ [o_opts_string appendFormat: \
+ @":sout=#%s%sstandard{mux=%s,dst=%s,access=%s,%s}", \
+ [o_duplicateCmd UTF8String], [o_trnscdCmd UTF8String], \
+ [[[o_encapFormats objectAtIndex: [[o_userSelections \
+ objectForKey: @"encapFormat"] intValue]] objectAtIndex:0] \
+ UTF8String], [[o_userSelections objectForKey: @"stmgDest"] \
+ UTF8String], [[[o_strmgMthds objectAtIndex: [[o_userSelections \
+ objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] \
+ UTF8String], [o_sap_option UTF8String]];
+ }
+ else
+ {
+ /* no SAP, just streaming */
+ [o_opts_string appendFormat: \
+ @":sout=#%s%sstandard{mux=%s,dst=%s,access=%s}", \
+ [o_duplicateCmd UTF8String], [o_trnscdCmd UTF8String], \
+ [[[o_encapFormats objectAtIndex: [[o_userSelections \
+ objectForKey: @"encapFormat"] intValue]] objectAtIndex:0] \
+ UTF8String], [[o_userSelections objectForKey: \
+ @"stmgDest"] UTF8String], [[[o_strmgMthds objectAtIndex: \
+ [[o_userSelections objectForKey: @"stmgMhd"] intValue]] \
+ objectAtIndex:0] UTF8String]];
}
- [o_opts_string appendFormat: @":sout=#standard{mux=%s,url=%s,access=%s,%s}", \
- [[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey: \
- @"encapFormat"] intValue]] objectAtIndex:0] UTF8String], \
- [[o_userSelections objectForKey:@"stmgDest"] UTF8String], \
- [[[o_strmgMthds objectAtIndex:[[o_userSelections objectForKey: \
- @"stmgMhd"] intValue]] objectAtIndex:0] UTF8String], \
- [o_sap_option UTF8String]];
- } else {
- /* no SAP, just streaming */
- [o_opts_string appendFormat: @":sout=#standard{mux=%s,url=%s,access=%s}", \
- [[[o_encapFormats objectAtIndex:[[o_userSelections objectForKey: \
- @"encapFormat"] intValue]] objectAtIndex:0] UTF8String], \
- [[o_userSelections objectForKey:@"stmgDest"] UTF8String], \
- [[[o_strmgMthds objectAtIndex:[[o_userSelections objectForKey: \
- @"stmgMhd"] intValue]] objectAtIndex:0] UTF8String]];
}
- }
- [o_userSelections setObject:o_opts_string forKey:@"opts"];
+ /* check whether the user requested local playback. if yes, close the
+ * string with an additional bracket */
+ if ([[o_userSelections objectForKey:@"localPb"] isEqualToString:@"YES"])
+ {
+ [o_opts_string appendString: @"\"}"];
+ }
+
+ [tempArray addObject: o_opts_string];
+
+ o_opts_string = [NSMutableString stringWithString:@""];
+ o_trnscdCmd = [NSMutableString stringWithString:@""];
+ o_duplicateCmd = [NSMutableString stringWithString:@""];
+ x += 1;
+ }
+ [o_userSelections setObject:[NSArray arrayWithArray: tempArray] forKey:@"opts"];
+ [tempArray release];
}
- (IBAction)prevTab:(id)sender
else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: \
@"Encap"])
{
- /* check whether we are streaming or transcoding and go back */
- if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString: \
- @"strmg"])
- {
- /* show "Streaming 1" */
- [o_tab_pageHolder selectTabViewItemAtIndex:2];
- }else{
- /* show "Transcode 2" */
- [o_tab_pageHolder selectTabViewItemAtIndex:3];
- }
+ /* show "Transcode 1" */
+ [o_tab_pageHolder selectTabViewItemAtIndex:3];
}
else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: \
@"Streaming 1"])
else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: \
@"Transcode 1"])
{
- /* show "Input" */
- [o_tab_pageHolder selectTabViewItemAtIndex:1];
+ if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
+ {
+ /* show "Streaming 1" */
+ [o_tab_pageHolder selectTabViewItemAtIndex:2];
+ }else{
+ /* show "Input" */
+ [o_tab_pageHolder selectTabViewItemAtIndex:1];
+ }
}
else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: \
@"Input"])
{
+ /* reset the wizard before going backwards. Otherwise, we might get
+ * unwanted behaviours in the Encap-Selection */
+ [self resetWizard];
/* show "Hello" */
[o_tab_pageHolder selectTabViewItemAtIndex:0];
/* disable backwards-btn */
- (IBAction)t1_mrInfo_streaming:(id)sender
{
/* show a sheet for the help */
- /* since NSAlert does not exist on OSX < 10.3, we use our own implementation */
- [o_wh_txt_title setStringValue: _NS("Stream to network")];
- [o_wh_txt_text setStringValue: _NS("Use this to stream on a network.")];
- [NSApp beginSheet: o_wizardhelp_window
- modalForWindow: o_wizard_window
- modalDelegate: o_wizardhelp_window
- didEndSelector: nil
- contextInfo: nil];
+ NSBeginInformationalAlertSheet(_NS("Stream to network"), \
+ _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, \
+ _NS("Use this to stream on a network."));
}
- (IBAction)t1_mrInfo_transcode:(id)sender
{
/* show a sheet for the help */
- [o_wh_txt_title setStringValue: _NS("Transcode/Save to file")];
- [o_wh_txt_text setStringValue: _NS("Use this to save a stream to a file. You "\
+ NSBeginInformationalAlertSheet(_NS("Transcode/Save to file"), \
+ _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, \
+ _NS("Use this to save a stream to a file. You "\
"have the possibility to reencode the stream. You can save whatever "\
"VLC can read.\nPlease notice that VLC is not very suited " \
"for file to file transcoding. You should use its transcoding " \
- "features to save network streams, for example.")];
- [NSApp beginSheet: o_wizardhelp_window
- modalForWindow: o_wizard_window
- modalDelegate: o_wizardhelp_window
- didEndSelector: nil
- contextInfo: nil];
+ "features to save network streams, for example."));
}
- (IBAction)t2_addNewStream:(id)sender
{
/* change the captions of o_t3_txt_destInfo according to the chosen
* streaming method */
- NSNumber * o_mode;
- o_mode = [[NSNumber alloc] initWithInt:[[o_t3_matrix_stmgMhd selectedCell] tag]];
- if( [o_mode intValue] == 0 )
+ int mode;
+ mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
+ if( mode == 0 )
+ {
+ /* HTTP */
+ [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:0] \
+ objectAtIndex:2]];
+ [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:0] \
+ objectAtIndex:3]];
+ }
+ else if( mode == 1 )
+ {
+ /* MMS */
+ [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:1] \
+ objectAtIndex:2]];
+ [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:1] \
+ objectAtIndex:3]];
+ }
+ else if( mode == 2 )
{
/* UDP-Unicast */
[o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:2] \
[o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:2] \
objectAtIndex:3]];
}
- else if ( [o_mode intValue] == 1 )
+ else if( mode == 3 )
{
/* UDP-Multicast */
[o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:3] \
[o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:3] \
objectAtIndex:3]];
}
- else if( [o_mode intValue] == 2 )
+ else if( mode == 4 )
{
- /* HTTP */
- [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:0] \
+ /* RTP-Unicast */
+ [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:4] \
objectAtIndex:2]];
- [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:0] \
+ [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:4] \
objectAtIndex:3]];
}
- else if( [o_mode intValue] == 3 )
+ else if( mode == 5 )
{
- /* MMS */
- [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:1] \
+ /* RTP-Multicast */
+ [o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:5] \
objectAtIndex:2]];
- [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:1] \
- objectAtIndex:3]];
+ [o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:5] \
+ objectAtIndex:3]];
}
- [o_mode release];
}
- (IBAction)t4_AudCdcChanged:(id)sender
- (IBAction)t6_mrInfo_ttl:(id)sender
{
/* show a sheet for the help */
- [o_wh_txt_title setStringValue: _NS("Time-To-Live (TTL)")];
- [o_wh_txt_text setStringValue: _NS("Define the TTL (Time-To-Live) of the stream. "\
- "This parameter is the maximum number of routers your stream can go " \
- "through. If you don't know what it means, or if you want to stream on " \
- "your local network only, leave this setting to 1.")];
- [NSApp beginSheet: o_wizardhelp_window
- modalForWindow: o_wizard_window
- modalDelegate: o_wizardhelp_window
- didEndSelector: nil
- contextInfo: nil];
+ NSBeginInformationalAlertSheet(_NS("Time-To-Live (TTL)"), \
+ _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, \
+ _NS("Define the TTL (Time-To-Live) of the stream. "\
+ "This parameter is the maximum number of routers your stream can " \
+ "go through. If you don't know what it means, or if you want to " \
+ "stream on your local network only, leave this setting to 1."));
}
- (IBAction)t6_mrInfo_sap:(id)sender
{
/* show a sheet for the help */
- [o_wh_txt_title setStringValue: _NS("SAP Announce")];
- [o_wh_txt_text setStringValue: _NS("When streaming using UDP, you can " \
+ NSBeginInformationalAlertSheet(_NS("SAP Announce"), \
+ _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, \
+ _NS("When streaming using UDP, you can " \
"announce your streams using the SAP/SDP announcing protocol. This " \
"way, the clients won't have to type in the multicast address, it " \
- "will appear in their playlist if they enable the SAP extra interface.\n" \
- "If you want to give a name to your stream, enter it here, " \
- "else, a default name will be used.")];
- [NSApp beginSheet: o_wizardhelp_window
- modalForWindow: o_wizard_window
- modalDelegate: o_wizardhelp_window
- didEndSelector: nil
- contextInfo: nil];
+ "will appear in their playlist if they enable the SAP extra " \
+ "interface.\nIf you want to give a name to your stream, enter it " \
+ "here, else, a default name will be used."));
+}
+
+- (IBAction)t67_mrInfo_local:(id)sender
+{
+ /* show a sheet for the help */
+ NSBeginInformationalAlertSheet(_NS("Local playback"), \
+ _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil, \
+ _NS("When this option is enabled, the stream will be both played " \
+ "and transcoded/streamed.\n\nNote that this requires much more " \
+ "CPU power than simple transcoding or streaming."));
}
- (IBAction)t7_selectTrnscdDestFile:(id)sender
{
- /* provide a save-to-dialogue, so the user can choose a location for his/her new file */
- NSSavePanel * savePanel = [NSSavePanel savePanel];
+ /* provide a save-to-dialogue, so the user can choose a location for
+ * his/her new file. We take a modified NSOpenPanel to select a folder
+ * and a plain NSSavePanel to save a single file. */
+
SEL sel = @selector(t7_getTrnscdDestFile:returnCode:contextInfo:);
- [savePanel setRequiredFileType:[[o_encapFormats objectAtIndex: \
- [[o_userSelections objectForKey:@"encapFormat"] intValue]] objectAtIndex:0]];
- [savePanel setCanSelectHiddenExtension:YES];
- [savePanel beginSheetForDirectory:nil file:nil modalForWindow: \
+
+ if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+ {
+ NSOpenPanel * saveFolderPanel = [[NSOpenPanel alloc] init];
+
+ [saveFolderPanel setCanChooseDirectories: YES];
+ [saveFolderPanel setCanChooseFiles: NO];
+ [saveFolderPanel setCanSelectHiddenExtension: NO];
+ [saveFolderPanel setCanCreateDirectories: YES];
+ [saveFolderPanel beginSheetForDirectory:nil file:nil modalForWindow: \
+ o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
+ }
+ else
+ {
+ NSSavePanel * saveFilePanel = [[NSSavePanel alloc] init];
+
+ /* don't use ".ps" as suffix, since the OSX Finder confuses our
+ * creations with PostScript-files and wants to open them with
+ * Preview.app */
+ NSString * theEncapFormat = [[o_encapFormats objectAtIndex: \
+ [[o_userSelections objectForKey:@"encapFormat"] intValue]] \
+ objectAtIndex:0];
+ if( theEncapFormat != @"ps" )
+ [saveFilePanel setRequiredFileType: theEncapFormat];
+ else
+ [saveFilePanel setRequiredFileType: @"mpg"];
+
+ [saveFilePanel setCanSelectHiddenExtension: YES];
+ [saveFilePanel setCanCreateDirectories: YES];
+ [saveFilePanel beginSheetForDirectory:nil file:nil modalForWindow: \
o_wizard_window modalDelegate:self didEndSelector:sel contextInfo:nil];
+ }
}
-- (void)t7_getTrnscdDestFile: (NSSavePanel *)sheet returnCode: \
+- (void)t7_getTrnscdDestFile: (NSOpenPanel *)sheet returnCode: \
(int)returnCode contextInfo: (void *)contextInfo
{
if (returnCode == NSOKButton)
{
- /* output returned path to text-field */
- [o_t7_fld_filePath setStringValue:[sheet filename]];
+ /* output returned path to text-field, add a / to the end if the user
+ * selected a folder */
+ if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+ [o_t7_fld_filePath setStringValue: [NSString stringWithFormat: \
+ @"%@/", [sheet filename]]];
+ else
+ [o_t7_fld_filePath setStringValue:[sheet filename]];
}
-}
-
-- (IBAction)wh_closeSheet:(id)sender
-{
- /* close the help sheet */
- [NSApp endSheet:o_wizardhelp_window];
- [o_wizardhelp_window close];
+ [sheet release];
}
@end