| 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 MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 AndroidVideoDecodeAccelerator( | 118 AndroidVideoDecodeAccelerator( |
| 119 const MakeGLContextCurrentCallback& make_context_current_cb, | 119 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 120 const GetGLES2DecoderCallback& get_gles2_decoder_cb); | 120 const GetGLES2DecoderCallback& get_gles2_decoder_cb); |
| 121 | 121 |
| 122 ~AndroidVideoDecodeAccelerator() override; | 122 ~AndroidVideoDecodeAccelerator() override; |
| 123 | 123 |
| 124 // media::VideoDecodeAccelerator implementation: | 124 // media::VideoDecodeAccelerator implementation: |
| 125 bool Initialize(const Config& config, Client* client) override; | 125 bool Initialize(const Config& config, Client* client) override; |
| 126 void SetCdm(int cdm_id) override; | |
| 127 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 126 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
| 128 void AssignPictureBuffers( | 127 void AssignPictureBuffers( |
| 129 const std::vector<media::PictureBuffer>& buffers) override; | 128 const std::vector<media::PictureBuffer>& buffers) override; |
| 130 void ReusePictureBuffer(int32_t picture_buffer_id) override; | 129 void ReusePictureBuffer(int32_t picture_buffer_id) override; |
| 131 void Flush() override; | 130 void Flush() override; |
| 132 void Reset() override; | 131 void Reset() override; |
| 133 void Destroy() override; | 132 void Destroy() override; |
| 134 bool TryToSetupDecodeOnSeparateThread( | 133 bool TryToSetupDecodeOnSeparateThread( |
| 135 const base::WeakPtr<Client>& decode_client, | 134 const base::WeakPtr<Client>& decode_client, |
| 136 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) | 135 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // more output. | 251 // more output. |
| 253 bool DequeueOutput(); | 252 bool DequeueOutput(); |
| 254 | 253 |
| 255 // Requests picture buffers from the client. | 254 // Requests picture buffers from the client. |
| 256 void RequestPictureBuffers(); | 255 void RequestPictureBuffers(); |
| 257 | 256 |
| 258 // Decode the content in the |bitstream_buffer|. Note that a | 257 // Decode the content in the |bitstream_buffer|. Note that a |
| 259 // |bitstream_buffer| of id as -1 indicates a flush command. | 258 // |bitstream_buffer| of id as -1 indicates a flush command. |
| 260 void DecodeBuffer(const media::BitstreamBuffer& bitstream_buffer); | 259 void DecodeBuffer(const media::BitstreamBuffer& bitstream_buffer); |
| 261 | 260 |
| 262 // This callback is called after CDM obtained a MediaCrypto object. | 261 // Called during Initialize() for encrypted streams to set up the CDM. |
| 262 void InitializeCdm(int cdm_id); |
| 263 |
| 264 // Called after the CDM obtains a MediaCrypto object. |
| 263 void OnMediaCryptoReady( | 265 void OnMediaCryptoReady( |
| 264 media::MediaDrmBridgeCdmContext::JavaObjectPtr media_crypto, | 266 media::MediaDrmBridgeCdmContext::JavaObjectPtr media_crypto, |
| 265 bool needs_protected_surface); | 267 bool needs_protected_surface); |
| 266 | 268 |
| 267 // This callback is called when a new key is added to CDM. | 269 // Called when a new key is added to the CDM. |
| 268 void OnKeyAdded(); | 270 void OnKeyAdded(); |
| 269 | 271 |
| 270 // Notifies the client of the result of deferred initialization. | 272 // Notifies the client of the result of deferred initialization. |
| 271 void NotifyInitializationComplete(bool success); | 273 void NotifyInitializationComplete(bool success); |
| 272 | 274 |
| 273 // Notifies the client about the availability of a picture. | 275 // Notifies the client about the availability of a picture. |
| 274 void NotifyPictureReady(const media::Picture& picture); | 276 void NotifyPictureReady(const media::Picture& picture); |
| 275 | 277 |
| 276 // Notifies the client that the input buffer identifed by input_buffer_id has | 278 // Notifies the client that the input buffer identifed by input_buffer_id has |
| 277 // been processed. | 279 // been processed. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 class OnFrameAvailableHandler; | 381 class OnFrameAvailableHandler; |
| 380 scoped_refptr<OnFrameAvailableHandler> on_frame_available_handler_; | 382 scoped_refptr<OnFrameAvailableHandler> on_frame_available_handler_; |
| 381 | 383 |
| 382 // Time at which we last did useful work on io_timer_. | 384 // Time at which we last did useful work on io_timer_. |
| 383 base::TimeTicks most_recent_work_; | 385 base::TimeTicks most_recent_work_; |
| 384 | 386 |
| 385 // Type of a drain request. We need to distinguish between DRAIN_FOR_FLUSH | 387 // Type of a drain request. We need to distinguish between DRAIN_FOR_FLUSH |
| 386 // and other types, see IsDrainingForResetOrDestroy(). | 388 // and other types, see IsDrainingForResetOrDestroy(). |
| 387 DrainType drain_type_; | 389 DrainType drain_type_; |
| 388 | 390 |
| 389 // CDM related stuff. | |
| 390 | |
| 391 // Holds a ref-count to the CDM to avoid using the CDM after it's destroyed. | 391 // Holds a ref-count to the CDM to avoid using the CDM after it's destroyed. |
| 392 scoped_refptr<media::MediaKeys> cdm_for_reference_holding_only_; | 392 scoped_refptr<media::MediaKeys> cdm_for_reference_holding_only_; |
| 393 | 393 |
| 394 media::MediaDrmBridgeCdmContext* media_drm_bridge_cdm_context_; | 394 media::MediaDrmBridgeCdmContext* media_drm_bridge_cdm_context_; |
| 395 | 395 |
| 396 // MediaDrmBridge requires registration/unregistration of the player, this | 396 // MediaDrmBridge requires registration/unregistration of the player, this |
| 397 // registration id is used for this. | 397 // registration id is used for this. |
| 398 int cdm_registration_id_; | 398 int cdm_registration_id_; |
| 399 | 399 |
| 400 // Configuration that we use for MediaCodec. | 400 // Configuration that we use for MediaCodec. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 418 | 418 |
| 419 // WeakPtrFactory for posting tasks back to |this|. | 419 // WeakPtrFactory for posting tasks back to |this|. |
| 420 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 420 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
| 421 | 421 |
| 422 friend class AndroidVideoDecodeAcceleratorTest; | 422 friend class AndroidVideoDecodeAcceleratorTest; |
| 423 }; | 423 }; |
| 424 | 424 |
| 425 } // namespace media | 425 } // namespace media |
| 426 | 426 |
| 427 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 427 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |