Go to the documentation of this file.
22 #define LOC QString("VideoOutput: ")
111 float VideoAspect,
const QRect WindowRect,
MythCodecID CodecID)
122 bool mainSuccess =
InitBounds(VideoDim, VideoDispDim, VideoAspect, WindowRect);
151 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Disabled all deinterlacing");
166 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Overriding deinterlacers");
175 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"SetDeinterlacing (Doublerate %1): Single %2 Double %3")
176 .arg(QString::number(DoubleRate),
189 bool& ,
int ReferenceFrames,
bool )
194 const AVCodec* codec = avcodec_find_decoder(avCodecId);
197 codecName = codec->name;
208 float& VisibleAspect,
210 float ThemeAspect)
const
224 float ThemeAspect)
const
227 float dispPixelAdj = 1.0F;
228 if (dvr.height() && dvr.width())
233 float vs = vr.height() ?
static_cast<float>(vr.width()) / vr.height() : 1.0F;
234 VisibleAspect = ThemeAspect * (ova > 0.0F ? vs / ova : 1.F) * dispPixelAdj;
237 return { QPoint(0,0), dvr.size() };
326 int image_height = video_size.height();
327 int image_width = (image_height > 720) ? 1920 :
328 (image_height > 576) ? 1280 : 720;
329 qreal image_aspect =
static_cast<qreal
>(image_width) / image_height;
330 qreal pixel_aspect =
static_cast<qreal
>(video_size.width()) / video_size.height();
333 if (DisplayRect && DisplayRect->isValid())
336 m0.scale(
static_cast<qreal
>(image_width) / DisplayRect->width(),
337 static_cast<qreal
>(image_height) / DisplayRect->height());
338 rect1 = m0.mapRect(rect1);
339 rect1.translate(DisplayRect->left(), DisplayRect->top());
341 QRect result = rect1;
346 hscale = image_aspect / pixel_aspect;
347 if (hscale < 0.99 || hscale > 1.01)
349 vid_rec.setLeft(
static_cast<int>(lround(
static_cast<qreal
>(vid_rec.left()) * hscale)));
350 vid_rec.setWidth(
static_cast<int>(lround(
static_cast<qreal
>(vid_rec.width()) * hscale)));
353 qreal vscale =
static_cast<qreal
>(dvr_rec.width()) / image_width;
354 hscale =
static_cast<qreal
>(dvr_rec.height()) / image_height;
356 m1.translate(dvr_rec.left(), dvr_rec.top());
357 m1.scale(vscale, hscale);
359 vscale =
static_cast<qreal
>(image_width) / vid_rec.width();
360 hscale =
static_cast<qreal
>(image_height) / vid_rec.height();
362 m2.scale(vscale, hscale);
363 m2.translate(-vid_rec.left(), -vid_rec.top());
365 result = m2.mapRect(result);
366 result = m1.mapRect(result);
378 static constexpr
float kSafeMargin = 0.05F;
381 int safex =
static_cast<int>(
static_cast<float>(result.width()) * kSafeMargin);
382 int safey =
static_cast<int>(
static_cast<float>(result.height()) * kSafeMargin);
383 return { result.left() + safex, result.top() + safey,
384 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
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
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 DiscardFrame(MythVideoFrame *Frame)
Releases frame from any queue onto the queue of frames ready for decoding onto.
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.
virtual void SetVideoFrameRate(float VideoFrameRate)
VideoBuffers m_videoBuffers
MythVideoColourSpace m_videoColourSpace
virtual void DoneDisplayingFrame(MythVideoFrame *Frame)
Releases frame returned from GetLastShownFrame() onto the queue of frames ready for decoding onto.