| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 if (!data) | 87 if (!data) |
| 88 return 0; | 88 return 0; |
| 89 return static_cast<ExtraDataContainer*>(data.get())->extraData(); | 89 return static_cast<ExtraDataContainer*>(data.get())->extraData(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void WebMediaStream::setExtraData(ExtraData* extraData) | 92 void WebMediaStream::setExtraData(ExtraData* extraData) |
| 93 { | 93 { |
| 94 m_private->setExtraData(adoptRef(new ExtraDataContainer(extraData))); | 94 m_private->setExtraData(adoptRef(new ExtraDataContainer(extraData))); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void WebMediaStream::audioSources(WebVector<WebMediaStreamTrack>& webSources) co
nst | 97 void WebMediaStream::audioTracks(WebVector<WebMediaStreamTrack>& webTracks) cons
t |
| 98 { | 98 { |
| 99 size_t numberOfSources = m_private->numberOfAudioComponents(); | 99 size_t numberOfTracks = m_private->numberOfAudioComponents(); |
| 100 WebVector<WebMediaStreamTrack> result(numberOfSources); | 100 WebVector<WebMediaStreamTrack> result(numberOfTracks); |
| 101 for (size_t i = 0; i < numberOfSources; ++i) | 101 for (size_t i = 0; i < numberOfTracks; ++i) |
| 102 result[i] = m_private->audioComponent(i); | 102 result[i] = m_private->audioComponent(i); |
| 103 webSources.swap(result); | 103 webTracks.swap(result); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void WebMediaStream::videoSources(WebVector<WebMediaStreamTrack>& webSources) co
nst | 106 void WebMediaStream::videoTracks(WebVector<WebMediaStreamTrack>& webTracks) cons
t |
| 107 { | 107 { |
| 108 size_t numberOfSources = m_private->numberOfVideoComponents(); | 108 size_t numberOfTracks = m_private->numberOfVideoComponents(); |
| 109 WebVector<WebMediaStreamTrack> result(numberOfSources); | 109 WebVector<WebMediaStreamTrack> result(numberOfTracks); |
| 110 for (size_t i = 0; i < numberOfSources; ++i) | 110 for (size_t i = 0; i < numberOfTracks; ++i) |
| 111 result[i] = m_private->videoComponent(i); | 111 result[i] = m_private->videoComponent(i); |
| 112 webSources.swap(result); | 112 webTracks.swap(result); |
| 113 } | 113 } |
| 114 | 114 |
| 115 WebMediaStream& WebMediaStream::operator=(const PassRefPtr<WebCore::MediaStreamD
escriptor>& mediaStreamDescriptor) | 115 WebMediaStream& WebMediaStream::operator=(const PassRefPtr<WebCore::MediaStreamD
escriptor>& mediaStreamDescriptor) |
| 116 { | 116 { |
| 117 m_private = mediaStreamDescriptor; | 117 m_private = mediaStreamDescriptor; |
| 118 return *this; | 118 return *this; |
| 119 } | 119 } |
| 120 | 120 |
| 121 WebMediaStream::operator PassRefPtr<WebCore::MediaStreamDescriptor>() const | 121 WebMediaStream::operator PassRefPtr<WebCore::MediaStreamDescriptor>() const |
| 122 { | 122 { |
| 123 return m_private.get(); | 123 return m_private.get(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 WebMediaStream::operator WebCore::MediaStreamDescriptor*() const | 126 WebMediaStream::operator WebCore::MediaStreamDescriptor*() const |
| 127 { | 127 { |
| 128 return m_private.get(); | 128 return m_private.get(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void WebMediaStream::initialize(const WebString& label, const WebVector<WebMedia
StreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources
) | 131 void WebMediaStream::initialize(const WebString& label, const WebVector<WebMedia
StreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources
) |
| 132 { | 132 { |
| 133 MediaStreamSourceVector audio, video; | 133 MediaStreamComponentVector audio, video; |
| 134 for (size_t i = 0; i < audioSources.size(); ++i) { | 134 for (size_t i = 0; i < audioSources.size(); ++i) { |
| 135 MediaStreamSource* curr = audioSources[i]; | 135 MediaStreamSource* source = audioSources[i]; |
| 136 audio.append(curr); | 136 audio.append(MediaStreamComponent::create(source->id(), source)); |
| 137 } | 137 } |
| 138 for (size_t i = 0; i < videoSources.size(); ++i) { | 138 for (size_t i = 0; i < videoSources.size(); ++i) { |
| 139 MediaStreamSource* curr = videoSources[i]; | 139 MediaStreamSource* source = videoSources[i]; |
| 140 video.append(curr); | 140 video.append(MediaStreamComponent::create(source->id(), source)); |
| 141 } |
| 142 m_private = MediaStreamDescriptor::create(label, audio, video); |
| 143 } |
| 144 |
| 145 void WebMediaStream::initialize(const WebString& label, const WebVector<WebMedia
StreamTrack>& audioTracks, const WebVector<WebMediaStreamTrack>& videoTracks) |
| 146 { |
| 147 MediaStreamComponentVector audio, video; |
| 148 for (size_t i = 0; i < audioTracks.size(); ++i) { |
| 149 MediaStreamComponent* component = audioTracks[i]; |
| 150 audio.append(component); |
| 151 } |
| 152 for (size_t i = 0; i < videoTracks.size(); ++i) { |
| 153 MediaStreamComponent* component = videoTracks[i]; |
| 154 video.append(component); |
| 141 } | 155 } |
| 142 m_private = MediaStreamDescriptor::create(label, audio, video); | 156 m_private = MediaStreamDescriptor::create(label, audio, video); |
| 143 } | 157 } |
| 144 | 158 |
| 145 void WebMediaStream::assign(const WebMediaStream& other) | 159 void WebMediaStream::assign(const WebMediaStream& other) |
| 146 { | 160 { |
| 147 m_private = other.m_private; | 161 m_private = other.m_private; |
| 148 } | 162 } |
| 149 | 163 |
| 150 } // namespace WebKit | 164 } // namespace WebKit |
| 151 | 165 |
| 152 #endif // ENABLE(MEDIA_STREAM) | 166 #endif // ENABLE(MEDIA_STREAM) |
| OLD | NEW |