Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chromecast / media / cma / base / decoder_buffer_base.h
blob08cf94b0e888eeb0df14920b3b6eee0b3efd7732
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"
14 namespace chromecast {
15 namespace media {
16 class CastDecryptConfig;
18 // DecoderBufferBase exposes only the properties of an audio/video buffer.
19 // The way a DecoderBufferBase is created and organized in memory
20 // is left as a detail of the implementation of derived classes.
21 class DecoderBufferBase
22 : public base::RefCountedThreadSafe<DecoderBufferBase> {
23 public:
24 DecoderBufferBase() {}
26 // Returns the stream id of this decoder buffer belonging to. it's optional
27 // and default value is kPrimary.
28 virtual StreamId stream_id() const = 0;
30 // Returns the PTS of the frame.
31 virtual base::TimeDelta timestamp() const = 0;
33 // Sets the PTS of the frame.
34 virtual void set_timestamp(base::TimeDelta timestamp) = 0;
36 // Gets the frame data.
37 virtual const uint8* data() const = 0;
38 virtual uint8* writable_data() const = 0;
40 // Returns the size of the frame in bytes.
41 virtual size_t data_size() const = 0;
43 // Returns the decrypt configuration.
44 // Returns NULL if the buffer has no decrypt info.
45 virtual const CastDecryptConfig* decrypt_config() const = 0;
47 // Indicate if this is a special frame that indicates the end of the stream.
48 // If true, functions to access the frame content cannot be called.
49 virtual bool end_of_stream() const = 0;
51 protected:
52 friend class base::RefCountedThreadSafe<DecoderBufferBase>;
53 virtual ~DecoderBufferBase() {}
55 private:
56 DISALLOW_COPY_AND_ASSIGN(DecoderBufferBase);
59 } // namespace media
60 } // namespace chromecast
62 #endif // CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_BASE_H_