]> git.sesse.net Git - vlc/commitdiff
* modules/gui/wxwindows/*: added demuxdump support to the open dialog.
authorGildas Bazin <gbazin@videolan.org>
Sat, 29 Mar 2003 01:50:12 +0000 (01:50 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sat, 29 Mar 2003 01:50:12 +0000 (01:50 +0000)
modules/gui/wxwindows/open.cpp
modules/gui/wxwindows/preferences.cpp
modules/gui/wxwindows/wxwindows.h

index 8983100da844e574c2fad56fc91e06a61a23cbff..da8055aaaa53f4eb693ae5421daac6ed605a64ab 100644 (file)
@@ -2,7 +2,7 @@
  * open.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: open.cpp,v 1.6 2003/03/22 03:14:34 gbazin Exp $
+ * $Id: open.cpp,v 1.7 2003/03/29 01:50:12 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -80,6 +80,10 @@ enum
 
     SoutEnable_Event,
     SoutSettings_Event,
+
+    DemuxDump_Event,
+    DemuxDumpEnable_Event,
+    DemuxDumpBrowse_Event,
 };
 
 BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
@@ -121,6 +125,12 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
     /* Events generated by the stream output buttons */
     EVT_CHECKBOX(SoutEnable_Event, OpenDialog::OnSoutEnable)
     EVT_BUTTON(SoutSettings_Event, OpenDialog::OnSoutSettings)
+
+    /* Events generated by the demux dump buttons */
+    EVT_CHECKBOX(DemuxDumpEnable_Event, OpenDialog::OnDemuxDumpEnable)
+    EVT_TEXT(DemuxDump_Event, OpenDialog::OnDemuxDumpChange)
+    EVT_BUTTON(DemuxDumpBrowse_Event, OpenDialog::OnDemuxDumpBrowse)
+
 END_EVENT_TABLE()
 
 /*****************************************************************************
@@ -175,23 +185,51 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface,
 
     /* Create Stream Output checkox */
     wxFlexGridSizer *sout_sizer = new wxFlexGridSizer( 2, 1, 20 );
