MCPcopy Create free account
hub / github.com/Tencent/libpag / readFrameInfo

Method readFrameInfo

exporter/src/export/encode/OfflineVideoEncoder.cpp:269–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269bool OfflineVideoEncoder::readFrameInfo(FrameInfo& frameInfo, const std::string& filePath) {
270 QFile file(filePath.data());
271 if (!file.open(QIODevice::ReadOnly)) {
272 return false;
273 }
274
275 QJsonParseError parseError;
276 QJsonDocument doc = QJsonDocument::fromJson(file.readAll(), &parseError);
277 file.close();
278 if (parseError.error != QJsonParseError::NoError) {
279 return false;
280 }
281
282 if (doc.isObject()) {
283 QJsonObject obj = doc.object();
284 frameInfo.frameType = static_cast<FrameType>(obj.value("FrameType").toInt());
285 frameInfo.timeStamp = obj.value("TimeStamp").toInt();
286 frameInfo.frameSize = obj.value("FrameSize").toInt();
287 return true;
288 }
289 return false;
290}
291
292bool OfflineVideoEncoder::writeFrameInfo(const FrameInfo& frameInfo, const std::string& filePath) {
293 std::string frameInfoData = QString(R"({ "FrameType": %1, "TimeStamp": %2, "FrameSize": %3 })")

Callers

nothing calls this directly

Calls 4

valueMethod · 0.80
dataMethod · 0.45
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected