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