vdr-plugin-softhddevice-drm-gles 1.6.2
Video Input Stream

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.
 

Detailed Description

Video Input Stream.

Enumeration Type Documentation

◆ HardwareQuirks

Hardware quirks, that are set depending on the hardware used.

Enumerator
QUIRK_NO_HW_DEINT 

set, if no hw deinterlacer available

QUIRK_CODEC_FLUSH_WORKAROUND 

set, if we have to close and reopen the codec instead of avcodec_flush_buffers (rpi)

QUIRK_CODEC_NEEDS_EXT_INIT 

set, if codec needs some infos for init (coded_width and coded_height)

QUIRK_CODEC_SKIP_FIRST_FRAMES 

set, if codec should skip first I-Frames

QUIRK_CODEC_SKIP_NUM_FRAMES 

skip QUIRK_CODEC_SKIP_NUM_FRAMES, in case QUIRK_CODEC_SKIP_FIRST_FRAMES is set

QUIRK_CODEC_DISABLE_MPEG_HW 

set, if disable mpeg hardware decoder

QUIRK_CODEC_DISABLE_H264_HW 

set, if disable h264 hardware decoder

Definition at line 44 of file videostream.h.

Function Documentation

◆ Action()

void cVideoStream::Action ( void  )
protectedvirtual

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.

◆ CancelFilterThread()

◆ CheckForcingFrameDecode()

void cVideoStream::CheckForcingFrameDecode ( void  )
private

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().

◆ ClearVdrCoreToDecoderQueue()

void cVideoStream::ClearVdrCoreToDecoderQueue ( void  )

◆ CloseDecoder()

◆ cVideoStream()

cVideoStream::cVideoStream ( cVideoRender render,
cQueue< cDrmBuffer > *  drmBufferQueue,
cSoftHdConfig config,
bool  isPipStream,
std::function< void(AVFrame *)>  frameOutput 
)
protected

◆ DecodeInput()

◆ Exit()

◆ Flush()

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 190 of file videostream.cpp.

References cVideoStream::m_packets, and cQueue< T >::Push().

Referenced by cSoftHdDevice::HandleStillPicture().

◆ FlushDecoder()

void cVideoStream::FlushDecoder ( void  )

◆ GetInputPtsMs()

int64_t cVideoStream::GetInputPtsMs ( void  )

◆ GetVideoSize()

void cVideoStream::GetVideoSize ( int width,
int height,
double aspect_ratio 
)

Get video size and aspect ratio.

Parameters
[out]widthvideo stream width
[out]heightvideo stream height
[out]aspect_ratiovideo 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().

◆ Open()

void cVideoStream::Open ( AVCodecID  codecId,
AVCodecParameters par = nullptr,
AVRational  timebase = { .num = 1, .den = 90000 } 
)

Open a video codec.

Parameters
codecIdvideo codec id
parvideo codec parameters
timebasetimebase

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().

◆ OpenDecoder()

◆ ParseH264Packet()

◆ PushAvPacket()

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.

Parameters
avpktThe AVPacket to push to the queue
Returns
true if the packet was successfully pushed, false otherwise

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().

◆ ReadHWPlatform()

static int ReadHWPlatform ( void  )
static

Helper function to find out which platform we are on.

Returns
the hardware quirks of the device

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().

◆ ReadLineFromFile()

static size_t ReadLineFromFile ( char buf,
size_t  size,
const char file 
)
static

Helper function to read a line from a given file.

Parameters
[out]bufpointer to the data
[out]sizesize of the data at buf
[in]filethe filepointer to be read on
Returns
the number of characters read

Definition at line 56 of file videostream.cpp.

References LOGERROR.

Referenced by ReadHWPlatform().

◆ RenderFrame()

◆ StartDecoder()

void cVideoStream::StartDecoder ( )

◆ Stop()

void cVideoStream::Stop ( void  )

Stop the decoding thread.

Definition at line 583 of file videostream.cpp.

References LOGDEBUG.

Referenced by cVideoStream::Exit().

◆ ~cVideoStream()

cVideoStream::~cVideoStream ( void  )
virtual

Definition at line 179 of file videostream.cpp.

References LOGDEBUG.