mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 834835. Part 1: Add initial AudioStreamTrack/VideoStreamTrack/MediaStreamTrack interfaces and implementations. r=jesup
--HG-- extra : rebase_source : 7d9ec16301f7ba12fb181e0b37fdcaf8455b97e4
This commit is contained in:
parent
883f6d98c7
commit
bd6864353b
20
content/media/AudioStreamTrack.cpp
Normal file
20
content/media/AudioStreamTrack.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#include "AudioStreamTrack.h"
|
||||
|
||||
#include "mozilla/dom/AudioStreamTrackBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
JSObject*
|
||||
AudioStreamTrack::WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return AudioStreamTrackBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
30
content/media/AudioStreamTrack.h
Normal file
30
content/media/AudioStreamTrack.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#ifndef AUDIOSTREAMTRACK_H_
|
||||
#define AUDIOSTREAMTRACK_H_
|
||||
|
||||
#include "MediaStreamTrack.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class AudioStreamTrack : public MediaStreamTrack {
|
||||
public:
|
||||
AudioStreamTrack(DOMMediaStream* aStream, TrackID aTrackID)
|
||||
: MediaStreamTrack(aStream, aTrackID) {}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope);
|
||||
|
||||
virtual AudioStreamTrack* AsAudioStreamTrack() { return this; }
|
||||
|
||||
// WebIDL
|
||||
virtual void GetKind(nsAString& aKind) { aKind.AssignLiteral("audio"); }
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* AUDIOSTREAMTRACK_H_ */
|
@ -16,24 +16,27 @@ FAIL_ON_WARNINGS := 1
|
||||
endif # !_MSC_VER
|
||||
|
||||
CPPSRCS = \
|
||||
AudioAvailableEventManager.cpp \
|
||||
AudioChannelFormat.cpp \
|
||||
AudioNodeEngine.cpp \
|
||||
AudioNodeStream.cpp \
|
||||
AudioSegment.cpp \
|
||||
AudioStream.cpp \
|
||||
AudioStreamTrack.cpp \
|
||||
DecoderTraits.cpp \
|
||||
DOMMediaStream.cpp \
|
||||
FileBlockCache.cpp \
|
||||
MediaResource.cpp \
|
||||
MediaStreamGraph.cpp \
|
||||
AudioAvailableEventManager.cpp \
|
||||
MediaCache.cpp \
|
||||
MediaDecoder.cpp \
|
||||
MediaDecoderStateMachine.cpp \
|
||||
MediaDecoderReader.cpp \
|
||||
MediaCache.cpp \
|
||||
MediaResource.cpp \
|
||||
MediaStreamGraph.cpp \
|
||||
MediaStreamTrack.cpp \
|
||||
StreamBuffer.cpp \
|
||||
VideoFrameContainer.cpp \
|
||||
VideoSegment.cpp \
|
||||
VideoStreamTrack.cpp \
|
||||
VideoUtils.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
51
content/media/MediaStreamTrack.cpp
Normal file
51
content/media/MediaStreamTrack.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#include "MediaStreamTrack.h"
|
||||
|
||||
#include "DOMMediaStream.h"
|
||||
#include "nsIUUIDGenerator.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
MediaStreamTrack::MediaStreamTrack(DOMMediaStream* aStream, TrackID aTrackID)
|
||||
: mStream(aStream), mTrackID(aTrackID), mEnded(false)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
|
||||
memset(&mID, 0, sizeof(mID));
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIUUIDGenerator> uuidgen =
|
||||
do_GetService("@mozilla.org/uuid-generator;1", &rv);
|
||||
if (uuidgen) {
|
||||
uuidgen->GenerateUUIDInPlace(&mID);
|
||||
}
|
||||
}
|
||||
|
||||
MediaStreamTrack::~MediaStreamTrack()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(MediaStreamTrack, nsDOMEventTargetHelper,
|
||||
mStream)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(MediaStreamTrack, nsDOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(MediaStreamTrack, nsDOMEventTargetHelper)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(MediaStreamTrack)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
||||
void
|
||||
MediaStreamTrack::GetId(nsAString& aID)
|
||||
{
|
||||
char chars[NSID_LENGTH];
|
||||
mID.ToProvidedString(chars);
|
||||
aID = NS_ConvertASCIItoUTF16(chars);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
63
content/media/MediaStreamTrack.h
Normal file
63
content/media/MediaStreamTrack.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#ifndef MEDIASTREAMTRACK_H_
|
||||
#define MEDIASTREAMTRACK_H_
|
||||
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsID.h"
|
||||
#include "StreamBuffer.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class DOMMediaStream;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class AudioStreamTrack;
|
||||
class VideoStreamTrack;
|
||||
|
||||
/**
|
||||
* Class representing a track in a DOMMediaStream.
|
||||
*/
|
||||
class MediaStreamTrack : public nsDOMEventTargetHelper {
|
||||
public:
|
||||
/**
|
||||
* aTrackID is the MediaStreamGraph track ID for the track in the
|
||||
* MediaStream owned by aStream.
|
||||
*/
|
||||
MediaStreamTrack(DOMMediaStream* aStream, TrackID aTrackID);
|
||||
virtual ~MediaStreamTrack();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaStreamTrack, nsDOMEventTargetHelper)
|
||||
|
||||
DOMMediaStream* GetParentObject() const { return mStream; }
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) = 0;
|
||||
|
||||
DOMMediaStream* GetStream() const { return mStream; }
|
||||
TrackID GetTrackID() const { return mTrackID; }
|
||||
virtual AudioStreamTrack* AsAudioStreamTrack() { return nullptr; }
|
||||
virtual VideoStreamTrack* AsVideoStreamTrack() { return nullptr; }
|
||||
|
||||
// WebIDL
|
||||
virtual void GetKind(nsAString& aKind) = 0;
|
||||
void GetId(nsAString& aID);
|
||||
void GetLabel(nsAString& aLabel) { aLabel.Truncate(); }
|
||||
|
||||
// Notifications from the MediaStreamGraph
|
||||
void NotifyEnded() { mEnded = true; }
|
||||
|
||||
protected:
|
||||
nsRefPtr<DOMMediaStream> mStream;
|
||||
TrackID mTrackID;
|
||||
nsID mID;
|
||||
bool mEnded;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MEDIASTREAMTRACK_H_ */
|
20
content/media/VideoStreamTrack.cpp
Normal file
20
content/media/VideoStreamTrack.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#include "VideoStreamTrack.h"
|
||||
|
||||
#include "mozilla/dom/VideoStreamTrackBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
JSObject*
|
||||
VideoStreamTrack::WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return VideoStreamTrackBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
30
content/media/VideoStreamTrack.h
Normal file
30
content/media/VideoStreamTrack.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#ifndef VIDEOSTREAMTRACK_H_
|
||||
#define VIDEOSTREAMTRACK_H_
|
||||
|
||||
#include "MediaStreamTrack.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class VideoStreamTrack : public MediaStreamTrack {
|
||||
public:
|
||||
VideoStreamTrack(DOMMediaStream* aStream, TrackID aTrackID)
|
||||
: MediaStreamTrack(aStream, aTrackID) {}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope);
|
||||
|
||||
virtual VideoStreamTrack* AsVideoStreamTrack() { return this; }
|
||||
|
||||
// WebIDL
|
||||
virtual void GetKind(nsAString& aKind) { aKind.AssignLiteral("video"); }
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* VIDEOSTREAMTRACK_H_ */
|
@ -74,3 +74,9 @@ EXPORTS += [
|
||||
'VorbisUtils.h',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'AudioStreamTrack.h',
|
||||
'MediaStreamTrack.h',
|
||||
'VideoStreamTrack.h',
|
||||
]
|
||||
|
||||
|
@ -126,6 +126,9 @@ DOMInterfaces = {
|
||||
'nativeType': 'nsDOMBeforeUnloadEvent',
|
||||
},
|
||||
|
||||
'AudioStreamTrack': {
|
||||
},
|
||||
|
||||
'BiquadFilterNode': {
|
||||
'resultNotAddRefed': [ 'frequency', 'q', 'gain' ],
|
||||
},
|
||||
@ -553,6 +556,11 @@ DOMInterfaces = {
|
||||
'workers': True,
|
||||
}],
|
||||
|
||||
'LocalMediaStream': {
|
||||
'headerFile': 'DOMMediaStream.h',
|
||||
'nativeType': 'mozilla::DOMLocalMediaStream'
|
||||
},
|
||||
|
||||
'Location': {
|
||||
# NOTE: Before you turn on codegen for Location, make sure all the
|
||||
# Unforgeable stuff is dealt with.
|
||||
@ -571,11 +579,6 @@ DOMInterfaces = {
|
||||
'skipGen': True
|
||||
}],
|
||||
|
||||
'LocalMediaStream': {
|
||||
'headerFile': 'DOMMediaStream.h',
|
||||
'nativeType': 'mozilla::DOMLocalMediaStream'
|
||||
},
|
||||
|
||||
'MediaStreamList': {
|
||||
'headerFile': 'MediaStreamList.h',
|
||||
'wrapperCache': False,
|
||||
@ -584,6 +587,10 @@ DOMInterfaces = {
|
||||
'binaryNames': { '__indexedGetter': 'IndexedGetter' }
|
||||
},
|
||||
|
||||
'MediaStreamTrack': {
|
||||
'concrete': False
|
||||
},
|
||||
|
||||
'MessageEvent': {
|
||||
'nativeType': 'nsDOMMessageEvent',
|
||||
},
|
||||
@ -1022,6 +1029,9 @@ DOMInterfaces = {
|
||||
'workers': True,
|
||||
}],
|
||||
|
||||
'VideoStreamTrack': {
|
||||
},
|
||||
|
||||
'WebGLActiveInfo': {
|
||||
'nativeType': 'mozilla::WebGLActiveInfo',
|
||||
'headerFile': 'WebGLContext.h',
|
||||
|
16
dom/webidl/AudioStreamTrack.webidl
Normal file
16
dom/webidl/AudioStreamTrack.webidl
Normal file
@ -0,0 +1,16 @@
|
||||
/* -*- 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://dev.w3.org/2011/webrtc/editor/getusermedia.html
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
// [Constructor(optional MediaTrackConstraints audioConstraints)]
|
||||
interface AudioStreamTrack : MediaStreamTrack {
|
||||
// static sequence<DOMString> getSourceIds ();
|
||||
};
|
33
dom/webidl/MediaStreamTrack.webidl
Normal file
33
dom/webidl/MediaStreamTrack.webidl
Normal file
@ -0,0 +1,33 @@
|
||||
/* -*- 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://dev.w3.org/2011/webrtc/editor/getusermedia.html
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface MediaStreamTrack {
|
||||
readonly attribute DOMString kind;
|
||||
readonly attribute DOMString id;
|
||||
readonly attribute DOMString label;
|
||||
// attribute boolean enabled;
|
||||
// readonly attribute MediaStreamTrackState readyState;
|
||||
// readonly attribute SourceTypeEnum sourceType;
|
||||
// readonly attribute DOMString sourceId;
|
||||
// attribute EventHandler onstarted;
|
||||
// attribute EventHandler onmute;
|
||||
// attribute EventHandler onunmute;
|
||||
// attribute EventHandler onended;
|
||||
// any getConstraint (DOMString constraintName, optional boolean mandatory = false);
|
||||
// void setConstraint (DOMString constraintName, any constraintValue, optional boolean mandatory = false);
|
||||
// MediaTrackConstraints? constraints ();
|
||||
// void applyConstraints (MediaTrackConstraints constraints);
|
||||
// void prependConstraint (DOMString constraintName, any constraintValue);
|
||||
// void appendConstraint (DOMString constraintName, any constraintValue);
|
||||
// attribute EventHandler onoverconstrained;
|
||||
// void stop ();
|
||||
};
|
19
dom/webidl/VideoStreamTrack.webidl
Normal file
19
dom/webidl/VideoStreamTrack.webidl
Normal file
@ -0,0 +1,19 @@
|
||||
/* -*- 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://dev.w3.org/2011/webrtc/editor/getusermedia.html
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
// [Constructor(optional MediaTrackConstraints videoConstraints)]
|
||||
interface VideoStreamTrack : MediaStreamTrack {
|
||||
// static sequence<DOMString> getSourceIds ();
|
||||
// void takePhoto ();
|
||||
// attribute EventHandler onphoto;
|
||||
// attribute EventHandler onphotoerror;
|
||||
};
|
@ -20,6 +20,7 @@ webidl_files = \
|
||||
AudioListener.webidl \
|
||||
AudioNode.webidl \
|
||||
AudioParam.webidl \
|
||||
AudioStreamTrack.webidl \
|
||||
Attr.webidl \
|
||||
BatteryManager.webidl \
|
||||
BeforeUnloadEvent.webidl \
|
||||
@ -154,6 +155,7 @@ webidl_files = \
|
||||
Location.webidl \
|
||||
MediaError.webidl \
|
||||
MediaStream.webidl \
|
||||
MediaStreamTrack.webidl \
|
||||
MessageEvent.webidl \
|
||||
MouseEvent.webidl \
|
||||
MouseScrollEvent.webidl \
|
||||
@ -298,6 +300,7 @@ webidl_files = \
|
||||
UndoManager.webidl \
|
||||
URLUtils.webidl \
|
||||
USSDReceivedEvent.webidl \
|
||||
VideoStreamTrack.webidl \
|
||||
XMLDocument.webidl \
|
||||
XMLHttpRequest.webidl \
|
||||
XMLHttpRequestEventTarget.webidl \
|
||||
|
Loading…
Reference in New Issue
Block a user