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