vdr-plugin-softhddevice-drm-gles 1.6.2
cVideoStream Class Reference

Video Input Stream. More...

#include <videostream.h>

Public Member Functions

virtual ~cVideoStream (void)
 
void DecodeInput (void)
 Decodes a reassembled codec packet.
 
bool IsInterlaced (void)
 
void Open (AVCodecID, AVCodecParameters *=nullptr, AVRational={ .num=1,.den=90000 })
 Open a video codec.
 
void Exit (void)
 Exit video stream.
 
void ClearVdrCoreToDecoderQueue (void)
 Clears all video stream data, which is buffered to be decoded.
 
void FlushDecoder (void)
 Flush the decoder.
 
void CloseDecoder (void)
 Close the decoder.
 
bool PushAvPacket (AVPacket *avpkt)
 Pushes a pre-assembled AVPacket directly to the processing queue.
 
void Flush (void)
 Flushes the video stream by finalizing any pending data.
 
void Stop (void)
 Stop the decoding thread.
 
void Halt (void)
 
void Resume (void)
 
cVideoDecoderDecoder (void)
 
void StartDecoder ()
 Start the decoder.
 
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 ResetInputPts (void)
 
void GetVideoSize (int *, int *, double *)
 Get video size and aspect ratio.
 
int GetVideoPacketMax (void)
 
void CancelFilterThread (void)
 Stop filter thread.
 
void ResetFilterThreadNeededCheck ()
 
virtual void SetDeinterlacerDeactivated (bool deactivate)
 
bool IsDeinterlacerDeactivated (void)
 
int HardwareQuirks (void)
 
void DisableDeint (bool disable)
 
void SetStartDecodingWithIFrame (bool enable)
 
void SetParseH264Dimensions (bool enable)
 
void SetDecoderFallbackToSwNumPkts (int numPackets)
 

Protected Member Functions

 cVideoStream (cVideoRender *, cQueue< cDrmBuffer > *, cSoftHdConfig *, bool, std::function< void(AVFrame *)>)
 Create a video stream.
 
virtual void Action (void)
 Decoding thread loop, which periodically tries to decode input.
 

Private Member Functions

void RenderFrame (AVFrame *)
 Render a frame.
 
void CheckForcingFrameDecode (void)
 Check, if we need to force the decoder to decode the frame (force a decoder drain)
 
void OpenDecoder (void)
 Open the decoder including an H.264 parsing if needed.
 
bool ParseH264Packet (AVPacket *)
 Parse an H.264 packet.
 

Private Attributes

cSoftHdConfigm_pConfig
 plugin config
 
cVideoDecoderm_pDecoder
 video decoder
 
cVideoRenderm_pRender
 video renderer
 
const charm_identifier
 identifier string for logging
 
std::function< void(AVFrame *)> m_frameOutput
 function to output the frame
 
cQueue< cDrmBuffer > * m_pDrmBufferQueue
 pointer to renderer's DRM buffer queue
 
cVideoFilter m_videoFilter
 pointer to deinterlace/scaling video filter thread
 
std::mutex m_mutex
 mutex for decoding thread control
 
bool m_checkFilterThreadNeeded
 set, if we have to check, if filter thread is needed at start of playback
 
int m_hardwareQuirks
 hardware specific quirks
 
bool m_userDisabledDeinterlacer = false
 set, if the user configured the deinterlace to be disabled
 
bool m_deinterlacerDeactivated
 set, if the deinterlacer should be disabled temporarily (trickspeed, stillpicture, pip)
 
bool m_startDecodingWithIFrame = false
 wait for an I-Frame to start h264 decoding
 
bool m_parseH264Dimensions = false
 parse width and height when starting an h264 stream
 
int m_decoderFallbackToSwNumPkts = 22
 fallback to sw decoder if hw decoder fails after the given number of packets sent
 
cQueue< AVPacketm_packets {VIDEO_PACKET_MAX}
 AVPackets queue.
 
enum AVCodecID m_codecId = AV_CODEC_ID_NONE
 current codec id
 
AVCodecParametersm_pPar = nullptr
 current codec parameters
 
std::atomic< struct AVRationalm_timebase
 current codec timebase
 
int m_trickpkts
 how many avpkt does the decoder need in trickspeed mode?
 
int m_sentTrickPkts = 0
 how many avpkt have been sent to the decoder in trickspeed mode?
 
volatile bool m_newStream = false
 flag for new stream
 
bool m_interlaced
 flag for interlaced stream
 
int64_t m_inputPts = AV_NOPTS_VALUE
 PTS of the first packet in the input buffer.
 
std::vector< std::string > m_naluTypesAtStart
 array of strings to log the H.264 frames at stream start
 
int m_numIFrames = 0
 counter for the arriving I-Frames at H.264 stream start
 
