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

Side by Side Diff: media/capture/video_capture_types.h

Issue 2415703002: Move files video_capture*.* from media/base to media/capture (Closed)
Patch Set: rebase Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ 5 #ifndef MEDIA_CAPTURE_VIDEO_CAPTURE_TYPES_H_
6 #define MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ 6 #define MEDIA_CAPTURE_VIDEO_CAPTURE_TYPES_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "media/base/media_export.h"
14 #include "media/base/video_types.h" 13 #include "media/base/video_types.h"
14 #include "media/capture/capture_export.h"
15 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 // TODO(wjia): this type should be defined in a common place and 19 // TODO(wjia): this type should be defined in a common place and
20 // shared with device manager. 20 // shared with device manager.
21 typedef int VideoCaptureSessionId; 21 typedef int VideoCaptureSessionId;
22 22
23 // Storage type for the pixels. 23 // Storage type for the pixels.
24 // TODO(mcasas): http://crbug.com/504160 Consider making this an enum class. 24 // TODO(mcasas): http://crbug.com/504160 Consider making this an enum class.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 "static_cast<int>(FREQUENCY_DEFAULT) must equal 60."); 71 "static_cast<int>(FREQUENCY_DEFAULT) must equal 60.");
72 72
73 // Some drivers use rational time per frame instead of float frame rate, this 73 // Some drivers use rational time per frame instead of float frame rate, this
74 // constant k is used to convert between both: A fps -> [k/k*A] seconds/frame. 74 // constant k is used to convert between both: A fps -> [k/k*A] seconds/frame.
75 const int kFrameRatePrecision = 10000; 75 const int kFrameRatePrecision = 10000;
76 76
77 // Video capture format specification. 77 // Video capture format specification.
78 // This class is used by the video capture device to specify the format of every 78 // This class is used by the video capture device to specify the format of every
79 // frame captured and returned to a client. It is also used to specify a 79 // frame captured and returned to a client. It is also used to specify a
80 // supported capture format by a device. 80 // supported capture format by a device.
81 struct MEDIA_EXPORT VideoCaptureFormat { 81 struct CAPTURE_EXPORT VideoCaptureFormat {
82 VideoCaptureFormat(); 82 VideoCaptureFormat();
83 VideoCaptureFormat(const gfx::Size& frame_size, 83 VideoCaptureFormat(const gfx::Size& frame_size,
84 float frame_rate, 84 float frame_rate,
85 VideoPixelFormat pixel_format); 85 VideoPixelFormat pixel_format);
86 VideoCaptureFormat(const gfx::Size& frame_size, 86 VideoCaptureFormat(const gfx::Size& frame_size,
87 float frame_rate, 87 float frame_rate,
88 VideoPixelFormat pixel_format, 88 VideoPixelFormat pixel_format,
89 VideoPixelStorage pixel_storage); 89 VideoPixelStorage pixel_storage);
90 90
91 static std::string ToString(const VideoCaptureFormat& format); 91 static std::string ToString(const VideoCaptureFormat& format);
92 static std::string PixelStorageToString(VideoPixelStorage storage); 92 static std::string PixelStorageToString(VideoPixelStorage storage);
93 93
94 // Compares the priority of the pixel formats. Returns true if |lhs| is the 94 // Compares the priority of the pixel formats. Returns true if |lhs| is the
95 // preferred pixel format in comparison with |rhs|. Returns false otherwise. 95 // preferred pixel format in comparison with |rhs|. Returns false otherwise.
96 static bool ComparePixelFormatPreference(const VideoPixelFormat& lhs, 96 static bool ComparePixelFormatPreference(const VideoPixelFormat& lhs,
97 const VideoPixelFormat& rhs); 97 const VideoPixelFormat& rhs);
98 98
99 // Returns the required buffer size to hold an image of a given 99 // Returns the required buffer size to hold an image of a given
100 // VideoCaptureFormat with no padding and tightly packed. 100 // VideoCaptureFormat with no padding and tightly packed.
101 size_t ImageAllocationSize() const; 101 size_t ImageAllocationSize() const;
102 102
103 // Checks that all values are in the expected range. All limits are specified 103 // Checks that all values are in the expected range. All limits are specified
104 // in media::Limits. 104 // in media::Limits.
105 bool IsValid() const; 105 bool IsValid() const;
106 106
107 bool operator==(const VideoCaptureFormat& other) const { 107 bool operator==(const VideoCaptureFormat& other) const {
108 return frame_size == other.frame_size && 108 return frame_size == other.frame_size && frame_rate == other.frame_rate &&
109 frame_rate == other.frame_rate && 109 pixel_format == other.pixel_format;
110 pixel_format == other.pixel_format;
111 } 110 }
112 111
113 gfx::Size frame_size; 112 gfx::Size frame_size;
114 float frame_rate; 113 float frame_rate;
115 VideoPixelFormat pixel_format; 114 VideoPixelFormat pixel_format;
116 VideoPixelStorage pixel_storage; 115 VideoPixelStorage pixel_storage;
117 }; 116 };
118 117
119 typedef std::vector<VideoCaptureFormat> VideoCaptureFormats; 118 typedef std::vector<VideoCaptureFormat> VideoCaptureFormats;
120 119
(...skipping 19 matching lines...) Expand all
140 139
141 // Policy for resolution change. 140 // Policy for resolution change.
142 ResolutionChangePolicy resolution_change_policy; 141 ResolutionChangePolicy resolution_change_policy;
143 142
144 // User-specified power line frequency. 143 // User-specified power line frequency.
145 PowerLineFrequency power_line_frequency; 144 PowerLineFrequency power_line_frequency;
146 }; 145 };
147 146
148 } // namespace media 147 } // namespace media
149 148
150 #endif // MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ 149 #endif // MEDIA_CAPTURE_VIDEO_CAPTURE_TYPES_H_
OLDNEW
« no previous file with comments | « media/capture/video/win/video_capture_device_win.h ('k') | media/capture/video_capture_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698