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