| 1 | /* |
| 2 | Copyright (C) 2012 Harald Sitter <sitter@kde.org> |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | This library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #ifndef Phonon_VLC_VIDEODATAOUTPUT_H |
| 19 | #define Phonon_VLC_VIDEODATAOUTPUT_H |
| 20 | |
| 21 | #include <QMutex> |
| 22 | #include <QObject> |
| 23 | |
| 24 | #include <phonon/experimental/videodataoutputinterface.h> |
| 25 | #include <phonon/experimental/videoframe2.h> |
| 26 | |
| 27 | #include "sinknode.h" |
| 28 | #include "videomemorystream.h" |
| 29 | |
| 30 | namespace Phonon |
| 31 | { |
| 32 | namespace VLC |
| 33 | { |
| 34 | |
| 35 | /** |
| 36 | * @author Harald Sitter <apachelogger@ubuntu.com> |
| 37 | */ |
| 38 | class VideoDataOutput : public QObject, public SinkNode, |
| 39 | public Experimental::VideoDataOutputInterface, private VideoMemoryStream |
| 40 | { |
| 41 | Q_OBJECT |
| 42 | Q_INTERFACES(Phonon::Experimental::VideoDataOutputInterface) |
| 43 | public: |
| 44 | explicit VideoDataOutput(QObject *parent); |
| 45 | ~VideoDataOutput(); |
| 46 | |
| 47 | void handleConnectToMediaObject(MediaObject *mediaObject) override; |
| 48 | void handleDisconnectFromMediaObject(MediaObject *mediaObject) override; |
| 49 | void handleAddToMedia(Media *media) override; |
| 50 | |
| 51 | Experimental::AbstractVideoDataOutput *frontendObject() const override; |
| 52 | void setFrontendObject(Experimental::AbstractVideoDataOutput *frontend) override; |
| 53 | |
| 54 | void *lockCallback(void **planes) override; |
| 55 | void unlockCallback(void *picture,void *const *planes) override; |
| 56 | void displayCallback(void *picture) override; |
| 57 | |
| 58 | unsigned formatCallback(char *chroma, |
| 59 | unsigned *width, unsigned *height, |
| 60 | unsigned *pitches, |
| 61 | unsigned *lines) override; |
| 62 | void formatCleanUpCallback() override; |
| 63 | |
| 64 | private: |
| 65 | Experimental::AbstractVideoDataOutput *m_frontend; |
| 66 | Experimental::VideoFrame2 m_frame; |
| 67 | QByteArray m_buffer; |
| 68 | QMutex m_mutex; |
| 69 | }; |
| 70 | |
| 71 | } // namespace VLC |
| 72 | } // namespace Phonon |
| 73 | |
| 74 | #endif // PHONON_VLC_VIDEODATAOUTPUT_H |
| 75 | |