Commit 43e8fc6a authored by Clément Stenac's avatar Clément Stenac

* Qt4 stream output dialog

* Fixes to the streaming chain generator
* network: don't print an error message for EINTR
parent 559c7675
......@@ -120,7 +120,8 @@ struct sout_transcode_t
int i_vb, i_ab, i_channels;
float f_scale;
vlc_bool_t b_soverlay;
char *psz_vcodec, *psz_acodec, *psz_scodec, *psz_venc, *psz_aenc;
char *psz_vcodec;
char *psz_acodec, *psz_scodec, *psz_venc, *psz_aenc;
char *psz_additional;
int i_params; sout_param_t **pp_params;
......@@ -219,6 +220,9 @@ struct sout_gui_descr_t
int i_ttl;
};
VLC_EXPORT(void, streaming_GuiDescToChain,(vlc_object_t*, sout_chain_t*, sout_gui_descr_t*));
VLC_EXPORT(char*, streaming_ChainToPsz,(sout_chain_t*));
/***************** Profile parsing ***********************/
struct profile_parser_t
......
......@@ -519,7 +519,7 @@ struct module_symbols_t
void (*__stats_TimersClean_inner) (vlc_object_t *);
void *__intf_IntfProgressUpdate_deprecated;
void *__intf_IntfProgress_deprecated;
void *streaming_ChainToPsz_deprecated;
char* (*streaming_ChainToPsz_inner) (sout_chain_t*);
int (*__intf_UserWarn_inner) (vlc_object_t*, const char*, const char*, ...);
vlc_bool_t (*__intf_UserProgressIsCancelled_inner) (vlc_object_t*, int);
int (*__intf_Progress_inner) (vlc_object_t*, const char*, const char*, float, int);
......@@ -558,6 +558,7 @@ struct module_symbols_t
char * (*str_format_time_inner) (char *);
char * (*__str_format_meta_inner) (vlc_object_t *, char *);
int (*vout_Snapshot_inner) (vout_thread_t *p_vout, picture_t *p_pic);
void (*streaming_GuiDescToChain_inner) (vlc_object_t*, sout_chain_t*, sout_gui_descr_t*);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
......@@ -1001,6 +1002,7 @@ struct module_symbols_t
# define input_AddSubtitles (p_symbols)->input_AddSubtitles_inner
# define __stats_CounterCreate (p_symbols)->__stats_CounterCreate_inner
# define __stats_TimersClean (p_symbols)->__stats_TimersClean_inner
# define streaming_ChainToPsz (p_symbols)->streaming_ChainToPsz_inner
# define __intf_UserWarn (p_symbols)->__intf_UserWarn_inner
# define __intf_UserProgressIsCancelled (p_symbols)->__intf_UserProgressIsCancelled_inner
# define __intf_Progress (p_symbols)->__intf_Progress_inner
......@@ -1033,6 +1035,7 @@ struct module_symbols_t
# define str_format_time (p_symbols)->str_format_time_inner
# define __str_format_meta (p_symbols)->__str_format_meta_inner
# define vout_Snapshot (p_symbols)->vout_Snapshot_inner
# define streaming_GuiDescToChain (p_symbols)->streaming_GuiDescToChain_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
......@@ -1479,6 +1482,7 @@ struct module_symbols_t
((p_symbols)->input_AddSubtitles_inner) = input_AddSubtitles; \
((p_symbols)->__stats_CounterCreate_inner) = __stats_CounterCreate; \
((p_symbols)->__stats_TimersClean_inner) = __stats_TimersClean; \
((p_symbols)->streaming_ChainToPsz_inner) = streaming_ChainToPsz; \
((p_symbols)->__intf_UserWarn_inner) = __intf_UserWarn; \
((p_symbols)->__intf_UserProgressIsCancelled_inner) = __intf_UserProgressIsCancelled; \
((p_symbols)->__intf_Progress_inner) = __intf_Progress; \
......@@ -1511,6 +1515,7 @@ struct module_symbols_t
((p_symbols)->str_format_time_inner) = str_format_time; \
((p_symbols)->__str_format_meta_inner) = __str_format_meta; \
((p_symbols)->vout_Snapshot_inner) = vout_Snapshot; \
((p_symbols)->streaming_GuiDescToChain_inner) = streaming_GuiDescToChain; \
(p_symbols)->vlc_current_charset_deprecated = NULL; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__sout_CfgParse_deprecated = NULL; \
......@@ -1570,7 +1575,6 @@ struct module_symbols_t
(p_symbols)->stats_TimersClean_deprecated = NULL; \
(p_symbols)->__intf_IntfProgressUpdate_deprecated = NULL; \
(p_symbols)->__intf_IntfProgress_deprecated = NULL; \
(p_symbols)->streaming_ChainToPsz_deprecated = NULL; \
(p_symbols)->__input_SecondaryPreparse_deprecated = NULL; \
(p_symbols)->__input_MetaFetch_deprecated = NULL; \
(p_symbols)->input_DownloadAndCacheArt_deprecated = NULL; \
......
......@@ -21,7 +21,8 @@ TOUI = \
ui/sprefs_playlist \
ui/sprefs_subtitles \
ui/sprefs_video \
ui/streampanel
ui/streampanel \
ui/sout
UIH = $(TOUI:%=%.h)
......@@ -38,6 +39,7 @@ TOMOC = main_interface \
dialogs/streaminfo \
dialogs/extended \
dialogs/interaction \
dialogs/sout \
components/extended_panels \
components/infopanels \
components/preferences_widgets \
......@@ -64,6 +66,7 @@ nodist_SOURCES_qt4 = \
dialogs/errors.moc.cpp \
dialogs/prefs_dialog.moc.cpp \
dialogs/interaction.moc.cpp \
dialogs/sout.moc.cpp \
components/extended_panels.moc.cpp \
components/infopanels.moc.cpp \
components/preferences_widgets.moc.cpp \
......@@ -110,6 +113,7 @@ SOURCES_qt4 = qt4.cpp \
dialogs/messages.cpp \
dialogs/errors.cpp \
dialogs/interaction.cpp \
dialogs/sout.cpp \
components/extended_panels.cpp \
components/infopanels.cpp \
components/preferences_widgets.cpp \
......@@ -138,6 +142,7 @@ EXTRA_DIST += \
dialogs/errors.hpp \
dialogs/prefs_dialog.hpp \
dialogs/interaction.hpp \
dialogs/sout.hpp \
components/extended_panels.hpp \
components/infopanels.hpp \
components/preferences_widgets.hpp \
......@@ -161,6 +166,7 @@ EXTRA_DIST += \
ui/sprefs_subtitles.ui \
ui/sprefs_video.ui \
ui/streampanel.ui \
ui/sout.ui \
pixmaps/advanced.xpm \
pixmaps/audio.xpm \
pixmaps/codec.xpm \
......
/*****************************************************************************
* sout.cpp : Stream output dialog (old-style)
****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id: Errors.cpp 16024 2006-07-13 13:51:05Z xtophe $
*
* Authors: Clément Stenac <zorglub@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.
*****************************************************************************/
#include "dialogs/sout.hpp"
#include "qt4.hpp"
#include <vlc_streaming.h>
#include <QFileDialog>
SoutDialog::SoutDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
setWindowTitle( _("Stream output") );
main = new QWidget( this );
/* UI stuff */
ui.setupUi( main );
#define ADD_VCODEC( name, fcc) ui.vCodec->addItem( name, QVariant( fcc ) );
ADD_VCODEC( "MPEG-1", "mp1v" );
ADD_VCODEC( "MPEG-2", "mp2v" );
ADD_VCODEC( "MPEG-4", "mp4v" );
ADD_VCODEC( "DIVX 1" , "DIV1" );
ADD_VCODEC( "DIVX 2" , "DIV1" );
ADD_VCODEC( "DIVX 3" , "DIV1" );
ADD_VCODEC( "H-263", "H263" );
ADD_VCODEC( "H-264", "h264" );
ADD_VCODEC( "WMV1", "WMV1" );
ADD_VCODEC( "WMV2" , "WMV2" );
ADD_VCODEC( "M-JPEG", "MJPG" );
ADD_VCODEC( "Theora", "theo" );
#define ADD_ACODEC( name, fcc) ui.aCodec->addItem( name, QVariant( fcc ) );
ADD_ACODEC( "MPEG Audio", "mpga" );
ADD_ACODEC( "MP3", "mp3" );
ADD_ACODEC( "MPEG 4 Audio (AAC)", "mp4a");
ADD_ACODEC( "A52/AC3", "a52");
ADD_ACODEC( "Vorbis", "vorb" );
ADD_ACODEC( "Flac", "flac" );
ADD_ACODEC( "Speex", "spx" );
ADD_ACODEC( "WAV", "s16l" );
ui.vScale->addItem( "0.25" );
ui.vScale->addItem( "0.5" );
ui.vScale->addItem( "0.75" );
ui.vScale->addItem( "1" );
ui.vScale->addItem( "1.25" );
ui.vScale->addItem( "1.5" );
ui.vScale->addItem( "1.75" );
ui.vScale->addItem( "2" );
/* Connect everything to the updateMRL function */
#define CB(x) CONNECT( ui.x, clicked(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() );
/* Output */
CB( fileOutput ); CB( HTTPOutput ); CB( localOutput );
CB( UDPOutput ); CB( MMSHOutput ); CB( rawInput );
CT( fileEdit ); CT( HTTPEdit ); CT( UDPEdit ); CT( MMSHEdit );
CS( HTTPPort ); CS( UDPPort ); CS( MMSHPort );
/* Transcode */
CC( vCodec ); CC( sCodec ); CC( aCodec ) ;
CB( transcodeVideo ); CB( transcodeAudio ); CB( transcodeSubs );
CB( sOverlay );
CS( vBitrate ); CS( aBitrate ); CS( aChannels ); CC( vScale );
/* Mux */
CB( PSMux ); CB( TSMux ); CB( MPEG1Mux ); CB( OggMux ); CB( ASFMux );
CB( MP4Mux ); CB( MOVMux ); CB( WAVMux ); CB( RAWMux );
/* Misc */
CB( soutAll ); CS( ttl ); CT( sapName ); CT( sapGroup );
CONNECT( ui.fileSelectButton, clicked(), this, fileBrowse() );
}
void SoutDialog::fileBrowse()
{
QString f = QFileDialog::getOpenFileName( this, qtr("Save file"), "", "" );
ui.fileEdit->setText( f );
updateMRL();
}
void SoutDialog::ok()
{
}
void SoutDialog::cancel()
{
}
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" );
/* 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 );
}
/*****************************************************************************
* sout.hpp : Stream output dialog (old-style, ala WX)
****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id: Errors.hpp 16024 2006-07-13 13:51:05Z xtophe $
*
* Authors: Clément Stenac <zorglub@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. *****************************************************************************/
#ifndef _SOUT_DIALOG_H_
#define _SOUT_DIALOG_H_
#include <vlc/vlc.h>
#include "ui/sout.h"
#include "util/qvlcframe.hpp"
class QPushButton;
class QCheckBox;
class QGridLayout;
class QTextEdit;
class SoutDialog : public QVLCFrame
{
Q_OBJECT;
public:
SoutDialog( intf_thread_t * );
QWidget *main;
private:
Ui::Sout ui;
public slots:
void ok();
void cancel();
void updateMRL();
void fileBrowse();
};
#endif
......@@ -36,6 +36,7 @@
#include "dialogs/streaminfo.hpp"
#include "dialogs/messages.hpp"
#include "dialogs/extended.hpp"
#include "dialogs/sout.hpp"
DialogsProvider* DialogsProvider::instance = NULL;
......@@ -158,6 +159,7 @@ void DialogsProvider::quit()
void DialogsProvider::streaminfoDialog()
{
(new SoutDialog( p_intf ))->show();
StreamInfoDialog::getInstance( p_intf )->toggleVisible();
}
......
<ui version="4.0" >
<class>Sout</class>
<widget class="QWidget" name="Sout" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>630</width>
<height>660</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Outputs</string>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QGridLayout" >
<property name="margin" >
<number>3</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="1" >
<widget class="QLabel" name="fileLabel" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Filename</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="fileOutput" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="text" >
<string>File</string>
</property>
</widget>
</item>
<item row="2" column="4" >
<widget class="QSpinBox" name="HTTPPort" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="maximumSize" >
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="maximum" >
<number>65535</number>
</property>
<property name="minimum" >
<number>1</number>
</property>
<property name="singleStep" >
<number>1</number>
</property>
<property name="value" >
<number>8080</number>
</property>
</widget>
</item>
<item row="1" column="4" >
<widget class="QCheckBox" name="rawInput" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Dump raw input</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLineEdit" name="fileEdit" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="3" >
<widget class="QLabel" name="MMSHPortLabel" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Port</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QLabel" name="MMSHLabel" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Address</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QCheckBox" name="localOutput" >
<property name="text" >
<string>Play locally</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QCheckBox" name="MMSHOutput" >
<property name="text" >
<string>MMSH</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<widget class="QPushButton" name="fileSelectButton" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Browse</string>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QLineEdit" name="HTTPEdit" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLabel" name="HTTPLabel" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Address</string>
</property>
</widget>
</item>
<item row="2" column="3" >
<widget class="QLabel" name="HTTPPortLabel" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Port</string>
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="QLineEdit" name="MMSHEdit" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QCheckBox" name="HTTPOutput" >
<property name="text" >
<string>HTTP</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QCheckBox" name="UDPOutput" >
<property name="text" >
<string>UDP</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QLabel" name="UDPLabel" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Address</string>
</property>
</widget>
</item>
<item row="4" column="3" >
<widget class="QLabel" name="UDPPortLabel" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Port</string>
</property>
</widget>
</item>
<item row="4" column="2" >
<widget class="QLineEdit" name="UDPEdit" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="4" >
<widget class="QSpinBox" name="MMSHPort" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="maximumSize" >
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="maximum" >
<number>65535</number>
</property>
<property name="minimum" >
<number>1</number>
</property>
<property name="value" >
<number>1234</number>
</property>
</widget>
</item>
<item row="4" column="4" >
<widget class="QSpinBox" name="UDPPort" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="maximumSize" >
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="maximum" >
<number>65535</number>
</property>
<property name="minimum" >
<number>1</number>
</property>
<property name="value" >
<number>1234</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="Encapsulation" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Encapsulation</string>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QRadioButton" name="TSMux" >