1 /*****************************************************************************
2 * sout.cpp : Stream output dialog (old-style)
3 ****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
5 * $Id: Errors.cpp 16024 2006-07-13 13:51:05Z xtophe $
7 * Authors: Clément Stenac <zorglub@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #include "dialogs/sout.hpp"
26 #include <vlc_streaming.h>
28 #include <QFileDialog>
30 SoutDialog::SoutDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
32 //setWindowTitle( qtr( "Stream output") );
36 #define ADD_VCODEC( name, fcc) ui.vCodec->addItem( name, QVariant( fcc ) );
37 ADD_VCODEC( "MPEG-1", "mp1v" );
38 ADD_VCODEC( "MPEG-2", "mp2v" );
39 ADD_VCODEC( "MPEG-4", "mp4v" );
40 ADD_VCODEC( "DIVX 1" , "DIV1" );
41 ADD_VCODEC( "DIVX 2" , "DIV1" );
42 ADD_VCODEC( "DIVX 3" , "DIV1" );
43 ADD_VCODEC( "H-263", "H263" );
44 ADD_VCODEC( "H-264", "h264" );
45 ADD_VCODEC( "WMV1", "WMV1" );
46 ADD_VCODEC( "WMV2" , "WMV2" );
47 ADD_VCODEC( "M-JPEG", "MJPG" );
48 ADD_VCODEC( "Theora", "theo" );
50 #define ADD_ACODEC( name, fcc) ui.aCodec->addItem( name, QVariant( fcc ) );
51 ADD_ACODEC( "MPEG Audio", "mpga" );
52 ADD_ACODEC( "MP3", "mp3" );
53 ADD_ACODEC( "MPEG 4 Audio (AAC)", "mp4a");
54 ADD_ACODEC( "A52/AC3", "a52");
55 ADD_ACODEC( "Vorbis", "vorb" );
56 ADD_ACODEC( "Flac", "flac" );
57 ADD_ACODEC( "Speex", "spx" );
58 ADD_ACODEC( "WAV", "s16l" );
60 ui.vScale->addItem( "0.25" );
61 ui.vScale->addItem( "0.5" );
62 ui.vScale->addItem( "0.75" );
63 ui.vScale->addItem( "1" );
64 ui.vScale->addItem( "1.25" );
65 ui.vScale->addItem( "1.5" );
66 ui.vScale->addItem( "1.75" );
67 ui.vScale->addItem( "2" );
69 /* Connect everything to the updateMRL function */
70 #define CB(x) CONNECT( ui.x, clicked(bool), this, updateMRL() );
71 #define CT(x) CONNECT( ui.x, textChanged(const QString), this, updateMRL() );
72 #define CS(x) CONNECT( ui.x, valueChanged(int), this, updateMRL() );
73 #define CC(x) CONNECT( ui.x, currentIndexChanged(int), this, updateMRL() );
75 CB( fileOutput ); CB( HTTPOutput ); CB( localOutput );
76 CB( UDPOutput ); CB( MMSHOutput ); CB( rawInput );
77 CT( fileEdit ); CT( HTTPEdit ); CT( UDPEdit ); CT( MMSHEdit );
78 CS( HTTPPort ); CS( UDPPort ); CS( MMSHPort );
80 CC( vCodec ); CC( sCodec ); CC( aCodec ) ;
81 CB( transcodeVideo ); CB( transcodeAudio ); CB( transcodeSubs );
83 CS( vBitrate ); CS( aBitrate ); CS( aChannels ); CC( vScale );
85 CB( PSMux ); CB( TSMux ); CB( MPEG1Mux ); CB( OggMux ); CB( ASFMux );
86 CB( MP4Mux ); CB( MOVMux ); CB( WAVMux ); CB( RAWMux );
88 CB( soutAll ); CS( ttl ); CT( sapName ); CT( sapGroup );
90 CONNECT( ui.fileSelectButton, clicked(), this, fileBrowse() );
93 void SoutDialog::fileBrowse()
95 QString f = QFileDialog::getOpenFileName( this, qtr("Save file"), "", "" );
96 ui.fileEdit->setText( f );
100 void SoutDialog::ok()
103 void SoutDialog::cancel()
107 void SoutDialog::updateMRL()
110 memset( &pd, 0, sizeof( sout_gui_descr_t ) );
113 pd.b_dump = ui.rawInput->isChecked();
114 if( pd.b_dump ) goto end;
116 pd.b_local = ui.localOutput->isChecked();
117 pd.b_file = ui.fileOutput->isChecked();
118 pd.b_http = ui.HTTPOutput->isChecked();
119 pd.b_mms = ui.MMSHOutput->isChecked();
120 pd.b_udp = ui.UDPOutput->isChecked();
122 pd.psz_file = ui.fileOutput->isChecked() ?
123 strdup(qtu( ui.fileEdit->text() ) ): NULL;
124 pd.psz_http = ui.HTTPOutput->isChecked() ?
125 strdup(qtu( ui.HTTPEdit->text() ) ) : NULL;
126 pd.psz_mms = ui.MMSHOutput->isChecked() ?
127 strdup(qtu( ui.MMSHEdit->text() ) ): NULL;
128 pd.psz_udp = ui.UDPOutput->isChecked() ?
129 strdup( qtu( ui.UDPEdit->text() ) ): NULL;
131 pd.i_http = ui.HTTPPort->value();
132 pd.i_mms = ui.MMSHPort->value();
133 pd.i_udp = ui.UDPPort->value();
136 #define SMUX(x, txt) if( ui.x##Mux->isChecked() ) pd.psz_mux = strdup(txt);
139 SMUX( MPEG1, "mpeg" );
148 pd.b_soverlay = ui.sOverlay->isChecked();
149 pd.i_vb = ui.vBitrate->value();
150 pd.i_ab = ui.aBitrate->value();
151 pd.i_channels = ui.aChannels->value();
152 pd.f_scale = atof( qta( ui.vScale->currentText() ) );
154 pd.psz_vcodec = ui.transcodeVideo->isChecked() ?
155 strdup( qtu( ui.vCodec->itemData(
156 ui.vCodec->currentIndex() ). toString() ) ) : NULL;
157 pd.psz_acodec = ui.transcodeAudio->isChecked() ?
158 strdup( qtu( ui.aCodec->itemData(
159 ui.aCodec->currentIndex() ).toString() ) ) : NULL;
160 pd.psz_scodec = ui.transcodeSubs->isChecked() ?
161 strdup( qtu( ui.sCodec->itemData(
162 ui.sCodec->currentIndex() ).toString() ) ) : NULL;
163 pd.b_sap = ui.sap->isChecked();
164 pd.b_all_es = ui.soutAll->isChecked();
165 pd.psz_name = qtu( ui.sapName->text() );
166 pd.psz_group = qtu( ui.sapGroup->text() );
167 pd.i_ttl = ui.ttl->value() ;
169 sout_chain_t* p_chain = streaming_ChainNew();
170 streaming_GuiDescToChain( VLC_OBJECT(p_intf), p_chain, &pd );
171 char *psz_mrl = streaming_ChainToPsz( p_chain );
172 ui.mrlEdit->setText( qfu( strdup(psz_mrl) ) );
173 free( pd.psz_acodec ); free( pd.psz_vcodec ); free( pd.psz_scodec );
174 free( pd.psz_file );free( pd.psz_http ); free( pd.psz_mms );
175 free( pd.psz_udp ); free( pd.psz_mux );