Commit 8e843ea7 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*: removed the V4L specific code.

  The V4L panel is now created automatically with an "AutoBuiltPanel" class.
  (A few options are missing compared to the old panel but they need to be added
   to the V4L plugin, not the wxWindows code).
parent 7a8356f8
......@@ -19,7 +19,6 @@ SOURCES_wxwindows = \
subtitles.cpp \
bookmarks.cpp \
video.cpp \
v4l.cpp \
$(NULL)
EXTRA_DIST += \
......
......@@ -68,18 +68,13 @@ enum
NetAddr1_Event, NetAddr2_Event, NetAddr3_Event, NetAddr4_Event,
NetForceIPv6_Event,
#ifndef WIN32
VideoType_Event,
VideoDevice_Event,
VideoChannel_Event,
V4LSettings_Event,
#endif
SubsFileEnable_Event,
SubsFileSettings_Event,
SoutEnable_Event,
SoutSettings_Event,
AdvancedOptions_Event
};
BEGIN_EVENT_TABLE(OpenDialog, wxFrame)
......@@ -120,14 +115,6 @@ BEGIN_EVENT_TABLE(OpenDialog, wxFrame)
EVT_TEXT(NetAddr4_Event, OpenDialog::OnNetPanelChange)
EVT_CHECKBOX(NetForceIPv6_Event, OpenDialog::OnNetPanelChange)
#ifndef WIN32
/* Events generated by the v4l panel */
EVT_RADIOBOX(VideoType_Event, OpenDialog::OnV4LTypeChange)
EVT_TEXT(VideoDevice_Event, OpenDialog::OnV4LPanelChange)
EVT_SPINCTRL(VideoChannel_Event, OpenDialog::OnV4LPanelChange)
EVT_BUTTON(V4LSettings_Event, OpenDialog::OnV4LSettingsChange)
#endif
/* Events generated by the subtitle file buttons */
EVT_CHECKBOX(SubsFileEnable_Event, OpenDialog::OnSubsFileEnable)
EVT_BUTTON(SubsFileSettings_Event, OpenDialog::OnSubsFileSettings)
......@@ -156,30 +143,55 @@ public:
virtual ~AutoBuiltPanel() {}
void UpdateAdvancedMRL();
wxString name;
ArrayOfConfigControls config_array;
ArrayOfConfigControls advanced_config_array;
wxComboBox *p_advanced_mrl_combo;
private:
intf_thread_t *p_intf;
OpenDialog *p_open_dialog;
void OnAdvanced( wxCommandEvent& event );
wxDialog *p_advanced_dialog;
DECLARE_EVENT_TABLE();
};
void AutoBuildCallback( void *p_data )
BEGIN_EVENT_TABLE(AutoBuiltPanel, wxPanel)
EVT_BUTTON(wxID_OK, AutoBuiltPanel::OnAdvanced)
EVT_BUTTON(AdvancedOptions_Event, AutoBuiltPanel::OnAdvanced)
END_EVENT_TABLE()
static void AutoBuildCallback( void *p_data )
{
((OpenDialog *)p_data)->UpdateMRL();
}
static void AutoBuildAdvancedCallback( void *p_data )
{
((AutoBuiltPanel *)p_data)->UpdateAdvancedMRL();
}
AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
intf_thread_t *_p_intf,
const module_t *p_module )
: wxPanel( parent, -1, wxDefaultPosition, wxSize(200, 200) ),
name( wxU(p_module->psz_object_name) ), p_intf( _p_intf )
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize ),
name( wxU(p_module->psz_object_name) ),
p_advanced_mrl_combo( NULL ),
p_intf( _p_intf ), p_open_dialog( dialog ), p_advanced_dialog( NULL )
{
wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
module_config_t *p_item = p_module->p_config;
bool b_advanced = false;
if( p_item ) do
{
if( !(p_item->i_type & CONFIG_HINT) && p_item->b_advanced )
b_advanced = true;
if( p_item->i_type & CONFIG_HINT || p_item->b_advanced )
continue;
......@@ -197,9 +209,129 @@ AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
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...")) );
sizer->Add( button, 0, wxALL, 5 );
/* Build the advanced dialog */
p_advanced_dialog =
new wxDialog( this, -1, wxU(_("Advanced options")) + wxT(" (") +
wxU( p_module->psz_longname ) + wxT(")"),
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
/* Create MRL combobox */
wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBox *mrl_box =
new wxStaticBox( p_advanced_dialog, -1,
wxU(_("Advanced options")) );
wxStaticBoxSizer *mrl_sizer =
new wxStaticBoxSizer( mrl_box, wxHORIZONTAL );
wxStaticText *mrl_label =
new wxStaticText( p_advanced_dialog, -1, wxU(_("Options:")) );
p_advanced_mrl_combo =
new wxComboBox( p_advanced_dialog, MRL_Event, wxT(""),
wxDefaultPosition, wxDefaultSize );
mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER, 5 );
mrl_sizer->Add( p_advanced_mrl_combo, 1, wxALL | wxALIGN_CENTER, 5 );
mrl_sizer_sizer->Add( mrl_sizer, 1, wxEXPAND | wxALL, 5 );
sizer->Add( mrl_sizer_sizer, 0, wxEXPAND | wxALL, 2 );
/* Add advanced options to panel */
module_config_t *p_item = p_module->p_config;
if( p_item ) do
{
if( p_item->i_type & CONFIG_HINT || !p_item->b_advanced )
continue;
ConfigControl *control =
CreateConfigControl( VLC_OBJECT(p_intf), p_item,
p_advanced_dialog );
advanced_config_array.Add( control );
/* Don't add items that were not recognized */
if( control == NULL ) continue;
control->SetUpdateCallback( AutoBuildAdvancedCallback,
(void *)this );
sizer->Add( control, 0, wxEXPAND | wxALL, 2 );
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
/* Separation */
dummy_panel = new wxPanel( p_advanced_dialog, -1 );
sizer->Add( dummy_panel, 1 );
wxStaticLine *static_line =
new wxStaticLine( p_advanced_dialog, wxID_OK );
sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
/* Create OK button */
wxButton *ok_button =
new wxButton( p_advanced_dialog, wxID_OK, wxU(_("OK")) );
ok_button->SetDefault();
sizer->Add( ok_button, 0, wxALL, 5 );
sizer->SetMinSize( 400, -1 );
p_advanced_dialog->SetSizerAndFit( sizer );
}
this->SetSizerAndFit( sizer );
}
void AutoBuiltPanel::OnAdvanced( wxCommandEvent& event )
{
p_advanced_dialog->Show( !p_advanced_dialog->IsShown() );
UpdateAdvancedMRL();
p_open_dialog->UpdateMRL();
}
void AutoBuiltPanel::UpdateAdvancedMRL()
{
wxString mrltemp;
for( int i = 0; i < (int)advanced_config_array.GetCount(); i++ )
{
ConfigControl *control = advanced_config_array.Item(i);
mrltemp += wxT(":");
if( control->GetType() == CONFIG_ITEM_BOOL &&
!control->GetIntValue() ) mrltemp += wxT("no-");
mrltemp += control->GetName();
switch( control->GetType() )
{
case CONFIG_ITEM_STRING:
case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE:
mrltemp += wxT("=\"") + control->GetPszValue() + wxT("\"");
break;
case CONFIG_ITEM_INTEGER:
mrltemp +=
wxString::Format( wxT("=%i"), control->GetIntValue() );
break;
case CONFIG_ITEM_FLOAT:
mrltemp +=
wxString::Format(wxT("=%f"), control->GetFloatValue());
break;
}
}
p_advanced_mrl_combo->SetValue( mrltemp );
}
/*****************************************************************************
* Constructor.
*****************************************************************************/
......@@ -225,9 +357,6 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
i_disc_type_selection = 0;
i_open_arg = i_arg;
#ifndef WIN32
v4l_dialog = NULL;
#endif
sout_dialog = NULL;
subsfile_dialog = NULL;
b_disc_device_changed = false;
......@@ -311,12 +440,28 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
i_access_method == DISC_ACCESS );
notebook->AddPage( NetPanel( notebook ), wxU(_("Network")),
i_access_method == NET_ACCESS );
#ifndef WIN32
notebook->AddPage( V4LPanel( notebook ), wxU(_("Video for Linux")),
module_t *p_module = config_FindModule( VLC_OBJECT(p_intf), "v4l" );
if( p_module )
{
AutoBuiltPanel *autopanel =
new AutoBuiltPanel( notebook, this, p_intf, p_module );
input_tab_array.Add( autopanel );
notebook->AddPage( autopanel, wxU( p_module->psz_longname ),
i_access_method == CAPTURE_ACCESS );
#endif
}
p_module = config_FindModule( VLC_OBJECT(p_intf), "pvr" );
if( p_module )
{
AutoBuiltPanel *autopanel =
new AutoBuiltPanel( notebook, this, p_intf, p_module );
input_tab_array.Add( autopanel );
notebook->AddPage( autopanel, wxU( p_module->psz_longname ),
i_access_method == CAPTURE_ACCESS );
}
module_t *p_module = config_FindModule( VLC_OBJECT(p_intf), "dshow" );
p_module = config_FindModule( VLC_OBJECT(p_intf), "dshow" );
if( p_module )
{
AutoBuiltPanel *autopanel =
......@@ -334,12 +479,6 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
dummy_event.SetId( NetRadio1_Event );
OnNetTypeChange( dummy_event );
#ifndef WIN32
/* Update v4l panel */
dummy_event.SetId( VideoType_Event );
OnV4LTypeChange( dummy_event );
#endif
/* Update MRL */
wxNotebookEvent event( wxEVT_NULL, 0, i_access_method );
OnPageChange( event );
......@@ -371,9 +510,6 @@ OpenDialog::~OpenDialog()
{
/* Clean up */
if( file_dialog ) delete file_dialog;
#ifndef WIN32
if( v4l_dialog ) delete v4l_dialog;
#endif
if( sout_dialog ) delete sout_dialog;
if( subsfile_dialog ) delete subsfile_dialog;
}
......@@ -599,65 +735,6 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
return panel;
}
#ifndef WIN32
wxPanel *OpenDialog::V4LPanel( wxWindow* parent )
{
wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
wxSize(200, 200) );
wxBoxSizer *sizer_row = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer *sizer = new wxFlexGridSizer( 1, 4, 20 );
static const wxString video_type_array[] =
{
wxU(_("Webcam")),
wxU(_("TV card")),
wxU(_("PVR")),
wxU(_("Kfir")),
};
video_type = new wxRadioBox( panel, VideoType_Event,
wxU(_("Video device type")),
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(video_type_array), video_type_array,
WXSIZEOF(video_type_array), wxRA_SPECIFY_COLS );
sizer_row->Add( video_type, 0, wxEXPAND | wxALL, 5 );
/* Video Options */
wxFlexGridSizer *video_sizer = new wxFlexGridSizer( 4, 2, 20 );
wxStaticText *label = new wxStaticText( panel, -1, wxU(_("Video device")) );
video_device = new wxTextCtrl( panel, VideoDevice_Event, wxT(""),
wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER);
video_device->SetToolTip( wxU(_("Device corresponding to your acquisition "
"card or your webcam")) );
video_sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
video_sizer->Add( video_device, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
label = new wxStaticText( panel, -1, wxU(_("Channel")) );
video_channel = new wxSpinCtrl( panel, VideoChannel_Event, wxT("0") );
video_channel->SetToolTip( wxU(_("Usually 0 is for tuner, 1 for composite "
"and 2 for svideo")) );
video_sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_HORIZONTAL );
video_sizer->Add( video_channel, 1, wxALIGN_LEFT | wxALIGN_CENTER_HORIZONTAL );
sizer->Add( video_sizer, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer *v4lbutton_sizer = new wxBoxSizer( wxHORIZONTAL );
v4l_button = new wxButton( panel, V4LSettings_Event,
wxU(_("Advanced settings...")) );
v4lbutton_sizer->Add( v4l_button, 0, wxALIGN_RIGHT, 5 );
sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );
sizer_row->Add( v4lbutton_sizer, 0, wxEXPAND | wxALL, 5 );
panel->SetSizerAndFit( sizer_row );
return panel;
}
#endif
void OpenDialog::UpdateMRL()
{
UpdateMRL( i_current_access_method );
......@@ -812,29 +889,6 @@ void OpenDialog::UpdateMRL( int i_access_method )
}
break;
#ifndef WIN32
case CAPTURE_ACCESS:
mrltemp = ( video_type->GetSelection() == 0 ? wxT("v4l") :
video_type->GetSelection() == 1 ? wxT("v4l") :
video_type->GetSelection() == 2 ? wxT("pvr") :
wxT("kfir") )
+ demux + wxT(":")
+ video_device->GetLineText( 0 );
if( video_type->GetSelection() == 1 )
{
mrltemp += wxString::Format( wxT(":channel=%d"),
video_channel->GetValue() );
}
if ( /* v4l_dialog != NULL && */ !v4l_mrl.IsEmpty() )
{
mrltemp += v4l_mrl[0];
}
break;
#endif
default:
{
int i_item = i_access_method - MAX_ACCESS;
......@@ -875,6 +929,13 @@ void OpenDialog::UpdateMRL( int i_access_method )
break;
}
}
if( input_panel->p_advanced_mrl_combo &&
input_panel->p_advanced_mrl_combo->GetValue() )
{
mrltemp += wxT(" ") +
input_panel->p_advanced_mrl_combo->GetValue();
}
}
break;
}
......@@ -947,8 +1008,6 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
}
}
//TogglePlayButton( PLAYING_S );
vlc_object_release( p_playlist );
Hide();
......@@ -1164,53 +1223,6 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event )
UpdateMRL( NET_ACCESS );
}
#ifndef WIN32
/*****************************************************************************
* v4l panel event methods.
*****************************************************************************/
void OpenDialog::OnV4LPanelChange( wxCommandEvent& WXUNUSED(event) )
{
UpdateMRL( CAPTURE_ACCESS );
}
void OpenDialog::OnV4LTypeChange( wxCommandEvent& WXUNUSED(event) )
{
video_device->SetValue( wxT( "/dev/video" ) );
v4l_button->Enable();
video_channel->Disable();
switch( video_type->GetSelection() )
{
case 1:
video_channel->Enable();
video_channel->SetRange( 0, 255 );
break;
case 3:
v4l_button->Disable();
break;
default:
break;
}
UpdateMRL( CAPTURE_ACCESS );
}
void OpenDialog::OnV4LSettingsChange( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the open dialog */
if( v4l_dialog == NULL )
v4l_dialog = new V4LDialog( p_intf, this );
if( v4l_dialog && v4l_dialog->ShowModal() == wxID_OK )
{
v4l_mrl = v4l_dialog->GetOptions();
}
UpdateMRL( CAPTURE_ACCESS );
}
#endif
/*****************************************************************************
* Subtitles file event methods.
*****************************************************************************/
......
/*****************************************************************************
* v4l.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2003 VideoLAN
* $Id$
*
* Authors: Mohammed Adnne Trojette <adn@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <errno.h> /* ENOMEM */
#include <string.h> /* strerror() */
#include <stdio.h>
#include <vlc/vlc.h>
#ifdef WIN32 /* mingw32 hack */
#undef Yield
#undef CreateDialog
#endif
#include <wx/combobox.h>
#include <wx/statline.h>
#include <vlc/intf.h>
#include "wxwindows.h"
#ifndef wxRB_SINGLE
# define wxRB_SINGLE 0
#endif
/*****************************************************************************
* Event Table.
*****************************************************************************/
/* IDs for the controls and the menu commands */
enum
{
MRL_Event,
Size_Event,
Norm_Event,
FrequencyEnable_Event,Frequency_Event,
AudioDevice_Event, ADevLocation, AudioChannel_Event,
BitrateEnable_Event, MaxBitrateEnable_Event,
Bitrate_Event, MaxBitrate_Event
};
BEGIN_EVENT_TABLE(V4LDialog, wxDialog)
/* Button events */
EVT_BUTTON(wxID_OK, V4LDialog::OnOk)
EVT_BUTTON(wxID_CANCEL, V4LDialog::OnCancel)
/* Events generated by the common panel */
EVT_CHECKBOX(Size_Event, V4LDialog::OnSizeEnable)
EVT_COMBOBOX(Size_Event, V4LDialog::OnSize)
EVT_CHECKBOX(Norm_Event, V4LDialog::OnNormEnable)
EVT_COMBOBOX(Norm_Event, V4LDialog::OnNorm)
EVT_CHECKBOX(FrequencyEnable_Event, V4LDialog::OnFrequencyEnable)
EVT_SPINCTRL(Frequency_Event, V4LDialog::OnFrequency)
/* Events generated by the audio panel */
EVT_CHECKBOX(AudioDevice_Event, V4LDialog::OnAudioEnable)
EVT_TEXT(ADevLocation, V4LDialog::OnAudioChange)
EVT_SPINCTRL(AudioChannel_Event, V4LDialog::OnAudioChannel)
/* Events generated by the bitrate panel */
EVT_CHECKBOX(BitrateEnable_Event, V4LDialog::OnBitrateEnable)
EVT_SPINCTRL(Bitrate_Event, V4LDialog::OnBitrate)
EVT_CHECKBOX(MaxBitrateEnable_Event, V4LDialog::OnMaxBitrateEnable)
EVT_SPINCTRL(MaxBitrate_Event, V4LDialog::OnMaxBitrate)
END_EVENT_TABLE()
/*****************************************************************************
* Constructor.
*****************************************************************************/
V4LDialog::V4LDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
wxDialog( _p_parent, -1, wxU(_("Advanced video device options")),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{
/* Initializations */
p_intf = _p_intf;
p_parent = _p_parent;
SetIcon( *p_intf->p_sys->p_icon );
/* Create a panel to put everything in */
wxPanel *panel = new wxPanel( this, -1 );
panel->SetAutoLayout( TRUE );
/* Create MRL combobox */
wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBox *mrl_box = new wxStaticBox( panel, -1,
wxU(_("Video device MRL")) );
wxStaticBoxSizer *mrl_sizer = new wxStaticBoxSizer( mrl_box,
wxHORIZONTAL );
wxStaticText *mrl_label = new wxStaticText( panel, -1,
wxU(_("Destination target:")));
mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
wxPoint(20,25), wxSize(200, -1), 0, NULL );
mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "
"the full MRL you want to open.\n Alternatively, the field will be "
"filled automatically when you use the controls below.")) );
mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER, 5 );
mrl_sizer->Add( mrl_combo, 1, wxALL | wxALIGN_CENTER, 5 );
mrl_sizer_sizer->Add( mrl_sizer, 1, wxEXPAND | wxALL, 5 );
/* Create the common panel */
wxPanel *common_panel = CommonPanel( panel );
/* Create the audio panel */
wxPanel *audio_panel = AudioPanel( panel );
/* Create the bitrate panel */
wxPanel *bitrate_panel = BitratePanel( panel );
/* 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();
wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,
wxU(_("Cancel")) );
/* Place everything in sizers */
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add( ok_button, 0, wxALL, 5 );
button_sizer->Add( cancel_button, 0, wxALL, 5 );
button_sizer->Layout();
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
panel_sizer->Add( common_panel, 1, wxEXPAND | wxALL, 5 );
panel_sizer->Add( audio_panel, 1, wxEXPAND | wxALL, 5 );
panel_sizer->Add( bitrate_panel, 1, wxEXPAND | wxALL, 5 );
panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALIGN_BOTTOM |
wxALL, 5 );
panel_sizer->Layout();
panel->SetSizerAndFit( panel_sizer );
main_sizer->Add( panel, 1, wxGROW, 0 );
main_sizer->Layout();
SetSizerAndFit( main_sizer );
}
V4LDialog::~V4LDialog()
{
}
wxArrayString V4LDialog::GetOptions()
{
return SeparateEntries( mrl_combo->GetValue() );
}
/*****************************************************************************
* Private methods.
*****************************************************************************/
void V4LDialog::UpdateMRL()
{
wxString audio;
if( audio_checkbox->IsChecked() )
{
audio = wxT(":adev=")
+ audio_device->GetLineText(0)
+ wxString::Format( wxT(":audio=%d"),
audio_channel->GetValue() );
}
wxString common;
{
if( size_checkbox->IsChecked() )
{
common += wxT(":size=")
+ size_combo->GetValue();
}
if( norm_checkbox->IsChecked() )
{
common += wxT(":norm=")
+ norm_combo->GetValue();
}
if( frequency_checkbox->IsChecked() )
{
common += wxString::Format( wxT(":frequency=%d"),
frequency->GetValue() );
}
}
wxString rate;
{
if( bitrate_checkbox->IsChecked() )
{
rate += wxString::Format( wxT(":bitrate=%d"),
bitrate->GetValue() );
}
if( maxbitrate_checkbox->IsChecked() )
{
rate += wxString::Format( wxT(":maxbitrate=%d"),
maxbitrate->GetValue() );
}
}
if( !audio.IsEmpty() || !common.IsEmpty() || !rate.IsEmpty() )
mrl_combo->SetValue( audio + common + rate);
else
mrl_combo->SetValue( wxT("") );
}
wxPanel *V4LDialog::CommonPanel( wxWindow* parent )
{
wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
wxSize(200, 200) );
wxStaticBox *panel_box = new wxStaticBox( panel, -1,
wxU(_("Common options")) );
wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
wxVERTICAL );
wxFlexGridSizer *subpanel_sizer;
common_subpanel = new wxPanel( panel, -1 );
subpanel_sizer = new wxFlexGridSizer( 2, 3, 20 );
static const wxString size_array[] =
{
wxT("subqcif"),
wxT("qsif"),
wxT("qcif"),
wxT("sif"),
wxT("cif"),
wxT("vga"),
};
size_checkbox = new wxCheckBox( common_subpanel,
Size_Event,
wxU(_("Size")) );
size_combo = new wxComboBox( common_subpanel, Size_Event, wxT(""),
wxPoint(20,25), wxSize( 120, -1),
WXSIZEOF(size_array), size_array,
wxCB_READONLY );
size_combo->SetSelection(5);
subpanel_sizer->Add( size_checkbox, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( size_combo, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
static const wxString norm_array[] =
{
wxT("pal"),
wxT("secam"),
wxT("ntsc")
};
norm_checkbox = new wxCheckBox( common_subpanel,
Norm_Event,
wxU(_("Norm")) );
norm_combo = new wxComboBox( common_subpanel, Norm_Event, wxT(""),
wxPoint(20,25), wxSize( 120, -1),
WXSIZEOF(norm_array), norm_array,
wxCB_READONLY );
norm_combo->SetSelection(1);
norm_combo->SetToolTip( wxU(_( "Standard of the analog signal" )) );
subpanel_sizer->Add( norm_checkbox, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( norm_combo, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
frequency_checkbox = new wxCheckBox( common_subpanel,
FrequencyEnable_Event,
wxU(_("Frequency (kHz)")) );
frequency = new wxSpinCtrl( common_subpanel, Frequency_Event,
wxT("479250") );
frequency->SetToolTip( wxU(_("The channel frequency in kHz" )) );
subpanel_sizer->Add( frequency_checkbox, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( frequency, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
common_subpanel->SetSizerAndFit( subpanel_sizer );
/* Stuff everything into the main panel */
panel_sizer->Add( common_subpanel, 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
panel->SetSizerAndFit( panel_sizer );
/* Update panel */
size_combo->Disable();
norm_combo->Disable();
frequency->Disable();
return panel;
}
wxPanel *V4LDialog::AudioPanel( wxWindow* parent )
{
wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
wxSize(200, 200) );
wxStaticBox *panel_box = new wxStaticBox( panel, -1,
wxU(_("Audio options")) );
wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
wxVERTICAL );
wxStaticText *label;
wxFlexGridSizer *subpanel_sizer;
audio_subpanel = new wxPanel( panel, -1 );
subpanel_sizer = new wxFlexGridSizer( 2, 2, 20 );
audio_checkbox = new wxCheckBox( audio_subpanel,
AudioDevice_Event,
wxU(_("Audio device")) );
audio_device = new wxTextCtrl( audio_subpanel, ADevLocation,
wxT("/dev/dsp"),
wxDefaultPosition, wxSize( 120, -1 ),
wxTE_PROCESS_ENTER);
audio_device->SetToolTip( wxU(_("Audio device")) );
label = new wxStaticText( audio_subpanel, -1, wxU(_("Channel")) );
audio_channel = new wxSpinCtrl( audio_subpanel, AudioChannel_Event,
wxT("1") );
audio_channel->SetToolTip( wxU(_("Usually 0 is for mono "
"and 1 for stereo")) );
subpanel_sizer->Add( audio_checkbox, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( audio_device, 1, wxALIGN_RIGHT );
subpanel_sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( audio_channel, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
audio_subpanel->SetSizerAndFit( subpanel_sizer );
/* Stuff everything into the main panel */
panel_sizer->Add( audio_subpanel, 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
panel->SetSizerAndFit( panel_sizer );
/* Update panel */
audio_device->Disable();
audio_channel->Disable();
return panel;
}
wxPanel *V4LDialog::BitratePanel( wxWindow* parent )
{
wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
wxSize(200, 200) );
wxStaticBox *panel_box = new wxStaticBox( panel, -1,
wxU(_("Bitrate options")) );
wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
wxVERTICAL );
wxFlexGridSizer *subpanel_sizer;
bitrate_subpanel = new wxPanel( panel, -1 );
subpanel_sizer = new wxFlexGridSizer( 2, 2, 20 );
bitrate_checkbox = new wxCheckBox( bitrate_subpanel,
BitrateEnable_Event,
wxU(_("Bitrate")) );
bitrate = new wxSpinCtrl( bitrate_subpanel, Bitrate_Event, wxT("3000") );
bitrate->SetToolTip( wxU(_("The average bitrate of the stream")) );
subpanel_sizer->Add( bitrate_checkbox, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( bitrate, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
maxbitrate_checkbox = new wxCheckBox( bitrate_subpanel,
MaxBitrateEnable_Event,
wxU(_("Maximum bitrate")) );
maxbitrate = new wxSpinCtrl( bitrate_subpanel, MaxBitrate_Event, wxT("3000") );
maxbitrate->SetToolTip( wxU(_("The maximum bitrate of the stream")) );
subpanel_sizer->Add( maxbitrate_checkbox, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( maxbitrate, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
bitrate_subpanel->SetSizerAndFit( subpanel_sizer );
/* Stuff everything into the main panel */
panel_sizer->Add( bitrate_subpanel, 1,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 );
panel->SetSizerAndFit( panel_sizer );
/* Update panel */
bitrate->Disable();
maxbitrate->Disable();
return panel;
}
/*****************************************************************************
* Events methods.
*****************************************************************************/
void V4LDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
mrl_combo->Append( mrl_combo->GetValue() );
EndModal( wxID_OK );
}
void V4LDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
{
EndModal( wxID_CANCEL );
}
void V4LDialog::OnMRLChange( wxCommandEvent& event )
{
//mrl = event.GetString();
}
/******************************************************************************
* Common panel event methods.
******************************************************************************/
void V4LDialog::OnSizeEnable( wxCommandEvent& event )
{
UpdateMRL();
size_combo->Enable( event.GetInt() );
}
void V4LDialog::OnSize( wxCommandEvent& event )
{
UpdateMRL();
}
void V4LDialog::OnNormEnable( wxCommandEvent& event )
{
norm_combo->Enable( event.GetInt() );
UpdateMRL();
}
void V4LDialog::OnNorm( wxCommandEvent& event )
{
UpdateMRL();
}
void V4LDialog::OnFrequencyEnable( wxCommandEvent& event )
{
frequency->SetRange( 0, 1200000 );
frequency->Enable( event.GetInt() );
UpdateMRL();
}
void V4LDialog::OnFrequency( wxCommandEvent& event )
{
UpdateMRL();
}
/*****************************************************************************
* Audio panel event methods.
*****************************************************************************/
void V4LDialog::OnAudioEnable( wxCommandEvent& event )
{
audio_channel->SetRange( 0, 255 );
audio_device->Enable( event.GetInt() );
audio_channel->Enable( event.GetInt() );
UpdateMRL();
}
void V4LDialog::OnAudioChange( wxCommandEvent& event )
{
UpdateMRL();
}
void V4LDialog::OnAudioChannel( wxCommandEvent& event )
{
UpdateMRL();
}
/******************************************************************************
* Bitrate panel event methods.
******************************************************************************/
void V4LDialog::OnBitrateEnable( wxCommandEvent& event )
{
bitrate->SetRange( 0, 10000 );
bitrate->Enable( event.GetInt() );
UpdateMRL();
}
void V4LDialog::OnBitrate( wxCommandEvent& event )
{
UpdateMRL();
}
void V4LDialog::OnMaxBitrateEnable( wxCommandEvent& event )
{
maxbitrate->SetRange( 0, 10000 );
maxbitrate->Enable( event.GetInt() );
UpdateMRL();
}
void V4LDialog::OnMaxBitrate( wxCommandEvent& event )
{
UpdateMRL();
}
......@@ -146,7 +146,6 @@ namespace wxvlc
{
class Interface;
class OpenDialog;
class V4LDialog;
class SoutDialog;
class SubsFileDialog;
class Playlist;
......@@ -225,7 +224,6 @@ private:
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event );
void OnOpenV4L( wxCommandEvent& event );
void OnExtended( wxCommandEvent& event );
void OnBookmarks( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event );
......@@ -297,7 +295,6 @@ private:
wxPanel *FilePanel( wxWindow* parent );
wxPanel *DiscPanel( wxWindow* parent );
wxPanel *NetPanel( wxWindow* parent );
wxPanel *V4LPanel( wxWindow* parent );
ArrayOfAutoBuiltPanel input_tab_array;
......@@ -321,11 +318,6 @@ private:
void OnNetPanelChange( wxCommandEvent& event );
void OnNetTypeChange( wxCommandEvent& event );
/* Event handlers for the v4l page */
void OnV4LPanelChange( wxCommandEvent& event );
void OnV4LTypeChange( wxCommandEvent& event );
void OnV4LSettingsChange( wxCommandEvent& event );
/* Event handlers for the stream output */
void OnSubsFileEnable( wxCommandEvent& event );
void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
......@@ -375,14 +367,6 @@ private:
wxTextCtrl *net_addrs[4];
wxCheckBox *net_ipv6;
/* Controls for the v4l panel */
wxRadioBox *video_type;
wxTextCtrl *video_device;
wxSpinCtrl *video_channel;
wxButton *v4l_button;
V4LDialog *v4l_dialog;
wxArrayString v4l_mrl;
/* Controls for the subtitles file */
wxButton *subsfile_button;
wxCheckBox *subsfile_checkbox;
......@@ -407,75 +391,6 @@ enum
};
#define MAX_ACCESS CAPTURE_ACCESS
/* V4L Dialog */
class V4LDialog: public wxDialog
{
public:
/* Constructor */
V4LDialog( intf_thread_t *p_intf, wxWindow *p_parent );
virtual ~V4LDialog();
wxArrayString GetOptions();
private:
void UpdateMRL();
wxPanel *AudioPanel( wxWindow* parent );
wxPanel *CommonPanel( wxWindow* parent );
wxPanel *BitratePanel( wxWindow* parent );
void ParseMRL();
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event );
void OnMRLChange( wxCommandEvent& event );
void OnAudioEnable( wxCommandEvent& event );
void OnAudioChange( wxCommandEvent& event );
void OnAudioChannel( wxCommandEvent& event );
void OnSizeEnable( wxCommandEvent& event );
void OnSize( wxCommandEvent& event );
void OnNormEnable( wxCommandEvent& event );
void OnNorm( wxCommandEvent& event );
void OnFrequencyEnable( wxCommandEvent& event );
void OnFrequency( wxCommandEvent& event );
void OnBitrateEnable( wxCommandEvent& event );
void OnBitrate( wxCommandEvent& event );
void OnMaxBitrateEnable( wxCommandEvent& event );
void OnMaxBitrate( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
wxWindow *p_parent;
wxComboBox *mrl_combo;
int i_access_type;
/* Controls for the v4l advanced options */
wxPanel *common_subpanel;
wxPanel *common_panel;
wxCheckBox *size_checkbox;
wxComboBox *size_combo;
wxCheckBox *norm_checkbox;
wxComboBox *norm_combo;
wxCheckBox *frequency_checkbox;
wxSpinCtrl *frequency;
wxPanel *audio_subpanel;
wxPanel *audio_panel;
wxCheckBox *audio_checkbox;
wxTextCtrl *audio_device;
wxSpinCtrl *audio_channel;
wxPanel *bitrate_subpanel;
wxPanel *bitrate_panel;
wxCheckBox *bitrate_checkbox;
wxSpinCtrl *bitrate;
wxCheckBox *maxbitrate_checkbox;
wxSpinCtrl *maxbitrate;
};
/* Stream output Dialog */
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