In case anyone is interested in hacking on this code, here's some info about API changes needed to support newer versions of libraries we use. This is probably not a complete list.
If you just want to statically build everything, I highly recommend using the build script and old version tarballs located at https://github.com/Logitech/slimserver-vendor/tree/public/7.9/CPAN Running ./buildme.sh Media::Scan is where to start. It probably needs a little hacking to use a newer version of Perl but otherwise it should be able to build everything.
ffmpeg
ffmpeg's API has moved on quite a bit from when this code was written. libmediascan was developed around version 0.8.4 and we always intended it to be statically linked to avoid these kinds of problems. The doc/APIchanges file is pretty helpful at figuring out what the new APIs are.
After a quick look at ffmpeg's release/2.8 branch, it looks like the following changes need to be worked out. I didn't check the state of the master branch.
src/mediascan.c:
Registering a file protocol seems to be unnecessary now, so REGISTER_PROTOCOL stuff can be removed.
--- a/src/result.c
+++ b/src/result.c
@@ -323,7 +323,7 @@ static int scan_video(MediaScanResult *r) {
r->_avf = (void *)avf;
- if ((AVError = av_find_stream_info(avf)) < 0) {
+ if ((AVError = avformat_find_stream_info(avf, NULL)) < 0) {
r->error = error_create(r->path, MS_ERROR_READ, "[libavformat] Unable to find stream info");
r->error->averror = AVError;
ret = 0;
@@ -372,9 +372,6 @@ static int scan_video(MediaScanResult *r) {
v->_codecs = (void *)codecs;
v->_avc = (void *)c;
}
- else if (codecs->vc->codec_name[0] != '\0') {
- v->codec = codecs->vc->codec_name;
- }
else {
char codec_tag_string[128];
@@ -403,9 +400,6 @@ static int scan_video(MediaScanResult *r) {
if (ac) {
a->codec = ac->name;
}
- else if (codecs->ac->codec_name[0] != '\0') {
- a->codec = codecs->ac->codec_name;
- }
// Special case for handling MP1 audio streams which FFMPEG can't identify a codec for
else if (codecs->ac->codec_id == CODEC_ID_MP1) {
a->codec = CODEC_MP1;
@@ -632,7 +626,7 @@ void result_destroy(MediaScanResult *r) {
tag_destroy(r->_tag);
if (r->_avf) {
- av_close_input_file(r->_avf);
+ avformat_close_input(r->_avf);
src/video.c
--- a/src/video.c
+++ b/src/video.c
@@ -64,12 +64,12 @@ MediaScanImage *video_create_image_from_frame(MediaScanVideo *v, MediaScanResult
int no_keyframe_found = 0;
int skipped_frames = 0;
- if ((avcodec_open(codecs->vc, codec)) < 0) {
+ if ((avcodec_open2(codecs->vc, codec, NULL)) < 0) {
LOG_ERROR("Couldn't open video codec %s for thumbnail creation\n", codec->name);
goto err;
}
- frame = avcodec_alloc_frame();
+ frame = av_frame_alloc();
if (!frame) {
LOG_ERROR("Couldn't allocate a video frame\n");
goto err;
@@ -171,7 +171,7 @@ MediaScanImage *video_create_image_from_frame(MediaScanVideo *v, MediaScanResult
goto err;
}
- frame_rgb = avcodec_alloc_frame();
+ frame_rgb = av_frame_alloc();
if (!frame_rgb) {
LOG_ERROR("Couldn't allocate a video frame\n");
goto err;
giflib
giflib changed their API at some point, I fixed this in Image::Scale so see that code for reference on what needs changed.
libdlna
We have a local version of libdlna in the source tree that uses various ffmpeg calls that need updated. Possibly a newer libdlna can just be dropped in.
OSX
I get the following warnings when building on 10.11.4 El Capitan with Apple LLVM version 7.3.0 (clang-703.0.31).
mediascan_macos.m:50:11: warning: 'CFURLGetFSRef' is deprecated: first deprecated in OS X 10.9mediascan_macos.m:52:21: warning: 'FSResolveAliasFile' is deprecated: first deprecated in OS X 10.8NSString+SymlinksAndAliases.m:239:7: warning: 'CFURLGetFSRef' is deprecated: first deprecated in OS X 10.9NSString+SymlinksAndAliases.m:242:16: warning: 'FSResolveAliasFileWithMountFlags' is deprecated: first deprecated in OS X 10.8NSString+SymlinksAndAliases.m:246:28: warning: 'CFURLCreateFromFSRef' is deprecated: first deprecated in OS X 10.9
In case anyone is interested in hacking on this code, here's some info about API changes needed to support newer versions of libraries we use. This is probably not a complete list.
If you just want to statically build everything, I highly recommend using the build script and old version tarballs located at https://github.com/Logitech/slimserver-vendor/tree/public/7.9/CPAN Running
./buildme.sh Media::Scan
is where to start. It probably needs a little hacking to use a newer version of Perl but otherwise it should be able to build everything.ffmpeg
ffmpeg's API has moved on quite a bit from when this code was written. libmediascan was developed around version 0.8.4 and we always intended it to be statically linked to avoid these kinds of problems. The doc/APIchanges file is pretty helpful at figuring out what the new APIs are.
After a quick look at ffmpeg's release/2.8 branch, it looks like the following changes need to be worked out. I didn't check the state of the master branch.
src/mediascan.c:
Registering a file protocol seems to be unnecessary now, so REGISTER_PROTOCOL stuff can be removed.
src/result.c
src/video.c
giflib
giflib changed their API at some point, I fixed this in Image::Scale so see that code for reference on what needs changed.
libdlna
We have a local version of libdlna in the source tree that uses various ffmpeg calls that need updated. Possibly a newer libdlna can just be dropped in.
OSX
I get the following warnings when building on 10.11.4 El Capitan with Apple LLVM version 7.3.0 (clang-703.0.31).
mediascan_macos.m:50:11: warning: 'CFURLGetFSRef' is deprecated: first deprecated in OS X 10.9
mediascan_macos.m:52:21: warning: 'FSResolveAliasFile' is deprecated: first deprecated in OS X 10.8
NSString+SymlinksAndAliases.m:239:7: warning: 'CFURLGetFSRef' is deprecated: first deprecated in OS X 10.9
NSString+SymlinksAndAliases.m:242:16: warning: 'FSResolveAliasFileWithMountFlags' is deprecated: first deprecated in OS X 10.8
NSString+SymlinksAndAliases.m:246:28: warning: 'CFURLCreateFromFSRef' is deprecated: first deprecated in OS X 10.9