Commit 23a9ce0d authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Sout: add functions to choose some predefined profiles for audio/video codecs.

Only basics options are done ( AVCodec + Muxer mainly ).
Two profiles are done. If you want to add more, then search "ADD HERE" in sout.cpp.
Reindentation of older code.
parent 038dc1ca
......@@ -5,6 +5,8 @@
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
* Jean-François Massol <jf.massol -at- gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -37,13 +39,14 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf,
/* UI stuff */
ui.setupUi( this );
#define ADD_PROFILE( name ) ui.profileBox->addItem( name );
ADD_PROFILE( "Custom" )
ADD_PROFILE( "IPod" )
ADD_PROFILE( "XBox" )
ADD_PROFILE( "Windows" )
ADD_PROFILE( "PSP" )
ADD_PROFILE( "GSM" )
/* ADD HERE for new profiles */
#define ADD_PROFILE( name, shortname ) ui.profileBox->addItem( qtr( name ), QVariant( QString( shortname ) ) );
ADD_PROFILE( "Custom" , "Custom" )
ADD_PROFILE( "IPod (mp4/aac)", "IPod" )
ADD_PROFILE( "XBox", "XBox" )
ADD_PROFILE( "Windows (wmv/asf)", "Windows" )
ADD_PROFILE( "PSP", "PSP")
ADD_PROFILE( "GSM", "GSM" )
#define ADD_VCODEC( name, fourcc ) ui.vCodecBox->addItem( name, QVariant( fourcc ) );
ADD_VCODEC( "MPEG-1", "mp1v" )
......@@ -80,7 +83,8 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf,
ADD_SCALING( "1.75" )
ADD_SCALING( "2" )
ui.mrlEdit->setToolTip ( qtr( "Stream output string.\n This is automatically generated when you change the above settings,\n but you can update it manually." ) ) ;
ui.mrlEdit->setToolTip ( qtr( "Stream output string.\n This is automatically generated "
"when you change the above settings,\n but you can update it manually." ) ) ;
// /* Connect everything to the updateMRL function */
#define CB( x ) CONNECT( ui.x, clicked( bool ), this, updateMRL() );
......@@ -124,7 +128,8 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf,
}
void SoutDialog::fileBrowse()
{ui.tabWidget->setTabEnabled( 0,false );
{
ui.tabWidget->setTabEnabled( 0,false );
QString f = QFileDialog::getOpenFileName( this, qtr( "Save file" ), "", "" );
ui.fileEdit->setText( f );
updateMRL();
......@@ -168,10 +173,40 @@ void SoutDialog::setRawOptions( bool b_raw )
}
}
int indexFromItemData( QComboBox *aCombo, QString aString )
{
for( int i=0; i < aCombo->count(); i++ )
{
if( aCombo->itemData( i ).toString() == aString ) return i;
}
return -1;
}
void SoutDialog::setOptions()
{
/* The test is currently done with a QString, it could be done with the index, it'd depend how translation works */
if ( ui.profileBox->currentText() == "Custom" )
QString profileString = ui.profileBox->itemData( ui.profileBox->currentIndex() ).toString();
msg_Dbg( p_intf, "Profile Used: %s", qta( profileString ));
int index;
#define setProfile( muxName, hasVideo, vCodecName, hasAudio, aCodecName ) \
{ \
ui.muxName ##Mux->setChecked( true ); \
\
ui.transcodeAudio->setChecked( hasAudio ); \
index = indexFromItemData( ui.aCodecBox, vCodecName ); \
if( index >= 0 ) ui.aCodecBox->setCurrentIndex( index ); \
\
ui.transcodeVideo->setChecked( hasVideo ); \
index = indexFromItemData( ui.aCodecBox, vCodecName ); \
if( index >=0 ) ui.vCodecBox->setCurrentIndex( index ); \
}
/* ADD HERE the profiles you want and need */
if( profileString == "IPod" ) setProfile( MP4, true, "mp4a", true, "mp4v" )
else if( profileString == "XBox" ) setProfile( ASF, true, "wma", true, "WMV2" )
/* If the profile is not a custom one, then disable the tabWidget */
if ( profileString == "Custom" )
{
ui.tabWidget->setEnabled( true );
}
......@@ -179,15 +214,18 @@ void SoutDialog::setOptions()
{
ui.tabWidget->setDisabled( true );
}
/* Update the MRL !! */
updateMRL();
}
void SoutDialog::toggleSout()
{
#define TGV( x ) { \
#define TGV( x ) { \
if( ( x->isHidden() ) ) \
x->show(); \
else x->hide();\
}
}
TGV( ui.HTTPOutput ) ; TGV( ui.UDPOutput ) ; TGV( ui.MMSHOutput ) ;
TGV( ui.HTTPEdit ) ; TGV( ui.UDPEdit ) ; TGV( ui.MMSHEdit ) ;
TGV( ui.HTTPLabel ) ; TGV( ui.UDPLabel ) ; TGV( ui.MMSHLabel ) ;
......@@ -251,8 +289,8 @@ void SoutDialog::updateMRL()
bool trans = false;
bool more = false;
if ( ui.transcodeVideo->isChecked() || ui.transcodeAudio->isChecked() )
{
if ( ui.transcodeVideo->isChecked() || ui.transcodeAudio->isChecked() )
{
if ( ui.transcodeVideo->isChecked() )
{
mrl = ":sout=#transcode{";
......@@ -288,7 +326,7 @@ if ( ui.transcodeVideo->isChecked() || ui.transcodeAudio->isChecked() )
trans = true;
}
mrl.append( "}" );
}
}
if ( sout.b_local || sout.b_file || sout.b_http || sout.b_mms || sout.b_udp )
{
......@@ -380,85 +418,9 @@ if ( ui.transcodeVideo->isChecked() || ui.transcodeAudio->isChecked() )
if ( sout.b_all_es )
mrl.append( ":sout-all" );
ui.mrlEdit->setText( mrl );
free( sout.psz_acodec ); free( sout.psz_vcodec ); free( sout.psz_scodec );
free( sout.psz_file );free( sout.psz_http ); free( sout.psz_mms );
free( sout.psz_udp ); free( sout.psz_mux );
free( sout.psz_name ); free( sout.psz_group );
}
// void SoutDialog::updateMRL()
// {
// sout_gui_descr_t pd;
// memset( &pd, 0, sizeof( sout_gui_descr_t ) );
//
// /* Output */
// pd.b_dump = ui.rawInput->isChecked();
// if( pd.b_dump ) goto end;
//
// pd.b_local = ui.localOutput->isChecked();
// pd.b_file = ui.fileOutput->isChecked();
// pd.b_http = ui.HTTPOutput->isChecked();
// pd.b_mms = ui.MMSHOutput->isChecked();
// pd.b_udp = ui.UDPOutput->isChecked();
//
// pd.psz_file = ui.fileOutput->isChecked() ?
// strdup( qtu( ui.fileEdit->text() ) ): NULL;
// pd.psz_http = ui.HTTPOutput->isChecked() ?
// strdup( qtu( ui.HTTPEdit->text() ) ) : NULL;
// pd.psz_mms = ui.MMSHOutput->isChecked() ?
// strdup( qtu( ui.MMSHEdit->text() ) ): NULL;
// pd.psz_udp = ui.UDPOutput->isChecked() ?
// strdup( qtu( ui.UDPEdit->text() ) ): NULL;
//
// pd.i_http = ui.HTTPPort->value();
// pd.i_mms = ui.MMSHPort->value();
// pd.i_udp = ui.UDPPort->value();
//
// /* Mux */
// #define SMUX( x, txt ) if( ui.x##Mux->isChecked() ) pd.psz_mux = strdup( txt );
// SMUX( PS, "ps" );
// SMUX( TS, "ts" );
// SMUX( MPEG1, "mpeg" );
// SMUX( Ogg, "ogg" );
// SMUX( ASF, "asf" );
// SMUX( MP4, "mp4" );
// SMUX( MOV, "mov" );
// SMUX( WAV, "wav" );
// SMUX( RAW, "raw" );
// SMUX( FLV, "flv" );
//
//
//
// /* Transcode */
// // pd.b_soverlay = ui.sOverlay->isChecked();
// // pd.i_vb = ui.vBitrate->value();
// // pd.i_ab = ui.aBitrate->value();
// // pd.i_channels = ui.aChannels->value();
// // pd.f_scale = atof( qta( ui.vScale->currentText() ) );
// //
// // pd.psz_vcodec = ui.transcodeVideo->isChecked() ?
// // strdup( qtu( ui.vCodec->itemData(
// // ui.vCodec->currentIndex() ). toString() ) ) : NULL;
// // pd.psz_acodec = ui.transcodeAudio->isChecked() ?
// // strdup( qtu( ui.aCodec->itemData(
// // ui.aCodec->currentIndex() ).toString() ) ) : NULL;
// // pd.psz_scodec = ui.transcodeSubs->isChecked() ?
// // strdup( qtu( ui.sCodec->itemData(
// // ui.sCodec->currentIndex() ).toString() ) ) : NULL;
// // pd.b_sap = ui.sap->isChecked();
// // pd.b_all_es = ui.soutAll->isChecked();
// // pd.psz_name = qtu( ui.sapName->text() );
// // pd.psz_group = qtu( ui.sapGroup->text() );
// // pd.i_ttl = ui.ttl->value() ;
// end:
// sout_chain_t* p_chain = streaming_ChainNew();
// streaming_GuiDescToChain( VLC_OBJECT( p_intf ), p_chain, &pd );
// char *psz_mrl = streaming_ChainToPsz( p_chain );
//
// ui.mrlEdit->setText( qfu( strdup( psz_mrl ) ) );
// free( pd.psz_acodec ); free( pd.psz_vcodec ); free( pd.psz_scodec );
// free( pd.psz_file );free( pd.psz_http ); free( pd.psz_mms );
// free( pd.psz_udp ); free( pd.psz_mux );
// }
......@@ -343,7 +343,7 @@
<item row="1" column="1" >
<widget class="QRadioButton" name="ASFMux" >
<property name="text" >
<string>ASF</string>
<string>ASF/WMV</string>
</property>
</widget>
</item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment