You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kaffeine/kaffeine/src/player-parts/libmpv-part/libmpv_part.h

153 lines
3.9 KiB

/*
* Kaffeine libmpv part
* Copyright (C) 2023 Mavridis Philippe <mavridisf@gmail.com>
*
* Based on Kaffeine dummy part
* Copyright (C) 2004-2005 Jürgen Kofler <kaffeine@gmx.net>
*
* 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 __LIBMPVPART_H__
#define __LIBMPVPART_H__
// TQt
#include <tqwidget.h>
// TDE
#include <tdeparts/factory.h>
// Kaffeine
#include "kaffeinepart.h"
// libmpv
#include <mpv/client.h>
class TQLabel;
class TQSlider;
class TQPopupMenu;
class TQPushButton;
class TDEToggleAction;
class MpvEventThread;
class MpvContainerWidget;
/**
* MpvPart -- A KaffeinePart which uses libmpv as backend
* @author Mavridis Philippe <mavridisf@gmail.com>
*
*/
class MpvPart : public KaffeinePart
{
TQ_OBJECT
friend class MpvEventThread;
friend class MpvContainerWidget;
public:
MpvPart(TQWidget*, const char*, TQObject*, const char*, const TQStringList&);
virtual ~MpvPart();
/*
* Reimplement from KaffeinePart
*/
uint volume() const; /* percent */
uint position() const; /* percent */
bool isPlaying();
bool isPaused();
bool isMute();
bool isStream();
bool isSeekable();
bool closeURL();
static TDEAboutData* createAboutData();
void showError(TQString text, TQString caption);
void showDetailedError(TQString text, TQString details, TQString caption);
public slots:
/*
* Reimplement from KaffeinePart
*/
bool openURL(const MRL& mrl);
void slotPlay();
void slotPause(bool pause);
void slotTogglePause();
void slotStop();
void slotMute();
void slotSetVolume(uint); /* percent */
void slotPrevious();
void slotNext();
void slotSetPosition(uint); /* percent */
void slotToggleRecording();
void startRecording();
void stopRecording();
void slotSetRecordingFile();
void slotAddSubtitles();
void slotReloadSubtitles();
void showContextMenu();
void hideContextMenu();
signals:
void mpvEvents();
protected:
mpv_handle *m_mpv;
MRL m_mrl;
private slots:
void slotStartSeeking();
void slotStopSeeking();
void slotSetSeekingPos(int pos);
void slotContextSetSubtitles(int choice);
// Overloaded method with "int" argument
// Used in connection with m_volume::sliderMoved(int)
void slotSetVolume(int vol) { slotSetVolume(static_cast<uint>(vol)); }
private:
bool initMpv();
void initActions();
void resetTime();
void customEvent(TQCustomEvent *event);
void updateRecordFileLabel();
private:
TDEToggleAction *m_recordAction;
TQWidget *m_player;
MpvEventThread *m_eventThread;
TQSlider *m_position;
TQSlider *m_volume;
TQPushButton *m_playtime;
TQLabel *m_recordFile;
TQPopupMenu *m_context;
TQPopupMenu *m_subs;
TQValueList<MRL> m_playlist;
uint m_current;
TQTime m_time;
uint m_percent;
bool m_seeking;
TQString m_recordFilePath;
};
#endif /* __LIBMPVPART_H__ */