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

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: Created 5 years 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);
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_; }
34 size_t size() const { return size_; } 45 size_t size() const { return size_; }
46 off_t offset() const { return offset_; }
35 47
Pawel Osciak 2015/12/24 00:58:01 Please add a comment what offset is.
Pawel Osciak 2015/12/24 01:01:38 Also perhaps please also clarify that size() is fo
Owen Lin 2015/12/24 08:01:35 Done.
Owen Lin 2015/12/24 08:01:35 Done.
36 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|. 48 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|.
37 base::TimeDelta presentation_timestamp() const { 49 base::TimeDelta presentation_timestamp() const {
38 return presentation_timestamp_; 50 return presentation_timestamp_;
39 } 51 }
40 52
41 // The following methods come from DecryptConfig. 53 // The following methods come from DecryptConfig.
42 54
43 const std::string& key_id() const { return key_id_; } 55 const std::string& key_id() const { return key_id_; }
44 const std::string& iv() const { return iv_; } 56 const std::string& iv() const { return iv_; }
45 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } 57 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; }
46 58
47 private: 59 private:
48 int32 id_; 60 int32 id_;
49 base::SharedMemoryHandle handle_; 61 base::SharedMemoryHandle handle_;
50 size_t size_; 62 size_t size_;
63 off_t offset_;
51 64
52 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator 65 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator
53 // needs the timestamp because the underlying decoder may require it to 66 // needs the timestamp because the underlying decoder may require it to
54 // determine the output order. 67 // determine the output order.
55 base::TimeDelta presentation_timestamp_; 68 base::TimeDelta presentation_timestamp_;
56 69
57 // The following fields come from DecryptConfig. 70 // The following fields come from DecryptConfig.
58 // TODO(timav): Try to DISALLOW_COPY_AND_ASSIGN and include these params as 71 // TODO(timav): Try to DISALLOW_COPY_AND_ASSIGN and include these params as
59 // scoped_ptr<DecryptConfig> or explain why copy & assign is needed. 72 // scoped_ptr<DecryptConfig> or explain why copy & assign is needed.
60 73
61 std::string key_id_; // key ID. 74 std::string key_id_; // key ID.
62 std::string iv_; // initialization vector 75 std::string iv_; // initialization vector
63 std::vector<SubsampleEntry> subsamples_; // clear/cypher sizes 76 std::vector<SubsampleEntry> subsamples_; // clear/cypher sizes
64 77
65 // Allow compiler-generated copy & assign constructors. 78 // Allow compiler-generated copy & assign constructors.
66 }; 79 };
67 80
68 } // namespace media 81 } // namespace media
69 82
70 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_ 83 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698