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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
(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/interfaces/rate_control.mojom.h"
11 #include "mojo/services/media/control/interfaces/media_factory.mojom.h"
12 #include "mojo/services/media/control/interfaces/media_player.mojom.h"
13
14 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.
15
16 // Model for media test application.
17 class MediaTest {
18 public:
19 using UpdateCallback = std::function<void()>;
20
21 static std::unique_ptr<MediaTest> Create(
22 mojo::ApplicationImpl* app,
23 const std::string& input_file_name);
24
25 ~MediaTest();
26
27 // Registers a callback signalling that the app should update its view.
28 void RegisterUpdateCallback(const UpdateCallback& callback);
29
30 // Starts playback.
31 void Play();
32
33 // Pauses playback.
34 void Pause();
35
36 // Seeks to the position indicated in nanoseconds from the start of the media.
37 void Seek(int64_t position_ns);
38
39 // Returns the current state of the player.
40 mojo::media::MediaState state() const;
41
42 // Returns the current presentation time in nanoseconds.
43 int64_t position_ns() const;
44
45 // Returns the current media metadata, if there is any.
46 const mojo::media::MediaMetadataPtr& metadata() const;
47
48 private:
49 MediaTest(mojo::ApplicationImpl* app, const std::string& input_file_name);
50
51 // Handles a status update from the player. When called with the default
52 // argument values, initiates status updates.
53 void HandleStatusUpdates(
54 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
55 mojo::media::MediaPlayerStatusPtr status = nullptr);
56
57 mojo::media::MediaPlayerPtr media_player_;
58 mojo::media::MediaState state_;
59 mojo::media::TimelineTransformPtr transform_;
60 mojo::media::MediaMetadataPtr metadata_;
61 UpdateCallback update_callback_;
62
63 DISALLOW_COPY_AND_ASSIGN(MediaTest);
64 };
65
66 } // namespace examples
67
68 #endif // EXAMPLES_MEDIA_TEST_MEDIA_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698