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

Unified Diff: media/video/capture/video_capture_types.h

Issue 22876027: Consolidate duplicated frame / capability structures in video_capture_types.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: media/video/capture/video_capture_types.h
diff --git a/media/video/capture/video_capture_types.h b/media/video/capture/video_capture_types.h
index 57712727ef0f25046c16bf1c2ac7daca632a2d67..c13193975873021753ba38d424580c37b282d88d 100644
--- a/media/video/capture/video_capture_types.h
+++ b/media/video/capture/video_capture_types.h
@@ -19,68 +19,84 @@ enum VideoCaptureResolutionType {
MaxVideoCaptureResolutionType, // Must be last.
};
-// Parameters for starting video capture and device information.
-struct VideoCaptureParams {
- VideoCaptureParams()
+// Color formats from camera.
+enum VideoPixelFormat {
ncarter (slow) 2013/09/04 18:05:05 I really like this type name. It packs a lot of pu
mcasas 2013/09/06 09:13:13 Kick Arses!
+ kColorUnknown, // Color format not set.
scherkus (not reviewing) 2013/09/06 00:55:01 now that these are in the global namespace they ne
mcasas 2013/09/06 09:13:13 For (my) future reference:
+ kI420,
+ kYUY2,
+ kUYVY,
+ kRGB24,
+ kARGB,
+ kMJPEG,
+ kNV21,
+ kYV12,
+};
+
+// Video capture format specification.
+class MEDIA_EXPORT VideoCaptureFormat {
+ public:
+ VideoCaptureFormat()
scherkus (not reviewing) 2013/09/06 00:55:01 none of these constructors need to be inlined -- p
mcasas 2013/09/06 09:13:13 Done.
: width(0),
height(0),
- frame_per_second(0),
- session_id(0),
+ frame_rate(0),
frame_size_type(ConstantResolutionVideoCaptureDevice) {};
+ VideoCaptureFormat(int width,
+ int height,
+ int frame_rate,
+ VideoCaptureResolutionType frame_size_type)
+ : width(width),
+ height(height),
+ frame_rate(frame_rate),
+ frame_size_type(frame_size_type) {};
+ // Checks that all values are in the expected range. All limits are specified
+ // in media::Limits.
+ bool IsValid() const;
+
+ public:
scherkus (not reviewing) 2013/09/06 00:55:01 nit: remove as it's redundant
mcasas 2013/09/06 09:13:13 Done.
int width;
int height;
- int frame_per_second;
- VideoCaptureSessionId session_id;
+ int frame_rate;
VideoCaptureResolutionType frame_size_type;
};
-// Capabilities describe the format a camera capture video in.
-struct VideoCaptureCapability {
- // Color formats from camera.
- enum Format {
- kColorUnknown, // Color format not set.
- kI420,
- kYUY2,
- kUYVY,
- kRGB24,
- kARGB,
- kMJPEG,
- kNV21,
- kYV12,
- };
+// Parameters for starting video capture and device information.
+class MEDIA_EXPORT VideoCaptureParams : public VideoCaptureFormat {
+ public:
+ VideoCaptureParams()
+ : session_id(0) {};
+ // Checks that all values are in the expected range. All limits are specified
+ // in media::Limits.
+ bool IsValid() const;
scherkus (not reviewing) 2013/09/06 00:55:01 if VideoCaptureParams inherits from VideoCaptureFo
mcasas 2013/09/06 09:13:13 My miss: is just a copy-paste! Removed VideoCaptur
+
+ public:
scherkus (not reviewing) 2013/09/06 00:55:01 nit: remove as it's redundant
mcasas 2013/09/06 09:13:13 Done.
+ VideoCaptureSessionId session_id;
+};
+// Capabilities describe the format a camera capture video in.
+class VideoCaptureCapability : public VideoCaptureFormat {
+ public:
VideoCaptureCapability()
- : width(0),
- height(0),
- frame_rate(0),
- color(kColorUnknown),
+ : color(kColorUnknown),
expected_capture_delay(0),
interlaced(false),
- frame_size_type(ConstantResolutionVideoCaptureDevice),
session_id(0) {};
VideoCaptureCapability(int width,
int height,
int frame_rate,
- Format color,
+ VideoPixelFormat color,
int delay,
bool interlaced,
VideoCaptureResolutionType frame_size_type)
- : width(width),
- height(height),
- frame_rate(frame_rate),
+ : VideoCaptureFormat(width, height, frame_rate, frame_size_type),
color(color),
expected_capture_delay(delay),
interlaced(interlaced),
- frame_size_type(frame_size_type),
session_id(0) {};
- int width; // Desired width.
- int height; // Desired height.
- int frame_rate; // Desired frame rate.
- Format color; // Desired video type.
+ public:
scherkus (not reviewing) 2013/09/06 00:55:01 nit: remove as it's redundant
mcasas 2013/09/06 09:13:13 Done.
+ VideoPixelFormat color; // Desired video type.
int expected_capture_delay; // Expected delay in millisecond.
bool interlaced; // Need interlace format.
- VideoCaptureResolutionType frame_size_type;
VideoCaptureSessionId session_id;
};

Powered by Google App Engine
This is Rietveld 408576698