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

📄 extended.m

📁 uclinux 下的vlc播放器源代码
💻 M
📖 第 1 页 / 共 2 页
字号:
    /* read-out the slider's value and apply it */    intf_thread_t * p_intf = VLCIntf;    aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf,                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);    if( p_aout != NULL )    {        var_SetFloat( p_aout, "norm-max-level", [o_sld_maxLevel floatValue] );        vlc_object_release( p_aout );    }    config_PutFloat( p_intf, "norm-max-level", [o_sld_maxLevel floatValue] );    o_config_changed = YES;}- (IBAction)audFtls_vlmeNorm:(id)sender{    /* en-/disable volume normalisation */    if ([o_ckb_vlme_norm state] == NSOnState)    {        [self changeAFiltersString: "normvol" onOrOff: YES ];    }else{        [self changeAFiltersString: "normvol" onOrOff: NO ];    }}- (IBAction)extWin_exp_adjImg:(id)sender{    /* expand or collapse adjImg */    NSRect o_win_rect = [o_extended_window frame];    NSRect o_box_audFlts_rect = [o_box_audFlts frame];    NSRect o_box_vidFlts_rect = [o_box_vidFlts frame];    NSRect o_box_adjImg_rect = [o_box_adjImg frame];        if (o_adjImg_expanded)    {        /* move the window contents upwards (partially done through settings         * inside the nib) and resize the window */        o_win_rect.size.height = o_win_rect.size.height - 171;        o_win_rect.origin.y = [o_extended_window frame].origin.y + 171;        o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 171;        o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y + 171;                /* remove the inserted view */        [o_adjustImg_view removeFromSuperviewWithoutNeedingDisplay];    }else{            /* move the window contents downwards and resize the window */        o_win_rect.size.height = o_win_rect.size.height + 171;        o_win_rect.origin.y = [o_extended_window frame].origin.y - 171;        o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 171;        o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y - 171;    }        [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];    [o_box_vidFlts setFrameFromContentFrame: o_box_vidFlts_rect];    [o_extended_window displayIfNeeded];    [o_extended_window setFrame: o_win_rect display:YES animate: YES];        if (o_adjImg_expanded)    {        o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height - 171;        msg_Dbg( VLCIntf, "collapsed adjust-image section");        o_adjImg_expanded = NO;    } else {        /* insert view */        o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height + 171;        [o_adjustImg_view setFrame: NSMakeRect( 20, -10, 370, 181)];        [o_adjustImg_view setNeedsDisplay:YES];        [o_adjustImg_view setAutoresizesSubviews: YES];        [[o_box_adjImg contentView] addSubview: o_adjustImg_view];        msg_Dbg( VLCIntf, "expanded adjust-image section");        o_adjImg_expanded = YES;    }    [o_box_adjImg setFrameFromContentFrame: o_box_adjImg_rect];}- (IBAction)extWin_exp_audFlts:(id)sender{    /* expand or collapse audFlts */    NSRect o_win_rect = [o_extended_window frame];    NSRect o_box_audFlts_rect = [o_box_audFlts frame];        if (o_audFlts_expanded)    {        /* move the window contents upwards (partially done through settings         * inside the nib) and resize the window */        o_win_rect.size.height = o_win_rect.size.height - 66;        o_win_rect.origin.y = [o_extended_window frame].origin.y + 66;                /* remove the inserted view */        [o_audioFlts_view removeFromSuperviewWithoutNeedingDisplay];    }else{        /* move the window contents downwards and resize the window */        o_win_rect.size.height = o_win_rect.size.height + 66;        o_win_rect.origin.y = [o_extended_window frame].origin.y - 66;    }    [o_extended_window displayIfNeeded];    [o_extended_window setFrame: o_win_rect display:YES animate: YES];            if (o_audFlts_expanded)    {        o_box_audFlts_rect.size.height = [o_box_audFlts frame].size.height - 66;        msg_Dbg( VLCIntf, "collapsed audio-filters section");        o_audFlts_expanded = NO;    } else {        /* insert view */        o_box_audFlts_rect.size.height = [o_box_audFlts frame].size.height + 66;        [o_audioFlts_view setFrame: NSMakeRect( 20, -20, 370, 76)];        [o_audioFlts_view setNeedsDisplay:YES];        [o_audioFlts_view setAutoresizesSubviews: YES];        [[o_box_audFlts contentView] addSubview: o_audioFlts_view];        msg_Dbg( VLCIntf, "expanded audio-filters section");        o_audFlts_expanded = YES;    }    [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];}- (IBAction)extWin_exp_vidFlts:(id)sender{    /* expand or collapse vidFlts */    NSRect o_win_rect = [o_extended_window frame];    NSRect o_box_audFlts_rect = [o_box_audFlts frame];    NSRect o_box_vidFlts_rect = [o_box_vidFlts frame];        if (o_vidFlts_expanded)    {        /* move the window contents upwards (partially done through settings         * inside the nib) and resize the window */        o_win_rect.size.height = o_win_rect.size.height - 134;        o_win_rect.origin.y = [o_extended_window frame].origin.y + 134;        o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 134;                /* remove the inserted view */        [o_videoFilters_view removeFromSuperviewWithoutNeedingDisplay];    }else{            /* move the window contents downwards and resize the window */        o_win_rect.size.height = o_win_rect.size.height + 134;        o_win_rect.origin.y = [o_extended_window frame].origin.y - 134;        o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 134;    }        [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];    [o_extended_window displayIfNeeded];    [o_extended_window setFrame: o_win_rect display:YES animate: YES];        if (o_vidFlts_expanded)    {        o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height - 134;        msg_Dbg( VLCIntf, "collapsed video-filters section");        o_vidFlts_expanded = NO;    } else {        /* insert view */        o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height + 134;        [o_videoFilters_view setFrame: NSMakeRect( 20, -10, 370, 144)];        [o_videoFilters_view setNeedsDisplay:YES];        [o_videoFilters_view setAutoresizesSubviews: YES];        [[o_box_vidFlts contentView] addSubview: o_videoFilters_view];        msg_Dbg( VLCIntf, "expanded video-filters section");        o_vidFlts_expanded = YES;    }    [o_box_vidFlts setFrameFromContentFrame: o_box_vidFlts_rect];}- (IBAction)vidFlts:(id)sender{    /* en-/disable video filters */    if (sender == o_ckb_blur)    {        [self changeVFiltersString: "motionblur" onOrOff: [o_ckb_blur state]];    }    else if (sender == o_ckb_distortion)    {        [self changeVFiltersString: "distort" onOrOff: [o_ckb_distortion state]];    }    else if (sender == o_ckb_imgClone)    {        [self changeVFiltersString: "clone" onOrOff: [o_ckb_imgClone state]];    }    else if (sender == o_ckb_imgCrop)    {        [self changeVFiltersString: "crop" onOrOff: [o_ckb_imgCrop state]];    }    else if (sender == o_ckb_imgInvers)    {        [self changeVFiltersString: "invert" onOrOff: [o_ckb_imgInvers state]];    }    else if (sender == o_ckb_trnsform)    {        [self changeVFiltersString: "transform" onOrOff: [o_ckb_trnsform state]];    } else {        /* this shouldn't happen */        msg_Warn (VLCIntf, "cannot find selected video-filter");    }}- (IBAction)vidFlts_mrInfo:(id)sender{    /* show info sheet *//// \bug [String] Misplaced \n    NSBeginInformationalAlertSheet(_NS("More Information"), _NS("OK"), @"", @"", \        o_extended_window, nil, nil, nil, nil, _NS("This panel allows to " \        "select video effects filters to apply.\n" \        "The filters can be configured indivudually in the Preferences, in " \        "the subsections of Video/Filters\n." \        "To choose the order in which the filter are applied, a filter " \        "option string can be set in the Preferences, Video / Filters section."));}/***************************************************************************** * methods to communicate changes to VLC's core *****************************************************************************/- (void)changeVFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )b_add {    /* copied from ../wxwidgets/extrapanel.cpp     * renamed to conform with Cocoa's rules */         vout_thread_t *p_vout;    intf_thread_t * p_intf = VLCIntf;        char *psz_parser, *psz_string;    psz_string = config_GetPsz( p_intf, "vout-filter" );        if( !psz_string ) psz_string = strdup("");    psz_parser = strstr( psz_string, psz_name );    if( b_add )    {        if( !psz_parser )        {            psz_parser = psz_string;            asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",                            psz_string, psz_name );            free( psz_parser );        }        else        {            return;        }    }    else    {        if( psz_parser )        {            memmove( psz_parser, psz_parser + strlen(psz_name) +                            (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),                            strlen(psz_parser + strlen(psz_name)) + 1 );            /* Remove trailing : : */            if( *(psz_string+strlen(psz_string ) -1 ) == ':' )            {                *(psz_string+strlen(psz_string ) -1 ) = '\0';            }         }         else         {             free( psz_string );             return;         }    }    /* Vout is not kept, so put that in the config */    config_PutPsz( p_intf, "vout-filter", psz_string );    /* Try to set on the fly */    p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,                                              FIND_ANYWHERE );    if( p_vout )    {        var_SetString( p_vout, "vout-filter", psz_string );        vlc_object_release( p_vout );    }    free( psz_string );    o_config_changed = YES;}- (void)changeAFiltersString: (char *)psz_name onOrOff: (vlc_bool_t )b_add;{    /* copied from ../wxwidgets/extrapanel.cpp     * renamed to conform with Cocoa's rules */    char *psz_parser, *psz_string;    intf_thread_t * p_intf = VLCIntf;    aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf,                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);    if( p_aout )    {        psz_string = var_GetString( p_aout, "audio-filter" );    }    else    {        psz_string = config_GetPsz( p_intf, "audio-filter" );    }    if( !psz_string ) psz_string = strdup("");    psz_parser = strstr( psz_string, psz_name );    if( b_add )    {        if( !psz_parser )        {            psz_parser = psz_string;            asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",                            psz_string, psz_name );            free( psz_parser );        }        else        {            return;        }    }    else    {        if( psz_parser )        {            memmove( psz_parser, psz_parser + strlen(psz_name) +                            (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),                            strlen(psz_parser + strlen(psz_name)) + 1 );            if( *(psz_string+strlen(psz_string ) -1 ) == ':' )            {                *(psz_string+strlen(psz_string ) -1 ) = '\0';            }         }         else         {             free( psz_string );             return;         }    }    if( p_aout == NULL )    {        config_PutPsz( p_intf, "audio-filter", psz_string );    }    else    {        var_SetString( p_aout, "audio-filter", psz_string );        int i = 0;        while( i < p_aout->i_nb_inputs )        {            p_aout->pp_inputs[i]->b_restart = VLC_TRUE;            i = (i + 1);        }        vlc_object_release( p_aout );    }    free( psz_string );    o_config_changed = YES;}- (void)savePrefs{        /* save the preferences to make sure that our module-changes will up on     * next launch again */    playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, \        FIND_ANYWHERE );    int returnedValue;    NSArray * theModules;    theModules = [[NSArray alloc] initWithObjects: @"main", @"headphone", \        @"transform", @"adjust", @"invert", @"motionblur", @"distort", \        @"clone", @"crop", @"normvol", @"headphone_channel_mixer", @"macosx", \        nil];    unsigned int x = 0;        while ( x != [theModules count] )    {        returnedValue = config_SaveConfigFile( p_playlist, [[theModules \            objectAtIndex: x] UTF8String] );        if (returnedValue != 0)        {            msg_Err(p_playlist, "unable to save the preferences of the " \            "extended control attribute '%s' (%i)",             [[theModules objectAtIndex: x] UTF8String] , returnedValue);            [theModules release];            vlc_object_release( p_playlist );                        return;        }        x = ( x + 1 );    }        msg_Dbg( p_playlist, "VLCExtended: saved certain preferences successfully" );        [theModules release];    vlc_object_release( p_playlist );}@end

⌨️ 快捷键说明

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