Lines Matching defs:pStrm

40 static int videoRecEncodeAndWrite(PVIDEORECSTREAM pStrm);
41 static int videoRecRGBToYUV(PVIDEORECSTREAM pStrm);
404 PVIDEORECSTREAM pStrm = &pCtx->Strm[uScreen];
405 if ( pStrm->fEnabled
406 && ASMAtomicReadBool(&pStrm->fRgbFilled))
408 rc = videoRecRGBToYUV(pStrm);
409 ASMAtomicWriteBool(&pStrm->fRgbFilled, false);
411 rc = videoRecEncodeAndWrite(pStrm);
486 PVIDEORECSTREAM pStrm = &pCtx->Strm[uScreen];
487 pStrm->uTargetWidth = uWidth;
488 pStrm->uTargetHeight = uHeight;
489 pStrm->pu8RgbBuf = (uint8_t *)RTMemAllocZ(uWidth * uHeight * 4);
490 AssertReturn(pStrm->pu8RgbBuf, VERR_NO_MEMORY);
491 pStrm->uEncoderDeadline = VPX_DL_REALTIME;
497 int rc = pStrm->Ebml.create(pszFile);
504 vpx_codec_err_t rcv = vpx_codec_enc_config_default(DEFAULTCODEC, &pStrm->VpxConfig, 0);
523 pStrm->uEncoderDeadline = VPX_DL_REALTIME;
527 pStrm->uEncoderDeadline = 1000000 / uFps;
531 pStrm->uEncoderDeadline = VPX_DL_BEST_QUALITY;
536 pStrm->uEncoderDeadline = value.toUInt32();
544 pStrm->VpxConfig.rc_target_bitrate = uRate;
546 pStrm->VpxConfig.g_w = uWidth;
548 pStrm->VpxConfig.g_h = uHeight;
550 pStrm->VpxConfig.g_timebase.num = 1;
551 pStrm->VpxConfig.g_timebase.den = 1000;
553 pStrm->VpxConfig.g_threads = 0;
555 pStrm->uDelay = 1000 / uFps;
558 rc = pStrm->Ebml.writeHeader(&pStrm->VpxConfig, &arg_framerate);
562 rcv = vpx_codec_enc_init(&pStrm->VpxCodec, DEFAULTCODEC, &pStrm->VpxConfig, 0);
569 if (!vpx_img_alloc(&pStrm->VpxRawImage, VPX_IMG_FMT_I420, uWidth, uHeight, 1))
574 pStrm->pu8YuvBuf = pStrm->VpxRawImage.planes[0];
577 pStrm->fEnabled = true;
612 PVIDEORECSTREAM pStrm = &pCtx->Strm[uScreen];
613 if (pStrm->fEnabled)
615 int rc = pStrm->Ebml.writeFooter(0);
617 pStrm->Ebml.close();
618 vpx_img_free(&pStrm->VpxRawImage);
619 vpx_codec_err_t rcv = vpx_codec_destroy(&pStrm->VpxCodec);
621 RTMemFree(pStrm->pu8RgbBuf);
622 pStrm->pu8RgbBuf = NULL;
625 pStrm->Ebml.~WebMWriter();
661 PVIDEORECSTREAM pStrm = &pCtx->Strm[uScreen];
662 if (!pStrm->fEnabled)
665 if (u64TimeStamp < pStrm->u64LastTimeStamp + pStrm->uDelay)
668 if (ASMAtomicReadBool(&pStrm->fRgbFilled))
686 PVIDEORECSTREAM pStrm = &pCtx->Strm[uScreen];
687 if(!pStrm->fEnabled)
695 uint64_t sizeInMB = pStrm->Ebml.getFileSize() / (1024 * 1024);
700 if (pStrm->Ebml.getAvailableSpace() < 0x100000)
718 static int videoRecEncodeAndWrite(PVIDEORECSTREAM pStrm)
721 vpx_codec_pts_t pts = pStrm->u64TimeStamp;
722 vpx_codec_err_t rcv = vpx_codec_encode(&pStrm->VpxCodec,
723 &pStrm->VpxRawImage,
725 pStrm->uDelay /* how long to show this frame */,
727 pStrm->uEncoderDeadline /* quality setting */);
738 const vpx_codec_cx_pkt_t *pkt = vpx_codec_get_cx_data(&pStrm->VpxCodec, &iter);
744 rc = pStrm->Ebml.writeBlock(&pStrm->VpxConfig, pkt);
752 pStrm->cFrame++;
762 static int videoRecRGBToYUV(PVIDEORECSTREAM pStrm)
764 switch (pStrm->u32PixelFormat)
768 if (!colorConvWriteYUV420p<ColorConvBGRA32Iter>(pStrm->uTargetWidth,
769 pStrm->uTargetHeight,
770 pStrm->pu8YuvBuf,
771 pStrm->pu8RgbBuf))
776 if (!colorConvWriteYUV420p<ColorConvBGR24Iter>(pStrm->uTargetWidth,
777 pStrm->uTargetHeight,
778 pStrm->pu8YuvBuf,
779 pStrm->pu8RgbBuf))
784 if (!colorConvWriteYUV420p<ColorConvBGR565Iter>(pStrm->uTargetWidth,
785 pStrm->uTargetHeight,
786 pStrm->pu8YuvBuf,
787 pStrm->pu8RgbBuf))
832 PVIDEORECSTREAM pStrm = &pCtx->Strm[uScreen];
833 if (!pStrm->fEnabled)
838 if (u64TimeStamp < pStrm->u64LastTimeStamp + pStrm->uDelay)
843 if (ASMAtomicReadBool(&pStrm->fRgbFilled))
849 pStrm->u64LastTimeStamp = u64TimeStamp;
851 int xDiff = ((int)pStrm->uTargetWidth - (int)uSourceWidth) / 2;
870 int yDiff = ((int)pStrm->uTargetHeight - (int)uSourceHeight) / 2;
887 if ( destX > pStrm->uTargetWidth
888 || destY > pStrm->uTargetHeight)
894 if (destX + w > pStrm->uTargetWidth)
895 w = pStrm->uTargetWidth - destX;
897 if (destY + h > pStrm->uTargetHeight)
898 h = pStrm->uTargetHeight - destY;
907 pStrm->u32PixelFormat = VPX_IMG_FMT_RGB32;
911 pStrm->u32PixelFormat = VPX_IMG_FMT_RGB24;
915 pStrm->u32PixelFormat = VPX_IMG_FMT_RGB565;
928 if ( uSourceWidth < pStrm->uLastSourceWidth
929 || uSourceHeight < pStrm->uLastSourceHeight)
930 memset(pStrm->pu8RgbBuf, 0, pStrm->uTargetWidth * pStrm->uTargetHeight * 4);
932 pStrm->uLastSourceWidth = uSourceWidth;
933 pStrm->uLastSourceHeight = uSourceHeight;
937 uint32_t offDst = (destY * pStrm->uTargetWidth + destX) * bpp;
943 Assert(offDst + w * bpp <= pStrm->uTargetHeight * pStrm->uTargetWidth * bpp);
944 memcpy(pStrm->pu8RgbBuf + offDst, pu8BufAddr + offSrc, w * bpp);
946 offDst += pStrm->uTargetWidth * bpp;
949 pStrm->u64TimeStamp = u64TimeStamp;
951 ASMAtomicWriteBool(&pStrm->fRgbFilled, true);