Merge lp:~thomas-voss/media-hub/make-video-size-a-proper-type into lp:media-hub

Proposed by Thomas Voß
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
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::video::Dimensions.
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::video::Dimensions.
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.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
101. By Thomas Voß

Remerge prereq branch.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

A few inline comments below. Please make sure to rebase with trunk.

review: Needs Fixing (code)
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.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
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)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
105. By Thomas Voß

Merge prereq branch.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

The jenkins node for the i386 build failed, I've restarted a new ci run.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
106. By Thomas Voß

Merge prereq branch.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/core/media/player.h'
--- include/core/media/player.h 2015-03-12 11:39:32 +0000
+++ include/core/media/player.h 2015-03-12 11:39:32 +0000
@@ -20,6 +20,8 @@
20#define CORE_UBUNTU_MEDIA_PLAYER_H_20#define CORE_UBUNTU_MEDIA_PLAYER_H_
2121
22#include <core/media/track.h>22#include <core/media/track.h>
23
24#include <core/media/video/dimensions.h>
23#include <core/media/video/sink.h>25#include <core/media/video/sink.h>
2426
25#include <core/property.h>27#include <core/property.h>
@@ -168,14 +170,9 @@
168 virtual const core::Signal<int64_t>& seeked_to() const = 0;170 virtual const core::Signal<int64_t>& seeked_to() const = 0;
169 virtual const core::Signal<void>& end_of_stream() const = 0;171 virtual const core::Signal<void>& end_of_stream() const = 0;
170 virtual core::Signal<PlaybackStatus>& playback_status_changed() = 0;172 virtual core::Signal<PlaybackStatus>& playback_status_changed() = 0;
171 /**173 virtual const core::Signal<video::Dimensions>& video_dimension_changed() const = 0;
172 * Called when the video height/width change. Passes height and width as a bitmask with
173 * height in the upper 32 bits and width in the lower 32 bits (both unsigned values)
174 */
175 virtual const core::Signal<uint64_t>& video_dimension_changed() const = 0;
176 /** Signals all errors and warnings (typically from GStreamer and below) */174 /** Signals all errors and warnings (typically from GStreamer and below) */
177 virtual const core::Signal<Error>& error() const = 0;175 virtual const core::Signal<Error>& error() const = 0;
178
179 protected:176 protected:
180 Player();177 Player();
181178
182179
=== added file 'include/core/media/video/dimensions.h'
--- include/core/media/video/dimensions.h 1970-01-01 00:00:00 +0000
+++ include/core/media/video/dimensions.h 2015-03-12 11:39:32 +0000
@@ -0,0 +1,145 @@
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_DIMENSIONS_H_
19#define CORE_UBUNTU_MEDIA_VIDEO_DIMENSIONS_H_
20
21#include <cstdint>
22
23#include <tuple>
24
25namespace core
26{
27namespace ubuntu
28{
29namespace media
30{
31namespace video
32{
33namespace detail
34{
35enum class DimensionTag { width, height };
36
37/**
38 * @brief IntWrapper is a type-safe integer that allows for encoding/enforcing semantics by means of tags.
39 * @tparam Tag Hint for the compiler on the semantics of the underlying integer.
40 * @tparam IntegerType The underlying integer type.
41 *
42 * Handling dimensions like width and height with raw integer values is tedious and error prone
43 * as the compiler has no way of distinguishing a width from a height, or an x coordinate from a
44 * y coordinate. The problem is solvable with the tagged integer type presented here. Consider
45 * the following example:
46 *
47 * @code{.cpp}
48 * typedef IntWrapper<DimensionTag::width, std::uint32_t> Width;
49 * typedef IntWrapper<DimensionTag::height, std::uint32_t> Height;
50 *
51 * void an_unsafe_function_expecting_width_and_height(std::uint32_t width, std::uint32_t height);
52 * void a_safe_function_expecting_width_and_height(Width width, Height height);
53 *
54 * int main()
55 * {
56 * std::uint unsafe_width{640}, unsafe_height{480};
57 * Width width{640}; Height height{480};
58 * // This will compile but is still wrong
59 * an_unsafe_function_expecting_width_and_height(unsafe_height, unsafe_width);
60 *
61 * // This will not compile
62 * a_safe_function_expecting_width_and_height(height, width);
63 *
64 * }
65 * @endcode
66 */
67template<DimensionTag Tag, typename IntegerType>
68class IntWrapper
69{
70public:
71 static_assert(std::is_integral<IntegerType>::value, "IntWrapper<> only supports integral types.");
72 typedef IntegerType ValueType;
73
74 IntWrapper() : value{0} {}
75 template<typename AnyInteger>
76 explicit IntWrapper(AnyInteger value) : value{static_cast<ValueType>(value)} {}
77
78 template<typename T = IntegerType>
79 T as() const
80 {
81 static_assert(std::is_arithmetic<T>::value, "as() only supports arithmetic types.");
82 return static_cast<T>(value);
83 }
84
85private:
86 ValueType value;
87};
88
89template<DimensionTag Tag, typename IntegerType>
90std::ostream& operator<<(std::ostream& out, IntWrapper<Tag, IntegerType> const& value)
91{
92 out << value.template as<>();
93 return out;
94}
95
96template<DimensionTag Tag, typename IntegerType>
97inline bool operator == (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs)
98{
99 return lhs.template as<>() == rhs.template as<>();
100}
101
102template<DimensionTag Tag, typename IntegerType>
103inline bool operator != (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs)
104{
105 return lhs.template as<>() != rhs.template as<>();
106}
107
108template<DimensionTag Tag, typename IntegerType>
109inline bool operator <= (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs)
110{
111 return lhs.template as<>() <= rhs.template as<>();
112}
113
114template<DimensionTag Tag, typename IntegerType>
115inline bool operator >= (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs)
116{
117 return lhs.template as<>() >= rhs.template as<>();
118}
119
120template<DimensionTag Tag, typename IntegerType>
121inline bool operator < (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs)
122{
123 return lhs.template as<>() < rhs.template as<>();
124}
125
126template<DimensionTag Tag, typename IntegerType>
127inline bool operator > (IntWrapper<Tag, IntegerType> const& lhs, IntWrapper<Tag, IntegerType> const& rhs)
128{
129 return lhs.template as<>() > rhs.template as<>();
130}
131} // namespace detail
132
133/** @brief The integer Height of a video. */
134typedef detail::IntWrapper<detail::DimensionTag::height, std::uint32_t> Height;
135/** @brief The integer Width of a video. */
136typedef detail::IntWrapper<detail::DimensionTag::width, std::uint32_t> Width;
137
138/** @brief Height and Width of a video. */
139typedef std::tuple<Height, Width> Dimensions;
140}
141}
142}
143}
144
145#endif // CORE_UBUNTU_MEDIA_VIDEO_DIMENSIONS_H_
0146
=== modified file 'src/core/media/codec.h'
--- src/core/media/codec.h 2015-01-13 14:18:59 +0000
+++ src/core/media/codec.h 2015-03-12 11:39:32 +0000
@@ -232,6 +232,31 @@
232232
233namespace helper233namespace helper
234{234{
235template<core::ubuntu::media::video::detail::DimensionTag tag, typename IntegerType>
236struct TypeMapper<core::ubuntu::media::video::detail::IntWrapper<tag, IntegerType>>
237{
238 constexpr static ArgumentType type_value()
239 {
240 return core::dbus::ArgumentType::uint32;
241 }
242
243 constexpr static bool is_basic_type()
244 {
245 return true;
246 }
247
248 constexpr static bool requires_signature()
249 {
250 return false;
251 }
252
253 static std::string signature()
254 {
255 static const std::string s = TypeMapper<std::uint32_t>::signature();
256 return s;
257 }
258};
259
235template<>260template<>
236struct TypeMapper<core::ubuntu::media::Player::Lifetime>261struct TypeMapper<core::ubuntu::media::Player::Lifetime>
237{262{
@@ -239,10 +264,12 @@
239 {264 {
240 return core::dbus::ArgumentType::int16;265 return core::dbus::ArgumentType::int16;
241 }266 }
267
242 constexpr static bool is_basic_type()268 constexpr static bool is_basic_type()
243 {269 {
244 return false;270 return true;
245 }271 }
272
246 constexpr static bool requires_signature()273 constexpr static bool requires_signature()
247 {274 {
248 return false;275 return false;
@@ -256,14 +283,30 @@
256};283};
257}284}
258285
286template<core::ubuntu::media::video::detail::DimensionTag tag, typename IntegerType>
287struct Codec<core::ubuntu::media::video::detail::IntWrapper<tag, IntegerType>>
288{
289 static void encode_argument(core::dbus::Message::Writer& out, const core::ubuntu::media::video::detail::IntWrapper<tag, IntegerType>& in)
290 {
291 out.push_uint32(in.template as<std::uint32_t>());
292 }
293
294 static void decode_argument(core::dbus::Message::Reader& out, core::ubuntu::media::video::detail::IntWrapper<tag, IntegerType>& in)
295 {
296 in = core::ubuntu::media::video::detail::IntWrapper<tag, IntegerType>{out.pop_uint32()};
297 }
298};
299
259template<>300template<>
260struct Codec<core::ubuntu::media::Player::Lifetime>301struct Codec<core::ubuntu::media::Player::Lifetime>
261{302{
303
262 static void encode_argument(core::dbus::Message::Writer& out, const core::ubuntu::media::Player::Lifetime& in)304 static void encode_argument(core::dbus::Message::Writer& out, const core::ubuntu::media::Player::Lifetime& in)
263 {305 {
264 out.push_int16(static_cast<std::int16_t>(in));306 out.push_int16(static_cast<std::int16_t>(in));
265 }307 }
266308
309
267 static void decode_argument(core::dbus::Message::Reader& out, core::ubuntu::media::Player::Lifetime& in)310 static void decode_argument(core::dbus::Message::Reader& out, core::ubuntu::media::Player::Lifetime& in)
268 {311 {
269 in = static_cast<core::ubuntu::media::Player::Lifetime>(out.pop_int16());312 in = static_cast<core::ubuntu::media::Player::Lifetime>(out.pop_int16());
270313
=== modified file 'src/core/media/engine.h'
--- src/core/media/engine.h 2015-03-12 11:39:32 +0000
+++ src/core/media/engine.h 2015-03-12 11:39:32 +0000
@@ -110,7 +110,7 @@
110 virtual const core::Signal<void>& client_disconnected_signal() const = 0;110 virtual const core::Signal<void>& client_disconnected_signal() const = 0;
111 virtual const core::Signal<void>& end_of_stream_signal() const = 0;111 virtual const core::Signal<void>& end_of_stream_signal() const = 0;
112 virtual const core::Signal<core::ubuntu::media::Player::PlaybackStatus>& playback_status_changed_signal() const = 0;112 virtual const core::Signal<core::ubuntu::media::Player::PlaybackStatus>& playback_status_changed_signal() const = 0;
113 virtual const core::Signal<uint32_t, uint32_t>& video_dimension_changed_signal() const = 0;113 virtual const core::Signal<video::Dimensions>& video_dimension_changed_signal() const = 0;
114 virtual const core::Signal<core::ubuntu::media::Player::Error>& error_signal() const = 0;114 virtual const core::Signal<core::ubuntu::media::Player::Error>& error_signal() const = 0;
115115
116 virtual void reset() = 0;116 virtual void reset() = 0;
117117
=== modified file 'src/core/media/gstreamer/engine.cpp'
--- src/core/media/gstreamer/engine.cpp 2015-01-19 21:48:01 +0000
+++ src/core/media/gstreamer/engine.cpp 2015-03-12 11:39:32 +0000
@@ -175,9 +175,9 @@
175 end_of_stream();175 end_of_stream();
176 }176 }
177177
178 void on_video_dimension_changed(uint32_t height, uint32_t width)178 void on_video_dimension_changed(const media::video::Dimensions& dimensions)
179 {179 {
180 video_dimension_changed(height, width);180 video_dimension_changed(dimensions);
181 }181 }
182182
183 Private()183 Private()
@@ -262,12 +262,11 @@
262 &Private::on_end_of_stream,262 &Private::on_end_of_stream,
263 this))),263 this))),
264 on_video_dimension_changed_connection(264 on_video_dimension_changed_connection(
265 playbin.signals.on_add_frame_dimension.connect(265 playbin.signals.on_video_dimensions_changed.connect(
266 std::bind(266 std::bind(
267 &Private::on_video_dimension_changed,267 &Private::on_video_dimension_changed,
268 this,268 this,
269 std::placeholders::_1,269 std::placeholders::_1)))
270 std::placeholders::_2)))
271 {270 {
272 }271 }
273272
@@ -307,7 +306,7 @@
307 core::Signal<void> client_disconnected;306 core::Signal<void> client_disconnected;
308 core::Signal<void> end_of_stream;307 core::Signal<void> end_of_stream;
309 core::Signal<media::Player::PlaybackStatus> playback_status_changed;308 core::Signal<media::Player::PlaybackStatus> playback_status_changed;
310 core::Signal<uint32_t, uint32_t> video_dimension_changed;309 core::Signal<core::ubuntu::media::video::Dimensions> video_dimension_changed;
311 core::Signal<media::Player::Error> error;310 core::Signal<media::Player::Error> error;
312};311};
313312
@@ -500,7 +499,7 @@
500 return d->playback_status_changed;499 return d->playback_status_changed;
501}500}
502501
503const core::Signal<uint32_t, uint32_t>& gstreamer::Engine::video_dimension_changed_signal() const502const core::Signal<core::ubuntu::media::video::Dimensions>& gstreamer::Engine::video_dimension_changed_signal() const
504{503{
505 return d->video_dimension_changed;504 return d->video_dimension_changed;
506}505}
507506
=== modified file 'src/core/media/gstreamer/engine.h'
--- src/core/media/gstreamer/engine.h 2015-01-13 14:18:59 +0000
+++ src/core/media/gstreamer/engine.h 2015-03-12 11:39:32 +0000
@@ -66,7 +66,7 @@
66 const core::Signal<void>& client_disconnected_signal() const;66 const core::Signal<void>& client_disconnected_signal() const;
67 const core::Signal<void>& end_of_stream_signal() const;67 const core::Signal<void>& end_of_stream_signal() const;
68 const core::Signal<core::ubuntu::media::Player::PlaybackStatus>& playback_status_changed_signal() const;68 const core::Signal<core::ubuntu::media::Player::PlaybackStatus>& playback_status_changed_signal() const;
69 const core::Signal<uint32_t, uint32_t>& video_dimension_changed_signal() const;69 const core::Signal<core::ubuntu::media::video::Dimensions>& video_dimension_changed_signal() const;
70 const core::Signal<core::ubuntu::media::Player::Error>& error_signal() const;70 const core::Signal<core::ubuntu::media::Player::Error>& error_signal() const;
7171
72 void reset();72 void reset();
7373
=== modified file 'src/core/media/gstreamer/playbin.h'
--- src/core/media/gstreamer/playbin.h 2014-11-11 23:59:07 +0000
+++ src/core/media/gstreamer/playbin.h 2015-03-12 11:39:32 +0000
@@ -85,8 +85,6 @@
85 bus{gst_element_get_bus(pipeline)},85 bus{gst_element_get_bus(pipeline)},
86 file_type(MEDIA_FILE_TYPE_NONE),86 file_type(MEDIA_FILE_TYPE_NONE),
87 video_sink(nullptr),87 video_sink(nullptr),
88 video_height(0),
89 video_width(0),
90 on_new_message_connection(88 on_new_message_connection(
91 bus.on_new_message.connect(89 bus.on_new_message.connect(
92 std::bind(90 std::bind(
@@ -425,19 +423,22 @@
425 pipeline,423 pipeline,
426 &current,424 &current,
427 &pending,425 &pending,
428 state_change_timeout.count());426 state_change_timeout.count());
427 break;
428 }
429429
430 if (new_state == GST_STATE_PLAYING)430 // The state change has to have been successful to make
431 // sure that we indeed reached the requested new state.
432 if (result && new_state == GST_STATE_PLAYING)
431 {433 {
432 // Get the video height/width from the video sink434 // Get the video height/width from the video sink
433 get_video_dimensions();435 if (has_video_sink_with_height_and_width())
436 signals.on_video_dimensions_changed(get_video_dimensions());
434#ifdef DEBUG_GST_PIPELINE437#ifdef DEBUG_GST_PIPELINE
435 std::cout << "Dumping pipeline dot file" << std::endl;438 std::cout << "Dumping pipeline dot file" << std::endl;
436 GST_DEBUG_BIN_TO_DOT_FILE((GstBin*)pipeline, GST_DEBUG_GRAPH_SHOW_ALL, "pipeline");439 GST_DEBUG_BIN_TO_DOT_FILE((GstBin*)pipeline, GST_DEBUG_GRAPH_SHOW_ALL, "pipeline");
437#endif440#endif
438 }441 }
439 break;
440 }
441442
442 return result;443 return result;
443 }444 }
@@ -452,27 +453,26 @@
452 ms.count() * 1000);453 ms.count() * 1000);
453 }454 }
454455
455 void get_video_dimensions()456 bool has_video_sink_with_height_and_width()
456 {457 {
457 if (video_sink != nullptr && g_strcmp0(::getenv("CORE_UBUNTU_MEDIA_SERVICE_VIDEO_SINK_NAME"), "mirsink") == 0)458 return video_sink != nullptr && g_strcmp0(::getenv("CORE_UBUNTU_MEDIA_SERVICE_VIDEO_SINK_NAME"), "mirsink") == 0;
459 }
460
461 core::ubuntu::media::video::Dimensions get_video_dimensions()
462 {
463 if (not has_video_sink_with_height_and_width())
464 throw std::runtime_error{"Could not get the height/width of each video frame"};
465
466 uint32_t video_height = 0, video_width = 0;
467 g_object_get (video_sink, "height", &video_height, nullptr);
468 g_object_get (video_sink, "width", &video_width, nullptr);
469 std::cout << "video_height: " << video_height << ", video_width: " << video_width << std::endl;
470
471 return core::ubuntu::media::video::Dimensions
458 {472 {
459 g_object_get (video_sink, "height", &video_height, nullptr);473 core::ubuntu::media::video::Height{video_height},
460 g_object_get (video_sink, "width", &video_width, nullptr);474 core::ubuntu::media::video::Width{video_width}
461 std::cout << "video_height: " << video_height << ", video_width: " << video_width << std::endl;475 };
462 signals.on_add_frame_dimension(video_height, video_width);
463 }
464 else
465 std::cerr << "Could not get the height/width of each video frame" << std::endl;
466 }
467
468 int get_video_height() const
469 {
470 return video_height;
471 }
472
473 int get_video_width() const
474 {
475 return video_width;
476 }476 }
477477
478 std::string get_file_content_type(const std::string& uri) const478 std::string get_file_content_type(const std::string& uri) const
@@ -555,8 +555,6 @@
555 MediaFileType file_type;555 MediaFileType file_type;
556 SurfaceTextureClientHybris stc_hybris;556 SurfaceTextureClientHybris stc_hybris;
557 GstElement* video_sink;557 GstElement* video_sink;
558 uint32_t video_height;
559 uint32_t video_width;
560 core::Connection on_new_message_connection;558 core::Connection on_new_message_connection;
561 bool is_seeking;559 bool is_seeking;
562 core::ubuntu::media::Player::HeadersType request_headers;560 core::ubuntu::media::Player::HeadersType request_headers;
@@ -571,9 +569,9 @@
571 core::Signal<Bus::Message::Detail::StateChanged> on_state_changed;569 core::Signal<Bus::Message::Detail::StateChanged> on_state_changed;
572 core::Signal<uint64_t> on_seeked_to;570 core::Signal<uint64_t> on_seeked_to;
573 core::Signal<void> on_end_of_stream;571 core::Signal<void> on_end_of_stream;
574 core::Signal<media::Player::PlaybackStatus> on_playback_status_changed;572 core::Signal<core::ubuntu::media::Player::PlaybackStatus> on_playback_status_changed;
575 core::Signal<media::Player::Orientation> on_orientation_changed;573 core::Signal<core::ubuntu::media::Player::Orientation> on_orientation_changed;
576 core::Signal<uint32_t, uint32_t> on_add_frame_dimension;574 core::Signal<core::ubuntu::media::video::Dimensions> on_video_dimensions_changed;
577 core::Signal<void> client_disconnected;575 core::Signal<void> client_disconnected;
578 } signals;576 } signals;
579};577};
580578
=== modified file 'src/core/media/mpris/player.h'
--- src/core/media/mpris/player.h 2015-03-12 11:39:32 +0000
+++ src/core/media/mpris/player.h 2015-03-12 11:39:32 +0000
@@ -34,12 +34,16 @@
34#include <core/dbus/types/object_path.h>34#include <core/dbus/types/object_path.h>
35#include <core/dbus/types/variant.h>35#include <core/dbus/types/variant.h>
3636
37#include <core/dbus/types/stl/tuple.h>
38
37#include <boost/utility/identity_type.hpp>39#include <boost/utility/identity_type.hpp>
3840
39#include <string>41#include <string>
40#include <tuple>42#include <tuple>
41#include <vector>43#include <vector>
4244
45#include <cstdint>
46
43namespace dbus = core::dbus;47namespace dbus = core::dbus;
4448
45namespace mpris49namespace mpris
@@ -134,7 +138,7 @@
134 DBUS_CPP_SIGNAL_DEF(Seeked, Player, std::int64_t)138 DBUS_CPP_SIGNAL_DEF(Seeked, Player, std::int64_t)
135 DBUS_CPP_SIGNAL_DEF(EndOfStream, Player, void)139 DBUS_CPP_SIGNAL_DEF(EndOfStream, Player, void)
136 DBUS_CPP_SIGNAL_DEF(PlaybackStatusChanged, Player, core::ubuntu::media::Player::PlaybackStatus)140 DBUS_CPP_SIGNAL_DEF(PlaybackStatusChanged, Player, core::ubuntu::media::Player::PlaybackStatus)
137 DBUS_CPP_SIGNAL_DEF(VideoDimensionChanged, Player, std::uint64_t)141 DBUS_CPP_SIGNAL_DEF(VideoDimensionChanged, Player, core::ubuntu::media::video::Dimensions)
138 DBUS_CPP_SIGNAL_DEF(Error, Player, core::ubuntu::media::Player::Error)142 DBUS_CPP_SIGNAL_DEF(Error, Player, core::ubuntu::media::Player::Error)
139 };143 };
140144
141145
=== modified file 'src/core/media/player_implementation.cpp'
--- src/core/media/player_implementation.cpp 2015-03-12 11:39:32 +0000
+++ src/core/media/player_implementation.cpp 2015-03-12 11:39:32 +0000
@@ -415,12 +415,9 @@
415 playback_status_changed()(status);415 playback_status_changed()(status);
416 });416 });
417417
418 d->engine->video_dimension_changed_signal().connect([this](uint32_t height, uint32_t width)418 d->engine->video_dimension_changed_signal().connect([this](const media::video::Dimensions& dimensions)
419 {419 {
420 uint64_t mask = 0;420 video_dimension_changed()(dimensions);
421 // Left most 32 bits are for height, right most 32 bits are for width
422 mask = (static_cast<uint64_t>(height) << 32) | static_cast<uint64_t>(width);
423 video_dimension_changed()(mask);
424 });421 });
425422
426 d->engine->error_signal().connect([this](const Player::Error& e)423 d->engine->error_signal().connect([this](const Player::Error& e)
427424
=== modified file 'src/core/media/player_skeleton.cpp'
--- src/core/media/player_skeleton.cpp 2015-03-12 11:39:32 +0000
+++ src/core/media/player_skeleton.cpp 2015-03-12 11:39:32 +0000
@@ -19,6 +19,7 @@
1919
20#include "apparmor.h"20#include "apparmor.h"
21#include "codec.h"21#include "codec.h"
22#include "engine.h"
22#include "player_skeleton.h"23#include "player_skeleton.h"
23#include "player_traits.h"24#include "player_traits.h"
24#include "property_stub.h"25#include "property_stub.h"
@@ -338,9 +339,9 @@
338 remote_playback_status_changed->emit(status);339 remote_playback_status_changed->emit(status);
339 });340 });
340341
341 video_dimension_changed.connect([remote_video_dimension_changed](uint64_t mask)342 video_dimension_changed.connect([remote_video_dimension_changed](const media::video::Dimensions& dimensions)
342 {343 {
343 remote_video_dimension_changed->emit(mask);344 remote_video_dimension_changed->emit(dimensions);
344 });345 });
345346
346 error.connect([remote_error](const media::Player::Error& e)347 error.connect([remote_error](const media::Player::Error& e)
@@ -352,7 +353,7 @@
352 core::Signal<int64_t> seeked_to;353 core::Signal<int64_t> seeked_to;
353 core::Signal<void> end_of_stream;354 core::Signal<void> end_of_stream;
354 core::Signal<media::Player::PlaybackStatus> playback_status_changed;355 core::Signal<media::Player::PlaybackStatus> playback_status_changed;
355 core::Signal<uint64_t> video_dimension_changed;356 core::Signal<media::video::Dimensions> video_dimension_changed;
356 core::Signal<media::Player::Error> error;357 core::Signal<media::Player::Error> error;
357 } signals;358 } signals;
358359
@@ -649,12 +650,12 @@
649 return d->signals.playback_status_changed;650 return d->signals.playback_status_changed;
650}651}
651652
652const core::Signal<uint64_t>& media::PlayerSkeleton::video_dimension_changed() const653const core::Signal<media::video::Dimensions>& media::PlayerSkeleton::video_dimension_changed() const
653{654{
654 return d->signals.video_dimension_changed;655 return d->signals.video_dimension_changed;
655}656}
656657
657core::Signal<uint64_t>& media::PlayerSkeleton::video_dimension_changed()658core::Signal<media::video::Dimensions>& media::PlayerSkeleton::video_dimension_changed()
658{659{
659 return d->signals.video_dimension_changed;660 return d->signals.video_dimension_changed;
660}661}
661662
=== modified file 'src/core/media/player_skeleton.h'
--- src/core/media/player_skeleton.h 2015-01-13 14:18:59 +0000
+++ src/core/media/player_skeleton.h 2015-03-12 11:39:32 +0000
@@ -75,7 +75,7 @@
75 virtual const core::Signal<int64_t>& seeked_to() const;75 virtual const core::Signal<int64_t>& seeked_to() const;
76 virtual const core::Signal<void>& end_of_stream() const;76 virtual const core::Signal<void>& end_of_stream() const;
77 virtual core::Signal<PlaybackStatus>& playback_status_changed();77 virtual core::Signal<PlaybackStatus>& playback_status_changed();
78 virtual const core::Signal<uint64_t>& video_dimension_changed() const;78 virtual const core::Signal<video::Dimensions>& video_dimension_changed() const;
79 virtual const core::Signal<Error>& error() const;79 virtual const core::Signal<Error>& error() const;
8080
81protected:81protected:
@@ -112,7 +112,7 @@
112112
113 virtual core::Signal<int64_t>& seeked_to();113 virtual core::Signal<int64_t>& seeked_to();
114 virtual core::Signal<void>& end_of_stream();114 virtual core::Signal<void>& end_of_stream();
115 virtual core::Signal<uint64_t>& video_dimension_changed();115 virtual core::Signal<video::Dimensions>& video_dimension_changed();
116 virtual core::Signal<Error>& error();116 virtual core::Signal<Error>& error();
117117
118 private:118 private:
119119
=== modified file 'src/core/media/player_stub.cpp'
--- src/core/media/player_stub.cpp 2015-03-12 11:39:32 +0000
+++ src/core/media/player_stub.cpp 2015-03-12 11:39:32 +0000
@@ -168,10 +168,10 @@
168 playback_status_changed(status);168 playback_status_changed(status);
169 });169 });
170170
171 dbus.video_dimension_changed->connect([this](uint64_t mask)171 dbus.video_dimension_changed->connect([this](const media::video::Dimensions dimensions)
172 {172 {
173 std::cout << "VideoDimensionChanged signal arrived via the bus." << std::endl;173 std::cout << "VideoDimensionChanged signal arrived via the bus." << std::endl;
174 video_dimension_changed(mask);174 video_dimension_changed(dimensions);
175 });175 });
176176
177 dbus.error->connect([this](const media::Player::Error& e)177 dbus.error->connect([this](const media::Player::Error& e)
@@ -184,7 +184,7 @@
184 core::Signal<int64_t> seeked_to;184 core::Signal<int64_t> seeked_to;
185 core::Signal<void> end_of_stream;185 core::Signal<void> end_of_stream;
186 core::Signal<media::Player::PlaybackStatus> playback_status_changed;186 core::Signal<media::Player::PlaybackStatus> playback_status_changed;
187 core::Signal<uint64_t> video_dimension_changed;187 core::Signal<media::video::Dimensions> video_dimension_changed;
188 core::Signal<media::Player::Error> error;188 core::Signal<media::Player::Error> error;
189189
190 struct DBus190 struct DBus
@@ -448,7 +448,7 @@
448 return d->signals.playback_status_changed;448 return d->signals.playback_status_changed;
449}449}
450450
451const core::Signal<uint64_t>& media::PlayerStub::video_dimension_changed() const451const core::Signal<media::video::Dimensions>& media::PlayerStub::video_dimension_changed() const
452{452{
453 return d->signals.video_dimension_changed;453 return d->signals.video_dimension_changed;
454}454}
455455
=== modified file 'src/core/media/player_stub.h'
--- src/core/media/player_stub.h 2015-03-12 11:39:32 +0000
+++ src/core/media/player_stub.h 2015-03-12 11:39:32 +0000
@@ -88,7 +88,7 @@
88 virtual const core::Signal<int64_t>& seeked_to() const;88 virtual const core::Signal<int64_t>& seeked_to() const;
89 virtual const core::Signal<void>& end_of_stream() const;89 virtual const core::Signal<void>& end_of_stream() const;
90 virtual core::Signal<PlaybackStatus>& playback_status_changed();90 virtual core::Signal<PlaybackStatus>& playback_status_changed();
91 virtual const core::Signal<uint64_t>& video_dimension_changed() const;91 virtual const core::Signal<video::Dimensions>& video_dimension_changed() const;
92 virtual const core::Signal<Error>& error() const;92 virtual const core::Signal<Error>& error() const;
9393
94 private:94 private:

Subscribers

People subscribed via source and target branches