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

Side by Side Diff: Source/core/platform/graphics/MediaPlayer.h

Issue 48273013: Move MediaPlayer, IntSizeHash to platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adapt patch to already moved ContentDecryption files Created 7 years, 1 month 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 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef MediaPlayer_h
27 #define MediaPlayer_h
28
29 #include "platform/graphics/GraphicsTypes3D.h"
30 #include "wtf/Forward.h"
31 #include "wtf/Noncopyable.h"
32
33 namespace WebKit { class WebLayer; }
34
35 namespace WebCore {
36
37 class AudioSourceProvider;
38 class GraphicsContext;
39 class GraphicsContext3D;
40 class InbandTextTrackPrivate;
41 class IntRect;
42 class IntSize;
43 class KURL;
44 class MediaPlayer;
45 class HTMLMediaSource;
46 class TimeRanges;
47
48 class MediaPlayerClient {
49 public:
50 enum CORSMode { Unspecified, Anonymous, UseCredentials };
51
52 virtual ~MediaPlayerClient() { }
53
54 // the network state has changed
55 virtual void mediaPlayerNetworkStateChanged() = 0;
56
57 // the ready state has changed
58 virtual void mediaPlayerReadyStateChanged() = 0;
59
60 // time has jumped, eg. not as a result of normal playback
61 virtual void mediaPlayerTimeChanged() = 0;
62
63 // the media file duration has changed, or is now known
64 virtual void mediaPlayerDurationChanged() = 0;
65
66 // the play/pause status changed
67 virtual void mediaPlayerPlaybackStateChanged() = 0;
68
69 virtual void mediaPlayerRequestFullscreen() = 0;
70
71 virtual void mediaPlayerRequestSeek(double) = 0;
72
73 // Presentation-related methods
74 // a new frame of video is available
75 virtual void mediaPlayerRepaint() = 0;
76
77 // the movie size has changed
78 virtual void mediaPlayerSizeChanged() = 0;
79
80 virtual void mediaPlayerEngineUpdated() = 0;
81
82 enum MediaKeyErrorCode { UnknownError = 1, ClientError, ServiceError, Output Error, HardwareChangeError, DomainError };
83 virtual void mediaPlayerKeyAdded(const String& /* keySystem */, const String & /* sessionId */) = 0;
84 virtual void mediaPlayerKeyError(const String& /* keySystem */, const String & /* sessionId */, MediaKeyErrorCode, unsigned short /* systemCode */) = 0;
85 virtual void mediaPlayerKeyMessage(const String& /* keySystem */, const Stri ng& /* sessionId */, const unsigned char* /* message */, unsigned /* messageLeng th */, const KURL& /* defaultURL */) = 0;
86 virtual bool mediaPlayerKeyNeeded(const String& /* keySystem */, const Strin g& /* sessionId */, const unsigned char* /* initData */, unsigned /* initDataLen gth */) = 0;
87
88 #if ENABLE(ENCRYPTED_MEDIA_V2)
89 virtual bool mediaPlayerKeyNeeded(Uint8Array*) = 0;
90 #endif
91
92 virtual CORSMode mediaPlayerCORSMode() const = 0;
93
94 virtual void mediaPlayerScheduleLayerUpdate() = 0;
95
96 virtual void mediaPlayerDidAddTrack(PassRefPtr<InbandTextTrackPrivate>) = 0;
97 virtual void mediaPlayerDidRemoveTrack(PassRefPtr<InbandTextTrackPrivate>) = 0;
98 };
99
100 typedef PassOwnPtr<MediaPlayer> (*CreateMediaEnginePlayer)(MediaPlayerClient*);
101
102 class MediaPlayer {
103 WTF_MAKE_NONCOPYABLE(MediaPlayer);
104 public:
105 static PassOwnPtr<MediaPlayer> create(MediaPlayerClient*);
106 static void setMediaEngineCreateFunction(CreateMediaEnginePlayer);
107
108 static double invalidTime() { return -1.0; }
109
110 MediaPlayer() { }
111 virtual ~MediaPlayer() { }
112
113 virtual void load(const String& url) = 0;
114 virtual void load(const String& url, PassRefPtr<HTMLMediaSource>) = 0;
115
116 virtual void prepareToPlay() = 0;
117 virtual WebKit::WebLayer* platformLayer() const = 0;
118
119 virtual void play() = 0;
120 virtual void pause() = 0;
121
122 virtual bool supportsFullscreen() const = 0;
123 virtual bool supportsSave() const = 0;
124 virtual IntSize naturalSize() const = 0;
125
126 virtual bool hasVideo() const = 0;
127 virtual bool hasAudio() const = 0;
128
129 virtual double duration() const = 0;
130
131 virtual double currentTime() const = 0;
132
133 virtual void seek(double) = 0;
134
135 virtual bool seeking() const = 0;
136
137 virtual double rate() const = 0;
138 virtual void setRate(double) = 0;
139
140 virtual bool paused() const = 0;
141
142 virtual void setVolume(double) = 0;
143 virtual void setMuted(bool) = 0;
144
145 enum NetworkState { Empty, Idle, Loading, Loaded, FormatError, NetworkError, DecodeError };
146 virtual NetworkState networkState() const = 0;
147
148 enum ReadyState { HaveNothing, HaveMetadata, HaveCurrentData, HaveFutureDat a, HaveEnoughData };
149 virtual ReadyState readyState() const = 0;
150
151 virtual double maxTimeSeekable() const = 0;
152 virtual PassRefPtr<TimeRanges> buffered() const = 0;
153
154 virtual bool didLoadingProgress() const = 0;
155
156 virtual void paint(GraphicsContext*, const IntRect&) = 0;
157
158 virtual void paintCurrentFrameInContext(GraphicsContext*, const IntRect&) = 0;
159 virtual bool copyVideoTextureToPlatformTexture(GraphicsContext3D*, Platform3 DObject, GC3Dint, GC3Denum, GC3Denum, bool, bool) = 0;
160
161 enum Preload { None, MetaData, Auto };
162 virtual void setPreload(Preload) = 0;
163
164 virtual void showFullscreenOverlay() = 0;
165 virtual void hideFullscreenOverlay() = 0;
166 virtual bool canShowFullscreenOverlay() const = 0;
167
168 // whether accelerated rendering is supported by the media engine for the cu rrent media.
169 virtual bool supportsAcceleratedRendering() const = 0;
170
171 virtual bool hasSingleSecurityOrigin() const = 0;
172
173 virtual bool didPassCORSAccessCheck() const = 0;
174
175 // Time value in the movie's time scale. It is only necessary to override th is if the media
176 // engine uses rational numbers to represent media time.
177 virtual double mediaTimeForTimeValue(double timeValue) const = 0;
178
179 virtual unsigned decodedFrameCount() const = 0;
180 virtual unsigned droppedFrameCount() const = 0;
181 virtual unsigned corruptedFrameCount() const = 0;
182 virtual unsigned audioDecodedByteCount() const = 0;
183 virtual unsigned videoDecodedByteCount() const = 0;
184
185 #if ENABLE(WEB_AUDIO)
186 virtual AudioSourceProvider* audioSourceProvider() = 0;
187 #endif
188
189 enum MediaKeyException { NoError, InvalidPlayerState, KeySystemNotSupported };
190 virtual MediaKeyException addKey(const String&, const unsigned char*, unsign ed, const unsigned char*, unsigned, const String&) = 0;
191 virtual MediaKeyException generateKeyRequest(const String&, const unsigned c har*, unsigned) = 0;
192 virtual MediaKeyException cancelKeyRequest(const String&, const String&) = 0 ;
193 };
194
195 }
196
197 #endif // MediaPlayer_h
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/IntSizeHash.h ('k') | Source/core/platform/graphics/MediaPlayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698