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

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

Issue 1179323002: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tracker working with VideoPixel{Format,Storage} ISO VideoFrame counterparts. Rebased. Created 5 years, 6 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 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_BASE_VIDEO_CAPTURE_TYPES_H_
6 #define MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ 6 #define MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
(...skipping 10 matching lines...) Expand all
21 PIXEL_FORMAT_I420, 21 PIXEL_FORMAT_I420,
22 PIXEL_FORMAT_YV12, 22 PIXEL_FORMAT_YV12,
23 PIXEL_FORMAT_NV12, 23 PIXEL_FORMAT_NV12,
24 PIXEL_FORMAT_NV21, 24 PIXEL_FORMAT_NV21,
25 PIXEL_FORMAT_UYVY, 25 PIXEL_FORMAT_UYVY,
26 PIXEL_FORMAT_YUY2, 26 PIXEL_FORMAT_YUY2,
27 PIXEL_FORMAT_RGB24, 27 PIXEL_FORMAT_RGB24,
28 PIXEL_FORMAT_RGB32, 28 PIXEL_FORMAT_RGB32,
29 PIXEL_FORMAT_ARGB, 29 PIXEL_FORMAT_ARGB,
30 PIXEL_FORMAT_MJPEG, 30 PIXEL_FORMAT_MJPEG,
31 PIXEL_FORMAT_TEXTURE, // Capture format as a GL texture.
32 PIXEL_FORMAT_GPUMEMORYBUFFER,
33 PIXEL_FORMAT_UNKNOWN, // Color format not set. 31 PIXEL_FORMAT_UNKNOWN, // Color format not set.
34 PIXEL_FORMAT_MAX, 32 PIXEL_FORMAT_MAX,
35 }; 33 };
36 34
35 enum VideoPixelStorage {
36 PIXEL_STORAGE_CPU,
37 PIXEL_STORAGE_TEXTURE,
hubbe 2015/06/16 21:11:35 Does PIXEL_FORMAT_???? make any sense if the stora
mcasas 2015/06/16 23:14:01 Done.
38 PIXEL_STORAGE_GPUMEMORYBUFFER,
39 };
40
37 // Policies for capture devices that have source content that varies in size. 41 // Policies for capture devices that have source content that varies in size.
38 // It is up to the implementation how the captured content will be transformed 42 // It is up to the implementation how the captured content will be transformed
39 // (e.g., scaling and/or letterboxing) in order to produce video frames that 43 // (e.g., scaling and/or letterboxing) in order to produce video frames that
40 // strictly adheree to one of these policies. 44 // strictly adheree to one of these policies.
41 enum ResolutionChangePolicy { 45 enum ResolutionChangePolicy {
42 // Capture device outputs a fixed resolution all the time. The resolution of 46 // Capture device outputs a fixed resolution all the time. The resolution of
43 // the first frame is the resolution for all frames. 47 // the first frame is the resolution for all frames.
44 RESOLUTION_POLICY_FIXED_RESOLUTION, 48 RESOLUTION_POLICY_FIXED_RESOLUTION,
45 49
46 // Capture device is allowed to output frames of varying resolutions. The 50 // Capture device is allowed to output frames of varying resolutions. The
(...skipping 16 matching lines...) Expand all
63 // Video capture format specification. 67 // Video capture format specification.
64 // This class is used by the video capture device to specify the format of every 68 // This class is used by the video capture device to specify the format of every
65 // frame captured and returned to a client. It is also used to specify a 69 // frame captured and returned to a client. It is also used to specify a
66 // supported capture format by a device. 70 // supported capture format by a device.
67 class MEDIA_EXPORT VideoCaptureFormat { 71 class MEDIA_EXPORT VideoCaptureFormat {
68 public: 72 public:
69 VideoCaptureFormat(); 73 VideoCaptureFormat();
70 VideoCaptureFormat(const gfx::Size& frame_size, 74 VideoCaptureFormat(const gfx::Size& frame_size,
71 float frame_rate, 75 float frame_rate,
72 VideoPixelFormat pixel_format); 76 VideoPixelFormat pixel_format);
77 VideoCaptureFormat(const gfx::Size& frame_size,
78 float frame_rate,
79 VideoPixelFormat pixel_format,
80 VideoPixelStorage pixel_storage);
73 81
74 std::string ToString() const; 82 std::string ToString() const;
75 static std::string PixelFormatToString(VideoPixelFormat format); 83 static std::string PixelFormatToString(VideoPixelFormat format);
84 static std::string PixelStorageToString(VideoPixelStorage storage);
76 85
77 // Returns the required buffer size to hold an image of a given 86 // Returns the required buffer size to hold an image of a given
78 // VideoCaptureFormat with no padding and tightly packed. 87 // VideoCaptureFormat with no padding and tightly packed.
79 size_t ImageAllocationSize() const; 88 size_t ImageAllocationSize() const;
80 89
81 // Checks that all values are in the expected range. All limits are specified 90 // Checks that all values are in the expected range. All limits are specified
82 // in media::Limits. 91 // in media::Limits.
83 bool IsValid() const; 92 bool IsValid() const;
84 93
85 bool operator==(const VideoCaptureFormat& other) const { 94 bool operator==(const VideoCaptureFormat& other) const {
86 return frame_size == other.frame_size && 95 return frame_size == other.frame_size &&
87 frame_rate == other.frame_rate && 96 frame_rate == other.frame_rate &&
88 pixel_format == other.pixel_format; 97 pixel_format == other.pixel_format;
89 } 98 }
90 99
91 gfx::Size frame_size; 100 gfx::Size frame_size;
92 float frame_rate; 101 float frame_rate;
93 VideoPixelFormat pixel_format; 102 VideoPixelFormat pixel_format;
103 VideoPixelStorage pixel_storage;
94 }; 104 };
95 105
96 typedef std::vector<VideoCaptureFormat> VideoCaptureFormats; 106 typedef std::vector<VideoCaptureFormat> VideoCaptureFormats;
97 107
98 // Parameters for starting video capture. 108 // Parameters for starting video capture.
99 // This class is used by the client of a video capture device to specify the 109 // This class is used by the client of a video capture device to specify the
100 // format of frames in which the client would like to have captured frames 110 // format of frames in which the client would like to have captured frames
101 // returned. 111 // returned.
102 class MEDIA_EXPORT VideoCaptureParams { 112 class MEDIA_EXPORT VideoCaptureParams {
103 public: 113 public:
104 VideoCaptureParams(); 114 VideoCaptureParams();
105 115
106 bool operator==(const VideoCaptureParams& other) const { 116 bool operator==(const VideoCaptureParams& other) const {
107 return requested_format == other.requested_format && 117 return requested_format == other.requested_format &&
108 resolution_change_policy == other.resolution_change_policy; 118 resolution_change_policy == other.resolution_change_policy;
109 } 119 }
110 120
111 // Requests a resolution and format at which the capture will occur. 121 // Requests a resolution and format at which the capture will occur.
112 VideoCaptureFormat requested_format; 122 VideoCaptureFormat requested_format;
113 123
114 // Policy for resolution change. 124 // Policy for resolution change.
115 ResolutionChangePolicy resolution_change_policy; 125 ResolutionChangePolicy resolution_change_policy;
116 }; 126 };
117 127
118 } // namespace media 128 } // namespace media
119 129
120 #endif // MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ 130 #endif // MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698