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

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

Issue 1422643002: Pass DecryptConfig parameters over IPC and use it in AVDA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed MediaCodec.CodecException that was added only at level 21 (Android L) Created 5 years, 1 month 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
« no previous file with comments | « media/base/android/media_codec_bridge.cc ('k') | media/base/bitstream_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
12 #include "media/base/media_export.h"
11 #include "media/base/timestamp_constants.h" 13 #include "media/base/timestamp_constants.h"
12 14
13 namespace media { 15 namespace media {
14 16
15 // 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
16 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev. 18 // data. This is the media-namespace equivalent of PP_VideoBitstreamBuffer_Dev.
17 class BitstreamBuffer { 19 class MEDIA_EXPORT BitstreamBuffer {
18 public: 20 public:
19 BitstreamBuffer(int32 id, base::SharedMemoryHandle handle, size_t size) 21 BitstreamBuffer(int32 id, base::SharedMemoryHandle handle, size_t size);
20 : id_(id),
21 handle_(handle),
22 size_(size),
23 presentation_timestamp_(kNoTimestamp()) {}
24 22
25 BitstreamBuffer(int32 id, 23 BitstreamBuffer(int32 id,
26 base::SharedMemoryHandle handle, 24 base::SharedMemoryHandle handle,
27 size_t size, 25 size_t size,
28 base::TimeDelta presentation_timestamp) 26 base::TimeDelta presentation_timestamp);
29 : id_(id), 27
30 handle_(handle), 28 ~BitstreamBuffer();
31 size_(size), 29
32 presentation_timestamp_(presentation_timestamp) {} 30 void SetDecryptConfig(const DecryptConfig& decrypt_config);
33 31
34 int32 id() const { return id_; } 32 int32 id() const { return id_; }
35 base::SharedMemoryHandle handle() const { return handle_; } 33 base::SharedMemoryHandle handle() const { return handle_; }
36 size_t size() const { return size_; } 34 size_t size() const { return size_; }
37 35
38 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|. 36 // The timestamp is only valid if it's not equal to |media::kNoTimestamp()|.
39 base::TimeDelta presentation_timestamp() const { 37 base::TimeDelta presentation_timestamp() const {
40 return presentation_timestamp_; 38 return presentation_timestamp_;
41 } 39 }
42 40
41 // The following methods come from DecryptConfig.
42
43 const std::string& key_id() const { return key_id_; }
44 const std::string& iv() const { return iv_; }
45 const std::vector<SubsampleEntry>& subsamples() const { return subsamples_; }
46
43 private: 47 private:
44 int32 id_; 48 int32 id_;
45 base::SharedMemoryHandle handle_; 49 base::SharedMemoryHandle handle_;
46 size_t size_; 50 size_t size_;
47 51
48 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator 52 // This is only set when necessary. For example, AndroidVideoDecodeAccelerator
49 // needs the timestamp because the underlying decoder may require it to 53 // needs the timestamp because the underlying decoder may require it to
50 // determine the output order. 54 // determine the output order.
51 base::TimeDelta presentation_timestamp_; 55 base::TimeDelta presentation_timestamp_;
52 56
57 // The following fields come from DecryptConfig.
58 // TODO(timav): Try to DISALLOW_COPY_AND_ASSIGN and include these params as
59 // scoped_ptr<DecryptConfig> or explain why copy & assign is needed.
60
61 std::string key_id_; // key ID.
62 std::string iv_; // initialization vector
63 std::vector<SubsampleEntry> subsamples_; // clear/cypher sizes
64
53 // Allow compiler-generated copy & assign constructors. 65 // Allow compiler-generated copy & assign constructors.
54 }; 66 };
55 67
56 } // namespace media 68 } // namespace media
57 69
58 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_ 70 #endif // MEDIA_BASE_BITSTREAM_BUFFER_H_
OLDNEW
« no previous file with comments | « media/base/android/media_codec_bridge.cc ('k') | media/base/bitstream_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698