OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef EXAMPLES_MEDIA_TEST_MEDIA_TEST_H_ | |
6 #define EXAMPLES_MEDIA_TEST_MEDIA_TEST_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "mojo/public/cpp/application/application_impl.h" | |
10 #include "mojo/services/media/common/cpp/linear_transform.h" | |
11 #include "mojo/services/media/common/interfaces/rate_control.mojom.h" | |
12 #include "mojo/services/media/control/interfaces/media_factory.mojom.h" | |
13 #include "mojo/services/media/control/interfaces/media_player.mojom.h" | |
14 | |
15 namespace mojo { | |
16 namespace media { | |
17 namespace examples { | |
18 | |
19 // Model for media test application. | |
20 class MediaTest { | |
21 public: | |
22 using UpdateCallback = std::function<void()>; | |
23 | |
24 static std::unique_ptr<MediaTest> Create( | |
25 mojo::ApplicationImpl* app, | |
26 const std::string& input_file_name); | |
27 | |
28 ~MediaTest(); | |
29 | |
30 // Registers a callback signalling that the app should update its view. | |
31 void RegisterUpdateCallback(const UpdateCallback& callback); | |
32 | |
33 // Starts playback. | |
34 void Play(); | |
35 | |
36 // Pauses playback. | |
37 void Pause(); | |
38 | |
39 // Seeks to the position indicated in nanoseconds from the start of the media. | |
40 void Seek(int64_t position_ns); | |
41 | |
42 // Returns the current state of the player. | |
43 MediaState state() const; | |
44 | |
45 // Returns the current presentation time in nanoseconds. | |
46 int64_t position_ns() const; | |
47 | |
48 // Returns the current media metadata, if there is any. | |
49 const MediaMetadataPtr& metadata() const; | |
50 | |
51 private: | |
52 MediaTest(mojo::ApplicationImpl* app, const std::string& input_file_name); | |
53 | |
54 // Handles a status update from the player. When called with the default | |
55 // argument values, initiates status updates. | |
56 void HandleStatusUpdates( | |
57 uint64_t version = MediaPlayer::kInitialStatus, | |
58 MediaPlayerStatusPtr status = nullptr); | |
59 | |
60 MediaPlayerPtr media_player_; | |
61 MediaState state_; | |
62 LinearTransform transform_ = LinearTransform(0, 1, 1, 0); | |
johngro
2016/03/22 16:56:35
Assuming that local->media time is the forward tra
dalesat
2016/03/22 19:59:39
Done.
| |
63 MediaMetadataPtr metadata_; | |
64 UpdateCallback update_callback_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(MediaTest); | |
67 }; | |
68 | |
69 } // namespace examples | |
70 } // namespace media | |
71 } // namespace mojo | |
72 | |
73 #endif // EXAMPLES_MEDIA_TEST_MEDIA_TEST_H_ | |
OLD | NEW |