| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | #ifndef API_VIDEO_RESOLUTION_H_ |
| 12 | #define API_VIDEO_RESOLUTION_H_ |
| 13 |
| 14 | #include <utility> |
| 15 |
| 16 | namespace webrtc { |
| 17 |
| 18 | // A struct representing a video resolution in pixels. |
| 19 | struct Resolution { |
| 20 | int width = 0; |
| 21 | int height = 0; |
| 22 |
| 23 | // Helper methods. |
| 24 | int PixelCount() const { return width * height; } |
| 25 | std::pair<int, int> ToPair() const { return std::make_pair(width, height); } |
| 26 | }; |
| 27 |
| 28 | inline bool operator==(const Resolution& lhs, const Resolution& rhs) { |
| 29 | return lhs.width == rhs.width && lhs.height == rhs.height; |
| 30 | } |
| 31 |
| 32 | inline bool operator!=(const Resolution& lhs, const Resolution& rhs) { |
| 33 | return !(lhs == rhs); |
| 34 | } |
| 35 |
| 36 | } // namespace webrtc |
| 37 |
| 38 | #endif // API_VIDEO_RESOLUTION_H_ |
| 39 |