| 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/video_decode_accelerator_impl.h" | |
| 19 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 18 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
| 20 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 21 #include "media/base/android/media_codec_bridge.h" | 20 #include "media/base/android/media_codec_bridge.h" |
| 22 #include "media/video/video_decode_accelerator.h" | 21 #include "media/video/video_decode_accelerator.h" |
| 23 | 22 |
| 24 namespace gfx { | 23 namespace gfx { |
| 25 class SurfaceTexture; | 24 class SurfaceTexture; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace content { | 27 namespace content { |
| 29 // A VideoDecodeAccelerator implementation for Android. | 28 // A VideoDecodeAccelerator implementation for Android. |
| 30 // This class decodes the input encoded stream by using Android's MediaCodec | 29 // This class decodes the input encoded stream by using Android's MediaCodec |
| 31 // class. http://developer.android.com/reference/android/media/MediaCodec.html | 30 // class. http://developer.android.com/reference/android/media/MediaCodec.html |
| 32 class CONTENT_EXPORT AndroidVideoDecodeAccelerator | 31 class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
| 33 : public VideoDecodeAcceleratorImpl { | 32 : public media::VideoDecodeAccelerator { |
| 34 public: | 33 public: |
| 35 // Does not take ownership of |client| which must outlive |*this|. | 34 // Does not take ownership of |client| which must outlive |*this|. |
| 36 AndroidVideoDecodeAccelerator( | 35 AndroidVideoDecodeAccelerator( |
| 37 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, | 36 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, |
| 38 const base::Callback<bool(void)>& make_context_current); | 37 const base::Callback<bool(void)>& make_context_current); |
| 39 | 38 |
| 40 // media::VideoDecodeAccelerator implementation. | 39 // media::VideoDecodeAccelerator implementation. |
| 41 virtual bool Initialize(media::VideoCodecProfile profile, | 40 virtual bool Initialize(media::VideoCodecProfile profile, |
| 42 Client* client) OVERRIDE; | 41 Client* client) OVERRIDE; |
| 43 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 42 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
| 44 virtual void AssignPictureBuffers( | 43 virtual void AssignPictureBuffers( |
| 45 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | 44 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
| 46 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 45 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
| 47 virtual void Flush() OVERRIDE; | 46 virtual void Flush() OVERRIDE; |
| 48 virtual void Reset() OVERRIDE; | 47 virtual void Reset() OVERRIDE; |
| 49 virtual void Destroy() OVERRIDE; | 48 virtual void Destroy() OVERRIDE; |
| 49 virtual bool CanDecodeOnIOThread() OVERRIDE; |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 enum State { | 52 enum State { |
| 53 NO_ERROR, | 53 NO_ERROR, |
| 54 ERROR, | 54 ERROR, |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 static const base::TimeDelta kDecodePollDelay; | 57 static const base::TimeDelta kDecodePollDelay; |
| 58 | 58 |
| 59 virtual ~AndroidVideoDecodeAccelerator(); | 59 virtual ~AndroidVideoDecodeAccelerator(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 // WeakPtrFactory for posting tasks back to |this|. | 164 // WeakPtrFactory for posting tasks back to |this|. |
| 165 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 165 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
| 166 | 166 |
| 167 friend class AndroidVideoDecodeAcceleratorTest; | 167 friend class AndroidVideoDecodeAcceleratorTest; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 } // namespace content | 170 } // namespace content |
| 171 | 171 |
| 172 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 172 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |