1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
|
/*****************************************************************************
* sout.cpp : Stream output dialog ( old-style )
****************************************************************************
* Copyright (C) 2007-2009 the VideoLAN team
*
* $Id: cb4fc1e76de074b2bfc600716dd6005c9288b6b1 $
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* ( at your option ) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "dialogs/sout.hpp"
#include "util/qt_dirs.hpp"
#include "components/sout/sout_widgets.hpp"
#include <QString>
#include <QFileDialog>
#include <QToolButton>
#include <QSpinBox>
#include <assert.h>
SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf, const QString& inputMRL )
: QWizard( parent )
{
p_intf = _p_intf;
setWindowTitle( qtr( "Stream Output" ) );
setWindowRole( "vlc-stream-output" );
/* UI stuff */
ui.setupUi( this );
ui.inputBox->setMRL( inputMRL );
ui.helpEdit->setPlainText( qtr("This wizard will allow you to stream or "
"convert your media for use locally, on your private network, "
"or on the Internet.\n"
"You should start by checking that source matches what you want "
"your input to be and then press the \"Next\" "
"button to continue.\n") );
ui.mrlEdit->setToolTip ( qtr( "Stream output string.\n"
"This is automatically generated "
"when you change the above settings,\n"
"but you can change it manually." ) ) ;
ui.destTab->setTabsClosable( true );
QTabBar* tb = ui.destTab->findChild<QTabBar*>();
if( tb != NULL ) tb->tabButton(0, QTabBar::RightSide)->hide();
CONNECT( ui.destTab, tabCloseRequested( int ), this, closeTab( int ) );
ui.destTab->setTabIcon( 0, QIcon( ":/buttons/playlist/playlist_add" ) );
ui.destBox->addItem( qtr( "File" ) );
ui.destBox->addItem( "HTTP" );
ui.destBox->addItem( "MS-WMSP (MMSH)" );
ui.destBox->addItem( "RTSP" );
ui.destBox->addItem( "RTP / MPEG Transport Stream" );
ui.destBox->addItem( "RTP Audio/Video Profile" );
ui.destBox->addItem( "UDP (legacy)" );
ui.destBox->addItem( "IceCast" );
BUTTONACT( ui.addButton, addDest() );
// /* Connect everything to the updateMRL function */
#define CB( x ) CONNECT( ui.x, toggled( bool ), this, updateMRL() );
#define CT( x ) CONNECT( ui.x, textChanged( const QString& ), this, updateMRL() );
#define CS( x ) CONNECT( ui.x, valueChanged( int ), this, updateMRL() );
#define CC( x ) CONNECT( ui.x, currentIndexChanged( int ), this, updateMRL() );
/* Misc */
CB( soutAll );
CB( localOutput ); CB( transcodeBox );
CONNECT( ui.profileSelect, optionsChanged(), this, updateMRL() );
setButtonText( QWizard::BackButton, qtr("Back") );
setButtonText( QWizard::CancelButton, qtr("Cancel") );
setButtonText( QWizard::NextButton, qtr("Next") );
setButtonText( QWizard::FinishButton, qtr("Stream") );
#undef CC
#undef CS
#undef CT
#undef CB
}
void SoutDialog::closeTab( int i )
{
if( i == 0 ) return;
QWidget* temp = ui.destTab->widget( i );
ui.destTab->removeTab( i );
delete temp;
updateMRL();
}
void SoutDialog::addDest( )
{
VirtualDestBox *db;
QString caption;
switch( ui.destBox->currentIndex() )
{
case 0:
db = new FileDestBox( this, p_intf );
caption = qtr( "File" );
break;
case 1:
db = new HTTPDestBox( this );
caption = qfu( "HTTP" );
break;
case 2:
db = new MMSHDestBox( this );
caption = qfu( "WMSP" );
break;
case 3:
db = new RTSPDestBox( this );
caption = qfu( "RTSP" );
break;
case 4:
db = new RTPDestBox( this, "ts" );
caption = "RTP/TS";
break;
case 5:
db = new RTPDestBox( this );
caption = "RTP/AVP";
break;
case 6:
db = new UDPDestBox( this );
caption = "UDP";
break;
case 7:
db = new ICEDestBox( this );
caption = "Icecast";
break;
default:
assert(0);
}
int index = ui.destTab->addTab( db, caption );
CONNECT( db, mrlUpdated(), this, updateMRL() );
ui.destTab->setCurrentIndex( index );
updateMRL();
}
void SoutDialog::done( int r )
{
mrl = ui.mrlEdit->toPlainText();
QWizard::done(r);
}
void SoutDialog::updateMRL()
{
QString qs_mux = ui.profileSelect->getMux();
SoutMrl smrl( ":sout=#" );
if( !ui.profileSelect->getTranscode().isEmpty() && ui.transcodeBox->isChecked() )
{
smrl.begin( ui.profileSelect->getTranscode() );
smrl.end();
}
bool multi = false;
if( ui.destTab->count() >= 3 ||
( ui.destTab->count() == 2 && ui.localOutput->isChecked() ) )
multi = true;
if( multi )
smrl.begin( "duplicate" );
for( int i = 1; i < ui.destTab->count(); i++ )
{
VirtualDestBox *vdb = qobject_cast<VirtualDestBox *>(ui.destTab->widget( i ));
if( !vdb )
continue;
QString tempMRL = vdb->getMRL( qs_mux );
if( tempMRL.isEmpty() ) continue;
if( multi )
smrl.option( "dst", tempMRL );
else
{
smrl.begin( tempMRL);
smrl.end();
}
}
if( ui.localOutput->isChecked() )
{
if( multi )
smrl.option( "dst", "display" );
else
{
smrl.begin( "display" );
smrl.end();
}
}
if ( multi ) smrl.end();
mrl = smrl.getMrl();
if( ui.soutAll->isChecked() ) mrl.append( " :sout-all" );
mrl.append( " :sout-keep" );
ui.mrlEdit->setPlainText( mrl );
}
|