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