MythTV  master
mythcodeccontext.cpp
Go to the documentation of this file.
1 // Copyright (c) 2017-19 MythTV Developers <mythtv-dev@mythtv.org>
3 //
4 // This is part of MythTV (https://www.mythtv.org)
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 //
24 
25 #include "mythcorecontext.h"
26 #include "mythlogging.h"
27 #include "mythmainwindow.h"
28 #include "mythopenglinterop.h"
29 #include "avformatdecoder.h"
30 
31 #ifdef USING_VAAPI
32 #include "mythvaapicontext.h"
33 #endif
34 #ifdef USING_VDPAU
35 #include "mythvdpauhelper.h"
36 #include "mythvdpaucontext.h"
37 #endif
38 #ifdef USING_NVDEC
39 #include "mythnvdeccontext.h"
40 #endif
41 #ifdef USING_VTB
42 #include "mythvtbcontext.h"
43 #endif
44 #ifdef USING_MEDIACODEC
45 #include "mythmediacodeccontext.h"
46 #endif
47 #ifdef USING_V4L2
48 #include "mythv4l2m2mcontext.h"
49 #endif
50 #ifdef USING_MMAL
51 #include "mythmmalcontext.h"
52 #endif
53 #ifdef USING_EGL
54 #include "mythdrmprimecontext.h"
55 #endif
56 #include "mythcodeccontext.h"
57 
58 extern "C" {
59 #include "libavutil/pixdesc.h"
60 }
61 
62 #define LOC QString("MythCodecContext: ")
63 
65 
67  : m_parent(Parent),
68  m_codecID(CodecID)
69 {
70 }
71 
73 {
74  MythCodecContext *mctx = nullptr;
75 #ifdef USING_VAAPI
76  if (codec_is_vaapi(Codec) || codec_is_vaapi_dec(Codec))
77  mctx = new MythVAAPIContext(Parent, Codec);
78 #endif
79 #ifdef USING_VDPAU
80  if (codec_is_vdpau_hw(Codec) || codec_is_vdpau_dechw(Codec))
81  mctx = new MythVDPAUContext(Parent, Codec);
82 #endif
83 #ifdef USING_NVDEC
84  if (codec_is_nvdec_dec(Codec) || codec_is_nvdec(Codec))
85  mctx = new MythNVDECContext(Parent, Codec);
86 #endif
87 #ifdef USING_VTB
88  if (codec_is_vtb_dec(Codec) || codec_is_vtb(Codec))
89  mctx = new MythVTBContext(Parent, Codec);
90 #endif
91 #ifdef USING_MEDIACODEC
92  if (codec_is_mediacodec(Codec) || codec_is_mediacodec_dec(Codec))
93  mctx = new MythMediaCodecContext(Parent, Codec);
94 #endif
95 #ifdef USING_V4L2
96  if (codec_is_v4l2_dec(Codec) || codec_is_v4l2(Codec))
97  mctx = new MythV4L2M2MContext(Parent, Codec);
98 #endif
99 #ifdef USING_MMAL
100  if (codec_is_mmal_dec(Codec) || codec_is_mmal(Codec))
101  mctx = new MythMMALContext(Parent, Codec);
102 #endif
103 #ifdef USING_EGL
104  if (codec_is_drmprime(Codec))
105  mctx = new MythDRMPRIMEContext(Parent, Codec);
106 #endif
107  Q_UNUSED(Codec);
108 
109  if (!mctx)
110  mctx = new MythCodecContext(Parent, Codec);
111  return mctx;
112 }
113 
115 {
116  QStringList decoders;
117 
118 #ifdef USING_VDPAU
120 #endif
121 #ifdef USING_VAAPI
123 #endif
124 #ifdef USING_MEDIACODEC
126 #endif
127 #ifdef USING_NVDEC
129 #endif
130 #ifdef USING_MMAL
132 #endif
133 #ifdef USING_V4L2
135 #endif
136 #ifdef USING_VTB
138 #endif
139  return decoders;
140 }
141 
143 {
144  if (!HasMythMainWindow())
145  {
146  LOG(VB_GENERAL, LOG_INFO, LOC + "No window: Ignoring hardware decoders");
147  return;
148  }
149 
150 #ifdef USING_VDPAU
151  // Only enable VDPAU support if it is actually present
153  {
154  Opts.decoders->append("vdpau");
155  (*Opts.equiv_decoders)["vdpau"].append("dummy");
156  Opts.decoders->append("vdpau-dec");
157  (*Opts.equiv_decoders)["vdpau-dec"].append("dummy");
158  }
159 #endif
160 #ifdef USING_DXVA2
161  Opts.decoders->append("dxva2");
162  (*Opts.equiv_decoders)["dxva2"].append("dummy");
163 #endif
164 
165 #ifdef USING_VAAPI
166  // Only enable VAAPI if it is actually present and isn't actually VDPAU
167  if (!MythVAAPIContext::HaveVAAPI().isEmpty())
168  {
169  Opts.decoders->append("vaapi");
170  (*Opts.equiv_decoders)["vaapi"].append("dummy");
171  Opts.decoders->append("vaapi-dec");
172  (*Opts.equiv_decoders)["vaapi-dec"].append("dummy");
173  }
174 #endif
175 #ifdef USING_NVDEC
176  // Only enable NVDec support if it is actually present
178  {
179  Opts.decoders->append("nvdec");
180  (*Opts.equiv_decoders)["nvdec"].append("dummy");
181  Opts.decoders->append("nvdec-dec");
182  (*Opts.equiv_decoders)["nvdec-dec"].append("dummy");
183  }
184 #endif
185 #ifdef USING_MEDIACODEC
187  {
188  Opts.decoders->append("mediacodec");
189  (*Opts.equiv_decoders)["mediacodec"].append("dummy");
190  Opts.decoders->append("mediacodec-dec");
191  (*Opts.equiv_decoders)["mediacodec-dec"].append("dummy");
192  }
193 #endif
194 #ifdef USING_VTB
196  {
197  Opts.decoders->append("vtb");
198  Opts.decoders->append("vtb-dec");
199  (*Opts.equiv_decoders)["vtb"].append("dummy");
200  (*Opts.equiv_decoders)["vtb-dec"].append("dummy");
201  }
202 #endif
203 #ifdef USING_V4L2
205  {
206 #ifdef USING_V4L2PRIME
207  Opts.decoders->append("v4l2");
208  (*Opts.equiv_decoders)["v4l2"].append("dummy");
209 #endif
210  Opts.decoders->append("v4l2-dec");
211  (*Opts.equiv_decoders)["v4l2-dec"].append("dummy");
212  }
213 #endif
214 #ifdef USING_EGL
216  {
217  Opts.decoders->append("drmprime");
218  (*Opts.equiv_decoders)["drmprime"].append("dummy");
219  }
220 #endif
221 #ifdef USING_MMAL
223  {
224  Opts.decoders->append("mmal-dec");
225  (*Opts.equiv_decoders)["mmal-dec"].append("dummy");
227  {
228  Opts.decoders->append("mmal");
229  (*Opts.equiv_decoders)["mmal"].append("dummy");
230  }
231  }
232 #endif
233 }
234 
235 MythCodecID MythCodecContext::FindDecoder(const QString &Decoder, AVStream *Stream,
236  AVCodecContext **Context, AVCodec **Codec)
237 {
238  MythCodecID result = kCodec_NONE;
239  uint streamtype = mpeg_version((*Context)->codec_id);
240 
241 #ifdef USING_VDPAU
242  result = MythVDPAUContext::GetSupportedCodec(Context, Codec, Decoder, streamtype);
243  if (codec_is_vdpau_hw(result) || codec_is_vdpau_dechw(result))
244  return result;
245 #endif
246 #ifdef USING_VAAPI
247  result = MythVAAPIContext::GetSupportedCodec(Context, Codec, Decoder, streamtype);
248  if (codec_is_vaapi(result) || codec_is_vaapi_dec(result))
249  return result;
250 #endif
251 #ifdef USING_VTB
252  (void)Stream;
253  result = MythVTBContext::GetSupportedCodec(Context, Codec, Decoder, streamtype);
254  if (codec_is_vtb(result) || codec_is_vtb_dec(result))
255  return result;
256 #endif
257 #ifdef USING_DXVA2
258  result = VideoOutputD3D::GetBestSupportedCodec(width, height, Decoder, streamtype, false);
259  if (codec_is_dxva2(result))
260  return result;
261 #endif
262 #ifdef USING_MEDIACODEC
263  result = MythMediaCodecContext::GetBestSupportedCodec(Context, Codec, Decoder, Stream, streamtype);
264  if (codec_is_mediacodec(result) || codec_is_mediacodec_dec(result))
265  return result;
266 #endif
267 #ifdef USING_NVDEC
268  result = MythNVDECContext::GetSupportedCodec(Context, Codec, Decoder, Stream, streamtype);
269  if (codec_is_nvdec(result) || codec_is_nvdec_dec(result))
270  return result;
271 #endif
272 #ifdef USING_V4L2
273  result = MythV4L2M2MContext::GetSupportedCodec(Context, Codec, Decoder, Stream, streamtype);
274  if (codec_is_v4l2_dec(result) || codec_is_v4l2(result))
275  return result;
276 #endif
277 #ifdef USING_MMAL
278  result = MythMMALContext::GetSupportedCodec(Context, Codec, Decoder, Stream, streamtype);
279  if (codec_is_mmal_dec(result) || codec_is_mmal(result))
280  return result;
281 #endif
282 #ifdef USING_EGL
283  result = MythDRMPRIMEContext::GetSupportedCodec(Context, Codec, Decoder, Stream, streamtype);
284  if (codec_is_drmprime(result))
285  return result;
286 #endif
287 
288  return kCodec_NONE;
289 }
290 
292  bool SelectedStream, bool &DirectRendering)
293 {
294  const AVCodec *codec1 = Context->codec;
295  if (codec1 && codec1->capabilities & AV_CODEC_CAP_DR1)
296  {
297  // Context->flags |= CODEC_FLAG_EMU_EDGE;
298  }
299  else
300  {
301  if (SelectedStream)
302  DirectRendering = false;
303  LOG(VB_PLAYBACK, LOG_INFO, LOC +
304  QString("Using software scaling to convert pixel format %1 for "
305  "codec %2").arg(av_get_pix_fmt_name(Context->pix_fmt))
306  .arg(ff_codec_id_string(Context->codec_id)));
307  }
308 }
309 
311 int MythCodecContext::GetBuffer(struct AVCodecContext *Context, AVFrame *Frame, int Flags)
312 {
313  auto *avfd = static_cast<AvFormatDecoder*>(Context->opaque);
314  VideoFrame *videoframe = avfd->GetPlayer()->GetNextVideoFrame();
315 
316  // set fields required for directrendering
317  for (int i = 0; i < 4; i++)
318  {
319  Frame->data[i] = nullptr;
320  Frame->linesize[i] = 0;
321  }
322  Frame->opaque = videoframe;
323  videoframe->pix_fmt = Context->pix_fmt;
324  Frame->reordered_opaque = Context->reordered_opaque;
325 
326  int ret = avcodec_default_get_buffer2(Context, Frame, Flags);
327  if (ret < 0)
328  return ret;
329 
330  // set the underlying pixel format. Set here rather than guessing later.
331  if (Frame->hw_frames_ctx)
332  {
333  auto *context = reinterpret_cast<AVHWFramesContext*>(Frame->hw_frames_ctx->data);
334  if (context)
335  videoframe->sw_pix_fmt = context->sw_format;
336  }
337 
338  // VAAPI 'fixes' 10/12/16bit colour values. Irrelevant for VDPAU.
339  videoframe->colorshifted = true;
340 
341  // avcodec_default_get_buffer2 will retrieve an AVBufferRef from the pool of
342  // hardware surfaces stored within AVHWFramesContext. The pointer to the surface is stored
343  // in Frame->data[3]. Store this in VideoFrame::buf for the interop class to use.
344  videoframe->buf = Frame->data[3];
345  // Frame->buf(0) also contains a reference to the buffer. Take an additional reference to this
346  // buffer to retain the surface until it has been displayed (otherwise it is
347  // reused once the decoder is finished with it).
348  videoframe->priv[0] = reinterpret_cast<unsigned char*>(av_buffer_ref(Frame->buf[0]));
349  // frame->hw_frames_ctx contains a reference to the AVHWFramesContext. Take an additional
350  // reference to ensure AVHWFramesContext is not released until we are finished with it.
351  // This also contains the underlying MythOpenGLInterop class reference.
352  videoframe->priv[1] = reinterpret_cast<unsigned char*>(av_buffer_ref(Frame->hw_frames_ctx));
353 
354  // Set release method
355  Frame->buf[1] = av_buffer_create(reinterpret_cast<uint8_t*>(videoframe), 0,
357  return ret;
358 }
359 
360 
362 bool MythCodecContext::GetBuffer2(struct AVCodecContext *Context, VideoFrame* Frame,
363  AVFrame *AvFrame, int /*Flags*/)
364 {
365  if (!AvFrame || !Context || !Frame)
366  return false;
367 
368  auto *avfd = static_cast<AvFormatDecoder*>(Context->opaque);
369 
370  Frame->pix_fmt = Context->pix_fmt;
371  Frame->directrendering = true;
372  Frame->colorshifted = true;
373 
374  AvFrame->reordered_opaque = Context->reordered_opaque;
375  AvFrame->opaque = Frame;
376 
377  // retrieve the software format
378  if (AvFrame->hw_frames_ctx)
379  {
380  auto *context = reinterpret_cast<AVHWFramesContext*>(AvFrame->hw_frames_ctx->data);
381  if (context)
382  Frame->sw_pix_fmt = context->sw_format;
383  }
384 
385  // the hardware surface is stored in Frame->data[3]
386  Frame->buf = AvFrame->data[3];
387 
388  // Frame->buf[0] contains the release method. Take another reference to
389  // ensure the frame is not released before it is displayed.
390  Frame->priv[0] = reinterpret_cast<unsigned char*>(av_buffer_ref(AvFrame->buf[0]));
391 
392  // Retrieve and set the interop class
393  auto *devicectx = reinterpret_cast<AVHWDeviceContext*>(Context->hw_device_ctx->data);
394  Frame->priv[1] = reinterpret_cast<unsigned char*>(devicectx->user_opaque);
395 
396  // Set release method
397  AvFrame->buf[1] = av_buffer_create(reinterpret_cast<uint8_t*>(Frame), 0,
399  return true;
400 }
401 
402 void MythCodecContext::ReleaseBuffer(void *Opaque, uint8_t *Data)
403 {
404  auto *decoder = static_cast<AvFormatDecoder*>(Opaque);
405  auto *frame = reinterpret_cast<VideoFrame*>(Data);
406  if (decoder && decoder->GetPlayer())
407  decoder->GetPlayer()->DeLimboFrame(frame);
408 }
409 
418 {
419  int count = ++s_hwFramesContextCount;
420  if (count != 1)
421  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Error: %1 concurrent hardware frames contexts").arg(count));
422 }
423 
425 {
427  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("%1 frames context finished")
428  .arg(av_hwdevice_get_type_name(Context->device_ctx->type)));
429  auto *interop = reinterpret_cast<MythOpenGLInterop*>(Context->user_opaque);
430  if (interop)
431  DestroyInterop(interop);
432 }
433 
435 {
436  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("%1 device context finished")
437  .arg(av_hwdevice_get_type_name(Context->type)));
438  auto *interop = reinterpret_cast<MythOpenGLInterop*>(Context->user_opaque);
439  if (interop)
440  {
441  DestroyInterop(interop);
442  FreeAVHWDeviceContext free = interop->GetDefaultFree();
443  if (free)
444  {
445  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Calling default device context free");
446  Context->user_opaque = interop->GetDefaultUserOpaque();
447  free(Context);
448  }
449  }
450 }
451 
453 {
454  if (gCoreContext->IsUIThread())
455  {
456  Interop->DecrRef();
457  return;
458  }
459 
460  auto destroy = [](void *Wait, void *Interop2, void* /*unused*/)
461  {
462  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Destroy interop callback");
463  auto *wait = reinterpret_cast<QWaitCondition*>(Wait);
464  auto *interop = reinterpret_cast<MythOpenGLInterop*>(Interop2);
465  if (interop)
466  interop->DecrRef();
467  if (wait)
468  wait->wakeAll();
469  };
470 
471  if (!Interop->GetPlayer())
472  {
473  LOG(VB_GENERAL, LOG_ERR, LOC + "Cannot destroy interop - no player");
474  return;
475  }
476  Interop->GetPlayer()->HandleDecoderCallback("Destroy OpenGL interop",
477  destroy, Interop, nullptr);
478 }
479 
480 void MythCodecContext::CreateDecoderCallback(void *Wait, void *Context, void *Callback)
481 {
482  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Create decoder callback");
483  auto *wait = reinterpret_cast<QWaitCondition*>(Wait);
484  auto *context = reinterpret_cast<AVCodecContext*>(Context);
485  auto callback = reinterpret_cast<CreateHWDecoder>(Callback);
486  if (context && callback)
487  (void)callback(context);
488  if (wait)
489  wait->wakeAll();
490 }
491 
494  const QString &Debug)
495 {
496  if (!Context || !Callback)
497  return -1;
498  if (gCoreContext->IsUIThread())
499  return Callback(Context);
500 
501  // Callback to MythPlayer (which will fail without a MythPlayer instance)
502  MythPlayer *player = nullptr;
503  auto *decoder = reinterpret_cast<AvFormatDecoder*>(Context->opaque);
504  if (decoder)
505  player = decoder->GetPlayer();
506  if (player)
508  Context, reinterpret_cast<void*>(Callback));
509  return Context->hw_frames_ctx ? 0 : -1;
510 }
511 
514  const QString &Debug)
515 {
516  if (!Context || !Callback)
517  return -1;
518  if (gCoreContext->IsUIThread())
519  return Callback(Context);
520 
521  // Callback to MythPlayer (which will fail without a MythPlayer instance)
522  MythPlayer *player = nullptr;
523  auto *decoder = reinterpret_cast<AvFormatDecoder*>(Context->opaque);
524  if (decoder)
525  player = decoder->GetPlayer();
526  if (player)
528  Context, reinterpret_cast<void*>(Callback));
529  return Context->hw_device_ctx ? 0 : -1;
530 }
531 
532 AVBufferRef* MythCodecContext::CreateDevice(AVHWDeviceType Type, MythOpenGLInterop *Interop, const QString &Device)
533 {
534  AVBufferRef* result = nullptr;
535  int res = av_hwdevice_ctx_create(&result, Type, Device.isEmpty() ? nullptr :
536  Device.toLocal8Bit().constData(), nullptr, 0);
537  if (res == 0)
538  {
539  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Created hardware device '%1'%2")
540  .arg(av_hwdevice_get_type_name(Type))
541  .arg(Device == nullptr ? "" : QString(" (%1)").arg(Device)));
542  auto *context = reinterpret_cast<AVHWDeviceContext*>(result->data);
543 
544  if ((context->free || context->user_opaque) && !Interop)
545  {
546  LOG(VB_PLAYBACK, LOG_INFO, "Creating dummy interop");
547  Interop = MythOpenGLInterop::CreateDummy();
548  }
549 
550  if (Interop)
551  {
552  Interop->SetDefaultFree(context->free);
553  Interop->SetDefaultUserOpaque(context->user_opaque);
554  Interop->IncrRef();
555  }
556 
558  context->user_opaque = Interop;
559  return result;
560  }
561 
562  std::string error;
563  LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("Failed to create hardware device '%1'%2 Error '%3'")
564  .arg(av_hwdevice_get_type_name(Type))
565  .arg(Device == nullptr ? "" : QString(" (%1)").arg(Device))
567  return nullptr;
568 }
569 
572 {
573  switch (Context->codec_id)
574  {
575  case AV_CODEC_ID_H264:
576  switch (Context->profile)
577  {
578  case FF_PROFILE_H264_HIGH_10:
579  case FF_PROFILE_H264_HIGH_10_INTRA:
580  case FF_PROFILE_H264_HIGH_422:
581  case FF_PROFILE_H264_HIGH_422_INTRA:
582  case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
583  case FF_PROFILE_H264_HIGH_444_INTRA:
584  case FF_PROFILE_H264_CAVLC_444: return true;
585  default: break;
586  }
587  break;
588  default: break;
589  }
590  return false;
591 }
592 
597 {
598  return avcodec_receive_frame(Context, Frame);
599 }
600 
602 {
603  if (!Frame || !AvFrame)
604  return false;
605 
606  AVFrame *temp = av_frame_alloc();
607  if (!temp)
608  return false;
609 
610  AVPixelFormat *pixelformats = nullptr;
611  int ret = av_hwframe_transfer_get_formats(AvFrame->hw_frames_ctx,
612  AV_HWFRAME_TRANSFER_DIRECTION_FROM,
613  &pixelformats, 0);
614  if (ret == 0)
615  {
616  AVPixelFormat best = m_parent->GetBestVideoFormat(pixelformats);
617  if (best != AV_PIX_FMT_NONE)
618  {
620  bool valid = Frame->codec == type;
621  if (!valid || (Frame->width != AvFrame->width) || (Frame->height != AvFrame->height))
623  AvFrame->width, AvFrame->height);
624 
625  if (valid)
626  {
627  // Retrieve the picture directly into the VideoFrame Buffer
628  temp->format = best;
629  uint max = planes(Frame->codec);
630  for (uint i = 0; i < 3; i++)
631  {
632  temp->data[i] = (i < max) ? (Frame->buf + Frame->offsets[i]) : nullptr;
633  temp->linesize[i] = Frame->pitches[i];
634  }
635 
636  // Dummy release method - we do not want to free the buffer
637  temp->buf[0] = av_buffer_create(reinterpret_cast<uint8_t*>(Frame), 0,
638  [](void* /*unused*/, uint8_t* /*unused*/){}, this, 0);
639  temp->width = AvFrame->width;
640  temp->height = AvFrame->height;
641  }
642  }
643  }
644  av_freep(&pixelformats);
645 
646  // retrieve data from GPU to CPU
647  if (ret >= 0)
648  if ((ret = av_hwframe_transfer_data(temp, AvFrame, 0)) < 0)
649  LOG(VB_GENERAL, LOG_ERR, LOC + QString("Error %1 transferring the data to system memory").arg(ret));
650 
651  Frame->colorshifted = true;
652  av_frame_free(&temp);
653  return ret >= 0;
654 }
655 
657 {
658  switch (CodecID)
659  {
660  case AV_CODEC_ID_MPEG1VIDEO: return MPEG1;
661  case AV_CODEC_ID_MPEG2VIDEO:
662  switch (Profile)
663  {
664  case FF_PROFILE_MPEG2_422: return MPEG2422;
665  case FF_PROFILE_MPEG2_HIGH: return MPEG2High;
666  case FF_PROFILE_MPEG2_SS: return MPEG2Spatial;
667  case FF_PROFILE_MPEG2_SNR_SCALABLE: return MPEG2SNR;
668  case FF_PROFILE_MPEG2_SIMPLE: return MPEG2Simple;
669  case FF_PROFILE_MPEG2_MAIN: return MPEG2Main;
670  default: break;
671  }
672  break;
673  case AV_CODEC_ID_MPEG4:
674  switch (Profile)
675  {
676  case FF_PROFILE_MPEG4_SIMPLE: return MPEG4Simple;
677  case FF_PROFILE_MPEG4_SIMPLE_SCALABLE: return MPEG4SimpleScaleable;
678  case FF_PROFILE_MPEG4_CORE: return MPEG4Core;
679  case FF_PROFILE_MPEG4_MAIN: return MPEG4Main;
680  case FF_PROFILE_MPEG4_N_BIT: return MPEG4NBit;
681  case FF_PROFILE_MPEG4_SCALABLE_TEXTURE: return MPEG4ScaleableTexture;
682  case FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION: return MPEG4SimpleFace;
683  case FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE: return MPEG4BasicAnimated;
684  case FF_PROFILE_MPEG4_HYBRID: return MPEG4Hybrid;
685  case FF_PROFILE_MPEG4_ADVANCED_REAL_TIME: return MPEG4AdvancedRT;
686  case FF_PROFILE_MPEG4_CORE_SCALABLE: return MPEG4CoreScaleable;
687  case FF_PROFILE_MPEG4_ADVANCED_CODING: return MPEG4AdvancedCoding;
688  case FF_PROFILE_MPEG4_ADVANCED_CORE: return MPEG4AdvancedCore;
689  case FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE: return MPEG4AdvancedScaleableTexture;
690  case FF_PROFILE_MPEG4_SIMPLE_STUDIO: return MPEG4SimpleStudio;
691  case FF_PROFILE_MPEG4_ADVANCED_SIMPLE: return MPEG4AdvancedSimple;
692  }
693  break;
694  case AV_CODEC_ID_H263: return H263;
695  case AV_CODEC_ID_H264:
696  switch (Profile)
697  {
698  // Mapping of H264MainExtended, H264ConstrainedHigh?
699  case FF_PROFILE_H264_BASELINE: return H264Baseline;
700  case FF_PROFILE_H264_CONSTRAINED_BASELINE: return H264ConstrainedBaseline;
701  case FF_PROFILE_H264_MAIN: return H264Main;
702  case FF_PROFILE_H264_EXTENDED: return H264Extended;
703  case FF_PROFILE_H264_HIGH: return H264High;
704  case FF_PROFILE_H264_HIGH_10: return H264High10;
705  //case FF_PROFILE_H264_HIGH_10_INTRA:
706  //case FF_PROFILE_H264_MULTIVIEW_HIGH:
707  case FF_PROFILE_H264_HIGH_422: return H264High422;
708  //case FF_PROFILE_H264_HIGH_422_INTRA:
709  //case FF_PROFILE_H264_STEREO_HIGH:
710  case FF_PROFILE_H264_HIGH_444: return H264High444;
711  //case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
712  //case FF_PROFILE_H264_HIGH_444_INTRA:
713  //case FF_PROFILE_H264_CAVLC_444:
714  }
715  break;
716  case AV_CODEC_ID_HEVC:
717  switch (Profile)
718  {
719  case FF_PROFILE_HEVC_MAIN: return HEVCMain;
720  case FF_PROFILE_HEVC_MAIN_10: return HEVCMain10;
721  case FF_PROFILE_HEVC_MAIN_STILL_PICTURE: return HEVCMainStill;
722  case FF_PROFILE_HEVC_REXT: return HEVCRext;
723  }
724  break;
725  case AV_CODEC_ID_VC1:
726  switch (Profile)
727  {
728  case FF_PROFILE_VC1_SIMPLE: return VC1Simple;
729  case FF_PROFILE_VC1_MAIN: return VC1Main;
730  case FF_PROFILE_VC1_COMPLEX: return VC1Complex;
731  case FF_PROFILE_VC1_ADVANCED: return VC1Advanced;
732  }
733  break;
734  case AV_CODEC_ID_VP8: return VP8;
735  case AV_CODEC_ID_VP9:
736  switch (Profile)
737  {
738  case FF_PROFILE_VP9_0: return VP9_0;
739  case FF_PROFILE_VP9_1: return VP9_1;
740  case FF_PROFILE_VP9_2: return VP9_2;
741  case FF_PROFILE_VP9_3: return VP9_3;
742  }
743  break;
744  case AV_CODEC_ID_AV1:
745  switch (Profile)
746  {
747  case FF_PROFILE_AV1_MAIN: return AV1Main;
748  case FF_PROFILE_AV1_HIGH: return AV1High;
749  case FF_PROFILE_AV1_PROFESSIONAL: return AV1Professional;
750  }
751  break;
752  case AV_CODEC_ID_MJPEG: return MJPEG;
753  default: break;
754  }
755 
756  return NoProfile;
757 }
758 
761 {
762  QString profile;
763  switch (Profile)
764  {
765  case NoProfile: profile = QObject::tr("Unknown/Unsupported"); break;
766  case MPEG1: profile = "MPEG1"; break;
767  case MPEG2: profile = "MPEG2"; break;
768  case MPEG2Simple: profile = "MPEG2 Simple"; break;
769  case MPEG2Main: profile = "MPEG2 Main"; break;
770  case MPEG2422: profile = "MPEG2 422"; break;
771  case MPEG2High: profile = "MPEG2 High"; break;
772  case MPEG2Spatial: profile = "MPEG2 Spatial"; break;
773  case MPEG2SNR: profile = "MPEG2 SNR"; break;
774  case MPEG4: profile = "MPEG4"; break;
775  case MPEG4Simple: profile = "MPEG4 Simple"; break;
776  case MPEG4SimpleScaleable: profile = "MPEG4 Simple Scaleable"; break;
777  case MPEG4Core: profile = "MPEG4 Core"; break;
778  case MPEG4Main: profile = "MPEG4 Main"; break;
779  case MPEG4NBit: profile = "MPEG4 NBit"; break;
780  case MPEG4ScaleableTexture: profile = "MPEG4 Scaleable Texture"; break;
781  case MPEG4SimpleFace: profile = "MPEG4 Simple Face"; break;
782  case MPEG4BasicAnimated: profile = "MPEG4 Basic Animated"; break;
783  case MPEG4Hybrid: profile = "MPEG4 Hybrid"; break;
784  case MPEG4AdvancedRT: profile = "MPEG4 Advanced RT"; break;
785  case MPEG4CoreScaleable: profile = "MPEG4 Core Scaleable"; break;
786  case MPEG4AdvancedCoding: profile = "MPEG4 Advanced Coding"; break;
787  case MPEG4AdvancedCore: profile = "MPEG4 Advanced Core"; break;
788  case MPEG4AdvancedScaleableTexture: profile = "MPEG4 Advanced Scaleable Texture"; break;
789  case MPEG4SimpleStudio: profile = "MPEG4 Simple Studio"; break;
790  case MPEG4AdvancedSimple: profile = "MPEG4 Advanced Simple"; break;
791  case H263: profile = "H263"; break;
792  case H264: profile = "H264"; break;
793  case H264Baseline: profile = "H264 Baseline"; break;
794  case H264ConstrainedBaseline: profile = "H264 Constrained"; break;
795  case H264Main: profile = "H264 Main"; break;
796  case H264MainExtended: profile = "H264 Main Extended"; break;
797  case H264High: profile = "H264 High"; break;
798  case H264High10: profile = "H264 High10"; break;
799  case H264Extended: profile = "H264 Extended"; break;
800  case H264High422: profile = "H264 High 422"; break;
801  case H264High444: profile = "H264 High 444"; break;
802  case H264ConstrainedHigh: profile = "H264 Constrained High"; break;
803  case HEVC: profile = "HEVC"; break;
804  case HEVCMain: profile = "HEVC Main"; break;
805  case HEVCMain10: profile = "HEVC Main10"; break;
806  case HEVCMainStill: profile = "HEVC Main Still"; break;
807  case HEVCRext: profile = "HEVC Rext"; break;
808  case HEVCMain10HDR: profile = "HEVC Main10HDR"; break;
809  case HEVCMain10HDRPlus: profile = "HEVC Main10HDRPlus"; break;
810  case VC1: profile = "VC1"; break;
811  case VC1Simple: profile = "VC1 Simple"; break;
812  case VC1Main: profile = "VC1 Main"; break;
813  case VC1Complex: profile = "VC1 Complex"; break;
814  case VC1Advanced: profile = "VC1 Advanced"; break;
815  case VP8: profile = "VP8"; break;
816  case VP9: profile = "VP9"; break;
817  case VP9_0: profile = "VP9 Level 0"; break;
818  case VP9_1: profile = "VP9 Level 1"; break;
819  case VP9_2: profile = "VP9 Level 2"; break;
820  case VP9_2HDR: profile = "VP9 Level 2 HDR"; break;
821  case VP9_2HDRPlus: profile = "VP9 Level 2 HDRPlus"; break;
822  case VP9_3: profile = "VP9 Level 3"; break;
823  case VP9_3HDR: profile = "VP9 Level 3 HDR"; break;
824  case VP9_3HDRPlus: profile = "VP9 Level 3 HDRPlus"; break;
825  case AV1: profile = "AV1"; break;
826  case AV1Main: profile = "AV1 Main"; break;
827  case AV1High: profile = "AV1 High"; break;
828  case AV1Professional: profile = "AV1 Professional"; break;
829  case MJPEG: profile = "MJPEG";
830  }
831 
832  if (Size.isEmpty())
833  return profile;
834 
835  return QObject::tr("%1%2%3 (Max size: %4x%5)")
836  .arg(profile).arg(Format != FMT_NONE ? QString(" %1").arg(format_description(Format)) : "")
837  .arg(ColorDepth > 8 ? QString(" %1Bit").arg(ColorDepth) : "")
838  .arg(Size.width()).arg(Size.height());
839 }
mythvtbcontext.h
MythCodecContext::VP9_3
@ VP9_3
Definition: mythcodeccontext.h:110
RenderOptions::equiv_decoders
QMap< QString, QStringList > * equiv_decoders
Definition: videodisplayprofile.h:34
MythCodecContext::VC1Simple
@ VC1Simple
Definition: mythcodeccontext.h:101
MythCodecContext::MPEG4Simple
@ MPEG4Simple
Definition: mythcodeccontext.h:65
MythCodecContext::H264Baseline
@ H264Baseline
Definition: mythcodeccontext.h:83
MythCodecContext::MPEG2Simple
@ MPEG2Simple
Definition: mythcodeccontext.h:58
MythPlayer::HandleDecoderCallback
void HandleDecoderCallback(const QString &Debug, DecoderCallback::Callback Function, void *Opaque1, void *Opaque2)
Convenience function to request and wait for a callback into the main thread.
Definition: mythplayer.cpp:3086
MythCodecContext::VC1Advanced
@ VC1Advanced
Definition: mythcodeccontext.h:104
MythCodecContext::s_hwFramesContextCount
static QAtomicInt s_hwFramesContextCount
Definition: mythcodeccontext.h:162
MythCodecContext::MythCodecContext
MythCodecContext(DecoderBase *Parent, MythCodecID CodecID)
Definition: mythcodeccontext.cpp:66
MythOpenGLInterop::GetPlayer
MythPlayer * GetPlayer(void)
Definition: mythopenglinterop.cpp:275
error
static void error(const char *str,...)
Definition: vbi.cpp:42
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
MythOpenGLInterop::CreateDummy
static MythOpenGLInterop * CreateDummy(void)
Definition: mythopenglinterop.cpp:230
MythCodecContext::FindDecoder
static MythCodecID FindDecoder(const QString &Decoder, AVStream *Stream, AVCodecContext **Context, AVCodec **Codec)
Definition: mythcodeccontext.cpp:235
MythCodecContext::VP9_1
@ VP9_1
Definition: mythcodeccontext.h:108
mpeg_version
uint mpeg_version(int codec_id)
Definition: mythcodecid.cpp:455
MythCodecContext::DestroyInterop
static void DestroyInterop(MythOpenGLInterop *Interop)
Definition: mythcodeccontext.cpp:452
MythCodecContext::VP9_0
@ VP9_0
Definition: mythcodeccontext.h:107
MythCodecContext::HEVCMain10
@ HEVCMain10
Definition: mythcodeccontext.h:95
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
MythNVDECContext::GetSupportedCodec
static MythCodecID GetSupportedCodec(AVCodecContext **CodecContext, AVCodec **Codec, const QString &Decoder, AVStream *Stream, uint StreamType)
Determine whether NVDEC decoding is supported for this codec.
Definition: mythnvdeccontext.cpp:34
MythCodecContext::RetrieveHWFrame
virtual bool RetrieveHWFrame(VideoFrame *Frame, AVFrame *AvFrame)
Definition: mythcodeccontext.cpp:601
mythopenglinterop.h
MythCodecContext::NoProfile
@ NoProfile
Definition: mythcodeccontext.h:55
MythCodecContext::MPEG4AdvancedSimple
@ MPEG4AdvancedSimple
Definition: mythcodeccontext.h:80
MythMediaCodecContext::HaveMediaCodec
static bool HaveMediaCodec(void)
Definition: mythmediacodeccontext.cpp:501
CreateHWDecoder
int(*)(AVCodecContext *Context) CreateHWDecoder
Definition: mythcodeccontext.h:45
MythCodecContext::CodecProfile
CodecProfile
Definition: mythcodeccontext.h:54
MythOpenGLInterop::SetDefaultFree
void SetDefaultFree(FreeAVHWDeviceContext FreeContext)
Definition: mythopenglinterop.cpp:285
Frame
Definition: zmdefines.h:94
MythCodecContext::NewHardwareFramesContext
static void NewHardwareFramesContext(void)
Track the number of concurrent frames contexts.
Definition: mythcodeccontext.cpp:417
MythCodecContext::MPEG4ScaleableTexture
@ MPEG4ScaleableTexture
Definition: mythcodeccontext.h:70
MythCodecContext::HEVCRext
@ HEVCRext
Definition: mythcodeccontext.h:97
codec_is_nvdec
#define codec_is_nvdec(id)
Definition: mythcodecid.h:328
MythCodecContext::VC1Main
@ VC1Main
Definition: mythcodeccontext.h:102
MythCodecContext::CreateContext
static MythCodecContext * CreateContext(DecoderBase *Parent, MythCodecID Codec)
Definition: mythcodeccontext.cpp:72
VideoBuffers::ReinitBuffer
static bool ReinitBuffer(VideoFrame *Frame, VideoFrameType Type, MythCodecID CodecID, int Width, int Height)
Definition: videobuffers.cpp:1061
arg
arg(title).arg(filename).arg(doDelete))
PixelFormatToFrameType
VideoFrameType PixelFormatToFrameType(AVPixelFormat fmt)
Definition: mythavutil.cpp:69
MythMediaCodecContext::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythmediacodeccontext.cpp:490
MythCoreContext::IsUIThread
bool IsUIThread(void)
Definition: mythcorecontext.cpp:1356
Context
QHash< QString, Action * > Context
Definition: action.h:77
MythCodecContext::InitVideoCodec
virtual void InitVideoCodec(AVCodecContext *Context, bool SelectedStream, bool &DirectRendering)
Definition: mythcodeccontext.cpp:291
MythDate::Format
Format
Definition: mythdate.h:13
codec_is_mmal_dec
#define codec_is_mmal_dec(id)
Definition: mythcodecid.h:342
codec_is_mmal
#define codec_is_mmal(id)
Definition: mythcodecid.h:341
VideoFrame::buf
unsigned char * buf
Definition: mythframe.h:140
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythCodecContext::FramesContextFinished
static void FramesContextFinished(AVHWFramesContext *Context)
Definition: mythcodeccontext.cpp:424
MythCodecContext::AV1High
@ AV1High
Definition: mythcodeccontext.h:117
MythV4L2M2MContext::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythv4l2m2mcontext.cpp:353
MythCodecContext::VP9_3HDRPlus
@ VP9_3HDRPlus
Definition: mythcodeccontext.h:114
MythCodecContext::MPEG4Main
@ MPEG4Main
Definition: mythcodeccontext.h:68
Device
A device containing images (ie. USB stick, CD, storage group etc)
Definition: imagemanager.cpp:34
MythPlayer
Definition: mythplayer.h:165
MythCodecContext::VP9_2
@ VP9_2
Definition: mythcodeccontext.h:109
VideoFrame
Definition: mythframe.h:138
MythCodecContext::FFmpegToMythProfile
static CodecProfile FFmpegToMythProfile(AVCodecID CodecID, int Profile)
Definition: mythcodeccontext.cpp:656
MythVDPAUHelper::HaveVDPAU
static bool HaveVDPAU(void)
Definition: mythvdpauhelper.cpp:53
MythCodecContext::MPEG4AdvancedCore
@ MPEG4AdvancedCore
Definition: mythcodeccontext.h:77
MythOpenGLInterop::SetDefaultUserOpaque
void SetDefaultUserOpaque(void *UserOpaque)
Definition: mythopenglinterop.cpp:290
DecoderBase::GetVideoCodecID
virtual MythCodecID GetVideoCodecID(void) const =0
HasMythMainWindow
bool HasMythMainWindow(void)
Definition: mythmainwindow.cpp:112
MythCodecContext::HEVCMainStill
@ HEVCMainStill
Definition: mythcodeccontext.h:96
MythCodecContext::H264Extended
@ H264Extended
Definition: mythcodeccontext.h:89
MythNVDECContext::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythnvdeccontext.cpp:564
MythCodecContext::H264ConstrainedBaseline
@ H264ConstrainedBaseline
Definition: mythcodeccontext.h:84
MythVAAPIContext::GetSupportedCodec
static MythCodecID GetSupportedCodec(AVCodecContext **Context, AVCodec **Codec, const QString &Decoder, uint StreamType)
Confirm whether VAAPI support is available given Decoder and Context.
Definition: mythvaapicontext.cpp:130
MythCodecContext::VP9_2HDRPlus
@ VP9_2HDRPlus
Definition: mythcodeccontext.h:112
MythVTBContext::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythvtbcontext.cpp:269
MythCodecContext::VC1Complex
@ VC1Complex
Definition: mythcodeccontext.h:103
mythvaapicontext.h
FMT_NONE
@ FMT_NONE
Definition: mythframe.h:26
MythVTBContext
Definition: mythvtbcontext.h:18
MythVAAPIContext::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythvaapicontext.cpp:626
MythCodecContext::MPEG4AdvancedCoding
@ MPEG4AdvancedCoding
Definition: mythcodeccontext.h:76
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
MythCodecContext::MPEG4SimpleScaleable
@ MPEG4SimpleScaleable
Definition: mythcodeccontext.h:66
MythVDPAUContext::GetSupportedCodec
static MythCodecID GetSupportedCodec(AVCodecContext **CodecContext, AVCodec **Codec, const QString &Decoder, uint StreamType)
Definition: mythvdpaucontext.cpp:126
RenderOptions::decoders
QStringList * decoders
Definition: videodisplayprofile.h:33
Decoder
Definition: decoder.h:66
MythCodecContext::MPEG2High
@ MPEG2High
Definition: mythcodeccontext.h:61
mythlogging.h
MythCodecContext::MPEG2422
@ MPEG2422
Definition: mythcodeccontext.h:60
codec_is_mediacodec
#define codec_is_mediacodec(id)
Definition: mythcodecid.h:323
RenderOptions
Definition: videodisplayprofile.h:28
MythCodecContext::DeviceContextFinished
static void DeviceContextFinished(AVHWDeviceContext *Context)
Definition: mythcodeccontext.cpp:434
MythCodecContext::MPEG4CoreScaleable
@ MPEG4CoreScaleable
Definition: mythcodeccontext.h:75
MythOpenGLInterop
Definition: mythopenglinterop.h:24
MythVDPAUHelper::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythvdpauhelper.cpp:212
hardwareprofile.scan.profile
profile
Definition: scan.py:99
mythvdpauhelper.h
MythOpenGLInterop::Unsupported
@ Unsupported
Definition: mythopenglinterop.h:31
MythDRMPRIMEContext::GetSupportedCodec
static MythCodecID GetSupportedCodec(AVCodecContext **Context, AVCodec **Codec, const QString &Decoder, AVStream *Stream, uint StreamType)
Definition: mythdrmprimecontext.cpp:68
MythCodecContext::ReleaseBuffer
static void ReleaseBuffer(void *Opaque, uint8_t *Data)
Definition: mythcodeccontext.cpp:402
VideoOutputD3D::GetBestSupportedCodec
static MythCodecID GetBestSupportedCodec(uint width, uint height, const QString &decoder, uint stream_type, bool no_acceleration, AVPixelFormat &pix_fmt)
Definition: videoout_d3d.cpp:629
MythVAAPIContext
Definition: mythvaapicontext.h:24
MythCodecContext::H264MainExtended
@ H264MainExtended
Definition: mythcodeccontext.h:86
MythCodecContext::MPEG2SNR
@ MPEG2SNR
Definition: mythcodeccontext.h:63
MythCodecContext::MPEG4AdvancedScaleableTexture
@ MPEG4AdvancedScaleableTexture
Definition: mythcodeccontext.h:78
MythCodecContext::GetBuffer
static int GetBuffer(struct AVCodecContext *Context, AVFrame *Frame, int Flags)
A generic hardware buffer initialisation method when using AVHWFramesContext.
Definition: mythcodeccontext.cpp:311
MythMediaCodecContext
Definition: mythmediacodeccontext.h:17
MythNVDECContext
Definition: mythnvdeccontext.h:25
MythCodecContext::VP9
@ VP9
Definition: mythcodeccontext.h:106
MythCodecContext::H264Main
@ H264Main
Definition: mythcodeccontext.h:85
MythVAAPIContext::HaveVAAPI
static QString HaveVAAPI(bool ReCheck=false)
Check whether VAAPI is available and not emulated via VDPAU.
Definition: mythvaapicontext.cpp:455
mythvdpaucontext.h
MythVTBContext::HaveVTB
static bool HaveVTB(void)
Definition: mythvtbcontext.cpp:240
MythCodecContext::H264High422
@ H264High422
Definition: mythcodeccontext.h:90
MythDRMPRIMEContext::HavePrimeDecoders
static bool HavePrimeDecoders(AVCodecID Codec=AV_CODEC_ID_NONE)
Definition: mythdrmprimecontext.cpp:193
MythCodecContext::AV1Professional
@ AV1Professional
Definition: mythcodeccontext.h:118
MythCodecContext::MPEG4SimpleStudio
@ MPEG4SimpleStudio
Definition: mythcodeccontext.h:79
MythCodecContext::HEVCMain10HDRPlus
@ HEVCMain10HDRPlus
Definition: mythcodeccontext.h:99
MythCodecContext::MPEG4
@ MPEG4
Definition: mythcodeccontext.h:64
MythCodecContext::MPEG1
@ MPEG1
Definition: mythcodeccontext.h:56
MythMMALContext::HaveMMAL
static bool HaveMMAL(void)
Definition: mythmmalcontext.cpp:260
MythCodecContext::HEVC
@ HEVC
Definition: mythcodeccontext.h:93
MythCodecContext::AV1
@ AV1
Definition: mythcodeccontext.h:115
AvFormatDecoder
A decoder for video files.
Definition: avformatdecoder.h:89
MythCodecContext::H263
@ H263
Definition: mythcodeccontext.h:81
MythDRMPRIMEContext
A generic context handler for codecs that return AV_PIX_FMT_DRM_PRIME frames.
Definition: mythdrmprimecontext.h:15
codec_is_mediacodec_dec
#define codec_is_mediacodec_dec(id)
Definition: mythcodecid.h:325
MythMediaCodecContext::GetBestSupportedCodec
static MythCodecID GetBestSupportedCodec(AVCodecContext **Context, AVCodec **Codec, const QString &Decoder, AVStream *Stream, uint StreamType)
Definition: mythmediacodeccontext.cpp:214
VideoFrame::sw_pix_fmt
int sw_pix_fmt
Definition: mythframe.h:164
VideoFrame::priv
unsigned char * priv[4]
random empty storage
Definition: mythframe.h:152
uint
unsigned int uint
Definition: compat.h:140
VideoFrame::pix_fmt
int pix_fmt
Definition: mythframe.h:163
MythCodecContext::m_parent
DecoderBase * m_parent
Definition: mythcodeccontext.h:164
MythCodecContext::MPEG4SimpleFace
@ MPEG4SimpleFace
Definition: mythcodeccontext.h:71
VideoFrame::colorshifted
bool colorshifted
false for software decoded 10/12/16bit frames. true for hardware decoders.
Definition: mythframe.h:171
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:57
MythCodecContext::MPEG2Spatial
@ MPEG2Spatial
Definition: mythcodeccontext.h:62
mythmediacodeccontext.h
MythV4L2M2MContext::GetSupportedCodec
static MythCodecID GetSupportedCodec(AVCodecContext **Context, AVCodec **Codec, const QString &Decoder, AVStream *Stream, uint StreamType)
Definition: mythv4l2m2mcontext.cpp:48
MythCodecContext::IsUnsupportedProfile
static bool IsUnsupportedProfile(AVCodecContext *Context)
Most hardware decoders do not support these codecs/profiles.
Definition: mythcodeccontext.cpp:571
MythCodecContext::MPEG2
@ MPEG2
Definition: mythcodeccontext.h:57
MythCodecContext::VP9_3HDR
@ VP9_3HDR
Definition: mythcodeccontext.h:113
MythCodecContext::H264High444
@ H264High444
Definition: mythcodeccontext.h:91
MythCodecContext::FilteredReceiveFrame
virtual int FilteredReceiveFrame(AVCodecContext *Context, AVFrame *Frame)
Retrieve and process/filter AVFrame.
Definition: mythcodeccontext.cpp:596
MythCodecContext::GetDecoders
static void GetDecoders(RenderOptions &Opts)
Definition: mythcodeccontext.cpp:142
MythCodecContext::HEVCMain10HDR
@ HEVCMain10HDR
Definition: mythcodeccontext.h:98
MythCodecContext::GetDecoderDescription
static QStringList GetDecoderDescription(void)
Definition: mythcodeccontext.cpp:114
codec_is_drmprime
#define codec_is_drmprime(id)
Definition: mythcodecid.h:296
codec_is_dxva2
#define codec_is_dxva2(id)
Definition: mythcodecid.h:316
MythVTBContext::GetSupportedCodec
static MythCodecID GetSupportedCodec(AVCodecContext **Context, AVCodec **Codec, const QString &Decoder, uint StreamType)
Definition: mythvtbcontext.cpp:74
codec_is_vdpau_hw
#define codec_is_vdpau_hw(id)
Definition: mythcodecid.h:300
MythCodecContext::CreateDevice
static AVBufferRef * CreateDevice(AVHWDeviceType Type, MythOpenGLInterop *Interop, const QString &Device=QString())
Definition: mythcodeccontext.cpp:532
MythCodecContext::MPEG4NBit
@ MPEG4NBit
Definition: mythcodeccontext.h:69
MythVDPAUContext
Definition: mythvdpaucontext.h:8
MythNVDECContext::HaveNVDEC
static bool HaveNVDEC(void)
Definition: mythnvdeccontext.cpp:527
MythV4L2M2MContext::HaveV4L2Codecs
static bool HaveV4L2Codecs(void)
Definition: mythv4l2m2mcontext.cpp:365
ColorDepth
int ColorDepth(int Format)
Return the color depth for the given MythTV frame format.
Definition: mythframe.cpp:808
MythCodecContext::CreateDecoderCallback
static void CreateDecoderCallback(void *Wait, void *Context, void *Callback)
Definition: mythcodeccontext.cpp:480
MythCodecContext::MPEG2Main
@ MPEG2Main
Definition: mythcodeccontext.h:59
MythCodecContext::VC1
@ VC1
Definition: mythcodeccontext.h:100
MythV4L2M2MContext
A handler for V4L2 Memory2Memory codecs.
Definition: mythv4l2m2mcontext.h:10
planes
static uint planes(VideoFrameType Type)
Definition: mythframe.h:570
mythcorecontext.h
codec_is_vaapi_dec
#define codec_is_vaapi_dec(id)
Definition: mythcodecid.h:313
codec_is_vaapi
#define codec_is_vaapi(id)
Definition: mythcodecid.h:311
avformatdecoder.h
codec_is_nvdec_dec
#define codec_is_nvdec_dec(id)
Definition: mythcodecid.h:330
mythnvdeccontext.h
mythmmalcontext.h
DecoderBase::GetBestVideoFormat
AVPixelFormat GetBestVideoFormat(AVPixelFormat *Formats)
Find a suitable frame format that is mutually acceptable to the decoder and render device.
Definition: decoderbase.cpp:1446
codec_is_v4l2
#define codec_is_v4l2(id)
Definition: mythcodecid.h:338
MythCodecContext::MPEG4BasicAnimated
@ MPEG4BasicAnimated
Definition: mythcodeccontext.h:72
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:513
FreeAVHWDeviceContext
void(*)(struct AVHWDeviceContext *) FreeAVHWDeviceContext
Definition: mythopenglinterop.h:20
MythCodecContext::MJPEG
@ MJPEG
Definition: mythcodeccontext.h:119
MythCodecContext::AV1Main
@ AV1Main
Definition: mythcodeccontext.h:116
mythcodeccontext.h
LOC
#define LOC
Definition: mythcodeccontext.cpp:62
MythCodecContext::MPEG4Hybrid
@ MPEG4Hybrid
Definition: mythcodeccontext.h:73
FMT_MMAL
@ FMT_MMAL
Definition: mythframe.h:64
MythCodecContext
Definition: mythcodeccontext.h:51
VideoFrameType
VideoFrameType
Definition: mythframe.h:25
MythCodecContext::H264High
@ H264High
Definition: mythcodeccontext.h:87
MythCodecContext::GetProfileDescription
static QString GetProfileDescription(CodecProfile Profile, QSize Size, VideoFrameType Format=FMT_NONE, uint ColorDepth=0)
Definition: mythcodeccontext.cpp:759
codec_is_vtb
#define codec_is_vtb(id)
Definition: mythcodecid.h:333
MythCodecContext::VP9_2HDR
@ VP9_2HDR
Definition: mythcodeccontext.h:111
MythCodecContext::MPEG4AdvancedRT
@ MPEG4AdvancedRT
Definition: mythcodeccontext.h:74
MythOpenGLInterop::GetInteropType
static Type GetInteropType(VideoFrameType Format, MythPlayer *Player)
Check whether we support direct rendering for the given VideoFrameType.
Definition: mythopenglinterop.cpp:77
mythdrmprimecontext.h
MythMMALContext::GetSupportedCodec
static MythCodecID GetSupportedCodec(AVCodecContext **Context, AVCodec **Codec, const QString &Decoder, AVStream *Stream, uint StreamType)
Definition: mythmmalcontext.cpp:39
codec_is_vdpau_dechw
#define codec_is_vdpau_dechw(id)
Definition: mythcodecid.h:306
codec_is_v4l2_dec
#define codec_is_v4l2_dec(id)
Definition: mythcodecid.h:339
ReferenceCounter::IncrRef
virtual int IncrRef(void)
Increments reference count.
Definition: referencecounter.cpp:101
format_description
const char * format_description(VideoFrameType Type)
Definition: mythframe.cpp:33
mythmainwindow.h
MythMMALContext
Definition: mythmmalcontext.h:11
MythCodecContext::MPEG4Core
@ MPEG4Core
Definition: mythcodeccontext.h:67
MythCodecContext::H264ConstrainedHigh
@ H264ConstrainedHigh
Definition: mythcodeccontext.h:92
mythv4l2m2mcontext.h
MythCodecContext::HEVCMain
@ HEVCMain
Definition: mythcodeccontext.h:94
MythCodecContext::InitialiseDecoder
static int InitialiseDecoder(AVCodecContext *Context, CreateHWDecoder Callback, const QString &Debug)
Initialise a hardware decoder that is expected to use AVHWFramesContext.
Definition: mythcodeccontext.cpp:493
codec_is_vtb_dec
#define codec_is_vtb_dec(id)
Definition: mythcodecid.h:335
av_make_error_stdstring
char * av_make_error_stdstring(std::string &errbuf, int errnum)
Definition: mythaverror.cpp:41
DecoderBase
Definition: decoderbase.h:120
MythCodecContext::VP8
@ VP8
Definition: mythcodeccontext.h:105
MythMMALContext::GetDecoderList
static void GetDecoderList(QStringList &Decoders)
Definition: mythmmalcontext.cpp:283
MythCodecContext::GetBuffer2
static bool GetBuffer2(struct AVCodecContext *Context, VideoFrame *Frame, AVFrame *AvFrame, int Flags)
A generic hardware buffer initialisation method when AVHWFramesContext is NOT used.
Definition: mythcodeccontext.cpp:362
MythCodecContext::H264High10
@ H264High10
Definition: mythcodeccontext.h:88
MythCodecContext::H264
@ H264
Definition: mythcodeccontext.h:82