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

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

Issue 1567123002: Support CAST+WMPI on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed 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 #ifndef MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_
6 #define MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_
7
8 // This file contains interfaces modeled after classes in
9 // content/renderer/media/android for the purposes of letting clases in
10 // this directory implement and/or interact with those classes.
11 // It's a stop-gap used to support cast on android until a better solution
12 // is implemented: crbug/575276
13
14 #include <string>
15 #include "base/time/time.h"
16 #include "ui/gfx/geometry/rect_f.h"
17
18 namespace media {
19
20 class RendererMediaPlayerInterface {
21 public:
22 virtual void OnMediaMetadataChanged(base::TimeDelta duration,
23 int width,
24 int height,
25 bool success) = 0;
26 virtual void OnPlaybackComplete() = 0;
27 virtual void OnBufferingUpdate(int percentage) = 0;
28 virtual void OnSeekRequest(const base::TimeDelta& time_to_seek) = 0;
29 virtual void OnSeekComplete(const base::TimeDelta& current_time) = 0;
30 virtual void OnMediaError(int error_type) = 0;
31 virtual void OnVideoSizeChanged(int width, int height) = 0;
32
33 // Called to update the current time.
34 virtual void OnTimeUpdate(base::TimeDelta current_timestamp,
35 base::TimeTicks current_time_ticks) = 0;
36
37 virtual void OnWaitingForDecryptionKey() = 0;
38 virtual void OnPlayerReleased() = 0;
39
40 // Functions called when media player status changes.
41 virtual void OnConnectedToRemoteDevice(
42 const std::string& remote_playback_message) = 0;
43 virtual void OnDisconnectedFromRemoteDevice() = 0;
44 virtual void OnDidExitFullscreen() = 0;
45 virtual void OnMediaPlayerPlay() = 0;
46 virtual void OnMediaPlayerPause() = 0;
47 virtual void OnRemoteRouteAvailabilityChanged(bool routes_available) = 0;
48
49 // Getters of playback state.
50 virtual bool paused() const = 0;
51
52 // True if the loaded media has a playable video track.
53 virtual bool hasVideo() const = 0;
54
55 // This function is called by the RendererMediaPlayerManager to pause the
56 // video and release the media player and surface texture when we switch tabs.
57 // However, the actual GlTexture is not released to keep the video screenshot.
58 virtual void ReleaseMediaResources() = 0;
59
60 #if defined(VIDEO_HOLE)
61 // Calculate the boundary rectangle of the media player (i.e. location and
62 // size of the video frame).
63 // Returns true if the geometry has been changed since the last call.
64 virtual bool UpdateBoundaryRectangle() = 0;
65
66 virtual const gfx::RectF GetBoundaryRectangle() = 0;
67 #endif
68 };
69
70 // Dictates which type of media playback is being initialized.
71 // Must match content/common/media/media_player_messages_enums_android.h
72 enum MediaPlayerHostMsg_Initialize_Type {
73 MEDIA_PLAYER_TYPE_URL,
74 MEDIA_PLAYER_TYPE_MEDIA_SOURCE,
75 MEDIA_PLAYER_TYPE_REMOTE_ONLY,
76 MEDIA_PLAYER_TYPE_LAST = MEDIA_PLAYER_TYPE_MEDIA_SOURCE
77 };
78
79 class RendererMediaPlayerManagerInterface {
80 public:
81 // Initializes a MediaPlayerAndroid object in browser process.
82 virtual void Initialize(MediaPlayerHostMsg_Initialize_Type type,
83 int player_id,
84 const GURL& url,
85 const GURL& first_party_for_cookies,
86 int demuxer_client_id,
87 const GURL& frame_url,
88 bool allow_credentials) = 0;
89
90 // Starts the player.
91 virtual void Start(int player_id) = 0;
92
93 // Pauses the player.
94 // is_media_related_action should be true if this pause is coming from an
95 // an action that explicitly pauses the video (user pressing pause, JS, etc.)
96 // Otherwise it should be false if Pause is being called due to other reasons
97 // (cleanup, freeing resources, etc.)
98 virtual void Pause(int player_id, bool is_media_related_action) = 0;
99
100 // Performs seek on the player.
101 virtual void Seek(int player_id, const base::TimeDelta& time) = 0;
102
103 // Sets the player volume.
104 virtual void SetVolume(int player_id, double volume) = 0;
105
106 // Sets the poster image.
107 virtual void SetPoster(int player_id, const GURL& poster) = 0;
108
109 // Releases resources for the player.
110 virtual void ReleaseResources(int player_id) = 0;
111
112 // Destroys the player in the browser process
113 virtual void DestroyPlayer(int player_id) = 0;
114
115 // Requests remote playback if possible
116 virtual void RequestRemotePlayback(int player_id) = 0;
117
118 // Requests control of remote playback
119 virtual void RequestRemotePlaybackControl(int player_id) = 0;
120
121 // Registers and unregisters a RendererMediaPlayerInterface object.
122 virtual int RegisterMediaPlayer(RendererMediaPlayerInterface* player) = 0;
123 virtual void UnregisterMediaPlayer(int player_id) = 0;
124 };
125
126 } // namespace media
127
128 #endif // MEDIA_BLINK_RENDERER_MEDIA_PLAYER_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698