Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 11 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
| 12 | 12 |
|
DaleCurtis
2015/06/16 18:26:08
Include build/build_config to ensure OS_XXX macros
mcasas
2015/06/16 20:47:02
Done.
| |
| 13 namespace media { | 13 namespace media { |
| 14 | 14 |
| 15 // TODO(wjia): this type should be defined in a common place and | 15 // TODO(wjia): this type should be defined in a common place and |
| 16 // shared with device manager. | 16 // shared with device manager. |
| 17 typedef int VideoCaptureSessionId; | 17 typedef int VideoCaptureSessionId; |
| 18 | 18 |
| 19 // Color formats from camera. This list is sorted in order of preference. | 19 // Color formats from camera. This list is sorted in order of preference. |
| 20 enum VideoPixelFormat { | 20 enum VideoPixelFormat { |
| 21 PIXEL_FORMAT_I420, | 21 PIXEL_FORMAT_I420, |
| 22 PIXEL_FORMAT_YV12, | 22 PIXEL_FORMAT_YV12, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // Some drivers use rational time per frame instead of float frame rate, this | 59 // Some drivers use rational time per frame instead of float frame rate, this |
| 60 // constant k is used to convert between both: A fps -> [k/k*A] seconds/frame. | 60 // constant k is used to convert between both: A fps -> [k/k*A] seconds/frame. |
| 61 const int kFrameRatePrecision = 10000; | 61 const int kFrameRatePrecision = 10000; |
| 62 | 62 |
| 63 // Video capture format specification. | 63 // Video capture format specification. |
| 64 // This class is used by the video capture device to specify the format of every | 64 // 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 | 65 // frame captured and returned to a client. It is also used to specify a |
| 66 // supported capture format by a device. | 66 // supported capture format by a device. |
| 67 class MEDIA_EXPORT VideoCaptureFormat { | 67 struct MEDIA_EXPORT VideoCaptureFormat { |
| 68 public: | |
| 69 VideoCaptureFormat(); | 68 VideoCaptureFormat(); |
| 70 VideoCaptureFormat(const gfx::Size& frame_size, | 69 VideoCaptureFormat(const gfx::Size& frame_size, |
| 71 float frame_rate, | 70 float frame_rate, |
| 72 VideoPixelFormat pixel_format); | 71 VideoPixelFormat pixel_format); |
| 73 | 72 |
| 74 std::string ToString() const; | 73 std::string ToString() const; |
| 75 static std::string PixelFormatToString(VideoPixelFormat format); | 74 static std::string PixelFormatToString(VideoPixelFormat format); |
| 76 | 75 |
| 77 // Returns the required buffer size to hold an image of a given | 76 // Returns the required buffer size to hold an image of a given |
| 78 // VideoCaptureFormat with no padding and tightly packed. | 77 // VideoCaptureFormat with no padding and tightly packed. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 92 float frame_rate; | 91 float frame_rate; |
| 93 VideoPixelFormat pixel_format; | 92 VideoPixelFormat pixel_format; |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 typedef std::vector<VideoCaptureFormat> VideoCaptureFormats; | 95 typedef std::vector<VideoCaptureFormat> VideoCaptureFormats; |
| 97 | 96 |
| 98 // Parameters for starting video capture. | 97 // Parameters for starting video capture. |
| 99 // This class is used by the client of a video capture device to specify the | 98 // 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 | 99 // format of frames in which the client would like to have captured frames |
| 101 // returned. | 100 // returned. |
| 102 class MEDIA_EXPORT VideoCaptureParams { | 101 struct MEDIA_EXPORT VideoCaptureParams { |
| 103 public: | |
| 104 VideoCaptureParams(); | 102 VideoCaptureParams(); |
| 105 | 103 |
| 106 bool operator==(const VideoCaptureParams& other) const { | 104 bool operator==(const VideoCaptureParams& other) const { |
| 107 return requested_format == other.requested_format && | 105 return requested_format == other.requested_format && |
| 106 #if defined(OS_LINUX) | |
| 107 use_native_gpu_memory_buffers == other.use_native_gpu_memory_buffers && | |
| 108 #endif | |
| 108 resolution_change_policy == other.resolution_change_policy; | 109 resolution_change_policy == other.resolution_change_policy; |
| 109 } | 110 } |
| 110 | 111 |
| 111 // Requests a resolution and format at which the capture will occur. | 112 // Requests a resolution and format at which the capture will occur. |
| 112 VideoCaptureFormat requested_format; | 113 VideoCaptureFormat requested_format; |
| 113 | 114 |
| 114 // Policy for resolution change. | 115 // Policy for resolution change. |
| 115 ResolutionChangePolicy resolution_change_policy; | 116 ResolutionChangePolicy resolution_change_policy; |
| 117 | |
| 118 #if defined(OS_LINUX) | |
| 119 // Indication to the Driver to try to use native GpuMemoryBuffers. | |
| 120 bool use_native_gpu_memory_buffers; | |
| 121 #endif | |
| 116 }; | 122 }; |
| 117 | 123 |
| 118 } // namespace media | 124 } // namespace media |
| 119 | 125 |
| 120 #endif // MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ | 126 #endif // MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ |
| OLD | NEW |