| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 MEDIA_BASE_DECODER_BUFFER_H_ | 5 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ |
| 6 #define MEDIA_BASE_DECODER_BUFFER_H_ | 6 #define MEDIA_BASE_DECODER_BUFFER_H_ |
| 7 | 7 |
| 8 #include "base/memory/aligned_memory.h" | 8 #include "base/memory/aligned_memory.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 const uint8* GetData() const; | 56 const uint8* GetData() const; |
| 57 uint8* GetWritableData() const; | 57 uint8* GetWritableData() const; |
| 58 | 58 |
| 59 int GetDataSize() const; | 59 int GetDataSize() const; |
| 60 | 60 |
| 61 const DecryptConfig* GetDecryptConfig() const; | 61 const DecryptConfig* GetDecryptConfig() const; |
| 62 void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); | 62 void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); |
| 63 | 63 |
| 64 // If there's no data in this buffer, it represents end of stream. | 64 // If there's no data in this buffer, it represents end of stream. |
| 65 // | |
| 66 // TODO(scherkus): Change to be an actual settable flag as opposed to being | |
| 67 // based on the value of |data_|, see http://crbug.com/169133 | |
| 68 bool IsEndOfStream() const; | 65 bool IsEndOfStream() const; |
| 69 | 66 |
| 70 protected: | 67 protected: |
| 71 friend class base::RefCountedThreadSafe<DecoderBuffer>; | 68 friend class base::RefCountedThreadSafe<DecoderBuffer>; |
| 72 | 69 |
| 73 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer | 70 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer |
| 74 // will be padded and aligned as necessary. If |data| is NULL then |data_| is | 71 // will be padded and aligned as necessary. If |data| is NULL then |data_| is |
| 75 // set to NULL and |buffer_size_| to 0. | 72 // set to NULL and |buffer_size_| to 0. |
| 76 DecoderBuffer(const uint8* data, int size); | 73 DecoderBuffer(const uint8* data, int size); |
| 77 virtual ~DecoderBuffer(); | 74 virtual ~DecoderBuffer(); |
| 78 | 75 |
| 79 private: | 76 private: |
| 80 base::TimeDelta timestamp_; | 77 base::TimeDelta timestamp_; |
| 81 base::TimeDelta duration_; | 78 base::TimeDelta duration_; |
| 82 | 79 |
| 83 int buffer_size_; | 80 int buffer_size_; |
| 84 scoped_ptr<uint8, base::ScopedPtrAlignedFree> data_; | 81 scoped_ptr<uint8, base::ScopedPtrAlignedFree> data_; |
| 85 scoped_ptr<DecryptConfig> decrypt_config_; | 82 scoped_ptr<DecryptConfig> decrypt_config_; |
| 86 | 83 |
| 87 // Constructor helper method for memory allocations. | 84 // Constructor helper method for memory allocations. |
| 88 void Initialize(); | 85 void Initialize(); |
| 89 | 86 |
| 90 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); | 87 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); |
| 91 }; | 88 }; |
| 92 | 89 |
| 93 } // namespace media | 90 } // namespace media |
| 94 | 91 |
| 95 #endif // MEDIA_BASE_DECODER_BUFFER_H_ | 92 #endif // MEDIA_BASE_DECODER_BUFFER_H_ |
| OLD | NEW |