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_ |
| 11 | 11 |
| 12 #include <queue> | 12 #include <queue> |
| 13 #include <vector> | 13 #include <vector> |
| 14 #include <linux/videodev2.h> | |
|
Pawel Osciak
2014/03/25 08:21:08
Why did we not need this before? If this is for v4
shivdasp
2014/03/25 10:36:40
This was for v4l2_format but now if we use frame_b
| |
| 14 | 15 |
| 15 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
| 16 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| 17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/synchronization/waitable_event.h" | 19 #include "base/synchronization/waitable_event.h" |
| 19 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
| 20 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
| 21 #include "content/common/gpu/media/v4l2_video_device.h" | 22 #include "content/common/gpu/media/v4l2_video_device.h" |
| 22 #include "content/common/gpu/media/video_decode_accelerator_impl.h" | 23 #include "content/common/gpu/media/video_decode_accelerator_impl.h" |
| 23 #include "media/base/limits.h" | 24 #include "media/base/limits.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 // caller can error out on resolution change. | 288 // caller can error out on resolution change. |
| 288 bool DestroyOutputBuffers(); | 289 bool DestroyOutputBuffers(); |
| 289 void ResolutionChangeDestroyBuffers(); | 290 void ResolutionChangeDestroyBuffers(); |
| 290 | 291 |
| 291 // Send decoded pictures to PictureReady. | 292 // Send decoded pictures to PictureReady. |
| 292 void SendPictureReady(); | 293 void SendPictureReady(); |
| 293 | 294 |
| 294 // Callback that indicates a picture has been cleared. | 295 // Callback that indicates a picture has been cleared. |
| 295 void PictureCleared(); | 296 void PictureCleared(); |
| 296 | 297 |
| 298 // This method determines whether a resolution change event processing | |
| 299 // is indeed required by returning true if either: | |
| 300 // - width or height of the new format is different than previous format. | |
| 301 // - V4L2_CID_MIN_BUFFERS_FOR_CAPTURE has changed. | |
| 302 // Returns false otherwise. | |
| 303 bool IsResolutionChangeNecessary(); | |
| 304 | |
| 297 // Our original calling message loop for the child thread. | 305 // Our original calling message loop for the child thread. |
| 298 scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; | 306 scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; |
| 299 | 307 |
| 300 // Message loop of the IO thread. | 308 // Message loop of the IO thread. |
| 301 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 309 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 302 | 310 |
| 303 // WeakPtr<> pointing to |this| for use in posting tasks from the decoder or | 311 // 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 | 312 // 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 | 313 // 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 | 314 // 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 | 427 |
| 420 // Make our context current before running any EGL entry points. | 428 // Make our context current before running any EGL entry points. |
| 421 base::Callback<bool(void)> make_context_current_; | 429 base::Callback<bool(void)> make_context_current_; |
| 422 | 430 |
| 423 // EGL state | 431 // EGL state |
| 424 EGLDisplay egl_display_; | 432 EGLDisplay egl_display_; |
| 425 | 433 |
| 426 // The codec we'll be decoding for. | 434 // The codec we'll be decoding for. |
| 427 media::VideoCodecProfile video_profile_; | 435 media::VideoCodecProfile video_profile_; |
| 428 | 436 |
| 437 // Stores the current format. This is used to check against | |
| 438 // the format received when we dequeue a RESOLUTION_CHANGE event. | |
| 439 // Resolution change sequence is only executed if the new format is different | |
| 440 // than the current_format_. | |
| 441 struct v4l2_format current_format_; | |
| 442 | |
| 429 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); | 443 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); |
| 430 }; | 444 }; |
| 431 | 445 |
| 432 } // namespace content | 446 } // namespace content |
| 433 | 447 |
| 434 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 448 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |