21#ifndef __SOFTHDDEVICE_H
22#define __SOFTHDDEVICE_H
24#if __cplusplus < 201703L
25#error "C++17 or higher is required"
31#include <vdr/dvbspu.h>
35#include <libavcodec/avcodec.h>
51struct overload : Ts... {
using Ts::operator()...; };
65 [](
const PlayEvent&) ->
const char* {
return "PlayEvent"; },
66 [](
const PauseEvent&) ->
const char* {
return "PauseEvent"; },
67 [](
const StopEvent&) ->
const char* {
return "StopEvent"; },
68 [](
const TrickSpeedEvent&) ->
const char* {
return "TrickSpeedEvent"; },
70 [](
const DetachEvent&) ->
const char* {
return "DetachEvent"; },
71 [](
const AttachEvent&) ->
const char* {
return "AttachEvent"; },
72 [](
const BufferUnderrunEvent& e) ->
const char* {
return e.type ==
AUDIO ?
"BufferUnderrunEvent: Audio" :
"BufferUnderrunEvent: Video"; },
74 [](
const PipEvent&) ->
const char* {
return "PipEvent"; },
123 virtual cString
DeviceName(
void)
const {
return "softhddevice-drm-gles"; }
132 virtual int PlayVideo(
const uchar *,
int);
133 virtual int PlayAudio(
const uchar *,
int, uchar);
134 virtual int64_t
GetSTC(
void);
136 virtual void ScaleVideo(
const cRect & = cRect::Null);
138 virtual void Clear(
void);
139 virtual void Play(
void);
140 virtual void Freeze(
void);
142 virtual bool Poll(cPoller &,
int = 0);
143 virtual bool Flush(
int = 0);
146 virtual uchar *
GrabImage(
int &,
bool,
int,
int,
int);
152 virtual void GetOsdSize(
int &,
int &,
double &);
182 char WritePngs(
void);
184 int MaxSizeGPUImageCache(
void);
185 int OglOsdIsDisabled(
void);
186 void SetDisableOglOsd(
void);
187 void SetEnableOglOsd(
void);
191 void OsdDrawARGB(
int,
int,
int,
int,
int,
const uint8_t *,
int,
int);
203 void SetAudioCodec(
enum AVCodecID, AVCodecParameters *, AVRational);
204 void SetVideoCodec(
enum AVCodecID, AVCodecParameters *, AVRational);
Audio and alsa module header file.
cAudioDecoder - Audio decoder class
cPipReceiver - receiver class for pip
Audio stream reassembly buffer.
Video stream reassembly buffer.
cSoftHdAudio - Audio class
int ConfigVideoAudioDelayMs
config audio delay
void SetState(State)
Sets the device into the given state.
void OsdDrawARGB(int, int, int, int, int, const uint8_t *, int, int)
Draw an OSD pixmap.
cReassemblyBufferVideo m_videoReassemblyBuffer
video pes reassembly buffer
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
cVideoStream * m_pPipStream
pointer to pip video stream
void PipSwapPosition(void)
Swap pip between normal and alternative position.
static constexpr int MIN_BUFFER_FILL_LEVEL_THRESHOLD_MS
min buffering threshold in ms
virtual void StillPicture(const uchar *, int)
Display the given I-frame as a still picture.
void PipSetSize(void)
Set size and position for the pip window.
cSoftOsdProvider * m_pOsdProvider
pointer to cSoftOsdProvider object
cVideoStream * m_pVideoStream
pointer to main video stream
cReassemblyBufferAudio m_audioReassemblyBuffer
audio pes reassembly buffer
std::atomic< bool > m_receivedAudio
flag if audio packets have been received
void HandlePip(enum PipState)
Handle the pip event.
cDvbSpuDecoder * m_pSpuDecoder
pointer to spu decoder
void OnEnteringState(State)
Actions to be performed when entering a state.
int Start(void)
Called by VDR when the plugin is started.
virtual void GetVideoSize(int &, int &, double &)
Get the video size.
bool IsOsdProviderSet(void) const
int PlayAudioPkts(AVPacket *)
Play an audio packet.
virtual void GetOsdSize(int &, int &, double &)
Returns the width, height and aspect ratio the OSD.
void GetStats(int *, int *, int *)
Get statistics from the renderer.
void ClearAudio(void)
Clear all audio data from the decoder and ringbuffer.
void ResetChannelId(void)
Reset the channel ID (restarts audio)
virtual bool CanReplay(void) const
Returns true if this device can currently start a replay session.
virtual void SetDigitalAudioDevice(bool)
void SwapPipPosition(void)
Swap pip between normal and alternative position.
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.
void OnEventReceived(const Event &)
Event handler for playback state transitions.
void ResetPipChannel(void)
Resets the pip channel to the current live stream channel.
void Detach(void)
Detach the device.
virtual int PlayVideo(const uchar *, int)
Play a video packet of the main videostream.
void TogglePip(void)
Toggle picture-in-picture.
int GetVideoAudioDelayMs(void)
uint32_t m_screenRefreshRate
std::atomic< State > m_state
current plugin state, normal plugin start sets detached state
void OnLeavingState(State)
Actions to be performed when leaving a state.
virtual bool SetPlayMode(ePlayMode)
Sets the device into the given play mode.
cAudioDecoder * m_pAudioDecoder
pointer to cAudioDecoder object
void SetAudioCodec(enum AVCodecID, AVCodecParameters *, AVRational)
Open an audio codec.
cPipReceiver * m_pPipReceiver
cReceiver for pip stream
virtual void Play(void)
Sets the device into play mode (after a previous trick mode, or pause)
bool IsBufferingThresholdReached(void)
Check if the buffering threshold has been reached.
bool m_grabActive
simple lock variable skips a new grab request if the last one is still active
void DelPip(void)
Delete the pip receiver, clear decoder and display buffers and disable rendering the pip window.
cVideoRender * m_pRender
pointer to cVideoRender object
virtual void SetAudioChannelDevice(int)
const char * CommandLineHelp(void)
Return command line help string.
cSoftHdDevice(cSoftHdConfig *)
cSoftHdDevice constructor
int PlayPipVideo(const uchar *, int)
Play a video packet of the pip videostream.
cSoftHdAudio * m_pAudio
pointer to cSoftHdAudio object
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.
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)
Flush the device output buffers.
bool IsDetached(void) const
Returns true, if the device is detached.
cVideoRender * Render(void)
virtual void TrickSpeed(int, bool)
Set trick play speed.
cVideoStream * VideoStream(void)
virtual int PlayAudio(const uchar *, int, uchar)
Play an audio packet.
void SetPipSize(void)
Set size and position for the pip window.
void PipToggle(void)
Toggle picture-in-picture.
bool PipIsEnabled(void)
Returns true, if picture-in-picture is running.
std::mutex m_sizeMutex
mutex to lock screen size (which is accessed by different threads)
std::atomic< bool > m_receivedVideo
flag if video packets have been received
virtual int GetAudioChannelDevice(void)
int PlayVideoPkts(AVPacket *)
Play a video packet.
int m_pipChannelNum
current pip channel number
virtual cString DeviceName(void) const
int GetBufferFillLevelThresholdMs()
Returns the buffer fill level threshold in milliseconds.
void SetPassthrough(int)
Set the passthrough mask (called from setup menu or conf)
int PlayVideoInternal(cVideoStream *, cReassemblyBufferVideo *, const uchar *, int)
Play a video packet.
const cChannel * m_pPipChannel
current pip channel
void HandleStillPicture(const uchar *data, int size)
The still picture data received from VDR can contain multiple PES packets.
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 ChangePipChannel(int)
Change the pip channel.
cSoftHdConfig * Config(void)
virtual ~cSoftHdDevice(void)
cSoftHdDevice destructor
int m_audioChannelID
current audio channel ID
void PipDisable(void)
Stop picture-in-picture.
virtual void SetVideoFormat(bool)
Set the video format.
void SetScreenSize(int, int, uint32_t)
Set the screen size.
virtual void MakePrimaryDevice(bool)
Informs a device that it will be the primary device.
void SetVideoCodec(enum AVCodecID, AVCodecParameters *, AVRational)
Open a video codec.
bool m_pipActive
true, if pip is active
void PipEnable(void)
Start picture-in-picture.
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.
virtual cSpuDecoder * GetSpuDecoder(void)
Get the device SPU decoder.
virtual void SetAudioTrackDevice(eTrackType)
void PipChannelSwap(void)
Swap the pip channel with main live channel.
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.
virtual void ScaleVideo(const cRect &=cRect::Null)
Scale the currently shown video.
int64_t GetFirstVideoPtsMsToPlay()
int ProcessArgs(int, char *[])
Process the command line arguments.
cSoftHdAudio * Audio(void)
void SetEnablePip(bool)
Enable/ disable picture-in-picture.
void PipChannelChange(int)
Change the pip channel.
virtual bool Poll(cPoller &, int=0)
Returns 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 NewPip(int)
Create a new pip receiver and render the pip stream.
cSoftOsdProvider - SoftHdDevice plugin OSD provider class
cVideoRender - Video render class
cVideoStream - Video stream class
Audio decoder header file.
SoftHdDevice config header file.
State machine and event header file.
std::variant< PlayEvent, PauseEvent, StopEvent, TrickSpeedEvent, StillPictureEvent, DetachEvent, AttachEvent, BufferUnderrunEvent, BufferingThresholdReachedEvent, PipEvent > Event
Pip receiver header file.
const char * EventToString(const Event &e)
overload(Ts...) -> overload< Ts... >
const char * StateToString(State s)
Softhddevice osd header file.
Rendering class header file.
Videostream class header file.