video_capture_types.cc revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
1// Copyright 2013 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#include "media/video/capture/video_capture_types.h" 6 7#include "media/base/limits.h" 8 9namespace media { 10 11VideoCaptureFormat::VideoCaptureFormat() 12 : frame_rate(0), pixel_format(PIXEL_FORMAT_UNKNOWN) {} 13 14VideoCaptureFormat::VideoCaptureFormat(const gfx::Size& frame_size, 15 int frame_rate, 16 VideoPixelFormat pixel_format) 17 : frame_size(frame_size), 18 frame_rate(frame_rate), 19 pixel_format(pixel_format) {} 20 21bool VideoCaptureFormat::IsValid() const { 22 return (frame_size.width() < media::limits::kMaxDimension) && 23 (frame_size.height() < media::limits::kMaxDimension) && 24 (frame_size.GetArea() >= 0) && 25 (frame_size.GetArea() < media::limits::kMaxCanvas) && 26 (frame_rate > 0) && 27 (frame_rate < media::limits::kMaxFramesPerSecond) && 28 (pixel_format >= PIXEL_FORMAT_UNKNOWN) && 29 (pixel_format < PIXEL_FORMAT_MAX); 30} 31 32VideoCaptureParams::VideoCaptureParams() : allow_resolution_change(false) {} 33 34} // namespace media 35