/usr/include/KF5/KMediaPlayer/kmediaplayer/player.h is in libkf5mediaplayer-dev 5.44.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | // Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Except as contained in this notice, the name(s) of the author(s) shall not be
// used in advertising or otherwise to promote the sale, use or other dealings
// in this Software without prior written authorization from the author(s).
#ifndef KMEDIAPLAYERPLAYER_H
#define KMEDIAPLAYERPLAYER_H
#include <kparts/readonlypart.h>
#include "view.h"
#include "kmediaplayer_export.h"
/**
* An interface for media playback parts.
*/
namespace KMediaPlayer
{
/**
* KPart interface to allow controlling and querying playback of a media track.
*
* This class provides methods to control playback of a single media track, as
* well as providing information on the current playback state. It can
* optionally provide access to a user interface that can be displayed to the
* user.
*
* There are two servicetypes for this KParts interface: KMediaPlayer/Player
* and KMediaPlayer/Engine. KMediaPlayer/Player provides a user interface (see
* view()), while KMediaPlayer/Engine just provides direct control via this
* class.
*/
class KMEDIAPLAYER_EXPORT Player : public KParts::ReadOnlyPart
{
Q_OBJECT
Q_ENUMS(State)
/**
* Whether the length property is valid.
*
* Not all media tracks have a length (for example, some streams are
* continuous).
*/
Q_PROPERTY(bool hasLength READ hasLength)
/**
* The length of the media track in milliseconds.
*
* The value is undefined if hasLength is @c false.
*/
Q_PROPERTY(qlonglong length READ length)
/**
* Whether playback should loop.
*
* As this interface has no concept of a playlist, this indicates
* whether the current media track will play repeatedly.
*/
Q_PROPERTY(bool looping READ isLooping WRITE setLooping)
/**
* The position in the media track in milliseconds.
*/
Q_PROPERTY(qlonglong position READ position)
/**
* Whether seek() can be expected to work on the current media track.
*
* Some streams cannot be seeked.
*/
Q_PROPERTY(bool seekable READ isSeekable)
/**
* The current state of the player.
*/
Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
public:
/**
* Constructs a Player instance with no associated GUI.
*
* This should be used when a KMediaPlayer/Engine is requested.
*/
explicit Player(QObject *parent);
/**
* Constructs a Player instance with a GUI.
*
* This should be used when a KMediaPlayer/Player is requested.
*/
Player(QWidget *parentWidget, const char *widgetName, QObject *parent);
/**
* Cleans up any associated resources.
*
* This should not explicitly delete any widget returned by view(): if it
* has been reparented, it is up to the caller to dispose of it properly.
*/
virtual ~Player();
/**
* Returns the widget associated with this player.
*
* If the part's service type is KMediaPlayer/Player, this should not return
* 0. However, if the part's service is just KMediaPlayer/Engine, this may
* return 0.
*
* @returns A widget to view and control this Player instance, or 0 if
* there is no GUI.
*/
virtual View *view() = 0;
public Q_SLOTS:
/**
* Pauses playback of the media track.
*
* If the media track is not already paused, this should have no effect.
*/
virtual void pause() = 0;
/**
* Starts playing the media track.
*
* If the media track is already playing, this should have no effect.
*/
virtual void play() = 0;
/**
* Stops playback of the media track and returns it to the beginning.
*/
virtual void stop() = 0;
/**
* Moves the current playback position.
*
* This will have no effect if isSeekable() is @c false.
*
* @param msec The new playback position in milliseconds.
*/
virtual void seek(qlonglong msec) = 0;
public:
/**
* Returns whether seek() can be expected to work on the current media
* track.
*/
virtual bool isSeekable() const = 0;
/**
* Returns the current playback position in milliseconds.
*/
virtual qlonglong position() const = 0;
/**
* Returns whether the current media track has a length.
*/
virtual bool hasLength() const = 0;
/**
* Returns the length of the current media track.
*
* The returned value is undefined if hasLength() returns @c false.
*/
virtual qlonglong length() const = 0;
public Q_SLOTS:
/**
* Sets whether playback should loop.
*
* @param on If @c true, playback will resume from the start of the
* track when the end is reached; if @c false it will not.
*/
void setLooping(bool on);
public:
/**
* Returns whether playback will loop.
*/
bool isLooping() const;
Q_SIGNALS:
/**
* Indicates that the value of isLooping() has changed.
*
* @param isLooping The new value.
*/
void loopingChanged(bool isLooping);
public:
/**
* The possible states of the player.
*/
enum State {
/**
* No track is loaded.
*
* Most functions will not work in this state.
*/
Empty,
/**
* A track is loaded, but playback is stopped.
*
* The position should always be 0 in this state. Playback will start
* from the beginning when play() is called.
*/
Stop,
/**
* Playback is temporarily suspended.
*
* Playback will resume from the current position when play() is called.
*/
Pause,
/**
* The media is currently being output.
*/
Play
};
/**
* Returns the current state of the player.
*/
State state() const;
Q_SIGNALS:
/**
* Indicates that the value returned by state() has changed.
*
* @param newState The new value.
*/
void stateChanged(KMediaPlayer::Player::State newState);
protected Q_SLOTS:
/**
* Sets the current state.
*
* This allows implementors to alter the playback state. This will emit the
* stateChanged() signal as appropriate.
*/
void setState(State state);
protected:
/* Enable the stateChanged(QString&, ...) method that was hidden by
the stateChanged(State) signal */
using KXMLGUIClient::stateChanged;
private:
class Private;
Private *d;
};
}
Q_DECLARE_METATYPE(KMediaPlayer::Player::State)
#endif
|