mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 20:00:13 +02:00
Merge pull request #572 from tomahawk-player/vlcargs
Allow specifying additional VLC cmdnline args in advanced settings
This commit is contained in:
@@ -1764,3 +1764,15 @@ TomahawkSettings::setPlaydarKey( const QByteArray& key )
|
|||||||
setValue( "playdar/key", 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;
|
QByteArray playdarKey() const;
|
||||||
void setPlaydarKey( const QByteArray& key );
|
void setPlaydarKey( const QByteArray& key );
|
||||||
|
|
||||||
|
// VLC Settings
|
||||||
|
QString vlcArguments() const;
|
||||||
|
void setVlcArguments( const QString& arguments );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
void recentlyPlayedPlaylistAdded( const QString& playlistId, int sourceId );
|
void recentlyPlayedPlaylistAdded( const QString& playlistId, int sourceId );
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include "AudioEngine.h"
|
#include "AudioEngine.h"
|
||||||
#include "AudioOutput.h"
|
#include "AudioOutput.h"
|
||||||
#include "TomahawkVersion.h"
|
#include "TomahawkVersion.h"
|
||||||
|
#include "TomahawkSettings.h"
|
||||||
|
|
||||||
#include "audio/MediaStream.h"
|
#include "audio/MediaStream.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
@@ -39,6 +40,8 @@
|
|||||||
#include <vlc/libvlc_media_player.h>
|
#include <vlc/libvlc_media_player.h>
|
||||||
#include <vlc/libvlc_version.h>
|
#include <vlc/libvlc_version.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
AudioOutput* AudioOutput::s_instance = 0;
|
AudioOutput* AudioOutput::s_instance = 0;
|
||||||
|
|
||||||
|
|
||||||
@@ -72,7 +75,7 @@ AudioOutput::AudioOutput( QObject* parent )
|
|||||||
|
|
||||||
qRegisterMetaType<AudioOutput::AudioState>("AudioOutput::AudioState");
|
qRegisterMetaType<AudioOutput::AudioState>("AudioOutput::AudioState");
|
||||||
|
|
||||||
const char* vlcArgs[] = {
|
QVector<const char*> vlcArgs = {
|
||||||
"--ignore-config",
|
"--ignore-config",
|
||||||
"--extraintf=logger",
|
"--extraintf=logger",
|
||||||
qApp->arguments().contains( "--verbose" ) ? "--verbose=3" : "",
|
qApp->arguments().contains( "--verbose" ) ? "--verbose=3" : "",
|
||||||
@@ -84,11 +87,28 @@ AudioOutput::AudioOutput( QObject* parent )
|
|||||||
// "--no-snapshot-preview",
|
// "--no-snapshot-preview",
|
||||||
// "--services-discovery=''",
|
// "--services-discovery=''",
|
||||||
"--no-video",
|
"--no-video",
|
||||||
|
//"--network-caching=10000",
|
||||||
|
//"--file-caching=10000",
|
||||||
|
//"--clock-synchro=0",
|
||||||
|
//"--cr-average=10000",
|
||||||
|
//"--clock-jitter=1",
|
||||||
"--no-xlib"
|
"--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)
|
// 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 )
|
if ( !m_vlcInstance )
|
||||||
{
|
{
|
||||||
tDebug() << Q_FUNC_INFO << "libVLC: could not initialize";
|
tDebug() << Q_FUNC_INFO << "libVLC: could not initialize";
|
||||||
|
@@ -126,6 +126,8 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
|||||||
m_advancedWidgetUi->enableProxyCheckBox->setChecked( useProxy );
|
m_advancedWidgetUi->enableProxyCheckBox->setChecked( useProxy );
|
||||||
m_advancedWidgetUi->proxyButton->setEnabled( useProxy );
|
m_advancedWidgetUi->proxyButton->setEnabled( useProxy );
|
||||||
|
|
||||||
|
m_advancedWidgetUi->vlcArgsLineEdit->setText( s->vlcArguments() );
|
||||||
|
|
||||||
m_advancedWidgetUi->aclEntryClearButton->setEnabled( TomahawkSettings::instance()->aclEntries().size() > 0 );
|
m_advancedWidgetUi->aclEntryClearButton->setEnabled( TomahawkSettings::instance()->aclEntries().size() > 0 );
|
||||||
connect( m_advancedWidgetUi->aclEntryClearButton, SIGNAL( clicked( bool ) ), this, SLOT( aclEntryClearButtonClicked() ) );
|
connect( m_advancedWidgetUi->aclEntryClearButton, SIGNAL( clicked( bool ) ), this, SLOT( aclEntryClearButtonClicked() ) );
|
||||||
|
|
||||||
@@ -335,6 +337,9 @@ SettingsDialog::saveSettings()
|
|||||||
s->applyChanges();
|
s->applyChanges();
|
||||||
s->sync();
|
s->sync();
|
||||||
|
|
||||||
|
m_restartRequired = m_restartRequired || m_advancedWidgetUi->vlcArgsLineEdit->text() != s->vlcArguments();
|
||||||
|
s->setVlcArguments( m_advancedWidgetUi->vlcArgsLineEdit->text() );
|
||||||
|
|
||||||
if ( m_restartRequired )
|
if ( m_restartRequired )
|
||||||
QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until %applicationName is restarted" ) );
|
QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until %applicationName is restarted" ) );
|
||||||
|
|
||||||
|
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>515</width>
|
<width>540</width>
|
||||||
<height>475</height>
|
<height>520</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -250,6 +250,36 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<spacer name="verticalSpacer_4">
|
<spacer name="verticalSpacer_4">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
Reference in New Issue
Block a user