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> |
(...skipping 19 matching lines...) Expand all Loading... |
30 // class. http://developer.android.com/reference/android/media/MediaCodec.html | 30 // class. http://developer.android.com/reference/android/media/MediaCodec.html |
31 class CONTENT_EXPORT AndroidVideoDecodeAccelerator | 31 class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
32 : public media::VideoDecodeAccelerator { | 32 : public media::VideoDecodeAccelerator { |
33 public: | 33 public: |
34 // Does not take ownership of |client| which must outlive |*this|. | 34 // Does not take ownership of |client| which must outlive |*this|. |
35 AndroidVideoDecodeAccelerator( | 35 AndroidVideoDecodeAccelerator( |
36 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, | 36 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, |
37 const base::Callback<bool(void)>& make_context_current); | 37 const base::Callback<bool(void)>& make_context_current); |
38 | 38 |
39 // media::VideoDecodeAccelerator implementation. | 39 // media::VideoDecodeAccelerator implementation. |
40 virtual bool Initialize(media::VideoCodecProfile profile, | 40 bool Initialize(media::VideoCodecProfile profile, Client* client) override; |
41 Client* client) override; | 41 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
42 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 42 void AssignPictureBuffers( |
43 virtual void AssignPictureBuffers( | |
44 const std::vector<media::PictureBuffer>& buffers) override; | 43 const std::vector<media::PictureBuffer>& buffers) override; |
45 virtual void ReusePictureBuffer(int32 picture_buffer_id) override; | 44 void ReusePictureBuffer(int32 picture_buffer_id) override; |
46 virtual void Flush() override; | 45 void Flush() override; |
47 virtual void Reset() override; | 46 void Reset() override; |
48 virtual void Destroy() override; | 47 void Destroy() override; |
49 virtual bool CanDecodeOnIOThread() override; | 48 bool CanDecodeOnIOThread() override; |
50 | 49 |
51 private: | 50 private: |
52 enum State { | 51 enum State { |
53 NO_ERROR, | 52 NO_ERROR, |
54 ERROR, | 53 ERROR, |
55 }; | 54 }; |
56 | 55 |
57 static const base::TimeDelta kDecodePollDelay; | 56 static const base::TimeDelta kDecodePollDelay; |
58 | 57 |
59 virtual ~AndroidVideoDecodeAccelerator(); | 58 ~AndroidVideoDecodeAccelerator() override; |
60 | 59 |
61 // Configures |media_codec_| with the given codec parameters from the client. | 60 // Configures |media_codec_| with the given codec parameters from the client. |
62 bool ConfigureMediaCodec(); | 61 bool ConfigureMediaCodec(); |
63 | 62 |
64 // Sends the current picture on the surface to the client. | 63 // Sends the current picture on the surface to the client. |
65 void SendCurrentSurfaceToClient(int32 bitstream_id); | 64 void SendCurrentSurfaceToClient(int32 bitstream_id); |
66 | 65 |
67 // Does pending IO tasks if any. Once this is called, it polls |media_codec_| | 66 // Does pending IO tasks if any. Once this is called, it polls |media_codec_| |
68 // until it finishes pending tasks. For the polling, |kDecodePollDelay| is | 67 // until it finishes pending tasks. For the polling, |kDecodePollDelay| is |
69 // used. | 68 // used. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 162 |
164 // WeakPtrFactory for posting tasks back to |this|. | 163 // WeakPtrFactory for posting tasks back to |this|. |
165 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; | 164 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
166 | 165 |
167 friend class AndroidVideoDecodeAcceleratorTest; | 166 friend class AndroidVideoDecodeAcceleratorTest; |
168 }; | 167 }; |
169 | 168 |
170 } // namespace content | 169 } // namespace content |
171 | 170 |
172 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | 171 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |