Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chromecast / media / cma / base / decoder_buffer_adapter.cc
blob10ffddcce061f66a7aa53c8ba83da3d2755a0e22
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromecast/media/cma/base/decoder_buffer_adapter.h"
7 #include "chromecast/media/cma/base/cast_decrypt_config_impl.h"
8 #include "chromecast/public/media/cast_decrypt_config.h"
9 #include "media/base/decoder_buffer.h"
11 namespace chromecast {
12 namespace media {
14 DecoderBufferAdapter::DecoderBufferAdapter(
15 const scoped_refptr<::media::DecoderBuffer>& buffer)
16 : DecoderBufferAdapter(kPrimary, buffer) {
19 DecoderBufferAdapter::DecoderBufferAdapter(
20 StreamId stream_id, const scoped_refptr<::media::DecoderBuffer>& buffer)
21 : stream_id_(stream_id),
22 buffer_(buffer) {
25 DecoderBufferAdapter::~DecoderBufferAdapter() {
28 StreamId DecoderBufferAdapter::stream_id() const {
29 return stream_id_;
32 base::TimeDelta DecoderBufferAdapter::timestamp() const {
33 return buffer_->timestamp();
36 void DecoderBufferAdapter::set_timestamp(base::TimeDelta timestamp) {
37 buffer_->set_timestamp(timestamp);
40 const uint8* DecoderBufferAdapter::data() const {
41 return buffer_->data();
44 uint8* DecoderBufferAdapter::writable_data() const {
45 return buffer_->writable_data();
48 size_t DecoderBufferAdapter::data_size() const {
49 return buffer_->data_size();
52 const CastDecryptConfig* DecoderBufferAdapter::decrypt_config() const {
53 if (buffer_->decrypt_config() && !decrypt_config_) {
54 const ::media::DecryptConfig* config = buffer_->decrypt_config();
55 decrypt_config_.reset(new CastDecryptConfigImpl(*config));
58 return decrypt_config_.get();
61 bool DecoderBufferAdapter::end_of_stream() const {
62 return buffer_->end_of_stream();
65 } // namespace media
66 } // namespace chromecast