mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-01-17 14:28:24 +01:00
Merge pull request #572 from tomahawk-player/vlcargs
Allow specifying additional VLC cmdnline args in advanced settings
This commit is contained in:
commit
84360aed2f
@ -1764,3 +1764,15 @@ TomahawkSettings::setPlaydarKey( const QByteArray& key )
|
||||
setValue( "playdar/key", key );
|
||||
}
|
||||
|
||||
QString
|
||||
TomahawkSettings::vlcArguments() const
|
||||
{
|
||||
return value( "vlc/cmdline_args" ).value< QString >();
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkSettings::setVlcArguments( const QString& args )
|
||||
{
|
||||
setValue( "vlc/cmdline_args", args);
|
||||
}
|
||||
|
||||
|
@ -253,6 +253,10 @@ public:
|
||||
QByteArray playdarKey() const;
|
||||
void setPlaydarKey( const QByteArray& key );
|
||||
|
||||
// VLC Settings
|
||||
QString vlcArguments() const;
|
||||
void setVlcArguments( const QString& arguments );
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
void recentlyPlayedPlaylistAdded( const QString& playlistId, int sourceId );
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "AudioEngine.h"
|
||||
#include "AudioOutput.h"
|
||||
#include "TomahawkVersion.h"
|
||||
#include "TomahawkSettings.h"
|
||||
|
||||
#include "audio/MediaStream.h"
|
||||
#include "utils/Logger.h"
|
||||
@ -39,6 +40,8 @@
|
||||
#include <vlc/libvlc_media_player.h>
|
||||
#include <vlc/libvlc_version.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
AudioOutput* AudioOutput::s_instance = 0;
|
||||
|
||||
|
||||
@ -72,7 +75,7 @@ AudioOutput::AudioOutput( QObject* parent )
|
||||
|
||||
qRegisterMetaType<AudioOutput::AudioState>("AudioOutput::AudioState");
|
||||
|
||||
const char* vlcArgs[] = {
|
||||
QVector<const char*> vlcArgs = {
|
||||
"--ignore-config",
|
||||
"--extraintf=logger",
|
||||
qApp->arguments().contains( "--verbose" ) ? "--verbose=3" : "",
|
||||
@ -84,11 +87,28 @@ AudioOutput::AudioOutput( QObject* parent )
|
||||
// "--no-snapshot-preview",
|
||||
// "--services-discovery=''",
|
||||
"--no-video",
|
||||
//"--network-caching=10000",
|
||||
//"--file-caching=10000",
|
||||
//"--clock-synchro=0",
|
||||
//"--cr-average=10000",
|
||||
//"--clock-jitter=1",
|
||||
"--no-xlib"
|
||||
};
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
//Save a list of Latin1 byte arrays for additional args
|
||||
auto additionalVlcArgs = s->vlcArguments().split(",");
|
||||
QVector<QByteArray> additionalArgsChar;
|
||||
|
||||
std::transform(additionalVlcArgs.begin(), additionalVlcArgs.end(),
|
||||
std::back_inserter(additionalArgsChar), [](QString str) { return str.toLatin1(); });
|
||||
|
||||
for (auto&& str : additionalArgsChar)
|
||||
{
|
||||
vlcArgs.append(str.constData());
|
||||
}
|
||||
|
||||
// Create and initialize a libvlc instance (it should be done only once)
|
||||
m_vlcInstance = libvlc_new( sizeof(vlcArgs) / sizeof(*vlcArgs), vlcArgs );
|
||||
m_vlcInstance = libvlc_new( vlcArgs.size(), vlcArgs.constData() );
|
||||
if ( !m_vlcInstance )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "libVLC: could not initialize";
|
||||
|
@ -126,6 +126,8 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
m_advancedWidgetUi->enableProxyCheckBox->setChecked( useProxy );
|
||||
m_advancedWidgetUi->proxyButton->setEnabled( useProxy );
|
||||
|
||||
m_advancedWidgetUi->vlcArgsLineEdit->setText( s->vlcArguments() );
|
||||
|
||||
m_advancedWidgetUi->aclEntryClearButton->setEnabled( TomahawkSettings::instance()->aclEntries().size() > 0 );
|
||||
connect( m_advancedWidgetUi->aclEntryClearButton, SIGNAL( clicked( bool ) ), this, SLOT( aclEntryClearButtonClicked() ) );
|
||||
|
||||
@ -335,6 +337,9 @@ SettingsDialog::saveSettings()
|
||||
s->applyChanges();
|
||||
s->sync();
|
||||
|
||||
m_restartRequired = m_restartRequired || m_advancedWidgetUi->vlcArgsLineEdit->text() != s->vlcArguments();
|
||||
s->setVlcArguments( m_advancedWidgetUi->vlcArgsLineEdit->text() );
|
||||
|
||||
if ( m_restartRequired )
|
||||
QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until %applicationName is restarted" ) );
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>515</width>
|
||||
<height>475</height>
|
||||
<width>540</width>
|
||||
<height>520</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -250,6 +250,36 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="vlcGroupBox">
|
||||
<property name="title">
|
||||
<string>VLC settings</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Additional command line arguments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>(separate with comma)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="vlcArgsLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
|
Loading…
x
Reference in New Issue
Block a user