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

Method pushData

YUViewLib/src/decoder/decoderLibde265.cpp:414–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414bool decoderLibde265::pushData(QByteArray &data)
415{
416 if (this->decoderState != DecoderState::NeedsMoreData)
417 {
418 DEBUG_LIBDE265("decoderLibde265::pushData: Wrong decoder state.");
419 return false;
420 }
421 if (this->flushing)
422 {
423 DEBUG_LIBDE265("decoderLibde265::pushData: Do not push data when flushing!");
424 return false;
425 }
426
427 // Push the data to the decoder
428 if (data.size() > 0)
429 {
430 // de265_push_NAL expects the NAL data without the start code
431 int offset = 0;
432 if (data.at(0) == (char)0 && data.at(1) == (char)0)
433 {
434 if (data.at(2) == (char)1)
435 offset = 3;
436 if (data.at(2) == (char)0 && data.at(3) == (char)1)
437 offset = 4;
438 }
439 // de265_push_NAL will return either DE265_OK or DE265_ERROR_OUT_OF_MEMORY
440 auto err = this->lib.de265_push_NAL(
441 this->decoder, data.data() + offset, data.size() - offset, 0, nullptr);
442 DEBUG_LIBDE265("decoderLibde265::pushData push data %d bytes%s%s",
443 data.size(),
444 err != DE265_OK ? " - err " : "",
445 err != DE265_OK ? this->lib.de265_get_error_text(err) : "");
446 if (err != DE265_OK)
447 return setErrorB("Error pushing data to decoder (de265_push_NAL): " +
448 QString(this->lib.de265_get_error_text(err)));
449 }
450 else
451 {
452 // The input file is at the end. Switch to flushing mode.
453 DEBUG_LIBDE265("decoderLibde265::pushData input ended - flushing");
454 auto err = this->lib.de265_flush_data(decoder);
455 if (err != DE265_OK)
456 return setErrorB("Error switching to flushing mode.");
457 this->flushing = true;
458 }
459
460 // Check for an available frame
461 if (this->decodeFrame())
462 this->decodedFrameWaiting = true;
463
464 return true;
465}
466
467#if SSE_CONVERSION
468void decoderLibde265::copyImgToByteArray(const de265_image *src, byteArrayAligned &dst)

Callers

nothing calls this directly

Calls 4

decodeFrameMethod · 0.95
sizeMethod · 0.45
atMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected