Music Hub ..
A session-wide music playback service
hybris_gl_sink.h
Go to the documentation of this file.
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */
18#ifndef CORE_UBUNTU_MEDIA_VIDEO_HYBRIS_GL_SINK_H_
19#define CORE_UBUNTU_MEDIA_VIDEO_HYBRIS_GL_SINK_H_
20
22
23#include <core/media/player.h>
24
25#include <functional>
26
27namespace core
28{
29namespace ubuntu
30{
31namespace media
32{
33namespace video
34{
36{
37public:
38 // Returns a factory functor that allows for creating actual sink instances.
39 static std::function<video::Sink::Ptr(std::uint32_t)> factory_for_key(const media::Player::PlayerKey&);
40
41 // Need this to avoid std::unique_ptr complaining about forward-declared Private.
43
44 // The signal is emitted whenever a new frame is available and a subsequent
45 // call to swap_buffers will not block and return true.
46 const core::Signal<void>& frame_available() const override;
47
48 // Queries the transformation matrix for the current frame, placing the data into 'matrix'
49 // and returns true or returns false and leaves 'matrix' unchanged in case
50 // of issues.
51 bool transformation_matrix(float* matrix) const override;
52
53 // Releases the current buffer, and consumes the next buffer in the queue,
54 // making it available for consumption by consumers of this API in an
55 // implementation-specific way. Clients will usually rely on a GL texture
56 // to receive the latest buffer.
57 bool swap_buffers() const override;
58
59private:
60 // Creates a new instance for the given gl texture, connecting to the remote part known
61 // under the given key or throw in case of issues.
62 HybrisGlSink(std::uint32_t gl_texture);
63
64 struct Private;
65 std::unique_ptr<Private> d;
66};
67}
68}
69}
70}
71
72#endif // CORE_UBUNTU_MEDIA_VIDEO_HYBRIS_GL_SINK_H_
bool transformation_matrix(float *matrix) const override
Queries the 4x4 transformation matrix for the current frame, placing the data into 'matrix'.
const core::Signal< void > & frame_available() const override
The signal is emitted whenever a new frame is available and a subsequent call to swap_buffers will no...
bool swap_buffers() const override
Releases the current buffer, and consumes the next buffer in the queue, making it available for consu...
static std::function< video::Sink::Ptr(std::uint32_t)> factory_for_key(const media::Player::PlayerKey &)
Definition: player.h:34
A video sink abstracts a queue of buffers, that receives a stream of decoded video buffers from an ar...
Definition: sink.h:37
std::shared_ptr< Sink > Ptr
To save us some typing.
Definition: sink.h:39