Rtspvideoplugin May 2026

Use OBS's obs_source_info structure:

bool readFrame(uint8_t** outRGB, int* width, int* height) AVPacket pkt; if (av_read_frame(m_fmtCtx, &pkt) < 0) return false; if (avcodec_send_packet(m_codecCtx, &pkt) == 0) while (avcodec_receive_frame(m_codecCtx, m_frame) == 0) // Convert YUV to RGB if (!m_swsCtx) m_swsCtx = sws_getContext(m_frame->width, m_frame->height, m_frame->format, m_frame->width, m_frame->height, AV_PIX_FMT_RGB24, SWS_BILINEAR, nullptr, nullptr, nullptr); *width = m_frame->width; *height = m_frame->height; sws_scale(m_swsCtx, m_frame->data, m_frame->linesize, 0, m_frame->height, outRGB, &m_frame->linesize[0]); av_packet_unref(&pkt); return true; av_packet_unref(&pkt); return false; rtspvideoplugin

__declspec(dllexport) void UpdateTexture(void* player, void* texturePtr, int width, int height) uint8_t* rgbData; ((FFmpegRTSPDecoder*)player)->readFrame(&rgbData, &width, &height); // Copy to Unity Texture2D native pointer memcpy(texturePtr, rgbData, width * height * 3); int* height) AVPacket pkt