Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/aligned_memory.h" | 10 #include "base/memory/aligned_memory.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 void SetTimestamp(const base::TimeDelta& timestamp); | 57 void SetTimestamp(const base::TimeDelta& timestamp); |
| 58 | 58 |
| 59 base::TimeDelta GetDuration() const; | 59 base::TimeDelta GetDuration() const; |
| 60 void SetDuration(const base::TimeDelta& duration); | 60 void SetDuration(const base::TimeDelta& duration); |
| 61 | 61 |
| 62 const uint8* GetData() const; | 62 const uint8* GetData() const; |
| 63 uint8* GetWritableData() const; | 63 uint8* GetWritableData() const; |
| 64 | 64 |
| 65 int GetDataSize() const; | 65 int GetDataSize() const; |
| 66 | 66 |
| 67 const uint8* GetSideData() const; | |
| 68 int GetSideDataSize() const; | |
| 69 | |
| 67 const DecryptConfig* GetDecryptConfig() const; | 70 const DecryptConfig* GetDecryptConfig() const; |
| 68 void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); | 71 void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); |
| 69 | 72 |
| 70 // If there's no data in this buffer, it represents end of stream. | 73 // If there's no data in this buffer, it represents end of stream. |
| 71 bool IsEndOfStream() const; | 74 bool IsEndOfStream() const; |
| 72 | 75 |
| 73 // Returns a human-readable string describing |*this|. | 76 // Returns a human-readable string describing |*this|. |
| 74 std::string AsHumanReadableString(); | 77 std::string AsHumanReadableString(); |
| 75 | 78 |
| 79 // Allocate memory and copy side data. Padded and aligned as necessary | |
| 80 virtual void SetSideData(const uint8* data, int size); | |
|
scherkus (not reviewing)
2013/02/22 23:18:01
I've been trying to move away from these data sett
vignesh
2013/02/25 21:51:42
Done.
| |
| 81 | |
| 76 protected: | 82 protected: |
| 77 friend class base::RefCountedThreadSafe<DecoderBuffer>; | 83 friend class base::RefCountedThreadSafe<DecoderBuffer>; |
| 78 | 84 |
| 79 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer | 85 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer |
| 80 // will be padded and aligned as necessary. If |data| is NULL then |data_| is | 86 // will be padded and aligned as necessary. If |data| is NULL then |data_| is |
| 81 // set to NULL and |buffer_size_| to 0. | 87 // set to NULL and |buffer_size_| to 0. |
| 82 DecoderBuffer(const uint8* data, int size); | 88 DecoderBuffer(const uint8* data, int size); |
| 83 virtual ~DecoderBuffer(); | 89 virtual ~DecoderBuffer(); |
| 84 | 90 |
| 85 private: | 91 private: |
| 86 base::TimeDelta timestamp_; | 92 base::TimeDelta timestamp_; |
| 87 base::TimeDelta duration_; | 93 base::TimeDelta duration_; |
| 88 | 94 |
| 89 int size_; | 95 int size_; |
| 90 scoped_ptr<uint8, base::ScopedPtrAlignedFree> data_; | 96 scoped_ptr<uint8, base::ScopedPtrAlignedFree> data_; |
| 97 int side_data_size_; | |
| 98 scoped_ptr<uint8, base::ScopedPtrAlignedFree> side_data_; | |
| 91 scoped_ptr<DecryptConfig> decrypt_config_; | 99 scoped_ptr<DecryptConfig> decrypt_config_; |
| 92 | 100 |
| 93 // Constructor helper method for memory allocations. | 101 // Constructor helper method for memory allocations. |
| 94 void Initialize(); | 102 void Initialize(); |
| 95 | 103 |
| 96 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); | 104 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); |
| 97 }; | 105 }; |
| 98 | 106 |
| 99 } // namespace media | 107 } // namespace media |
| 100 | 108 |
| 101 #endif // MEDIA_BASE_DECODER_BUFFER_H_ | 109 #endif // MEDIA_BASE_DECODER_BUFFER_H_ |
| OLD | NEW |