Update HTMLMediaElement to the new OO MediaSource API.
authorannacc@chromium.org <annacc@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Aug 2012 18:38:43 +0000 (18:38 +0000)
committerannacc@chromium.org <annacc@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Aug 2012 18:38:43 +0000 (18:38 +0000)
commit2abd074bb82d1be1bc259d1811c369f2f7386b0c
tree000dca0a3eb007e5187f8a43e758591048b2c473
parentee83643884b1fbd751915f3af8115c96e7c1a142
Update HTMLMediaElement to the new OO MediaSource API.
https://bugs.webkit.org/show_bug.cgi?id=91775

Reviewed by Eric Carlson.

This patch rips out the old-style MediaSource API and allows a
MediaSource object to be attached to HTMLMediaElement.
http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html

Source/WebCore:

Tests: updates to http/tests/media/media-source/*
       http/tests/media/media-source/video-media-source-add-and-remove-buffers.html
       http/tests/media/media-source/video-media-source-objects.html

* html/HTMLMediaElement.cpp:
(WebCore):
(WebCore::HTMLMediaElement::HTMLMediaElement): Remove old style API resources.
(WebCore::HTMLMediaElement::parseAttribute): Remove old style event attribute.
(WebCore::HTMLMediaElement::prepareForLoad): Set source state to "closed".
(WebCore::HTMLMediaElement::loadResource): Get MediaSource object from blob registry
    look up and, if found, set it's MediaPlayer pointer to the current MediaPlayer.
(WebCore::HTMLMediaElement::noneSupported): Set source state to "closed".
(WebCore::HTMLMediaElement::mediaEngineError): Set source state to "closed".
(WebCore::HTMLMediaElement::mediaPlayerSourceOpened): Set source state to "open".
(WebCore::HTMLMediaElement::mediaPlayerSourceURL): Change to new blob URL.
(WebCore::HTMLMediaElement::seek): Check if source state is "closed".
(WebCore::HTMLMediaElement::setSourceState): Helper function so that we don't have to
    keep checking for m_mediaSource.
(WebCore::HTMLMediaElement::userCancelledLoad): Set source state to "closed".
(WebCore::HTMLMediaElement::createMediaPlayer): If the current MediaPlayer is re-
     created, notify the MediaSource and reset its MediaPlayer.

* html/HTMLMediaElement.h: Remove old style API code and add a MediaSource object.
(HTMLMediaElement):
* html/HTMLMediaElement.idl: Remove old style API.

LayoutTests:

* http/tests/media/media-source/media-source.js:
(MediaSourceTest.SegmentHelper):
(MediaSourceTest.SegmentHelper.prototype.addSourceBuffer):
(MediaSourceTest.SegmentHelper.prototype.appendInitSegment):
(MediaSourceTest.SegmentHelper.prototype.appendMediaSegment):
(MediaSourceTest.SegmentHelper.prototype.appendUntilEndOfStream):
(MediaSourceTest.setSrcToMediaSourceTestURL):
(MediaSourceTest.defaultOnErrorChecks):
(MediaSourceTest.runOnSourceOpen.eventHandlerFunction):
(MediaSourceTest.runOnSourceOpen):
(MediaSourceTest.logSourceState):
(MediaSourceTest.expectSourceState):
* http/tests/media/media-source/video-media-source-abort-expected.txt:
* http/tests/media/media-source/video-media-source-abort.html:
* http/tests/media/media-source/video-media-source-add-and-remove-buffers-expected.txt: Renamed from LayoutTests/http/tests/media/media-source/video-media-source-add-and-remove-ids-expected.txt.
* http/tests/media/media-source/video-media-source-add-and-remove-buffers.html: Added.
* http/tests/media/media-source/video-media-source-add-and-remove-ids.html: Removed.
* http/tests/media/media-source/video-media-source-errors-expected.txt:
* http/tests/media/media-source/video-media-source-errors.html:
* http/tests/media/media-source/video-media-source-event-attributes-expected.txt:
* http/tests/media/media-source/video-media-source-event-attributes.html:
* http/tests/media/media-source/video-media-source-objects-expected.txt: Added.
* http/tests/media/media-source/video-media-source-objects.html: Added.
* http/tests/media/media-source/video-media-source-play-expected.txt:
* http/tests/media/media-source/video-media-source-play.html:
* http/tests/media/media-source/video-media-source-seek-expected.txt:
* http/tests/media/media-source/video-media-source-seek.html:
* http/tests/media/media-source/video-media-source-state-changes-expected.txt:
* http/tests/media/media-source/video-media-source-state-changes.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/media/media-source/media-source.js
LayoutTests/http/tests/media/media-source/video-media-source-abort-expected.txt
LayoutTests/http/tests/media/media-source/video-media-source-abort.html
LayoutTests/http/tests/media/media-source/video-media-source-add-and-remove-buffers-expected.txt [moved from LayoutTests/http/tests/media/media-source/video-media-source-add-and-remove-ids-expected.txt with 50% similarity]
LayoutTests/http/tests/media/media-source/video-media-source-add-and-remove-buffers.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/video-media-source-add-and-remove-ids.html [deleted file]
LayoutTests/http/tests/media/media-source/video-media-source-errors-expected.txt
LayoutTests/http/tests/media/media-source/video-media-source-errors.html
LayoutTests/http/tests/media/media-source/video-media-source-event-attributes-expected.txt
LayoutTests/http/tests/media/media-source/video-media-source-event-attributes.html
LayoutTests/http/tests/media/media-source/video-media-source-objects-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/video-media-source-objects.html [new file with mode: 0644]
LayoutTests/http/tests/media/media-source/video-media-source-play-expected.txt
LayoutTests/http/tests/media/media-source/video-media-source-play.html
LayoutTests/http/tests/media/media-source/video-media-source-seek-expected.txt
LayoutTests/http/tests/media/media-source/video-media-source-seek.html
LayoutTests/http/tests/media/media-source/video-media-source-state-changes-expected.txt
LayoutTests/http/tests/media/media-source/video-media-source-state-changes.html
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLMediaElement.idl