]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/wizard.cpp
wizard.cpp -- change checkboxes to use wxALIGN_CENTER_VERTICAL|wxALL instead of wxLEF...
[vlc] / modules / gui / wxwindows / wizard.cpp
index 10f36a1b0ba43bf8a675954bcd8fb2b51b49010b..e602a8266d22b70aa1c4c1c3969d1dd0de9748d9 100644 (file)
@@ -115,7 +115,7 @@ END_EVENT_TABLE()
 #define PARTIAL _("Use this to read only a part of the stream. " \
                   "You must be able to control the incoming stream " \
                   "(for example, a file or a disc, but not an UDP " \
-                  "network stream.\n" \
+                  "network stream.)\n" \
                   "Enter the starting and ending times (in seconds)")
 
 #define INPUT_BUTTON _("Choose")
@@ -217,6 +217,9 @@ class wizInputPage : public wxWizardPage
         void SetTranscodePage( wxWizardPage *page);
         void SetAction( int i_action );
         void SetPintf( intf_thread_t *p_intf );
+        void SetUri( char *psz_uri );
+        void SetPartial( int i_from, int i_to );
+
     protected:
         bool b_chosen;
         intf_thread_t *p_intf;
@@ -236,14 +239,14 @@ class wizInputPage : public wxWizardPage
         OpenDialog *p_open_dialog;
         wxListView *listview;
         wxPanel *open_panel;
-        wxPanel *pl_panel;
         wxWizardPage *p_prev;
         wxWizardPage *p_streaming_page;
         wxWizardPage *p_transcode_page;
+
         DECLARE_EVENT_TABLE()
 };
 
-BEGIN_EVENT_TABLE(wizInputPage, wxWizardPageSimple)
+BEGIN_EVENT_TABLE(wizInputPage, wxWizardPage)
     EVT_RADIOBUTTON( InputRadio0_Event, wizInputPage::OnInputChange)
     EVT_RADIOBUTTON( InputRadio1_Event, wizInputPage::OnInputChange)
     EVT_BUTTON( Choose_Event, wizInputPage::OnChoose)
@@ -289,7 +292,7 @@ protected:
     DECLARE_EVENT_TABLE()
 };
 
-BEGIN_EVENT_TABLE(wizTranscodeCodecPage, wxWizardPageSimple)
+BEGIN_EVENT_TABLE(wizTranscodeCodecPage, wxWizardPage)
    EVT_CHECKBOX( VideoEnable_Event, wizTranscodeCodecPage::OnEnableVideo)
    EVT_CHECKBOX( AudioEnable_Event, wizTranscodeCodecPage::OnEnableAudio)
    EVT_COMBOBOX( VideoCodec_Event, wizTranscodeCodecPage::OnVideoCodecChange)
@@ -319,7 +322,7 @@ protected:
     wxWizardPage *p_next;
 };
 
-BEGIN_EVENT_TABLE(wizStreamingMethodPage, wxWizardPageSimple)
+BEGIN_EVENT_TABLE(wizStreamingMethodPage, wxWizardPage)
     EVT_RADIOBUTTON( MethodRadio0_Event, wizStreamingMethodPage::OnMethodChange)
     EVT_RADIOBUTTON( MethodRadio1_Event, wizStreamingMethodPage::OnMethodChange)
     EVT_RADIOBUTTON( MethodRadio2_Event, wizStreamingMethodPage::OnMethodChange)
@@ -347,14 +350,14 @@ protected:
     int i_mux;
     int i_action;
     void OnEncapChange(wxEvent& event);
-    wxRadioButton *encap_radios[9];
+    wxRadioButton *encap_radios[MUXERS_NUMBER];
     WizardDialog *p_parent;
     wxWizardPage *p_prev;
     wxWizardPage *p_streaming_page;
     wxWizardPage *p_transcode_page;
 };
 
-BEGIN_EVENT_TABLE(wizEncapPage, wxWizardPageSimple)
+BEGIN_EVENT_TABLE(wizEncapPage, wxWizardPage)
     EVT_WIZARD_PAGE_CHANGING(-1, wizEncapPage::OnWizardPageChanging)
     EVT_RADIOBUTTON( EncapRadio0_Event, wizEncapPage::OnEncapChange)
     EVT_RADIOBUTTON( EncapRadio1_Event, wizEncapPage::OnEncapChange)
@@ -366,6 +369,7 @@ BEGIN_EVENT_TABLE(wizEncapPage, wxWizardPageSimple)
     EVT_RADIOBUTTON( EncapRadio7_Event, wizEncapPage::OnEncapChange)
     EVT_RADIOBUTTON( EncapRadio8_Event, wizEncapPage::OnEncapChange)
     EVT_RADIOBUTTON( EncapRadio9_Event, wizEncapPage::OnEncapChange)
+    EVT_RADIOBUTTON( EncapRadio10_Event, wizEncapPage::OnEncapChange)
 END_EVENT_TABLE()
 
 /* Additional settings for transcode */
@@ -525,12 +529,14 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
     p_parent = (WizardDialog *)parent;
     b_chosen = false;
     p_open_dialog = NULL;
-    pl_panel = NULL;
+    listview = NULL;    
     mainSizer = new wxBoxSizer(wxVERTICAL);
 
     /* Create the texts */
     pageHeader( this, mainSizer, INPUT_TITLE, INPUT_TEXT );
 
+    mainSizer->Add( 0,20,0 );
+
     /* Create the radio buttons */
     input_radios[0] = new wxRadioButton( this, InputRadio0_Event ,
                                wxU( INPUT_OPEN ) );
@@ -563,10 +569,8 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
     {
         if( p_playlist->i_size > 0)
         {
-            pl_panel = new wxPanel(this, -1);
-            wxBoxSizer *plSizer = new wxBoxSizer( wxHORIZONTAL );
-            listview = new wxListView( pl_panel, ListView_Event,
-                                       wxDefaultPosition, wxSize(300,300),
+            listview = new wxListView( this, ListView_Event,
+                                       wxDefaultPosition, wxDefaultSize,
                                        wxLC_REPORT | wxSUNKEN_BORDER );
             listview->InsertColumn( 0, wxU(_("Name")) );
             listview->InsertColumn( 1, wxU(_("URI")) );
@@ -581,13 +585,10 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
                                                             input.psz_uri) );
             }
             listview->Select( p_playlist->i_index , TRUE);
-            plSizer->Add( listview, 1, wxALL | wxEXPAND , 5 );
-            pl_panel->SetSizer( plSizer );
-            plSizer->Layout();
-            mainSizer->Add( pl_panel, 1, wxALL|wxEXPAND, 5 );
+            mainSizer->Add( listview, 1, wxALL|wxEXPAND, 5 );
 
-            pl_panel->Hide();
-            mainSizer->Hide( pl_panel );
+            listview->Hide();
+            mainSizer->Hide( listview );
             mainSizer->Layout();
         }
         else
@@ -612,7 +613,7 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
     enable_checkbox = new wxCheckBox( this, PartialEnable_Event,
                                                 wxU(_("Enable") ) );
     enable_checkbox->SetToolTip(wxU(_(PARTIAL) ) ) ;
