| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Get FourCC code as a string. | 128 // Get FourCC code as a string. |
| 129 inline std::string GetFourccName(uint32_t fourcc) { | 129 inline std::string GetFourccName(uint32_t fourcc) { |
| 130 std::string name; | 130 std::string name; |
| 131 name.push_back(static_cast<char>(fourcc & 0xFF)); | 131 name.push_back(static_cast<char>(fourcc & 0xFF)); |
| 132 name.push_back(static_cast<char>((fourcc >> 8) & 0xFF)); | 132 name.push_back(static_cast<char>((fourcc >> 8) & 0xFF)); |
| 133 name.push_back(static_cast<char>((fourcc >> 16) & 0xFF)); | 133 name.push_back(static_cast<char>((fourcc >> 16) & 0xFF)); |
| 134 name.push_back(static_cast<char>((fourcc >> 24) & 0xFF)); | 134 name.push_back(static_cast<char>((fourcc >> 24) & 0xFF)); |
| 135 return name; | 135 return name; |
| 136 } | 136 } |
| 137 | 137 |
| 138 // Computes a scale less to fit in max_pixels while maintaining aspect ratio. | |
| 139 void ComputeScaleMaxPixels(int frame_width, int frame_height, int max_pixels, | |
| 140 int* scaled_width, int* scaled_height); | |
| 141 | |
| 142 // For low fps, max pixels limit is set to Retina MacBookPro 15" resolution of | |
| 143 // 2880 x 1800 as of 4/18/2013. | |
| 144 // For high fps, maximum pixels limit is set based on common 24" monitor | |
| 145 // resolution of 2048 x 1280 as of 6/13/2013. The Retina resolution is | |
| 146 // therefore reduced to 1440 x 900. | |
| 147 void ComputeScale(int frame_width, int frame_height, int fps, | |
| 148 int* scaled_width, int* scaled_height); | |
| 149 | |
| 150 // Compute the frame size that conversion should crop to based on aspect ratio. | |
| 151 // Ensures size is multiple of 2 due to I420 and conversion limitations. | |
| 152 void ComputeCrop(int cropped_format_width, int cropped_format_height, | |
| 153 int frame_width, int frame_height, | |
| 154 int pixel_width, int pixel_height, | |
| 155 int rotation, | |
| 156 int* cropped_width, int* cropped_height); | |
| 157 | |
| 158 // Compute the frame size that makes pixels square pixel aspect ratio. | |
| 159 void ComputeScaleToSquarePixels(int in_width, int in_height, | |
| 160 int pixel_width, int pixel_height, | |
| 161 int* scaled_width, int* scaled_height); | |
| 162 | |
| 163 ////////////////////////////////////////////////////////////////////////////// | 138 ////////////////////////////////////////////////////////////////////////////// |
| 164 // Definition of VideoFormat. | 139 // Definition of VideoFormat. |
| 165 ////////////////////////////////////////////////////////////////////////////// | 140 ////////////////////////////////////////////////////////////////////////////// |
| 166 | 141 |
| 167 // VideoFormat with Plain Old Data for global variables. | 142 // VideoFormat with Plain Old Data for global variables. |
| 168 struct VideoFormatPod { | 143 struct VideoFormatPod { |
| 169 int width; // Number of pixels. | 144 int width; // Number of pixels. |
| 170 int height; // Number of pixels. | 145 int height; // Number of pixels. |
| 171 int64_t interval; // Nanoseconds. | 146 int64_t interval; // Nanoseconds. |
| 172 uint32_t fourcc; // Color space. FOURCC_ANY means that any color space is OK. | 147 uint32_t fourcc; // Color space. FOURCC_ANY means that any color space is OK. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 format.width * format.height * format.framerate(); | 219 format.width * format.height * format.framerate(); |
| 245 } | 220 } |
| 246 | 221 |
| 247 // Get a string presentation in the form of "fourcc width x height x fps" | 222 // Get a string presentation in the form of "fourcc width x height x fps" |
| 248 std::string ToString() const; | 223 std::string ToString() const; |
| 249 }; | 224 }; |
| 250 | 225 |
| 251 } // namespace cricket | 226 } // namespace cricket |
| 252 | 227 |
| 253 #endif // WEBRTC_MEDIA_BASE_VIDEOCOMMON_H_ // NOLINT | 228 #endif // WEBRTC_MEDIA_BASE_VIDEOCOMMON_H_ // NOLINT |
| OLD | NEW |