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 #ifndef CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_ADAPTER_H_
6 #define CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_ADAPTER_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "chromecast/media/cma/base/decoder_buffer_base.h"
16 namespace chromecast
{
19 // DecoderBufferAdapter wraps a ::media::DecoderBuffer
20 // into a DecoderBufferBase.
21 class DecoderBufferAdapter
: public DecoderBufferBase
{
23 // Using explicit constructor without providing stream Id will set it to
24 // kPrimary by default.
25 explicit DecoderBufferAdapter(
26 const scoped_refptr
<::media::DecoderBuffer
>& buffer
);
28 StreamId stream_id
, const scoped_refptr
<::media::DecoderBuffer
>& buffer
);
30 // DecoderBufferBase implementation.
31 StreamId
stream_id() const override
;
32 base::TimeDelta
timestamp() const override
;
33 void set_timestamp(const base::TimeDelta
& timestamp
) override
;
34 const uint8
* data() const override
;
35 uint8
* writable_data() const override
;
36 size_t data_size() const override
;
37 const ::media::DecryptConfig
* decrypt_config() const override
;
38 bool end_of_stream() const override
;
41 ~DecoderBufferAdapter() override
;
44 scoped_refptr
<::media::DecoderBuffer
> const buffer_
;
46 DISALLOW_COPY_AND_ASSIGN(DecoderBufferAdapter
);
50 } // namespace chromecast
52 #endif // CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_ADAPTER_H_