File indexing completed on 2024-12-01 04:21:26
0001 /* 0002 Copyright (C) 2013 Harald Sitter <sitter@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Lesser General Public 0006 License as published by the Free Software Foundation; either 0007 version 2.1 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Lesser General Public License for more details. 0013 0014 You should have received a copy of the GNU Lesser General Public 0015 License along with this library. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 #ifndef PHONON_VLC_SINKNODE_H 0019 #define PHONON_VLC_SINKNODE_H 0020 0021 #include <QPointer> 0022 0023 namespace Phonon { 0024 namespace VLC { 0025 0026 class Media; 0027 class MediaObject; 0028 class MediaPlayer; 0029 0030 /** \brief The sink node is essentially an output for a media object 0031 * 0032 * This class handles connections for the sink to a media object. It remembers 0033 * the media object and the libVLC media player associated with it. 0034 * 0035 * \see MediaObject 0036 */ 0037 class SinkNode 0038 { 0039 public: 0040 SinkNode(); 0041 virtual ~SinkNode(); 0042 0043 /** 0044 * Associates the sink node to the provided media object. The m_mediaObject and m_vlcPlayer 0045 * attributes are set, and the sink is added to the media object's sinks. 0046 * 0047 * \param mediaObject The media object to connect to. 0048 * 0049 * \see disconnectFromMediaObject() 0050 */ 0051 void connectToMediaObject(MediaObject *mediaObject); 0052 0053 /** 0054 * Removes this sink from the specified media object's sinks. 0055 * 0056 * \param mediaObject The media object to disconnect from 0057 * 0058 * \see connectToMediaObject() 0059 */ 0060 void disconnectFromMediaObject(MediaObject *mediaObject); 0061 0062 /** 0063 * Does nothing. To be reimplemented in child classes. 0064 */ 0065 void addToMedia(Media *media); 0066 0067 protected: 0068 /** 0069 * Handling function for derived classes. 0070 * \note This handle is executed *after* the global handle. 0071 * Meaning the SinkNode base will be done handling the connect. 0072 * \see connectToMediaObject 0073 */ 0074 virtual void handleConnectToMediaObject(MediaObject *mediaObject) { Q_UNUSED(mediaObject); } 0075 0076 /** 0077 * Handling function for derived classes. 0078 * \note This handle is executed *before* the global handle. 0079 * Meaning the SinkNode base will continue handling the disconnect. 0080 * \see disconnectFromMediaObject 0081 */ 0082 virtual void handleDisconnectFromMediaObject(MediaObject *mediaObject) { Q_UNUSED(mediaObject); } 0083 0084 /** 0085 * Handling function for derived classes. 0086 * \note This handle is executed *after* the global handle. 0087 * Meaning the SinkNode base will be done handling the connect. 0088 * \see addToMedia 0089 */ 0090 virtual void handleAddToMedia(Media *media) { Q_UNUSED(media); } 0091 0092 /** Available while connected to a MediaObject (until disconnected) */ 0093 QPointer<MediaObject> m_mediaObject; 0094 0095 /** Available while connected to a MediaObject (until disconnected) */ 0096 MediaPlayer *m_player; 0097 }; 0098 0099 } // namespace VLC 0100 } // namespace Phonon 0101 0102 #endif // PHONON_VLC_SINKNODE_H