Skip to content

Commit

Permalink
MythCodecContext: Add a convenience method to retrieve MythPlayerUI
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kendall committed Oct 14, 2020
1 parent 0e25f71 commit d89897f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythcodeccontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "mythmainwindow.h"
#include "mythopenglinterop.h"
#include "avformatdecoder.h"
#include "mythplayerui.h"

#ifdef USING_VAAPI
#include "mythvaapicontext.h"
Expand Down Expand Up @@ -489,6 +490,15 @@ void MythCodecContext::CreateDecoderCallback(void *Wait, void *Context, void *Ca
wait->wakeAll();
}

MythPlayerUI* MythCodecContext::GetPlayerUI(AVCodecContext *Context)
{
MythPlayerUI* result = nullptr;
auto* decoder = reinterpret_cast<AvFormatDecoder*>(Context->opaque);
if (decoder)
result = dynamic_cast<MythPlayerUI*>(decoder->GetPlayer());
return result;
}

/// \brief Initialise a hardware decoder that is expected to use AVHWFramesContext
int MythCodecContext::InitialiseDecoder(AVCodecContext *Context, CreateHWDecoder Callback,
const QString &Debug)
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythcodeccontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ extern "C" {

using CreateHWDecoder = int (*)(AVCodecContext *Context);

class MythPlayerUI;
class MythOpenGLInterop;
class VideoDisplayProfile;

Expand Down Expand Up @@ -136,6 +137,7 @@ class MTV_PUBLIC MythCodecContext
static void FramesContextFinished (AVHWFramesContext *Context);
static void DeviceContextFinished (AVHWDeviceContext *Context);
static void CreateDecoderCallback (void *Wait, void *Context, void *Callback);
static MythPlayerUI* GetPlayerUI (AVCodecContext* Context);
static AVBufferRef* CreateDevice (AVHWDeviceType Type, MythOpenGLInterop *Interop, const QString &Device = QString());
static bool IsUnsupportedProfile (AVCodecContext *Context);
static QString GetProfileDescription (CodecProfile Profile, QSize Size,
Expand Down

0 comments on commit d89897f

Please sign in to comment.