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