gecko/dom/webidl/HTMLMediaElement.webidl
Chris Pearce a8e52798ff Bug 778077 - Implement HTMLMediaElement.fastSeek(time). r=cajbir
Implement HTMLMediaElement.fastSeek(), basically by changing all the
MediaDecoderReader::Seek() overrides to not call
MediaDecoderReader::DecodeToTarget(), and have MediaDecoderReader::DecodeSeek()
call DecodeToTarget() if we're doing an accurate (non-fast) seek.

Update gizmo.mp4 to have a keyframe every second, instead of only 1 keyframe at
the start of stream. This makes the unit test I added more useful for mp4...

I pushed most of the seek target clamping logic in MediaDecoder up into
HTMLMediaElement, so that we're clamping in fewer places. Note
MediaDecoderStateMachine::Seek() still sanity checks the seek target.

We have to update the currentTime/MediaDecoder playback position after a seek
completes now, rather than assuming the seek always got it exactly right.

Removed those pesky assertions about seek target lying in the first frame after
seek, since actually sometimes the media doesn't have samples for all streams
after a seek (either due to the media being encoded like that, or because of a
bug in the platform's decoder, not entirely sure).

Green: https://tbpl.mozilla.org/?tree=Try&rev=b028258565e2
* * *
Bug 778077 - Fix up MediaOMXReader fastseek to ensure audio stream stays in sync with video stream. r=cajbir
2014-04-01 16:39:04 +13:00

146 lines
5.0 KiB
Plaintext

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#media-elements
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
interface HTMLMediaElement : HTMLElement {
// error state
readonly attribute MediaError? error;
// network state
[SetterThrows]
attribute DOMString src;
readonly attribute DOMString currentSrc;
[SetterThrows]
attribute DOMString crossOrigin;
const unsigned short NETWORK_EMPTY = 0;
const unsigned short NETWORK_IDLE = 1;
const unsigned short NETWORK_LOADING = 2;
const unsigned short NETWORK_NO_SOURCE = 3;
readonly attribute unsigned short networkState;
[SetterThrows]
attribute DOMString preload;
[NewObject]
readonly attribute TimeRanges buffered;
void load();
DOMString canPlayType(DOMString type);
// ready state
const unsigned short HAVE_NOTHING = 0;
const unsigned short HAVE_METADATA = 1;
const unsigned short HAVE_CURRENT_DATA = 2;
const unsigned short HAVE_FUTURE_DATA = 3;
const unsigned short HAVE_ENOUGH_DATA = 4;
readonly attribute unsigned short readyState;
readonly attribute boolean seeking;
// playback state
[SetterThrows]
attribute double currentTime;
[Throws]
void fastSeek(double time);
readonly attribute unrestricted double duration;
// TODO: Bug 847376 - readonly attribute any startDate;
readonly attribute boolean paused;
[SetterThrows]
attribute double defaultPlaybackRate;
[SetterThrows]
attribute double playbackRate;
[NewObject]
readonly attribute TimeRanges played;
[NewObject]
readonly attribute TimeRanges seekable;
readonly attribute boolean ended;
[SetterThrows]
attribute boolean autoplay;
[SetterThrows]
attribute boolean loop;
[Throws]
void play();
[Throws]
void pause();
// TODO: Bug 847377 - mediaGroup and MediaController
// media controller
// attribute DOMString mediaGroup;
// attribute MediaController? controller;
// controls
[SetterThrows]
attribute boolean controls;
[SetterThrows]
attribute double volume;
attribute boolean muted;
[SetterThrows]
attribute boolean defaultMuted;
// TODO: Bug 847379
// tracks
//readonly attribute AudioTrackList audioTracks;
//readonly attribute VideoTrackList videoTracks;
[Pref="media.webvtt.enabled"]
readonly attribute TextTrackList textTracks;
[Pref="media.webvtt.enabled"]
TextTrack addTextTrack(TextTrackKind kind,
optional DOMString label = "",
optional DOMString language = "");
};
// Mozilla extensions:
partial interface HTMLMediaElement {
attribute MediaStream? mozSrcObject;
attribute boolean mozPreservesPitch;
readonly attribute boolean mozAutoplayEnabled;
// Mozilla extension: stream capture
[Throws]
MediaStream mozCaptureStream();
[Throws]
MediaStream mozCaptureStreamUntilEnded();
readonly attribute boolean mozAudioCaptured;
// Mozilla extension: extra stream metadata information, used as part
// of MozAudioAvailable events and the mozWriteAudio() method. The
// mozFrameBufferLength method allows for the size of the framebuffer
// used within MozAudioAvailable events to be changed. The new size must
// be between 512 and 16384. The default size, for a media element with
// audio is (mozChannels * 1024).
[Pref="media.audio_data.enabled", GetterThrows]
readonly attribute unsigned long mozChannels;
[Pref="media.audio_data.enabled", GetterThrows]
readonly attribute unsigned long mozSampleRate;
[Pref="media.audio_data.enabled", Throws]
attribute unsigned long mozFrameBufferLength;
// Mozilla extension: return embedded metadata from the stream as a
// JSObject with key:value pairs for each tag. This can be used by
// player interfaces to display the song title, artist, etc.
[Throws]
object? mozGetMetadata();
// Mozilla extension: provides access to the fragment end time if
// the media element has a fragment URI for the currentSrc, otherwise
// it is equal to the media duration.
readonly attribute double mozFragmentEnd;
// Mozilla extension: an audio channel type for media elements.
// Read AudioChannel.webidl for more information about this attribute.
[SetterThrows]
attribute AudioChannel mozAudioChannelType;
// In addition the media element has this new events:
// * onmozinterruptbegin - called when the media element is interrupted
// because of the audiochannel manager.
// * onmozinterruptend - called when the interruption is concluded
};