Changeset 117662 in webkit
- Timestamp:
- May 18, 2012 6:08:46 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r117658 r117662 1 2012-05-18 Aaron Colwell <acolwell@chromium.org> 2 3 Updated Media Source LayoutTests to use v0.5 spec signatures and added 4 new tests to verify the behavior of the new methods. 5 https://bugs.webkit.org/show_bug.cgi?id=83607 6 7 Reviewed by Darin Fisher. 8 9 * http/tests/media/media-source/video-media-source-event-attributes-expected.txt: Added. 10 * http/tests/media/media-source/video-media-source-event-attributes.html: Added. Tests onwebkitsourcexxx event attributes. 11 * http/tests/media/media-source/webm/video-media-source-abort-expected.txt: Added. 12 * http/tests/media/media-source/webm/video-media-source-abort.html: Added. Tests basic webkitSourceAbort() functionality. 13 * http/tests/media/media-source/webm/video-media-source-add-and-remove-ids-expected.txt: Added. 14 * http/tests/media/media-source/webm/video-media-source-add-and-remove-ids.html: Added. Tests webkitSourceAddId() & webkitSourceRemoveId(). 15 * http/tests/media/media-source/webm/video-media-source-errors.html: Style fixes and add addSourceId() since we need to add an ID before appending data now. 16 * http/tests/media/media-source/webm/video-media-source-play.html: Style fixes and add addSourceId(). 17 * http/tests/media/media-source/webm/video-media-source-seek.html: Style fixes and add addSourceId(). 18 * http/tests/media/media-source/webm/video-media-source-state-changes.html: Style fixes and add addSourceId(). 19 * http/tests/media/media-source/webm/webm-media-source.js: 20 (getData.request.onload): Style fix. 21 (getData): Style fix. 22 (loadWebMData): Style fix. 23 (addSourceId): New helper method that adds SOURCE_ID to the video tag so data can be appended with this ID. 24 (appendHeaders): Add SOURCE_ID parameter since the webkitSourceAppend() signature changed. 25 (appendCluster): Add SOURCE_ID parameter since the webkitSourceAppend() signature changed. 26 (appendUntilEndOfStream): Add SOURCE_ID parameter since the webkitSourceAppend() signature changed. 27 1 28 2012-05-18 Eric Seidel <eric@webkit.org> 2 29 -
trunk/LayoutTests/http/tests/media/media-source/webm/video-media-source-errors.html
r115380 r117662 146 146 testCaseIndex++; 147 147 148 var eventHandlerFunction = function (event) { 148 var eventHandlerFunction = function (event) 149 { 149 150 consoleWrite(""); 150 151 consoleWrite("running " + functionName); 151 152 event.target.removeEventListener('webkitsourceopen', eventHandlerFunction); 153 addSourceId(event.target); 152 154 onOpenFunction(event); 153 155 }; -
trunk/LayoutTests/http/tests/media/media-source/webm/video-media-source-play.html
r113495 r117662 8 8 { 9 9 var videoTag = event.target; 10 addSourceId(videoTag); 10 11 appendHeaders(videoTag); 11 12 appendUntilEndOfStream(videoTag, 0); … … 25 26 video.addEventListener('webkitsourceopen', onSourceOpen); 26 27 27 loadWebMData(function(success) { 28 loadWebMData(function(success) 29 { 28 30 if (!success) { 29 31 failTest("Failed to load WebM data"); -
trunk/LayoutTests/http/tests/media/media-source/webm/video-media-source-seek.html
r113495 r117662 16 16 firstOpen = false; 17 17 18 addSourceId(videoTag); 18 19 appendHeaders(videoTag); 19 20 appendUntilEndOfStream(videoTag, 0); … … 69 70 video.addEventListener('seeked', onSeeked); 70 71 71 loadWebMData(function(success) { 72 loadWebMData(function(success) 73 { 72 74 if (!success) { 73 75 failTest("Failed to load WebM data"); -
trunk/LayoutTests/http/tests/media/media-source/webm/video-media-source-state-changes.html
r113495 r117662 7 7 var seekTime = getClusterTimeForIndex(4); 8 8 9 function appendUntilEnd(videoTag, startIndex) 9 function appendUntilEnd(videoTag, startIndex) 10 10 { 11 11 for (var index = startIndex; index < getClusterCount(); index++) { 12 videoTag.webkitSourceAppend(getCluster(index));12 appendCluster(videoTag, index); 13 13 } 14 14 … … 16 16 } 17 17 18 function appendClustersForSeek(videoTag, clusterSeekTime) 18 function appendClustersForSeek(videoTag, clusterSeekTime) 19 19 { 20 20 var clusterIndex = getClusterIndexForTimestamp(clusterSeekTime); … … 22 22 23 23 for (; (clusterIndex < endIndex) && (clusterIndex < getClusterCount()); clusterIndex++) { 24 videoTag.webkitSourceAppend(getCluster(clusterIndex));24 appendCluster(videoTag, clusterIndex); 25 25 } 26 26 … … 31 31 } 32 32 33 function onSourceEvent(event) 33 function onSourceEvent(event) 34 34 { 35 35 consoleWrite('EVENT(' + event.type + ') : ' + getSourceStateName(event.target.webkitSourceState)); 36 36 } 37 37 38 function onFirstSourceOpen(event) 38 function onFirstSourceOpen(event) 39 39 { 40 40 // This is the first time the source is opened. We just want to append … … 44 44 var videoTag = event.target; 45 45 videoTag.removeEventListener('webkitsourceopen', onFirstSourceOpen); 46 addSourceId(videoTag); 46 47 47 48 expectSourceState(videoTag, HTMLMediaElement.SOURCE_OPEN); … … 55 56 } 56 57 57 function onFirstSourceEnded(event) 58 function onFirstSourceEnded(event) 58 59 { 59 60 var videoTag = event.target; … … 66 67 } 67 68 68 function triggerFirstSeek(event) { 69 function triggerFirstSeek(event) 70 { 69 71 var videoTag = event.target; 70 72 videoTag.removeEventListener('playing', triggerFirstSeek); … … 77 79 } 78 80 79 function onFirstSeeking(event) 81 function onFirstSeeking(event) 80 82 { 81 83 var videoTag = event.target; … … 88 90 } 89 91 90 function onFirstSeeked(event) 92 function onFirstSeeked(event) 91 93 { 92 94 var videoTag = event.target; … … 101 103 } 102 104 103 function onSecondSeeking(event) 105 function onSecondSeeking(event) 104 106 { 105 107 var videoTag = event.target; … … 112 114 } 113 115 114 function onSecondSeeked(event) 116 function onSecondSeeked(event) 115 117 { 116 118 var videoTag = event.target; … … 124 126 } 125 127 126 function onFirstSourceClose(event) 128 function onFirstSourceClose(event) 127 129 { 128 130 var videoTag = event.target; … … 134 136 } 135 137 136 function onSecondSourceOpen(event) 138 function onSecondSourceOpen(event) 137 139 { 138 140 var videoTag = event.target; 139 141 videoTag.removeEventListener('webkitsourceopen', onSecondSourceOpen); 142 addSourceId(videoTag); 140 143 141 144 expectSourceState(videoTag, HTMLMediaElement.SOURCE_OPEN); … … 149 152 } 150 153 151 function onSecondSourceEnded(event) 154 function onSecondSourceEnded(event) 152 155 { 153 156 var videoTag = event.target; … … 160 163 } 161 164 162 function triggerSecondSourceClose(event) { 165 function triggerSecondSourceClose(event) 166 { 163 167 var videoTag = event.target; 164 168 videoTag.removeEventListener('playing', triggerSecondSourceClose); … … 169 173 } 170 174 171 function onSecondSourceClose(event) 175 function onSecondSourceClose(event) 172 176 { 173 177 var videoTag = event.target; … … 178 182 } 179 183 180 function onThirdSourceOpen(event) 184 function onThirdSourceOpen(event) 181 185 { 182 186 var videoTag = event.target; 183 187 videoTag.removeEventListener('webkitsourceopen', onThirdSourceOpen); 188 addSourceId(videoTag); 184 189 185 190 expectSourceState(videoTag, HTMLMediaElement.SOURCE_OPEN); … … 188 193 } 189 194 190 function onLoad() 195 function onLoad() 191 196 { 192 197 findMediaElement(); … … 207 212 208 213 logSourceState(video); 209 loadWebMData(function(success) { 214 loadWebMData(function(success) 215 { 210 216 if (!success) { 211 217 failTest("Failed to load WebM data"); -
trunk/LayoutTests/http/tests/media/media-source/webm/webm-media-source.js
r113495 r117662 12 12 var headerData = null; 13 13 var clusterData = []; 14 var SOURCE_ID = "sourceID1"; 14 15 15 16 function getData(url, callback) … … 18 19 request.open("GET", url, true); 19 20 request.responseType = 'arraybuffer'; 20 request.onload = function() { 21 request.onload = function() 22 { 21 23 if (request.status != 200) { 22 24 failTest("Unexpected status code " + request.status + " for " + url); … … 30 32 } 31 33 32 function createClusterGetFunction(clusterIndex, callback) { 33 return function(data) { 34 function createClusterGetFunction(clusterIndex, callback) 35 { 36 return function(data) 37 { 34 38 if (!data) { 35 39 callback(false); … … 50 54 } 51 55 52 function loadWebMData(callback) { 53 getData("/media/resources/media-source/webm/test.webm.headers", function(data) { 56 function loadWebMData(callback) 57 { 58 getData("/media/resources/media-source/webm/test.webm.headers", function(data) 59 { 54 60 if (!data) { 55 61 callback(false); … … 109 115 } 110 116 117 function addSourceId(videoTag) 118 { 119 try { 120 videoTag.webkitSourceAddId(SOURCE_ID, 'video/webm; codecs="vp8, vorbis"'); 121 } catch (e) { 122 failTest("Unexpected webkitSourceAddId() exception " + e); 123 } 124 } 125 111 126 function appendHeaders(videoTag) 112 127 { … … 116 131 } 117 132 118 videoTag.webkitSourceAppend( getHeaders());133 videoTag.webkitSourceAppend(SOURCE_ID, getHeaders()); 119 134 } 120 135 … … 133 148 try { 134 149 var cluster = getCluster(clusterIndex); 135 videoTag.webkitSourceAppend( cluster);150 videoTag.webkitSourceAppend(SOURCE_ID, cluster); 136 151 } catch (err) { 137 152 consoleWrite(err); … … 147 162 148 163 for (var clusterIndex = startIndex; clusterIndex < getClusterCount(); clusterIndex++) { 149 videoTag.webkitSourceAppend( getCluster(clusterIndex));164 videoTag.webkitSourceAppend(SOURCE_ID, getCluster(clusterIndex)); 150 165 } 151 166 videoTag.webkitSourceEndOfStream(videoTag.EOS_NO_ERROR); -
trunk/Source/WebCore/ChangeLog
r117659 r117662 1 2012-05-18 Aaron Colwell <acolwell@chromium.org> 2 3 Update Media Source implementation to reflect changes in 0.5 spec. 4 https://bugs.webkit.org/show_bug.cgi?id=83607 5 6 Reviewed by Darin Fisher. 7 8 Tests: http/tests/media/media-source/video-media-source-event-attributes.html 9 http/tests/media/media-source/webm/video-media-source-abort.html 10 http/tests/media/media-source/webm/video-media-source-add-and-remove-ids.html 11 12 * html/HTMLAttributeNames.in: Add onwebkitsourcexxx event attribute names. 13 * html/HTMLMediaElement.cpp: 14 (WebCore::HTMLMediaElement::parseAttribute): Add code to register event listeners for the onwebkitsourcexxx attributes. 15 (WebCore::HTMLMediaElement::pauseInternal): 16 (WebCore): 17 (WebCore::HTMLMediaElement::webkitSourceAddId): Changed code to pass the parsed type & codecs to m_player instead of the whole MIME-type string. This was done to allow some simple parsing & validation code to be shared in WebKit instead of reimplemented in every port. 18 (WebCore::HTMLMediaElement::webkitSourceBuffered): New method in the v0.5 spec. It validates the parameters & that it is being called in the correct state. If so it forwards the call to m_player. 19 (WebCore::HTMLMediaElement::webkitSourceAppend): Adds id parameter to match v0.5 signature. Minor logic changes that avoid calling m_player for 0 byte arrays and fixes exceptions reported for a null array and a parse error so they match the spec text. 20 (WebCore::HTMLMediaElement::webkitSourceAbort): New method in the v0.5 spec. It validates the parameter & that it is being called in athe correct state. If so it forwards the call to m_player. 21 * html/HTMLMediaElement.h: 22 (HTMLMediaElement): Added new methods, signature updates, and onwebitsourcexxx event listener attributes. 23 * html/HTMLMediaElement.idl: Added new methods, signature updates, and onwebitsourcexxx event listener attributes. 24 * platform/ContentType.cpp: 25 (WebCore::ContentType::codecs): A new method that parses the codecs parameter into a vector of codec strings. 26 (WebCore): 27 * platform/ContentType.h: 28 (ContentType): 29 * platform/graphics/MediaPlayer.cpp: 30 (WebCore::NullMediaPlayerPrivate::sourceAddId): Update the signature to take the parsed type and codecs vector. 31 (WebCore::NullMediaPlayerPrivate::sourceBuffered): Add default implementation for this new method. 32 (WebCore::NullMediaPlayerPrivate::sourceRemoveId): Remove id parameter name to match other methods. 33 (WebCore::NullMediaPlayerPrivate::sourceAppend): Updated signature to include id parameter. 34 (WebCore::NullMediaPlayerPrivate::sourceAbort): Add default implementation for this new method. 35 (WebCore::NullMediaPlayerPrivate::sourceEndOfStream): Remove parameter name to match other methods. 36 (WebCore::MediaPlayer::sourceAddId): Update the signature to take the parsed type and codecs vector. 37 (WebCore): 38 (WebCore::MediaPlayer::sourceBuffered): Add implementation for new method that forwards the call to the MediaPlayerPrivate interface. 39 (WebCore::MediaPlayer::sourceAppend): Update method to forward the new id parameter in the signature. 40 (WebCore::MediaPlayer::sourceAbort): Add implementation for new method that forwards the call to the MediaPlayerPrivate interface. 41 * platform/graphics/MediaPlayer.h: Update interface to include new methods and updated signatures. 42 * platform/graphics/MediaPlayerPrivate.h: 43 (WebCore::MediaPlayerPrivateInterface::sourceAddId): Update the signature to take the parsed type and codecs vector. 44 (WebCore::MediaPlayerPrivateInterface::sourceBuffered): Add default implementation for new method. 45 (WebCore::MediaPlayerPrivateInterface::sourceAppend): Update method to forward the new id parameter in the signature. 46 (WebCore::MediaPlayerPrivateInterface::sourceAbort): Add default implementation for new method. 47 1 48 2012-05-18 Levi Weintraub <leviw@chromium.org> 2 49 -
trunk/Source/WebCore/html/HTMLAttributeNames.in
r116592 r117662 254 254 onwebkitkeymessage 255 255 onwebkitneedkey 256 onwebkitsourceclose 257 onwebkitsourceended 258 onwebkitsourceopen 256 259 onwebkittransitionend 257 260 open -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r117242 r117662 425 425 else if (attribute.name() == onwebkitendfullscreenAttr) 426 426 setAttributeEventListener(eventNames().webkitendfullscreenEvent, createAttributeEventListener(this, attribute)); 427 #if ENABLE(MEDIA_SOURCE) 428 else if (attribute.name() == onwebkitsourcecloseAttr) 429 setAttributeEventListener(eventNames().webkitsourcecloseEvent, createAttributeEventListener(this, attribute)); 430 else if (attribute.name() == onwebkitsourceendedAttr) 431 setAttributeEventListener(eventNames().webkitsourceendedEvent, createAttributeEventListener(this, attribute)); 432 else if (attribute.name() == onwebkitsourceopenAttr) 433 setAttributeEventListener(eventNames().webkitsourceopenEvent, createAttributeEventListener(this, attribute)); 434 #endif 427 435 else 428 436 HTMLElement::parseAttribute(attribute); … … 2292 2300 2293 2301 m_autoplaying = false; 2294 2302 2295 2303 if (!m_paused) { 2296 2304 m_paused = true; … … 2303 2311 2304 2312 #if ENABLE(MEDIA_SOURCE) 2313 2305 2314 void HTMLMediaElement::webkitSourceAddId(const String& id, const String& type, ExceptionCode& ec) 2306 2315 { … … 2325 2334 } 2326 2335 2327 switch (m_player->sourceAddId(id, type)) { 2336 ContentType contentType(type); 2337 Vector<String> codecs = contentType.codecs(); 2338 2339 if (!codecs.size()) { 2340 ec = NOT_SUPPORTED_ERR; 2341 return; 2342 } 2343 2344 switch (m_player->sourceAddId(id, contentType.type(), codecs)) { 2328 2345 case MediaPlayer::Ok: 2329 2346 m_sourceIDs.add(id); … … 2356 2373 } 2357 2374 2358 void HTMLMediaElement::webkitSourceAppend(PassRefPtr<Uint8Array> data, ExceptionCode& ec) 2359 { 2375 PassRefPtr<TimeRanges> HTMLMediaElement::webkitSourceBuffered(const String& id, ExceptionCode& ec) 2376 { 2377 if (!isValidSourceId(id, ec)) 2378 return 0; 2379 2380 if (!m_player || m_currentSrc != m_mediaSourceURL || m_sourceState == SOURCE_CLOSED) { 2381 ec = INVALID_STATE_ERR; 2382 return 0; 2383 } 2384 2385 return m_player->sourceBuffered(id); 2386 } 2387 2388 void HTMLMediaElement::webkitSourceAppend(const String& id, PassRefPtr<Uint8Array> data, ExceptionCode& ec) 2389 { 2390 if (!isValidSourceId(id, ec)) 2391 return; 2392 2360 2393 if (!m_player || m_currentSrc != m_mediaSourceURL || m_sourceState != SOURCE_OPEN) { 2361 2394 ec = INVALID_STATE_ERR; … … 2363 2396 } 2364 2397 2365 if (!data.get() || !m_player->sourceAppend(data->data(), data->length())) { 2398 if (!data.get()) { 2399 ec = INVALID_ACCESS_ERR; 2400 return; 2401 } 2402 2403 if (!data->length()) 2404 return; 2405 2406 if (!m_player->sourceAppend(id, data->data(), data->length())) { 2366 2407 ec = SYNTAX_ERR; 2367 2408 return; 2368 2409 } 2410 } 2411 2412 void HTMLMediaElement::webkitSourceAbort(const String& id, ExceptionCode& ec) 2413 { 2414 if (!isValidSourceId(id, ec)) 2415 return; 2416 2417 if (!m_player || m_currentSrc != m_mediaSourceURL || m_sourceState != SOURCE_OPEN) { 2418 ec = INVALID_STATE_ERR; 2419 return; 2420 } 2421 2422 if (!m_player->sourceAbort(id)) 2423 ASSERT_NOT_REACHED(); 2369 2424 } 2370 2425 -
trunk/Source/WebCore/html/HTMLMediaElement.h
r117195 r117662 175 175 void webkitSourceAddId(const String&, const String&, ExceptionCode&); 176 176 void webkitSourceRemoveId(const String&, ExceptionCode&); 177 void webkitSourceAppend(PassRefPtr<Uint8Array> data, ExceptionCode&); 177 PassRefPtr<TimeRanges> webkitSourceBuffered(const String&, ExceptionCode&); 178 void webkitSourceAppend(const String&, PassRefPtr<Uint8Array> data, ExceptionCode&); 179 void webkitSourceAbort(const String&, ExceptionCode&); 178 180 enum EndOfStreamStatus { EOS_NO_ERROR, EOS_NETWORK_ERR, EOS_DECODE_ERR }; 179 181 void webkitSourceEndOfStream(unsigned short, ExceptionCode&); … … 181 183 SourceState webkitSourceState() const; 182 184 void setSourceState(SourceState); 185 186 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitsourceopen); 187 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitsourceended); 188 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitsourceclose); 183 189 #endif 184 190 -
trunk/Source/WebCore/html/HTMLMediaElement.idl
r115745 r117662 100 100 readonly attribute [V8EnabledAtRuntime=mediaSource, URL] DOMString webkitMediaSourceURL; 101 101 102 // Appends media to to the source. 103 [V8EnabledAtRuntime=mediaSource] void webkitSourceAppend(in Uint8Array data) raises (DOMException); 102 // Manages IDs for appending media to the source. 103 [V8EnabledAtRuntime=mediaSource] void webkitSourceAddId(in DOMString id, in DOMString type) raises (DOMException); 104 [V8EnabledAtRuntime=mediaSource] void webkitSourceRemoveId(in DOMString id) raises (DOMException); 105 106 // Returns the time ranges buffered for a specific source ID. 107 [V8EnabledAtRuntime=mediaSource] TimeRanges webkitSourceBuffered(in DOMString id) raises (DOMException); 108 109 // Appends segment data. 110 [V8EnabledAtRuntime=mediaSource] void webkitSourceAppend(in DOMString id, in Uint8Array data) raises (DOMException); 111 112 // Aborts the current segment. 113 [V8EnabledAtRuntime=mediaSource] void webkitSourceAbort(in DOMString id) raises (DOMException); 104 114 105 115 // Signals the end of stream. … … 114 124 [V8EnabledAtRuntime=mediaSource] const unsigned short SOURCE_ENDED = 2; 115 125 readonly attribute [V8EnabledAtRuntime=mediaSource] unsigned short webkitSourceState; 126 127 attribute [V8EnabledAtRuntime=mediaSource] EventListener onwebkitsourceopen; 128 attribute [V8EnabledAtRuntime=mediaSource] EventListener onwebkitsourceended; 129 attribute [V8EnabledAtRuntime=mediaSource] EventListener onwebkitsourceclose; 116 130 #endif 117 131 -
trunk/Source/WebCore/platform/ContentType.cpp
r95901 r117662 77 77 } 78 78 79 Vector<String> ContentType::codecs() const 80 { 81 String codecsParameter = parameter("codecs"); 82 83 if (codecsParameter.isEmpty()) 84 return Vector<String>(); 85 86 Vector<String> codecs; 87 codecsParameter.split(",", codecs); 88 for (size_t i = 0; i < codecs.size(); ++i) 89 codecs[i] = codecs[i].simplifyWhiteSpace(); 90 91 return codecs; 92 } 93 79 94 } // namespace WebCore -
trunk/Source/WebCore/platform/ContentType.h
r95901 r117662 38 38 String parameter (const String& parameterName) const; 39 39 String type() const; 40 Vector<String> codecs() const; 40 41 const String& raw() const { return m_type; } 41 42 private: -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r117147 r117662 150 150 151 151 #if ENABLE(MEDIA_SOURCE) 152 virtual MediaPlayer::AddIdStatus sourceAddId(const String& id, const String& type) { return MediaPlayer::NotSupported; } 153 virtual bool sourceRemoveId(const String& id) { return false; } 154 virtual bool sourceAppend(const unsigned char*, unsigned) { return false; } 155 virtual void sourceEndOfStream(MediaPlayer::EndOfStreamStatus status) { } 152 virtual MediaPlayer::AddIdStatus sourceAddId(const String& id, const String& type, const Vector<String>& codecs) { return MediaPlayer::NotSupported; } 153 virtual PassRefPtr<TimeRanges> sourceBuffered(const String&) { return TimeRanges::create(); } 154 virtual bool sourceRemoveId(const String&) { return false; } 155 virtual bool sourceAppend(const String&, const unsigned char*, unsigned) { return false; } 156 virtual bool sourceAbort(const String&) { return false; } 157 virtual void sourceEndOfStream(MediaPlayer::EndOfStreamStatus) { } 156 158 #endif 157 159 … … 462 464 #if ENABLE(MEDIA_SOURCE) 463 465 464 MediaPlayer::AddIdStatus MediaPlayer::sourceAddId(const String& id, const String& type) 465 { 466 return m_private->sourceAddId(id, type); 466 MediaPlayer::AddIdStatus MediaPlayer::sourceAddId(const String& id, const String& type, const Vector<String>& codecs) 467 { 468 return m_private->sourceAddId(id, type, codecs); 469 } 470 471 PassRefPtr<TimeRanges> MediaPlayer::sourceBuffered(const String& id) 472 { 473 return m_private->sourceBuffered(id); 467 474 } 468 475 … … 472 479 } 473 480 474 bool MediaPlayer::sourceAppend(const unsigned char* data, unsigned length) 475 { 476 return m_private->sourceAppend(data, length); 481 bool MediaPlayer::sourceAppend(const String& id, const unsigned char* data, unsigned length) 482 { 483 return m_private->sourceAppend(id, data, length); 484 } 485 486 bool MediaPlayer::sourceAbort(const String& id) 487 { 488 return m_private->sourceAbort(id); 477 489 } 478 490 -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r117147 r117662 239 239 #if ENABLE(MEDIA_SOURCE) 240 240 enum AddIdStatus { Ok, NotSupported, ReachedIdLimit }; 241 AddIdStatus sourceAddId(const String& id, const String& type );241 AddIdStatus sourceAddId(const String& id, const String& type, const Vector<String>& codecs); 242 242 bool sourceRemoveId(const String& id); 243 bool sourceAppend(const unsigned char* data, unsigned length); 243 PassRefPtr<TimeRanges> sourceBuffered(const String& id); 244 bool sourceAppend(const String& id, const unsigned char* data, unsigned length); 245 bool sourceAbort(const String& id); 244 246 enum EndOfStreamStatus { EosNoError, EosNetworkError, EosDecodeError }; 245 247 void sourceEndOfStream(EndOfStreamStatus); -
trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
r116782 r117662 166 166 167 167 #if ENABLE(MEDIA_SOURCE) 168 virtual MediaPlayer::AddIdStatus sourceAddId(const String&, const String&) { return MediaPlayer::NotSupported; } 169 virtual bool sourceRemoveId(const String&) { return false; } 170 virtual bool sourceAppend(const unsigned char*, unsigned) { return false; } 168 virtual MediaPlayer::AddIdStatus sourceAddId(const String& id, const String& type, const Vector<String>& codecs) { return MediaPlayer::NotSupported; } 169 virtual PassRefPtr<TimeRanges> sourceBuffered(const String& id) { return TimeRanges::create(); } 170 virtual bool sourceRemoveId(const String& id) { return false; } 171 virtual bool sourceAppend(const String& id, const unsigned char* data, unsigned length) { return false; } 172 virtual bool sourceAbort(const String& id) { return false; } 171 173 virtual void sourceEndOfStream(MediaPlayer::EndOfStreamStatus) { }; 172 174 #endif -
trunk/Source/WebKit/chromium/ChangeLog
r117645 r117662 1 2012-05-18 Aaron Colwell <acolwell@chromium.org> 2 3 Update Media Source implementation to reflect changes in 0.5 spec. 4 https://bugs.webkit.org/show_bug.cgi?id=83607 5 6 Reviewed by Darin Fisher. 7 8 * public/WebMediaPlayer.h: 9 (WebKit::WebMediaPlayer::sourceAddId): Update the signature to take the parsed type and codecs vector. 10 (WebKit::WebMediaPlayer::sourceBuffered): Add default implementation for new method. 11 (WebKit::WebMediaPlayer::sourceAppend): Update signature to include id parameter. 12 (WebKit::WebMediaPlayer::sourceAbort): Add default implementation for new method. 13 * src/WebMediaPlayerClientImpl.cpp: 14 (WebKit::WebMediaPlayerClientImpl::sourceAddId): Update the signature to take the parsed type and codecs vector. 15 (WebKit::WebMediaPlayerClientImpl::sourceBuffered): Added implementation for new method. Converts WebKit::WebTimeRanges to WebCore::TimeRanges. 16 (WebKit): 17 (WebKit::WebMediaPlayerClientImpl::sourceAppend): Update signature to include id parameter. 18 (WebKit::WebMediaPlayerClientImpl::sourceAbort): Implementation for new method. 19 * src/WebMediaPlayerClientImpl.h: 20 (WebMediaPlayerClientImpl): Added declarations for new methods and updated signatures for existing ones. 21 1 22 2012-05-18 Shawn Singh <shawnsingh@chromium.org> 2 23 -
trunk/Source/WebKit/chromium/public/WebMediaPlayer.h
r116782 r117662 174 174 virtual WebAudioSourceProvider* audioSourceProvider() { return 0; } 175 175 176 virtual AddIdStatus sourceAddId(const WebString& id, const WebString& type) { return AddIdStatusNotSupported; } 176 virtual AddIdStatus sourceAddId(const WebString& id, const WebString& type, 177 const WebVector<WebString>& codecs) { return AddIdStatusNotSupported; } 177 178 virtual bool sourceRemoveId(const WebString& id) { return false; } 178 virtual bool sourceAppend(const unsigned char* data, unsigned length) { return false; } 179 virtual WebTimeRanges sourceBuffered(const WebString& id) { return WebTimeRanges(); }; 180 virtual bool sourceAppend(const WebString& id, const unsigned char* data, unsigned length) { return false; } 181 virtual bool sourceAbort(const WebString& id) { return false; } 179 182 virtual void sourceEndOfStream(EndOfStreamStatus) { } 180 183 -
trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
r116782 r117662 360 360 361 361 #if ENABLE(MEDIA_SOURCE) 362 WebCore::MediaPlayer::AddIdStatus WebMediaPlayerClientImpl::sourceAddId(const String& id, const String& type )362 WebCore::MediaPlayer::AddIdStatus WebMediaPlayerClientImpl::sourceAddId(const String& id, const String& type, const Vector<String>& codecs) 363 363 { 364 364 if (!m_webMediaPlayer) 365 365 return WebCore::MediaPlayer::NotSupported; 366 366 367 return static_cast<WebCore::MediaPlayer::AddIdStatus>(m_webMediaPlayer->sourceAddId(id, type ));367 return static_cast<WebCore::MediaPlayer::AddIdStatus>(m_webMediaPlayer->sourceAddId(id, type, codecs)); 368 368 } 369 369 … … 376 376 } 377 377 378 bool WebMediaPlayerClientImpl::sourceAppend(const unsigned char* data, unsigned length) 379 { 380 if (m_webMediaPlayer) 381 return m_webMediaPlayer->sourceAppend(data, length); 378 PassRefPtr<TimeRanges> WebMediaPlayerClientImpl::sourceBuffered(const String& id) 379 { 380 if (!m_webMediaPlayer) 381 return TimeRanges::create(); 382 383 WebTimeRanges webRanges = m_webMediaPlayer->sourceBuffered(id); 384 RefPtr<TimeRanges> ranges = TimeRanges::create(); 385 for (size_t i = 0; i < webRanges.size(); ++i) 386 ranges->add(webRanges[i].start, webRanges[i].end); 387 return ranges.release(); 388 } 389 390 bool WebMediaPlayerClientImpl::sourceAppend(const String& id, const unsigned char* data, unsigned length) 391 { 392 if (m_webMediaPlayer) 393 return m_webMediaPlayer->sourceAppend(id, data, length); 382 394 return false; 395 } 396 397 bool WebMediaPlayerClientImpl::sourceAbort(const String& id) 398 { 399 if (!m_webMediaPlayer) 400 return false; 401 402 return m_webMediaPlayer->sourceAbort(id); 383 403 } 384 404 -
trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
r116782 r117662 155 155 156 156 #if ENABLE(MEDIA_SOURCE) 157 virtual WebCore::MediaPlayer::AddIdStatus sourceAddId(const String& id, const String& type );157 virtual WebCore::MediaPlayer::AddIdStatus sourceAddId(const String& id, const String& type, const Vector<String>& codecs); 158 158 virtual bool sourceRemoveId(const String&); 159 virtual bool sourceAppend(const unsigned char* data, unsigned length); 159 virtual WTF::PassRefPtr<WebCore::TimeRanges> sourceBuffered(const String&); 160 virtual bool sourceAppend(const String&, const unsigned char* data, unsigned length); 161 virtual bool sourceAbort(const String&); 160 162 virtual void sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus); 161 163 #endif
Note: See TracChangeset
for help on using the changeset viewer.