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)).arg(get_decoder_name(CodecID))
77  .arg(Decoder).arg(renderers.join(",")));
78  renderers = MythVideoProfile::GetFilteredRenderers(Decoder, renderers);
79  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Allowed renderers (filt: %1): %2")
80  .arg(Decoder).arg(renderers.join(",")));
81 
82  QString renderer;
83 
84  auto videoprofile = std::make_shared<MythVideoProfile>();
85 
86  if (!renderers.empty())
87  {
88  videoprofile->SetInput(VideoDispDim, FrameRate, Codec);
89  QString tmp = videoprofile->GetVideoRenderer();
90  if (videoprofile->IsDecoderCompatible(Decoder) && renderers.contains(tmp))
91  {
92  renderer = tmp;
93  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Preferred renderer: " + renderer);
94  }
95  else
96  {
97  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("No preferred renderer for decoder '%1' - profile renderer: '%2'")
98  .arg(Decoder).arg(tmp));
99  }
100  }
101 
102  if (renderer.isEmpty())
103  renderer = MythVideoProfile::GetBestVideoRenderer(renderers);
104 
105  if (renderer.isEmpty())
106  {
107  QString fallback;
108 #ifdef USING_OPENGL
109  if (Render->Type() == kRenderOpenGL)
110  fallback = "opengl";
111 #endif
112 #ifdef USING_VULKAN
113  if (Render->Type() == kRenderVulkan)
114  fallback = VULKAN_RENDERER;
115 #endif
116  LOG(VB_GENERAL, LOG_WARNING, LOC + "No renderer found. This should not happen!.");
117  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Falling back to '%1'").arg(fallback));
118  renderer = fallback;
119  }
120 
121  while (!renderers.empty())
122  {
123  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Trying video renderer: '%1'").arg(renderer));
124  int index = renderers.indexOf(renderer);
125  if (index >= 0)
126  renderers.removeAt(index);
127  else
128  break;
129 
130  MythVideoOutputGPU* video = nullptr;
131 
132 #ifdef _WIN32
133  if (renderer == "direct3d")
134  video = new VideoOutputD3D();
135 #endif
136 #ifdef USING_OPENGL
137  if (renderer.contains("opengl") && openglrender)
138  {
139  video = new MythVideoOutputOpenGL(MainWindow, openglrender,
140  openglpainter, Display,
141  videoprofile, renderer);
142  }
143 #endif
144 #ifdef USING_VULKAN
145  if (renderer.contains(VULKAN_RENDERER))
146  {
147  video = new MythVideoOutputVulkan(MainWindow, vulkanrender,
148  vulkanpainter, Display,
149  videoprofile, renderer);
150  }
151 #endif
152 
153  if (video)
154  {
155  video->SetVideoFrameRate(FrameRate);
156  video->SetReferenceFrames(ReferenceFrames);
157  if (video->Init(VideoDim, VideoDispDim, VideoAspect, MainWindow->GetUIScreenRect(), CodecID))
158  {
159  video->SetVideoScalingAllowed(true);
160  RenderFormats = video->m_renderFormats;
161  return video;
162  }
163  delete video;
164  video = nullptr;
165  }
166  renderer = MythVideoProfile::GetBestVideoRenderer(renderers);
167  }
168 
169  LOG(VB_GENERAL, LOG_ERR, LOC + "Not compiled with any useable video output method.");
170  return nullptr;
171 }
172 
174 {
175  if (codec_is_vaapi(CodecId)) return FMT_VAAPI;
176  if (codec_is_vdpau(CodecId)) return FMT_VDPAU;
177  if (codec_is_nvdec(CodecId)) return FMT_NVDEC;
178  if (codec_is_vtb(CodecId)) return FMT_VTB;
179  if (codec_is_mmal(CodecId)) return FMT_MMAL;
180  if (codec_is_v4l2(CodecId) || codec_is_drmprime(CodecId)) return FMT_DRMPRIME;
181  if (codec_is_mediacodec(CodecId)) return FMT_MEDIACODEC;
182  return FMT_NONE;
183 }
184 
198  MythPainterGPU* Painter, MythDisplay* Display,
199  MythVideoProfilePtr VideoProfile, QString& Profile)
200  : m_mainWindow(MainWindow),
201  m_render(Render),
202  m_painter(Painter),
203  m_profile(std::move(Profile))
204 {
205  if (!(m_mainWindow && m_render && m_painter && Display))
206  {
207  LOG(VB_GENERAL, LOG_ERR, "Fatal error");
208  return;
209  }
210 
211  m_videoProfile = std::move(VideoProfile);
212  m_render->IncrRef();
213  SetDisplay(Display);
215 
216  // If our rendering context is overlaid on top of a video plane, we need transparency
217  // and we need to ensure we are clearing the entire framebuffer.
218  // Note: an alpha of zero is probably safe to use everywhere. tbc.
219  if (m_display->IsPlanar())
220  {
221  m_clearAlpha = 0;
222  m_needFullClear = true;
223  }
224 
227  connect(this, &MythVideoOutputGPU::DoRefreshState,
237 }
238 
240 {
242  delete m_video;
243  if (m_painter)
245  if (m_render)
246  m_render->DecrRef();
247 }
248 
250 {
251  return GetDisplayVisibleRect();
252 }
253 
255 {
257 }
258 
259 void MythVideoOutputGPU::WindowResized(const QSize Size)
260 {
261  SetWindowSize(Size);
263 }
264 
266 {
267  if (!m_videoProfile)
268  return;
269 
270  if (qFuzzyCompare(m_videoProfile->GetOutput() + 1.0F, NewRate + 1.0F))
271  return;
272 
273  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Video frame rate changed: %1->%2")
274  .arg(static_cast<double>(m_videoProfile->GetOutput())).arg(static_cast<double>(NewRate)));
275  m_videoProfile->SetOutput(NewRate);
276  m_newFrameRate = true;
277 }
278 
279 bool MythVideoOutputGPU::Init(const QSize VideoDim, const QSize VideoDispDim,
280  float Aspect, const QRect DisplayVisibleRect, MythCodecID CodecId)
281 {
282  // if we are the main video player then free up as much video memory
283  // as possible at startup
284  if ((kCodec_NONE == m_newCodecId) && m_painter)
286 
287  // Default initialisation - mainly MythVideoBounds
288  if (!MythVideoOutput::Init(VideoDim, VideoDispDim, Aspect, DisplayVisibleRect, CodecId))
289  return false;
290 
291  // Ensure any new profile preferences are handled after a stream change
292  if (m_videoProfile)
293  m_video->SetProfile(m_videoProfile->GetVideoRenderer());
294 
295  // Set default support for picture attributes
297 
298  // Setup display
299  QSize size = GetVideoDim();
300 
301  // Set the display mode if required
303  ResizeForVideo(size);
305 
306  // Create buffers
308  if (!m_buffersCreated)
309  return false;
310 
311  // Adjust visible rect for embedding
312  QRect dvr = GetDisplayVisibleRectAdj();
314  {
315  m_render->SetViewPort(QRect(QPoint(), dvr.size()));
316  return true;
317  }
318 
319  // Reset OpenGLVideo
320  if (m_video->IsValid())
322 
323  return true;
324 }
325 
332 void MythVideoOutputGPU::DiscardFrames(bool KeyFrame, bool Flushed)
333 {
334  if (Flushed)
335  {
336  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("(%1): %2").arg(KeyFrame).arg(m_videoBuffers.GetStatus()));
338  }
339  MythVideoOutput::DiscardFrames(KeyFrame, Flushed);
340 }
341 
354 {
355  if (!Frame)
356  return;
357 
358  bool retain = MythVideoFrame::HardwareFormat(Frame->m_type);
359  QVector<MythVideoFrame*> release;
360 
363  {
365  if (!retain || (frame != Frame))
366  release.append(frame);
367  }
368 
369  if (retain)
370  {
374  }
375  else
376  {
377  release.append(Frame);
378  }
380 
381  for (auto * frame : release)
383 }
384 
386 {
387  if (m_buffersCreated)
388  return true;
389 
390  if (codec_is_copyback(CodecID))
391  {
393  return m_videoBuffers.CreateBuffers(FMT_YV12, Size.width(), Size.height(), m_renderFormats);
394  }
395 
396  if (codec_is_mediacodec(CodecID))
398  if (codec_is_vaapi(CodecID))
400  if (codec_is_vtb(CodecID))
401  return m_videoBuffers.CreateBuffers(FMT_VTB, m_renderFormats, Size, 1, 4, 2);
402  if (codec_is_vdpau(CodecID))
404  if (codec_is_nvdec(CodecID))
405  return m_videoBuffers.CreateBuffers(FMT_NVDEC, m_renderFormats, Size, 2, 1, 4);
406  if (codec_is_mmal(CodecID))
407  return m_videoBuffers.CreateBuffers(FMT_MMAL, m_renderFormats, Size, 2, 1, 4);
408  if (codec_is_v4l2(CodecID) || codec_is_drmprime(CodecID))
410 
412 }
413 
415 {
418  m_buffersCreated = false;
419 }
420 
421 void MythVideoOutputGPU::SetReferenceFrames(int ReferenceFrames)
422 {
423  m_maxReferenceFrames = ReferenceFrames;
424 }
425 
426 bool MythVideoOutputGPU::InputChanged(QSize VideoDim, QSize VideoDispDim,
427  float Aspect, MythCodecID CodecId, bool& AspectOnly, int ReferenceFrames,
428  bool ForceChange)
429 {
430  QSize currentvideodim = GetVideoDim();
431  QSize currentvideodispdim = GetVideoDispDim();
432  MythCodecID currentcodec = m_videoCodecID;
433  float currentaspect = GetVideoAspect();
434 
435  if (m_newCodecId != kCodec_NONE)
436  {
437  // InputChanged has been called twice in quick succession without a call to ProcessFrame
438  currentvideodim = m_newVideoDim;
439  currentvideodispdim = m_newVideoDispDim;
440  currentcodec = m_newCodecId;
441  currentaspect = m_newAspect;
442  }
443 
444  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Video changed: %1x%2 (%3x%4) '%5' (Aspect %6 Refs %13)"
445  "-> %7x%8 (%9x%10) '%11' (Aspect %12 Refs %14)")
446  .arg(currentvideodispdim.width()).arg(currentvideodispdim.height())
447  .arg(currentvideodim.width()).arg(currentvideodim.height())
448  .arg(toString(currentcodec)).arg(static_cast<double>(currentaspect))
449  .arg(VideoDispDim.width()).arg(VideoDispDim.height())
450  .arg(VideoDim.width()).arg(VideoDim.height())
451  .arg(toString(CodecId)).arg(static_cast<double>(Aspect))
452  .arg(m_maxReferenceFrames).arg(ReferenceFrames));
453 
454  bool cidchanged = (CodecId != currentcodec);
455  bool reschanged = (VideoDispDim != currentvideodispdim);
456  bool refschanged = m_maxReferenceFrames != ReferenceFrames;
457 
458  // aspect ratio changes are a no-op as changes are handled at display time
459  if (!(cidchanged || reschanged || refschanged || ForceChange))
460  {
461  AspectOnly = true;
462  return true;
463  }
464 
465  // N.B. We no longer check for interop support for the new codec as it is a
466  // poor substitute for a full check of decoder capabilities etc. Better to let
467  // hardware decoding fail if necessary - which should at least fallback to
468  // software decoding rather than bailing out here.
469 
470  // delete and recreate the buffers and flag that the input has changed
471  m_maxReferenceFrames = ReferenceFrames;
473  if (!m_buffersCreated)
474  return false;
475 
476  m_newCodecId= CodecId;
477  m_newVideoDim = VideoDim;
478  m_newVideoDispDim = VideoDispDim;
479  m_newAspect = Aspect;
480  return true;
481 }
482 
484 {
485  if (m_newCodecId != kCodec_NONE)
486  {
487  // Ensure we don't lose embedding through program changes.
488  bool wasembedding = IsEmbedding();
489  QRect oldrect;
490  if (wasembedding)
491  {
492  oldrect = GetEmbeddingRect();
493  EmbedPlayback(false, {});
494  }
495 
496  // Note - we don't call the default VideoOutput::InputChanged method as
497  // the OpenGL implementation is asynchronous.
498  // So we need to update the video display profile here. It is a little
499  // circular as we need to set the video dimensions first which are then
500  // reset in Init.
501  // All told needs a cleanup - not least because the use of codecName appears
502  // to be inconsistent.
504  AVCodecID avCodecId = myth2av_codecid(m_newCodecId);
505  AVCodec* codec = avcodec_find_decoder(avCodecId);
506  QString codecName;
507  if (codec)
508  codecName = codec->name;
509  if (m_videoProfile)
510  m_videoProfile->SetInput(GetVideoDispDim(), 0 , codecName);
513  m_newVideoDim = QSize();
514  m_newVideoDispDim = QSize();
515  m_newAspect = 0.0F;
516  m_newFrameRate = false;
517 
518  if (wasembedding && ok)
519  EmbedPlayback(true, oldrect);
520 
521  // Update deinterlacers for any input change
523 
524  if (!ok)
525  return false;
526  }
527  else if (m_newFrameRate)
528  {
529  // If we are switching mode purely for a refresh rate change, then there
530  // is no need to recreate buffers etc etc
531  ResizeForVideo();
532  m_newFrameRate = false;
533  }
534 
535  return true;
536 }
537 
544 {
545  if (!m_display)
546  return;
547 
548  // Retrieve the display aspect ratio.
549  // This will be, in priority order:-
550  // - aspect ratio override when using resolution/mode switching (if not 'Default')
551  // - aspect ratio override for setups where detection does not work/is broken (multiscreen, broken EDID etc)
552  // - aspect ratio based on detected physical size (this should be the common/default value)
553  // - aspect ratio fallback using screen resolution
554  // - 16:9
555  QString source;
556  double displayaspect = m_display->GetAspectRatio(source);
557  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Display aspect ratio: %1 (%2)")
558  .arg(displayaspect).arg(source));
559 
560  // Get the window and screen resolutions
561  QSize window = GetRawWindowRect().size();
562  QSize screen = m_display->GetResolution();
563 
564  // If not running fullscreen, adjust for window size and ignore any video
565  // mode overrides as they do not apply when in a window
566  if (!window.isEmpty() && !screen.isEmpty() && window != screen)
567  {
568  displayaspect = m_display->GetAspectRatio(source, true);
569  double screenaspect = screen.width() / static_cast<double>(screen.height());
570  double windowaspect = window.width() / static_cast<double>(window.height());
571  displayaspect = displayaspect * (1.0 / screenaspect) * windowaspect;
572  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Window aspect ratio: %1").arg(displayaspect));
573  }
574 
575  SetDisplayAspect(static_cast<float>(displayaspect));
576 }
577 
579 {
580  // Process input changes
581  if (!ProcessInputChange())
582  return;
583 
584  if (Frame)
585  {
586  SetRotation(Frame->m_rotation);
587  if (MythVideoFrame::HardwareFormat(Frame->m_type) || Frame->m_dummy)
588  return;
589 
590  // software deinterlacing
592 
593  // update software textures
594  if (m_video)
595  m_video->PrepareFrame(Frame, Scan);
596  }
597 }
598 
600 {
601  bool dummy = false;
602  bool topfieldfirst = false;
603  if (Frame)
604  {
605  m_framesPlayed = Frame->m_frameNumber + 1;
606  topfieldfirst = Frame->m_interlacedReverse ? !Frame->m_topFieldFirst : Frame->m_topFieldFirst;
607  dummy = Frame->m_dummy;
608  }
609  else
610  {
611  // see DoneDisplayingFrame
612  // we only retain pause frames for hardware formats
615  }
616 
617  // Main UI when embedded
618  if (m_painter && IsEmbedding())
619  {
620  // If we are using high dpi, the painter needs to set the appropriate
621  // viewport and enable scaling of its images
623 
625  {
626  m_mainWindow->GetPaintWindow()->clearMask();
628  }
630  }
631 
632  // Video
633  // N.B. dummy streams need the viewport updated in case we have resized the window (i.e. LiveTV)
634  if (m_video && !dummy)
635  m_video->RenderFrame(Frame, topfieldfirst, Scan, GetStereoOverride());
636  else if (dummy)
638 }
639 
641 {
642  if (!IsEmbedding())
644 }
645 
646 void MythVideoOutputGPU::UpdatePauseFrame(int64_t& DisplayTimecode, FrameScanType Scan)
647 {
648  MythVideoFrame* release = nullptr;
651  if (used)
652  {
654  {
656  }
657  else
658  {
660  m_deinterlacer.Filter(used, Scan, m_videoProfile.get(), true);
661  if (m_video)
662  m_video->PrepareFrame(used, Scan);
663  }
664  DisplayTimecode = used->m_displayTimecode;
665  }
666  else
667  {
668  LOG(VB_PLAYBACK, LOG_WARNING, LOC + "Could not update pause frame");
669  }
671 
672  if (release)
673  DoneDisplayingFrame(release);
674 }
675 
677 {
678  m_video->EndFrame();
679 }
680 
682 {
683  // Clear reference frames for GPU deinterlacing
684  if (m_video)
686  // Clear decoded frames
688 }
689 
702 {
703  if (!m_display)
704  return;
705  if (!m_display->UsingVideoModes())
706  return;
707 
708  if (Size.isEmpty())
709  {
710  Size = GetVideoDispDim();
711  if (Size.isEmpty())
712  return;
713  }
714 
715  float rate = m_videoProfile ? m_videoProfile->GetOutput() : 0.0F;
716 
717  bool hide = m_display->NextModeIsLarger(Size);
718  if (hide)
719  m_mainWindow->hide();
720 
721  if (m_display->SwitchToVideo(Size, static_cast<double>(rate)))
722  {
723  // Switching to custom display resolution succeeded
724  // Make a note of the new size
725  QString source;
726  double aspect = m_display->GetAspectRatio(source);
727  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Aspect ratio: %1 (%2)")
728  .arg(aspect).arg(source));
729  SetDisplayAspect(static_cast<float>(aspect));
731 
732  bool fullscreen = !UsingGuiSize();
733 
734  // if width && height are zero users expect fullscreen playback
735  if (!fullscreen)
736  {
737  int gui_width = 0;
738  int gui_height = 0;
739  gCoreContext->GetResolutionSetting("Gui", gui_width, gui_height);
740  fullscreen |= (0 == gui_width && 0 == gui_height);
741  }
742 
743  if (fullscreen)
744  {
745  QSize size = m_display->GetResolution();
746  QRect display_visible_rect = QRect(m_mainWindow->geometry().topLeft(), size);
747  if (hide)
748  {
749  m_mainWindow->Show();
750  hide = false;
751  }
752  m_mainWindow->MoveResize(display_visible_rect);
753  }
754  }
755  if (hide)
756  m_mainWindow->Show();
757 }
FMT_MEDIACODEC
@ FMT_MEDIACODEC
Definition: mythframe.h:59
codec_is_copyback
#define codec_is_copyback(id)
Definition: mythcodecid.h:344
MythVideoOutputGPU::InitPictureAttributes
void InitPictureAttributes() override
Definition: mythvideooutgpu.cpp:254
MythOpenGLPainter
Definition: mythpainteropengl.h:23
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:332
MythVideoOutputGPU::SetVideoFrameRate
void SetVideoFrameRate(float NewRate) override
Definition: mythvideooutgpu.cpp:265
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:192
MythVideoOutputGPU::InitDisplayMeasurements
void InitDisplayMeasurements()
Initialise display measurement.
Definition: mythvideooutgpu.cpp:543
FMT_VTB
@ FMT_VTB
Definition: mythframe.h:60
MythDisplay::IsPlanar
virtual bool IsPlanar()
Definition: mythdisplay.h:30
MythVideoOutputGPU::DestroyBuffers
void DestroyBuffers()
Definition: mythvideooutgpu.cpp:414
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:62
mythpaintergpu.h
VideoBuffers::Remove
void Remove(BufferType Type, MythVideoFrame *Frame)
Definition: videobuffers.cpp:684
MythVideoOutput::m_framesPlayed
long long m_framesPlayed
Definition: mythvideoout.h:104
VULKAN_RENDERER
#define VULKAN_RENDERER
Definition: mythvideooutputvulkan.h:11
MythVideoBounds::GetDisplayVisibleRect
QRect GetDisplayVisibleRect(void) const
Definition: mythvideobounds.h:73
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:426
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
arg
arg(title).arg(filename).arg(doDelete))
VideoBuffers::DiscardAndRecreate
bool DiscardAndRecreate(MythCodecID CodecID, QSize VideoDim, int References)
Discard all buffers and recreate.
Definition: videobuffers.cpp:482
FrameScanType
FrameScanType
Definition: videoouttypes.h: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:110
kRenderOpenGL
@ kRenderOpenGL
Definition: mythrender_base.h:19
MythMainWindow::Show
void Show()
Definition: mythmainwindow.cpp:964
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:797
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:128
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythVideoFrame::HardwareFormat
static bool HardwareFormat(VideoFrameType Type)
Definition: mythframe.h:421
mythplayer.h
MythVideoOutputGPU::ClearAfterSeek
void ClearAfterSeek() override
Tells video output to toss decoded buffers due to a seek.
Definition: mythvideooutgpu.cpp:681
PlayerFlags
PlayerFlags
Definition: mythplayer.h:62
MythVideoBounds::UsingGuiSize
bool UsingGuiSize(void) const
Definition: mythvideobounds.h:79
MythMainWindow::Draw
void Draw(MythPainter *Painter=nullptr)
Definition: mythmainwindow.cpp:433
mythpaintervulkan.h
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:701
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
video
QDomElement video
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:661
MythVideoOutputGPU::Init
bool Init(QSize VideoDim, QSize VideoDispDim, float Aspect, QRect DisplayVisibleRect, MythCodecID CodecId) override
Definition: mythvideooutgpu.cpp:279
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:20
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:353
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:65
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:972
mythlogging.h
codec_is_mediacodec
#define codec_is_mediacodec(id)
Definition: mythcodecid.h:323
RenderOptions
Definition: mythvideoprofile.h:41
MythVideoOutput::m_clearAlpha
uint8_t m_clearAlpha
Definition: mythvideoout.h:98
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
MythVideoOutputGPU::RenderOverlays
void RenderOverlays(OSD &Osd) override
Definition: mythvideooutgpu.cpp:640
OSD::Draw
void Draw(QRect Rect)
Definition: osd.cpp:450
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:269
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:22
MythVideoFrame::m_alreadyDeinterlaced
bool m_alreadyDeinterlaced
Definition: mythframe.h:151
MythVideoFrame::m_displayTimecode
int64_t m_displayTimecode
Definition: mythframe.h:129
VideoFrameTypes
std::vector< VideoFrameType > VideoFrameTypes
Definition: mythframe.h:81
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:101
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
MythVideoOutputGPU::UpdatePauseFrame
void UpdatePauseFrame(int64_t &DisplayTimecode, FrameScanType Scan=kScan_Progressive) override
Definition: mythvideooutgpu.cpp:646
MythCoreContext::GetResolutionSetting
void GetResolutionSetting(const QString &type, int &width, int &height, double &forced_aspect, double &refresh_rate, int index=-1)
Definition: mythcorecontext.cpp:870
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:648
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:112
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:428
MythVideoOutput::m_videoCodecID
MythCodecID m_videoCodecID
Definition: mythvideoout.h:99
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:141
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:421
MythVideoBounds::GetVideoDispDim
QSize GetVideoDispDim(void) const
Definition: mythvideobounds.h:71
MythVideoGPU::EndFrame
virtual void EndFrame()=0
MythDisplay
Definition: mythdisplay.h:21
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:578
mythvideogpu.h
MythVideoOutputGPU::m_needFullClear
bool m_needFullClear
Definition: mythvideooutgpu.h:79
MythVideoOutput::m_deinterlacer
MythDeinterlacer m_deinterlacer
Definition: mythvideoout.h:106
MythVideoOutputGPU::FrameTypeForCodec
static VideoFrameType FrameTypeForCodec(MythCodecID CodecId)
Definition: mythvideooutgpu.cpp:173
ALL_PICTURE_ATTRIBUTES
#define ALL_PICTURE_ATTRIBUTES
Definition: videoouttypes.h:127
MythVideoOutputGPU::ProcessInputChange
bool ProcessInputChange()
Definition: mythvideooutgpu.cpp:483
MythVideoOutputVulkan::GetRenderOptions
static void GetRenderOptions(RenderOptions &Options)
Definition: mythvideooutputvulkan.cpp:13
FMT_NVDEC
@ FMT_NVDEC
Definition: mythframe.h:61
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:31
MythRenderOpenGL
Definition: mythrenderopengl.h:96
MythVideoOutputGPU::ChangePictureAttribute
void ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value)
kVideoIsNull
@ kVideoIsNull
Definition: mythplayer.h:71
MythVideoOutput::m_renderFormats
const VideoFrameTypes * m_renderFormats
Definition: mythvideoout.h:107
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:628
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:283
FMT_VDPAU
@ FMT_VDPAU
Definition: mythframe.h:55
kScan_Interlaced
@ kScan_Interlaced
Definition: videoouttypes.h:98
kVideoBuffer_used
@ kVideoBuffer_used
Definition: videobuffers.h:30
MythRender
Definition: mythrender_base.h:23
MythVideoFrame::m_type
VideoFrameType m_type
Definition: mythframe.h:116
MythPainter
Definition: mythpainter.h:32
MythVideoOutputGPU::MythVideoOutputGPU
MythVideoOutputGPU(MythMainWindow *MainWindow, MythRender *Render, MythPainterGPU *Painter, MythDisplay *Display, MythVideoProfilePtr VideoProfile, QString &Profile)
Definition: mythvideooutgpu.cpp:197
codec_is_vaapi
#define codec_is_vaapi(id)
Definition: mythcodecid.h:311
MythVideoOutputGPU::RenderFrame
void RenderFrame(MythVideoFrame *Frame, FrameScanType Scan) override
Definition: mythvideooutgpu.cpp:599
MythVideoOutputVulkan
Definition: mythvideooutputvulkan.h:13
MythVideoOutputGPU::CreateBuffers
bool CreateBuffers(MythCodecID CodecID, QSize Size)
Definition: mythvideooutgpu.cpp:385
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
mythvideooutopengl.h
MythVideoOutputGPU
Common code shared between GPU accelerated sub-classes (e.g. OpenGL)
Definition: mythvideooutgpu.h:11
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:58
MythVideoGPU::ResetFrameFormat
virtual void ResetFrameFormat()
Definition: mythvideogpu.cpp:96
VideoFrameType
VideoFrameType
Definition: mythframe.h:18
FMT_VAAPI
@ FMT_VAAPI
Definition: mythframe.h:56
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:249
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:975
MythVideoBounds::GetWindowRect
QRect GetWindowRect(void) const
Definition: mythvideobounds.h:74
MythDisplay::UsingVideoModes
virtual bool UsingVideoModes()
Definition: mythdisplay.h:29
MythVideoOutput::SetDeinterlacing
virtual void SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force=DEINT_NONE)
Definition: mythvideoout.cpp:140
MythVideoFrame
Definition: mythframe.h:85
VideoOutputD3D
Definition: videoout_d3d.h:15
MythVideoBounds::GetRawWindowRect
QRect GetRawWindowRect(void) const
Definition: mythvideobounds.h:75
MythVideoOutputGPU::~MythVideoOutputGPU
~MythVideoOutputGPU() override
Definition: mythvideooutgpu.cpp:239
MythVideoOutput::m_maxReferenceFrames
int m_maxReferenceFrames
Definition: mythvideoout.h:100
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
kRenderDirect3D9
@ kRenderDirect3D9
Definition: mythrender_base.h:18
VideoBuffers::Size
uint Size(BufferType Type) const
Definition: videobuffers.cpp:741
MythVideoOutputGPU::EndFrame
void EndFrame() override
Definition: mythvideooutgpu.cpp:676
OSD
Definition: osd.h:94
VideoBuffers::GetNumBuffers
static uint GetNumBuffers(int PixelFormat, int MaxReferenceFrames=16, bool Decoder=false)
Definition: videobuffers.cpp:135
MythMainWindow
Definition: mythmainwindow.h:34
VideoOutputD3D::GetAllowedRenderers
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
Definition: videoout_d3d.cpp:605
MythVideoOutput::m_deinterlacing2X
bool m_deinterlacing2X
Definition: mythvideoout.h:109
MythVideoOutput::m_videoBuffers
VideoBuffers m_videoBuffers
Definition: mythvideoout.h:102
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:95
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:259
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:108