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