-    wxCheckBox *checkbox = new wxCheckBox( panel, SoutEnable_Event,
+    sout_checkbox = new wxCheckBox( panel, SoutEnable_Event,
                                            _("Stream Output") );
-    checkbox->SetToolTip( _("Use VLC has a stream server") );
-    sout_sizer->Add( checkbox, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+    sout_checkbox->SetToolTip( _("Use VLC has a stream server") );
+    sout_sizer->Add( sout_checkbox, 0,
+                     wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
     sout_button = new wxButton( panel, SoutSettings_Event, _("Settings...") );
     sout_button->Disable();
 
     char *psz_sout = config_GetPsz( p_intf, "sout" );
     if( psz_sout && *psz_sout )
     {
-        checkbox->SetValue(TRUE);
+        sout_checkbox->SetValue(TRUE);
         sout_button->Enable();
     }
     if( psz_sout ) free( psz_sout );
 
     sout_sizer->Add( sout_button, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
 
+    /* Create Demux Dump checkox */
+    wxBoxSizer *demuxdump_sizer = new wxBoxSizer( wxHORIZONTAL );
+    demuxdump_checkbox = new wxCheckBox( panel, DemuxDumpEnable_Event,
+                               _("Capture input stream") );
+    demuxdump_checkbox->SetToolTip(
+                           _("Capture the stream you are playing to a file") );
+    demuxdump_textctrl = new wxTextCtrl( panel, DemuxDump_Event,
+                                         "", wxDefaultPosition, wxDefaultSize,
+                                         wxTE_PROCESS_ENTER);
+    demuxdump_button = new wxButton( panel, DemuxDumpBrowse_Event,
+                                     _("Browse...") );
+
+    char *psz_demuxdump = config_GetPsz( p_intf, "demuxdump-file" );
+    if( psz_demuxdump && *psz_demuxdump )
+    {
+        demuxdump_textctrl->SetValue( psz_demuxdump );
+    }
+    if( psz_demuxdump ) free( psz_demuxdump );
+
+    demuxdump_textctrl->Disable();
+    demuxdump_button->Disable();
+    demuxdump_sizer->Add( demuxdump_checkbox, 0,
+                          wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 10 );
+    demuxdump_sizer->Add( demuxdump_button, 0,
+                          wxALL | wxALIGN_CENTER_VERTICAL, 10 );
+    demuxdump_sizer->Add( demuxdump_textctrl, 1, wxALL, 10 );
+
     /* Separation */
     wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
 
@@ -201,6 +239,10 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface,
     wxButton *cancel_button = new wxButton( panel, wxID_CANCEL, _("Cancel") );
 
 
+    /* Update Disc panel */
+    wxCommandEvent dummy_event;
+    OnDiscTypeChange( dummy_event );
+
     /* Update MRL */
     wxNotebookEvent event = wxNotebookEvent( wxEVT_NULL, 0, i_access_method );
     OnPageChange( event );
@@ -216,6 +258,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface,
     panel_sizer->Add( label, 0, wxEXPAND | wxALL, 5 );
     panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );
     panel_sizer->Add( sout_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
+    panel_sizer->Add( demuxdump_sizer, 0, wxEXPAND | 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();
@@ -247,7 +290,6 @@ wxPanel *OpenDialog::FilePanel( wxWindow* parent )
     sizer->Add( browse_button, 0, wxALL, 5 );
 
     panel->SetSizerAndFit( sizer );
-
     return panel;
 }
 
@@ -293,11 +335,6 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
     sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );
 
     panel->SetSizerAndFit( sizer_row );
-
-    /* Update Disc panel */
-    wxCommandEvent dummy_event;
-    OnDiscTypeChange( dummy_event );
-
     return panel;
 }
 
@@ -413,13 +450,6 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
     sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );
 
     panel->SetSizerAndFit( sizer_row );
-
-    /* Update Net panel */
-    net_addrs[3]->SetValue( "http://" );
-    wxCommandEvent dummy_event;
-    dummy_event.SetId( NetRadio1_Event );
-    OnNetTypeChange( dummy_event );
-
     return panel;
 }
 
@@ -432,14 +462,25 @@ wxPanel *OpenDialog::SatPanel( wxWindow* parent )
 
 void OpenDialog::UpdateMRL( int i_access_method )
 {
+    wxString demux;
+
+    i_current_access_method = i_access_method;
+
+    /* Check if the user asked for demuxdump */
+    if( demuxdump_checkbox->GetValue() )
+    {
+        demux = "/demuxdump";
+    }
+
     switch( i_access_method )
     {
     case FILE_ACCESS:
-        mrl = "file://" + file_combo->GetValue();
+        mrl = "file" + demux + "://" + file_combo->GetValue();
         break;
     case DISC_ACCESS:
-        mrl = ( disc_type->GetSelection() == 0 ? "dvdold://" :
-                disc_type->GetSelection() == 1 ? "dvd://" : "vcd://" )
+        mrl = ( disc_type->GetSelection() == 0 ? "dvdold" :
+                disc_type->GetSelection() == 1 ? "dvd" : "vcd" )
+                  + demux + "://"
                   + disc_device->GetLineText(0)
                   + wxString::Format( "@%d:%d",
                                       disc_title->GetValue(),
@@ -452,17 +493,17 @@ void OpenDialog::UpdateMRL( int i_access_method )
             if( net_ports[0]->GetValue() !=
                 config_GetInt( p_intf, "server-port" ) )
             {
-                mrl = wxString::Format( "udp://@:%d",
-                                        net_ports[0]->GetValue() );
+                mrl = "udp" + demux +
+                       wxString::Format( "://@:%d", net_ports[0]->GetValue() );
             }
             else
             {
-                mrl = "udp://";
+                mrl = "udp" + demux + "://";
             }
             break;
 
         case 1:
-            mrl = "udp://@" + net_addrs[1]->GetLineText(0);
+            mrl = "udp" + demux + "://@" + net_addrs[1]->GetLineText(0);
             if( net_ports[1]->GetValue() !=
                 config_GetInt( p_intf, "server-port" ) )
             {
@@ -472,17 +513,17 @@ void OpenDialog::UpdateMRL( int i_access_method )
             break;
 
         case 2:
-            mrl = "udp://";
+            mrl = "udp" + demux + "://";
             break;
 
         case 3:
             /* http access */     
-            mrl = net_addrs[3]->GetLineText(0);
+            mrl = "http" + demux + "://" + net_addrs[3]->GetLineText(0);
             break;
         }
         break;
     case SAT_ACCESS:
-        mrl = "satellite://";
+        mrl = "satellite" + demux + "://";
         break;
     default:
         break;
@@ -613,6 +654,13 @@ void OpenDialog::OnSoutEnable( wxCommandEvent& event )
     {
         config_PutPsz( p_intf, "sout", "" );
     }
+    else
+    {
+        demuxdump_checkbox->SetValue( 0 );
+        wxCommandEvent event = wxCommandEvent( wxEVT_NULL );
+        event.SetInt( 0 );
+        OnDemuxDumpEnable( event );
+    }
 }
 
 void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) )
@@ -625,3 +673,40 @@ void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) )
         config_PutPsz( p_intf, "sout", (char *)dialog.mrl.c_str() );
     }
 }
+
+/*****************************************************************************
+ * Demux dump event methods.
+ *****************************************************************************/
+void OpenDialog::OnDemuxDumpEnable( wxCommandEvent& event )
+{
+    demuxdump_textctrl->Enable( event.GetInt() != 0 );
+    demuxdump_button->Enable( event.GetInt() != 0 );
+
+    if( event.GetInt() )
+    {
+        sout_checkbox->SetValue( 0 );
+        wxCommandEvent event = wxCommandEvent( wxEVT_NULL );
+        event.SetInt( 0 );
+        OnSoutEnable( event );
+    }
+
+    UpdateMRL( i_current_access_method );
+}
+
+void OpenDialog::OnDemuxDumpBrowse( wxCommandEvent& WXUNUSED(event) )
+{
+    wxFileDialog dialog( this, _("Save file"), "", "", "*.*", wxSAVE );
+
+    if( dialog.ShowModal() == wxID_OK )
+    {
+        demuxdump_textctrl->SetValue( dialog.GetPath() );
+        wxCommandEvent event = wxCommandEvent( wxEVT_NULL );
+        OnDemuxDumpChange( event );
+    }
+}
+
+void OpenDialog::OnDemuxDumpChange( wxCommandEvent& WXUNUSED(event) )
+{
+    config_PutPsz( p_intf, "demuxdump-file",
+                   demuxdump_textctrl->GetValue() );
+}
index 8e3038cd9ce64ba553e33f896524361f47dfa684..6613a413e438681724e79dbd45f4989444e616c9 100644 (file)
@@ -2,7 +2,7 @@
  * preferences.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: preferences.cpp,v 1.1 2003/03/26 00:56:22 gbazin Exp $
+ * $Id: preferences.cpp,v 1.2 2003/03/29 01:50:12 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
 
 #include <wx/wxprec.h>
 #include <wx/wx.h>
+#include <wx/window.h>
 #include <wx/notebook.h>
 #include <wx/textctrl.h>
 #include <wx/combobox.h>
 #include <wx/spinctrl.h>
 #include <wx/statline.h>
 #include <wx/treectrl.h>
+#include <wx/clntdata.h>
+#include <wx/dynarray.h>
 
 #include <vlc/intf.h>
 
@@ -80,6 +83,8 @@ private:
     wxWindow *p_parent;
 };
 
+WX_DEFINE_ARRAY(wxEvtHandler *, ArrayOfControls);
+
 class PrefsPanel : public wxScrolledWindow
 {
 public:
@@ -95,19 +100,33 @@ private:
     DECLARE_EVENT_TABLE()
 
     intf_thread_t *p_intf;
+    ArrayOfControls controls_array;
 };
 
-class ConfigData : public wxTreeItemData
+class ConfigTreeData : public wxTreeItemData
 {
 public:
 
-    ConfigData() { panel == NULL; }
-    virtual ~ConfigData() { if( panel ) delete panel; }
+    ConfigTreeData() { panel == NULL; }
+    virtual ~ConfigTreeData() { if( panel ) delete panel; }
 
     wxWindow *panel;
     wxBoxSizer *sizer;
 };
 
+class ConfigData : public wxClientData
+{
+public:
+    ConfigData() { b_advanced = VLC_FALSE; }
+    ConfigData( vlc_bool_t _b_advanced ) { b_advanced = _b_advanced; }
+    virtual ~ConfigData() { }
+
+    vlc_bool_t IsAdvanced() { return b_advanced; }
+
+private:
+    vlc_bool_t b_advanced;
+};
+
 /*****************************************************************************
  * Event Table.
  *****************************************************************************/
@@ -222,16 +241,16 @@ void PrefsDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
 
 void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
 {
-    ConfigData *config_data;
+    ConfigTreeData *config_data;
 
-    config_data = (ConfigData *)GetItemData( event.GetOldItem() );
+    config_data = (ConfigTreeData *)GetItemData( event.GetOldItem() );
     if( config_data && config_data->panel )
     {
         config_data->panel->Hide();
         p_sizer->Remove( config_data->panel );
     }
 
-    config_data = (ConfigData *)GetItemData( event.GetItem() );
+    config_data = (ConfigTreeData *)GetItemData( event.GetItem() );
     if( config_data && config_data->panel )
     {
         config_data->panel->Show();
@@ -320,7 +339,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
             switch( p_item->i_type )
             {
             case CONFIG_HINT_CATEGORY:
-                ConfigData *config_data = new ConfigData;
+                ConfigTreeData *config_data = new ConfigTreeData;
                 config_data->panel =
                     new PrefsPanel( p_parent, p_intf,
                                     p_module, p_item->psz_text );
@@ -368,7 +387,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
         }
 
         /* Add the plugin to the tree */
-        ConfigData *config_data = new ConfigData;
+        ConfigTreeData *config_data = new ConfigTreeData;
         config_data->panel =
             new PrefsPanel( p_parent, p_intf, p_module, NULL );
         config_data->panel->Hide();
@@ -408,6 +427,9 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
   :  wxScrolledWindow( parent, -1, wxDefaultPosition, wxDefaultSize )
 {
     module_config_t *p_item;
+    vlc_list_t      *p_list;
+    module_t        *p_parser;
+
     wxStaticText *label;
     wxComboBox *combo;
     wxRadioButton *radio;
@@ -417,6 +439,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
     wxButton *button;
     wxStaticLine *static_line;
     wxBoxSizer *horizontal_sizer;
+    wxSortedArrayString sorted_array;
+    wxArrayString array;
 
     /* Initializations */
     p_intf = _p_intf;
@@ -473,11 +497,24 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
             break;
 
         case CONFIG_ITEM_MODULE:
+            label = new wxStaticText(this, -1, p_item->psz_text);
+            combo = new wxComboBox( this, -1, p_item->psz_value,
+                                    wxDefaultPosition, wxSize(200,-1),
+                                    0, NULL );
+
             /* build a list of available modules */
+            p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+            for( int i_index = 0; i_index < p_list->i_count; i_index++ )
+            {
+                p_parser = (module_t *)p_list->p_values[i_index].p_object ;
+
+                if( !strcmp( p_parser->psz_capability,
+                             p_item->psz_type ) )
+                {
+                    combo->Append( p_parser->psz_longname );
+                }
+            }
 
-            label = new wxStaticText(this, -1, p_item->psz_text);
-            combo = new wxComboBox( this, -1, "", wxPoint(20,25),
-                                    wxSize(120, -1), 0, NULL );
             combo->SetToolTip( p_item->psz_longtext );
             horizontal_sizer = new wxBoxSizer( wxHORIZONTAL );
             horizontal_sizer->Add( label, 0, wxALL, 5 );
@@ -488,13 +525,9 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
         case CONFIG_ITEM_STRING:
         case CONFIG_ITEM_FILE:
             label = new wxStaticText(this, -1, p_item->psz_text);
-            textctrl = new wxTextCtrl( this, -1, "",
+            textctrl = new wxTextCtrl( this, -1, p_item->psz_value,
                                        wxDefaultPosition, wxDefaultSize,
                                        wxTE_PROCESS_ENTER);
-#if 0
-            combo = new wxComboBox( this, -1, "", wxPoint(20,25),
-                                    wxSize(120, -1), 0, NULL );
-#endif
             textctrl->SetToolTip( p_item->psz_longtext );
             horizontal_sizer = new wxBoxSizer( wxHORIZONTAL );
             horizontal_sizer->Add( label, 0, wxALL, 5 );
@@ -509,10 +542,11 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
 
         case CONFIG_ITEM_INTEGER:
             label = new wxStaticText(this, -1, p_item->psz_text);
-            spin = new wxSpinCtrl( this, -1, p_item->psz_text,
+            spin = new wxSpinCtrl( this, -1,
+                                   wxString::Format(_("%d"), p_item->i_value),
                                    wxDefaultPosition, wxDefaultSize,
                                    wxSP_ARROW_KEYS,
-                                   0, 16000, 8);
+                                   0, 16000, p_item->i_value);
             spin->SetToolTip( p_item->psz_longtext );
             horizontal_sizer = new wxBoxSizer( wxHORIZONTAL );
             horizontal_sizer->Add( label, 0, wxALL, 5 );
@@ -522,10 +556,11 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
 
         case CONFIG_ITEM_FLOAT:
             label = new wxStaticText(this, -1, p_item->psz_text);
-            spin = new wxSpinCtrl( this, -1, p_item->psz_text,
+            spin = new wxSpinCtrl( this, -1,
+                                   wxString::Format(_("%d"), p_item->i_value),
                                    wxDefaultPosition, wxDefaultSize,
                                    wxSP_ARROW_KEYS,
-                                   0, 16000, 8);
+                                   0, 16000, p_item->i_value);
             spin->SetToolTip( p_item->psz_longtext );
             horizontal_sizer = new wxBoxSizer( wxHORIZONTAL );
             horizontal_sizer->Add( label, 0, wxALL, 5 );
@@ -535,6 +570,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
 
         case CONFIG_ITEM_BOOL:
             checkbox = new wxCheckBox( this, -1, p_item->psz_text );
+            if( p_item->i_value ) checkbox->SetValue(TRUE);
             checkbox->SetToolTip( p_item->psz_longtext );
             horizontal_sizer = new wxBoxSizer( wxHORIZONTAL );
             horizontal_sizer->Add( checkbox, 0, wxALL, 5 );
index 96050e86bca745ec374c3541c4a78ca0d06944eb..79723f718dd236f449c75d879a72378893a43c0f 100644 (file)
@@ -2,7 +2,7 @@
  * wxwindows.h: private wxWindows interface description
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: wxwindows.h,v 1.11 2003/03/26 00:56:22 gbazin Exp $
+ * $Id: wxwindows.h,v 1.12 2003/03/29 01:50:12 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -205,10 +205,16 @@ private:
     void OnSoutEnable( wxCommandEvent& event );
     void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
 
+    /* Event handlers for the demux dump */
+    void OnDemuxDumpEnable( wxCommandEvent& event );
+    void OnDemuxDumpBrowse( wxCommandEvent& event );
+    void OnDemuxDumpChange( wxCommandEvent& event );
+
     DECLARE_EVENT_TABLE();
 
     intf_thread_t *p_intf;
     Interface *p_main_interface;
+    int i_current_access_method;
 
     wxComboBox *mrl_combo;
 
@@ -231,6 +237,12 @@ private:
 
     /* Controls for the stream output */
     wxButton *sout_button;
+    wxCheckBox *sout_checkbox;
+
+    /* Controls for the demux dump */
+    wxTextCtrl *demuxdump_textctrl;
+    wxButton *demuxdump_button;
+    wxCheckBox *demuxdump_checkbox;
 };
 
 enum