-    partial_sizer->Add( enable_checkbox, 0 , wxLEFT , 5 );
+    partial_sizer->Add( enable_checkbox, 0 , wxALIGN_CENTER_VERTICAL|wxALL, 5 ); //wxLEFT
 
     wxFlexGridSizer *partial_sizer2 = new wxFlexGridSizer( 4 , 1 , 20 );
     partial_sizer2->Add( new wxStaticText(this, -1, wxU(_( "From" ) ) ),
@@ -648,10 +649,10 @@ void wizInputPage::OnInputChange(wxEvent& event)
     i_input = event.GetId() - InputRadio0_Event;
     if( i_input == 0 )
     {
-        if( pl_panel )
+        if( listview )
         {
-            pl_panel->Hide();
-            mainSizer->Hide( pl_panel );
+            listview->Hide();
+            mainSizer->Hide( listview );
             open_panel->Show();
             mainSizer->Show( open_panel );
             mainSizer->Layout();
@@ -661,8 +662,8 @@ void wizInputPage::OnInputChange(wxEvent& event)
     {
         open_panel->Hide();
         mainSizer->Hide( open_panel );
-        pl_panel->Show();
-        mainSizer->Show( pl_panel );
+        listview->Show();
+        mainSizer->Show( listview );
         mainSizer->Layout();
     }
 }
@@ -677,7 +678,8 @@ void wizInputPage::OnEnablePartial(wxCommandEvent& event)
 void wizInputPage::OnChoose(wxCommandEvent& event)
 {
     p_open_dialog = new OpenDialog( p_intf, this, -1, -1, OPEN_STREAM );
-    if(  p_open_dialog->ShowModal() == wxID_OK )
+    if(  p_open_dialog->ShowModal() == wxID_OK &&
+         !p_open_dialog->mrl.IsEmpty() )
     {
         mrl_text->SetValue(p_open_dialog->mrl[0] );
     }
@@ -755,6 +757,23 @@ void wizInputPage::SetPintf( intf_thread_t *p_intf )
     this->p_intf = p_intf;
 }
 
+void wizInputPage::SetUri( char *psz_uri )
+{
+    mrl_text->SetValue( wxU( psz_uri ) );
+}
+
+void wizInputPage::SetPartial( int i_from, int i_to )
+{
+   wxString msg;
+   msg.Printf( wxString( wxT( "%i") ), i_from );
+   from_text->Enable( TRUE );
+   from_text->SetValue( msg );
+   msg.Printf( wxString( wxT( "%i") ), i_to );
+   to_text->Enable( TRUE );
+   to_text->SetValue( msg );
+   enable_checkbox->SetValue( TRUE );
+}
+
 /***************************************************
  * First transcode page: choose codecs             *
  ***************************************************/
@@ -779,7 +798,7 @@ wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent,
     /* Line 1 : only the checkbox */
     wxFlexGridSizer *video_sizer1 = new wxFlexGridSizer( 2,3,20 );
     video_sizer1->Add( new wxCheckBox( this, VideoEnable_Event,
-                       wxU(_("Transcode video") ) ), 0 , 0 , 5 );
+                       wxU(_("Transcode video") ) ), 0 , wxALIGN_CENTER_VERTICAL|wxALL , 5 );
     video_sizer1->Add( 0,0,1);
     /* Line 2 : codec */
     video_sizer1->Add( new wxStaticText(this, -1, wxU(_("Codec"))),0,wxLEFT ,5);
@@ -790,13 +809,16 @@ wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent,
         video_combo->Append( wxU( vcodecs_array[i].psz_display ) ,
                             (void *)&vcodecs_array[i] );
     }
+    i_video_codec = 0;
+    video_combo->SetSelection(0);
+
     video_sizer1->Add( video_combo, 0 , wxALIGN_LEFT , 0 );
 
     video_sizer1->Add( new wxStaticText(this, -1, wxU(_("Bitrate (kb/s)"))),0,
                        wxLEFT ,5);
     vb_combo = new wxComboBox( this, VideoBitrate_Event, wxT("1024"),
                                wxDefaultPosition, wxDefaultSize,
-                               WXSIZEOF(vbitrates_array), vbitrates_array );
+                               WXSIZEOF(vbitrates_array), vbitrates_array, wxCB_READONLY );
     video_sizer1->Add( vb_combo, 0, wxALIGN_LEFT , 0 );
 
     /* Line 3 : text */
@@ -814,7 +836,7 @@ wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent,
     /* Line1: enabler */
     wxFlexGridSizer *audio_sizer1 = new wxFlexGridSizer( 2,3,20);
     audio_sizer1->Add( new wxCheckBox( this, AudioEnable_Event,
-                            wxU(_("Transcode audio") ) ), 0 , wxLEFT, 5 );
+                            wxU(_("Transcode audio") ) ), 0 , wxALIGN_CENTER_VERTICAL|wxALL, 5 );
     audio_sizer1->Add( 0, 0, 1 );
 
     /* Line 2 : codec */
@@ -826,13 +848,15 @@ wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent,
         audio_combo->Append( wxU( acodecs_array[i].psz_display ) ,
                             (void *)&acodecs_array[i] );
     }
+    i_audio_codec = 0;
+    audio_combo->SetSelection(0);
     audio_sizer1->Add( audio_combo, 0 , wxALIGN_LEFT, 0 );
 
     audio_sizer1->Add( new wxStaticText(this, -1, wxU(_("Bitrate (kb/s)"))),0,
                        wxLEFT ,5);
     ab_combo = new wxComboBox( this, AudioBitrate_Event, wxT("192"),
                                wxDefaultPosition, wxDefaultSize,
-                               WXSIZEOF(abitrates_array), abitrates_array );
+                               WXSIZEOF(abitrates_array), abitrates_array, wxCB_READONLY );
     audio_sizer1->Add( ab_combo, 0, wxALIGN_LEFT, 0 );
 
     /* Line 3 : text */
