vdr-plugin-softhddevice-drm-gles 1.6.2
Device

Output Device Implementation. More...

Classes

struct  overload< Ts >
 
class  cSoftHdDevice
 Output Device Implementation. More...
 

Enumerations

enum  State {
  STOP , BUFFERING , PLAY , TRICK_SPEED ,
  DETACHED
}
 
enum  PlaybackMode { NONE , AUDIO_AND_VIDEO , AUDIO_ONLY , VIDEO_ONLY }
 

Functions

static void PrintStreamData (const uchar *payload)
 Print the start code, stream id, length, first three bytes (start code) of the payload, and the following 16 bytes of the codec payload.
 
template<class... Ts>
 overload (Ts...) -> overload< Ts... >
 
const charEventToString (const Event &e)
 
const charStateToString (State s)
 
 cSoftHdDevice::cSoftHdDevice (cSoftHdConfig *)
 Create the device.
 
virtual cSoftHdDevice::~cSoftHdDevice (void)
 Destroy the device.
 
int cSoftHdDevice::Start (void)
 Called by VDR when the plugin is started.
 
void cSoftHdDevice::Stop (void)
 Called by VDR when the plugin is stopped.
 
void cSoftHdDevice::FlushAudio (void)
 Clear all audio data from the decoder and ringbuffer.
 
virtual void cSoftHdDevice::MakePrimaryDevice (bool)
 Informs a device that it will be the primary device.
 
virtual void cSoftHdDevice::ChannelSwitch (const cDevice *, int, bool)
 Monitor a channel switch triggered by VDR (cStatus::ChannelSwitch())
 
virtual cSpuDecodercSoftHdDevice::GetSpuDecoder (void)
 Get the device SPU decoder.
 
virtual bool cSoftHdDevice::HasDecoder (void) const
 Tells whether this device has an MPEG decoder.
 
virtual bool cSoftHdDevice::CanReplay (void) const
 Return true if this device can currently start a replay session.
 
void cSoftHdDevice::OnEventReceived (const Event &)
 Event handler for playback state transitions.
 
void cSoftHdDevice::OnEnteringState (State)
 Actions to be performed when entering a state.
 
void cSoftHdDevice::OnLeavingState (State)
 Actions to be performed when leaving a state.
 
void cSoftHdDevice::SetState (State)
 Sets the device into the given state.
 
virtual bool cSoftHdDevice::SetPlayMode (ePlayMode)
 Sets the device into the given play mode.
 
virtual int64_t cSoftHdDevice::GetSTC (void)
 Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles.
 
virtual void cSoftHdDevice::TrickSpeed (int, bool)
 Sets the device into a mode where replay is done slower.
 
virtual void cSoftHdDevice::Clear (void)
 Clears all video and audio data from the device.
 
virtual void cSoftHdDevice::Play (void)
 Sets the device into play mode (after a previous trick mode, or pause)
 
virtual void cSoftHdDevice::Freeze (void)
 Puts the device into "freeze frame" mode.
 
virtual void cSoftHdDevice::StillPicture (const uchar *, int)
 Display the given I-frame as a still picture.
 
void cSoftHdDevice::HandleStillPicture (const uchar *data, int size)
 The still picture data received from VDR can contain multiple PES packets.
 
virtual bool cSoftHdDevice::Poll (cPoller &, int=0)
 Return true if the device itself or any of the file handles in poller is ready for further action.
 
virtual bool cSoftHdDevice::Flush (int=0)
 Flush the device output buffers.
 
virtual void cSoftHdDevice::SetVideoDisplayFormat (eVideoDisplayFormat)
 Sets the video display format.
 
virtual void cSoftHdDevice::SetVideoFormat (bool)
 Set the video format.
 
virtual void cSoftHdDevice::GetVideoSize (int &, int &, double &)
 Get the video size.
 
virtual void cSoftHdDevice::GetOsdSize (int &, int &, double &)
 Returns the width, height and aspect ratio the OSD.
 
void cSoftHdDevice::SetScreenSize (int, int, double)
 Set the screen size.
 
virtual int cSoftHdDevice::PlayAudio (const uchar *, int, uchar)
 Play an audio packet.
 
virtual void cSoftHdDevice::SetAudioTrackDevice (eTrackType)
 
virtual void cSoftHdDevice::SetDigitalAudioDevice (bool)
 
virtual void cSoftHdDevice::SetAudioChannelDevice (int)
 
virtual int cSoftHdDevice::GetAudioChannelDevice (void)
 
virtual void cSoftHdDevice::SetVolumeDevice (int)
 Sets the audio volume on this device (Volume = 0...255).
 
virtual int cSoftHdDevice::PlayVideo (const uchar *, int)
 Play a video packet of the main videostream.
 
int cSoftHdDevice::PlayPipVideo (const uchar *, int)
 Play a video packet of the pip videostream.
 
int cSoftHdDevice::PlayVideoInternal (cVideoStream *, cReassemblyBufferVideo *, const uchar *, int, bool)
 Play a video packet.
 
int cSoftHdDevice::GetBufferFillLevelThresholdMs ()
 Returns the buffer fill level threshold in milliseconds.
 
bool cSoftHdDevice::IsBufferingThresholdReached (void)
 Check if the buffering threshold has been reached.
 
int64_t cSoftHdDevice::GetFirstAudioPtsMsToPlay ()
 Calculate the first audio PTS that should be played during synchronized playback.
 
int64_t cSoftHdDevice::GetFirstVideoPtsMsToPlay ()
 
virtual ucharcSoftHdDevice::GrabImage (int &, bool, int, int, int)
 Grabs the currently visible screen image.
 
virtual cRect cSoftHdDevice::CanScaleVideo (const cRect &, int taCenter)
 Ask the output, if it can scale video.
 
virtual void cSoftHdDevice::ScaleVideo (const cRect &=cRect::Null)
 Scale the currently shown video.
 
