MythTV  master
mythvideooutgpu.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "mythlogging.h"
3 #include "mythmainwindow.h"
4 #include "mythplayer.h"
5 #include "mythpaintergpu.h"
6 #include "mythvideogpu.h"
7 #include "mythvideooutgpu.h"
8 
9 #ifdef USING_OPENGL
11 #endif
12 #ifdef USING_VULKAN
14 #endif
15 
16 #define LOC QString("VidOutGPU: ")
17 
19  MythCodecID CodecID, const QSize& VideoDim,
20  const QSize& VideoDispDim, float VideoAspect,
21  float FrameRate, uint PlayerFlags,
22  const QString& Codec, int ReferenceFrames)
23 {
24  if (!MainWindow)
25  {
26  LOG(VB_GENERAL, LOG_ERR, LOC + "No main window");
27  return nullptr;
28  }
29 
31  {
32  LOG(VB_GENERAL, LOG_ERR, LOC + "Cannot create null video output here");
33  return nullptr;
34  }
35 
36  MythRender* render = MainWindow->GetRenderDevice();
37  if (!render)
38  {
39  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to retrieve render device");
40  return nullptr;
41  }
42 
43  QStringList renderers;
44 
45 #ifdef _WIN32
46  if (render->Type() == kRenderDirect3D9)
47  renderers += VideoOutputD3D::GetAllowedRenderers(CodecID, VideoDispDim);
48 #endif
49 
50 #ifdef USING_OPENGL
51  if (render->Type() == kRenderOpenGL)
52  renderers += MythVideoOutputOpenGL::GetAllowedRenderers(CodecID, VideoDispDim);
53 #endif
54 
55 #ifdef USING_VULKAN
56  if (render->Type() == kRenderVulkan)
57  renderers += MythVideoOutputVulkan::GetAllowedRenderers(CodecID);
58 #endif
59 
60  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Allowed renderers for %1 %2 (Decoder: %3): '%4'")
61  .arg(get_encoding_type(CodecID)).arg(get_decoder_name(CodecID))
62  .arg(Decoder).arg(renderers.join(",")));
63  renderers = VideoDisplayProfile::GetFilteredRenderers(Decoder, renderers);
64  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Allowed renderers (filt: %1): %2")
65  .arg(Decoder).arg(renderers.join(",")));
66 
67  QString renderer;
68 
69  auto * vprof = new VideoDisplayProfile();
70 
71  if (!renderers.empty())
72  {
73  vprof->SetInput(VideoDispDim, FrameRate, Codec);
74  QString tmp = vprof->GetVideoRenderer();
75  if (vprof->IsDecoderCompatible(Decoder) && renderers.contains(tmp))
76  {
77  renderer = tmp;
78  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Preferred renderer: " + renderer);
79  }
80  else
81  {
82  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("No preferred renderer for decoder '%1' - profile renderer: '%2'")
83  .arg(Decoder).arg(tmp));
84  }
85  }
86 
87  if (renderer.isEmpty())
88  renderer = VideoDisplayProfile::GetBestVideoRenderer(renderers);
89 
90  if (renderer.isEmpty())
91  {
92  QString fallback;
93 #ifdef USING_OPENGL
94  if (render->Type() == kRenderOpenGL)
95  fallback = "opengl";
96 #endif
97 #ifdef USING_VULKAN
98  if (render->Type() == kRenderVulkan)
99  fallback = VULKAN_RENDERER;
100 #endif
101  LOG(VB_GENERAL, LOG_WARNING, LOC + "No renderer found. This should not happen!.");
102  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Falling back to '%1'").arg(fallback));
103  renderer = fallback;
104  }
105 
106  while (!renderers.empty())
107  {
108  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Trying video renderer: '%1'").arg(renderer));
109  int index = renderers.indexOf(renderer);
110  if (index >= 0)
111  renderers.removeAt(index);
112  else
113  break;
114 
115  MythVideoOutputGPU* video = nullptr;
116 
117 #ifdef _WIN32
118  if (renderer == "direct3d")
119  video = new VideoOutputD3D();
120 #endif
121 #ifdef USING_OPENGL
122  if (renderer.contains("opengl"))
123  video = new MythVideoOutputOpenGL(renderer);
124 #endif
125 #ifdef USING_VULKAN
126  if (renderer.contains(VULKAN_RENDERER))
127  video = new MythVideoOutputVulkan(renderer);
128 #endif
129 
130  if (video)
131  {
132  video->m_dbDisplayProfile = vprof;
133  video->SetVideoFrameRate(FrameRate);
134  video->SetReferenceFrames(ReferenceFrames);
135  if (video->Init(VideoDim, VideoDispDim, VideoAspect, MainWindow->GetUIScreenRect(), CodecID))
136  {
137  video->SetVideoScalingAllowed(true);
138  return video;
139  }
140 
141  video->m_dbDisplayProfile = nullptr;
142  delete video;
143  video = nullptr;
144  }
145  renderer = VideoDisplayProfile::GetBestVideoRenderer(renderers);
146  }
147 
148  LOG(VB_GENERAL, LOG_ERR, LOC + "Not compiled with any useable video output method.");
149  delete vprof;
150  return nullptr;
151 }
152 
166  : m_render(Render),
167  m_profile(std::move(Profile))
168 {
169  if (m_render)
170  m_render->IncrRef();
171 
173  if (win)
174  {
175  SetDisplay(win->GetDisplay());
176  m_painter = dynamic_cast<MythPainterGPU*>(win->GetPainter());
177  if (m_painter)
179  }
180 
181  if (!(win && m_render && m_painter))
182  LOG(VB_GENERAL, LOG_ERR, LOC + "Fatal error");
183 
188 }
189 
191 {
193  delete m_video;
194  if (m_painter)
196  if (m_render)
197  m_render->DecrRef();
198 }
199 
201 {
202  return GetDisplayVisibleRect();
203 }
204 
206 {
208 }
209 
210 void MythVideoOutputGPU::WindowResized(const QSize& Size)
211 {
212  SetWindowSize(Size);
214 }
215 
217 {
218  if (!m_dbDisplayProfile)
219  return;
220 
221  if (qFuzzyCompare(m_dbDisplayProfile->GetOutput() + 1.0F, NewRate + 1.0F))
222  return;
223 
224  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Video frame rate changed: %1->%2")
225  .arg(static_cast<double>(m_dbDisplayProfile->GetOutput())).arg(static_cast<double>(NewRate)));
226  m_dbDisplayProfile->SetOutput(NewRate);
227  m_newFrameRate = true;
228 }
229 
230 bool MythVideoOutputGPU::Init(const QSize& VideoDim, const QSize& VideoDispDim,
231  float Aspect, const QRect& DisplayVisibleRect, MythCodecID CodecId)
232 {
233  // if we are the main video player then free up as much video memory
234  // as possible at startup
235  if ((kCodec_NONE == m_newCodecId) && m_painter)
237 
238  // Default initialisation - mainly MythVideoBounds
239  if (!MythVideoOutput::Init(VideoDim, VideoDispDim, Aspect, DisplayVisibleRect, CodecId))
240  return false;
241 
242  // Ensure any new profile preferences are handled after a stream change
243  if (m_dbDisplayProfile)
245 
246  // Set default support for picture attributes
248 
249  // Setup display
250  QSize size = GetVideoDim();
251 
252  // Set the display mode if required
254  ResizeForVideo(size);
256 
257  // Create buffers
258  if (!CreateBuffers(CodecId, GetVideoDim()))
259  return false;
260 
261  // Adjust visible rect for embedding
262  QRect dvr = GetDisplayVisibleRectAdj();
264  {
265  m_render->SetViewPort(QRect(QPoint(), dvr.size()));
266  return true;
267  }
268 
269  // Reset OpenGLVideo
270  if (m_video->IsValid())
272 
273  return true;
274 }
275 
282 void MythVideoOutputGPU::DiscardFrames(bool KeyFrame, bool Flushed)
283 {
284  if (Flushed)
285  {
286  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("(%1): %2").arg(KeyFrame).arg(m_videoBuffers.GetStatus()));
288  }
289  MythVideoOutput::DiscardFrames(KeyFrame, Flushed);
290 }
291 
304 {
305  if (!Frame)
306  return;
307 
308  bool retain = MythVideoFrame::HardwareFormat(Frame->m_type);
309  QVector<MythVideoFrame*> release;
310 
313  {
315  if (!retain || (frame != Frame))
316  release.append(frame);
317  }
318 
319  if (retain)
320  {
324  }
325  else
326  {
327  release.append(Frame);
328  }
330 
331  for (auto * frame : release)
333 }
334 
336 {
337  if (m_buffersCreated)
338  return true;
339 
340  if (codec_is_copyback(CodecID))
341  {
343  return m_videoBuffers.CreateBuffers(FMT_YV12, Size.width(), Size.height());
344  }
345 
346  if (codec_is_mediacodec(CodecID))
347  return m_videoBuffers.CreateBuffers(FMT_MEDIACODEC, Size, 1, 2, 2);
348  if (codec_is_vaapi(CodecID))
350  if (codec_is_vtb(CodecID))
351  return m_videoBuffers.CreateBuffers(FMT_VTB, Size, 1, 4, 2);
352  if (codec_is_vdpau(CodecID))
354  if (codec_is_nvdec(CodecID))
355  return m_videoBuffers.CreateBuffers(FMT_NVDEC, Size, 2, 1, 4);
356  if (codec_is_mmal(CodecID))
357  return m_videoBuffers.CreateBuffers(FMT_MMAL, Size, 2, 1, 4);
358  if (codec_is_v4l2(CodecID) || codec_is_drmprime(CodecID))
359  return m_videoBuffers.CreateBuffers(FMT_DRMPRIME, Size, 2, 1, 4);
360 
362 }
363 
365 {
368  m_buffersCreated = false;
369 }
370 
371 void MythVideoOutputGPU::SetReferenceFrames(int ReferenceFrames)
372 {
373  m_maxReferenceFrames = ReferenceFrames;
374 }
375 
376 bool MythVideoOutputGPU::InputChanged(const QSize& VideoDim, const QSize& VideoDispDim,
377  float Aspect, MythCodecID CodecId, bool& AspectOnly, int ReferenceFrames,
378  bool ForceChange)
379 {
380  QSize currentvideodim = GetVideoDim();
381  QSize currentvideodispdim = GetVideoDispDim();
382  MythCodecID currentcodec = m_videoCodecID;
383  float currentaspect = GetVideoAspect();
384 
385  if (m_newCodecId != kCodec_NONE)
386  {
387  // InputChanged has been called twice in quick succession without a call to ProcessFrame
388  currentvideodim = m_newVideoDim;
389  currentvideodispdim = m_newVideoDispDim;
390  currentcodec = m_newCodecId;
391  currentaspect = m_newAspect;
392  }
393 
394  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Video changed: %1x%2 (%3x%4) '%5' (Aspect %6 Refs %13)"
395  "-> %7x%8 (%9x%10) '%11' (Aspect %12 Refs %14)")
396  .arg(currentvideodispdim.width()).arg(currentvideodispdim.height())
397  .arg(currentvideodim.width()).arg(currentvideodim.height())
398  .arg(toString(currentcodec)).arg(static_cast<double>(currentaspect))
399  .arg(VideoDispDim.width()).arg(VideoDispDim.height())
400  .arg(VideoDim.width()).arg(VideoDim.height())
401  .arg(toString(CodecId)).arg(static_cast<double>(Aspect))
402  .arg(m_maxReferenceFrames).arg(ReferenceFrames));
403 
404  bool cidchanged = (CodecId != currentcodec);
405  bool reschanged = (VideoDispDim != currentvideodispdim);
406  bool refschanged = m_maxReferenceFrames != ReferenceFrames;
407 
408  // aspect ratio changes are a no-op as changes are handled at display time
409  if (!(cidchanged || reschanged || refschanged || ForceChange))
410  {
411  AspectOnly = true;
412  return true;
413  }
414 
415  // N.B. We no longer check for interop support for the new codec as it is a
416  // poor substitute for a full check of decoder capabilities etc. Better to let
417  // hardware decoding fail if necessary - which should at least fallback to
418  // software decoding rather than bailing out here.
419 
420  // delete and recreate the buffers and flag that the input has changed
421  m_maxReferenceFrames = ReferenceFrames;
423  if (!m_buffersCreated)
424  return false;
425 
426  m_newCodecId= CodecId;
427  m_newVideoDim = VideoDim;
428  m_newVideoDispDim = VideoDispDim;
429  m_newAspect = Aspect;
430  return true;
431 }
432 
434 {
435  if (m_newCodecId != kCodec_NONE)
436  {
437  // Ensure we don't lose embedding through program changes.
438  bool wasembedding = IsEmbedding();
439  QRect oldrect;
440  if (wasembedding)
441  {
442  oldrect = GetEmbeddingRect();
443  EmbedPlayback(false, {});
444  }
445 
446  // Note - we don't call the default VideoOutput::InputChanged method as
447  // the OpenGL implementation is asynchronous.
448  // So we need to update the video display profile here. It is a little
449  // circular as we need to set the video dimensions first which are then
450  // reset in Init.
451  // All told needs a cleanup - not least because the use of codecName appears
452  // to be inconsistent.
454  AVCodecID avCodecId = myth2av_codecid(m_newCodecId);
455  AVCodec* codec = avcodec_find_decoder(avCodecId);
456  QString codecName;
457  if (codec)
458  codecName = codec->name;
459  if (m_dbDisplayProfile)
460  m_dbDisplayProfile->SetInput(GetVideoDispDim(), 0 , codecName);
463  m_newVideoDim = QSize();
464  m_newVideoDispDim = QSize();
465  m_newAspect = 0.0F;
466  m_newFrameRate = false;
467 
468  if (wasembedding && ok)
469  EmbedPlayback(true, oldrect);
470 
471  // Update deinterlacers for any input change
473 
474  if (!ok)
475  return false;
476  }
477  else if (m_newFrameRate)
478  {
479  // If we are switching mode purely for a refresh rate change, then there
480  // is no need to recreate buffers etc etc
481  ResizeForVideo();
482  m_newFrameRate = false;
483  }
484 
485  return true;
486 }
487 
494 {
495  if (!m_display)
496  return;
497 
498  // Retrieve the display aspect ratio.
499  // This will be, in priority order:-
500  // - aspect ratio override when using resolution/mode switching (if not 'Default')
501  // - aspect ratio override for setups where detection does not work/is broken (multiscreen, broken EDID etc)
502  // - aspect ratio based on detected physical size (this should be the common/default value)
503  // - aspect ratio fallback using screen resolution
504  // - 16:9
505  QString source;
506  double displayaspect = m_display->GetAspectRatio(source);
507  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Display aspect ratio: %1 (%2)")
508  .arg(displayaspect).arg(source));
509 
510  // Get the window and screen resolutions
511  QSize window = GetRawWindowRect().size();
512  QSize screen = m_display->GetResolution();
513 
514  // If not running fullscreen, adjust for window size and ignore any video
515  // mode overrides as they do not apply when in a window
516  if (!window.isEmpty() && !screen.isEmpty() && window != screen)
517  {
518  displayaspect = m_display->GetAspectRatio(source, true);
519  double screenaspect = screen.width() / static_cast<double>(screen.height());
520  double windowaspect = window.width() / static_cast<double>(window.height());
521  displayaspect = displayaspect * (1.0 / screenaspect) * windowaspect;
522  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Window aspect ratio: %1").arg(displayaspect));
523  }
524 
525  SetDisplayAspect(static_cast<float>(displayaspect));
526 }
527 
529 {
530  // Process input changes
531  if (!ProcessInputChange())
532  return;
533 
534  if (Frame)
535  {
536  SetRotation(Frame->m_rotation);
537  if (MythVideoFrame::HardwareFormat(Frame->m_type) || Frame->m_dummy)
538  return;
539 
540  // software deinterlacing
542 
543  // update software textures
544  if (m_video)
545  m_video->PrepareFrame(Frame, Scan);
546  }
547 }
548 
550 {
551  bool dummy = false;
552  bool topfieldfirst = false;
553  if (Frame)
554  {
555  m_framesPlayed = Frame->m_frameNumber + 1;
556  topfieldfirst = Frame->m_interlacedReverse ? !Frame->m_topFieldFirst : Frame->m_topFieldFirst;
557  dummy = Frame->m_dummy;
558  }
559  else
560  {
561  // see DoneDisplayingFrame
562  // we only retain pause frames for hardware formats
565  }
566 
567  // Main UI when embedded
568  if (m_painter && IsEmbedding())
569  {
570  // If we are using high dpi, the painter needs to set the appropriate
571  // viewport and enable scaling of its images
573 
575  if (win && win->GetPaintWindow())
576  {
577  win->GetPaintWindow()->clearMask();
578  win->Draw(m_painter);
579  }
581  }
582 
583  // Video
584  // N.B. dummy streams need the viewport updated in case we have resized the window (i.e. LiveTV)
585  if (m_video && !dummy)
586  m_video->RenderFrame(Frame, topfieldfirst, Scan, GetStereoOverride());
587  else if (dummy)
589 }
590 
592 {
593  if (!IsEmbedding())
595 }
596 
597 void MythVideoOutputGPU::UpdatePauseFrame(int64_t& DisplayTimecode, FrameScanType Scan)
598 {
599  MythVideoFrame* release = nullptr;
602  if (used)
603  {
605  {
607  }
608  else
609  {
611  m_deinterlacer.Filter(used, Scan, m_dbDisplayProfile, true);
612  if (m_video)
613  m_video->PrepareFrame(used, Scan);
614  }
615  DisplayTimecode = used->m_displayTimecode;
616  }
617  else
618  {
619  LOG(VB_PLAYBACK, LOG_WARNING, LOC + "Could not update pause frame");
620  }
622 
623  if (release)
624  DoneDisplayingFrame(release);
625 }
626 
628 {
629  m_video->EndFrame();
630 }
631 
633 {
634  // Clear reference frames for GPU deinterlacing
635  if (m_video)
637  // Clear decoded frames
639 }
640 
653 {
654  if (!m_display)
655  return;
656  if (!m_display->UsingVideoModes())
657  return;
658 
659  if (Size.isEmpty())
660  {
661  Size = GetVideoDispDim();
662  if (Size.isEmpty())
663  return;
664  }
665 
666  float rate = m_dbDisplayProfile ? m_dbDisplayProfile->GetOutput() : 0.0F;
667 
668  bool hide = m_display->NextModeIsLarger(Size);
669  MythMainWindow* window = GetMythMainWindow();
670  if (hide)
671  window->hide();
672 
673  if (m_display->SwitchToVideo(Size, static_cast<double>(rate)))
674  {
675  // Switching to custom display resolution succeeded
676  // Make a note of the new size
677  QString source;
678  double aspect = m_display->GetAspectRatio(source);
679  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Aspect ratio: %1 (%2)")
680  .arg(aspect).arg(source));
681  SetDisplayAspect(static_cast<float>(aspect));
683 
684  bool fullscreen = !UsingGuiSize();
685 
686  // if width && height are zero users expect fullscreen playback
687  if (!fullscreen)
688  {
689  int gui_width = 0;
690  int gui_height = 0;
691  gCoreContext->GetResolutionSetting("Gui", gui_width, gui_height);
692  fullscreen |= (0 == gui_width && 0 == gui_height);
693  }
694 
695  if (fullscreen)
696  {
697  QSize sz = m_display->GetResolution();
698  QRect display_visible_rect = QRect(GetMythMainWindow()->geometry().topLeft(), sz);
699  if (HasMythMainWindow())
700  {
701  if (hide)
702  {
703  window->Show();
704  hide = false;
705  }
706  GetMythMainWindow()->MoveResize(display_visible_rect);
707  }
708  }
709  }
710  if (hide)
711  window->Show();
712 }
FMT_MEDIACODEC
@ FMT_MEDIACODEC
Definition: mythframe.h:56
codec_is_copyback
#define codec_is_copyback(id)
Definition: mythcodecid.h:344
MythVideoOutputGPU::InitPictureAttributes
void InitPictureAttributes() override
Definition: mythvideooutgpu.cpp:205
MythVideoColourSpace::PictureAttributeChanged
void PictureAttributeChanged(PictureAttribute Attribute, int Value)
MythVideoBounds::IsEmbedding
bool IsEmbedding(void) const
Definition: mythvideobounds.h:68
MythVideoOutputGPU::DiscardFrames
void DiscardFrames(bool KeyFrame, bool Flushed) override
Discard video frames.
Definition: mythvideooutgpu.cpp:282
MythVideoOutputGPU::SetVideoFrameRate
void SetVideoFrameRate(float NewRate) override
Definition: mythvideooutgpu.cpp:216
MythVideoGPU::RenderFrame
virtual void RenderFrame(MythVideoFrame *Frame, bool TopFieldFirst, FrameScanType Scan, StereoscopicMode StereoOverride, bool DrawBorder=false)=0
VideoDisplayProfile::SetInput
void SetInput(const QSize &Size, float Framerate=0, const QString &CodecName=QString(), const QStringList &DisallowedDecoders=QStringList())
Definition: videodisplayprofile.cpp:359
VideoBuffers::Head
MythVideoFrame * Head(BufferType Type)
Definition: videobuffers.cpp:647
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
VideoBuffers::Tail
MythVideoFrame * Tail(BufferType Type)
Definition: videobuffers.cpp:658
MythUIScreenBounds::GetUIScreenRect
QRect GetUIScreenRect()
Definition: mythuiscreenbounds.cpp:192
MythVideoOutputGPU::InitDisplayMeasurements
void InitDisplayMeasurements()
Initialise display measurement.
Definition: mythvideooutgpu.cpp:493
FMT_VTB
@ FMT_VTB
Definition: mythframe.h:57
VideoDisplayProfile::GetOutput
float GetOutput(void) const
Definition: videodisplayprofile.cpp:394
MythVideoOutputGPU::DestroyBuffers
void DestroyBuffers()
Definition: mythvideooutgpu.cpp:364
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
FMT_DRMPRIME
@ FMT_DRMPRIME
Definition: mythframe.h:59
mythpaintergpu.h
VideoBuffers::Remove
void Remove(BufferType Type, MythVideoFrame *Frame)
Definition: videobuffers.cpp:684
MythVideoOutput::m_framesPlayed
long long m_framesPlayed
Definition: mythvideoout.h:101
VULKAN_RENDERER
#define VULKAN_RENDERER
Definition: mythvideooutputvulkan.h:11
MythVideoBounds::GetDisplayVisibleRect
QRect GetDisplayVisibleRect(void) const
Definition: mythvideobounds.h:73
MythVideoOutputOpenGL::GetAllowedRenderers
static QStringList GetAllowedRenderers(MythCodecID CodecId, const QSize &VideoDim)
Generate a list of supported OpenGL profiles.
Definition: mythvideooutopengl.cpp:368
MythVideoGPU::IsValid
bool IsValid() const
Definition: mythvideogpu.cpp:55
Frame
Definition: zmdefines.h:94
VideoDisplayProfile::SetOutput
void SetOutput(float Framerate)
Definition: videodisplayprofile.cpp:384
MythVideoOutputGPU::m_render
MythRender * m_render
Definition: mythvideooutgpu.h:57
codec_is_nvdec
#define codec_is_nvdec(id)
Definition: mythcodecid.h:328
arg
arg(title).arg(filename).arg(doDelete))
VideoBuffers::DiscardAndRecreate
bool DiscardAndRecreate(MythCodecID CodecID, QSize VideoDim, int References)
Discard all buffers and recreate.
Definition: videobuffers.cpp:482
FrameScanType
FrameScanType
Definition: videoouttypes.h:61
MythVideoOutput::m_forcedDeinterlacer
MythDeintType m_forcedDeinterlacer
Definition: mythvideoout.h:107
kRenderOpenGL
@ kRenderOpenGL
Definition: mythrender_base.h:19
codec_is_vdpau
#define codec_is_vdpau(id)
Definition: mythcodecid.h:298
VideoBuffers::Dequeue
MythVideoFrame * Dequeue(BufferType Type)
Definition: videobuffers.cpp:638
MythDisplay::GetAspectRatio
double GetAspectRatio(QString &Source, bool IgnoreModeOverride=false)
Returns current screen aspect ratio.
Definition: mythdisplay.cpp:773
codec_is_mmal
#define codec_is_mmal(id)
Definition: mythcodecid.h:341
MythVideoColourSpace::SetSupportedAttributes
void SetSupportedAttributes(PictureAttributeSupported Supported)
Enable the given set of picture attributes.
Definition: mythvideocolourspace.cpp:122
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythVideoFrame::HardwareFormat
static bool HardwareFormat(VideoFrameType Type)
Definition: mythframe.h:408
mythplayer.h
MythVideoOutputGPU::ClearAfterSeek
void ClearAfterSeek() override
Tells video output to toss decoded buffers due to a seek.
Definition: mythvideooutgpu.cpp:632
PlayerFlags
PlayerFlags
Definition: mythplayer.h:79
MythVideoBounds::UsingGuiSize
bool UsingGuiSize(void) const
Definition: mythvideobounds.h:79
MythMainWindow::Draw
void Draw(MythPainter *Painter=nullptr)
Definition: mythmainwindow.cpp:446
MythMainWindow::GetRenderDevice
MythRender * GetRenderDevice()
Definition: mythmainwindow.cpp:295
MythMainWindow::GetPainter
MythPainter * GetPainter()
Definition: mythmainwindow.cpp:261
MythVideoOutputGPU::WindowResized
void WindowResized(const QSize &Size)
Definition: mythvideooutgpu.cpp:210
HasMythMainWindow
bool HasMythMainWindow(void)
Definition: mythmainwindow.cpp:110
video
QDomElement video
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:661
MythVideoOutputGPU::Init
bool Init(const QSize &VideoDim, const QSize &VideoDispDim, float Aspect, const QRect &DisplayVisibleRect, MythCodecID CodecId) override
Definition: mythvideooutgpu.cpp:230
mythvideooutputvulkan.h
tmp
static guint32 * tmp
Definition: goom_core.cpp:31
MythVideoOutputGPU::m_newVideoDispDim
QSize m_newVideoDispDim
Definition: mythvideooutgpu.h:62
FMT_NONE
@ FMT_NONE
Definition: mythframe.h:17
kRenderVulkan
@ kRenderVulkan
Definition: mythrender_base.h:20
OSD::Draw
void Draw(const QRect &Rect)
Definition: osd.cpp:442
MythVideoOutputGPU::DoneDisplayingFrame
void DoneDisplayingFrame(MythVideoFrame *Frame) override
Release a video frame back into the decoder pool.
Definition: mythvideooutgpu.cpp:303
MythMainWindow::getMainWindow
static MythMainWindow * getMainWindow(bool useDB=true)
Return the existing main window, or create one.
Definition: mythmainwindow.cpp:81
MythMainWindow::GetDisplay
MythDisplay * GetDisplay()
Definition: mythmainwindow.cpp:256
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
MythVideoBounds::SetDisplayAspect
void SetDisplayAspect(float DisplayAspect)
Definition: mythvideobounds.cpp:605
MythVideoGPU::ResetTextures
virtual void ResetTextures()=0
toString
QString toString(MarkTypes type)
Definition: programtypes.cpp:26
MythVideoGPU::PrepareFrame
virtual void PrepareFrame(MythVideoFrame *Frame, FrameScanType Scan=kScan_Progressive)=0
Decoder
Definition: decoder.h:66
MythDisplay::GetResolution
QSize GetResolution()
Definition: mythdisplay.cpp:948
mythlogging.h
codec_is_mediacodec
#define codec_is_mediacodec(id)
Definition: mythcodecid.h:323
MythVideoBounds::SetDisplay
void SetDisplay(MythDisplay *mDisplay)
Definition: mythvideobounds.cpp:72
kScan_Progressive
@ kScan_Progressive
Definition: videoouttypes.h:66
VideoBuffers::Contains
bool Contains(BufferType Type, MythVideoFrame *Frame) const
Definition: videobuffers.cpp:762
VideoDisplayProfile::GetFilteredRenderers
static QStringList GetFilteredRenderers(const QString &Decoder, const QStringList &Renderers)
Definition: videodisplayprofile.cpp:1329
MythVideoOutputGPU::RenderOverlays
void RenderOverlays(OSD &Osd) override
Definition: mythvideooutgpu.cpp:591
MythVideoOutput::m_dbDisplayProfile
VideoDisplayProfile * m_dbDisplayProfile
Definition: mythvideoout.h:98
MythVideoOutput::ClearAfterSeek
virtual void ClearAfterSeek()
Tells video output to toss decoded buffers due to a seek.
Definition: mythvideoout.cpp:307
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:19
MythDeinterlacer::Filter
void Filter(MythVideoFrame *Frame, FrameScanType Scan, VideoDisplayProfile *Profile, bool Force=false)
Deinterlace Frame if needed.
Definition: mythdeinterlacer.cpp:69
MythVideoFrame::m_alreadyDeinterlaced
bool m_alreadyDeinterlaced
Definition: mythframe.h:144
MythVideoFrame::m_displayTimecode
int64_t m_displayTimecode
Definition: mythframe.h:123
MythVideoOutputGPU::PictureAttributeChanged
void PictureAttributeChanged(PictureAttribute Attribute, int Value)
MythVideoOutputGPU::m_newCodecId
MythCodecID m_newCodecId
Definition: mythvideooutgpu.h:60
MythVideoOutputGPU::m_newFrameRate
bool m_newFrameRate
Definition: mythvideooutgpu.h:64
mythvideooutgpu.h
MythPainterGPU::Viewport
@ Viewport
Definition: mythpaintergpu.h:19
FrameRate
Definition: recorderbase.h:37
MythVideoOutputGPU::UpdatePauseFrame
void UpdatePauseFrame(int64_t &DisplayTimecode, FrameScanType Scan=kScan_Progressive) override
Definition: mythvideooutgpu.cpp:597
MythCoreContext::GetResolutionSetting
void GetResolutionSetting(const QString &type, int &width, int &height, double &forced_aspect, double &refresh_rate, int index=-1)
Definition: mythcorecontext.cpp:866
MythDisplay::SwitchToVideo
bool SwitchToVideo(QSize Size, double Rate=0.0)
Switches to the resolution and refresh rate defined in the database for the specified video resolutio...
Definition: mythdisplay.cpp:624
LOC
#define LOC
Definition: mythvideooutgpu.cpp:16
get_encoding_type
QString get_encoding_type(MythCodecID codecid)
Definition: mythcodecid.cpp:475
MythMainWindow::GetPaintWindow
QWidget * GetPaintWindow()
Definition: mythmainwindow.cpp:271
MythVideoBounds::GetEmbeddingRect
QRect GetEmbeddingRect(void) const
Definition: mythvideobounds.h:78
VideoBuffers::Reset
void Reset(void)
Resets the class so that Init may be called again.
Definition: videobuffers.cpp:264
MythVideoOutputGPU::m_buffersCreated
bool m_buffersCreated
Definition: mythvideooutgpu.h:65
MythVideoOutput::DiscardFrames
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...
Definition: mythvideoout.cpp:471
MythRender::SetViewPort
virtual void SetViewPort(const QRect &, bool=false)
Definition: mythrender_base.h:36
MythVideoOutput::m_videoCodecID
MythCodecID m_videoCodecID
Definition: mythvideoout.h:96
MythVideoOutputGPU::m_newVideoDim
QSize m_newVideoDim
Definition: mythvideooutgpu.h:61
MythVideoBounds::SetRotation
void SetRotation(int Rotation)
Set the rotation in degrees.
Definition: mythvideobounds.cpp:658
MythVideoOutputOpenGL
Definition: mythvideooutopengl.h:13
uint
unsigned int uint
Definition: compat.h:140
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:56
MythVideoOutputGPU::m_newAspect
float m_newAspect
Definition: mythvideooutgpu.h:63
MythPainter::FreeResources
virtual void FreeResources(void)
Definition: mythpainter.h:51
MythVideoOutputGPU::SetReferenceFrames
void SetReferenceFrames(int ReferenceFrames)
Definition: mythvideooutgpu.cpp:371
MythVideoBounds::GetVideoDispDim
QSize GetVideoDispDim(void) const
Definition: mythvideobounds.h:71
MythVideoGPU::EndFrame
virtual void EndFrame()=0
VideoBuffers::BeginLock
frame_queue_t::iterator BeginLock(BufferType Type)
Lock the video buffers.
Definition: videobuffers.cpp:732
MythVideoOutputVulkan::GetAllowedRenderers
static QStringList GetAllowedRenderers(MythCodecID CodecId)
Definition: mythvideooutputvulkan.cpp:37
MythVideoOutputGPU::PrepareFrame
void PrepareFrame(MythVideoFrame *Frame, FrameScanType Scan) override
Definition: mythvideooutgpu.cpp:528
mythvideogpu.h
MythVideoOutput::m_deinterlacer
MythDeinterlacer m_deinterlacer
Definition: mythvideoout.h:103
MythVideoBounds::EmbedPlayback
virtual void EmbedPlayback(bool Embed, const QRect &Rect)
Definition: mythvideobounds.cpp:681
ALL_PICTURE_ATTRIBUTES
#define ALL_PICTURE_ATTRIBUTES
Definition: videoouttypes.h:93
MythVideoOutputGPU::ProcessInputChange
bool ProcessInputChange()
Definition: mythvideooutgpu.cpp:433
VideoDisplayProfile
Definition: videodisplayprofile.h:69
FMT_NVDEC
@ FMT_NVDEC
Definition: mythframe.h:58
codec_is_drmprime
#define codec_is_drmprime(id)
Definition: mythcodecid.h:296
MythVideoOutputGPU::MythVideoOutputGPU
MythVideoOutputGPU(MythRender *Render, QString &Profile)
Definition: mythvideooutgpu.cpp:165
VideoBuffers::EndLock
void EndLock()
Definition: videobuffers.cpp:741
MythPainterGPU::SetViewControl
void SetViewControl(ViewControls Control)
Definition: mythpaintergpu.cpp:18
VideoBuffers::DiscardPauseFrames
void DiscardPauseFrames(void)
Definition: videobuffers.cpp:460
kVideoBuffer_pause
@ kVideoBuffer_pause
Definition: videobuffers.h:31
MythMainWindow::Show
void Show(void)
Definition: mythmainwindow.cpp:984
MythVideoOutput::Init
virtual bool Init(const QSize &VideoDim, const QSize &VideoDispDim, float VideoAspect, const QRect &WindowRect, MythCodecID CodecID)
Definition: mythvideoout.cpp:142
MythVideoOutputGPU::ChangePictureAttribute
void ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value)
kVideoIsNull
@ kVideoIsNull
Definition: mythplayer.h:87
myth2av_codecid
AVCodecID myth2av_codecid(MythCodecID codec_id)
Definition: mythcodecid.cpp:228
MythDisplay::NextModeIsLarger
bool NextModeIsLarger(QSize Size)
Check whether the next mode is larger in size than the current mode.
Definition: mythdisplay.cpp:604
MythVideoOutputGPU::InputChanged
bool InputChanged(const QSize &VideoDim, const QSize &VideoDispDim, float Aspect, MythCodecID CodecId, bool &AspectOnly, int ReferenceFrames, bool ForceChange) override
Tells video output to discard decoded frames and wait for new ones.
Definition: mythvideooutgpu.cpp:376
MythPainterGPU::Framebuffer
@ Framebuffer
Definition: mythpaintergpu.h:20
VideoDisplayProfile::GetVideoRenderer
QString GetVideoRenderer(void) const
Definition: videodisplayprofile.cpp:424
VideoBuffers::Enqueue
void Enqueue(BufferType Type, MythVideoFrame *Frame)
Definition: videobuffers.cpp:669
MythVideoColourSpace::ChangePictureAttribute
int ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value)
Definition: mythvideocolourspace.cpp:274
FMT_VDPAU
@ FMT_VDPAU
Definition: mythframe.h:52
kScan_Interlaced
@ kScan_Interlaced
Definition: videoouttypes.h:64
kVideoBuffer_used
@ kVideoBuffer_used
Definition: videobuffers.h:30
MythRender
Definition: mythrender_base.h:24
MythVideoFrame::m_type
VideoFrameType m_type
Definition: mythframe.h:110
codec_is_vaapi
#define codec_is_vaapi(id)
Definition: mythcodecid.h:311
MythVideoOutputGPU::RenderFrame
void RenderFrame(MythVideoFrame *Frame, FrameScanType Scan) override
Definition: mythvideooutgpu.cpp:549
MythVideoOutputVulkan
Definition: mythvideooutputvulkan.h:14
MythVideoOutputGPU::CreateBuffers
bool CreateBuffers(MythCodecID CodecID, QSize Size)
Definition: mythvideooutgpu.cpp:335
get_decoder_name
QString get_decoder_name(MythCodecID codec_id)
Definition: mythcodecid.cpp:714
VideoBuffers::DoneDisplayingFrame
void DoneDisplayingFrame(MythVideoFrame *Frame)
Removes frame from used queue and adds it to the available list.
Definition: videobuffers.cpp:417
MythVideoGPU::SetProfile
void SetProfile(const QString &Profile)
Definition: mythvideogpu.cpp:60
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:105
codec_is_v4l2
#define codec_is_v4l2(id)
Definition: mythcodecid.h:338
mythvideooutopengl.h
MythVideoOutputGPU
Common code shared between GPU accelerated sub-classes (e.g. OpenGL)
Definition: mythvideooutgpu.h:12
MythVideoOutputGPU::ResizeForVideo
void ResizeForVideo(QSize Size=QSize()) override
Definition: mythvideooutgpu.cpp:652
MythRender::Type
RenderType Type(void) const
Definition: mythrender_base.h:32
FMT_MMAL
@ FMT_MMAL
Definition: mythframe.h:55
MythVideoGPU::ResetFrameFormat
virtual void ResetFrameFormat()
Definition: mythvideogpu.cpp:80
MythVideoOutputGPU::Create
static MythVideoOutputGPU * Create(MythMainWindow *MainWindow, const QString &Decoder, MythCodecID CodecID, const QSize &VideoDim, const QSize &VideoDispDim, float VideoAspect, float FrameRate, uint PlayerFlags, const QString &Codec, int ReferenceFrames)
Definition: mythvideooutgpu.cpp:18
FMT_VAAPI
@ FMT_VAAPI
Definition: mythframe.h:53
codec_is_vtb
#define codec_is_vtb(id)
Definition: mythcodecid.h:333
MythVideoOutputGPU::m_video
MythVideoGPU * m_video
Definition: mythvideooutgpu.h:58
MythVideoOutputGPU::GetDisplayVisibleRectAdj
virtual QRect GetDisplayVisibleRectAdj()
Definition: mythvideooutgpu.cpp:200
MythVideoOutputGPU::m_painter
MythPainterGPU * m_painter
Definition: mythvideooutgpu.h:59
MythMainWindow::MoveResize
void MoveResize(QRect &Geometry)
Definition: mythmainwindow.cpp:995
MythVideoBounds::GetWindowRect
QRect GetWindowRect(void) const
Definition: mythvideobounds.h:74
MythVideoBounds::SourceChanged
void SourceChanged(const QSize &VideoDim, const QSize &VideoDispDim, float Aspect)
Update for new source video dimensions and aspect ratio.
Definition: mythvideobounds.cpp:521
MythDisplay::UsingVideoModes
virtual bool UsingVideoModes()
Definition: mythdisplay.h:26
MythVideoOutput::SetDeinterlacing
virtual void SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force=DEINT_NONE)
Definition: mythvideoout.cpp:173
MythVideoFrame
Definition: mythframe.h:83
VideoOutputD3D
Definition: videoout_d3d.h:16
MythVideoBounds::GetRawWindowRect
QRect GetRawWindowRect(void) const
Definition: mythvideobounds.h:75
MythVideoOutputGPU::~MythVideoOutputGPU
~MythVideoOutputGPU() override
Definition: mythvideooutgpu.cpp:190
MythVideoOutput::m_maxReferenceFrames
int m_maxReferenceFrames
Definition: mythvideoout.h:97
ReferenceCounter::IncrRef
virtual int IncrRef(void)
Increments reference count.
Definition: referencecounter.cpp:101
VideoBuffers::CreateBuffers
bool CreateBuffers(VideoFrameType Type, QSize Size, uint NeedFree, uint NeedprebufferNormal, uint NeedPrebufferSmall, int MaxReferenceFrames=16)
Definition: videobuffers.cpp:952
mythmainwindow.h
is_interlaced
bool is_interlaced(FrameScanType Scan)
Definition: videoouttypes.h:154
VideoBuffers::Init
void Init(uint NumDecode, uint NeedFree, uint NeedprebufferNormal, uint NeedPrebufferSmall)
Creates buffers and sets various buffer management parameters.
Definition: videobuffers.cpp:175
VideoBuffers::GetStatus
QString GetStatus(uint Num=0) const
Definition: videobuffers.cpp:1020
MythVideoBounds::GetVideoDim
QSize GetVideoDim(void) const
Definition: mythvideobounds.h:70
kRenderDirect3D9
@ kRenderDirect3D9
Definition: mythrender_base.h:18
VideoBuffers::Size
uint Size(BufferType Type) const
Definition: videobuffers.cpp:753
MythVideoOutputGPU::EndFrame
void EndFrame() override
Definition: mythvideooutgpu.cpp:627
OSD
Definition: osd.h:95
VideoBuffers::GetNumBuffers
static uint GetNumBuffers(int PixelFormat, int MaxReferenceFrames=16, bool Decoder=false)
Definition: videobuffers.cpp:135
MythMainWindow
Definition: mythmainwindow.h:35
VideoOutputD3D::GetAllowedRenderers
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
Definition: videoout_d3d.cpp:607
MythVideoOutput::m_deinterlacing2X
bool m_deinterlacing2X
Definition: mythvideoout.h:106
MythVideoOutput::m_videoBuffers
VideoBuffers m_videoBuffers
Definition: mythvideoout.h:99
MythVideoBounds::GetVideoAspect
float GetVideoAspect(void) const
Definition: mythvideobounds.h:83
MythVideoOutput::m_videoColourSpace
MythVideoColourSpace m_videoColourSpace
Definition: mythvideoout.h:94
MythPainterGPU
Definition: mythpaintergpu.h:12
MythVideoBounds::SetWindowSize
void SetWindowSize(QSize Size)
Definition: mythvideobounds.cpp:616
VideoDisplayProfile::GetBestVideoRenderer
static QString GetBestVideoRenderer(const QStringList &Renderers)
Definition: videodisplayprofile.cpp:1343
MythVideoBounds::GetStereoOverride
StereoscopicMode GetStereoOverride() const
Definition: mythvideobounds.h:85
MythPainterGPU::None
@ None
Definition: mythpaintergpu.h:18
MythVideoBounds::m_display
MythDisplay * m_display
Definition: mythvideobounds.h:101
MythVideoOutput::m_deinterlacing
bool m_deinterlacing
Definition: mythvideoout.h:105