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

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

Issue 10228017: Add initial implementation of SourceBufferStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/buffers.cc » ('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) 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 // Defines a base class for representing timestamped media data. Every buffer 5 // Defines a base class for representing timestamped media data. Every buffer
6 // contains a timestamp in microseconds describing the relative position of 6 // contains a timestamp in microseconds describing the relative position of
7 // the buffer within the media stream, and the duration in microseconds for 7 // the buffer within the media stream, and the duration in microseconds for
8 // the length of time the buffer will be rendered. 8 // the length of time the buffer will be rendered.
9 // 9 //
10 // Timestamps are derived directly from the encoded media file and are commonly 10 // Timestamps are derived directly from the encoded media file and are commonly
11 // known as the presentation timestamp (PTS). Durations are a best-guess and 11 // known as the presentation timestamp (PTS). Durations are a best-guess and
12 // are usually derived from the sample/frame rate of the media file. 12 // are usually derived from the sample/frame rate of the media file.
13 // 13 //
14 // Due to encoding and transmission errors, it is not guaranteed that timestamps 14 // Due to encoding and transmission errors, it is not guaranteed that timestamps
15 // arrive in a monotonically increasing order nor that the next timestamp will 15 // arrive in a monotonically increasing order nor that the next timestamp will
16 // be equal to the previous timestamp plus the duration. 16 // be equal to the previous timestamp plus the duration.
17 // 17 //
18 // In the ideal scenario for a 25fps movie, buffers are timestamped as followed: 18 // In the ideal scenario for a 25fps movie, buffers are timestamped as followed:
19 // 19 //
20 // Buffer0 Buffer1 Buffer2 ... BufferN 20 // Buffer0 Buffer1 Buffer2 ... BufferN
21 // Timestamp: 0us 40000us 80000us ... (N*40000)us 21 // Timestamp: 0us 40000us 80000us ... (N*40000)us
22 // Duration*: 40000us 40000us 40000us ... 40000us 22 // Duration*: 40000us 40000us 40000us ... 40000us
23 // 23 //
24 // *25fps = 0.04s per frame = 40000us per frame 24 // *25fps = 0.04s per frame = 40000us per frame
25 25
26 #ifndef MEDIA_BASE_BUFFERS_H_ 26 #ifndef MEDIA_BASE_BUFFERS_H_
27 #define MEDIA_BASE_BUFFERS_H_ 27 #define MEDIA_BASE_BUFFERS_H_
28 28
29 #include "base/basictypes.h" 29 #include "base/basictypes.h"
30 #include "base/logging.h"
30 #include "base/memory/ref_counted.h" 31 #include "base/memory/ref_counted.h"
31 #include "base/time.h" 32 #include "base/time.h"
32 #include "media/base/media_export.h" 33 #include "media/base/media_export.h"
33 34
34 namespace media { 35 namespace media {
35 36
36 class DecryptConfig; 37 class DecryptConfig;
37 38
38 // Indicates an invalid or missing timestamp. 39 // Indicates an invalid or missing timestamp.
39 MEDIA_EXPORT extern inline base::TimeDelta kNoTimestamp() { 40 MEDIA_EXPORT extern inline base::TimeDelta kNoTimestamp() {
(...skipping 26 matching lines...) Expand all
66 timestamp_ = timestamp; 67 timestamp_ = timestamp;
67 } 68 }
68 69
69 base::TimeDelta GetDuration() const { 70 base::TimeDelta GetDuration() const {
70 return duration_; 71 return duration_;
71 } 72 }
72 void SetDuration(const base::TimeDelta& duration) { 73 void SetDuration(const base::TimeDelta& duration) {
73 duration_ = duration; 74 duration_ = duration;
74 } 75 }
75 76
77 virtual bool IsKeyframe() const {
scherkus (not reviewing) 2012/04/25 22:59:00 don't inline virtual methods in .h http://dev.chro
vrk (LEFT CHROMIUM) 2012/04/25 23:25:48 Yeahhh as I explained offline, I was worried that
78 // TODO(vrk): Remove this when keyframes are marked as such.
79 NOTIMPLEMENTED();
80
81 return is_keyframe_;
82 }
83
84 void SetKeyframe(bool is_keyframe) {
85 is_keyframe_ = is_keyframe;
86 }
87
76 protected: 88 protected:
77 friend class base::RefCountedThreadSafe<Buffer>; 89 friend class base::RefCountedThreadSafe<Buffer>;
78 Buffer(base::TimeDelta timestamp, base::TimeDelta duration); 90 Buffer(base::TimeDelta timestamp, base::TimeDelta duration);
79 virtual ~Buffer(); 91 virtual ~Buffer();
80 92
81 private: 93 private:
82 base::TimeDelta timestamp_; 94 base::TimeDelta timestamp_;
83 base::TimeDelta duration_; 95 base::TimeDelta duration_;
96 bool is_keyframe_;
84 97
85 DISALLOW_COPY_AND_ASSIGN(Buffer); 98 DISALLOW_COPY_AND_ASSIGN(Buffer);
86 }; 99 };
87 100
88 } // namespace media 101 } // namespace media
89 102
90 #endif // MEDIA_BASE_BUFFERS_H_ 103 #endif // MEDIA_BASE_BUFFERS_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/buffers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698