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