|
vdr-plugin-softhddevice-drm-gles 1.6.2
|
Video Input Stream. More...
Classes | |
| class | cVideoStream |
| Video Input Stream. More... | |
| class | cMainVideoStream |
| Main Video Stream. More... | |
| class | cPipVideoStream |
| PiP Video Stream. More... | |
Enumerations | |
| enum | HardwareQuirks { QUIRK_NO_HW_DEINT = 1 << 0 , QUIRK_CODEC_FLUSH_WORKAROUND = 1 << 1 , QUIRK_CODEC_NEEDS_EXT_INIT = 1 << 2 , QUIRK_CODEC_SKIP_FIRST_FRAMES = 1 << 3 , QUIRK_CODEC_SKIP_NUM_FRAMES = 2 , QUIRK_CODEC_DISABLE_MPEG_HW = 1 << 4 , QUIRK_CODEC_DISABLE_H264_HW = 1 << 5 } |
| Hardware quirks, that are set depending on the hardware used. More... | |
Functions | |
| static size_t | ReadLineFromFile (char *buf, size_t size, const char *file) |
| Helper function to read a line from a given file. | |
| static int | ReadHWPlatform (void) |
| Helper function to find out which platform we are on. | |
| cVideoStream::cVideoStream (cVideoRender *, cQueue< cDrmBuffer > *, cSoftHdConfig *, bool, std::function< void(AVFrame *)>) | |
| Create a video stream. | |
| virtual | cVideoStream::~cVideoStream (void) |
| void | cVideoStream::Flush (void) |
| Flushes the video stream by finalizing any pending data. | |
| bool | cVideoStream::PushAvPacket (AVPacket *avpkt) |
| Pushes a pre-assembled AVPacket directly to the processing queue. | |
| int64_t | cVideoStream::GetInputPtsMs (void) |
| void | cVideoStream::Exit (void) |
| Exit video stream. | |
| void | cVideoStream::ClearVdrCoreToDecoderQueue (void) |
| Clears all video stream data, which is buffered to be decoded. | |
| void | cVideoStream::StartDecoder () |
| Start the decoder. | |
| void | cVideoStream::CloseDecoder (void) |
| Close the decoder. | |
| void | cVideoStream::FlushDecoder (void) |
| Flush the decoder. | |
| void | cVideoStream::CheckForcingFrameDecode (void) |
| Check, if we need to force the decoder to decode the frame (force a decoder drain) | |
| void | cVideoStream::OpenDecoder (void) |
| Open the decoder including an H.264 parsing if needed. | |
| bool | cVideoStream::ParseH264Packet (AVPacket *) |
| Parse an H.264 packet. | |
| void | cVideoStream::DecodeInput (void) |
| Decodes a reassembled codec packet. | |
| void | cVideoStream::GetVideoSize (int *, int *, double *) |
| Get video size and aspect ratio. | |
| void | cVideoStream::Open (AVCodecID, AVCodecParameters *=nullptr, AVRational={ .num=1,.den=90000 }) |
| Open a video codec. | |
| virtual void | cVideoStream::Action (void) |
| Decoding thread loop, which periodically tries to decode input. | |
| void | cVideoStream::Stop (void) |
| Stop the decoding thread. | |
| void | cVideoStream::CancelFilterThread (void) |
| Stop filter thread. | |
| void | cVideoStream::RenderFrame (AVFrame *) |
| Render a frame. | |
Video Input Stream.
Hardware quirks, that are set depending on the hardware used.
Definition at line 44 of file videostream.h.
Decoding thread loop, which periodically tries to decode input.
Definition at line 565 of file videostream.cpp.
References cVideoStream::DecodeInput(), LOGDEBUG, and cVideoStream::m_mutex.
Stop filter thread.
Definition at line 595 of file videostream.cpp.
References cVideoStream::m_checkFilterThreadNeeded, cVideoStream::m_videoFilter, cVideoStream::SetDeinterlacerDeactivated(), and cVideoFilter::Stop().
Referenced by cSoftHdDevice::Clear(), cSoftHdDevice::OnEnteringState(), cSoftHdDevice::OnLeavingState(), and cSoftHdDevice::ResetPipStream().
Check, if we need to force the decoder to decode the frame (force a decoder drain)
Get the number of packets we need to have in the buffer while in interlaced trickspeed mode, in order to get a decoded frameout of the decoder.
In a normal interlaced h264 stream we need to force decoding after sending 2 packets in backwards trickspeed to get a decoded frame, in an mpeg2 stream 1 packet is enough.
This minPkts magic guarantees, that we don't drain the decoder too early, but exactly after the right amount of packets was sent in trickspeed mode.
Definition at line 308 of file videostream.cpp.
References cVideoRender::IsForwardTrickspeed(), cVideoStream::m_interlaced, cVideoStream::m_pDecoder, cVideoStream::m_pRender, cVideoStream::m_sentTrickPkts, cVideoStream::m_trickpkts, and cVideoDecoder::SendPacket().
Referenced by cVideoStream::DecodeInput().
Clears all video stream data, which is buffered to be decoded.
Definition at line 239 of file videostream.cpp.
References AV_NOPTS_VALUE, cQueue< T >::IsEmpty(), LOGDEBUG, cVideoStream::m_identifier, cVideoStream::m_inputPts, cVideoStream::m_packets, cQueue< T >::Pop(), and cQueue< T >::Size().
Referenced by cSoftHdDevice::Clear(), cVideoStream::Exit(), cSoftHdDevice::OnEnteringState(), and cSoftHdDevice::ResetPipStream().
Close the decoder.
Definition at line 265 of file videostream.cpp.
References cVideoDecoder::Close(), L_CODEC, LOGDEBUG2, cVideoStream::m_codecId, cVideoStream::m_dpbFrames, cVideoStream::m_identifier, cVideoStream::m_maxFrameNum, cVideoStream::m_naluTypesAtStart, cVideoStream::m_numIFrames, cVideoStream::m_pDecoder, and cVideoStream::m_pPar.
Referenced by cSoftHdDevice::OnEnteringState(), and cSoftHdDevice::ResetPipStream().
|
protected |
Create a video stream.
Definition at line 157 of file videostream.cpp.
References cSoftHdConfig::ConfigDecoderFallbackToSw, cSoftHdConfig::ConfigDecoderFallbackToSwNumPkts, L_CODEC, LOGDEBUG, LOGDEBUG2, cVideoStream::m_decoderFallbackToSwNumPkts, cVideoStream::m_hardwareQuirks, cVideoStream::m_identifier, and ReadHWPlatform().
Decodes a reassembled codec packet.
Definition at line 451 of file videostream.cpp.
References cVideoStream::CheckForcingFrameDecode(), cVideoStream::FlushDecoder(), cSoftHdConfig::GetDecoderNeedsMaxPackets(), cVideoDecoder::GetFramesReceived(), cVideoDecoder::GetPacketsSent(), cQueue< T >::IsEmpty(), cQueue< T >::IsFull(), cVideoDecoder::IsHardwareDecoder(), cVideoFilter::IsInputBufferFull(), cVideoRender::IsTrickSpeed(), LOGDEBUG, LOGFATAL, LOGWARNING, cVideoStream::m_codecId, cVideoStream::m_decoderFallbackToSwNumPkts, cVideoStream::m_dropInvalidPackets, cVideoStream::m_identifier, cVideoStream::m_isResend, cVideoStream::m_logPackets, cVideoStream::m_naluTypesAtStart, cVideoStream::m_newStream, cVideoStream::m_numIFrames, cVideoStream::m_packets, cVideoStream::m_pConfig, cVideoStream::m_pDecoder, cVideoStream::m_pDrmBufferQueue, cVideoStream::m_pPar, cVideoStream::m_pRender, cVideoStream::m_sentTrickPkts, cVideoStream::m_timebase, cVideoStream::m_videoFilter, cVideoStream::OpenDecoder(), cVideoStream::ParseH264Packet(), cQueue< T >::Peek(), cQueue< T >::Pop(), cVideoDecoder::ReceiveFrame(), cVideoStream::RenderFrame(), cVideoDecoder::ReopenCodec(), cVideoDecoder::SendPacket(), and cSoftHdConfig::SetDecoderNeedsMaxPackets().
Referenced by cVideoStream::Action().
Exit video stream.
Definition at line 221 of file videostream.cpp.
References cVideoStream::ClearVdrCoreToDecoderQueue(), cVideoDecoder::Close(), LOGDEBUG, cVideoStream::m_identifier, cVideoStream::m_pDecoder, and cVideoStream::Stop().
Referenced by cSoftHdDevice::OnEnteringState().
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 190 of file videostream.cpp.
References cVideoStream::m_packets, and cQueue< T >::Push().
Referenced by cSoftHdDevice::HandleStillPicture().
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 284 of file videostream.cpp.
References cVideoDecoder::FlushBuffers(), cVideoDecoder::IsHardwareDecoder(), L_CODEC, LOGDEBUG2, LOGFATAL, cVideoStream::m_codecId, cVideoStream::m_hardwareQuirks, cVideoStream::m_identifier, cVideoStream::m_pDecoder, cVideoStream::m_pPar, cVideoStream::m_timebase, QUIRK_CODEC_FLUSH_WORKAROUND, and cVideoDecoder::ReopenCodec().
Referenced by cSoftHdDevice::Clear(), and cVideoStream::DecodeInput().
Definition at line 213 of file videostream.cpp.
References cVideoStream::m_inputPts, and cVideoStream::m_timebase.
Referenced by cSoftHdDevice::IsBufferingThresholdReached().
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 528 of file videostream.cpp.
References cVideoDecoder::GetContext(), and cVideoStream::m_pDecoder.
Referenced by cSoftHdDevice::GetVideoSize().
| 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 550 of file videostream.cpp.
References cVideoStream::m_codecId, cVideoStream::m_newStream, cVideoStream::m_pPar, cVideoStream::m_timebase, and cVideoStream::m_trickpkts.
Referenced by cSoftHdDevice::SetVideoCodec().
Open the decoder including an H.264 parsing if needed.
Definition at line 324 of file videostream.cpp.
References cSoftHdConfig::ConfigDropInvalidH264PFrames, cSoftHdConfig::ConfigParseH264StreamStart, cSoftHdConfig::CurrentDecoderName, cSoftHdConfig::CurrentDecoderType, cVideoDecoder::IsHardwareDecoder(), L_CODEC, LOGDEBUG2, LOGFATAL, cVideoStream::m_codecId, cVideoStream::m_dropInvalidPackets, cVideoStream::m_hardwareQuirks, cVideoStream::m_identifier, cVideoStream::m_log2MaxFrameNumMinus4, cVideoStream::m_logPackets, cVideoStream::m_newStream, cVideoStream::m_packets, cVideoStream::m_parseH264Dimensions, cVideoStream::m_pConfig, cVideoStream::m_pDecoder, cVideoStream::m_pPar, cVideoStream::m_ppsNumRefIdxL0DefaultActiveMinus1, cVideoStream::m_ppsNumRefIdxL1DefaultActiveMinus1, cVideoStream::m_startDecodingWithIFrame, cVideoStream::m_timebase, cVideoDecoder::Name(), cVideoDecoder::Open(), cQueue< T >::Peek(), cQueue< T >::Pop(), and QUIRK_CODEC_NEEDS_EXT_INIT.
Referenced by cVideoStream::DecodeInput().
Parse an H.264 packet.
Definition at line 373 of file videostream.cpp.
References L_CODEC, LOGDEBUG2, cVideoStream::m_dpbFrames, cVideoStream::m_dropInvalidPackets, cVideoStream::m_identifier, cVideoStream::m_log2MaxFrameNumMinus4, cVideoStream::m_maxFrameNum, cVideoStream::m_naluTypesAtStart, cVideoStream::m_numIFrames, cVideoStream::m_ppsNumRefIdxL0DefaultActiveMinus1, and cVideoStream::m_ppsNumRefIdxL1DefaultActiveMinus1.
Referenced by cVideoStream::DecodeInput().
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 205 of file videostream.cpp.
References AV_NOPTS_VALUE, cVideoStream::m_inputPts, cVideoStream::m_packets, and cQueue< T >::Push().
Referenced by cSoftHdDevice::HandleStillPicture(), and cSoftHdDevice::PlayVideoPkts().
Helper function to find out which platform we are on.
Definition at line 79 of file videostream.cpp.
References L_DRM, LOGDEBUG2, QUIRK_CODEC_FLUSH_WORKAROUND, QUIRK_CODEC_NEEDS_EXT_INIT, QUIRK_CODEC_SKIP_FIRST_FRAMES, QUIRK_NO_HW_DEINT, and ReadLineFromFile().
Referenced by cVideoStream::cVideoStream().
Helper function to read a line from a given file.
| [out] | buf | pointer to the data |
| [out] | size | size of the data at buf |
| [in] | file | the filepointer to be read on |
Definition at line 56 of file videostream.cpp.
References LOGERROR.
Referenced by ReadHWPlatform().
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 611 of file videostream.cpp.
References cVideoDecoder::GetContext(), cVideoFilter::GetNumFramesToFilter(), cVideoFilter::InitAndStart(), isInterlacedFrame(), LOGDEBUG, LOGWARNING, cVideoStream::m_checkFilterThreadNeeded, cVideoStream::m_deinterlacerDeactivated, cVideoStream::m_frameOutput, cVideoStream::m_hardwareQuirks, cVideoStream::m_identifier, cVideoStream::m_interlaced, cVideoStream::m_pDecoder, cVideoStream::m_timebase, cVideoStream::m_userDisabledDeinterlacer, cVideoStream::m_videoFilter, cVideoFilter::PushFrame(), and QUIRK_NO_HW_DEINT.
Referenced by cVideoStream::DecodeInput().
| void cVideoStream::StartDecoder | ( | ) |
Start the decoder.
Definition at line 254 of file videostream.cpp.
References L_CODEC, LOGDEBUG2, cVideoStream::m_hardwareQuirks, cVideoStream::m_identifier, and cVideoStream::m_pDecoder.
Referenced by cSoftHdDevice::OnLeavingState().
Stop the decoding thread.
Definition at line 583 of file videostream.cpp.
References LOGDEBUG.
Referenced by cVideoStream::Exit().
|
virtual |
Definition at line 179 of file videostream.cpp.
References LOGDEBUG.