OLD | NEW |
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 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ | 5 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ |
6 #define MEDIA_BASE_DECODER_BUFFER_H_ | 6 #define MEDIA_BASE_DECODER_BUFFER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/aligned_memory.h" | 12 #include "base/memory/aligned_memory.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "media/base/buffers.h" | |
18 #include "media/base/decrypt_config.h" | 17 #include "media/base/decrypt_config.h" |
19 #include "media/base/media_export.h" | 18 #include "media/base/media_export.h" |
20 | 19 |
21 namespace media { | 20 namespace media { |
22 | 21 |
23 // A specialized buffer for interfacing with audio / video decoders. | 22 // A specialized buffer for interfacing with audio / video decoders. |
24 // | 23 // |
25 // Specifically ensures that data is aligned and padded as necessary by the | 24 // Specifically ensures that data is aligned and padded as necessary by the |
26 // underlying decoding framework. On desktop platforms this means memory is | 25 // underlying decoding framework. On desktop platforms this means memory is |
27 // allocated using FFmpeg with particular alignment and padding requirements. | 26 // allocated using FFmpeg with particular alignment and padding requirements. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // shave keep as a virtual with hacker_style() for now. | 70 // shave keep as a virtual with hacker_style() for now. |
72 virtual void set_timestamp(base::TimeDelta timestamp); | 71 virtual void set_timestamp(base::TimeDelta timestamp); |
73 | 72 |
74 base::TimeDelta duration() const { | 73 base::TimeDelta duration() const { |
75 DCHECK(!end_of_stream()); | 74 DCHECK(!end_of_stream()); |
76 return duration_; | 75 return duration_; |
77 } | 76 } |
78 | 77 |
79 void set_duration(base::TimeDelta duration) { | 78 void set_duration(base::TimeDelta duration) { |
80 DCHECK(!end_of_stream()); | 79 DCHECK(!end_of_stream()); |
81 DCHECK(duration == kNoTimestamp() || | |
82 (duration >= base::TimeDelta() && duration != kInfiniteDuration())) | |
83 << duration.InSecondsF(); | |
84 duration_ = duration; | 80 duration_ = duration; |
85 } | 81 } |
86 | 82 |
87 const uint8* data() const { | 83 const uint8* data() const { |
88 DCHECK(!end_of_stream()); | 84 DCHECK(!end_of_stream()); |
89 return data_.get(); | 85 return data_.get(); |
90 } | 86 } |
91 | 87 |
92 uint8* writable_data() const { | 88 uint8* writable_data() const { |
93 DCHECK(!end_of_stream()); | 89 DCHECK(!end_of_stream()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 177 |
182 // Constructor helper method for memory allocations. | 178 // Constructor helper method for memory allocations. |
183 void Initialize(); | 179 void Initialize(); |
184 | 180 |
185 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); | 181 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); |
186 }; | 182 }; |
187 | 183 |
188 } // namespace media | 184 } // namespace media |
189 | 185 |
190 #endif // MEDIA_BASE_DECODER_BUFFER_H_ | 186 #endif // MEDIA_BASE_DECODER_BUFFER_H_ |
OLD | NEW |