⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wizard.m

📁 uclinux 下的vlc播放器源代码
💻 M
📖 第 1 页 / 共 5 页
字号:
        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)        {            /* 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( (int)[[[NSFileManager defaultManager] fileAttributesAtPath: \                        [[o_userSelections objectForKey:@"pathToStrm"] \                        objectAtIndex: x] traverseLink: NO] objectForKey: \                        NSFileExtensionHidden] == YES )                        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 = (playlist_t *)vlc_object_find( p_intf,                            VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);        if( p_playlist )        {            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];                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, [[NSString \                        stringWithFormat: @"stop-time=%@", [o_userSelections \                        objectForKey: @"partExtractTo"]] 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_Co

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -