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

Side by Side Diff: media/base/android/media_codec_bridge.h

Issue 2058113002: Add 'cbcs' encryption scheme support in Android media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_ANDROID_MEDIA_CODEC_BRIDGE_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "media/base/android/media_codec_direction.h" 18 #include "media/base/android/media_codec_direction.h"
19 #include "media/base/media_export.h" 19 #include "media/base/media_export.h"
20 #include "ui/gfx/geometry/size.h" 20 #include "ui/gfx/geometry/size.h"
21 21
22 namespace media { 22 namespace media {
23 23
24 class EncryptionScheme;
24 struct SubsampleEntry; 25 struct SubsampleEntry;
25 26
26 // These must be in sync with MediaCodecBridge.MEDIA_CODEC_XXX constants in 27 // These must be in sync with MediaCodecBridge.MEDIA_CODEC_XXX constants in
27 // MediaCodecBridge.java. 28 // MediaCodecBridge.java.
28 enum MediaCodecStatus { 29 enum MediaCodecStatus {
29 MEDIA_CODEC_OK, 30 MEDIA_CODEC_OK,
30 MEDIA_CODEC_DEQUEUE_INPUT_AGAIN_LATER, 31 MEDIA_CODEC_DEQUEUE_INPUT_AGAIN_LATER,
31 MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER, 32 MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER,
32 MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED, 33 MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED,
33 MEDIA_CODEC_OUTPUT_FORMAT_CHANGED, 34 MEDIA_CODEC_OUTPUT_FORMAT_CHANGED,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // NULL |subsamples| indicates the whole buffer is encrypted. If |data| is 95 // NULL |subsamples| indicates the whole buffer is encrypted. If |data| is
95 // NULL, assume the input buffer has already been populated (but still obey 96 // NULL, assume the input buffer has already been populated (but still obey
96 // |data_size|). |data_size| must be less than kint32max (because Java). 97 // |data_size|). |data_size| must be less than kint32max (because Java).
97 MediaCodecStatus QueueSecureInputBuffer( 98 MediaCodecStatus QueueSecureInputBuffer(
98 int index, 99 int index,
99 const uint8_t* data, 100 const uint8_t* data,
100 size_t data_size, 101 size_t data_size,
101 const std::string& key_id, 102 const std::string& key_id,
102 const std::string& iv, 103 const std::string& iv,
103 const std::vector<SubsampleEntry>& subsamples, 104 const std::vector<SubsampleEntry>& subsamples,
105 const EncryptionScheme& encryption_scheme,
104 base::TimeDelta presentation_time); 106 base::TimeDelta presentation_time);
105 107
106 // Same QueueSecureInputBuffer overriden for the use with 108 // Same QueueSecureInputBuffer overriden for the use with
107 // AndroidVideoDecodeAccelerator and MediaCodecAudioDecoder. TODO(timav): 109 // AndroidVideoDecodeAccelerator and MediaCodecAudioDecoder. TODO(timav):
108 // remove this method and keep only the one above after we switch to the 110 // remove this method and keep only the one above after we switch to the
109 // Spitzer pipeline. 111 // Spitzer pipeline.
110 virtual MediaCodecStatus QueueSecureInputBuffer( 112 virtual MediaCodecStatus QueueSecureInputBuffer(
111 int index, 113 int index,
112 const uint8_t* data, 114 const uint8_t* data,
113 size_t data_size, 115 size_t data_size,
114 const std::vector<char>& key_id, 116 const std::vector<char>& key_id,
115 const std::vector<char>& iv, 117 const std::vector<char>& iv,
116 const SubsampleEntry* subsamples, 118 const SubsampleEntry* subsamples,
117 int subsamples_size, 119 int subsamples_size,
120 const EncryptionScheme& encryption_scheme,
118 base::TimeDelta presentation_time) = 0; 121 base::TimeDelta presentation_time) = 0;
119 122
120 // Submits an empty buffer with a EOS (END OF STREAM) flag. 123 // Submits an empty buffer with a EOS (END OF STREAM) flag.
121 virtual void QueueEOS(int input_buffer_index) = 0; 124 virtual void QueueEOS(int input_buffer_index) = 0;
122 125
123 // Returns: 126 // Returns:
124 // MEDIA_CODEC_OK if an input buffer is ready to be filled with valid data, 127 // MEDIA_CODEC_OK if an input buffer is ready to be filled with valid data,
125 // MEDIA_CODEC_ENQUEUE_INPUT_AGAIN_LATER if no such buffer is available, or 128 // MEDIA_CODEC_ENQUEUE_INPUT_AGAIN_LATER if no such buffer is available, or
126 // MEDIA_CODEC_ERROR if unexpected error happens. 129 // MEDIA_CODEC_ERROR if unexpected error happens.
127 // Note: Never use infinite timeout as this would block the decoder thread and 130 // Note: Never use infinite timeout as this would block the decoder thread and
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 bool FillInputBuffer(int index, 188 bool FillInputBuffer(int index,
186 const uint8_t* data, 189 const uint8_t* data,
187 size_t data_size) WARN_UNUSED_RESULT; 190 size_t data_size) WARN_UNUSED_RESULT;
188 191
189 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge); 192 DISALLOW_COPY_AND_ASSIGN(MediaCodecBridge);
190 }; 193 };
191 194
192 } // namespace media 195 } // namespace media
193 196
194 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_ 197 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698