blob: 36314f9ea6c27364012f69d1e14eaaa3371eefe9 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_
#define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_
#include <vector>
#include "media/base/media_export.h"
#include "ui/gfx/size.h"
namespace media {
// TODO(wjia): this type should be defined in a common place and
// shared with device manager.
typedef int VideoCaptureSessionId;
// Color formats from camera.
enum VideoPixelFormat {
PIXEL_FORMAT_UNKNOWN, // Color format not set.
PIXEL_FORMAT_I420,
PIXEL_FORMAT_YUY2,
PIXEL_FORMAT_UYVY,
PIXEL_FORMAT_RGB24,
PIXEL_FORMAT_ARGB,
PIXEL_FORMAT_MJPEG,
PIXEL_FORMAT_NV21,
PIXEL_FORMAT_YV12,
PIXEL_FORMAT_TEXTURE, // Capture format as a GL texture.
PIXEL_FORMAT_MAX,
};
// Video capture format specification.
// This class is used by the video capture device to specify the format of every
// frame captured and returned to a client. It is also used to specify a
// supported capture format by a device.
class MEDIA_EXPORT VideoCaptureFormat {
public:
VideoCaptureFormat();
VideoCaptureFormat(const gfx::Size& frame_size,
int frame_rate,
VideoPixelFormat pixel_format);
// Checks that all values are in the expected range. All limits are specified
// in media::Limits.
bool IsValid() const;
gfx::Size frame_size;
int frame_rate;
VideoPixelFormat pixel_format;
};
typedef std::vector<VideoCaptureFormat> VideoCaptureFormats;
// Parameters for starting video capture.
// This class is used by the client of a video capture device to specify the
// format of frames in which the client would like to have captured frames
// returned.
class MEDIA_EXPORT VideoCaptureParams {
public:
VideoCaptureParams();
// Requests a resolution and format at which the capture will occur.
VideoCaptureFormat requested_format;
// Allow mid-capture resolution change.
bool allow_resolution_change;
};
} // namespace media
#endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_