Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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 // A specialized buffer for interfacing with audio / video decoders. | |
| 6 // | |
| 7 // Specifically ensures that data is aligned and padded as necessary by the | |
| 8 // underlying decoding framework. On desktop platforms this means memory is | |
| 9 // allocated using FFmpeg with particular alignment and padding requirements. | |
| 10 // | |
| 11 // Also includes decoder specific functionality for decryption. | |
| 12 | |
| 13 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ | |
| 14 #define MEDIA_BASE_DECODER_BUFFER_H_ | |
| 15 | |
| 16 #include "base/memory/scoped_ptr.h" | |
| 17 #include "media/base/buffers.h" | |
| 18 #include "media/base/decrypt_config.h" | |
| 19 | |
| 20 namespace media { | |
| 21 | |
| 22 class MEDIA_EXPORT DecoderBuffer : public Buffer { | |
| 23 public: | |
| 24 // Allocates buffer of size |buffer_size| >= 0. Buffer will be padded and | |
| 25 // aligned as necessary. | |
| 26 explicit DecoderBuffer(int buffer_size); | |
|
scherkus (not reviewing)
2012/05/30 02:48:42
while doing a final review pass it appears that th
DaleCurtis
2012/05/30 03:20:11
We should keep this constructor since it's impossi
DaleCurtis
2012/05/30 03:50:52
Also, Ronald has a use case for this constructor c
scherkus (not reviewing)
2012/05/30 04:32:27
Gah I think you're reading too much into my sideba
| |
| 27 | |
| 28 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be | |
| 29 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0. | |
| 30 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size); | |
| 31 | |
| 32 // Create a DecoderBuffer indicating we've reached end of stream. GetData() | |
| 33 // and GetWritableData() will return NULL and GetDataSize() will return 0. | |
| 34 static scoped_refptr<DecoderBuffer> CreateEOSBuffer(); | |
| 35 | |
| 36 // Buffer implementation. | |
| 37 virtual const uint8* GetData() const OVERRIDE; | |
| 38 virtual int GetDataSize() const OVERRIDE; | |
| 39 | |
| 40 // Returns a read-write pointer to the buffer data. | |
| 41 virtual uint8* GetWritableData(); | |
| 42 | |
| 43 virtual const DecryptConfig* GetDecryptConfig() const; | |
| 44 virtual void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); | |
| 45 | |
| 46 protected: | |
| 47 DecoderBuffer(const uint8* data, int size); | |
| 48 virtual ~DecoderBuffer(); | |
| 49 | |
| 50 private: | |
| 51 int buffer_size_; | |
| 52 uint8* data_; | |
| 53 scoped_ptr<DecryptConfig> decrypt_config_; | |
| 54 | |
| 55 // Constructor helper method for memory allocations. | |
| 56 void Initialize(); | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); | |
| 59 }; | |
| 60 | |
| 61 } // namespace media | |
| 62 | |
| 63 #endif // MEDIA_BASE_DECODER_BUFFER_H_ | |
| OLD | NEW |