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

📄 open.cpp

📁 uclinux 下的vlc播放器源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    ic.dwSize = sizeof(INITCOMMONCONTROLSEX);    ic.dwICC = ICC_UPDOWN_CLASS;    InitCommonControlsEx(&ic);    hUpdown[1] = CreateUpDownControl( WS_CHILD | WS_VISIBLE | WS_BORDER |        UDS_ALIGNRIGHT | UDS_SETBUDDYINT | UDS_NOTHOUSANDS,        0, 0, 0, 0, hwnd, 0, hInst,        net_ports[1], 16000, 0, i_net_ports[1] );    /* HTTP and RTSP rows */    net_radios[2] = CreateWindow( _T("BUTTON"), net_type_array[2].psz_text,        WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,        rc.left + 5 + 15 + 5 + net_type_array[0].length + 5,        rc.top + 10, 15, 15, hwnd, NULL, hInst, NULL );            net_label[2] = CreateWindow( _T("STATIC"), net_type_array[2].psz_text,        WS_CHILD | WS_VISIBLE | SS_LEFT,        rc.left + 5 + 15 + 5 + net_type_array[0].length + 5 + 15 + 5,        rc.top + 10, net_type_array[2].length, 15,        hwnd, NULL, hInst, NULL );    net_addrs_label[2] = CreateWindow( _T("STATIC"), _T("URL"),        WS_CHILD | WS_VISIBLE | SS_LEFT,        rc.left + 5 , rc.top + 10 + 2*(15 + 10), 30, 15,        hwnd, NULL, hInst, NULL );    net_addrs[2] = CreateWindow( _T("EDIT"), _T(""),        WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,        rc.left + 5 + 30 + 5, rc.top + 10 + 2*(15 + 10) - 3,        rc.right - 5 - (rc.left + 5 + 30 + 5), 15 + 6,        hwnd, NULL, hInst, NULL);    net_radios[3] = CreateWindow( _T("BUTTON"), net_type_array[3].psz_text,        WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,        rc.left + 5 + 15 + 5 + net_type_array[1].length + 5,        rc.top + 10 + 15 + 10, 15, 15, hwnd, NULL, hInst, NULL );    net_label[3] = CreateWindow( _T("STATIC"), net_type_array[3].psz_text,        WS_CHILD | WS_VISIBLE | SS_LEFT,        rc.left + 5 + 15 + 5 + net_type_array[1].length + 5 + 15 + 5,        rc.top + 10 + 15 + 10, net_type_array[3].length, 15,        hwnd, NULL, hInst, NULL );    net_addrs_label[3] = CreateWindow( _T("STATIC"), _T("URL"),        WS_CHILD | WS_VISIBLE | SS_LEFT,        rc.left + 5 , rc.top + 10 + 2*(15 + 10), 30, 15,        hwnd, NULL, hInst, NULL );    net_addrs[3] = CreateWindow( _T("EDIT"), _T("rtsp://"),        WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,        rc.left + 5 + 30 + 5, rc.top + 10 + 2*(15 + 10) - 3,        rc.right - 5 - (rc.left + 5 + 30 + 5), 15 + 6,        hwnd, NULL, hInst, NULL );    SendMessage( net_radios[0], BM_SETCHECK, BST_CHECKED, 0 );}void OpenDialog::UpdateMRL(){    UpdateMRL( i_access );}void OpenDialog::UpdateMRL( int i_access_method ){    string demux, mrltemp;    TCHAR psz_text[2048];    char psz_tmp[256];    i_access = i_access_method;    switch( i_access_method )    {    case FILE_ACCESS:        GetWindowText( file_combo, psz_text, 2048 );        mrltemp = _TOMB(psz_text);        break;    case NET_ACCESS:        switch( i_net_type )        {        case 0:            mrltemp = "udp" + demux + "://";            if( i_net_ports[0] !=                config_GetInt( p_intf, "server-port" ) )            {                sprintf( psz_tmp, "@:%d", i_net_ports[0] );                mrltemp += psz_tmp;            }            break;        case 1:            mrltemp = "udp" + demux + "://@";            Edit_GetText( net_addrs[1], psz_text, 2048 );            mrltemp += _TOMB(psz_text);            if( i_net_ports[1] != config_GetInt( p_intf, "server-port" ) )            {                sprintf( psz_tmp, ":%d", i_net_ports[1] );                mrltemp += psz_tmp;            }            break;        case 2:            /* http access */            Edit_GetText( net_addrs[2], psz_text, 2048 );            if( !strstr( _TOMB(psz_text), "http://" ) )            {                mrltemp = "http" + demux + "://";            }            mrltemp += _TOMB(psz_text);            break;        case 3:            /* RTSP access */            Edit_GetText( net_addrs[3], psz_text, 2048 );            if( !strstr( _TOMB(psz_text), "rtsp://" ) )            {                mrltemp = "rtsp" + demux + "://";            }            mrltemp += _TOMB(psz_text);            break;        }        break;    default:        break;    }    SetWindowText( mrl_combo, _FROMMB(mrltemp.c_str()) );}void OpenDialog::OnPageChange(){    if( TabCtrl_GetCurSel( notebook ) == 0 )    {        for( int i=0; i<4; i++ )        {            SetWindowPos( net_radios[i], HWND_BOTTOM, 0, 0, 0, 0,                          SWP_NOMOVE | SWP_NOSIZE );            SetWindowPos( net_label[i], HWND_BOTTOM, 0, 0, 0, 0,                          SWP_NOMOVE | SWP_NOSIZE );        }        DisableNETCtrl();        SetWindowPos( file_combo, HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( browse_button, HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( subsfile_checkbox, HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( subsfile_label, HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( subsfile_button, HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        i_access = FILE_ACCESS;    }    else if ( TabCtrl_GetCurSel( notebook ) == 1 )    {        SetWindowPos( file_combo, HWND_BOTTOM, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( browse_button, HWND_BOTTOM, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( subsfile_checkbox, HWND_BOTTOM, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( subsfile_label, HWND_BOTTOM, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( subsfile_button, HWND_BOTTOM, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        for( int i=0; i<4; i++ )        {            SetWindowPos( net_radios[i], HWND_TOP, 0, 0, 0, 0,                          SWP_NOMOVE | SWP_NOSIZE );            SendMessage( net_radios[i], BM_SETCHECK, BST_UNCHECKED, 0 );            SetWindowPos( net_label[i], HWND_TOP, 0, 0, 0, 0,                          SWP_NOMOVE | SWP_NOSIZE );        }        SetWindowPos( net_port_label[0], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( net_ports[0], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( hUpdown[0], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SendMessage( net_radios[0], BM_SETCHECK, BST_CHECKED, 0 );        i_access = NET_ACCESS;    }    UpdateMRL();}void OpenDialog::OnOk(){    TCHAR psz_text[2048];    GetWindowText( mrl_combo, psz_text, 2048 );    int i_args;    char **pp_args = vlc_parse_cmdline( _TOMB(psz_text), &i_args );    ComboBox_AddString( mrl_combo, psz_text );    if( ComboBox_GetCount( mrl_combo ) > 10 )         ComboBox_DeleteString( mrl_combo, 0 );    ComboBox_SetCurSel( mrl_combo, ComboBox_GetCount( mrl_combo ) - 1 );    /* Update the playlist */    playlist_t *p_playlist =        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,                                       FIND_ANYWHERE );    if( p_playlist == NULL ) return;    for( int i = 0; i < i_args; i++ )    {        vlc_bool_t b_start = !i && i_open_arg;        playlist_item_t *p_item =            playlist_ItemNew( p_intf, pp_args[i], pp_args[i] );        /* Insert options */        while( i + 1 < i_args && pp_args[i + 1][0] == ':' )        {            playlist_ItemAddOption( p_item, pp_args[i + 1] );            i++;        }        /* Get the options from the subtitles dialog */        if( (SendMessage( subsfile_checkbox, BM_GETCHECK, 0, 0 ) & BST_CHECKED)            && subsfile_mrl.size() )        {            for( int j = 0; j < (int)subsfile_mrl.size(); j++ )            {                playlist_ItemAddOption( p_item, subsfile_mrl[j].c_str() );            }        }        playlist_AddItem( p_playlist, p_item,                          PLAYLIST_APPEND, PLAYLIST_END );        if( b_start )        {            playlist_Control( p_playlist, PLAYLIST_ITEMPLAY , p_item );        }    }    //TogglePlayButton( PLAYING_S );    while( i_args-- )    {        free( pp_args[i_args] );        if( !i_args ) free( pp_args );    }    vlc_object_release( p_playlist );}/***************************************************************************** * File panel event methods. *****************************************************************************/void OpenDialog::OnFilePanelChange(){    UpdateMRL( FILE_ACCESS );}static void OnOpenCB( intf_dialog_args_t *p_arg ){    OpenDialog *p_this = (OpenDialog *)p_arg->p_arg;    char psz_tmp[PATH_MAX+2] = "\0";    if( p_arg->i_results && p_arg->psz_results[0] )    {        if( strchr( p_arg->psz_results[0], ' ' ) )        {            strcat( psz_tmp, "\"" );            strcat( psz_tmp, p_arg->psz_results[0] );            strcat( psz_tmp, "\"" );        }        else strcat( psz_tmp, p_arg->psz_results[0] );        SetWindowText( p_this->file_combo, _FROMMB(psz_tmp) );        ComboBox_AddString( p_this->file_combo, _FROMMB(psz_tmp) );        if( ComboBox_GetCount( p_this->file_combo ) > 10 )             ComboBox_DeleteString( p_this->file_combo, 0 );        p_this->UpdateMRL( FILE_ACCESS );    }}void OpenDialog::OnFileBrowse(){    intf_dialog_args_t *p_arg =        (intf_dialog_args_t *)malloc( sizeof(intf_dialog_args_t) );    memset( p_arg, 0, sizeof(intf_dialog_args_t) );    p_arg->psz_title = strdup( "Open file" );    p_arg->psz_extensions = strdup( "All (*.*)|*.*" );    p_arg->p_arg = this;    p_arg->pf_callback = OnOpenCB;    p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE_GENERIC, 0, p_arg);}/***************************************************************************** * Net panel event methods. *****************************************************************************/void OpenDialog::OnNetPanelChange( int event ){    TCHAR psz_text[2048];    int port;    if( event >= NetPort1_Event && event <= NetPort2_Event )    {        Edit_GetText( net_ports[event - NetPort1_Event], psz_text, 2048 );        _stscanf( psz_text, _T("%d"), &port );        i_net_ports[event - NetPort1_Event] = port;    }    UpdateMRL( NET_ACCESS );}void OpenDialog::OnNetTypeChange( int event ){    DisableNETCtrl();    i_net_type = event - NetRadio1_Event;    if( event == NetRadio1_Event )    {        SetWindowPos( net_port_label[0], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( net_ports[0], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( hUpdown[0], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );    }     else if( event == NetRadio2_Event )    {        SetWindowPos( net_addrs_label[1], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( net_addrs[1], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( net_port_label[1], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( net_ports[1], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( hUpdown[1], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );    }     else if( event == NetRadio3_Event )    {        SetWindowPos( net_addrs_label[2], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( net_addrs[2], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );    }     else if( event == NetRadio4_Event )    {        SetWindowPos( net_addrs_label[3], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( net_addrs[3], HWND_TOP, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );    }            UpdateMRL( NET_ACCESS );}void OpenDialog::DisableNETCtrl(){    for( int i=0; i<4; i++ )    {        SetWindowPos( net_port_label[i], HWND_BOTTOM, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( net_ports[i], HWND_BOTTOM, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( hUpdown[i], HWND_BOTTOM, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( net_addrs_label[i], HWND_BOTTOM, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );        SetWindowPos( net_addrs[i], HWND_BOTTOM, 0, 0, 0, 0,                      SWP_NOMOVE | SWP_NOSIZE );    }    UpdateMRL( FILE_ACCESS );}/***************************************************************************** * Subtitles file event methods. *****************************************************************************/void OpenDialog::OnSubsFileEnable(){    EnableWindow( subsfile_button, ( SendMessage( subsfile_checkbox,                  BM_GETCHECK, 0, 0 ) & BST_CHECKED ) ? TRUE : FALSE );}void OpenDialog::OnSubsFileSettings( HWND hwnd ){    /* Show/hide the open dialog */    SubsFileDialog *subsfile_dialog = new SubsFileDialog( p_intf, this, hInst);    CreateDialogBox(  hwnd, subsfile_dialog );    subsfile_mrl.clear();    for( int i = 0; i < (int)subsfile_dialog->subsfile_mrl.size(); i++ )        subsfile_mrl.push_back( subsfile_dialog->subsfile_mrl[i] );    delete subsfile_dialog;}

⌨️ 快捷键说明

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