- add sources.
[platform/framework/web/crosswalk.git] / src / media / video / capture / video_capture_types.h
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_
6 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_
7
8 #include "media/base/video_frame.h"
9
10 namespace media {
11
12 // TODO(wjia): this type should be defined in a common place and
13 // shared with device manager.
14 typedef int VideoCaptureSessionId;
15
16 enum VideoCaptureResolutionType {
17   ConstantResolutionVideoCaptureDevice = 0,
18   VariableResolutionVideoCaptureDevice,
19   MaxVideoCaptureResolutionType,  // Must be last.
20 };
21
22 // Color formats from camera.
23 enum VideoPixelFormat {
24   PIXEL_FORMAT_UNKNOWN,  // Color format not set.
25   PIXEL_FORMAT_I420,
26   PIXEL_FORMAT_YUY2,
27   PIXEL_FORMAT_UYVY,
28   PIXEL_FORMAT_RGB24,
29   PIXEL_FORMAT_ARGB,
30   PIXEL_FORMAT_MJPEG,
31   PIXEL_FORMAT_NV21,
32   PIXEL_FORMAT_YV12,
33 };
34
35 // Video capture format specification.
36 class MEDIA_EXPORT VideoCaptureFormat {
37  public:
38   VideoCaptureFormat();
39   VideoCaptureFormat(int width,
40                      int height,
41                      int frame_rate,
42                      VideoCaptureResolutionType frame_size_type);
43
44   // Checks that all values are in the expected range. All limits are specified
45   // in media::Limits.
46   bool IsValid() const;
47
48   int width;
49   int height;
50   int frame_rate;
51   VideoCaptureResolutionType frame_size_type;
52 };
53
54 // Parameters for starting video capture.
55 class MEDIA_EXPORT VideoCaptureParams {
56  public:
57   VideoCaptureParams();
58   // Identifies which device is to be started.
59   VideoCaptureSessionId session_id;
60
61   // Requests a resolution and format at which the capture will occur.
62   VideoCaptureFormat requested_format;
63 };
64
65 // Capabilities describe the format a camera captures video in.
66 class MEDIA_EXPORT VideoCaptureCapability : public VideoCaptureFormat {
67  public:
68   VideoCaptureCapability();
69   VideoCaptureCapability(int width,
70                          int height,
71                          int frame_rate,
72                          VideoPixelFormat color,
73                          VideoCaptureResolutionType frame_size_type);
74
75   VideoPixelFormat color;      // Desired video type.
76 };
77
78 typedef std::vector<VideoCaptureCapability> VideoCaptureCapabilities;
79
80 }  // namespace media
81
82 #endif  // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_