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 MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_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> |
11 #include <map> | 11 #include <map> |
12 #include <queue> | 12 #include <queue> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
18 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
19 #include "content/common/content_export.h" | |
20 #include "content/common/gpu/media/avda_state_provider.h" | |
21 #include "content/common/gpu/media/gpu_video_decode_accelerator_helpers.h" | |
22 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
23 #include "gpu/command_buffer/service/gpu_preferences.h" | 20 #include "gpu/command_buffer/service/gpu_preferences.h" |
24 #include "media/base/android/media_drm_bridge_cdm_context.h" | 21 #include "media/base/android/media_drm_bridge_cdm_context.h" |
25 #include "media/base/android/sdk_media_codec_bridge.h" | 22 #include "media/base/android/sdk_media_codec_bridge.h" |
26 #include "media/base/media_keys.h" | 23 #include "media/base/media_keys.h" |
| 24 #include "media/gpu/avda_state_provider.h" |
| 25 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" |
| 26 #include "media/gpu/media_gpu_export.h" |
27 #include "media/video/video_decode_accelerator.h" | 27 #include "media/video/video_decode_accelerator.h" |
28 #include "ui/gl/android/scoped_java_surface.h" | 28 #include "ui/gl/android/scoped_java_surface.h" |
29 | 29 |
30 namespace gfx { | 30 namespace gfx { |
31 class SurfaceTexture; | 31 class SurfaceTexture; |
32 } | 32 } |
33 | 33 |
34 namespace content { | 34 namespace media { |
35 | 35 |
36 // A VideoDecodeAccelerator implementation for Android. | 36 // A VideoDecodeAccelerator implementation for Android. |
37 // This class decodes the input encoded stream by using Android's MediaCodec | 37 // This class decodes the input encoded stream by using Android's MediaCodec |
38 // class. http://developer.android.com/reference/android/media/MediaCodec.html | 38 // class. http://developer.android.com/reference/android/media/MediaCodec.html |
39 // It delegates attaching pictures to PictureBuffers to a BackingStrategy, but | 39 // It delegates attaching pictures to PictureBuffers to a BackingStrategy, but |
40 // otherwise handles the work of transferring data to / from MediaCodec. | 40 // otherwise handles the work of transferring data to / from MediaCodec. |
41 class CONTENT_EXPORT AndroidVideoDecodeAccelerator | 41 class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator |
42 : public media::VideoDecodeAccelerator, | 42 : public media::VideoDecodeAccelerator, |
43 public AVDAStateProvider { | 43 public AVDAStateProvider { |
44 public: | 44 public: |
45 using OutputBufferMap = std::map<int32_t, media::PictureBuffer>; | 45 using OutputBufferMap = std::map<int32_t, media::PictureBuffer>; |
46 | 46 |
47 // A BackingStrategy is responsible for making a PictureBuffer's texture | 47 // A BackingStrategy is responsible for making a PictureBuffer's texture |
48 // contain the image that a MediaCodec decoder buffer tells it to. | 48 // contain the image that a MediaCodec decoder buffer tells it to. |
49 class BackingStrategy { | 49 class BackingStrategy { |
50 public: | 50 public: |
51 virtual ~BackingStrategy() {} | 51 virtual ~BackingStrategy() {} |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // True if and only if VDA initialization is deferred, and we have not yet | 381 // True if and only if VDA initialization is deferred, and we have not yet |
382 // called NotifyInitializationComplete. | 382 // called NotifyInitializationComplete. |
383 bool deferred_initialization_pending_; | 383 bool deferred_initialization_pending_; |
384 | 384 |
385 // WeakPtrFactory for posting tasks back to |this|. | 385 // WeakPtrFactory for posting tasks back to |this|. |
386 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 386 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
387 | 387 |
388 friend class AndroidVideoDecodeAcceleratorTest; | 388 friend class AndroidVideoDecodeAcceleratorTest; |
389 }; | 389 }; |
390 | 390 |
391 } // namespace content | 391 } // namespace media |
392 | 392 |
393 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 393 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |