| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 // Attempt to start/stop device_poll_thread_. | 236 // Attempt to start/stop device_poll_thread_. |
| 237 bool StartDevicePoll(); | 237 bool StartDevicePoll(); |
| 238 // If |keep_input_state| is true, don't reset input state; used during | 238 // If |keep_input_state| is true, don't reset input state; used during |
| 239 // resolution change. | 239 // resolution change. |
| 240 bool StopDevicePoll(bool keep_input_state); | 240 bool StopDevicePoll(bool keep_input_state); |
| 241 | 241 |
| 242 void StartResolutionChangeIfNeeded(); | 242 void StartResolutionChangeIfNeeded(); |
| 243 void FinishResolutionChange(); | 243 void FinishResolutionChange(); |
| 244 | 244 |
| 245 // Try to get output format, detected after parsing the beginning | 245 // Try to get output format and visible size, detected after parsing the |
| 246 // of the stream. Sets |again| to true if more parsing is needed. | 246 // beginning of the stream. Sets |again| to true if more parsing is needed. |
| 247 bool GetFormatInfo(struct v4l2_format* format, bool* again); | 247 bool GetFormatInfo(struct v4l2_format* format, |
| 248 // Create output buffers for the given |format|. | 248 gfx::Size* visible_size, |
| 249 bool CreateBuffersForFormat(const struct v4l2_format& format); | 249 bool* again); |
| 250 // Create output buffers for the given |format| and |visible_size|. |
| 251 bool CreateBuffersForFormat(const struct v4l2_format& format, |
| 252 const gfx::Size& visible_size); |
| 253 |
| 254 // Try to get |visible_size|. Return false if cropping is not supported or the |
| 255 // crop size is not inside |coded_size|. |
| 256 bool GetVisibleSize(const gfx::Size& coded_size, gfx::Size* visible_size); |
| 250 | 257 |
| 251 // | 258 // |
| 252 // Device tasks, to be run on device_poll_thread_. | 259 // Device tasks, to be run on device_poll_thread_. |
| 253 // | 260 // |
| 254 | 261 |
| 255 // The device task. | 262 // The device task. |
| 256 void DevicePollTask(bool poll_device); | 263 void DevicePollTask(bool poll_device); |
| 257 | 264 |
| 258 // | 265 // |
| 259 // Safe from any thread. | 266 // Safe from any thread. |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 // Pictures that are ready but not sent to PictureReady yet. | 415 // Pictures that are ready but not sent to PictureReady yet. |
| 409 std::queue<PictureRecord> pending_picture_ready_; | 416 std::queue<PictureRecord> pending_picture_ready_; |
| 410 | 417 |
| 411 // The number of pictures that are sent to PictureReady and will be cleared. | 418 // The number of pictures that are sent to PictureReady and will be cleared. |
| 412 int picture_clearing_count_; | 419 int picture_clearing_count_; |
| 413 | 420 |
| 414 // Used by the decoder thread to wait for AssignPictureBuffers to arrive | 421 // Used by the decoder thread to wait for AssignPictureBuffers to arrive |
| 415 // to avoid races with potential Reset requests. | 422 // to avoid races with potential Reset requests. |
| 416 base::WaitableEvent pictures_assigned_; | 423 base::WaitableEvent pictures_assigned_; |
| 417 | 424 |
| 418 // Output picture size. | 425 // Output picture coded size. |
| 419 gfx::Size frame_buffer_size_; | 426 gfx::Size coded_size_; |
| 427 |
| 428 // Output picture visible size. |
| 429 gfx::Size visible_size_; |
| 420 | 430 |
| 421 // | 431 // |
| 422 // The device polling thread handles notifications of V4L2 device changes. | 432 // The device polling thread handles notifications of V4L2 device changes. |
| 423 // | 433 // |
| 424 | 434 |
| 425 // The thread. | 435 // The thread. |
| 426 base::Thread device_poll_thread_; | 436 base::Thread device_poll_thread_; |
| 427 | 437 |
| 428 // | 438 // |
| 429 // Other state, held by the child (main) thread. | 439 // Other state, held by the child (main) thread. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 443 | 453 |
| 444 // The WeakPtrFactory for |weak_this_|. | 454 // The WeakPtrFactory for |weak_this_|. |
| 445 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; | 455 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; |
| 446 | 456 |
| 447 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); | 457 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); |
| 448 }; | 458 }; |
| 449 | 459 |
| 450 } // namespace content | 460 } // namespace content |
| 451 | 461 |
| 452 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 462 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |