MythTV  master
mythmediacodeccontext.cpp
Go to the documentation of this file.
1 // Qt
2 #include <QtAndroidExtras>
3 #include <QAndroidJniEnvironment>
4 
5 // MythTV
9 
10 #include "avformatdecoder.h"
11 #include "mythmediacodeccontext.h"
12 #include "mythplayerui.h"
14 
15 // FFmpeg
16 extern "C" {
17 #include "libavutil/pixfmt.h"
18 #include "libavutil/hwcontext_mediacodec.h"
19 #include "libavcodec/mediacodec.h"
20 #include "libavcodec/avcodec.h"
21 }
22 
23 #define LOC QString("MediaCodec: ")
24 
25 // MedicaCodec profile constants from MediaCodecInfo.CodecProfileLevel
26 #define MC_MPEG2_SIMPLE (0x0)
27 #define MC_MPEG2_MAIN (0x1)
28 #define MC_MPEG2_422 (0x2)
29 #define MC_MPEG2_SNR (0x3)
30 #define MC_MPEG2_SPATIAL (0x4)
31 #define MC_MPEG2_HIGH (0x5)
32 #define MC_MPEG4_SIMPLE (0x0001)
33 #define MC_MPEG4_SIMPLE_SCALEABLE (0x0002)
34 #define MC_MPEG4_CORE (0x0004)
35 #define MC_MPEG4_MAIN (0x0008)
36 #define MC_MPEG4_NBIT (0x0010)
37 #define MC_MPEG4_SCALEABLE_TEX (0x0020)
38 #define MC_MPEG4_SIMPLE_FACE (0x0040)
39 #define MC_MPEG4_SIMPLE_FBA (0x0080)
40 #define MC_MPEG4_BASIC_ANIMATED (0x0100)
41 #define MC_MPEG4_HYBRID (0x0200)
42 #define MC_MPEG4_ADV_REALTIME (0x0400)
43 #define MC_MPEG4_CORE_SCALEABLE (0x0800)
44 #define MC_MPEG4_ADV_CODING (0x1000)
45 #define MC_MPEG4_ADV_CORE (0x2000)
46 #define MC_MPEG4_ADV_SCALEABLE (0x4000)
47 #define MC_MPEG4_ADV_SIMPLE (0x8000)
48 #define MC_H264_BASELINE (0x00001)
49 #define MC_H264_MAIN (0x00002)
50 #define MC_H264_EXTENDED (0x00004)
51 #define MC_H264_HIGH (0x00008)
52 #define MC_H264_HIGH10 (0x00010)
53 #define MC_H264_HIGH422 (0x00020)
54 #define MC_H264_HIGH444 (0x00040)
55 #define MC_H264_CONST_BASELINE (0x10000)
56 #define MC_H264_CONST_HIGH (0x80000)
57 #define MC_HEVC_MAIN (0x0001)
58 #define MC_HEVC_MAIN10 (0x0002)
59 #define MC_HEVC_MAIN_STILL (0x0004)
60 #define MC_HEVC_MAIN10HDR10 (0x1000)
61 #define MC_HEVC_MMAIN10HDR10PLUS (0x2000)
62 #define MC_VP8_MAIN (0x0001)
63 #define MC_VP9_0 (0x0001)
64 #define MC_VP9_1 (0x0002)
65 #define MC_VP9_2 (0x0004)
66 #define MC_VP9_3 (0x0008)
67 #define MC_VP9_2HDR (0x1000)
68 #define MC_VP9_3HDR (0x2000)
69 #define MC_VP9_2HDRPLUS (0x4000)
70 #define MC_VP9_3HDRPLUS (0x8000)
71 
73 {
74  if (Codec == MythCodecContext::MPEG2)
75  {
76  switch (Profile)
77  {
84  default: return MythCodecContext::MPEG2;
85  }
86  }
87 
88  if (Codec == MythCodecContext::MPEG4)
89  {
90  switch (Profile)
91  {
99  case MC_MPEG4_SIMPLE_FBA: return MythCodecContext::MPEG4SimpleStudio; // Is this correct?
108  default: return MythCodecContext::MPEG4;
109  }
110  }
111 
112  if (Codec == MythCodecContext::H264)
113  {
114  switch (Profile)
115  {
125  default: return MythCodecContext::H264;
126  }
127  }
128 
129  if (Codec == MythCodecContext::HEVC)
130  {
131  switch (Profile)
132  {
138  default: return MythCodecContext::HEVC;
139  }
140  }
141 
142  if (Codec == MythCodecContext::VP8)
143  return MythCodecContext::VP8;
144 
145  if (Codec == MythCodecContext::VP9)
146  {
147  switch (Profile)
148  {
149  case MC_VP9_0: return MythCodecContext::VP9_0;
150  case MC_VP9_1: return MythCodecContext::VP9_1;
151  case MC_VP9_2: return MythCodecContext::VP9_2;
152  case MC_VP9_3: return MythCodecContext::VP9_3;
157  default: return MythCodecContext::VP9;
158  }
159  }
160 
162 }
163 
164 int MythMediaCodecContext::InitialiseDecoder(AVCodecContext *Context)
165 {
166  if (!Context || !gCoreContext->IsUIThread())
167  return -1;
168 
169  // The interop must have a reference to the ui player so it can be deleted
170  // from the main thread.
171  auto * player = GetPlayerUI(Context);
172  if (!player)
173  return -1;
174 
175  // Retrieve OpenGL render context
176  auto * render = dynamic_cast<MythRenderOpenGL*>(player->GetRender());
177  if (!render)
178  return -1;
179  OpenGLLocker locker(render);
180 
181  // Create interop - NB no interop check here or in MythMediaCodecInterop
182  QSize size(Context->width, Context->height);
183  auto * interop = MythMediaCodecInterop::CreateMediaCodec(player, render, size);
184  if (!interop)
185  return -1;
186  if (!interop->GetSurface())
187  {
188  interop->DecrRef();
189  return -1;
190  }
191 
192  // Create the hardware context
193  AVBufferRef *hwdeviceref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_MEDIACODEC);
194  AVHWDeviceContext *hwdevicectx = reinterpret_cast<AVHWDeviceContext*>(hwdeviceref->data);
195  hwdevicectx->free = &MythCodecContext::DeviceContextFinished;
196  hwdevicectx->user_opaque = interop;
197  AVMediaCodecDeviceContext *hwctx = reinterpret_cast<AVMediaCodecDeviceContext*>(hwdevicectx->hwctx);
198  hwctx->surface = interop->GetSurface();
199  if (av_hwdevice_ctx_init(hwdeviceref) < 0)
200  {
201  LOG(VB_GENERAL, LOG_ERR, LOC + "av_hwdevice_ctx_init failed");
202  av_buffer_unref(&hwdeviceref);
203  return -1;
204  }
205 
206  Context->hw_device_ctx = hwdeviceref;
207  LOG(VB_GENERAL, LOG_INFO, LOC + "Created MediaCodec hardware device context");
208  return 0;
209 }
210 
212  AVCodec **Codec,
213  const QString &Decoder,
214  AVStream *Stream,
215  uint StreamType)
216 {
217  bool decodeonly = Decoder == "mediacodec-dec";
218  MythCodecID success = static_cast<MythCodecID>((decodeonly ? kCodec_MPEG1_MEDIACODEC_DEC : kCodec_MPEG1_MEDIACODEC) + (StreamType - 1));
219  MythCodecID failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1));
220 
221  if (!Decoder.startsWith("mediacodec"))
222  return failure;
223 
224  if (!HaveMediaCodec())
225  return failure;
226 
227  if (!decodeonly)
228  if (!FrameTypeIsSupported(*Context, FMT_MEDIACODEC))
229  return failure;
230 
231  bool found = false;
233  MythCodecContext::CodecProfile mythprofile =
234  MythCodecContext::FFmpegToMythProfile((*Context)->codec_id, (*Context)->profile);
235  for (auto profile : qAsConst(profiles))
236  {
237  if (profile.first == mythprofile &&
238  profile.second.width() >= (*Context)->width &&
239  profile.second.height() >= (*Context)->height)
240  {
241  found = true;
242  break;
243  }
244  }
245 
246  AvFormatDecoder *decoder = dynamic_cast<AvFormatDecoder*>(reinterpret_cast<DecoderBase*>((*Context)->opaque));
247  QString profilestr = MythCodecContext::GetProfileDescription(mythprofile, QSize());
248  if (found && decoder)
249  {
250  QString decodername = QString((*Codec)->name) + "_mediacodec";
251  if (decodername == "mpeg2video_mediacodec")
252  decodername = "mpeg2_mediacodec";
253  AVCodec *newCodec = avcodec_find_decoder_by_name (decodername.toLocal8Bit());
254  if (newCodec)
255  {
256  *Codec = newCodec;
257  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("HW device type '%1' supports decoding '%2' (%3)")
258  .arg(av_hwdevice_get_type_name(AV_HWDEVICE_TYPE_MEDIACODEC)).arg((*Codec)->name).arg(profilestr));
259  decoder->CodecMap()->FreeCodecContext(Stream);
260  *Context = decoder->CodecMap()->GetCodecContext(Stream, *Codec);
261  (*Context)->pix_fmt = AV_PIX_FMT_MEDIACODEC;
262  return success;
263  }
264  }
265 
266  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("HW device type '%1' does not support decoding '%2' (%3)")
267  .arg(av_hwdevice_get_type_name(AV_HWDEVICE_TYPE_MEDIACODEC)).arg((*Codec)->name).arg(profilestr));
268  return failure;
269 }
270 
272  : MythCodecContext(Parent, CodecID)
273 {
274 }
275 
276 void MythMediaCodecContext::InitVideoCodec(AVCodecContext *Context, bool SelectedStream, bool &DirectRendering)
277 {
278  if (CODEC_IS_MEDIACODEC(Context->codec))
279  {
280  Context->get_format = MythMediaCodecContext::GetFormat;
281  Context->slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD;
282  DirectRendering = false;
283  return;
284  }
285 
286  MythCodecContext::InitVideoCodec(Context, SelectedStream, DirectRendering);
287 }
288 
289 int MythMediaCodecContext::HwDecoderInit(AVCodecContext *Context)
290 {
292  return 0;
293  else if (codec_is_mediacodec(m_codecID))
294  return MythCodecContext::InitialiseDecoder2(Context, MythMediaCodecContext::InitialiseDecoder, "Create MediaCodec decoder");
295  return -1;
296 }
297 
298 bool MythMediaCodecContext::RetrieveFrame(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame)
299 {
300  if (AvFrame->format != AV_PIX_FMT_MEDIACODEC)
301  return false;
303  return GetBuffer2(Context, Frame, AvFrame, 0);
304  return false;
305 }
306 
307 AVPixelFormat MythMediaCodecContext::GetFormat(AVCodecContext*, const AVPixelFormat *PixFmt)
308 {
309  while (*PixFmt != AV_PIX_FMT_NONE)
310  {
311  if (*PixFmt == AV_PIX_FMT_MEDIACODEC)
312  return AV_PIX_FMT_MEDIACODEC;
313  PixFmt++;
314  }
315  return AV_PIX_FMT_NONE;
316 }
317 
323 {
324  if (!Frame)
325  return;
326 
327  Frame->m_deinterlaceInuse = DEINT_BASIC | DEINT_DRIVER;
328  Frame->m_deinterlaceInuse2x = false;
329  Frame->m_interlaced = 0;
330  Frame->m_interlacedReverse = false;
331  Frame->m_topFieldFirst = false;
332  Frame->m_deinterlaceAllowed = DEINT_NONE;
333  Frame->m_alreadyDeinterlaced = true;
334 }
335 
340 bool MythMediaCodecContext::IsDeinterlacing(bool &DoubleRate, bool)
341 {
342  DoubleRate = true;
343  return true;
344 }
345 
347 {
348  // TODO Something tells me this is leakier than a leaky thing
349 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
350  static QMutex lock(QMutex::Recursive);
351 #else
352  static QRecursiveMutex lock;
353 #endif
354  static bool s_initialised = false;
355  static MCProfiles s_profiles;
356 
357  QMutexLocker locker(&lock);
358  if (s_initialised)
359  return s_profiles;
360  s_initialised = true;
361 
362  static const QPair<QString,QPair<MythCodecContext::CodecProfile, QList<int> > > mimetypes[] =
363  {
364  { "video/mpeg2", { MythCodecContext::MPEG2,
367  { "video/mp4v-es", { MythCodecContext::MPEG4,
374  { "video/avc", { MythCodecContext::H264,
378  { "video/hevc", { MythCodecContext::HEVC,
381  { "video/x-vnd.on2.vp8", { MythCodecContext::VP8, { MC_VP8_MAIN }}},
382  { "video/x-vnd.on2.vp9", { MythCodecContext::VP9,
385  //{ "video/vc1", { MythCodecContext::VC1 , {}}}, // No FFmpeg support
386  //{ "video/3gpp", { MythCodecContext::H263 , {}}}, // No FFmpeg support
387  //{ "video/av01", { MythCodecContext::AV1 , {}}} // No FFmpeg support, API Level 29
388  };
389 
390  // Retrieve MediaCodecList
391  QAndroidJniEnvironment env;
392  QAndroidJniObject list("android/media/MediaCodecList", "(I)V", 0); // 0 = REGULAR_CODECS
393  if (!list.isValid())
394  return s_profiles;
395  // Retrieve array of MediaCodecInfo's
396  QAndroidJniObject qtcodecs = list.callObjectMethod("getCodecInfos", "()[Landroid/media/MediaCodecInfo;");
397  if (!qtcodecs.isValid())
398  return s_profiles;
399 
400  // Iterate over MediaCodecInfo's
401  jobjectArray codecs = qtcodecs.object<jobjectArray>();
402  jsize codeccount = env->GetArrayLength(codecs);
403  for (jsize i = 0; i < codeccount; ++i)
404  {
405  QAndroidJniObject codec(env->GetObjectArrayElement(codecs, i));
406  if (!codec.isValid())
407  continue;
408 
409  // Ignore encoders
410  if (codec.callMethod<jboolean>("isEncoder"))
411  continue;
412 
413  // Ignore software decoders
414  QString name = codec.callObjectMethod<jstring>("getName").toString();
415  if (name.contains("OMX.google", Qt::CaseInsensitive))
416  continue;
417 
418  // Retrieve supported mimetypes (there is usually just one)
419  QAndroidJniObject qttypes = codec.callObjectMethod("getSupportedTypes", "()[Ljava/lang/String;");
420  jobjectArray types = qttypes.object<jobjectArray>();
421  jsize typecount = env->GetArrayLength(types);
422  for (jsize j = 0; j < typecount; ++j)
423  {
424  QAndroidJniObject type(env->GetObjectArrayElement(types, j));
425  if (!type.isValid())
426  continue;
427 
428  // Match mimetype to types supported by FFmpeg
429  QString typestr = type.toString();
430  for (auto mimetype : mimetypes)
431  {
432  if (mimetype.first != typestr)
433  continue;
434 
435  // Retrieve MediaCodecInfo.CodecCapabilities for mimetype
436  QAndroidJniObject caps = codec.callObjectMethod("getCapabilitiesForType",
437  "(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;",
438  type.object<jstring>());
439  if (!caps.isValid())
440  continue;
441 
442  // Retrieve MediaCodecInfo.VideoCapabilities from CodecCapabilities
443  QAndroidJniObject videocaps = caps.callObjectMethod("getVideoCapabilities",
444  "()Landroid/media/MediaCodecInfo$VideoCapabilities;");
445  QAndroidJniObject widthrange = videocaps.callObjectMethod("getSupportedWidths",
446  "()Landroid/util/Range;");
447  QAndroidJniObject heightrange = videocaps.callObjectMethod("getSupportedHeights",
448  "()Landroid/util/Range;");
449 
450  QAndroidJniObject widthqt = widthrange.callObjectMethod("getUpper", "()Ljava/lang/Comparable;");
451  QAndroidJniObject heightqt = heightrange.callObjectMethod("getUpper", "()Ljava/lang/Comparable;");
452  int width = widthqt.callMethod<jint>("intValue", "()I");
453  int height = heightqt.callMethod<jint>("intValue", "()I");
454 
455  // Profiles are available from CodecCapabilities.profileLevel field
456  QAndroidJniObject profiles = caps.getObjectField("profileLevels",
457  "[Landroid/media/MediaCodecInfo$CodecProfileLevel;");
458  jobjectArray profilearr = profiles.object<jobjectArray>();
459  jsize profilecount = env->GetArrayLength(profilearr);
460  if (profilecount < 1)
461  {
462  s_profiles.append(QPair<MythCodecContext::CodecProfile,QSize>(mimetype.second.first, QSize(width, height)));
463  continue;
464  }
465 
466  for (jsize k = 0; k < profilecount; ++k)
467  {
468  jobject profile = env->GetObjectArrayElement(profilearr, k);
469  jclass objclass = env->GetObjectClass(profile);
470  jfieldID id = env->GetFieldID(objclass, "profile", "I");
471  int value = static_cast<int>(env->GetIntField(profile, id));
472  QList<int>& mcprofiles = mimetype.second.second;
473  auto sameprof = [value](auto mcprofile) { return value == mcprofile; };
474  if (std::any_of(mcprofiles.cbegin(), mcprofiles.cend(), sameprof))
475  {
476  MythCodecContext::CodecProfile p = MediaCodecToMythProfile(mimetype.second.first, value);
477  s_profiles.append(QPair<MythCodecContext::CodecProfile,QSize>(p, QSize(width, height)));
478  }
479  else
480  s_profiles.append(QPair<MythCodecContext::CodecProfile,QSize>(mimetype.second.first, QSize(width, height)));
481  }
482  }
483  }
484  }
485 
486  return s_profiles;
487 }
488 
489 void MythMediaCodecContext::GetDecoderList(QStringList &Decoders)
490 {
492  if (profiles.isEmpty())
493  return;
494 
495  Decoders.append("MediaCodec:");
496  for (auto profile : qAsConst(profiles))
497  Decoders.append(MythCodecContext::GetProfileDescription(profile.first, profile.second));
498 }
499 
500 bool MythMediaCodecContext::HaveMediaCodec(bool Reinit /*=false*/)
501 {
502 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
503  static QMutex lock(QMutex::Recursive);
504 #else
505  static QRecursiveMutex lock;
506 #endif
507  static bool s_initialised = false;
508  static bool s_available = false;
509 
510  QMutexLocker locker(&lock);
511  if (!s_initialised || Reinit)
512  {
514  if (profiles.isEmpty())
515  {
516  LOG(VB_GENERAL, LOG_INFO, LOC + "No MediaCodec decoders found");
517  }
518  else
519  {
520  s_available = true;
521  LOG(VB_GENERAL, LOG_INFO, LOC + "Supported/available MediaCodec decoders:");
522  for (auto profile : qAsConst(profiles))
523  {
524  LOG(VB_GENERAL, LOG_INFO, LOC +
526  }
527  }
528  }
529  s_initialised = true;
530  return s_available;
531 }
532 
MythCodecContext::VP9_3
@ VP9_3
Definition: mythcodeccontext.h:114
MC_MPEG4_SIMPLE_SCALEABLE
#define MC_MPEG4_SIMPLE_SCALEABLE
Definition: mythmediacodeccontext.cpp:33
FMT_MEDIACODEC
@ FMT_MEDIACODEC
Definition: mythframe.h:61
MC_MPEG4_BASIC_ANIMATED
#define MC_MPEG4_BASIC_ANIMATED
Definition: mythmediacodeccontext.cpp:40
DEINT_DRIVER
@ DEINT_DRIVER
Definition: mythframe.h:75
MythCodecContext::MPEG4Simple
@ MPEG4Simple
Definition: mythcodeccontext.h:69
MythCodecContext::H264Baseline
@ H264Baseline
Definition: mythcodeccontext.h:87
MC_H264_HIGH444
#define MC_H264_HIGH444
Definition: mythmediacodeccontext.cpp:54
MythCodecContext::MPEG2Simple
@ MPEG2Simple
Definition: mythcodeccontext.h:62
MC_MPEG4_ADV_SIMPLE
#define MC_MPEG4_ADV_SIMPLE
Definition: mythmediacodeccontext.cpp:47
MC_VP9_2HDRPLUS
#define MC_VP9_2HDRPLUS
Definition: mythmediacodeccontext.cpp:69
MythMediaCodecContext::IsDeinterlacing
bool IsDeinterlacing(bool &DoubleRate, bool=false) override
Definition: mythmediacodeccontext.cpp:340
MythCodecContext::m_codecID
MythCodecID m_codecID
Definition: mythcodeccontext.h:171
MC_HEVC_MMAIN10HDR10PLUS
#define MC_HEVC_MMAIN10HDR10PLUS
Definition: mythmediacodeccontext.cpp:61
MythCodecContext::VP9_1
@ VP9_1
Definition: mythcodeccontext.h:112
mythplayerui.h
MC_VP8_MAIN
#define MC_VP8_MAIN
Definition: mythmediacodeccontext.cpp:62
MythCodecContext::VP9_0
@ VP9_0
Definition: mythcodeccontext.h:111
MythCodecMap::GetCodecContext
AVCodecContext * GetCodecContext(const AVStream *Stream, const AVCodec *Codec=nullptr, bool NullCodec=false)
Definition: mythavutil.cpp:255
MythCodecContext::HEVCMain10
@ HEVCMain10
Definition: mythcodeccontext.h:99
kCodec_MPEG1_MEDIACODEC_DEC
@ kCodec_MPEG1_MEDIACODEC_DEC
Definition: mythcodecid.h:133
MythCodecContext::NoProfile
@ NoProfile
Definition: mythcodeccontext.h:59
mythmediacodecinterop.h
MythCodecContext::MPEG4AdvancedSimple
@ MPEG4AdvancedSimple
Definition: mythcodeccontext.h:84
MC_H264_HIGH10
#define MC_H264_HIGH10
Definition: mythmediacodeccontext.cpp:52
MythCodecContext::CodecProfile
CodecProfile
Definition: mythcodeccontext.h:57
MC_MPEG4_HYBRID
#define MC_MPEG4_HYBRID
Definition: mythmediacodeccontext.cpp:41
Frame
Definition: zmdefines.h:93
MythCodecContext::MPEG4ScaleableTexture
@ MPEG4ScaleableTexture
Definition: mythcodeccontext.h:74
DEINT_NONE
@ DEINT_NONE
Definition: mythframe.h:69
MythMediaCodecContext::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythmediacodeccontext.cpp:489
MythCoreContext::IsUIThread
bool IsUIThread(void)
Definition: mythcorecontext.cpp:1371
types
static const struct wl_interface * types[]
Definition: idle_inhibit_unstable_v1.c:39
MythCodecContext::InitVideoCodec
virtual void InitVideoCodec(AVCodecContext *Context, bool SelectedStream, bool &DirectRendering)
Definition: mythcodeccontext.cpp:302
MC_MPEG4_NBIT
#define MC_MPEG4_NBIT
Definition: mythmediacodeccontext.cpp:36
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythMediaCodecContext::GetProfiles
static MCProfiles & GetProfiles(void)
Definition: mythmediacodeccontext.cpp:346
MythCodecContext::VP9_3HDRPlus
@ VP9_3HDRPlus
Definition: mythcodeccontext.h:118
MythCodecContext::MPEG4Main
@ MPEG4Main
Definition: mythcodeccontext.h:72
MythCodecContext::VP9_2
@ VP9_2
Definition: mythcodeccontext.h:113
MythCodecContext::FFmpegToMythProfile
static CodecProfile FFmpegToMythProfile(AVCodecID CodecID, int Profile)
Definition: mythcodeccontext.cpp:680
MythCodecContext::MPEG4AdvancedCore
@ MPEG4AdvancedCore
Definition: mythcodeccontext.h:81
MC_H264_MAIN
#define MC_H264_MAIN
Definition: mythmediacodeccontext.cpp:49
MediaCodecToMythProfile
MythCodecContext::CodecProfile MediaCodecToMythProfile(int Codec, int Profile)
Definition: mythmediacodeccontext.cpp:72
MC_MPEG4_ADV_SCALEABLE
#define MC_MPEG4_ADV_SCALEABLE
Definition: mythmediacodeccontext.cpp:46
MythCodecContext::HEVCMainStill
@ HEVCMainStill
Definition: mythcodeccontext.h:100
MythCodecContext::H264Extended
@ H264Extended
Definition: mythcodeccontext.h:93
MythCodecContext::H264ConstrainedBaseline
@ H264ConstrainedBaseline
Definition: mythcodeccontext.h:88
MythCodecContext::VP9_2HDRPlus
@ VP9_2HDRPlus
Definition: mythcodeccontext.h:116
MC_HEVC_MAIN10
#define MC_HEVC_MAIN10
Definition: mythmediacodeccontext.cpp:58
AvFormatDecoder::CodecMap
MythCodecMap * CodecMap(void)
Definition: avformatdecoder.cpp:402
MythMediaCodecContext::PostProcessFrame
void PostProcessFrame(AVCodecContext *, MythVideoFrame *) override
Mark all MediaCodec decoded frames as progressive,.
Definition: mythmediacodeccontext.cpp:322
MC_H264_CONST_BASELINE
#define MC_H264_CONST_BASELINE
Definition: mythmediacodeccontext.cpp:55
MythCodecContext::MPEG4AdvancedCoding
@ MPEG4AdvancedCoding
Definition: mythcodeccontext.h:80
MythCodecID
MythCodecID
Definition: mythcodecid.h:10
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
MC_HEVC_MAIN
#define MC_HEVC_MAIN
Definition: mythmediacodeccontext.cpp:57
MythCodecContext::MPEG4SimpleScaleable
@ MPEG4SimpleScaleable
Definition: mythcodeccontext.h:70
toString
QString toString(MarkTypes type)
Definition: programtypes.cpp:29
Decoder
Definition: decoder.h:70
MythCodecContext::MPEG2High
@ MPEG2High
Definition: mythcodeccontext.h:65
MC_HEVC_MAIN_STILL
#define MC_HEVC_MAIN_STILL
Definition: mythmediacodeccontext.cpp:59
mythlogging.h
MythCodecContext::MPEG2422
@ MPEG2422
Definition: mythcodeccontext.h:64
codec_is_mediacodec
#define codec_is_mediacodec(id)
Definition: mythcodecid.h:323
MythCodecContext::DeviceContextFinished
static void DeviceContextFinished(AVHWDeviceContext *Context)
Definition: mythcodeccontext.cpp:445
MythCodecContext::MPEG4CoreScaleable
@ MPEG4CoreScaleable
Definition: mythcodeccontext.h:79
hardwareprofile.scan.profile
profile
Definition: scan.py:99
hardwareprofile.config.p
p
Definition: config.py:33
MC_MPEG2_MAIN
#define MC_MPEG2_MAIN
Definition: mythmediacodeccontext.cpp:27
MC_MPEG4_SIMPLE_FACE
#define MC_MPEG4_SIMPLE_FACE
Definition: mythmediacodeccontext.cpp:38
MythCodecContext::MPEG2SNR
@ MPEG2SNR
Definition: mythcodeccontext.h:67
MythCodecContext::MPEG4AdvancedScaleableTexture
@ MPEG4AdvancedScaleableTexture
Definition: mythcodeccontext.h:82
kCodec_MPEG1
@ kCodec_MPEG1
Definition: mythcodecid.h:21
MC_MPEG2_422
#define MC_MPEG2_422
Definition: mythmediacodeccontext.cpp:28
MythCodecContext::VP9
@ VP9
Definition: mythcodeccontext.h:110
MythCodecContext::H264Main
@ H264Main
Definition: mythcodeccontext.h:89
MythCodecContext::H264High422
@ H264High422
Definition: mythcodeccontext.h:94
kCodec_MPEG1_MEDIACODEC
@ kCodec_MPEG1_MEDIACODEC
Definition: mythcodecid.h:117
MC_MPEG4_ADV_CORE
#define MC_MPEG4_ADV_CORE
Definition: mythmediacodeccontext.cpp:45
MythCodecMap::FreeCodecContext
void FreeCodecContext(const AVStream *Stream)
Definition: mythavutil.cpp:303
MythCodecContext::MPEG4SimpleStudio
@ MPEG4SimpleStudio
Definition: mythcodeccontext.h:83
MythCodecContext::HEVCMain10HDRPlus
@ HEVCMain10HDRPlus
Definition: mythcodeccontext.h:103
MythCodecContext::MPEG4
@ MPEG4
Definition: mythcodeccontext.h:68
LOC
#define LOC
Definition: mythmediacodeccontext.cpp:23
MythCodecContext::HEVC
@ HEVC
Definition: mythcodeccontext.h:97
MC_VP9_2HDR
#define MC_VP9_2HDR
Definition: mythmediacodeccontext.cpp:67
AvFormatDecoder
A decoder for media files.
Definition: avformatdecoder.h:83
codec_is_mediacodec_dec
#define codec_is_mediacodec_dec(id)
Definition: mythcodecid.h:325
MC_MPEG2_SNR
#define MC_MPEG2_SNR
Definition: mythmediacodeccontext.cpp:29
MythMediaCodecContext::GetBestSupportedCodec
static MythCodecID GetBestSupportedCodec(AVCodecContext **Context, AVCodec **Codec, const QString &Decoder, AVStream *Stream, uint StreamType)
Definition: mythmediacodeccontext.cpp:211
MC_MPEG4_SIMPLE
#define MC_MPEG4_SIMPLE
Definition: mythmediacodeccontext.cpp:32
uint
unsigned int uint
Definition: compat.h:79
MythCodecContext::MPEG4SimpleFace
@ MPEG4SimpleFace
Definition: mythcodeccontext.h:75
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:61
MC_VP9_3HDR
#define MC_VP9_3HDR
Definition: mythmediacodeccontext.cpp:68
MythCodecContext::MPEG2Spatial
@ MPEG2Spatial
Definition: mythcodeccontext.h:66
mythmediacodeccontext.h
MythCodecContext::MPEG2
@ MPEG2
Definition: mythcodeccontext.h:61
MythCodecContext::VP9_3HDR
@ VP9_3HDR
Definition: mythcodeccontext.h:117
MythCodecContext::H264High444
@ H264High444
Definition: mythcodeccontext.h:95
MythCodecContext::HEVCMain10HDR
@ HEVCMain10HDR
Definition: mythcodeccontext.h:102
MC_MPEG4_MAIN
#define MC_MPEG4_MAIN
Definition: mythmediacodeccontext.cpp:35
MythMediaCodecContext::HaveMediaCodec
static bool HaveMediaCodec(bool Reinit=false)
Definition: mythmediacodeccontext.cpp:500
MythRenderOpenGL
Definition: mythrenderopengl.h:100
MC_VP9_3
#define MC_VP9_3
Definition: mythmediacodeccontext.cpp:66
MC_H264_CONST_HIGH
#define MC_H264_CONST_HIGH
Definition: mythmediacodeccontext.cpp:56
MythMediaCodecContext::RetrieveFrame
bool RetrieveFrame(AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame) override
Definition: mythmediacodeccontext.cpp:298
MC_H264_HIGH
#define MC_H264_HIGH
Definition: mythmediacodeccontext.cpp:51
MythCodecContext::MPEG4NBit
@ MPEG4NBit
Definition: mythcodeccontext.h:73
MC_MPEG4_SIMPLE_FBA
#define MC_MPEG4_SIMPLE_FBA
Definition: mythmediacodeccontext.cpp:39
MythCodecContext::MPEG2Main
@ MPEG2Main
Definition: mythcodeccontext.h:63
mythcorecontext.h
MC_VP9_1
#define MC_VP9_1
Definition: mythmediacodeccontext.cpp:64
avformatdecoder.h
MC_MPEG4_CORE_SCALEABLE
#define MC_MPEG4_CORE_SCALEABLE
Definition: mythmediacodeccontext.cpp:43
MythCodecContext::FrameTypeIsSupported
static bool FrameTypeIsSupported(AVCodecContext *Context, VideoFrameType Format)
Definition: mythcodeccontext.cpp:512
MC_MPEG4_ADV_CODING
#define MC_MPEG4_ADV_CODING
Definition: mythmediacodeccontext.cpp:44
MC_H264_HIGH422
#define MC_H264_HIGH422
Definition: mythmediacodeccontext.cpp:53
MythMediaCodecContext::InitialiseDecoder
static int InitialiseDecoder(AVCodecContext *Context)
Definition: mythmediacodeccontext.cpp:164
MythCodecContext::MPEG4BasicAnimated
@ MPEG4BasicAnimated
Definition: mythcodeccontext.h:76
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:540
MC_H264_BASELINE
#define MC_H264_BASELINE
Definition: mythmediacodeccontext.cpp:48
MC_MPEG2_HIGH
#define MC_MPEG2_HIGH
Definition: mythmediacodeccontext.cpp:31
MythMediaCodecContext::GetFormat
static AVPixelFormat GetFormat(AVCodecContext *, const AVPixelFormat *PixFmt)
Definition: mythmediacodeccontext.cpp:307
MC_HEVC_MAIN10HDR10
#define MC_HEVC_MAIN10HDR10
Definition: mythmediacodeccontext.cpp:60
MythCodecContext::MPEG4Hybrid
@ MPEG4Hybrid
Definition: mythcodeccontext.h:77
MythCodecContext
Definition: mythcodeccontext.h:54
MythMediaCodecContext::HwDecoderInit
int HwDecoderInit(AVCodecContext *Context) override
Definition: mythmediacodeccontext.cpp:289
MythCodecContext::H264High
@ H264High
Definition: mythcodeccontext.h:91
MythCodecContext::GetProfileDescription
static QString GetProfileDescription(CodecProfile Profile, QSize Size, VideoFrameType Format=FMT_NONE, uint ColorDepth=0)
Definition: mythcodeccontext.cpp:783
MC_VP9_0
#define MC_VP9_0
Definition: mythmediacodeccontext.cpp:63
MC_VP9_3HDRPLUS
#define MC_VP9_3HDRPLUS
Definition: mythmediacodeccontext.cpp:70
MythCodecContext::VP9_2HDR
@ VP9_2HDR
Definition: mythcodeccontext.h:115
MC_VP9_2
#define MC_VP9_2
Definition: mythmediacodeccontext.cpp:65
MythCodecContext::MPEG4AdvancedRT
@ MPEG4AdvancedRT
Definition: mythcodeccontext.h:78
MythVideoFrame
Definition: mythframe.h:88
DEINT_BASIC
@ DEINT_BASIC
Definition: mythframe.h:70
MythMediaCodecContext::MythMediaCodecContext
MythMediaCodecContext(DecoderBase *Parent, MythCodecID CodecID)
Definition: mythmediacodeccontext.cpp:271
mythmainwindow.h
MC_MPEG4_CORE
#define MC_MPEG4_CORE
Definition: mythmediacodeccontext.cpp:34
MythCodecContext::MPEG4Core
@ MPEG4Core
Definition: mythcodeccontext.h:71
MC_H264_EXTENDED
#define MC_H264_EXTENDED
Definition: mythmediacodeccontext.cpp:50
MythMediaCodecContext::InitVideoCodec
void InitVideoCodec(AVCodecContext *Context, bool SelectedStream, bool &DirectRendering) override
Definition: mythmediacodeccontext.cpp:276
MC_MPEG2_SIMPLE
#define MC_MPEG2_SIMPLE
Definition: mythmediacodeccontext.cpp:26
MythCodecContext::H264ConstrainedHigh
@ H264ConstrainedHigh
Definition: mythcodeccontext.h:96
MythCodecContext::HEVCMain
@ HEVCMain
Definition: mythcodeccontext.h:98
MCProfiles
QList< QPair< MythCodecContext::CodecProfile, QSize > > MCProfiles
Definition: mythmediacodeccontext.h:14
MythMediaCodecInterop::CreateMediaCodec
static MythMediaCodecInterop * CreateMediaCodec(MythPlayerUI *Player, MythRenderOpenGL *Context, QSize Size)
Definition: mythmediacodecinterop.cpp:14
DecoderBase
Definition: decoderbase.h:120
CODEC_IS_MEDIACODEC
#define CODEC_IS_MEDIACODEC(codec)
Definition: mythcodecid.h:382
MythCodecContext::GetBuffer2
static bool GetBuffer2(struct AVCodecContext *Context, MythVideoFrame *Frame, AVFrame *AvFrame, int Flags)
A generic hardware buffer initialisation method when AVHWFramesContext is NOT used.
Definition: mythcodeccontext.cpp:373
MC_MPEG4_SCALEABLE_TEX
#define MC_MPEG4_SCALEABLE_TEX
Definition: mythmediacodeccontext.cpp:37
MythCodecContext::GetPlayerUI
static MythPlayerUI * GetPlayerUI(AVCodecContext *Context)
Definition: mythcodeccontext.cpp:503
MC_MPEG2_SPATIAL
#define MC_MPEG2_SPATIAL
Definition: mythmediacodeccontext.cpp:30
MythCodecContext::VP8
@ VP8
Definition: mythcodeccontext.h:109
MythCodecContext::H264High10
@ H264High10
Definition: mythcodeccontext.h:92
MC_MPEG4_ADV_REALTIME
#define MC_MPEG4_ADV_REALTIME
Definition: mythmediacodeccontext.cpp:42
MythCodecContext::H264
@ H264
Definition: mythcodeccontext.h:86
OpenGLLocker
Definition: mythrenderopengl.h:263