|
vdr-plugin-softhddevice-drm-gles 1.4.0
|
cVideoStream - Video stream class More...
#include <videostream.h>

Public Member Functions | |
| cVideoStream (cVideoRender *, cQueue< cDrmBuffer > *, cSoftHdConfig *, const char *, std::function< void(AVFrame *)>) | |
| cVideoStream constructor More... | |
| virtual | ~cVideoStream (void) |
| cVideoStream destructor More... | |
| void | DecodeInput (void) |
| Decodes a reassembled codec packet. More... | |
| bool | IsInterlaced (void) |
| void | Open (AVCodecID, AVCodecParameters *=nullptr, AVRational={ .num=1,.den=90000 }) |
| Open a video codec. More... | |
| void | Exit (void) |
| Exit video stream. More... | |
| void | ClearVdrCoreToDecoderQueue (void) |
| Clears all video stream data, which is buffered to be decoded. More... | |
| void | FlushDecoder (void) |
| Flush the decoder. More... | |
| void | CloseDecoder (void) |
| Close the decoder. More... | |
| bool | PushAvPacket (AVPacket *avpkt) |
| Pushes a pre-assembled AVPacket directly to the processing queue. More... | |
| void | Flush (void) |
| Flushes the video stream by finalizing any pending data. More... | |
| cVideoDecoder * | Decoder (void) |
| void | StartDecoder () |
| Start the decoder. More... | |
| size_t | GetAvPacketsFilled (void) |
| bool | IsInputBufferFull (void) |
| enum AVCodecID | GetCodecId (void) |
| void | ResetTrickSpeedFramesSentCounter (void) |
| bool | HasInputPts (void) |
| int64_t | GetInputPtsMs (void) |
| int64_t | GetInputPts (void) |
| void | GetVideoSize (int *, int *, double *) |
| Get video size and aspect ratio. More... | |
| void | ExitDecodingThread (void) |
| Stop decoding thread. More... | |
| void | DecodingThreadHalt (void) |
| void | DecodingThreadResume (void) |
| void | CancelFilterThread (void) |
| Stop filter thread. More... | |
| void | ResetFilterThreadNeededCheck () |
| void | SetDeinterlacerDeactivated (bool deactivate) |
| bool | IsDeinterlacerDeactivated (void) |
| int | HardwareQuirks (void) |
| void | DisableDeint (bool disable) |
Private Member Functions | |
| void | RenderFrame (AVFrame *) |
| Render a frame. More... | |
Private Attributes | |
| cVideoDecoder * | m_pDecoder |
| video decoder More... | |
| cVideoRender * | m_pRender |
| video renderer More... | |
| cFilterThread * | m_pFilterThread |
| pointer to deinterlace filter thread More... | |
| const char * | m_identifier |
| identifier string for logging More... | |
| std::string | m_filterThreadName |
| filter thread name string (persists for object lifetime) More... | |
| std::string | m_decodingThreadName |
| decoding thread name string (persists for object lifetime) More... | |
| std::function< void(AVFrame *)> | m_frameOutput |
| function to output the frame More... | |
| cQueue< cDrmBuffer > * | m_pDrmBufferQueue |
| pointer to renderer's DRM buffer queue More... | |
| bool | m_checkFilterThreadNeeded |
| set, if we have to check, if filter thread is needed at start of playback More... | |
| int | m_hardwareQuirks |
| hardware specific quirks More... | |
| bool | m_userDisabledDeinterlacer = false |
| set, if the user configured the deinterlace to be disabled More... | |
| bool | m_deinterlacerDeactivated = false |
| set, if the deinterlacer shall be deactivated temporarily (used for trick speed and still picture) More... | |
| cQueue< AVPacket > | m_packets {VIDEO_PACKET_MAX} |
| AVPackets queue. More... | |
| enum AVCodecID | m_codecId = AV_CODEC_ID_NONE |
| current codec id More... | |
| AVCodecParameters * | m_pPar = nullptr |
| current codec parameters More... | |
| std::atomic< struct AVRational > | m_timebase |
| current codec timebase More... | |
| int | m_trickpkts |
| how many avpkt does the decoder need in trickspeed mode? More... | |
| int | m_sentTrickPkts = 0 |
| how many avpkt have been sent to the decoder in trickspeed mode? More... | |
| volatile bool | m_newStream |
| flag for new stream More... | |
| bool | m_interlaced |
| flag for interlaced stream More... | |
| cDecodingThread * | m_pDecodingThread |
| pointer to decoding thread More... | |
| int64_t | m_inputPts = AV_NOPTS_VALUE |
| PTS of the first packet in the input buffer. More... | |
cVideoStream - Video stream class
Definition at line 50 of file videostream.h.
| cVideoStream::cVideoStream | ( | cVideoRender * | render, |
| cQueue< cDrmBuffer > * | drmBufferQueue, | ||
| cSoftHdConfig * | config, | ||
| const char * | identifier, | ||
| std::function< void(AVFrame *)> | frameOutput | ||
| ) |
cVideoStream constructor
Definition at line 169 of file videostream.cpp.
References cSoftHdConfig::ConfigDisableDeint, LOGDEBUG, m_codecId, m_filterThreadName, m_frameOutput, m_hardwareQuirks, m_identifier, m_newStream, m_pDecoder, m_pDrmBufferQueue, m_pFilterThread, m_pPar, m_pRender, m_userDisabledDeinterlacer, and ReadHWPlatform().
|
virtual |
cVideoStream destructor
Definition at line 193 of file videostream.cpp.
References LOGDEBUG, and m_pFilterThread.
| void cVideoStream::CancelFilterThread | ( | void | ) |
Stop filter thread.
Definition at line 438 of file videostream.cpp.
References m_checkFilterThreadNeeded, m_pFilterThread, and cFilterThread::Stop().
Referenced by cSoftHdDevice::Clear(), cSoftHdDevice::DelPip(), cSoftHdDevice::OnEnteringState(), and cSoftHdDevice::OnLeavingState().
| void cVideoStream::ClearVdrCoreToDecoderQueue | ( | void | ) |
Clears all video stream data, which is buffered to be decoded.
Definition at line 256 of file videostream.cpp.
References AV_NOPTS_VALUE, cQueue< T >::IsEmpty(), LOGDEBUG, m_identifier, m_inputPts, m_packets, cQueue< T >::Pop(), and cQueue< T >::Size().
Referenced by cSoftHdDevice::Clear(), cSoftHdDevice::DelPip(), Exit(), and cSoftHdDevice::OnEnteringState().
| void cVideoStream::CloseDecoder | ( | void | ) |
Close the decoder.
Definition at line 284 of file videostream.cpp.
References cVideoDecoder::Close(), L_CODEC, LOGDEBUG2, m_codecId, m_identifier, m_pDecoder, and m_pPar.
Referenced by cSoftHdDevice::DelPip(), and cSoftHdDevice::OnEnteringState().
| void cVideoStream::DecodeInput | ( | void | ) |
Decodes a reassembled codec packet.
Definition at line 314 of file videostream.cpp.
References FlushDecoder(), cH264Parser::GetDimensions(), cVideoRender::GetTrickForward(), cVideoRender::GetTrickSpeed(), cQueue< T >::IsEmpty(), cQueue< T >::IsFull(), cFilterThread::IsInputBufferFull(), L_CODEC, LOGDEBUG2, LOGFATAL, m_codecId, m_hardwareQuirks, m_identifier, m_interlaced, m_newStream, m_packets, m_pDecoder, m_pDrmBufferQueue, m_pFilterThread, m_pPar, m_pRender, m_sentTrickPkts, m_timebase, m_trickpkts, cVideoDecoder::Open(), cQueue< T >::Peek(), cQueue< T >::Pop(), QUIRK_CODEC_NEEDS_EXT_INIT, cVideoDecoder::ReceiveFrame(), RenderFrame(), and cVideoDecoder::SendPacket().
Referenced by cDecodingThread::Action().
|
inline |
Definition at line 68 of file videostream.h.
References m_pDecoder.
|
inline |
Definition at line 81 of file videostream.h.
References cDecodingThread::Halt(), and m_pDecodingThread.
Referenced by cSoftHdDevice::Clear(), cSoftHdDevice::DelPip(), and cSoftHdDevice::OnEventReceived().
|
inline |
Definition at line 82 of file videostream.h.
References m_pDecodingThread, and cDecodingThread::Resume().
Referenced by cSoftHdDevice::Clear(), cSoftHdDevice::DelPip(), cSoftHdDevice::OnEnteringState(), and cSoftHdDevice::OnEventReceived().
|
inline |
Definition at line 91 of file videostream.h.
References m_userDisabledDeinterlacer.
Referenced by cSoftHdDevice::SetDisableDeint().
| void cVideoStream::Exit | ( | void | ) |
Exit video stream.
Definition at line 238 of file videostream.cpp.
References ClearVdrCoreToDecoderQueue(), cVideoDecoder::Close(), ExitDecodingThread(), LOGDEBUG, m_identifier, and m_pDecoder.
Referenced by cSoftHdDevice::OnEnteringState().
| void cVideoStream::ExitDecodingThread | ( | void | ) |
Stop decoding thread.
Definition at line 424 of file videostream.cpp.
References LOGDEBUG, m_identifier, m_pDecodingThread, and cDecodingThread::Stop().
Referenced by Exit().
| void cVideoStream::Flush | ( | void | ) |
Flushes the video stream by finalizing any pending data.
This function completes processing of any remaining PES fragments in the fragmentation buffer, then pushes a nullptr packet to the queue to signal a flush operation to the decoder.
Definition at line 207 of file videostream.cpp.
References m_packets, and cQueue< T >::Push().
Referenced by cSoftHdDevice::HandleStillPicture().
| void cVideoStream::FlushDecoder | ( | void | ) |
Flush the decoder.
Some hardware (RPI) needs a reopen workaround (close/open) here, because hardware doesn't do the hardware flush right.
Definition at line 299 of file videostream.cpp.
References cVideoDecoder::FlushBuffers(), L_CODEC, LOGDEBUG2, LOGFATAL, m_codecId, m_hardwareQuirks, m_identifier, m_pDecoder, m_pPar, m_timebase, QUIRK_CODEC_FLUSH_WORKAROUND, and cVideoDecoder::ReopenCodec().
Referenced by cSoftHdDevice::Clear(), and DecodeInput().
|
inline |
Definition at line 70 of file videostream.h.
References m_packets, and cQueue< T >::Size().
Referenced by cVideoRender::DisplayFrame(), cSoftHdDevice::Flush(), cVideoRender::LogDroppedDuped(), and cSoftHdDevice::PlayVideoPkts().
|
inline |
Definition at line 72 of file videostream.h.
References m_codecId.
Referenced by cSoftHdDevice::PlayVideoInternal().
|
inline |
Definition at line 76 of file videostream.h.
References m_inputPts.
| int64_t cVideoStream::GetInputPtsMs | ( | void | ) |
Definition at line 230 of file videostream.cpp.
References m_inputPts, and m_timebase.
Referenced by cSoftHdDevice::IsBufferingThresholdReached().
| void cVideoStream::GetVideoSize | ( | int * | width, |
| int * | height, | ||
| double * | aspect_ratio | ||
| ) |
Get video size and aspect ratio.
| [out] | width | video stream width |
| [out] | height | video stream height |
| [out] | aspect_ratio | video stream aspect ratio (is currently width/ height) |
Definition at line 387 of file videostream.cpp.
References cVideoDecoder::GetContext(), and m_pDecoder.
Referenced by cSoftHdDevice::GetVideoSize().
|
inline |
Definition at line 90 of file videostream.h.
References m_hardwareQuirks.
|
inline |
Definition at line 74 of file videostream.h.
References AV_NOPTS_VALUE, and m_inputPts.
Referenced by cSoftHdDevice::IsBufferingThresholdReached(), and cSoftHdDevice::OnEventReceived().
|
inline |
Definition at line 89 of file videostream.h.
References m_deinterlacerDeactivated.
|
inline |
Definition at line 71 of file videostream.h.
References m_packets, cQueue< T >::Size(), and VIDEO_PACKET_MAX.
Referenced by cSoftHdDevice::PlayVideoInternal(), and cSoftHdDevice::Poll().
|
inline |
Definition at line 57 of file videostream.h.
Referenced by cVideoRender::GetTrickSpeed().
| void cVideoStream::Open | ( | AVCodecID | codecId, |
| AVCodecParameters * | par = nullptr, |
||
| AVRational | timebase = { .num = 1, .den = 90000 } |
||
| ) |
Open a video codec.
| codecId | video codec id |
| par | video codec parameters |
| timebase | timebase |
Definition at line 409 of file videostream.cpp.
References m_codecId, m_newStream, m_pPar, m_timebase, and m_trickpkts.
Referenced by cSoftHdDevice::PlayVideoInternal(), and cSoftHdDevice::SetVideoCodec().
| bool cVideoStream::PushAvPacket | ( | AVPacket * | avpkt | ) |
Pushes a pre-assembled AVPacket directly to the processing queue.
This function bypasses the PES fragmentation/reassembly mechanism and directly pushes an already-complete AVPacket to the m_packets queue for decoding. Used when packets are received from sources that don't require fragmentation handling.
| avpkt | The AVPacket to push to the queue |
Definition at line 222 of file videostream.cpp.
References AV_NOPTS_VALUE, m_inputPts, m_packets, and cQueue< T >::Push().
Referenced by cSoftHdDevice::HandleStillPicture(), cSoftHdDevice::PlayVideoInternal(), and cSoftHdDevice::PlayVideoPkts().
|
private |
Render a frame.
Frames either go through the filter thread or directly into the render buffer.
| videoCtx | ffmpeg video codec context |
| frame | frame to render |
Definition at line 453 of file videostream.cpp.
References cVideoDecoder::GetContext(), cFilterThread::GetNumFramesToFilter(), cFilterThread::InitAndStart(), isInterlacedFrame(), LOGDEBUG, LOGWARNING, m_checkFilterThreadNeeded, m_deinterlacerDeactivated, m_frameOutput, m_hardwareQuirks, m_identifier, m_interlaced, m_pDecoder, m_pFilterThread, m_timebase, m_userDisabledDeinterlacer, cFilterThread::PushFrame(), and QUIRK_NO_HW_DEINT.
Referenced by DecodeInput().
|
inline |
Definition at line 86 of file videostream.h.
References m_checkFilterThreadNeeded.
Referenced by cSoftHdDevice::OnEventReceived(), and cSoftHdDevice::OnLeavingState().
|
inline |
Definition at line 73 of file videostream.h.
References m_sentTrickPkts.
Referenced by cSoftHdDevice::OnLeavingState().
|
inline |
Definition at line 88 of file videostream.h.
References m_deinterlacerDeactivated.
Referenced by cSoftHdDevice::OnEnteringState(), and cSoftHdDevice::OnLeavingState().
| void cVideoStream::StartDecoder | ( | ) |
Start the decoder.
Definition at line 271 of file videostream.cpp.
References L_CODEC, LOGDEBUG2, m_decodingThreadName, m_hardwareQuirks, m_identifier, m_pDecoder, and m_pDecodingThread.
Referenced by cSoftHdDevice::OnLeavingState().
|
private |
set, if we have to check, if filter thread is needed at start of playback
Definition at line 103 of file videostream.h.
Referenced by CancelFilterThread(), RenderFrame(), and ResetFilterThreadNeededCheck().
|
private |
current codec id
Definition at line 110 of file videostream.h.
Referenced by CloseDecoder(), cVideoStream(), DecodeInput(), FlushDecoder(), GetCodecId(), and Open().
|
private |
decoding thread name string (persists for object lifetime)
Definition at line 99 of file videostream.h.
Referenced by StartDecoder().
|
private |
set, if the deinterlacer shall be deactivated temporarily (used for trick speed and still picture)
Definition at line 106 of file videostream.h.
Referenced by IsDeinterlacerDeactivated(), RenderFrame(), and SetDeinterlacerDeactivated().
|
private |
filter thread name string (persists for object lifetime)
Definition at line 98 of file videostream.h.
Referenced by cVideoStream().
|
private |
function to output the frame
Definition at line 100 of file videostream.h.
Referenced by cVideoStream(), and RenderFrame().
|
private |
hardware specific quirks
Definition at line 104 of file videostream.h.
Referenced by cVideoStream(), DecodeInput(), FlushDecoder(), HardwareQuirks(), RenderFrame(), and StartDecoder().
|
private |
identifier string for logging
Definition at line 97 of file videostream.h.
Referenced by ClearVdrCoreToDecoderQueue(), CloseDecoder(), cVideoStream(), DecodeInput(), Exit(), ExitDecodingThread(), FlushDecoder(), RenderFrame(), and StartDecoder().
|
private |
PTS of the first packet in the input buffer.
Definition at line 119 of file videostream.h.
Referenced by ClearVdrCoreToDecoderQueue(), GetInputPts(), GetInputPtsMs(), HasInputPts(), and PushAvPacket().
|
private |
flag for interlaced stream
Definition at line 116 of file videostream.h.
Referenced by DecodeInput(), and RenderFrame().
|
private |
flag for new stream
Definition at line 115 of file videostream.h.
Referenced by cVideoStream(), DecodeInput(), and Open().
|
private |
AVPackets queue.
Definition at line 108 of file videostream.h.
Referenced by ClearVdrCoreToDecoderQueue(), DecodeInput(), Flush(), GetAvPacketsFilled(), IsInputBufferFull(), and PushAvPacket().
|
private |
video decoder
Definition at line 94 of file videostream.h.
Referenced by CloseDecoder(), cVideoStream(), DecodeInput(), Decoder(), Exit(), FlushDecoder(), GetVideoSize(), RenderFrame(), and StartDecoder().
|
private |
pointer to decoding thread
Definition at line 118 of file videostream.h.
Referenced by DecodingThreadHalt(), DecodingThreadResume(), ExitDecodingThread(), and StartDecoder().
|
private |
pointer to renderer's DRM buffer queue
Definition at line 101 of file videostream.h.
Referenced by cVideoStream(), and DecodeInput().
|
private |
pointer to deinterlace filter thread
Definition at line 96 of file videostream.h.
Referenced by CancelFilterThread(), cVideoStream(), DecodeInput(), RenderFrame(), and ~cVideoStream().
|
private |
current codec parameters
Definition at line 111 of file videostream.h.
Referenced by CloseDecoder(), cVideoStream(), DecodeInput(), FlushDecoder(), and Open().
|
private |
video renderer
Definition at line 95 of file videostream.h.
Referenced by cVideoStream(), and DecodeInput().
|
private |
how many avpkt have been sent to the decoder in trickspeed mode?
Definition at line 114 of file videostream.h.
Referenced by DecodeInput(), and ResetTrickSpeedFramesSentCounter().
|
private |
current codec timebase
Definition at line 112 of file videostream.h.
Referenced by DecodeInput(), FlushDecoder(), GetInputPtsMs(), Open(), and RenderFrame().
|
private |
how many avpkt does the decoder need in trickspeed mode?
Definition at line 113 of file videostream.h.
Referenced by DecodeInput(), and Open().
|
private |
set, if the user configured the deinterlace to be disabled
Definition at line 105 of file videostream.h.
Referenced by cVideoStream(), DisableDeint(), and RenderFrame().