/usr/include/libtomahawk/audio/AudioEngine.h is in libtomahawk-dev 0.8.4+dfsg1-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 | /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
*
* Tomahawk 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 3 of the License, or
* (at your option) any later version.
*
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AUDIOENGINE_H
#define AUDIOENGINE_H
#include "../Typedefs.h"
#include <QStringList>
#include "DllMacro.h"
class AudioEnginePrivate;
class DLLEXPORT AudioEngine : public QObject
{
Q_OBJECT
public:
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError, UnknownError, NoError };
enum AudioState { Stopped = 0, Playing = 1, Paused = 2, Error = 3, Loading = 4 };
enum AudioChannel { LeftChannel, LeftSurroundChannel, RightChannel , RightSurroundChannel, CenterChannel , SubwooferChannel };
static AudioEngine* instance();
explicit AudioEngine();
~AudioEngine();
/**
* List the MIME types we can play.
*
* This list might not include all possible MIME types that can be played.
* If you know that a certain service always returns a specific MIME type
* not reported here, we still might be able to play this media. Please
* check the individual backends why they do not report it and if every
* (recent) version supports this type.
*
* @return A list of playable MIME types.
*/
QStringList supportedMimeTypes() const;
/**
* Reports the current set volume in percent (0-100).
*
* @return Current volume in percent.
*/
unsigned int volume() const;
AudioState state() const;
bool isPlaying() const;
bool isPaused() const;
bool isStopped() const;
bool isMuted() const;
/**
* Returns the PlaylistInterface of the currently playing track.
*
* Note: This might be different to the current playlist!
*/
Tomahawk::playlistinterface_ptr currentTrackPlaylist() const;
/**
* Returns the PlaylistInterface of the current playlist.
*
* Note: The currently playing track might still be from a different
* playlist!
*/
Tomahawk::playlistinterface_ptr playlist() const;
Tomahawk::result_ptr currentTrack() const;
Tomahawk::query_ptr stopAfterTrack() const;
/**
* Get the current position in the media.
*
* As the user might seek forwards and backwards this only returns the
* location in the media, not the actual time that the media was already
* playing.
* @return The current time in milliseconds.
*/
qint64 currentTime() const;
/**
* Returns the total duration of the currently playing track.
*
* For some media this time might only be an estimate as metadate might
* not have reported a duration and thus the duration is estimated. During
* playback we might get a better estimate so that the return value may
* differ between multiple calls.
*
* @return The total duration in milliseconds.
*/
qint64 currentTrackTotalTime() const;
int equalizerBandCount();
bool setEqualizerBand( int band, int value );
public slots:
void playPause();
void play();
void pause();
void stop( AudioErrorCode errorCode = NoError );
bool activateDataOutput();
bool deactivateDataOutput();
void previous();
void next();
bool canGoPrevious();
bool canGoNext();
bool canSeek();
void seek( qint64 ms );
void seek( int ms ); // for compatibility with seekbar in audiocontrols
void setVolume( int percentage );
void lowerVolume();
void raiseVolume();
void mute();
void toggleMute();
void play( const QUrl& url );
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result, const Tomahawk::query_ptr& fromQuery = Tomahawk::query_ptr() );
void playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query );
void playItem( const Tomahawk::artist_ptr& artist );
void playItem( const Tomahawk::album_ptr& album );
void playPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlist );
void setPlaylist( Tomahawk::playlistinterface_ptr playlist );
void setQueue( const Tomahawk::playlistinterface_ptr& queue );
void setStopAfterTrack( const Tomahawk::query_ptr& query );
void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode );
void setShuffled( bool enabled );
signals:
void loading( const Tomahawk::result_ptr track );
void started( const Tomahawk::result_ptr track );
void finished( const Tomahawk::result_ptr track );
void stopped();
void paused();
void resumed();
void audioDataReady( QMap< AudioEngine::AudioChannel, QVector<qint16> > data );
void stopAfterTrackChanged();
void seeked( qint64 ms );
void shuffleModeChanged( bool enabled );
void repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode mode );
void controlStateChanged();
void stateChanged( AudioState newState, AudioState oldState );
void volumeChanged( int volume /* in percent */ );
void mutedChanged( bool muted );
void timerMilliSeconds( qint64 msElapsed );
void timerSeconds( unsigned int secondsElapsed );
void timerPercentage( unsigned int percentage );
void playlistChanged( Tomahawk::playlistinterface_ptr playlist );
void currentTrackPlaylistChanged( Tomahawk::playlistinterface_ptr playlist );
void error( AudioEngine::AudioErrorCode errorCode );
private slots:
void loadTrack( const Tomahawk::result_ptr& result ); //async!
void performLoadIODevice( const Tomahawk::result_ptr& result, const QString& url ); //only call from loadTrack kthxbi
void performLoadTrack( const Tomahawk::result_ptr result, const QString url, QSharedPointer< QIODevice > io ); //only call from loadTrack or performLoadIODevice kthxbi
void loadPreviousTrack();
void loadNextTrack();
void onAboutToFinish();
void onVolumeChanged( qreal volume );
void timerTriggered( qint64 time );
void setCurrentTrack( const Tomahawk::result_ptr& result );
void onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type );
void onPlaylistNextTrackAvailable();
void sendNowPlayingNotification( const Tomahawk::InfoSystem::InfoType type );
void sendWaitingNotification() const;
private:
void setState( AudioState state );
void setCurrentTrackPlaylist( const Tomahawk::playlistinterface_ptr& playlist );
void initEqualizer();
void audioDataArrived( QMap< AudioEngine::AudioChannel, QVector< qint16 > >& data );
Q_DECLARE_PRIVATE( AudioEngine )
AudioEnginePrivate* d_ptr;
};
#endif // AUDIOENGINE_H
|