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

Side by Side Diff: media/blink/webmediaplayer_cast_android.h

Issue 1567123002: Support CAST+WMPI on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: suspend/resume cleanup Created 4 years, 11 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 2016 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 // Delete this file when WMPI_CAST is no longer needed.
6
7 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_CAST_H_
8 #define MEDIA_BLINK_WEBMEDIAPLAYER_CAST_H_
9
10 #include "media/blink/renderer_media_player_interface.h"
11 #include "media/blink/webmediaplayer_params.h"
12 #include "url/gurl.h"
13
14 namespace blink {
15 class WebLocalFrame;
16 class WebMediaPlayerClient;
17 }
18
19 namespace media {
20
21 class WebMediaPlayerImpl;
22
23 class WebMediaPlayerCast : public RendererMediaPlayerInterface {
24 public:
25 WebMediaPlayerCast(WebMediaPlayerImpl* impl,
26 blink::WebMediaPlayerClient* client,
27 const WebMediaPlayerParams::Context3DCB& context_3d_cb);
28 ~WebMediaPlayerCast();
29
30 void Initialize(const GURL& url, blink::WebLocalFrame* frame);
31
32 void requestRemotePlayback();
33 void requestRemotePlaybackControl();
34
35 void set_media_player_manager(
36 RendererMediaPlayerManagerInterface* media_player_manager);
37 bool isRemote() const { return is_remote_; }
38
39 double currentTime() const;
40 void play();
41 void pause();
42 void seek(base::TimeDelta t);
43
44 // RendererMediaPlayerInterface implementation
45 void OnMediaMetadataChanged(base::TimeDelta duration,
46 int width,
47 int height,
48 bool success) override;
49 void OnPlaybackComplete() override;
50 void OnBufferingUpdate(int percentage) override;
51 void OnSeekRequest(const base::TimeDelta& time_to_seek) override;
52 void OnSeekComplete(const base::TimeDelta& current_time) override;
53 void OnMediaError(int error_type) override;
54 void OnVideoSizeChanged(int width, int height) override;
55
56 // Called to update the current time.
57 void OnTimeUpdate(base::TimeDelta current_timestamp,
58 base::TimeTicks current_time_ticks) override;
59
60 // void OnWaitingForDecryptionKey() override;
61 void OnPlayerReleased() override;
62
63 // Functions called when media player status changes.
64 void OnConnectedToRemoteDevice(
65 const std::string& remote_playback_message) override;
66 void OnDisconnectedFromRemoteDevice() override;
67 void OnDidExitFullscreen() override;
68 void OnMediaPlayerPlay() override;
69 void OnMediaPlayerPause() override;
70 void OnRemoteRouteAvailabilityChanged(bool routes_available) override;
71
72 // Getters of playback state.
73 // bool paused() const override;
74
75 // True if the loaded media has a playable video track.
76 // bool hasVideo() const override;
77
78 // This function is called by the RendererMediaPlayerManager to pause the
79 // video and release the media player and surface texture when we switch tabs.
80 // However, the actual GlTexture is not released to keep the video screenshot.
81 void ReleaseMediaResources() override;
82
83 #if defined(VIDEO_HOLE)
84 // Calculate the boundary rectangle of the media player (i.e. location and
85 // size of the video frame).
86 // Returns true if the geometry has been changed since the last call.
87 bool UpdateBoundaryRectangle() override;
88
89 const gfx::RectF GetBoundaryRectangle() override;
90 #endif
91
92 void OnWaitingForDecryptionKey() override;
93
94 void DrawRemotePlaybackText(const std::string& remote_playback_message);
95 bool paused() const override;
96 bool hasVideo() const override;
97
98 private:
99 WebMediaPlayerImpl* webmediaplayer_;
100 blink::WebMediaPlayerClient* client_;
101 WebMediaPlayerParams::Context3DCB context_3d_cb_;
102
103 // Manages this object and delegates player calls to the browser process.
104 // Owned by RenderFrameImpl.
105 RendererMediaPlayerManagerInterface* player_manager_ = nullptr;
106
107 // Player ID assigned by the |player_manager_|.
108 int player_id_;
109
110 // Whether the browser is currently connected to a remote media player.
111 bool is_remote_ = false;
112
113 bool paused_ = true;
114 bool should_notify_time_changed_ = false;
115
116 // Last reported playout time.
117 base::TimeDelta remote_time_;
118 base::TimeTicks remote_time_at_;
119
120 // Whether the media player has been initialized.
121 bool is_player_initialized_ = false;
122 };
123
124 } // namespace media
125
126 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_CAST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698