Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BITSTREAM_BUFFER_H_ | 5 #ifndef MEDIA_BASE_BITSTREAM_BUFFER_H_ |
| 6 #define MEDIA_BASE_BITSTREAM_BUFFER_H_ | 6 #define MEDIA_BASE_BITSTREAM_BUFFER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "media/base/decrypt_config.h" | |
| 11 #include "media/base/timestamp_constants.h" | 12 #include "media/base/timestamp_constants.h" |
| 12 | 13 |
| 13 namespace media { | 14 namespace media { |
| 14 | 15 |
| 15 // Class for passing bitstream buffers around. Does not take ownership of the | 16 // Class for passing bitstream buffers around. Does not take ownership of the |
| 16 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev. | 17 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev. |
| 17 class BitstreamBuffer { | 18 class BitstreamBuffer { |
| 18 public: | 19 public: |
| 19 BitstreamBuffer(int32 id, base::SharedMemoryHandle handle, size_t size) | 20 BitstreamBuffer(int32 id, base::SharedMemoryHandle handle, size_t size); |
| 20 : id_(id), | |
| 21 handle_(handle), | |
| 22 size_(size), | |
| 23 presentation_timestamp_(kNoTimestamp()) {} | |
| 24 | 21 |
| 25 BitstreamBuffer(int32 id, | 22 BitstreamBuffer(int32 id, |
| 26 base::SharedMemoryHandle handle, | 23 base::SharedMemoryHandle handle, |
| 27 size_t size, | 24 size_t size, |
| 28 base::TimeDelta presentation_timestamp) | 25 base::TimeDelta presentation_timestamp); |
| 29 : id_(id), | 26 |
| 30 handle_(handle), | 27 ~BitstreamBuffer(); |
| 31 size_(size), | 28 |
| 32 presentation_timestamp_(presentation_timestamp) {} | 29 void SetDecryptParams(const DecryptConfig& decrypt_config); |
|
xhwang
2015/10/22 06:13:51
nit: maybe just SetDecryptConfig?
Tima Vaisburd
2015/10/22 21:57:26
Done.
| |
| 33 | 30 |
| 34 int32 id() const { return id_; } | 31 int32 id() const { return id_; } |
| 35 base::SharedMemoryHandle handle() const { return handle_; } | 32 base::SharedMemoryHandle handle() const { return handle_; } |
| 36 size_t size() const { return size_; } | 33 size_t size() const { return size_; } |
| 37 | 34 |
| 38 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|. | 35 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|. |
| 39 base::TimeDelta presentation_timestamp() const { | 36 base::TimeDelta presentation_timestamp() const { |
| 40 return presentation_timestamp_; | 37 return presentation_timestamp_; |
| 41 } | 38 } |
| 42 | 39 |
| 40 // The following methods come from DecryptConfig. | |
| 41 | |
| 42 const std::string& key_id() const { return key_id_; } | |
| 43 const std::string& iv() const { return iv_; } | |
| 44 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } | |
| 45 | |
| 43 private: | 46 private: |
| 44 int32 id_; | 47 int32 id_; |
| 45 base::SharedMemoryHandle handle_; | 48 base::SharedMemoryHandle handle_; |
| 46 size_t size_; | 49 size_t size_; |
| 47 | 50 |
| 48 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator | 51 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator |
| 49 // needs the timestamp because the underlying decoder may require it to | 52 // needs the timestamp because the underlying decoder may require it to |
| 50 // determine the output order. | 53 // determine the output order. |
| 51 base::TimeDelta presentation_timestamp_; | 54 base::TimeDelta presentation_timestamp_; |
| 52 | 55 |
| 56 // The following fields come from DecryptConfig. | |
| 57 | |
| 58 std::string key_id_; // key ID. | |
| 59 std::string iv_; // initialization vector | |
| 60 std::vector<SubsampleEntry> subsamples_; // clear/cypher sizes | |
|
xhwang
2015/10/22 06:13:51
Can you just have a scoped_ptr<DecryptConfig> here
Tima Vaisburd
2015/10/22 17:15:45
Yes, I wanted that from the very beginning, but wa
xhwang
2015/10/22 18:11:25
ouch...
Maybe it's because of this that we allow
Tima Vaisburd
2015/10/22 21:57:26
Done.
| |
| 61 | |
| 53 // Allow compiler-generated copy & assign constructors. | 62 // Allow compiler-generated copy & assign constructors. |
| 54 }; | 63 }; |
| 55 | 64 |
| 56 } // namespace media | 65 } // namespace media |
| 57 | 66 |
| 58 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_ | 67 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_ |
| OLD | NEW |