OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_ | 5 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_ |
6 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_ | 6 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_ |
7 | 7 |
8 #include "media/base/video_frame.h" | 8 #include <vector> |
| 9 |
| 10 #include "media/base/media_export.h" |
| 11 #include "ui/gfx/size.h" |
9 | 12 |
10 namespace media { | 13 namespace media { |
11 | 14 |
12 // TODO(wjia): this type should be defined in a common place and | 15 // TODO(wjia): this type should be defined in a common place and |
13 // shared with device manager. | 16 // shared with device manager. |
14 typedef int VideoCaptureSessionId; | 17 typedef int VideoCaptureSessionId; |
15 | 18 |
16 enum VideoCaptureResolutionType { | |
17 ConstantResolutionVideoCaptureDevice = 0, | |
18 VariableResolutionVideoCaptureDevice, | |
19 MaxVideoCaptureResolutionType, // Must be last. | |
20 }; | |
21 | |
22 // Color formats from camera. | 19 // Color formats from camera. |
23 enum VideoPixelFormat { | 20 enum VideoPixelFormat { |
24 PIXEL_FORMAT_UNKNOWN, // Color format not set. | 21 PIXEL_FORMAT_UNKNOWN, // Color format not set. |
25 PIXEL_FORMAT_I420, | 22 PIXEL_FORMAT_I420, |
26 PIXEL_FORMAT_YUY2, | 23 PIXEL_FORMAT_YUY2, |
27 PIXEL_FORMAT_UYVY, | 24 PIXEL_FORMAT_UYVY, |
28 PIXEL_FORMAT_RGB24, | 25 PIXEL_FORMAT_RGB24, |
29 PIXEL_FORMAT_ARGB, | 26 PIXEL_FORMAT_ARGB, |
30 PIXEL_FORMAT_MJPEG, | 27 PIXEL_FORMAT_MJPEG, |
31 PIXEL_FORMAT_NV21, | 28 PIXEL_FORMAT_NV21, |
32 PIXEL_FORMAT_YV12, | 29 PIXEL_FORMAT_YV12, |
| 30 PIXEL_FORMAT_MAX, |
33 }; | 31 }; |
34 | 32 |
35 // Video capture format specification. | 33 // Video capture format specification. |
| 34 // This class is used by the video capture device to specify the format of every |
| 35 // frame captured and returned to a client. |
36 class MEDIA_EXPORT VideoCaptureFormat { | 36 class MEDIA_EXPORT VideoCaptureFormat { |
37 public: | 37 public: |
38 VideoCaptureFormat(); | 38 VideoCaptureFormat(); |
39 VideoCaptureFormat(int width, | 39 VideoCaptureFormat(const gfx::Size& frame_size, |
40 int height, | |
41 int frame_rate, | 40 int frame_rate, |
42 VideoCaptureResolutionType frame_size_type); | 41 VideoPixelFormat pixel_format); |
43 | 42 |
44 // Checks that all values are in the expected range. All limits are specified | 43 // Checks that all values are in the expected range. All limits are specified |
45 // in media::Limits. | 44 // in media::Limits. |
46 bool IsValid() const; | 45 bool IsValid() const; |
47 | 46 |
48 int width; | 47 gfx::Size frame_size; |
49 int height; | |
50 int frame_rate; | 48 int frame_rate; |
51 VideoCaptureResolutionType frame_size_type; | 49 VideoPixelFormat pixel_format; |
52 }; | 50 }; |
53 | 51 |
54 // Parameters for starting video capture. | 52 // Parameters for starting video capture. |
| 53 // This class is used by the client of a video capture device to specify the |
| 54 // format of frames in which the client would like to have captured frames |
| 55 // returned. |
55 class MEDIA_EXPORT VideoCaptureParams { | 56 class MEDIA_EXPORT VideoCaptureParams { |
56 public: | 57 public: |
57 VideoCaptureParams(); | 58 VideoCaptureParams(); |
58 // Identifies which device is to be started. | |
59 VideoCaptureSessionId session_id; | |
60 | 59 |
61 // Requests a resolution and format at which the capture will occur. | 60 // Requests a resolution and format at which the capture will occur. |
62 VideoCaptureFormat requested_format; | 61 VideoCaptureFormat requested_format; |
| 62 |
| 63 // Allow mid-capture resolution change. |
| 64 bool allow_resolution_change; |
63 }; | 65 }; |
64 | 66 |
65 // Capabilities describe the format a camera captures video in. | 67 // Capabilities describe the format a camera captures video in. |
66 class MEDIA_EXPORT VideoCaptureCapability : public VideoCaptureFormat { | 68 // This class is used by the video capture device to report the formats in which |
| 69 // it is capable of capturing frames. |
| 70 class MEDIA_EXPORT VideoCaptureCapability { |
67 public: | 71 public: |
68 VideoCaptureCapability(); | 72 VideoCaptureCapability(); |
69 VideoCaptureCapability(int width, | |
70 int height, | |
71 int frame_rate, | |
72 VideoPixelFormat color, | |
73 VideoCaptureResolutionType frame_size_type); | |
74 | 73 |
75 VideoPixelFormat color; // Desired video type. | 74 // Supported resolution and format. |
| 75 VideoCaptureFormat supported_format; |
76 }; | 76 }; |
77 | 77 |
78 typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities; | 78 typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities; |
79 | 79 |
80 } // namespace media | 80 } // namespace media |
81 | 81 |
82 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_ | 82 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_ |
OLD | NEW |