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  // cppcheck-suppress knownConditionTrueFalse
140  if (!video && renderer.contains("opengl") && openglrender)
141  {
142  video = new MythVideoOutputOpenGL(MainWindow, openglrender,
143  openglpainter, Display,
144  videoprofile, renderer);
145  }
146 #endif
147 #ifdef USING_VULKAN
148  if (!video && renderer.contains(VULKAN_RENDERER))
149  {
150  video = new MythVideoOutputVulkan(MainWindow, vulkanrender,
151  vulkanpainter, Display,
152  videoprofile, renderer);
153  }
154 #endif
155 
156  if (video)
157  {
159  video->SetReferenceFrames(ReferenceFrames);
160  if (video->Init(VideoDim, VideoDispDim, VideoAspect, MainWindow->GetUIScreenRect(), CodecID))
161  {
162  video->SetVideoScalingAllowed(true);
163  RenderFormats = video->m_renderFormats;
164  return video;
165  }
166  delete video;
167  video = nullptr;
168  }
169  renderer = MythVideoProfile::GetBestVideoRenderer(renderers);
170  }
171 
172  LOG(VB_GENERAL, LOG_ERR, LOC + "Not compiled with any useable video output method.");
173  return nullptr;
174 }
175 
177 {
178  if (codec_is_vaapi(CodecId)) return FMT_VAAPI;
179  if (codec_is_vdpau(CodecId)) return FMT_VDPAU;
180  if (codec_is_nvdec(CodecId)) return FMT_NVDEC;
181  if (codec_is_vtb(CodecId)) return FMT_VTB;
182  if (codec_is_mmal(CodecId)) return FMT_MMAL;
183  if (codec_is_v4l2(CodecId) || codec_is_drmprime(CodecId)) return FMT_DRMPRIME;
184  if (codec_is_mediacodec(CodecId)) return FMT_MEDIACODEC;
185  return FMT_NONE;
186 }
187 
201  MythPainterGPU* Painter, MythDisplay* Display,
202  MythVideoProfilePtr VideoProfile, QString& Profile)
203  : m_mainWindow(MainWindow),
204  m_render(Render),
205  m_painter(Painter),
206  m_profile(std::move(Profile))
207 {
208  if (!(m_mainWindow && m_render && m_painter && Display))
209  {
210  LOG(VB_GENERAL, LOG_ERR, "Fatal error");
211  return;
212  }
213 
214  m_videoProfile = std::move(VideoProfile);
215  m_render->IncrRef();
216  SetDisplay(Display);
218 
219  // If our rendering context is overlaid on top of a video plane, we need transparency
220  // and we need to ensure we are clearing the entire framebuffer.
221  // Note: an alpha of zero is probably safe to use everywhere. tbc.
222  if (m_display->IsPlanar())
223  {
224  m_clearAlpha = 0;
225  m_needFullClear = true;
226  }
227 
229 
232  connect(this, &MythVideoOutputGPU::DoRefreshState,
242 }
243 
245 {
246  m_hdrTracker = nullptr;
247 
249  delete m_video;
250  if (m_painter)
252  if (m_render)
253  m_render->DecrRef();
254 }
255 
257 {
258  return GetDisplayVisibleRect();
259 }
260 
262 {
264 }
265 
266 void MythVideoOutputGPU::WindowResized(const QSize Size)
267 {
268  SetWindowSize(Size);
270 }
271 
273 {
274  if (!m_videoProfile)
275  return;
276 
277  if (qFuzzyCompare(m_videoProfile->GetOutput() + 1.0F, NewRate + 1.0F))
278  return;
279 
280  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Video frame rate changed: %1->%2")
281  .arg(static_cast<double>(m_videoProfile->GetOutput())).arg(static_cast<double>(NewRate)));
282  m_videoProfile->SetOutput(NewRate);
283  m_newFrameRate = true;
284 }
285 
286 bool MythVideoOutputGPU::Init(const QSize VideoDim, const QSize VideoDispDim,
287  float Aspect, const QRect DisplayVisibleRect, MythCodecID CodecId)
288 {
289  // if we are the main video player then free up as much video memory
290  // as possible at startup
291  if ((kCodec_NONE == m_newCodecId) && m_painter)
293 
294  // Default initialisation - mainly MythVideoBounds
295  if (!MythVideoOutput::Init(VideoDim, VideoDispDim, Aspect, DisplayVisibleRect, CodecId))
296  return false;
297 
298  // Ensure any new profile preferences are handled after a stream change
299  if (m_videoProfile)
300  m_video->SetProfile(m_videoProfile->GetVideoRenderer());
301 
302  // Set default support for picture attributes
304 
305  // Setup display
306  QSize size = GetVideoDim();
307 
308  // Set the display mode if required
310  ResizeForVideo(size);
312 
313  // Create buffers
315  if (!m_buffersCreated)
316  return false;
317 
318  // Adjust visible rect for embedding
319  QRect dvr = GetDisplayVisibleRectAdj();
321  {
322  m_render->SetViewPort(QRect(QPoint(), dvr.size()));
323  return true;
324  }
325 
326  // Reset OpenGLVideo
327  if (m_video->IsValid())
329 
330  return true;
331 }
332 
339 void MythVideoOutputGPU::DiscardFrames(bool KeyFrame, bool Flushed)
340 {
341  if (Flushed)
342  {
343  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("(%1): %2").arg(KeyFrame).arg(m_videoBuffers.GetStatus()));
345  }
346  MythVideoOutput::DiscardFrames(KeyFrame, Flushed);
347 }
348 
361 {
362  if (!Frame)
363  return;
364 
365  auto retain = MythVideoFrame::HardwareFormat(Frame->m_type);
366  QVector<MythVideoFrame*> release;
367 
370  {
371  auto * frame = m_videoBuffers.Dequeue(kVideoBuffer_pause);
372  if (!retain || (frame != Frame))
373  release.append(frame);
374  }
375 
376  if (retain)
377  {
381  }
382  else
383  {
384  release.append(Frame);
385  }
387 
388  for (auto * frame : release)
390 }
391 
393 {
394  if (m_buffersCreated)
395  return true;
396 
397  if (codec_is_copyback(CodecID))
398  {
400  return m_videoBuffers.CreateBuffers(FMT_YV12, Size.width(), Size.height(), m_renderFormats);
401  }
402 
403  if (codec_is_mediacodec(CodecID))
405  if (codec_is_vaapi(CodecID))
407  if (codec_is_vtb(CodecID))
408  return m_videoBuffers.CreateBuffers(FMT_VTB, m_renderFormats, Size, 1, 4, 2);
409  if (codec_is_vdpau(CodecID))
411  if (codec_is_nvdec(CodecID))
412  return m_videoBuffers.CreateBuffers(FMT_NVDEC, m_renderFormats, Size, 2, 1, 4);
413  if (codec_is_mmal(CodecID))
414  return m_videoBuffers.CreateBuffers(FMT_MMAL, m_renderFormats, Size, 2, 1, 4);
415  if (codec_is_v4l2(CodecID) || codec_is_drmprime(CodecID))
417 
419 }
420 
422 {
425  m_buffersCreated = false;
426 }
427 
428 void MythVideoOutputGPU::SetReferenceFrames(int ReferenceFrames)
429 {
430  m_maxReferenceFrames = ReferenceFrames;
431 }
432 
433 bool MythVideoOutputGPU::InputChanged(QSize VideoDim, QSize VideoDispDim,
434  float VideoAspect, MythCodecID CodecId,
435  bool& AspectOnly, int ReferenceFrames,
436  bool ForceChange)
437 {
438  QSize currentvideodim = GetVideoDim();
439  QSize currentvideodispdim = GetVideoDispDim();
440  MythCodecID currentcodec = m_videoCodecID;
441  float currentaspect = GetVideoAspect();
442 
443  if (m_newCodecId != kCodec_NONE)
444  {
445  // InputChanged has been called twice in quick succession without a call to ProcessFrame
446  currentvideodim = m_newVideoDim;
447  currentvideodispdim = m_newVideoDispDim;
448  currentcodec = m_newCodecId;
449  currentaspect = m_newAspect;
450  }
451 
452  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Video changed: %1x%2 (%3x%4) '%5' (Aspect %6 Refs %13)"
453  "-> %7x%8 (%9x%10) '%11' (Aspect %12 Refs %14)")
454  .arg(currentvideodispdim.width()).arg(currentvideodispdim.height())
455  .arg(currentvideodim.width()).arg(currentvideodim.height())
456  .arg(toString(currentcodec)).arg(static_cast<double>(currentaspect))
457  .arg(VideoDispDim.width()).arg(VideoDispDim.height())
458  .arg(VideoDim.width()).arg(VideoDim.height())
459  .arg(toString(CodecId)).arg(static_cast<double>(VideoAspect))
460  .arg(m_maxReferenceFrames).arg(ReferenceFrames));
461 
462  bool cidchanged = (CodecId != currentcodec);
463  bool reschanged = (VideoDispDim != currentvideodispdim);
464  bool refschanged = m_maxReferenceFrames != ReferenceFrames;
465 
466  // aspect ratio changes are a no-op as changes are handled at display time
467  if (!(cidchanged || reschanged || refschanged || ForceChange))
468  {
469  AspectOnly = true;
470  return true;
471  }
472 
473  // N.B. We no longer check for interop support for the new codec as it is a
474  // poor substitute for a full check of decoder capabilities etc. Better to let
475  // hardware decoding fail if necessary - which should at least fallback to
476  // software decoding rather than bailing out here.
477 
478  // delete and recreate the buffers and flag that the input has changed
479  m_maxReferenceFrames = ReferenceFrames;
481  if (!m_buffersCreated)
482  return false;
483 
484  m_newCodecId= CodecId;
485  m_newVideoDim = VideoDim;
486  m_newVideoDispDim = VideoDispDim;
487  m_newAspect = VideoAspect;
488  return true;
489 }
490 
492 {
493  if (m_newCodecId != kCodec_NONE)
494  {
495  // Ensure we don't lose embedding through program changes.
496  bool wasembedding = IsEmbedding();
497  QRect oldrect;
498  if (wasembedding)
499  {
500  oldrect = GetEmbeddingRect();
501  EmbedPlayback(false, {});
502  }
503 
504  // Note - we don't call the default VideoOutput::InputChanged method as
505  // the OpenGL implementation is asynchronous.
506  // So we need to update the video display profile here. It is a little
507  // circular as we need to set the video dimensions first which are then
508  // reset in Init.
509  // All told needs a cleanup - not least because the use of codecName appears
510  // to be inconsistent.
512  AVCodecID avCodecId = myth2av_codecid(m_newCodecId);
513  AVCodec* codec = avcodec_find_decoder(avCodecId);
514  QString codecName;
515  if (codec)
516  codecName = codec->name;
517  if (m_videoProfile)
518  m_videoProfile->SetInput(GetVideoDispDim(), 0 , codecName);
521  m_newVideoDim = QSize();
522  m_newVideoDispDim = QSize();
523  m_newAspect = 0.0F;
524  m_newFrameRate = false;
525 
526  if (wasembedding && ok)
527  EmbedPlayback(true, oldrect);
528 
529  // Update deinterlacers for any input change
531 
532  if (!ok)
533  return false;
534  }
535  else if (m_newFrameRate)
536  {
537  // If we are switching mode purely for a refresh rate change, then there
538  // is no need to recreate buffers etc etc
539  ResizeForVideo();
540  m_newFrameRate = false;
541  }
542 
543  return true;
544 }
545 
552 {
553  if (!m_display)
554  return;
555 
556  // Retrieve the display aspect ratio.
557  // This will be, in priority order:-
558  // - aspect ratio override when using resolution/mode switching (if not 'Default')
559  // - aspect ratio override for setups where detection does not work/is broken (multiscreen, broken EDID etc)
560  // - aspect ratio based on detected physical size (this should be the common/default value)
561  // - aspect ratio fallback using screen resolution
562  // - 16:9
563  QString source;
564  double displayaspect = m_display->GetAspectRatio(source);
565  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Display aspect ratio: %1 (%2)")
566  .arg(displayaspect).arg(source));
567 
568  // Get the window and screen resolutions
569  QSize window = GetRawWindowRect().size();
570  QSize screen = m_display->GetResolution();
571 
572  // If not running fullscreen, adjust for window size and ignore any video
573  // mode overrides as they do not apply when in a window
574  if (!window.isEmpty() && !screen.isEmpty() && window != screen)
575  {
576  displayaspect = m_display->GetAspectRatio(source, true);
577  double screenaspect = screen.width() / static_cast<double>(screen.height());
578  double windowaspect = window.width() / static_cast<double>(window.height());
579  displayaspect = displayaspect * (1.0 / screenaspect) * windowaspect;
580  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Window aspect ratio: %1").arg(displayaspect));
581  }
582 
583  SetDisplayAspect(static_cast<float>(displayaspect));
584 }
585 
587 {
588  // Process input changes
589  if (!ProcessInputChange())
590  return;
591 
592  if (Frame)
593  {
594  SetRotation(Frame->m_rotation);
595 
596  if (m_hdrTracker)
597  m_hdrTracker->Update(Frame);
598 
599  if (MythVideoFrame::HardwareFormat(Frame->m_type) || Frame->m_dummy)
600  return;
601 
602  // software deinterlacing
604 
605  // update software textures
606  if (m_video)
607  m_video->PrepareFrame(Frame, Scan);
608  }
609 }
610 
612 {
613  bool dummy = false;
614  bool topfieldfirst = false;
615  if (Frame)
616  {
617  m_framesPlayed = Frame->m_frameNumber + 1;
618  topfieldfirst = Frame->m_interlacedReverse ? !Frame->m_topFieldFirst : Frame->m_topFieldFirst;
619  dummy = Frame->m_dummy;
620  }
621  else
622  {
623  // see DoneDisplayingFrame
624  // we only retain pause frames for hardware formats
627  }
628 
629  // Main UI when embedded
630  if (m_painter && IsEmbedding())
631  {
632  // If we are using high dpi, the painter needs to set the appropriate
633  // viewport and enable scaling of its images
635 
637  {
638  m_mainWindow->GetPaintWindow()->clearMask();
640  }
642  }
643 
644  // Video
645  // N.B. dummy streams need the viewport updated in case we have resized the window (i.e. LiveTV)
646  if (m_video && !dummy)
647  m_video->RenderFrame(Frame, topfieldfirst, Scan, GetStereoOverride());
648  else if (dummy)
650 }
651 
652 void MythVideoOutputGPU::UpdatePauseFrame(std::chrono::milliseconds& DisplayTimecode, FrameScanType Scan)
653 {
654  MythVideoFrame* release = nullptr;
657  if (used)
658  {
660  {
662  }
663  else
664  {
666  m_deinterlacer.Filter(used, Scan, m_videoProfile.get(), true);
667  if (m_video)
668  m_video->PrepareFrame(used, Scan);
669  }
670  DisplayTimecode = used->m_displayTimecode;
671  }
672  else
673  {
674  LOG(VB_PLAYBACK, LOG_WARNING, LOC + "Could not update pause frame");
675  }
677 
678  if (release)
679  DoneDisplayingFrame(release);
680 }
681 
683 {
684  m_video->EndFrame();
685 }
686 
688 {
689  // Clear reference frames for GPU deinterlacing
690  if (m_video)
692  // Clear decoded frames
694 }
695 
708 {
709  if (!m_display)
710  return;
711  if (!m_display->UsingVideoModes())
712  return;
713 
714  if (Size.isEmpty())
715  {
716  Size = GetVideoDispDim();
717  if (Size.isEmpty())
718  return;
719  }
720 
721  float rate = m_videoProfile ? m_videoProfile->GetOutput() : 0.0F;
722 
723  bool hide = m_display->NextModeIsLarger(Size);
724  if (hide)
725  m_mainWindow->hide();
726 
727  if (m_display->SwitchToVideo(Size, static_cast<double>(rate)))
728  {
729  // Switching to custom display resolution succeeded
730  // Make a note of the new size
731  QString source;
732  double aspect = m_display->GetAspectRatio(source);
733  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Aspect ratio: %1 (%2)")
734  .arg(aspect).arg(source));
735  SetDisplayAspect(static_cast<float>(aspect));
737 
738  bool fullscreen = !UsingGuiSize();
739 
740  // if width && height are zero users expect fullscreen playback
741  if (!fullscreen)
742  {
743  int gui_width = 0;
744  int gui_height = 0;
745  gCoreContext->GetResolutionSetting("Gui", gui_width, gui_height);
746  fullscreen |= (0 == gui_width && 0 == gui_height);
747  }
748 
749  if (fullscreen)
750  {
751  QSize size = m_display->GetResolution();
752  QRect display_visible_rect = QRect(m_mainWindow->geometry().topLeft(), size);
753  if (hide)
754  {
755  m_mainWindow->Show();
756  hide = false;
757  }
758  m_mainWindow->MoveResize(display_visible_rect);
759  }
760  }
761  if (hide)
762  m_mainWindow->Show();
763 }
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:261
MythOpenGLPainter
Definition: mythpainteropengl.h:28
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:339
MythVideoOutputGPU::SetVideoFrameRate
void SetVideoFrameRate(float NewRate) override
Definition: mythvideooutgpu.cpp:272
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:551
FMT_VTB
@ FMT_VTB
Definition: mythframe.h:62
MythDisplay::IsPlanar
virtual bool IsPlanar()
Definition: mythdisplay.h:31
MythVideoOutputGPU::DestroyBuffers
void DestroyBuffers()
Definition: mythvideooutgpu.cpp:421
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
MythVideoGPU::IsValid
bool IsValid() const
Definition: mythvideogpu.cpp:73
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:954
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:687
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:433
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:707
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:286
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:360
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:25
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:652
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:875
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:265
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:61
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:428
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:586
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:176
ALL_PICTURE_ATTRIBUTES
#define ALL_PICTURE_ATTRIBUTES
Definition: videoouttypes.h:127
MythVideoOutputGPU::ProcessInputChange
bool ProcessInputChange()
Definition: mythvideooutgpu.cpp:491
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:100
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
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:433
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:200
codec_is_vaapi
#define codec_is_vaapi(id)
Definition: mythcodecid.h:311
MythVideoOutputGPU::RenderFrame
void RenderFrame(MythVideoFrame *Frame, FrameScanType Scan) override
Definition: mythvideooutgpu.cpp:611
std
Definition: mythchrono.h:23
MythVideoOutputVulkan
Definition: mythvideooutputvulkan.h:13
MythVideoOutputGPU::CreateBuffers
bool CreateBuffers(MythCodecID CodecID, QSize Size)
Definition: mythvideooutgpu.cpp:392
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:78
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:98
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:256
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:965
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:244
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:682
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:266
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