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" | |
9 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
10 #include "base/time/time.h" | 9 #include "base/time/time.h" |
11 #include "media/base/decrypt_config.h" | 10 #include "media/base/decrypt_config.h" |
12 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
13 #include "media/base/timestamp_constants.h" | 12 #include "media/base/timestamp_constants.h" |
14 | 13 |
15 namespace media { | 14 namespace media { |
16 | 15 |
17 // 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 |
18 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev. | 17 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev. |
19 class MEDIA_EXPORT BitstreamBuffer { | 18 class MEDIA_EXPORT BitstreamBuffer { |
20 public: | 19 public: |
21 BitstreamBuffer(int32 id, base::SharedMemoryHandle handle, size_t size); | 20 BitstreamBuffer(int32_t id, base::SharedMemoryHandle handle, size_t size); |
22 | 21 |
23 BitstreamBuffer(int32 id, | 22 BitstreamBuffer(int32_t id, |
24 base::SharedMemoryHandle handle, | 23 base::SharedMemoryHandle handle, |
25 size_t size, | 24 size_t size, |
26 base::TimeDelta presentation_timestamp); | 25 base::TimeDelta presentation_timestamp); |
27 | 26 |
28 ~BitstreamBuffer(); | 27 ~BitstreamBuffer(); |
29 | 28 |
30 void SetDecryptConfig(const DecryptConfig& decrypt_config); | 29 void SetDecryptConfig(const DecryptConfig& decrypt_config); |
31 | 30 |
32 int32 id() const { return id_; } | 31 int32_t id() const { return id_; } |
33 base::SharedMemoryHandle handle() const { return handle_; } | 32 base::SharedMemoryHandle handle() const { return handle_; } |
34 size_t size() const { return size_; } | 33 size_t size() const { return size_; } |
35 | 34 |
36 // 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()|. |
37 base::TimeDelta presentation_timestamp() const { | 36 base::TimeDelta presentation_timestamp() const { |
38 return presentation_timestamp_; | 37 return presentation_timestamp_; |
39 } | 38 } |
40 | 39 |
41 // The following methods come from DecryptConfig. | 40 // The following methods come from DecryptConfig. |
42 | 41 |
43 const std::string& key_id() const { return key_id_; } | 42 const std::string& key_id() const { return key_id_; } |
44 const std::string& iv() const { return iv_; } | 43 const std::string& iv() const { return iv_; } |
45 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } | 44 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } |
46 | 45 |
47 private: | 46 private: |
48 int32 id_; | 47 int32_t id_; |
49 base::SharedMemoryHandle handle_; | 48 base::SharedMemoryHandle handle_; |
50 size_t size_; | 49 size_t size_; |
51 | 50 |
52 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator | 51 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator |
53 // needs the timestamp because the underlying decoder may require it to | 52 // needs the timestamp because the underlying decoder may require it to |
54 // determine the output order. | 53 // determine the output order. |
55 base::TimeDelta presentation_timestamp_; | 54 base::TimeDelta presentation_timestamp_; |
56 | 55 |
57 // The following fields come from DecryptConfig. | 56 // The following fields come from DecryptConfig. |
58 // TODO(timav): Try to DISALLOW_COPY_AND_ASSIGN and include these params as | 57 // TODO(timav): Try to DISALLOW_COPY_AND_ASSIGN and include these params as |
59 // scoped_ptr<DecryptConfig> or explain why copy & assign is needed. | 58 // scoped_ptr<DecryptConfig> or explain why copy & assign is needed. |
60 | 59 |
61 std::string key_id_; // key ID. | 60 std::string key_id_; // key ID. |
62 std::string iv_; // initialization vector | 61 std::string iv_; // initialization vector |
63 std::vector<SubsampleEntry> subsamples_; // clear/cypher sizes | 62 std::vector<SubsampleEntry> subsamples_; // clear/cypher sizes |
64 | 63 |
65 // Allow compiler-generated copy & assign constructors. | 64 // Allow compiler-generated copy & assign constructors. |
66 }; | 65 }; |
67 | 66 |
68 } // namespace media | 67 } // namespace media |
69 | 68 |
70 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_ | 69 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_ |
OLD | NEW |