int m_logPackets = 0
 parse and log all frames until the number of given I-Frames arrived
 
int m_dropInvalidPackets = 0
 drop P-Frames with invalid references until the given number of I-Frames arrived
 
std::set< intm_dpbFrames
 private set of reference frames (internal short-time decoded picture buffer)
 
int m_maxFrameNum = 1
 = 1 << Log2MaxFrameNumMinus4 + 4
 
int m_log2MaxFrameNumMinus4 = -4
 cache Log2MaxFrameNumMinus4 from a previous SPS parsing
 
int m_ppsNumRefIdxL0DefaultActiveMinus1 = -1
 cache NumRefIdxL0DefaultActiveMinuns1 from a previous PPS parsing
 
int m_ppsNumRefIdxL1DefaultActiveMinus1 = -1
 cache NumRefIdxL1DefaultActiveMinuns1 from a previous PPS parsing
 
bool m_isResend = false
 track, if we already tried to send the AVPacket to the decoder if so, skip the parsing
 

Static Private Attributes

static constexpr int VIDEO_PACKET_MAX = 192
 max number of video packets held in the buffer
 

Detailed Description

Video Input Stream.

Definition at line 57 of file videostream.h.

Member Function Documentation

◆ Decoder()

cVideoDecoder * cVideoStream::Decoder ( void  )
inline

Definition at line 78 of file videostream.h.

References m_pDecoder.

◆ DisableDeint()

void cVideoStream::DisableDeint ( bool  disable)
inline

Definition at line 98 of file videostream.h.

References m_userDisabledDeinterlacer.

Referenced by cSoftHdDevice::SetDisableDeint().

◆ GetAvPacketsFilled()

size_t cVideoStream::GetAvPacketsFilled ( void  )
inline

◆ GetCodecId()

enum AVCodecID cVideoStream::GetCodecId ( void  )
inline

Definition at line 82 of file videostream.h.

References m_codecId.

◆ GetInputPts()

int64_t cVideoStream::GetInputPts ( void  )
inline

Definition at line 86 of file videostream.h.

References m_inputPts.

◆ GetVideoPacketMax()

int cVideoStream::GetVideoPacketMax ( void  )
inline

Definition at line 89 of file videostream.h.

References VIDEO_PACKET_MAX.

Referenced by cSoftHdDevice::PlayVideoPkts().

◆ Halt()

void cVideoStream::Halt ( void  )
inline

◆ HardwareQuirks()

int cVideoStream::HardwareQuirks ( void  )
inline

Definition at line 97 of file videostream.h.

References m_hardwareQuirks.

◆ HasInputPts()

bool cVideoStream::HasInputPts ( void  )
inline

◆ IsDeinterlacerDeactivated()

bool cVideoStream::IsDeinterlacerDeactivated ( void  )
inline

Definition at line 96 of file videostream.h.

References m_deinterlacerDeactivated.

◆ IsInputBufferFull()

bool cVideoStream::IsInputBufferFull ( void  )
inline

Definition at line 81 of file videostream.h.

References m_packets, cQueue< T >::Size(), and VIDEO_PACKET_MAX.

Referenced by cSoftHdDevice::PlayPipVideo(), and cSoftHdDevice::Poll().

◆ IsInterlaced()

bool cVideoStream::IsInterlaced ( void  )
inline

Definition at line 62 of file videostream.h.

◆ ResetFilterThreadNeededCheck()

void cVideoStream::ResetFilterThreadNeededCheck ( )
inline

◆ ResetInputPts()

void cVideoStream::ResetInputPts ( void  )
inline

Definition at line 87 of file videostream.h.

References AV_NOPTS_VALUE, and m_inputPts.

Referenced by cSoftHdDevice::HandleStillPicture().

◆ ResetTrickSpeedFramesSentCounter()

void cVideoStream::ResetTrickSpeedFramesSentCounter ( void  )
inline

Definition at line 83 of file videostream.h.

References m_sentTrickPkts.

Referenced by cSoftHdDevice::OnLeavingState().

◆ Resume()

void cVideoStream::Resume ( void  )
inline

◆ SetDecoderFallbackToSwNumPkts()

void cVideoStream::SetDecoderFallbackToSwNumPkts ( int  numPackets)
inline

Definition at line 101 of file videostream.h.

References m_decoderFallbackToSwNumPkts.

Referenced by cSoftHdDevice::SetDecoderFallbackToSw().

◆ SetDeinterlacerDeactivated()

virtual void cVideoStream::SetDeinterlacerDeactivated ( bool  deactivate)
inlinevirtual

◆ SetParseH264Dimensions()

void cVideoStream::SetParseH264Dimensions ( bool  enable)
inline

Definition at line 100 of file videostream.h.