const charcSoftHdDevice::CommandLineHelp (void)
 Return command line help string.
 
int cSoftHdDevice::ProcessArgs (int, char *[])
 Process the command line arguments.
 
void cSoftHdDevice::OsdClose (void)
 Close the OSD.
 
void cSoftHdDevice::OsdDrawARGB (int, int, int, int, int, const uint8_t *, int, int)
 Draw an OSD pixmap.
 
int cSoftHdDevice::MaxSizeGPUImageCache (void)
 Get the maximum GPU image cache size.
 
int cSoftHdDevice::OglOsdIsDisabled (void)
 Is the OpenGL/ES osd disabled?
 
void cSoftHdDevice::SetDisableOglOsd (void)
 Disables OpenGL/ES Osd (called from setup menu or conf)
 
void cSoftHdDevice::SetEnableOglOsd (void)
 Enables OpenGL/ES Osd.
 
void cSoftHdDevice::SetDisableDeint (void)
 Disables deinterlacer (called from setup menu or conf)
 
void cSoftHdDevice::SetDecoderNeedsIFrame (void)
 Forces the h264 decoder to wait for an I-Frame to start.
 
void cSoftHdDevice::SetParseH264Dimensions (void)
 Parse the h264 stream width and height before starting the decoder.
 
void cSoftHdDevice::SetDecoderFallbackToSw (bool)
 Force the decoder to fallback to software if the hardware decoder fails after the configured amount of packets were sent and no frame was received.
 
void cSoftHdDevice::SetPassthroughMask (int)
 Set the passthrough mask (called from setup menu or conf)
 
void cSoftHdDevice::ResetChannelId (void)
 Reset the channel ID (restarts audio)
 
void cSoftHdDevice::GetStats (int *, int *, int *)
 Get statistics from the renderer.
 
void cSoftHdDevice::SetAudioCodec (enum AVCodecID, AVCodecParameters *, AVRational)
 Open an audio codec.
 
void cSoftHdDevice::SetVideoCodec (enum AVCodecID, AVCodecParameters *, AVRational)
 Open a video codec.
 
int cSoftHdDevice::PlayAudioPkts (AVPacket *)
 Play an audio packet.
 
int cSoftHdDevice::PlayVideoPkts (AVPacket *)
 Play a video packet.
 
void cSoftHdDevice::Detach (void)
 Detach the device.
 
void cSoftHdDevice::Attach (void)
 Attach the device again.
 
bool cSoftHdDevice::IsDetached (void) const
 Returns true, if the device is detached.
 
void cSoftHdDevice::ResetPipStream (void)
 Resets pip stream and render pipeline.
 
bool cSoftHdDevice::PipIsEnabled (void)
 Returns true, if pip is currently enabled.
 
void cSoftHdDevice::SetRenderPipSize (void)
 Wrapper functions for cVideoRender and cPipHandler.
 
void cSoftHdDevice::SetRenderPipActive (bool)
 
void cSoftHdDevice::PipEnable (void)
 
void cSoftHdDevice::PipDisable (void)
 
void cSoftHdDevice::PipToggle (void)
 
void cSoftHdDevice::PipChannelChange (int)
 
void cSoftHdDevice::PipChannelSwap (bool)
 
void cSoftHdDevice::PipSwapPosition (void)
 
void cSoftHdDevice::PipSetSize (void)
 
void cSoftHdDevice::SetEnableHdr (bool)
 Enable HDR display mode.
 

Detailed Description

Output Device Implementation.

Enumeration Type Documentation

◆ PlaybackMode

Enumerator
NONE 
AUDIO_AND_VIDEO 
AUDIO_ONLY 
VIDEO_ONLY 

Definition at line 96 of file softhddevice.h.

◆ State

Enumerator
STOP 
BUFFERING 
PLAY 
TRICK_SPEED 
DETACHED 

Definition at line 60 of file softhddevice.h.

Function Documentation

◆ Attach()

void cSoftHdDevice::Attach ( void  )

Attach the device again.

Kind of a plugin restart. Inits and starts all necessary resources. Only valid after a detach.

Definition at line 1779 of file softhddevice.cpp.

References cSoftHdDevice::m_forceDetached, cSoftHdDevice::m_needsMakePrimary, cSoftHdDevice::MakePrimaryDevice(), and cSoftHdDevice::OnEventReceived().

Referenced by cSoftHdMenu::HandleHotKey(), and cPluginSoftHdDevice::SVDRPCommand().

◆ CanReplay()

bool cSoftHdDevice::CanReplay ( void  ) const
virtual

Return true if this device can currently start a replay session.

Definition at line 175 of file softhddevice.cpp.

References cSoftHdDevice::IsDetached(), and LOGDEBUG.

◆ CanScaleVideo()

cRect cSoftHdDevice::CanScaleVideo ( const cRect ,
int  taCenter 
)
virtual

Ask the output, if it can scale video.

Parameters
rectrequested video window rectangle
Returns
the real rectangle or cRect::NULL if invalid

Definition at line 1421 of file softhddevice.cpp.

◆ ChannelSwitch()

void cSoftHdDevice::ChannelSwitch ( const cDevice *  device,
int  channelNum,
bool  liveView 
)
protectedvirtual

Monitor a channel switch triggered by VDR (cStatus::ChannelSwitch())

Save the timestamp when a channel switch is initiated (channelNum == 0) for later time measurement.

Definition at line 133 of file softhddevice.cpp.

References cSoftHdDevice::m_channelSwitchStartTime.

◆ Clear()

◆ CommandLineHelp()

const char * cSoftHdDevice::CommandLineHelp ( void  )

Return command line help string.

Definition at line 1449 of file softhddevice.cpp.

Referenced by cPluginSoftHdDevice::CommandLineHelp().

