MythTV  master
mythvideooutopengl.cpp
Go to the documentation of this file.
1 // C/C++
2 #include <utility>
3 
4 // MythTV
5 #include "mythcontext.h"
6 #include "mythmainwindow.h"
7 #include "mythplayer.h"
8 #include "videodisplayprofile.h"
9 #include "osd.h"
10 #include "mythuihelper.h"
11 #include "opengl/mythopenglperf.h"
14 #include "mythcodeccontext.h"
15 #include "mythopenglinterop.h"
16 #include "mythvideooutopengl.h"
17 
18 #define LOC QString("VidOutGL: ")
19 
27 {
28  QStringList safe;
29  safe << "opengl" << "opengl-yv12";
30 
31  // all profiles can handle all software frames
32  (*Options.safe_renderers)["dummy"].append(safe);
33  (*Options.safe_renderers)["nuppel"].append(safe);
34  if (Options.decoders->contains("ffmpeg"))
35  (*Options.safe_renderers)["ffmpeg"].append(safe);
36  if (Options.decoders->contains("mediacodec-dec"))
37  (*Options.safe_renderers)["mediacodec-dec"].append(safe);
38  if (Options.decoders->contains("vaapi-dec"))
39  (*Options.safe_renderers)["vaapi-dec"].append(safe);
40  if (Options.decoders->contains("vdpau-dec"))
41  (*Options.safe_renderers)["vdpau-dec"].append(safe);
42  if (Options.decoders->contains("nvdec-dec"))
43  (*Options.safe_renderers)["nvdec-dec"].append(safe);
44  if (Options.decoders->contains("vtb-dec"))
45  (*Options.safe_renderers)["vtb-dec"].append(safe);
46  if (Options.decoders->contains("v4l2-dec"))
47  (*Options.safe_renderers)["v4l2-dec"].append(safe);
48  if (Options.decoders->contains("mmal-dec"))
49  (*Options.safe_renderers)["mmal-dec"].append(safe);
50 
51  // OpenGL UYVY
52  Options.renderers->append("opengl");
53  Options.priorities->insert("opengl", 65);
54 
55  // OpenGL YV12
56  Options.renderers->append("opengl-yv12");
57  Options.priorities->insert("opengl-yv12", 65);
58 
59 #if defined(USING_VAAPI) || defined (USING_VTB) || defined (USING_MEDIACODEC) || defined (USING_VDPAU) || defined (USING_NVDEC) || defined (USING_MMAL) || defined (USING_V4L2PRIME) || defined (USING_EGL)
60  Options.renderers->append("opengl-hw");
61  (*Options.safe_renderers)["dummy"].append("opengl-hw");
62  (*Options.safe_renderers)["nuppel"].append("opengl-hw");
63  Options.priorities->insert("opengl-hw", 110);
64 #endif
65 #ifdef USING_VAAPI
66  if (Options.decoders->contains("vaapi"))
67  (*Options.safe_renderers)["vaapi"].append("opengl-hw");
68 #endif
69 #ifdef USING_VTB
70  if (Options.decoders->contains("vtb"))
71  (*Options.safe_renderers)["vtb"].append("opengl-hw");
72 #endif
73 #ifdef USING_MEDIACODEC
74  if (Options.decoders->contains("mediacodec"))
75  (*Options.safe_renderers)["mediacodec"].append("opengl-hw");
76 #endif
77 #ifdef USING_VDPAU
78  if (Options.decoders->contains("vdpau"))
79  (*Options.safe_renderers)["vdpau"].append("opengl-hw");
80 #endif
81 #ifdef USING_NVDEC
82  if (Options.decoders->contains("nvdec"))
83  (*Options.safe_renderers)["nvdec"].append("opengl-hw");
84 #endif
85 #ifdef USING_MMAL
86  if (Options.decoders->contains("mmal"))
87  (*Options.safe_renderers)["mmal"].append("opengl-hw");
88 #endif
89 #ifdef USING_V4L2PRIME
90  if (Options.decoders->contains("v4l2"))
91  (*Options.safe_renderers)["v4l2"].append("opengl-hw");
92 #endif
93 #ifdef USING_EGL
94  if (Options.decoders->contains("drmprime"))
95  (*Options.safe_renderers)["drmprime"].append("opengl-hw");
96 #endif
97 }
98 
100  : m_videoProfile(std::move(Profile))
101 {
102  // Retrieve render context
104  if (!m_render)
105  {
106  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to retrieve OpenGL context");
107  return;
108  }
109 
110  // Retain and lock
111  m_render->IncrRef();
112  OpenGLLocker locker(m_render);
113 
114  // enable performance monitoring if requested
115  // will report the execution time for the key GL code blocks
116  // N.B. 'Upload' should always be zero when using hardware decoding and direct
117  // rendering. Any copy cost for direct rendering will be included within 'Render'
118  if (VERBOSE_LEVEL_CHECK(VB_GPUVIDEO, LOG_INFO))
119  {
120  m_openGLPerf = new MythOpenGLPerf("GLVidPerf: ", { "Upload:", "Clear:", "Render:", "Flush:", "Swap:" });
121  if (!m_openGLPerf->isCreated())
122  {
123  delete m_openGLPerf;
124  m_openGLPerf = nullptr;
125  }
126  }
127 
128  // Disallow unsupported video texturing on GLES2/GL1.X
131 
132  // Retrieve OpenGL painter
134  m_openGLPainter = dynamic_cast<MythOpenGLPainter*>(win->GetCurrentPainter());
135  if (!m_openGLPainter)
136  {
137  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to get painter");
138  return;
139  }
140 
141  // we need to control buffer swapping
143 
144  // Create OpenGLVideo
145  QRect dvr = GetDisplayVisibleRect();
149 
150  // Connect VideoOutWindow to OpenGLVideo
155 }
156 
158 {
160  while (!m_openGLVideoPiPs.empty())
161  {
162  delete *m_openGLVideoPiPs.begin();
163  m_openGLVideoPiPs.erase(m_openGLVideoPiPs.begin());
164  }
165  m_openGLVideoPiPsReady.clear();
166  if (m_openGLPainter)
168  delete m_openGLVideo;
169  if (m_render)
170  {
172  delete m_openGLPerf;
174  m_render->DecrRef();
175  }
176  m_render = nullptr;
177 }
178 
180 {
184  m_buffersCreated = false;
185 }
186 
187 bool MythVideoOutputOpenGL::Init(const QSize &VideoDim, const QSize &VideoDispDim, float Aspect,
188  MythDisplay *Display, const QRect &DisplayVisibleRect, MythCodecID CodecId)
189 {
191  return false;
192 
193  if (!gCoreContext->IsUIThread())
194  {
195  LOG(VB_GENERAL, LOG_ERR, LOC + "Cannot initialise OpenGL video from this thread");
196  return false;
197  }
198 
199  OpenGLLocker ctx_lock(m_render);
200 
201  // if we are the main video player then free up as much video memory
202  // as possible at startup
203  PIPState pip = m_window.GetPIPState();
204  if ((kCodec_NONE == m_newCodecId) && ((kPIPOff == pip) || (kPBPLeft == pip)))
206 
207  // Default initialisation - mainly VideoOutWindow
208  if (!MythVideoOutput::Init(VideoDim, VideoDispDim, Aspect, Display, DisplayVisibleRect, CodecId))
209  return false;
210 
211  // Ensure any new profile preferences are handled after a stream change
212  if (m_dbDisplayProfile)
214 
215  // Set default support for picture attributes
217 
218  // Setup display
219  QSize size = m_window.GetVideoDim();
220 
221  // Set the display mode if required
223  ResizeForVideo(size);
225 
226  // Create buffers
227  if (!CreateBuffers(CodecId, m_window.GetVideoDim()))
228  return false;
229 
230  // Adjust visible rect for embedding
231  QRect dvr = GetDisplayVisibleRect();
233  {
234  m_render->SetViewPort(QRect(QPoint(), dvr.size()));
235  return true;
236  }
237 
239  {
240  QRect tmprect = QRect(QPoint(0,0), dvr.size());
241  ResizeDisplayWindow(tmprect, true);
242  }
243 
244  // Reset OpenGLVideo
245  if (m_openGLVideo->IsValid())
247 
248  // This works around an issue with VDPAU direct rendering using legacy drivers
249  m_render->Flush();
250 
251  return true;
252 }
253 
255 {
256  if (!m_dbDisplayProfile)
257  return;
258 
259  if (qFuzzyCompare(m_dbDisplayProfile->GetOutput() + 1.0F, NewRate + 1.0F))
260  return;
261 
262  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Video frame rate changed: %1->%2")
263  .arg(static_cast<double>(m_dbDisplayProfile->GetOutput())).arg(static_cast<double>(NewRate)));
264  m_dbDisplayProfile->SetOutput(NewRate);
265  m_newFrameRate = true;
266 }
267 
268 bool MythVideoOutputOpenGL::InputChanged(const QSize &VideoDim, const QSize &VideoDispDim,
269  float Aspect, MythCodecID CodecId, bool &AspectOnly,
270  MythMultiLocker* /*Locks*/, int ReferenceFrames,
271  bool ForceChange)
272 {
273  QSize currentvideodim = m_window.GetVideoDim();
274  QSize currentvideodispdim = m_window.GetVideoDispDim();
275  MythCodecID currentcodec = m_videoCodecID;
276  float currentaspect = m_window.GetVideoAspect();
277 
278  if (m_newCodecId != kCodec_NONE)
279  {
280  // InputChanged has been called twice in quick succession without a call to ProcessFrame
281  currentvideodim = m_newVideoDim;
282  currentvideodispdim = m_newVideoDispDim;
283  currentcodec = m_newCodecId;
284  currentaspect = m_newAspect;
285  }
286 
287  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Video changed: %1x%2 (%3x%4) '%5' (Aspect %6 Refs %13)"
288  "-> %7x%8 (%9x%10) '%11' (Aspect %12 Refs %14)")
289  .arg(currentvideodispdim.width()).arg(currentvideodispdim.height())
290  .arg(currentvideodim.width()).arg(currentvideodim.height())
291  .arg(toString(currentcodec)).arg(static_cast<double>(currentaspect))
292  .arg(VideoDispDim.width()).arg(VideoDispDim.height())
293  .arg(VideoDim.width()).arg(VideoDim.height())
294  .arg(toString(CodecId)).arg(static_cast<double>(Aspect))
295  .arg(m_maxReferenceFrames).arg(ReferenceFrames));
296 
297  bool cidchanged = (CodecId != currentcodec);
298  bool reschanged = (VideoDispDim != currentvideodispdim);
299  bool refschanged = m_maxReferenceFrames != ReferenceFrames;
300 
301  // aspect ratio changes are a no-op as changes are handled at display time
302  if (!(cidchanged || reschanged || refschanged || ForceChange))
303  {
304  AspectOnly = true;
305  return true;
306  }
307 
308  // N.B. We no longer check for interop support for the new codec as it is a
309  // poor substitute for a full check of decoder capabilities etc. Better to let
310  // hardware decoding fail if necessary - which should at least fallback to
311  // software decoding rather than bailing out here.
312 
313  // delete and recreate the buffers and flag that the input has changed
314  m_maxReferenceFrames = ReferenceFrames;
316  if (!m_buffersCreated)
317  return false;
318 
319  m_newCodecId= CodecId;
320  m_newVideoDim = VideoDim;
321  m_newVideoDispDim = VideoDispDim;
322  m_newAspect = Aspect;
323  return true;
324 }
325 
327 {
328  QRect dvr = m_window.GetDisplayVisibleRect();
329 
330  MythMainWindow *mainwin = GetMythMainWindow();
331  if (!mainwin)
332  return dvr;
333  QSize size = mainwin->size();
334 
335  // may be called before m_window is initialised fully
336  if (dvr.isEmpty())
337  dvr = QRect(QPoint(0, 0), size);
338 
339  // If the Video screen mode has vertically less pixels
340  // than the GUI screen mode - OpenGL coordinate adjustments
341  // must be made to put the video at the top of the display
342  // area instead of at the bottom.
343  if (dvr.height() < size.height())
344  dvr.setTop(dvr.top() - size.height() + dvr.height());
345 
346  // If the Video screen mode has horizontally less pixels
347  // than the GUI screen mode - OpenGL width must be set
348  // as the higher GUI width so that the Program Guide
349  // invoked from playback is not cut off.
350  if (dvr.width() < size.width())
351  dvr.setWidth(size.width());
352 
353  return dvr;
354 }
355 
357 {
358  if (m_buffersCreated)
359  return true;
360 
361  if (codec_is_copyback(CodecID))
362  {
364  return m_videoBuffers.CreateBuffers(FMT_YV12, Size.width(), Size.height());
365  }
366 
367  if (codec_is_mediacodec(CodecID))
368  return m_videoBuffers.CreateBuffers(FMT_MEDIACODEC, Size, false, 1, 2, 2);
369  if (codec_is_vaapi(CodecID))
370  return m_videoBuffers.CreateBuffers(FMT_VAAPI, Size, false, 2, 1, 4, m_maxReferenceFrames);
371  if (codec_is_vtb(CodecID))
372  return m_videoBuffers.CreateBuffers(FMT_VTB, Size, false, 1, 4, 2);
373  if (codec_is_vdpau(CodecID))
374  return m_videoBuffers.CreateBuffers(FMT_VDPAU, Size, false, 2, 1, 4, m_maxReferenceFrames);
375  if (codec_is_nvdec(CodecID))
376  return m_videoBuffers.CreateBuffers(FMT_NVDEC, Size, false, 2, 1, 4);
377  if (codec_is_mmal(CodecID))
378  return m_videoBuffers.CreateBuffers(FMT_MMAL, Size, false, 2, 1, 4);
379  if (codec_is_v4l2(CodecID) || codec_is_drmprime(CodecID))
380  return m_videoBuffers.CreateBuffers(FMT_DRMPRIME, Size, false, 2, 1, 4);
381 
382  return m_videoBuffers.CreateBuffers(FMT_YV12, Size, false, 1, 8, 4, m_maxReferenceFrames);
383 }
384 
386  const PIPMap &PiPPlayers,
387  FrameScanType Scan)
388 {
389  if (!m_render)
390  return;
391 
392  OpenGLLocker ctx_lock(m_render);
393 
394  // start the first timer
395  if (m_openGLPerf)
397 
398  // Process input changes
399  if (m_newCodecId != kCodec_NONE)
400  {
401  // Ensure we don't lose embedding through program changes.
402  bool wasembedding = m_window.IsEmbedding();
403  QRect oldrect;
404  if (wasembedding)
405  {
406  oldrect = m_window.GetEmbeddingRect();
407  StopEmbedding();
408  }
409 
410  // Note - we don't call the default VideoOutput::InputChanged method as
411  // the OpenGL implementation is asynchronous.
412  // So we need to update the video display profile here. It is a little
413  // circular as we need to set the video dimensions first which are then
414  // reset in Init.
415  // All told needs a cleanup - not least because the use of codecName appears
416  // to be inconsistent.
418  AVCodecID avCodecId = myth2av_codecid(m_newCodecId);
419  AVCodec *codec = avcodec_find_decoder(avCodecId);
420  QString codecName;
421  if (codec)
422  codecName = codec->name;
423  if (m_dbDisplayProfile)
425 
429  m_newVideoDim = QSize();
430  m_newVideoDispDim = QSize();
431  m_newAspect = 0.0F;
432  m_newFrameRate = false;
433 
434  if (wasembedding && ok)
435  EmbedInWidget(oldrect);
436 
437  if (!ok)
438  return;
439  }
440  else if (m_newFrameRate)
441  {
442  // If we are switching mode purely for a refresh rate change, then there
443  // is no need to recreate buffers etc etc
444  ResizeForVideo();
445  m_newFrameRate = false;
446  }
447 
448  if (Frame)
449  m_window.SetRotation(Frame->rotation);
450 
451  if (VERBOSE_LEVEL_CHECK(VB_GPU, LOG_INFO))
452  m_render->logDebugMarker(LOC + "PROCESS_FRAME_START");
453 
454  bool swframe = Frame ? !format_is_hw(Frame->codec) : false;
455  bool dummy = Frame ? Frame->dummy : false;
456 
457  // software deinterlacing
458  if (!dummy && swframe)
460 
461  if (!m_window.IsEmbedding())
462  {
463  m_openGLVideoPiPActive = nullptr;
464  ShowPIPs(Frame, PiPPlayers);
465  }
466 
467  if (m_openGLVideo && swframe && !dummy)
469 
470  // time texture update
471  if (m_openGLPerf)
473 
474  if (VERBOSE_LEVEL_CHECK(VB_GPU, LOG_INFO))
475  m_render->logDebugMarker(LOC + "PROCESS_FRAME_END");
476 }
477 
479 {
480  if (!m_render)
481  return;
482 
483  if (m_newCodecId != kCodec_NONE)
484  return; // input changes need to be handled in ProcessFrame
485 
486  OpenGLLocker ctx_lock(m_render);
487 
488  if (VERBOSE_LEVEL_CHECK(VB_GPU, LOG_INFO))
489  m_render->logDebugMarker(LOC + "PREPARE_FRAME_START");
490 
491  bool dummy = false;
492  bool topfieldfirst = false;
493  if (Frame)
494  {
495  m_framesPlayed = Frame->frameNumber + 1;
496  topfieldfirst = Frame->interlaced_reversed ? !Frame->top_field_first : Frame->top_field_first;
497  dummy = Frame->dummy;
498  }
499  else
500  {
501  // see VideoOutputOpenGL::DoneDisplayingFrame
502  // we only retain pause frames for hardware formats
505  }
506 
507  // if process frame has not been called (double rate hardware deint), then
508  // we need to start the first 2 performance timers here
509  if (m_openGLPerf)
510  {
512  {
515  }
516  }
517 
518  m_render->BindFramebuffer(nullptr);
519 
520  if (VERBOSE_LEVEL_CHECK(VB_GPU, LOG_INFO))
521  m_render->logDebugMarker(LOC + "CLEAR_START");
522 
523  uint8_t gray = m_dbLetterboxColour == kLetterBoxColour_Gray25 ? 64 : 0;
524 
525  if (!Frame || dummy || ((m_render->GetExtraFeatures() & kGLTiled) != 0))
526  {
527  m_render->SetBackground(gray, gray, gray, 255);
529  }
530  // avoid clearing the framebuffer if it will be entirely overwritten by video
531  else if (!m_window.VideoIsFullScreen())
532  {
533  if (m_window.IsEmbedding())
534  {
535  // use MythRenderOpenGL rendering as it will clear to the appropriate 'black level'
536  m_render->ClearRect(nullptr, m_window.GetWindowRect(), gray);
537  }
538  else
539  {
540  // in the vast majority of cases it is significantly quicker to just
541  // clear the unused portions of the screen
542  QRegion toclear = m_window.GetBoundingRegion();
543  for (auto rect : qAsConst(toclear))
544  m_render->ClearRect(nullptr, rect, gray);
545  }
546  }
547 
548  if (VERBOSE_LEVEL_CHECK(VB_GPU, LOG_INFO))
549  m_render->logDebugMarker(LOC + "CLEAR_END");
550 
551  // time framebuffer clearing
552  if (m_openGLPerf)
554 
555  // stereoscopic views
556  QRect main = m_render->GetViewPort();
557  QRect first = main;
558  QRect second = main;
560 
562  {
563  first = QRect(main.left() / 2, main.top(), main.width() / 2, main.height());
564  second = first.translated(main.width() / 2, 0);
565  }
567  {
568  first = QRect(main.left(), main.top() / 2, main.width(), main.height() / 2);
569  second = first.translated(0, main.height() / 2);
570  }
571 
572  // main UI when embedded
573  if (m_window.IsEmbedding())
574  {
576  if (win && win->GetPaintWindow())
577  {
578  if (twopass)
579  m_render->SetViewPort(first, true);
580  win->GetPaintWindow()->clearMask();
581  win->Draw(m_openGLPainter);
582  if (twopass)
583  {
584  m_render->SetViewPort(second, true);
585  win->GetPaintWindow()->clearMask();
586  win->Draw(m_openGLPainter);
587  m_render->SetViewPort(main, true);
588  }
589  }
590  }
591 
592  // video
593  if (m_openGLVideo && !dummy)
594  {
595  m_openGLVideo->PrepareFrame(Frame, topfieldfirst, Scan, m_stereo);
596  // dummy streams need the viewport updated in case we have resized the window
597  }
598  else if (dummy)
599  {
601  }
602 
603  // PiPs/PBPs
604  if (!m_openGLVideoPiPs.empty() && !m_window.IsEmbedding())
605  {
606  for (auto it = m_openGLVideoPiPs.begin(); it != m_openGLVideoPiPs.end(); ++it)
607  {
608  if (m_openGLVideoPiPsReady[it.key()])
609  {
610  bool active = m_openGLVideoPiPActive == *it;
611  if (twopass)
612  m_render->SetViewPort(first, true);
613  (*it)->PrepareFrame(nullptr, topfieldfirst, Scan, kStereoscopicModeNone, active);
614  if (twopass)
615  {
616  m_render->SetViewPort(second, true);
617  (*it)->PrepareFrame(nullptr, topfieldfirst, Scan, kStereoscopicModeNone, active);
619  }
620  }
621  }
622  }
623 
624  // visualisation
626  {
627  if (twopass)
628  m_render->SetViewPort(first, true);
630  if (twopass)
631  {
632  m_render->SetViewPort(second, true);
635  }
636  }
637 
638  // OSD
639  if (Osd && m_openGLPainter && !m_window.IsEmbedding())
640  {
641  if (twopass)
642  m_render->SetViewPort(first, true);
643  Osd->Draw(m_openGLPainter, GetTotalOSDBounds().size(), true);
644  if (twopass)
645  {
646  m_render->SetViewPort(second, true);
647  Osd->Draw(m_openGLPainter, GetTotalOSDBounds().size(), true);
649  }
650  }
651 
652  // time rendering
653  if (m_openGLPerf)
655 
656  m_render->Flush();
657 
658  // time flush
659  if (m_openGLPerf)
661 
662  if (VERBOSE_LEVEL_CHECK(VB_GPU, LOG_INFO))
663  m_render->logDebugMarker(LOC + "PREPARE_FRAME_END");
664 }
665 
678 {
679  if (!Frame)
680  return;
681 
682  bool retain = format_is_hw(Frame->codec);
683  QVector<VideoFrame*> release;
684 
687  {
689  if (!retain || (retain && (frame != Frame)))
690  release.append(frame);
691  }
692 
693  if (retain)
694  {
698  }
699  else
700  {
701  release.append(Frame);
702  }
704 
705  for (auto * frame : release)
707 }
708 
715 void MythVideoOutputOpenGL::DiscardFrames(bool KeyFrame, bool Flushed)
716 {
717  if (Flushed)
718  {
719  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("(%1): %2").arg(KeyFrame).arg(m_videoBuffers.GetStatus()));
721  }
722  MythVideoOutput::DiscardFrames(KeyFrame, Flushed);
723 }
724 
726 {
727  // Complete list of formats supported for OpenGL 2.0 and higher and OpenGL ES3.X
728  static VideoFrameType s_AllFormats[] =
734  FMT_NONE };
735 
736  // OpenGL ES 2.0 and OpenGL1.X only allow luminance textures
737  static VideoFrameType s_LegacyFormats[] =
739 
740  static VideoFrameType* s_formats[2] = { s_AllFormats, s_LegacyFormats };
741  return s_formats[m_textureFormats];
742 }
743 
745 {
746  m_window.SetWindowSize(Size);
748 }
749 
751 {
752  if (m_render && !IsErrored())
753  {
755  if (VERBOSE_LEVEL_CHECK(VB_GPU, LOG_INFO))
756  m_render->logDebugMarker(LOC + "SHOW");
758  if (m_openGLPerf)
759  {
760  // time buffer swap and log
761  // Results will normally be available on the next pass - and we will typically
762  // test every other frame as a result to avoid blocking in the driver.
763  // With the default of averaging over 30 samples this should give a 30 sample
764  // average over 60 frames
767  }
769  }
770 }
771 
773 {
774  if (m_openGLVideo)
777 }
778 
781 QStringList MythVideoOutputOpenGL::GetAllowedRenderers(MythCodecID CodecId, const QSize& /*VideoDim*/)
782 {
783  QStringList allowed;
784 
785  if (MythRenderOpenGL::GetOpenGLRender() == nullptr)
786  return allowed;
787 
788  if (codec_sw_copy(CodecId))
789  {
790  allowed << "opengl" << "opengl-yv12";
791  return allowed;
792  }
793 
794  VideoFrameType format = FMT_NONE;
795  if (codec_is_vaapi(CodecId))
796  format = FMT_VAAPI;
797  else if (codec_is_vdpau(CodecId))
798  format = FMT_VDPAU;
799  else if (codec_is_nvdec(CodecId))
800  format = FMT_NVDEC;
801  else if (codec_is_vtb(CodecId))
802  format = FMT_VTB;
803  else if (codec_is_mmal(CodecId))
804  format = FMT_MMAL;
805  else if (codec_is_v4l2(CodecId) || codec_is_drmprime(CodecId))
806  format = FMT_DRMPRIME;
807  else if (codec_is_mediacodec(CodecId))
808  format = FMT_MEDIACODEC;
809 
810  if (FMT_NONE == format)
811  return allowed;
812 
813  allowed += MythOpenGLInterop::GetAllowedRenderers(format);
814  return allowed;
815 }
816 
817 void MythVideoOutputOpenGL::UpdatePauseFrame(int64_t &DisplayTimecode, FrameScanType Scan)
818 {
819  VideoFrame* release = nullptr;
822  if (used)
823  {
824  if (format_is_hw(used->codec))
825  {
827  }
828  else
829  {
831  m_deinterlacer.Filter(used, Scan, m_dbDisplayProfile, true);
832  m_openGLVideo->ProcessFrame(used, Scan);
833  }
834  DisplayTimecode = used->disp_timecode;
835  }
836  else
837  {
838  LOG(VB_PLAYBACK, LOG_WARNING, LOC + "Could not update pause frame");
839  }
841 
842  if (release)
843  DoneDisplayingFrame(release);
844 }
845 
847 {
849 }
850 
851 void MythVideoOutputOpenGL::ShowPIP(VideoFrame* /*Frame*/, MythPlayer *PiPPlayer, PIPLocation Location)
852 {
853  if (!PiPPlayer)
854  return;
855 
856  int pipw = 0;
857  int piph = 0;
858  VideoFrame *pipimage = PiPPlayer->GetCurrentFrame(pipw, piph);
859  const QSize pipvideodim = PiPPlayer->GetVideoBufferSize();
860  QRect pipvideorect = QRect(QPoint(0, 0), pipvideodim);
861 
862  if ((PiPPlayer->GetVideoAspect() <= 0.0F) || !pipimage || !pipimage->buf ||
863  (pipimage->codec != FMT_YV12) || !PiPPlayer->IsPIPVisible())
864  {
865  PiPPlayer->ReleaseCurrentFrame(pipimage);
866  return;
867  }
868 
869  QRect position = GetPIPRect(Location, PiPPlayer);
870  QRect dvr = m_window.GetDisplayVisibleRect();
871 
872  m_openGLVideoPiPsReady[PiPPlayer] = false;
873  MythOpenGLVideo *gl_pipchain = m_openGLVideoPiPs[PiPPlayer];
874  if (!gl_pipchain)
875  {
876  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Initialise PiP");
877  auto *colourspace = new VideoColourSpace(&m_videoColourSpace);
878  m_openGLVideoPiPs[PiPPlayer] = gl_pipchain = new MythOpenGLVideo(m_render, colourspace,
879  pipvideodim, pipvideodim,
880  dvr, position, pipvideorect,
881  false, m_videoProfile);
882 
883  colourspace->DecrRef();
884  if (!gl_pipchain->IsValid())
885  {
886  PiPPlayer->ReleaseCurrentFrame(pipimage);
887  return;
888  }
889  gl_pipchain->SetMasterViewport(dvr.size());
890  }
891 
892  if (gl_pipchain->GetVideoSize() != pipvideodim)
893  {
894  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Re-initialise PiP.");
895  delete gl_pipchain;
896  auto *colourspace = new VideoColourSpace(&m_videoColourSpace);
897  m_openGLVideoPiPs[PiPPlayer] = gl_pipchain = new MythOpenGLVideo(m_render, colourspace,
898  pipvideodim, pipvideodim,
899  dvr, position, pipvideorect,
900  false, m_videoProfile);
901  colourspace->DecrRef();
902  if (!gl_pipchain->IsValid())
903  {
904  PiPPlayer->ReleaseCurrentFrame(pipimage);
905  return;
906  }
907  gl_pipchain->SetMasterViewport(dvr.size());
908  }
909 
910  if (gl_pipchain->IsValid())
911  {
912  gl_pipchain->SetVideoRects(position, pipvideorect);
913  gl_pipchain->ProcessFrame(pipimage);
914  }
915 
916  m_openGLVideoPiPsReady[PiPPlayer] = true;
917  if (PiPPlayer->IsPIPActive())
918  m_openGLVideoPiPActive = gl_pipchain;
919  PiPPlayer->ReleaseCurrentFrame(pipimage);
920 }
921 
923 {
924  if (m_openGLVideoPiPs.contains(PiPPlayer))
925  {
927  delete m_openGLVideoPiPs.take(PiPPlayer);
928  m_openGLVideoPiPsReady.remove(PiPPlayer);
929  m_openGLVideoPiPs.remove(PiPPlayer);
931  }
932 }
933 
935 {
936  if (m_render)
939 }
940 
942 {
943  return m_openGLPainter;
944 }
945 
947 {
949 }
950 
951 bool MythVideoOutputOpenGL::SetupVisualisation(AudioPlayer *Audio, MythRender* /*Render*/, const QString &Name)
952 {
954 }
VideoOutWindow::VideoRectsChanged
void VideoRectsChanged(const QRect &DisplayVideoRect, const QRect &VideoRect)
VideoOutWindow::InputChanged
void InputChanged(const QSize &VideoDim, const QSize &VideoDispDim, float Aspect)
Tells video output to discard decoded frames and wait for new ones.
Definition: videooutwindow.cpp:530
FMT_MEDIACODEC
@ FMT_MEDIACODEC
Definition: mythframe.h:65
codec_is_copyback
#define codec_is_copyback(id)
Definition: mythcodecid.h:344
MythVideoOutput::InitDisplayMeasurements
void InitDisplayMeasurements(void)
Initialise display measurement.
Definition: mythvideoout.cpp:1004
MythOpenGLPainter
Definition: mythpainteropengl.h:25
MythOpenGLVideo::SetProfile
void SetProfile(const QString &Profile)
Definition: mythopenglvideo.cpp:162
bbciplayer.main
main
Definition: bbciplayer.py:263
MythDeinterlacer::Filter
void Filter(VideoFrame *Frame, FrameScanType Scan, VideoDisplayProfile *Profile, bool Force=false)
Deinterlace Frame if needed.
Definition: mythdeinterlacer.cpp:69
MythVideoOutput::m_dbLetterboxColour
LetterBoxColour m_dbLetterboxColour
Definition: mythvideoout.h:163
MythVideoOutput::GetTotalOSDBounds
QRect GetTotalOSDBounds(void) const
Definition: mythvideoout.cpp:495
VideoOutWindow::GetBoundingRegion
QRegion GetBoundingRegion(void) const
Return the region of DisplayVisibleRect that lies outside of DisplayVideoRect.
Definition: videooutwindow.cpp:839
FMT_YUV420P10
@ FMT_YUV420P10
Definition: mythframe.h:30
VideoBuffers::Contains
bool Contains(BufferType Type, VideoFrame *Frame) const
Definition: videobuffers.cpp:790
MythRenderOpenGL::SetBackground
void SetBackground(uint8_t Red, uint8_t Green, uint8_t Blue, uint8_t Alpha)
Definition: mythrenderopengl.cpp:610
VideoDisplayProfile::SetInput
void SetInput(const QSize &Size, float Framerate=0, const QString &CodecName=QString(), const QStringList &DisallowedDecoders=QStringList())
Definition: videodisplayprofile.cpp:359
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
VideoBuffers::Tail
VideoFrame * Tail(BufferType Type)
Definition: videobuffers.cpp:686
MythVideoOutputOpenGL::GetDisplayVisibleRect
QRect GetDisplayVisibleRect(void)
Definition: mythvideooutopengl.cpp:326
FMT_YUV420P16
@ FMT_YUV420P16
Definition: mythframe.h:33
VideoBuffers::Remove
void Remove(BufferType Type, VideoFrame *Frame)
Definition: videobuffers.cpp:712
OSD::Draw
bool Draw(MythPainter *Painter, QSize Size, bool Repaint=false)
Definition: osd.cpp:623
MythVideoOutput::GetPIPRect
virtual QRect GetPIPRect(PIPLocation Location, MythPlayer *PiPPlayer=nullptr, bool DoPixelAdj=true) const
returns QRect of PIP based on PIPLocation
Definition: mythvideoout.cpp:678
MythVideoOutput::m_visual
VideoVisual * m_visual
Definition: mythvideoout.h:170
FMT_VTB
@ FMT_VTB
Definition: mythframe.h:66
MythVideoOutputOpenGL::m_newFrameRate
bool m_newFrameRate
Definition: mythvideooutopengl.h:73
AudioPlayer
Definition: audioplayer.h:27
RenderOptions::renderers
QStringList * renderers
Definition: videodisplayprofile.h:29
MythRenderOpenGL::SetViewPort
void SetViewPort(const QRect &Rect, bool ViewportOnly=false)
Definition: mythrenderopengl.cpp:576
FMT_YUV420P14
@ FMT_YUV420P14
Definition: mythframe.h:32
VideoDisplayProfile::GetOutput
float GetOutput(void) const
Definition: videodisplayprofile.cpp:394
MythRenderOpenGL::ClearFramebuffer
void ClearFramebuffer(void)
Definition: mythrenderopengl.cpp:796
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
MythVideoOutputOpenGL::Show
void Show(FrameScanType Scan) override
Definition: mythvideooutopengl.cpp:750
FMT_DRMPRIME
@ FMT_DRMPRIME
Definition: mythframe.h:68
FMT_YUV444P10
@ FMT_YUV444P10
Definition: mythframe.h:50
MythVideoOutput::m_framesPlayed
long long m_framesPlayed
Definition: mythvideoout.h:169
FMT_YUV422P14
@ FMT_YUV422P14
Definition: mythframe.h:45
mythopenglinterop.h
MythVideoOutputOpenGL::GetAllowedRenderers
static QStringList GetAllowedRenderers(MythCodecID CodecId, const QSize &VideoDim)
Generate a list of supported OpenGL profiles.
Definition: mythvideooutopengl.cpp:781
MythVideoOutputOpenGL::m_newVideoDispDim
QSize m_newVideoDispDim
Definition: mythvideooutopengl.h:71
Frame
Definition: zmdefines.h:94
MythVideoOutputOpenGL::SetupVisualisation
bool SetupVisualisation(AudioPlayer *Audio, MythRender *Render, const QString &Name) override
Definition: mythvideooutopengl.cpp:951
MythVideoOutput::GetVisualiserList
virtual QStringList GetVisualiserList(void)
Definition: mythvideoout.cpp:763
MythVideoOutputOpenGL::UpdatePauseFrame
void UpdatePauseFrame(int64_t &DisplayTimecode, FrameScanType Scan=kScan_Progressive) override
Definition: mythvideooutopengl.cpp:817
MythVideoOutput::ClearAfterSeek
virtual void ClearAfterSeek(void)
Tells video output to toss decoded buffers due to a seek.
Definition: mythvideoout.cpp:647
VideoDisplayProfile::SetOutput
void SetOutput(float Framerate)
Definition: videodisplayprofile.cpp:384
FMT_P010
@ FMT_P010
Definition: mythframe.h:58
MythRenderOpenGL::logDebugMarker
void logDebugMarker(const QString &Message)
Definition: mythrenderopengl.cpp:200
MythPlayer::ReleaseCurrentFrame
void ReleaseCurrentFrame(VideoFrame *frame)
Definition: mythplayer.cpp:1058
MythOpenGLPainter::FreeResources
void FreeResources(void) override
Definition: mythpainteropengl.cpp:49
codec_is_nvdec
#define codec_is_nvdec(id)
Definition: mythcodecid.h:328
arg
arg(title).arg(filename).arg(doDelete))
VideoBuffers::DoneDisplayingFrame
void DoneDisplayingFrame(VideoFrame *Frame)
Definition: videobuffers.cpp:444
MythOpenGLPerf::GetTimersRunning
int GetTimersRunning(void) const
Definition: mythopenglperf.cpp:34
VideoBuffers::DiscardAndRecreate
bool DiscardAndRecreate(MythCodecID CodecID, QSize VideoDim, int References)
Discard all buffers and recreate.
Definition: videobuffers.cpp:509
FrameScanType
FrameScanType
Definition: videoouttypes.h:79
VideoOutWindow::GetVideoDispDim
QSize GetVideoDispDim(void) const
Definition: videooutwindow.h:72
MythVideoOutputOpenGL::DestroyBuffers
void DestroyBuffers(void)
Definition: mythvideooutopengl.cpp:179
MythVideoOutputOpenGL::GetRenderOptions
static void GetRenderOptions(RenderOptions &Options)
Generate the list of available OpenGL profiles.
Definition: mythvideooutopengl.cpp:26
MythPlayer::IsPIPActive
bool IsPIPActive(void) const
Definition: mythplayer.h:266
osd.h
MythCoreContext::IsUIThread
bool IsUIThread(void)
Definition: mythcorecontext.cpp:1356
codec_is_vdpau
#define codec_is_vdpau(id)
Definition: mythcodecid.h:298
FMT_YUV422P
@ FMT_YUV422P
Definition: mythframe.h:41
codec_is_mmal
#define codec_is_mmal(id)
Definition: mythcodecid.h:341
VideoFrame::buf
unsigned char * buf
Definition: mythframe.h:140
kPIPOff
@ kPIPOff
Definition: videoouttypes.h:10
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythVideoOutput::StopEmbedding
virtual void StopEmbedding(void)
Definition: mythvideoout.cpp:453
mythplayer.h
MythVideoOutput::m_videoColourSpace
VideoColourSpace m_videoColourSpace
Definition: mythvideoout.h:160
kGLLegacyTextures
@ kGLLegacyTextures
Definition: mythrenderopengl.h:44
MythPlayer
Definition: mythplayer.h:165
MythMainWindow::Draw
void Draw(MythPainter *Painter=nullptr)
Definition: mythmainwindow.cpp:429
MythVideoOutputOpenGL::m_openGLVideoPiPsReady
QMap< MythPlayer *, bool > m_openGLVideoPiPsReady
Definition: mythvideooutopengl.h:65
VideoFrame
Definition: mythframe.h:138
MythOpenGLVideo::SetViewportRect
void SetViewportRect(const QRect &DisplayVisibleRect)
Definition: mythopenglvideo.cpp:150
MythOpenGLPerf::LogSamples
void LogSamples(void)
Definition: mythopenglperf.cpp:48
VideoBuffers::CreateBuffers
bool CreateBuffers(VideoFrameType Type, QSize Size, bool ExtraForPause, uint NeedFree, uint NeedprebufferNormal, uint NeedPrebufferSmall, int MaxReferenceFrames=16)
Definition: videobuffers.cpp:1005
kStereoscopicModeTopAndBottom
@ kStereoscopicModeTopAndBottom
Definition: videoouttypes.h:123
MythMultiLocker
Definition: mythplayer.h:122
FMT_YUV444P14
@ FMT_YUV444P14
Definition: mythframe.h:52
MythVideoOutputOpenGL::m_videoProfile
QString m_videoProfile
Definition: mythvideooutopengl.h:68
MythVideoOutputOpenGL::MythVideoOutputOpenGL
MythVideoOutputOpenGL(QString Profile=QString())
Definition: mythvideooutopengl.cpp:99
FMT_YUV444P
@ FMT_YUV444P
Definition: mythframe.h:48
VideoFrame::codec
VideoFrameType codec
Definition: mythframe.h:139
MythOpenGLVideo::SetVideoRects
void SetVideoRects(const QRect &DisplayVideoRect, const QRect &VideoRect)
Definition: mythopenglvideo.cpp:144
MythOpenGLVideo::ResetTextures
void ResetTextures(void)
Clear reference frames after a seek as they will contain old images.
Definition: mythopenglvideo.cpp:1015
MythVideoOutputOpenGL::ClearAfterSeek
void ClearAfterSeek(void) override
Tells video output to toss decoded buffers due to a seek.
Definition: mythvideooutopengl.cpp:772
MythVideoOutputOpenGL::DirectRenderFormats
VideoFrameType * DirectRenderFormats(void) override
Definition: mythvideooutopengl.cpp:725
MythVideoOutputOpenGL::m_openGLVideo
MythOpenGLVideo * m_openGLVideo
Definition: mythvideooutopengl.h:63
FMT_NONE
@ FMT_NONE
Definition: mythframe.h:26
MythMainWindow::getMainWindow
static MythMainWindow * getMainWindow(bool useDB=true)
Return the existing main window, or create one.
Definition: mythmainwindow.cpp:83
VideoOutWindow::GetDisplayVideoRect
QRect GetDisplayVideoRect(void) const
Definition: videooutwindow.h:81
MythVideoOutputOpenGL::m_openGLPainter
MythOpenGLPainter * m_openGLPainter
Definition: mythvideooutopengl.h:67
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
videodisplayprofile.h
mythrenderopengl.h
toString
QString toString(MarkTypes type)
Definition: programtypes.cpp:26
MythMainWindow::GetCurrentPainter
MythPainter * GetCurrentPainter()
Definition: mythmainwindow.cpp:244
MythVideoOutputOpenGL::m_openGLVideoPiPActive
MythOpenGLVideo * m_openGLVideoPiPActive
Definition: mythvideooutopengl.h:66
RenderOptions::decoders
QStringList * decoders
Definition: videodisplayprofile.h:33
MythVideoOutput::m_window
VideoOutWindow m_window
Definition: mythvideoout.h:159
format_is_hw
static bool format_is_hw(VideoFrameType Type)
Definition: mythframe.h:73
MythVideoOutput::ResizeDisplayWindow
virtual void ResizeDisplayWindow(const QRect &Rect, bool SaveVisible)
Resize Display Window.
Definition: mythvideoout.cpp:434
codec_is_mediacodec
#define codec_is_mediacodec(id)
Definition: mythcodecid.h:323
RenderOptions
Definition: videodisplayprofile.h:28
VideoOutWindow::GetVideoRect
QRect GetVideoRect(void) const
Definition: videooutwindow.h:80
MythOpenGLVideo::GetVideoSize
QSize GetVideoSize(void) const
Definition: mythopenglvideo.cpp:167
MythPlayer::GetVideoBufferSize
QSize GetVideoBufferSize(void) const
Definition: mythplayer.h:216
VideoOutWindow::SetWindowSize
void SetWindowSize(QSize Size)
Definition: videooutwindow.cpp:634
kScan_Progressive
@ kScan_Progressive
Definition: videoouttypes.h:84
MythVideoOutputOpenGL::m_newAspect
float m_newAspect
Definition: mythvideooutopengl.h:72
MythVideoOutput::m_dbDisplayProfile
VideoDisplayProfile * m_dbDisplayProfile
Definition: mythvideoout.h:166
MythRenderOpenGL::Flush
void Flush(void)
Definition: mythrenderopengl.cpp:589
MythVideoOutputOpenGL::CanVisualise
bool CanVisualise(AudioPlayer *Audio, MythRender *Render) override
Definition: mythvideooutopengl.cpp:946
MythRenderOpenGL::GetViewPort
QRect GetViewPort(void)
Definition: mythrenderopengl.h:119
FMT_YUV444P9
@ FMT_YUV444P9
Definition: mythframe.h:49
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:28
MythOpenGLVideo::ProcessFrame
void ProcessFrame(VideoFrame *Frame, FrameScanType Scan=kScan_Progressive)
Update the current input texture using the data from the given video frame.
Definition: mythopenglvideo.cpp:586
MythOpenGLInterop::GetAllowedRenderers
static QStringList GetAllowedRenderers(VideoFrameType Format)
Definition: mythopenglinterop.cpp:51
FMT_YUV422P10
@ FMT_YUV422P10
Definition: mythframe.h:43
FMT_YUV444P16
@ FMT_YUV444P16
Definition: mythframe.h:53
MythVideoOutputOpenGL::m_openGLPerf
MythOpenGLPerf * m_openGLPerf
Definition: mythvideooutopengl.h:77
VideoOutWindow::GetEmbeddingRect
QRect GetEmbeddingRect(void) const
Definition: videooutwindow.h:82
MythOpenGLPainter::SetSwapControl
void SetSwapControl(bool Swap)
Definition: mythpainteropengl.h:32
MythVideoOutputOpenGL::InputChanged
bool InputChanged(const QSize &VideoDim, const QSize &VideoDispDim, float Aspect, MythCodecID CodecId, bool &AspectOnly, MythMultiLocker *Locks, int ReferenceFrames, bool ForceChange) override
Tells video output to discard decoded frames and wait for new ones.
Definition: mythvideooutopengl.cpp:268
MythVideoOutputOpenGL::m_render
MythRenderOpenGL * m_render
Definition: mythvideooutopengl.h:61
MythVideoOutputOpenGL::InitPictureAttributes
void InitPictureAttributes(void) override
Definition: mythvideooutopengl.cpp:846
MythVideoOutput::SetupVisualisation
virtual bool SetupVisualisation(AudioPlayer *Audio, MythRender *Render, const QString &Name)
Definition: mythvideoout.cpp:748
MythVideoOutputOpenGL::ProcessFrame
void ProcessFrame(VideoFrame *Frame, OSD *Osd, const PIPMap &PiPPlayers, FrameScanType Scan) override
Definition: mythvideooutopengl.cpp:385
VideoColourSpace::SetSupportedAttributes
void SetSupportedAttributes(PictureAttributeSupported Supported)
Enable the given set of picture attributes.
Definition: videocolourspace.cpp:140
MythPlayer::IsPIPVisible
bool IsPIPVisible(void) const
Definition: mythplayer.h:267
FMT_YUV420P12
@ FMT_YUV420P12
Definition: mythframe.h:31
RenderOptions::safe_renderers
QMap< QString, QStringList > * safe_renderers
Definition: videodisplayprofile.h:30
LOC
#define LOC
Definition: mythvideooutopengl.cpp:18
MythRenderOpenGL::swapBuffers
void swapBuffers()
Definition: mythrenderopengl.cpp:520
MythVideoOutputOpenGL::DiscardFrames
void DiscardFrames(bool KeyFrame, bool Flushed) override
Discard video frames.
Definition: mythvideooutopengl.cpp:715
MythRenderOpenGL::makeCurrent
void makeCurrent()
Definition: mythrenderopengl.cpp:558
mythopenglperf.h
kStereoscopicModeNone
@ kStereoscopicModeNone
Definition: videoouttypes.h:120
MythVideoOutput::Init
virtual bool Init(const QSize &VideoDim, const QSize &VideoDispDim, float VideoAspect, MythDisplay *Display, const QRect &WindowRect, MythCodecID CodecID)
Definition: mythvideoout.cpp:303
MythDisplay::UsingVideoModes
virtual bool UsingVideoModes(void)
Definition: mythdisplay.h:29
VideoBuffers::Init
void Init(uint NumDecode, bool ExtraForPause, uint NeedFree, uint NeedprebufferNormal, uint NeedPrebufferSmall)
Creates buffers and sets various buffer management parameters.
Definition: videobuffers.cpp:188
MythMainWindow::GetPaintWindow
QWidget * GetPaintWindow()
Definition: mythmainwindow.cpp:254
MythRenderOpenGL::GetExtraFeatures
int GetExtraFeatures(void) const
Definition: mythrenderopengl.cpp:464
VideoBuffers::Reset
void Reset(void)
Definition: videobuffers.cpp:291
MythVideoOutputOpenGL::PrepareFrame
void PrepareFrame(VideoFrame *Frame, FrameScanType Scan, OSD *Osd) override
Definition: mythvideooutopengl.cpp:478
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:921
VideoOutWindow::GetPIPState
PIPState GetPIPState(void) const
Definition: videooutwindow.h:74
MythVideoOutput::m_videoCodecID
MythCodecID m_videoCodecID
Definition: mythvideoout.h:164
VideoOutWindow::SetRotation
void SetRotation(int Rotation)
Set the rotation in degrees.
Definition: videooutwindow.cpp:673
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:57
PIPMap
QMap< MythPlayer *, PIPLocation > PIPMap
Definition: mythvideoout.h:32
MythVideoOutputOpenGL::ShowPIP
void ShowPIP(VideoFrame *Frame, MythPlayer *PiPPlayer, PIPLocation Location) override
Definition: mythvideooutopengl.cpp:851
MythDisplay
Definition: mythdisplay.h:19
MythOpenGLVideo::OutputChanged
void OutputChanged(QSize VideoDim, QSize VideoDispDim, float)
VideoVisual::GetVisualiserList
static QStringList GetVisualiserList(RenderType type)
Definition: videovisual.cpp:14
VideoBuffers::BeginLock
frame_queue_t::iterator BeginLock(BufferType Type)
Lock the video buffers.
Definition: videobuffers.cpp:760
MythOpenGLPerf
A simple overload of QOpenGLTimeMonitor to record and log OpenGL execution intervals.
Definition: mythopenglperf.h:38
FMT_YUV444P12
@ FMT_YUV444P12
Definition: mythframe.h:51
MythVideoOutput::m_deinterlacer
MythDeinterlacer m_deinterlacer
Definition: mythvideoout.h:173
ALL_PICTURE_ATTRIBUTES
#define ALL_PICTURE_ATTRIBUTES
Definition: videoouttypes.h:111
VideoFrame::disp_timecode
int64_t disp_timecode
Definition: mythframe.h:151
codec_sw_copy
#define codec_sw_copy(id)
Definition: mythcodecid.h:349
kStereoscopicModeSideBySide
@ kStereoscopicModeSideBySide
Definition: videoouttypes.h:121
MythVideoOutputOpenGL::DoneDisplayingFrame
void DoneDisplayingFrame(VideoFrame *Frame) override
Release a video frame back into the decoder pool.
Definition: mythvideooutopengl.cpp:677
MythVideoOutputOpenGL::RemovePIP
void RemovePIP(MythPlayer *PiPPlayer) override
Definition: mythvideooutopengl.cpp:922
MythVideoOutput::IsErrored
bool IsErrored() const
Definition: mythvideoout.cpp:630
kPBPLeft
@ kPBPLeft
Definition: videoouttypes.h:13
VideoOutWindow::IsEmbedding
bool IsEmbedding(void) const
Definition: videooutwindow.h:70
FMT_NVDEC
@ FMT_NVDEC
Definition: mythframe.h:67
MythRenderOpenGL::doneCurrent
void doneCurrent()
Definition: mythrenderopengl.cpp:566
codec_is_drmprime
#define codec_is_drmprime(id)
Definition: mythcodecid.h:296
MythVideoOutput::m_display
MythDisplay * m_display
Definition: mythvideoout.h:158
mythuihelper.h
VideoBuffers::EndLock
void EndLock()
Definition: videobuffers.cpp:769
mythpainteropengl.h
VideoBuffers::DiscardPauseFrames
void DiscardPauseFrames(void)
Definition: videobuffers.cpp:487
kVideoBuffer_pause
@ kVideoBuffer_pause
Definition: videobuffers.h:32
VideoColourSpace
VideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: videocolourspace.h:18
FMT_YUV422P9
@ FMT_YUV422P9
Definition: mythframe.h:42
VideoBuffers::Dequeue
VideoFrame * Dequeue(BufferType Type)
Definition: videobuffers.cpp:666
kPIPStandAlone
@ kPIPStandAlone
Definition: videoouttypes.h:12
MythOpenGLVideo::ResetFrameFormat
void ResetFrameFormat(void)
Definition: mythopenglvideo.cpp:561
VERBOSE_LEVEL_CHECK
#define VERBOSE_LEVEL_CHECK(_MASK_, _LEVEL_)
Definition: mythlogging.h:14
myth2av_codecid
AVCodecID myth2av_codecid(MythCodecID codec_id)
Definition: mythcodecid.cpp:228
FMT_YUV420P9
@ FMT_YUV420P9
Definition: mythframe.h:29
VideoOutWindow::WindowRectChanged
void WindowRectChanged(const QRect &WindowRect)
MythVideoOutputOpenGL::m_newCodecId
MythCodecID m_newCodecId
Definition: mythvideooutopengl.h:69
MythOpenGLVideo::SetMasterViewport
void SetMasterViewport(QSize Size)
Definition: mythopenglvideo.cpp:133
MythRenderOpenGL::BindFramebuffer
void BindFramebuffer(QOpenGLFramebufferObject *Framebuffer)
Definition: mythrenderopengl.cpp:776
MythVideoOutput::ResizeForVideo
virtual void ResizeForVideo(QSize Size=QSize())
Definition: mythvideoout.cpp:937
PIPLocation
PIPLocation
Definition: videoouttypes.h:18
MythOpenGLVideo
Definition: mythopenglvideo.h:24
VideoDisplayProfile::GetVideoRenderer
QString GetVideoRenderer(void) const
Definition: videodisplayprofile.cpp:424
VideoOutWindow::VideoSizeChanged
void VideoSizeChanged(const QSize &VideoDim, const QSize &VideoDispDim)
FMT_VDPAU
@ FMT_VDPAU
Definition: mythframe.h:61
MythVideoOutputOpenGL::LegacyFormats
@ LegacyFormats
Definition: mythvideooutopengl.h:18
MythVideoOutputOpenGL::GetVisualiserList
QStringList GetVisualiserList(void) override
Definition: mythvideooutopengl.cpp:934
kScan_Interlaced
@ kScan_Interlaced
Definition: videoouttypes.h:82
kVideoBuffer_used
@ kVideoBuffer_used
Definition: videobuffers.h:31
MythRender
Definition: mythrender_base.h:23
FMT_YUV422P16
@ FMT_YUV422P16
Definition: mythframe.h:46
kLetterBoxColour_Gray25
@ kLetterBoxColour_Gray25
Definition: videoouttypes.h:74
MythPainter
Definition: mythpainter.h:33
Name
Definition: channelsettings.cpp:47
codec_is_vaapi
#define codec_is_vaapi(id)
Definition: mythcodecid.h:311
MythOpenGLVideo::SetVideoDimensions
void SetVideoDimensions(const QSize &VideoDim, const QSize &VideoDispDim)
Definition: mythopenglvideo.cpp:138
VideoOutWindow::GetVideoAspect
float GetVideoAspect(void) const
Definition: videooutwindow.h:89
MythVideoOutput::m_stereo
StereoscopicMode m_stereo
Definition: mythvideoout.h:171
FMT_YUV422P12
@ FMT_YUV422P12
Definition: mythframe.h:44
MythVideoOutputOpenGL::CreateBuffers
bool CreateBuffers(MythCodecID CodecID, QSize Size)
Definition: mythvideooutopengl.cpp:356
MythPlayer::GetVideoAspect
float GetVideoAspect(void) const
Definition: mythplayer.h:218
MythOpenGLVideo::IsValid
bool IsValid(void) const
Definition: mythopenglvideo.cpp:77
MythVideoOutput::CanVisualise
virtual bool CanVisualise(AudioPlayer *Audio, MythRender *Render)
Definition: mythvideoout.cpp:743
PIPState
PIPState
Definition: videoouttypes.h:9
MythRenderOpenGL::GetOpenGLRender
static MythRenderOpenGL * GetOpenGLRender(void)
Definition: mythrenderopengl.cpp:63
mythcontext.h
VideoOutWindow::VideoIsFullScreen
bool VideoIsFullScreen(void) const
Check whether the video display rect covers the entire window/framebuffer.
Definition: videooutwindow.cpp:827
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:107
codec_is_v4l2
#define codec_is_v4l2(id)
Definition: mythcodecid.h:338
VideoFrame::already_deinterlaced
bool already_deinterlaced
temporary? TODO move scan detection/tracking into decoder
Definition: mythframe.h:172
MythOpenGLVideo::PrepareFrame
void PrepareFrame(VideoFrame *Frame, bool TopFieldFirst, FrameScanType Scan, StereoscopicMode Stereo, bool DrawBorder=false)
Definition: mythopenglvideo.cpp:687
MythVideoOutputOpenGL::WindowResized
void WindowResized(const QSize &Size) override
Definition: mythvideooutopengl.cpp:744
mythvideooutopengl.h
MythVideoOutputOpenGL::~MythVideoOutputOpenGL
~MythVideoOutputOpenGL() override
Definition: mythvideooutopengl.cpp:157
mythcodeccontext.h
MythRender::Type
RenderType Type(void) const
Definition: mythrender_base.h:39
FMT_MMAL
@ FMT_MMAL
Definition: mythframe.h:64
VideoFrameType
VideoFrameType
Definition: mythframe.h:25
FMT_VAAPI
@ FMT_VAAPI
Definition: mythframe.h:62
codec_is_vtb
#define codec_is_vtb(id)
Definition: mythcodecid.h:333
VideoOutWindow::GetVideoDim
QSize GetVideoDim(void) const
Definition: videooutwindow.h:71
VideoVisual::Draw
virtual void Draw(const QRect &area, MythPainter *painter, QPaintDevice *device)=0
MythVideoOutputOpenGL::m_buffersCreated
bool m_buffersCreated
Definition: mythvideooutopengl.h:74
MythVideoOutputOpenGL::m_newVideoDim
QSize m_newVideoDim
Definition: mythvideooutopengl.h:70
MythVideoOutput::ShowPIPs
virtual void ShowPIPs(VideoFrame *Frame, const PIPMap &PiPPlayers)
Definition: mythvideoout.cpp:683
FMT_NV12
@ FMT_NV12
Definition: mythframe.h:57
MythPlayer::GetCurrentFrame
VideoFrame * GetCurrentFrame(int &w, int &h)
Definition: mythplayer.cpp:1035
MythVideoOutputOpenGL::m_openGLVideoPiPs
QMap< MythPlayer *, MythOpenGLVideo * > m_openGLVideoPiPs
Definition: mythvideooutopengl.h:64
MythOpenGLPerf::RecordSample
void RecordSample(void)
Definition: mythopenglperf.cpp:39
FMT_P016
@ FMT_P016
Definition: mythframe.h:59
MythVideoOutputOpenGL::GetOSDPainter
MythPainter * GetOSDPainter(void) override
Definition: mythvideooutopengl.cpp:941
MythVideoOutput::m_maxReferenceFrames
int m_maxReferenceFrames
Definition: mythvideoout.h:165
ReferenceCounter::IncrRef
virtual int IncrRef(void)
Increments reference count.
Definition: referencecounter.cpp:101
MythVideoOutputOpenGL::Init
bool Init(const QSize &VideoDim, const QSize &VideoDispDim, float Aspect, MythDisplay *Display, const QRect &DisplayVisibleRect, MythCodecID CodecId) override
Definition: mythvideooutopengl.cpp:187
MythVideoOutputOpenGL::SetVideoFrameRate
void SetVideoFrameRate(float NewRate) override
Definition: mythvideooutopengl.cpp:254
mythmainwindow.h
is_interlaced
bool is_interlaced(FrameScanType Scan)
Definition: videoouttypes.h:174
MythRenderOpenGL::ClearRect
void ClearRect(QOpenGLFramebufferObject *Target, const QRect &Area, int Color)
An optimised method to clear a QRect to the given color.
Definition: mythrenderopengl.cpp:921
VideoBuffers::GetStatus
QString GetStatus(uint Num=0) const
Definition: videobuffers.cpp:1108
MythVideoOutputOpenGL::m_textureFormats
TextureFormats m_textureFormats
Definition: mythvideooutopengl.h:62
kGLTiled
@ kGLTiled
Definition: mythrenderopengl.h:43
VideoBuffers::Enqueue
void Enqueue(BufferType Type, VideoFrame *Frame)
Definition: videobuffers.cpp:697
VideoOutWindow::GetWindowRect
QRect GetWindowRect(void) const
Definition: videooutwindow.h:77
VideoBuffers::Size
uint Size(BufferType Type) const
Definition: videobuffers.cpp:781
OSD
Definition: osd.h:132
VideoBuffers::GetNumBuffers
static uint GetNumBuffers(int PixelFormat, int MaxReferenceFrames=16, bool Decoder=false)
Definition: videobuffers.cpp:135
MythMainWindow
Definition: mythmainwindow.h:33
VideoBuffers::DeleteBuffers
void DeleteBuffers(void)
Definition: videobuffers.cpp:1054
VideoBuffers::Head
VideoFrame * Head(BufferType Type)
Definition: videobuffers.cpp:675
MythVideoOutput::m_videoBuffers
VideoBuffers m_videoBuffers
Definition: mythvideoout.h:167
VideoOutWindow::GetDisplayVisibleRect
QRect GetDisplayVisibleRect(void) const
Definition: videooutwindow.h:76
RenderOptions::priorities
QMap< QString, uint > * priorities
Definition: videodisplayprofile.h:32
MythVideoOutput::EmbedInWidget
virtual void EmbedInWidget(const QRect &EmbedRect)
Tells video output to embed video in an existing window.
Definition: mythvideoout.cpp:443
OpenGLLocker
Definition: mythrenderopengl.h:253