Skip to content

Commit

Permalink
MythCodecContext: Add MPEG1 profile and bit depth to profile description
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kendall committed Jan 23, 2020
1 parent 9ab9932 commit 06f55a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions mythtv/libs/libmythtv/decoders/mythcodeccontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ MythCodecContext::CodecProfile MythCodecContext::FFmpegToMythProfile(AVCodecID C
{
switch (CodecID)
{
case AV_CODEC_ID_MPEG1VIDEO: return MPEG1;
case AV_CODEC_ID_MPEG2VIDEO:
switch (Profile)
{
Expand Down Expand Up @@ -726,12 +727,13 @@ MythCodecContext::CodecProfile MythCodecContext::FFmpegToMythProfile(AVCodecID C
return NoProfile;
}

QString MythCodecContext::GetProfileDescription(CodecProfile Profile, QSize Size)
QString MythCodecContext::GetProfileDescription(CodecProfile Profile, QSize Size, uint ColorDepth)
{
QString profile;
switch (Profile)
{
case NoProfile: profile = QObject::tr("Unknown/Unsupported"); break;
case MPEG1: profile = "MPEG1"; break;
case MPEG2: profile = "MPEG2"; break;
case MPEG2Simple: profile = "MPEG2 Simple"; break;
case MPEG2Main: profile = "MPEG2 Main"; break;
Expand Down Expand Up @@ -800,5 +802,7 @@ QString MythCodecContext::GetProfileDescription(CodecProfile Profile, QSize Size
if (Size.isEmpty())
return profile;

return QObject::tr("%1 (Max size: %2x%3)").arg(profile).arg(Size.width()).arg(Size.height());
return QObject::tr("%1%2 (Max size: %3x%4)")
.arg(profile).arg(ColorDepth > 8 ? QString(" %1Bit").arg(ColorDepth) : "")
.arg(Size.width()).arg(Size.height());
}
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/decoders/mythcodeccontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MTV_PUBLIC MythCodecContext
enum CodecProfile
{
NoProfile = 0,
MPEG1,
MPEG2,
MPEG2Simple,
MPEG2Main,
Expand Down Expand Up @@ -137,7 +138,7 @@ class MTV_PUBLIC MythCodecContext
static void CreateDecoderCallback (void *Wait, void *Context, void *Callback);
static AVBufferRef* CreateDevice (AVHWDeviceType Type, MythOpenGLInterop *Interop, const QString &Device = QString());
static bool IsUnsupportedProfile (AVCodecContext *Context);
static QString GetProfileDescription (CodecProfile Profile, QSize Size);
static QString GetProfileDescription (CodecProfile Profile, QSize Size, uint ColorDepth = 0);
static CodecProfile FFmpegToMythProfile(AVCodecID CodecID, int Profile);

virtual void InitVideoCodec (AVCodecContext *Context,
Expand Down

0 comments on commit 06f55a4

Please sign in to comment.