◆ cSoftHdDevice()

cSoftHdDevice::cSoftHdDevice ( cSoftHdConfig config)

Create the device.

Initializes some member variables

Parameters
configpointer to cSoftHdConfig class

Definition at line 59 of file softhddevice.cpp.

References cSoftHdDevice::m_channelSwitchStartTime, and cSoftHdDevice::m_dataReceivedTime.

◆ Detach()

void cSoftHdDevice::Detach ( void  )

Detach the device.

Clears audio and video, stops all threads and releases drm/alsa. A detached state can only be exited (restarted) with an AttachEvent.

Definition at line 1758 of file softhddevice.cpp.

References LOGDEBUG, cSoftHdDevice::m_needsMakePrimary, cSoftHdDevice::MakePrimaryDevice(), and cSoftHdDevice::OnEventReceived().

Referenced by cSoftHdMenu::HandleHotKey(), cSoftHdMenu::ProcessKey(), and cPluginSoftHdDevice::SVDRPCommand().

◆ EventToString()

const char * EventToString ( const Event e)
inline

Definition at line 68 of file softhddevice.h.

References AUDIO.

Referenced by cSoftHdDevice::OnEventReceived().

◆ Flush()

bool cSoftHdDevice::Flush ( int  timeoutMs = 0)
virtual

Flush the device output buffers.

Parameters
timeoutMstimeout in ms to become ready

Definition at line 888 of file softhddevice.cpp.

References cVideoStream::GetAvPacketsFilled(), cSoftHdDevice::IsDetached(), LOGDEBUG, and cSoftHdDevice::m_pVideoStream.

◆ FlushAudio()

void cSoftHdDevice::FlushAudio ( void  )
private

◆ Freeze()

void cSoftHdDevice::Freeze ( void  )
virtual

Puts the device into "freeze frame" mode.

Definition at line 797 of file softhddevice.cpp.

References LOGDEBUG, and cSoftHdDevice::OnEventReceived().

Referenced by cSoftHdControl::ProcessKey().

◆ GetAudioChannelDevice()

int cSoftHdDevice::GetAudioChannelDevice ( void  )
virtual

Definition at line 1133 of file softhddevice.cpp.

◆ GetBufferFillLevelThresholdMs()

int cSoftHdDevice::GetBufferFillLevelThresholdMs ( )
private

Returns the buffer fill level threshold in milliseconds.

Combines the minimum threshold with the user-configured additional buffer length.

Definition at line 1274 of file softhddevice.cpp.

References cSoftHdConfig::ConfigAdditionalBufferLengthMs, cSoftHdDevice::m_pConfig, and cSoftHdDevice::MIN_BUFFER_FILL_LEVEL_THRESHOLD_MS.

Referenced by cSoftHdDevice::IsBufferingThresholdReached().

◆ GetFirstAudioPtsMsToPlay()

int64_t cSoftHdDevice::GetFirstAudioPtsMsToPlay ( )
private

Calculate the first audio PTS that should be played during synchronized playback.

This method determines the starting audio presentation timestamp when transitioning from BUFFERING to PLAY state. It synchronizes audio with video by taking the maximum of both output PTSes, then adjusts for user-configured audio/video delay.

Returns
the first audio PTS in milliseconds that should be played
Note
Positive ConfigVideoAudioDelayMs means audio is intentionally delayed (video ahead)
Negative ConfigVideoAudioDelayMs means video is intentionally delayed (audio ahead)

Definition at line 1357 of file softhddevice.cpp.

References cSoftHdConfig::ConfigVideoAudioDelayMs, cSoftHdAudio::GetOutputPtsMs(), cVideoRender::GetOutputPtsMs(), cSoftHdDevice::m_pAudio, cSoftHdDevice::m_pConfig, and cSoftHdDevice::m_pRender.

Referenced by cSoftHdDevice::IsBufferingThresholdReached(), and cSoftHdDevice::OnEventReceived().

◆ GetFirstVideoPtsMsToPlay()

◆ GetOsdSize()

void cSoftHdDevice::GetOsdSize ( int width,
int height,
double aspectRatio 
)
virtual

Returns the width, height and aspect ratio the OSD.

Parameters
[out]widthosd width
[out]heightosd height
[out]aspectRatioosd aspect ratio
Todo:
: Called every second, for nothing (no OSD displayed)?

Definition at line 970 of file softhddevice.cpp.

References cSoftHdDevice::IsDetached(), cSoftHdDevice::m_screenHeight, cSoftHdDevice::m_screenWidth, and cSoftHdDevice::m_sizeMutex.

Referenced by cOglOsd::cOglOsd(), cSoftOsd::Flush(), and cSoftHdDevice::GrabImage().

◆ GetSpuDecoder()

cSpuDecoder * cSoftHdDevice::GetSpuDecoder ( void  )
virtual

Get the device SPU decoder.

Returns
a pointer to the device's SPU decoder (or NULL, if this device doesn't have an SPU decoder)

Definition at line 151 of file softhddevice.cpp.

References LOGDEBUG, and cSoftHdDevice::m_pSpuDecoder.

◆ GetStats()

void cSoftHdDevice::GetStats ( int duped,
int dropped,
int counter 
)

Get statistics from the renderer.

Parameters
[out]dupedduped frames
[out]droppeddropped frames
[out]countnumber of total rendered frames

Definition at line 1671 of file softhddevice.cpp.

References cVideoRender::GetStats(), and cSoftHdDevice::m_pRender.

Referenced by cMenuSetupSoft::Create().

◆ GetSTC()

int64_t cSoftHdDevice::GetSTC ( void  )
virtual

◆ GetVideoSize()

void cSoftHdDevice::GetVideoSize ( int width,
int height,
double aspectRatio 
)
virtual

Get the video size.

Return the width, height and aspect ratio of the currently displayed video material

Parameters
[out]widthvideo width
[out]heightvideo height
[out]aspectRatiovideo aspect ratio
Note
the video_aspect is used to scale the subtitle.

Definition at line 947 of file softhddevice.cpp.

References cVideoStream::GetVideoSize(), cSoftHdDevice::IsDetached(), and cSoftHdDevice::m_pVideoStream.

◆ GrabImage()

uchar * cSoftHdDevice::GrabImage ( int size,
bool  jpeg,
int  quality,
int  width,
int  height 
)
virtual

Grabs the currently visible screen image.

Parameters
sizesize of the returned data
jpegflag true, create JPEG data
qualityJPEG quality
widthnumber of horizontal pixels in the frame
heightnumber of vertical pixels in the frame

Definition at line 1389 of file softhddevice.cpp.

References cSoftHdGrab::Active(), cSoftHdDevice::GetOsdSize(), cSoftHdGrab::Image(), cSoftHdDevice::IsDetached(), L_GRAB, LOGDEBUG2, LOGWARNING, cSoftHdDevice::m_pGrab, cSoftHdGrab::Size(), and cSoftHdGrab::Start().

◆ HandleStillPicture()

void cSoftHdDevice::HandleStillPicture ( const uchar data,
int  size 
)
private

The still picture data received from VDR can contain multiple PES packets.

This sends each PES packet's raw data separately to PlayVideo(), and does a flush to display the frame immediately.

Parameters
datapes data of one or more frames
sizelength of data area

Definition at line 830 of file softhddevice.cpp.

References cVideoStream::Flush(), LOGWARNING, cSoftHdDevice::m_pRender, cSoftHdDevice::m_pVideoStream, cSoftHdDevice::m_videoReassemblyBuffer, cSoftHdDevice::PlayVideoInternal(), cReassemblyBufferVideo::PopAvPacket(), cVideoStream::PushAvPacket(), cVideoStream::ResetInputPts(), cVideoStream::SetDeinterlacerDeactivated(), cVideoRender::SetPlaybackPaused(), and cVideoRender::SetStillpicture().

Referenced by cSoftHdDevice::OnEventReceived().

◆ HasDecoder()

bool cSoftHdDevice::HasDecoder ( void  ) const
virtual

Tells whether this device has an MPEG decoder.

Definition at line 163 of file softhddevice.cpp.

References cSoftHdDevice::IsDetached().

◆ IsBufferingThresholdReached()

bool cSoftHdDevice::IsBufferingThresholdReached ( void  )

Check if the buffering threshold has been reached.

During the BUFFERING state, this method determines when sufficient audio/video data has been buffered to start playback.

ThresholdReached (Sync-Ability) is signalled 1) in audio only mode: -> PlayAudio() was called -> audio input has a valid pts -> enough audio data is buffered 2) in video only mode: -> PlayVideo() was called -> video input has a valid pts -> enough video data is buffered (which implies "a video frame reached the renderer") 3) in audio/video mode: -> audio input has a valid pts -> video input has a valid pts -> video and audio has enough data buffered (calculated from the first output pts to play) -> the render output buffer queue is completely filled once (which implies "a video frame reached the renderer")

Return values
trueif playback should start (audio or video only or buffering threshold reached)
falseif playback should not start
Note
In order to signal ThresholdReached, both (audio and video) need to have a valid pts in audio + video mode!

Definition at line 1304 of file softhddevice.cpp.

References AV_NOPTS_VALUE, BUFFERING, cSoftHdDevice::GetBufferFillLevelThresholdMs(), cSoftHdDevice::GetFirstAudioPtsMsToPlay(), cSoftHdDevice::GetFirstVideoPtsMsToPlay(), cSoftHdAudio::GetInputPtsMs(), cVideoStream::GetInputPtsMs(), cSoftHdAudio::GetOutputPtsMs(), cVideoRender::GetOutputPtsMs(), cSoftHdAudio::HasInputPts(), cVideoStream::HasInputPts(), cVideoRender::IsOutputBufferFull(), L_AV_SYNC, LOGDEBUG, LOGDEBUG2, cSoftHdDevice::m_pAudio, cSoftHdDevice::m_pRender, cSoftHdDevice::m_pVideoStream, cSoftHdDevice::m_receivedAudio, cSoftHdDevice::m_receivedVideo, cSoftHdDevice::m_state, and Timestamp2String().

Referenced by cVideoRender::DisplayFrame(), and cSoftHdDevice::PlayAudio().

◆ IsDetached()

◆ MakePrimaryDevice()

void cSoftHdDevice::MakePrimaryDevice ( bool  on)
protectedvirtual

Informs a device that it will be the primary device.

Parameters
onflag if becoming or loosing primary

Definition at line 117 of file softhddevice.cpp.

References LOGDEBUG, and cSoftHdDevice::m_pOsdProvider.

Referenced by cSoftHdDevice::Attach(), and cSoftHdDevice::Detach().

◆ MaxSizeGPUImageCache()

int cSoftHdDevice::MaxSizeGPUImageCache ( void  )

Get the maximum GPU image cache size.

Definition at line 1568 of file softhddevice.cpp.

References cSoftHdConfig::ConfigMaxSizeGPUImageCache, and cSoftHdDevice::m_pConfig.

Referenced by cSoftOsdProvider::StartOpenGlThread().

◆ OglOsdIsDisabled()

◆ OnEnteringState()

void cSoftHdDevice::OnEnteringState ( State  state)
private

Actions to be performed when entering a state.

These are only executed when the state actually changes. E.g. a state transition PLAY -> PLAY does not trigger this.

Parameters
statestate being entered

Definition at line 469 of file softhddevice.cpp.

References AUDIO_ONLY, BUFFERING, cVideoStream::CancelFilterThread(), cVideoRender::ClearDecoderToDisplayQueue(), cVideoStream::ClearVdrCoreToDecoderQueue(), cVideoStream::CloseDecoder(), DETACHED, cVideoRender::DisplayBlackFrame(), cSoftHdAudio::Exit(), cVideoRender::Exit(), cVideoStream::Exit(), cSoftHdDevice::FlushAudio(), cSoftHdDevice::m_audioJitterTracker, cSoftHdDevice::m_pAudio, cSoftHdDevice::m_pAudioDecoder, cSoftHdDevice::m_pGrab, cSoftHdDevice::m_playbackMode, cSoftHdDevice::m_pOsdProvider, cSoftHdDevice::m_pPipHandler, cSoftHdDevice::m_pPipStream, cSoftHdDevice::m_pRender, cSoftHdDevice::m_pVideoStream, cSoftHdDevice::m_videoJitterTracker, cSoftHdDevice::m_videoReassemblyBuffer, NONE, PLAY, cSoftOsdProvider::RequestStopOpenGlThread(), cVideoRender::Reset(), cJitterTracker::Reset(), cReassemblyBuffer::Reset(), cVideoRender::ResetBufferReuseStrategy(), cVideoRender::ResetDecodingStrategy(), cSoftHdAudio::ResetHwDelayBaseline(), cVideoRender::Resume(), cVideoStream::Resume(), cVideoStream::SetDeinterlacerDeactivated(), cSoftHdAudio::SetPaused(), cVideoRender::SetPlaybackPaused(), cVideoRender::SetStillpicture(), STOP, cSoftOsdProvider::StopOpenGlThread(), TRICK_SPEED, cSoftOsdProvider::UnlockOpenGlThread(), and VIDEO_ONLY.

Referenced by cSoftHdDevice::SetState().

◆ OnEventReceived()

void cSoftHdDevice::OnEventReceived ( const Event event)
privatevirtual

Event handler for playback state transitions.

Processes events (Play, Pause, Stop, TrickSpeed, StillPicture) and performs the appropriate state transitions based on the current state. The method halts both display and decoding threads before processing the event and resumes them afterwards to ensure thread-safe state transitions.

Parameters
eventThe event to process (variant type containing specific event data)

Implements IEventReceiver.

Definition at line 194 of file softhddevice.cpp.

References AUDIO_AND_VIDEO, AUDIO_ONLY, BUFFERING, cSoftHdConfig::ConfigVideoAudioDelayMs, DETACHED, cSoftHdAudio::DropSamplesOlderThanPtsMs(), EventToString(), cSoftHdDevice::GetFirstAudioPtsMsToPlay(), cSoftHdDevice::GetFirstVideoPtsMsToPlay(), cSoftHdAudio::GetOutputPtsMs(), cVideoRender::GetOutputPtsMs(), cVideoRender::Halt(), cVideoStream::Halt(), cPipHandler::HandleEvent(), cSoftHdDevice::HandleStillPicture(), cSoftHdAudio::HasInputPts(), cVideoStream::HasInputPts(), cSoftHdAudio::LazyInit(), cSoftOsdProvider::LockOpenGlThread(), LOGDEBUG, LOGFATAL, LOGWARNING, cSoftHdDevice::m_forceDetached, cSoftHdDevice::m_mutex, cSoftHdDevice::m_pAudio, cSoftHdDevice::m_pConfig, cSoftHdDevice::m_playbackMode, cSoftHdDevice::m_pOsdProvider, cSoftHdDevice::m_pPipHandler, cSoftHdDevice::m_pRender, cSoftHdDevice::m_pVideoStream, cSoftHdDevice::m_state, cSoftHdDevice::m_volume, NONE, PIPSTOP, PLAY, cVideoStream::ResetFilterThreadNeededCheck(), cVideoRender::ResetFrameCounter(), cSoftHdAudio::ResetHwDelayBaseline(), cVideoRender::Resume(), cVideoStream::Resume(), cVideoRender::SchedulePlaybackStartAtPtsMs(), cVideoRender::ScheduleResyncAtPtsMs(), cVideoRender::ScheduleVideoPlaybackPauseAt(), cSoftHdAudio::SetHwDelayBaseline(), cSoftHdAudio::SetPaused(), cVideoRender::SetPlaybackPaused(), cVideoRender::SetScheduleAudioResume(), cSoftHdDevice::SetState(), cVideoRender::SetStillpicture(), cVideoRender::SetTrickSpeed(), cSoftHdAudio::SetVolume(), StateToString(), STOP, TRICK_SPEED, cSoftOsdProvider::UnlockOpenGlThread(), and VIDEO_ONLY.

Referenced by cSoftHdDevice::Attach(), cSoftHdDevice::Detach(), cSoftHdDevice::Freeze(), cSoftHdDevice::Play(), cSoftHdDevice::PlayAudio(), cSoftHdDevice::SetPlayMode(), cSoftHdDevice::Start(), cSoftHdDevice::StillPicture(), cSoftHdDevice::Stop(), and cSoftHdDevice::TrickSpeed().

◆ OnLeavingState()

◆ OsdClose()

void cSoftHdDevice::OsdClose ( void  )

◆ OsdDrawARGB()

void cSoftHdDevice::OsdDrawARGB ( int  xi,
int  yi,
int  height,
int  width,
int  pitch,
const uint8_t argb,
int  x,
int  y 
)

Draw an OSD pixmap.

Parameters
xix-coordinate in argb image
yiy-coordinate in argb image
heightheight in pixel in argb image
widthwidth in pixel in argb image
pitchpitch of argb image
argb32bit ARGB image data
xx-coordinate on screen of argb image
yy-coordinate on screen of argb image

Definition at line 1555 of file softhddevice.cpp.

References cSoftHdDevice::IsDetached(), cSoftHdDevice::m_pRender, and cVideoRender::OsdDrawARGB().

