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

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

Issue 1541353002: Add offset support to BitstreamBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle the offset with a helper class Created 4 years, 12 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
OLDNEW
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/decrypt_config.h"
12 #include "media/base/media_export.h" 12 #include "media/base/media_export.h"
13 #include "media/base/timestamp_constants.h" 13 #include "media/base/timestamp_constants.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 // Class for passing bitstream buffers around. Does not take ownership of the 17 // Class for passing bitstream buffers around. Does not take ownership of the
18 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev. 18 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev.
19 class MEDIA_EXPORT BitstreamBuffer { 19 class MEDIA_EXPORT BitstreamBuffer {
20 public: 20 public:
21 BitstreamBuffer(int32 id, base::SharedMemoryHandle handle, size_t size); 21 BitstreamBuffer(int32 id, base::SharedMemoryHandle handle, size_t size);
22 22
23 BitstreamBuffer(int32 id, 23 BitstreamBuffer(int32 id,
24 base::SharedMemoryHandle handle, 24 base::SharedMemoryHandle handle,
25 size_t size, 25 size_t size,
26 off_t offset);
Pawel Osciak 2015/12/31 02:05:54 Please add documentation what offset and size are,
Owen Lin 2016/01/04 08:54:18 Done.
27
28 BitstreamBuffer(int32 id,
29 base::SharedMemoryHandle handle,
30 size_t size,
26 base::TimeDelta presentation_timestamp); 31 base::TimeDelta presentation_timestamp);
27 32
33 BitstreamBuffer(int32 id,
34 base::SharedMemoryHandle handle,
35 size_t size,
36 off_t offset,
37 base::TimeDelta presentation_timestamp);
38
28 ~BitstreamBuffer(); 39 ~BitstreamBuffer();
29 40
30 void SetDecryptConfig(const DecryptConfig& decrypt_config); 41 void SetDecryptConfig(const DecryptConfig& decrypt_config);
31 42
32 int32 id() const { return id_; } 43 int32 id() const { return id_; }
33 base::SharedMemoryHandle handle() const { return handle_; } 44 base::SharedMemoryHandle handle() const { return handle_; }
45
46 // The number of bytes of the bitstream buffer.
Pawel Osciak 2015/12/31 02:05:54 Please clarify if this is the size of the bitstrea
Owen Lin 2016/01/04 08:54:18 Done.
34 size_t size() const { return size_; } 47 size_t size() const { return size_; }
35 48
49 // The offset of the bistream buffer to the shared memory.
Pawel Osciak 2015/12/31 02:05:54 "Offset to the start of actual bitstream data in s
Owen Lin 2016/01/04 08:54:18 Done.
50 off_t offset() const { return offset_; }
51
36 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|. 52 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|.
37 base::TimeDelta presentation_timestamp() const { 53 base::TimeDelta presentation_timestamp() const {
38 return presentation_timestamp_; 54 return presentation_timestamp_;
39 } 55 }
40 56
41 // The following methods come from DecryptConfig. 57 // The following methods come from DecryptConfig.
42 58
43 const std::string& key_id() const { return key_id_; } 59 const std::string& key_id() const { return key_id_; }
44 const std::string& iv() const { return iv_; } 60 const std::string& iv() const { return iv_; }
45 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } 61 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; }
46 62
47 private: 63 private:
48 int32 id_; 64 int32 id_;
49 base::SharedMemoryHandle handle_; 65 base::SharedMemoryHandle handle_;
50 size_t size_; 66 size_t size_;
67 off_t offset_;
51 68
52 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator 69 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator
53 // needs the timestamp because the underlying decoder may require it to 70 // needs the timestamp because the underlying decoder may require it to
54 // determine the output order. 71 // determine the output order.
55 base::TimeDelta presentation_timestamp_; 72 base::TimeDelta presentation_timestamp_;
56 73
57 // The following fields come from DecryptConfig. 74 // The following fields come from DecryptConfig.
58 // TODO(timav): Try to DISALLOW_COPY_AND_ASSIGN and include these params as 75 // TODO(timav): Try to DISALLOW_COPY_AND_ASSIGN and include these params as
59 // scoped_ptr<DecryptConfig> or explain why copy & assign is needed. 76 // scoped_ptr<DecryptConfig> or explain why copy & assign is needed.
60 77
61 std::string key_id_; // key ID. 78 std::string key_id_; // key ID.
62 std::string iv_; // initialization vector 79 std::string iv_; // initialization vector
63 std::vector<SubsampleEntry> subsamples_; // clear/cypher sizes 80 std::vector<SubsampleEntry> subsamples_; // clear/cypher sizes
64 81
65 // Allow compiler-generated copy & assign constructors. 82 // Allow compiler-generated copy & assign constructors.
66 }; 83 };
67 84
68 } // namespace media 85 } // namespace media
69 86
70 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_ 87 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698