Index: media/base/decoder_buffer.h |
diff --git a/media/base/decoder_buffer.h b/media/base/decoder_buffer.h |
index 22c0544b31980580dd6e8d29c1608bb56ae44fdb..6cf519f4c1d6205e8acae941754a4248710aa52f 100644 |
--- a/media/base/decoder_buffer.h |
+++ b/media/base/decoder_buffer.h |
@@ -7,17 +7,17 @@ |
#include <string> |
+#include "base/logging.h" |
#include "base/memory/aligned_memory.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/time/time.h" |
#include "build/build_config.h" |
+#include "media/base/decrypt_config.h" |
#include "media/base/media_export.h" |
namespace media { |
-class DecryptConfig; |
- |
// A specialized buffer for interfacing with audio / video decoders. |
// |
// Specifically ensures that data is aligned and padded as necessary by the |
@@ -26,7 +26,7 @@ class DecryptConfig; |
// |
// Also includes decoder specific functionality for decryption. |
// |
-// NOTE: It is illegal to call any method when IsEndOfStream() is true. |
+// NOTE: It is illegal to call any method when end_of_stream() is true. |
class MEDIA_EXPORT DecoderBuffer |
: public base::RefCountedThreadSafe<DecoderBuffer> { |
public: |
@@ -56,29 +56,69 @@ class MEDIA_EXPORT DecoderBuffer |
// Create a DecoderBuffer indicating we've reached end of stream. |
// |
- // Calling any method other than IsEndOfStream() on the resulting buffer |
+ // Calling any method other than end_of_stream() on the resulting buffer |
// is disallowed. |
static scoped_refptr<DecoderBuffer> CreateEOSBuffer(); |
- base::TimeDelta GetTimestamp() const; |
- void SetTimestamp(const base::TimeDelta& timestamp); |
- |
- base::TimeDelta GetDuration() const; |
- void SetDuration(const base::TimeDelta& duration); |
- |
- const uint8* GetData() const; |
- uint8* GetWritableData() const; |
- |
- int GetDataSize() const; |
- |
- const uint8* GetSideData() const; |
- int GetSideDataSize() const; |
- |
- const DecryptConfig* GetDecryptConfig() const; |
- void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); |
+ base::TimeDelta timestamp() const { |
+ DCHECK(!end_of_stream()); |
+ return timestamp_; |
+ } |
+ |
+ void set_timestamp(const base::TimeDelta& timestamp) { |
+ DCHECK(!end_of_stream()); |
+ timestamp_ = timestamp; |
+ } |
+ |
+ base::TimeDelta duration() const { |
+ DCHECK(!end_of_stream()); |
+ return duration_; |
+ } |
+ |
+ void set_duration(const base::TimeDelta& duration) { |
+ DCHECK(!end_of_stream()); |
+ duration_ = duration; |
+ } |
+ |
+ const uint8* data() const { |
+ DCHECK(!end_of_stream()); |
+ return data_.get(); |
+ } |
+ |
+ uint8* writable_data() const { |
+ DCHECK(!end_of_stream()); |
+ return data_.get(); |
+ } |
+ |
+ int data_size() const { |
+ DCHECK(!end_of_stream()); |
+ return size_; |
+ } |
+ |
+ const uint8* side_data() const { |
+ DCHECK(!end_of_stream()); |
+ return side_data_.get(); |
+ } |
+ |
+ int side_data_size() const { |
+ DCHECK(!end_of_stream()); |
+ return side_data_size_; |
+ } |
+ |
+ const DecryptConfig* decrypt_config() const { |
+ DCHECK(!end_of_stream()); |
+ return decrypt_config_.get(); |
+ } |
+ |
+ void set_decrypt_config(scoped_ptr<DecryptConfig> decrypt_config) { |
+ DCHECK(!end_of_stream()); |
+ decrypt_config_ = decrypt_config.Pass(); |
+ } |
// If there's no data in this buffer, it represents end of stream. |
- bool IsEndOfStream() const; |
+ bool end_of_stream() const { |
+ return data_ == NULL; |
+ } |
// Returns a human-readable string describing |*this|. |
std::string AsHumanReadableString(); |