| 237 | } |
| 238 | |
| 239 | bool OfflineVideoEncoder::readEndParam(bool& hasEnd, bool& earlyExit, const std::string& filePath) { |
| 240 | QFile file(filePath.data()); |
| 241 | if (!file.open(QIODevice::ReadOnly)) { |
| 242 | return false; |
| 243 | } |
| 244 | |
| 245 | QJsonParseError parseError; |
| 246 | QJsonDocument doc = QJsonDocument::fromJson(file.readAll(), &parseError); |
| 247 | file.close(); |
| 248 | if (parseError.error != QJsonParseError::NoError) { |
| 249 | return false; |
| 250 | } |
| 251 | |
| 252 | if (doc.isObject()) { |
| 253 | QJsonObject obj = doc.object(); |
| 254 | hasEnd = obj.value("HasEnd").toInt() == 1; |
| 255 | earlyExit = obj.value("EarlyExit").toInt() == 1; |
| 256 | return true; |
| 257 | } |
| 258 | return false; |
| 259 | } |
| 260 | |
| 261 | bool OfflineVideoEncoder::writeEndParam(bool hasEnd, bool earlyExit, const std::string& filePath) { |
| 262 | std::string endData = QString(R"({ "HasEnd": %1, "EarlyExit": %2 })") |