#include <vlc/intf.h>
+#include <vector>
+
#include "wxwindows.h"
#include "preferences_widgets.h"
DiscDevice_Event,
DiscTitle_Event,
DiscChapter_Event,
+ DiscSub_Event,
NetType_Event,
NetRadio1_Event, NetRadio2_Event, NetRadio3_Event, NetRadio4_Event,
SoutEnable_Event,
SoutSettings_Event,
+ CachingEnable_Event,
+ CachingChange_Event,
+
AdvancedOptions_Event
};
EVT_SPINCTRL(DiscTitle_Event, OpenDialog::OnDiscPanelChange)
EVT_TEXT(DiscChapter_Event, OpenDialog::OnDiscPanelChange)
EVT_SPINCTRL(DiscChapter_Event, OpenDialog::OnDiscPanelChange)
+ EVT_TEXT(DiscSub_Event, OpenDialog::OnDiscPanelChange)
+ EVT_SPINCTRL(DiscSub_Event, OpenDialog::OnDiscPanelChange)
/* Events generated by the net panel */
EVT_RADIOBUTTON(NetRadio1_Event, OpenDialog::OnNetTypeChange)
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)
if( b_advanced )
{
- wxPanel *dummy_panel = new wxPanel( this, -1 );
- sizer->Add( dummy_panel, 1 );
-
wxButton *button =
new wxButton( this, AdvancedOptions_Event,
wxU(_("Advanced options...")) );
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
/* Separation */
- dummy_panel = new wxPanel( p_advanced_dialog, -1 );
+ wxPanel *dummy_panel = new wxPanel( p_advanced_dialog, -1 );
sizer->Add( dummy_panel, 1 );
wxStaticLine *static_line =
new wxStaticLine( p_advanced_dialog, wxID_OK );
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,
- wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+ common_opt_sizer->Add( sout_checkbox, 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+
sout_button = new wxButton( panel, SoutSettings_Event,
wxU(_("Settings...")) );
sout_button->Disable();
}
if( psz_sout ) free( psz_sout );
- sout_sizer->Add( sout_button, 1, wxALIGN_LEFT |
- wxALIGN_CENTER_VERTICAL );
+ 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 milliseconds)")) );
+ 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();
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( static_line, 0, wxEXPAND | 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 );
disc_title_label = new wxStaticText( panel, -1, wxU(_("Title")) );
disc_title = new wxSpinCtrl( panel, DiscTitle_Event );
-
sizer->Add( disc_title_label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
sizer->Add( disc_title, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
sizer->Add( disc_chapter_label, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
sizer->Add( disc_chapter, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
+
+ disc_sub_label = new wxStaticText( panel, -1, wxU(_("Subtitles track")) );
+ disc_sub = new wxSpinCtrl( panel, DiscSub_Event );
+ sizer->Add( disc_sub_label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
+ sizer->Add( disc_sub, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
+ disc_sub->SetRange( -1, 255 );
+ i_disc_sub = config_GetInt( p_intf, "spu-channel" );
+ disc_sub->SetValue( i_disc_sub );
+
sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );
panel->SetSizerAndFit( sizer_row );
void OpenDialog::UpdateMRL( int i_access_method )
{
- wxString demux, mrltemp;
+ wxString 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 = wxT("file-caching");
break;
+
case DISC_ACCESS:
- i_disc_type_selection = disc_type->GetSelection();
+ i_disc_type_selection = disc_type->GetSelection();
- switch ( i_disc_type_selection )
+ switch ( i_disc_type_selection )
{
case 0: /* DVD with menus */
- disc_chapter->Enable();
- disc_chapter_label->Enable();
- mrltemp = wxT("dvd://")
- + disc_device->GetValue()
- + wxString::Format( wxT("@%d:%d"),
- disc_title->GetValue(),
- disc_chapter->GetValue() );
- break;
-
case 1: /* DVD without menus */
- disc_chapter->Enable();
- disc_chapter_label->Enable();
- mrltemp = wxT("dvdsimple://")
- + disc_device->GetValue()
- + wxString::Format( wxT("@%d:%d"),
- disc_title->GetValue(),
- disc_chapter->GetValue() );
- break;
+ if( i_disc_type_selection == 0 )
+ {
+ mrltemp = wxT("dvd://") + disc_device->GetValue();
+ caching_name = wxT("dvdnav-caching");
+ }
+ else
+ {
+ mrltemp = wxT("dvdsimple://") + disc_device->GetValue();
+ caching_name = wxT("dvdread-caching");
+ }
+
+ if( i_disc_title > 0 )
+ {
+ mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
+
+ if( i_disc_chapter > 0 )
+ mrltemp += wxString::Format( wxT(":%d"), i_disc_chapter );
+ }
+
+ if( i_disc_sub >= 0 )
+ mrltemp += wxString::Format( wxT(" :spu-channel=%d"),
+ i_disc_sub );
+ break;
case 2: /* VCD of some sort */
- {
- /* The chapter object is used for subtitles */
-
- int i_subtitle = disc_chapter->GetValue();
- config_PutInt( p_intf, "spu-channel", i_subtitle );
-
- disc_chapter->Enable();
- disc_chapter_label->Enable();
#ifdef HAVE_VCDX
- if ( disc_title->GetValue() )
- mrltemp = wxT("vcdx://")
- + disc_device->GetValue()
- + wxString::Format( wxT("@%c%d"),
+ mrltemp = wxT("vcdx://") + disc_device->GetValue();
+ if( i_disc_title > 0 )
+ mrltemp += wxString::Format( wxT("@%c%d"),
config_GetInt( p_intf, "vcdx-PBC" )
- ? 'P' : 'E',
- disc_title->GetValue()
- );
- else
- mrltemp = wxT("vcdx://")
- + disc_device->GetValue();
+ ? 'P' : 'E', i_disc_title );
#else
- mrltemp = wxT("vcd://")
- + disc_device->GetValue()
- + wxString::Format( wxT("@%d"),
- disc_title->GetValue() );
+ mrltemp = wxT("vcd://") + disc_device->GetValue();
+ if( i_disc_title > 0 )
+ mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
#endif
- break;
- }
-
+
+ if( i_disc_sub >= 0 )
+ mrltemp += wxString::Format( wxT(" :spu-channel=%d"),
+ i_disc_sub );
+
+ caching_name = wxT("vcd-caching");
+ break;
case 3: /* CD-DA */
- disc_chapter->Disable();
- disc_chapter_label->Disable();
+ mrltemp =
#ifdef HAVE_CDDAX
- if ( disc_title->GetValue() )
- mrltemp = wxT("cddax://")
- + disc_device->GetValue()
- + wxString::Format( wxT("@T%d"),
- disc_title->GetValue() );
- else
- mrltemp = wxT("cddax://")
- + disc_device->GetValue();
-
+ wxT("cddax://")
#else
- mrltemp = wxT("cdda://")
- + disc_device->GetValue()
- + wxString::Format( wxT("@%d"),
- disc_title->GetValue() );
+ wxT("cdda://")
#endif
- break;
+ + disc_device->GetValue();
+ if( i_disc_title > 0 )
+ mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
+
+ caching_name = wxT("cdda-caching");
+ break;
- default: ;
- msg_Err( p_intf, "invalid selection (%d)",
- disc_type->GetSelection() );
+ default:
+ msg_Err( p_intf, "invalid selection (%d)",
+ disc_type->GetSelection() );
}
break;
+
case NET_ACCESS:
switch( i_net_type )
{
case 0:
- mrltemp = wxT("udp") + demux + wxT("://");
+ mrltemp = wxT("udp://");
if ( net_ipv6->GetValue() )
{
mrltemp += wxT("@[::]");
{
mrltemp += wxString::Format( wxT("@:%d"), i_net_ports[0] );
}
+
+ caching_name = wxT("udp-caching");
break;
case 1:
- mrltemp = wxT("udp") + demux + wxT("://@");
+ mrltemp = wxT("udp://@");
if ((net_addrs[1]->GetLineText(0).Find (':') != -1)
&& (net_addrs[1]->GetLineText(0)[0u] != '['))
{
{
mrltemp += wxString::Format( wxT(":%d"), i_net_ports[1] );
}
+
+ caching_name = wxT("udp-caching");
break;
case 2:
/* http access */
- if( net_addrs[2]->GetLineText(0).Find(wxT("http://")) )
- {
- mrltemp = wxT("http") + demux + wxT("://");
- }
+ if( net_addrs[2]->GetLineText(0).Find(wxT("://")) == -1 )
+ mrltemp = wxT("http://");
+
mrltemp += net_addrs[2]->GetLineText(0);
+
+ caching_name = wxT("http-caching");
break;
case 3:
/* RTSP access */
if( net_addrs[3]->GetLineText(0).Find(wxT("rtsp://")) != 0 )
{
- mrltemp = wxT("rtsp") + demux + wxT("://");
+ mrltemp = wxT("rtsp://");
}
mrltemp += net_addrs[3]->GetLineText(0);
+
+ caching_name = wxT("rtsp-caching");
break;
}
break;
break;
}
+ if( caching_name.size() )
+ {
+ if( caching_value->IsEnabled() )
+ {
+ mrltemp += wxT(" :") + caching_name +
+ wxString::Format( wxT("=%d"), i_caching );
+ }
+ else
+ {
+ int i_value = config_GetInt( p_intf, caching_name.mb_str() );
+ caching_value->SetValue( i_value );
+ }
+ }
+
mrl_combo->SetValue( mrltemp );
}
if( b_start )
{
- int i_pos = playlist_GetPositionById( p_playlist , i_id );
- playlist_Command( p_playlist, PLAYLIST_GOTO, i_pos );
+ playlist_Control( p_playlist, PLAYLIST_ITEMPLAY , p_item );
}
}
*****************************************************************************/
void OpenDialog::OnDiscPanelChange( wxCommandEvent& event )
{
+ if( event.GetId() == DiscTitle_Event ) i_disc_title = event.GetInt();
+ if( event.GetId() == DiscChapter_Event ) i_disc_chapter = event.GetInt();
+ if( event.GetId() == DiscSub_Event ) i_disc_sub = event.GetInt();
+
UpdateMRL( DISC_ACCESS );
}
void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
{
char *psz_device = NULL;
- int i_selection = 1; /* Default Title/Track selection number*/
switch( disc_type->GetSelection() )
{
case 0: /* DVD with menus */
- case 4: /* DVD with menus (dvdnav) */
- i_selection=0;
- /* Fall through... */
-
- case 1: /* DVD of some sort */
+ case 1: /* DVD without menus */
+ disc_sub->Enable(); disc_sub_label->Enable();
+ disc_chapter->Enable(); disc_chapter_label->Enable();
+ disc_title_label->SetLabel ( wxU(_("Title")) );
psz_device = config_GetPsz( p_intf, "dvd" );
if( !b_disc_device_changed )
{
- if( psz_device )
- disc_device->SetValue( wxL2U(psz_device) );
- else
- disc_device->SetValue( wxT("") );
-
- disc_title_label->SetLabel ( wxU(_("Title")) );
+ if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
+ else disc_device->SetValue( wxT("") );
}
- disc_title->SetRange( i_selection, 255 );
- disc_title->SetValue( i_selection );
-
- disc_chapter->SetRange( 1, 255 );
- disc_chapter->SetValue( 1 );
- disc_chapter_label->SetLabel ( wxU(_("Chapter")) );
-
+ disc_title->SetRange( 0, 255 );
+ disc_chapter->SetRange( 0, 255 );
break;
case 2: /* VCD of some sort */
+ disc_sub->Enable(); disc_sub_label->Enable();
+ disc_chapter->Disable(); disc_chapter_label->Disable();
psz_device = config_GetPsz( p_intf, "vcd" );
if( !b_disc_device_changed )
{
- if( psz_device )
- disc_device->SetValue( wxL2U(psz_device) );
- else
- disc_device->SetValue( wxT("") );
+ if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
+ else disc_device->SetValue( wxT("") );
}
- /* There are at most 98, tracks in a VCD, 999 Segments, 500 entries
- I don't know what the limit is for LIDs, 999 is probably safe
- though.
-
- FIXME: it would be better however to get the information for
- this particular Media possibly from the General Info area.
- */
#ifdef HAVE_VCDX
disc_title_label->SetLabel ( config_GetInt( p_intf, "vcdx-PBC" )
? wxT("Playback LID") : wxT("Entry") );
- disc_title->SetRange( 0, 999 );
- i_selection = 0;
#else
disc_title_label->SetLabel ( wxU(_("Track")) );
- disc_title->SetRange( 1, 98 );
#endif
- disc_title->SetValue( i_selection );
-
- /* We use the chapter to set subtitle number */
- disc_chapter_label->SetLabel ( wxU(_("Subtitle")) );
- disc_chapter->SetRange( -1, 4 );
- disc_chapter->SetValue( config_GetInt( p_intf, "spu-channel" ) );
+ disc_title->SetRange( 0, 999 );
break;
case 3: /* CD-DA */
+ disc_sub->Disable(); disc_sub_label->Disable();
+ disc_chapter->Disable(); disc_chapter_label->Disable();
+ disc_title_label->SetLabel ( wxU(_("Track")) );
psz_device = config_GetPsz( p_intf, "cd-audio" );
if( !b_disc_device_changed )
{
- if( psz_device )
- disc_device->SetValue( wxL2U(psz_device) );
- else
- disc_device->SetValue( wxT("") );
+ if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
+ else disc_device->SetValue( wxT("") );
}
- disc_title_label->SetLabel ( wxU(_("Track")) );
-#ifdef HAVE_CDDAX
- i_selection = 0;
-#endif
- /* There are at most 99 tracks in a CD-DA */
- disc_title->SetRange( i_selection, 99 );
- disc_title->SetValue( i_selection );
+
+ /* There are at most 99 tracks in a CD-DA */
+ disc_title->SetRange( 0, 99 );
break;
+
default:
msg_Err( p_intf, "invalid Disc type selection (%d)",
disc_type->GetSelection() );
break;
}
+ disc_title->SetValue( 0 ); i_disc_title = 0;
+ disc_chapter->SetValue( 0 ); i_disc_chapter = 0;
+
if( psz_device ) free( psz_device );
UpdateMRL( DISC_ACCESS );
if( subsfile_dialog->encoding_combo )
subsfile_mrl.Add( wxString(wxT("subsdec-encoding=")) +
subsfile_dialog->encoding_combo->GetValue() );
- subsfile_mrl.Add( wxString::Format( wxT("sub-delay=%i"),
- subsfile_dialog->delay_spinctrl->GetValue() ) );
+ subsfile_mrl.Add( wxString::Format(wxT("subsdec-align=%i"),
+ (int)subsfile_dialog->align_combo->GetClientData(
+ subsfile_dialog->align_combo->GetSelection()) ) );
+
+ subsfile_mrl.Add( wxString::Format( wxT("freetype-rel-fontsize=%i"),
+ (int)subsfile_dialog->size_combo->GetClientData(
+ subsfile_dialog->size_combo->GetSelection()) ) );
subsfile_mrl.Add( wxString::Format( wxT("sub-fps=%i"),
subsfile_dialog->fps_spinctrl->GetValue() ) );
+ subsfile_mrl.Add( wxString::Format( wxT("sub-delay=%i"),
+ subsfile_dialog->delay_spinctrl->GetValue() ) );
}
}
}
}
+/*****************************************************************************
+ * 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.
*****************************************************************************/