MythTV  master
mythvideooutgpu.cpp
Go to the documentation of this file.
1 // MythTV
5 
6 #include "mythplayer.h"
7 #include "mythvideogpu.h"
8 #include "mythvideooutgpu.h"
9 
10 #ifdef _WIN32
12 #include "videoout_d3d.h"
13 #endif
14 #ifdef USING_OPENGL
17 #endif
18 #ifdef USING_VULKAN
21 #endif
22 
23 #define LOC QString("VidOutGPU: ")
24 
26 {
27 #ifdef USING_OPENGL
28  if (dynamic_cast<MythRenderOpenGL*>(Render) != nullptr)
30 #endif
31 
32 #ifdef USING_VULKAN
33  if (dynamic_cast<MythRenderVulkan*>(Render) != nullptr)
35 #endif
36 }
37 
39  MythPainter* Painter, MythDisplay* Display,
40  const QString& Decoder,
41  MythCodecID CodecID, const QSize VideoDim,
42  const QSize VideoDispDim, float VideoAspect,
43  float FrameRate, uint PlayerFlags,
44  const QString& Codec, int ReferenceFrames,
45  const VideoFrameTypes*& RenderFormats)
46 {
47  if (!(MainWindow && Render && Painter && Display))
48  {
49  LOG(VB_GENERAL, LOG_ERR, LOC + "Fatal error");
50  return nullptr;
51  }
52 
54  {
55  LOG(VB_GENERAL, LOG_ERR, LOC + "Cannot create null video output here");
56  return nullptr;
57  }
58 
59  QStringList renderers;
60 
61 #ifdef _WIN32
62 // auto * d3drender = dynamic_cast<MythRenderD3D9*>(Render);
63 // auto * d3dpainter = dynamic_cast<MythD3D9Painter*>(Painter);
64 // if (Render->Type() == kRenderDirect3D9)
65 // renderers += VideoOutputD3D::GetAllowedRenderers(CodecID, VideoDispDim);
66 #endif
67 
68 #ifdef USING_OPENGL
69  auto * openglrender = dynamic_cast<MythRenderOpenGL*>(Render);
70  auto * openglpainter = dynamic_cast<MythOpenGLPainter*>(Painter);
71  if (openglrender && openglpainter && (Render->Type() == kRenderOpenGL))
72  renderers += MythVideoOutputOpenGL::GetAllowedRenderers(openglrender, CodecID, VideoDispDim);
73 #endif
74 
75 #ifdef USING_VULKAN
76  auto * vulkanrender = dynamic_cast<MythRenderVulkan*>(Render);
77  auto * vulkanpainter = dynamic_cast<MythPainterVulkan*>(Painter);
78  if (vulkanrender && vulkanpainter && (Render->Type() == kRenderVulkan))
79  renderers += MythVideoOutputVulkan::GetAllowedRenderers(CodecID);
80 #endif
81 
82  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Allowed renderers for %1 %2 (Decoder: %3): '%4'")
83  .arg(get_encoding_type(CodecID),
84  get_decoder_name(CodecID),
85  Decoder,
86  renderers.join(",")));
87  renderers = MythVideoProfile::GetFilteredRenderers(Decoder, renderers);
88  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Allowed renderers (filt: %1): %2")
89  .arg(Decoder, renderers.join(",")));
90 
91  QString renderer;
92 
93  auto videoprofile = std::make_shared<MythVideoProfile>();
94 
95  if (!renderers.empty())
96  {
97  videoprofile->SetInput(VideoDispDim, FrameRate, Codec);
98  QString tmp = videoprofile->GetVideoRenderer();
99  if (videoprofile->IsDecoderCompatible(Decoder) && renderers.contains(tmp))
100  {
101  renderer = tmp;
102  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Preferred renderer: " + renderer);
103  }
104  else
105  {
106  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("No preferred renderer for decoder '%1' - profile renderer: '%2'")
107  .arg(Decoder, tmp));
108  }
109  }
110 
111  if (renderer.isEmpty())
112  renderer = MythVideoProfile::GetBestVideoRenderer(renderers);
113 
114  if (renderer.isEmpty())
115  {
116  QString fallback;
117 #ifdef USING_OPENGL
118  if (Render->Type() == kRenderOpenGL)
119  fallback = "opengl";
120 #endif
121 #ifdef USING_VULKAN
122  if (Render->Type() == kRenderVulkan)
123  fallback = VULKAN_RENDERER;
124 #endif
125  LOG(VB_GENERAL, LOG_WARNING, LOC + "No renderer found. This should not happen!.");
126  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Falling back to '%1'").arg(fallback));
127  renderer = fallback;
128  }
129 
130  while (!renderers.empty())
131  {
132  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Trying video renderer: '%1'").arg(renderer));
133  int index = renderers.indexOf(renderer);
134  if (index >= 0)
135  renderers.removeAt(index);
136  else
137  break;
138 
139  MythVideoOutputGPU* video = nullptr;
140 
141 #ifdef _WIN32
142 // if (renderer == "direct3d")
143 // video = new VideoOutputD3D(MainWindow, d3drender,
144 // d3dpainter, Display,
145 // videoprofile, renderer);
146 #endif
147 #ifdef USING_OPENGL
148  // cppcheck-suppress knownConditionTrueFalse
149  if (!video && renderer.contains("opengl") && openglrender)
150  {
151  video = new MythVideoOutputOpenGL(MainWindow, openglrender,
152  openglpainter, Display,
153  videoprofile, renderer);
154  }
155 #endif
156 #ifdef USING_VULKAN
157  if (!video && renderer.contains(VULKAN_RENDERER))
158  {
159  video = new MythVideoOutputVulkan(MainWindow, vulkanrender,
160  vulkanpainter, Display,
161  videoprofile, renderer);
162  }
163 #endif
164 
165  if (video)
166  {
168  video->SetReferenceFrames(ReferenceFrames);
169  if (video->Init(VideoDim, VideoDispDim, VideoAspect, MainWindow->GetUIScreenRect(), CodecID))
170  {
171  video->SetVideoScalingAllowed(true);
172  RenderFormats = video->m_renderFormats;
173  return video;
174  }
175  delete video;
176  video = nullptr;
177  }
178  renderer = MythVideoProfile::GetBestVideoRenderer(renderers);
179  }
180 
181  LOG(VB_GENERAL, LOG_ERR, LOC + "Not compiled with any useable video output method.");
182  return nullptr;
183 }
184 
186 {
187  if (codec_is_vaapi(CodecId)) return FMT_VAAPI;
188  if (codec_is_vdpau(CodecId)) return FMT_VDPAU;
189  if (codec_is_nvdec(CodecId)) return FMT_NVDEC;
190  if (codec_is_vtb(CodecId)) return FMT_VTB;
191  if (codec_is_mmal(CodecId)) return FMT_MMAL;
192  if (codec_is_v4l2(CodecId) || codec_is_drmprime(CodecId)) return FMT_DRMPRIME;
193  if (codec_is_mediacodec(CodecId)) return FMT_MEDIACODEC;
194  return FMT_NONE;
195 }
196 
210  MythPainterGPU* Painter, MythDisplay* Display,
211  MythVideoProfilePtr VideoProfile, QString& Profile)
212  : m_mainWindow(MainWindow),
213  m_render(Render),
214  m_painter(Painter),
215  m_profile(std::move(Profile))
216 {
217  if (!(m_mainWindow && m_render && m_painter && Display))
218  {
219  LOG(VB_GENERAL, LOG_ERR, "Fatal error");
220  return;
221  }
222 
223  m_videoProfile = std::move(VideoProfile);
224  m_render->IncrRef();
225  SetDisplay(Display);
227 
228  // If our rendering context is overlaid on top of a video plane, we need transparency
229  // and we need to ensure we are clearing the entire framebuffer.
230  // Note: an alpha of zero is probably safe to use everywhere. tbc.
231  if (m_display->IsPlanar())
232  {
233  m_clearAlpha = 0;
234  m_needFullClear = true;
235  }
236 
238 
241  connect(this, &MythVideoOutputGPU::DoRefreshState,
251 }
252 
254 {
255  m_hdrTracker = nullptr;
256 
258  delete m_video;
259  if (m_painter)
261  if (m_render)
262  m_render->DecrRef();
263 }
264 
266 {
267  return GetDisplayVisibleRect();
268 }
269 
271 {
273 }
274 
275 void MythVideoOutputGPU::WindowResized(const QSize Size)
276 {
277  SetWindowSize(Size);
279 }
280 
282 {
283  if (!m_videoProfile)
284  return;
285 
286  if (qFuzzyCompare(m_videoProfile->GetOutput() + 1.0F, NewRate + 1.0F))
287  return;
288 
289  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Video frame rate changed: %1->%2")
290  .arg(static_cast<double>(m_videoProfile->GetOutput())).arg(static_cast<double>(NewRate)));
291  m_videoProfile->SetOutput(NewRate);
292  m_newFrameRate = true;
293 }
294 
295 bool MythVideoOutputGPU::Init(const QSize VideoDim, const QSize VideoDispDim,
296  float Aspect, const QRect DisplayVisibleRect, MythCodecID CodecId)
297 {
298  // if we are the main video player then free up as much video memory
299  // as possible at startup
300  if ((kCodec_NONE == m_newCodecId) && m_painter)
302 
303  // Default initialisation - mainly MythVideoBounds
304  if (!MythVideoOutput::Init(VideoDim, VideoDispDim, Aspect, DisplayVisibleRect, CodecId))
305  return false;
306 
307  // Ensure any new profile preferences are handled after a stream change
308  if (m_videoProfile)
309  m_video->SetProfile(m_videoProfile->GetVideoRenderer());
310 
311  // Set default support for picture attributes
313 
314  // Setup display
315  QSize size = GetVideoDim();
316 
317  // Set the display mode if required
319  ResizeForVideo(size);
321 
322  // Create buffers
324  if (!m_buffersCreated)
325  return false;
326 
327  // Adjust visible rect for embedding
328  QRect dvr = GetDisplayVisibleRectAdj();
330  {
331  m_render->SetViewPort(QRect(QPoint(), dvr.size()));
332  return true;
333  }
334 
335  // Reset OpenGLVideo
336  if (m_video->IsValid())
338 
339  return true;
340 }
341 
348 void MythVideoOutputGPU::DiscardFrames(bool KeyFrame, bool Flushed)
349 {
350  if (Flushed)
351  {
352  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("(%1): %2").arg(KeyFrame).arg(m_videoBuffers.GetStatus()));
354  }
355  MythVideoOutput::DiscardFrames(KeyFrame, Flushed);
356 }
357 
370 {
371  if (!Frame)
372  return;
373 
374  auto retain = MythVideoFrame::HardwareFormat(Frame->m_type);
375  QVector<MythVideoFrame*> release;
376 
379  {
380  auto * frame = m_videoBuffers.Dequeue(kVideoBuffer_pause);
381  if (!retain || (frame != Frame))
382  release.append(frame);
383  }
384 
385  if (retain)
386  {
390  }
391  else
392  {
393  release.append(Frame);
394  }
396 
397  for (auto * frame : release)
399 }
400 
402 {
403  if (m_buffersCreated)
404  return true;
405 
406  if (codec_is_copyback(CodecID))
407  {
409  return m_videoBuffers.CreateBuffers(FMT_YV12, Size.width(), Size.height(), m_renderFormats);
410  }
411 
412  if (codec_is_mediacodec(CodecID))
414  if (codec_is_vaapi(CodecID))
416  if (codec_is_vtb(CodecID))
417  return m_videoBuffers.CreateBuffers(FMT_VTB, m_renderFormats, Size, 1, 4, 2);
418  if (codec_is_vdpau(CodecID))
420  if (codec_is_nvdec(CodecID))
421  return m_videoBuffers.CreateBuffers(FMT_NVDEC, m_renderFormats, Size, 2, 1, 4);
422  if (codec_is_mmal(CodecID))
423  return m_videoBuffers.CreateBuffers(FMT_MMAL, m_renderFormats, Size, 2, 1, 4);
424  if (codec_is_v4l2(CodecID) || codec_is_drmprime(CodecID))
426 
428 }
429 
431 {
434  m_buffersCreated = false;
435 }
436 
437 void MythVideoOutputGPU::SetReferenceFrames(int ReferenceFrames)
438 {
439  m_maxReferenceFrames = ReferenceFrames;
440 }
441 
442 bool MythVideoOutputGPU::InputChanged(QSize VideoDim, QSize VideoDispDim,
443  float VideoAspect, MythCodecID CodecId,
444  bool& AspectOnly, int ReferenceFrames,
445  bool ForceChange)
446 {
447  QSize currentvideodim = GetVideoDim();
448  QSize currentvideodispdim = GetVideoDispDim();
449  MythCodecID currentcodec = m_videoCodecID;
450  float currentaspect = GetVideoAspect();
451 
452  if (m_newCodecId != kCodec_NONE)
453  {
454  // InputChanged has been called twice in quick succession without a call to ProcessFrame
455  currentvideodim = m_newVideoDim;
456  currentvideodispdim = m_newVideoDispDim;
457  currentcodec = m_newCodecId;
458  currentaspect = m_newAspect;
459  }
460 
461  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Video changed: %1x%2 (%3x%4) '%5' (Aspect %6 Refs %13)"
462  "-> %7x%8 (%9x%10) '%11' (Aspect %12 Refs %14)")
463  .arg(currentvideodispdim.width()).arg(currentvideodispdim.height())
464  .arg(currentvideodim.width()).arg(currentvideodim.height())
465  .arg(toString(currentcodec)).arg(static_cast<double>(currentaspect))
466  .arg(VideoDispDim.width()).arg(VideoDispDim.height())
467  .arg(VideoDim.width()).arg(VideoDim.height())
468  .arg(toString(CodecId)).arg(static_cast<double>(VideoAspect))
469  .arg(m_maxReferenceFrames).arg(ReferenceFrames));
470 
471  bool cidchanged = (CodecId != currentcodec);
472  bool reschanged = (VideoDispDim != currentvideodispdim);
473  bool refschanged = m_maxReferenceFrames != ReferenceFrames;
474 
475  // aspect ratio changes are a no-op as changes are handled at display time
476  if (!(cidchanged || reschanged || refschanged || ForceChange))
477  {
478  AspectOnly = true;
479  return true;
480  }
481 
482  // N.B. We no longer check for interop support for the new codec as it is a
483  // poor substitute for a full check of decoder capabilities etc. Better to let
484  // hardware decoding fail if necessary - which should at least fallback to
485  // software decoding rather than bailing out here.
486 
487  // delete and recreate the buffers and flag that the input has changed
488  m_maxReferenceFrames = ReferenceFrames;
490  if (!m_buffersCreated)
491  return false;
492 
493  m_newCodecId= CodecId;
494  m_newVideoDim = VideoDim;
495  m_newVideoDispDim = VideoDispDim;
496  m_newAspect = VideoAspect;
497  return true;
498 }
499 
501 {
502  if (m_newCodecId != kCodec_NONE)
503  {
504  // Ensure we don't lose embedding through program changes.
505  bool wasembedding = IsEmbedding();
506  QRect oldrect;
507  if (wasembedding)
508  {
509  oldrect = GetEmbeddingRect();
510  EmbedPlayback(false, {});
511  }
512 
513  // Note - we don't call the default VideoOutput::InputChanged method as
514  // the OpenGL implementation is asynchronous.
515  // So we need to update the video display profile here. It is a little
516  // circular as we need to set the video dimensions first which are then
517  // reset in Init.
518  // All told needs a cleanup - not least because the use of codecName appears
519  // to be inconsistent.
521  AVCodecID avCodecId = myth2av_codecid(m_newCodecId);
522  const AVCodec* codec = avcodec_find_decoder(avCodecId);
523  QString codecName;
524  if (codec)
525  codecName = codec->name;
526  if (m_videoProfile)
527  m_videoProfile->SetInput(GetVideoDispDim(), 0 , codecName);
530  m_newVideoDim = QSize();
531  m_newVideoDispDim = QSize();
532  m_newAspect = 0.0F;
533  m_newFrameRate = false;
534 
535  if (wasembedding && ok)
536  EmbedPlayback(true, oldrect);
537 
538  // Update deinterlacers for any input change
540 
541  if (!ok)
542  return false;
543  }
544  else if (m_newFrameRate)
545  {
546  // If we are switching mode purely for a refresh rate change, then there
547  // is no need to recreate buffers etc etc
548  ResizeForVideo();
549  m_newFrameRate = false;
550  }
551 
552  return true;
553 }
554 
561 {
562  if (!m_display)
563  return;
564 
565  // Retrieve the display aspect ratio.
566  // This will be, in priority order:-
567  // - aspect ratio override when using resolution/mode switching (if not 'Default')
568  // - aspect ratio override for setups where detection does not work/is broken (multiscreen, broken EDID etc)
569  // - aspect ratio based on detected physical size (this should be the common/default value)
570  // - aspect ratio fallback using screen resolution
571  // - 16:9
572  QString source;
573  double displayaspect = m_display->GetAspectRatio(source);
574  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Display aspect ratio: %1 (%2)")
575  .arg(displayaspect).arg(source));
576 
577  // Get the window and screen resolutions
578  QSize window = GetRawWindowRect().size();
579  QSize screen = m_display->GetResolution();
580 
581  // If not running fullscreen, adjust for window size and ignore any video
582  // mode overrides as they do not apply when in a window
583  if (!window.isEmpty() && !screen.isEmpty() && window != screen)
584  {
585  displayaspect = m_display->GetAspectRatio(source, true);
586  double screenaspect = screen.width() / static_cast<double>(screen.height());
587  double windowaspect = window.width() / static_cast<double>(window.height());
588  displayaspect = displayaspect * (1.0 / screenaspect) * windowaspect;
589  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Window aspect ratio: %1").arg(displayaspect));
590  }
591 
592  SetDisplayAspect(static_cast<float>(displayaspect));
593 }
594 
596 {
597  // Process input changes
598  if (!ProcessInputChange())
599  return;
600 
601  if (Frame)
602  {
603  SetRotation(Frame->m_rotation);
604 
605  if (m_hdrTracker)
606  m_hdrTracker->Update(Frame);
607 
608  if (MythVideoFrame::HardwareFormat(Frame->m_type) || Frame->m_dummy)
609  return;
610 
611  // software deinterlacing
613 
614  // update software textures
615  if (m_video)
616  m_video->PrepareFrame(Frame, Scan);
617  }
618 }
619 
621 {
622  bool dummy = false;
623  bool topfieldfirst = false;
624  if (Frame)
625  {
626  m_framesPlayed = Frame->m_frameNumber + 1;
627  topfieldfirst = Frame->m_interlacedReverse ? !Frame->m_topFieldFirst : Frame->m_topFieldFirst;
628  dummy = Frame->m_dummy;
629  }
630  else
631  {
632  // see DoneDisplayingFrame
633  // we only retain pause frames for hardware formats
636  }
637 
638  // Main UI when embedded
639  if (m_painter && IsEmbedding())
640  {
641  // If we are using high dpi, the painter needs to set the appropriate
642  // viewport and enable scaling of its images
644 
646  {
647  m_mainWindow->GetPaintWindow()->clearMask();
649  }
651  }
652 
653  // Video
654  // N.B. dummy streams need the viewport updated in case we have resized the window (i.e. LiveTV)
655  if (m_video && !dummy)
656  m_video->RenderFrame(Frame, topfieldfirst, Scan, GetStereoOverride());
657  else if (dummy)
659 }
660 
661 void MythVideoOutputGPU::UpdatePauseFrame(std::chrono::milliseconds& DisplayTimecode, FrameScanType Scan)
662 {
663  MythVideoFrame* release = nullptr;
666  if (used)
667  {
669  {
671  }
672  else
673  {
675  m_deinterlacer.Filter(used, Scan, m_videoProfile.get(), true);
676  if (m_video)
677  m_video->PrepareFrame(used, Scan);
678  }
679  DisplayTimecode = used->m_displayTimecode;
680  }
681  else
682  {
683  LOG(VB_PLAYBACK, LOG_WARNING, LOC + "Could not update pause frame");
684  }
686 
687  if (release)
688  DoneDisplayingFrame(release);
689 }
690 
692 {
693  m_video->EndFrame();
694 }
695 
697 {
698  // Clear reference frames for GPU deinterlacing
699  if (m_video)
701  // Clear decoded frames
703 }
704 
717 {
718  if (!m_display)
719  return;
720  if (!m_display->UsingVideoModes())
721  return;
722 
723  if (Size.isEmpty())
724  {
725  Size = GetVideoDispDim();
726  if (Size.isEmpty())
727  return;
728  }
729 
730  float rate = m_videoProfile ? m_videoProfile->GetOutput() : 0.0F;
731 
732  bool hide = m_display->NextModeIsLarger(Size);
733  if (hide)
734  m_mainWindow->hide();
735 
736  if (m_display->SwitchToVideo(Size, static_cast<double>(rate)))
737  {
738  // Switching to custom display resolution succeeded
739  // Make a note of the new size
740  QString source;
741  double aspect = m_display->GetAspectRatio(source);
742  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Aspect ratio: %1 (%2)")
743  .arg(aspect).arg(source));
744  SetDisplayAspect(static_cast<float>(aspect));
746 
747  bool fullscreen = !UsingGuiSize();
748 
749  // if width && height are zero users expect fullscreen playback
750  if (!fullscreen)
751  {
752  int gui_width = 0;
753  int gui_height = 0;
754  gCoreContext->GetResolutionSetting("Gui", gui_width, gui_height);
755  fullscreen |= (0 == gui_width && 0 == gui_height);
756  }
757 
758  if (fullscreen)
759  {
760  QSize size = m_display->GetResolution();
761  QRect display_visible_rect = QRect(m_mainWindow->geometry().topLeft(), size);
762  if (hide)
763  {
764  m_mainWindow->Show();
765  hide = false;
766  }
767  m_mainWindow->MoveResize(display_visible_rect);
768  }
769  }
770  if (hide)
771  m_mainWindow->Show();
772 }
FMT_VTB
@ FMT_VTB
Definition: mythframe.h:62
MythVideoOutputGPU::InitPictureAttributes
void InitPictureAttributes() override
Definition: mythvideooutgpu.cpp:270
mythpainter_d3d9.h
MythOpenGLPainter
Definition: mythpainteropengl.h:26
MythVideoColourSpace::PictureAttributeChanged
void PictureAttributeChanged(PictureAttribute Attribute, int Value)
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:84
FMT_VDPAU
@ FMT_VDPAU
Definition: mythframe.h:57
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:348
MythVideoOutputGPU::SetVideoFrameRate
void SetVideoFrameRate(float NewRate) override
Definition: mythvideooutgpu.cpp:281
MythVideoGPU::RenderFrame
virtual void RenderFrame(MythVideoFrame *Frame, bool TopFieldFirst, FrameScanType Scan, StereoscopicMode StereoOverride, bool DrawBorder=false)=0
videoout_d3d.h
MythVideoOutputGPU::RefreshState
void RefreshState()
VideoBuffers::Head
MythVideoFrame * Head(BufferType Type)
Definition: videobuffers.cpp:648
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
codec_is_v4l2
static bool codec_is_v4l2(MythCodecID id)
Definition: mythcodecid.h:356
VideoBuffers::Tail
MythVideoFrame * Tail(BufferType Type)
Definition: videobuffers.cpp:659
MythUIScreenBounds::GetUIScreenRect
QRect GetUIScreenRect()
Definition: mythuiscreenbounds.cpp:198
MythVideoOutputGPU::InitDisplayMeasurements
void InitDisplayMeasurements()
Initialise display measurement.
Definition: mythvideooutgpu.cpp:560
MythPainterGPU::Viewport
@ Viewport
Definition: mythpaintergpu.h:19
MythDisplay::IsPlanar
virtual bool IsPlanar()
Definition: mythdisplay.h:31
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
MythVideoOutputGPU::DestroyBuffers
void DestroyBuffers()
Definition: mythvideooutgpu.cpp:430
MythVideoBounds::EmbedPlayback
virtual void EmbedPlayback(bool Embed, QRect Rect)
Definition: mythvideobounds.cpp:684
codec_is_nvdec
static bool codec_is_nvdec(MythCodecID id)
Definition: mythcodecid.h:342
mythpaintergpu.h
VideoBuffers::Remove
void Remove(BufferType Type, MythVideoFrame *Frame)
Definition: videobuffers.cpp:685
MythVideoOutput::m_framesPlayed
long long m_framesPlayed
Definition: mythvideoout.h:103
VULKAN_RENDERER
#define VULKAN_RENDERER
Definition: mythvideooutputvulkan.h:11
kScan_Progressive
@ kScan_Progressive
Definition: videoouttypes.h:100
MythVideoBounds::GetDisplayVisibleRect
QRect GetDisplayVisibleRect(void) const
Definition: mythvideobounds.h:73
MythVideoGPU::IsValid
bool IsValid() const
Definition: mythvideogpu.cpp:73
Frame
Definition: zmdefines.h:93
MythVideoOutputGPU::m_render
MythRender * m_render
Definition: mythvideooutgpu.h:69
codec_is_vaapi
static bool codec_is_vaapi(MythCodecID id)
Definition: mythcodecid.h:319
codec_is_vtb
static bool codec_is_vtb(MythCodecID id)
Definition: mythcodecid.h:349
MythVideoBounds::RefreshVideoBoundsState
void RefreshVideoBoundsState()
Send out latest state to listeners.
Definition: mythvideobounds.cpp:68
FMT_NVDEC
@ FMT_NVDEC
Definition: mythframe.h:63
MythVideoOutputGPU::PictureAttributesUpdated
void PictureAttributesUpdated(const std::map< PictureAttribute, int > &Values)
VideoBuffers::DiscardAndRecreate
bool DiscardAndRecreate(MythCodecID CodecID, QSize VideoDim, int References)
Discard all buffers and recreate.
Definition: videobuffers.cpp:483
MythVideoOutputOpenGL::GetRenderOptions
static void GetRenderOptions(RenderOptions &Options)
Generate the list of available OpenGL profiles.
Definition: mythvideooutopengl.cpp:28
MythVideoOutput::m_forcedDeinterlacer
MythDeintType m_forcedDeinterlacer
Definition: mythvideoout.h:109
kRenderOpenGL
@ kRenderOpenGL
Definition: mythrender_base.h:19
MythMainWindow::Show
void Show()
Definition: mythmainwindow.cpp:961
VideoBuffers::Dequeue
MythVideoFrame * Dequeue(BufferType Type)
Definition: videobuffers.cpp:639
MythDisplay::GetAspectRatio
double GetAspectRatio(QString &Source, bool IgnoreModeOverride=false)
Returns current screen aspect ratio.
Definition: mythdisplay.cpp:871
MythVideoOutputGPU::m_hdrTracker
HDRTracker m_hdrTracker
Definition: mythvideooutgpu.h:80
MythVideoColourSpace::SetSupportedAttributes
void SetSupportedAttributes(PictureAttributeSupported Supported)
Enable the given set of picture attributes.
Definition: mythvideocolourspace.cpp:111
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
FMT_NONE
@ FMT_NONE
Definition: mythframe.h:22
MythVideoFrame::HardwareFormat
static bool HardwareFormat(VideoFrameType Type)
Definition: mythframe.h:425
mythplayer.h
kVideoBuffer_pause
@ kVideoBuffer_pause
Definition: videobuffers.h:31
MythVideoOutputGPU::ClearAfterSeek
void ClearAfterSeek() override
Tells video output to toss decoded buffers due to a seek.
Definition: mythvideooutgpu.cpp:696
PlayerFlags
PlayerFlags
Definition: mythplayer.h:64
MythVideoBounds::UsingGuiSize
bool UsingGuiSize(void) const
Definition: mythvideobounds.h:79
MythMainWindow::Draw
void Draw(MythPainter *Painter=nullptr)
Definition: mythmainwindow.cpp:435
mythpaintervulkan.h
MythVideoFrame::m_displayTimecode
std::chrono::milliseconds m_displayTimecode
Definition: mythframe.h:132
MythVideoProfile::GetBestVideoRenderer
static QString GetBestVideoRenderer(const QStringList &Renderers)
Definition: mythvideoprofile.cpp:1279
MythVideoOutputOpenGL::GetAllowedRenderers
static QStringList GetAllowedRenderers(MythRenderOpenGL *Render, MythCodecID CodecId, QSize VideoDim)
Generate a list of supported OpenGL profiles.
Definition: mythvideooutopengl.cpp:371
MythVideoOutputGPU::ResizeForVideo
void ResizeForVideo(QSize Size=QSize())
Definition: mythvideooutgpu.cpp:716
MythVideoColourSpace::SupportedAttributesChanged
void SupportedAttributesChanged(PictureAttributeSupported Supported)
VideoBuffers::CreateBuffers
bool CreateBuffers(VideoFrameType Type, const VideoFrameTypes *RenderFormats, QSize Size, uint NeedFree, uint NeedprebufferNormal, uint NeedPrebufferSmall, int MaxReferenceFrames=16)
Definition: videobuffers.cpp:941
MythVideoOutputGPU::Init
bool Init(QSize VideoDim, QSize VideoDispDim, float Aspect, QRect DisplayVisibleRect, MythCodecID CodecId) override
Definition: mythvideooutgpu.cpp:295
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:15
mythvideooutputvulkan.h
tmp
static guint32 * tmp
Definition: goom_core.cpp:26
MythVideoOutputGPU::m_newVideoDispDim
QSize m_newVideoDispDim
Definition: mythvideooutgpu.h:74
kRenderVulkan
@ kRenderVulkan
Definition: mythrender_base.h:20
MythVideoOutputGPU::GetRenderOptions
static void GetRenderOptions(RenderOptions &Options, MythRender *Render)
Definition: mythvideooutgpu.cpp:25
MythVideoOutputGPU::DoneDisplayingFrame
void DoneDisplayingFrame(MythVideoFrame *Frame) override
Release a video frame back into the decoder pool.
Definition: mythvideooutgpu.cpp:369
MythRender::SetViewPort
virtual void SetViewPort(const QRect, bool=false)
Definition: mythrender_base.h:36
MythVideoBounds::SetDisplayAspect
void SetDisplayAspect(float DisplayAspect)
Definition: mythvideobounds.cpp:608
MythVideoGPU::ResetTextures
virtual void ResetTextures()=0
MythVideoOutputGPU::m_mainWindow
MythMainWindow * m_mainWindow
Definition: mythvideooutgpu.h:68
MythVideoGPU::PrepareFrame
virtual void PrepareFrame(MythVideoFrame *Frame, FrameScanType Scan=kScan_Progressive)=0
Decoder
Definition: decoder.h:70
FMT_VAAPI
@ FMT_VAAPI
Definition: mythframe.h:58
MythVideoOutput::Init
virtual bool Init(QSize VideoDim, QSize VideoDispDim, float VideoAspect, QRect WindowRect, MythCodecID CodecID)
Definition: mythvideoout.cpp:110
MythDisplay::GetResolution
QSize GetResolution()
Definition: mythdisplay.cpp:1067
mythlogging.h
RenderOptions
Definition: mythvideoprofile.h:41
MythVideoOutput::m_clearAlpha
uint8_t m_clearAlpha
Definition: mythvideoout.h:97
MythPainterVulkan
Definition: mythpaintervulkan.h:19
MythVideoBounds::SetDisplay
void SetDisplay(MythDisplay *mDisplay)
Definition: mythvideobounds.cpp:74
VideoBuffers::Contains
bool Contains(BufferType Type, MythVideoFrame *Frame) const
Definition: videobuffers.cpp:751
MythVideoBounds::SourceChanged
void SourceChanged(QSize VideoDim, QSize VideoDispDim, float Aspect)
Update for new source video dimensions and aspect ratio.
Definition: mythvideobounds.cpp:525
MythVideoOutput::ClearAfterSeek
virtual void ClearAfterSeek()
Tells video output to toss decoded buffers due to a seek.
Definition: mythvideoout.cpp:272
MythVideoOutputGPU::UpdatePauseFrame
void UpdatePauseFrame(std::chrono::milliseconds &DisplayTimecode, FrameScanType Scan=kScan_Progressive) override
Definition: mythvideooutgpu.cpp:661
MythVideoFrame::m_alreadyDeinterlaced
bool m_alreadyDeinterlaced
Definition: mythframe.h:154
VideoFrameTypes
std::vector< VideoFrameType > VideoFrameTypes
Definition: mythframe.h:83
MythVideoOutputGPU::PictureAttributeChanged
void PictureAttributeChanged(PictureAttribute Attribute, int Value)
MythVideoOutputGPU::m_newCodecId
MythCodecID m_newCodecId
Definition: mythvideooutgpu.h:72
MythVideoOutput::m_videoProfile
MythVideoProfilePtr m_videoProfile
Definition: mythvideoout.h:100
MythVideoOutputGPU::m_newFrameRate
bool m_newFrameRate
Definition: mythvideooutgpu.h:76
mythvideooutgpu.h
MythDeinterlacer::Filter
void Filter(MythVideoFrame *Frame, FrameScanType Scan, MythVideoProfile *Profile, bool Force=false)
Deinterlace Frame if needed.
Definition: mythdeinterlacer.cpp:69
VideoFrameType
VideoFrameType
Definition: mythframe.h:20
FrameRate
Definition: recorderbase.h:38
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:24
MythCoreContext::GetResolutionSetting
void GetResolutionSetting(const QString &type, int &width, int &height, double &forced_aspect, double &refresh_rate, int index=-1)
Definition: mythcorecontext.cpp:853
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:692
MythVideoOutputGPU::Create
static MythVideoOutputGPU * Create(MythMainWindow *MainWindow, MythRender *Render, MythPainter *Painter, MythDisplay *Display, const QString &Decoder, MythCodecID CodecID, QSize VideoDim, QSize VideoDispDim, float VideoAspect, float FrameRate, uint PlayerFlags, const QString &Codec, int ReferenceFrames, const VideoFrameTypes *&RenderFormats)
Definition: mythvideooutgpu.cpp:38
FMT_DRMPRIME
@ FMT_DRMPRIME
Definition: mythframe.h:64
LOC
#define LOC
Definition: mythvideooutgpu.cpp:23
get_encoding_type
QString get_encoding_type(MythCodecID codecid)
Definition: mythcodecid.cpp:475
MythVideoColourSpace::RefreshState
void RefreshState()
Definition: mythvideocolourspace.cpp:95
MythMainWindow::GetPaintWindow
QWidget * GetPaintWindow()
Definition: mythmainwindow.cpp:267
MythVideoBounds::GetEmbeddingRect
QRect GetEmbeddingRect(void) const
Definition: mythvideobounds.h:78
VideoBuffers::Reset
void Reset(void)
Definition: videobuffers.cpp:265
MythVideoOutputGPU::m_buffersCreated
bool m_buffersCreated
Definition: mythvideooutgpu.h:77
MythPainterGPU::Framebuffer
@ Framebuffer
Definition: mythpaintergpu.h:20
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:434
MythVideoOutput::m_videoCodecID
MythCodecID m_videoCodecID
Definition: mythvideoout.h:98
MythVideoOutputGPU::m_newVideoDim
QSize m_newVideoDim
Definition: mythvideooutgpu.h:73
MythVideoBounds::SetRotation
void SetRotation(int Rotation)
Set the rotation in degrees.
Definition: mythvideobounds.cpp:661
MythVideoOutputOpenGL
Definition: mythvideooutopengl.h:12
uint
unsigned int uint
Definition: compat.h:81
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
MythVideoOutputGPU::m_newAspect
float m_newAspect
Definition: mythvideooutgpu.h:75
MythPainter::FreeResources
virtual void FreeResources(void)
Definition: mythpainter.h:53
MythVideoOutputGPU::SetReferenceFrames
void SetReferenceFrames(int ReferenceFrames)
Definition: mythvideooutgpu.cpp:437
MythVideoBounds::GetVideoDispDim
QSize GetVideoDispDim(void) const
Definition: mythvideobounds.h:71
MythVideoGPU::EndFrame
virtual void EndFrame()=0
MythDisplay
Definition: mythdisplay.h:22
VideoBuffers::BeginLock
frame_queue_t::iterator BeginLock(BufferType Type)
Lock the video buffers.
Definition: videobuffers.cpp:721
MythVideoOutputVulkan::GetAllowedRenderers
static QStringList GetAllowedRenderers(MythCodecID CodecId)
Definition: mythvideooutputvulkan.cpp:29
MythVideoOutputGPU::PrepareFrame
void PrepareFrame(MythVideoFrame *Frame, FrameScanType Scan) override
Definition: mythvideooutgpu.cpp:595
mythvideogpu.h
MythVideoOutputGPU::m_needFullClear
bool m_needFullClear
Definition: mythvideooutgpu.h:79
MythVideoOutput::m_deinterlacer
MythDeinterlacer m_deinterlacer
Definition: mythvideoout.h:105
MythVideoOutputGPU::FrameTypeForCodec
static VideoFrameType FrameTypeForCodec(MythCodecID CodecId)
Definition: mythvideooutgpu.cpp:185
ALL_PICTURE_ATTRIBUTES
#define ALL_PICTURE_ATTRIBUTES
Definition: videoouttypes.h:127
MythVideoOutputGPU::ProcessInputChange
bool ProcessInputChange()
Definition: mythvideooutgpu.cpp:500
MythVideoOutputVulkan::GetRenderOptions
static void GetRenderOptions(RenderOptions &Options)
Definition: mythvideooutputvulkan.cpp:14
kVideoBuffer_used
@ kVideoBuffer_used
Definition: videobuffers.h:30
kScan_Interlaced
@ kScan_Interlaced
Definition: videoouttypes.h:98
VideoBuffers::EndLock
void EndLock()
Definition: videobuffers.cpp:730
MythPainterGPU::SetViewControl
void SetViewControl(ViewControls Control)
Definition: mythpaintergpu.cpp:19
mythpainteropengl.h
VideoBuffers::DiscardPauseFrames
void DiscardPauseFrames(void)
Definition: videobuffers.cpp:461
MythRenderOpenGL
Definition: mythrenderopengl.h:96
MythVideoOutputGPU::ChangePictureAttribute
void ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value)
kVideoIsNull
@ kVideoIsNull
Definition: mythplayer.h:73
MythVideoOutput::m_renderFormats
const VideoFrameTypes * m_renderFormats
Definition: mythvideoout.h:106
MythVideoColourSpace::PictureAttributesUpdated
void PictureAttributesUpdated(const std::map< PictureAttribute, int > &Values)
myth2av_codecid
AVCodecID myth2av_codecid(MythCodecID codec_id)
Definition: mythcodecid.cpp:228
FMT_MMAL
@ FMT_MMAL
Definition: mythframe.h:60
MythDisplay::NextModeIsLarger
bool NextModeIsLarger(QSize Size)
Check whether the next mode is larger in size than the current mode.
Definition: mythdisplay.cpp:672
VideoBuffers::Enqueue
void Enqueue(BufferType Type, MythVideoFrame *Frame)
Definition: videobuffers.cpp:670
MythVideoColourSpace::ChangePictureAttribute
int ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value)
Definition: mythvideocolourspace.cpp:282
MythPainterGPU::None
@ None
Definition: mythpaintergpu.h:18
MythRender
Definition: mythrender_base.h:23
MythVideoOutputGPU::InputChanged
bool InputChanged(QSize VideoDim, QSize VideoDispDim, float VideoAspect, MythCodecID CodecId, bool &AspectOnly, int ReferenceFrames, bool ForceChange) override
Tells video output to discard decoded frames and wait for new ones.
Definition: mythvideooutgpu.cpp:442
MythVideoFrame::m_type
VideoFrameType m_type
Definition: mythframe.h:119
MythPainter
Definition: mythpainter.h:34
MythVideoOutputGPU::MythVideoOutputGPU
MythVideoOutputGPU(MythMainWindow *MainWindow, MythRender *Render, MythPainterGPU *Painter, MythDisplay *Display, MythVideoProfilePtr VideoProfile, QString &Profile)
Definition: mythvideooutgpu.cpp:209
MythVideoOutputGPU::RenderFrame
void RenderFrame(MythVideoFrame *Frame, FrameScanType Scan) override
Definition: mythvideooutgpu.cpp:620
codec_is_mmal
static bool codec_is_mmal(MythCodecID id)
Definition: mythcodecid.h:361
MythVideoOutputVulkan
Definition: mythvideooutputvulkan.h:13
MythVideoOutputGPU::CreateBuffers
bool CreateBuffers(MythCodecID CodecID, QSize Size)
Definition: mythvideooutgpu.cpp:401
MythVideoOutputGPU::DoRefreshState
void DoRefreshState()
get_decoder_name
QString get_decoder_name(MythCodecID codec_id)
Definition: mythcodecid.cpp:714
VideoBuffers::DoneDisplayingFrame
void DoneDisplayingFrame(MythVideoFrame *Frame)
Definition: videobuffers.cpp:418
MythVideoGPU::SetProfile
void SetProfile(const QString &Profile)
Definition: mythvideogpu.cpp:78
MythVideoBounds::SetVideoScalingAllowed
void SetVideoScalingAllowed(bool Change)
Disable or enable underscan/overscan.
Definition: mythvideobounds.cpp:581
codec_is_mediacodec
static bool codec_is_mediacodec(MythCodecID id)
Definition: mythcodecid.h:335
mythvideooutopengl.h
MythVideoOutputGPU
Common code shared between GPU accelerated sub-classes (e.g. OpenGL)
Definition: mythvideooutgpu.h:12
MythRenderVulkan
Definition: mythrendervulkan.h:57
codec_is_drmprime
static bool codec_is_drmprime(MythCodecID id)
Definition: mythcodecid.h:299
MythVideoOutputGPU::SupportedAttributesChanged
void SupportedAttributesChanged(PictureAttributeSupported Supported)
MythRender::Type
RenderType Type(void) const
Definition: mythrender_base.h:32
MythVideoGPU::ResetFrameFormat
virtual void ResetFrameFormat()
Definition: mythvideogpu.cpp:98
codec_is_vdpau
static bool codec_is_vdpau(MythCodecID id)
Definition: mythcodecid.h:302
MythVideoOutputGPU::m_video
MythVideoGPU * m_video
Definition: mythvideooutgpu.h:70
MythVideoOutputGPU::GetDisplayVisibleRectAdj
virtual QRect GetDisplayVisibleRectAdj()
Definition: mythvideooutgpu.cpp:265
FrameScanType
FrameScanType
Definition: videoouttypes.h:94
MythVideoProfilePtr
std::shared_ptr< MythVideoProfile > MythVideoProfilePtr
Definition: mythvideogpu.h:18
MythVideoOutputGPU::m_painter
MythPainterGPU * m_painter
Definition: mythvideooutgpu.h:71
MythMainWindow::MoveResize
void MoveResize(QRect &Geometry)
Definition: mythmainwindow.cpp:972
MythVideoBounds::GetWindowRect
QRect GetWindowRect(void) const
Definition: mythvideobounds.h:74
MythDisplay::UsingVideoModes
virtual bool UsingVideoModes()
Definition: mythdisplay.h:30
MythVideoOutput::SetDeinterlacing
virtual void SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force=DEINT_NONE)
Definition: mythvideoout.cpp:141
MythVideoFrame
Definition: mythframe.h:88
MythVideoBounds::GetRawWindowRect
QRect GetRawWindowRect(void) const
Definition: mythvideobounds.h:75
codec_is_copyback
static bool codec_is_copyback(MythCodecID id)
Definition: mythcodecid.h:366
FMT_MEDIACODEC
@ FMT_MEDIACODEC
Definition: mythframe.h:61
MythVideoOutputGPU::~MythVideoOutputGPU
~MythVideoOutputGPU() override
Definition: mythvideooutgpu.cpp:253
MythVideoOutput::m_maxReferenceFrames
int m_maxReferenceFrames
Definition: mythvideoout.h:99
ReferenceCounter::IncrRef
virtual int IncrRef(void)
Increments reference count.
Definition: referencecounter.cpp:101
mythmainwindow.h
is_interlaced
bool is_interlaced(FrameScanType Scan)
Definition: videoouttypes.h:188
VideoBuffers::Init
void Init(uint NumDecode, uint NeedFree, uint NeedprebufferNormal, uint NeedPrebufferSmall)
Creates buffers and sets various buffer management parameters.
Definition: videobuffers.cpp:176
VideoBuffers::GetStatus
QString GetStatus(uint Num=0) const
Definition: videobuffers.cpp:1012
MythVideoBounds::GetVideoDim
QSize GetVideoDim(void) const
Definition: mythvideobounds.h:70
VideoBuffers::Size
uint Size(BufferType Type) const
Definition: videobuffers.cpp:742
MythVideoOutputGPU::EndFrame
void EndFrame() override
Definition: mythvideooutgpu.cpp:691
VideoBuffers::GetNumBuffers
static uint GetNumBuffers(int PixelFormat, int MaxReferenceFrames=16, bool Decoder=false)
Definition: videobuffers.cpp:136
MythHDRTracker::Create
static HDRTracker Create(class MythDisplay *MDisplay)
Create a tracker instance that looks for changes in the required EOTF.
Definition: mythhdrtracker.cpp:18
MythMainWindow
Definition: mythmainwindow.h:28
MythVideoOutput::m_deinterlacing2X
bool m_deinterlacing2X
Definition: mythvideoout.h:108
MythVideoOutput::m_videoBuffers
VideoBuffers m_videoBuffers
Definition: mythvideoout.h:101
MythVideoBounds::GetVideoAspect
float GetVideoAspect(void) const
Definition: mythvideobounds.h:81
MythVideoProfile::GetFilteredRenderers
static QStringList GetFilteredRenderers(const QString &Decoder, const QStringList &Renderers)
Definition: mythvideoprofile.cpp:1266
MythVideoOutput::m_videoColourSpace
MythVideoColourSpace m_videoColourSpace
Definition: mythvideoout.h:94
MythPainterGPU
Definition: mythpaintergpu.h:11
MythVideoBounds::SetWindowSize
void SetWindowSize(QSize Size)
Definition: mythvideobounds.cpp:619
MythVideoBounds::GetStereoOverride
StereoscopicMode GetStereoOverride() const
Definition: mythvideobounds.h:83
MythVideoOutputGPU::WindowResized
void WindowResized(QSize Size)
Definition: mythvideooutgpu.cpp:275
MythVideoBounds::m_display
MythDisplay * m_display
Definition: mythvideobounds.h:99
MythVideoOutput::m_deinterlacing
bool m_deinterlacing
Definition: mythvideoout.h:107