+ NSBeginInformationalAlertSheet(_NS("No input selected"),
+ _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
+ _NS("No new stream or valid playlist item has been selected.\n\n"
+ "Choose 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 */
+ int mode;
+ mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
+ if( mode == 0 )
+ {
+ /* HTTP Streaming */
+ [o_userSelections setObject:@"0" forKey:@"stmgMhd"];
+
+ /* 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 point"];
+
+ } else if ( mode == 1 )
+ {
+ /* MMS Streaming */
+ [o_userSelections setObject:@"1" forKey:@"stmgMhd"];
+
+ /* disable all codecs which don't support ASF / ASFH */
+ [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 point"];
+
+ [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 {
+ /* 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 point"];
+ }
+
+ /* store the destination and check whether is it empty */
+ if([[o_userSelections objectForKey:@"stmgMhd"] intValue] >=2 )
+ {
+ /* empty field is valid for HTTP and MMS */
+ if( [[o_t3_fld_address stringValue] isEqualToString: @""] )
+ {
+ /* complain to the user that "" is no valid dest. */
+ NSBeginInformationalAlertSheet(_NS("No valid destination"),
+ _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
+ _NS("A valid destination has to be selected "
+ "Enter either a Unicast-IP or a Multicast-IP."
+ "\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 transcode-1-tab */
+ [o_tab_pageHolder selectTabViewItemAtIndex:3];
+ }
+ } else {
+ [o_userSelections setObject:[o_t3_fld_address stringValue]
+ forKey:@"stmgDest"];
+ /* let's go to the transcode-1-tab */
+ [o_tab_pageHolder selectTabViewItemAtIndex:3];
+ }
+ }
+ else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString:
+ @"Transcode 1"])
+ {
+ /* check whether the user wants to transcode the video-track and store
+ * the related options */
+ if ([o_t4_ckb_video state] == NSOnState)
+ {
+ NSNumber * theNum;
+ theNum = [NSNumber numberWithInt:[o_t4_pop_videoCodec indexOfSelectedItem]];
+ [o_userSelections setObject:@"YES" forKey:@"trnscdVideo"];
+ [o_userSelections setObject:[o_t4_pop_videoBitrate titleOfSelectedItem]
+ forKey:@"trnscdVideoBitrate"];
+ [o_userSelections setObject:theNum forKey:@"trnscdVideoCodec"];
+ } else {
+ [o_userSelections setObject:@"NO" forKey:@"trnscdVideo"];
+ }
+
+ /* check whether the user wants to transcode the audio-track and store
+ * the related options */
+ if ([o_t4_ckb_audio state] == NSOnState)
+ {
+ NSNumber * theNum;
+ theNum = [NSNumber numberWithInt:[o_t4_pop_audioCodec indexOfSelectedItem]];
+ [o_userSelections setObject:@"YES" forKey:@"trnscdAudio"];
+ [o_userSelections setObject:[o_t4_pop_audioBitrate titleOfSelectedItem]
+ forKey:@"trnscdAudioBitrate"];
+ [o_userSelections setObject:theNum forKey:@"trnscdAudioCodec"];
+ } else {
+ [o_userSelections setObject:@"NO" forKey:@"trnscdAudio"];
+ }
+
+ /* store the currently selected item for further reference */
+ int i_temp = [[o_t5_matrix_encap selectedCell] tag];
+
+ /* disable all encap-formats */
+ [[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:NO];
+
+ /* re-enable the encap-formats supported by the chosen codecs */
+ /* FIXME: the following is a really bad coding-style. feel free to mail
+ me ideas how to make this nicer, if you want to -- FK, 7/11/05 */
+
+ if ([[o_userSelections objectForKey:@"trnscdAudio"] isEqualTo: @"YES"])
+ {
+ if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
+ {
+ /* we are transcoding both audio and video, so we need to check both deps */
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_PS"])
+ {
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections
+ objectForKey:@"trnscdAudioCodec"] intValue]]
+ containsObject: @"MUX_PS"])
+ {
+ [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:0 column:0];
+ }
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections
+ objectForKey:@"trnscdVideoCodec"] intValue]] containsObject: @"MUX_TS"])
+ {
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_TS"])
+ {
+ [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:1 column:0];
+ }
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MPEG"])
+ {
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MPEG"])
+ {
+ [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:2 column:0];
+ }
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_OGG"])
+ {
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections
+ objectForKey:@"trnscdAudioCodec"] intValue]] containsObject: @"MUX_OGG"])
+ {
+ [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:3 column:0];
+ }
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_RAW"])
+ {
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_RAW"])
+ {
+ [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:4 column:0];
+ }
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_ASF"])
+ {
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_ASF"])
+ {
+ [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:5 column:0];
+ }
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
+ {
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
+ {
+ [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:6 column:0];
+ }
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
+ {
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
+ {
+ [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:7 column:0];
+ }
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
+ {
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
+ {
+ [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:8 column:0];
+ }
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
+ {
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
+ {
+ [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:9 column:0];
+ }
+ }
+
+ } else {
+
+ /* we just transcoding the audio */
+
+ /* select formats supported by the audio codec */
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_PS"])
+ {
+ [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:0 column:0];
+ }
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_TS"])
+ {
+ [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:1 column:0];
+ }
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MPEG"])
+ {
+ [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:2 column:0];
+ }
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_OGG"])
+ {
+ [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:3 column:0];
+ }
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_RAW"])
+ {
+ [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:4 column:0];
+ }
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_ASF"])
+ {
+ [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:5 column:0];
+ }
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_AVI"])
+ {
+ [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:6 column:0];
+ }
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MP4"])
+ {
+ [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:7 column:0];
+ }
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_MOV"])
+ {
+ [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:8 column:0];
+ }
+ if ([[o_audioCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdAudioCodec"] intValue]] containsObject: @"MUX_WAV"])
+ {
+ [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:9 column:0];
+ }
+ }
+ }
+ else if ([[o_userSelections objectForKey:@"trnscdVideo"] isEqualTo: @"YES"])
+ {
+ /* we are just transcoding the video */
+
+ /* select formats supported by the video-codec */
+
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_PS"])
+ {
+ [[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:0 column:0];
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_TS"])
+ {
+ [[o_t5_matrix_encap cellAtRow:1 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:1 column:0];
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MPEG"])
+ {
+ [[o_t5_matrix_encap cellAtRow:2 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:2 column:0];
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_OGG"])
+ {
+ [[o_t5_matrix_encap cellAtRow:3 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:3 column:0];
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_RAW"])
+ {
+ [[o_t5_matrix_encap cellAtRow:4 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:4 column:0];
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_ASF"])
+ {
+ [[o_t5_matrix_encap cellAtRow:5 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:5 column:0];
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_AVI"])
+ {
+ [[o_t5_matrix_encap cellAtRow:6 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:6 column:0];
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MP4"])
+ {
+ [[o_t5_matrix_encap cellAtRow:7 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:7 column:0];
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_MOV"])
+ {
+ [[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:8 column:0];
+ }
+ if ([[o_videoCodecs objectAtIndex:[[o_userSelections objectForKey:
+ @"trnscdVideoCodec"] intValue]] containsObject: @"MUX_WAV"])
+ {
+ [[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
+ [o_t5_matrix_encap selectCellAtRow:9 column:0];
+ }
+ } else {
+ /* we don't do any transcoding
+ * -> 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, 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: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: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 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;
+ x = 0;
+ anythingEnabled = NO;
+ while (x != [o_t5_matrix_encap numberOfRows])
+ {
+ if ([[o_t5_matrix_encap cellAtRow:x column:0] isEnabled])
+ {
+ anythingEnabled = YES;
+ }
+ x += 1;
+ }
+ if (anythingEnabled == YES)
+ {
+ /* re-select the previously chosen item, if available */
+ if( [[o_t5_matrix_encap cellWithTag: i_temp] isEnabled] )
+ [o_t5_matrix_encap selectCellWithTag: i_temp];
+
+ /* 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"),
+ @"", @"", o_wizard_window, nil, nil, nil, nil, _NS("The "
+ "chosen codecs are not compatible with each other. For example: "
+ "It is impossibleto mix uncompressed audio with any video codec.\n\n"
+ "Correct your selection and try again."));
+ }
+
+ }
+ else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString: @"Encap"])
+ {
+ /* get the chosen encap format and store it */
+ NSNumber * theNum;
+ theNum = [NSNumber numberWithInt:[[o_t5_matrix_encap selectedCell] tag]];
+ [o_userSelections setObject:[theNum stringValue] forKey:@"encapFormat"];
+
+ /* show either "Streaming 2" or "Transcode 2" to the user */
+ if ([[o_userSelections objectForKey:@"trnscdOrStrmg"] isEqualToString:@"strmg"])
+ {
+ /* we are streaming */
+ [o_tab_pageHolder selectTabViewItemAtIndex:5];
+ }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 directory to save to")];
+ }
+ else
+ {
+ [o_t7_txt_saveFileTo setStringValue:
+ _NS("Select the file to save to")];
+ }
+ }
+ }
+ else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString:
+ @"Streaming 2"])
+ {
+ /* store the chosen TTL */
+ [o_userSelections setObject:[o_t6_fld_ttl stringValue] forKey:@"ttl"];
+
+ /* check whether SAP is enabled and store the announce, if needed */
+ if ([o_t6_ckb_sap state] == NSOnState)
+ {
+ [o_userSelections setObject:@"YES" forKey:@"sap"];
+ [o_userSelections setObject:[o_t6_fld_sap stringValue] forKey:@"sapText"];
+ } 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"];
+ }
+
+ /* include subtitles? */
+ [o_userSelections setObject:
+ [[NSNumber numberWithInt:[o_t6_ckb_soverlay state]] stringValue]
+ forKey: @"soverlay"];
+
+ /* 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 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("A directory "
+ "where to save the files has to be selected."),
+ _NS("Enter either a valid path or use the \"Choose...\" "
+ "button to select a location.")]);
+ else
+ NSBeginInformationalAlertSheet(_NS("No file selected"),
+ _NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
+ [NSString stringWithFormat: @"%@\n\n%@", _NS("A file "
+ "where to save the stream has to be selected."),
+ _NS("Enter either a valid path or use the \"Choose\" "
+ "button to select a location.")]);
+ } else {
+ /* create a string containing the requested suffix for later usage */
+ NSString * theEncapFormat = [[o_encapFormats objectAtIndex:
+ [[o_userSelections objectForKey:@"encapFormat"] intValue]]
+ objectAtIndex:0];
+ if( theEncapFormat == @"ps" )
+ theEncapFormat = @"mpg";
+
+ /* look whether we need to process multiple items or not.
+ * choose a faster variant if we just want a single item */
+ if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
+ {
+ NSMutableArray * tempArray = [[NSMutableArray alloc] init];
+ int x = 0;
+ int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
+ NSMutableString * tempString = [[NSMutableString alloc] init];
+ while( x != y )
+ {
+ NSString * fileNameToUse;
+ /* check whether the extension is hidden or not.
+ * if not, remove it
+ * we need the casting to make GCC4 happy */
+ if( [[[NSFileManager defaultManager] fileAttributesAtPath:
+ [[o_userSelections objectForKey:@"pathToStrm"]
+ objectAtIndex: x] traverseLink: NO] objectForKey:
+ NSFileExtensionHidden] )
+ fileNameToUse = [NSString stringWithString:
+ [[NSFileManager defaultManager] displayNameAtPath:
+ [[o_userSelections objectForKey:@"pathToStrm"]
+ objectAtIndex: x]]];
+ else
+ {
+ int z = 0;
+ int count = [[[[NSFileManager defaultManager]
+ displayNameAtPath:
+ [[o_userSelections objectForKey:@"pathToStrm"]
+ objectAtIndex: x]]
+ componentsSeparatedByString: @"."] count];
+ fileNameToUse = @"";
+ while( z < (count - 1) )
+ {
+ fileNameToUse = [fileNameToUse stringByAppendingString:
+ [[[[NSFileManager defaultManager]
+ displayNameAtPath:
+ [[o_userSelections objectForKey:@"pathToStrm"]
+ objectAtIndex: x]]
+ componentsSeparatedByString: @"."]
+ objectAtIndex: z]];
+ z += 1;
+ }
+ }
+ tempString = [NSString stringWithFormat: @"%@%@.%@",
+ [o_t7_fld_filePath stringValue],
+ fileNameToUse, theEncapFormat];
+ if( [[NSFileManager defaultManager] fileExistsAtPath:
+ tempString] )
+ {
+ /* we don't wanna overwrite existing files, so add an
+ * int to the file-name */
+ int additionalInt = 1;
+ while( additionalInt < 100 )
+ {
+ tempString = [NSString stringWithFormat:@"%@%@ %i.%@",
+ [o_t7_fld_filePath stringValue],
+ fileNameToUse, additionalInt, theEncapFormat];
+ if(! [[NSFileManager defaultManager]
+ fileExistsAtPath: tempString] )
+ break;
+ additionalInt += 1;
+ }
+ if( additionalInt >= 100 )
+ msg_Err( VLCIntf, "Files with the same name are "
+ "already present in the destination directory. "
+ "Delete these files or choose a different directory." );
+ }
+ [tempArray addObject: [tempString retain]];
+ x += 1;
+ }
+ [o_userSelections setObject: [NSArray arrayWithArray:tempArray]
+ forKey: @"trnscdFilePath"];
+ [tempArray release];
+ [tempString release];
+ }
+ else
+ {
+ /* we don't need to check for existing items because Cocoa
+ * does that already when we are asking the user for a location
+ * to save her file */
+ [o_userSelections setObject: [NSArray arrayWithObject:
+ [o_t7_fld_filePath stringValue]] forKey: @"trnscdFilePath"];
+ }
+
+ /* include subtitles ? */
+ [o_userSelections setObject:
+ [[NSNumber numberWithInt:[o_t7_ckb_soverlay state]] stringValue]
+ forKey: @"soverlay"];
+
+ /* go to "Summary" */
+ [self showSummary];
+ }
+ }
+ else if ([[[o_tab_pageHolder selectedTabViewItem] label] isEqualToString:
+ @"Summary"])
+ {
+ intf_thread_t * p_intf = VLCIntf;
+
+ playlist_t * p_playlist = pl_Get( p_intf );
+
+ int x = 0;
+ int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
+ while( x != y )
+ {
+ /* 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];
+ input_item_t *p_input = input_item_New( p_playlist,
+ [[[o_userSelections objectForKey:@"pathToStrm"]
+ objectAtIndex:x] UTF8String],
+ [tempString UTF8String] );
+ input_item_AddOption( p_input, [[[o_userSelections
+ objectForKey:@"opts"] objectAtIndex: x] UTF8String],
+ VLC_INPUT_OPTION_TRUSTED );
+
+ if(! [[o_userSelections objectForKey:@"partExtractFrom"]
+ isEqualToString:@""] )
+ {
+ input_item_AddOption( p_input, [[NSString
+ stringWithFormat: @"start-time=%@", [o_userSelections
+ objectForKey: @"partExtractFrom"]] UTF8String],
+ VLC_INPUT_OPTION_TRUSTED );
+ }
+
+ if(! [[o_userSelections objectForKey:@"partExtractTo"]
+ isEqualToString:@""] )
+ {
+ input_item_AddOption( p_input, [[NSString
+ stringWithFormat: @"stop-time=%@", [o_userSelections
+ objectForKey: @"partExtractTo"]] UTF8String],
+ VLC_INPUT_OPTION_TRUSTED );
+ }
+
+ input_item_AddOption( p_input, [[NSString stringWithFormat:
+ @"ttl=%@", [o_userSelections objectForKey:@"ttl"]]
+ UTF8String],
+ VLC_INPUT_OPTION_TRUSTED );
+
+ /* FIXME: playlist_AddInput() can fail */
+ playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP,
+ PLAYLIST_END, true, pl_Unlocked );
+
+ if( x == 0 )
+ {
+ /* play the first item and add the others afterwards */
+ PL_LOCK;
+ playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
+ p_item );
+ PL_UNLOCK;
+ }
+
+ vlc_gc_decref( p_input );
+ x += 1;