Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: media/blink/webmediasource_impl.cc

Issue 1281663003: Media: Introduce addSourceBuffer which takes an unparsed codecs string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: buildfix Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/blink/webmediasource_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/blink/websourcebuffer_impl.h" 9 #include "media/blink/websourcebuffer_impl.h"
9 #include "media/filters/chunk_demuxer.h" 10 #include "media/filters/chunk_demuxer.h"
10 #include "third_party/WebKit/public/platform/WebCString.h" 11 #include "third_party/WebKit/public/platform/WebCString.h"
11 #include "third_party/WebKit/public/platform/WebString.h" 12 #include "third_party/WebKit/public/platform/WebString.h"
12 13
13 using ::blink::WebString; 14 using ::blink::WebString;
14 using ::blink::WebMediaSource; 15 using ::blink::WebMediaSource;
15 16
16 namespace media { 17 namespace media {
17 18
(...skipping 26 matching lines...) Expand all
44 WebMediaSource::AddStatus result = 45 WebMediaSource::AddStatus result =
45 static_cast<WebMediaSource::AddStatus>( 46 static_cast<WebMediaSource::AddStatus>(
46 demuxer_->AddId(id, type.utf8().data(), new_codecs)); 47 demuxer_->AddId(id, type.utf8().data(), new_codecs));
47 48
48 if (result == WebMediaSource::AddStatusOk) 49 if (result == WebMediaSource::AddStatusOk)
49 *source_buffer = new WebSourceBufferImpl(id, demuxer_); 50 *source_buffer = new WebSourceBufferImpl(id, demuxer_);
50 51
51 return result; 52 return result;
52 } 53 }
53 54
55 WebMediaSource::AddStatus WebMediaSourceImpl::addSourceBuffer(
56 const blink::WebString& type,
57 const blink::WebString& codecs,
58 blink::WebSourceBuffer** source_buffer) {
59 std::string id = base::GenerateGUID();
60
61 std::vector<std::string> parsed_codec_ids;
62 media::ParseCodecString(codecs.utf8().data(), &parsed_codec_ids, false);
63
64 WebMediaSource::AddStatus result =
65 static_cast<WebMediaSource::AddStatus>(
66 demuxer_->AddId(id, type.utf8().data(), parsed_codec_ids));
67
68 if (result == WebMediaSource::AddStatusOk)
69 *source_buffer = new WebSourceBufferImpl(id, demuxer_);
70
71 return result;
72 }
73
54 double WebMediaSourceImpl::duration() { 74 double WebMediaSourceImpl::duration() {
55 return demuxer_->GetDuration(); 75 return demuxer_->GetDuration();
56 } 76 }
57 77
58 void WebMediaSourceImpl::setDuration(double new_duration) { 78 void WebMediaSourceImpl::setDuration(double new_duration) {
59 DCHECK_GE(new_duration, 0); 79 DCHECK_GE(new_duration, 0);
60 demuxer_->SetDuration(new_duration); 80 demuxer_->SetDuration(new_duration);
61 } 81 }
62 82
63 void WebMediaSourceImpl::markEndOfStream( 83 void WebMediaSourceImpl::markEndOfStream(
(...skipping 12 matching lines...) Expand all
76 } 96 }
77 97
78 demuxer_->MarkEndOfStream(pipeline_status); 98 demuxer_->MarkEndOfStream(pipeline_status);
79 } 99 }
80 100
81 void WebMediaSourceImpl::unmarkEndOfStream() { 101 void WebMediaSourceImpl::unmarkEndOfStream() {
82 demuxer_->UnmarkEndOfStream(); 102 demuxer_->UnmarkEndOfStream();
83 } 103 }
84 104
85 } // namespace media 105 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediasource_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698