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

Method getEncodedFrame

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

Source from the content-addressed store, hash-verified

202}
203
204int OfflineVideoEncoder::getEncodedFrame(bool wait, uint8_t** outData, FrameType* outFrameType,
205 int64_t* outFrameIndex) {
206 for (int i = 0; i < SleepCount && outFrames < frames; i++) {
207 FrameInfo outFrameInfo;
208 std::string outFrameInfoFile =
209 JoinPaths(rootPath, "OutFrameInfo-" + std::to_string(outFrames) + ".txt");
210 bool ret = readFrameInfo(outFrameInfo, outFrameInfoFile);
211 if (ret) {
212 std::string h264File = JoinPaths(rootPath, "H264-" + std::to_string(outFrames) + ".264");
213 int size = ReadFileData(h264File, h264Buf.data(), h264Buf.size());
214 if (size > 0 && size == outFrameInfo.frameSize) {
215 printf("read frame=%d size = %d outSize = %d\n", outFrames, size, outFrameInfo.frameSize);
216 *outData = h264Buf.data();
217 *outFrameType = outFrameInfo.frameType;
218 *outFrameIndex = outFrameInfo.timeStamp;
219 outFrames++;
220 return size;
221 }
222 }
223 if (process->state() != QProcess::Running) {
224 qDebug() << "H264EncoderTools abnormal exit: " << process->exitCode();
225 qDebug() << "Error: " << process->error();
226 qDebug() << "Standard Error: " << process->readAllStandardError().data();
227 return -1;
228 }
229 if (wait) {
230 std::this_thread::sleep_for(std::chrono::microseconds(SleepUS));
231 } else {
232 break;
233 }
234 }
235
236 return 0;
237}
238
239bool OfflineVideoEncoder::readEndParam(bool& hasEnd, bool& earlyExit, const std::string& filePath) {
240 QFile file(filePath.data());

Callers 1

getEncodedDataMethod · 0.80

Calls 4

JoinPathsFunction · 0.85
ReadFileDataFunction · 0.85
sizeMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected