1 /*****************************************************************************
\r
2 * wizard.cpp : wxWindows plugin for vlc
\r
3 *****************************************************************************
\r
4 * Copyright (C) 2000-2004 VideoLAN
\r
7 * Authors: Clément Stenac <zorglub@videolan.org>
\r
9 * This program is free software; you can redistribute it and/or modify
\r
10 * it under the terms of the GNU General Public License as published by
\r
11 * the Free Software Foundation; either version 2 of the License, or
\r
12 * (at your option) any later version.
\r
14 * This program is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU General Public License for more details.
\r
19 * You should have received a copy of the GNU General Public License
\r
20 * along with this program; if not, write to the Free Software
\r
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
\r
22 *****************************************************************************/
\r
24 /*****************************************************************************
\r
26 *****************************************************************************/
\r
27 #include <stdlib.h> /* malloc(), free() */
\r
28 #include <errno.h> /* ENOMEM */
\r
29 #include <string.h> /* strerror() */
\r
32 #include <vlc/vlc.h>
\r
33 #include <vlc/intf.h>
\r
35 #include "wxwindows.h"
\r
37 #include "streamdata.h"
\r
39 #include <wx/statline.h>
\r
44 /*****************************************************************************
\r
46 *****************************************************************************/
\r
49 ActionRadio0_Event, ActionRadio1_Event,
\r
50 MoreInfoStreaming_Event,
\r
51 MoreInfoTranscode_Event,
\r
53 Open_Event , Choose_Event ,
\r
55 InputRadio0_Event, InputRadio1_Event,
\r
56 PartialEnable_Event,
\r
58 MethodRadio0_Event, MethodRadio1_Event,
\r
59 MethodRadio2_Event, MethodRadio3_Event,
\r
61 EncapRadio0_Event, EncapRadio1_Event,
\r
62 EncapRadio2_Event, EncapRadio3_Event,
\r
63 EncapRadio4_Event, EncapRadio5_Event,
\r
64 EncapRadio6_Event, EncapRadio7_Event,
\r
65 EncapRadio8_Event, EncapRadio9_Event,
\r
66 EncapRadio10_Event, EncapRadio11_Event,
\r
68 VideoEnable_Event, VideoCodec_Event,VideoBitrate_Event,
\r
69 AudioEnable_Event, AudioCodec_Event,AudioBitrate_Event,
\r
75 #define TEXTWIDTH 55
\r
76 #define ACTION_STREAM 0
\r
77 #define ACTION_TRANSCODE 1
\r
79 BEGIN_EVENT_TABLE(WizardDialog, wxWizard)
\r
82 /*****************************************************************************
\r
84 *****************************************************************************/
\r
86 #define ERROR_MSG _("Error")
\r
87 #define ITEM_NAME _("Streaming/Transcoding Wizard")
\r
90 #define HELLO_TITLE _("Streaming/Transcoding Wizard")
\r
91 #define HELLO_TEXT _("This wizard helps you to stream, transcode or" \
\r
93 #define HELLO_STREAMING _("Stream to network")
\r
94 #define HELLO_STREAMING_DESC _("Use this to stream on a network")
\r
95 #define HELLO_TRANSCODE _("Transcode/Save to file")
\r
96 #define HELLO_TRANSCODE_DESC _("Use this to re-encode a stream and save it to a file")
\r
97 #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")
\r
99 #define MOREINFO_STREAM _("Use this to stream on a network")
\r
101 #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 " \
\r
102 "for file to file transcoding. You should use its transcoding " \
\r
103 "features to save network streams, for example" )
\r
106 #define INPUT_TITLE _("Choose input")
\r
107 #define INPUT_TEXT _("Choose here your input stream")
\r
109 #define INPUT_OPEN _("Select a stream" )
\r
110 #define INPUT_PL _( "Existing playlist item" )
\r
112 #define CHOOSE_STREAM _("You must choose a stream")
\r
113 #define NO_PLAYLIST _("Uh Oh! Unable to find playlist !")
\r
115 #define PARTIAL _("Use this to read only a part of the stream. " \
\r
116 "You must be able to control the incoming stream " \
\r
117 "(for example, a file or a disc, but not an UDP " \
\r
118 "network stream.)\n" \
\r
119 "Enter the starting and ending times (in seconds)")
\r
121 #define INPUT_BUTTON _("Choose")
\r
124 #define TRANSCODE1_TITLE _("Transcode")
\r
125 #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).")
\r
127 #define TR_VIDEO_TEXT0 _("If your stream has video and you want to " \
\r
128 "transcode it, enable this")
\r
129 #define TR_VIDEO_TEXT _("Select your video codec. Click one to get more " \
\r
132 #define TR_AUDIO_TEXT0 _("If your stream has audio and you want to "\
\r
133 "transcode it, enable this")
\r
134 #define TR_AUDIO_TEXT _("Select your audio codec. Click one to get more " \
\r
138 #define STREAMING1_TITLE _("Streaming")
\r
139 #define STREAMING1_TEXT _("In this page, you will select how your input stream will be sent.")
\r
142 #define INVALID_MCAST_ADDRESS _("This does not appear to be a valid " \
\r
143 "multicast address" )
\r
144 #define NO_ADDRESS _("You need to enter an address" )
\r
147 #define ENCAP_TITLE _("Encapsulation format")
\r
148 #define ENCAP_TEXT _("In this page, you will select how the stream will be "\
\r
149 "encapsulated. Depending on the choices you made, all "\
\r
150 "formats won't be available." )
\r
154 #define EXTRATRANSCODE_TITLE _("Additional transcode options")
\r
155 #define EXTRATRANSCODE_TEXT _("In this page, you will define a few " \
\r
156 "additionnal parameters for your transcoding" )
\r
158 #define CHOOSE_OUTFILE _("You must choose a file to save to")
\r
161 #define EXTRASTREAMING_TITLE _("Additional streaming options")
\r
162 #define EXTRASTREAMING_TEXT _("In this page, you will define a few " \
\r
163 "additionnal parameters for your stream" )
\r
165 #define TTL _("Define the TTL (Time-To-Live) of the stream. This parameter " \
\r
166 "is the maximum number of routers your stream can go through. " \
\r
167 "If you don't know what it means, or if you want to stream on " \
\r
168 "your local network only, leave this setting to 1." )
\r
170 #define SAP _("When streaming using UDP, you can announce your streams " \
\r
171 "using the SAP/SDP announcing protocol. This way, the clients " \
\r
172 "won't have to type in the multicast address, it will appear " \
\r
173 "in their playlist if they enable the SAP extra interface.\n" \
\r
174 "If you want to give a name to your stream, enter it here, " \
\r
175 "else, a default name will be used" )
\r
177 /*****************************************************************************
\r
178 * All the pages of the wizard, declaration
\r
179 *****************************************************************************/
\r
181 /* Declare classes */
\r
182 class wizHelloPage : public wxWizardPageSimple
\r
185 wizHelloPage( wxWizard *parent);
\r
186 void OnActionChange(wxEvent& event);
\r
187 void OnWizardPageChanging(wxWizardEvent& event);
\r
188 void OnMoreInfo( wxCommandEvent& event );
\r
191 WizardDialog *p_parent;
\r
192 wxRadioButton *action_radios[2];
\r
193 DECLARE_EVENT_TABLE()
\r
196 BEGIN_EVENT_TABLE(wizHelloPage, wxWizardPageSimple)
\r
197 EVT_RADIOBUTTON( ActionRadio0_Event, wizHelloPage::OnActionChange)
\r
198 EVT_RADIOBUTTON( ActionRadio1_Event, wizHelloPage::OnActionChange)
\r
199 EVT_BUTTON( MoreInfoStreaming_Event, wizHelloPage::OnMoreInfo )
\r
200 EVT_BUTTON( MoreInfoTranscode_Event, wizHelloPage::OnMoreInfo )
\r
202 EVT_WIZARD_PAGE_CHANGING(-1, wizHelloPage::OnWizardPageChanging)
\r
206 class wizInputPage : public wxWizardPage
\r
209 wizInputPage( wxWizard *, wxWizardPage *, intf_thread_t *);
\r
210 wizInputPage::~wizInputPage();
\r
211 void OnWizardPageChanging(wxWizardEvent& event);
\r
212 void OnInputChange(wxEvent& event);
\r
213 void OnEnablePartial(wxCommandEvent& event);
\r
214 virtual wxWizardPage *GetPrev() const;
\r
215 virtual wxWizardPage *GetNext() const;
\r
216 void SetStreamingPage( wxWizardPage *page);
\r
217 void SetTranscodePage( wxWizardPage *page);
\r
218 void SetAction( int i_action );
\r
219 void SetPintf( intf_thread_t *p_intf );
\r
220 void SetUri( char *psz_uri );
\r
221 void SetPartial( int i_from, int i_to );
\r
225 intf_thread_t *p_intf;
\r
229 void OnChoose( wxCommandEvent& event );
\r
231 WizardDialog *p_parent;
\r
232 wxRadioButton *input_radios[2];
\r
233 wxCheckBox *enable_checkbox;
\r
234 wxBoxSizer *mainSizer;
\r
236 wxTextCtrl *mrl_text;
\r
237 wxTextCtrl *from_text;
\r
238 wxTextCtrl *to_text;
\r
239 OpenDialog *p_open_dialog;
\r
240 wxListView *listview;
\r
241 wxPanel *open_panel;
\r
242 wxWizardPage *p_prev;
\r
243 wxWizardPage *p_streaming_page;
\r
244 wxWizardPage *p_transcode_page;
\r
246 DECLARE_EVENT_TABLE()
\r
249 BEGIN_EVENT_TABLE(wizInputPage, wxWizardPage)
\r
250 EVT_RADIOBUTTON( InputRadio0_Event, wizInputPage::OnInputChange)
\r
251 EVT_RADIOBUTTON( InputRadio1_Event, wizInputPage::OnInputChange)
\r
252 EVT_BUTTON( Choose_Event, wizInputPage::OnChoose)
\r
253 EVT_CHECKBOX( PartialEnable_Event, wizInputPage::OnEnablePartial)
\r
254 EVT_WIZARD_PAGE_CHANGING(-1, wizInputPage::OnWizardPageChanging)
\r
258 class wizTranscodeCodecPage : public wxWizardPage
\r
261 wizTranscodeCodecPage( wxWizard *parent, wxWizardPage *next);
\r
262 ~wizTranscodeCodecPage();
\r
263 void wizTranscodeCodecPage::OnWizardPageChanging(wxWizardEvent& event);
\r
264 virtual wxWizardPage *GetPrev() const;
\r
265 virtual wxWizardPage *GetNext() const;
\r
266 void SetPrev( wxWizardPage *page);
\r
268 wxCheckBox *video_checkbox;
\r
269 wxComboBox *video_combo;
\r
270 wxComboBox *vb_combo;
\r
271 wxStaticText * video_text;
\r
272 wxCheckBox *audio_checkbox;
\r
273 wxComboBox *audio_combo;
\r
274 wxComboBox *ab_combo;
\r
275 wxStaticText * audio_text;
\r
277 WizardDialog *p_parent;
\r
284 wxWizardPage *p_prev;
\r
285 wxWizardPage *p_next;
\r
287 void OnVideoCodecChange(wxCommandEvent& event);
\r
288 void OnAudioCodecChange(wxCommandEvent& event);
\r
289 void OnEnableVideo(wxCommandEvent& event);
\r
290 void OnEnableAudio(wxCommandEvent& event);
\r
292 DECLARE_EVENT_TABLE()
\r
295 BEGIN_EVENT_TABLE(wizTranscodeCodecPage, wxWizardPage)
\r
296 EVT_CHECKBOX( VideoEnable_Event, wizTranscodeCodecPage::OnEnableVideo)
\r
297 EVT_CHECKBOX( AudioEnable_Event, wizTranscodeCodecPage::OnEnableAudio)
\r
298 EVT_COMBOBOX( VideoCodec_Event, wizTranscodeCodecPage::OnVideoCodecChange)
\r
299 EVT_COMBOBOX( AudioCodec_Event, wizTranscodeCodecPage::OnAudioCodecChange)
\r
300 EVT_WIZARD_PAGE_CHANGING(-1, wizTranscodeCodecPage::OnWizardPageChanging)
\r
303 class wizStreamingMethodPage : public wxWizardPage
\r
306 wizStreamingMethodPage( wxWizard *parent, wxWizardPage *next);
\r
307 void OnWizardPageChanging(wxWizardEvent& event);
\r
308 virtual wxWizardPage *GetPrev() const;
\r
309 virtual wxWizardPage *GetNext() const;
\r
310 void SetPrev( wxWizardPage *page);
\r
312 DECLARE_EVENT_TABLE()
\r
314 wxBoxSizer *mainSizer;
\r
315 wxStaticBoxSizer *address_sizer;
\r
316 wxStaticText *address_text;
\r
317 wxTextCtrl *address_txtctrl;
\r
318 WizardDialog * p_parent;
\r
319 void OnMethodChange(wxEvent& event);
\r
320 wxRadioButton *method_radios[4];
\r
321 wxWizardPage *p_prev;
\r
322 wxWizardPage *p_next;
\r
325 BEGIN_EVENT_TABLE(wizStreamingMethodPage, wxWizardPage)
\r
326 EVT_RADIOBUTTON( MethodRadio0_Event, wizStreamingMethodPage::OnMethodChange)
\r
327 EVT_RADIOBUTTON( MethodRadio1_Event, wizStreamingMethodPage::OnMethodChange)
\r
328 EVT_RADIOBUTTON( MethodRadio2_Event, wizStreamingMethodPage::OnMethodChange)
\r
329 EVT_RADIOBUTTON( MethodRadio3_Event, wizStreamingMethodPage::OnMethodChange)
\r
330 EVT_WIZARD_PAGE_CHANGING(-1, wizStreamingMethodPage::OnWizardPageChanging)
\r
334 class wizEncapPage : public wxWizardPage
\r
337 wizEncapPage( wxWizard *parent);
\r
338 wizEncapPage::~wizEncapPage();
\r
339 void OnWizardPageChanging(wxWizardEvent& event);
\r
340 virtual wxWizardPage *GetPrev() const;
\r
341 virtual wxWizardPage *GetNext() const;
\r
342 void SetStreamingPage( wxWizardPage *page);
\r
343 void SetTranscodePage( wxWizardPage *page);
\r
344 void SetPrev( wxWizardPage *page);
\r
345 void SetAction( int );
\r
346 void EnableEncap( int encap );
\r
348 DECLARE_EVENT_TABLE()
\r
352 void OnEncapChange(wxEvent& event);
\r
353 wxRadioButton *encap_radios[MUXERS_NUMBER];
\r
354 WizardDialog *p_parent;
\r
355 wxWizardPage *p_prev;
\r
356 wxWizardPage *p_streaming_page;
\r
357 wxWizardPage *p_transcode_page;
\r
360 BEGIN_EVENT_TABLE(wizEncapPage, wxWizardPage)
\r
361 EVT_WIZARD_PAGE_CHANGING(-1, wizEncapPage::OnWizardPageChanging)
\r
362 EVT_RADIOBUTTON( EncapRadio0_Event, wizEncapPage::OnEncapChange)
\r
363 EVT_RADIOBUTTON( EncapRadio1_Event, wizEncapPage::OnEncapChange)
\r
364 EVT_RADIOBUTTON( EncapRadio2_Event, wizEncapPage::OnEncapChange)
\r
365 EVT_RADIOBUTTON( EncapRadio3_Event, wizEncapPage::OnEncapChange)
\r
366 EVT_RADIOBUTTON( EncapRadio4_Event, wizEncapPage::OnEncapChange)
\r
367 EVT_RADIOBUTTON( EncapRadio5_Event, wizEncapPage::OnEncapChange)
\r
368 EVT_RADIOBUTTON( EncapRadio6_Event, wizEncapPage::OnEncapChange)
\r
369 EVT_RADIOBUTTON( EncapRadio7_Event, wizEncapPage::OnEncapChange)
\r
370 EVT_RADIOBUTTON( EncapRadio8_Event, wizEncapPage::OnEncapChange)
\r
371 EVT_RADIOBUTTON( EncapRadio9_Event, wizEncapPage::OnEncapChange)
\r
372 EVT_RADIOBUTTON( EncapRadio10_Event, wizEncapPage::OnEncapChange)
\r
375 /* Additional settings for transcode */
\r
376 class wizTranscodeExtraPage : public wxWizardPage
\r
379 wizTranscodeExtraPage( wxWizard *parent, wxWizardPage *prev,
\r
380 wxWizardPage *next);
\r
381 virtual wxWizardPage *GetPrev() const;
\r
382 virtual wxWizardPage *GetNext() const;
\r
383 void OnWizardPageChanging( wxWizardEvent& event );
\r
385 DECLARE_EVENT_TABLE()
\r
386 void wizTranscodeExtraPage::OnSelectFile(wxCommandEvent&);
\r
387 wxTextCtrl *file_text;
\r
388 WizardDialog *p_parent;
\r
389 wxWizardPage *p_prev;
\r
390 wxWizardPage *p_next;
\r
393 BEGIN_EVENT_TABLE(wizTranscodeExtraPage, wxWizardPage)
\r
394 EVT_BUTTON( Open_Event, wizTranscodeExtraPage::OnSelectFile)
\r
395 EVT_WIZARD_PAGE_CHANGING(-1, wizTranscodeExtraPage::OnWizardPageChanging)
\r
398 /* Additional settings for streaming */
\r
399 class wizStreamingExtraPage : public wxWizardPage
\r
402 wizStreamingExtraPage( wxWizard *parent, wxWizardPage *prev,
\r
403 wxWizardPage *next);
\r
404 virtual wxWizardPage *GetPrev() const;
\r
405 virtual wxWizardPage *GetNext() const;
\r
406 void OnWizardPageChanging(wxWizardEvent&);
\r
407 void OnSAP( wxCommandEvent&);
\r
408 wxCheckBox *sap_checkbox;
\r
409 wxTextCtrl *sap_text;
\r
411 friend class wizEncapPage;
\r
412 DECLARE_EVENT_TABLE()
\r
413 WizardDialog *p_parent;
\r
414 wxWizardPage *p_prev;
\r
415 wxWizardPage *p_next;
\r
417 wxSpinCtrl *ttl_spin;
\r
420 BEGIN_EVENT_TABLE(wizStreamingExtraPage, wxWizardPage)
\r
421 EVT_CHECKBOX( SAP_Event, wizStreamingExtraPage::OnSAP )
\r
422 EVT_WIZARD_PAGE_CHANGING(-1, wizStreamingExtraPage::OnWizardPageChanging)
\r
426 /* Local functions */
\r
427 static int ismult( const char *psz_uri );
\r
429 static void pageHeader( wxWindow *window, wxBoxSizer *sizer,
\r
430 char *psz_title, char *psz_text);
\r
432 static void pageHeader( wxWindow *window, wxBoxSizer *sizer,
\r
433 char *psz_title, char *psz_text)
\r
435 wxStaticText *wtitle = new wxStaticText( window, -1, wxU( psz_title ) );
\r
436 wxFont font = wtitle->GetFont();
\r
437 font.SetPointSize(14);
\r
438 wtitle->SetFont(font);
\r
439 sizer->Add( wtitle, 0, wxALL, 5 );
\r
440 sizer->Add( new wxStaticText( window, -1,
\r
441 wxU( vlc_wraptext( psz_text , TEXTWIDTH, false ) ) ),
\r
445 /***************************************************************************
\r
446 * Implementation of the pages
\r
447 ***************************************************************************/
\r
450 /***************************************************
\r
451 * First page: choose between stream and transcode *
\r
452 ***************************************************/
\r
453 wizHelloPage::wizHelloPage( wxWizard *parent) : wxWizardPageSimple(parent)
\r
456 p_parent = (WizardDialog *)parent;
\r
457 wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
\r
459 /* Create the texts */
\r
460 pageHeader( this, mainSizer, HELLO_TITLE, HELLO_TEXT );
\r
462 /* Create the radio buttons with their helps */
\r
463 action_radios[0] = new wxRadioButton( this, ActionRadio0_Event,
\r
464 wxU( HELLO_STREAMING ) );
\r
465 action_radios[1] = new wxRadioButton( this, ActionRadio1_Event,
\r
466 wxU( HELLO_TRANSCODE ) );
\r
469 mainSizer->Add( 0, 0, 1 );
\r
471 wxBoxSizer *stream_sizer = new wxBoxSizer( wxHORIZONTAL );
\r
472 stream_sizer->Add( action_radios[0], 0, wxALL, 5 );
\r
473 stream_sizer->Add( 0,0,1 );
\r
474 stream_sizer->Add( new wxButton( this, MoreInfoStreaming_Event,
\r
475 wxU( _("More Info")) ), 0, 0, 0 );
\r
476 mainSizer->Add( stream_sizer, 0, wxALL | wxEXPAND , 5 );
\r
478 wxBoxSizer *transcode_sizer = new wxBoxSizer( wxHORIZONTAL );
\r
479 transcode_sizer->Add( action_radios[1], 0, wxALL, 5 );
\r
480 transcode_sizer->Add( 0,0,1);
\r
481 transcode_sizer->Add( new wxButton( this, MoreInfoTranscode_Event,
\r
482 wxU( _("More Info")) ), 0 , 0 , 0 );
\r
483 mainSizer->Add( transcode_sizer, 0, wxALL | wxEXPAND, 5 );
\r
485 mainSizer->Add( 0, 0, 1 );
\r
487 mainSizer->Add( new wxStaticLine(this, -1 ), 0, wxEXPAND| wxTOP|
\r
490 mainSizer->Add( new wxStaticText(this, -1,
\r
491 wxU( vlc_wraptext(HELLO_NOTICE , TEXTWIDTH , false ))),
\r
494 SetSizer(mainSizer);
\r
495 mainSizer->Fit(this);
\r
498 void wizHelloPage::OnMoreInfo(wxCommandEvent& event)
\r
501 msg.Printf( wxString( wxU( event.GetId() == MoreInfoStreaming_Event ?
\r
503 MOREINFO_TRANSCODE ) ) );
\r
504 wxMessageBox( msg, wxU(_("More information")),
\r
505 wxOK | wxICON_INFORMATION, this->p_parent );
\r
508 void wizHelloPage::OnActionChange(wxEvent& event)
\r
510 i_action = event.GetId() - ActionRadio0_Event;
\r
511 ((wizInputPage *)GetNext())->SetAction( i_action );
\r
512 p_parent->SetAction( i_action );
\r
515 void wizHelloPage::OnWizardPageChanging(wxWizardEvent& event)
\r
517 ((wizInputPage *)GetNext())->SetAction( i_action );
\r
518 p_parent->SetAction( i_action );
\r
521 /************************************
\r
522 * Second page: choose input stream *
\r
523 ************************************/
\r
524 wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t *_p_intf) :
\r
525 wxWizardPage(parent)
\r
529 p_parent = (WizardDialog *)parent;
\r
531 p_open_dialog = NULL;
\r
533 mainSizer = new wxBoxSizer(wxVERTICAL);
\r
535 /* Create the texts */
\r
536 pageHeader( this, mainSizer, INPUT_TITLE, INPUT_TEXT );
\r
538 mainSizer->Add( 0,20,0 );
\r
540 /* Create the radio buttons */
\r
541 input_radios[0] = new wxRadioButton( this, InputRadio0_Event ,
\r
542 wxU( INPUT_OPEN ) );
\r
543 mainSizer->Add( input_radios[0], 0, wxALL, 5 );
\r
544 input_radios[1] = new wxRadioButton( this, InputRadio1_Event ,
\r
547 mainSizer->Add( input_radios[1], 0, wxALL, 5 );
\r
550 open_panel = new wxPanel(this, -1);
\r
551 open_panel->SetAutoLayout( TRUE );
\r
552 wxBoxSizer *openSizer = new wxBoxSizer(wxHORIZONTAL);
\r
554 mrl_text = new wxTextCtrl( open_panel, -1, wxU( "" ), wxDefaultPosition,
\r
556 openSizer->Add( mrl_text, 0 , wxALL, 5 );
\r
557 openSizer->Add( new wxButton( open_panel, Choose_Event, wxU(_("Choose...")) ), 0, wxALL, 5 );
\r
558 open_panel->SetSizer( openSizer );
\r
559 openSizer->Layout();
\r
560 openSizer->Fit(open_panel);
\r
562 mainSizer->Add( open_panel );
\r
565 playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
\r
566 VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
\r
570 if( p_playlist->i_size > 0)
\r
572 listview = new wxListView( this, ListView_Event,
\r
573 wxDefaultPosition, wxDefaultSize,
\r
574 wxLC_REPORT | wxSUNKEN_BORDER );
\r
575 listview->InsertColumn( 0, wxU(_("Name")) );
\r
576 listview->InsertColumn( 1, wxU(_("URI")) );
\r
577 listview->SetColumnWidth( 0, 250 );
\r
578 listview->SetColumnWidth( 1, 100 );
\r
579 for( int i=0 ; i < p_playlist->i_size ; i++ )
\r
581 wxString filename = wxL2U( p_playlist->pp_items[i]->input.
\r
583 listview->InsertItem( i, filename );
\r
584 listview->SetItem( i, 1, wxL2U( p_playlist->pp_items[i]->
\r
587 listview->Select( p_playlist->i_index , TRUE);
\r
588 mainSizer->Add( listview, 1, wxALL|wxEXPAND, 5 );
\r
591 mainSizer->Hide( listview );
\r
592 mainSizer->Layout();
\r
596 input_radios[1]->Disable();
\r
598 vlc_object_release( p_playlist );
\r
602 input_radios[1]->Disable();
\r
605 /* Partial Extract Box */
\r
606 mainSizer->Add( 0, 10, 0 );
\r
607 wxStaticBox *partial_box = new wxStaticBox( this, -1,
\r
608 wxU(_("Partial Extract")) );
\r
610 wxStaticBoxSizer *partial_sizer = new wxStaticBoxSizer( partial_box,
\r
613 enable_checkbox = new wxCheckBox( this, PartialEnable_Event,
\r
614 wxU(_("Enable") ) );
\r
615 enable_checkbox->SetToolTip(wxU(_(PARTIAL) ) ) ;
\r
616 partial_sizer->Add( enable_checkbox, 0 , wxALIGN_CENTER_VERTICAL|wxALL, 5 ); //wxLEFT
\r
618 wxFlexGridSizer *partial_sizer2 = new wxFlexGridSizer( 4 , 1 , 20 );
\r
619 partial_sizer2->Add( new wxStaticText(this, -1, wxU(_( "From" ) ) ),
\r
621 from_text = new wxTextCtrl( this, -1, wxT(""),
\r
622 wxDefaultPosition, wxSize( 80,25 ) );
\r
623 partial_sizer2->Add( from_text, 0 , wxALIGN_RIGHT);
\r
624 partial_sizer2->Add( new wxStaticText(this, -1, wxU(_( "To" ) ) ),
\r
626 to_text = new wxTextCtrl( this, -1, wxT(""),
\r
627 wxDefaultPosition, wxSize( 80 , 25 ) );
\r
628 partial_sizer2->Add( to_text, 0 , wxALIGN_RIGHT );
\r
630 partial_sizer->Add( partial_sizer2, 0, wxALL, 0 );
\r
632 partial_sizer->Fit( partial_box );
\r
634 mainSizer->Add( partial_sizer, 0, 0, 0 );
\r
636 from_text->Disable();
\r
637 to_text->Disable();
\r
638 SetSizer(mainSizer);
\r
639 mainSizer->Fit(this);
\r
640 mainSizer->Layout();
\r
643 wizInputPage::~wizInputPage()
\r
647 void wizInputPage::OnInputChange(wxEvent& event)
\r
649 i_input = event.GetId() - InputRadio0_Event;
\r
655 mainSizer->Hide( listview );
\r
656 open_panel->Show();
\r
657 mainSizer->Show( open_panel );
\r
658 mainSizer->Layout();
\r
663 open_panel->Hide();
\r
664 mainSizer->Hide( open_panel );
\r
666 mainSizer->Show( listview );
\r
667 mainSizer->Layout();
\r
671 void wizInputPage::OnEnablePartial(wxCommandEvent& event)
\r
673 from_text->Enable( event.IsChecked() );
\r
674 to_text->Enable( event.IsChecked() );
\r
678 void wizInputPage::OnChoose(wxCommandEvent& event)
\r
680 p_open_dialog = new OpenDialog( p_intf, this, -1, -1, OPEN_STREAM );
\r
681 if( p_open_dialog->ShowModal() == wxID_OK &&
\r
682 !p_open_dialog->mrl.IsEmpty() )
\r
684 mrl_text->SetValue(p_open_dialog->mrl[0] );
\r
686 delete p_open_dialog;
\r
687 p_open_dialog = NULL;
\r
690 void wizInputPage::OnWizardPageChanging(wxWizardEvent& event)
\r
694 if( mrl_text->GetValue().IsSameAs( wxT(""), TRUE ) &&
\r
695 event.GetDirection() )
\r
697 wxMessageBox( wxU( CHOOSE_STREAM ), wxU( ERROR_MSG ),
\r
698 wxICON_WARNING | wxOK, this->p_parent );
\r
704 p_parent->SetMrl( (const char *)mrl_text->GetValue().mb_str() );
\r
710 wxListItem listitem;
\r
711 i = listview->GetNextItem( i , wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
\r
714 listitem.SetId( i );
\r
715 listitem.SetColumn( 1 );
\r
716 listview->GetItem( listitem );
\r
717 p_parent->SetMrl( (const char*) listitem.GetText().mb_str() );
\r
720 if( enable_checkbox->IsChecked() )
\r
722 int i_from = atoi( from_text->GetValue().mb_str() );
\r
723 int i_to = atoi( to_text->GetValue().mb_str() );
\r
724 msg_Dbg( p_intf, "Partial streaming enabled, from %i to %i",
\r
726 p_parent->SetPartial( i_from, i_to );
\r
731 wxWizardPage *wizInputPage::GetPrev() const { return p_prev; }
\r
732 wxWizardPage *wizInputPage::GetNext() const
\r
734 if( i_action == ACTION_STREAM )
\r
735 return p_streaming_page;
\r
737 return p_transcode_page;
\r
740 void wizInputPage::SetStreamingPage( wxWizardPage *page)
\r
742 p_streaming_page = page;
\r
745 void wizInputPage::SetTranscodePage( wxWizardPage *page)
\r
747 p_transcode_page = page;
\r
750 void wizInputPage::SetAction( int i_action )
\r
752 this->i_action = i_action;
\r
755 void wizInputPage::SetPintf( intf_thread_t *p_intf )
\r
757 this->p_intf = p_intf;
\r
760 void wizInputPage::SetUri( char *psz_uri )
\r
762 mrl_text->SetValue( wxU( psz_uri ) );
\r
765 void wizInputPage::SetPartial( int i_from, int i_to )
\r
768 msg.Printf( wxString( wxT( "%i") ), i_from );
\r
769 from_text->Enable( TRUE );
\r
770 from_text->SetValue( msg );
\r
771 msg.Printf( wxString( wxT( "%i") ), i_to );
\r
772 to_text->Enable( TRUE );
\r
773 to_text->SetValue( msg );
\r
774 enable_checkbox->SetValue( TRUE );
\r
777 /***************************************************
\r
778 * First transcode page: choose codecs *
\r
779 ***************************************************/
\r
780 wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent,
\r
781 wxWizardPage *next) : wxWizardPage(parent)
\r
787 p_parent = (WizardDialog *) parent;
\r
789 wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
\r
792 pageHeader( this, main_sizer, TRANSCODE1_TITLE, TRANSCODE1_TEXT );
\r
795 wxStaticBox *video_box = new wxStaticBox( this, -1, wxU(_("Video")) );
\r
796 wxStaticBoxSizer *video_sizer = new wxStaticBoxSizer( video_box,
\r
798 /* Line 1 : only the checkbox */
\r
799 wxFlexGridSizer *video_sizer1 = new wxFlexGridSizer( 2,3,20 );
\r
800 video_sizer1->Add( new wxCheckBox( this, VideoEnable_Event,
\r
801 wxU(_("Transcode video") ) ), 0 , wxALIGN_CENTER_VERTICAL|wxALL , 5 );
\r
802 video_sizer1->Add( 0,0,1);
\r
803 /* Line 2 : codec */
\r
804 video_sizer1->Add( new wxStaticText(this, -1, wxU(_("Codec"))),0,wxLEFT ,5);
\r
805 video_combo = new wxComboBox( this, VideoCodec_Event, wxT(""),
\r
806 wxDefaultPosition, wxSize(200,25), 0, NULL,
\r
807 wxCB_DROPDOWN| wxCB_READONLY );
\r
808 for( int i= 0; vcodecs_array[i].psz_display != NULL; i++ )
\r
810 video_combo->Append( wxU( vcodecs_array[i].psz_display ) ,
\r
811 (void *)&vcodecs_array[i] );
\r
814 video_combo->SetSelection(0);
\r
816 video_sizer1->Add( video_combo, 0 , wxALIGN_LEFT , 0 );
\r
818 video_sizer1->Add( new wxStaticText(this, -1, wxU(_("Bitrate (kb/s)"))),0,
\r
820 vb_combo = new wxComboBox( this, VideoBitrate_Event, wxT("1024"),
\r
821 wxDefaultPosition, wxDefaultSize,
\r
822 WXSIZEOF(vbitrates_array), vbitrates_array, wxCB_READONLY );
\r
823 video_sizer1->Add( vb_combo, 0, wxALIGN_LEFT , 0 );
\r
825 /* Line 3 : text */
\r
826 video_text = new wxStaticText( this, -1,
\r
827 wxU( vlc_wraptext( TR_VIDEO_TEXT, TEXTWIDTH, false) ) );
\r
828 /* Fill the main video sizer */
\r
829 video_sizer->Add( video_sizer1 , 0, wxEXPAND , 5 );
\r
830 video_sizer->Add( video_text, 0, wxLEFT|wxTOP , 5 );
\r
834 wxStaticBox *audio_box = new wxStaticBox( this, -1, wxU(_("Audio")) );
\r
835 wxStaticBoxSizer *audio_sizer = new wxStaticBoxSizer( audio_box,
\r
837 /* Line1: enabler */
\r
838 wxFlexGridSizer *audio_sizer1 = new wxFlexGridSizer( 2,3,20);
\r
839 audio_sizer1->Add( new wxCheckBox( this, AudioEnable_Event,
\r
840 wxU(_("Transcode audio") ) ), 0 , wxALIGN_CENTER_VERTICAL|wxALL, 5 );
\r
841 audio_sizer1->Add( 0, 0, 1 );
\r
843 /* Line 2 : codec */
\r
844 audio_sizer1->Add( new wxStaticText(this, -1, wxU(_("Codec"))),0,wxLEFT,5);
\r
845 audio_combo = new wxComboBox( this, AudioCodec_Event, wxT(""),
\r
846 wxDefaultPosition, wxSize(200,25), 0, NULL,
\r
847 wxCB_DROPDOWN| wxCB_READONLY );
\r
848 for( int i= 0; acodecs_array[i].psz_display != NULL; i++ )
\r
850 audio_combo->Append( wxU( acodecs_array[i].psz_display ) ,
\r
851 (void *)&acodecs_array[i] );
\r
854 audio_combo->SetSelection(0);
\r
855 audio_sizer1->Add( audio_combo, 0 , wxALIGN_LEFT, 0 );
\r
857 audio_sizer1->Add( new wxStaticText(this, -1, wxU(_("Bitrate (kb/s)"))),0,
\r
859 ab_combo = new wxComboBox( this, AudioBitrate_Event, wxT("192"),
\r
860 wxDefaultPosition, wxDefaultSize,
\r
861 WXSIZEOF(abitrates_array), abitrates_array, wxCB_READONLY );
\r
862 audio_sizer1->Add( ab_combo, 0, wxALIGN_LEFT, 0 );
\r
864 /* Line 3 : text */
\r
865 audio_text = new wxStaticText( this, -1,
\r
866 wxU( vlc_wraptext( TR_AUDIO_TEXT, TEXTWIDTH, false) ) );
\r
868 audio_sizer->Add(audio_sizer1, 0, wxEXPAND, 5);
\r
869 audio_sizer->Add( audio_text, 0, wxLEFT | wxTOP, 5 );
\r
871 main_sizer->Add( video_sizer, 1, wxGROW, 0 );
\r
872 main_sizer->Add( audio_sizer, 1, wxGROW, 0 );
\r
873 main_sizer->Layout();
\r
874 SetSizerAndFit( main_sizer );
\r
876 /* Default disabled */
\r
877 video_combo->Disable(); video_text->Disable();vb_combo->Disable();
\r
878 audio_combo->Disable(); audio_text->Disable();ab_combo->Disable();
\r
882 wizTranscodeCodecPage::~wizTranscodeCodecPage()
\r
884 if( acodec ) free( acodec );
\r
885 if( vcodec ) free( vcodec );
\r
888 void wizTranscodeCodecPage::OnEnableVideo(wxCommandEvent& event)
\r
890 video_combo->Enable( event.IsChecked() );
\r
891 vb_combo->Enable( event.IsChecked() );
\r
892 video_text->Enable( event.IsChecked() );
\r
895 void wizTranscodeCodecPage::OnEnableAudio(wxCommandEvent& event)
\r
897 audio_combo->Enable( event.IsChecked() );
\r
898 ab_combo->Enable( event.IsChecked() );
\r
899 audio_text->Enable( event.IsChecked() );
\r
902 void wizTranscodeCodecPage::OnVideoCodecChange(wxCommandEvent& event)
\r
904 struct codec *c = (struct codec*)
\r
905 (video_combo->GetClientData(video_combo->GetSelection()));
\r
906 video_text->SetLabel( wxU( vlc_wraptext(c->psz_descr, TEXTWIDTH, false) ) );
\r
907 i_video_codec = video_combo->GetSelection();
\r
908 vcodec = strdup(c->psz_codec);
\r
911 void wizTranscodeCodecPage::OnAudioCodecChange(wxCommandEvent& event)
\r
913 struct codec *c = (struct codec*)
\r
914 (audio_combo->GetClientData(audio_combo->GetSelection()));
\r
915 audio_text->SetLabel( wxU( vlc_wraptext(c->psz_descr, TEXTWIDTH, false) ) );
\r
916 i_audio_codec = audio_combo->GetSelection();
\r
917 acodec = strdup(c->psz_codec);
\r
921 void wizTranscodeCodecPage::OnWizardPageChanging(wxWizardEvent& event)
\r
925 if( !event.GetDirection() )
\r
927 GetPrev()->Enable();
\r
931 /* Set the dummy codec ( accept all muxers ) if needed */
\r
932 if( !video_combo->IsEnabled() )
\r
934 i_video_codec = VCODECS_NUMBER;
\r
936 if( !audio_combo->IsEnabled() )
\r
938 i_audio_codec = ACODECS_NUMBER;
\r
941 ((wizEncapPage *)GetNext())->SetPrev(this);
\r
943 for( i = 0 ; i< MUXERS_NUMBER ; i++ )
\r
945 if( vcodecs_array[i_video_codec].muxers[i] != -1 )
\r
947 for( j = 0 ; j< MUXERS_NUMBER ; j++ )
\r
949 if( acodecs_array[i_audio_codec].muxers[j] ==
\r
950 vcodecs_array[i_video_codec].muxers[i] )
\r
952 ((wizEncapPage*)GetNext())->EnableEncap(
\r
953 vcodecs_array[i_video_codec].muxers[i] );
\r
958 struct codec *c = (struct codec*)
\r
959 (video_combo->GetClientData( video_combo->IsEnabled() ?
\r
960 video_combo->GetSelection(): i_video_codec ));
\r
961 vcodec = strdup(c->psz_codec);
\r
962 c = (struct codec*)
\r
963 (audio_combo->GetClientData( audio_combo->IsEnabled() ?
\r
964 audio_combo->GetSelection() : i_audio_codec ));
\r
965 acodec = strdup(c->psz_codec);
\r
967 int vb = atoi(vb_combo->GetValue().mb_str() );
\r
972 int ab = atoi(ab_combo->GetValue().mb_str() );
\r
978 p_parent->SetTranscode( vcodec, vb , acodec, ab );
\r
979 ((wizEncapPage*)GetNext())->SetAction( p_parent->GetAction() );
\r
980 p_parent->SetAction( p_parent->GetAction() );
\r
985 wxWizardPage *wizTranscodeCodecPage::GetPrev() const { return p_prev; }
\r
986 wxWizardPage *wizTranscodeCodecPage::GetNext() const { return p_next; }
\r
987 void wizTranscodeCodecPage::SetPrev( wxWizardPage *page) {p_prev = page; }
\r
990 /***************************************************
\r
991 * First streaming page: choose method *
\r
992 ***************************************************/
\r
993 wizStreamingMethodPage::wizStreamingMethodPage( wxWizard *parent,
\r
994 wxWizardPage *next) : wxWizardPage(parent)
\r
998 p_parent = (WizardDialog *)parent;
\r
1000 mainSizer = new wxBoxSizer(wxVERTICAL);
\r
1002 /* Create the texts */
\r
1003 pageHeader( this, mainSizer, STREAMING1_TITLE, STREAMING1_TEXT );
\r
1005 mainSizer->Add( 0,50,0 );
\r
1009 wxStaticBox *method_box = new wxStaticBox( this, -1,
\r
1010 wxU(_("Streaming method")) );
\r
1011 wxStaticBoxSizer *method_sizer = new wxStaticBoxSizer(method_box,
\r
1013 for( i = 0 ; i< 3 ; i++ )
\r
1015 method_radios[i] = new wxRadioButton( this, MethodRadio0_Event + i,
\r
1016 wxU( methods_array[i].psz_method ) );
\r
1017 method_radios[i]->SetToolTip( wxU(_( methods_array[i].psz_descr ) ) );
\r
1018 method_sizer->Add( method_radios[i], 0, wxALL, 5 );
\r
1021 method_sizer->Layout();
\r
1023 wxStaticBox *address_box = new wxStaticBox( this, -1,
\r
1024 wxU(_("Destination")) );
\r
1026 address_sizer = new wxStaticBoxSizer(address_box,
\r
1029 /* Big kludge, we take the longest text to get the size */
\r
1030 address_text = new wxStaticText(this, -1,
\r
1031 wxU( vlc_wraptext(methods_array[2].psz_address,
\r
1032 TEXTWIDTH, false ) ),
\r
1033 wxDefaultPosition, wxDefaultSize );
\r
1035 address_txtctrl = new wxTextCtrl( this, -1, wxU(""), wxDefaultPosition,
\r
1037 address_sizer->Add( address_text, 0, wxALL, 5 );
\r
1038 address_sizer->Add( address_txtctrl, 0, wxALL, 5 );
\r
1039 address_sizer->Layout();
\r
1041 /* Set the minimum size */
\r
1042 address_sizer->SetMinSize( address_sizer->GetSize() );
\r
1043 address_text->SetLabel( wxU(
\r
1044 vlc_wraptext( _(methods_array[0].psz_address), TEXTWIDTH, false)));
\r
1046 mainSizer->Add( method_sizer, 0, wxALL | wxEXPAND, 5 );
\r
1047 mainSizer->Add( address_sizer, 0, wxALL | wxEXPAND, 5 );
\r
1049 mainSizer->Add( 0,0,1 );
\r
1051 mainSizer->Layout();
\r
1053 SetSizer(mainSizer);
\r
1054 mainSizer->Fit(this);
\r
1059 void wizStreamingMethodPage::OnWizardPageChanging(wxWizardEvent& event)
\r
1062 if( !event.GetDirection() ) return;
\r
1064 /* Check valid address */
\r
1065 if( i_method == 1 && !ismult( address_txtctrl->GetValue().mb_str()) )
\r
1067 wxMessageBox( wxU( INVALID_MCAST_ADDRESS ) , wxU( ERROR_MSG ),
\r
1068 wxICON_WARNING | wxOK, this->p_parent );
\r
1072 else if( i_method == 0 && address_txtctrl->GetValue().IsEmpty() )
\r
1074 wxMessageBox( wxU( NO_ADDRESS ) , wxU( ERROR_MSG ),
\r
1075 wxICON_WARNING | wxOK, this->p_parent );
\r
1080 ((wizEncapPage *)GetNext())->SetPrev(this);
\r
1081 for( i = 0 ; i< MUXERS_NUMBER ; i++ )
\r
1083 if( methods_array[i_method].muxers[i] != -1 )
\r
1085 ((wizEncapPage*)GetNext())->EnableEncap(
\r
1086 methods_array[i_method].muxers[i] );
\r
1089 p_parent->SetStream( methods_array[i_method].psz_access ,
\r
1090 (char *)address_txtctrl->GetValue().c_str() );
\r
1092 /* Set the action for the muxer page */
\r
1093 ((wizEncapPage*)GetNext())->SetAction( p_parent->GetAction() );
\r
1097 wxWizardPage *wizStreamingMethodPage::GetPrev() const { return p_prev; }
\r
1098 wxWizardPage *wizStreamingMethodPage::GetNext() const { return p_next; }
\r
1100 void wizStreamingMethodPage::SetPrev( wxWizardPage *page) {p_prev = page; }
\r
1103 void wizStreamingMethodPage::OnMethodChange(wxEvent& event)
\r
1105 i_method = event.GetId() - MethodRadio0_Event;
\r
1106 address_text->SetLabel( wxU(
\r
1107 vlc_wraptext( _(methods_array[i_method].psz_address), TEXTWIDTH, false)));
\r
1108 address_sizer->Layout();
\r
1109 mainSizer->Layout();
\r
1112 /***************************************************
\r
1113 * Choose encapsulation format *
\r
1114 ***************************************************/
\r
1115 wizEncapPage::wizEncapPage( wxWizard *parent ) : wxWizardPage(parent)
\r
1119 p_parent = (WizardDialog *)parent;
\r
1120 p_streaming_page = NULL;
\r
1121 p_transcode_page = NULL;
\r
1123 wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
\r
1125 /* Create the texts */
\r
1126 pageHeader( this, mainSizer, ENCAP_TITLE, ENCAP_TEXT );
\r
1128 mainSizer->Add( 0,0,1 );
\r
1130 for( i = 0 ; i< MUXERS_NUMBER ; i++ )
\r
1132 encap_radios[i] = new wxRadioButton( this, EncapRadio0_Event + i,
\r
1133 wxU( encaps_array[i].psz_encap ) );
\r
1134 encap_radios[i]->SetToolTip( wxU(_( encaps_array[i].psz_descr ) ) );
\r
1135 mainSizer->Add( encap_radios[i], 0, wxLEFT, 5 );
\r
1136 encap_radios[i]->Disable();
\r
1139 mainSizer->Add( 0,0,1 );
\r
1141 SetSizer(mainSizer);
\r
1142 mainSizer->Fit(this);
\r
1145 wizEncapPage::~wizEncapPage()
\r
1149 void wizEncapPage::OnWizardPageChanging(wxWizardEvent& event)
\r
1152 if( !event.GetDirection() )
\r
1154 for( i = 0 ; i< MUXERS_NUMBER ; i++ )
\r
1156 encap_radios[i]->Disable();
\r
1159 p_parent->SetMux( encaps_array[i_mux].psz_mux );
\r
1161 if( p_parent->GetAction() == ACTION_STREAM )
\r
1163 if( strstr( p_parent->method, "udp" ))
\r
1165 ((wizStreamingExtraPage *)GetNext())->sap_checkbox->Enable();
\r
1166 ((wizStreamingExtraPage *)GetNext())->sap_text->Enable(false);
\r
1170 ((wizStreamingExtraPage *)GetNext())->sap_checkbox->Enable( false );
\r
1171 ((wizStreamingExtraPage *)GetNext())->sap_text->Enable( false );
\r
1179 void wizEncapPage::OnEncapChange(wxEvent& event)
\r
1181 i_mux = event.GetId() - EncapRadio0_Event;
\r
1184 void wizEncapPage::EnableEncap( int encap )
\r
1187 for( i = 0 ; i< MUXERS_NUMBER ; i++)
\r
1189 if( encaps_array[i].id == encap )
\r
1191 encap_radios[i]->Enable();
\r
1192 encap_radios[i]->SetValue(true);
\r
1198 void wizEncapPage::SetStreamingPage( wxWizardPage *page)
\r
1200 p_streaming_page = page;
\r
1203 void wizEncapPage::SetTranscodePage( wxWizardPage *page)
\r
1205 p_transcode_page = page;
\r
1208 wxWizardPage *wizEncapPage::GetPrev() const { return p_prev; }
\r
1210 wxWizardPage *wizEncapPage::GetNext() const
\r
1212 if( i_action== ACTION_STREAM )
\r
1213 return p_streaming_page;
\r
1215 return p_transcode_page;
\r
1218 void wizEncapPage::SetAction( int i_act ) { i_action = i_act; }
\r
1220 void wizEncapPage::SetPrev( wxWizardPage *page) { p_prev = page; }
\r
1222 /***************************************************
\r
1223 * Extra transcoding page : Select file *
\r
1224 ***************************************************/
\r
1225 wizTranscodeExtraPage::wizTranscodeExtraPage( wxWizard *parent,
\r
1226 wxWizardPage *prev,
\r
1227 wxWizardPage *next) : wxWizardPage(parent)
\r
1231 p_parent = (WizardDialog *) parent;
\r
1232 wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
\r
1234 /* Create the texts */
\r
1235 pageHeader( this, mainSizer, EXTRATRANSCODE_TITLE, EXTRATRANSCODE_TEXT );
\r
1237 mainSizer->Add( 0, 0, 1 );
\r
1239 wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 2, 1 );
\r
1240 sizer->Add( new wxStaticText( this, -1,
\r
1241 wxU(_("Select the file to save to") ) ),
\r
1243 sizer->Add( 0, 0, 1 );
\r
1245 file_text = new wxTextCtrl( this, -1, wxU(""), wxDefaultPosition,
\r
1246 wxSize( 150, -1 ) );
\r
1248 sizer->Add( file_text, 0, wxALL, 5 );
\r
1249 sizer->Add( new wxButton( this, Open_Event, wxU("Choose") ) );
\r
1251 mainSizer->Add( sizer, 0, 0, 0) ;
\r
1253 mainSizer->Add( 0, 0, 1 );
\r
1254 SetSizer(mainSizer);
\r
1255 mainSizer->Fit(this);
\r
1258 void wizTranscodeExtraPage::OnSelectFile( wxCommandEvent &event)
\r
1260 wxFileDialog *file_dialog = new wxFileDialog( this, wxU(_("Open File")),
\r
1261 wxT(""), wxT(""), wxT("*"), wxSAVE );
\r
1263 if( file_dialog && file_dialog->ShowModal() == wxID_OK )
\r
1265 if( file_dialog->GetFilename().mb_str() )
\r
1267 file_text->SetValue( file_dialog->GetFilename() );
\r
1272 void wizTranscodeExtraPage::OnWizardPageChanging( wxWizardEvent& event )
\r
1274 if( event.GetDirection() && file_text->GetValue().IsEmpty() )
\r
1276 wxMessageBox( wxU( CHOOSE_OUTFILE ), wxU( ERROR_MSG ),
\r
1277 wxICON_WARNING | wxOK, this->p_parent );
\r
1280 if( event.GetDirection() )
\r
1282 p_parent->SetTranscodeOut( file_text->GetValue().mb_str());
\r
1286 wxWizardPage *wizTranscodeExtraPage::GetPrev() const { return p_prev; }
\r
1287 wxWizardPage *wizTranscodeExtraPage::GetNext() const {return p_next; }
\r
1289 /***********************************************************
\r
1290 * Extra streaming page
\r
1291 ***********************************************************/
\r
1292 wizStreamingExtraPage::wizStreamingExtraPage( wxWizard *parent,
\r
1293 wxWizardPage *prev,
\r
1294 wxWizardPage *next) : wxWizardPage(parent)
\r
1298 p_parent = (WizardDialog *) parent;
\r
1299 wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
\r
1301 /* Create the texts */
\r
1302 pageHeader( this, mainSizer, EXTRASTREAMING_TITLE, EXTRASTREAMING_TEXT );
\r
1304 mainSizer->Add( 0, 0, 1 );
\r
1306 wxFlexGridSizer *sizer = new wxFlexGridSizer( 2,2,1) ;
\r
1309 sizer->Add( new wxStaticText( this, -1, wxU(_("Time-To-Live (TTL)"))),
\r
1311 ttl_spin = new wxSpinCtrl( this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize,
\r
1313 ttl_spin->SetToolTip(wxU(_(TTL) ) ) ;
\r
1314 sizer->Add( ttl_spin, 0, wxALL , 5 );
\r
1316 /* SAP announce */
\r
1317 sap_checkbox = new wxCheckBox( this, SAP_Event, wxU(_("SAP Announce")) );
\r
1318 sap_checkbox->SetToolTip( wxU(_( SAP ) ) );
\r
1319 sizer->Add( sap_checkbox, 0, 0 , 0 );
\r
1320 sap_text = new wxTextCtrl( this, -1, wxU(""), wxDefaultPosition,
\r
1322 sap_text->SetToolTip( wxU(_( SAP ) ) );
\r
1323 sizer->Add( sap_text, 0, wxALL , 5 );
\r
1325 mainSizer->Add(sizer, 0, wxALL, 5 );
\r
1327 mainSizer->Add( 0, 0, 1 );
\r
1329 SetSizer(mainSizer);
\r
1330 mainSizer->Fit(this);
\r
1333 void wizStreamingExtraPage::OnSAP( wxCommandEvent &event )
\r
1335 sap_text->Enable( event.IsChecked() );
\r
1338 void wizStreamingExtraPage::OnWizardPageChanging(wxWizardEvent& event)
\r
1340 if( sap_checkbox->IsChecked() )
\r
1342 if( sap_text->GetValue().IsEmpty() )
\r
1344 p_parent->SetSAP( true, NULL );
\r
1348 p_parent->SetSAP( true,
\r
1349 (const char *)sap_text->GetValue().mb_str() );
\r
1354 p_parent->SetSAP( false, NULL );
\r
1357 p_parent->SetTTL( ttl_spin->GetValue() );
\r
1360 wxWizardPage *wizStreamingExtraPage::GetPrev() const { return p_prev; }
\r
1361 wxWizardPage *wizStreamingExtraPage::GetNext() const {return p_next; }
\r
1364 /***************************************************************************
\r
1365 * Implementation of the wizard itself
\r
1366 ***************************************************************************/
\r
1367 wizHelloPage *page1;
\r
1368 wizInputPage *page2 ;
\r
1369 wizTranscodeCodecPage *tr_page1 ;
\r
1370 wizStreamingMethodPage *st_page1;
\r
1371 wizTranscodeExtraPage *tr_page2 ;
\r
1372 wizStreamingExtraPage *st_page2;
\r
1373 wizEncapPage *encap_page;
\r
1375 WizardDialog::WizardDialog(intf_thread_t *_p_intf, wxWindow *_p_parent,
\r
1376 char *psz_uri, int _i_from, int _i_to ) :
\r
1377 wxWizard( _p_parent, -1, wxU(_("Streaming/Transcoding Wizard")), wxNullBitmap, wxDefaultPosition)
\r
1379 /* Initializations */
\r
1381 SetPageSize(wxSize(400,420));
\r
1383 /* Initialize structure */
\r
1393 page1 = new wizHelloPage(this);
\r
1394 page2 = new wizInputPage(this, page1, p_intf);
\r
1398 page2->SetUri( psz_uri );
\r
1400 if( i_from != 0 || i_to != 0 )
\r
1402 page2->SetPartial( i_from, i_to );
\r
1405 encap_page = new wizEncapPage(this );
\r
1406 tr_page1 = new wizTranscodeCodecPage(this, encap_page );
\r
1407 st_page1 = new wizStreamingMethodPage(this, encap_page);
\r
1409 tr_page2 = new wizTranscodeExtraPage(this, encap_page, NULL );
\r
1410 st_page2 = new wizStreamingExtraPage(this, encap_page, NULL );
\r
1413 page1->SetNext( page2 );
\r
1414 /* 2->1 in constructor of 2 */
\r
1417 page2->SetTranscodePage(tr_page1);
\r
1418 page2->SetStreamingPage(st_page1);
\r
1419 page2->SetPintf( p_intf );
\r
1420 tr_page1->SetPrev(page2);
\r
1421 st_page1->SetPrev(page2);
\r
1424 encap_page->SetTranscodePage( tr_page2 );
\r
1425 encap_page->SetStreamingPage( st_page2 );
\r
1426 /* 3->4 in constructor of 3 */
\r
1427 // encap_page->SetPrev(tr_page1);
\r
1430 WizardDialog::~WizardDialog()
\r
1439 delete encap_page;
\r
1442 void WizardDialog::SetMrl( const char *mrl )
\r
1444 this->mrl = strdup( mrl );
\r
1447 void WizardDialog::SetTTL( int i_ttl )
\r
1449 this->i_ttl = i_ttl;
\r
1452 void WizardDialog::SetSAP( bool b_enabled, const char *psz_text )
\r
1454 this->b_sap = b_enabled;
\r
1457 if( psz_text != NULL )
\r
1459 this->psz_sap_name = strdup( psz_text );
\r
1463 this->psz_sap_name = NULL;
\r
1468 void WizardDialog::SetPartial( int i_from, int i_to )
\r
1470 this->i_from = i_from;
\r
1471 this->i_to = i_to;
\r
1474 void WizardDialog::SetTranscode( char *vcodec, int vb, char *acodec,int ab)
\r
1476 if( strcmp( vcodec, "dummy") )
\r
1478 this->vcodec= strdup(vcodec);
\r
1480 if( strcmp( acodec, "dummy" ) )
\r
1482 this->acodec = strdup(acodec);
\r
1488 void WizardDialog::SetStream( char *method, char *address )
\r
1490 this->method = strdup( method );
\r
1491 this->address = strdup( address );
\r
1494 void WizardDialog::SetTranscodeOut( const char *address )
\r
1496 this->address = strdup( address );
\r
1499 void WizardDialog::SetMux( char *mux )
\r
1501 this->mux = strdup( mux );
\r
1504 void WizardDialog::SetAction( int i_action )
\r
1506 this->i_action = i_action;
\r
1509 int WizardDialog::GetAction()
\r
1514 void WizardDialog::Run()
\r
1516 msg_Dbg( p_intf,"starting wizard");
\r
1517 if( RunWizard(page1) )
\r
1521 msg_Dbg( p_intf,"wizard completed");
\r
1523 if( i_action == ACTION_TRANSCODE )
\r
1525 msg_Dbg( p_intf,"Starting transcode of %s to file %s",
\r
1527 msg_Dbg( p_intf,"Using %s (%i kbps) / %s (%i kbps),encap %s",
\r
1528 vcodec,vb,acodec,ab,mux);
\r
1529 int i_tr_size = 0 ; /* 10 = ab + vb */
\r
1530 i_tr_size += vcodec ? strlen(vcodec) + strlen("vcodec=") +strlen("vb="): 0;
\r
1531 i_tr_size += acodec ? strlen(acodec) + strlen("acodec=") +strlen("ab=") : 0;
\r
1533 char *psz_transcode = (char *)malloc( i_tr_size * sizeof(char));
\r
1534 if( vcodec || acodec )
\r
1536 sprintf( psz_transcode, "transcode{" );
\r
1540 snprintf( psz_transcode, 1 , "%c", 0 );
\r
1544 i_tr_size += 5 + strlen(vcodec);
\r
1545 snprintf( psz_transcode, i_tr_size , "%svcodec=%s,vb=%i",
\r
1546 psz_transcode, vcodec, vb );
\r
1550 i_tr_size += 6 + strlen(acodec);
\r
1552 sprintf( psz_transcode, "%s%cacodec=%s,ab=%i",
\r
1553 psz_transcode, vcodec ? ',' : ' ', acodec, ab );
\r
1555 if( vcodec || acodec )
\r
1558 sprintf( psz_transcode , "%s}:", psz_transcode );
\r
1560 i_size = 73 + strlen(mux) + strlen(address) + strlen(psz_transcode);
\r
1561 psz_opt = (char *)malloc( i_size * sizeof(char) );
\r
1562 snprintf( psz_opt, i_size, ":sout=#%sstandard{mux=%s,url=%s,"
\r
1564 psz_transcode, mux, address );
\r
1568 msg_Dbg( p_intf, "Starting stream of %s to %s using %s, encap %s",
\r
1569 mrl, address, method, mux);
\r
1572 char *psz_sap_option = NULL;
\r
1573 if( psz_sap_name )
\r
1575 psz_sap_option = (char *) malloc( strlen( psz_sap_name )
\r
1577 snprintf( psz_sap_option,strlen( psz_sap_name ) + 15,
\r
1578 "sap,name=\"%s\"",psz_sap_name );
\r
1582 psz_sap_option = (char *) malloc( 5 );
\r
1583 snprintf( psz_sap_option, 5, "sap" );
\r
1585 i_size = 40 + strlen(mux) + strlen(address) +
\r
1586 strlen( psz_sap_option);
\r
1587 psz_opt = (char *)malloc( i_size * sizeof(char) );
\r
1588 snprintf( psz_opt, i_size,
\r
1589 ":sout=#standard{mux=%s,url=%s,access=%s,%s}",
\r
1590 mux, address,method, psz_sap_option);
\r
1591 msg_Dbg( p_intf, "Sap enabled: %s", psz_sap_option);
\r
1592 if( psz_sap_option ) free( psz_sap_option );
\r
1596 i_size = 40 + strlen(mux) + strlen(address);
\r
1597 psz_opt = (char *)malloc( i_size * sizeof(char) );
\r
1598 snprintf( psz_opt, i_size,
\r
1599 ":sout=#standard{mux=%s,url=%s,access=%s}",
\r
1600 mux, address,method);
\r
1604 playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
\r
1605 VLC_OBJECT_PLAYLIST, FIND_ANYWHERE);
\r
1608 playlist_item_t *p_item = playlist_ItemNew( p_playlist, mrl,
\r
1610 playlist_ItemAddOption( p_item, psz_opt);
\r
1613 char psz_from[20];
\r
1614 msg_Dbg( p_intf, "Setting starttime");
\r
1615 snprintf( psz_from, 20, "start-time=%i", i_from);
\r
1616 playlist_ItemAddOption( p_item, psz_from);
\r
1621 snprintf( psz_to, 20, "stop-time=%i", i_to);
\r
1622 playlist_ItemAddOption( p_item, psz_to);
\r
1626 snprintf( psz_ttl, 20, "ttl=%i",i_ttl );
\r
1627 playlist_ItemAddOption( p_item, psz_ttl );
\r
1629 playlist_AddItem( p_playlist, p_item, PLAYLIST_GO, PLAYLIST_END );
\r
1630 vlc_object_release(p_playlist);
\r
1634 wxMessageBox( wxU( NO_PLAYLIST ), wxU( ERROR_MSG ),
\r
1635 wxICON_WARNING | wxOK, this );
\r
1640 msg_Dbg( p_intf, "wizard was cancelled");
\r
1643 /****************************************************************
\r
1644 * Local helper functions
\r
1645 ****************************************************************/
\r
1646 static int ismult( const char *psz_uri )
\r
1649 unsigned long i_value;
\r
1652 if( psz_uri[0] == '[')
\r
1653 return strncasecmp( &psz_uri[1], "FF" , 2) ? VLC_FALSE : VLC_TRUE;
\r
1656 i_value = strtoul( psz_uri, &psz_end, 10 );
\r
1657 if( *psz_end != '.' ) { return( VLC_FALSE ); }
\r
1659 return( ( i_value >= 224 && i_value < 240 ) ? VLC_TRUE : VLC_FALSE );
\r