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();
}
......
This diff is collapsed.
......@@ -418,7 +418,8 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
return i_total;
error:
msg_Err( p_this, "Read error: %s", net_strerror (net_errno) );
if( errno != EINTR )
msg_Err( p_this, "Read error: %s", net_strerror (net_errno) );
return i_total ? (ssize_t)i_total : -1;
}
......
......@@ -89,14 +89,14 @@ sout_transcode_t *streaming_ChainAddTranscode( sout_chain_t *p_chain,
DECMALLOC_NULL( p_module, sout_module_t );
MALLOC_NULL( TRAM, sout_transcode_t );
p_module->i_type = SOUT_MOD_TRANSCODE;
memset( TRAM, 0, sizeof( sout_transcode_t ) );
assert( !( b_soverlay && psz_scodec ) );
if( psz_vcodec ) TRAM->psz_vcodec = strdup( psz_vcodec );
if( psz_acodec ) TRAM->psz_acodec = strdup( psz_acodec );
if( psz_scodec ) TRAM->psz_scodec = strdup( psz_scodec );
TRAM->i_vb = i_vb; TRAM->i_ab = i_ab; TRAM->f_scale = f_scale;
TRAM->i_channels = i_channels; TRAM->b_soverlay = b_soverlay;
if( TRAM->psz_additional ) TRAM->psz_additional = strdup( psz_additional );
if( psz_additional ) TRAM->psz_additional = strdup( psz_additional );
TAB_APPEND( p_chain->i_modules, p_chain->pp_modules, p_module );
return TRAM;
}
......@@ -353,7 +353,7 @@ vlc_bool_t streaming_ChainToGuiDesc( vlc_object_t *p_this,
}
#define HANDLE_GUI_URL( type, access ) if( pd->b_##type ) { \
streaming_DupAddChild( p_dup ); \
if( p_dup ) streaming_DupAddChild( p_dup ); \
if( pd->i_##type > 0 ) \
{ \
char *psz_url; \
......@@ -379,6 +379,7 @@ void streaming_GuiDescToChain( vlc_object_t *p_obj, sout_chain_t *p_chain,
/* Transcode */
if( pd->psz_vcodec || pd->psz_acodec || pd->psz_scodec || pd->b_soverlay )
{
fprintf( stderr, "382 vcodec %s\n", pd->psz_vcodec );
streaming_ChainAddTranscode( p_chain, pd->psz_vcodec, pd->psz_acodec,
pd->psz_scodec, pd->i_vb, pd->f_scale,
pd->i_ab, pd->i_channels,
......@@ -392,19 +393,19 @@ void streaming_GuiDescToChain( vlc_object_t *p_obj, sout_chain_t *p_chain,
}
if( pd->b_local )
{
streaming_DupAddChild( p_dup );
streaming_ChainAddDisplay( DUP_OR_CHAIN );
if( p_dup ) streaming_DupAddChild( p_dup );
streaming_ChainAddDisplay( DUP_OR_CHAIN );
}
if( pd->b_file )
{
streaming_DupAddChild( p_dup );
if( p_dup ) streaming_DupAddChild( p_dup );
streaming_ChainAddStd( DUP_OR_CHAIN, "file", pd->psz_mux,
pd->psz_file );
}
if( pd->b_udp )
{
sout_std_t *p_std;
streaming_DupAddChild( p_dup );
if( p_dup ) streaming_DupAddChild( p_dup );
if( pd->i_udp > 0 )
{
char *psz_url;
......@@ -434,17 +435,30 @@ void streaming_GuiDescToChain( vlc_object_t *p_obj, sout_chain_t *p_chain,
/**********************************************************************
* Create a sout string from a chain
**********************************************************************/
char * streaming_ChainToPsz( sout_chain_t *p_chain )
static char * ChainToPsz( sout_chain_t *p_chain, vlc_bool_t b_root )
{
int i;
int i, j;
char psz_output[MAX_CHAIN];
char psz_temp[MAX_CHAIN];
sprintf( psz_output, "#" );
if( b_root ) sprintf( psz_output, "#" );
else sprintf( psz_output, "" );
for( i = 0 ; i< p_chain->i_modules; i++ )
{
sout_module_t *p_module = p_chain->pp_modules[i];
switch( p_module->i_type )
{
case SOUT_MOD_DUPLICATE:
CHAIN_APPEND( "duplicate{" );
for( j = 0 ; j < DUPM->i_children ; j ++ )
{
char *psz_child = ChainToPsz( DUPM->pp_children[j], VLC_FALSE);
fprintf(stderr, "child %s\n", psz_child);
CHAIN_APPEND( "dst=%s", psz_child );
free( psz_child );
if( j != DUPM->i_children - 1 ) CHAIN_APPEND( "," );
}
CHAIN_APPEND( "}" );
break;
case SOUT_MOD_TRANSCODE:
CHAIN_APPEND( "transcode{" );
if( TRAM->psz_vcodec )
......@@ -476,10 +490,16 @@ char * streaming_ChainToPsz( sout_chain_t *p_chain )
CHAIN_APPEND( "std{access=%s,url=%s,mux=%s}", STDM->psz_access,
STDM->psz_url, STDM->psz_mux );
}
if( i != p_chain->i_modules - 1 ) CHAIN_APPEND( ":" );
}
return strdup( psz_output );
}
char * streaming_ChainToPsz( sout_chain_t *p_chain )
{
return ChainToPsz( p_chain, VLC_TRUE );
}
/**********************************************************************
* Handle streaming profiles
**********************************************************************/
......
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