4 #include <QDesktopWidget> 31 #ifdef USING_OPENGL_VIDEO 55 #include "libavcodec/avcodec.h" 56 #include "libswscale/swscale.h" 57 #include "libavutil/imgutils.h" 64 #define LOC QString("VideoOutput: ") 71 QStringList cpudeints;
72 cpudeints +=
"onefield";
73 cpudeints +=
"linearblend";
74 cpudeints +=
"kerneldeint";
75 cpudeints +=
"kerneldoubleprocessdeint";
77 cpudeints +=
"greedyhdeint";
79 cpudeints +=
"greedyhdoubleprocessdeint";
80 cpudeints +=
"yadifdeint";
81 cpudeints +=
"yadifdoubleprocessdeint";
82 cpudeints +=
"fieldorderdoubleprocessdeint";
95 #ifdef USING_OPENGL_VIDEO 97 #endif // USING_OPENGL_VIDEO 102 #endif // USING_VDPAU 106 #endif // USING_VAAPI 109 #endif // USING_GLVAAPI 113 #endif // USING_OPENMAX 122 const QString &decoder,
MythCodecID codec_id,
void *codec_priv,
123 PIPState pipState,
const QSize &video_dim_buf,
124 const QSize &video_dim_disp,
float video_aspect,
125 QWidget *parentwidget,
const QRect &embed_rect,
float video_prate,
126 uint playerFlags, QString &codecName)
129 QStringList renderers;
144 #endif // USING_VDPAU 163 #ifdef USING_OPENGL_VIDEO 166 #endif // USING_OPENGL_VIDEO 171 #endif // USING_VDPAU 176 #endif // USING_GLVAAPI 181 #endif // USING_OPENMAX 184 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Allowed renderers: " +
189 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Allowed renderers (filt: " + decoder +
196 if (renderers.size() > 0)
198 vprof->
SetInput(video_dim_disp, video_prate, codecName);
203 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Preferred renderer: " + renderer);
207 if (renderer.isEmpty())
210 while (!renderers.empty())
212 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
213 QString(
"Trying video renderer: '%1'").arg(renderer));
214 int index = renderers.indexOf(renderer);
216 renderers.removeAt(index);
223 if (renderer ==
"null")
227 else if (renderer ==
"direct3d")
231 #ifdef USING_OPENGL_VIDEO 232 else if (renderer.contains(
"opengl") && (renderer !=
"openglvaapi"))
234 #endif // USING_OPENGL_VIDEO 237 else if (renderer ==
"vdpau")
239 else if (renderer ==
"nullvdpau")
241 #endif // USING_VDPAU 244 else if (renderer ==
"nullvaapi")
246 #endif // USING_VAAPI 249 else if (renderer ==
"openglvaapi")
251 #endif // USING_GLVAAPI 256 #endif // USING_OPENMAX 259 else if (xvlist.contains(renderer))
268 QWidget *widget = parentwidget;
271 widget =
window->findChild<QWidget*>(
"video playback window");
275 LOG(VB_GENERAL, LOG_ERR,
LOC +
"No window for video output.");
281 if (!widget->winId())
283 LOG(VB_GENERAL, LOG_ERR,
LOC +
"No window for video output.");
290 QRect display_rect = QRect(0, 0, widget->width(), widget->height());
292 display_rect = embed_rect;
297 video_dim_buf, video_dim_disp, video_aspect,
298 widget->winId(), display_rect, codec_id))
310 if (vo->
Init(video_dim_buf, video_dim_disp,
311 video_aspect, 0, QRect(), codec_id))
324 LOG(VB_GENERAL, LOG_ERR,
LOC +
325 "Not compiled with any useable video output method.");
407 video_codec_id(
kCodec_NONE), db_vdisp_profile(nullptr),
410 pip_desired_display_size(160,128), pip_display_size(0,0),
412 pip_tmp_buf(nullptr), pip_tmp_buf2(nullptr),
413 pip_scaling_context(nullptr),
417 vsz_desired_display_rect(0,0,0,0), vsz_display_size(0,0),
419 vsz_tmp_buf(nullptr), vsz_scale_context(nullptr),
422 m_deinterlacing(
false), m_deintfiltername(
"linearblend"),
423 m_deintFiltMan(nullptr), m_deintFilter(nullptr),
424 m_deinterlaceBeforeOSD(
true),
430 display_res(nullptr),
433 monitor_sz(640,480), monitor_dim(400,300),
436 osd_painter(nullptr), osd_image(nullptr),
437 invalid_osd_painter(nullptr),
495 const QSize &video_dim_disp,
496 float aspect, WId winid,
510 bool mainSuccess =
window.
Init(video_dim_buf, video_dim_disp,
570 const QString& overridefilter)
626 LOG(VB_GENERAL, LOG_ERR,
627 QString(
"Failed to approve '%1' deinterlacer " 628 "as a software deinterlacer")
638 int width = video_dim.width();
639 int height = video_dim.height();
642 width, height, btmp, threads);
649 LOG(VB_GENERAL, LOG_ERR,
LOC +
650 QString(
"Couldn't load deinterlace filter %1")
656 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"Using deinterlace method %1")
726 return (!filtername.contains(
"bobdeint") &&
727 !filtername.contains(
"doublerate") &&
728 !filtername.contains(
"opengl") &&
729 !filtername.contains(
"vdpau"));
757 const QSize &video_dim_disp,
764 aspect, myth_codec_id, codec_private);
767 AVCodec *codec = avcodec_find_decoder(avCodecId);
770 codecName = codec->name;
822 float &visible_aspect,
824 float themeaspect)
const 837 float &visible_aspect,
float &font_scaling,
float themeaspect)
const 842 visible_aspect, font_scaling, themeaspect);
848 QSize dvr2 = QSize(dvr.width() & ~0x3,
849 dvr.height() & ~0x1);
851 float dispPixelAdj = 1.0f;
852 if (dvr2.height() && dvr2.width())
857 float vs = vr.height() ? (float)vr.width() / vr.height() : 1.f;
858 visible_aspect = themeaspect * (ova ? vs / ova : 1.f) * dispPixelAdj;
861 return QRect(QPoint(0,0), dvr2);
874 QSize dvr2 = QSize(dvr.width() & ~0x3,
875 dvr.height() & ~0x1);
877 return QRect(QPoint(0,0), dvr2);
886 return QRect(QPoint(dvr.left() & ~0x1, dvr.top() & ~0x1),
887 QSize(dvr.width() & ~0x1, dvr.height() & ~0x1));
971 int newVal = curVal + ((direction) ? +1 : -1);
974 newVal = newVal % 100;
979 newVal = min(max(newVal, 0), 100);
1027 QSize vid_size = QSize(pipwidth, pipheight);
1046 AV_PIX_FMT_YUV420P, SWS_FAST_BILINEAR,
1047 nullptr,
nullptr,
nullptr);
1080 PIPMap::const_iterator it = pipPlayers.begin();
1081 for (; it != pipPlayers.end(); ++it)
1082 ShowPIP(frame, it.key(), *it);
1116 if ((video_aspect <= 0) || (pipVideoAspect <= 0) ||
1145 av_image_fill_arrays(
1146 img_out.data, img_out.linesize,
1154 piph, img_out.data, img_out.linesize);
1162 av_image_fill_arrays(img_padded.data, img_padded.linesize,
1166 int color[3] = { 20, 0, 200 };
1167 av_picture_pad((AVPicture*)(&img_padded),
1168 (AVPicture*)(&img_out), piph, pipw,
1169 AV_PIX_FMT_YUV420P, 4, 4, 4, 4, color);
1171 int offsets[3] = {0, int(img_padded.data[1] - img_padded.data[0]),
1172 int(img_padded.data[2] - img_padded.data[0]) };
1174 sizeof(
int), img_padded.linesize, offsets);
1178 int offsets[3] = {0, int(img_out.data[1] - img_out.data[0]),
1179 int(img_out.data[2] - img_out.data[0]) };
1181 sizeof(
int), img_out.linesize, offsets);
1186 if ((position.left() >= 0) && (position.top() >= 0))
1188 int xoff = position.left();
1189 int yoff = position.top();
1190 int xoff2[3] = { xoff, xoff>>1, xoff>>1 };
1191 int yoff2[3] = { yoff, yoff>>1, yoff>>1 };
1194 int height[3] = { pip_height, pip_height>>1, pip_height>>1 };
1196 int widths[3] = { pip_width, pip_width>>1, pip_width>>1 };
1198 for (
int p = 0; p < 3; p++)
1200 for (
int h = pipActive ? 0 : 1; h < height[p]; h++)
1202 memcpy((frame->
buf + frame->
offsets[p]) + (h + yoff2[p]) *
1239 AV_PIX_FMT_YUV420P, SWS_FAST_BILINEAR,
1240 nullptr,
nullptr,
nullptr);
1253 (resize.right() > frame->
width || resize.bottom() > frame->
height ||
1254 resize.width() > frame->
width || resize.height() > frame->
height);
1256 abort |= !resize.left() && !resize.top() && (resize.size() == frameDim);
1277 av_image_fill_arrays(img_out.data, img_out.linesize,
1280 av_image_fill_arrays(img_in.data, img_in.linesize,
1281 frame->
buf, AV_PIX_FMT_YUV420P,
1283 img_in.data[0] = frame->
buf + frame->
offsets[0];
1284 img_in.data[1] = frame->
buf + frame->
offsets[1];
1285 img_in.data[2] = frame->
buf + frame->
offsets[2];
1286 img_in.linesize[0] = frame->
pitches[0];
1287 img_in.linesize[1] = frame->
pitches[1];
1288 img_in.linesize[2] = frame->
pitches[2];
1290 frame->
height, img_out.data, img_out.linesize);
1296 int xoff = resize.left();
1297 int yoff = resize.top();
1298 int resw = resize.width();
1301 unsigned char *yptr = frame->
buf + frame->
offsets[0];
1305 yptr += yoff * vidw + xoff;
1306 for (
int i = 0; i < resize.height(); i++)
1308 memcpy(yptr, videoyptr, resw);
1317 unsigned char *uptr = frame->
buf + frame->
offsets[1];
1318 unsigned char *vptr = frame->
buf + frame->
offsets[2];
1320 uptr += yoff * vidw + xoff;
1321 vptr += yoff * vidw + xoff;
1323 unsigned char *videouptr =
vsz_tmp_buf + resw * resize.height();
1324 unsigned char *videovptr =
vsz_tmp_buf + (resw * resize.height() * 5) / 4;
1326 for (
int i = 0; i < resize.height() / 2; i ++)
1328 memcpy(uptr, videouptr, resw);
1331 memcpy(vptr, videovptr, resw);
1387 if (!videoRect.isValid() ||
1388 videoRect.width() < 1 || videoRect.height() < 1)
1409 #define THREADED_OSD_RENDER 1 1412 #if THREADED_OSD_RENDER 1413 class OsdRender :
public QRunnable
1417 m_frame(frame), m_osd_image(osd_image), m_video_dim(dim), m_vis(vis)
1422 switch (m_frame->codec)
1434 #define ROUNDUP( _x,_z) ((_x) + ((-(_x)) & ((_z) - 1)) ) 1435 #define ROUNDDN( _x,_z) ((_x) & ~((_z) - 1)) 1436 int left = m_vis.left();
1438 left = std::min(left, m_osd_image->width());
1440 int right = m_vis.left() + m_vis.width();
1442 right = std::min(right, m_osd_image->width());
1444 int top = m_vis.top();
1447 int bottom = m_vis.top() + m_vis.height();
1448 bottom = ROUNDDN(bottom,
ALIGN_C);
1453 inline void i44(
bool ifirst)
1455 int left = std::min(m_vis.left(), m_osd_image->width());
1456 int top = std::min(m_vis.top(), m_osd_image->height());
1457 int right = std::min(left + m_vis.width(), m_osd_image->width());
1458 int bottom = std::min(top + m_vis.height(), m_osd_image->height());
1460 memset(m_frame->buf, 0, m_video_dim.width() * m_video_dim.height());
1462 left, top, right, bottom, ifirst);
1468 QSize
const m_video_dim;
1501 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"OSD size changed."));
1511 QImage blank = QImage(osd_size,
1512 QImage::Format_ARGB32_Premultiplied);
1516 QRegion(QRect(QPoint(0,0), osd_size)));
1517 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Created YV12 OSD."));
1525 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Visualiser not supported here");
1530 switch (frame->
codec)
1537 LOG(VB_GENERAL, LOG_ERR,
LOC +
1538 "Display OSD: Frame format not supported.");
1542 QRegion dirty = QRegion();
1546 bool changed = !dirty.isEmpty();
1547 bool show = !visible.isEmpty();
1557 #if THREADED_OSD_RENDER 1562 QPoint c =
r.center();
1563 QVector<QRect> vis = visible.intersected(QRect(
r.topLeft(),c)).rects();
1564 vis += visible.intersected(QRect(c,
r.bottomRight())).rects();
1565 vis += visible.intersected(QRect(
r.bottomLeft(),c).normalized()).rects();
1566 vis += visible.intersected(QRect(c,
r.topRight()).normalized()).rects();
1568 QVector<QRect> vis = visible.rects();
1570 for (
int i = 0; i < vis.size(); i++)
1572 #if THREADED_OSD_RENDER 1573 OsdRender *job =
new OsdRender(frame,
osd_image, video_dim, vis[i]);
1574 job->setAutoDelete(
true);
1575 s_pool.
start(job,
"OsdRender");
1577 int left = min(vis[i].left(),
osd_image->width());
1578 int top = min(vis[i].top(),
osd_image->height());
1579 int right = min(left + vis[i].width(),
osd_image->width());
1580 int bottom = min(top + vis[i].height(),
osd_image->height());
1588 memset(frame->
buf, 0, video_dim.width() * video_dim.height());
1590 left, top, right, bottom,
true);
1594 memset(frame->
buf, 0, video_dim.width() * video_dim.height());
1596 left, top, right, bottom,
false);
1600 #if THREADED_OSD_RENDER 1607 const QString &
name)
1623 const QString &
name)
1639 return QStringList();
1658 if (to ==
nullptr || from ==
nullptr)
1673 int image_height = video_size.height();
1674 int image_width = (image_height > 720) ? 1920 :
1675 (image_height > 576) ? 1280 : 720;
1676 float image_aspect = (float)image_width / (
float)image_height;
1677 float pixel_aspect = (float)video_size.width() /
1678 (float)video_size.height();
1681 if (display && display->isValid())
1684 m0.scale((
float)image_width / (
float)display->width(),
1685 (float)image_height / (
float)display->height());
1686 rect1 = m0.mapRect(rect1);
1687 rect1.translate(display->left(), display->top());
1689 QRect result = rect1;
1696 hscale = image_aspect / pixel_aspect;
1697 if (hscale < 0.99f || hscale > 1.01f)
1699 vid_rec.setLeft(lroundf((
float)vid_rec.left() * hscale));
1700 vid_rec.setWidth(lroundf((
float)vid_rec.width() * hscale));
1703 float vscale = (float)dvr_rec.width() / (float)image_width;
1704 hscale = (float)dvr_rec.height() / (float)image_height;
1706 m1.translate(dvr_rec.left(), dvr_rec.top());
1707 m1.scale(vscale, hscale);
1709 vscale = (float)image_width / (
float)vid_rec.width();
1710 hscale = (float)image_height / (
float)vid_rec.height();
1712 m2.scale(vscale, hscale);
1713 m2.translate(-vid_rec.left(), -vid_rec.top());
1715 result = m2.mapRect(result);
1716 result = m1.mapRect(result);
1720 hscale = pixel_aspect / image_aspect;
1721 if (hscale < 0.99f || hscale > 1.01f)
1723 result.setLeft(lroundf((
float)rect1.left() * hscale));
1724 result.setWidth(lroundf((
float)rect1.width() * hscale));
1727 result.translate(-visible_osd.left(), -visible_osd.top());
1739 static const float safeMargin = 0.05f;
1742 int safex = (int)((
float)result.width() * safeMargin);
1743 int safey = (int)((
float)result.height() * safeMargin);
1744 return QRect(result.left() + safex, result.top() + safey,
1745 result.width() - (2 * safex), result.height() - (2 * safey));
1757 for (QStringList::const_iterator it = list.begin(); it != list.end(); ++it)
1761 return ret.left(ret.length()-1);
1803 if (!width || !height)
1807 if (!width || !height)
1815 if ((width == 1920 || width == 1440) && height == 1088)
1833 int gui_width = 0, gui_height = 0;
1835 fullscreen |= (0 == gui_width && 0 == gui_height);
1841 const QRect display_visible_rect =
1858 QString source =
"Actual";
1863 QSize sz1 = disp.
res;
1865 QSize max_size = sz1.expandedTo(sz2);
1880 max_size.width(), max_size.height()));
1892 source =
"Database";
1903 float pixel_aspect = (float)screen_size.width() /
1904 (float)screen_size.height();
1906 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
1907 QString(
"Pixel dimensions: Screen %1x%2, window %3x%4")
1908 .arg(screen_size.width()).arg(screen_size.height())
1909 .arg(window_size.width()).arg(window_size.height()));
1921 source =
"Xinerama";
1923 "XineramaMonitorAspectRatio",
1925 if (disp_dim.height() <= 0)
1926 disp_dim.setHeight(300);
1927 disp_dim.setWidth(lroundf(disp_dim.height() * disp_aspect));
1930 if (disp_dim.isEmpty())
1932 source =
"Guessed!";
1933 LOG(VB_GENERAL, LOG_WARNING,
LOC +
"Physical size of display unknown." 1934 "\n\t\t\tAssuming 17\" monitor with square pixels.");
1935 disp_dim = QSize(lroundf(300 * pixel_aspect), 300);
1938 disp_aspect = (float) disp_dim.width() / (float) disp_dim.height();
1939 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
1940 QString(
"%1 display dimensions: %2x%3 mm Aspect: %4")
1941 .arg(source).arg(disp_dim.width()).arg(disp_dim.height())
1950 disp_dim = QSize((disp_dim.width() * window_size.width()) /
1951 screen_size.width(),
1952 (disp_dim.height() * window_size.height()) /
1953 screen_size.height());
1954 disp_aspect = (float) disp_dim.width() / (float) disp_dim.height();
1962 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
1963 QString(
"Estimated window dimensions: %1x%2 mm Aspect: %3")
1974 if ((adaptor_name ==
"ATI Radeon Video Overlay") ||
1975 (adaptor_name ==
"XA G3D Textured Video") ||
1976 (adaptor_name ==
"Radeon Textured Video") ||
1977 (adaptor_name ==
"AMD Radeon AVIVO Video") ||
1978 (adaptor_name ==
"XV_SWOV" ) ||
1979 (adaptor_name ==
"Savage Streams Engine" ) ||
1980 (adaptor_name ==
"SIS 300/315/330 series Video Overlay") ||
1981 adaptor_name.toLower().contains(
"xvba") ||
1982 adaptor_name.toLower().startsWith(
"intel i965 driver"))
1986 else if (adaptor_name.startsWith(
"NV17"))
1992 LOG(VB_GENERAL, LOG_INFO,
LOC +
1993 QString(
"CalcHueBase(%1): Unknown adaptor, hue may be wrong.")
1994 .arg(adaptor_name));
1995 LOG(VB_GENERAL, LOG_INFO,
LOC +
1996 "Please open a ticket if you need to adjust the hue.");
2013 if (crop <= 0 || crop >= 16)
2016 uint64_t *ybuf = (uint64_t*) (frame->
buf + frame->
offsets[0]);
2017 uint64_t *ubuf = (uint64_t*) (frame->
buf + frame->
offsets[1]);
2018 uint64_t *vbuf = (uint64_t*) (frame->
buf + frame->
offsets[2]);
2019 const uint64_t Y_black = 0x0000000000000000LL;
2020 const uint64_t UV_black = 0x8080808080808080LL;
2025 y = y + (sz - y) * (16 -
crop) / 16;
2033 y = y + (sz - y) * (16 -
crop) / 16;
virtual void ResizeForVideo(uint width=0, uint height=0)
Sets display parameters based on video resolution.
int pitches[3]
Y, U, & V pitches.
void ToggleAspectOverride(AspectOverrideMode aspectOverrideMode=kAspect_Toggle)
Enforce different aspect ration than detected, then calls VideoAspectRatioChanged(float) to apply the...
virtual int SetPictureAttribute(PictureAttribute, int newValue)
Sets a specified picture attribute.
MythPainter * invalid_osd_painter
QString m_deintfiltername
float GetVideoAspect(void) const
unsigned char * pip_tmp_buf2
void SetDisplayAspect(float displayAspect)
A dummy video class that uses VDPAU to decode video frames.
virtual bool CanVisualise(AudioPlayer *audio, MythRender *render)
int GetMaxHeight(void) const
Returns maximum height in pixels supported by display.
virtual void ResizeForGui(void)
If we are using DisplayRes support, return the screen size and refresh rate to those used for the GUI...
QMap< MythPlayer *, PIPLocation > PIPMap
bool UsingXinerama(void) const
void start(QRunnable *runnable, QString debugName, int priority=0)
VERBOSE_PREAMBLE Most true
virtual bool DisplayOSD(VideoFrame *frame, OSD *osd)
If the OSD has changed, this will convert the OSD buffer to the OSDSurface's color format.
QRect GetTotalOSDBounds(void) const
Returns total OSD bounds.
void DestroyVisualisation(void)
QString GetFilters(void) const
double GetAspectRatio(void) const
Returns current screen aspect ratio.
virtual void ToggleAspectOverride(AspectOverrideMode aspectOverrideMode=kAspect_Toggle)
Enforce different aspect ration than detected, then calls VideoAspectRatioChanged(float) to apply the...
LetterBoxColour db_letterbox_colour
static bool isCodecDeinterlacer(QString decodername)
virtual bool IsBobDeint(void) const
virtual QString Name(void)=0
static int crop(VideoFilter *f, VideoFrame *frame, int field)
virtual bool NeedsDoubleFramerate(void) const
Should Prepare() and Show() be called twice for every ProcessFrame().
virtual void DiscardFrames(bool kf)
Releases all frames not being actively displayed from any queue onto the queue of frames ready for de...
virtual void SetVideoFrameRate(float)
static bool CanVisualise(AudioPlayer *audio, MythRender *render)
VideoColourSpace videoColourSpace
VideoOutput()
This constructor for VideoOutput must be followed by an Init(int,int,float,WId,int,...
int DecrRef(void) override
Decrements reference count and deletes on 0.
AdjustFillMode GetAdjustFill(void) const
Returns current adjust fill mode.
static void GetRenderOptions(render_opts &opts, QStringList &cpudeints)
float GetOutput(void) const
QRect GetPIPRect(PIPLocation location, MythPlayer *pipplayer=nullptr, bool do_pixel_adj=true) const
QString GetFilteredDeint(const QString &override)
virtual bool IsExtraProcessingRequired(void) const
Should Prepare() and Show() and ProcessFrame be called twice for every Frameloop().
QRect GetVideoRect(void) const
static VideoVisual * Create(const QString &name, AudioPlayer *audio, MythRender *render)
virtual bool Init(const QSize &video_dim_buf, const QSize &video_dim_disp, float aspect, WId winid, const QRect &win_rect, MythCodecID codec_id)
Performs most of the initialization for VideoOutput.
void c_yuv888_to_yv12(VideoFrame *frame, MythImage *osd_image, int left, int top, int right, int bottom)
virtual float GetDisplayAspect(void) const
Returns current display aspect ratio.
double GetFloatSettingOnHost(const QString &key, const QString &host, double defaultval=0.0)
QRect GetTotalOSDBounds(void) const
Returns total OSD bounds.
VideoFrame * GetCurrentFrame(int &w, int &h)
QString GetFallbackDeinterlacer(void) const
virtual void SaveBottomLine(void)
Save current Manual Zoom settings as BottomLine adjustment.
virtual void SetPIPState(PIPState setting)
static QString to_comma_list(const QStringList &list)
void CropToDisplay(VideoFrame *frame)
QSize db_display_dim
Screen dimensions in millimeters from DB.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
AspectOverrideMode GetAspectOverride(void) const
Returns current aspect override mode.
QRect GetMHEGBounds(void)
virtual void StopEmbedding(void)
Tells video output to stop embedding video in an existing window.
QSize pip_desired_display_size
enum FrameType_ VideoFrameType
QRect GetSafeRect(void)
Returns a QRect describing an area of the screen on which it is 'safe' to render the On Screen Displa...
virtual QString GetOSDRenderer(void) const
\ brief return OSD renderer type for this videoOutput
struct SwsContext * pip_scaling_context
static void Unlock(void)
Release any access restrictions.
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
Generate a list of supported OpenGL profiles.
long long copy(QFile &dst, QFile &src, uint block_size)
Copies src file to dst file.
void SetOutput(float framerate)
VideoDisplayProfile * db_vdisp_profile
void SetPIPState(PIPState setting)
unsigned char * pip_tmp_buf
void SetVideoScalingAllowed(bool change)
Disable or enable underscan/overscan.
void SetVideoDim(QSize dim)
bool AllowPreviewEPG(void) const
float GetDisplayAspect(void) const
Returns current display aspect ratio.
virtual void EmbedInWidget(const QRect &rect)
Tells video output to embed video in an existing window.
virtual void ClearDummyFrame(VideoFrame *frame)
Clears the frame to black.
static QStringList GetDeinterlacers(const QString &video_renderer)
static void init(VideoFrame *vf, VideoFrameType _codec, unsigned char *_buf, int _width, int _height, int _size, const int *p=nullptr, const int *o=nullptr, float _aspect=-1.0f, double _rate=-1.0f, int _aligned=64)
AdjustFillMode db_adjustfill
virtual void ShowPIPs(VideoFrame *frame, const PIPMap &pipPlayers)
int offsets[3]
Y, U, & V offsets.
This class serves as the base class for all video output methods.
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id)
void ExposeEvent(void)
Tells video output that a full repaint is needed.
static int run(MythMediaDevice *dev=nullptr, bool startRandomShow=false)
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
QString GetFilters(void) const
static void CopyFrame(VideoFrame *to, const VideoFrame *from)
Copies frame data from one VideoFrame to another.
bool UsingGuiSize(void) const
int GetWidth(void) const
Returns current screen width in pixels.
static QString GetBestVideoRenderer(const QStringList &renderers)
void GetResolutionSetting(const QString &type, int &width, int &height, double &forced_aspect, double &refreshrate, int index=-1)
static void GetRenderOptions(render_opts &opts)
int AVPictureFill(AVFrame *pic, const VideoFrame *frame, AVPixelFormat fmt)
AVPictureFill Initialise AVFrame pic with content from VideoFrame frame.
bool IsPreviewEPGAllowed(void) const
static void GetRenderOptions(render_opts &opts)
static void show(uint8_t *buf, int length)
static void clear(SettingsMap &cache, SettingsMap &overrides, const QString &myKey)
void Clear(QPaintDevice *device, const QRegion ®ion) override
void ReleaseCurrentFrame(VideoFrame *frame)
void SaveBottomLine(void)
static void GetRenderOptions(render_opts &opts)
QRect GetScreenGeometry(void) const
MythCodecID video_codec_id
QRect GetEmbeddingRect(void) const
bool SwitchToGUI(tmode which_gui=GUI)
Switches to the GUI resolution specified.
static void GetRenderOptions(render_opts &opts)
QRegion Draw(MythPainter *painter, QPaintDevice *device, QSize size, QRegion &changed, int alignx=0, int aligny=0)
virtual void BestDeint(void)
Change to the best deinterlacing method.
virtual void MoveResizeWindow(QRect new_rect)=0
void SetNeedRepaint(bool needRepaint)
bool IsVideoScalingAllowed(void) const
check if video underscan/overscan is allowed
QString GetVisualiserName(void)
int GetHeight(void) const
Returns current screen width in pixels.
void SetVideoScalingAllowed(bool change)
Disable or enable underscan/overscan.
virtual void GetOSDBounds(QRect &total, QRect &visible, float &visibleAspect, float &fontScale, float themeAspect) const
FilterChain * LoadFilters(QString filters, VideoFrameType &inpixfmt, VideoFrameType &outpixfmt, int &width, int &height, int &bufsize, int max_threads=1)
void InitDisplayMeasurements(uint width, uint height, bool resize)
Init display measurements based on database settings and actual screen parameters.
bool IsEmbedding(void) const
Returns if videooutput is embedding.
int ChangePictureAttribute(PictureAttribute, bool direction)
const FilterInfo * GetFilterInfo(const QString &name) const
void yuv888_to_i44(unsigned char *dest, MythImage *osd_image, QSize dst_size, int left, int top, int right, int bottom, bool ifirst)
void DoPipResize(int pipwidth, int pipheight)
Sets up Picture in Picture image resampler.
bool EnableVisualisation(AudioPlayer *audio, bool enable, const QString &name=QString(""))
QRect vsz_desired_display_rect
QRect GetVisibleOSDBounds(float &, float &, float) const
Returns visible portions of total OSD bounds.
QSize GetVideoDispDim(void) const
int GetPhysicalHeight(void) const
Returns current screen height in millimeters.
QRect GetDisplayVideoRect(void) const
int GetPictureAttribute(PictureAttribute)
void SetInput(const QSize &size, float framerate=0, const QString &codecName=QString())
bool IsVideoScalingAllowed(void) const
virtual void ResizeDisplayWindow(const QRect &, bool)
Resize Display Window.
void EmbedInWidget(const QRect &)
Tells video output to embed video in an existing window.
virtual void InitOSD(OSD *osd)
unsigned char * vsz_tmp_buf
void * av_malloc(unsigned int size)
QString GetActualVideoRenderer(void) const
static QString const kName
void GetDeinterlacers(QStringList &deinterlacers)
virtual QStringList GetVisualiserList(void)
int GetPhysicalWidth(void) const
Returns current screen width in millimeters.
static QStringList GetAllowedRenderers(MythCodecID, const QSize &)
static QStringList GetFilteredRenderers(const QString &decoder, const QStringList &renderers)
MythMainWindow * GetMythMainWindow(void)
PIPState GetPIPState(void) const
int myth2av_codecid(MythCodecID codec_id, bool &vdpau)
MythYUVAPainter * osd_painter
Supports common video output methods used with X11 Servers.
AdjustFillMode GetAdjustFill(void) const
Returns current adjust fill mode.
static void GetRenderOptions(render_opts &opts, QStringList &cpudeints)
virtual bool hasFullScreenOSD(void) const
void yuv888_to_yv12(VideoFrame *frame, MythImage *osd_image, int left, int top, int right, int bottom)
static void GetRenderOptions(render_opts &opts, QStringList &cpudeints)
virtual void ToggleAdjustFill(AdjustFillMode adjustFillMode=kAdjustFill_Toggle)
Sets up letterboxing for various standard video frame and monitor dimensions, then calls MoveResize()...
virtual bool InputChanged(const QSize &video_dim_buf, const QSize &video_dim_disp, float aspect, MythCodecID myth_codec_id, void *codec_private, bool &aspect_changed)
Tells video output to discard decoded frames and wait for new ones.
virtual void ShutdownVideoResize(void)
QRect GetImageRect(const QRect &rect, QRect *display=nullptr)
translates caption/dvd button rectangle into 'screen' space
int GetNumSetting(const QString &key, int defaultval=0)
static int CalcHueBase(const QString &adaptor_name)
void ResizeDisplayWindow(const QRect &, bool)
Resize Display Window.
#define LOG(_MASK_, _LEVEL_, _STRING_)
virtual void ShowPIP(VideoFrame *frame, MythPlayer *pipplayer, PIPLocation loc)
Composites PiP image onto a video frame.
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
void DoVideoResize(const QSize &inDim, const QSize &outDim)
Sets up Picture in Picture image resampler.
virtual bool ApproveDeintFilter(const QString &filtername) const
Approves bobdeint filter for XVideo and otherwise defers to VideoOutput::ApproveDeintFilter(const QSt...
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
uint GetMaxCPUs(void) const
bool InputChanged(const QSize &input_size_buf, const QSize &input_size_disp, float aspect, MythCodecID myth_codec_id, void *codec_private)
Tells video output to discard decoded frames and wait for new ones.
static void GetRenderOptions(render_opts &opts, QStringList &cpudeints)
QString GetOSDRenderer(void) const
virtual QRect GetPIPRect(PIPLocation location, MythPlayer *pipplayer=nullptr, bool do_pixel_adj=true) const
returns QRect of PIP based on PIPLocation
virtual void VideoAspectRatioChanged(float aspect)
Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.
virtual void Zoom(ZoomDirection direction)
Sets up zooming into to different parts of the video, the zoom is actually applied in MoveResize().
void ToggleMoveBottomLine(void)
QRect GetVisibleOSDBounds(float &, float &, float) const
Returns visible portions of total OSD bounds.
void ResizeVideo(VideoFrame *frame)
virtual void MoveResize(void)
performs all the calculations for video framing and any resizing.
float GetOverridenVideoAspect(void) const
void VideoAspectRatioChanged(float aspect)
Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.
static void GetRenderOptions(render_opts &opts)
static void GetRenderOptions(render_opts &opts, QStringList &cpudeints)
Generate the list of available OpenGL profiles.
void SetDisplayDim(QSize displayDim)
void MoveResize(void)
performs all the calculations for video framing and any resizing.
float GetVideoAspect(void) const
bool IsEmbedding(void)
Returns if videooutput is embedding.
virtual void Draw(const QRect &area, MythPainter *painter, QPaintDevice *device)=0
bool Init(const QSize &new_video_dim_buf, const QSize &new_video_dim_disp, float aspect, const QRect &new_display_visible_rect, AspectOverrideMode aspectoverride, AdjustFillMode adjustfill)
QRect GetDisplayVisibleRect(void) const
FilterChain * m_deintFilter
void ShutdownPipResize(void)
Shuts down Picture in Picture image resampler.
QString GetVideoRenderer(void) const
QSize GetVideoDim(void) const
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
static VideoOutput * Create(const QString &decoder, MythCodecID codec_id, void *codec_priv, PIPState pipState, const QSize &video_dim_buf, const QSize &video_dim_disp, float video_aspect, QWidget *parentwidget, const QRect &embed_rect, float video_prate, uint playerFlags, QString &codecName)
Depending on compile-time configure settings and run-time renderer settings, create a relevant VideoO...
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id)
static uint buffersize(VideoFrameType type, int width, int height, int _aligned=64)
bool IsOSDFadeEnabled(void) const
bool IsPIPVisible(void) const
void Assign(const QImage &img)
static DisplayInfo GetDisplayInfo(int video_rate=0)
int GetPictureAttribute(PictureAttribute attribute)
bool m_deinterlaceBeforeOSD
FilterManager * m_deintFiltMan
bool SwitchToVideo(int iwidth, int iheight, double frate=0.0)
Switches to the resolution and refresh rate defined in the database for the specified video resolutio...
void ToggleAdjustFill(AdjustFillMode adjustFillMode=kAdjustFill_Toggle)
Sets up letterboxing for various standard video frame and monitor dimensions, then calls MoveResize()...
void SetVideoResize(const QRect &videoRect)
Tells the player to resize the video frame (used for ITV)
virtual void ToggleMoveBottomLine(void)
AspectOverrideMode db_aspectoverride
MythImage * GetFormatImage()
Returns a blank reference counted image in the format required for the Draw functions for this painte...
QString GetHostName(void)
virtual bool SetupDeinterlace(bool interlaced, const QString &overridefilter="")
Attempts to enable or disable deinterlacing.
virtual bool SetupVisualisation(AudioPlayer *audio, MythRender *render, const QString &name)
virtual ~VideoOutput()
Shuts down video output.
void StopEmbedding(void)
Tells video output to stop embedding video in an existing window.
AspectOverrideMode GetAspectOverride(void) const
Returns current aspect override mode.
virtual bool SetDeinterlacingEnabled(bool)
Attempts to enable/disable deinterlacing using existing deinterlace method when enabling.
void SetDisplayVisibleRect(QRect rect)
struct SwsContext * vsz_scale_context
virtual void FallbackDeint(void)
Fallback to non-frame-rate-doubling deinterlacing method.
void Zoom(ZoomDirection direction)
Sets up zooming into to different parts of the video, the zoom is actually applied in MoveResize().
int SetPictureAttribute(PictureAttribute attribute, int value)
bool IsDecoderCompatible(const QString &decoder)
bool IsPIPActive(void) const
virtual void DrawSlice(VideoFrame *frame, int x, int y, int w, int h)
Informs video output of new data for frame, used for hardware accelerated decoding.
int GetMaxWidth(void) const
Returns maximum width in pixels supported by display.
QSize GetDisplayDim(void) const