Commit 6644a0aa authored by Michael Pyne's avatar Michael Pyne

Fix scratchy/choppy playback in phonon-gstreamer, refactor playback.

The simplifications needed for PlayerManager have the sideeffect of
removing crossfade support for now (but that hasn't worked since KDE
3...).

Despite the churn to PlayerManager, the actual problem causing poor
playback was that the position slider was syncing its GUI update
straight back into PlayerManager::seek.  This affected phonon-vlc less
for some reason but either way the output is now bearable :) :)
parent b9830e9e
......@@ -230,10 +230,6 @@ void JuK::setupActions()
act->setText(i18n("Remove From Playlist"));
act->setIcon(QIcon::fromTheme( QLatin1String( "list-remove" )));
act = collection->add<KToggleAction>("crossfadeTracks");
act->setText(i18n("Crossfade Between Tracks"));
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(setCrossfadeEnabled(bool)));
act = collection->addAction("play", m_player, SLOT(play()));
act->setText(i18n("&Play"));
act->setIcon(QIcon::fromTheme( QLatin1String( "media-playback-start" )));
......@@ -415,8 +411,8 @@ void JuK::readConfig()
const int volume = playerConfig.readEntry("Volume", maxVolume);
m_player->setVolume(volume * 0.01);
bool enableCrossfade = playerConfig.readEntry("CrossfadeTracks", true);
m_player->setCrossfadeEnabled(enableCrossfade);
//bool enableCrossfade = playerConfig.readEntry("CrossfadeTracks", true);
//m_player->setCrossfadeEnabled(enableCrossfade);
//ActionCollection::action<QAction>("crossfadeTracks")->setChecked(enableCrossfade);
}
......@@ -463,8 +459,7 @@ void JuK::saveConfig()
QAction *a = ActionCollection::action<QAction>("loopPlaylist");
playerConfig.writeEntry("LoopPlaylist", a->isChecked());
a = ActionCollection::action<QAction>("crossfadeTracks");
playerConfig.writeEntry("CrossfadeTracks", a->isChecked());
playerConfig.writeEntry("CrossfadeTracks", false); // TODO bring back
a = ActionCollection::action<QAction>("albumRandomPlay");
if(a->isChecked())
......
<!DOCTYPE kpartgui>
<kpartgui name="juk" version="13">
<kpartgui name="juk" version="14">
<MenuBar>
<Menu name="file" noMerge="1"><text>&amp;File</text>
<Action name="file_new"/>
......@@ -40,7 +40,6 @@
<Action name="actionMenu"/>
<Action name="loopPlaylist"/>
<Action name="crossfadeTracks"/>
<Separator/>
......
<!-- PLEASE UPDATE jukui-rtl.rc WHEN UPDATING THIS FILE -->
<!DOCTYPE kpartgui>
<kpartgui name="juk" version="13">
<kpartgui name="juk" version="14">
<MenuBar>
<Menu name="file" noMerge="1"><text>&amp;File</text>
<Action name="file_new"/>
......@@ -42,7 +42,6 @@
<Action name="actionMenu"/>
<Action name="loopPlaylist"/>
<Action name="crossfadeTracks"/>
<Separator/>
......
This diff is collapsed.
......@@ -16,8 +16,8 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLAYERMANAGER_H
#define PLAYERMANAGER_H
#ifndef JUK_PLAYERMANAGER_H
#define JUK_PLAYERMANAGER_H
#include <QObject>
......@@ -26,7 +26,6 @@
#include <Phonon/Global>
#include <Phonon/Path>
class KSelectAction;
class StatusLabel;
class PlaylistInterface;
class QPixmap;
......@@ -35,7 +34,6 @@ namespace Phonon
{
class AudioOutput;
class MediaObject;
class VolumeFaderEffect;
}
/**
......@@ -49,7 +47,6 @@ class PlayerManager : public QObject
public:
PlayerManager();
virtual ~PlayerManager();
bool playing() const;
bool paused() const;
......@@ -76,8 +73,6 @@ public:
FileHandle playingFile() const;
QString playingString() const;
KSelectAction* outputDeviceSelectAction();
void setPlaylistInterface(PlaylistInterface *interface);
void setStatusLabel(StatusLabel *label);
......@@ -103,7 +98,6 @@ public slots:
bool mute();
void setRandomPlayMode(const QString &randomMode);
void setCrossfadeEnabled(bool enableCrossfade);
signals:
void tick(int time);
......@@ -120,17 +114,12 @@ signals:
private:
void setup();
void crossfadeToFile(const FileHandle &newFile);
void stopCrossfade();
private slots:
void slotNeedNextUrl();
void slotFinished();
void slotLength(qint64);
void slotTick(qint64);
void slotStateChanged(Phonon::State, Phonon::State);
/// Updates the GUI to reflect stopped playback if we're stopped at this point.
void slotUpdateGuiIfStopped();
void slotSeekableChanged(bool);
void slotMutedChanged(bool);
void slotVolumeChanged(qreal);
......@@ -141,15 +130,12 @@ private:
StatusLabel *m_statusLabel;
bool m_muted;
bool m_setup;
bool m_crossfadeTracks;
static const int m_pollInterval = 800;
int m_curOutputPath; ///< Either 0 or 1 depending on which output path is in use.
Phonon::AudioOutput *m_output[2];
Phonon::Path m_audioPath[2];
Phonon::MediaObject *m_media[2];
Phonon::VolumeFaderEffect *m_fader[2];
Phonon::AudioOutput *m_output;
Phonon::Path m_audioPath;
Phonon::MediaObject *m_media;
};
#endif
......
......@@ -54,7 +54,7 @@ QWidget *TrackPositionAction::createWidget(QWidget *parent)
slider->setToolTip(seekable ? QString() : noSeekMsg);
});
connect(player, &PlayerManager::totalTimeChanged, slider, &Slider::setMaximum);
connect(slider, &Slider::valueChanged, player, &PlayerManager::seek);
connect(slider, &Slider::sliderReleased, player, &PlayerManager::seek);
return slider;
}
......
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