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 <vector>
      9 
     10 #include "media/base/media_export.h"
     11 #include "ui/gfx/size.h"
     12 
     13 namespace media {
     14 
     15 // TODO(wjia): this type should be defined in a common place and
     16 // shared with device manager.
     17 typedef int VideoCaptureSessionId;
     18 
     19 // Color formats from camera.
     20 enum VideoPixelFormat {
     21   PIXEL_FORMAT_UNKNOWN,  // Color format not set.
     22   PIXEL_FORMAT_I420,
     23   PIXEL_FORMAT_YUY2,
     24   PIXEL_FORMAT_UYVY,
     25   PIXEL_FORMAT_RGB24,
     26   PIXEL_FORMAT_ARGB,
     27   PIXEL_FORMAT_MJPEG,
     28   PIXEL_FORMAT_NV21,
     29   PIXEL_FORMAT_YV12,
     30   PIXEL_FORMAT_MAX,
     31 };
     32 
     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. It is also used to specify a
     36 // supported capture format by a device.
     37 class MEDIA_EXPORT VideoCaptureFormat {
     38  public:
     39   VideoCaptureFormat();
     40   VideoCaptureFormat(const gfx::Size& frame_size,
     41                      int frame_rate,
     42                      VideoPixelFormat pixel_format);
     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   gfx::Size frame_size;
     49   int frame_rate;
     50   VideoPixelFormat pixel_format;
     51 };
     52 
     53 typedef std::vector<VideoCaptureFormat> VideoCaptureFormats;
     54 
     55 // Parameters for starting video capture.
     56 // This class is used by the client of a video capture device to specify the
     57 // format of frames in which the client would like to have captured frames
     58 // returned.
     59 class MEDIA_EXPORT VideoCaptureParams {
     60  public:
     61   VideoCaptureParams();
     62 
     63   // Requests a resolution and format at which the capture will occur.
     64   VideoCaptureFormat requested_format;
     65 
     66   // Allow mid-capture resolution change.
     67   bool allow_resolution_change;
     68 };
     69 
     70 }  // namespace media
     71 
     72 #endif  // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_
     73