Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: media/video/capture/video_capture_types.cc

Issue 83633008: Reland: Reorganize media::VideoCapture* types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/video/capture/video_capture_types.h" 5 #include "media/video/capture/video_capture_types.h"
6 6
7 #include "media/base/limits.h" 7 #include "media/base/limits.h"
8 8
9 namespace media { 9 namespace media {
10 10
11 VideoCaptureFormat::VideoCaptureFormat() 11 VideoCaptureFormat::VideoCaptureFormat()
12 : width(0), 12 : frame_rate(0), pixel_format(PIXEL_FORMAT_UNKNOWN) {}
13 height(0),
14 frame_rate(0),
15 frame_size_type(ConstantResolutionVideoCaptureDevice) {}
16 13
17 VideoCaptureFormat::VideoCaptureFormat( 14 VideoCaptureFormat::VideoCaptureFormat(const gfx::Size& frame_size,
18 int width, 15 int frame_rate,
19 int height, 16 VideoPixelFormat pixel_format)
20 int frame_rate, 17 : frame_size(frame_size),
21 VideoCaptureResolutionType frame_size_type)
22 : width(width),
23 height(height),
24 frame_rate(frame_rate), 18 frame_rate(frame_rate),
25 frame_size_type(frame_size_type) {} 19 pixel_format(pixel_format) {}
26 20
27 bool VideoCaptureFormat::IsValid() const { 21 bool VideoCaptureFormat::IsValid() const {
28 return (width > 0) && (height > 0) && (frame_rate > 0) && 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) &&
29 (frame_rate < media::limits::kMaxFramesPerSecond) && 27 (frame_rate < media::limits::kMaxFramesPerSecond) &&
30 (width < media::limits::kMaxDimension) && 28 (pixel_format >= PIXEL_FORMAT_UNKNOWN) &&
31 (height < media::limits::kMaxDimension) && 29 (pixel_format < PIXEL_FORMAT_MAX);
32 (width * height < media::limits::kMaxCanvas) &&
33 (frame_size_type >= 0) &&
34 (frame_size_type < media::MaxVideoCaptureResolutionType);
35 } 30 }
36 31
37 VideoCaptureParams::VideoCaptureParams() 32 VideoCaptureParams::VideoCaptureParams() : allow_resolution_change(false) {}
38 : session_id(0) {}
39 33
40 VideoCaptureCapability::VideoCaptureCapability() 34 VideoCaptureCapability::VideoCaptureCapability() {}
41 : color(PIXEL_FORMAT_UNKNOWN) {}
42
43 VideoCaptureCapability::VideoCaptureCapability(
44 int width,
45 int height,
46 int frame_rate,
47 VideoPixelFormat color,
48 VideoCaptureResolutionType frame_size_type)
49 : VideoCaptureFormat(width, height, frame_rate, frame_size_type),
50 color(color) {}
51 35
52 } // namespace media 36 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/video_capture_types.h ('k') | media/video/capture/win/capability_list_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698