Commit d1ffd81d authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/open.cpp: added a caching option.

parent 1844d504
......@@ -75,6 +75,9 @@ enum
SoutEnable_Event,
SoutSettings_Event,
CachingEnable_Event,
CachingChange_Event,
AdvancedOptions_Event
};
......@@ -126,6 +129,11 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
EVT_CHECKBOX(SoutEnable_Event, OpenDialog::OnSoutEnable)
EVT_BUTTON(SoutSettings_Event, OpenDialog::OnSoutSettings)
/* Events generated by the caching button */
EVT_CHECKBOX(CachingEnable_Event, OpenDialog::OnCachingEnable)
EVT_TEXT(CachingChange_Event, OpenDialog::OnCachingChange)
EVT_SPINCTRL(CachingChange_Event, OpenDialog::OnCachingChange)
/* Hide the window when the user closes the window */
EVT_CLOSE(OpenDialog::OnCancel)
......@@ -400,20 +408,17 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
wxU(_("Alternatively, you can build an MRL using one of the "
"following predefined targets:")) );
wxFlexGridSizer *sout_sizer = NULL;
wxStaticLine *static_line = NULL;
wxFlexGridSizer *common_opt_sizer = new wxFlexGridSizer( 5, 1, 20 );
if( i_method == OPEN_NORMAL )
{
/* Create Stream Output checkox */
sout_sizer = new wxFlexGridSizer( 2, 1, 20 );
sout_checkbox = new wxCheckBox( panel, SoutEnable_Event,
wxU(_("Stream output")) );
sout_checkbox->SetToolTip( wxU(_("Use VLC as a server of streams")) );
sout_sizer->Add( sout_checkbox, 0,
common_opt_sizer->Add( sout_checkbox, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
sout_button = new wxButton( panel, SoutSettings_Event,
wxU(_("Settings...")) );
sout_button->Disable();
......@@ -427,13 +432,29 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
}
if( psz_sout ) free( psz_sout );
sout_sizer->Add( sout_button, 1, wxALIGN_LEFT |
common_opt_sizer->Add( sout_button, 1, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
/* Separation */
static_line = new wxStaticLine( panel, wxID_OK );
common_opt_sizer->Add( new wxPanel( this, -1 ), 1,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
}
/* Create caching options */
caching_checkbox = new wxCheckBox( panel, CachingEnable_Event,
wxU(_("Caching")) );
caching_checkbox->SetToolTip( wxU(_("Change the default caching value "
"(in miliseconds)")) );
common_opt_sizer->Add( caching_checkbox, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
caching_value = new wxSpinCtrl( panel, CachingChange_Event );
caching_value->SetRange( 0, 1000000 );
caching_value->Disable();
common_opt_sizer->Add( caching_value, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
/* Separation */
wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
/* Create the buttons */
wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) );
ok_button->SetDefault();
......@@ -513,11 +534,8 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
panel_sizer->Add( label, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );
if( i_method == OPEN_NORMAL)
{
panel_sizer->Add( sout_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
panel_sizer->Add( common_opt_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
}
panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
panel_sizer->Layout();
panel->SetSizerAndFit( panel_sizer );
......@@ -767,15 +785,15 @@ void OpenDialog::UpdateMRL()
void OpenDialog::UpdateMRL( int i_access_method )
{
wxString demux, mrltemp;
wxString demux, mrltemp, caching_name;
i_current_access_method = i_access_method;
switch( i_access_method )
{
case FILE_ACCESS:
//mrltemp = wxT("file") + demux + wxT(":") + file_combo->GetValue();
mrltemp = file_combo->GetValue();
caching_name = "file-caching";
break;
case DISC_ACCESS:
......@@ -786,9 +804,15 @@ void OpenDialog::UpdateMRL( int i_access_method )
case 0: /* DVD with menus */
case 1: /* DVD without menus */
if( i_disc_type_selection == 0 )
{
mrltemp = wxT("dvd://") + disc_device->GetValue();
caching_name = "dvdnav-caching";
}
else
{
mrltemp = wxT("dvdsimple://") + disc_device->GetValue();
caching_name = "dvdread-caching";
}
if( i_disc_title > 0 )
{
......@@ -819,12 +843,16 @@ void OpenDialog::UpdateMRL( int i_access_method )
if( i_disc_sub >= 0 )
mrltemp += wxString::Format( wxT(" :spu-channel=%d"),
i_disc_sub );
caching_name = "vcd-caching";
break;
case 3: /* CD-DA */
mrltemp = wxT("cdda://") + disc_device->GetValue();
if( i_disc_title > 0 )
mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
caching_name = "cdda-caching";
break;
default:
......@@ -848,6 +876,8 @@ void OpenDialog::UpdateMRL( int i_access_method )
{
mrltemp += wxString::Format( wxT("@:%d"), i_net_ports[0] );
}
caching_name = "udp-caching";
break;
case 1:
......@@ -867,6 +897,8 @@ void OpenDialog::UpdateMRL( int i_access_method )
{
mrltemp += wxString::Format( wxT(":%d"), i_net_ports[1] );
}
caching_name = "udp-caching";
break;
case 2:
......@@ -876,6 +908,8 @@ void OpenDialog::UpdateMRL( int i_access_method )
mrltemp = wxT("http") + demux + wxT("://");
}
mrltemp += net_addrs[2]->GetLineText(0);
caching_name = "http-caching";
break;
case 3:
......@@ -885,6 +919,8 @@ void OpenDialog::UpdateMRL( int i_access_method )
mrltemp = wxT("rtsp") + demux + wxT("://");
}
mrltemp += net_addrs[3]->GetLineText(0);
caching_name = "rtsp-caching";
break;
}
break;
......@@ -940,6 +976,20 @@ void OpenDialog::UpdateMRL( int i_access_method )
break;
}
if( caching_name.size() )
{
if( caching_value->IsEnabled() )
{
mrltemp += wxString::Format( wxT(" :%s=%d"), caching_name.mb_str(),
i_caching );
}
else
{
int i_value = config_GetInt( p_intf, caching_name.mb_str() );
caching_value->SetValue( i_value );
}
}
mrl_combo->SetValue( mrltemp );
}
......@@ -1257,6 +1307,22 @@ void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) )
}
}
/*****************************************************************************
* Caching event methods.
*****************************************************************************/
void OpenDialog::OnCachingEnable( wxCommandEvent& event )
{
caching_value->Enable( event.GetInt() != 0 );
i_caching = caching_value->GetValue();
UpdateMRL();
}
void OpenDialog::OnCachingChange( wxCommandEvent& event )
{
i_caching = event.GetInt();
UpdateMRL();
}
/*****************************************************************************
* Utility functions.
*****************************************************************************/
......
......@@ -423,6 +423,10 @@ private:
void OnSoutEnable( wxCommandEvent& event );
void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
/* Event handlers for the caching option */
void OnCachingEnable( wxCommandEvent& event );
void OnCachingChange( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
......@@ -477,6 +481,11 @@ private:
wxCheckBox *sout_checkbox;
SoutDialog *sout_dialog;
wxArrayString sout_mrl;
/* Controls for the caching options */
wxCheckBox *caching_checkbox;
wxSpinCtrl *caching_value;
int i_caching;
};
enum
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment