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 defines the V4L2Device interface which is used by the | 5 // This file defines the V4L2Device interface which is used by the |
6 // V4L2DecodeAccelerator class to delegate/pass the device specific | 6 // V4L2DecodeAccelerator class to delegate/pass the device specific |
7 // handling of any of the functionalities. | 7 // handling of any of the functionalities. |
8 | 8 |
9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ | 9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ |
10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ | 10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "media/base/video_decoder_config.h" | 14 #include "media/base/video_decoder_config.h" |
15 #include "media/base/video_frame.h" | 15 #include "media/base/video_frame.h" |
| 16 #include "media/video/video_decode_accelerator.h" |
| 17 #include "media/video/video_encode_accelerator.h" |
16 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
17 #include "ui/gl/gl_bindings.h" | 19 #include "ui/gl/gl_bindings.h" |
18 | 20 |
19 namespace content { | 21 namespace content { |
20 | 22 |
21 class CONTENT_EXPORT V4L2Device | 23 class CONTENT_EXPORT V4L2Device |
22 : public base::RefCountedThreadSafe<V4L2Device> { | 24 : public base::RefCountedThreadSafe<V4L2Device> { |
23 public: | 25 public: |
24 // Utility format conversion functions | 26 // Utility format conversion functions |
25 static media::VideoFrame::Format V4L2PixFmtToVideoFrameFormat(uint32 format); | 27 static media::VideoFrame::Format V4L2PixFmtToVideoFrameFormat(uint32 format); |
26 static uint32 VideoFrameFormatToV4L2PixFmt(media::VideoFrame::Format format); | 28 static uint32 VideoFrameFormatToV4L2PixFmt(media::VideoFrame::Format format); |
27 static uint32 VideoCodecProfileToV4L2PixFmt(media::VideoCodecProfile profile, | 29 static uint32 VideoCodecProfileToV4L2PixFmt(media::VideoCodecProfile profile, |
28 bool slice_based); | 30 bool slice_based); |
29 static uint32_t V4L2PixFmtToDrmFormat(uint32_t format); | 31 static uint32_t V4L2PixFmtToDrmFormat(uint32_t format); |
30 // Convert format requirements requested by a V4L2 device to gfx::Size. | 32 // Convert format requirements requested by a V4L2 device to gfx::Size. |
31 static gfx::Size CodedSizeFromV4L2Format(struct v4l2_format format); | 33 static gfx::Size CodedSizeFromV4L2Format(struct v4l2_format format); |
32 | 34 |
33 enum Type { | 35 enum Type { |
34 kDecoder, | 36 kDecoder, |
35 kEncoder, | 37 kEncoder, |
36 kImageProcessor, | 38 kImageProcessor, |
37 }; | 39 }; |
38 | 40 |
39 // Creates and initializes an appropriate V4L2Device of |type| for the | 41 // Creates and initializes an appropriate V4L2Device of |type| for the |
40 // current platform and returns a scoped_ptr<V4L2Device> on success, or NULL. | 42 // current platform and returns a scoped_ptr<V4L2Device> on success, or NULL. |
41 static scoped_refptr<V4L2Device> Create(Type type); | 43 static scoped_refptr<V4L2Device> Create(Type type); |
42 | 44 |
| 45 static std::vector<media::VideoDecodeAccelerator::SupportedProfile> |
| 46 GetSupportedDecodeProfiles(); |
| 47 |
| 48 static std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
| 49 GetSupportedEncodeProfiles(); |
| 50 |
43 // Parameters and return value are the same as for the standard ioctl() system | 51 // Parameters and return value are the same as for the standard ioctl() system |
44 // call. | 52 // call. |
45 virtual int Ioctl(int request, void* arg) = 0; | 53 virtual int Ioctl(int request, void* arg) = 0; |
46 | 54 |
47 // This method sleeps until either: | 55 // This method sleeps until either: |
48 // - SetDevicePollInterrupt() is called (on another thread), | 56 // - SetDevicePollInterrupt() is called (on another thread), |
49 // - |poll_device| is true, and there is new data to be read from the device, | 57 // - |poll_device| is true, and there is new data to be read from the device, |
50 // or an event from the device has arrived; in the latter case | 58 // or an event from the device has arrived; in the latter case |
51 // |*event_pending| will be set to true. | 59 // |*event_pending| will be set to true. |
52 // Returns false on error, true otherwise. | 60 // Returns false on error, true otherwise. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 virtual uint32 PreferredInputFormat() = 0; | 110 virtual uint32 PreferredInputFormat() = 0; |
103 | 111 |
104 protected: | 112 protected: |
105 friend class base::RefCountedThreadSafe<V4L2Device>; | 113 friend class base::RefCountedThreadSafe<V4L2Device>; |
106 virtual ~V4L2Device(); | 114 virtual ~V4L2Device(); |
107 }; | 115 }; |
108 | 116 |
109 } // namespace content | 117 } // namespace content |
110 | 118 |
111 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ | 119 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_DEVICE_H_ |
OLD | NEW |