Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 VideoDecodeAccelerator | 5 // This file contains an implementation of VideoDecodeAccelerator |
| 6 // that utilizes hardware video decoders, which expose Video4Linux 2 API | 6 // that utilizes hardware video decoders, which expose Video4Linux 2 API |
| 7 // (http://linuxtv.org/downloads/v4l-dvb-apis/). | 7 // (http://linuxtv.org/downloads/v4l-dvb-apis/). |
| 8 | 8 |
| 9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| 10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 off_t bytes_used; // bytes filled in the mmap() segment. | 148 off_t bytes_used; // bytes filled in the mmap() segment. |
| 149 int32 input_id; // triggering input_id as given to Decode(). | 149 int32 input_id; // triggering input_id as given to Decode(). |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 // Record for output buffers. | 152 // Record for output buffers. |
| 153 struct OutputRecord { | 153 struct OutputRecord { |
| 154 OutputRecord(); | 154 OutputRecord(); |
| 155 ~OutputRecord(); | 155 ~OutputRecord(); |
| 156 bool at_device; // held by device. | 156 bool at_device; // held by device. |
| 157 bool at_client; // held by client. | 157 bool at_client; // held by client. |
| 158 int fds[2]; // file descriptors for each plane. | |
| 159 EGLImageKHR egl_image; // EGLImageKHR for the output buffer. | 158 EGLImageKHR egl_image; // EGLImageKHR for the output buffer. |
| 160 EGLSyncKHR egl_sync; // sync the compositor's use of the EGLImage. | 159 EGLSyncKHR egl_sync; // sync the compositor's use of the EGLImage. |
| 161 int32 picture_id; // picture buffer id as returned to PictureReady(). | 160 int32 picture_id; // picture buffer id as returned to PictureReady(). |
| 162 bool cleared; // Whether the texture is cleared and safe to render | 161 bool cleared; // Whether the texture is cleared and safe to render |
| 163 // from. See TextureManager for details. | 162 // from. See TextureManager for details. |
| 164 }; | 163 }; |
| 165 | 164 |
| 166 // | 165 // |
| 167 // Decoding tasks, to be run on decode_thread_. | 166 // Decoding tasks, to be run on decode_thread_. |
| 168 // | 167 // |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 // caller can error out on resolution change. | 286 // caller can error out on resolution change. |
| 288 bool DestroyOutputBuffers(); | 287 bool DestroyOutputBuffers(); |
| 289 void ResolutionChangeDestroyBuffers(); | 288 void ResolutionChangeDestroyBuffers(); |
| 290 | 289 |
| 291 // Send decoded pictures to PictureReady. | 290 // Send decoded pictures to PictureReady. |
| 292 void SendPictureReady(); | 291 void SendPictureReady(); |
| 293 | 292 |
| 294 // Callback that indicates a picture has been cleared. | 293 // Callback that indicates a picture has been cleared. |
| 295 void PictureCleared(); | 294 void PictureCleared(); |
| 296 | 295 |
| 296 // This method determines whether a resolution change event processing | |
| 297 // is indeed required by returning true if either: | |
| 298 // - width or height of the new format is different than previous format. | |
| 299 // - V4L2_CID_MIN_BUFFERS_FOR_CAPTURE has changed. | |
| 300 // Returns false otherwise. | |
| 301 bool IsResolutionChangeNecessary(); | |
| 302 | |
| 297 // Our original calling message loop for the child thread. | 303 // Our original calling message loop for the child thread. |
| 298 scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; | 304 scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; |
| 299 | 305 |
| 300 // Message loop of the IO thread. | 306 // Message loop of the IO thread. |
| 301 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 307 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 302 | 308 |
| 303 // WeakPtr<> pointing to |this| for use in posting tasks from the decoder or | 309 // WeakPtr<> pointing to |this| for use in posting tasks from the decoder or |
| 304 // device worker threads back to the child thread. Because the worker threads | 310 // device worker threads back to the child thread. Because the worker threads |
| 305 // are members of this class, any task running on those threads is guaranteed | 311 // are members of this class, any task running on those threads is guaranteed |
| 306 // that this object is still alive. As a result, tasks posted from the child | 312 // that this object is still alive. As a result, tasks posted from the child |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 | 425 |
| 420 // Make our context current before running any EGL entry points. | 426 // Make our context current before running any EGL entry points. |
| 421 base::Callback<bool(void)> make_context_current_; | 427 base::Callback<bool(void)> make_context_current_; |
| 422 | 428 |
| 423 // EGL state | 429 // EGL state |
| 424 EGLDisplay egl_display_; | 430 EGLDisplay egl_display_; |
| 425 | 431 |
| 426 // The codec we'll be decoding for. | 432 // The codec we'll be decoding for. |
| 427 media::VideoCodecProfile video_profile_; | 433 media::VideoCodecProfile video_profile_; |
| 428 | 434 |
| 435 // Stores the number of planes (i.e. separate memory buffers) for output. | |
| 436 uint8 output_planes_count_; | |
|
Pawel Osciak
2014/03/28 06:21:46
s/uint8/size_t/
shivdasp
2014/03/28 06:40:43
Done.
| |
| 437 | |
| 429 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); | 438 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); |
| 430 }; | 439 }; |
| 431 | 440 |
| 432 } // namespace content | 441 } // namespace content |
| 433 | 442 |
| 434 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 443 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |