MythTV  master
mythv4l2m2mcontext.cpp
Go to the documentation of this file.
1 // Sys
2 #include <sys/ioctl.h>
3 
4 // Qt
5 #include <QDir>
6 
7 // MythTV
11 
12 #include "avformatdecoder.h"
13 #include "fourcc.h"
14 #include "mythplayerui.h"
15 #include "v4l2util.h"
16 
17 #ifdef USING_EGL
19 #endif
21 
22 #ifdef USING_MMAL
24 #endif
25 
26 // FFmpeg
27 extern "C" {
28 #include "libavutil/opt.h"
29 }
30 
31 #define LOC QString("V4L2_M2M: ")
32 
41  : MythDRMPRIMEContext(Parent, CodecID)
42 {
43 }
44 
46 {
47  return codec_is_v4l2(m_codecID);
48 }
49 
51  const AVCodec **Codec,
52  const QString &Decoder,
53  AVStream *Stream,
54  uint StreamType)
55 {
56  bool decodeonly = Decoder == "v4l2-dec";
57  auto success = static_cast<MythCodecID>((decodeonly ? kCodec_MPEG1_V4L2_DEC : kCodec_MPEG1_V4L2) + (StreamType - 1));
58  auto failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1));
59 
60  // not us
61  if (!Decoder.startsWith("v4l2"))
62  return failure;
63 
64  if (!decodeonly)
65  if (!FrameTypeIsSupported(*Context, FMT_DRMPRIME))
66  return failure;
67 
68  // supported by device driver?
70  switch ((*Codec)->id)
71  {
72  case AV_CODEC_ID_MPEG1VIDEO: mythprofile = MythCodecContext::MPEG1; break;
73  case AV_CODEC_ID_MPEG2VIDEO: mythprofile = MythCodecContext::MPEG2; break;
74  case AV_CODEC_ID_MPEG4: mythprofile = MythCodecContext::MPEG4; break;
75  case AV_CODEC_ID_H263: mythprofile = MythCodecContext::H263; break;
76  case AV_CODEC_ID_H264: mythprofile = MythCodecContext::H264; break;
77  case AV_CODEC_ID_VC1: mythprofile = MythCodecContext::VC1; break;
78  case AV_CODEC_ID_VP8: mythprofile = MythCodecContext::VP8; break;
79  case AV_CODEC_ID_VP9: mythprofile = MythCodecContext::VP9; break;
80  case AV_CODEC_ID_HEVC: mythprofile = MythCodecContext::HEVC; break;
81  default: break;
82  }
83 
84  if (mythprofile == MythCodecContext::NoProfile)
85  return failure;
86 
87  bool request = false;
88  const auto & standard = MythV4L2M2MContext::GetStandardProfiles();
89  if (!standard.contains(mythprofile))
90  {
92  if (!requests.contains(mythprofile))
93  return failure;
94  request = true;
95  }
96 
97 #ifdef USING_MMAL
98  // If MMAL is available, assume this is a Raspberry Pi and check the supported
99  // video sizes
100  if (!MythMMALContext::CheckCodecSize((*Context)->width, (*Context)->height, mythprofile))
101  return failure;
102  // As for MMAL, don't try and decode 10bit H264
103  if ((*Codec)->id == AV_CODEC_ID_H264)
104  {
105  if ((*Context)->profile == FF_PROFILE_H264_HIGH_10 ||
106  (*Context)->profile == FF_PROFILE_H264_HIGH_10_INTRA)
107  {
108  return failure;
109  }
110  }
111 #endif
112 
113  if (request)
114  {
115  (*Context)->pix_fmt = AV_PIX_FMT_DRM_PRIME;
116  return success;
117  }
118 
119  return MythDRMPRIMEContext::GetPrimeCodec(Context, Codec, Stream,
120  success, failure, "v4l2m2m",
121  decodeonly ? (*Context)->pix_fmt : AV_PIX_FMT_DRM_PRIME);
122 }
123 
124 int MythV4L2M2MContext::HwDecoderInit(AVCodecContext *Context)
125 {
126  if (!Context)
127  return -1;
128 
130  return 0;
131 
132  return MythDRMPRIMEContext::HwDecoderInit(Context);
133 }
134 
135 void MythV4L2M2MContext::InitVideoCodec(AVCodecContext *Context, bool SelectedStream, bool &DirectRendering)
136 {
137  // Fairly circular check of whether our codec id is using the request API.
138  // N.B. As for other areas of this class, this assumes there is no overlap
139  // between standard and request API codec support - though both can be used
140  // but for different codecs (as is expected on the Pi 4)
142  switch (m_codecID)
143  {
144  case kCodec_MPEG2_V4L2: profile = MPEG2; break;
145  case kCodec_H264_V4L2: profile = H264; break;
146  case kCodec_VP8_V4L2: profile = VP8; break;
147  case kCodec_VP9_V4L2: profile = VP9; break;
148  case kCodec_HEVC_V4L2: profile = HEVC; break;
149  default: break;
150  }
151 
153 
155  {
156  DirectRendering = false;
157  return;
158  }
159 
161  {
162  DirectRendering = false; // Surely true ?? And then an issue for regular V4L2 as well
163  Context->get_format = MythV4L2M2MContext::GetV4L2RequestFormat;
164  return;
165  }
166 
167  MythDRMPRIMEContext::InitVideoCodec(Context, SelectedStream, DirectRendering);
168 }
169 
170 bool MythV4L2M2MContext::RetrieveFrame(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame)
171 {
173  return GetBuffer(Context, Frame, AvFrame, 0);
174 
175  if (m_request)
176  return MythDRMPRIMEContext::GetDRMBuffer(Context, Frame, AvFrame, 0);
177 
178  return MythDRMPRIMEContext::RetrieveFrame(Context, Frame, AvFrame);
179 }
180 
186 void MythV4L2M2MContext::SetDecoderOptions(AVCodecContext* Context, const AVCodec* Codec)
187 {
188  if (m_request)
189  return;
190 
191  if (!(Context && Codec))
192  return;
193 
194  if (!(Codec->priv_class && Context->priv_data))
195  return;
196 
197  // best guess currently - this matches the number of capture buffers to the
198  // number of output buffers - and hence to the number of video buffers for
199  // direct rendering
200  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Setting number of capture buffers to 6");
201  av_opt_set_int(Context->priv_data, "num_capture_buffers", 6, 0);
202 }
203 
210 bool MythV4L2M2MContext::GetBuffer(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame, int /*Flags*/)
211 {
212  // Sanity checks
213  if (!Context || !AvFrame || !Frame)
214  return false;
215 
216  // Ensure we can render this format
217  auto * decoder = static_cast<AvFormatDecoder*>(Context->opaque);
218  auto type = MythAVUtil::PixelFormatToFrameType(static_cast<AVPixelFormat>(AvFrame->format));
219  const auto * supported = Frame->m_renderFormats;
220  auto found = std::find(supported->cbegin(), supported->cend(), type);
221  // No fallback currently (unlikely)
222  if (found == supported->end())
223  return false;
224 
225  // Re-allocate if necessary
226  if ((Frame->m_type != type) || (Frame->m_width != AvFrame->width) || (Frame->m_height != AvFrame->height))
227  if (!VideoBuffers::ReinitBuffer(Frame, type, decoder->GetVideoCodecID(), AvFrame->width, AvFrame->height))
228  return false;
229 
230  // Copy data
231  uint count = MythVideoFrame::GetNumPlanes(Frame->m_type);
232  for (uint plane = 0; plane < count; ++plane)
233  {
234  MythVideoFrame::CopyPlane(Frame->m_buffer + Frame->m_offsets[plane],Frame->m_pitches[plane],
235  AvFrame->data[plane], AvFrame->linesize[plane],
236  MythVideoFrame::GetPitchForPlane(Frame->m_type, AvFrame->width, plane),
237  MythVideoFrame::GetHeightForPlane(Frame->m_type, AvFrame->height, plane));
238  }
239 
240  return true;
241 }
242 
243 #ifndef V4L2_PIX_FMT_HEVC
244 #define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C')
245 #endif
246 
247 #ifndef V4L2_PIX_FMT_VP9
248 #define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0')
249 #endif
250 
251 #ifndef V4L2_PIX_FMT_NV12_COL128
252 #define V4L2_PIX_FMT_NV12_COL128 v4l2_fourcc('N', 'C', '1', '2')
253 #endif
254 
255 #ifndef V4L2_PIX_FMT_NV12_10_COL128
256 #define V4L2_PIX_FMT_NV12_10_COL128 v4l2_fourcc('N', 'C', '3', '0')
257 #endif
258 
260 {
261  static const std::vector<V4L2Mapping> s_map
262  {{
263  { V4L2_PIX_FMT_MPEG1, MythCodecContext::MPEG1 },
264  { V4L2_PIX_FMT_MPEG2, MythCodecContext::MPEG2 },
265  { V4L2_PIX_FMT_MPEG4, MythCodecContext::MPEG4 },
266  { V4L2_PIX_FMT_H263, MythCodecContext::H263 },
267  { V4L2_PIX_FMT_H264, MythCodecContext::H264 },
268  { V4L2_PIX_FMT_VC1_ANNEX_G, MythCodecContext::VC1 },
269  { V4L2_PIX_FMT_VP8, MythCodecContext::VP8 },
272  }};
273 
274  static QRecursiveMutex lock;
275  static bool s_initialised = false;
276  static V4L2Profiles s_profiles;
277 
278  QMutexLocker locker(&lock);
279  if (!s_initialised)
280  s_profiles = GetProfiles(s_map);
281  s_initialised = true;
282  return s_profiles;
283 }
284 
285 V4L2Profiles MythV4L2M2MContext::GetProfiles(const std::vector<V4L2Mapping>& Profiles)
286 {
287  static const std::vector<uint32_t> s_formats
288  {
289  V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_YVU420, V4L2_PIX_FMT_YUV420M,
290  V4L2_PIX_FMT_YVU420M, V4L2_PIX_FMT_NV12, V4L2_PIX_FMT_NV12M,
291  V4L2_PIX_FMT_NV21, V4L2_PIX_FMT_NV21M, V4L2_PIX_FMT_NV12_COL128,
293  };
294 
295  V4L2Profiles result;
296 
297  const QString root("/dev/");
298  QDir dir(root);
299  QStringList namefilters;
300  namefilters.append("video*");
301  auto devices = dir.entryList(namefilters, QDir::Files |QDir::System);
302  for (const QString& device : std::as_const(devices))
303  {
304  V4L2util v4l2dev(root + device);
305  uint32_t caps = v4l2dev.GetCapabilities();
306  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Device: %1 Driver: '%2' Capabilities: 0x%3")
307  .arg(v4l2dev.GetDeviceName(), v4l2dev.GetDriverName(), QString::number(caps, 16)));
308 
309  // check capture and output support
310  // these mimic the device checks in v4l2_m2m.c
311  bool mplanar = ((caps & (V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE)) != 0U) &&
312  ((caps & V4L2_CAP_STREAMING) != 0U);
313  bool mplanarm2m = (caps & V4L2_CAP_VIDEO_M2M_MPLANE) != 0U;
314  bool splanar = ((caps & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT)) != 0U) &&
315  ((caps & V4L2_CAP_STREAMING) != 0U);
316  bool splanarm2m = (caps & V4L2_CAP_VIDEO_M2M) != 0U;
317 
318  if (!(mplanar || mplanarm2m || splanar || splanarm2m))
319  continue;
320 
321  v4l2_buf_type capturetype = V4L2_BUF_TYPE_VIDEO_CAPTURE;
322  v4l2_buf_type outputtype = V4L2_BUF_TYPE_VIDEO_OUTPUT;
323 
324  if (mplanar || mplanarm2m)
325  {
326  capturetype = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
327  outputtype = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
328  }
329 
330  // check codec support
331  QSize dummy{0, 0};
332 
333  for (const auto & profile : Profiles)
334  {
335  bool found = false;
336  uint32_t v4l2pixfmt = profile.first;
337  auto mythprofile = profile.second;
338  struct v4l2_fmtdesc fdesc {};
339  memset(&fdesc, 0, sizeof(fdesc));
340 
341  // check output first
342  fdesc.type = outputtype;
343  while (!found)
344  {
345  int res = ioctl(v4l2dev.FD(), VIDIOC_ENUM_FMT, &fdesc);
346  if (res)
347  break;
348  if (fdesc.pixelformat == v4l2pixfmt)
349  found = true;
350  fdesc.index++;
351  }
352 
353  if (found)
354  {
355  QStringList pixformats;
356  bool foundfmt = false;
357  // check capture
358  memset(&fdesc, 0, sizeof(fdesc));
359  fdesc.type = capturetype;
360  while (true)
361  {
362  int res = ioctl(v4l2dev.FD(), VIDIOC_ENUM_FMT, &fdesc);
363  if (res)
364  break;
365  pixformats.append(fourcc_str(static_cast<int>(fdesc.pixelformat)));
366  if (std::find(s_formats.cbegin(), s_formats.cend(), fdesc.pixelformat) != s_formats.cend())
367  {
368  if (!result.contains(mythprofile))
369  result.append(mythprofile);
370  foundfmt = true;
371  break;
372  }
373  fdesc.index++;
374  }
375 
376  if (!foundfmt)
377  {
378  if (pixformats.isEmpty())
379  pixformats.append("None");
380  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Codec '%1' has no supported formats (Supported: %2)")
381  .arg(MythCodecContext::GetProfileDescription(mythprofile, dummy), pixformats.join((","))));
382  }
383  }
384  }
385  }
386 
387  return result;
388 }
389 
390 void MythV4L2M2MContext::GetDecoderList(QStringList &Decoders)
391 {
392  const auto & profiles = MythV4L2M2MContext::GetStandardProfiles();
393  if (!profiles.isEmpty())
394  {
395  QSize size(0, 0);
396  Decoders.append("V4L2:");
397  for (MythCodecContext::CodecProfile profile : profiles)
398  Decoders.append(MythCodecContext::GetProfileDescription(profile, size));
399  }
400 
402  if (!requests.isEmpty())
403  {
404  QSize size(0, 0);
405  Decoders.append("V4L2 Request:");
406  for (MythCodecContext::CodecProfile profile : requests)
407  Decoders.append(MythCodecContext::GetProfileDescription(profile, size));
408  }
409 
410 }
411 
412 bool MythV4L2M2MContext::HaveV4L2Codecs(bool Reinit /*=false*/)
413 {
414  static QRecursiveMutex lock;
415  QMutexLocker locker(&lock);
416  static bool s_checked = false;
417  static bool s_available = false;
418 
419  if (s_checked && !Reinit)
420  return s_available;
421  s_checked = true;
422 
423  const auto & standard = MythV4L2M2MContext::GetStandardProfiles();
424  const auto & request = MythV4L2M2MContext::GetRequestProfiles();
425  if (standard.isEmpty() && request.isEmpty())
426  {
427  LOG(VB_GENERAL, LOG_INFO, LOC + "No V4L2 decoders found");
428  return s_available;
429  }
430 
431  LOG(VB_GENERAL, LOG_INFO, LOC + "Supported/available V4L2 decoders:");
432  s_available = true;
433  QSize size {0, 0};
434  for (auto profile : std::as_const(standard))
435  LOG(VB_GENERAL, LOG_INFO, LOC + MythCodecContext::GetProfileDescription(profile, size));
436  for (auto profile : std::as_const(request))
437  LOG(VB_GENERAL, LOG_INFO, LOC + MythCodecContext::GetProfileDescription(profile, size) + "(Request)");
438  return s_available;
439 }
440 
441 #ifndef V4L2_PIX_FMT_MPEG2_SLICE
442 #define V4L2_PIX_FMT_MPEG2_SLICE v4l2_fourcc('M', 'G', '2', 'S')
443 #endif
444 
445 #ifndef V4L2_PIX_FMT_H264_SLICE
446 #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4')
447 #endif
448 
449 #ifndef V4L2_PIX_FMT_VP8_FRAME
450 #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F')
451 #endif
452 
453 #ifndef V4L2_PIX_FMT_VP9_FRAME
454 #define V4L2_PIX_FMT_VP9_FRAME v4l2_fourcc('V', 'P', '9', 'F')
455 #endif
456 
457 #ifndef V4L2_PIX_FMT_HEVC_SLICE
458 #define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5')
459 #endif
460 
462 {
463  static const std::vector<V4L2Mapping> s_map
464  {{
470  }};
471 
472  static QRecursiveMutex lock;
473  static bool s_initialised = false;
474  static V4L2Profiles s_profiles;
475 
476  QMutexLocker locker(&lock);
477  if (!s_initialised)
478  s_profiles = GetProfiles(s_map);
479  s_initialised = true;
480  return s_profiles;
481 }
482 
483 AVPixelFormat MythV4L2M2MContext::GetV4L2RequestFormat(AVCodecContext *Context, const AVPixelFormat *PixFmt)
484 {
485  while (*PixFmt != AV_PIX_FMT_NONE)
486  {
487  if (*PixFmt == AV_PIX_FMT_DRM_PRIME)
488  {
490  "V4L2 request context creation") >= 0)
491  {
492  return AV_PIX_FMT_DRM_PRIME;
493  }
494  }
495  PixFmt++;
496  }
497  return AV_PIX_FMT_NONE;
498 }
499 
501 {
502  if (!Context || !gCoreContext->IsUIThread())
503  return -1;
504 
505  // N.B. Interop support should already have been checked
506  // Create the device context
507  auto * hwdeviceref = MythCodecContext::CreateDevice(AV_HWDEVICE_TYPE_DRM, nullptr);
508  if (!hwdeviceref)
509  return -1;
510 
511  Context->hw_device_ctx = hwdeviceref;
512  return 0;
513 }
V4L2_PIX_FMT_VP8_FRAME
#define V4L2_PIX_FMT_VP8_FRAME
Definition: mythv4l2m2mcontext.cpp:450
V4L2_PIX_FMT_NV12_10_COL128
#define V4L2_PIX_FMT_NV12_10_COL128
Definition: mythv4l2m2mcontext.cpp:256
MythMMALContext::CheckCodecSize
static bool CheckCodecSize(int Width, int Height, MythCodecContext::CodecProfile Profile)
Definition: mythmmalcontext.cpp:26
MythCodecContext::m_codecID
MythCodecID m_codecID
Definition: mythcodeccontext.h:169
MythVideoFrame::GetPitchForPlane
static int GetPitchForPlane(VideoFrameType Type, int Width, uint Plane)
Definition: mythframe.h:303
codec_is_v4l2
static bool codec_is_v4l2(MythCodecID id)
Definition: mythcodecid.h:356
mythplayerui.h
MythV4L2M2MContext::DecoderWillResetOnFlush
bool DecoderWillResetOnFlush() override
Definition: mythv4l2m2mcontext.cpp:45
MythV4L2M2MContext::HwDecoderInit
int HwDecoderInit(AVCodecContext *Context) override
Definition: mythv4l2m2mcontext.cpp:124
kCodec_MPEG1_V4L2_DEC
@ kCodec_MPEG1_V4L2_DEC
Definition: mythcodecid.h:230
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
MythCodecContext::H264
@ H264
Definition: mythcodeccontext.h:84
MythDRMPRIMEContext::InitVideoCodec
void InitVideoCodec(AVCodecContext *Context, bool SelectedStream, bool &DirectRendering) override
Definition: mythdrmprimecontext.cpp:123
kCodec_MPEG2_V4L2
@ kCodec_MPEG2_V4L2
Definition: mythcodecid.h:215
MythCodecContext::MPEG1
@ MPEG1
Definition: mythcodeccontext.h:58
Frame
Definition: zmdefines.h:102
MythV4L2M2MContext::InitVideoCodec
void InitVideoCodec(AVCodecContext *Context, bool SelectedStream, bool &DirectRendering) override
Definition: mythv4l2m2mcontext.cpp:135
MythCoreContext::IsUIThread
bool IsUIThread(void)
Definition: mythcorecontext.cpp:1358
MythCodecContext::VC1
@ VC1
Definition: mythcodeccontext.h:102
V4L2util::FD
int FD(void) const
Definition: v4l2util.h:26
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythCodecContext::VP9
@ VP9
Definition: mythcodeccontext.h:108
MythV4L2M2MContext::HaveV4L2Codecs
static bool HaveV4L2Codecs(bool Reinit=false)
Definition: mythv4l2m2mcontext.cpp:412
MythV4L2M2MContext::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythv4l2m2mcontext.cpp:390
MythV4L2M2MContext::SetDecoderOptions
void SetDecoderOptions(AVCodecContext *Context, const AVCodec *Codec) override
Reduce the number of capture buffers.
Definition: mythv4l2m2mcontext.cpp:186
kCodec_MPEG1_V4L2
@ kCodec_MPEG1_V4L2
Definition: mythcodecid.h:214
V4L2_PIX_FMT_VP9
#define V4L2_PIX_FMT_VP9
Definition: mythv4l2m2mcontext.cpp:248
MythDRMPRIMEContext::GetPrimeCodec
static MythCodecID GetPrimeCodec(AVCodecContext **Context, const AVCodec **Codec, AVStream *Stream, MythCodecID Successs, MythCodecID Failure, const QString &CodecName, AVPixelFormat Format)
Definition: mythdrmprimecontext.cpp:43
kCodec_HEVC_V4L2
@ kCodec_HEVC_V4L2
Definition: mythcodecid.h:223
MythDRMPRIMEContext::HwDecoderInit
int HwDecoderInit(AVCodecContext *Context) override
Definition: mythdrmprimecontext.cpp:108
V4L2Profiles
QList< MythCodecContext::CodecProfile > V4L2Profiles
Definition: mythv4l2m2mcontext.h:7
MythCodecContext::NoProfile
@ NoProfile
Definition: mythcodeccontext.h:57
MythV4L2M2MContext::GetStandardProfiles
static const V4L2Profiles & GetStandardProfiles()
Definition: mythv4l2m2mcontext.cpp:259
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
mythrenderopengl.h
Decoder
Definition: decoder.h:70
MythV4L2M2MContext::RetrieveFrame
bool RetrieveFrame(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame) override
Definition: mythv4l2m2mcontext.cpp:170
mythlogging.h
kCodec_VP9_V4L2
@ kCodec_VP9_V4L2
Definition: mythcodecid.h:222
hardwareprofile.scan.profile
profile
Definition: scan.py:96
MythVideoFrame::CopyPlane
static void CopyPlane(uint8_t *To, int ToPitch, const uint8_t *From, int FromPitch, int PlaneWidth, int PlaneHeight)
Definition: mythframe.cpp:188
v4l2util.h
MythV4L2M2MContext::GetRequestProfiles
static const V4L2Profiles & GetRequestProfiles()
Definition: mythv4l2m2mcontext.cpp:461
MythDRMPRIMEContext::RetrieveFrame
bool RetrieveFrame(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame) override
Definition: mythdrmprimecontext.cpp:140
MythCodecContext::MPEG2
@ MPEG2
Definition: mythcodeccontext.h:59
kCodec_H264_V4L2
@ kCodec_H264_V4L2
Definition: mythcodecid.h:218
LOC
#define LOC
Definition: mythv4l2m2mcontext.cpp:31
MythV4L2M2MContext::GetSupportedCodec
static MythCodecID GetSupportedCodec(AVCodecContext **Context, const AVCodec **Codec, const QString &Decoder, AVStream *Stream, uint StreamType)
Definition: mythv4l2m2mcontext.cpp:50
MythV4L2M2MContext::GetProfiles
static V4L2Profiles GetProfiles(const std::vector< V4L2Mapping > &Profiles)
Definition: mythv4l2m2mcontext.cpp:285
V4L2_PIX_FMT_VP9_FRAME
#define V4L2_PIX_FMT_VP9_FRAME
Definition: mythv4l2m2mcontext.cpp:454
FMT_DRMPRIME
@ FMT_DRMPRIME
Definition: mythframe.h:63
MythCodecContext::VP8
@ VP8
Definition: mythcodeccontext.h:107
AvFormatDecoder
A decoder for media files.
Definition: avformatdecoder.h:79
MythDRMPRIMEContext
A generic context handler for codecs that return AV_PIX_FMT_DRM_PRIME frames.
Definition: mythdrmprimecontext.h:14
V4L2_PIX_FMT_HEVC
#define V4L2_PIX_FMT_HEVC
Definition: mythv4l2m2mcontext.cpp:244
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:57
MythCodecContext::H263
@ H263
Definition: mythcodeccontext.h:83
V4L2util::GetDeviceName
QString GetDeviceName(void) const
Definition: v4l2util.cpp:679
MythAVUtil::PixelFormatToFrameType
static VideoFrameType PixelFormatToFrameType(AVPixelFormat Fmt)
Definition: mythavutil.cpp:72
MythCodecContext::CodecProfile
CodecProfile
Definition: mythcodeccontext.h:55
MythVideoFrame::GetHeightForPlane
static int GetHeightForPlane(VideoFrameType Type, int Height, uint Plane)
Definition: mythframe.h:257
V4L2util::GetDriverName
QString GetDriverName(void) const
Definition: v4l2util.cpp:684
MythV4L2M2MContext::GetV4L2RequestFormat
static enum AVPixelFormat GetV4L2RequestFormat(AVCodecContext *Context, const AVPixelFormat *PixFmt)
Definition: mythv4l2m2mcontext.cpp:483
V4L2util
Definition: v4l2util.h:16
kCodec_MPEG1
@ kCodec_MPEG1
Definition: mythcodecid.h:22
mythcorecontext.h
MythCodecContext::CreateDevice
static AVBufferRef * CreateDevice(AVHWDeviceType Type, MythInteropGPU *Interop, const QString &Device=QString())
Definition: mythcodeccontext.cpp:559
avformatdecoder.h
MythV4L2M2MContext::MythV4L2M2MContext
MythV4L2M2MContext(DecoderBase *Parent, MythCodecID CodecID)
Definition: mythv4l2m2mcontext.cpp:40
codec_is_v4l2_dec
static bool codec_is_v4l2_dec(MythCodecID id)
Definition: mythcodecid.h:358
MythV4L2M2MContext::InitialiseV4L2RequestContext
static int InitialiseV4L2RequestContext(AVCodecContext *Context)
Definition: mythv4l2m2mcontext.cpp:500
MythCodecContext::FrameTypeIsSupported
static bool FrameTypeIsSupported(AVCodecContext *Context, VideoFrameType Format)
Definition: mythcodeccontext.cpp:515
mythmmalcontext.h
MythDRMPRIMEContext::GetDRMBuffer
bool GetDRMBuffer(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame, int)
Definition: mythdrmprimecontext.cpp:159
MythV4L2M2MContext::m_request
bool m_request
Definition: mythv4l2m2mcontext.h:39
fourcc_str
static const char * fourcc_str(int i)
Definition: fourcc.h:26
MythVideoFrame::GetNumPlanes
static uint GetNumPlanes(VideoFrameType Type)
Definition: mythframe.h:213
V4L2_PIX_FMT_HEVC_SLICE
#define V4L2_PIX_FMT_HEVC_SLICE
Definition: mythv4l2m2mcontext.cpp:458
mythdrmprimeinterop.h
MythCodecContext::InitialiseDecoder2
static int InitialiseDecoder2(AVCodecContext *Context, CreateHWDecoder Callback, const QString &Debug)
Initialise a hardware decoder that is NOT expected to use AVHWFramesContext.
Definition: mythcodeccontext.cpp:543
MythCodecContext::HEVC
@ HEVC
Definition: mythcodeccontext.h:95
VideoBuffers::ReinitBuffer
static bool ReinitBuffer(MythVideoFrame *Frame, VideoFrameType Type, MythCodecID CodecID, int Width, int Height)
Definition: videobuffers.cpp:981
MythV4L2M2MContext::GetBuffer
static bool GetBuffer(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame, int)
Retrieve a frame from CPU memory.
Definition: mythv4l2m2mcontext.cpp:210
kCodec_VP8_V4L2
@ kCodec_VP8_V4L2
Definition: mythcodecid.h:221
MythCodecContext::GetProfileDescription
static QString GetProfileDescription(CodecProfile Profile, QSize Size, VideoFrameType Format=FMT_NONE, uint ColorDepth=0)
Definition: mythcodeccontext.cpp:789
V4L2_PIX_FMT_MPEG2_SLICE
#define V4L2_PIX_FMT_MPEG2_SLICE
Definition: mythv4l2m2mcontext.cpp:442
MythCodecContext::MPEG4
@ MPEG4
Definition: mythcodeccontext.h:66
MythVideoFrame
Definition: mythframe.h:87
V4L2util::GetCapabilities
uint32_t GetCapabilities(void) const
Definition: v4l2util.cpp:674
V4L2_PIX_FMT_NV12_COL128
#define V4L2_PIX_FMT_NV12_COL128
Definition: mythv4l2m2mcontext.cpp:252
V4L2_PIX_FMT_H264_SLICE
#define V4L2_PIX_FMT_H264_SLICE
Definition: mythv4l2m2mcontext.cpp:446
mythv4l2m2mcontext.h
DecoderBase
Definition: decoderbase.h:120
find
static pid_list_t::iterator find(const PIDInfoMap &map, pid_list_t &list, pid_list_t::iterator begin, pid_list_t::iterator end, bool find_open)
Definition: dvbstreamhandler.cpp:363
uint
unsigned int uint
Definition: freesurround.h:24
fourcc.h