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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // media::VideoDecodeAccelerator implementation. | 49 // media::VideoDecodeAccelerator implementation. |
50 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE; | 50 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE; |
51 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | 51 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; |
52 virtual void AssignPictureBuffers( | 52 virtual void AssignPictureBuffers( |
53 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | 53 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; |
54 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | 54 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; |
55 virtual void Flush() OVERRIDE; | 55 virtual void Flush() OVERRIDE; |
56 virtual void Reset() OVERRIDE; | 56 virtual void Reset() OVERRIDE; |
57 virtual void Destroy() OVERRIDE; | 57 virtual void Destroy() OVERRIDE; |
58 | 58 |
59 // Do any necessary initialization before the sandbox is enabled. | 59 private: |
60 static void PreSandboxInitialization(); | |
61 | |
62 private: | |
63 // Ensure data has been synced with the output texture and notify | 60 // Ensure data has been synced with the output texture and notify |
64 // the client it is ready for displaying. | 61 // the client it is ready for displaying. |
65 void SyncAndNotifyPictureReady(int32 input_id, int32 output_id); | 62 void SyncAndNotifyPictureReady(int32 input_id, int32 output_id); |
66 | 63 |
67 // 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. |
68 void NotifyError(Error error); | 65 void NotifyError(Error error); |
69 | 66 |
70 // Map the received input buffer into this process' address space and | 67 // Map the received input buffer into this process' address space and |
71 // queue it for decode. | 68 // queue it for decode. |
72 void MapAndQueueNewInputBuffer( | 69 void MapAndQueueNewInputBuffer( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 void ResetTask(); | 115 void ResetTask(); |
119 | 116 |
120 // Scheduled by ResetTask after it's done putting VAVDA into an idle state. | 117 // Scheduled by ResetTask after it's done putting VAVDA into an idle state. |
121 // Drops remaining input buffers and notifies the client that reset has been | 118 // Drops remaining input buffers and notifies the client that reset has been |
122 // finished. | 119 // finished. |
123 void FinishReset(); | 120 void FinishReset(); |
124 | 121 |
125 // Helper for Destroy(), doing all the actual work except for deleting self. | 122 // Helper for Destroy(), doing all the actual work except for deleting self. |
126 void Cleanup(); | 123 void Cleanup(); |
127 | 124 |
128 // Lazily initialize static data after sandbox is enabled. Return false on | |
129 // init failure. | |
130 static bool PostSandboxInitialization(); | |
131 | |
132 // Client-provided X/GLX state. | 125 // Client-provided X/GLX state. |
133 Display* x_display_; | 126 Display* x_display_; |
134 GLXContext glx_context_; | 127 GLXContext glx_context_; |
135 base::Callback<bool(void)> make_context_current_; | 128 base::Callback<bool(void)> make_context_current_; |
136 | 129 |
137 // VAVDA state. | 130 // VAVDA state. |
138 enum State { | 131 enum State { |
139 // Initialize() not called yet or failed. | 132 // Initialize() not called yet or failed. |
140 kUninitialized, | 133 kUninitialized, |
141 // Initialize() succeeded, no initial decode and no pictures requested. | 134 // Initialize() succeeded, no initial decode and no pictures requested. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 content::VaapiH264Decoder decoder_; | 197 content::VaapiH264Decoder decoder_; |
205 | 198 |
206 // Callback passed to the decoder, which it will use to signal readiness | 199 // Callback passed to the decoder, which it will use to signal readiness |
207 // of an output picture to be displayed. | 200 // of an output picture to be displayed. |
208 void OutputPicCallback(int32 input_id, int32 output_id); | 201 void OutputPicCallback(int32 input_id, int32 output_id); |
209 | 202 |
210 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 203 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
211 }; | 204 }; |
212 | 205 |
213 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 206 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |