Home | History | Annotate | Download | only in capture
      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 // Parameters for starting video capture and device information.
     23 struct VideoCaptureParams {
     24   VideoCaptureParams()
     25       : width(0),
     26         height(0),
     27         frame_per_second(0),
     28         session_id(0),
     29         frame_size_type(ConstantResolutionVideoCaptureDevice) {};
     30   int width;
     31   int height;
     32   int frame_per_second;
     33   VideoCaptureSessionId session_id;
     34   VideoCaptureResolutionType frame_size_type;
     35 };
     36 
     37 // Capabilities describe the format a camera capture video in.
     38 struct VideoCaptureCapability {
     39   // Color formats from camera.
     40   enum Format {
     41     kColorUnknown,  // Color format not set.
     42     kI420,
     43     kYUY2,
     44     kUYVY,
     45     kRGB24,
     46     kARGB,
     47     kMJPEG,
     48     kNV21,
     49     kYV12,
     50   };
     51 
     52   VideoCaptureCapability()
     53       : width(0),
     54         height(0),
     55         frame_rate(0),
     56         color(kColorUnknown),
     57         expected_capture_delay(0),
     58         interlaced(false),
     59         frame_size_type(ConstantResolutionVideoCaptureDevice),
     60         session_id(0) {};
     61   VideoCaptureCapability(int width,
     62                          int height,
     63                          int frame_rate,
     64                          Format color,
     65                          int delay,
     66                          bool interlaced,
     67                          VideoCaptureResolutionType frame_size_type)
     68       : width(width),
     69         height(height),
     70         frame_rate(frame_rate),
     71         color(color),
     72         expected_capture_delay(delay),
     73         interlaced(interlaced),
     74         frame_size_type(frame_size_type),
     75         session_id(0) {};
     76 
     77   int width;                   // Desired width.
     78   int height;                  // Desired height.
     79   int frame_rate;              // Desired frame rate.
     80   Format color;                // Desired video type.
     81   int expected_capture_delay;  // Expected delay in millisecond.
     82   bool interlaced;             // Need interlace format.
     83   VideoCaptureResolutionType frame_size_type;
     84   VideoCaptureSessionId session_id;
     85 };
     86 
     87 }  // namespace media
     88 
     89 #endif  // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_
     90