]> git.sesse.net Git - vlc/commitdiff
* modules/gui/wxwindows/*: added support for input options in the open dialog.
authorGildas Bazin <gbazin@videolan.org>
Thu, 24 Jul 2003 16:07:10 +0000 (16:07 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 24 Jul 2003 16:07:10 +0000 (16:07 +0000)
   The stream output and subtitles options use them and you can also add options in the MRL itself.

modules/gui/wxwindows/open.cpp
modules/gui/wxwindows/preferences.cpp
modules/gui/wxwindows/wxwindows.h

index eba926c2c6c534201ac259d342f1d8e32ebe4fc7..6c747a2055d87f5f87e41d64543bc6ee4978ecad 100644 (file)
@@ -2,7 +2,7 @@
  * open.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: open.cpp,v 1.29 2003/07/23 01:13:47 gbazin Exp $
+ * $Id: open.cpp,v 1.30 2003/07/24 16:07:10 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -209,6 +209,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     {
         subsfile_checkbox->SetValue(TRUE);
         subsfile_button->Enable();
+        subsfile_mrl.Add( wxString(wxT("sub-file=")) + wxU(psz_subsfile) );
     }
     if( psz_subsfile ) free( psz_subsfile );
 
@@ -231,6 +232,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     {
         sout_checkbox->SetValue(TRUE);
         sout_button->Enable();
+        subsfile_mrl.Add( wxString(wxT("sout=")) + wxU(psz_sout) );
     }
     if( psz_sout ) free( psz_sout );
 
@@ -652,17 +654,72 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
     playlist_t *p_playlist =
         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                       FIND_ANYWHERE );
-    if( p_playlist == NULL )
-    {
-        return;
-    }
+    if( p_playlist == NULL ) return;
 
-    for( size_t i = 0; i < mrl.GetCount(); i++ )
+    for( int i = 0; i < (int)mrl.GetCount(); i++ )
     {
+        int i_options = 0, i_total_options;
+        char **ppsz_options = NULL;
+
+        /* Count the input options */
+        while( i + i_options + 1 < (int)mrl.GetCount() &&
+               mrl[i + i_options + 1].mb_str()[0] == ':' )
+        {
+            i_options++;
+        }
+
+        /* Allocate ppsz_options */
+        for( int j = 0; j < i_options; j++ )
+        {
+            if( !ppsz_options )
+                ppsz_options = (char **)malloc( sizeof(char *) * i_options );
+
+            ppsz_options[j] = strdup( mrl[i + j  + 1].mb_str() );
+        }
+
+       i_total_options = i_options;
+
+        /* Get the options from the subtitles dialog */
+        if( subsfile_checkbox->IsChecked() && subsfile_mrl.GetCount() )
+        {
+            ppsz_options = (char **)realloc( ppsz_options, sizeof(char *) *
+                               (i_total_options + subsfile_mrl.GetCount()) );
+
+            for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ )
+            {
+                ppsz_options[i_total_options + j] =
+                    strdup( subsfile_mrl[j].mb_str() );
+            }
+
+            i_total_options += subsfile_mrl.GetCount();
+        }
+
+        /* Get the options from the stream output dialog */
+        if( sout_checkbox->IsChecked() && sout_mrl.GetCount() )
+        {
+            ppsz_options = (char **)realloc( ppsz_options, sizeof(char *) *
+                               (i_total_options + sout_mrl.GetCount()) );
+
+            for( int j = 0; j < (int)sout_mrl.GetCount(); j++ )
+            {
+                ppsz_options[i_total_options + j] =
+                    strdup( sout_mrl[j].mb_str() );
+            }
+
+            i_total_options += sout_mrl.GetCount();
+        }
+
         playlist_Add( p_playlist, (const char *)mrl[i].mb_str(),
-                     0, 0,
+                      (const char **)ppsz_options, i_total_options,
                       PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
-    }
+
+        /* clean up */
+        for( int j = 0; j < i_total_options; j++ )
+            free( ppsz_options[j] );
+        if( ppsz_options ) free( ppsz_options );
+
+        i += i_options;
+   }
 
     //TogglePlayButton( PLAYING_S );
 
@@ -797,11 +854,7 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event )
 void OpenDialog::OnSubsFileEnable( wxCommandEvent& event )
 {
     subsfile_button->Enable( event.GetInt() != 0 );
-    if( !event.GetInt() )
-    {
-        config_PutPsz( p_intf, "sub-file", "" );
-    }
-    else
+    if( event.GetInt() && demuxdump_checkbox->IsChecked() )
     {
         demuxdump_checkbox->SetValue( 0 );
         wxCommandEvent event = wxCommandEvent( wxEVT_NULL );
@@ -818,12 +871,13 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
 
     if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK )
     {
-        config_PutPsz( p_intf, "sub-file",
-            (const char *)subsfile_dialog->file_combo->GetValue().mb_str() );
-        config_PutInt( p_intf, "sub-delay",
-                       subsfile_dialog->delay_spinctrl->GetValue() );
-        config_PutFloat( p_intf, "sub-fps",
-                         subsfile_dialog->fps_spinctrl->GetValue() );
+        subsfile_mrl.Empty();
+        subsfile_mrl.Add( wxString(wxT("sub-file=")) +
+                          subsfile_dialog->file_combo->GetValue() );
+        subsfile_mrl.Add( wxString::Format( wxT("sub-delay=%i"),
+                          subsfile_dialog->delay_spinctrl->GetValue() ) );
+        subsfile_mrl.Add( wxString::Format( wxT("sub-fps=%i"),
+                          subsfile_dialog->fps_spinctrl->GetValue() ) );
     }
 }
 
@@ -833,11 +887,7 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
 void OpenDialog::OnSoutEnable( wxCommandEvent& event )
 {
     sout_button->Enable( event.GetInt() != 0 );
-    if( !event.GetInt() )
-    {
-        config_PutPsz( p_intf, "sout", "" );
-    }
-    else
+    if( event.GetInt() && demuxdump_checkbox->IsChecked() )
     {
         demuxdump_checkbox->SetValue( 0 );
         wxCommandEvent event = wxCommandEvent( wxEVT_NULL );
@@ -854,8 +904,8 @@ void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) )
 
     if( sout_dialog && sout_dialog->ShowModal() == wxID_OK )
     {
-        config_PutPsz( p_intf, "sout",
-                       (const char *)sout_dialog->mrl.mb_str() );
+        sout_mrl.Empty();
+        sout_mrl.Add( wxString(wxT("sout=")) + sout_dialog->mrl );
     }
 }
 
index 9b31b8d0007b7ab1422a33ace0c1463dc9110476..917f120c6c3859f135dcb9550b6170bb91b209fc 100644 (file)
@@ -2,7 +2,7 @@
  * preferences.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: preferences.cpp,v 1.23 2003/07/20 12:22:32 gbazin Exp $
+ * $Id: preferences.cpp,v 1.24 2003/07/24 16:07:10 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -814,6 +814,9 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
                 for( int i_index = 0; p_item->ppsz_list[i_index]; i_index++ )
                 {
                     combo->Append( wxU(p_item->ppsz_list[i_index]) );
+                    if( p_item->psz_value && !strcmp( p_item->psz_value,
+                                 p_item->ppsz_list[i_index] ) )
+                        combo->SetSelection( i_index );
                 }
 
                 if( p_item->psz_value )
index 3d1472489c03276d7f68c22979677b57bff16f6e..a14750d79f7b353956c7c22f41089ef8b34eeea6 100644 (file)
@@ -2,7 +2,7 @@
  * wxwindows.h: private wxWindows interface description
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: wxwindows.h,v 1.47 2003/07/20 10:38:49 gbazin Exp $
+ * $Id: wxwindows.h,v 1.48 2003/07/24 16:07:10 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -324,11 +324,13 @@ private:
     wxButton *subsfile_button;
     wxCheckBox *subsfile_checkbox;
     SubsFileDialog *subsfile_dialog;
+    wxArrayString subsfile_mrl;
 
     /* Controls for the stream output */
     wxButton *sout_button;
     wxCheckBox *sout_checkbox;
     SoutDialog *sout_dialog;
+    wxArrayString sout_mrl;
 
     /* Controls for the demux dump */
     wxTextCtrl *demuxdump_textctrl;