| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| 11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
| 12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
| 13 * | 13 * |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND | 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND |
| 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 17 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR | 17 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR |
| 18 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 18 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef MediaStream_h | 26 #ifndef MediaStream_h |
| 27 #define MediaStream_h | 27 #define MediaStream_h |
| 28 | 28 |
| 29 #include "core/dom/ExecutionContext.h" | |
| 30 #include "core/html/URLRegistry.h" | 29 #include "core/html/URLRegistry.h" |
| 31 #include "modules/EventTargetModules.h" | 30 #include "modules/EventTargetModules.h" |
| 32 #include "modules/ModulesExport.h" | 31 #include "modules/ModulesExport.h" |
| 33 #include "modules/mediastream/MediaStreamTrack.h" | 32 #include "modules/mediastream/MediaStreamTrack.h" |
| 34 #include "platform/Timer.h" | 33 #include "platform/Timer.h" |
| 35 #include "platform/mediastream/MediaStreamDescriptor.h" | 34 #include "platform/mediastream/MediaStreamDescriptor.h" |
| 36 | 35 |
| 37 namespace blink { | 36 namespace blink { |
| 38 | 37 |
| 39 class ExceptionState; | 38 class ExceptionState; |
| 39 class ExecutionContext; |
| 40 class ScriptState; |
| 40 | 41 |
| 41 class MODULES_EXPORT MediaStream final : public EventTargetWithInlineData, | 42 class MODULES_EXPORT MediaStream final : public EventTargetWithInlineData, |
| 42 public ContextClient, | 43 public ContextClient, |
| 43 public URLRegistrable, | 44 public URLRegistrable, |
| 44 public MediaStreamDescriptorClient { | 45 public MediaStreamDescriptorClient { |
| 45 USING_GARBAGE_COLLECTED_MIXIN(MediaStream); | 46 USING_GARBAGE_COLLECTED_MIXIN(MediaStream); |
| 46 DEFINE_WRAPPERTYPEINFO(); | 47 DEFINE_WRAPPERTYPEINFO(); |
| 47 | 48 |
| 48 public: | 49 public: |
| 49 static MediaStream* create(ExecutionContext*); | 50 static MediaStream* create(ExecutionContext*); |
| 50 static MediaStream* create(ExecutionContext*, MediaStream*); | 51 static MediaStream* create(ExecutionContext*, MediaStream*); |
| 51 static MediaStream* create(ExecutionContext*, const MediaStreamTrackVector&); | 52 static MediaStream* create(ExecutionContext*, const MediaStreamTrackVector&); |
| 52 static MediaStream* create(ExecutionContext*, MediaStreamDescriptor*); | 53 static MediaStream* create(ExecutionContext*, MediaStreamDescriptor*); |
| 53 ~MediaStream() override; | 54 ~MediaStream() override; |
| 54 | 55 |
| 55 String id() const { return m_descriptor->id(); } | 56 String id() const { return m_descriptor->id(); } |
| 56 | 57 |
| 57 void addTrack(MediaStreamTrack*, ExceptionState&); | 58 void addTrack(MediaStreamTrack*, ExceptionState&); |
| 58 void removeTrack(MediaStreamTrack*, ExceptionState&); | 59 void removeTrack(MediaStreamTrack*, ExceptionState&); |
| 59 MediaStreamTrack* getTrackById(String); | 60 MediaStreamTrack* getTrackById(String); |
| 60 MediaStream* clone(ExecutionContext*); | 61 MediaStream* clone(ScriptState*); |
| 61 | 62 |
| 62 MediaStreamTrackVector getAudioTracks() const { return m_audioTracks; } | 63 MediaStreamTrackVector getAudioTracks() const { return m_audioTracks; } |
| 63 MediaStreamTrackVector getVideoTracks() const { return m_videoTracks; } | 64 MediaStreamTrackVector getVideoTracks() const { return m_videoTracks; } |
| 64 MediaStreamTrackVector getTracks(); | 65 MediaStreamTrackVector getTracks(); |
| 65 | 66 |
| 66 bool active() const { return m_descriptor->active(); } | 67 bool active() const { return m_descriptor->active(); } |
| 67 | 68 |
| 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(active); | 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(active); |
| 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(inactive); | 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(inactive); |
| 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); | 71 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 HeapVector<Member<Event>> m_scheduledEvents; | 118 HeapVector<Member<Event>> m_scheduledEvents; |
| 118 }; | 119 }; |
| 119 | 120 |
| 120 using MediaStreamVector = HeapVector<Member<MediaStream>>; | 121 using MediaStreamVector = HeapVector<Member<MediaStream>>; |
| 121 | 122 |
| 122 MediaStream* toMediaStream(MediaStreamDescriptor*); | 123 MediaStream* toMediaStream(MediaStreamDescriptor*); |
| 123 | 124 |
| 124 } // namespace blink | 125 } // namespace blink |
| 125 | 126 |
| 126 #endif // MediaStream_h | 127 #endif // MediaStream_h |
| OLD | NEW |