Go to the documentation of this file.
21 #define LOC QString("VideoOutput: ")
110 float VideoAspect,
const QRect WindowRect,
MythCodecID CodecID)
121 bool mainSuccess =
InitBounds(VideoDim, VideoDispDim, VideoAspect, WindowRect);
150 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Disabled all deinterlacing");
165 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Overriding deinterlacers");
174 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"SetDeinterlacing (Doublerate %1): Single %2 Double %3")
186 bool& ,
int ReferenceFrames,
bool )
191 AVCodec* codec = avcodec_find_decoder(avCodecId);
194 codecName = codec->name;
205 float& VisibleAspect,
207 float ThemeAspect)
const
221 float ThemeAspect)
const
224 float dispPixelAdj = 1.0F;
225 if (dvr.height() && dvr.width())
230 float vs = vr.height() ?
static_cast<float>(vr.width()) / vr.height() : 1.0F;
231 VisibleAspect = ThemeAspect * (ova > 0.0F ? vs / ova : 1.F) * dispPixelAdj;
234 return { QPoint(0,0), dvr.size() };
323 int image_height = video_size.height();
324 int image_width = (image_height > 720) ? 1920 :
325 (image_height > 576) ? 1280 : 720;
326 qreal image_aspect =
static_cast<qreal
>(image_width) / image_height;
327 qreal pixel_aspect =
static_cast<qreal
>(video_size.width()) / video_size.height();
330 if (DisplayRect && DisplayRect->isValid())
333 m0.scale(
static_cast<qreal
>(image_width) / DisplayRect->width(),
334 static_cast<qreal
>(image_height) / DisplayRect->height());
335 rect1 = m0.mapRect(rect1);
336 rect1.translate(DisplayRect->left(), DisplayRect->top());
338 QRect result = rect1;
343 hscale = image_aspect / pixel_aspect;
344 if (hscale < 0.99 || hscale > 1.01)
346 vid_rec.setLeft(
static_cast<int>(lround(
static_cast<qreal
>(vid_rec.left()) * hscale)));
347 vid_rec.setWidth(
static_cast<int>(lround(
static_cast<qreal
>(vid_rec.width()) * hscale)));
350 qreal vscale =
static_cast<qreal
>(dvr_rec.width()) / image_width;
351 hscale =
static_cast<qreal
>(dvr_rec.height()) / image_height;
353 m1.translate(dvr_rec.left(), dvr_rec.top());
354 m1.scale(vscale, hscale);
356 vscale =
static_cast<qreal
>(image_width) / vid_rec.width();
357 hscale =
static_cast<qreal
>(image_height) / vid_rec.height();
359 m2.scale(vscale, hscale);
360 m2.translate(-vid_rec.left(), -vid_rec.top());
362 result = m2.mapRect(result);
363 result = m1.mapRect(result);
375 static constexpr
float kSafeMargin = 0.05F;
378 int safex =
static_cast<int>(
static_cast<float>(result.width()) * kSafeMargin);
379 int safey =
static_cast<int>(
static_cast<float>(result.height()) * kSafeMargin);
380 return { result.left() + safex, result.top() + safey,
381 result.width() - (2 * safex), result.height() - (2 * safey) };
virtual void GetOSDBounds(QRect &Total, QRect &Visible, float &VisibleAspect, float &FontScaling, float ThemeAspect) const
uint ValidVideoFrames(void) const
bool IsEmbedding(void) const
void ReleaseFrame(MythVideoFrame *Frame)
LetterBoxColour m_dbLetterboxColour
virtual bool InputChanged(QSize VideoDim, QSize VideoDispDim, float VideoAspect, MythCodecID CodecID, bool &AspectChanged, int ReferenceFrames, bool ForceChange)
Tells video output to discard decoded frames and wait for new ones.
PictureAttributeSupported
void VideoAspectRatioChanged(float Aspect)
Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.
static MythDeintType ParseDeinterlacer(const QString &Deinterlacer)
virtual void EmbedPlayback(bool Embed, QRect Rect)
int FreeVideoFrames()
Returns number of frames available for decoding onto.
VideoErrorState GetError() const
MythVideoFrame * GetNextFreeFrame(BufferType EnqueueTo=kVideoBuffer_limbo)
Gets a frame from available buffers list.
QRect GetDisplayVisibleRect(void) const
VideoErrorState m_errorState
bool EnoughDecodedFrames(void) const
float GetDisplayAspect(void) const
arg(title).arg(filename).arg(doDelete))
void SetDeinterlacing(MythDeintType Single, MythDeintType Double, MythCodecID CodecID)
MythDeintType m_forcedDeinterlacer
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
virtual void SetFramesPlayed(long long FramesPlayed)
QRect GetVideoRect(void) const
QRect GetDisplayVideoRect(void) const
void SetPrebuffering(bool Normal)
Sets whether to use a normal number of buffers or fewer buffers.
static void GetRenderOptions(RenderOptions &Options, MythRender *Render)
virtual bool Init(QSize VideoDim, QSize VideoDispDim, float VideoAspect, QRect WindowRect, MythCodecID CodecID)
virtual int ValidVideoFrames() const
Returns number of frames that are fully decoded.
void SourceChanged(QSize VideoDim, QSize VideoDispDim, float Aspect)
Update for new source video dimensions and aspect ratio.
virtual void ClearAfterSeek()
Tells video output to toss decoded buffers due to a seek.
virtual void DeLimboFrame(MythVideoFrame *Frame)
Releases a frame for reuse if it is in limbo.
QString GetFrameStatus() const
Returns string with status of each frame for debugging.
bool EnoughFreeFrames(void) const
MythVideoProfilePtr m_videoProfile
virtual MythVideoFrame * GetNextFreeFrame()
Blocks until it is possible to return a frame for decoding onto.
void StartDisplayingFrame(void)
QRect GetImageRect(QRect Rect, QRect *DisplayRect=nullptr)
translates caption/dvd button rectangle into 'screen' space
virtual long long GetFramesPlayed()
QRect GetEmbeddingRect(void) const
virtual void DiscardFrames(bool KeyFrame, bool Flushed)
Releases all frames not being actively displayed from any queue onto the queue of frames ready for de...
virtual MythVideoFrame * GetLastDecodedFrame()
MythCodecID m_videoCodecID
float GetOverridenVideoAspect(void) const
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QSize GetVideoDispDim(void) const
int GetNumSetting(const QString &key, int defaultval=0)
static QString DeinterlacerPref(MythDeintType Deint)
bool EnoughFreeFrames()
Returns true iff enough frames are available to decode onto.
virtual void ReleaseFrame(MythVideoFrame *Frame)
Releases a frame from the ready for decoding queue onto the queue of frames ready for display.
virtual void StartDisplayingFrame()
Tell GetLastShownFrame() to return the next frame from the head of the queue of frames to display.
static void GetRenderOptions(RenderOptions &Options)
MythVideoFrame * GetLastShownFrame(void)
virtual void SetVideoFrameRate(float playback_fps)
AVCodecID myth2av_codecid(MythCodecID codec_id)
void DiscardFrame(MythVideoFrame *Frame)
PictureAttributeSupported GetSupportedPictureAttributes()
@ kLetterBoxColour_Gray25
MythVideoFrame * GetLastDecodedFrame(void)
void SetPrebuffering(bool Normal)
QRect GetSafeRect()
Returns a QRect describing an area of the screen on which it is 'safe' to render the On Screen Displa...
void ClearAfterSeek(void)
Clear used frames after seeking.
void DoneDisplayingFrame(MythVideoFrame *Frame)
bool InitBounds(QSize VideoDim, QSize VideoDispDim, float Aspect, QRect WindowRect)
uint FreeVideoFrames(void) const
static void GetRenderOptions(RenderOptions &Options, MythRender *Render)
virtual void SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force=DEINT_NONE)
void DiscardFrames(bool NextFrameIsKeyFrame)
void DeLimboFrame(MythVideoFrame *Frame)
bool EnoughDecodedFrames()
Returns true iff there are plenty of decoded frames ready for display.
virtual MythVideoFrame * GetLastShownFrame()
Returns frame from the head of the ready to be displayed queue, if StartDisplayingFrame has been call...
PictureAttributeSupported SupportedAttributes(void) const
QString GetStatus(uint Num=0) const
QRect GetVisibleOSDBounds(float &VisibleAspect, float &FontScaling, float ThemeAspect) const
Returns visible portions of total OSD bounds.
VideoBuffers m_videoBuffers
MythVideoColourSpace m_videoColourSpace
virtual void DiscardFrame(MythVideoFrame *frame)
Releases frame from any queue onto the queue of frames ready for decoding onto.
virtual void DoneDisplayingFrame(MythVideoFrame *Frame)
Releases frame returned from GetLastShownFrame() onto the queue of frames ready for decoding onto.