/*
 * Copyright (C) 2011 Google Inc. All rights reserved.
 * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

enum MediaStreamTrackState { "live", "ended" };

[
    ActiveDOMObject,
    Conditional=MEDIA_STREAM,
    CustomToJSObject,
    ExportToWrappedFunction,
    PrivateIdentifier,
    PublicIdentifier,
] interface MediaStreamTrack : EventTarget {
    readonly attribute DOMString kind;
    readonly attribute DOMString id;
    readonly attribute DOMString label;
    attribute boolean enabled;
    readonly attribute boolean muted;
    attribute EventHandler onmute;
    attribute EventHandler onunmute;
    readonly attribute MediaStreamTrackState readyState;
    attribute EventHandler onended;

    MediaStreamTrack clone();
    [ImplementedAs=stopTrack] void stop();

    MediaTrackCapabilities getCapabilities();
    MediaTrackConstraints getConstraints();
    [CallWith=Document] MediaTrackSettings getSettings();
    Promise<void> applyConstraints(optional MediaTrackConstraints constraints);

    attribute EventHandler onoverconstrained;
};

[
    Conditional=MEDIA_STREAM,
    JSGenerateToJSObject,
] dictionary MediaTrackCapabilities {
    LongRange width;
    LongRange height;
    DoubleRange aspectRatio;
    DoubleRange frameRate;
    sequence<DOMString> facingMode;
    DoubleRange volume;
    LongRange sampleRate;
    LongRange sampleSize;
    sequence<boolean> echoCancellation;
    // FIXME 169871: add latency
    // FIXME 169871: add channelCount
    DOMString deviceId;
    DOMString groupId;
};

[
    Conditional=MEDIA_STREAM,
    JSGenerateToJSObject,
] dictionary MediaTrackSettings {
    long width;
    long height;
    double aspectRatio;
    double frameRate;
    DOMString facingMode;
    double volume;
    long sampleRate;
    long sampleSize;
    boolean echoCancellation;
    // FIXME 169871: add latency
    // FIXME 169871: add channelCount
    DOMString deviceId;
    DOMString groupId;
};
