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 <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/synchronization/waitable_event.h" | 20 #include "base/synchronization/waitable_event.h" |
21 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
22 #include "content/common/content_export.h" | 22 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" |
23 #include "content/common/gpu/media/gpu_video_decode_accelerator_helpers.h" | 23 #include "media/gpu/h264_decoder.h" |
24 #include "content/common/gpu/media/h264_decoder.h" | 24 #include "media/gpu/media_gpu_export.h" |
25 #include "content/common/gpu/media/v4l2_device.h" | 25 #include "media/gpu/v4l2_device.h" |
26 #include "content/common/gpu/media/vp8_decoder.h" | 26 #include "media/gpu/vp8_decoder.h" |
27 #include "media/video/video_decode_accelerator.h" | 27 #include "media/video/video_decode_accelerator.h" |
28 | 28 |
29 namespace content { | 29 namespace media { |
30 | 30 |
31 // An implementation of VideoDecodeAccelerator that utilizes the V4L2 slice | 31 // An implementation of VideoDecodeAccelerator that utilizes the V4L2 slice |
32 // level codec API for decoding. The slice level API provides only a low-level | 32 // level codec API for decoding. The slice level API provides only a low-level |
33 // decoding functionality and requires userspace to provide support for parsing | 33 // decoding functionality and requires userspace to provide support for parsing |
34 // the input stream and managing decoder state across frames. | 34 // the input stream and managing decoder state across frames. |
35 class CONTENT_EXPORT V4L2SliceVideoDecodeAccelerator | 35 class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator |
36 : public media::VideoDecodeAccelerator { | 36 : public media::VideoDecodeAccelerator { |
37 public: | 37 public: |
38 class V4L2DecodeSurface; | 38 class V4L2DecodeSurface; |
39 | 39 |
40 V4L2SliceVideoDecodeAccelerator( | 40 V4L2SliceVideoDecodeAccelerator( |
41 const scoped_refptr<V4L2Device>& device, | 41 const scoped_refptr<V4L2Device>& device, |
42 EGLDisplay egl_display, | 42 EGLDisplay egl_display, |
43 const GetGLContextCallback& get_gl_context_cb, | 43 const GetGLContextCallback& get_gl_context_cb, |
44 const MakeGLContextCurrentCallback& make_context_current_cb); | 44 const MakeGLContextCurrentCallback& make_context_current_cb); |
45 ~V4L2SliceVideoDecodeAccelerator() override; | 45 ~V4L2SliceVideoDecodeAccelerator() override; |
46 | 46 |
47 // media::VideoDecodeAccelerator implementation. | 47 // media::VideoDecodeAccelerator implementation. |
48 bool Initialize(const Config& config, Client* client) override; | 48 bool Initialize(const Config& config, Client* client) override; |
49 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 49 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
50 void AssignPictureBuffers( | 50 void AssignPictureBuffers( |
51 const std::vector<media::PictureBuffer>& buffers) override; | 51 const std::vector<media::PictureBuffer>& buffers) override; |
52 void ReusePictureBuffer(int32_t picture_buffer_id) override; | 52 void ReusePictureBuffer(int32_t picture_buffer_id) override; |
53 void Flush() override; | 53 void Flush() override; |
54 void Reset() override; | 54 void Reset() override; |
55 void Destroy() override; | 55 void Destroy() override; |
56 bool TryToSetupDecodeOnSeparateThread( | 56 bool TryToSetupDecodeOnSeparateThread( |
57 const base::WeakPtr<Client>& decode_client, | 57 const base::WeakPtr<Client>& decode_client, |
58 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) | 58 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) |
59 override; | 59 override; |
60 | 60 |
61 static media::VideoDecodeAccelerator::SupportedProfiles | 61 static media::VideoDecodeAccelerator::SupportedProfiles |
62 GetSupportedProfiles(); | 62 GetSupportedProfiles(); |
63 | 63 |
64 private: | 64 private: |
65 class V4L2H264Accelerator; | 65 class V4L2H264Accelerator; |
66 class V4L2VP8Accelerator; | 66 class V4L2VP8Accelerator; |
67 | 67 |
68 // Record for input buffers. | 68 // Record for input buffers. |
69 struct InputRecord { | 69 struct InputRecord { |
70 InputRecord(); | 70 InputRecord(); |
71 int32_t input_id; | 71 int32_t input_id; |
72 void* address; | 72 void* address; |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 394 |
395 // The WeakPtrFactory for |weak_this_|. | 395 // The WeakPtrFactory for |weak_this_|. |
396 base::WeakPtrFactory<V4L2SliceVideoDecodeAccelerator> weak_this_factory_; | 396 base::WeakPtrFactory<V4L2SliceVideoDecodeAccelerator> weak_this_factory_; |
397 | 397 |
398 DISALLOW_COPY_AND_ASSIGN(V4L2SliceVideoDecodeAccelerator); | 398 DISALLOW_COPY_AND_ASSIGN(V4L2SliceVideoDecodeAccelerator); |
399 }; | 399 }; |
400 | 400 |
401 class V4L2H264Picture; | 401 class V4L2H264Picture; |
402 class V4L2VP8Picture; | 402 class V4L2VP8Picture; |
403 | 403 |
404 } // namespace content | 404 } // namespace media |
405 | 405 |
406 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ | 406 #endif // MEDIA_GPU_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |