OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/blink/webmediasource_impl.h" | 5 #include "media/blink/webmediasource_impl.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
8 #include "media/base/mime_util.h" | 8 #include "media/base/mime_util.h" |
9 #include "media/blink/websourcebuffer_impl.h" | 9 #include "media/blink/websourcebuffer_impl.h" |
10 #include "media/filters/chunk_demuxer.h" | 10 #include "media/filters/chunk_demuxer.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 WebMediaSourceImpl::~WebMediaSourceImpl() {} | 33 WebMediaSourceImpl::~WebMediaSourceImpl() {} |
34 | 34 |
35 WebMediaSource::AddStatus WebMediaSourceImpl::addSourceBuffer( | 35 WebMediaSource::AddStatus WebMediaSourceImpl::addSourceBuffer( |
36 const blink::WebString& type, | 36 const blink::WebString& type, |
37 const blink::WebString& codecs, | 37 const blink::WebString& codecs, |
38 blink::WebSourceBuffer** source_buffer) { | 38 blink::WebSourceBuffer** source_buffer) { |
39 std::string id = base::GenerateGUID(); | 39 std::string id = base::GenerateGUID(); |
40 | 40 |
41 std::vector<std::string> parsed_codec_ids; | 41 WebMediaSource::AddStatus result = static_cast<WebMediaSource::AddStatus>( |
42 media::ParseCodecString(codecs.utf8().data(), &parsed_codec_ids, false); | 42 demuxer_->AddId(id, type.utf8().data(), codecs.utf8().data())); |
43 | |
44 WebMediaSource::AddStatus result = | |
45 static_cast<WebMediaSource::AddStatus>( | |
46 demuxer_->AddId(id, type.utf8().data(), parsed_codec_ids)); | |
47 | 43 |
48 if (result == WebMediaSource::AddStatusOk) | 44 if (result == WebMediaSource::AddStatusOk) |
49 *source_buffer = new WebSourceBufferImpl(id, demuxer_); | 45 *source_buffer = new WebSourceBufferImpl(id, demuxer_); |
50 | 46 |
51 return result; | 47 return result; |
52 } | 48 } |
53 | 49 |
54 double WebMediaSourceImpl::duration() { | 50 double WebMediaSourceImpl::duration() { |
55 return demuxer_->GetDuration(); | 51 return demuxer_->GetDuration(); |
56 } | 52 } |
(...skipping 19 matching lines...) Expand all Loading... |
76 } | 72 } |
77 | 73 |
78 demuxer_->MarkEndOfStream(pipeline_status); | 74 demuxer_->MarkEndOfStream(pipeline_status); |
79 } | 75 } |
80 | 76 |
81 void WebMediaSourceImpl::unmarkEndOfStream() { | 77 void WebMediaSourceImpl::unmarkEndOfStream() { |
82 demuxer_->UnmarkEndOfStream(); | 78 demuxer_->UnmarkEndOfStream(); |
83 } | 79 } |
84 | 80 |
85 } // namespace media | 81 } // namespace media |
OLD | NEW |