Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed Sep 13, 2015
1 parent ff537d3 commit 33a5eaa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions include/ffmscompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ static const AVPixFmtDescriptor *av_pix_fmt_desc_get(AVPixelFormat pix_fmt) {
# if VERSION_CHECK(LIBAVUTIL_VERSION_INT, <, 52, 9, 0, 52, 20, 100)
# define av_frame_alloc avcodec_alloc_frame
# endif

# if VERSION_CHECK(LIBAVUTIL_VERSION_INT, >, 55, 0, 0, 55, 0, 100) || defined(FF_API_PLUS1_MINUS1)
# define FFMS_DEPTH(x) ((x).depth)
# else
# define FFMS_DEPTH(x) ((x).depth_minus1 + 1)
# endif
#endif


Expand Down
6 changes: 3 additions & 3 deletions src/core/videoutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ struct LossAttributes {

static int GetPseudoDepth(const AVPixFmtDescriptor &Desc) {
// Comparing the pseudo depth makes sure that rgb565-ish formats get selected over rgb555-ish ones
int depth = -1;
int depth = 0;
for (int i = 0; i < Desc.nb_components; i++)
depth = FFMAX(depth, Desc.comp[i].depth_minus1);
return depth + 1;
depth = FFMAX(depth, FFMS_DEPTH(Desc.comp[i]));
return depth;
}

static LossAttributes CalculateLoss(AVPixelFormat Dst, AVPixelFormat Src) {
Expand Down
10 changes: 5 additions & 5 deletions src/vapoursynth/vapoursource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ static bool IsRealNativeEndianPlanar(const AVPixFmtDescriptor &desc) {
int used_planes = 0;
for (int i = 0; i < desc.nb_components; i++)
used_planes = std::max(used_planes, (int)desc.comp[i].plane + 1);
bool temp = (used_planes == desc.nb_components) && (desc.comp[0].depth_minus1 + 1 >= 8) &&
bool temp = (used_planes == desc.nb_components) && (FFMS_DEPTH(desc.comp[0]) >= 8) &&
(!(desc.flags & FFMS_PIX_FMT_FLAG(PAL)));
if (!temp)
return false;
else if (desc.comp[0].depth_minus1 + 1 == 8)
else if (FFMS_DEPTH(desc.comp[0]) == 8)
return temp;
else
return (FFMS_PIX_FMT(YUV420P10) == FFMS_PIX_FMT(YUV420P10BE) ? !!(desc.flags & FFMS_PIX_FMT_FLAG(BE)) : !(desc.flags & FFMS_PIX_FMT_FLAG(BE)));
Expand Down Expand Up @@ -76,7 +76,7 @@ static int FormatConversionToPixelFormat(int id, bool Alpha, VSCore *core, const
const AVPixFmtDescriptor &desc = *av_pix_fmt_desc_get((AVPixelFormat)i);
if (IsRealNativeEndianPlanar(desc) && !HasAlpha(desc)
&& GetColorFamily(desc) == f->colorFamily
&& desc.comp[0].depth_minus1 + 1 == f->bitsPerSample
&& FFMS_DEPTH(desc.comp[0]) == f->bitsPerSample
&& desc.log2_chroma_w == f->subSamplingW
&& desc.log2_chroma_h == f->subSamplingH)
return i;
Expand All @@ -87,7 +87,7 @@ static int FormatConversionToPixelFormat(int id, bool Alpha, VSCore *core, const
const AVPixFmtDescriptor &desc = *av_pix_fmt_desc_get((AVPixelFormat)i);
if (IsRealNativeEndianPlanar(desc) && HasAlpha(desc)
&& GetColorFamily(desc) == f->colorFamily
&& desc.comp[0].depth_minus1 + 1 == f->bitsPerSample
&& FFMS_DEPTH(desc.comp[0]) == f->bitsPerSample
&& desc.log2_chroma_w == f->subSamplingW
&& desc.log2_chroma_h == f->subSamplingH)
return i;
Expand All @@ -97,7 +97,7 @@ static int FormatConversionToPixelFormat(int id, bool Alpha, VSCore *core, const

static const VSFormat *FormatConversionToVS(int id, VSCore *core, const VSAPI *vsapi) {
return vsapi->registerFormat(GetColorFamily(*av_pix_fmt_desc_get((AVPixelFormat)id)), stInteger,
av_pix_fmt_desc_get((AVPixelFormat)id)->comp[0].depth_minus1 + 1,
FFMS_DEPTH(av_pix_fmt_desc_get((AVPixelFormat)id)->comp[0]),
av_pix_fmt_desc_get((AVPixelFormat)id)->log2_chroma_w,
av_pix_fmt_desc_get((AVPixelFormat)id)->log2_chroma_h, core);
}
Expand Down

0 comments on commit 33a5eaa

Please sign in to comment.