[vlc-devel] [PATCH v2 3/3] Deinterlace can be associated with codec arguments
Jérôme Froissart
software at froissart.eu
Thu Oct 17 17:11:26 CEST 2019
Previously, one could not convert a video into a video with both:
* deinterlace checked (in the Convert dialog)
* custom options (in "Profile edition" dialog, "Video codec" tab)
This was due to incorrectly handled braces in a SoutMrl.
This patch requires to make VLCProfileSelector::getTranscode() return a SoutMrl instead of a plain QString, which eases the handling of the Mrl
---
.../qt/components/sout/profile_selector.cpp | 78 +++++++++----------
.../qt/components/sout/profile_selector.hpp | 5 +-
modules/gui/qt/dialogs/convert.cpp | 37 ++++++---
modules/gui/qt/dialogs/sout.cpp | 4 +-
4 files changed, 66 insertions(+), 58 deletions(-)
diff --git a/modules/gui/qt/components/sout/profile_selector.cpp b/modules/gui/qt/components/sout/profile_selector.cpp
index 55fc5c9c28..36867bc91b 100644
--- a/modules/gui/qt/components/sout/profile_selector.cpp
+++ b/modules/gui/qt/components/sout/profile_selector.cpp
@@ -203,7 +203,7 @@ void VLCProfileSelector::updateOptions( int i )
if ( rx.indexIn( options ) != -1 )
return updateOptionsOldFormat( i );
- transcode = "";
+ transcode.clear();
QStringList tuples = options.split( ";" );
typedef QHash<QString, QString> proptovalueHashType;
@@ -242,8 +242,7 @@ void VLCProfileSelector::updateOptions( int i )
}\
else value = QString()
- SoutMrl smrl;
- smrl.begin( "transcode" );
+ transcode.begin( "transcode" );
/* First muxer options */
HASHPICK( "muxer", "mux" );
@@ -257,19 +256,19 @@ void VLCProfileSelector::updateOptions( int i )
if ( !value.isEmpty() )
{
- smrl.option( "vcodec", value );
+ transcode.option( "vcodec", value );
HASHPICK( "vcodec", "bitrate" );
if ( value.toInt() > 0 )
{
- smrl.option( "vb", value.toInt() );
+ transcode.option( "vb", value.toInt() );
}
HASHPICK( "video", "filters" );
if ( !value.isEmpty() )
{
QStringList valuesList = QUrl::fromPercentEncoding( value.toLatin1() ).split( ";" );
- smrl.option( "vfilter", valuesList.join( ":" ) );
+ transcode.option( "vfilter", valuesList.join( ":" ) );
}
/*if ( codec is h264 )*/
@@ -286,28 +285,28 @@ void VLCProfileSelector::updateOptions( int i )
codecoptions << QUrl::fromPercentEncoding( value.toLatin1() );
if ( codecoptions.count() )
- smrl.option( "venc",
+ transcode.option( "venc",
QString("x264{%1}").arg( codecoptions.join(",") ) );
}
HASHPICK( "vcodec", "framerate" );
if ( !value.isEmpty() && value.toInt() > 0 )
- smrl.option( "fps", value );
+ transcode.option( "fps", value );
HASHPICK( "vcodec", "scale" );
if ( !value.isEmpty() )
- smrl.option( "scale", value );
+ transcode.option( "scale", value );
HASHPICK( "vcodec", "width" );
if ( !value.isEmpty() && value.toInt() > 0 )
- smrl.option( "width", value );
+ transcode.option( "width", value );
HASHPICK( "vcodec", "height" );
if ( !value.isEmpty() && value.toInt() > 0 )
- smrl.option( "height", value );
+ transcode.option( "height", value );
}
} else {
- smrl.option( "vcodec", "none" );
+ transcode.option( "vcodec", "none" );
}
HASHPICK( "audio", "enable" );
@@ -316,27 +315,27 @@ void VLCProfileSelector::updateOptions( int i )
HASHPICK( "audio", "codec" );
if ( !value.isEmpty() )
{
- smrl.option( "acodec", value );
+ transcode.option( "acodec", value );
HASHPICK( "acodec", "bitrate" );
- smrl.option( "ab", value.toInt() );
+ transcode.option( "ab", value.toInt() );
HASHPICK( "acodec", "channels" );
- smrl.option( "channels", value.toInt() );
+ transcode.option( "channels", value.toInt() );
HASHPICK( "acodec", "samplerate" );
- smrl.option( "samplerate", value.toInt() );
+ transcode.option( "samplerate", value.toInt() );
HASHPICK( "audio", "filters" );
if ( !value.isEmpty() )
{
QStringList valuesList = QUrl::fromPercentEncoding( value.toLatin1() ).split( ";" );
- smrl.option( "afilter", valuesList.join( ":" ) );
+ transcode.option( "afilter", valuesList.join( ":" ) );
}
}
} else {
- smrl.option( "acodec", "none" );
+ transcode.option( "acodec", "none" );
}
HASHPICK( "subtitles", "enable" );
@@ -346,20 +345,18 @@ void VLCProfileSelector::updateOptions( int i )
if ( value.isEmpty() )
{
HASHPICK( "subtitles", "codec" );
- smrl.option( "scodec", value );
+ transcode.option( "scodec", value );
}
else
{
- smrl.option( "soverlay" );
+ transcode.option( "soverlay" );
}
} else {
- smrl.option( "scodec", "none" );
+ transcode.option( "scodec", "none" );
}
- smrl.end();
+ transcode.end();
#undef HASHPICK
- transcode = smrl.getMrl();
-
cleanup:
/* Temp hash tables cleanup */
foreach( proptovalueHashType *hash, categtopropHash )
@@ -376,52 +373,49 @@ void VLCProfileSelector::updateOptionsOldFormat( int i )
mux = options[0];
- SoutMrl smrl;
if( options[1].toInt() || options[2].toInt() || options[3].toInt() )
{
- smrl.begin( "transcode" );
+ transcode.begin( "transcode" );
if( options[1].toInt() )
{
- smrl.option( "vcodec", options[4] );
+ transcode.option( "vcodec", options[4] );
if( options[4] != "none" )
{
- smrl.option( "vb", options[5].toInt() );
+ transcode.option( "vb", options[5].toInt() );
if( !options[7].isEmpty() && options[7].toInt() > 0 )
- smrl.option( "fps", options[7] );
+ transcode.option( "fps", options[7] );
if( !options[6].isEmpty() )
- smrl.option( "scale", options[6] );
+ transcode.option( "scale", options[6] );
if( !options[8].isEmpty() && options[8].toInt() > 0 )
- smrl.option( "width", options[8].toInt() );
+ transcode.option( "width", options[8].toInt() );
if( !options[9].isEmpty() && options[9].toInt() > 0 )
- smrl.option( "height", options[9].toInt() );
+ transcode.option( "height", options[9].toInt() );
}
}
if( options[2].toInt() )
{
- smrl.option( "acodec", options[10] );
+ transcode.option( "acodec", options[10] );
if( options[10] != "none" )
{
- smrl.option( "ab", options[11].toInt() );
- smrl.option( "channels", options[12].toInt() );
- smrl.option( "samplerate", options[13].toInt() );
+ transcode.option( "ab", options[11].toInt() );
+ transcode.option( "channels", options[12].toInt() );
+ transcode.option( "samplerate", options[13].toInt() );
}
}
if( options[3].toInt() )
{
- smrl.option( "scodec", options[14] );
+ transcode.option( "scodec", options[14] );
if( options[15].toInt() )
- smrl.option( "soverlay" );
+ transcode.option( "soverlay" );
}
- smrl.end();
-
- transcode = smrl.getMrl();
+ transcode.end();
}
else
- transcode = "";
+ transcode.clear();
emit optionsChanged();
}
diff --git a/modules/gui/qt/components/sout/profile_selector.hpp b/modules/gui/qt/components/sout/profile_selector.hpp
index 1074c7b220..61d3502eb7 100644
--- a/modules/gui/qt/components/sout/profile_selector.hpp
+++ b/modules/gui/qt/components/sout/profile_selector.hpp
@@ -30,6 +30,7 @@
#include <QHash>
#include "util/qvlcframe.hpp"
+#include "util/soutmrl.hpp"
#include "ui_profiles.h"
class QComboBox;
@@ -42,14 +43,14 @@ public:
VLCProfileSelector( QWidget *_parent );
~VLCProfileSelector();
QString getMux() { return mux; }
- QString getTranscode() { return transcode; }
+ SoutMrl getTranscode() { return transcode; }
private:
QComboBox *profileBox;
void fillProfilesCombo();
void editProfile( const QString&, const QString& );
void saveProfiles();
QString mux;
- QString transcode;
+ SoutMrl transcode;
private slots:
void newProfile();
void editProfile();
diff --git a/modules/gui/qt/dialogs/convert.cpp b/modules/gui/qt/dialogs/convert.cpp
index cf157472b6..332da28c70 100644
--- a/modules/gui/qt/dialogs/convert.cpp
+++ b/modules/gui/qt/dialogs/convert.cpp
@@ -176,21 +176,20 @@ void ConvertDialog::close()
for(int i = 0; i < incomingMRLs->length(); i++)
{
- QString mrl;
+ SoutMrl mrl;
if( dumpRadio->isChecked() )
{
- mrl = "demux=dump :demuxdump-file=" + fileLine->text();
+ mrl.header("demux=dump :demuxdump-file=" + fileLine->text());
}
else
{
- mrl = "sout=#" + profile->getTranscode();
+ mrl = profile->getTranscode();
+ mrl.header( "sout=#" + mrl.getHeader() );
if( deinterBox->isChecked() )
{
- mrl.remove( '}' );
- mrl += ",deinterlace}";
+ mrl.option("deinterlace");
}
- mrl += ":";
QString newFileName;
@@ -229,15 +228,29 @@ void ConvertDialog::close()
newFileName.replace( QChar('\''), "\\\'" );
- QString chain = QString("std{access=file{no-overwrite},mux=%1,dst='%2'}")
- .arg( profile->getMux() ).arg( newFileName );
+
+ mrl.end();
+ MrlModule dstModule("std");
+ MrlModule file("file");
+ file.option("no-overwrite");
+ dstModule.option("access", file);
+ dstModule.option("mux", profile->getMux());
+ dstModule.option("dst", "'" + newFileName + "'");
+
if( displayBox->isChecked() )
- mrl += QString( "duplicate{dst=display,dst=%1}" ).arg( chain );
+ {
+ MrlModule duplicate("duplicate");
+ duplicate.option("dst", "display");
+ duplicate.option("dst", dstModule);
+ mrl.module(duplicate);
+ }
else
- mrl += chain;
+ {
+ mrl.module(dstModule);
+ }
}
- msg_Dbg( p_intf, "Transcode MRL: %s", qtu( mrl ) );
- mrls.append(mrl);
+ msg_Dbg( p_intf, "Transcode MRL: %s", qtu( mrl.getMrl() ) );
+ mrls.append(mrl.getMrl());
}
accept();
}
diff --git a/modules/gui/qt/dialogs/sout.cpp b/modules/gui/qt/dialogs/sout.cpp
index bbcc308d63..3dd764e418 100644
--- a/modules/gui/qt/dialogs/sout.cpp
+++ b/modules/gui/qt/dialogs/sout.cpp
@@ -179,9 +179,9 @@ void SoutDialog::updateMRL()
QString qs_mux = ui.profileSelect->getMux();
SoutMrl smrl( ":sout=#" );
- if( !ui.profileSelect->getTranscode().isEmpty() && ui.transcodeBox->isChecked() )
+ if( !ui.profileSelect->getTranscode().getMrl().isEmpty() && ui.transcodeBox->isChecked() )
{
- smrl.begin( ui.profileSelect->getTranscode() );
+ smrl.begin( ui.profileSelect->getTranscode().getMrl() );
smrl.end();
}
--
2.20.1
More information about the vlc-devel
mailing list