Music Hub ..
A session-wide music playback service
 
Loading...
Searching...
No Matches
video_sink.cpp
Go to the documentation of this file.
1/*
2 * Copyright © 2021-2022 UBports Foundation.
3 *
4 * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License version 3,
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "video_sink_p.h"
20
21#include "egl_video_sink.h"
22#include "hybris_video_sink.h"
23
24using namespace lomiri::MediaHub;
25
27{
28 Q_OBJECT
29
30public:
32 VideoSink(new VideoSinkPrivate(), parent)
33 {
34 }
35
36 bool swapBuffers() override { return true; }
37};
38
40 QObject(parent),
41 d_ptr(d)
42{
43}
44
45VideoSink::~VideoSink() = default;
46
47const QMatrix4x4 &VideoSink::transformationMatrix() const
48{
49 Q_D(const VideoSink);
50 return d->m_transformationMatrix;
51}
52
54 PlayerKey key,
55 AVBackend::Backend backend)
56{
57 switch (backend) {
59 qDebug() << "Using Hybris video sink";
62 qDebug() << "Using Mir/EGL video sink";
65 qDebug() << "No video backend selected. "
66 "Video rendering functionality won't work.";
67 return [](uint32_t textureId, QObject *parent) {
68 Q_UNUSED(textureId);
69 return new NullVideoSink(parent);
70 };
71 default:
72 qWarning() << "Invalid or no A/V backend specified, "
73 "using \"hybris\" as a default." << backend;
75 }
76}
77
78#include "video_sink.moc"
NullVideoSink(QObject *parent)
bool swapBuffers() override
Releases the current buffer, and consumes the next buffer in the queue, making it available for consu...
static VideoSinkFactory createFactory(PlayerKey playerKey)
static VideoSinkFactory createFactory(PlayerKey playerKey)
A video sink abstracts a queue of buffers, that receives a stream of decoded video buffers from an ar...
Definition video_sink.h:35
const QMatrix4x4 & transformationMatrix() const
Queries the 4x4 transformation matrix for the current frame.
VideoSink(VideoSinkPrivate *d, QObject *parent=nullptr)
VideoSinkFactory createVideoSinkFactory(PlayerKey key, AVBackend::Backend backend)
std::function< VideoSink *(uint32_t textureId, QObject *parent)> VideoSinkFactory