diff --git a/inotify.c b/inotify.c index c3dc3f3..9a36df0 100644 --- a/inotify.c +++ b/inotify.c @@ -37,6 +37,7 @@ #include "linux/inotify.h" #include "linux/inotify-syscalls.h" #endif +#include "libav.h" #include "upnpglobalvars.h" #include "inotify.h" @@ -652,6 +653,7 @@ start_inotify() if (setpriority(PRIO_PROCESS, 0, 19) == -1) DPRINTF(E_WARN, L_INOTIFY, "Failed to reduce inotify thread priority\n"); sqlite3_release_memory(1<<31); + av_register_all(); while( !quitting ) { diff --git a/libav.h b/libav.h new file mode 100644 index 0000000..7b46093 --- /dev/null +++ b/libav.h @@ -0,0 +1,43 @@ + +#if HAVE_FFMPEG_LIBAVUTIL_AVUTIL_H +#include +#elif HAVE_LIBAV_LIBAVUTIL_AVUTIL_H +#include +#elif HAVE_LIBAVUTIL_AVUTIL_H +#include +#elif HAVE_FFMPEG_AVUTIL_H +#include +#elif HAVE_LIBAV_AVUTIL_H +#include +#elif HAVE_AVUTIL_H +#include +#endif + +#if HAVE_FFMPEG_LIBAVCODEC_AVCODEC_H +#include +#elif HAVE_LIBAV_LIBAVCODEC_AVCODEC_H +#include +#elif HAVE_LIBAVCODEC_AVCODEC_H +#include +#elif HAVE_FFMPEG_AVCODEC_H +#include +#elif HAVE_LIBAV_AVCODEC_H +#include +#elif HAVE_AVCODEC_H +#include +#endif + +#if HAVE_FFMPEG_LIBAVFORMAT_AVFORMAT_H +#include +#elif HAVE_LIBAV_LIBAVFORMAT_AVFORMAT_H +#include +#elif HAVE_LIBAVFORMAT_AVFORMAT_H +#include +#elif HAVE_FFMPEG_AVFORMAT_H +#include +#elif HAVE_LIBAV_LIBAVFORMAT_H +#include +#elif HAVE_AVFORMAT_H +#include +#endif + diff --git a/metadata.c b/metadata.c index 0314da4..3396484 100644 --- a/metadata.c +++ b/metadata.c @@ -29,54 +29,13 @@ #include #include -#include "image_utils.h" -#include "tagutils/tagutils.h" #include #include - -#if HAVE_FFMPEG_LIBAVUTIL_AVUTIL_H -#include -#elif HAVE_LIBAV_LIBAVUTIL_AVUTIL_H -#include -#elif HAVE_LIBAVUTIL_AVUTIL_H -#include -#elif HAVE_FFMPEG_AVUTIL_H -#include -#elif HAVE_LIBAV_AVUTIL_H -#include -#elif HAVE_AVUTIL_H -#include -#endif - -#if HAVE_FFMPEG_LIBAVCODEC_AVCODEC_H -#include -#elif HAVE_LIBAV_LIBAVCODEC_AVCODEC_H -#include -#elif HAVE_LIBAVCODEC_AVCODEC_H -#include -#elif HAVE_FFMPEG_AVCODEC_H -#include -#elif HAVE_LIBAV_AVCODEC_H -#include -#elif HAVE_AVCODEC_H -#include -#endif - -#if HAVE_FFMPEG_LIBAVFORMAT_AVFORMAT_H -#include -#elif HAVE_LIBAV_LIBAVFORMAT_AVFORMAT_H -#include -#elif HAVE_LIBAVFORMAT_AVFORMAT_H -#include -#elif HAVE_FFMPEG_AVFORMAT_H -#include -#elif HAVE_LIBAV_LIBAVFORMAT_H -#include -#elif HAVE_AVFORMAT_H -#include -#endif +#include "libav.h" #include "upnpglobalvars.h" +#include "tagutils/tagutils.h" +#include "image_utils.h" #include "upnpreplyparse.h" #include "tivo_utils.h" #include "metadata.h" @@ -140,7 +99,7 @@ lav_open(AVFormatContext **ctx, const char *filename) #if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(17<<8)+0) ret = avformat_open_input(ctx, filename, NULL, NULL); if (ret == 0) - avformat_find_stream_info(*ctx, NULL); + avformat_find_stream_info(*ctx, NULL); #else ret = av_open_input_file(ctx, filename, NULL, 0, NULL); if (ret == 0) @@ -764,7 +723,9 @@ GetVideoMetadata(const char *path, char *name) ret = lav_open(&ctx, path); if( ret != 0 ) { - DPRINTF(E_WARN, L_METADATA, "Opening %s failed!\n", path); + char err[128]; + av_strerror(ret, err, sizeof(err)); + DPRINTF(E_WARN, L_METADATA, "Opening %s failed! [%s]\n", path, err); return 0; } //dump_format(ctx, 0, NULL, 0); diff --git a/scanner.c b/scanner.c index 3fd2fc0..0234a88 100644 --- a/scanner.c +++ b/scanner.c @@ -33,34 +33,8 @@ #ifdef ENABLE_NLS #include #endif -#if HAVE_FFMPEG_LIBAVUTIL_AVUTIL_H -#include -#elif HAVE_LIBAV_LIBAVUTIL_AVUTIL_H -#include -#elif HAVE_LIBAVUTIL_AVUTIL_H -#include -#elif HAVE_FFMPEG_AVUTIL_H -#include -#elif HAVE_LIBAV_AVUTIL_H -#include -#elif HAVE_AVUTIL_H -#include -#endif -#if HAVE_FFMPEG_LIBAVFORMAT_AVFORMAT_H -#include -#elif HAVE_LIBAV_LIBAVFORMAT_AVFORMAT_H -#include -#elif HAVE_LIBAVFORMAT_AVFORMAT_H -#include -#elif HAVE_FFMPEG_AVFORMAT_H -#include -#elif HAVE_LIBAV_LIBAVFORMAT_H -#include -#elif HAVE_AVFORMAT_H -#include -#endif - #include +#include "libav.h" #include "scanner_sqlite.h" #include "upnpglobalvars.h"