summaryrefslogtreecommitdiffstats
path: root/media/base/buffers.h
diff options
context:
space:
mode:
authorralphl@chromium.org <ralphl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-25 23:53:16 +0000
committerralphl@chromium.org <ralphl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-25 23:53:16 +0000
commita28e0e48a6d0f1e8b25a45a8e6d7089c276f3c44 (patch)
tree17f9ade0447bf18ec387c7f5489d883c959bf656 /media/base/buffers.h
parent24062acc468ac7c21b0dde801c02d6b72a2330e1 (diff)
downloadchromium_src-a28e0e48a6d0f1e8b25a45a8e6d7089c276f3c44.zip
chromium_src-a28e0e48a6d0f1e8b25a45a8e6d7089c276f3c44.tar.gz
chromium_src-a28e0e48a6d0f1e8b25a45a8e6d7089c276f3c44.tar.bz2
Added IsEndOfStream and IsDiscontiguous flags to buffers.
Review URL: http://codereview.chromium.org/27120 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10406 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/buffers.h')
-rw-r--r--media/base/buffers.h57
1 files changed, 49 insertions, 8 deletions
diff --git a/media/base/buffers.h b/media/base/buffers.h
index b6c3935..9cd8c96 100644
--- a/media/base/buffers.h
+++ b/media/base/buffers.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2008-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -36,20 +36,61 @@ namespace media {
class StreamSample : public base::RefCountedThreadSafe<StreamSample> {
public:
// Returns the timestamp of this buffer in microseconds.
- virtual base::TimeDelta GetTimestamp() const = 0;
+ base::TimeDelta GetTimestamp() const {
+ return timestamp_;
+ }
// Returns the duration of this buffer in microseconds.
- virtual base::TimeDelta GetDuration() const = 0;
+ base::TimeDelta GetDuration() const {
+ return duration_;
+ }
+
+ // Indicates that the sample is the last one in the stream.
+ bool IsEndOfStream() const {
+ return end_of_stream_;
+ }
+
+ // Indicates that this sample is discontinuous from the previous one, for
+ // example, following a seek.
+ bool IsDiscontinuous() const {
+ return discontinuous_;
+ }
// Sets the timestamp of this buffer in microseconds.
- virtual void SetTimestamp(const base::TimeDelta& timestamp) = 0;
+ void SetTimestamp(const base::TimeDelta& timestamp) {
+ timestamp_ = timestamp;
+ }
// Sets the duration of this buffer in microseconds.
- virtual void SetDuration(const base::TimeDelta& duration) = 0;
+ void SetDuration(const base::TimeDelta& duration) {
+ duration_ = duration;
+ }
+
+ // Sets the value returned by IsEndOfStream().
+ void SetEndOfStream(bool end_of_stream) {
+ end_of_stream_ = end_of_stream;
+ }
+
+ // Sets the value returned by IsDiscontinuous().
+ void SetDiscontinuous(bool discontinuous) {
+ discontinuous_ = discontinuous;
+ }
protected:
friend class base::RefCountedThreadSafe<StreamSample>;
+ StreamSample()
+ : end_of_stream_(false),
+ discontinuous_(false) {
+ }
virtual ~StreamSample() {}
+
+ base::TimeDelta timestamp_;
+ base::TimeDelta duration_;
+ bool end_of_stream_;
+ bool discontinuous_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(StreamSample);
};
@@ -134,8 +175,8 @@ class VideoFrame : public StreamSample {
//
// TODO(scherkus): rethink the Assignable interface -- it's a bit kludgy.
template <class BufferType>
-class Assignable :
- public base::RefCountedThreadSafe< Assignable<BufferType> > {
+class Assignable
+ : public base::RefCountedThreadSafe< Assignable<BufferType> > {
public:
// Assigns a buffer to the owner.
virtual void SetBuffer(BufferType* buffer) = 0;
@@ -146,7 +187,7 @@ class Assignable :
// TODO(scherkus): figure out a solution to friending a template.
// See http://www.comeaucomputing.com/techtalk/templates/#friendclassT for
// an explanation.
- //protected:
+ // protected:
// friend class base::RefCountedThreadSafe< Assignable<class T> >;
virtual ~Assignable() {}
};