Merge lp:~thomas-voss/media-hub/introduce-video-sink-interface into lp:media-hub
- introduce-video-sink-interface
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Ricardo Mendoza |
Approved revision: | 109 |
Merged at revision: | 114 |
Proposed branch: | lp:~thomas-voss/media-hub/introduce-video-sink-interface |
Merge into: | lp:media-hub |
Diff against target: |
970 lines (+480/-142) 19 files modified
CMakeLists.txt (+3/-1) debian/changelog (+6/-0) debian/control (+4/-4) debian/libmedia-hub-common3.symbols (+1/-1) include/core/media/player.h (+12/-10) include/core/media/video/sink.h (+76/-0) src/core/media/CMakeLists.txt (+10/-1) src/core/media/engine.h (+3/-1) src/core/media/mpris/player.h (+11/-0) src/core/media/player.cpp (+5/-0) src/core/media/player_implementation.cpp (+6/-23) src/core/media/player_implementation.h (+2/-4) src/core/media/player_skeleton.cpp (+23/-3) src/core/media/player_stub.cpp (+16/-89) src/core/media/player_stub.h (+2/-5) src/core/media/video/hybris_gl_sink.cpp (+116/-0) src/core/media/video/hybris_gl_sink.h (+72/-0) src/core/media/video/platform_default_sink.cpp (+68/-0) src/core/media/video/platform_default_sink.h (+44/-0) |
To merge this branch: | bzr merge lp:~thomas-voss/media-hub/introduce-video-sink-interface |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Jim Hodapp (community) | code | Approve | |
Review via email:
|
Commit message
Refactor client-facing interfaces to pull out explicit dependency on hybris-based media layer.
Introduce interface media::video::Sink, and expose it in interfaces
Adjust implementation to account for interface changes.
Introduce an implementation of media::video::Sink relying on Hybris.
Description of the change
Refactor client-facing interfaces to pull out explicit dependency on hybris-based media layer.
Introduce interface media::video::Sink, and expose it in interfaces
Adjust implementation to account for interface changes.
Introduce an implementation of media::video::Sink relying on Hybris.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
- 100. By Thomas Voß
-
Adjust debian/*.install and debian/*.symbols to account for major version bump.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:100
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jim Hodapp (jhodapp) wrote : | # |
Looks good, just 1 inline comment below. Also, make sure to rebase with trunk changes. This would be the very first MR I'd like to see get put into a silo so that I can test it well. This is a nice limited-scope MR but still is important. I want to try to avoid having to test all of the MRs combined in one silo, but instead would like to incrementally test one or 2 MRs at a time and land, then test 1 or two more and land, etc.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Thomas Voß (thomas-voss) wrote : | # |
> Looks good, just 1 inline comment below. Also, make sure to rebase with trunk
> changes.
They should be up to date, and the train takes care of remerging with trunk.
> This would be the very first MR I'd like to see get put into a silo
> so that I can test it well. This is a nice limited-scope MR but still is
> important. I want to try to avoid having to test all of the MRs combined in
> one silo, but instead would like to incrementally test one or 2 MRs at a time
> and land, then test 1 or two more and land, etc.
Well, I wonder if we could at least group together the introduce-MRs into one silo and collectively test them to avoid retesting the same thing over and over again.
- 101. By Thomas Voß
-
Adjust comment according to review.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:101
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 102. By Thomas Voß
-
[ Jim Hodapp ]
* Resubmitting with prerequisite branch (LP: #1331041)
[ Justin McPherson ]
* Resubmitting with prerequisite branch (LP: #1331041)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:102
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 103. By Thomas Voß
-
Adjust major version in CMake setup.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:103
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 104. By Thomas Voß
-
Default to Hybris based implemenations.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:104
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 105. By Thomas Voß
-
[ Jim Hodapp ]
* Error reporting all the way up to the app level from the playbin
pipeline.
[ Ubuntu daily release ]
* New rebuild forced
[ Jim Hodapp ]
* Don't auto-resume playback of videos after a phone call ends. (LP:
#1411273)
[ Ubuntu daily release ]
* New rebuild forced
[ Ricardo Salveti de Araujo ]
* service_implementation: adding debug for call started/ended signals.
Make sure account and connection are available when setting up
account manager (patch from Gustavo Boiko). call_monitor: don't
check caps when hooking up on/off signals, until bug 1409125 is
fixed. Enable parallel building . (LP: #1409125)
[ Jim Hodapp ]
* Pause playback when recording begins. (LP: #1398047)
[ Ricardo Salveti de Araujo ]
* call_monitor.cpp: waiting for bridge to be up, and also protecting
the on_change call (LP: #1408137)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:105
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 106. By Thomas Voß
-
Fix FTBFS.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:106
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 107. By Thomas Voß
-
Funnel creation of video::Sink instances via a factory to allow for early initialization
tasks that should/have to be carried out as soon as the player's identity on the service
side is established and the respective key is known.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:107
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 108. By Thomas Voß
-
* debian/control:
- Removing pre-depends that are not required
- Bumping standards-version to 3.9.6
[ Ricardo Salveti de Araujo ]
* Migrating tests to use ogg instead of mp3/avi removed:
tests/h264.avi tests/test.mp3 added: tests/test-audio-1. ogg
tests/test-video. ogg tests/test.mp3 renamed: tests/test.ogg =>
tests/test-audio. ogg - 109. By Thomas Voß
-
Remove Pre-Depends as trunk suggests.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:109
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2014-11-13 23:50:01 +0000 | |||
3 | +++ CMakeLists.txt 2015-03-12 11:38:55 +0000 | |||
4 | @@ -2,7 +2,7 @@ | |||
5 | 2 | 2 | ||
6 | 3 | project(ubuntu-media-hub) | 3 | project(ubuntu-media-hub) |
7 | 4 | 4 | ||
9 | 5 | set(UBUNTU_MEDIA_HUB_VERSION_MAJOR 2) | 5 | set(UBUNTU_MEDIA_HUB_VERSION_MAJOR 3) |
10 | 6 | set(UBUNTU_MEDIA_HUB_VERSION_MINOR 0) | 6 | set(UBUNTU_MEDIA_HUB_VERSION_MINOR 0) |
11 | 7 | set(UBUNTU_MEDIA_HUB_VERSION_PATCH 0) | 7 | set(UBUNTU_MEDIA_HUB_VERSION_PATCH 0) |
12 | 8 | 8 | ||
13 | @@ -30,6 +30,8 @@ | |||
14 | 30 | pkg_check_modules(GIO gio-2.0 REQUIRED) | 30 | pkg_check_modules(GIO gio-2.0 REQUIRED) |
15 | 31 | pkg_check_modules(HYBRIS_MEDIA libmedia REQUIRED) | 31 | pkg_check_modules(HYBRIS_MEDIA libmedia REQUIRED) |
16 | 32 | 32 | ||
17 | 33 | add_definitions(-DMEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER) | ||
18 | 34 | |||
19 | 33 | ##################################################################### | 35 | ##################################################################### |
20 | 34 | # Enable code coverage calculation with gcov/gcovr/lcov | 36 | # Enable code coverage calculation with gcov/gcovr/lcov |
21 | 35 | # Usage: | 37 | # Usage: |
22 | 36 | 38 | ||
23 | === modified file 'debian/changelog' | |||
24 | --- debian/changelog 2015-03-12 03:06:40 +0000 | |||
25 | +++ debian/changelog 2015-03-12 11:38:55 +0000 | |||
26 | @@ -1,3 +1,9 @@ | |||
27 | 1 | media-hub (3.0.0) UNRELEASED; urgency=medium | ||
28 | 2 | |||
29 | 3 | * Refactor client-facing interfaces to pull out explicit dependency on hybris-based media layer. | ||
30 | 4 | |||
31 | 5 | -- Thomas Voss <thomas.voss@canonical.com> Tue, 11 Nov 2014 17:15:52 +0100 | ||
32 | 6 | |||
33 | 1 | media-hub (2.0.0+15.04.20150303-0ubuntu2) vivid; urgency=medium | 7 | media-hub (2.0.0+15.04.20150303-0ubuntu2) vivid; urgency=medium |
34 | 2 | 8 | ||
35 | 3 | * debian/control: | 9 | * debian/control: |
36 | 4 | 10 | ||
37 | === modified file 'debian/control' | |||
38 | --- debian/control 2015-03-12 03:06:29 +0000 | |||
39 | +++ debian/control 2015-03-12 11:38:55 +0000 | |||
40 | @@ -39,8 +39,8 @@ | |||
41 | 39 | Section: libdevel | 39 | Section: libdevel |
42 | 40 | Architecture: any | 40 | Architecture: any |
43 | 41 | Multi-Arch: same | 41 | Multi-Arch: same |
46 | 42 | Depends: libmedia-hub-common2 (= ${binary:Version}), | 42 | Depends: libmedia-hub-common3 (= ${binary:Version}), |
47 | 43 | libmedia-hub-client2 (= ${binary:Version}), | 43 | libmedia-hub-client3 (= ${binary:Version}), |
48 | 44 | ${misc:Depends}, | 44 | ${misc:Depends}, |
49 | 45 | libproperties-cpp-dev, | 45 | libproperties-cpp-dev, |
50 | 46 | Suggests: libmedia-hub-doc | 46 | Suggests: libmedia-hub-doc |
51 | @@ -61,7 +61,7 @@ | |||
52 | 61 | . | 61 | . |
53 | 62 | This package contains the runtime. | 62 | This package contains the runtime. |
54 | 63 | 63 | ||
56 | 64 | Package: libmedia-hub-common2 | 64 | Package: libmedia-hub-common3 |
57 | 65 | Architecture: any | 65 | Architecture: any |
58 | 66 | Multi-Arch: same | 66 | Multi-Arch: same |
59 | 67 | Depends: ${misc:Depends}, | 67 | Depends: ${misc:Depends}, |
60 | @@ -72,7 +72,7 @@ | |||
61 | 72 | . | 72 | . |
62 | 73 | This package contains the common libraries. | 73 | This package contains the common libraries. |
63 | 74 | 74 | ||
65 | 75 | Package: libmedia-hub-client2 | 75 | Package: libmedia-hub-client3 |
66 | 76 | Architecture: any | 76 | Architecture: any |
67 | 77 | Multi-Arch: same | 77 | Multi-Arch: same |
68 | 78 | Depends: ${misc:Depends}, | 78 | Depends: ${misc:Depends}, |
69 | 79 | 79 | ||
70 | === renamed file 'debian/libmedia-hub-client2.install' => 'debian/libmedia-hub-client3.install' | |||
71 | === renamed file 'debian/libmedia-hub-common2.install' => 'debian/libmedia-hub-common3.install' | |||
72 | === renamed file 'debian/libmedia-hub-common2.symbols' => 'debian/libmedia-hub-common3.symbols' | |||
73 | --- debian/libmedia-hub-common2.symbols 2014-09-10 21:11:00 +0000 | |||
74 | +++ debian/libmedia-hub-common3.symbols 2015-03-12 11:38:55 +0000 | |||
75 | @@ -1,2 +1,2 @@ | |||
77 | 1 | libmedia-hub-common.so.2 libmedia-hub-common2 #MINVER# | 1 | libmedia-hub-common.so.3 libmedia-hub-common3 #MINVER# |
78 | 2 | (c++)"core::ubuntu::media::the_session_bus()@Base" 2.0.0+14.10.20140910.2 | 2 | (c++)"core::ubuntu::media::the_session_bus()@Base" 2.0.0+14.10.20140910.2 |
79 | 3 | 3 | ||
80 | === modified file 'include/core/media/player.h' | |||
81 | --- include/core/media/player.h 2015-01-19 21:48:01 +0000 | |||
82 | +++ include/core/media/player.h 2015-03-12 11:38:55 +0000 | |||
83 | @@ -20,6 +20,7 @@ | |||
84 | 20 | #define CORE_UBUNTU_MEDIA_PLAYER_H_ | 20 | #define CORE_UBUNTU_MEDIA_PLAYER_H_ |
85 | 21 | 21 | ||
86 | 22 | #include <core/media/track.h> | 22 | #include <core/media/track.h> |
87 | 23 | #include <core/media/video/sink.h> | ||
88 | 23 | 24 | ||
89 | 24 | #include <core/property.h> | 25 | #include <core/property.h> |
90 | 25 | 26 | ||
91 | @@ -44,10 +45,15 @@ | |||
92 | 44 | typedef void* GLConsumerWrapperHybris; | 45 | typedef void* GLConsumerWrapperHybris; |
93 | 45 | typedef std::map<std::string, std::string> HeadersType; | 46 | typedef std::map<std::string, std::string> HeadersType; |
94 | 46 | 47 | ||
99 | 47 | /** Used to set a callback function to be called when a frame is ready to be rendered **/ | 48 | struct Errors |
100 | 48 | typedef void (*FrameAvailableCbHybris)(GLConsumerWrapperHybris wrapper, void *context); | 49 | { |
101 | 49 | typedef void (*FrameAvailableCb)(void *context); | 50 | Errors() = delete; |
102 | 50 | typedef void (*PlaybackCompleteCb)(void *context); | 51 | |
103 | 52 | struct OutOfProcessBufferStreamingNotSupported : public std::runtime_error | ||
104 | 53 | { | ||
105 | 54 | OutOfProcessBufferStreamingNotSupported(); | ||
106 | 55 | }; | ||
107 | 56 | }; | ||
108 | 51 | 57 | ||
109 | 52 | struct Configuration; | 58 | struct Configuration; |
110 | 53 | 59 | ||
111 | @@ -120,10 +126,10 @@ | |||
112 | 120 | virtual std::shared_ptr<TrackList> track_list() = 0; | 126 | virtual std::shared_ptr<TrackList> track_list() = 0; |
113 | 121 | virtual PlayerKey key() const = 0; | 127 | virtual PlayerKey key() const = 0; |
114 | 122 | 128 | ||
115 | 129 | virtual video::Sink::Ptr create_gl_texture_video_sink(std::uint32_t texture_id) = 0; | ||
116 | 130 | |||
117 | 123 | virtual bool open_uri(const Track::UriType& uri) = 0; | 131 | virtual bool open_uri(const Track::UriType& uri) = 0; |
118 | 124 | virtual bool open_uri(const Track::UriType& uri, const HeadersType&) = 0; | 132 | virtual bool open_uri(const Track::UriType& uri, const HeadersType&) = 0; |
119 | 125 | virtual void create_video_sink(uint32_t texture_id) = 0; | ||
120 | 126 | virtual GLConsumerWrapperHybris gl_consumer() const = 0; | ||
121 | 127 | virtual void next() = 0; | 133 | virtual void next() = 0; |
122 | 128 | virtual void previous() = 0; | 134 | virtual void previous() = 0; |
123 | 129 | virtual void play() = 0; | 135 | virtual void play() = 0; |
124 | @@ -131,10 +137,6 @@ | |||
125 | 131 | virtual void stop() = 0; | 137 | virtual void stop() = 0; |
126 | 132 | virtual void seek_to(const std::chrono::microseconds& offset) = 0; | 138 | virtual void seek_to(const std::chrono::microseconds& offset) = 0; |
127 | 133 | 139 | ||
128 | 134 | // TODO: Convert this to be a signal | ||
129 | 135 | virtual void set_frame_available_callback(FrameAvailableCb cb, void *context) = 0; | ||
130 | 136 | virtual void set_playback_complete_callback(PlaybackCompleteCb cb, void *context) = 0; | ||
131 | 137 | |||
132 | 138 | virtual const core::Property<bool>& can_play() const = 0; | 140 | virtual const core::Property<bool>& can_play() const = 0; |
133 | 139 | virtual const core::Property<bool>& can_pause() const = 0; | 141 | virtual const core::Property<bool>& can_pause() const = 0; |
134 | 140 | virtual const core::Property<bool>& can_seek() const = 0; | 142 | virtual const core::Property<bool>& can_seek() const = 0; |
135 | 141 | 143 | ||
136 | === added directory 'include/core/media/video' | |||
137 | === added file 'include/core/media/video/sink.h' | |||
138 | --- include/core/media/video/sink.h 1970-01-01 00:00:00 +0000 | |||
139 | +++ include/core/media/video/sink.h 2015-03-12 11:38:55 +0000 | |||
140 | @@ -0,0 +1,76 @@ | |||
141 | 1 | /* | ||
142 | 2 | * Copyright © 2014 Canonical Ltd. | ||
143 | 3 | * | ||
144 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
145 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
146 | 6 | * as published by the Free Software Foundation. | ||
147 | 7 | * | ||
148 | 8 | * This program is distributed in the hope that it will be useful, | ||
149 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
150 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
151 | 11 | * GNU Lesser General Public License for more details. | ||
152 | 12 | * | ||
153 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
154 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
155 | 15 | * | ||
156 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | ||
157 | 17 | */ | ||
158 | 18 | #ifndef CORE_UBUNTU_MEDIA_VIDEO_SINK_H_ | ||
159 | 19 | #define CORE_UBUNTU_MEDIA_VIDEO_SINK_H_ | ||
160 | 20 | |||
161 | 21 | #include <core/signal.h> | ||
162 | 22 | |||
163 | 23 | #include <memory> | ||
164 | 24 | |||
165 | 25 | namespace core | ||
166 | 26 | { | ||
167 | 27 | namespace ubuntu | ||
168 | 28 | { | ||
169 | 29 | namespace media | ||
170 | 30 | { | ||
171 | 31 | namespace video | ||
172 | 32 | { | ||
173 | 33 | /** @brief A video sink abstracts a queue of buffers, that receives | ||
174 | 34 | * a stream of decoded video buffers from an arbitrary source. | ||
175 | 35 | */ | ||
176 | 36 | struct Sink | ||
177 | 37 | { | ||
178 | 38 | /** @brief To save us some typing. */ | ||
179 | 39 | typedef std::shared_ptr<Sink> Ptr; | ||
180 | 40 | |||
181 | 41 | /** @cond */ | ||
182 | 42 | Sink() = default; | ||
183 | 43 | Sink(const Sink&) = delete; | ||
184 | 44 | virtual ~Sink() = default; | ||
185 | 45 | |||
186 | 46 | Sink& operator=(const Sink&) = delete; | ||
187 | 47 | /** @endcond */ | ||
188 | 48 | |||
189 | 49 | /** | ||
190 | 50 | * @brief The signal is emitted whenever a new frame is available and a subsequent | ||
191 | 51 | * call to swap_buffers will not block and return true. | ||
192 | 52 | */ | ||
193 | 53 | virtual const core::Signal<void>& frame_available() const = 0; | ||
194 | 54 | |||
195 | 55 | /** | ||
196 | 56 | * @brief Queries the 4x4 transformation matrix for the current frame, placing the data into 'matrix'. | ||
197 | 57 | * @param matrix [out] The destination array representing the matrix in column-major format. | ||
198 | 58 | * We expect at least 4*4 float elements in the array. | ||
199 | 59 | * @returns true iff the data has been set. Returns false and leaves 'matrix' unchanged in case of issues. | ||
200 | 60 | */ | ||
201 | 61 | virtual bool transformation_matrix(float* matrix) const = 0; | ||
202 | 62 | |||
203 | 63 | /** | ||
204 | 64 | * @brief Releases the current buffer, and consumes the next buffer in the queue, | ||
205 | 65 | * making it available for consumption by consumers of this API in an | ||
206 | 66 | * implementation-specific way. Clients will usually rely on a GL texture | ||
207 | 67 | * to receive the latest buffer. | ||
208 | 68 | */ | ||
209 | 69 | virtual bool swap_buffers() const = 0; | ||
210 | 70 | }; | ||
211 | 71 | } | ||
212 | 72 | } | ||
213 | 73 | } | ||
214 | 74 | } | ||
215 | 75 | |||
216 | 76 | #endif // CORE_UBUNTU_MEDIA_VIDEO_SINK_H_ | ||
217 | 0 | 77 | ||
218 | === modified file 'src/core/media/CMakeLists.txt' | |||
219 | --- src/core/media/CMakeLists.txt 2014-11-12 19:10:24 +0000 | |||
220 | +++ src/core/media/CMakeLists.txt 2015-03-12 11:38:55 +0000 | |||
221 | @@ -6,7 +6,10 @@ | |||
222 | 6 | # out all symbols that are not in core::ubuntu::media* | 6 | # out all symbols that are not in core::ubuntu::media* |
223 | 7 | set(symbol_map "${CMAKE_SOURCE_DIR}/symbols.map") | 7 | set(symbol_map "${CMAKE_SOURCE_DIR}/symbols.map") |
224 | 8 | 8 | ||
226 | 9 | file(GLOB MPRIS_HEADERS mpris/ *.h) | 9 | file(GLOB_RECURSE MEDIA_HUB_HEADERS ${CMAKE_SOURCE_DIR}/include/*.h) |
227 | 10 | file(GLOB MPRIS_HEADERS mpris/*.h) | ||
228 | 11 | |||
229 | 12 | message(STATUS ${MEDIA_HUB_HEADERS}) | ||
230 | 10 | 13 | ||
231 | 11 | add_subdirectory(call-monitor) | 14 | add_subdirectory(call-monitor) |
232 | 12 | 15 | ||
233 | @@ -36,6 +39,8 @@ | |||
234 | 36 | add_library( | 39 | add_library( |
235 | 37 | media-hub-client SHARED | 40 | media-hub-client SHARED |
236 | 38 | 41 | ||
237 | 42 | ${MEDIA_HUB_HEADERS} | ||
238 | 43 | |||
239 | 39 | player.cpp | 44 | player.cpp |
240 | 40 | service.cpp | 45 | service.cpp |
241 | 41 | track.cpp | 46 | track.cpp |
242 | @@ -44,6 +49,9 @@ | |||
243 | 44 | player_stub.cpp | 49 | player_stub.cpp |
244 | 45 | service_stub.cpp | 50 | service_stub.cpp |
245 | 46 | track_list_stub.cpp | 51 | track_list_stub.cpp |
246 | 52 | |||
247 | 53 | video/hybris_gl_sink.cpp | ||
248 | 54 | video/platform_default_sink.cpp | ||
249 | 47 | ) | 55 | ) |
250 | 48 | 56 | ||
251 | 49 | set_target_properties( | 57 | set_target_properties( |
252 | @@ -75,6 +83,7 @@ | |||
253 | 75 | add_library( | 83 | add_library( |
254 | 76 | media-hub-service | 84 | media-hub-service |
255 | 77 | 85 | ||
256 | 86 | ${MEDIA_HUB_HEADERS} | ||
257 | 78 | ${MPRIS_HEADERS} | 87 | ${MPRIS_HEADERS} |
258 | 79 | 88 | ||
259 | 80 | cover_art_resolver.cpp | 89 | cover_art_resolver.cpp |
260 | 81 | 90 | ||
261 | === modified file 'src/core/media/engine.h' | |||
262 | --- src/core/media/engine.h 2015-01-13 14:18:59 +0000 | |||
263 | +++ src/core/media/engine.h 2015-03-12 11:38:55 +0000 | |||
264 | @@ -75,8 +75,10 @@ | |||
265 | 75 | 75 | ||
266 | 76 | virtual const core::Property<State>& state() const = 0; | 76 | virtual const core::Property<State>& state() const = 0; |
267 | 77 | 77 | ||
269 | 78 | virtual bool open_resource_for_uri(const Track::UriType& uri) = 0; | 78 | virtual bool open_resource_for_uri(const core::ubuntu::media::Track::UriType& uri) = 0; |
270 | 79 | virtual bool open_resource_for_uri(const core::ubuntu::media::Track::UriType& uri, const Player::HeadersType&) = 0; | 79 | virtual bool open_resource_for_uri(const core::ubuntu::media::Track::UriType& uri, const Player::HeadersType&) = 0; |
271 | 80 | // Throws core::ubuntu::media::Player::Error::OutOfProcessBufferStreamingNotSupported if the implementation does not | ||
272 | 81 | // support this feature. | ||
273 | 80 | virtual void create_video_sink(uint32_t texture_id) = 0; | 82 | virtual void create_video_sink(uint32_t texture_id) = 0; |
274 | 81 | 83 | ||
275 | 82 | virtual bool play() = 0; | 84 | virtual bool play() = 0; |
276 | 83 | 85 | ||
277 | === modified file 'src/core/media/mpris/player.h' | |||
278 | --- src/core/media/mpris/player.h 2015-01-13 14:18:59 +0000 | |||
279 | +++ src/core/media/mpris/player.h 2015-03-12 11:38:55 +0000 | |||
280 | @@ -103,6 +103,17 @@ | |||
281 | 103 | static constexpr const char* stopped{"Stopped"}; | 103 | static constexpr const char* stopped{"Stopped"}; |
282 | 104 | }; | 104 | }; |
283 | 105 | 105 | ||
284 | 106 | struct Error | ||
285 | 107 | { | ||
286 | 108 | struct OutOfProcessBufferStreamingNotSupported | ||
287 | 109 | { | ||
288 | 110 | static constexpr const char* name | ||
289 | 111 | { | ||
290 | 112 | "mpris.Player.Error.OutOfProcessBufferStreamingNotSupported" | ||
291 | 113 | }; | ||
292 | 114 | }; | ||
293 | 115 | }; | ||
294 | 116 | |||
295 | 106 | typedef std::map<std::string, core::dbus::types::Variant> Dictionary; | 117 | typedef std::map<std::string, core::dbus::types::Variant> Dictionary; |
296 | 107 | 118 | ||
297 | 108 | DBUS_CPP_METHOD_DEF(Next, Player) | 119 | DBUS_CPP_METHOD_DEF(Next, Player) |
298 | 109 | 120 | ||
299 | === modified file 'src/core/media/player.cpp' | |||
300 | --- src/core/media/player.cpp 2014-09-09 10:28:32 +0000 | |||
301 | +++ src/core/media/player.cpp 2015-03-12 11:38:55 +0000 | |||
302 | @@ -22,6 +22,11 @@ | |||
303 | 22 | 22 | ||
304 | 23 | namespace media = core::ubuntu::media; | 23 | namespace media = core::ubuntu::media; |
305 | 24 | 24 | ||
306 | 25 | media::Player::Errors::OutOfProcessBufferStreamingNotSupported::OutOfProcessBufferStreamingNotSupported() | ||
307 | 26 | : std::runtime_error{"Implementation does not support out-of-process buffer streaming"} | ||
308 | 27 | { | ||
309 | 28 | } | ||
310 | 29 | |||
311 | 25 | const media::Player::Configuration& media::Player::Client::default_configuration() | 30 | const media::Player::Configuration& media::Player::Client::default_configuration() |
312 | 26 | { | 31 | { |
313 | 27 | static const media::Player::Configuration config | 32 | static const media::Player::Configuration config |
314 | 28 | 33 | ||
315 | === modified file 'src/core/media/player_implementation.cpp' | |||
316 | --- src/core/media/player_implementation.cpp 2015-01-13 14:18:59 +0000 | |||
317 | +++ src/core/media/player_implementation.cpp 2015-03-12 11:38:55 +0000 | |||
318 | @@ -470,6 +470,12 @@ | |||
319 | 470 | return d->key; | 470 | return d->key; |
320 | 471 | } | 471 | } |
321 | 472 | 472 | ||
322 | 473 | media::video::Sink::Ptr media::PlayerImplementation::create_gl_texture_video_sink(std::uint32_t texture_id) | ||
323 | 474 | { | ||
324 | 475 | d->engine->create_video_sink(texture_id); | ||
325 | 476 | return media::video::Sink::Ptr{}; | ||
326 | 477 | } | ||
327 | 478 | |||
328 | 473 | bool media::PlayerImplementation::open_uri(const Track::UriType& uri) | 479 | bool media::PlayerImplementation::open_uri(const Track::UriType& uri) |
329 | 474 | { | 480 | { |
330 | 475 | return d->engine->open_resource_for_uri(uri); | 481 | return d->engine->open_resource_for_uri(uri); |
331 | @@ -480,17 +486,6 @@ | |||
332 | 480 | return d->engine->open_resource_for_uri(uri, headers); | 486 | return d->engine->open_resource_for_uri(uri, headers); |
333 | 481 | } | 487 | } |
334 | 482 | 488 | ||
335 | 483 | void media::PlayerImplementation::create_video_sink(uint32_t texture_id) | ||
336 | 484 | { | ||
337 | 485 | d->engine->create_video_sink(texture_id); | ||
338 | 486 | } | ||
339 | 487 | |||
340 | 488 | media::Player::GLConsumerWrapperHybris media::PlayerImplementation::gl_consumer() const | ||
341 | 489 | { | ||
342 | 490 | // This method is client-side only and is simply a no-op for the service side | ||
343 | 491 | return NULL; | ||
344 | 492 | } | ||
345 | 493 | |||
346 | 494 | void media::PlayerImplementation::next() | 489 | void media::PlayerImplementation::next() |
347 | 495 | { | 490 | { |
348 | 496 | } | 491 | } |
349 | @@ -515,18 +510,6 @@ | |||
350 | 515 | d->engine->stop(); | 510 | d->engine->stop(); |
351 | 516 | } | 511 | } |
352 | 517 | 512 | ||
353 | 518 | void media::PlayerImplementation::set_frame_available_callback( | ||
354 | 519 | UNUSED FrameAvailableCb cb, UNUSED void *context) | ||
355 | 520 | { | ||
356 | 521 | // This method is client-side only and is simply a no-op for the service side | ||
357 | 522 | } | ||
358 | 523 | |||
359 | 524 | void media::PlayerImplementation::set_playback_complete_callback( | ||
360 | 525 | UNUSED PlaybackCompleteCb cb, UNUSED void *context) | ||
361 | 526 | { | ||
362 | 527 | // This method is client-side only and is simply a no-op for the service side | ||
363 | 528 | } | ||
364 | 529 | |||
365 | 530 | void media::PlayerImplementation::seek_to(const std::chrono::microseconds& ms) | 513 | void media::PlayerImplementation::seek_to(const std::chrono::microseconds& ms) |
366 | 531 | { | 514 | { |
367 | 532 | d->engine->seek_to(ms); | 515 | d->engine->seek_to(ms); |
368 | 533 | 516 | ||
369 | === modified file 'src/core/media/player_implementation.h' | |||
370 | --- src/core/media/player_implementation.h 2015-01-13 14:18:59 +0000 | |||
371 | +++ src/core/media/player_implementation.h 2015-03-12 11:38:55 +0000 | |||
372 | @@ -46,17 +46,15 @@ | |||
373 | 46 | virtual std::shared_ptr<TrackList> track_list(); | 46 | virtual std::shared_ptr<TrackList> track_list(); |
374 | 47 | virtual PlayerKey key() const; | 47 | virtual PlayerKey key() const; |
375 | 48 | 48 | ||
376 | 49 | virtual video::Sink::Ptr create_gl_texture_video_sink(std::uint32_t texture_id); | ||
377 | 50 | |||
378 | 49 | virtual bool open_uri(const Track::UriType& uri); | 51 | virtual bool open_uri(const Track::UriType& uri); |
379 | 50 | virtual bool open_uri(const Track::UriType& uri, const Player::HeadersType& headers); | 52 | virtual bool open_uri(const Track::UriType& uri, const Player::HeadersType& headers); |
380 | 51 | virtual void create_video_sink(uint32_t texture_id); | ||
381 | 52 | virtual GLConsumerWrapperHybris gl_consumer() const; | ||
382 | 53 | virtual void next(); | 53 | virtual void next(); |
383 | 54 | virtual void previous(); | 54 | virtual void previous(); |
384 | 55 | virtual void play(); | 55 | virtual void play(); |
385 | 56 | virtual void pause(); | 56 | virtual void pause(); |
386 | 57 | virtual void stop(); | 57 | virtual void stop(); |
387 | 58 | virtual void set_frame_available_callback(FrameAvailableCb cb, void *context); | ||
388 | 59 | virtual void set_playback_complete_callback(PlaybackCompleteCb cb, void *context); | ||
389 | 60 | virtual void seek_to(const std::chrono::microseconds& offset); | 58 | virtual void seek_to(const std::chrono::microseconds& offset); |
390 | 61 | 59 | ||
391 | 62 | const core::Signal<>& on_client_disconnected() const; | 60 | const core::Signal<>& on_client_disconnected() const; |
392 | 63 | 61 | ||
393 | === modified file 'src/core/media/player_skeleton.cpp' | |||
394 | --- src/core/media/player_skeleton.cpp 2015-01-13 14:18:59 +0000 | |||
395 | +++ src/core/media/player_skeleton.cpp 2015-03-12 11:38:55 +0000 | |||
396 | @@ -136,9 +136,29 @@ | |||
397 | 136 | { | 136 | { |
398 | 137 | uint32_t texture_id; | 137 | uint32_t texture_id; |
399 | 138 | in->reader() >> texture_id; | 138 | in->reader() >> texture_id; |
403 | 139 | impl->create_video_sink(texture_id); | 139 | |
404 | 140 | 140 | core::dbus::Message::Ptr reply; | |
405 | 141 | auto reply = dbus::Message::make_method_return(in); | 141 | |
406 | 142 | try | ||
407 | 143 | { | ||
408 | 144 | impl->create_gl_texture_video_sink(texture_id); | ||
409 | 145 | reply = dbus::Message::make_method_return(in); | ||
410 | 146 | } | ||
411 | 147 | catch (const media::Player::Errors::OutOfProcessBufferStreamingNotSupported& e) | ||
412 | 148 | { | ||
413 | 149 | reply = dbus::Message::make_error( | ||
414 | 150 | in, | ||
415 | 151 | mpris::Player::Error::OutOfProcessBufferStreamingNotSupported::name, | ||
416 | 152 | e.what()); | ||
417 | 153 | } | ||
418 | 154 | catch (...) | ||
419 | 155 | { | ||
420 | 156 | reply = dbus::Message::make_error( | ||
421 | 157 | in, | ||
422 | 158 | mpris::Player::Error::OutOfProcessBufferStreamingNotSupported::name, | ||
423 | 159 | std::string{}); | ||
424 | 160 | } | ||
425 | 161 | |||
426 | 142 | bus->send(reply); | 162 | bus->send(reply); |
427 | 143 | } | 163 | } |
428 | 144 | 164 | ||
429 | 145 | 165 | ||
430 | === modified file 'src/core/media/player_stub.cpp' | |||
431 | --- src/core/media/player_stub.cpp 2015-01-19 18:38:29 +0000 | |||
432 | +++ src/core/media/player_stub.cpp 2015-03-12 11:38:55 +0000 | |||
433 | @@ -19,6 +19,7 @@ | |||
434 | 19 | 19 | ||
435 | 20 | #include <core/media/service.h> | 20 | #include <core/media/service.h> |
436 | 21 | #include <core/media/track_list.h> | 21 | #include <core/media/track_list.h> |
437 | 22 | #include <core/media/video/platform_default_sink.h> | ||
438 | 22 | 23 | ||
439 | 23 | #include "codec.h" | 24 | #include "codec.h" |
440 | 24 | #include "player_stub.h" | 25 | #include "player_stub.h" |
441 | @@ -48,13 +49,9 @@ | |||
442 | 48 | Private(const std::shared_ptr<Service>& parent, | 49 | Private(const std::shared_ptr<Service>& parent, |
443 | 49 | const std::shared_ptr<core::dbus::Object>& object | 50 | const std::shared_ptr<core::dbus::Object>& object |
444 | 50 | ) : parent(parent), | 51 | ) : parent(parent), |
445 | 51 | texture_id(0), | ||
446 | 52 | igbc_wrapper(nullptr), | ||
447 | 53 | glc_wrapper(nullptr), | ||
448 | 54 | decoding_session(nullptr), | ||
449 | 55 | frame_available_cb(nullptr), | ||
450 | 56 | frame_available_context(nullptr), | ||
451 | 57 | object(object), | 52 | object(object), |
452 | 53 | key(object->invoke_method_synchronously<mpris::Player::Key, media::Player::PlayerKey>().value()), | ||
453 | 54 | sink_factory(media::video::make_platform_default_sink_factory(key)), | ||
454 | 58 | properties | 55 | properties |
455 | 59 | { | 56 | { |
456 | 60 | // Link the properties from the server side to the client side over the bus | 57 | // Link the properties from the server side to the client side over the bus |
457 | @@ -89,64 +86,17 @@ | |||
458 | 89 | object->get_signal<mpris::Player::Signals::Error>() | 86 | object->get_signal<mpris::Player::Signals::Error>() |
459 | 90 | } | 87 | } |
460 | 91 | { | 88 | { |
461 | 92 | auto op = object->invoke_method_synchronously<mpris::Player::Key, media::Player::PlayerKey>(); | ||
462 | 93 | decoding_session = decoding_service_create_session(op.value()); | ||
463 | 94 | } | 89 | } |
464 | 95 | 90 | ||
465 | 96 | ~Private() | 91 | ~Private() |
466 | 97 | { | 92 | { |
467 | 98 | } | 93 | } |
468 | 99 | 94 | ||
469 | 100 | static void on_frame_available_cb(UNUSED GLConsumerWrapperHybris wrapper, void *context) | ||
470 | 101 | { | ||
471 | 102 | if (context != nullptr) { | ||
472 | 103 | Private *p = static_cast<Private*>(context); | ||
473 | 104 | p->on_frame_available(); | ||
474 | 105 | } | ||
475 | 106 | else | ||
476 | 107 | std::cerr << "context is nullptr, can't call on_frame_available()" << std::endl; | ||
477 | 108 | } | ||
478 | 109 | |||
479 | 110 | void on_frame_available() | ||
480 | 111 | { | ||
481 | 112 | if (frame_available_cb != nullptr) { | ||
482 | 113 | frame_available_cb(frame_available_context); | ||
483 | 114 | } | ||
484 | 115 | else | ||
485 | 116 | std::cerr << "frame_available_cb is nullptr, can't call frame_available_cb()" << std::endl; | ||
486 | 117 | } | ||
487 | 118 | |||
488 | 119 | void set_frame_available_cb(FrameAvailableCb cb, void *context) | ||
489 | 120 | { | ||
490 | 121 | frame_available_cb = cb; | ||
491 | 122 | frame_available_context = context; | ||
492 | 123 | |||
493 | 124 | gl_consumer_set_frame_available_cb(glc_wrapper, &Private::on_frame_available_cb, static_cast<void*>(this)); | ||
494 | 125 | } | ||
495 | 126 | |||
496 | 127 | /** We need a GLConsumerHybris instance for doing texture streaming over the | ||
497 | 128 | * process boundary **/ | ||
498 | 129 | void get_gl_consumer() | ||
499 | 130 | { | ||
500 | 131 | igbc_wrapper = decoding_service_get_igraphicbufferconsumer(); | ||
501 | 132 | glc_wrapper = gl_consumer_create_by_id_with_igbc(texture_id, igbc_wrapper); | ||
502 | 133 | |||
503 | 134 | } | ||
504 | 135 | |||
505 | 136 | std::shared_ptr<Service> parent; | 95 | std::shared_ptr<Service> parent; |
506 | 137 | std::shared_ptr<TrackList> track_list; | 96 | std::shared_ptr<TrackList> track_list; |
507 | 138 | |||
508 | 139 | uint32_t texture_id; | ||
509 | 140 | IGBCWrapperHybris igbc_wrapper; | ||
510 | 141 | GLConsumerWrapperHybris glc_wrapper; | ||
511 | 142 | |||
512 | 143 | DSSessionWrapperHybris decoding_session; | ||
513 | 144 | |||
514 | 145 | FrameAvailableCb frame_available_cb; | ||
515 | 146 | void *frame_available_context; | ||
516 | 147 | |||
517 | 148 | dbus::Object::Ptr object; | 97 | dbus::Object::Ptr object; |
519 | 149 | 98 | media::Player::PlayerKey key; | |
520 | 99 | media::video::SinkFactory sink_factory; | ||
521 | 150 | struct | 100 | struct |
522 | 151 | { | 101 | { |
523 | 152 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::CanPlay>> can_play; | 102 | std::shared_ptr<core::dbus::Property<mpris::Player::Properties::CanPlay>> can_play; |
524 | @@ -186,9 +136,7 @@ | |||
525 | 186 | const std::shared_ptr<DBusPlaybackStatusChangedSignal>& status, | 136 | const std::shared_ptr<DBusPlaybackStatusChangedSignal>& status, |
526 | 187 | const std::shared_ptr<DBusVideoDimensionChangedSignal>& d, | 137 | const std::shared_ptr<DBusVideoDimensionChangedSignal>& d, |
527 | 188 | const std::shared_ptr<DBusErrorSignal>& e) | 138 | const std::shared_ptr<DBusErrorSignal>& e) |
531 | 189 | : playback_complete_cb(nullptr), | 139 | : seeked_to(), |
529 | 190 | playback_complete_context(nullptr), | ||
530 | 191 | seeked_to(), | ||
532 | 192 | end_of_stream(), | 140 | end_of_stream(), |
533 | 193 | playback_status_changed(), | 141 | playback_status_changed(), |
534 | 194 | video_dimension_changed(), | 142 | video_dimension_changed(), |
535 | @@ -211,8 +159,6 @@ | |||
536 | 211 | dbus.end_of_stream->connect([this]() | 159 | dbus.end_of_stream->connect([this]() |
537 | 212 | { | 160 | { |
538 | 213 | std::cout << "EndOfStream signal arrived via the bus." << std::endl; | 161 | std::cout << "EndOfStream signal arrived via the bus." << std::endl; |
539 | 214 | if (playback_complete_cb) | ||
540 | 215 | playback_complete_cb(playback_complete_context); | ||
541 | 216 | end_of_stream(); | 162 | end_of_stream(); |
542 | 217 | }); | 163 | }); |
543 | 218 | 164 | ||
544 | @@ -235,14 +181,6 @@ | |||
545 | 235 | }); | 181 | }); |
546 | 236 | } | 182 | } |
547 | 237 | 183 | ||
548 | 238 | void set_playback_complete_cb(PlaybackCompleteCb cb, void *context) | ||
549 | 239 | { | ||
550 | 240 | playback_complete_cb = cb; | ||
551 | 241 | playback_complete_context = context; | ||
552 | 242 | } | ||
553 | 243 | |||
554 | 244 | PlaybackCompleteCb playback_complete_cb; | ||
555 | 245 | void *playback_complete_context; | ||
556 | 246 | core::Signal<int64_t> seeked_to; | 184 | core::Signal<int64_t> seeked_to; |
557 | 247 | core::Signal<void> end_of_stream; | 185 | core::Signal<void> end_of_stream; |
558 | 248 | core::Signal<media::Player::PlaybackStatus> playback_status_changed; | 186 | core::Signal<media::Player::PlaybackStatus> playback_status_changed; |
559 | @@ -284,9 +222,7 @@ | |||
560 | 284 | 222 | ||
561 | 285 | media::Player::PlayerKey media::PlayerStub::key() const | 223 | media::Player::PlayerKey media::PlayerStub::key() const |
562 | 286 | { | 224 | { |
566 | 287 | auto op = d->object->invoke_method_synchronously<mpris::Player::Key, media::Player::PlayerKey>(); | 225 | return d->key; |
564 | 288 | |||
565 | 289 | return op.value(); | ||
567 | 290 | } | 226 | } |
568 | 291 | 227 | ||
569 | 292 | bool media::PlayerStub::open_uri(const media::Track::UriType& uri) | 228 | bool media::PlayerStub::open_uri(const media::Track::UriType& uri) |
570 | @@ -296,6 +232,7 @@ | |||
571 | 296 | return op.value(); | 232 | return op.value(); |
572 | 297 | } | 233 | } |
573 | 298 | 234 | ||
574 | 235 | |||
575 | 299 | bool media::PlayerStub::open_uri(const Track::UriType& uri, const Player::HeadersType& headers) | 236 | bool media::PlayerStub::open_uri(const Track::UriType& uri, const Player::HeadersType& headers) |
576 | 300 | { | 237 | { |
577 | 301 | auto op = d->object->invoke_method_synchronously<mpris::Player::OpenUriExtended, bool>(uri, headers); | 238 | auto op = d->object->invoke_method_synchronously<mpris::Player::OpenUriExtended, bool>(uri, headers); |
578 | @@ -303,19 +240,19 @@ | |||
579 | 303 | return op.value(); | 240 | return op.value(); |
580 | 304 | } | 241 | } |
581 | 305 | 242 | ||
583 | 306 | void media::PlayerStub::create_video_sink(uint32_t texture_id) | 243 | media::video::Sink::Ptr media::PlayerStub::create_gl_texture_video_sink(std::uint32_t texture_id) |
584 | 307 | { | 244 | { |
585 | 308 | auto op = d->object->invoke_method_synchronously<mpris::Player::CreateVideoSink, void>(texture_id); | 245 | auto op = d->object->invoke_method_synchronously<mpris::Player::CreateVideoSink, void>(texture_id); |
586 | 309 | d->texture_id = texture_id; | ||
587 | 310 | d->get_gl_consumer(); | ||
588 | 311 | 246 | ||
589 | 312 | if (op.is_error()) | 247 | if (op.is_error()) |
592 | 313 | throw std::runtime_error("Problem creating new video sink instance on remote object"); | 248 | { |
593 | 314 | } | 249 | if (op.error().name() == mpris::Player::Error::OutOfProcessBufferStreamingNotSupported::name) |
594 | 250 | throw media::Player::Errors::OutOfProcessBufferStreamingNotSupported{}; | ||
595 | 251 | else | ||
596 | 252 | throw std::runtime_error{op.error().print()}; | ||
597 | 253 | } | ||
598 | 315 | 254 | ||
602 | 316 | GLConsumerWrapperHybris media::PlayerStub::gl_consumer() const | 255 | return d->sink_factory(texture_id); |
600 | 317 | { | ||
601 | 318 | return d->glc_wrapper; | ||
603 | 319 | } | 256 | } |
604 | 320 | 257 | ||
605 | 321 | void media::PlayerStub::next() | 258 | void media::PlayerStub::next() |
606 | @@ -366,16 +303,6 @@ | |||
607 | 366 | throw std::runtime_error("Problem stopping playback on remote object"); | 303 | throw std::runtime_error("Problem stopping playback on remote object"); |
608 | 367 | } | 304 | } |
609 | 368 | 305 | ||
610 | 369 | void media::PlayerStub::set_frame_available_callback(FrameAvailableCb cb, void *context) | ||
611 | 370 | { | ||
612 | 371 | d->set_frame_available_cb(cb, context); | ||
613 | 372 | } | ||
614 | 373 | |||
615 | 374 | void media::PlayerStub::set_playback_complete_callback(PlaybackCompleteCb cb, void *context) | ||
616 | 375 | { | ||
617 | 376 | d->signals.set_playback_complete_cb(cb, context); | ||
618 | 377 | } | ||
619 | 378 | |||
620 | 379 | const core::Property<bool>& media::PlayerStub::can_play() const | 306 | const core::Property<bool>& media::PlayerStub::can_play() const |
621 | 380 | { | 307 | { |
622 | 381 | return *d->properties.can_play; | 308 | return *d->properties.can_play; |
623 | 382 | 309 | ||
624 | === modified file 'src/core/media/player_stub.h' | |||
625 | --- src/core/media/player_stub.h 2015-01-13 14:18:59 +0000 | |||
626 | +++ src/core/media/player_stub.h 2015-03-12 11:38:55 +0000 | |||
627 | @@ -46,10 +46,10 @@ | |||
628 | 46 | virtual std::shared_ptr<TrackList> track_list(); | 46 | virtual std::shared_ptr<TrackList> track_list(); |
629 | 47 | virtual PlayerKey key() const; | 47 | virtual PlayerKey key() const; |
630 | 48 | 48 | ||
631 | 49 | virtual video::Sink::Ptr create_gl_texture_video_sink(std::uint32_t texture_id); | ||
632 | 50 | |||
633 | 49 | virtual bool open_uri(const Track::UriType& uri); | 51 | virtual bool open_uri(const Track::UriType& uri); |
634 | 50 | virtual bool open_uri(const Track::UriType& uri, const Player::HeadersType& headers); | 52 | virtual bool open_uri(const Track::UriType& uri, const Player::HeadersType& headers); |
635 | 51 | virtual void create_video_sink(uint32_t texture_id); | ||
636 | 52 | virtual GLConsumerWrapperHybris gl_consumer() const; | ||
637 | 53 | virtual void next(); | 53 | virtual void next(); |
638 | 54 | virtual void previous(); | 54 | virtual void previous(); |
639 | 55 | virtual void play(); | 55 | virtual void play(); |
640 | @@ -57,9 +57,6 @@ | |||
641 | 57 | virtual void seek_to(const std::chrono::microseconds& offset); | 57 | virtual void seek_to(const std::chrono::microseconds& offset); |
642 | 58 | virtual void stop(); | 58 | virtual void stop(); |
643 | 59 | 59 | ||
644 | 60 | virtual void set_frame_available_callback(FrameAvailableCb cb, void *context); | ||
645 | 61 | virtual void set_playback_complete_callback(PlaybackCompleteCb cb, void *context); | ||
646 | 62 | |||
647 | 63 | virtual const core::Property<bool>& can_play() const; | 60 | virtual const core::Property<bool>& can_play() const; |
648 | 64 | virtual const core::Property<bool>& can_pause() const; | 61 | virtual const core::Property<bool>& can_pause() const; |
649 | 65 | virtual const core::Property<bool>& can_seek() const; | 62 | virtual const core::Property<bool>& can_seek() const; |
650 | 66 | 63 | ||
651 | === added directory 'src/core/media/video' | |||
652 | === added file 'src/core/media/video/hybris_gl_sink.cpp' | |||
653 | --- src/core/media/video/hybris_gl_sink.cpp 1970-01-01 00:00:00 +0000 | |||
654 | +++ src/core/media/video/hybris_gl_sink.cpp 2015-03-12 11:38:55 +0000 | |||
655 | @@ -0,0 +1,116 @@ | |||
656 | 1 | /* | ||
657 | 2 | * Copyright © 2014 Canonical Ltd. | ||
658 | 3 | * | ||
659 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
660 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
661 | 6 | * as published by the Free Software Foundation. | ||
662 | 7 | * | ||
663 | 8 | * This program is distributed in the hope that it will be useful, | ||
664 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
665 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
666 | 11 | * GNU Lesser General Public License for more details. | ||
667 | 12 | * | ||
668 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
669 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
670 | 15 | * | ||
671 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | ||
672 | 17 | */ | ||
673 | 18 | |||
674 | 19 | #include <core/media/video/hybris_gl_sink.h> | ||
675 | 20 | |||
676 | 21 | #if defined(MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER) | ||
677 | 22 | // Hybris | ||
678 | 23 | #include <hybris/media/media_codec_layer.h> | ||
679 | 24 | #include <hybris/media/surface_texture_client_hybris.h> | ||
680 | 25 | |||
681 | 26 | namespace media = core::ubuntu::media; | ||
682 | 27 | namespace video = core::ubuntu::media::video; | ||
683 | 28 | |||
684 | 29 | struct video::HybrisGlSink::Private | ||
685 | 30 | { | ||
686 | 31 | static void on_frame_available_callback(GLConsumerWrapperHybris, void* context) | ||
687 | 32 | { | ||
688 | 33 | if (not context) | ||
689 | 34 | return; | ||
690 | 35 | |||
691 | 36 | auto thiz = static_cast<Private*>(context); | ||
692 | 37 | |||
693 | 38 | thiz->frame_available(); | ||
694 | 39 | } | ||
695 | 40 | |||
696 | 41 | Private(std::uint32_t gl_texture) | ||
697 | 42 | : gl_texture{gl_texture}, | ||
698 | 43 | graphics_buffer_consumer{decoding_service_get_igraphicbufferconsumer()}, | ||
699 | 44 | gl_texture_consumer{gl_consumer_create_by_id_with_igbc(gl_texture, graphics_buffer_consumer)} | ||
700 | 45 | { | ||
701 | 46 | if (not graphics_buffer_consumer) throw std::runtime_error | ||
702 | 47 | { | ||
703 | 48 | "video::HybrisGlSink: Could not connect to remote buffer queue." | ||
704 | 49 | }; | ||
705 | 50 | |||
706 | 51 | if (not gl_texture_consumer) throw std::runtime_error | ||
707 | 52 | { | ||
708 | 53 | "video::HybrisGlSink: Could not associate local texture id with remote buffer streak." | ||
709 | 54 | }; | ||
710 | 55 | |||
711 | 56 | gl_consumer_set_frame_available_cb(gl_texture_consumer, Private::on_frame_available_callback, this); | ||
712 | 57 | } | ||
713 | 58 | |||
714 | 59 | ~Private() | ||
715 | 60 | { | ||
716 | 61 | gl_consumer_set_frame_available_cb(gl_texture_consumer, Private::on_frame_available_callback, nullptr); | ||
717 | 62 | } | ||
718 | 63 | |||
719 | 64 | std::uint32_t gl_texture; | ||
720 | 65 | core::Signal<void> frame_available; | ||
721 | 66 | IGBCWrapperHybris graphics_buffer_consumer; | ||
722 | 67 | GLConsumerWrapperHybris gl_texture_consumer; | ||
723 | 68 | }; | ||
724 | 69 | |||
725 | 70 | std::function<video::Sink::Ptr(std::uint32_t)> video::HybrisGlSink::factory_for_key(const media::Player::PlayerKey& key) | ||
726 | 71 | { | ||
727 | 72 | // It's okay-ish to use static map here. Point being that we currently have no way | ||
728 | 73 | // of terminating the session with the decoding service anyway. | ||
729 | 74 | static std::map<media::Player::PlayerKey, DSSessionWrapperHybris> lut; | ||
730 | 75 | static std::mutex lut_guard; | ||
731 | 76 | |||
732 | 77 | // Scoping access to the lut to ensure that the lock is kept for as short as possible. | ||
733 | 78 | { | ||
734 | 79 | std::lock_guard<std::mutex> lg{lut_guard}; | ||
735 | 80 | if (lut.count(key) == 0) | ||
736 | 81 | lut[key] = decoding_service_create_session(key); | ||
737 | 82 | } | ||
738 | 83 | |||
739 | 84 | return [](std::uint32_t texture) | ||
740 | 85 | { | ||
741 | 86 | return video::Sink::Ptr{new video::HybrisGlSink{texture}}; | ||
742 | 87 | }; | ||
743 | 88 | } | ||
744 | 89 | |||
745 | 90 | video::HybrisGlSink::HybrisGlSink(std::uint32_t gl_texture) : d{new Private{gl_texture}} | ||
746 | 91 | { | ||
747 | 92 | } | ||
748 | 93 | |||
749 | 94 | video::HybrisGlSink::~HybrisGlSink() | ||
750 | 95 | { | ||
751 | 96 | } | ||
752 | 97 | |||
753 | 98 | const core::Signal<void>& video::HybrisGlSink::frame_available() const | ||
754 | 99 | { | ||
755 | 100 | return d->frame_available; | ||
756 | 101 | } | ||
757 | 102 | |||
758 | 103 | bool video::HybrisGlSink::transformation_matrix(float* matrix) const | ||
759 | 104 | { | ||
760 | 105 | // TODO: The underlying API really should tell us if everything is ok. | ||
761 | 106 | gl_consumer_get_transformation_matrix(d->gl_texture_consumer, matrix); | ||
762 | 107 | return true; | ||
763 | 108 | } | ||
764 | 109 | |||
765 | 110 | bool video::HybrisGlSink::swap_buffers() const | ||
766 | 111 | { | ||
767 | 112 | // TODO: The underlying API really should tell us if everything is ok. | ||
768 | 113 | gl_consumer_update_texture(d->gl_texture_consumer); | ||
769 | 114 | return true; | ||
770 | 115 | } | ||
771 | 116 | #endif // MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER | ||
772 | 0 | 117 | ||
773 | === added file 'src/core/media/video/hybris_gl_sink.h' | |||
774 | --- src/core/media/video/hybris_gl_sink.h 1970-01-01 00:00:00 +0000 | |||
775 | +++ src/core/media/video/hybris_gl_sink.h 2015-03-12 11:38:55 +0000 | |||
776 | @@ -0,0 +1,72 @@ | |||
777 | 1 | /* | ||
778 | 2 | * Copyright © 2014 Canonical Ltd. | ||
779 | 3 | * | ||
780 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
781 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
782 | 6 | * as published by the Free Software Foundation. | ||
783 | 7 | * | ||
784 | 8 | * This program is distributed in the hope that it will be useful, | ||
785 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
786 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
787 | 11 | * GNU Lesser General Public License for more details. | ||
788 | 12 | * | ||
789 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
790 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
791 | 15 | * | ||
792 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | ||
793 | 17 | */ | ||
794 | 18 | #ifndef CORE_UBUNTU_MEDIA_VIDEO_HYBRIS_GL_SINK_H_ | ||
795 | 19 | #define CORE_UBUNTU_MEDIA_VIDEO_HYBRIS_GL_SINK_H_ | ||
796 | 20 | |||
797 | 21 | #include <core/media/video/sink.h> | ||
798 | 22 | |||
799 | 23 | #include <core/media/player.h> | ||
800 | 24 | |||
801 | 25 | #include <functional> | ||
802 | 26 | |||
803 | 27 | namespace core | ||
804 | 28 | { | ||
805 | 29 | namespace ubuntu | ||
806 | 30 | { | ||
807 | 31 | namespace media | ||
808 | 32 | { | ||
809 | 33 | namespace video | ||
810 | 34 | { | ||
811 | 35 | class HybrisGlSink : public video::Sink | ||
812 | 36 | { | ||
813 | 37 | public: | ||
814 | 38 | // Returns a factory functor that allows for creating actual sink instances. | ||
815 | 39 | static std::function<video::Sink::Ptr(std::uint32_t)> factory_for_key(const media::Player::PlayerKey&); | ||
816 | 40 | |||
817 | 41 | // Need this to avoid std::unique_ptr complaining about forward-declared Private. | ||
818 | 42 | ~HybrisGlSink(); | ||
819 | 43 | |||
820 | 44 | // The signal is emitted whenever a new frame is available and a subsequent | ||
821 | 45 | // call to swap_buffers will not block and return true. | ||
822 | 46 | const core::Signal<void>& frame_available() const override; | ||
823 | 47 | |||
824 | 48 | // Queries the transformation matrix for the current frame, placing the data into 'matrix' | ||
825 | 49 | // and returns true or returns false and leaves 'matrix' unchanged in case | ||
826 | 50 | // of issues. | ||
827 | 51 | bool transformation_matrix(float* matrix) const override; | ||
828 | 52 | |||
829 | 53 | // Releases the current buffer, and consumes the next buffer in the queue, | ||
830 | 54 | // making it available for consumption by consumers of this API in an | ||
831 | 55 | // implementation-specific way. Clients will usually rely on a GL texture | ||
832 | 56 | // to receive the latest buffer. | ||
833 | 57 | bool swap_buffers() const override; | ||
834 | 58 | |||
835 | 59 | private: | ||
836 | 60 | // Creates a new instance for the given gl texture, connecting to the remote part known | ||
837 | 61 | // under the given key or throw in case of issues. | ||
838 | 62 | HybrisGlSink(std::uint32_t gl_texture); | ||
839 | 63 | |||
840 | 64 | struct Private; | ||
841 | 65 | std::unique_ptr<Private> d; | ||
842 | 66 | }; | ||
843 | 67 | } | ||
844 | 68 | } | ||
845 | 69 | } | ||
846 | 70 | } | ||
847 | 71 | |||
848 | 72 | #endif // CORE_UBUNTU_MEDIA_VIDEO_HYBRIS_GL_SINK_H_ | ||
849 | 0 | 73 | ||
850 | === added file 'src/core/media/video/platform_default_sink.cpp' | |||
851 | --- src/core/media/video/platform_default_sink.cpp 1970-01-01 00:00:00 +0000 | |||
852 | +++ src/core/media/video/platform_default_sink.cpp 2015-03-12 11:38:55 +0000 | |||
853 | @@ -0,0 +1,68 @@ | |||
854 | 1 | /* | ||
855 | 2 | * Copyright © 2014 Canonical Ltd. | ||
856 | 3 | * | ||
857 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
858 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
859 | 6 | * as published by the Free Software Foundation. | ||
860 | 7 | * | ||
861 | 8 | * This program is distributed in the hope that it will be useful, | ||
862 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
863 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
864 | 11 | * GNU Lesser General Public License for more details. | ||
865 | 12 | * | ||
866 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
867 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
868 | 15 | * | ||
869 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | ||
870 | 17 | */ | ||
871 | 18 | |||
872 | 19 | #include <core/media/video/platform_default_sink.h> | ||
873 | 20 | |||
874 | 21 | namespace media = core::ubuntu::media; | ||
875 | 22 | namespace video = core::ubuntu::media::video; | ||
876 | 23 | |||
877 | 24 | namespace | ||
878 | 25 | { | ||
879 | 26 | struct NullSink : public video::Sink | ||
880 | 27 | { | ||
881 | 28 | // The signal is emitted whenever a new frame is available and a subsequent | ||
882 | 29 | // call to swap_buffers will not block and return true. | ||
883 | 30 | const core::Signal<void>& frame_available() const | ||
884 | 31 | { | ||
885 | 32 | return signal_frame_available; | ||
886 | 33 | } | ||
887 | 34 | |||
888 | 35 | // Queries the transformation matrix for the current frame, placing the data into 'matrix' | ||
889 | 36 | // and returns true or returns false and leaves 'matrix' unchanged in case | ||
890 | 37 | // of issues. | ||
891 | 38 | bool transformation_matrix(float*) const | ||
892 | 39 | { | ||
893 | 40 | return true; | ||
894 | 41 | } | ||
895 | 42 | |||
896 | 43 | // Releases the current buffer, and consumes the next buffer in the queue, | ||
897 | 44 | // making it available for consumption by consumers of this API in an | ||
898 | 45 | // implementation-specific way. Clients will usually rely on a GL texture | ||
899 | 46 | // to receive the latest buffer. | ||
900 | 47 | bool swap_buffers() const | ||
901 | 48 | { | ||
902 | 49 | return true; | ||
903 | 50 | } | ||
904 | 51 | |||
905 | 52 | core::Signal<void> signal_frame_available; | ||
906 | 53 | }; | ||
907 | 54 | } | ||
908 | 55 | |||
909 | 56 | #if defined(MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER) | ||
910 | 57 | #include <core/media/video/hybris_gl_sink.h> | ||
911 | 58 | |||
912 | 59 | video::SinkFactory video::make_platform_default_sink_factory(const media::Player::PlayerKey& key) | ||
913 | 60 | { | ||
914 | 61 | return video::HybrisGlSink::factory_for_key(key); | ||
915 | 62 | } | ||
916 | 63 | #else // MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER | ||
917 | 64 | video::SinkFactory video::make_platform_default_sink_factory(const media::Player::PlayerKey&) | ||
918 | 65 | { | ||
919 | 66 | return [](std::uint32_t) { return video::Sink::Ptr{}; }; | ||
920 | 67 | } | ||
921 | 68 | #endif // MEDIA_HUB_HAVE_HYBRIS_MEDIA_COMPAT_LAYER | ||
922 | 0 | 69 | ||
923 | === added file 'src/core/media/video/platform_default_sink.h' | |||
924 | --- src/core/media/video/platform_default_sink.h 1970-01-01 00:00:00 +0000 | |||
925 | +++ src/core/media/video/platform_default_sink.h 2015-03-12 11:38:55 +0000 | |||
926 | @@ -0,0 +1,44 @@ | |||
927 | 1 | /* | ||
928 | 2 | * Copyright © 2014 Canonical Ltd. | ||
929 | 3 | * | ||
930 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
931 | 5 | * under the terms of the GNU Lesser General Public License version 3, | ||
932 | 6 | * as published by the Free Software Foundation. | ||
933 | 7 | * | ||
934 | 8 | * This program is distributed in the hope that it will be useful, | ||
935 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
936 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
937 | 11 | * GNU Lesser General Public License for more details. | ||
938 | 12 | * | ||
939 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
940 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
941 | 15 | * | ||
942 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | ||
943 | 17 | */ | ||
944 | 18 | #ifndef CORE_UBUNTU_MEDIA_VIDEO_PLATFORM_DEFAULT_SINK_H_ | ||
945 | 19 | #define CORE_UBUNTU_MEDIA_VIDEO_PLATFORM_DEFAULT_SINK_H_ | ||
946 | 20 | |||
947 | 21 | #include <core/media/video/sink.h> | ||
948 | 22 | |||
949 | 23 | #include <core/media/player.h> | ||
950 | 24 | |||
951 | 25 | #include <functional> | ||
952 | 26 | |||
953 | 27 | namespace core | ||
954 | 28 | { | ||
955 | 29 | namespace ubuntu | ||
956 | 30 | { | ||
957 | 31 | namespace media | ||
958 | 32 | { | ||
959 | 33 | namespace video | ||
960 | 34 | { | ||
961 | 35 | // A functor that allows for creating actual sinks given a texture id. | ||
962 | 36 | typedef std::function<Sink::Ptr(std::uint32_t)> SinkFactory; | ||
963 | 37 | // Returns the platform default sink factory for the player instance identified by the given key. | ||
964 | 38 | SinkFactory make_platform_default_sink_factory(const Player::PlayerKey& key); | ||
965 | 39 | } | ||
966 | 40 | } | ||
967 | 41 | } | ||
968 | 42 | } | ||
969 | 43 | |||
970 | 44 | #endif // CORE_UBUNTU_MEDIA_VIDEO_PLATFORM_DEFAULT_SINK_H_ |
FAILED: Continuous integration, rev:99 jenkins. qa.ubuntu. com/job/ media-hub- ci/176/ jenkins. qa.ubuntu. com/job/ media-hub- vivid-amd64- ci/16/console jenkins. qa.ubuntu. com/job/ media-hub- vivid-armhf- ci/16/console jenkins. qa.ubuntu. com/job/ media-hub- vivid-i386- ci/16/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/media- hub-ci/ 176/rebuild
http://