| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 | 11 |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <queue> | 13 #include <queue> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 21 #include "base/synchronization/waitable_event.h" | 21 #include "base/synchronization/waitable_event.h" |
| 22 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
| 23 #include "content/common/content_export.h" | 23 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" |
| 24 #include "content/common/gpu/media/gpu_video_decode_accelerator_helpers.h" | 24 #include "media/gpu/h264_decoder.h" |
| 25 #include "content/common/gpu/media/h264_decoder.h" | 25 #include "media/gpu/media_gpu_export.h" |
| 26 #include "content/common/gpu/media/v4l2_device.h" | 26 #include "media/gpu/v4l2_device.h" |
| 27 #include "content/common/gpu/media/vp8_decoder.h" | 27 #include "media/gpu/vp8_decoder.h" |
| 28 #include "media/video/video_decode_accelerator.h" | 28 #include "media/video/video_decode_accelerator.h" |
| 29 | 29 |
| 30 namespace content { | 30 namespace media { |
| 31 | 31 |
| 32 // An implementation of VideoDecodeAccelerator that utilizes the V4L2 slice | 32 // An implementation of VideoDecodeAccelerator that utilizes the V4L2 slice |
| 33 // level codec API for decoding. The slice level API provides only a low-level | 33 // level codec API for decoding. The slice level API provides only a low-level |
| 34 // decoding functionality and requires userspace to provide support for parsing | 34 // decoding functionality and requires userspace to provide support for parsing |
| 35 // the input stream and managing decoder state across frames. | 35 // the input stream and managing decoder state across frames. |
| 36 class CONTENT_EXPORT V4L2SliceVideoDecodeAccelerator | 36 class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator |
| 37 : public media::VideoDecodeAccelerator { | 37 : public media::VideoDecodeAccelerator { |
| 38 public: | 38 public: |
| 39 class V4L2DecodeSurface; | 39 class V4L2DecodeSurface; |
| 40 | 40 |
| 41 V4L2SliceVideoDecodeAccelerator( | 41 V4L2SliceVideoDecodeAccelerator( |
| 42 const scoped_refptr<V4L2Device>& device, | 42 const scoped_refptr<V4L2Device>& device, |
| 43 EGLDisplay egl_display, | 43 EGLDisplay egl_display, |
| 44 const GetGLContextCallback& get_gl_context_cb, | 44 const GetGLContextCallback& get_gl_context_cb, |
| 45 const MakeGLContextCurrentCallback& make_context_current_cb); | 45 const MakeGLContextCurrentCallback& make_context_current_cb); |
| 46 ~V4L2SliceVideoDecodeAccelerator() override; | 46 ~V4L2SliceVideoDecodeAccelerator() override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 57 void Flush() override; | 57 void Flush() override; |
| 58 void Reset() override; | 58 void Reset() override; |
| 59 void Destroy() override; | 59 void Destroy() override; |
| 60 bool TryToSetupDecodeOnSeparateThread( | 60 bool TryToSetupDecodeOnSeparateThread( |
| 61 const base::WeakPtr<Client>& decode_client, | 61 const base::WeakPtr<Client>& decode_client, |
| 62 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) | 62 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) |
| 63 override; | 63 override; |
| 64 media::VideoPixelFormat GetOutputFormat() const override; | 64 media::VideoPixelFormat GetOutputFormat() const override; |
| 65 | 65 |
| 66 static media::VideoDecodeAccelerator::SupportedProfiles | 66 static media::VideoDecodeAccelerator::SupportedProfiles |
| 67 GetSupportedProfiles(); | 67 GetSupportedProfiles(); |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 class V4L2H264Accelerator; | 70 class V4L2H264Accelerator; |
| 71 class V4L2VP8Accelerator; | 71 class V4L2VP8Accelerator; |
| 72 | 72 |
| 73 // Record for input buffers. | 73 // Record for input buffers. |
| 74 struct InputRecord { | 74 struct InputRecord { |
| 75 InputRecord(); | 75 InputRecord(); |
| 76 int32_t input_id; | 76 int32_t input_id; |
| 77 void* address; | 77 void* address; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 461 |
| 462 // The WeakPtrFactory for |weak_this_|. | 462 // The WeakPtrFactory for |weak_this_|. |
| 463 base::WeakPtrFactory<V4L2SliceVideoDecodeAccelerator> weak_this_factory_; | 463 base::WeakPtrFactory<V4L2SliceVideoDecodeAccelerator> weak_this_factory_; |
| 464 | 464 |
| 465 DISALLOW_COPY_AND_ASSIGN(V4L2SliceVideoDecodeAccelerator); | 465 DISALLOW_COPY_AND_ASSIGN(V4L2SliceVideoDecodeAccelerator); |
| 466 }; | 466 }; |
| 467 | 467 |
| 468 class V4L2H264Picture; | 468 class V4L2H264Picture; |
| 469 class V4L2VP8Picture; | 469 class V4L2VP8Picture; |
| 470 | 470 |
| 471 } // namespace content | 471 } // namespace media |
| 472 | 472 |
| 473 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ | 473 #endif // MEDIA_GPU_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |