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

Side by Side Diff: media/base/buffers.h

Issue 19739: Changed media::Buffer interfaces to use base::TimeDelta. (Closed)
Patch Set: Created 11 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | media/base/data_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // Defines various types of timestamped media buffers used for transporting 5 // Defines various types of timestamped media buffers used for transporting
6 // data between filters. Every buffer contains a timestamp in microseconds 6 // data between filters. Every buffer contains a timestamp in microseconds
7 // describing the relative position of the buffer within the media stream, and 7 // describing the relative position of the buffer within the media stream, and
8 // the duration in microseconds for the length of time the buffer will be 8 // the duration in microseconds for the length of time the buffer will be
9 // rendered. 9 // rendered.
10 // 10 //
11 // Timestamps are derived directly from the encoded media file and are commonly 11 // Timestamps are derived directly from the encoded media file and are commonly
12 // known as the presentation timestamp (PTS). Durations are a best-guess and 12 // known as the presentation timestamp (PTS). Durations are a best-guess and
13 // are usually derived from the sample/frame rate of the media file. 13 // are usually derived from the sample/frame rate of the media file.
14 // 14 //
15 // Due to encoding and transmission errors, it is not guaranteed that timestamps 15 // Due to encoding and transmission errors, it is not guaranteed that timestamps
16 // arrive in a monotonically increasing order nor that the next timestamp will 16 // arrive in a monotonically increasing order nor that the next timestamp will
17 // be equal to the previous timestamp plus the duration. 17 // be equal to the previous timestamp plus the duration.
18 // 18 //
19 // In the ideal scenario for a 25fps movie, buffers are timestamped as followed: 19 // In the ideal scenario for a 25fps movie, buffers are timestamped as followed:
20 // 20 //
21 // Buffer0 Buffer1 Buffer2 ... BufferN 21 // Buffer0 Buffer1 Buffer2 ... BufferN
22 // Timestamp: 0us 40000us 80000us ... (N*40000)us 22 // Timestamp: 0us 40000us 80000us ... (N*40000)us
23 // Duration*: 40000us 40000us 40000us ... 40000us 23 // Duration*: 40000us 40000us 40000us ... 40000us
24 // 24 //
25 // *25fps = 0.04s per frame = 40000us per frame 25 // *25fps = 0.04s per frame = 40000us per frame
26 26
27 #ifndef MEDIA_BASE_BUFFERS_H_ 27 #ifndef MEDIA_BASE_BUFFERS_H_
28 #define MEDIA_BASE_BUFFERS_H_ 28 #define MEDIA_BASE_BUFFERS_H_
29 29
30 #include "base/basictypes.h"
30 #include "base/ref_counted.h" 31 #include "base/ref_counted.h"
32 #include "base/time.h"
31 33
32 namespace media { 34 namespace media {
33 35
34 class StreamSample : public base::RefCountedThreadSafe<StreamSample> { 36 class StreamSample : public base::RefCountedThreadSafe<StreamSample> {
35 public: 37 public:
36 // Returns the timestamp of this buffer in microseconds. 38 // Returns the timestamp of this buffer in microseconds.
37 virtual int64 GetTimestamp() const = 0; 39 virtual base::TimeDelta GetTimestamp() const = 0;
38 40
39 // Returns the duration of this buffer in microseconds. 41 // Returns the duration of this buffer in microseconds.
40 virtual int64 GetDuration() const = 0; 42 virtual base::TimeDelta GetDuration() const = 0;
41 43
42 // Sets the timestamp of this buffer in microseconds. 44 // Sets the timestamp of this buffer in microseconds.
43 virtual void SetTimestamp(int64 timestamp) = 0; 45 virtual void SetTimestamp(const base::TimeDelta& timestamp) = 0;
44 46
45 // Sets the duration of this buffer in microseconds. 47 // Sets the duration of this buffer in microseconds.
46 virtual void SetDuration(int64 duration) = 0; 48 virtual void SetDuration(const base::TimeDelta& duration) = 0;
47 49
48 protected: 50 protected:
49 friend class base::RefCountedThreadSafe<StreamSample>; 51 friend class base::RefCountedThreadSafe<StreamSample>;
50 virtual ~StreamSample() {} 52 virtual ~StreamSample() {}
51 }; 53 };
52 54
53 55
54 class Buffer : public StreamSample { 56 class Buffer : public StreamSample {
55 public: 57 public:
56 // Returns a read only pointer to the buffer data. 58 // Returns a read only pointer to the buffer data.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 private: 175 private:
174 OwnerType* owner_; 176 OwnerType* owner_;
175 scoped_refptr<BufferType> buffer_; 177 scoped_refptr<BufferType> buffer_;
176 178
177 DISALLOW_COPY_AND_ASSIGN(AssignableBuffer); 179 DISALLOW_COPY_AND_ASSIGN(AssignableBuffer);
178 }; 180 };
179 181
180 } // namespace media 182 } // namespace media
181 183
182 #endif // MEDIA_BASE_BUFFERS_H_ 184 #endif // MEDIA_BASE_BUFFERS_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/data_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698