OLD | NEW |
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 CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 #include "content/common/gpu/media/avda_state_provider.h" | 18 #include "content/common/gpu/media/avda_state_provider.h" |
19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
20 #include "media/base/android/media_codec_bridge.h" | 20 #include "media/base/android/media_codec_bridge.h" |
| 21 #include "media/base/android/media_drm_bridge.h" |
| 22 #include "media/base/media_keys.h" |
21 #include "media/video/video_decode_accelerator.h" | 23 #include "media/video/video_decode_accelerator.h" |
22 | 24 |
23 namespace gfx { | 25 namespace gfx { |
24 class SurfaceTexture; | 26 class SurfaceTexture; |
25 } | 27 } |
26 | 28 |
27 namespace content { | 29 namespace content { |
28 | 30 |
29 // A VideoDecodeAccelerator implementation for Android. | 31 // A VideoDecodeAccelerator implementation for Android. |
30 // This class decodes the input encoded stream by using Android's MediaCodec | 32 // This class decodes the input encoded stream by using Android's MediaCodec |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void QueueInput(); | 142 void QueueInput(); |
141 | 143 |
142 // Dequeues output from |media_codec_| and feeds the decoded frame to the | 144 // Dequeues output from |media_codec_| and feeds the decoded frame to the |
143 // client. Returns a hint about whether calling again might produce | 145 // client. Returns a hint about whether calling again might produce |
144 // more output. | 146 // more output. |
145 bool DequeueOutput(); | 147 bool DequeueOutput(); |
146 | 148 |
147 // Requests picture buffers from the client. | 149 // Requests picture buffers from the client. |
148 void RequestPictureBuffers(); | 150 void RequestPictureBuffers(); |
149 | 151 |
| 152 // This callback is called after CDM obtained a MediaCrypto object. |
| 153 void OnMediaCryptoReady(media::MediaDrmBridge::JavaObjectPtr media_crypto, |
| 154 bool needs_protected_surface); |
| 155 |
| 156 // This callback is called when a new key is added to CDM. |
| 157 void OnKeyAdded(); |
| 158 |
150 // Notifies the client of the CDM setting result. | 159 // Notifies the client of the CDM setting result. |
151 void NotifyCdmAttached(bool success); | 160 void NotifyCdmAttached(bool success); |
152 | 161 |
153 // Notifies the client about the availability of a picture. | 162 // Notifies the client about the availability of a picture. |
154 void NotifyPictureReady(const media::Picture& picture); | 163 void NotifyPictureReady(const media::Picture& picture); |
155 | 164 |
156 // Notifies the client that the input buffer identifed by input_buffer_id has | 165 // Notifies the client that the input buffer identifed by input_buffer_id has |
157 // been processed. | 166 // been processed. |
158 void NotifyEndOfBitstreamBuffer(int input_buffer_id); | 167 void NotifyEndOfBitstreamBuffer(int input_buffer_id); |
159 | 168 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 238 |
230 // Owner of the GL context. Used to restore the context state. | 239 // Owner of the GL context. Used to restore the context state. |
231 base::WeakPtr<gpu::gles2::GLES2Decoder> gl_decoder_; | 240 base::WeakPtr<gpu::gles2::GLES2Decoder> gl_decoder_; |
232 | 241 |
233 // Repeating timer responsible for draining pending IO to the codec. | 242 // Repeating timer responsible for draining pending IO to the codec. |
234 base::RepeatingTimer io_timer_; | 243 base::RepeatingTimer io_timer_; |
235 | 244 |
236 // Backing strategy that we'll use to connect PictureBuffers to frames. | 245 // Backing strategy that we'll use to connect PictureBuffers to frames. |
237 scoped_ptr<BackingStrategy> strategy_; | 246 scoped_ptr<BackingStrategy> strategy_; |
238 | 247 |
| 248 // CDM related stuff. |
| 249 |
| 250 // Holds a ref-count to the CDM. |
| 251 scoped_refptr<media::MediaKeys> cdm_; |
| 252 |
| 253 // MediaDrmBridge requires registration/unregistration of the player, this |
| 254 // registration id is used for this. |
| 255 int cdm_registration_id_; |
| 256 |
| 257 // The MediaCrypto object is used in the MediaCodec.configure() in case of |
| 258 // an encrypted stream. |
| 259 media::MediaDrmBridge::JavaObjectPtr media_crypto_; |
| 260 |
239 // WeakPtrFactory for posting tasks back to |this|. | 261 // WeakPtrFactory for posting tasks back to |this|. |
240 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 262 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
241 | 263 |
242 friend class AndroidVideoDecodeAcceleratorTest; | 264 friend class AndroidVideoDecodeAcceleratorTest; |
243 }; | 265 }; |
244 | 266 |
245 } // namespace content | 267 } // namespace content |
246 | 268 |
247 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 269 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |