Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chromecast / media / cma / base / decoder_buffer_adapter.h
blob51186944109dbed077eb993cfd900895e9836be7
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"
13 namespace media {
14 class DecoderBuffer;
17 namespace chromecast {
18 namespace media {
20 // DecoderBufferAdapter wraps a ::media::DecoderBuffer
21 // into a DecoderBufferBase.
22 class DecoderBufferAdapter : public DecoderBufferBase {
23 public:
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);
28 DecoderBufferAdapter(
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;
41 private:
42 ~DecoderBufferAdapter() override;
44 StreamId stream_id_;
45 scoped_refptr<::media::DecoderBuffer> const buffer_;
46 mutable scoped_ptr<CastDecryptConfig> decrypt_config_;
48 DISALLOW_COPY_AND_ASSIGN(DecoderBufferAdapter);
51 } // namespace media
52 } // namespace chromecast
54 #endif // CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_ADAPTER_H_