MythTV  master
mythavutil.cpp
Go to the documentation of this file.
1 //
2 // mythavutil.cpp
3 // MythTV
4 //
5 // Created by Jean-Yves Avenard on 28/06/2014.
6 // Copyright (c) 2014 Bubblestuff Pty Ltd. All rights reserved.
7 //
8 
9 // Qt
10 #include <QtGlobal>
11 #include <QMutexLocker>
12 #include <QFile>
13 
14 // MythTV
15 #include "libmythbase/mythconfig.h"
17 #include "mythdeinterlacer.h"
18 #include "mythavutil.h"
19 
20 // FFmpeg
21 extern "C" {
22 #include "libavcodec/avcodec.h"
23 #include "libavutil/imgutils.h"
24 #include "libavformat/avformat.h"
25 }
26 
28 {
29  switch (Type)
30  {
31  case FMT_YV12: return AV_PIX_FMT_YUV420P;
32  case FMT_YUV420P9: return AV_PIX_FMT_YUV420P9;
33  case FMT_YUV420P10: return AV_PIX_FMT_YUV420P10;
34  case FMT_YUV420P12: return AV_PIX_FMT_YUV420P12;
35  case FMT_YUV420P14: return AV_PIX_FMT_YUV420P14;
36  case FMT_YUV420P16: return AV_PIX_FMT_YUV420P16;
37  case FMT_NV12: return AV_PIX_FMT_NV12;
38  case FMT_P010: return AV_PIX_FMT_P010;
39  case FMT_P016: return AV_PIX_FMT_P016;
40  case FMT_YUV422P: return AV_PIX_FMT_YUV422P;
41  case FMT_YUV422P9: return AV_PIX_FMT_YUV422P9;
42  case FMT_YUV422P10: return AV_PIX_FMT_YUV422P10;
43  case FMT_YUV422P12: return AV_PIX_FMT_YUV422P12;
44  case FMT_YUV422P14: return AV_PIX_FMT_YUV422P14;
45  case FMT_YUV422P16: return AV_PIX_FMT_YUV422P16;
46  case FMT_YUV444P: return AV_PIX_FMT_YUV444P;
47  case FMT_YUV444P9: return AV_PIX_FMT_YUV444P9;
48  case FMT_YUV444P10: return AV_PIX_FMT_YUV444P10;
49  case FMT_YUV444P12: return AV_PIX_FMT_YUV444P12;
50  case FMT_YUV444P14: return AV_PIX_FMT_YUV444P14;
51  case FMT_YUV444P16: return AV_PIX_FMT_YUV444P16;
52  case FMT_RGB24: return AV_PIX_FMT_RGB24;
53  case FMT_BGRA: return AV_PIX_FMT_BGRA; // NOLINT(bugprone-branch-clone)
54  case FMT_RGB32: return AV_PIX_FMT_RGB32;
55  case FMT_ARGB32: return AV_PIX_FMT_ARGB;
56  case FMT_RGBA32: return AV_PIX_FMT_RGBA;
57  case FMT_YUY2: return AV_PIX_FMT_UYVY422;
58  case FMT_VDPAU: return AV_PIX_FMT_VDPAU;
59  case FMT_VTB: return AV_PIX_FMT_VIDEOTOOLBOX;
60  case FMT_VAAPI: return AV_PIX_FMT_VAAPI;
61  case FMT_MEDIACODEC: return AV_PIX_FMT_MEDIACODEC;
62  case FMT_NVDEC: return AV_PIX_FMT_CUDA;
63  case FMT_DXVA2: return AV_PIX_FMT_DXVA2_VLD;
64  case FMT_MMAL: return AV_PIX_FMT_MMAL;
65  case FMT_DRMPRIME: return AV_PIX_FMT_DRM_PRIME;
66  case FMT_NONE: break;
67  }
68  return AV_PIX_FMT_NONE;
69 }
70 
72 {
73  switch (Fmt)
74  {
75  case AV_PIX_FMT_YUVJ420P:
76  case AV_PIX_FMT_YUV420P: return FMT_YV12;
77  case AV_PIX_FMT_YUV420P9: return FMT_YUV420P9;
78  case AV_PIX_FMT_YUV420P10: return FMT_YUV420P10;
79  case AV_PIX_FMT_YUV420P12: return FMT_YUV420P12;
80  case AV_PIX_FMT_YUV420P14: return FMT_YUV420P14;
81  case AV_PIX_FMT_YUV420P16: return FMT_YUV420P16;
82  case AV_PIX_FMT_NV12: return FMT_NV12;
83  case AV_PIX_FMT_P010: return FMT_P010;
84  case AV_PIX_FMT_P016: return FMT_P016;
85  case AV_PIX_FMT_YUVJ422P:
86  case AV_PIX_FMT_YUV422P: return FMT_YUV422P;
87  case AV_PIX_FMT_YUV422P9: return FMT_YUV422P9;
88  case AV_PIX_FMT_YUV422P10: return FMT_YUV422P10;
89  case AV_PIX_FMT_YUV422P12: return FMT_YUV422P12;
90  case AV_PIX_FMT_YUV422P14: return FMT_YUV422P14;
91  case AV_PIX_FMT_YUV422P16: return FMT_YUV422P16;
92  case AV_PIX_FMT_YUVJ444P:
93  case AV_PIX_FMT_YUV444P: return FMT_YUV444P;
94  case AV_PIX_FMT_YUV444P9: return FMT_YUV444P9;
95  case AV_PIX_FMT_YUV444P10: return FMT_YUV444P10;
96  case AV_PIX_FMT_YUV444P12: return FMT_YUV444P12;
97  case AV_PIX_FMT_YUV444P14: return FMT_YUV444P14;
98  case AV_PIX_FMT_YUV444P16: return FMT_YUV444P16;
99  case AV_PIX_FMT_UYVY422: return FMT_YUY2;
100  case AV_PIX_FMT_RGB24: return FMT_RGB24;
101  case AV_PIX_FMT_ARGB: return FMT_ARGB32;
102  case AV_PIX_FMT_RGBA: return FMT_RGBA32;
103  case AV_PIX_FMT_BGRA: return FMT_BGRA;
104  case AV_PIX_FMT_CUDA: return FMT_NVDEC;
105  case AV_PIX_FMT_MMAL: return FMT_MMAL;
106  case AV_PIX_FMT_VDPAU: return FMT_VDPAU;
107  case AV_PIX_FMT_VIDEOTOOLBOX: return FMT_VTB;
108  case AV_PIX_FMT_VAAPI: return FMT_VAAPI;
109  case AV_PIX_FMT_DXVA2_VLD: return FMT_DXVA2;
110  case AV_PIX_FMT_MEDIACODEC: return FMT_MEDIACODEC;
111  case AV_PIX_FMT_DRM_PRIME: return FMT_DRMPRIME;
112  default: break;
113  }
114  return FMT_NONE;
115 }
116 
118 {
119  switch (Transfer)
120  {
121  case AVCOL_TRC_SMPTE2084: return MythHDR::HDR10;
122  case AVCOL_TRC_BT2020_10:
123  case AVCOL_TRC_ARIB_STD_B67: return MythHDR::HLG;
124  default: break;
125  }
126  return MythHDR::SDR;
127 }
128 
135 {
136  if (!Frame)
137  return;
138 
139  // Create a wrapper frame and set it up
140  // (yes - this will end up being a wrapper around a wrapper!)
141  if (VideoFrameType type = PixelFormatToFrameType(static_cast<AVPixelFormat>(Frame->format));
143  {
144  // AVFrame video data consists of 3 independent buffers.
145  // MythVideoFrame requires video data to be in one memory block.
146  // Create a copy of the frame with all video data in one memory block.
147  AVFrame tempFrame = *Frame;
148  AVFrame *tf = &tempFrame;
149 
150  size_t b0 = tf->buf[0]->size;
151  size_t b1 = tf->buf[1]->size;
152  size_t b2 = tf->buf[2]->size;
153 
154  // Extend size to a multiple of 16 bytes for MythVideoFrame alignment constraints
155  size_t b0a = ((b0 + 15) / 16) * 16;
156  size_t b1a = ((b1 + 15) / 16) * 16;
157  size_t b2a = ((b2 + 15) / 16) * 16;
158 
159  // Allocate contiguous buffer with enough space for the three segments
160  uint8_t *tbuf{ new uint8_t[b0a + b1a + b2a]{} };
161 
162  tf->data[0] = tbuf;
163  tf->data[1] = tbuf + b0a;
164  tf->data[2] = tbuf + b0a + b1a;
165  memcpy(tf->data[0], tf->buf[0]->data, b0);
166  memcpy(tf->data[1], tf->buf[1]->data, b1);
167  memcpy(tf->data[2], tf->buf[2]->data, b2);
168 
169  // Create a MythVideoFrame from the temporary AVFrame
170  MythVideoFrame mythframe(type, tf->data[0],
171  MythVideoFrame::GetBufferSize(type, tf->width, tf->height),
172  tf->width, tf->height);
173  mythframe.m_offsets[0] = 0;
174  mythframe.m_offsets[1] = tf->data[1] - tf->data[0];
175  mythframe.m_offsets[2] = tf->data[2] - tf->data[0];
176  mythframe.m_pitches[0] = tf->linesize[0];
177  mythframe.m_pitches[1] = tf->linesize[1];
178  mythframe.m_pitches[2] = tf->linesize[2];
179 
180  // Deinterlacing
182  mythframe.m_deinterlaceAllowed = DEINT_ALL;
183  MythDeinterlacer deinterlacer;
184  deinterlacer.Filter(&mythframe, kScan_Interlaced, nullptr, true);
185 
186  // Copy back our deinterlaced frame and free the video buffer of the temporary AVFrame
187  memcpy(Frame->data[0], tf->data[0], b0);
188  memcpy(Frame->data[1], tf->data[1], b1);
189  memcpy(Frame->data[2], tf->data[2], b2);
190  delete[] tbuf;
191 
192  // Must remove buffer before mythframe is deleted
193  mythframe.m_buffer = nullptr;
194  }
195 }
196 
198 int MythAVUtil::FillAVFrame(AVFrame *Frame, const MythVideoFrame *From, AVPixelFormat Fmt)
199 {
200  if (Fmt == AV_PIX_FMT_NONE)
201  Fmt = FrameTypeToPixelFormat(From->m_type);
202 
203  av_image_fill_arrays(Frame->data, Frame->linesize, From->m_buffer,
204  Fmt, From->m_width, From->m_height, IMAGE_ALIGN);
205  Frame->data[1] = From->m_buffer + From->m_offsets[1];
206  Frame->data[2] = From->m_buffer + From->m_offsets[2];
207  Frame->linesize[0] = From->m_pitches[0];
208  Frame->linesize[1] = From->m_pitches[1];
209  Frame->linesize[2] = From->m_pitches[2];
210  return static_cast<int>(MythVideoFrame::GetBufferSize(From->m_type, From->m_width, From->m_height));
211 }
212 
217 {
218  sws_freeContext(m_swsctx);
219 }
220 
221 int MythAVCopy::SizeData(int Width, int Height, AVPixelFormat Fmt)
222 {
223  if (Width == m_width && Height == m_height && Fmt == m_format)
224  return m_size;
225 
226  m_size = av_image_get_buffer_size(Fmt, Width, Height, IMAGE_ALIGN);
227  m_width = Width;
228  m_height = Height;
229  m_format = Fmt;
230  return m_size;
231 }
232 
233 int MythAVCopy::Copy(AVFrame* To, AVPixelFormat ToFmt, const AVFrame* From, AVPixelFormat FromFmt,
234  int Width, int Height)
235 {
236  int newwidth = Width;
237 #ifdef Q_PROCESSOR_ARM
238  // references https://code.mythtv.org/trac/ticket/12888 and
239  // https://trac.ffmpeg.org/ticket/6192
240  // TODO: This is from 2017-02-17 and probably needs to be tested again.
241 
242  // The ARM build of FFMPEG has a bug that if sws_scale is
243  // called with source and dest sizes the same, and
244  // formats as shown below, it causes a bus error and the
245  // application core dumps. To avoid this I make a -1
246  // difference in the new width, causing it to bypass
247  // the code optimization which is failing.
248  if (FromFmt == AV_PIX_FMT_YUV420P && ToFmt == AV_PIX_FMT_BGRA)
249  newwidth = Width - 1;
250 #endif
251  m_swsctx = sws_getCachedContext(m_swsctx, Width, Height, FromFmt,
252  newwidth, Height, ToFmt, SWS_FAST_BILINEAR,
253  nullptr, nullptr, nullptr);
254  if (m_swsctx == nullptr)
255  return -1;
256  sws_scale(m_swsctx, From->data, From->linesize, 0, Height, To->data, To->linesize);
257  return SizeData(Width, Height, ToFmt);
258 }
259 
267  unsigned char* Buffer, AVPixelFormat Fmt)
268 {
269  if (!Buffer)
270  return 0;
271  AVFrame frame;
272  AVPixelFormat fromfmt = MythAVUtil::FrameTypeToPixelFormat(From->m_type);
273  MythAVUtil::FillAVFrame(&frame, From, fromfmt);
274  av_image_fill_arrays(To->data, To->linesize, Buffer, Fmt, From->m_width, From->m_height, IMAGE_ALIGN);
275  return Copy(To, Fmt, &frame, fromfmt, From->m_width, From->m_height);
276 }
277 
283 {
284  FreeAllContexts();
285 }
286 
287 AVCodecContext *MythCodecMap::GetCodecContext(const AVStream* Stream,
288  const AVCodec* Codec,
289  bool NullCodec)
290 {
291  QMutexLocker lock(&m_mapLock);
292  AVCodecContext* avctx = m_streamMap.value(Stream, nullptr);
293  if (!avctx)
294  {
295  if (Stream == nullptr || Stream->codecpar == nullptr)
296  return nullptr;
297 
298  if (NullCodec)
299  {
300  Codec = nullptr;
301  }
302  else
303  {
304  if (!Codec)
305  Codec = avcodec_find_decoder(Stream->codecpar->codec_id);
306 
307  if (!Codec)
308  {
309  LOG(VB_GENERAL, LOG_WARNING, QString("avcodec_find_decoder fail for %1")
310  .arg(Stream->codecpar->codec_id));
311  return nullptr;
312  }
313  }
314  avctx = avcodec_alloc_context3(Codec);
315  if (avcodec_parameters_to_context(avctx, Stream->codecpar) < 0)
316  avcodec_free_context(&avctx);
317 
318  if (avctx)
319  {
320  avctx->pkt_timebase = Stream->time_base;
321  m_streamMap.insert(Stream, avctx);
322  }
323  }
324  return avctx;
325 }
326 
327 AVCodecContext *MythCodecMap::FindCodecContext(const AVStream* Stream)
328 {
329  return m_streamMap.value(Stream, nullptr);
330 }
331 
335 void MythCodecMap::FreeCodecContext(const AVStream* Stream)
336 {
337  QMutexLocker lock(&m_mapLock);
338  AVCodecContext* avctx = m_streamMap.take(Stream);
339  if (avctx)
340  {
341  if (avctx->internal)
342  avcodec_flush_buffers(avctx);
343  avcodec_free_context(&avctx);
344  }
345 }
346 
348 {
349  QMutexLocker lock(&m_mapLock);
350  QMap<const AVStream*, AVCodecContext*>::iterator i = m_streamMap.begin();
351  while (i != m_streamMap.end())
352  {
353  const AVStream *stream = i.key();
354  ++i;
355  FreeCodecContext(stream);
356  }
357 }
358 
360 {
361  const int probeBufferSize = 8 * 1024;
362  const AVInputFormat *fmt = nullptr;
363  AVProbeData probe;
364  memset(&probe, 0, sizeof(AVProbeData));
365  probe.filename = "";
366  probe.buf = new unsigned char[probeBufferSize + AVPROBE_PADDING_SIZE];
367  probe.buf_size = probeBufferSize;
368  memset(probe.buf, 0, probeBufferSize + AVPROBE_PADDING_SIZE);
369  av_log_set_level(AV_LOG_FATAL);
370  m_errorCode = 0;
371  if (filename == "")
372  m_errorCode = 97;
373  QFile infile(filename);
374  if (m_errorCode == 0 && !infile.open(QIODevice::ReadOnly))
375  m_errorCode = 99;
376  if (m_errorCode==0) {
377  int64_t leng = infile.read(reinterpret_cast<char*>(probe.buf), probeBufferSize);
378  probe.buf_size = static_cast<int>(leng);
379  infile.close();
380  fmt = av_probe_input_format(&probe, static_cast<int>(true));
381  if (fmt == nullptr)
382  m_errorCode = 98;
383  }
384  AVFormatContext *ctx = nullptr;
385  if (m_errorCode==0)
386  {
387  ctx = avformat_alloc_context();
388  m_errorCode = avformat_open_input(&ctx, filename.toUtf8(), fmt, nullptr);
389  }
390  if (m_errorCode==0)
391  m_errorCode = avformat_find_stream_info(ctx, nullptr);
392 
393  if (m_errorCode==0)
394  {
395  for (uint ix = 0; ix < ctx->nb_streams; ix++)
396  {
397  AVStream *stream = ctx->streams[ix];
398  if (stream == nullptr)
399  continue;
400  AVCodecParameters *codecpar = stream->codecpar;
401  const AVCodecDescriptor* desc = nullptr;
402  MythStreamInfo info;
403  info.m_codecType = ' ';
404  if (codecpar != nullptr)
405  {
406  desc = avcodec_descriptor_get(codecpar->codec_id);
407  switch (codecpar->codec_type)
408  {
409  case AVMEDIA_TYPE_VIDEO:
410  info.m_codecType = 'V';
411  break;
412  case AVMEDIA_TYPE_AUDIO:
413  info.m_codecType = 'A';
414  break;
415  case AVMEDIA_TYPE_SUBTITLE:
416  info.m_codecType = 'S';
417  break;
418  default:
419  continue;
420  }
421  }
422  if (desc != nullptr)
423  info.m_codecName = desc->name;
424  info.m_duration = stream->duration * stream->time_base.num / stream->time_base.den;
425  if (info.m_codecType == 'V')
426  {
427  if (codecpar != nullptr)
428  {
429  info.m_width = codecpar->width;
430  info.m_height = codecpar->height;
431  info.m_SampleAspectRatio = static_cast<float>(codecpar->sample_aspect_ratio.num)
432  / static_cast<float>(codecpar->sample_aspect_ratio.den);
433  switch (codecpar->field_order)
434  {
435  case AV_FIELD_PROGRESSIVE:
436  info.m_fieldOrder = "PR";
437  break;
438  case AV_FIELD_TT:
439  info.m_fieldOrder = "TT";
440  break;
441  case AV_FIELD_BB:
442  info.m_fieldOrder = "BB";
443  break;
444  case AV_FIELD_TB:
445  info.m_fieldOrder = "TB";
446  break;
447  case AV_FIELD_BT:
448  info.m_fieldOrder = "BT";
449  break;
450  default:
451  break;
452  }
453  }
454  info.m_frameRate = static_cast<float>(stream->r_frame_rate.num)
455  / static_cast<float>(stream->r_frame_rate.den);
456  info.m_avgFrameRate = static_cast<float>(stream->avg_frame_rate.num)
457  / static_cast<float>(stream->avg_frame_rate.den);
458  }
459  if (info.m_codecType == 'A')
460  info.m_channels = codecpar->ch_layout.nb_channels;
461  m_streamInfoList.append(info);
462  }
463  }
464  if (m_errorCode != 0)
465  {
466  switch(m_errorCode) {
467  case 97:
468  m_errorMsg = "File Not Found";
469  break;
470  case 98:
471  m_errorMsg = "av_probe_input_format returned no result";
472  break;
473  case 99:
474  m_errorMsg = "File could not be opened";
475  break;
476  default:
477  std::string errbuf;
478  if (av_strerror_stdstring(m_errorCode, errbuf) == 0)
479  m_errorMsg = QString::fromStdString(errbuf);
480  else
481  m_errorMsg = "UNKNOWN";
482  }
483  LOG(VB_GENERAL, LOG_ERR,
484  QString("MythStreamInfoList failed for %1. Error code:%2 Message:%3")
485  .arg(filename).arg(m_errorCode).arg(m_errorMsg));
486 
487  }
488 
489  if (ctx != nullptr)
490  {
491  avformat_close_input(&ctx);
492  avformat_free_context(ctx);
493  }
494  delete [] probe.buf;
495 }
MythStreamInfoList::m_errorMsg
QString m_errorMsg
Definition: mythavutil.h:102
FMT_MEDIACODEC
@ FMT_MEDIACODEC
Definition: mythframe.h:61
MythAVCopy::m_size
int m_size
Definition: mythavutil.h:60
MythAVCopy::m_format
AVPixelFormat m_format
Definition: mythavutil.h:56
MythStreamInfo::m_codecName
QString m_codecName
Definition: mythavutil.h:77
DEINT_MEDIUM
@ DEINT_MEDIUM
Definition: mythframe.h:71
MythStreamInfo::m_height
int m_height
Definition: mythavutil.h:81
FMT_YUV420P10
@ FMT_YUV420P10
Definition: mythframe.h:26
FMT_YUV420P16
@ FMT_YUV420P16
Definition: mythframe.h:29
FMT_VTB
@ FMT_VTB
Definition: mythframe.h:62
MythCodecMap::GetCodecContext
AVCodecContext * GetCodecContext(const AVStream *Stream, const AVCodec *Codec=nullptr, bool NullCodec=false)
Definition: mythavutil.cpp:287
FMT_YUV420P14
@ FMT_YUV420P14
Definition: mythframe.h:28
MythVideoFrame::m_deinterlaceAllowed
MythDeintType m_deinterlaceAllowed
Definition: mythframe.h:160
FMT_DRMPRIME
@ FMT_DRMPRIME
Definition: mythframe.h:64
FMT_YUV444P10
@ FMT_YUV444P10
Definition: mythframe.h:46
FMT_YUV422P14
@ FMT_YUV422P14
Definition: mythframe.h:41
MythStreamInfo::m_codecType
char m_codecType
Definition: mythavutil.h:76
MythStreamInfo::m_avgFrameRate
float m_avgFrameRate
Definition: mythavutil.h:89
Frame
Definition: zmdefines.h:93
MythStreamInfo
Definition: mythavutil.h:73
MythAVUtil::DeinterlaceAVFrame
static void DeinterlaceAVFrame(AVFrame *Frame)
Deinterlace an AVFrame.
Definition: mythavutil.cpp:134
FMT_P010
@ FMT_P010
Definition: mythframe.h:54
MythCodecMap::FreeAllContexts
void FreeAllContexts()
Definition: mythavutil.cpp:347
MythVideoFrame::m_width
int m_width
Definition: mythframe.h:121
FMT_YUV422P
@ FMT_YUV422P
Definition: mythframe.h:37
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythStreamInfo::m_duration
int64_t m_duration
Definition: mythavutil.h:78
DEINT_ALL
@ DEINT_ALL
Definition: mythframe.h:76
MythAVCopy::m_height
int m_height
Definition: mythavutil.h:59
MythVideoFrame::m_offsets
FrameOffsets m_offsets
Definition: mythframe.h:143
mythdeinterlacer.h
MythHDR::HLG
@ HLG
Definition: mythhdr.h:40
FMT_YUV444P14
@ FMT_YUV444P14
Definition: mythframe.h:48
FMT_YUV444P
@ FMT_YUV444P
Definition: mythframe.h:44
FMT_NONE
@ FMT_NONE
Definition: mythframe.h:22
DEINT_CPU
@ DEINT_CPU
Definition: mythframe.h:73
MythCodecMap::FindCodecContext
AVCodecContext * FindCodecContext(const AVStream *Stream)
Definition: mythavutil.cpp:327
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
MythStreamInfoList::m_errorCode
int m_errorCode
Definition: mythavutil.h:101
MythVideoFrame::YUVFormat
static bool YUVFormat(VideoFrameType Type)
Definition: mythframe.h:466
MythAVCopy::m_swsctx
SwsContext * m_swsctx
Definition: mythavutil.h:57
MythVideoFrame::GetBufferSize
static size_t GetBufferSize(VideoFrameType Type, int Width, int Height, int Aligned=MYTH_WIDTH_ALIGNMENT)
Definition: mythframe.cpp:412
MythStreamInfo::m_width
int m_width
Definition: mythavutil.h:80
mythlogging.h
av_strerror_stdstring
int av_strerror_stdstring(int errnum, std::string &errbuf)
Definition: mythaverror.cpp:27
FMT_YUV444P9
@ FMT_YUV444P9
Definition: mythframe.h:45
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:24
FMT_YUV422P10
@ FMT_YUV422P10
Definition: mythframe.h:39
FMT_YUV444P16
@ FMT_YUV444P16
Definition: mythframe.h:49
MythStreamInfo::m_channels
int m_channels
Definition: mythavutil.h:91
FMT_BGRA
@ FMT_BGRA
Definition: mythframe.h:32
MythStreamInfo::m_SampleAspectRatio
float m_SampleAspectRatio
Definition: mythavutil.h:82
MythDeinterlacer::Filter
void Filter(MythVideoFrame *Frame, FrameScanType Scan, MythVideoProfile *Profile, bool Force=false)
Deinterlace Frame if needed.
Definition: mythdeinterlacer.cpp:69
FMT_YUV420P12
@ FMT_YUV420P12
Definition: mythframe.h:27
MythDeinterlacer
Handles software based deinterlacing of video frames.
Definition: mythdeinterlacer.h:15
MythCodecMap::FreeCodecContext
void FreeCodecContext(const AVStream *Stream)
Definition: mythavutil.cpp:335
MythHDR::HDR10
@ HDR10
Definition: mythhdr.h:39
uint
unsigned int uint
Definition: compat.h:81
MythAVCopy::m_width
int m_width
Definition: mythavutil.h:58
FMT_YUV444P12
@ FMT_YUV444P12
Definition: mythframe.h:47
FMT_ARGB32
@ FMT_ARGB32
Definition: mythframe.h:34
MythAVUtil::PixelFormatToFrameType
static VideoFrameType PixelFormatToFrameType(AVPixelFormat Fmt)
Definition: mythavutil.cpp:71
MythVideoFrame::m_pitches
FramePitches m_pitches
Definition: mythframe.h:142
MythStreamInfo::m_frameRate
float m_frameRate
Definition: mythavutil.h:88
FMT_NVDEC
@ FMT_NVDEC
Definition: mythframe.h:63
FMT_YUV422P9
@ FMT_YUV422P9
Definition: mythframe.h:38
MythStreamInfo::m_fieldOrder
QString m_fieldOrder
Definition: mythavutil.h:87
Buffer
Definition: MythExternControl.h:36
FMT_YUV420P9
@ FMT_YUV420P9
Definition: mythframe.h:25
FMT_VDPAU
@ FMT_VDPAU
Definition: mythframe.h:57
kScan_Interlaced
@ kScan_Interlaced
Definition: videoouttypes.h:98
MythVideoFrame::m_type
VideoFrameType m_type
Definition: mythframe.h:119
FMT_YUV422P16
@ FMT_YUV422P16
Definition: mythframe.h:42
FMT_YUY2
@ FMT_YUY2
Definition: mythframe.h:51
FMT_DXVA2
@ FMT_DXVA2
Definition: mythframe.h:59
FMT_RGB24
@ FMT_RGB24
Definition: mythframe.h:31
FMT_YUV422P12
@ FMT_YUV422P12
Definition: mythframe.h:40
MythAVUtil::FrameTypeToPixelFormat
static AVPixelFormat FrameTypeToPixelFormat(VideoFrameType Type)
Definition: mythavutil.cpp:27
mythavutil.h
MythAVUtil::FFmpegTransferToHDRType
static MythHDR::HDRType FFmpegTransferToHDRType(int Transfer)
Definition: mythavutil.cpp:117
MythStreamInfoList::MythStreamInfoList
MythStreamInfoList(const QString &filename)
Definition: mythavutil.cpp:359
MythCodecMap::~MythCodecMap
~MythCodecMap()
Definition: mythavutil.cpp:282
MythVideoFrame::m_height
int m_height
Definition: mythframe.h:122
FMT_RGB32
@ FMT_RGB32
endian dependent format, ARGB or BGRA
Definition: mythframe.h:33
FMT_MMAL
@ FMT_MMAL
Definition: mythframe.h:60
VideoFrameType
VideoFrameType
Definition: mythframe.h:20
FMT_VAAPI
@ FMT_VAAPI
Definition: mythframe.h:58
MythCodecMap::m_streamMap
QMap< const AVStream *, AVCodecContext * > m_streamMap
Definition: mythavutil.h:38
MythAVCopy::~MythAVCopy
~MythAVCopy()
Definition: mythavutil.cpp:216
MythHDR::SDR
@ SDR
Definition: mythhdr.h:38
MythVideoFrame
Definition: mythframe.h:88
FMT_NV12
@ FMT_NV12
Definition: mythframe.h:53
MythAVCopy::Copy
int Copy(AVFrame *To, const MythVideoFrame *From, unsigned char *Buffer, AVPixelFormat Fmt=AV_PIX_FMT_YUV420P)
Initialise AVFrame and copy contents of VideoFrame frame into it, performing any required conversion.
Definition: mythavutil.cpp:266
FMT_P016
@ FMT_P016
Definition: mythframe.h:55
MythAVCopy::SizeData
int SizeData(int Width, int Height, AVPixelFormat Fmt)
Definition: mythavutil.cpp:221
build_compdb.filename
filename
Definition: build_compdb.py:21
MythHDR::HDRType
HDRType
Definition: mythhdr.h:36
MythAVUtil::FillAVFrame
static int FillAVFrame(AVFrame *Frame, const MythVideoFrame *From, AVPixelFormat Fmt=AV_PIX_FMT_NONE)
Initialise AVFrame with content from MythVideoFrame.
Definition: mythavutil.cpp:198
MythVideoFrame::m_deinterlaceSingle
MythDeintType m_deinterlaceSingle
Definition: mythframe.h:158
FMT_RGBA32
@ FMT_RGBA32
Definition: mythframe.h:35
MythVideoFrame::m_buffer
uint8_t * m_buffer
Definition: mythframe.h:120
MythCodecMap::m_mapLock
QRecursiveMutex m_mapLock
Definition: mythavutil.h:39
MythStreamInfoList::m_streamInfoList
QVector< MythStreamInfo > m_streamInfoList
Definition: mythavutil.h:103