| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_BASE_H_ | |
| 6 #define CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_BASE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/time/time.h" | |
| 12 #include "chromecast/public/media/cast_decoder_buffer.h" | |
| 13 #include "chromecast/public/media/decrypt_context.h" | |
| 14 | |
| 15 namespace media { | |
| 16 class DecoderBuffer; | |
| 17 } | |
| 18 | |
| 19 namespace chromecast { | |
| 20 namespace media { | |
| 21 | |
| 22 // DecoderBufferBase exposes only the properties of an audio/video buffer. | |
| 23 // The way a DecoderBufferBase is created and organized in memory | |
| 24 // is left as a detail of the implementation of derived classes. | |
| 25 class DecoderBufferBase : public CastDecoderBuffer, | |
| 26 public base::RefCountedThreadSafe<DecoderBufferBase> { | |
| 27 public: | |
| 28 // Partial CastDecoderBuffer implementation: | |
| 29 DecryptContext* decrypt_context() const override; | |
| 30 | |
| 31 void set_decrypt_context(scoped_ptr<DecryptContext> context) { | |
| 32 decrypt_context_ = context.Pass(); | |
| 33 } | |
| 34 | |
| 35 // Sets the PTS of the frame. | |
| 36 virtual void set_timestamp(base::TimeDelta timestamp) = 0; | |
| 37 | |
| 38 // Gets a pointer to the frame data buffer. | |
| 39 virtual uint8_t* writable_data() const = 0; | |
| 40 | |
| 41 virtual scoped_refptr<::media::DecoderBuffer> ToMediaBuffer() const = 0; | |
| 42 | |
| 43 protected: | |
| 44 friend class base::RefCountedThreadSafe<DecoderBufferBase>; | |
| 45 | |
| 46 DecoderBufferBase(); | |
| 47 ~DecoderBufferBase() override; | |
| 48 | |
| 49 private: | |
| 50 scoped_ptr<DecryptContext> decrypt_context_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(DecoderBufferBase); | |
| 53 }; | |
| 54 | |
| 55 inline DecoderBufferBase::DecoderBufferBase() { | |
| 56 } | |
| 57 | |
| 58 inline DecoderBufferBase::~DecoderBufferBase() { | |
| 59 } | |
| 60 | |
| 61 inline DecryptContext* DecoderBufferBase::decrypt_context() const { | |
| 62 return decrypt_context_.get(); | |
| 63 } | |
| 64 | |
| 65 } // namespace media | |
| 66 } // namespace chromecast | |
| 67 | |
| 68 #endif // CHROMECAST_MEDIA_CMA_BASE_DECODER_BUFFER_BASE_H_ | |
| OLD | NEW |