Giter Club home page Giter Club logo

libmediascan's People

Contributors

andygrundman avatar hfoxbennett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

libmediascan's Issues

ffmpeg, giflib, OSX, etc API changes

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/mediascan.c
+++ b/src/mediascan.c
@@ -173,9 +173,6 @@ static void register_codecs(void) {
 #define REGISTER_DEMUXER(X,x) { \
   extern AVInputFormat ff_##x##_demuxer; \
        av_register_input_format(&ff_##x##_demuxer); }
-#define REGISTER_PROTOCOL(X,x) { \
-  extern URLProtocol ff_##x##_protocol; \
-  av_register_protocol2(&ff_##x##_protocol, sizeof(ff_##x##_protocol)); }

 ///-------------------------------------------------------------------------------------------------
 ///  Registers the formats for FFmpeg.
@@ -197,9 +194,6 @@ static void register_formats(void) {
   REGISTER_DEMUXER(MPEGPS, mpegps); // VOB files
   REGISTER_DEMUXER(MPEGTS, mpegts);
   REGISTER_DEMUXER(MPEGVIDEO, mpegvideo);
-
-  // protocols
-  REGISTER_PROTOCOL(FILE, file);
 }                               /* register_formats() */

src/result.c

--- 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.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

Compiling "mediascan_unix.c" on Solaris 11 Express

Compiling "mediascan_unix.c" resulted in a problem concerned with the d_type/DT_DIR issue on some platforms (line 114 in "mediascan_unix.c")

The problem could be solved by adding the following line to the file:

in case of (line 114):
if (dp->d_type == DT_DIR) {
I put:
stat(dp->d_name, &t);
if ((t.st_mode & S_IFMT) == S_IFDIR) {

I also had to add "struct stat t;" to function "recurse_dir"

Maybe this helps to get libmediascan running on Solaris/Openindiana

License clarification

Dear Andy,

I'm in the (slow) process of packaging the Logitech Media Server for Debian, and for that to work, I'm currently looking at libmediascan. One of the most important steps to get libmediascan into Debian is to check the license of all the source. I have several requests for clarification.

  1. There's a COPYING file containing the LGPL3 in your source tree. I can only assume you meant to declare all your code to be available under the LGPL3 license. Is that correct? Did you mean LGPL3 or LGPL3 or any later version? I also note that bindings/perl/Makefile.PL claims that the license (of the binding?) is gpl_2
  2. src/libdlna/ seems to be mostly covered by the LGPL2.1 Is that also your understanding?
  3. I found a lot of precompiled libraries in lib/ and win32/, I believe I can strip those directories out. Does that seem reasonable to you?
  4. I'm a bit worried about the test data. It seems to me you created some of the test data yourself, but (last time I checked, I take this from memory) also took some files from the PNG wikipedia page. Is that correct? Do you have any other sources?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.