| 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) 2013 Google Inc. All rights reserved. |
| 3 * | 4 * |
| 4 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 6 * are met: | 7 * are met: |
| 7 * | 8 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 11 * 2. Redistributions in binary form must reproduce the above copyright |
| 11 * notice, this list of conditions and the following disclaimer | 12 * notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the | 13 * in the documentation and/or other materials provided with the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (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 |
| 28 * 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. |
| 29 */ | 30 */ |
| 30 | 31 |
| 31 #ifndef MediaStreamComponent_h | 32 #ifndef MediaStreamComponent_h |
| 32 #define MediaStreamComponent_h | 33 #define MediaStreamComponent_h |
| 33 | 34 |
| 34 #include "core/platform/UUID.h" | 35 #include <wtf/PassRefPtr.h> |
| 35 #include "core/platform/mediastream/MediaStreamSource.h" | 36 #include <wtf/RefCounted.h> |
| 37 #include <wtf/text/WTFString.h> |
| 36 | 38 |
| 37 namespace WebCore { | 39 namespace WebCore { |
| 38 | 40 |
| 39 class MediaStreamDescriptor; | 41 class MediaStreamDescriptor; |
| 42 class MediaStreamSource; |
| 40 | 43 |
| 41 class MediaStreamComponent : public RefCounted<MediaStreamComponent> { | 44 class MediaStreamComponent : public RefCounted<MediaStreamComponent> { |
| 42 public: | 45 public: |
| 43 static PassRefPtr<MediaStreamComponent> create(PassRefPtr<MediaStreamSource>
source) | 46 static PassRefPtr<MediaStreamComponent> create(PassRefPtr<MediaStreamSource>
); |
| 44 { | 47 static PassRefPtr<MediaStreamComponent> create(const String& id, PassRefPtr<
MediaStreamSource>); |
| 45 return adoptRef(new MediaStreamComponent(createCanonicalUUIDString(), 0,
source)); | 48 static PassRefPtr<MediaStreamComponent> create(MediaStreamDescriptor*, PassR
efPtr<MediaStreamSource>); |
| 46 } | |
| 47 | |
| 48 static PassRefPtr<MediaStreamComponent> create(const String& id, PassRefPtr<
MediaStreamSource> source) | |
| 49 { | |
| 50 return adoptRef(new MediaStreamComponent(id, 0, source)); | |
| 51 } | |
| 52 | |
| 53 static PassRefPtr<MediaStreamComponent> create(MediaStreamDescriptor* stream
, PassRefPtr<MediaStreamSource> source) | |
| 54 { | |
| 55 return adoptRef(new MediaStreamComponent(createCanonicalUUIDString(), st
ream, source)); | |
| 56 } | |
| 57 | 49 |
| 58 MediaStreamDescriptor* stream() const { return m_stream; } | 50 MediaStreamDescriptor* stream() const { return m_stream; } |
| 59 void setStream(MediaStreamDescriptor* stream) { ASSERT(!m_stream && stream);
m_stream = stream; } | 51 void setStream(MediaStreamDescriptor* stream) { ASSERT(!m_stream && stream);
m_stream = stream; } |
| 60 | 52 |
| 61 MediaStreamSource* source() const { return m_source.get(); } | 53 MediaStreamSource* source() const { return m_source.get(); } |
| 62 | 54 |
| 63 String id() const { return m_id; } | 55 String id() const { return m_id; } |
| 64 bool enabled() const { return m_enabled; } | 56 bool enabled() const { return m_enabled; } |
| 65 void setEnabled(bool enabled) { m_enabled = enabled; } | 57 void setEnabled(bool enabled) { m_enabled = enabled; } |
| 66 | 58 |
| 67 private: | 59 private: |
| 68 MediaStreamComponent(const String& id, MediaStreamDescriptor* stream, PassRe
fPtr<MediaStreamSource> source) | 60 MediaStreamComponent(const String& id, MediaStreamDescriptor*, PassRefPtr<Me
diaStreamSource>); |
| 69 : m_stream(stream) | |
| 70 , m_source(source) | |
| 71 , m_id(id) | |
| 72 , m_enabled(true) | |
| 73 { | |
| 74 ASSERT(m_id.length()); | |
| 75 } | |
| 76 | 61 |
| 77 MediaStreamDescriptor* m_stream; | 62 MediaStreamDescriptor* m_stream; |
| 78 RefPtr<MediaStreamSource> m_source; | 63 RefPtr<MediaStreamSource> m_source; |
| 79 String m_id; | 64 String m_id; |
| 80 bool m_enabled; | 65 bool m_enabled; |
| 81 }; | 66 }; |
| 82 | 67 |
| 83 typedef Vector<RefPtr<MediaStreamComponent> > MediaStreamComponentVector; | 68 typedef Vector<RefPtr<MediaStreamComponent> > MediaStreamComponentVector; |
| 84 | 69 |
| 85 } // namespace WebCore | 70 } // namespace WebCore |
| 86 | 71 |
| 87 #endif // MediaStreamComponent_h | 72 #endif // MediaStreamComponent_h |
| OLD | NEW |