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

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

Issue 1645873002: Use ParamTraits for media::BitstreamBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compiling errors on mac and address review comments Created 4 years, 10 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "ipc/ipc_param_traits.h"
14 #include "media/base/decrypt_config.h" 15 #include "media/base/decrypt_config.h"
15 #include "media/base/media_export.h" 16 #include "media/base/media_export.h"
16 #include "media/base/timestamp_constants.h" 17 #include "media/base/timestamp_constants.h"
17 18
18 namespace media { 19 namespace media {
19 20
20 // Class for passing bitstream buffers around. Does not take ownership of the 21 // Class for passing bitstream buffers around. Does not take ownership of the
21 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev. 22 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev.
22 class MEDIA_EXPORT BitstreamBuffer { 23 class MEDIA_EXPORT BitstreamBuffer {
23 public: 24 public:
25 BitstreamBuffer();
26
24 BitstreamBuffer(int32_t id, base::SharedMemoryHandle handle, size_t size); 27 BitstreamBuffer(int32_t id, base::SharedMemoryHandle handle, size_t size);
25 28
26 BitstreamBuffer(int32_t id, 29 BitstreamBuffer(int32_t id,
27 base::SharedMemoryHandle handle, 30 base::SharedMemoryHandle handle,
28 size_t size, 31 size_t size,
29 base::TimeDelta presentation_timestamp); 32 base::TimeDelta presentation_timestamp);
30 33
31 ~BitstreamBuffer(); 34 ~BitstreamBuffer();
32 35
33 void SetDecryptConfig(const DecryptConfig& decrypt_config); 36 void SetDecryptConfig(const DecryptConfig& decrypt_config);
34 37
35 int32_t id() const { return id_; } 38 int32_t id() const { return id_; }
36 base::SharedMemoryHandle handle() const { return handle_; } 39 base::SharedMemoryHandle handle() const { return handle_; }
37 size_t size() const { return size_; } 40 size_t size() const { return size_; }
38 41
42 void set_handle(const base::SharedMemoryHandle& handle) { handle_ = handle; }
43
39 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|. 44 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|.
40 base::TimeDelta presentation_timestamp() const { 45 base::TimeDelta presentation_timestamp() const {
41 return presentation_timestamp_; 46 return presentation_timestamp_;
42 } 47 }
43 48
44 // The following methods come from DecryptConfig. 49 // The following methods come from DecryptConfig.
45 50
46 const std::string& key_id() const { return key_id_; } 51 const std::string& key_id() const { return key_id_; }
47 const std::string& iv() const { return iv_; } 52 const std::string& iv() const { return iv_; }
48 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; } 53 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; }
49 54
50 private: 55 private:
51 int32_t id_; 56 int32_t id_;
52 base::SharedMemoryHandle handle_; 57 base::SharedMemoryHandle handle_;
53 size_t size_; 58 size_t size_;
54 59
55 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator 60 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator
56 // needs the timestamp because the underlying decoder may require it to 61 // needs the timestamp because the underlying decoder may require it to
57 // determine the output order. 62 // determine the output order.
58 base::TimeDelta presentation_timestamp_; 63 base::TimeDelta presentation_timestamp_;
59 64
60 // The following fields come from DecryptConfig. 65 // The following fields come from DecryptConfig.
61 // TODO(timav): Try to DISALLOW_COPY_AND_ASSIGN and include these params as 66 // TODO(timav): Try to DISALLOW_COPY_AND_ASSIGN and include these params as
62 // scoped_ptr<DecryptConfig> or explain why copy & assign is needed. 67 // scoped_ptr<DecryptConfig> or explain why copy & assign is needed.
63 68
64 std::string key_id_; // key ID. 69 std::string key_id_; // key ID.
65 std::string iv_; // initialization vector 70 std::string iv_; // initialization vector
66 std::vector<SubsampleEntry> subsamples_; // clear/cypher sizes 71 std::vector<SubsampleEntry> subsamples_; // clear/cypher sizes
67 72
73 friend struct IPC::ParamTraits<media::BitstreamBuffer>;
74
68 // Allow compiler-generated copy & assign constructors. 75 // Allow compiler-generated copy & assign constructors.
69 }; 76 };
70 77
71 } // namespace media 78 } // namespace media
72 79
73 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_ 80 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698