1 // Copyright 2015 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_CAST_DECODER_BUFFER_IMPL_H_
6 #define CHROMECAST_MEDIA_CMA_BASE_CAST_DECODER_BUFFER_IMPL_H_
8 #include "chromecast/public/media/cast_decoder_buffer.h"
9 #include "chromecast/media/cma/base/decoder_buffer_base.h"
11 namespace chromecast
{
14 // Implementation of public DecoderBuffer interface.
15 // Holds a (refcounted) DecoderBufferBase. This way, ownership throughout
16 // the pipeline is refcounted, but without exposing RefCountedBase in
18 class CastDecoderBufferImpl
: public CastDecoderBuffer
{
20 CastDecoderBufferImpl(const scoped_refptr
<DecoderBufferBase
>& buffer
);
21 ~CastDecoderBufferImpl() override
;
23 // Returns the stream id of this decoder buffer belonging to. it's optional
24 // and default value is kPrimary.
25 StreamId
stream_id() const override
;
27 // Returns the PTS of the frame in microseconds.
28 int64_t timestamp() const override
;
30 // Gets the frame data.
31 const uint8
* data() const override
;
33 // Returns the size of the frame in bytes.
34 size_t data_size() const override
;
36 // Returns the decrypt configuration.
37 // Returns NULL if the buffer has no decrypt info.
38 const CastDecryptConfig
* decrypt_config() const override
;
40 // Indicate if this is a special frame that indicates the end of the stream.
41 // If true, functions to access the frame content cannot be called.
42 bool end_of_stream() const override
;
44 const scoped_refptr
<DecoderBufferBase
>& buffer() const;
47 scoped_refptr
<DecoderBufferBase
> buffer_
;
51 } // namespace chromecast
53 #endif // CHROMECAST_MEDIA_CMA_BASE_CAST_DECODER_BUFFER_BASE_H_