OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains an implementation of VideoDecoderAccelerator | 5 // This file contains an implementation of VideoDecoderAccelerator |
6 // that utilizes hardware video decoder present on Intel CPUs. | 6 // that utilizes hardware video decoder present on Intel CPUs. |
7 | 7 |
8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Decoding tasks are performed in a separate decoding thread. | 34 // Decoding tasks are performed in a separate decoding thread. |
35 // | 35 // |
36 // Threading/life-cycle: this object is created & destroyed on the GPU | 36 // Threading/life-cycle: this object is created & destroyed on the GPU |
37 // ChildThread. A few methods on it are called on the decoder thread which is | 37 // ChildThread. A few methods on it are called on the decoder thread which is |
38 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread | 38 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread |
39 // can assume |*this| is still alive. See |weak_this_| below for more details. | 39 // can assume |*this| is still alive. See |weak_this_| below for more details. |
40 class CONTENT_EXPORT VaapiVideoDecodeAccelerator : | 40 class CONTENT_EXPORT VaapiVideoDecodeAccelerator : |
41 public media::VideoDecodeAccelerator { | 41 public media::VideoDecodeAccelerator { |
42 public: | 42 public: |
43 VaapiVideoDecodeAccelerator( | 43 VaapiVideoDecodeAccelerator( |
| 44 Display* x_display, GLXContext glx_context, |
44 Client* client, | 45 Client* client, |
45 const base::Callback<bool(void)>& make_context_current); | 46 const base::Callback<bool(void)>& make_context_current); |
46 virtual ~VaapiVideoDecodeAccelerator(); | 47 virtual ~VaapiVideoDecodeAccelerator(); |
47 | 48 |
48 // media::VideoDecodeAccelerator implementation. | 49 // media::VideoDecodeAccelerator implementation. |
49 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE; | 50 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE; |
50 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 51 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
51 virtual void AssignPictureBuffers( | 52 virtual void AssignPictureBuffers( |
52 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | 53 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
53 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 54 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
54 virtual void Flush() OVERRIDE; | 55 virtual void Flush() OVERRIDE; |
55 virtual void Reset() OVERRIDE; | 56 virtual void Reset() OVERRIDE; |
56 virtual void Destroy() OVERRIDE; | 57 virtual void Destroy() OVERRIDE; |
57 | 58 |
58 // Used by user of this class to pass X/GLX state. | |
59 void SetGlxState(Display* x_display, GLXContext glx_context); | |
60 | |
61 private: | 59 private: |
62 // Ensure data has been synced with the output texture and notify | 60 // Ensure data has been synced with the output texture and notify |
63 // the client it is ready for displaying. | 61 // the client it is ready for displaying. |
64 void SyncAndNotifyPictureReady(int32 input_id, int32 output_id); | 62 void SyncAndNotifyPictureReady(int32 input_id, int32 output_id); |
65 | 63 |
66 // Notify the client that an error has occurred and decoding cannot continue. | 64 // Notify the client that an error has occurred and decoding cannot continue. |
67 void NotifyError(Error error); | 65 void NotifyError(Error error); |
68 | 66 |
69 // Map the received input buffer into this process' address space and | 67 // Map the received input buffer into this process' address space and |
70 // queue it for decode. | 68 // queue it for decode. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 content::VaapiH264Decoder decoder_; | 196 content::VaapiH264Decoder decoder_; |
199 | 197 |
200 // Callback passed to the decoder, which it will use to signal readiness | 198 // Callback passed to the decoder, which it will use to signal readiness |
201 // of an output picture to be displayed. | 199 // of an output picture to be displayed. |
202 void OutputPicCallback(int32 input_id, int32 output_id); | 200 void OutputPicCallback(int32 input_id, int32 output_id); |
203 | 201 |
204 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 202 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
205 }; | 203 }; |
206 | 204 |
207 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 205 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |