]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/dialogs/wizard.cpp
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / wxwidgets / dialogs / wizard.cpp
index 75b615e799527deb3b49b77500a2b6d34f37a659..6ee53449be73db1a640e85771353a0ad6a038dbf 100644 (file)
@@ -30,8 +30,8 @@
 
 #include <wx/listctrl.h>
 #include <wx/statline.h>
-#include <network.h>
-#include <charset.h>
+#include <vlc_network.h>
+#include <vlc_charset.h>
 
 class wizHelloPage;
 class wizInputPage;
@@ -88,74 +88,80 @@ END_EVENT_TABLE()
 #define HELLO_STREAMING _("Stream to network")
 #define HELLO_STREAMING_DESC _("Use this to stream on a network.")
 #define HELLO_TRANSCODE _("Transcode/Save to file")
-#define HELLO_TRANSCODE_DESC _("Use this to re-encode a stream and save it to a file.")
-#define HELLO_NOTICE _("This wizard only gives access to a small subset of VLC's streaming and transcoding capabilities. Use the Open and Stream Output dialogs to get all of them.")
+#define HELLO_TRANSCODE_DESC _("Use this to re-encode a stream and save it "\
+        "to a file.")
+#define HELLO_NOTICE _("This wizard only contains a small subset " \
+        "of VLC's streaming and transcoding capabilities. Use the Open "\
+        "and Stream Output dialogs to access all of them.")
 
 #define MOREINFO_STREAM _("Use this to stream on a network")
 
-#define MOREINFO_TRANSCODE _("Use this to save a stream to a file. You have the possibility to reencode the stream. You can save whatever VLC can read.\nPlease notice that VLC is not very suited " \
-             "for file to file transcoding. You should use its transcoding " \
-             "features to save network streams, for example." )
+#define MOREINFO_TRANSCODE _("Saves the stream to a file. The stream must " \
+        "be a format that VLC recognizes. If desired, the stream can also " \
+        "be transcoded to another format.\n\nPlease note that VLC is not very" \
+        " suited for file-to-file transcoding. Its transcoding " \
+        "features are more appropriate for saving network streams." )
 
 /* Input page */
-#define INPUT_TITLE _("Choose input")
-#define INPUT_TEXT _("Choose here your input stream.")
+#define INPUT_TITLE _("Input")
+#define INPUT_TEXT _("Input stream")
 
 #define INPUT_OPEN _("Select a stream" )
 #define INPUT_PL _( "Existing playlist item" )
 
 #define CHOOSE_STREAM _("You must choose a stream")
-#define NO_PLAYLIST _("Uh Oh! Unable to find playlist !")
+#define NO_PLAYLIST _("Unable to find playlist")
 
 #define PARTIAL _("Use this to read only a part of the stream. " \
-                  "You must be able to control the incoming stream " \
+                  "To use, enter the starting and ending times (in seconds)." \
+                  "\n\nNote: You must be able to control the incoming stream " \
                   "(for example, a file or a disc, but not a RTP/UDP " \
-                  "network stream.)\n" \
-                  "Enter the starting and ending times (in seconds).")
+                  "network stream).\n" \
+)
 
 #define INPUT_BUTTON _("Choose")
 
 /* Transcode 1 */
 #define TRANSCODE1_TITLE _("Transcode")
-#define TRANSCODE1_TEXT _("If you want to change the compression format of the audio or video tracks, fill in this page. (If you only want to change the container format, proceed to next page.)")
+#define TRANSCODE1_TEXT _("Changes the compression format " \
+        "of the audio or video tracks. To change only the " \
+        "container format, proceed to the next page.")
 
-#define TR_VIDEO_TEXT0 _("If your stream has video and you want to " \
-                         "transcode it, enable this.")
-#define TR_VIDEO_TEXT _("Select your video codec. Click one to get more " \
-                        "information.")
+#define TR_VIDEO_TEXT0 _("Transcode video (if available)" )
+#define TR_VIDEO_TEXT _("Select the target video codec. Choose a codec to " \
+                        "display more information about it.")
 
-#define TR_AUDIO_TEXT0 _("If your stream has audio and you want to "\
-                         "transcode it, enable this.")
-#define TR_AUDIO_TEXT _("Select your audio codec. Click one to get more " \
-                        "information.")
+#define TR_AUDIO_TEXT0 _("Transcode audio (if available)"
+#define TR_AUDIO_TEXT _("Select the target audio codec. Choose a codec to " \
+                        "display more information about it.")
 
 /* Streaming 1 */
 #define STREAMING1_TITLE _("Streaming")
-#define STREAMING1_TEXT _("In this page, you will select how your input stream will be sent.")
+#define STREAMING1_TEXT _("Determines how the input stream will be sent.")
 
 
 #define INVALID_MCAST_ADDRESS _("This does not appear to be a valid " \
                                 "multicast address" )
-#define NO_ADDRESS_TEXT _("You need to enter an address" )
+#define NO_ADDRESS_TEXT _("Please enter an address" )
 
 /* Encap  */
 #define ENCAP_TITLE _("Encapsulation format")
-#define ENCAP_TEXT _("In this page, you will select how the stream will be "\
-                     "encapsulated. Depending on the choices you made, all "\
-                     "formats won't be available." )
+#define ENCAP_TEXT _("Determines how the stream will be encapsulated. " \
+                     "Depending on the previous choices, some formats " \
+                     "might not be available." )
 
 
 /* Transcode 2 */
 #define EXTRATRANSCODE_TITLE _("Additional transcode options")
-#define EXTRATRANSCODE_TEXT _("In this page, you will define a few " \
-                              "additionnal parameters for your transcoding" )
+#define EXTRATRANSCODE_TEXT _("Defines a few additional parameters " \
+                              "for the transcoding." )
 
 #define CHOOSE_OUTFILE _("You must choose a file to save to")
 
 /* Streaming 2 */
 #define EXTRASTREAMING_TITLE _("Additional streaming options")
-#define EXTRASTREAMING_TEXT _("In this page, you will define a few " \
-                              "additionnal parameters for your stream" )
+#define EXTRASTREAMING_TEXT _("Defines a few additional parameters " \
+                              "for the stream." )
 
 #define TTL _("Define the TTL (Time-To-Live) of the stream. This parameter " \
               "is the maximum number of routers your stream can go through. " \
@@ -166,8 +172,8 @@ END_EVENT_TABLE()
               "using the SAP/SDP announcing protocol. This way, the clients " \
               "won't have to type in the multicast address, it will appear " \
               "in their playlist if they enable the SAP extra interface.\n" \
-              "If you want to give a name to your stream, enter it here, " \
-              "else, a default name will be used" )
+              "If you want to give a name to your stream, enter it here. " \
+              "Otherwise, a default name will be used." )
 
 /*****************************************************************************
  * All the pages of the wizard, declaration
@@ -202,7 +208,7 @@ class wizInputPage : public wxWizardPage
 {
     public:
         wizInputPage( wxWizard *, wxWizardPage *, intf_thread_t *);
-        wizInputPage::~wizInputPage();
+        ~wizInputPage();
         void OnWizardPageChanging(wxWizardEvent& event);
         void OnInputChange( wxCommandEvent& event );
         void OnEnablePartial(wxCommandEvent& event);
@@ -256,7 +262,7 @@ class wizTranscodeCodecPage : public wxWizardPage
 public:
     wizTranscodeCodecPage( wxWizard *parent, wxWizardPage *next);
     ~wizTranscodeCodecPage();
-    void wizTranscodeCodecPage::OnWizardPageChanging(wxWizardEvent& event);
+    void OnWizardPageChanging(wxWizardEvent& event);
     virtual wxWizardPage *GetPrev() const;
     virtual wxWizardPage *GetNext() const;
     void SetPrev( wxWizardPage *page);
@@ -333,7 +339,7 @@ class wizEncapPage : public wxWizardPage
 {
 public:
     wizEncapPage( wxWizard *parent);
-    wizEncapPage::~wizEncapPage();
+    ~wizEncapPage();
     void OnWizardPageChanging(wxWizardEvent& event);
     virtual wxWizardPage *GetPrev() const;
     virtual wxWizardPage *GetNext() const;
@@ -381,7 +387,7 @@ public:
     void OnWizardPageChanging( wxWizardEvent& event );
 protected:
     DECLARE_EVENT_TABLE()
-    void wizTranscodeExtraPage::OnSelectFile(wxCommandEvent&);
+    void OnSelectFile(wxCommandEvent&);
     wxTextCtrl *file_text;
     WizardDialog *p_parent;
     wxWizardPage *p_prev;
@@ -434,7 +440,7 @@ static void pageHeader( wxWindow *window, wxBoxSizer *sizer,
     wtitle->SetFont(font);
     sizer->Add( wtitle, 0, wxALL, 5 );
     sizer->Add( new wxStaticText( window, -1,
-                wxU( vlc_wraptext( psz_text , TEXTWIDTH, false ) ) ),
+                wxU( vlc_wraptext( psz_text , TEXTWIDTH ) ) ),
                         0, wxALL, 5 );
 }
 
@@ -484,7 +490,7 @@ wizHelloPage::wizHelloPage( wxWizard *parent) : wxWizardPageSimple(parent)
                         wxBOTTOM, 5 );
 
         mainSizer->Add( new wxStaticText(this, -1,
-                        wxU( vlc_wraptext(HELLO_NOTICE , TEXTWIDTH , false ))),
+                        wxU( vlc_wraptext(HELLO_NOTICE , TEXTWIDTH ))),
                         0, wxALL, 5 );
 
         SetSizer(mainSizer);
@@ -544,7 +550,7 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
                                wxU( INPUT_OPEN ) );
     radioSizer->Add( input_radios[0], 0, wxALL, 5 );
     input_radios[1] = new wxRadioButton( radio_panel, InputRadio1_Event ,
-                               wxU( INPUT_PL ) );  
+                               wxU( INPUT_PL ) );
     radioSizer->Add( input_radios[1], 0, wxALL, 5 );
 
     radio_panel->SetSizer( radioSizer );
@@ -576,7 +582,7 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
 
     if( p_playlist )
     {
-        if( p_playlist->i_size > 0)
+        if( !playlist_IsEmpty( p_playlist ) )
         {
             listview = new wxListView( this, ListView_Event,
                                        wxDefaultPosition, wxDefaultSize,
@@ -585,17 +591,6 @@ wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t
             listview->InsertColumn( 1, wxU(_("URI")) );
             listview->SetColumnWidth( 0, 250 );
             listview->SetColumnWidth( 1, 100 );
-            for( int i=0 ; i < p_playlist->i_size ; i++ )
-            {
-                wxString filename = wxL2U( p_playlist->pp_items[i]->input.
-                                                                    psz_name );
-                listview->InsertItem( i, filename );
-                listview->SetItem( i, 1, wxL2U( p_playlist->pp_items[i]->
-                                                            input.psz_uri) );
-                listview->SetItemData( i,
-                                  (long)p_playlist->pp_items[i]->input.i_id );
-            }
-            listview->Select( p_playlist->i_index , TRUE);
             mainSizer->Add( listview, 1, wxALL|wxEXPAND, 5 );
 
             listview->Hide();
@@ -712,7 +707,7 @@ void wizInputPage::OnWizardPageChanging(wxWizardEvent& event)
         }
         else
         {
-            p_parent->SetMrl( (const char *)mrl_text->GetValue().mb_str() );
+            p_parent->SetMrl( (const char *)mrl_text->GetValue().mb_str(wxConvUTF8) );
         }
     }
     else
@@ -721,16 +716,17 @@ void wizInputPage::OnWizardPageChanging(wxWizardEvent& event)
         i = listview->GetNextItem( i , wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
         if( i != -1 )
         {
-            long data = listview->GetItemData( i );            
+            long data = listview->GetItemData( i );
             playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
                                       VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
             if( p_playlist )
             {
-                playlist_item_t * p_item = playlist_LockItemGetById(
-                                                   p_playlist, (int)data );
+                playlist_item_t * p_item = playlist_ItemGetById(                                                   p_playlist, (int)data, VLC_FALSE );
                 if( p_item )
                 {
-                    p_parent->SetMrl( (const char*)p_item->input.psz_uri );
+                    const char *psz_uri = input_item_GetURI( p_item->p_input );
+                    p_parent->SetMrl( psz_uri );
+                    free( psz_uri );
                 }
                 else
                     event.Veto();
@@ -741,8 +737,8 @@ void wizInputPage::OnWizardPageChanging(wxWizardEvent& event)
     }
     if( enable_checkbox->IsChecked() )
     {
-        int i_from = atoi( from_text->GetValue().mb_str() );
-        int i_to = atoi( to_text->GetValue().mb_str() );
+        int i_from = atoi( from_text->GetValue().mb_str(wxConvUTF8) );
+        int i_to = atoi( to_text->GetValue().mb_str(wxConvUTF8) );
         p_parent->SetPartial( i_from, i_to );
     }
     return;
@@ -825,7 +821,7 @@ wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent,
     /* Line 2 : codec */
     video_sizer1->Add( new wxStaticText(this, -1, wxU(_("Codec"))),0,wxLEFT ,5);
     video_combo = new wxComboBox( this, VideoCodec_Event, wxT(""),
-                                  wxDefaultPosition, wxSize(200,25), 0, NULL, 
+                                  wxDefaultPosition, wxSize(200,25), 0, NULL,
                                   wxCB_DROPDOWN| wxCB_READONLY );
     for( i= 0; vcodecs_array[i].psz_display != NULL; i++ )
     {
@@ -846,7 +842,7 @@ wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent,
 
     /* Line 3 : text */
     video_text = new wxStaticText( this, -1,
-                     wxU( vlc_wraptext( TR_VIDEO_TEXT, TEXTWIDTH, false) ) );
+                     wxU( vlc_wraptext( TR_VIDEO_TEXT, TEXTWIDTH ) ) );
     /* Fill the main video sizer */
     video_sizer->Add( video_sizer1 , 0, wxEXPAND , 5 );
     video_sizer->Add( video_text, 0, wxLEFT|wxTOP , 5 );
