Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Unified Diff: examples/media_test/media_test.h

Issue 1809703003: Motown: Add examples/media_test, a command line media player app. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Tweaks based on feedback. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « examples/media_test/keystroke.cc ('k') | examples/media_test/media_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4b6c91de10ce891585c81bf5b19f3af5c16eff9d
--- /dev/null
+++ b/examples/media_test/media_test.h
@@ -0,0 +1,73 @@
+// 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/cpp/linear_transform.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 mojo {
+namespace media {
+namespace examples {
+
+// 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.
+ 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 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 = MediaPlayer::kInitialStatus,
+ MediaPlayerStatusPtr status = nullptr);
+
+ MediaPlayerPtr media_player_;
+ MediaState state_;
+ 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.
+ MediaMetadataPtr metadata_;
+ UpdateCallback update_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaTest);
+};
+
+} // namespace examples
+} // namespace media
+} // namespace mojo
+
+#endif // EXAMPLES_MEDIA_TEST_MEDIA_TEST_H_
« no previous file with comments | « examples/media_test/keystroke.cc ('k') | examples/media_test/media_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698