| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #ifndef WebMediaStreamPrivate_h | 32 #ifndef MediaStreamDescriptor_h |
| 33 #define WebMediaStreamPrivate_h | 33 #define MediaStreamDescriptor_h |
| 34 | 34 |
| 35 #include "core/platform/chromium/support/WebMediaStreamClient.h" | |
| 36 #include "core/platform/mediastream/MediaStreamComponent.h" | 35 #include "core/platform/mediastream/MediaStreamComponent.h" |
| 37 #include "core/platform/mediastream/MediaStreamSource.h" | 36 #include "core/platform/mediastream/MediaStreamSource.h" |
| 38 #include "wtf/RefCounted.h" | 37 #include <wtf/RefCounted.h> |
| 39 #include "wtf/Vector.h" | 38 #include <wtf/Vector.h> |
| 40 | 39 |
| 41 namespace WebKit { | 40 namespace WebCore { |
| 42 | 41 |
| 43 class WebMediaStreamPrivate : public RefCounted<WebMediaStreamPrivate> { | 42 class MediaStreamDescriptorClient { |
| 43 public: |
| 44 virtual ~MediaStreamDescriptorClient() { } |
| 45 |
| 46 virtual void trackEnded() = 0; |
| 47 virtual void streamEnded() = 0; |
| 48 virtual void addRemoteTrack(MediaStreamComponent*) = 0; |
| 49 virtual void removeRemoteTrack(MediaStreamComponent*) = 0; |
| 50 }; |
| 51 |
| 52 class MediaStreamDescriptor : public RefCounted<MediaStreamDescriptor> { |
| 44 public: | 53 public: |
| 45 class ExtraData : public RefCounted<ExtraData> { | 54 class ExtraData : public RefCounted<ExtraData> { |
| 46 public: | 55 public: |
| 47 virtual ~ExtraData() { } | 56 virtual ~ExtraData() { } |
| 48 }; | 57 }; |
| 49 | 58 |
| 50 static PassRefPtr<WebMediaStreamPrivate> create(const WebCore::MediaStreamSo
urceVector& audioSources, const WebCore::MediaStreamSourceVector& videoSources); | 59 static PassRefPtr<MediaStreamDescriptor> create(const MediaStreamSourceVecto
r& audioSources, const MediaStreamSourceVector& videoSources); |
| 51 | 60 |
| 52 static PassRefPtr<WebMediaStreamPrivate> create(const String& id, const WebC
ore::MediaStreamComponentVector& audioComponents, const WebCore::MediaStreamComp
onentVector& videoComponents); | 61 static PassRefPtr<MediaStreamDescriptor> create(const String& id, const Medi
aStreamComponentVector& audioComponents, const MediaStreamComponentVector& video
Components); |
| 53 | 62 |
| 54 WebKit::WebMediaStreamClient* client() const { return m_client; } | 63 MediaStreamDescriptorClient* client() const { return m_client; } |
| 55 void setClient(WebKit::WebMediaStreamClient* client) { m_client = client; } | 64 void setClient(MediaStreamDescriptorClient* client) { m_client = client; } |
| 56 | 65 |
| 57 String id() const { return m_id; } | 66 String id() const { return m_id; } |
| 58 | 67 |
| 59 unsigned numberOfAudioComponents() const { return m_audioComponents.size();
} | 68 unsigned numberOfAudioComponents() const { return m_audioComponents.size();
} |
| 60 WebCore::MediaStreamComponent* audioComponent(unsigned index) const { return
m_audioComponents[index].get(); } | 69 MediaStreamComponent* audioComponent(unsigned index) const { return m_audioC
omponents[index].get(); } |
| 61 | 70 |
| 62 unsigned numberOfVideoComponents() const { return m_videoComponents.size();
} | 71 unsigned numberOfVideoComponents() const { return m_videoComponents.size();
} |
| 63 WebCore::MediaStreamComponent* videoComponent(unsigned index) const { return
m_videoComponents[index].get(); } | 72 MediaStreamComponent* videoComponent(unsigned index) const { return m_videoC
omponents[index].get(); } |
| 64 | 73 |
| 65 void addComponent(WebCore::MediaStreamComponent*); | 74 void addComponent(PassRefPtr<MediaStreamComponent>); |
| 66 void removeComponent(WebCore::MediaStreamComponent*); | 75 void removeComponent(PassRefPtr<MediaStreamComponent>); |
| 67 | 76 |
| 68 void addRemoteTrack(WebCore::MediaStreamComponent*); | 77 void addRemoteTrack(MediaStreamComponent*); |
| 69 void removeRemoteTrack(WebCore::MediaStreamComponent*); | 78 void removeRemoteTrack(MediaStreamComponent*); |
| 70 | 79 |
| 71 bool ended() const { return m_ended; } | 80 bool ended() const { return m_ended; } |
| 72 void setEnded() { m_ended = true; } | 81 void setEnded() { m_ended = true; } |
| 73 | 82 |
| 74 PassRefPtr<ExtraData> extraData() const { return m_extraData; } | 83 PassRefPtr<ExtraData> extraData() const { return m_extraData; } |
| 75 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData
; } | 84 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData
; } |
| 76 | 85 |
| 77 private: | 86 private: |
| 78 WebMediaStreamPrivate(const String& id, const WebCore::MediaStreamSourceVect
or& audioSources, const WebCore::MediaStreamSourceVector& videoSources); | 87 MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audio
Sources, const MediaStreamSourceVector& videoSources); |
| 79 WebMediaStreamPrivate(const String& id, const WebCore::MediaStreamComponentV
ector& audioComponents, const WebCore::MediaStreamComponentVector& videoComponen
ts); | 88 MediaStreamDescriptor(const String& id, const MediaStreamComponentVector& au
dioComponents, const MediaStreamComponentVector& videoComponents); |
| 80 | 89 |
| 81 WebMediaStreamClient* m_client; | 90 MediaStreamDescriptorClient* m_client; |
| 82 String m_id; | 91 String m_id; |
| 83 Vector<RefPtr<WebCore::MediaStreamComponent> > m_audioComponents; | 92 Vector<RefPtr<MediaStreamComponent> > m_audioComponents; |
| 84 Vector<RefPtr<WebCore::MediaStreamComponent> > m_videoComponents; | 93 Vector<RefPtr<MediaStreamComponent> > m_videoComponents; |
| 85 bool m_ended; | 94 bool m_ended; |
| 86 | 95 |
| 87 RefPtr<ExtraData> m_extraData; | 96 RefPtr<ExtraData> m_extraData; |
| 88 }; | 97 }; |
| 89 | 98 |
| 90 typedef Vector<RefPtr<WebMediaStreamPrivate> > WebMediaStreamPrivateVector; | 99 typedef Vector<RefPtr<MediaStreamDescriptor> > MediaStreamDescriptorVector; |
| 91 | 100 |
| 92 } // namespace WebKit | 101 } // namespace WebCore |
| 93 | 102 |
| 94 #endif // WebMediaStreamPrivate_h | 103 #endif // MediaStreamDescriptor_h |
| OLD | NEW |