OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/base/video_capture_types.h" | 5 #include "media/base/video_capture_types.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "media/base/limits.h" | 9 #include "media/base/limits.h" |
10 | 10 |
11 namespace media { | 11 namespace media { |
12 | 12 |
13 VideoCaptureFormat::VideoCaptureFormat() | 13 VideoCaptureFormat::VideoCaptureFormat() |
14 : frame_rate(0.0f), pixel_format(PIXEL_FORMAT_UNKNOWN) {} | 14 : frame_rate(0.0f), pixel_format(PIXEL_FORMAT_UNKNOWN) {} |
15 | 15 |
16 VideoCaptureFormat::VideoCaptureFormat(const gfx::Size& frame_size, | 16 VideoCaptureFormat::VideoCaptureFormat(const gfx::Size& frame_size, |
17 float frame_rate, | 17 float frame_rate, |
18 VideoPixelFormat pixel_format) | 18 VideoPixelFormat pixel_format) |
19 : frame_size(frame_size), | 19 : frame_size(frame_size), |
20 frame_rate(frame_rate), | 20 frame_rate(frame_rate), |
21 pixel_format(pixel_format) {} | 21 pixel_format(pixel_format) {} |
22 | 22 |
| 23 bool VideoCaptureFormat::operator==(const VideoCaptureFormat& other) const { |
| 24 return frame_size == other.frame_size && |
| 25 frame_rate == other.frame_rate && |
| 26 pixel_format == other.pixel_format; |
| 27 } |
| 28 |
23 bool VideoCaptureFormat::IsValid() const { | 29 bool VideoCaptureFormat::IsValid() const { |
24 return (frame_size.width() < media::limits::kMaxDimension) && | 30 return (frame_size.width() < media::limits::kMaxDimension) && |
25 (frame_size.height() < media::limits::kMaxDimension) && | 31 (frame_size.height() < media::limits::kMaxDimension) && |
26 (frame_size.GetArea() >= 0) && | 32 (frame_size.GetArea() >= 0) && |
27 (frame_size.GetArea() < media::limits::kMaxCanvas) && | 33 (frame_size.GetArea() < media::limits::kMaxCanvas) && |
28 (frame_rate >= 0.0f) && | 34 (frame_rate >= 0.0f) && |
29 (frame_rate < media::limits::kMaxFramesPerSecond) && | 35 (frame_rate < media::limits::kMaxFramesPerSecond) && |
30 (pixel_format >= 0) && | 36 (pixel_format >= 0) && |
31 (pixel_format < PIXEL_FORMAT_MAX); | 37 (pixel_format < PIXEL_FORMAT_MAX); |
32 } | 38 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 case PIXEL_FORMAT_GPUMEMORYBUFFER: | 107 case PIXEL_FORMAT_GPUMEMORYBUFFER: |
102 return "GPUMEMORYBUFFER"; | 108 return "GPUMEMORYBUFFER"; |
103 case PIXEL_FORMAT_MAX: | 109 case PIXEL_FORMAT_MAX: |
104 break; | 110 break; |
105 } | 111 } |
106 NOTREACHED() << "Invalid VideoPixelFormat provided: " << format; | 112 NOTREACHED() << "Invalid VideoPixelFormat provided: " << format; |
107 return ""; | 113 return ""; |
108 } | 114 } |
109 | 115 |
110 VideoCaptureParams::VideoCaptureParams() | 116 VideoCaptureParams::VideoCaptureParams() |
111 : resolution_change_policy(RESOLUTION_POLICY_FIXED) {} | 117 : resolution_change_policy(RESOLUTION_POLICY_FIXED_RESOLUTION) {} |
| 118 |
| 119 bool VideoCaptureParams::operator==(const VideoCaptureParams& other) const { |
| 120 return requested_format == other.requested_format && |
| 121 resolution_change_policy == other.resolution_change_policy; |
| 122 } |
| 123 |
112 } // namespace media | 124 } // namespace media |
OLD | NEW |