References m_parseH264Dimensions.

Referenced by cSoftHdDevice::SetParseH264Dimensions().

◆ SetStartDecodingWithIFrame()

void cVideoStream::SetStartDecodingWithIFrame ( bool  enable)
inline

Definition at line 99 of file videostream.h.

References m_startDecodingWithIFrame.

Referenced by cSoftHdDevice::SetDecoderNeedsIFrame().

Member Data Documentation

◆ m_checkFilterThreadNeeded

bool cVideoStream::m_checkFilterThreadNeeded
private

set, if we have to check, if filter thread is needed at start of playback

Definition at line 117 of file videostream.h.

Referenced by CancelFilterThread(), RenderFrame(), and ResetFilterThreadNeededCheck().

◆ m_codecId

enum AVCodecID cVideoStream::m_codecId = AV_CODEC_ID_NONE
private

current codec id

Definition at line 128 of file videostream.h.

Referenced by CloseDecoder(), DecodeInput(), FlushDecoder(), GetCodecId(), Open(), and OpenDecoder().

◆ m_decoderFallbackToSwNumPkts

int cVideoStream::m_decoderFallbackToSwNumPkts = 22
private

fallback to sw decoder if hw decoder fails after the given number of packets sent

Definition at line 123 of file videostream.h.

Referenced by cVideoStream(), DecodeInput(), and SetDecoderFallbackToSwNumPkts().

◆ m_deinterlacerDeactivated

bool cVideoStream::m_deinterlacerDeactivated
private

set, if the deinterlacer should be disabled temporarily (trickspeed, stillpicture, pip)

Definition at line 120 of file videostream.h.

Referenced by IsDeinterlacerDeactivated(), RenderFrame(), and SetDeinterlacerDeactivated().

◆ m_dpbFrames

std::set<int> cVideoStream::m_dpbFrames
private

private set of reference frames (internal short-time decoded picture buffer)

Definition at line 143 of file videostream.h.

Referenced by CloseDecoder(), and ParseH264Packet().

◆ m_dropInvalidPackets

int cVideoStream::m_dropInvalidPackets = 0
private

drop P-Frames with invalid references until the given number of I-Frames arrived

Definition at line 142 of file videostream.h.

Referenced by DecodeInput(), OpenDecoder(), and ParseH264Packet().

◆ m_frameOutput

std::function<void(AVFrame *)> cVideoStream::m_frameOutput
private

function to output the frame

Definition at line 112 of file videostream.h.

Referenced by RenderFrame().

◆ m_hardwareQuirks

int cVideoStream::m_hardwareQuirks
private

hardware specific quirks

Definition at line 118 of file videostream.h.

Referenced by cVideoStream(), FlushDecoder(), HardwareQuirks(), OpenDecoder(), RenderFrame(), and StartDecoder().

◆ m_identifier

const char* cVideoStream::m_identifier
private

◆ m_inputPts

int64_t cVideoStream::m_inputPts = AV_NOPTS_VALUE
private

PTS of the first packet in the input buffer.

Definition at line 136 of file videostream.h.

Referenced by ClearVdrCoreToDecoderQueue(), GetInputPts(), GetInputPtsMs(), HasInputPts(), PushAvPacket(), and ResetInputPts().

◆ m_interlaced

bool cVideoStream::m_interlaced
private

flag for interlaced stream

Definition at line 134 of file videostream.h.

Referenced by CheckForcingFrameDecode(), and RenderFrame().

◆ m_isResend

bool cVideoStream::m_isResend = false
private

track, if we already tried to send the AVPacket to the decoder if so, skip the parsing

Definition at line 148 of file videostream.h.

Referenced by DecodeInput().

◆ m_log2MaxFrameNumMinus4

int cVideoStream::m_log2MaxFrameNumMinus4 = -4
private

cache Log2MaxFrameNumMinus4 from a previous SPS parsing

Definition at line 145 of file videostream.h.

Referenced by OpenDecoder(), and ParseH264Packet().

◆ m_logPackets

int cVideoStream::m_logPackets = 0
private

parse and log all frames until the number of given I-Frames arrived

Definition at line 141 of file videostream.h.

Referenced by DecodeInput(), and OpenDecoder().

◆ m_maxFrameNum

int cVideoStream::m_maxFrameNum = 1
private

= 1 << Log2MaxFrameNumMinus4 + 4

Definition at line 144 of file videostream.h.

Referenced by CloseDecoder(), and ParseH264Packet().

◆ m_mutex

std::mutex cVideoStream::m_mutex
private

mutex for decoding thread control

Definition at line 115 of file videostream.h.

Referenced by Action(), Halt(), and Resume().

◆ m_naluTypesAtStart

std::vector<std::string> cVideoStream::m_naluTypesAtStart
private

array of strings to log the H.264 frames at stream start

Definition at line 139 of file videostream.h.

Referenced by CloseDecoder(), DecodeInput(), and ParseH264Packet().

◆ m_newStream

volatile bool cVideoStream::m_newStream = false
private

flag for new stream

Definition at line 133 of file videostream.h.

Referenced by DecodeInput(), Open(), and OpenDecoder().

◆ m_numIFrames

int cVideoStream::m_numIFrames = 0
private

counter for the arriving I-Frames at H.264 stream start

Definition at line 140 of file videostream.h.

Referenced by CloseDecoder(), DecodeInput(), and ParseH264Packet().

◆ m_packets

cQueue<AVPacket> cVideoStream::m_packets {VIDEO_PACKET_MAX}
private

◆ m_parseH264Dimensions

bool cVideoStream::m_parseH264Dimensions = false
private

parse width and height when starting an h264 stream

Definition at line 122 of file videostream.h.

Referenced by OpenDecoder(), and SetParseH264Dimensions().

◆ m_pConfig

cSoftHdConfig* cVideoStream::m_pConfig
private

plugin config

Definition at line 108 of file videostream.h.

Referenced by DecodeInput(), and OpenDecoder().

◆ m_pDecoder

cVideoDecoder* cVideoStream::m_pDecoder
private

◆ m_pDrmBufferQueue

cQueue<cDrmBuffer>* cVideoStream::m_pDrmBufferQueue
private

pointer to renderer's DRM buffer queue

Definition at line 113 of file videostream.h.

Referenced by DecodeInput().

◆ m_pPar

AVCodecParameters* cVideoStream::m_pPar = nullptr
private

current codec parameters

Definition at line 129 of file videostream.h.

Referenced by CloseDecoder(), DecodeInput(), FlushDecoder(), Open(), and OpenDecoder().

◆ m_ppsNumRefIdxL0DefaultActiveMinus1

int cVideoStream::m_ppsNumRefIdxL0DefaultActiveMinus1 = -1
private

cache NumRefIdxL0DefaultActiveMinuns1 from a previous PPS parsing

Definition at line 146 of file videostream.h.

Referenced by OpenDecoder(), and ParseH264Packet().

◆ m_ppsNumRefIdxL1DefaultActiveMinus1

int cVideoStream::m_ppsNumRefIdxL1DefaultActiveMinus1 = -1
private

cache NumRefIdxL1DefaultActiveMinuns1 from a previous PPS parsing

Definition at line 147 of file videostream.h.

Referenced by OpenDecoder(), and ParseH264Packet().

◆ m_pRender

cVideoRender* cVideoStream::m_pRender
private

video renderer

Definition at line 110 of file videostream.h.

Referenced by CheckForcingFrameDecode(), and DecodeInput().

◆ m_sentTrickPkts

int cVideoStream::m_sentTrickPkts = 0
private

how many avpkt have been sent to the decoder in trickspeed mode?

Definition at line 132 of file videostream.h.

Referenced by CheckForcingFrameDecode(), DecodeInput(), and ResetTrickSpeedFramesSentCounter().

◆ m_startDecodingWithIFrame

bool cVideoStream::m_startDecodingWithIFrame = false
private

wait for an I-Frame to start h264 decoding

Definition at line 121 of file videostream.h.

Referenced by OpenDecoder(), and SetStartDecodingWithIFrame().

◆ m_timebase

std::atomic<struct AVRational> cVideoStream::m_timebase
private

current codec timebase

Definition at line 130 of file videostream.h.

Referenced by DecodeInput(), FlushDecoder(), GetInputPtsMs(), Open(), OpenDecoder(), and RenderFrame().

◆ m_trickpkts

int cVideoStream::m_trickpkts
private

how many avpkt does the decoder need in trickspeed mode?

Definition at line 131 of file videostream.h.

Referenced by CheckForcingFrameDecode(), and Open().

◆ m_userDisabledDeinterlacer

bool cVideoStream::m_userDisabledDeinterlacer = false
private

set, if the user configured the deinterlace to be disabled

Definition at line 119 of file videostream.h.

Referenced by DisableDeint(), and RenderFrame().

◆ m_videoFilter

cVideoFilter cVideoStream::m_videoFilter
private

pointer to deinterlace/scaling video filter thread

Definition at line 114 of file videostream.h.

Referenced by CancelFilterThread(), DecodeInput(), and RenderFrame().

◆ VIDEO_PACKET_MAX

constexpr int cVideoStream::VIDEO_PACKET_MAX = 192
staticconstexprprivate

max number of video packets held in the buffer

Definition at line 125 of file videostream.h.

Referenced by GetVideoPacketMax(), and IsInputBufferFull().


The documentation for this class was generated from the following files: