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