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 <QMutexLocker>
11 #include <QFile>
12 
13 // MythTV
14 #include "mythcorecontext.h"
15 #include "mythconfig.h"
16 #include "mythdeinterlacer.h"
17 #include "mythavutil.h"
18 
19 // FFmpeg
20 extern "C" {
21 #include "libswscale/swscale.h"
22 #include "libavfilter/avfilter.h"
23 #include "libavcodec/avcodec.h"
24 #include "libavfilter/buffersrc.h"
25 #include "libavfilter/buffersink.h"
26 #include "libavutil/imgutils.h"
27 #include "libavformat/avformat.h"
28 }
29 
31 {
32  switch (Type)
33  {
34  case FMT_YV12: return AV_PIX_FMT_YUV420P;
35  case FMT_YUV420P9: return AV_PIX_FMT_YUV420P9;
36  case FMT_YUV420P10: return AV_PIX_FMT_YUV420P10;
37  case FMT_YUV420P12: return AV_PIX_FMT_YUV420P12;
38  case FMT_YUV420P14: return AV_PIX_FMT_YUV420P14;
39  case FMT_YUV420P16: return AV_PIX_FMT_YUV420P16;
40  case FMT_NV12: return AV_PIX_FMT_NV12;
41  case FMT_P010: return AV_PIX_FMT_P010;
42  case FMT_P016: return AV_PIX_FMT_P016;
43  case FMT_YUV422P: return AV_PIX_FMT_YUV422P;
44  case FMT_YUV422P9: return AV_PIX_FMT_YUV422P9;
45  case FMT_YUV422P10: return AV_PIX_FMT_YUV422P10;
46  case FMT_YUV422P12: return AV_PIX_FMT_YUV422P12;
47  case FMT_YUV422P14: return AV_PIX_FMT_YUV422P14;
48  case FMT_YUV422P16: return AV_PIX_FMT_YUV422P16;
49  case FMT_YUV444P: return AV_PIX_FMT_YUV444P;
50  case FMT_YUV444P9: return AV_PIX_FMT_YUV444P9;
51  case FMT_YUV444P10: return AV_PIX_FMT_YUV444P10;
52  case FMT_YUV444P12: return AV_PIX_FMT_YUV444P12;
53  case FMT_YUV444P14: return AV_PIX_FMT_YUV444P14;
54  case FMT_YUV444P16: return AV_PIX_FMT_YUV444P16;
55  case FMT_RGB24: return AV_PIX_FMT_RGB24;
56  case FMT_BGRA: return AV_PIX_FMT_BGRA; // NOLINT(bugprone-branch-clone)
57  case FMT_RGB32: return AV_PIX_FMT_RGB32;
58  case FMT_ARGB32: return AV_PIX_FMT_ARGB;
59  case FMT_RGBA32: return AV_PIX_FMT_RGBA;
60  case FMT_YUY2: return AV_PIX_FMT_UYVY422;
61  case FMT_VDPAU: return AV_PIX_FMT_VDPAU;
62  case FMT_VTB: return AV_PIX_FMT_VIDEOTOOLBOX;
63  case FMT_VAAPI: return AV_PIX_FMT_VAAPI;
64  case FMT_MEDIACODEC: return AV_PIX_FMT_MEDIACODEC;
65  case FMT_NVDEC: return AV_PIX_FMT_CUDA;
66  case FMT_DXVA2: return AV_PIX_FMT_DXVA2_VLD;
67  case FMT_MMAL: return AV_PIX_FMT_MMAL;
68  case FMT_DRMPRIME: return AV_PIX_FMT_DRM_PRIME;
69  case FMT_NONE: break;
70  }
71  return AV_PIX_FMT_NONE;
72 }
73 
75 {
76  switch (Fmt)
77  {
78  case AV_PIX_FMT_YUVJ420P:
79  case AV_PIX_FMT_YUV420P: return FMT_YV12;
80  case AV_PIX_FMT_YUV420P9: return FMT_YUV420P9;
81  case AV_PIX_FMT_YUV420P10: return FMT_YUV420P10;
82  case AV_PIX_FMT_YUV420P12: return FMT_YUV420P12;
83  case AV_PIX_FMT_YUV420P14: return FMT_YUV420P14;
84  case AV_PIX_FMT_YUV420P16: return FMT_YUV420P16;
85  case AV_PIX_FMT_NV12: return FMT_NV12;
86  case AV_PIX_FMT_P010: return FMT_P010;
87  case AV_PIX_FMT_P016: return FMT_P016;
88  case AV_PIX_FMT_YUVJ422P:
89  case AV_PIX_FMT_YUV422P: return FMT_YUV422P;
90  case AV_PIX_FMT_YUV422P9: return FMT_YUV422P9;
91  case AV_PIX_FMT_YUV422P10: return FMT_YUV422P10;
92  case AV_PIX_FMT_YUV422P12: return FMT_YUV422P12;
93  case AV_PIX_FMT_YUV422P14: return FMT_YUV422P14;
94  case AV_PIX_FMT_YUV422P16: return FMT_YUV422P16;
95  case AV_PIX_FMT_YUVJ444P:
96  case AV_PIX_FMT_YUV444P: return FMT_YUV444P;
97  case AV_PIX_FMT_YUV444P9: return FMT_YUV444P9;
98  case AV_PIX_FMT_YUV444P10: return FMT_YUV444P10;
99  case AV_PIX_FMT_YUV444P12: return FMT_YUV444P12;
100  case AV_PIX_FMT_YUV444P14: return FMT_YUV444P14;
101  case AV_PIX_FMT_YUV444P16: return FMT_YUV444P16;
102  case AV_PIX_FMT_UYVY422: return FMT_YUY2;
103  case AV_PIX_FMT_RGB24: return FMT_RGB24;
104  case AV_PIX_FMT_ARGB: return FMT_ARGB32;
105  case AV_PIX_FMT_RGBA: return FMT_RGBA32;
106  case AV_PIX_FMT_BGRA: return FMT_BGRA;
107  case AV_PIX_FMT_CUDA: return FMT_NVDEC;
108  case AV_PIX_FMT_MMAL: return FMT_MMAL;
109  case AV_PIX_FMT_VDPAU: return FMT_VDPAU;
110  case AV_PIX_FMT_VIDEOTOOLBOX: return FMT_VTB;
111  case AV_PIX_FMT_VAAPI: return FMT_VAAPI;
112  case AV_PIX_FMT_DXVA2_VLD: return FMT_DXVA2;
113  case AV_PIX_FMT_MEDIACODEC: return FMT_MEDIACODEC;
114  case AV_PIX_FMT_DRM_PRIME: return FMT_DRMPRIME;
115  default: break;
116  }
117  return FMT_NONE;
118 }
119 
126 {
127  if (!Frame)
128  return;
129 
130  // Create a wrapper frame and set it up
131  // (yes - this will end up being a wrapper around a wrapper!)
132  MythVideoFrame mythframe;
133  VideoFrameType type = PixelFormatToFrameType(static_cast<AVPixelFormat>(Frame->format));
135  {
136  mythframe.Init(type, Frame->data[0], MythVideoFrame::GetBufferSize(type, Frame->width, Frame->height),
137  Frame->width, Frame->height);
138  mythframe.m_offsets[0] = 0;
139  mythframe.m_offsets[1] = static_cast<int>(Frame->data[1] - Frame->data[0]);
140  mythframe.m_offsets[2] = static_cast<int>(Frame->data[2] - Frame->data[0]);
141  mythframe.m_pitches[0] = Frame->linesize[0];
142  mythframe.m_pitches[1] = Frame->linesize[1];
143  mythframe.m_pitches[2] = Frame->linesize[2];
144 
146  mythframe.m_deinterlaceAllowed = DEINT_ALL;
147  MythDeinterlacer deinterlacer;
148  deinterlacer.Filter(&mythframe, kScan_Interlaced, nullptr, true);
149  }
150 
151  // Must remove buffer before mythframe is deleted
152  mythframe.m_buffer = nullptr;
153 }
154 
156 int MythAVUtil::FillAVFrame(AVFrame *Frame, const MythVideoFrame *From, AVPixelFormat Fmt)
157 {
158  if (Fmt == AV_PIX_FMT_NONE)
159  Fmt = FrameTypeToPixelFormat(From->m_type);
160 
161  av_image_fill_arrays(Frame->data, Frame->linesize, From->m_buffer,
162  Fmt, From->m_width, From->m_height, IMAGE_ALIGN);
163  Frame->data[1] = From->m_buffer + From->m_offsets[1];
164  Frame->data[2] = From->m_buffer + From->m_offsets[2];
165  Frame->linesize[0] = From->m_pitches[0];
166  Frame->linesize[1] = From->m_pitches[1];
167  Frame->linesize[2] = From->m_pitches[2];
168  return static_cast<int>(MythVideoFrame::GetBufferSize(From->m_type, From->m_width, From->m_height));
169 }
170 
175 {
176  sws_freeContext(m_swsctx);
177 }
178 
179 int MythAVCopy::SizeData(int Width, int Height, AVPixelFormat Fmt)
180 {
181  if (Width == m_width && Height == m_height && Fmt == m_format)
182  return m_size;
183 
184  m_size = av_image_get_buffer_size(Fmt, Width, Height, IMAGE_ALIGN);
185  m_width = Width;
186  m_height = Height;
187  m_format = Fmt;
188  return m_size;
189 }
190 
191 int MythAVCopy::Copy(AVFrame* To, AVPixelFormat ToFmt, const AVFrame* From, AVPixelFormat FromFmt,
192  int Width, int Height)
193 {
194  int newwidth = Width;
195 #if ARCH_ARM
196  // The ARM build of FFMPEG has a bug that if sws_scale is
197  // called with source and dest sizes the same, and
198  // formats as shown below, it causes a bus error and the
199  // application core dumps. To avoid this I make a -1
200  // difference in the new width, causing it to bypass
201  // the code optimization which is failing.
202  if (FromFmt == AV_PIX_FMT_YUV420P && ToFmt == AV_PIX_FMT_BGRA)
203  newwidth = Width - 1;
204 #endif
205  m_swsctx = sws_getCachedContext(m_swsctx, Width, Height, FromFmt,
206  newwidth, Height, ToFmt, SWS_FAST_BILINEAR,
207  nullptr, nullptr, nullptr);
208  if (m_swsctx == nullptr)
209  return -1;
210  sws_scale(m_swsctx, From->data, From->linesize, 0, Height, To->data, To->linesize);
211  return SizeData(Width, Height, ToFmt);
212 }
213 
221  unsigned char* Buffer, AVPixelFormat Fmt)
222 {
223  if (!Buffer)
224  return 0;
225  AVFrame frame;
226  AVPixelFormat fromfmt = MythAVUtil::FrameTypeToPixelFormat(From->m_type);
227  MythAVUtil::FillAVFrame(&frame, From, fromfmt);
228  av_image_fill_arrays(To->data, To->linesize, Buffer, Fmt, From->m_width, From->m_height, IMAGE_ALIGN);
229  return Copy(To, Fmt, &frame, fromfmt, From->m_width, From->m_height);
230 }
231 
237 {
238  FreeAllContexts();
239 }
240 
241 AVCodecContext *MythCodecMap::GetCodecContext(const AVStream* Stream,
242  const AVCodec* Codec,
243  bool NullCodec)
244 {
245  QMutexLocker lock(&m_mapLock);
246  AVCodecContext* avctx = m_streamMap.value(Stream, nullptr);
247  if (!avctx)
248  {
249  if (Stream == nullptr || Stream->codecpar == nullptr)
250  return nullptr;
251 
252  if (NullCodec)
253  {
254  Codec = nullptr;
255  }
256  else
257  {
258  if (!Codec)
259  Codec = avcodec_find_decoder(Stream->codecpar->codec_id);
260 
261  if (!Codec)
262  {
263  LOG(VB_GENERAL, LOG_WARNING, QString("avcodec_find_decoder fail for %1")
264  .arg(Stream->codecpar->codec_id));
265  return nullptr;
266  }
267  }
268  avctx = avcodec_alloc_context3(Codec);
269  if (avcodec_parameters_to_context(avctx, Stream->codecpar) < 0)
270  avcodec_free_context(&avctx);
271 
272  if (avctx)
273  {
274  avctx->pkt_timebase = Stream->time_base;
275  m_streamMap.insert(Stream, avctx);
276  }
277  }
278  return avctx;
279 }
280 
281 AVCodecContext *MythCodecMap::FindCodecContext(const AVStream* Stream)
282 {
283  return m_streamMap.value(Stream, nullptr);
284 }
285 
289 void MythCodecMap::FreeCodecContext(const AVStream* Stream)
290 {
291  QMutexLocker lock(&m_mapLock);
292  AVCodecContext* avctx = m_streamMap.take(Stream);
293  if (avctx)
294  {
295  if (avctx->internal)
296  avcodec_flush_buffers(avctx);
297  avcodec_free_context(&avctx);
298  }
299 }
300 
302 {
303  QMutexLocker lock(&m_mapLock);
304  QMap<const AVStream*, AVCodecContext*>::iterator i = m_streamMap.begin();
305  while (i != m_streamMap.end())
306  {
307  const AVStream *stream = i.key();
308  ++i;
309  FreeCodecContext(stream);
310  }
311 }
312 
314 {
315  const int probeBufferSize = 8 * 1024;
316  AVInputFormat *fmt = nullptr;
317  AVProbeData probe;
318  memset(&probe, 0, sizeof(AVProbeData));
319  probe.filename = "";
320  probe.buf = new unsigned char[probeBufferSize + AVPROBE_PADDING_SIZE];
321  probe.buf_size = probeBufferSize;
322  memset(probe.buf, 0, probeBufferSize + AVPROBE_PADDING_SIZE);
323  av_log_set_level(AV_LOG_FATAL);
324  m_errorCode = 0;
325  if (filename == "")
326  m_errorCode = 97;
327  QFile infile(filename);
328  if (m_errorCode == 0 && !infile.open(QIODevice::ReadOnly))
329  m_errorCode = 99;
330  if (m_errorCode==0) {
331  int64_t leng = infile.read(reinterpret_cast<char*>(probe.buf), probeBufferSize);
332  probe.buf_size = static_cast<int>(leng);
333  infile.close();
334  fmt = av_probe_input_format(&probe, static_cast<int>(true));
335  if (fmt == nullptr)
336  m_errorCode = 98;
337  }
338  AVFormatContext *ctx = nullptr;
339  if (m_errorCode==0)
340  {
341  ctx = avformat_alloc_context();
342  m_errorCode = avformat_open_input(&ctx, filename.toUtf8(), fmt, nullptr);
343  }
344  if (m_errorCode==0)
345  m_errorCode = avformat_find_stream_info(ctx, nullptr);
346 
347  if (m_errorCode==0)
348  {
349  for (uint ix = 0; ix < ctx->nb_streams; ix++)
350  {
351  AVStream *stream = ctx->streams[ix];
352  if (stream == nullptr)
353  continue;
354  AVCodecParameters *codecpar = stream->codecpar;
355  const AVCodecDescriptor* desc = nullptr;
356  MythStreamInfo info;
357  info.m_codecType = ' ';
358  if (codecpar != nullptr)
359  {
360  desc = avcodec_descriptor_get(codecpar->codec_id);
361  switch (codecpar->codec_type)
362  {
363  case AVMEDIA_TYPE_VIDEO:
364  info.m_codecType = 'V';
365  break;
366  case AVMEDIA_TYPE_AUDIO:
367  info.m_codecType = 'A';
368  break;
369  case AVMEDIA_TYPE_SUBTITLE:
370  info.m_codecType = 'S';
371  break;
372  default:
373  continue;
374  }
375  }
376  if (desc != nullptr)
377  info.m_codecName = desc->name;
378  info.m_duration = stream->duration * stream->time_base.num / stream->time_base.den;
379  if (info.m_codecType == 'V')
380  {
381  if (codecpar != nullptr)
382  {
383  info.m_width = codecpar->width;
384  info.m_height = codecpar->height;
385  info.m_SampleAspectRatio = static_cast<float>(codecpar->sample_aspect_ratio.num)
386  / static_cast<float>(codecpar->sample_aspect_ratio.den);
387  switch (codecpar->field_order)
388  {
389  case AV_FIELD_PROGRESSIVE:
390  info.m_fieldOrder = "PR";
391  break;
392  case AV_FIELD_TT:
393  info.m_fieldOrder = "TT";
394  break;
395  case AV_FIELD_BB:
396  info.m_fieldOrder = "BB";
397  break;
398  case AV_FIELD_TB:
399  info.m_fieldOrder = "TB";
400  break;
401  case AV_FIELD_BT:
402  info.m_fieldOrder = "BT";
403  break;
404  default:
405  break;
406  }
407  }
408  info.m_frameRate = static_cast<float>(stream->r_frame_rate.num)
409  / static_cast<float>(stream->r_frame_rate.den);
410  info.m_avgFrameRate = static_cast<float>(stream->avg_frame_rate.num)
411  / static_cast<float>(stream->avg_frame_rate.den);
412  }
413  if (info.m_codecType == 'A')
414  info.m_channels = codecpar->channels;
415  m_streamInfoList.append(info);
416  }
417  }
418  if (m_errorCode != 0)
419  {
420  switch(m_errorCode) {
421  case 97:
422  m_errorMsg = "File Not Found";
423  break;
424  case 98:
425  m_errorMsg = "av_probe_input_format returned no result";
426  break;
427  case 99:
428  m_errorMsg = "File could not be opened";
429  break;
430  default:
431  std::string errbuf;
432  if (av_strerror_stdstring(m_errorCode, errbuf) == 0)
433  m_errorMsg = QString::fromStdString(errbuf);
434  else
435  m_errorMsg = "UNKNOWN";
436  }
437  LOG(VB_GENERAL, LOG_ERR,
438  QString("MythStreamInfoList failed for %1. Error code:%2 Message:%3")
440 
441  }
442 
443  if (ctx != nullptr)
444  {
445  avformat_close_input(&ctx);
446  avformat_free_context(ctx);
447  }
448  delete [] probe.buf;
449 }
MythStreamInfoList::m_errorMsg
QString m_errorMsg
Definition: mythavutil.h:99
FMT_MEDIACODEC
@ FMT_MEDIACODEC
Definition: mythframe.h:56
MythVideoFrame::Init
void Init(VideoFrameType Type, int Width, int Height)
Definition: mythframe.cpp:41
MythAVCopy::m_size
int m_size
Definition: mythavutil.h:58
MythAVCopy::m_format
AVPixelFormat m_format
Definition: mythavutil.h:54
MythStreamInfo::m_codecName
QString m_codecName
Definition: mythavutil.h:74
DEINT_MEDIUM
@ DEINT_MEDIUM
Definition: mythframe.h:66
MythStreamInfo::m_height
int m_height
Definition: mythavutil.h:78
FMT_YUV420P10
@ FMT_YUV420P10
Definition: mythframe.h:21
FMT_YUV420P16
@ FMT_YUV420P16
Definition: mythframe.h:24
FMT_VTB
@ FMT_VTB
Definition: mythframe.h:57
MythCodecMap::GetCodecContext
AVCodecContext * GetCodecContext(const AVStream *Stream, const AVCodec *Codec=nullptr, bool NullCodec=false)
Definition: mythavutil.cpp:241
FMT_YUV420P14
@ FMT_YUV420P14
Definition: mythframe.h:23
MythVideoFrame::m_deinterlaceAllowed
MythDeintType m_deinterlaceAllowed
Definition: mythframe.h:149
FMT_DRMPRIME
@ FMT_DRMPRIME
Definition: mythframe.h:59
FMT_YUV444P10
@ FMT_YUV444P10
Definition: mythframe.h:41
FMT_YUV422P14
@ FMT_YUV422P14
Definition: mythframe.h:36
MythStreamInfo::m_codecType
char m_codecType
Definition: mythavutil.h:73
MythStreamInfo::m_avgFrameRate
float m_avgFrameRate
Definition: mythavutil.h:86
Frame
Definition: zmdefines.h:94
MythStreamInfo
Definition: mythavutil.h:70
MythAVUtil::DeinterlaceAVFrame
static void DeinterlaceAVFrame(AVFrame *Frame)
Deinterlace an AVFrame.
Definition: mythavutil.cpp:125
FMT_P010
@ FMT_P010
Definition: mythframe.h:49
arg
arg(title).arg(filename).arg(doDelete))
MythCodecMap::FreeAllContexts
void FreeAllContexts()
Definition: mythavutil.cpp:301
MythVideoFrame::m_width
int m_width
Definition: mythframe.h:112
FMT_YUV422P
@ FMT_YUV422P
Definition: mythframe.h:32
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythStreamInfo::m_duration
int64_t m_duration
Definition: mythavutil.h:75
DEINT_ALL
@ DEINT_ALL
Definition: mythframe.h:71
MythAVCopy::m_height
int m_height
Definition: mythavutil.h:57
MythVideoFrame::m_offsets
FrameOffsets m_offsets
Definition: mythframe.h:134
mythdeinterlacer.h
FMT_YUV444P14
@ FMT_YUV444P14
Definition: mythframe.h:43
FMT_YUV444P
@ FMT_YUV444P
Definition: mythframe.h:39
FMT_NONE
@ FMT_NONE
Definition: mythframe.h:17
DEINT_CPU
@ DEINT_CPU
Definition: mythframe.h:68
MythCodecMap::FindCodecContext
AVCodecContext * FindCodecContext(const AVStream *Stream)
Definition: mythavutil.cpp:281
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
MythStreamInfoList::m_errorCode
int m_errorCode
Definition: mythavutil.h:98
MythVideoFrame::YUVFormat
static bool YUVFormat(VideoFrameType Type)
Definition: mythframe.h:449
MythAVCopy::m_swsctx
SwsContext * m_swsctx
Definition: mythavutil.h:55
MythVideoFrame::GetBufferSize
static size_t GetBufferSize(VideoFrameType Type, int Width, int Height, int Aligned=MYTH_WIDTH_ALIGNMENT)
Definition: mythframe.cpp:407
MythStreamInfo::m_width
int m_width
Definition: mythavutil.h:77
av_strerror_stdstring
int av_strerror_stdstring(int errnum, std::string &errbuf)
Definition: mythaverror.cpp:27
FMT_YUV444P9
@ FMT_YUV444P9
Definition: mythframe.h:40
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:19
MythDeinterlacer::Filter
void Filter(MythVideoFrame *Frame, FrameScanType Scan, VideoDisplayProfile *Profile, bool Force=false)
Deinterlace Frame if needed.
Definition: mythdeinterlacer.cpp:69
FMT_YUV422P10
@ FMT_YUV422P10
Definition: mythframe.h:34
FMT_YUV444P16
@ FMT_YUV444P16
Definition: mythframe.h:44
MythStreamInfo::m_channels
int m_channels
Definition: mythavutil.h:88
FMT_BGRA
@ FMT_BGRA
Definition: mythframe.h:27
MythStreamInfo::m_SampleAspectRatio
float m_SampleAspectRatio
Definition: mythavutil.h:79
FMT_YUV420P12
@ FMT_YUV420P12
Definition: mythframe.h:22
MythDeinterlacer
Handles software based deinterlacing of video frames.
Definition: mythdeinterlacer.h:15
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:637
MythCodecMap::FreeCodecContext
void FreeCodecContext(const AVStream *Stream)
Definition: mythavutil.cpp:289
uint
unsigned int uint
Definition: compat.h:140
MythAVCopy::m_width
int m_width
Definition: mythavutil.h:56
FMT_YUV444P12
@ FMT_YUV444P12
Definition: mythframe.h:42
FMT_ARGB32
@ FMT_ARGB32
Definition: mythframe.h:29
MythAVUtil::PixelFormatToFrameType
static VideoFrameType PixelFormatToFrameType(AVPixelFormat Fmt)
Definition: mythavutil.cpp:74
MythVideoFrame::m_pitches
FramePitches m_pitches
Definition: mythframe.h:133
MythStreamInfo::m_frameRate
float m_frameRate
Definition: mythavutil.h:85
FMT_NVDEC
@ FMT_NVDEC
Definition: mythframe.h:58
FMT_YUV422P9
@ FMT_YUV422P9
Definition: mythframe.h:33
MythStreamInfo::m_fieldOrder
QString m_fieldOrder
Definition: mythavutil.h:84
Buffer
Definition: MythExternControl.h:37
FMT_YUV420P9
@ FMT_YUV420P9
Definition: mythframe.h:20
mythcorecontext.h
FMT_VDPAU
@ FMT_VDPAU
Definition: mythframe.h:52
kScan_Interlaced
@ kScan_Interlaced
Definition: videoouttypes.h:64
MythVideoFrame::m_type
VideoFrameType m_type
Definition: mythframe.h:110
FMT_YUV422P16
@ FMT_YUV422P16
Definition: mythframe.h:37
FMT_YUY2
@ FMT_YUY2
Definition: mythframe.h:46
FMT_DXVA2
@ FMT_DXVA2
Definition: mythframe.h:54
FMT_RGB24
@ FMT_RGB24
Definition: mythframe.h:26
FMT_YUV422P12
@ FMT_YUV422P12
Definition: mythframe.h:35
MythAVUtil::FrameTypeToPixelFormat
static AVPixelFormat FrameTypeToPixelFormat(VideoFrameType Type)
Definition: mythavutil.cpp:30
mythavutil.h
MythCodecMap::m_mapLock
QMutex m_mapLock
Definition: mythavutil.h:37
MythStreamInfoList::MythStreamInfoList
MythStreamInfoList(const QString &filename)
Definition: mythavutil.cpp:313
MythCodecMap::~MythCodecMap
~MythCodecMap()
Definition: mythavutil.cpp:236
MythVideoFrame::m_height
int m_height
Definition: mythframe.h:113
FMT_RGB32
@ FMT_RGB32
endian dependent format, ARGB or BGRA
Definition: mythframe.h:28
FMT_MMAL
@ FMT_MMAL
Definition: mythframe.h:55
VideoFrameType
VideoFrameType
Definition: mythframe.h:16
FMT_VAAPI
@ FMT_VAAPI
Definition: mythframe.h:53
MythCodecMap::m_streamMap
QMap< const AVStream *, AVCodecContext * > m_streamMap
Definition: mythavutil.h:36
MythAVCopy::~MythAVCopy
~MythAVCopy()
Definition: mythavutil.cpp:174
MythVideoFrame
Definition: mythframe.h:83
FMT_NV12
@ FMT_NV12
Definition: mythframe.h:48
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:220
FMT_P016
@ FMT_P016
Definition: mythframe.h:50
MythAVCopy::SizeData
int SizeData(int Width, int Height, AVPixelFormat Fmt)
Definition: mythavutil.cpp:179
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:156
MythVideoFrame::m_deinterlaceSingle
MythDeintType m_deinterlaceSingle
Definition: mythframe.h:147
FMT_RGBA32
@ FMT_RGBA32
Definition: mythframe.h:30
MythVideoFrame::m_buffer
uint8_t * m_buffer
Definition: mythframe.h:111
MythStreamInfoList::m_streamInfoList
QVector< MythStreamInfo > m_streamInfoList
Definition: mythavutil.h:100