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 // |visible_size| could be nullptr and ignored. |
248 // Create output buffers for the given |format|. | 248 bool GetFormatInfo(struct v4l2_format* format, |
249 bool CreateBuffersForFormat(const struct v4l2_format& format); | 249 gfx::Size* visible_size, |
250 bool* again); | |
251 // Create output buffers for the given |format| and |visible_size|. | |
252 bool CreateBuffersForFormat(const struct v4l2_format& format, | |
253 const gfx::Size& visible_size); | |
254 | |
255 // Try to get |visible_size|. Return visible size. Fallback to |coded_size| if | |
256 // cropping is not supported or the crop size is not inside |coded_size|. | |
Pawel Osciak
2015/03/04 10:50:22
Mentioning cropping is not really relevant here I
kcwu
2015/03/04 13:05:04
Done.
| |
257 gfx::Size GetVisibleSize(const gfx::Size& coded_size); | |
250 | 258 |
251 // | 259 // |
252 // Device tasks, to be run on device_poll_thread_. | 260 // Device tasks, to be run on device_poll_thread_. |
253 // | 261 // |
254 | 262 |
255 // The device task. | 263 // The device task. |
256 void DevicePollTask(bool poll_device); | 264 void DevicePollTask(bool poll_device); |
257 | 265 |
258 // | 266 // |
259 // Safe from any thread. | 267 // 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. | 416 // Pictures that are ready but not sent to PictureReady yet. |
409 std::queue<PictureRecord> pending_picture_ready_; | 417 std::queue<PictureRecord> pending_picture_ready_; |
410 | 418 |
411 // The number of pictures that are sent to PictureReady and will be cleared. | 419 // The number of pictures that are sent to PictureReady and will be cleared. |
412 int picture_clearing_count_; | 420 int picture_clearing_count_; |
413 | 421 |
414 // Used by the decoder thread to wait for AssignPictureBuffers to arrive | 422 // Used by the decoder thread to wait for AssignPictureBuffers to arrive |
415 // to avoid races with potential Reset requests. | 423 // to avoid races with potential Reset requests. |
416 base::WaitableEvent pictures_assigned_; | 424 base::WaitableEvent pictures_assigned_; |
417 | 425 |
418 // Output picture size. | 426 // Output picture coded size. |
419 gfx::Size frame_buffer_size_; | 427 gfx::Size coded_size_; |
428 | |
429 // Output picture visible size. | |
430 gfx::Size visible_size_; | |
420 | 431 |
421 // | 432 // |
422 // The device polling thread handles notifications of V4L2 device changes. | 433 // The device polling thread handles notifications of V4L2 device changes. |
423 // | 434 // |
424 | 435 |
425 // The thread. | 436 // The thread. |
426 base::Thread device_poll_thread_; | 437 base::Thread device_poll_thread_; |
427 | 438 |
428 // | 439 // |
429 // Other state, held by the child (main) thread. | 440 // Other state, held by the child (main) thread. |
(...skipping 13 matching lines...) Expand all Loading... | |
443 | 454 |
444 // The WeakPtrFactory for |weak_this_|. | 455 // The WeakPtrFactory for |weak_this_|. |
445 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; | 456 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; |
446 | 457 |
447 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); | 458 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); |
448 }; | 459 }; |
449 | 460 |
450 } // namespace content | 461 } // namespace content |
451 | 462 |
452 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 463 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |