| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class ExtraData : public RefCounted<ExtraData> { | 54 class ExtraData : public RefCounted<ExtraData> { |
| 55 public: | 55 public: |
| 56 virtual ~ExtraData() { } | 56 virtual ~ExtraData() { } |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 static PassRefPtr<MediaStreamDescriptor> create(const String& id, const Medi
aStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) | 59 static PassRefPtr<MediaStreamDescriptor> create(const String& id, const Medi
aStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) |
| 60 { | 60 { |
| 61 return adoptRef(new MediaStreamDescriptor(id, audioSources, videoSources
)); | 61 return adoptRef(new MediaStreamDescriptor(id, audioSources, videoSources
)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 static PassRefPtr<MediaStreamDescriptor> create(const String& id, const Medi
aStreamComponentVector& audioComponents, const MediaStreamComponentVector& video
Components) |
| 65 { |
| 66 return adoptRef(new MediaStreamDescriptor(id, audioComponents, videoComp
onents)); |
| 67 } |
| 68 |
| 64 MediaStreamDescriptorClient* client() const { return m_client; } | 69 MediaStreamDescriptorClient* client() const { return m_client; } |
| 65 void setClient(MediaStreamDescriptorClient* client) { m_client = client; } | 70 void setClient(MediaStreamDescriptorClient* client) { m_client = client; } |
| 66 | 71 |
| 67 String id() const { return m_id; } | 72 String id() const { return m_id; } |
| 68 | 73 |
| 69 unsigned numberOfAudioComponents() const { return m_audioComponents.size();
} | 74 unsigned numberOfAudioComponents() const { return m_audioComponents.size();
} |
| 70 MediaStreamComponent* audioComponent(unsigned index) const { return m_audioC
omponents[index].get(); } | 75 MediaStreamComponent* audioComponent(unsigned index) const { return m_audioC
omponents[index].get(); } |
| 71 void addAudioComponent(PassRefPtr<MediaStreamComponent> component) { m_audio
Components.append(component); } | 76 void addAudioComponent(PassRefPtr<MediaStreamComponent> component) { m_audio
Components.append(component); } |
| 72 void removeAudioComponent(MediaStreamComponent* component) | 77 void removeAudioComponent(MediaStreamComponent* component) |
| 73 { | 78 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 91 | 96 |
| 92 PassRefPtr<ExtraData> extraData() const { return m_extraData; } | 97 PassRefPtr<ExtraData> extraData() const { return m_extraData; } |
| 93 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData
; } | 98 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData
; } |
| 94 | 99 |
| 95 private: | 100 private: |
| 96 MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audio
Sources, const MediaStreamSourceVector& videoSources) | 101 MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audio
Sources, const MediaStreamSourceVector& videoSources) |
| 97 : m_client(0) | 102 : m_client(0) |
| 98 , m_id(id) | 103 , m_id(id) |
| 99 , m_ended(false) | 104 , m_ended(false) |
| 100 { | 105 { |
| 106 ASSERT(m_id.length()); |
| 101 for (size_t i = 0; i < audioSources.size(); i++) | 107 for (size_t i = 0; i < audioSources.size(); i++) |
| 102 m_audioComponents.append(MediaStreamComponent::create(this, audioSou
rces[i])); | 108 m_audioComponents.append(MediaStreamComponent::create(this, audioSou
rces[i])); |
| 103 | 109 |
| 104 for (size_t i = 0; i < videoSources.size(); i++) | 110 for (size_t i = 0; i < videoSources.size(); i++) |
| 105 m_videoComponents.append(MediaStreamComponent::create(this, videoSou
rces[i])); | 111 m_videoComponents.append(MediaStreamComponent::create(this, videoSou
rces[i])); |
| 106 } | 112 } |
| 107 | 113 |
| 114 MediaStreamDescriptor(const String& id, const MediaStreamComponentVector& au
dioComponents, const MediaStreamComponentVector& videoComponents) |
| 115 : m_client(0) |
| 116 , m_id(id) |
| 117 , m_ended(false) |
| 118 { |
| 119 ASSERT(m_id.length()); |
| 120 for (MediaStreamComponentVector::const_iterator iter = audioComponents.b
egin(); iter != audioComponents.end(); ++iter) { |
| 121 (*iter)->setStream(this); |
| 122 m_audioComponents.append((*iter)); |
| 123 } |
| 124 for (MediaStreamComponentVector::const_iterator iter = videoComponents.b
egin(); iter != videoComponents.end(); ++iter) { |
| 125 (*iter)->setStream(this); |
| 126 m_videoComponents.append((*iter)); |
| 127 } |
| 128 } |
| 129 |
| 108 MediaStreamDescriptorClient* m_client; | 130 MediaStreamDescriptorClient* m_client; |
| 109 String m_id; | 131 String m_id; |
| 110 Vector<RefPtr<MediaStreamComponent> > m_audioComponents; | 132 Vector<RefPtr<MediaStreamComponent> > m_audioComponents; |
| 111 Vector<RefPtr<MediaStreamComponent> > m_videoComponents; | 133 Vector<RefPtr<MediaStreamComponent> > m_videoComponents; |
| 112 bool m_ended; | 134 bool m_ended; |
| 113 | 135 |
| 114 RefPtr<ExtraData> m_extraData; | 136 RefPtr<ExtraData> m_extraData; |
| 115 }; | 137 }; |
| 116 | 138 |
| 117 typedef Vector<RefPtr<MediaStreamDescriptor> > MediaStreamDescriptorVector; | 139 typedef Vector<RefPtr<MediaStreamDescriptor> > MediaStreamDescriptorVector; |
| 118 | 140 |
| 119 } // namespace WebCore | 141 } // namespace WebCore |
| 120 | 142 |
| 121 #endif // ENABLE(MEDIA_STREAM) | 143 #endif // ENABLE(MEDIA_STREAM) |
| 122 | 144 |
| 123 #endif // MediaStreamDescriptor_h | 145 #endif // MediaStreamDescriptor_h |
| OLD | NEW |