Referenced by cOglCmdCopyBufferToOutputFb::Execute(), and cSoftOsd::Flush().

◆ overload()

template<class... Ts>
overload ( Ts...  ) -> overload< Ts... >

◆ PipChannelChange()

void cSoftHdDevice::PipChannelChange ( int  dir)

◆ PipChannelSwap()

void cSoftHdDevice::PipChannelSwap ( bool  closePip)

◆ PipDisable()

void cSoftHdDevice::PipDisable ( void  )

◆ PipEnable()

void cSoftHdDevice::PipEnable ( void  )

◆ PipIsEnabled()

bool cSoftHdDevice::PipIsEnabled ( void  )

Returns true, if pip is currently enabled.

Definition at line 1825 of file softhddevice.cpp.

References cPipHandler::IsEnabled(), cSoftHdDevice::m_mutex, and cSoftHdDevice::m_pPipHandler.

Referenced by cPluginSoftHdDevice::SVDRPCommand().

◆ PipSetSize()

void cSoftHdDevice::PipSetSize ( void  )

Definition at line 1842 of file softhddevice.cpp.

References cSoftHdDevice::m_pPipHandler, and cPipHandler::SetSize().

Referenced by cMenuSetupSoft::Store().

◆ PipSwapPosition()

◆ PipToggle()

void cSoftHdDevice::PipToggle ( void  )

◆ Play()

void cSoftHdDevice::Play ( void  )
virtual

Sets the device into play mode (after a previous trick mode, or pause)

This is called by VDR via DevicePlay() in the Play() and Goto() call

Definition at line 787 of file softhddevice.cpp.

References cSoftHdDevice::OnEventReceived().

Referenced by cSoftHdControl::ProcessKey().

◆ PlayAudio()

◆ PlayAudioPkts()

int cSoftHdDevice::PlayAudioPkts ( AVPacket pkt)

Play an audio packet.

Parameters
pktAVPacket to play
Return values
0packet could not be player, free audio buffer too small
1packet was sent to be decoded

Definition at line 1717 of file softhddevice.cpp.

References cAudioDecoder::Decode(), cSoftHdAudio::IsBufferFull(), cSoftHdAudio::LazyInit(), cSoftHdDevice::m_pAudio, and cSoftHdDevice::m_pAudioDecoder.

Referenced by cSoftHdPlayer::Play().

◆ PlayPipVideo()

int cSoftHdDevice::PlayPipVideo ( const uchar data,
int  size 
)

Play a video packet of the pip videostream.

Parameters
dataA complete PES packet with optionally fragmented payload
sizethe length of the PES packet including header

The caller must ensure, that PlayPipVideo() is not called in detached state. (CanReplay() and HasDecoder() return false in this state and we are not the primary device.)

Definition at line 1198 of file softhddevice.cpp.

References cVideoStream::IsInputBufferFull(), cSoftHdDevice::m_pipReassemblyBuffer, cSoftHdDevice::m_pPipStream, and cSoftHdDevice::PlayVideoInternal().

Referenced by cPipReceiver::PlayTs().

◆ PlayVideo()

int cSoftHdDevice::PlayVideo ( const uchar data,
int  size 
)
virtual

Play a video packet of the main videostream.

This is the main function, which is called by VDR to play video data

Parameters
dataA complete PES packet with optionally fragmented payload
sizethe length of the PES packet including header

This is called directly from VDR

The caller must ensure, that PlayVideo() is not called in detached state. (CanReplay() and HasDecoder() return false in this state and we are not the primary device.)

Definition at line 1168 of file softhddevice.cpp.

References cSoftHdDevice::IsDetached(), LOGDEBUG, cSoftHdDevice::m_channelSwitchStartTime, cSoftHdDevice::m_dataReceivedTime, cSoftHdDevice::m_pVideoStream, cSoftHdDevice::m_receivedAudio, cSoftHdDevice::m_receivedVideo, cSoftHdDevice::m_videoReassemblyBuffer, and cSoftHdDevice::PlayVideoInternal().

◆ PlayVideoInternal()

int cSoftHdDevice::PlayVideoInternal ( cVideoStream stream,
cReassemblyBufferVideo buffer,
const uchar data,
int  size,
bool  trackJitter 
)
private

◆ PlayVideoPkts()

int cSoftHdDevice::PlayVideoPkts ( AVPacket pkt)

Play a video packet.

Parameters
pktAVPacket to play
Return values
0packet could not be player, free audio buffer too small
1packet was sent to be decoded

Definition at line 1736 of file softhddevice.cpp.

References cVideoStream::GetAvPacketsFilled(), cVideoStream::GetVideoPacketMax(), cSoftHdAudio::LazyInit(), cSoftHdDevice::m_pAudio, cSoftHdDevice::m_pVideoStream, and cVideoStream::PushAvPacket().

Referenced by cSoftHdPlayer::Play().

◆ Poll()

bool cSoftHdDevice::Poll ( cPoller ,
int  = 0 
)
virtual

Return true if the device itself or any of the file handles in poller is ready for further action.

If TimeoutMs is not zero, the device will wait up to the given number of milliseconds before returning in case it can't accept any data.

Parameters
pollerfile handles (unused)
timeoutMstimeout in ms to become ready
Return values
trueif ready
falseif busy

Definition at line 869 of file softhddevice.cpp.

References cSoftHdAudio::IsBufferFull(), cSoftHdDevice::IsDetached(), cVideoStream::IsInputBufferFull(), cSoftHdDevice::m_pAudio, and cSoftHdDevice::m_pVideoStream.

◆ PrintStreamData()

static void PrintStreamData ( const uchar payload)
static

Print the start code, stream id, length, first three bytes (start code) of the payload, and the following 16 bytes of the codec payload.

Parameters
datapointer to stream data
offsetprint from here

Definition at line 1006 of file softhddevice.cpp.

