Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1069)

Unified Diff: media/base/decoder_buffer.h

Issue 17408005: Refactored DecoderBuffer to use unix_hacker_style naming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@localrefactor
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/android/media_source_player_unittest.cc ('k') | media/base/decoder_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « media/base/android/media_source_player_unittest.cc ('k') | media/base/decoder_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698