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 "base/memory/scoped_ptr.h"
11 #include "chromecast/media/cma/base/decoder_buffer_base.h"
17 namespace chromecast
{
20 // DecoderBufferAdapter wraps a ::media::DecoderBuffer
21 // into a DecoderBufferBase.
22 class DecoderBufferAdapter
: public DecoderBufferBase
{
24 // Using explicit constructor without providing stream Id will set it to
25 // kPrimary by default.
26 explicit DecoderBufferAdapter(
27 const scoped_refptr
<::media::DecoderBuffer
>& buffer
);
29 StreamId stream_id
, const scoped_refptr
<::media::DecoderBuffer
>& buffer
);
31 // DecoderBufferBase implementation.
32 StreamId
stream_id() const override
;
33 base::TimeDelta
timestamp() const override
;
34 void set_timestamp(base::TimeDelta timestamp
) override
;
35 const uint8
* data() const override
;
36 uint8
* writable_data() const override
;
37 size_t data_size() const override
;
38 const CastDecryptConfig
* decrypt_config() const override
;
39 bool end_of_stream() const override
;
42 ~DecoderBufferAdapter() override
;
45 scoped_refptr
<::media::DecoderBuffer
> const buffer_
;
46 mutable scoped_ptr
<CastDecryptConfig
> decrypt_config_
;
48 DISALLOW_COPY_AND_ASSIGN(DecoderBufferAdapter
);
52 } // namespace chromecast
54 #endif // CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_ADAPTER_H_