Index: examples/media_test/media_test.h |
diff --git a/examples/media_test/media_test.h b/examples/media_test/media_test.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8e0f8c2f1571985ef64fff3a053773c0d7889356 |
--- /dev/null |
+++ b/examples/media_test/media_test.h |
@@ -0,0 +1,68 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef EXAMPLES_MEDIA_TEST_MEDIA_TEST_H_ |
+#define EXAMPLES_MEDIA_TEST_MEDIA_TEST_H_ |
+ |
+#include "base/macros.h" |
+#include "mojo/public/cpp/application/application_impl.h" |
+#include "mojo/services/media/common/interfaces/rate_control.mojom.h" |
+#include "mojo/services/media/control/interfaces/media_factory.mojom.h" |
+#include "mojo/services/media/control/interfaces/media_player.mojom.h" |
+ |
+namespace examples { |
johngro
2016/03/21 22:10:47
if you want to save the need to say mojo::media::
dalesat
2016/03/21 23:58:35
Done.
|
+ |
+// Model for media test application. |
+class MediaTest { |
+ public: |
+ using UpdateCallback = std::function<void()>; |
+ |
+ static std::unique_ptr<MediaTest> Create( |
+ mojo::ApplicationImpl* app, |
+ const std::string& input_file_name); |
+ |
+ ~MediaTest(); |
+ |
+ // Registers a callback signalling that the app should update its view. |
+ void RegisterUpdateCallback(const UpdateCallback& callback); |
+ |
+ // Starts playback. |
+ void Play(); |
+ |
+ // Pauses playback. |
+ void Pause(); |
+ |
+ // Seeks to the position indicated in nanoseconds from the start of the media. |
+ void Seek(int64_t position_ns); |
+ |
+ // Returns the current state of the player. |
+ mojo::media::MediaState state() const; |
+ |
+ // Returns the current presentation time in nanoseconds. |
+ int64_t position_ns() const; |
+ |
+ // Returns the current media metadata, if there is any. |
+ const mojo::media::MediaMetadataPtr& metadata() const; |
+ |
+ private: |
+ MediaTest(mojo::ApplicationImpl* app, const std::string& input_file_name); |
+ |
+ // Handles a status update from the player. When called with the default |
+ // argument values, initiates status updates. |
+ void HandleStatusUpdates( |
+ uint64_t version = 0, |
johngro
2016/03/21 22:10:46
sanity check, 0 is a special value for version whi
dalesat
2016/03/21 23:58:35
Excellent point. I've added this to three mojom fi
|
+ mojo::media::MediaPlayerStatusPtr status = nullptr); |
+ |
+ mojo::media::MediaPlayerPtr media_player_; |
+ mojo::media::MediaState state_; |
+ mojo::media::TimelineTransformPtr transform_; |
+ mojo::media::MediaMetadataPtr metadata_; |
+ UpdateCallback update_callback_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MediaTest); |
+}; |
+ |
+} // namespace examples |
+ |
+#endif // EXAMPLES_MEDIA_TEST_MEDIA_TEST_H_ |