📄 wizard.m
字号:
[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_Yield( 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]); if(! [[o_userSelections objectForKey:@"partExtractFrom"] isEqualToString:@""] ) { input_item_AddOption( p_input, [[NSString stringWithFormat: @"start-time=%@", [o_userSelections objectForKey: @"partExtractFrom"]] UTF8String] ); } if(! [[o_userSelections objectForKey:@"partExtractTo"] isEqualToString:@""] ) { input_item_AddOption( p_input, [[NSString stringWithFormat: @"stop-time=%@", [o_userSelections objectForKey: @"partExtractTo"]] UTF8String] ); } input_item_AddOption( p_input, [[NSString stringWithFormat: @"ttl=%@", [o_userSelections objectForKey:@"ttl"]] UTF8String] ); /* 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, pl_Locked ); playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL, p_item ); PL_UNLOCK; } vlc_gc_decref( p_input ); x += 1; } vlc_object_release( p_playlist ); /* close the window, since we are done */ [o_wizard_window close]; }}- (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( 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( savePreviousSel >= 0 ) [o_t4_pop_audioCodec selectItemAtIndex: savePreviousSel];}- (void)showSummary{ [o_btn_forward setTitle: _NS("Finish")]; /* 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"]) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -