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_BASE_H_
6 #define CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_BASE_H_
8 #include "base/basictypes.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/time/time.h"
12 #include "chromecast/public/media/stream_id.h"
18 namespace chromecast
{
21 // DecoderBufferBase exposes only the properties of an audio/video buffer.
22 // The way a DecoderBufferBase is created and organized in memory
23 // is left as a detail of the implementation of derived classes.
24 class DecoderBufferBase
25 : public base::RefCountedThreadSafe
<DecoderBufferBase
> {
29 // Returns the stream id of this decoder buffer belonging to. it's optional
30 // and default value is kPrimary.
31 virtual StreamId
stream_id() const = 0;
33 // Returns the PTS of the frame.
34 virtual base::TimeDelta
timestamp() const = 0;
36 // Sets the PTS of the frame.
37 virtual void set_timestamp(const base::TimeDelta
& timestamp
) = 0;
39 // Gets the frame data.
40 virtual const uint8
* data() const = 0;
41 virtual uint8
* writable_data() const = 0;
43 // Returns the size of the frame in bytes.
44 virtual size_t data_size() const = 0;
46 // Returns the decrypt configuration.
47 // Returns NULL if the buffer has no decrypt info.
48 virtual const ::media::DecryptConfig
* decrypt_config() const = 0;
50 // Indicate if this is a special frame that indicates the end of the stream.
51 // If true, functions to access the frame content cannot be called.
52 virtual bool end_of_stream() const = 0;
55 friend class base::RefCountedThreadSafe
<DecoderBufferBase
>;
56 virtual ~DecoderBufferBase();
59 DISALLOW_COPY_AND_ASSIGN(DecoderBufferBase
);
63 } // namespace chromecast
65 #endif // CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_BASE_H_