7dcc7a02e7f6fbefddc19d37109b51776974537b
[platform/framework/web/crosswalk.git] / src / media / video / capture / video_capture_types.cc
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
9 namespace media {
10
11 VideoCaptureFormat::VideoCaptureFormat()
12     : frame_rate(0), pixel_format(PIXEL_FORMAT_UNKNOWN) {}
13
14 VideoCaptureFormat::VideoCaptureFormat(const gfx::Size& frame_size,
15                                        float frame_rate,
16                                        VideoPixelFormat pixel_format)
17     : frame_size(frame_size),
18       frame_rate(frame_rate),
19       pixel_format(pixel_format) {}
20
21 bool 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
32 VideoCaptureParams::VideoCaptureParams() : allow_resolution_change(false) {}
33
34 }  // namespace media