13#ifndef __SOFTHDDEVICE_H
14#define __SOFTHDDEVICE_H
21#include <libavcodec/avcodec.h>
24#include <vdr/device.h>
26#include <vdr/status.h>
27#include <vdr/thread.h>
103 virtual void GetOsdSize(
int &,
int &,
double &);
119 virtual void Clear(
void);
120 virtual void Play(
void);
121 virtual void Freeze(
void);
124 virtual bool Flush(
int = 0);
125#if APIVERSNUM >= 30014
126 virtual bool Drain(
void);
Audio Stream Reassembly Buffer.
Video Stream Reassembly Buffer.
int ConfigVideoAudioDelayMs
config audio delay
Output Device Implementation.
void OsdDrawARGB(int, int, int, int, int, const uint8_t *, int, int)
Draw an OSD pixmap.
cReassemblyBufferVideo m_videoReassemblyBuffer
video pes reassembly buffer
void ResumeFromPause(void)
Resume playback from pause state.
void Stop(void)
Called by VDR when the plugin is stopped.
bool m_pipUseAlt
use alternative pip position
cReassemblyBufferVideo m_pipReassemblyBuffer
pip pes reassembly buffer
void PipChannelSwap(bool)
cVideoStream * m_pPipStream
pointer to pip video stream
void FlushAudio(void)
Clear all audio data from the decoder and ringbuffer.
void PipSwapPosition(void)
static constexpr int MIN_BUFFER_FILL_LEVEL_THRESHOLD_MS
min buffering threshold in ms
bool IsAudioBufferingThresholdReached(void)
Returns true, if audio buffer is filled enough to start audio playback.
int m_volume
track the volume in the device (for attach)
void SetScreenSize(int, int)
Set the screen size.
virtual void StillPicture(const uchar *, int)
Display the given I-frame as a still picture.
bool HaltOpenGlThread(void)
Pause the OpenGL worker thread.
void HandleDisplayModeChange(const sDrmMode &)
Set the display mode.
cSoftOsdProvider * m_pOsdProvider
pointer to cSoftOsdProvider object
cVideoStream * m_pVideoStream
pointer to main video stream
cReassemblyBufferAudio m_audioReassemblyBuffer
audio pes reassembly buffer
int MaxSizeGPUImageCache(void)
Get the maximum GPU image cache size.
std::atomic< bool > m_receivedAudio
flag if audio packets have been received
void SetRenderPipSize(void)
cDvbSpuDecoder * m_pSpuDecoder
pointer to spu decoder
int Start(void)
Called by VDR when the plugin is started.
void SetEnableOglOsd(void)
Enables OpenGL/ES Osd.
virtual void GetVideoSize(int &, int &, double &)
Get the video size.
bool IsOsdProviderSet(void) const
bool IsDetachForced(void)
Returns true, the a detached plugin start was forced.
int PlayAudioPkts(AVPacket *)
Play an audio packet.
virtual void GetOsdSize(int &, int &, double &)
Returns the width, height and aspect ratio the OSD should have.
bool m_initialized
true, if the plugin had a successful Initialize()
void SetEnableHdr(bool)
Enable HDR display mode.
void SetRenderPipActive(bool)
void GetStats(int *, int *, int *)
Get statistics from the renderer.
void SetTrickSpeed(double, bool, bool)
Set the trickspeed in the renderer.
void HaltVideoThreads(void)
Pause the rendering and decoder thread.
void ResetChannelId(void)
Reset the channel ID (restarts audio)
void ResumeVideoThreads(void)
Resume the rendering and decoder thread.
cHardwareDevice * m_pHardwareDevice
pointer to hardware device description
virtual bool CanReplay(void) const
Return true if this device can currently start a replay session.
bool SchedulePlaybackStart(void)
Schedules the playback start.
std::mutex m_mutex
mutex to lock the state machine
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
virtual void Clear(void)
Clears all video and audio data from the device.
cEventHandler * m_pEventHandler
event handler thread
cPipHandler * m_pPipHandler
pointer to pip handler
void Detach(void)
Detach the device.
void ResumeOpenGlThread(void)
Resume the OpenGL worker thread.
virtual int PlayVideo(const uchar *, int)
Play a video packet of the main videostream.
void SetStartDetached(void)
void ResetPipStream(void)
Resets pip stream and render pipeline.
int GetVideoAudioDelayMs(void)
std::chrono::steady_clock::time_point m_dataReceivedTime
timestamp, when the first audio or video data after a channel switch arrives in Play*()
virtual bool SetPlayMode(ePlayMode)
Sets the device into the given play mode.
cAudioDecoder * m_pAudioDecoder
pointer to cAudioDecoder object
void SetDrmCanDisplayPip(bool canDisplay)
void SetAudioCodec(enum AVCodecID, AVCodecParameters *, AVRational)
Open an audio codec.
virtual void Play(void)
Sets the device into play mode (after a previous trick mode, or pause)
void EnterState(State)
Actions to be performed when entering a state.
bool IsBufferingThresholdReached(void)
Check if the buffering threshold has been reached.
int InitAudio(bool)
Init the audio lazily.
cVideoRender * m_pRender
pointer to cVideoRender object
std::unique_ptr< cStateMachine > m_pStateMachine
void SetOsdSize(int, int)
Set the OSD size.
cSoftHdGrab * m_pGrab
pointer to grabber object
void LeaveState(State)
Actions to be performed when leaving a state.
int OglOsdIsDisabled(void)
Is the OpenGL/ES osd disabled?
int PlayPipVideo(const uchar *, int)
Play a video packet of the pip videostream.
bool m_needsMakePrimary
true, if device should be made a primary device after attach
virtual void ChannelSwitch(const cDevice *, int, bool)
Monitor a channel switch triggered by VDR (cStatus::ChannelSwitch())
cSoftHdAudio * m_pAudio
pointer to cSoftHdAudio object
std::chrono::steady_clock::time_point GetChannelSwitchFirstPacketTime(void)
cSoftHdConfig * m_pConfig
pointer to cSoftHdConfig object
void ResetOsdProvider(void)
virtual cRect CanScaleVideo(const cRect &, int taCenter)
Ask the output, if it can scale video.
bool m_disablePip
true, if pip was disabled by the user
virtual void SetVolumeDevice(int)
Sets the audio volume on this device (Volume = 0...255).
virtual int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles.
virtual bool Flush(int=0)
Return true, if the output buffers are empty, false otherwise.
bool IsDetached(void) const
Returns true, if the device is detached.
cVideoRender * Render(void)
virtual void TrickSpeed(int, bool)
Sets the device into a mode where replay is done slower.
cVideoStream * VideoStream(void)
std::chrono::steady_clock::time_point m_channelSwitchStartTime
timestamp, when VDR triggered a channel switch
void SetDecoderFallbackToSw(bool)
Force the decoder to fallback to software if the hardware decoder fails after the configured amount o...
virtual int PlayAudio(const uchar *, int, uchar)
Play an audio packet.
bool PipIsEnabled(void)
Returns true, if pip is currently enabled.
std::mutex m_sizeMutex
mutex to lock screen size (which is accessed by different threads)
std::chrono::steady_clock::time_point GetChannelSwitchStartTime(void)
bool Initialize(void)
Initialize the device.
std::atomic< bool > m_receivedVideo
flag if video packets have been received
void SetDecoderNeedsIFrame(void)
Forces the h264 decoder to wait for an I-Frame to start.
void SetChannelSwitchMode(ChannelSwitchMode mode)
int PlayVideoPkts(AVPacket *)
Play a video packet.
std::atomic< bool > m_receivedValidAudio
flag if valid audio packets have been received
cJitterTracker m_audioJitterTracker
audio jitter tracker
virtual cString DeviceName(void) const
std::atomic< bool > m_receivedValidVideo
flag if valid video packets have been received
int GetBufferFillLevelThresholdMs()
Returns the buffer fill level threshold in milliseconds.
void HandleStillPicture(const uchar *data, int size)
The still picture data received from VDR can contain multiple PES packets.
std::atomic< bool > m_draining
true, if the device is in draining mode (waiting for empty buffers)
int PlayVideoInternal(cVideoStream *, cReassemblyBufferVideo *, const uchar *, int, bool, bool)
Play a video packet.
std::mutex m_eventMutex
mutex to protect event queue
virtual void SetVideoDisplayFormat(eVideoDisplayFormat)
Sets the video display format.
virtual void Freeze(void)
Puts the device into "freeze frame" mode.
void SetParseH264Dimensions(void)
Parse the h264 stream width and height before starting the decoder.
void SetDisableOglOsd(void)
Disables OpenGL/ES Osd (called from setup menu or conf)
cSoftHdConfig * Config(void)
bool m_forceDetached
start the plugin in detached state
void TriggerEvent(const Event &)
With this wrapper function, the device can directly act as an event reveiver.
virtual ~cSoftHdDevice(void)
Destroy the device.
int GetMinBufferFillLevelThresholdMs(void)
void ResetVideoFilter(void)
Reset the video deinterlace filter.
int m_audioChannelID
current audio channel ID
std::atomic< ChannelSwitchMode > m_channelSwitchMode
current channel switch mode
virtual void SetVideoFormat(bool)
Set the video format.
void PausePlayback(bool)
Pause the playback.
virtual void MakePrimaryDevice(bool)
Informs a device that it will be the primary device.
void SetVideoCodec(enum AVCodecID, AVCodecParameters *, AVRational)
Open a video codec.
void SetDetachForced(void)
void SetPassthroughMask(int)
Set the passthrough mask (called from setup menu or conf)
void SetDisableDeint(void)
Disables deinterlacer (called from setup menu or conf)
virtual uchar * GrabImage(int &, bool, int, int, int)
Grabs the currently visible screen image.
void ResumePlayback(void)
Resume playback again.
virtual cSpuDecoder * GetSpuDecoder(void)
Get the device SPU decoder.
cJitterTracker m_videoJitterTracker
video jitter tracker
bool m_drmCanDisplayPip
true, if the drm device is able to display a pip video
std::atomic< PlaybackMode > m_playbackMode
current playback mode
void OsdClose(void)
Close the OSD.
int64_t GetFirstAudioPtsMsToPlay()
Calculate the first audio PTS that should be played during synchronized playback.
bool IsVideoOnlyPlayback(void)
virtual void ScaleVideo(const cRect &=cRect::Null)
Scale the currently shown video.
int64_t GetFirstVideoPtsMsToPlay()
void SetDisplayMode(int)
Trigger a display mode change event if the mode changed.
cSoftHdAudio * Audio(void)
void PipChannelChange(int)
virtual bool Poll(cPoller &, int=0)
Return true if the device itself or any of the file handles in poller is ready for further action.
void Attach(void)
Attach the device again.
void ScheduleResyncAtPtsMs(int64_t)
Schedule aa a/v resync in the render thread at the given pts.
bool m_externalPlayerActive
true, if we detached for an external player
void ToggleRenderPipPosition(void)
State Machine Implementation.
Plugin Configuration Header File.
std::variant< PlayEvent, PauseEvent, StopEvent, TrickSpeedEvent, StillPictureEvent, DetachEvent, AttachEvent, BufferUnderrunEvent, BufferingThresholdReachedEvent, ScheduleResyncAtPtsMsEvent, ResyncEvent, DisplayChangeEvent > Event
ChannelSwitchMode
Channel switch modes.
Describes a hardware device.
Jitter Tracking of Incoming Packets Header File.
PES Packet Parser Header File.
Device State Machine and Event Handler Header File.
Holds possible display configurations.