Hello,
I was compiling Gem against a recent ffmpeg and noticed that it
still uses the img_convert call, along with, perhaps, some other
deprecated functionality. I patched it [img_convert] out thusly:
(filmFFMPEG.cpp @ 314)
// was: if (img_convert(&rgba,dstfmt,&m_Picture,fmt,width,height)<0)
//Patched to use swsscale instead of img_convert:
static SwsContext *sws_context = NULL;
sws_context = sws_getCachedContext(sws_context, width, height, fmt,
width, height, dstfmt, 0, NULL, NULL, NULL);
if (!sws_context)
error("ffmpeg-conversion failed (%d->%d)", fmt, dstfmt);
else if (sws_scale(sws_context, m_Picture.data, m_Picture.linesize,
0, height, rgba.data, rgba.linesize)<0)
error("ffmpeg-conversion failed (%d->%d)", fmt, dstfmt);
(also added swscale.h to the header; added -lswscale with
PKG_CONFIG_FFMPEG)
However,
(a) I'm not sure this is a great option, since sws_getCachedContext
will de- and re- allocate contexts repeatedly, e.g. if decoding
multiple streams of different sizes. If there is there a way to make
that SwsContext per-object, it would work better.
(b) haven't found a test video that actually works yet (I have
mostly .mkv's and ffmpeg gives a decode error on 'em).
(c) From all the #defines in the code, it seems like multiple-
version compatibility is really important, and -- of course -- this
also breaks that.
(d) there is other deprecated stuff yet to patch out, but see (c).
Anyway, figured I'd email this list and see if anyone was working on
it or had suggestions.
Good day,
--Jim