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