Merge lp:~thomas-voss/media-hub/make-video-size-a-proper-type into lp:media-hub
- make-video-size-a-proper-type
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Ricardo Mendoza |
Approved revision: | 107 |
Merged at revision: | 115 |
Proposed branch: | lp:~thomas-voss/media-hub/make-video-size-a-proper-type |
Merge into: | lp:media-hub |
Prerequisite: | lp:~thomas-voss/media-hub/introduce-video-sink-interface |
Diff against target: |
611 lines (+250/-66) 13 files modified
include/core/media/player.h (+3/-6) include/core/media/video/dimensions.h (+145/-0) src/core/media/codec.h (+44/-1) src/core/media/engine.h (+1/-1) src/core/media/gstreamer/engine.cpp (+6/-7) src/core/media/gstreamer/engine.h (+1/-1) src/core/media/gstreamer/playbin.h (+30/-32) src/core/media/mpris/player.h (+5/-1) src/core/media/player_implementation.cpp (+2/-5) src/core/media/player_skeleton.cpp (+6/-5) src/core/media/player_skeleton.h (+2/-2) src/core/media/player_stub.cpp (+4/-4) src/core/media/player_stub.h (+1/-1) |
To merge this branch: | bzr merge lp:~thomas-voss/media-hub/make-video-size-a-proper-type |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Jim Hodapp (community) | code | Needs Fixing | |
Review via email: mp+242879@code.launchpad.net |
Commit message
Replace home-grown mask type for the video size with a std::tuple, i.e., media::
Introduce a simple TaggedInteger class to distinguish between Width, Height and other dimensions.
Adjust interfaces of media::Player to rely on the new type.
Adjust implementation classes to account for interface changes.
Adjust Codec implementation for sending the tagged integer via the bus.
Adjust gstreamer::Engine and gstreamer::Playbin to hand out the correct types.
Description of the change
Replace home-grown mask type for the video size with a std::tuple, i.e., media::
Introduce a simple TaggedInteger class to distinguish between Width, Height and other dimensions.
Adjust interfaces of media::Player to rely on the new type.
Adjust implementation classes to account for interface changes.
Adjust Codec implementation for sending the tagged integer via the bus.
Adjust gstreamer::Engine and gstreamer::Playbin to hand out the correct types.
PS Jenkins bot (ps-jenkins) wrote : | # |
- 101. By Thomas Voß
-
Remerge prereq branch.
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://
Jim Hodapp (jhodapp) wrote : | # |
A few inline comments below. Please make sure to rebase with trunk.
- 102. By Thomas Voß
-
[ Jim Hodapp ]
* Resubmitting with prerequisite branch (LP: #1331041)
[ Justin McPherson ]
* Resubmitting with prerequisite branch (LP: #1331041) - 103. By Thomas Voß
-
Address reviewer comments.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:103
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 104. 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)
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ß
-
Merge prereq branch.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:105
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Francis Ginther (fginther) wrote : | # |
The jenkins node for the i386 build failed, I've restarted a new ci run.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:105
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 106. By Thomas Voß
-
Merge prereq branch.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:106
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 107. 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
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:107
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'include/core/media/player.h' |
2 | --- include/core/media/player.h 2015-03-12 11:39:32 +0000 |
3 | +++ include/core/media/player.h 2015-03-12 11:39:32 +0000 |
4 | @@ -20,6 +20,8 @@ |
5 | #define CORE_UBUNTU_MEDIA_PLAYER_H_ |
6 | |
7 | #include <core/media/track.h> |
8 | + |
9 | +#include <core/media/video/dimensions.h> |
10 | #include <core/media/video/sink.h> |
11 | |
12 | #include <core/property.h> |
13 | @@ -168,14 +170,9 @@ |
14 | virtual const core::Signal<int64_t>& seeked_to() const = 0; |
15 | virtual const core::Signal<void>& end_of_stream() const = 0; |
16 | virtual core::Signal<PlaybackStatus>& playback_status_changed() = 0; |
17 | - /** |
18 | - * Called when the video height/width change. Passes height and width as a bitmask with |
19 | - * height in the upper 32 bits and width in the lower 32 bits (both unsigned values) |
20 | - */ |
21 | - virtual const core::Signal<uint64_t>& video_dimension_changed() const = 0; |
22 | + virtual const core::Signal<video::Dimensions>& video_dimension_changed() const = 0; |
23 | /** Signals all errors and warnings (typically from GStreamer and below) */ |
24 | virtual const core::Signal<Error>& error() const = 0; |
25 | - |
26 | protected: |
27 | Player(); |
28 | |
29 | |
30 | === added file 'include/core/media/video/dimensions.h' |
31 | --- include/core/media/video/dimensions.h 1970-01-01 00:00:00 +0000 |
32 | +++ include/core/media/video/dimensions.h 2015-03-12 11:39:32 +0000 |
33 | @@ -0,0 +1,145 @@ |
34 | +/* |
35 | + * Copyright © 2014 Canonical Ltd. |
36 | + * |
37 | + * This program is free software: you can redistribute it and/or modify it |
38 | + * under the terms of the GNU Lesser General Public License version 3, |
39 | + * as published by the Free Software Foundation. |
40 | + * |
41 | + * This program is distributed in the hope that it will be useful, |
42 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
43 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
44 | + * GNU Lesser General Public License for more details. |
45 | + * |
46 | + * You should have received a copy of the GNU Lesser General Public License |
47 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
48 | + * |
49 | + * Authored by: Thomas Voß <thomas.voss@canonical.com> |
50 | + */ |
51 | +#ifndef CORE_UBUNTU_MEDIA_VIDEO_DIMENSIONS_H_ |
52 | +#define CORE_UBUNTU_MEDIA_VIDEO_DIMENSIONS_H_ |
53 | + |
54 | +#include <cstdint> |
55 | + |
56 | +#include <tuple> |
57 | + |
58 | +namespace core |
59 | +{ |
60 | +namespace ubuntu |
61 | +{ |
62 | +namespace media |
63 | +{ |
64 | +namespace video |
65 | +{ |
66 | +namespace detail |
67 | +{ |
68 | +enum class DimensionTag { width, height }; |
69 | + |
70 | +/** |
71 | + * @brief IntWrapper is a type-safe integer that allows for encoding/enforcing semantics by means of tags. |
72 | + * @tparam Tag Hint for the compiler on the semantics of the underlying integer. |
73 | + * @tparam IntegerType The underlying integer type. |
74 | + * |
75 | + * Handling dimensions like width and height with raw integer values is tedious and error prone |
76 | + * as the compiler has no way of distinguishing a width from a height, or an x coordinate from a |
77 | + * y coordinate. The problem is solvable with the tagged integer type presented here. Consider |
78 | + * the following example: |
79 | + * |
80 | + * @code{.cpp} |
81 | + * typedef IntWrapper<DimensionTag::width, std::uint32_t> Width; |
82 | + * typedef IntWrapper<DimensionTag::height, std::uint32_t> Height; |
83 | + * |
84 | + * void an_unsafe_function_expecting_width_and_height(std::uint32_t width, std::uint32_t height); |
85 | + * void a_safe_function_expecting_width_and_height(Width width, Height height); |
86 | + * |
87 | + * int main() |
88 | + * { |
89 | + * std::uint unsafe_width{640}, unsafe_height{480}; |
90 | + * Width width{640}; Height height{480}; |
91 | + * // This will compile but is still wrong |
92 | + * an_unsafe_function_expecting_width_and_height(unsafe_height, unsafe_width); |
93 | + * |
94 | + * // This will not compile |
95 | + * a_safe_function_expecting_width_and_height(height, width); |
96 | + * |
97 | + * } |
98 | + * @endcode |
99 | + */ |
100 | +template<DimensionTag Tag, typename IntegerType> |
101 | +class IntWrapper |
102 | +{ |
103 | +public: |
104 | + static_assert(std::is_integral<IntegerType>::value, "IntWrapper<> only supports integral types."); |
105 | + typedef IntegerType ValueType; |
106 | + |
107 | + IntWrapper() : value{0} {} |
108 | + template<typename AnyInteger> |
109 | + explicit IntWrapper(AnyInteger value) : value{static_cast<ValueType>(value)} {} |
110 | + |
111 | + template<typename T = IntegerType> |
112 | + T as() const |
113 | + { |
114 | + static_assert(std::is_arithmetic<T>::value, "as() only supports arithmetic types."); |
115 | + return static_cast<T>(value); |
116 | + } |
117 | + |
118 | +private: |
119 | + ValueType value; |
120 | +}; |
121 | + |
122 | +template<DimensionTag Tag, typename IntegerType> |
123 | +std::ostream& operator<<(std::ostream& out, IntWrapper<Tag, IntegerType> const& value) |
124 | +{ |
125 | + out << value.template as<>(); |
126 | + return out; |
127 | +} |
128 | + |
129 | +template<DimensionTag Tag, typename IntegerType> |
130 | +inline bool operator == (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs) |
131 | +{ |
132 | + return lhs.template as<>() == rhs.template as<>(); |
133 | +} |
134 | + |
135 | +template<DimensionTag Tag, typename IntegerType> |
136 | +inline bool operator != (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs) |
137 | +{ |
138 | + return lhs.template as<>() != rhs.template as<>(); |
139 | +} |
140 | + |
141 | +template<DimensionTag Tag, typename IntegerType> |
142 | +inline bool operator <= (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs) |
143 | +{ |
144 | + return lhs.template as<>() <= rhs.template as<>(); |
145 | +} |
146 | + |
147 | +template<DimensionTag Tag, typename IntegerType> |
148 | +inline bool operator >= (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs) |
149 | +{ |
150 | + return lhs.template as<>() >= rhs.template as<>(); |
151 | +} |
152 | + |
153 | +template<DimensionTag Tag, typename IntegerType> |
154 | +inline bool operator < (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs) |
155 | +{ |
156 | + return lhs.template as<>() < rhs.template as<>(); |
157 | +} |
158 | + |
159 | +template<DimensionTag Tag, typename IntegerType> |
160 | +inline bool operator > (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs) |
161 | +{ |
162 | + return lhs.template as<>() > rhs.template as<>(); |
163 | +} |
164 | +} // namespace detail |
165 | + |
166 | +/** @brief The integer Height of a video. */ |
167 | +typedef detail::IntWrapper<detail::DimensionTag::height, std::uint32_t> Height; |
168 | +/** @brief The integer Width of a video. */ |
169 | +typedef detail::IntWrapper<detail::DimensionTag::width, std::uint32_t> Width; |
170 | + |
171 | +/** @brief Height and Width of a video. */ |
172 | +typedef std::tuple<Height, Width> Dimensions; |
173 | +} |
174 | +} |
175 | +} |
176 | +} |
177 | + |
178 | +#endif // CORE_UBUNTU_MEDIA_VIDEO_DIMENSIONS_H_ |
179 | |
180 | === modified file 'src/core/media/codec.h' |
181 | --- src/core/media/codec.h 2015-01-13 14:18:59 +0000 |
182 | +++ src/core/media/codec.h 2015-03-12 11:39:32 +0000 |
183 | @@ -232,6 +232,31 @@ |
184 | |
185 | namespace helper |
186 | { |
187 | +template<core::ubuntu::media::video::detail::DimensionTag tag, typename IntegerType> |
188 | +struct TypeMapper<core::ubuntu::media::video::detail::IntWrapper<tag, IntegerType>> |
189 | +{ |
190 | + constexpr static ArgumentType type_value() |
191 | + { |
192 | + return core::dbus::ArgumentType::uint32; |
193 | + } |
194 | + |
195 | + constexpr static bool is_basic_type() |
196 | + { |
197 | + return true; |
198 | + } |
199 | + |
200 | + constexpr static bool requires_signature() |
201 | + { |
202 | + return false; |
203 | + } |
204 | + |
205 | + static std::string signature() |
206 | + { |
207 | + static const std::string s = TypeMapper<std::uint32_t>::signature(); |
208 | + return s; |
209 | + } |
210 | +}; |
211 | + |
212 | template<> |
213 | struct TypeMapper<core::ubuntu::media::Player::Lifetime> |
214 | { |
215 | @@ -239,10 +264,12 @@ |
216 | { |
217 | return core::dbus::ArgumentType::int16; |
218 | } |
219 | + |
220 | constexpr static bool is_basic_type() |
221 | { |
222 | - return false; |
223 | + return true; |
224 | } |
225 | + |
226 | constexpr static bool requires_signature() |
227 | { |
228 | return false; |
229 | @@ -256,14 +283,30 @@ |
230 | }; |
231 | } |
232 | |
233 | +template<core::ubuntu::media::video::detail::DimensionTag tag, typename IntegerType> |
234 | +struct Codec<core::ubuntu::media::video::detail::IntWrapper<tag, IntegerType>> |
235 | +{ |
236 | + static void encode_argument(core::dbus::Message::Writer& out, const core::ubuntu::media::video::detail::IntWrapper<tag, IntegerType>& in) |
237 | + { |
238 | + out.push_uint32(in.template as<std::uint32_t>()); |
239 | + } |
240 | + |
241 | + static void decode_argument(core::dbus::Message::Reader& out, core::ubuntu::media::video::detail::IntWrapper<tag, IntegerType>& in) |
242 | + { |
243 | + in = core::ubuntu::media::video::detail::IntWrapper<tag, IntegerType>{out.pop_uint32()}; |
244 | + } |
245 | +}; |
246 | + |
247 | template<> |
248 | struct Codec<core::ubuntu::media::Player::Lifetime> |
249 | { |
250 | + |
251 | static void encode_argument(core::dbus::Message::Writer& out, const core::ubuntu::media::Player::Lifetime& in) |
252 | { |
253 | out.push_int16(static_cast<std::int16_t>(in)); |
254 | } |
255 | |
256 | + |
257 | static void decode_argument(core::dbus::Message::Reader& out, core::ubuntu::media::Player::Lifetime& in) |
258 | { |
259 | in = static_cast<core::ubuntu::media::Player::Lifetime>(out.pop_int16()); |
260 | |
261 | === modified file 'src/core/media/engine.h' |
262 | --- src/core/media/engine.h 2015-03-12 11:39:32 +0000 |
263 | +++ src/core/media/engine.h 2015-03-12 11:39:32 +0000 |
264 | @@ -110,7 +110,7 @@ |
265 | virtual const core::Signal<void>& client_disconnected_signal() const = 0; |
266 | virtual const core::Signal<void>& end_of_stream_signal() const = 0; |
267 | virtual const core::Signal<core::ubuntu::media::Player::PlaybackStatus>& playback_status_changed_signal() const = 0; |
268 | - virtual const core::Signal<uint32_t, uint32_t>& video_dimension_changed_signal() const = 0; |
269 | + virtual const core::Signal<video::Dimensions>& video_dimension_changed_signal() const = 0; |
270 | virtual const core::Signal<core::ubuntu::media::Player::Error>& error_signal() const = 0; |
271 | |
272 | virtual void reset() = 0; |
273 | |
274 | === modified file 'src/core/media/gstreamer/engine.cpp' |
275 | --- src/core/media/gstreamer/engine.cpp 2015-01-19 21:48:01 +0000 |
276 | +++ src/core/media/gstreamer/engine.cpp 2015-03-12 11:39:32 +0000 |
277 | @@ -175,9 +175,9 @@ |
278 | end_of_stream(); |
279 | } |
280 | |
281 | - void on_video_dimension_changed(uint32_t height, uint32_t width) |
282 | + void on_video_dimension_changed(const media::video::Dimensions& dimensions) |
283 | { |
284 | - video_dimension_changed(height, width); |
285 | + video_dimension_changed(dimensions); |
286 | } |
287 | |
288 | Private() |
289 | @@ -262,12 +262,11 @@ |
290 | &Private::on_end_of_stream, |
291 | this))), |
292 | on_video_dimension_changed_connection( |
293 | - playbin.signals.on_add_frame_dimension.connect( |
294 | + playbin.signals.on_video_dimensions_changed.connect( |
295 | std::bind( |
296 | &Private::on_video_dimension_changed, |
297 | this, |
298 | - std::placeholders::_1, |
299 | - std::placeholders::_2))) |
300 | + std::placeholders::_1))) |
301 | { |
302 | } |
303 | |
304 | @@ -307,7 +306,7 @@ |
305 | core::Signal<void> client_disconnected; |
306 | core::Signal<void> end_of_stream; |
307 | core::Signal<media::Player::PlaybackStatus> playback_status_changed; |
308 | - core::Signal<uint32_t, uint32_t> video_dimension_changed; |
309 | + core::Signal<core::ubuntu::media::video::Dimensions> video_dimension_changed; |
310 | core::Signal<media::Player::Error> error; |
311 | }; |
312 | |
313 | @@ -500,7 +499,7 @@ |
314 | return d->playback_status_changed; |
315 | } |
316 | |
317 | -const core::Signal<uint32_t, uint32_t>& gstreamer::Engine::video_dimension_changed_signal() const |
318 | +const core::Signal<core::ubuntu::media::video::Dimensions>& gstreamer::Engine::video_dimension_changed_signal() const |
319 | { |
320 | return d->video_dimension_changed; |
321 | } |
322 | |
323 | === modified file 'src/core/media/gstreamer/engine.h' |
324 | --- src/core/media/gstreamer/engine.h 2015-01-13 14:18:59 +0000 |
325 | +++ src/core/media/gstreamer/engine.h 2015-03-12 11:39:32 +0000 |
326 | @@ -66,7 +66,7 @@ |
327 | const core::Signal<void>& client_disconnected_signal() const; |
328 | const core::Signal<void>& end_of_stream_signal() const; |
329 | const core::Signal<core::ubuntu::media::Player::PlaybackStatus>& playback_status_changed_signal() const; |
330 | - const core::Signal<uint32_t, uint32_t>& video_dimension_changed_signal() const; |
331 | + const core::Signal<core::ubuntu::media::video::Dimensions>& video_dimension_changed_signal() const; |
332 | const core::Signal<core::ubuntu::media::Player::Error>& error_signal() const; |
333 | |
334 | void reset(); |
335 | |
336 | === modified file 'src/core/media/gstreamer/playbin.h' |
337 | --- src/core/media/gstreamer/playbin.h 2014-11-11 23:59:07 +0000 |
338 | +++ src/core/media/gstreamer/playbin.h 2015-03-12 11:39:32 +0000 |
339 | @@ -85,8 +85,6 @@ |
340 | bus{gst_element_get_bus(pipeline)}, |
341 | file_type(MEDIA_FILE_TYPE_NONE), |
342 | video_sink(nullptr), |
343 | - video_height(0), |
344 | - video_width(0), |
345 | on_new_message_connection( |
346 | bus.on_new_message.connect( |
347 | std::bind( |
348 | @@ -425,19 +423,22 @@ |
349 | pipeline, |
350 | ¤t, |
351 | &pending, |
352 | - state_change_timeout.count()); |
353 | + state_change_timeout.count()); |
354 | + break; |
355 | + } |
356 | |
357 | - if (new_state == GST_STATE_PLAYING) |
358 | + // The state change has to have been successful to make |
359 | + // sure that we indeed reached the requested new state. |
360 | + if (result && new_state == GST_STATE_PLAYING) |
361 | { |
362 | // Get the video height/width from the video sink |
363 | - get_video_dimensions(); |
364 | + if (has_video_sink_with_height_and_width()) |
365 | + signals.on_video_dimensions_changed(get_video_dimensions()); |
366 | #ifdef DEBUG_GST_PIPELINE |
367 | std::cout << "Dumping pipeline dot file" << std::endl; |
368 | GST_DEBUG_BIN_TO_DOT_FILE((GstBin*)pipeline, GST_DEBUG_GRAPH_SHOW_ALL, "pipeline"); |
369 | #endif |
370 | } |
371 | - break; |
372 | - } |
373 | |
374 | return result; |
375 | } |
376 | @@ -452,27 +453,26 @@ |
377 | ms.count() * 1000); |
378 | } |
379 | |
380 | - void get_video_dimensions() |
381 | - { |
382 | - if (video_sink != nullptr && g_strcmp0(::getenv("CORE_UBUNTU_MEDIA_SERVICE_VIDEO_SINK_NAME"), "mirsink") == 0) |
383 | + bool has_video_sink_with_height_and_width() |
384 | + { |
385 | + return video_sink != nullptr && g_strcmp0(::getenv("CORE_UBUNTU_MEDIA_SERVICE_VIDEO_SINK_NAME"), "mirsink") == 0; |
386 | + } |
387 | + |
388 | + core::ubuntu::media::video::Dimensions get_video_dimensions() |
389 | + { |
390 | + if (not has_video_sink_with_height_and_width()) |
391 | + throw std::runtime_error{"Could not get the height/width of each video frame"}; |
392 | + |
393 | + uint32_t video_height = 0, video_width = 0; |
394 | + g_object_get (video_sink, "height", &video_height, nullptr); |
395 | + g_object_get (video_sink, "width", &video_width, nullptr); |
396 | + std::cout << "video_height: " << video_height << ", video_width: " << video_width << std::endl; |
397 | + |
398 | + return core::ubuntu::media::video::Dimensions |
399 | { |
400 | - g_object_get (video_sink, "height", &video_height, nullptr); |
401 | - g_object_get (video_sink, "width", &video_width, nullptr); |
402 | - std::cout << "video_height: " << video_height << ", video_width: " << video_width << std::endl; |
403 | - signals.on_add_frame_dimension(video_height, video_width); |
404 | - } |
405 | - else |
406 | - std::cerr << "Could not get the height/width of each video frame" << std::endl; |
407 | - } |
408 | - |
409 | - int get_video_height() const |
410 | - { |
411 | - return video_height; |
412 | - } |
413 | - |
414 | - int get_video_width() const |
415 | - { |
416 | - return video_width; |
417 | + core::ubuntu::media::video::Height{video_height}, |
418 | + core::ubuntu::media::video::Width{video_width} |
419 | + }; |
420 | } |
421 | |
422 | std::string get_file_content_type(const std::string& uri) const |
423 | @@ -555,8 +555,6 @@ |
424 | MediaFileType file_type; |
425 | SurfaceTextureClientHybris stc_hybris; |
426 | GstElement* video_sink; |
427 | - uint32_t video_height; |
428 | - uint32_t video_width; |
429 | core::Connection on_new_message_connection; |
430 | bool is_seeking; |
431 | core::ubuntu::media::Player::HeadersType request_headers; |
432 | @@ -571,9 +569,9 @@ |
433 | core::Signal<Bus::Message::Detail::StateChanged> on_state_changed; |
434 | core::Signal<uint64_t> on_seeked_to; |
435 | core::Signal<void> on_end_of_stream; |
436 | - core::Signal<media::Player::PlaybackStatus> on_playback_status_changed; |
437 | - core::Signal<media::Player::Orientation> on_orientation_changed; |
438 | - core::Signal<uint32_t, uint32_t> on_add_frame_dimension; |
439 | + core::Signal<core::ubuntu::media::Player::PlaybackStatus> on_playback_status_changed; |
440 | + core::Signal<core::ubuntu::media::Player::Orientation> on_orientation_changed; |
441 | + core::Signal<core::ubuntu::media::video::Dimensions> on_video_dimensions_changed; |
442 | core::Signal<void> client_disconnected; |
443 | } signals; |
444 | }; |
445 | |
446 | === modified file 'src/core/media/mpris/player.h' |
447 | --- src/core/media/mpris/player.h 2015-03-12 11:39:32 +0000 |
448 | +++ src/core/media/mpris/player.h 2015-03-12 11:39:32 +0000 |
449 | @@ -34,12 +34,16 @@ |
450 | #include <core/dbus/types/object_path.h> |
451 | #include <core/dbus/types/variant.h> |
452 | |
453 | +#include <core/dbus/types/stl/tuple.h> |
454 | + |
455 | #include <boost/utility/identity_type.hpp> |
456 | |
457 | #include <string> |
458 | #include <tuple> |
459 | #include <vector> |
460 | |
461 | +#include <cstdint> |
462 | + |
463 | namespace dbus = core::dbus; |
464 | |
465 | namespace mpris |
466 | @@ -134,7 +138,7 @@ |
467 | DBUS_CPP_SIGNAL_DEF(Seeked, Player, std::int64_t) |
468 | DBUS_CPP_SIGNAL_DEF(EndOfStream, Player, void) |
469 | DBUS_CPP_SIGNAL_DEF(PlaybackStatusChanged, Player, core::ubuntu::media::Player::PlaybackStatus) |
470 | - DBUS_CPP_SIGNAL_DEF(VideoDimensionChanged, Player, std::uint64_t) |
471 | + DBUS_CPP_SIGNAL_DEF(VideoDimensionChanged, Player, core::ubuntu::media::video::Dimensions) |
472 | DBUS_CPP_SIGNAL_DEF(Error, Player, core::ubuntu::media::Player::Error) |
473 | }; |
474 | |
475 | |
476 | === modified file 'src/core/media/player_implementation.cpp' |
477 | --- src/core/media/player_implementation.cpp 2015-03-12 11:39:32 +0000 |
478 | +++ src/core/media/player_implementation.cpp 2015-03-12 11:39:32 +0000 |
479 | @@ -415,12 +415,9 @@ |
480 | playback_status_changed()(status); |
481 | }); |
482 | |
483 | - d->engine->video_dimension_changed_signal().connect([this](uint32_t height, uint32_t width) |
484 | + d->engine->video_dimension_changed_signal().connect([this](const media::video::Dimensions& dimensions) |
485 | { |
486 | - uint64_t mask = 0; |
487 | - // Left most 32 bits are for height, right most 32 bits are for width |
488 | - mask = (static_cast<uint64_t>(height) << 32) | static_cast<uint64_t>(width); |
489 | - video_dimension_changed()(mask); |
490 | + video_dimension_changed()(dimensions); |
491 | }); |
492 | |
493 | d->engine->error_signal().connect([this](const Player::Error& e) |
494 | |
495 | === modified file 'src/core/media/player_skeleton.cpp' |
496 | --- src/core/media/player_skeleton.cpp 2015-03-12 11:39:32 +0000 |
497 | +++ src/core/media/player_skeleton.cpp 2015-03-12 11:39:32 +0000 |
498 | @@ -19,6 +19,7 @@ |
499 | |
500 | #include "apparmor.h" |
501 | #include "codec.h" |
502 | +#include "engine.h" |
503 | #include "player_skeleton.h" |
504 | #include "player_traits.h" |
505 | #include "property_stub.h" |
506 | @@ -338,9 +339,9 @@ |
507 | remote_playback_status_changed->emit(status); |
508 | }); |
509 | |
510 | - video_dimension_changed.connect([remote_video_dimension_changed](uint64_t mask) |
511 | + video_dimension_changed.connect([remote_video_dimension_changed](const media::video::Dimensions& dimensions) |
512 | { |
513 | - remote_video_dimension_changed->emit(mask); |
514 | + remote_video_dimension_changed->emit(dimensions); |
515 | }); |
516 | |
517 | error.connect([remote_error](const media::Player::Error& e) |
518 | @@ -352,7 +353,7 @@ |
519 | core::Signal<int64_t> seeked_to; |
520 | core::Signal<void> end_of_stream; |
521 | core::Signal<media::Player::PlaybackStatus> playback_status_changed; |
522 | - core::Signal<uint64_t> video_dimension_changed; |
523 | + core::Signal<media::video::Dimensions> video_dimension_changed; |
524 | core::Signal<media::Player::Error> error; |
525 | } signals; |
526 | |
527 | @@ -649,12 +650,12 @@ |
528 | return d->signals.playback_status_changed; |
529 | } |
530 | |
531 | -const core::Signal<uint64_t>& media::PlayerSkeleton::video_dimension_changed() const |
532 | +const core::Signal<media::video::Dimensions>& media::PlayerSkeleton::video_dimension_changed() const |
533 | { |
534 | return d->signals.video_dimension_changed; |
535 | } |
536 | |
537 | -core::Signal<uint64_t>& media::PlayerSkeleton::video_dimension_changed() |
538 | +core::Signal<media::video::Dimensions>& media::PlayerSkeleton::video_dimension_changed() |
539 | { |
540 | return d->signals.video_dimension_changed; |
541 | } |
542 | |
543 | === modified file 'src/core/media/player_skeleton.h' |
544 | --- src/core/media/player_skeleton.h 2015-01-13 14:18:59 +0000 |
545 | +++ src/core/media/player_skeleton.h 2015-03-12 11:39:32 +0000 |
546 | @@ -75,7 +75,7 @@ |
547 | virtual const core::Signal<int64_t>& seeked_to() const; |
548 | virtual const core::Signal<void>& end_of_stream() const; |
549 | virtual core::Signal<PlaybackStatus>& playback_status_changed(); |
550 | - virtual const core::Signal<uint64_t>& video_dimension_changed() const; |
551 | + virtual const core::Signal<video::Dimensions>& video_dimension_changed() const; |
552 | virtual const core::Signal<Error>& error() const; |
553 | |
554 | protected: |
555 | @@ -112,7 +112,7 @@ |
556 | |
557 | virtual core::Signal<int64_t>& seeked_to(); |
558 | virtual core::Signal<void>& end_of_stream(); |
559 | - virtual core::Signal<uint64_t>& video_dimension_changed(); |
560 | + virtual core::Signal<video::Dimensions>& video_dimension_changed(); |
561 | virtual core::Signal<Error>& error(); |
562 | |
563 | private: |
564 | |
565 | === modified file 'src/core/media/player_stub.cpp' |
566 | --- src/core/media/player_stub.cpp 2015-03-12 11:39:32 +0000 |
567 | +++ src/core/media/player_stub.cpp 2015-03-12 11:39:32 +0000 |
568 | @@ -168,10 +168,10 @@ |
569 | playback_status_changed(status); |
570 | }); |
571 | |
572 | - dbus.video_dimension_changed->connect([this](uint64_t mask) |
573 | + dbus.video_dimension_changed->connect([this](const media::video::Dimensions dimensions) |
574 | { |
575 | std::cout << "VideoDimensionChanged signal arrived via the bus." << std::endl; |
576 | - video_dimension_changed(mask); |
577 | + video_dimension_changed(dimensions); |
578 | }); |
579 | |
580 | dbus.error->connect([this](const media::Player::Error& e) |
581 | @@ -184,7 +184,7 @@ |
582 | core::Signal<int64_t> seeked_to; |
583 | core::Signal<void> end_of_stream; |
584 | core::Signal<media::Player::PlaybackStatus> playback_status_changed; |
585 | - core::Signal<uint64_t> video_dimension_changed; |
586 | + core::Signal<media::video::Dimensions> video_dimension_changed; |
587 | core::Signal<media::Player::Error> error; |
588 | |
589 | struct DBus |
590 | @@ -448,7 +448,7 @@ |
591 | return d->signals.playback_status_changed; |
592 | } |
593 | |
594 | -const core::Signal<uint64_t>& media::PlayerStub::video_dimension_changed() const |
595 | +const core::Signal<media::video::Dimensions>& media::PlayerStub::video_dimension_changed() const |
596 | { |
597 | return d->signals.video_dimension_changed; |
598 | } |
599 | |
600 | === modified file 'src/core/media/player_stub.h' |
601 | --- src/core/media/player_stub.h 2015-03-12 11:39:32 +0000 |
602 | +++ src/core/media/player_stub.h 2015-03-12 11:39:32 +0000 |
603 | @@ -88,7 +88,7 @@ |
604 | virtual const core::Signal<int64_t>& seeked_to() const; |
605 | virtual const core::Signal<void>& end_of_stream() const; |
606 | virtual core::Signal<PlaybackStatus>& playback_status_changed(); |
607 | - virtual const core::Signal<uint64_t>& video_dimension_changed() const; |
608 | + virtual const core::Signal<video::Dimensions>& video_dimension_changed() const; |
609 | virtual const core::Signal<Error>& error() const; |
610 | |
611 | private: |
FAILED: Continuous integration, rev:100 jenkins. qa.ubuntu. com/job/ media-hub- ci/177/ jenkins. qa.ubuntu. com/job/ media-hub- vivid-amd64- ci/17/console jenkins. qa.ubuntu. com/job/ media-hub- vivid-armhf- ci/17/console jenkins. qa.ubuntu. com/job/ media-hub- vivid-i386- ci/17/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/ 177/rebuild
http://