References L_CODEC, and LOGDEBUG2.

Referenced by cSoftHdDevice::PlayVideoInternal().

◆ ProcessArgs()

int cSoftHdDevice::ProcessArgs ( int  argc,
char argv[] 
)

◆ ResetChannelId()

void cSoftHdDevice::ResetChannelId ( void  )

Reset the channel ID (restarts audio)

Definition at line 1658 of file softhddevice.cpp.

References LOGDEBUG, and cSoftHdDevice::m_audioChannelID.

Referenced by cMenuSetupSoft::Store().

◆ ResetPipStream()

◆ ScaleVideo()

void cSoftHdDevice::ScaleVideo ( const cRect rect = cRect::Null)
virtual

Scale the currently shown video.

Parameters
xvideo window x coordinate OSD relative
yvideo window x coordinate OSD relative
widthvideo window width OSD relative
heightvideo window height OSD relative

Definition at line 1434 of file softhddevice.cpp.

References cSoftHdDevice::IsDetached(), L_OSD, LOGDEBUG2, cSoftHdDevice::m_pRender, and cVideoRender::SetVideoOutputPosition().

◆ SetAudioChannelDevice()

void cSoftHdDevice::SetAudioChannelDevice ( int  )
virtual

Definition at line 1127 of file softhddevice.cpp.

◆ SetAudioCodec()

void cSoftHdDevice::SetAudioCodec ( enum AVCodecID  codecId,
AVCodecParameters par,
AVRational  timebase 
)

Open an audio codec.

Parameters
codecIdaudio codec id
paraudio codec parameters
timebasetimebase

Definition at line 1692 of file softhddevice.cpp.

References cSoftHdDevice::m_pAudioDecoder, and cAudioDecoder::Open().

Referenced by cSoftHdPlayer::Play().

◆ SetAudioTrackDevice()

void cSoftHdDevice::SetAudioTrackDevice ( eTrackType  )
virtual

Definition at line 1117 of file softhddevice.cpp.

◆ SetDecoderFallbackToSw()

void cSoftHdDevice::SetDecoderFallbackToSw ( bool  enable)

Force the decoder to fallback to software if the hardware decoder fails after the configured amount of packets were sent and no frame was received.

Definition at line 1634 of file softhddevice.cpp.

References cSoftHdConfig::ConfigDecoderFallbackToSwNumPkts, cSoftHdDevice::m_pConfig, cSoftHdDevice::m_pVideoStream, and cVideoStream::SetDecoderFallbackToSwNumPkts().

Referenced by cMenuSetupSoft::Store().

◆ SetDecoderNeedsIFrame()

void cSoftHdDevice::SetDecoderNeedsIFrame ( void  )

Forces the h264 decoder to wait for an I-Frame to start.

Definition at line 1615 of file softhddevice.cpp.

References cSoftHdConfig::ConfigDecoderNeedsIFrame, cSoftHdDevice::m_pConfig, cSoftHdDevice::m_pVideoStream, and cVideoStream::SetStartDecodingWithIFrame().

Referenced by cMenuSetupSoft::Store().

◆ SetDigitalAudioDevice()

void cSoftHdDevice::SetDigitalAudioDevice ( bool  )
virtual

Definition at line 1122 of file softhddevice.cpp.

◆ SetDisableDeint()

void cSoftHdDevice::SetDisableDeint ( void  )

Disables deinterlacer (called from setup menu or conf)

Definition at line 1606 of file softhddevice.cpp.

References cSoftHdConfig::ConfigDisableDeint, cVideoStream::DisableDeint(), cSoftHdDevice::m_pConfig, and cSoftHdDevice::m_pVideoStream.

Referenced by cMenuSetupSoft::Store().

◆ SetDisableOglOsd()

void cSoftHdDevice::SetDisableOglOsd ( void  )

Disables OpenGL/ES Osd (called from setup menu or conf)

Definition at line 1584 of file softhddevice.cpp.

References cSoftHdConfig::ConfigDisableOglOsd, cVideoRender::DisableOglOsd(), cSoftHdDevice::m_pConfig, and cSoftHdDevice::m_pRender.

Referenced by cSoftOsdProvider::CreateOsd(), and cSoftHdDevice::ProcessArgs().

◆ SetEnableHdr()

void cSoftHdDevice::SetEnableHdr ( bool  enable)

Enable HDR display mode.

Definition at line 1845 of file softhddevice.cpp.

References cSoftHdDevice::m_pRender, and cVideoRender::SetEnableHdr().

Referenced by cMenuSetupSoft::Store().

◆ SetEnableOglOsd()

void cSoftHdDevice::SetEnableOglOsd ( void  )

◆ SetParseH264Dimensions()

void cSoftHdDevice::SetParseH264Dimensions ( void  )

Parse the h264 stream width and height before starting the decoder.

Definition at line 1624 of file softhddevice.cpp.

References cSoftHdConfig::ConfigParseH264Dimensions, cSoftHdDevice::m_pConfig, cSoftHdDevice::m_pVideoStream, and cVideoStream::SetParseH264Dimensions().

Referenced by cMenuSetupSoft::Store().

◆ SetPassthroughMask()

void cSoftHdDevice::SetPassthroughMask ( int  mask)

Set the passthrough mask (called from setup menu or conf)

Definition at line 1648 of file softhddevice.cpp.

References cSoftHdDevice::m_pAudio, cSoftHdDevice::m_pAudioDecoder, cSoftHdAudio::SetPassthroughMask(), and cAudioDecoder::SetPassthroughMask().

Referenced by cMenuSetupSoft::Store().

◆ SetPlayMode()

bool cSoftHdDevice::SetPlayMode ( ePlayMode  play_mode)
virtual

Sets the device into the given play mode.

Parameters
play_modenew play mode (Audio/Video/External...)

Definition at line 620 of file softhddevice.cpp.

