LIVE

Rtspvideoplugin File

void stop() m_running = false; if (m_thread.joinable()) m_thread.join();

if (avformat_open_input(&m_fmtCtx, rtspUrl, nullptr, &opts) < 0) return false; if (avformat_find_stream_info(m_fmtCtx, nullptr) < 0) return false; // Find video stream int videoStream = -1; for (int i = 0; i < m_fmtCtx->nb_streams; i++) if (m_fmtCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) videoStream = i; break; AVCodec* codec = avcodec_find_decoder(m_fmtCtx->streams[videoStream]->codecpar->codec_id); m_codecCtx = avcodec_alloc_context3(codec); avcodec_parameters_to_context(m_codecCtx, m_fmtCtx->streams[videoStream]->codecpar); avcodec_open2(m_codecCtx, codec, nullptr); m_frame = av_frame_alloc(); return true; rtspvideoplugin

class FFmpegRTSPDecoder AVFormatContext* m_fmtCtx = nullptr; AVCodecContext* m_codecCtx = nullptr; AVFrame* m_frame = nullptr; SwsContext* m_swsCtx = nullptr; void stop() m_running = false; if (m_thread

RTSPVideoPlugin() = default; ~RTSPVideoPlugin() stop(); void stop() m_running = false

Articoli correlati

Andrea Moffa

Andrea Moffa

Eroe numero 50 di Overwatch 2. Appassionato di notizie videoludiche. Esploro e condivido le avventure e le ultime info di questo mondo in continua espansione.

Condividi