[MediaRouter] Update MR-2-Extension's PostMessage to return boolean.
[chromium-blink-merge.git] / chromecast / media / cma / base / decoder_buffer_adapter.h
blob7c48ec8a40b7a1d10f0706b7ba66c21cbe8bac13
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"
12 namespace media {
13 class DecoderBuffer;
16 namespace chromecast {
17 namespace media {
19 // DecoderBufferAdapter wraps a ::media::DecoderBuffer
20 // into a DecoderBufferBase.
21 class DecoderBufferAdapter : public DecoderBufferBase {
22 public:
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);
27 DecoderBufferAdapter(
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;
40 private:
41 ~DecoderBufferAdapter() override;
43 StreamId stream_id_;
44 scoped_refptr<::media::DecoderBuffer> const buffer_;
46 DISALLOW_COPY_AND_ASSIGN(DecoderBufferAdapter);
49 } // namespace media
50 } // namespace chromecast
52 #endif // CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_ADAPTER_H_