#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")
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;
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)
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)
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)
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)
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 */
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 ) );
{
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")) );
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
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" ) ) ),
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();
{
open_panel->Hide();
mainSizer->Hide( open_panel );
- pl_panel->Show();
- mainSizer->Show( pl_panel );
+ listview->Show();
+ mainSizer->Show( listview );
mainSizer->Layout();
}
}
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] );
}
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 *
***************************************************/
/* 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);
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 */
/* 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 */
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 */
/* 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] )
/* Create the texts */
pageHeader( this, mainSizer, STREAMING1_TITLE, STREAMING1_TEXT );
- mainSizer->Add( 0,0,1 );
+ mainSizer->Add( 0,50,0 );
i_method = 0;
}
((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 )
{
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();
}
/***************************************************
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 ) );
int i;
if( !event.GetDirection() )
{
- for( i = 0 ; i< 9 ; i++ )
+ for( i = 0 ; i< MUXERS_NUMBER ; i++ )
{
encap_radios[i]->Disable();
}
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 )
{
}
if( event.GetDirection() )
{
- p_parent->SetTranscodeOut( (char *)file_text->GetValue().c_str());
+ p_parent->SetTranscodeOut( file_text->GetValue().mb_str());
}
}
/* 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 );
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 */
/* 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;
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);
this->address = strdup( address );
}
-void WizardDialog::SetTranscodeOut( char *address )
+void WizardDialog::SetTranscodeOut( const char *address )
{
this->address = strdup( address );
}
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 = 0 ; /* 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;
{
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 );
}
{
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);
}
}
{
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 );