Save profile to file system
| 238 | |
| 239 | // Save profile to file system |
| 240 | void Profile::Save(const std::string& file_path) const { |
| 241 | std::ofstream file(file_path); |
| 242 | if (!file.is_open()) { |
| 243 | throw std::ios_base::failure("Failed to save profile."); |
| 244 | } |
| 245 | |
| 246 | file << "description=" << info.description << "\n"; |
| 247 | file << "frame_rate_num=" << info.fps.num << "\n"; |
| 248 | file << "frame_rate_den=" << info.fps.den << "\n"; |
| 249 | file << "width=" << info.width << "\n"; |
| 250 | file << "height=" << info.height << "\n"; |
| 251 | file << "progressive=" << !info.interlaced_frame << "\n"; // Correct the boolean value for progressive/interlaced |
| 252 | file << "sample_aspect_num=" << info.pixel_ratio.num << "\n"; |
| 253 | file << "sample_aspect_den=" << info.pixel_ratio.den << "\n"; |
| 254 | file << "display_aspect_num=" << info.display_ratio.num << "\n"; |
| 255 | file << "display_aspect_den=" << info.display_ratio.den << "\n"; |
| 256 | file << "pixel_format=" << info.pixel_format << "\n"; |
| 257 | file << "spherical=" << info.spherical; |
| 258 | |
| 259 | file.close(); |
| 260 | } |
| 261 | |
| 262 | // Generate JSON string of this object |
| 263 | std::string Profile::Json() const { |
nothing calls this directly
no outgoing calls
no test coverage detected