MCPcopy Create free account
hub / github.com/IENT/YUView / pushData

Method pushData

YUViewLib/src/decoder/decoderVVDec.cpp:410–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408}
409
410bool decoderVVDec::pushData(QByteArray &data)
411{
412 if (decoderState != DecoderState::NeedsMoreData)
413 {
414 DEBUG_vvdec("decoderVVDec::pushData: Wrong decoder state.");
415 return false;
416 }
417 if (this->flushing)
418 {
419 DEBUG_vvdec("decoderVVDec::pushData: Don't push more data when flushing.");
420 return false;
421 }
422
423 bool endOfFile = (data.length() == 0);
424 if (endOfFile)
425 {
426 DEBUG_vvdec("decoderVVDec::pushData: Setting flushing mode");
427 this->flushing = true;
428 this->decoderState = DecoderState::RetrieveFrames;
429 this->currentOutputBuffer.clear();
430 return true;
431 }
432 else
433 {
434 if (data.size() > this->accessUnit->payloadSize)
435 return setErrorB("Access unit too big to push");
436
437 std::memcpy(this->accessUnit->payload, data.constData(), data.size());
438 this->accessUnit->payloadUsedSize = data.size();
439
440 auto ret = this->lib.vvdec_decode(this->decoder, this->accessUnit, &this->currentFrame);
441 if (ret == VVDEC_EOF)
442 endOfFile = true;
443 else if (ret != VVDEC_TRY_AGAIN && ret != VVDEC_OK)
444 {
445 auto cErr = this->lib.vvdec_get_last_error(this->decoder);
446 auto cErrAdd = this->lib.vvdec_get_last_additional_error(this->decoder);
447 return setErrorB(QString("Error pushing data to decoder length %1 - %2 - %3")
448 .arg(data.length())
449 .arg(cErr)
450 .arg(cErrAdd));
451 }
452
453 DEBUG_vvdec("decoderVVDec::pushData pushed NAL length %d%s",
454 data.length(),
455 this->currentFrame != nullptr ? " frameAvailable" : "");
456 }
457
458 if (this->getNextFrameFromDecoder())
459 {
460 this->decoderState = DecoderState::RetrieveFrames;
461 this->currentOutputBuffer.clear();
462 }
463
464 return true;
465}
466
467QByteArray decoderVVDec::getRawFrameData()

Callers

nothing calls this directly

Calls 3

clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected