| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Google 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 are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebMediaPlayer_h | |
| 32 #define WebMediaPlayer_h | |
| 33 | |
| 34 #include "WebCanvas.h" | |
| 35 #include "WebVector.h" | |
| 36 | |
| 37 namespace WebKit { | |
| 38 | |
| 39 class WebMediaPlayerClient; | |
| 40 class WebURL; | |
| 41 struct WebRect; | |
| 42 struct WebSize; | |
| 43 | |
| 44 struct WebTimeRange { | |
| 45 WebTimeRange() : start(0), end(0) {} | |
| 46 WebTimeRange(float s, float e) : start(s), end(e) {} | |
| 47 | |
| 48 float start; | |
| 49 float end; | |
| 50 }; | |
| 51 | |
| 52 typedef WebVector<WebTimeRange> WebTimeRanges; | |
| 53 | |
| 54 class WebMediaPlayer { | |
| 55 public: | |
| 56 enum NetworkState { | |
| 57 Empty, | |
| 58 Idle, | |
| 59 Loading, | |
| 60 Loaded, | |
| 61 FormatError, | |
| 62 NetworkError, | |
| 63 DecodeError, | |
| 64 }; | |
| 65 | |
| 66 enum ReadyState { | |
| 67 HaveNothing, | |
| 68 HaveMetadata, | |
| 69 HaveCurrentData, | |
| 70 HaveFutureData, | |
| 71 HaveEnoughData, | |
| 72 }; | |
| 73 | |
| 74 enum MovieLoadType { | |
| 75 Unknown, | |
| 76 Download, | |
| 77 StoredStream, | |
| 78 LiveStream, | |
| 79 }; | |
| 80 | |
| 81 virtual ~WebMediaPlayer() {} | |
| 82 | |
| 83 virtual void load(const WebURL&) = 0; | |
| 84 virtual void cancelLoad() = 0; | |
| 85 | |
| 86 // Playback controls. | |
| 87 virtual void play() = 0; | |
| 88 virtual void pause() = 0; | |
| 89 virtual bool supportsFullscreen() const = 0; | |
| 90 virtual bool supportsSave() const = 0; | |
| 91 virtual void seek(float seconds) = 0; | |
| 92 virtual void setEndTime(float seconds) = 0; | |
| 93 virtual void setRate(float) = 0; | |
| 94 virtual void setVolume(float) = 0; | |
| 95 virtual void setVisible(bool) = 0; | |
| 96 virtual bool setAutoBuffer(bool) = 0; | |
| 97 virtual bool totalBytesKnown() = 0; | |
| 98 virtual const WebTimeRanges& buffered() const = 0; | |
| 99 virtual float maxTimeSeekable() const = 0; | |
| 100 | |
| 101 virtual void setSize(const WebSize&) = 0; | |
| 102 | |
| 103 virtual void paint(WebCanvas*, const WebRect&) = 0; | |
| 104 | |
| 105 // True if the loaded media has a playable video/audio track. | |
| 106 virtual bool hasVideo() const = 0; | |
| 107 virtual bool hasAudio() const = 0; | |
| 108 | |
| 109 // Dimension of the video. | |
| 110 virtual WebSize naturalSize() const = 0; | |
| 111 | |
| 112 // Getters of playback state. | |
| 113 virtual bool paused() const = 0; | |
| 114 virtual bool seeking() const = 0; | |
| 115 virtual float duration() const = 0; | |
| 116 virtual float currentTime() const = 0; | |
| 117 | |
| 118 // Get rate of loading the resource. | |
| 119 virtual int dataRate() const = 0; | |
| 120 | |
| 121 // Internal states of loading and network. | |
| 122 virtual NetworkState networkState() const = 0; | |
| 123 virtual ReadyState readyState() const = 0; | |
| 124 | |
| 125 virtual unsigned long long bytesLoaded() const = 0; | |
| 126 virtual unsigned long long totalBytes() const = 0; | |
| 127 | |
| 128 virtual bool hasSingleSecurityOrigin() const = 0; | |
| 129 virtual MovieLoadType movieLoadType() const = 0; | |
| 130 }; | |
| 131 | |
| 132 } // namespace WebKit | |
| 133 | |
| 134 #endif | |
| OLD | NEW |