Video4Linux / PVR / KFIR unified panel

parent aa5ceed9
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* open.cpp : wxWindows plugin for vlc * open.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: open.cpp,v 1.36 2003/08/10 09:22:07 gbazin Exp $ * $Id: open.cpp,v 1.37 2003/08/19 21:16:09 adn Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -79,6 +79,11 @@ enum ...@@ -79,6 +79,11 @@ enum
NetPort1_Event, NetPort2_Event, NetPort3_Event, NetPort1_Event, NetPort2_Event, NetPort3_Event,
NetAddr1_Event, NetAddr2_Event, NetAddr3_Event, NetAddr1_Event, NetAddr2_Event, NetAddr3_Event,
VideoType_Event,
VideoDevice_Event,
VideoChannel_Event,
V4LSettings_Event,
SubsFileEnable_Event, SubsFileEnable_Event,
SubsFileSettings_Event, SubsFileSettings_Event,
...@@ -124,6 +129,12 @@ BEGIN_EVENT_TABLE(OpenDialog, wxFrame) ...@@ -124,6 +129,12 @@ BEGIN_EVENT_TABLE(OpenDialog, wxFrame)
EVT_TEXT(NetAddr2_Event, OpenDialog::OnNetPanelChange) EVT_TEXT(NetAddr2_Event, OpenDialog::OnNetPanelChange)
EVT_TEXT(NetAddr3_Event, OpenDialog::OnNetPanelChange) EVT_TEXT(NetAddr3_Event, OpenDialog::OnNetPanelChange)
/* 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)
/* Events generated by the subtitle file buttons */ /* Events generated by the subtitle file buttons */
EVT_CHECKBOX(SubsFileEnable_Event, OpenDialog::OnSubsFileEnable) EVT_CHECKBOX(SubsFileEnable_Event, OpenDialog::OnSubsFileEnable)
EVT_BUTTON(SubsFileSettings_Event, OpenDialog::OnSubsFileSettings) EVT_BUTTON(SubsFileSettings_Event, OpenDialog::OnSubsFileSettings)
...@@ -155,6 +166,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, ...@@ -155,6 +166,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
p_parent = _p_parent; p_parent = _p_parent;
SetIcon( *p_intf->p_sys->p_icon ); SetIcon( *p_intf->p_sys->p_icon );
file_dialog = NULL; file_dialog = NULL;
v4l_dialog = NULL;
sout_dialog = NULL; sout_dialog = NULL;
subsfile_dialog = NULL; subsfile_dialog = NULL;
demuxdump_dialog = NULL; demuxdump_dialog = NULL;
...@@ -261,6 +273,9 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, ...@@ -261,6 +273,9 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
i_access_method == SAT_ACCESS ); i_access_method == SAT_ACCESS );
#endif #endif
notebook->AddPage( V4LPanel( notebook ), wxU(_("Video For Linux")),
i_access_method == V4L_ACCESS );
/* Update Disc panel */ /* Update Disc panel */
wxCommandEvent dummy_event; wxCommandEvent dummy_event;
OnDiscTypeChange( dummy_event ); OnDiscTypeChange( dummy_event );
...@@ -269,6 +284,10 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, ...@@ -269,6 +284,10 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
dummy_event.SetId( NetRadio1_Event ); dummy_event.SetId( NetRadio1_Event );
OnNetTypeChange( dummy_event ); OnNetTypeChange( dummy_event );
/* Update v4l panel */
dummy_event.SetId( VideoType_Event );
OnV4LTypeChange( dummy_event );
/* Update MRL */ /* Update MRL */
wxNotebookEvent event( wxEVT_NULL, 0, i_access_method ); wxNotebookEvent event( wxEVT_NULL, 0, i_access_method );
OnPageChange( event ); OnPageChange( event );
...@@ -298,6 +317,7 @@ OpenDialog::~OpenDialog() ...@@ -298,6 +317,7 @@ OpenDialog::~OpenDialog()
{ {
/* Clean up */ /* Clean up */
if( file_dialog ) delete file_dialog; if( file_dialog ) delete file_dialog;
if( v4l_dialog ) delete v4l_dialog;
if( sout_dialog ) delete sout_dialog; if( sout_dialog ) delete sout_dialog;
if( subsfile_dialog ) delete subsfile_dialog; if( subsfile_dialog ) delete subsfile_dialog;
if( demuxdump_dialog ) delete demuxdump_dialog; if( demuxdump_dialog ) delete demuxdump_dialog;
...@@ -513,6 +533,61 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent ) ...@@ -513,6 +533,61 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
return panel; return panel;
} }
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_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 );
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;
}
wxPanel *OpenDialog::SatPanel( wxWindow* parent ) wxPanel *OpenDialog::SatPanel( wxWindow* parent )
{ {
wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition, wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
...@@ -585,6 +660,28 @@ void OpenDialog::UpdateMRL( int i_access_method ) ...@@ -585,6 +660,28 @@ void OpenDialog::UpdateMRL( int i_access_method )
case SAT_ACCESS: case SAT_ACCESS:
mrltemp = wxT("satellite") + demux + wxT("://"); mrltemp = wxT("satellite") + demux + wxT("://");
break; break;
case V4L_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;
default: default:
break; break;
} }
...@@ -646,6 +743,22 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) ) ...@@ -646,6 +743,22 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
i_total_options += subsfile_mrl.GetCount(); i_total_options += subsfile_mrl.GetCount();
} }
/* Get the options from the v4l dialog */
/* if( v4l_mrl.GetCount() )
{
ppsz_options = (char **)realloc( ppsz_options, sizeof(char *) *
(i_total_options + v4l_mrl.GetCount()) );
for( int j = 0; j < (int)v4l_mrl.GetCount(); j++ )
{
ppsz_options[i_total_options + j] =
strdup( v4l_mrl[j].mb_str() );
}
i_total_options += v4l_mrl.GetCount();
}
*/
/* Get the options from the stream output dialog */ /* Get the options from the stream output dialog */
if( sout_checkbox->IsChecked() && sout_mrl.GetCount() ) if( sout_checkbox->IsChecked() && sout_mrl.GetCount() )
{ {
...@@ -659,6 +772,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) ) ...@@ -659,6 +772,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
} }
i_total_options += sout_mrl.GetCount(); i_total_options += sout_mrl.GetCount();
} }
playlist_Add( p_playlist, (const char *)mrl[i].mb_str(), playlist_Add( p_playlist, (const char *)mrl[i].mb_str(),
...@@ -813,6 +927,52 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event ) ...@@ -813,6 +927,52 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event )
UpdateMRL( NET_ACCESS ); UpdateMRL( NET_ACCESS );
} }
/*****************************************************************************
* v4l panel event methods.
*****************************************************************************/
void OpenDialog::OnV4LPanelChange( wxCommandEvent& WXUNUSED(event) )
{
UpdateMRL( V4L_ACCESS );
}
void OpenDialog::OnV4LTypeChange( wxCommandEvent& WXUNUSED(event) )
{
video_device->SetValue( wxU( "/dev/video" ) );
v4l_button->Enable();
video_channel->Disable();
switch( video_type->GetSelection() )
{
case 1:
video_channel->Enable();
video_channel->SetRange( 0, 255 );
video_channel->SetValue( 0 );
break;
case 3:
v4l_button->Disable();
break;
default:
break;
}
UpdateMRL( V4L_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( V4L_ACCESS );
}
/***************************************************************************** /*****************************************************************************
* Subtitles file event methods. * Subtitles file event methods.
*****************************************************************************/ *****************************************************************************/
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.53 2003/08/16 21:05:14 zorglub Exp $ * $Id: wxwindows.h,v 1.54 2003/08/19 21:16:09 adn Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -33,15 +33,6 @@ ...@@ -33,15 +33,6 @@
DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 ); DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
enum
{
FILE_ACCESS,
DISC_ACCESS,
NET_ACCESS,
SAT_ACCESS,
FILE_SIMPLE_ACCESS
};
class OpenDialog; class OpenDialog;
class Playlist; class Playlist;
class Messages; class Messages;
...@@ -159,8 +150,13 @@ private: ...@@ -159,8 +150,13 @@ private:
void OnExit( wxCommandEvent& event ); void OnExit( wxCommandEvent& event );
void OnAbout( wxCommandEvent& event ); void OnAbout( wxCommandEvent& event );
void OnOpenFileSimple( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event );
void OnOpenV4L( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event ); void OnShowDialog( wxCommandEvent& event );
void OnPlayStream( wxCommandEvent& event ); void OnPlayStream( wxCommandEvent& event );
void OnStopStream( wxCommandEvent& event ); void OnStopStream( wxCommandEvent& event );
void OnSliderUpdate( wxScrollEvent& event ); void OnSliderUpdate( wxScrollEvent& event );
...@@ -240,6 +236,7 @@ public: ...@@ -240,6 +236,7 @@ public:
}; };
/* Open Dialog */ /* Open Dialog */
class V4LDialog;
class SoutDialog; class SoutDialog;
class SubsFileDialog; class SubsFileDialog;
class OpenDialog: public wxFrame class OpenDialog: public wxFrame
...@@ -260,6 +257,7 @@ private: ...@@ -260,6 +257,7 @@ private:
wxPanel *DiscPanel( wxWindow* parent ); wxPanel *DiscPanel( wxWindow* parent );
wxPanel *NetPanel( wxWindow* parent ); wxPanel *NetPanel( wxWindow* parent );
wxPanel *SatPanel( wxWindow* parent ); wxPanel *SatPanel( wxWindow* parent );
wxPanel *V4LPanel( wxWindow* parent );
void UpdateMRL( int i_access_method ); void UpdateMRL( int i_access_method );
...@@ -282,6 +280,11 @@ private: ...@@ -282,6 +280,11 @@ private:
void OnNetPanelChange( wxCommandEvent& event ); void OnNetPanelChange( wxCommandEvent& event );
void OnNetTypeChange( 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 */ /* Event handlers for the stream output */
void OnSubsFileEnable( wxCommandEvent& event ); void OnSubsFileEnable( wxCommandEvent& event );
void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) ); void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
...@@ -325,6 +328,14 @@ private: ...@@ -325,6 +328,14 @@ private:
int i_net_ports[4]; int i_net_ports[4];
wxTextCtrl *net_addrs[4]; wxTextCtrl *net_addrs[4];
/* 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 */ /* Controls for the subtitles file */
wxButton *subsfile_button; wxButton *subsfile_button;
wxCheckBox *subsfile_checkbox; wxCheckBox *subsfile_checkbox;
...@@ -344,6 +355,72 @@ private: ...@@ -344,6 +355,72 @@ private:
wxFileDialog *demuxdump_dialog; wxFileDialog *demuxdump_dialog;
}; };
enum
{
FILE_ACCESS = 0,
DISC_ACCESS,
NET_ACCESS,
SAT_ACCESS,
V4L_ACCESS,
FILE_SIMPLE_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 );
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 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 );
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;
};
/* Stream output Dialog */ /* Stream output Dialog */
class SoutDialog: public wxDialog class SoutDialog: public wxDialog
{ {
...@@ -375,8 +452,8 @@ private: ...@@ -375,8 +452,8 @@ private:
/* Event handlers for the net access output */ /* Event handlers for the net access output */
void OnNetChange( wxCommandEvent& event ); void OnNetChange( wxCommandEvent& event );
/* Event specific to the sap address */ /* Event specific to the announce address */
void OnSAPAddrChange( wxCommandEvent& event ); void OnAnnounceAddrChange( wxCommandEvent& event );
/* Event handlers for the encapsulation panel */ /* Event handlers for the encapsulation panel */
void OnEncapsulationChange( wxCommandEvent& event ); void OnEncapsulationChange( wxCommandEvent& event );
...@@ -387,6 +464,7 @@ private: ...@@ -387,6 +464,7 @@ private:
/* Event handlers for the misc panel */ /* Event handlers for the misc panel */
void OnSAPMiscChange( wxCommandEvent& event ); void OnSAPMiscChange( wxCommandEvent& event );
void OnSLPMiscChange( wxCommandEvent& event );
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
...@@ -408,7 +486,8 @@ private: ...@@ -408,7 +486,8 @@ private:
/* Controls for the SAP announces */ /* Controls for the SAP announces */
wxPanel *misc_subpanels[1]; wxPanel *misc_subpanels[1];
wxCheckBox *sap_checkbox; wxCheckBox *sap_checkbox;
wxTextCtrl *sap_addr; wxCheckBox *slp_checkbox;
wxTextCtrl *announce_addr;
/* Controls for the encapsulation */ /* Controls for the encapsulation */
wxRadioButton *encapsulation_radios[5]; wxRadioButton *encapsulation_radios[5];
......
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