| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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_UNKNOWN, |
| 37 PIXEL_STORAGE_CPU, |
| 38 PIXEL_STORAGE_TEXTURE, |
| 39 PIXEL_STORAGE_GPUMEMORYBUFFER, |
| 40 }; |
| 41 |
| 37 // Policies for capture devices that have source content that varies in size. | 42 // 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 | 43 // 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 | 44 // (e.g., scaling and/or letterboxing) in order to produce video frames that |
| 40 // strictly adheree to one of these policies. | 45 // strictly adheree to one of these policies. |
| 41 enum ResolutionChangePolicy { | 46 enum ResolutionChangePolicy { |
| 42 // Capture device outputs a fixed resolution all the time. The resolution of | 47 // Capture device outputs a fixed resolution all the time. The resolution of |
| 43 // the first frame is the resolution for all frames. | 48 // the first frame is the resolution for all frames. |
| 44 RESOLUTION_POLICY_FIXED_RESOLUTION, | 49 RESOLUTION_POLICY_FIXED_RESOLUTION, |
| 45 | 50 |
| 46 // Capture device is allowed to output frames of varying resolutions. The | 51 // Capture device is allowed to output frames of varying resolutions. The |
| (...skipping 16 matching lines...) Expand all Loading... |
| 63 // Video capture format specification. | 68 // Video capture format specification. |
| 64 // This class is used by the video capture device to specify the format of every | 69 // 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 | 70 // frame captured and returned to a client. It is also used to specify a |
| 66 // supported capture format by a device. | 71 // supported capture format by a device. |
| 67 class MEDIA_EXPORT VideoCaptureFormat { | 72 class MEDIA_EXPORT VideoCaptureFormat { |
| 68 public: | 73 public: |
| 69 VideoCaptureFormat(); | 74 VideoCaptureFormat(); |
| 70 VideoCaptureFormat(const gfx::Size& frame_size, | 75 VideoCaptureFormat(const gfx::Size& frame_size, |
| 71 float frame_rate, | 76 float frame_rate, |
| 72 VideoPixelFormat pixel_format); | 77 VideoPixelFormat pixel_format); |
| 78 VideoCaptureFormat(const gfx::Size& frame_size, |
| 79 float frame_rate, |
| 80 VideoPixelFormat pixel_format, |
| 81 VideoPixelStorage pixel_storage); |
| 73 | 82 |
| 74 std::string ToString() const; | 83 std::string ToString() const; |
| 75 static std::string PixelFormatToString(VideoPixelFormat format); | 84 static std::string PixelFormatToString(VideoPixelFormat format); |
| 85 static std::string PixelStorageToString(VideoPixelStorage storage); |
| 76 | 86 |
| 77 // Returns the required buffer size to hold an image of a given | 87 // Returns the required buffer size to hold an image of a given |
| 78 // VideoCaptureFormat with no padding and tightly packed. | 88 // VideoCaptureFormat with no padding and tightly packed. |
| 79 size_t ImageAllocationSize() const; | 89 size_t ImageAllocationSize() const; |
| 80 | 90 |
| 81 // Checks that all values are in the expected range. All limits are specified | 91 // Checks that all values are in the expected range. All limits are specified |
| 82 // in media::Limits. | 92 // in media::Limits. |
| 83 bool IsValid() const; | 93 bool IsValid() const; |
| 84 | 94 |
| 85 bool operator==(const VideoCaptureFormat& other) const { | 95 bool operator==(const VideoCaptureFormat& other) const { |
| 86 return frame_size == other.frame_size && | 96 return frame_size == other.frame_size && |
| 87 frame_rate == other.frame_rate && | 97 frame_rate == other.frame_rate && |
| 88 pixel_format == other.pixel_format; | 98 pixel_format == other.pixel_format; |
| 89 } | 99 } |
| 90 | 100 |
| 91 gfx::Size frame_size; | 101 gfx::Size frame_size; |
| 92 float frame_rate; | 102 float frame_rate; |
| 93 VideoPixelFormat pixel_format; | 103 VideoPixelFormat pixel_format; |
| 104 VideoPixelStorage pixel_storage; |
| 94 }; | 105 }; |
| 95 | 106 |
| 96 typedef std::vector<VideoCaptureFormat> VideoCaptureFormats; | 107 typedef std::vector<VideoCaptureFormat> VideoCaptureFormats; |
| 97 | 108 |
| 98 // Parameters for starting video capture. | 109 // Parameters for starting video capture. |
| 99 // This class is used by the client of a video capture device to specify the | 110 // 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 | 111 // format of frames in which the client would like to have captured frames |
| 101 // returned. | 112 // returned. |
| 102 class MEDIA_EXPORT VideoCaptureParams { | 113 class MEDIA_EXPORT VideoCaptureParams { |
| 103 public: | 114 public: |
| 104 VideoCaptureParams(); | 115 VideoCaptureParams(); |
| 105 | 116 |
| 106 bool operator==(const VideoCaptureParams& other) const { | 117 bool operator==(const VideoCaptureParams& other) const { |
| 107 return requested_format == other.requested_format && | 118 return requested_format == other.requested_format && |
| 108 resolution_change_policy == other.resolution_change_policy; | 119 resolution_change_policy == other.resolution_change_policy; |
| 109 } | 120 } |
| 110 | 121 |
| 111 // Requests a resolution and format at which the capture will occur. | 122 // Requests a resolution and format at which the capture will occur. |
| 112 VideoCaptureFormat requested_format; | 123 VideoCaptureFormat requested_format; |
| 113 | 124 |
| 114 // Policy for resolution change. | 125 // Policy for resolution change. |
| 115 ResolutionChangePolicy resolution_change_policy; | 126 ResolutionChangePolicy resolution_change_policy; |
| 116 }; | 127 }; |
| 117 | 128 |
| 118 } // namespace media | 129 } // namespace media |
| 119 | 130 |
| 120 #endif // MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ | 131 #endif // MEDIA_BASE_VIDEO_CAPTURE_TYPES_H_ |
| OLD | NEW |