@@ -905,20 +929,20 @@ void wizTranscodeCodecPage::OnWizardPageChanging(wxWizardEvent& event)
     /* Set the dummy codec ( accept all muxers ) if needed */
     if( !video_combo->IsEnabled() )
     {
-        i_video_codec = 12;
+        i_video_codec = VCODECS_NUMBER;
     }
     if( !audio_combo->IsEnabled() )
     {
-        i_audio_codec = 7;
+        i_audio_codec = ACODECS_NUMBER;
     }
 
     ((wizEncapPage *)GetNext())->SetPrev(this);
 
-    for( i = 0 ; i< 9 ; i++ )
+    for( i = 0 ; i< MUXERS_NUMBER ; i++ )
     {
         if( vcodecs_array[i_video_codec].muxers[i] != -1 )
         {
-            for( j = 0 ; j< 9 ; j++ )
+            for( j = 0 ; j<  MUXERS_NUMBER ; j++ )
             {
                 if( acodecs_array[i_audio_codec].muxers[j] ==
                               vcodecs_array[i_video_codec].muxers[i] )
@@ -976,7 +1000,7 @@ wizStreamingMethodPage::wizStreamingMethodPage( wxWizard *parent,
     /* Create the texts */
     pageHeader( this, mainSizer,  STREAMING1_TITLE, STREAMING1_TEXT );
 
-    mainSizer->Add( 0,0,1 );
+    mainSizer->Add( 0,50,0 );
 
     i_method = 0;
 
@@ -1052,7 +1076,7 @@ void wizStreamingMethodPage::OnWizardPageChanging(wxWizardEvent& event)
     }
 
     ((wizEncapPage *)GetNext())->SetPrev(this);
-    for( i = 0 ; i< 9 ; i++ )
+    for( i = 0 ; i< MUXERS_NUMBER ; i++ )
     {
         if( methods_array[i_method].muxers[i] != -1 )
         {
@@ -1079,6 +1103,8 @@ void wizStreamingMethodPage::OnMethodChange(wxEvent& event)
     i_method = event.GetId() - MethodRadio0_Event;
     address_text->SetLabel( wxU(
      vlc_wraptext( _(methods_array[i_method].psz_address), TEXTWIDTH, false)));
+    address_sizer->Layout();
+    mainSizer->Layout();
 }
 
 /***************************************************
@@ -1099,7 +1125,7 @@ wizEncapPage::wizEncapPage( wxWizard *parent ) : wxWizardPage(parent)
 
     mainSizer->Add( 0,0,1 );
 
-    for( i = 0 ; i< 9 ; i++ )
+    for( i = 0 ; i< MUXERS_NUMBER ; i++ )
     {
         encap_radios[i] = new wxRadioButton( this, EncapRadio0_Event + i,
                                wxU( encaps_array[i].psz_encap ) );
@@ -1123,7 +1149,7 @@ void wizEncapPage::OnWizardPageChanging(wxWizardEvent& event)
     int i;
     if( !event.GetDirection() )
     {
-        for( i = 0 ; i< 9 ; i++ )
+        for( i = 0 ; i< MUXERS_NUMBER ; i++ )
         {
             encap_radios[i]->Disable();
         }
@@ -1156,7 +1182,7 @@ void wizEncapPage::OnEncapChange(wxEvent& event)
 void wizEncapPage::EnableEncap( int encap )
 {
     int i;
-    for( i = 0 ; i< 9 ; i++)
+    for( i = 0 ; i< MUXERS_NUMBER ; i++)
     {
         if( encaps_array[i].id == encap )
         {
@@ -1251,7 +1277,7 @@ void wizTranscodeExtraPage::OnWizardPageChanging( wxWizardEvent& event )
     }
     if( event.GetDirection() )
     {
-       p_parent->SetTranscodeOut( (char *)file_text->GetValue().c_str());
+       p_parent->SetTranscodeOut( file_text->GetValue().mb_str());
     }
 }
 
@@ -1280,7 +1306,7 @@ wizStreamingExtraPage::wizStreamingExtraPage( wxWizard *parent,
     /* TTL */
     sizer->Add( new wxStaticText( this, -1, wxU(_("Time-To-Live (TTL)"))),
                     0, wxALL,  5 );
-    ttl_spin = new wxSpinCtrl( this, -1, "", wxDefaultPosition, wxDefaultSize,
+    ttl_spin = new wxSpinCtrl( this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize,
                     0, 1, 255, 1 );
     ttl_spin->SetToolTip(wxU(_(TTL) ) ) ;
     sizer->Add( ttl_spin, 0, wxALL , 5 );
@@ -1344,7 +1370,8 @@ wizTranscodeExtraPage *tr_page2 ;
 wizStreamingExtraPage *st_page2;
 wizEncapPage *encap_page;
 
-WizardDialog::WizardDialog(intf_thread_t *_p_intf, wxWindow *_p_parent ) :
+WizardDialog::WizardDialog(intf_thread_t *_p_intf, wxWindow *_p_parent,
+                           char *psz_uri, int _i_from, int _i_to  ) :
 wxWizard( _p_parent, -1, wxU(_("Streaming/Transcoding Wizard")), wxNullBitmap, wxDefaultPosition)
 {
     /* Initializations */
@@ -1353,8 +1380,8 @@ wxWizard( _p_parent, -1, wxU(_("Streaming/Transcoding Wizard")), wxNullBitmap, w
 
     /* Initialize structure */
     i_action = 0;
-    i_from = 0;
-    i_to = 0;
+    i_from = _i_from;
+    i_to = _i_to;
     i_ttl = 1;
     vb = 0;
     ab = 0;
@@ -1363,6 +1390,16 @@ wxWizard( _p_parent, -1, wxU(_("Streaming/Transcoding Wizard")), wxNullBitmap, w
 
     page1 = new wizHelloPage(this);
     page2 = new wizInputPage(this, page1, p_intf);
+
+    if( psz_uri )
+    {
+        page2->SetUri( psz_uri );
+    }
+    if( i_from != 0 || i_to != 0 )
+    {
+        page2->SetPartial( i_from, i_to );
+    }
+
     encap_page = new wizEncapPage(this );
     tr_page1 = new wizTranscodeCodecPage(this, encap_page );
     st_page1 = new wizStreamingMethodPage(this, encap_page);
@@ -1452,7 +1489,7 @@ void WizardDialog::SetStream( char *method, char *address )
     this->address = strdup( address );
 }
 
-void WizardDialog::SetTranscodeOut( char *address )
+void WizardDialog::SetTranscodeOut( const char *address )
 {
     this->address = strdup( address );
 }
@@ -1481,51 +1518,53 @@ void WizardDialog::Run()
         char *psz_opt;
         msg_Dbg( p_intf,"wizard completed");
 
-        if( i_action == ACTION_TRANSCODE)
+        if( i_action == ACTION_TRANSCODE )
         {
             msg_Dbg( p_intf,"Starting transcode of %s to file %s",
                                   mrl, address);
             msg_Dbg( p_intf,"Using %s (%i kbps) / %s (%i kbps),encap %s",
                                 vcodec,vb,acodec,ab,mux);
-            int i_tr_size = 10; /* 10 = ab + vb */
-            i_tr_size += vcodec ? strlen(vcodec) : 0;
-            i_tr_size += acodec ? strlen(acodec) : 0;
+            int i_tr_size = ; /* 10 = ab + vb */
+            i_tr_size += vcodec ? strlen(vcodec) + strlen("vcodec=") +strlen("vb="): 0;
+            i_tr_size += acodec ? strlen(acodec) + strlen("acodec=") +strlen("ab=") : 0;
 
             char *psz_transcode = (char *)malloc( i_tr_size * sizeof(char));
             if( vcodec || acodec )
             {
-                sprintf( psz_transcode, "transcode{");
+                sprintf( psz_transcode, "transcode{" );
             }
             else
             {
-                sprintf( psz_transcode, "%c", 0 );
+                snprintf( psz_transcode, 1 , "%c", 0 );
             }
             if( vcodec )
             {
-                sprintf( psz_transcode, "%svcodec=%s,vb=%i",
-                                psz_transcode, vcodec, vb );
+                i_tr_size += 5 + strlen(vcodec);
+                snprintf( psz_transcode, i_tr_size , "%svcodec=%s,vb=%i",
+                          psz_transcode, vcodec, vb );
             }
             if( acodec )
             {
+                i_tr_size += 6 + strlen(acodec);
+                /* FIXME */
                 sprintf( psz_transcode, "%s%cacodec=%s,ab=%i",
-                                psz_transcode, vcodec ? ',' : ' ',
-                                acodec, ab );
+                          psz_transcode, vcodec ? ',' : ' ', acodec, ab );
             }
             if( vcodec || acodec )
             {
-                sprintf( psz_transcode, "%s}:", psz_transcode );
+                i_tr_size +=2;
+                sprintf( psz_transcode , "%s}:", psz_transcode );
             }
             i_size = 73 + strlen(mux) + strlen(address) + strlen(psz_transcode);
             psz_opt = (char *)malloc( i_size * sizeof(char) );
-            sprintf( psz_opt, ":sout=#%sstandard{mux=%s,url=%s,"
-                               "access=file}",
-                               psz_transcode, mux, address );
+            snprintf( psz_opt, i_size, ":sout=#%sstandard{mux=%s,url=%s,"
+                      "access=file}",
+                       psz_transcode, mux, address );
         }
         else
         {
             msg_Dbg( p_intf, "Starting stream of %s to %s using %s, encap %s",
                                mrl, address, method, mux);
-
             if( b_sap )
             {
                 char *psz_sap_option = NULL;
@@ -1533,19 +1572,20 @@ void WizardDialog::Run()
                 {
                     psz_sap_option = (char *) malloc( strlen( psz_sap_name )
                                                + 15 );
-                    sprintf( psz_sap_option, "sap,name=\"%s\"",psz_sap_name );
+                    snprintf( psz_sap_option,strlen( psz_sap_name ) + 15,
+                             "sap,name=\"%s\"",psz_sap_name );
                 }
                 else
                 {
-                    psz_sap_option = (char *) malloc( 10 );
-                    sprintf( psz_sap_option, "sap" );
+                    psz_sap_option = (char *) malloc( 5 );
+                    snprintf( psz_sap_option, 5, "sap" );
                 }
                 i_size = 40 + strlen(mux) + strlen(address) +
                               strlen( psz_sap_option);
                 psz_opt = (char *)malloc( i_size * sizeof(char) );
-                sprintf( psz_opt,
-                        ":sout=#standard{mux=%s,url=%s,access=%s,%s}",
-                                  mux, address,method, psz_sap_option);
+                snprintf( psz_opt, i_size,
+                          ":sout=#standard{mux=%s,url=%s,access=%s,%s}",
+                          mux, address,method, psz_sap_option);
                 msg_Dbg( p_intf, "Sap enabled: %s", psz_sap_option);
                 if( psz_sap_option ) free( psz_sap_option );
             }
@@ -1553,8 +1593,9 @@ void WizardDialog::Run()
             {
                 i_size = 40 + strlen(mux) + strlen(address);
                 psz_opt = (char *)malloc( i_size * sizeof(char) );
-                sprintf( psz_opt, ":sout=#standard{mux=%s,url=%s,access=%s}",
-                            mux, address,method);
+                snprintf( psz_opt, i_size,
+                          ":sout=#standard{mux=%s,url=%s,access=%s}",
+                          mux, address,method);
             }
         }
 
@@ -1569,18 +1610,18 @@ void WizardDialog::Run()
             {
                 char psz_from[20];
                 msg_Dbg( p_intf, "Setting starttime");
-                sprintf( psz_from, "start-time=%i", i_from);
+                snprintf( psz_from, 20, "start-time=%i", i_from);
                 playlist_ItemAddOption( p_item, psz_from);
             }
             if( i_to != 0)
             {
                 char psz_to[20];
-                sprintf( psz_to, "stop-time=%i", i_to);
+                snprintf( psz_to, 20, "stop-time=%i", i_to);
                 playlist_ItemAddOption( p_item, psz_to);
             }
 
             char psz_ttl[20];
-            sprintf( psz_ttl, "ttl=%i",i_ttl );
+            snprintf( psz_ttl, 20, "ttl=%i",i_ttl );
             playlist_ItemAddOption( p_item, psz_ttl );
 
             playlist_AddItem( p_playlist, p_item, PLAYLIST_GO, PLAYLIST_END );