References LOGDEBUG, LOGERROR, and cSoftHdDevice::OnEventReceived().

◆ SetRenderPipActive()

void cSoftHdDevice::SetRenderPipActive ( bool  active)

Definition at line 1835 of file softhddevice.cpp.

References cSoftHdDevice::m_pRender, and cVideoRender::SetPipActive().

Referenced by cPipHandler::HandleEnable().

◆ SetRenderPipSize()

void cSoftHdDevice::SetRenderPipSize ( void  )

Wrapper functions for cVideoRender and cPipHandler.

Definition at line 1834 of file softhddevice.cpp.

References cSoftHdDevice::m_pipUseAlt, cSoftHdDevice::m_pRender, and cVideoRender::SetPipSize().

Referenced by cPipHandler::HandleEvent().

◆ SetScreenSize()

void cSoftHdDevice::SetScreenSize ( int  width,
int  height,
double  refreshRateHz 
)

Set the screen size.

Parameters
widthscreen width
heightscreen height
refreshRateHzscreen refresh rate in Hz

Definition at line 992 of file softhddevice.cpp.

References cSoftHdDevice::m_screenHeight, cSoftHdDevice::m_screenRefreshRateHz, cSoftHdDevice::m_screenWidth, and cSoftHdDevice::m_sizeMutex.

Referenced by cVideoRender::SetScreenSize().

◆ SetState()

void cSoftHdDevice::SetState ( State  newState)
private

Sets the device into the given state.

Parameters
newStatenew state

Definition at line 603 of file softhddevice.cpp.

References LOGDEBUG, cSoftHdDevice::m_state, cSoftHdDevice::OnEnteringState(), cSoftHdDevice::OnLeavingState(), and StateToString().

Referenced by cSoftHdDevice::Clear(), and cSoftHdDevice::OnEventReceived().

◆ SetVideoCodec()

void cSoftHdDevice::SetVideoCodec ( enum AVCodecID  codecId,
AVCodecParameters par,
AVRational  timebase 
)

Open a video codec.

Parameters
codecIdvideo codec id
parvideo codec parameters
timebasetimebase

Definition at line 1704 of file softhddevice.cpp.

References cSoftHdDevice::m_pVideoStream, and cVideoStream::Open().

Referenced by cSoftHdPlayer::Play().

◆ SetVideoDisplayFormat()

void cSoftHdDevice::SetVideoDisplayFormat ( eVideoDisplayFormat  videoDisplayFormat)
virtual

Sets the video display format.

Parameters
videoDisplayFormatvideo display format Set it to the given one (only useful if this device has an MPEG decoder).

Definition at line 910 of file softhddevice.cpp.

References LOGDEBUG.

Referenced by cSoftHdDevice::SetVideoFormat().

◆ SetVideoFormat()

void cSoftHdDevice::SetVideoFormat ( bool  videoFormat16_9)
virtual

Set the video format.

Sets the output video format to either 16:9 or 4:3 (only useful if this device has an MPEG decoder).

Should call SetVideoDisplayFormat

Parameters
videoFormat16_9flag true 16:9.

Definition at line 927 of file softhddevice.cpp.

References LOGDEBUG, and cSoftHdDevice::SetVideoDisplayFormat().

◆ SetVolumeDevice()

void cSoftHdDevice::SetVolumeDevice ( int  volume)
virtual

Sets the audio volume on this device (Volume = 0...255).

Parameters
volumedevice volume

Definition at line 1144 of file softhddevice.cpp.

References cSoftHdDevice::IsDetached(), LOGDEBUG, cSoftHdDevice::m_pAudio, cSoftHdDevice::m_volume, and cSoftHdAudio::SetVolume().

◆ Start()

int cSoftHdDevice::Start ( void  )

Called by VDR when the plugin is started.

Definition at line 84 of file softhddevice.cpp.

References LOGDEBUG, and cSoftHdDevice::OnEventReceived().

Referenced by cPluginSoftHdDevice::Start().

◆ StateToString()

const char * StateToString ( State  s)
inline

Definition at line 85 of file softhddevice.h.

References BUFFERING, DETACHED, PLAY, STOP, and TRICK_SPEED.

Referenced by cSoftHdDevice::OnEventReceived(), and cSoftHdDevice::SetState().

◆ StillPicture()

void cSoftHdDevice::StillPicture ( const uchar data,
int  size 
)
virtual

Display the given I-frame as a still picture.

Parameters
datapes or ts data of a frame
lengthlength of data area

Definition at line 811 of file softhddevice.cpp.

References LOGDEBUG, and cSoftHdDevice::OnEventReceived().

◆ Stop()

void cSoftHdDevice::Stop ( void  )

Called by VDR when the plugin is stopped.

Definition at line 95 of file softhddevice.cpp.

References LOGDEBUG, and cSoftHdDevice::OnEventReceived().

Referenced by cPluginSoftHdDevice::Stop().

◆ TrickSpeed()

void cSoftHdDevice::TrickSpeed ( int  speed,
bool  forward 
)
virtual

Sets the device into a mode where replay is done slower.

Every single frame shall then be displayed the given number of times. Forward is true if replay is done in the normal (forward) direction, false if it is done reverse. The cDvbPlayer uses the following values for the various speeds: 1x 2x 3x Fast Forward 6 3 1 Fast Reverse 6 3 1 Slow Forward 8 4 2 Slow Reverse 63 48 24

Definition at line 677 of file softhddevice.cpp.

References LOGDEBUG, and cSoftHdDevice::OnEventReceived().

◆ ~cSoftHdDevice()

cSoftHdDevice::~cSoftHdDevice ( void  )
virtual

Destroy the device.

Only deletes spu decoder, which was created in constructor

Definition at line 75 of file softhddevice.cpp.

References LOGDEBUG, and cSoftHdDevice::m_pSpuDecoder.