@@ -865,7 +861,7 @@ wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent,
     /* Line 2 : codec */
     audio_sizer1->Add( new wxStaticText(this, -1, wxU(_("Codec"))),0,wxLEFT,5);
     audio_combo = new wxComboBox( this, AudioCodec_Event, wxT(""),
-                                  wxDefaultPosition, wxSize(200,25), 0, NULL, 
+                                  wxDefaultPosition, wxSize(200,25), 0, NULL,
                                   wxCB_DROPDOWN| wxCB_READONLY );
     for( i= 0; acodecs_array[i].psz_display != NULL; i++ )
     {
@@ -885,7 +881,7 @@ wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent,
 
     /* Line 3 : text */
     audio_text = new wxStaticText( this, -1,
-                     wxU( vlc_wraptext( TR_AUDIO_TEXT, TEXTWIDTH, false) ) );
+                     wxU( vlc_wraptext( TR_AUDIO_TEXT, TEXTWIDTH ) ) );
 
     audio_sizer->Add(audio_sizer1, 0, wxEXPAND, 5);
     audio_sizer->Add( audio_text, 0, wxLEFT | wxTOP, 5 );
@@ -925,7 +921,7 @@ void wizTranscodeCodecPage::OnVideoCodecChange(wxCommandEvent& event)
 {
     struct codec *c = (struct codec*)
              (video_combo->GetClientData(video_combo->GetSelection()));
-    video_text->SetLabel( wxU( vlc_wraptext(c->psz_descr, TEXTWIDTH, false) ) );
+    video_text->SetLabel( wxU( vlc_wraptext(c->psz_descr, TEXTWIDTH ) ) );
     i_video_codec = video_combo->GetSelection();
     vcodec = strdup(c->psz_codec);
 }
@@ -934,7 +930,7 @@ void wizTranscodeCodecPage::OnAudioCodecChange(wxCommandEvent& event)
 {
     struct codec *c = (struct codec*)
              (audio_combo->GetClientData(audio_combo->GetSelection()));
-    audio_text->SetLabel( wxU( vlc_wraptext(c->psz_descr, TEXTWIDTH, false) ) );
+    audio_text->SetLabel( wxU( vlc_wraptext(c->psz_descr, TEXTWIDTH ) ) );
     i_audio_codec = audio_combo->GetSelection();
     acodec = strdup(c->psz_codec);
 
@@ -986,12 +982,12 @@ void wizTranscodeCodecPage::OnWizardPageChanging(wxWizardEvent& event)
                                        audio_combo->GetSelection() : i_audio_codec ));
     acodec = strdup(c->psz_codec);
 
-    int vb = atoi(vb_combo->GetValue().mb_str() );
+    int vb = atoi(vb_combo->GetValue().mb_str(wxConvUTF8) );
     if( vb == 0 )
     {
          vb = 1024;
     }
-    int ab = atoi(ab_combo->GetValue().mb_str() );
+    int ab = atoi(ab_combo->GetValue().mb_str(wxConvUTF8) );
     if( ab == 0)
     {
         ab = 192;
@@ -1050,8 +1046,7 @@ wizStreamingMethodPage::wizStreamingMethodPage( intf_thread_t *p_this, wxWizard
 
     /* Big kludge, we take the longest text to get the size */
     address_text = new wxStaticText(this, -1,
-               wxU( vlc_wraptext(methods_array[2].psz_address,
-                                 TEXTWIDTH, false ) ),
+               wxU( vlc_wraptext(methods_array[2].psz_address, TEXTWIDTH ) ),
                wxDefaultPosition, wxDefaultSize );
 
     address_txtctrl = new wxTextCtrl( this, -1, wxU(""), wxDefaultPosition,
@@ -1063,7 +1058,7 @@ wizStreamingMethodPage::wizStreamingMethodPage( intf_thread_t *p_this, wxWizard
     /* Set the minimum size */
     address_sizer->SetMinSize( address_sizer->GetSize() );
     address_text->SetLabel( wxU(
-     vlc_wraptext( _(methods_array[0].psz_address), TEXTWIDTH, false)));
+     vlc_wraptext( _(methods_array[0].psz_address), TEXTWIDTH )));
 
     mainSizer->Add( method_sizer, 0, wxALL | wxEXPAND, 5 );
     mainSizer->Add( address_sizer, 0, wxALL | wxEXPAND, 5 );
@@ -1086,7 +1081,7 @@ void wizStreamingMethodPage::OnWizardPageChanging(wxWizardEvent& event)
     /* Check valid address */
     if( i_method == 1
      && !net_AddressIsMulticast( (vlc_object_t *)p_intf,
-                                 address_txtctrl->GetValue().mb_str()) )
+                                 address_txtctrl->GetValue().mb_str(wxConvUTF8)) )
     {
         wxMessageBox( wxU( INVALID_MCAST_ADDRESS ) , wxU( ERROR_MSG ),
                       wxICON_WARNING | wxOK, this->p_parent );
@@ -1111,7 +1106,7 @@ void wizStreamingMethodPage::OnWizardPageChanging(wxWizardEvent& event)
         }
     }
     p_parent->SetStream( methods_array[i_method].psz_access ,
-                         address_txtctrl->GetValue().mb_str() );
+                         address_txtctrl->GetValue().mb_str(wxConvUTF8) );
 
     /* Set the action for the muxer page */
     ((wizEncapPage*)GetNext())->SetAction( p_parent->GetAction() );
@@ -1128,7 +1123,7 @@ void wizStreamingMethodPage::OnMethodChange( wxCommandEvent& event )
 {
     i_method = event.GetId() - MethodRadio0_Event;
     address_text->SetLabel( wxU(
-     vlc_wraptext( _(methods_array[i_method].psz_address), TEXTWIDTH, false)));
+     vlc_wraptext( _(methods_array[i_method].psz_address), TEXTWIDTH )));
     address_sizer->Layout();
     mainSizer->Layout();
 }
@@ -1286,7 +1281,7 @@ void wizTranscodeExtraPage::OnSelectFile( wxCommandEvent &event)
 
     if( file_dialog && file_dialog->ShowModal() == wxID_OK )
     {
-        if( file_dialog->GetFilename().mb_str() )
+        if( file_dialog->GetFilename().mb_str(wxConvUTF8) )
         {
             file_text->SetValue( file_dialog->GetPath() );
         }
@@ -1303,7 +1298,7 @@ void wizTranscodeExtraPage::OnWizardPageChanging( wxWizardEvent& event )
     }
     if( event.GetDirection() )
     {
-       p_parent->SetTranscodeOut( file_text->GetValue().mb_str());
+       p_parent->SetTranscodeOut( file_text->GetValue() );
     }
 }
 
@@ -1370,7 +1365,7 @@ void wizStreamingExtraPage::OnWizardPageChanging(wxWizardEvent& event)
         else
         {
             p_parent->SetSAP( true,
-                             (const char *)sap_text->GetValue().mb_str() );
+                             (const char *)sap_text->GetValue().mb_str(wxConvUTF8) );
         }
     }
     else
@@ -1516,11 +1511,11 @@ void WizardDialog::SetStream( char const *method, char const *address )
     this->address = strdup( address );
 }
 
-void WizardDialog::SetTranscodeOut( char const *address )
+void WizardDialog::SetTranscodeOut( wxString address )
 {
-    char *psz_utf8 = FromLocale( address );
+    char *psz_utf8 = wxFromLocale( address );
     this->address = strdup( psz_utf8 );
-    LocaleFree( psz_utf8 );
+    wxLocaleFree( psz_utf8 );
 }
 
 void WizardDialog::SetMux( char const *mux )
@@ -1546,9 +1541,9 @@ void WizardDialog::Run()
 
         if( i_action == ACTION_TRANSCODE )
         {
-            msg_Dbg( p_intf,"Starting transcode of %s to file %s",
+            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",
+            msg_Dbg( p_intf,"using %s (%i kbps) / %s (%i kbps),encap %s",
                                 vcodec,vb,acodec,ab,mux);
             char *psz_transcode;
 
@@ -1599,7 +1594,7 @@ void WizardDialog::Run()
             char *psz_sap_option = NULL;
             bool v6;
 
-            msg_Dbg( p_intf, "Starting stream of %s to %s using %s, encap %s",
+            msg_Dbg( p_intf, "starting stream of %s to %s using %s, encap %s",
                                mrl, address, method, mux );
             if( b_sap )
             {
@@ -1616,8 +1611,8 @@ void WizardDialog::Run()
             /* Add brackets automatically for IPv6 if they are missing */
             v6 = ( address[0] != '[' ) && ( strchr( address, ':' ) != NULL );
             asprintf( &psz_opt,
-                      ":sout=#standard{mux=%s,dst=%s%s%s,access=%s%s}",
-                      mux, v6 ? "[" : "", address, v6 ? "]" : "", method,
+                      ":sout=#%smux=%s,dst=%s%s%s%s}", method,
+                      mux, v6 ? "[" : "", address, v6 ? "]" : "",
                       psz_sap_option ?: "" );
             if( psz_sap_option ) free( psz_sap_option );
         }
@@ -1626,27 +1621,28 @@ void WizardDialog::Run()
                             VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
         if( p_playlist )
         {
-            playlist_item_t *p_item = playlist_ItemNew( p_playlist, mrl,
-                                                        ITEM_NAME );
-            playlist_ItemAddOption( p_item, psz_opt);
+            input_item_t *p_input = input_ItemNew( p_playlist, mrl,
+                                                   ITEM_NAME );
+            input_ItemAddOption( p_input, psz_opt );
             if( i_from != 0)
             {
                 char psz_from[20];
                 snprintf( psz_from, 20, "start-time=%i", i_from);
-                playlist_ItemAddOption( p_item, psz_from);
+                input_ItemAddOption( p_input, psz_from );
             }
             if( i_to != 0)
             {
                 char psz_to[20];
                 snprintf( psz_to, 20, "stop-time=%i", i_to);
-                playlist_ItemAddOption( p_item, psz_to);
+                input_ItemAddOption( p_input, psz_to );
             }
 
             char psz_ttl[20];
             snprintf( psz_ttl, 20, "ttl=%i",i_ttl );
-            playlist_ItemAddOption( p_item, psz_ttl );
+            input_ItemAddOption( p_input, psz_ttl );
 
-            playlist_AddItem( p_playlist, p_item, PLAYLIST_GO, PLAYLIST_END );
+            playlist_AddInput( p_playlist, p_input,
+                               PLAYLIST_GO, PLAYLIST_END, VLC_TRUE, VLC_FALSE );
             vlc_object_release(p_playlist);
         }
         else