MythTV  master
mythvdpauhelper.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "mythlogging.h"
3 #include "mythvideocolourspace.h"
4 #include "mythvdpauhelper.h"
5 #include "platforms/mythxdisplay.h" // always last
6 
7 // Std
8 #include <cmath>
9 
10 #define LOC QString("VDPAUHelp: ")
11 
12 #define INIT_ST \
13 VdpStatus status; \
14 bool ok = true;
15 
16 #define CHECK_ST \
17 ok &= (status == VDP_STATUS_OK); \
18 if (!ok) \
19 { \
20  LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("Error at %1:%2 (#%3, %4)") \
21  .arg(__FILE__).arg( __LINE__).arg(status) \
22  .arg(m_vdpGetErrorString(status))); \
23 }
24 
25 #define GET_PROC(FUNC_ID, PROC) \
26 status = m_vdpGetProcAddress(m_device, FUNC_ID, reinterpret_cast<void **>(&(PROC))); CHECK_ST
27 
28 VDPAUCodec::VDPAUCodec(MythCodecContext::CodecProfile Profile, QSize Size, uint32_t Macroblocks, uint32_t Level)
29  : m_maxSize(Size),
30  m_maxMacroBlocks(Macroblocks),
31  m_maxLevel(Level)
32 {
33  // Levels don't work for MPEG1/2
34  if (MythCodecContext::MPEG1 <= Profile && Profile <= MythCodecContext::MPEG2SNR)
35  m_maxLevel = 1000;
36 }
37 
38 bool VDPAUCodec::Supported(int Width, int Height, int Level) const
39 {
40  // Note - level checks are now ignored here and in FFmpeg
41  uint32_t macros = static_cast<uint32_t>(((Width + 15) & ~15) * ((Height + 15) & ~15)) / 256;
42  bool result = (Width <= m_maxSize.width()) && (Height <= m_maxSize.height()) &&
43  (macros <= m_maxMacroBlocks) /*&& (static_cast<uint32_t>(Level) <= m_maxLevel)*/;
44  if (!result)
45  {
46  LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Not supported: Size %1x%2 > %3x%4, MBs %5 > %6, Level %7 > %8")
47  .arg(Width).arg(Height).arg(m_maxSize.width()).arg(m_maxSize.height())
48  .arg(macros).arg(m_maxMacroBlocks).arg(Level).arg(m_maxLevel));
49  }
50  return result;
51 }
52 
54 {
55  static QMutex s_mutex;
56  static bool s_checked = false;
57  static bool s_available = false;
58 
59  QMutexLocker locker(&s_mutex);
60  if (s_checked)
61  return s_available;
62 
63  {
64  MythVDPAUHelper vdpau;
65  s_available = vdpau.IsValid();
66  }
67 
68  s_checked = true;
69  if (s_available)
70  {
71  LOG(VB_GENERAL, LOG_INFO, LOC + "Supported/available VDPAU decoders:");
72  const VDPAUProfiles& profiles = MythVDPAUHelper::GetProfiles();
73  for (auto profile : qAsConst(profiles))
74  LOG(VB_GENERAL, LOG_INFO, LOC +
76  }
77  else
78  {
79  LOG(VB_GENERAL, LOG_INFO, LOC + "VDPAU is NOT available");
80  }
81  return s_available;
82 }
83 
84 bool MythVDPAUHelper::ProfileCheck(VdpDecoderProfile Profile, uint32_t &Level,
85  uint32_t &Macros, uint32_t &Width, uint32_t &Height)
86 {
87  if (!m_device)
88  return false;
89 
90  INIT_ST
91  VdpBool supported = VDP_FALSE;
92  status = m_vdpDecoderQueryCapabilities(m_device, Profile, &supported,
93  &Level, &Macros, &Width, &Height);
94  CHECK_ST
95 
96  LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("ProfileCheck: Prof %1 Supp %2 Level %3 Macros %4 Width %5 Height %6 Status %7")
97  .arg(Profile).arg(supported).arg(Level).arg(Macros).arg(Width).arg(Height).arg(status));
98 
99  if (((supported != VDP_TRUE) || (status != VDP_STATUS_OK)) &&
100  (Profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE ||
101  Profile == VDP_DECODER_PROFILE_H264_BASELINE))
102  {
103  LOG(VB_GENERAL, LOG_INFO, LOC + QString("Driver does not report support for H264 %1Baseline")
104  .arg(Profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE ? "Constrained " : ""));
105 
106  // H264 Constrained baseline is reported as not supported on older chipsets but
107  // works due to support for H264 Main. Test for H264 main if constrained baseline
108  // fails - which mimics the fallback in FFmpeg.
109  // Updated to included baseline... not so sure about that:)
110  status = m_vdpDecoderQueryCapabilities(m_device, VDP_DECODER_PROFILE_H264_MAIN, &supported,
111  &Level, &Macros, &Width, &Height);
112  CHECK_ST
113  if (supported == VDP_TRUE)
114  LOG(VB_GENERAL, LOG_INFO, LOC + "... but assuming available as H264 Main is supported");
115  }
116 
117  return supported == VDP_TRUE;
118 }
119 
121 {
122  static const std::array<const VdpDecoderProfile,15> MainProfiles
123  {
124  VDP_DECODER_PROFILE_MPEG1, VDP_DECODER_PROFILE_MPEG2_SIMPLE, VDP_DECODER_PROFILE_MPEG2_MAIN,
125  VDP_DECODER_PROFILE_MPEG4_PART2_SP, VDP_DECODER_PROFILE_MPEG4_PART2_ASP,
126  VDP_DECODER_PROFILE_VC1_SIMPLE, VDP_DECODER_PROFILE_VC1_MAIN, VDP_DECODER_PROFILE_VC1_ADVANCED,
127  VDP_DECODER_PROFILE_H264_BASELINE, VDP_DECODER_PROFILE_H264_MAIN, VDP_DECODER_PROFILE_H264_HIGH,
128  VDP_DECODER_PROFILE_H264_EXTENDED, VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE,
129  VDP_DECODER_PROFILE_H264_CONSTRAINED_HIGH, VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE
130  };
131 
132  static const std::array<const VdpDecoderProfile,4> HEVCProfiles
133  {
134  VDP_DECODER_PROFILE_HEVC_MAIN, VDP_DECODER_PROFILE_HEVC_MAIN_10,
135  VDP_DECODER_PROFILE_HEVC_MAIN_STILL, VDP_DECODER_PROFILE_HEVC_MAIN_444
136  };
137 
138  auto VDPAUToMythProfile = [](VdpDecoderProfile Profile)
139  {
140  switch (Profile)
141  {
142  case VDP_DECODER_PROFILE_MPEG1: return MythCodecContext::MPEG1;
143  case VDP_DECODER_PROFILE_MPEG2_SIMPLE: return MythCodecContext::MPEG2Simple;
144  case VDP_DECODER_PROFILE_MPEG2_MAIN: return MythCodecContext::MPEG2Main;
145 
146  case VDP_DECODER_PROFILE_MPEG4_PART2_SP: return MythCodecContext::MPEG4Simple;
147  case VDP_DECODER_PROFILE_MPEG4_PART2_ASP: return MythCodecContext::MPEG4AdvancedSimple;
148 
149  case VDP_DECODER_PROFILE_VC1_SIMPLE: return MythCodecContext::VC1Simple;
150  case VDP_DECODER_PROFILE_VC1_MAIN: return MythCodecContext::VC1Main;
151  case VDP_DECODER_PROFILE_VC1_ADVANCED: return MythCodecContext::VC1Advanced;
152 
153  case VDP_DECODER_PROFILE_H264_BASELINE: return MythCodecContext::H264Baseline;
154  case VDP_DECODER_PROFILE_H264_MAIN: return MythCodecContext::H264Main;
155  case VDP_DECODER_PROFILE_H264_HIGH: return MythCodecContext::H264High;
156  case VDP_DECODER_PROFILE_H264_EXTENDED: return MythCodecContext::H264Extended;
157  case VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE: return MythCodecContext::H264ConstrainedBaseline;
158  case VDP_DECODER_PROFILE_H264_CONSTRAINED_HIGH: return MythCodecContext::H264ConstrainedHigh;
159  case VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE: return MythCodecContext::H264High444; // ?
160 
161  case VDP_DECODER_PROFILE_HEVC_MAIN: return MythCodecContext::HEVCMain;
162  case VDP_DECODER_PROFILE_HEVC_MAIN_10: return MythCodecContext::HEVCMain10;
163  case VDP_DECODER_PROFILE_HEVC_MAIN_STILL: return MythCodecContext::HEVCMainStill;
164  case VDP_DECODER_PROFILE_HEVC_MAIN_444: return MythCodecContext::HEVCRext;
165  }
167  };
168 
169  static QMutex lock(QMutex::Recursive);
170  static bool s_initialised = false;
171  static VDPAUProfiles s_profiles;
172 
173  QMutexLocker locker(&lock);
174  if (s_initialised)
175  return s_profiles;
176  s_initialised = true;
177 
178  MythVDPAUHelper helper;
179  if (!helper.IsValid())
180  return s_profiles;
181 
182  uint32_t level = 0;
183  uint32_t macros = 0;
184  uint32_t width = 0;
185  uint32_t height = 0;
186  for (VdpDecoderProfile profile : MainProfiles)
187  {
188  if (helper.ProfileCheck(profile, level, macros, width, height))
189  {
190  MythCodecContext::CodecProfile prof = VDPAUToMythProfile(profile);
191  s_profiles.push_back(VDPAUProfile(prof,
192  VDPAUCodec(prof, QSize(static_cast<int>(width), static_cast<int>(height)), macros, level)));
193  }
194  }
195 
196  if (helper.HEVCSupported())
197  {
198  for (VdpDecoderProfile profile : HEVCProfiles)
199  {
200  if (helper.ProfileCheck(profile, level, macros, width, height))
201  {
202  MythCodecContext::CodecProfile prof = VDPAUToMythProfile(profile);
203  s_profiles.push_back(VDPAUProfile(prof,
204  VDPAUCodec(prof, QSize(static_cast<int>(width), static_cast<int>(height)), macros, level)));
205  }
206  }
207  }
208 
209  return s_profiles;
210 }
211 
212 void MythVDPAUHelper::GetDecoderList(QStringList &Decoders)
213 {
214  const VDPAUProfiles& profiles = MythVDPAUHelper::GetProfiles();
215  if (profiles.empty())
216  return;
217 
218  Decoders.append("VDPAU:");
219  for (auto profile : qAsConst(profiles))
220  if (profile.first != MythCodecContext::MJPEG)
221  Decoders.append(MythCodecContext::GetProfileDescription(profile.first, profile.second.m_maxSize));
222 }
223 
224 static void vdpau_preemption_callback(VdpDevice /*unused*/, void* Opaque)
225 {
226  auto* helper = static_cast<MythVDPAUHelper*>(Opaque);
227  if (helper)
228  helper->SetPreempted();
229 }
230 
235  : m_device(Context->device),
236  m_vdpGetProcAddress(Context->get_proc_address)
237 {
238  m_valid = InitProcs();
239  if (m_valid)
240  {
241  INIT_ST
243  CHECK_ST
244  if (!ok)
245  LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to register preemption callback");
246  }
247 }
248 
249 static const char* DummyGetError(VdpStatus /*status*/)
250 {
251  return "Unknown";
252 }
253 
255  : m_createdDevice(true)
256 {
258  if (!m_display)
259  return;
260 
261  INIT_ST
263  XLOCK(m_display, status = vdp_device_create_x11(m_display->GetDisplay(),
264  m_display->GetScreen(),
266  CHECK_ST
267  if (!ok)
268  {
269  LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to create VDPAU device.");
270  return;
271  }
272  m_valid = InitProcs();
273 }
274 
276 {
278  m_vdpPreemptionCallbackRegister(m_device, nullptr, nullptr);
281  delete m_display;
282 }
283 
285 {
286  INIT_ST
287  GET_PROC(VDP_FUNC_ID_GET_ERROR_STRING, m_vdpGetErrorString)
288  if (!ok)
289  {
291  ok = true;
292  }
293  GET_PROC(VDP_FUNC_ID_GET_INFORMATION_STRING, m_vdpGetInformationString)
294  GET_PROC(VDP_FUNC_ID_DEVICE_DESTROY, m_vdpDeviceDestroy)
295  GET_PROC(VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES, m_vdpDecoderQueryCapabilities)
296  GET_PROC(VDP_FUNC_ID_DECODER_CREATE, m_vdpDecoderCreate)
297  GET_PROC(VDP_FUNC_ID_DECODER_DESTROY, m_vdpDecoderDestroy)
298  GET_PROC(VDP_FUNC_ID_VIDEO_MIXER_CREATE, m_vdpVideoMixerCreate)
299  GET_PROC(VDP_FUNC_ID_VIDEO_MIXER_DESTROY, m_vdpVideoMixerDestroy)
300  GET_PROC(VDP_FUNC_ID_VIDEO_MIXER_RENDER, m_vdpVideoMixerRender)
301  GET_PROC(VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES, m_vdpVideoMixerSetAttributeValues)
302  GET_PROC(VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES, m_vdpVideoMixerSetFeatureEnables)
303  GET_PROC(VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT, m_vdpVideoMixerQueryFeatureSupport)
304  GET_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_CREATE, m_vdpOutputSurfaceCreate)
305  GET_PROC(VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY, m_vdpOutputSurfaceDestroy)
306  GET_PROC(VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS, m_vdpVideoSurfaceGetParameters)
307  GET_PROC(VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER, m_vdpPreemptionCallbackRegister)
308 
309  return ok;
310 }
311 
312 bool MythVDPAUHelper::IsValid(void) const
313 {
314  return m_valid;
315 }
316 
318 {
319  emit DisplayPreempted();
320 }
321 
323 {
324  if (!m_valid)
325  return false;
326 
327  // FFmpeg will disallow HEVC VDPAU for driver versions < 410
328  const char* infostring = nullptr;
329  INIT_ST
330  status = m_vdpGetInformationString(&infostring);
331  CHECK_ST
332  if (!ok || !infostring)
333  return false;
334 
335  int driver = 0;
336  sscanf(infostring, "NVIDIA VDPAU Driver Shared Library %d", &driver);
337  return !(driver < 410);
338 }
339 
341 {
342  if (!Context)
343  return false;
344 
345  int mbs = static_cast<int>(ceil(static_cast<double>(Context->width) / 16.0));
346  if (!(mbs == 49 || mbs == 54 || mbs == 59 || mbs == 64 ||
347  mbs == 113 || mbs == 118 ||mbs == 123 || mbs == 128))
348  {
349  return true;
350  }
351 
352  VdpDecoderProfile profile = 0;
353  switch (Context->profile & ~FF_PROFILE_H264_INTRA)
354  {
355  case FF_PROFILE_H264_BASELINE: profile = VDP_DECODER_PROFILE_H264_BASELINE; break;
356  case FF_PROFILE_H264_CONSTRAINED_BASELINE: profile = VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE; break;
357  case FF_PROFILE_H264_MAIN: profile = VDP_DECODER_PROFILE_H264_MAIN; break;
358  case FF_PROFILE_H264_HIGH: profile = VDP_DECODER_PROFILE_H264_HIGH; break;
359 #ifdef VDP_DECODER_PROFILE_H264_EXTENDED
360  case FF_PROFILE_H264_EXTENDED: profile = VDP_DECODER_PROFILE_H264_EXTENDED; break;
361 #endif
362  case FF_PROFILE_H264_HIGH_10: profile = VDP_DECODER_PROFILE_H264_HIGH; break;
363 #ifdef VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE
364  case FF_PROFILE_H264_HIGH_422:
365  case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
366  case FF_PROFILE_H264_CAVLC_444: profile = VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE; break;
367 #endif
368  default: return false;
369  }
370 
371  // Create an instance
372  MythVDPAUHelper helper;
373  if (helper.IsValid())
374  return helper.H264DecodeCheck(profile, Context);
375  return false;
376 }
377 
378 bool MythVDPAUHelper::H264DecodeCheck(VdpDecoderProfile Profile, AVCodecContext *Context)
379 {
380  if (!m_valid || !Context)
381  return false;
382 
383  INIT_ST
384  VdpDecoder tmp = 0;
385  status = m_vdpDecoderCreate(m_device, Profile, static_cast<uint>(Context->width),
386  static_cast<uint>(Context->height), 2, &tmp);
387  CHECK_ST
388  if (tmp)
390  if (!ok)
391  {
392  LOG(VB_GENERAL, LOG_INFO, LOC + QString("No H264 decoder support for %1x%2")
393  .arg(Context->width).arg(Context->height));
394  }
395  return ok;
396 }
397 
398 VdpOutputSurface MythVDPAUHelper::CreateOutputSurface(QSize Size)
399 {
400  if (!m_valid)
401  return 0;
402 
403  VdpOutputSurface result = 0;
404  INIT_ST
405  status = m_vdpOutputSurfaceCreate(m_device, VDP_RGBA_FORMAT_B8G8R8A8,
406  static_cast<uint>(Size.width()),
407  static_cast<uint>(Size.height()), &result);
408  CHECK_ST
409  return result;
410 }
411 
413 {
414  if (!Surface)
415  return;
416 
417  INIT_ST
419  CHECK_ST
420 }
421 
422 VdpVideoMixer MythVDPAUHelper::CreateMixer(QSize Size, VdpChromaType ChromaType,
423  MythDeintType Deinterlacer)
424 {
425  if (!m_valid || Size.isEmpty())
426  return 0;
427 
428  VdpVideoMixer result = 0;
429 
430  static const std::array<const VdpVideoMixerParameter,4> parameters {
431  VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH,
432  VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT,
433  VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE,
434  VDP_VIDEO_MIXER_PARAMETER_LAYERS,
435  };
436 
437 
438  uint width = static_cast<uint>(Size.width());
439  uint height = static_cast<uint>(Size.height());
440  uint layers = 0;
441  std::array<void const *,4> parametervalues { &width, &height, &ChromaType, &layers};
442 
443  uint32_t featurecount = 0;
444  std::array<VdpVideoMixerFeature,2> features {};
445  VdpBool enable = VDP_TRUE;
446  const std::array<VdpBool,2> enables = { enable, enable };
447 
448  if (DEINT_MEDIUM == Deinterlacer || DEINT_HIGH == Deinterlacer)
449  {
450  features[featurecount] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL;
451  featurecount++;
452  }
453 
454  if (DEINT_HIGH== Deinterlacer)
455  {
456  features[featurecount] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL;
457  featurecount++;
458  }
459 
460  INIT_ST
461  status = m_vdpVideoMixerCreate(m_device, featurecount, featurecount ? features.data() : nullptr,
462  4, parameters.data(), parametervalues.data(), &result);
463  CHECK_ST
464 
465  if (!ok || !result)
466  {
467  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create video mixer");
468  return result;
469  }
470 
471  status = m_vdpVideoMixerSetFeatureEnables(result, featurecount, features.data(), enables.data());
472  CHECK_ST
473  return result;
474 }
475 
476 void MythVDPAUHelper::MixerRender(VdpVideoMixer Mixer, VdpVideoSurface Source,
477  VdpOutputSurface Dest, FrameScanType Scan, int TopFieldFirst,
478  QVector<AVBufferRef*>& Frames)
479 {
480  if (!m_valid || !Mixer || !Source || !Dest)
481  return;
482 
483  VdpVideoMixerPictureStructure field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME;
484  if (kScan_Interlaced == Scan)
485  {
486  field = TopFieldFirst ? VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD :
487  VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD;
488  }
489  else if (kScan_Intr2ndField == Scan)
490  {
491  field = TopFieldFirst ? VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD :
492  VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD;
493  }
494 
495  int count = Frames.size();
496  if ((count < 1) || (field == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME))
497  {
498  INIT_ST
499  status = m_vdpVideoMixerRender(Mixer, VDP_INVALID_HANDLE, nullptr, field,
500  0, nullptr, Source, 0, nullptr, nullptr, Dest, nullptr, nullptr, 0, nullptr);
501  CHECK_ST
502  }
503  else
504  {
505  std::array<VdpVideoSurface,2> past = { VDP_INVALID_HANDLE, VDP_INVALID_HANDLE };
506  std::array<VdpVideoSurface,1> future = { VDP_INVALID_HANDLE };
507 
508  auto next = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frames[0]->data));
509  auto current = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frames[count > 1 ? 1 : 0]->data));
510  auto last = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frames[count > 2 ? 2 : 0]->data));
511 
512  if (field == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD)
513  {
514  future[0] = current;
515  past[0] = past[1] = last;
516  }
517  else
518  {
519  future[0] = next;
520  past[0] = current;
521  past[1] = last;
522  }
523 
524  INIT_ST
525  status = m_vdpVideoMixerRender(Mixer, VDP_INVALID_HANDLE, nullptr, field,
526  2, past.data(), current, 1, future.data(),
527  nullptr, Dest, nullptr, nullptr, 0, nullptr);
528  CHECK_ST
529  }
530 }
531 
532 void MythVDPAUHelper::DeleteMixer(VdpVideoMixer Mixer)
533 {
534  if (!Mixer)
535  return;
536 
537  INIT_ST
538  status = m_vdpVideoMixerDestroy(Mixer);
539  CHECK_ST
540 }
541 
542 void MythVDPAUHelper::SetCSCMatrix(VdpVideoMixer Mixer, MythVideoColourSpace *ColourSpace)
543 {
544  if (!Mixer || !ColourSpace)
545  return;
546 
547  VdpVideoMixerAttribute attr = { VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX };
548  void const* val = { ColourSpace->data() };
549 
550  INIT_ST
551  status = m_vdpVideoMixerSetAttributeValues(Mixer, 1, &attr, &val);
552  CHECK_ST
553 }
554 
556 {
557  if (!m_valid)
558  return false;
559 
560  INIT_ST
561  auto supported = static_cast<VdpBool>(false);
562  status = m_vdpVideoMixerQueryFeatureSupport(m_device, Feature, &supported);
563  CHECK_ST
564  return ok && static_cast<bool>(supported);
565 }
566 
567 QSize MythVDPAUHelper::GetSurfaceParameters(VdpVideoSurface Surface, VdpChromaType &Chroma)
568 {
569  if (!Surface)
570  return {};
571 
572  uint width = 0;
573  uint height = 0;
574  INIT_ST
575  status = m_vdpVideoSurfaceGetParameters(Surface, &Chroma, &width, &height);
576  CHECK_ST
577 
578  return {static_cast<int>(width), static_cast<int>(height)};
579 }
MythCodecContext::VC1Simple
@ VC1Simple
Definition: mythcodeccontext.h:102
INIT_ST
#define INIT_ST
Definition: mythvdpauhelper.cpp:12
MythCodecContext::MPEG4Simple
@ MPEG4Simple
Definition: mythcodeccontext.h:66
MythVDPAUHelper::GetProfiles
static const VDPAUProfiles & GetProfiles(void)
Definition: mythvdpauhelper.cpp:120
MythVDPAUHelper::~MythVDPAUHelper
~MythVDPAUHelper(void) override
Definition: mythvdpauhelper.cpp:275
MythVDPAUHelper::m_vdpVideoMixerQueryFeatureSupport
VdpVideoMixerQueryFeatureSupport * m_vdpVideoMixerQueryFeatureSupport
Definition: mythvdpauhelper.h:107
MythCodecContext::H264Baseline
@ H264Baseline
Definition: mythcodeccontext.h:84
MythCodecContext::MPEG2Simple
@ MPEG2Simple
Definition: mythcodeccontext.h:59
DEINT_MEDIUM
@ DEINT_MEDIUM
Definition: mythframe.h:66
MythVDPAUHelper::m_vdpOutputSurfaceDestroy
VdpOutputSurfaceDestroy * m_vdpOutputSurfaceDestroy
Definition: mythvdpauhelper.h:109
MythCodecContext::VC1Advanced
@ VC1Advanced
Definition: mythcodeccontext.h:105
MythVDPAUHelper::m_vdpDecoderQueryCapabilities
VdpDecoderQueryCapabilities * m_vdpDecoderQueryCapabilities
Definition: mythvdpauhelper.h:99
VDPAUCodec::m_maxSize
QSize m_maxSize
Definition: mythvdpauhelper.h:32
MythVDPAUHelper::SetCSCMatrix
void SetCSCMatrix(VdpVideoMixer Mixer, MythVideoColourSpace *ColourSpace)
Definition: mythvdpauhelper.cpp:542
MythCodecContext::HEVCMain10
@ HEVCMain10
Definition: mythcodeccontext.h:96
VDPAUCodec::m_maxMacroBlocks
uint32_t m_maxMacroBlocks
Definition: mythvdpauhelper.h:33
VDPAUProfiles
std::vector< VDPAUProfile > VDPAUProfiles
Definition: mythvdpauhelper.h:38
MythCodecContext::NoProfile
@ NoProfile
Definition: mythcodeccontext.h:56
MythCodecContext::MPEG4AdvancedSimple
@ MPEG4AdvancedSimple
Definition: mythcodeccontext.h:81
VDPAUCodec::m_maxLevel
uint32_t m_maxLevel
Definition: mythvdpauhelper.h:34
MythCodecContext::CodecProfile
CodecProfile
Definition: mythcodeccontext.h:55
MythVDPAUHelper::m_vdpGetErrorString
VdpGetErrorString * m_vdpGetErrorString
Definition: mythvdpauhelper.h:96
MythVDPAUHelper::MythVDPAUHelper
MythVDPAUHelper(void)
Definition: mythvdpauhelper.cpp:254
MythCodecContext::HEVCRext
@ HEVCRext
Definition: mythcodeccontext.h:98
MythCodecContext::VC1Main
@ VC1Main
Definition: mythcodeccontext.h:103
arg
arg(title).arg(filename).arg(doDelete))
Surface
Definition: surface.h:4
FrameScanType
FrameScanType
Definition: videoouttypes.h:61
MythVDPAUHelper::m_valid
bool m_valid
Definition: mythvdpauhelper.h:90
Context
QHash< QString, Action * > Context
Definition: action.h:77
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythVDPAUHelper::HaveVDPAU
static bool HaveVDPAU(void)
Definition: mythvdpauhelper.cpp:53
MythVDPAUHelper::m_vdpVideoMixerDestroy
VdpVideoMixerDestroy * m_vdpVideoMixerDestroy
Definition: mythvdpauhelper.h:103
MythVDPAUHelper::IsFeatureAvailable
bool IsFeatureAvailable(uint Feature)
Definition: mythvdpauhelper.cpp:555
MythVDPAUHelper::CreateOutputSurface
VdpOutputSurface CreateOutputSurface(QSize Size)
Definition: mythvdpauhelper.cpp:398
MythCodecContext::HEVCMainStill
@ HEVCMainStill
Definition: mythcodeccontext.h:97
MythVDPAUHelper::InitProcs
bool InitProcs(void)
Definition: mythvdpauhelper.cpp:284
MythCodecContext::H264Extended
@ H264Extended
Definition: mythcodeccontext.h:90
MythCodecContext::H264ConstrainedBaseline
@ H264ConstrainedBaseline
Definition: mythcodeccontext.h:85
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
true
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:91
MythXDisplay::OpenMythXDisplay
static MythXDisplay * OpenMythXDisplay(bool Warn=true)
Definition: mythxdisplay.cpp:44
tmp
static guint32 * tmp
Definition: goom_core.cpp:31
MythVDPAUHelper::m_createdDevice
bool m_createdDevice
Definition: mythvdpauhelper.h:91
MythVDPAUHelper::DeleteOutputSurface
void DeleteOutputSurface(VdpOutputSurface Surface)
Definition: mythvdpauhelper.cpp:412
mythvideocolourspace.h
kScan_Intr2ndField
@ kScan_Intr2ndField
Definition: videoouttypes.h:65
CHECK_ST
#define CHECK_ST
Definition: mythvdpauhelper.cpp:16
MythVDPAUHelper::m_display
MythXDisplay * m_display
Definition: mythvdpauhelper.h:93
mythlogging.h
LOC
#define LOC
Definition: mythvdpauhelper.cpp:10
MythVDPAUHelper::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythvdpauhelper.cpp:212
hardwareprofile.scan.profile
profile
Definition: scan.py:99
Source
Definition: channelsettings.cpp:69
mythvdpauhelper.h
MythVDPAUHelper::DisplayPreempted
void DisplayPreempted(void)
MythCodecContext::MPEG2SNR
@ MPEG2SNR
Definition: mythcodeccontext.h:64
MythVDPAUHelper::SetPreempted
void SetPreempted(void)
Definition: mythvdpauhelper.cpp:317
vdpau_preemption_callback
static void vdpau_preemption_callback(VdpDevice, void *Opaque)
Definition: mythvdpauhelper.cpp:224
MythVDPAUHelper
A simple wrapper around VDPAU functionality.
Definition: mythvdpauhelper.h:41
MythCodecContext::H264Main
@ H264Main
Definition: mythcodeccontext.h:86
MythVDPAUHelper::m_vdpVideoMixerRender
VdpVideoMixerRender * m_vdpVideoMixerRender
Definition: mythvdpauhelper.h:104
MythVDPAUHelper::DeleteMixer
void DeleteMixer(VdpVideoMixer Mixer)
Definition: mythvdpauhelper.cpp:532
MythCodecContext::MPEG1
@ MPEG1
Definition: mythcodeccontext.h:57
MythVDPAUHelper::GetSurfaceParameters
QSize GetSurfaceParameters(VdpVideoSurface Surface, VdpChromaType &Chroma)
Definition: mythvdpauhelper.cpp:567
MythVDPAUHelper::m_vdpGetProcAddress
VdpGetProcAddress * m_vdpGetProcAddress
Definition: mythvdpauhelper.h:95
MythVDPAUHelper::IsValid
bool IsValid(void) const
Definition: mythvdpauhelper.cpp:312
VDPAUProfile
QPair< MythCodecContext::CodecProfile, VDPAUCodec > VDPAUProfile
Definition: mythvdpauhelper.h:37
uint
unsigned int uint
Definition: compat.h:140
MythVDPAUHelper::m_vdpVideoMixerSetFeatureEnables
VdpVideoMixerSetFeatureEnables * m_vdpVideoMixerSetFeatureEnables
Definition: mythvdpauhelper.h:106
MythVDPAUHelper::CreateMixer
VdpVideoMixer CreateMixer(QSize Size, VdpChromaType ChromaType=VDP_CHROMA_TYPE_420, MythDeintType Deinterlacer=DEINT_BASIC)
Definition: mythvdpauhelper.cpp:422
MythXDisplay::GetDisplay
Display * GetDisplay(void)
Definition: mythxdisplay.h:31
MythCodecContext::H264High444
@ H264High444
Definition: mythcodeccontext.h:92
mythxdisplay.h
MythXDisplay::GetScreen
int GetScreen(void) const
Definition: mythxdisplay.h:33
DummyGetError
static const char * DummyGetError(VdpStatus)
Definition: mythvdpauhelper.cpp:249
MythDeintType
MythDeintType
Definition: mythframe.h:63
MythVDPAUHelper::m_vdpGetInformationString
VdpGetInformationString * m_vdpGetInformationString
Definition: mythvdpauhelper.h:97
MythVDPAUHelper::m_vdpDeviceDestroy
VdpDeviceDestroy * m_vdpDeviceDestroy
Definition: mythvdpauhelper.h:98
MythCodecContext::MPEG2Main
@ MPEG2Main
Definition: mythcodeccontext.h:60
kScan_Interlaced
@ kScan_Interlaced
Definition: videoouttypes.h:64
MythVDPAUHelper::HEVCSupported
bool HEVCSupported(void)
Definition: mythvdpauhelper.cpp:322
MythVDPAUHelper::ProfileCheck
bool ProfileCheck(VdpDecoderProfile Profile, uint32_t &Level, uint32_t &Macros, uint32_t &Width, uint32_t &Height)
Definition: mythvdpauhelper.cpp:84
MythVDPAUHelper::m_vdpDecoderCreate
VdpDecoderCreate * m_vdpDecoderCreate
Definition: mythvdpauhelper.h:100
DEINT_HIGH
@ DEINT_HIGH
Definition: mythframe.h:67
MythVDPAUHelper::m_vdpVideoMixerCreate
VdpVideoMixerCreate * m_vdpVideoMixerCreate
Definition: mythvdpauhelper.h:102
MythCodecContext::MJPEG
@ MJPEG
Definition: mythcodeccontext.h:120
MythVDPAUHelper::H264DecodeCheck
bool H264DecodeCheck(VdpDecoderProfile Profile, AVCodecContext *Context)
Definition: mythvdpauhelper.cpp:378
MythVDPAUHelper::CheckH264Decode
static bool CheckH264Decode(AVCodecContext *Context)
Definition: mythvdpauhelper.cpp:340
MythVDPAUHelper::MixerRender
void MixerRender(VdpVideoMixer Mixer, VdpVideoSurface Source, VdpOutputSurface Dest, FrameScanType Scan, int TopFieldFirst, QVector< AVBufferRef * > &Frames)
Definition: mythvdpauhelper.cpp:476
MythCodecContext::H264High
@ H264High
Definition: mythcodeccontext.h:88
MythCodecContext::GetProfileDescription
static QString GetProfileDescription(CodecProfile Profile, QSize Size, VideoFrameType Format=FMT_NONE, uint ColorDepth=0)
Definition: mythcodeccontext.cpp:763
VDPAUCodec::VDPAUCodec
VDPAUCodec(MythCodecContext::CodecProfile Profile, QSize Size, uint32_t Macroblocks, uint32_t Level)
Definition: mythvdpauhelper.cpp:28
MythVDPAUHelper::m_vdpVideoMixerSetAttributeValues
VdpVideoMixerSetAttributeValues * m_vdpVideoMixerSetAttributeValues
Definition: mythvdpauhelper.h:105
VDPAUCodec::Supported
bool Supported(int Width, int Height, int Level) const
Definition: mythvdpauhelper.cpp:38
VDPAUCodec
Definition: mythvdpauhelper.h:27
MythVDPAUHelper::m_vdpDecoderDestroy
VdpDecoderDestroy * m_vdpDecoderDestroy
Definition: mythvdpauhelper.h:101
MythVDPAUHelper::m_vdpVideoSurfaceGetParameters
VdpVideoSurfaceGetParameters * m_vdpVideoSurfaceGetParameters
Definition: mythvdpauhelper.h:110
GET_PROC
#define GET_PROC(FUNC_ID, PROC)
Definition: mythvdpauhelper.cpp:25
MythVDPAUHelper::m_vdpOutputSurfaceCreate
VdpOutputSurfaceCreate * m_vdpOutputSurfaceCreate
Definition: mythvdpauhelper.h:108
MythVDPAUHelper::m_vdpPreemptionCallbackRegister
VdpPreemptionCallbackRegister * m_vdpPreemptionCallbackRegister
Definition: mythvdpauhelper.h:111
MythVDPAUHelper::m_device
VdpDevice m_device
Definition: mythvdpauhelper.h:92
MythCodecContext::H264ConstrainedHigh
@ H264ConstrainedHigh
Definition: mythcodeccontext.h:93
MythVideoColourSpace
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: mythvideocolourspace.h:21
MythCodecContext::HEVCMain
@ HEVCMain
Definition: mythcodeccontext.h:95
XLOCK
#define XLOCK(dpy, arg)
Definition: mythxdisplay.h:19