* Add support for the latest ffmpeg/libav library versions.
This commit is contained in:
parent
78af8c3d6e
commit
2c7a3bfc06
@ -27,7 +27,6 @@ minidlna_LDADD = \
|
|||||||
@LIBSQLITE3_LIBS@ \
|
@LIBSQLITE3_LIBS@ \
|
||||||
@LIBAVFORMAT_LIBS@ \
|
@LIBAVFORMAT_LIBS@ \
|
||||||
@LIBAVUTIL_LIBS@ \
|
@LIBAVUTIL_LIBS@ \
|
||||||
@LIBAVCODEC_LIBS@ \
|
|
||||||
@LIBEXIF_LIBS@ \
|
@LIBEXIF_LIBS@ \
|
||||||
@LIBDL_LIBS@ \
|
@LIBDL_LIBS@ \
|
||||||
@LIBRT_LIBS@ \
|
@LIBRT_LIBS@ \
|
||||||
@ -44,7 +43,6 @@ testupnpdescgen_LDADD = \
|
|||||||
@LIBSQLITE3_LIBS@ \
|
@LIBSQLITE3_LIBS@ \
|
||||||
@LIBAVFORMAT_LIBS@ \
|
@LIBAVFORMAT_LIBS@ \
|
||||||
@LIBAVUTIL_LIBS@ \
|
@LIBAVUTIL_LIBS@ \
|
||||||
@LIBAVCODEC_LIBS@ \
|
|
||||||
@LIBEXIF_LIBS@ \
|
@LIBEXIF_LIBS@ \
|
||||||
@LIBDL_LIBS@ \
|
@LIBDL_LIBS@ \
|
||||||
-lpthread -lFLAC $(flacoggflag) $(vorbisflag)
|
-lpthread -lFLAC $(flacoggflag) $(vorbisflag)
|
||||||
|
15
configure.ac
15
configure.ac
@ -11,7 +11,7 @@ m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_USE_SYSTEM_EXTENSIONS])
|
|||||||
|
|
||||||
AM_ICONV
|
AM_ICONV
|
||||||
AM_GNU_GETTEXT([external])
|
AM_GNU_GETTEXT([external])
|
||||||
AM_GNU_GETTEXT_VERSION(0.14.4)
|
AM_GNU_GETTEXT_VERSION(0.18)
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
# AC_PROG_CXX
|
# AC_PROG_CXX
|
||||||
@ -381,19 +381,20 @@ for dir in "" /usr/local $SEARCH_DIR; do
|
|||||||
if test -n "$dir"; then
|
if test -n "$dir"; then
|
||||||
LDFLAGS="$LDFLAGS -L$dir/lib"
|
LDFLAGS="$LDFLAGS -L$dir/lib"
|
||||||
fi
|
fi
|
||||||
AC_CHECK_LIB([avformat], [av_open_input_file], [LIBAVFORMAT_LIBS="-lavformat"], [unset ac_cv_lib_avformat_av_open_input_file; LDFLAGS="$LDFLAGS_SAVE"; continue])
|
AC_CHECK_LIB([avformat], [av_open_input_file], [LIBAVFORMAT_LIBS="-lavformat"],
|
||||||
AC_SUBST(LIBJPEG_LIBS)
|
[AC_CHECK_LIB([avformat], [avformat_open_input], [LIBAVFORMAT_LIBS="-lavformat"],
|
||||||
|
[unset ac_cv_lib_avformat_av_open_input_file; unset ac_cv_lib_avformat_avformat_open_input; LDFLAGS="$LDFLAGS_SAVE"; continue])])
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
test x"$ac_cv_lib_avformat_av_open_input_file" = x"yes" || AC_MSG_ERROR([Could not find libavformat - part of ffmpeg])
|
if test x"$ac_cv_lib_avformat_av_open_input_file" != x"yes" &&
|
||||||
|
test x"$ac_cv_lib_avformat_avformat_open_input" != x"yes"; then
|
||||||
|
AC_MSG_ERROR([Could not find libavformat - part of ffmpeg])
|
||||||
|
fi
|
||||||
AC_SUBST(LIBAVFORMAT_LIBS)
|
AC_SUBST(LIBAVFORMAT_LIBS)
|
||||||
|
|
||||||
AC_CHECK_LIB(avutil ,[av_rescale_q], [LIBAVUTIL_LIBS="-lavutil"], [AC_MSG_ERROR([Could not find libavutil - part of ffmpeg])])
|
AC_CHECK_LIB(avutil ,[av_rescale_q], [LIBAVUTIL_LIBS="-lavutil"], [AC_MSG_ERROR([Could not find libavutil - part of ffmpeg])])
|
||||||
AC_SUBST(LIBAVUTIL_LIBS)
|
AC_SUBST(LIBAVUTIL_LIBS)
|
||||||
|
|
||||||
AC_CHECK_LIB(avcodec ,[avcodec_init], [LIBAVCODEC_LIBS="-lavcodec"], [AC_MSG_ERROR([Could not find libavcodec - part of ffmpeg])])
|
|
||||||
AC_SUBST(LIBAVCODEC_LIBS)
|
|
||||||
|
|
||||||
AC_CHECK_LIB(pthread, pthread_create)
|
AC_CHECK_LIB(pthread, pthread_create)
|
||||||
|
|
||||||
# test if we have vorbisfile
|
# test if we have vorbisfile
|
||||||
|
50
metadata.c
50
metadata.c
@ -131,6 +131,40 @@ enum audio_profiles {
|
|||||||
PROFILE_AUDIO_AMR
|
PROFILE_AUDIO_AMR
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
lav_open(AVFormatContext **ctx, const char *filename)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0)
|
||||||
|
ret = avformat_open_input(ctx, filename, NULL, NULL);
|
||||||
|
if (ret == 0)
|
||||||
|
avformat_find_stream_info(*ctx, NULL);
|
||||||
|
#else
|
||||||
|
ret = av_open_input_file(ctx, filename, NULL, 0, NULL);
|
||||||
|
if (ret == 0)
|
||||||
|
av_find_stream_info(*ctx);
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
lav_close(AVFormatContext *ctx)
|
||||||
|
{
|
||||||
|
#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0)
|
||||||
|
avformat_close_input(&ctx);
|
||||||
|
#else
|
||||||
|
av_close_input_file(ctx);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(31<<8)+0)
|
||||||
|
# if LIBAVUTIL_VERSION_INT < ((51<<16)+(5<<8)+0)
|
||||||
|
#define AV_DICT_IGNORE_SUFFIX AV_METADATA_IGNORE_SUFFIX
|
||||||
|
#define av_dict_get av_metadata_get
|
||||||
|
typedef AVMetadataTag AVDictionaryEntry;
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This function shamelessly copied from libdlna */
|
/* This function shamelessly copied from libdlna */
|
||||||
#define MPEG_TS_SYNC_CODE 0x47
|
#define MPEG_TS_SYNC_CODE 0x47
|
||||||
#define MPEG_TS_PACKET_LENGTH 188
|
#define MPEG_TS_PACKET_LENGTH 188
|
||||||
@ -745,16 +779,12 @@ GetVideoMetadata(const char * path, char * name)
|
|||||||
strip_ext(name);
|
strip_ext(name);
|
||||||
//DEBUG DPRINTF(E_DEBUG, L_METADATA, " * size: %jd\n", file.st_size);
|
//DEBUG DPRINTF(E_DEBUG, L_METADATA, " * size: %jd\n", file.st_size);
|
||||||
|
|
||||||
#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0)
|
ret = lav_open(&ctx, path);
|
||||||
if( avformat_open_input(&ctx, path, NULL, NULL) != 0 )
|
if( ret != 0 )
|
||||||
#else
|
|
||||||
if( av_open_input_file(&ctx, path, NULL, 0, NULL) != 0 )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
DPRINTF(E_WARN, L_METADATA, "Opening %s failed!\n", path);
|
DPRINTF(E_WARN, L_METADATA, "Opening %s failed!\n", path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
av_find_stream_info(ctx);
|
|
||||||
//dump_format(ctx, 0, NULL, 0);
|
//dump_format(ctx, 0, NULL, 0);
|
||||||
for( i=0; i<ctx->nb_streams; i++)
|
for( i=0; i<ctx->nb_streams; i++)
|
||||||
{
|
{
|
||||||
@ -778,7 +808,7 @@ GetVideoMetadata(const char * path, char * name)
|
|||||||
if( !vc )
|
if( !vc )
|
||||||
{
|
{
|
||||||
/* This must not be a video file. */
|
/* This must not be a video file. */
|
||||||
av_close_input_file(ctx);
|
lav_close(ctx);
|
||||||
if( !is_audio(path) )
|
if( !is_audio(path) )
|
||||||
DPRINTF(E_DEBUG, L_METADATA, "File %s does not contain a video stream.\n", basepath);
|
DPRINTF(E_DEBUG, L_METADATA, "File %s does not contain a video stream.\n", basepath);
|
||||||
free(path_cpy);
|
free(path_cpy);
|
||||||
@ -1561,10 +1591,10 @@ GetVideoMetadata(const char * path, char * name)
|
|||||||
{
|
{
|
||||||
if( ctx->metadata )
|
if( ctx->metadata )
|
||||||
{
|
{
|
||||||
AVMetadataTag *tag = NULL;
|
AVDictionaryEntry *tag = NULL;
|
||||||
|
|
||||||
//DEBUG DPRINTF(E_DEBUG, L_METADATA, "Metadata:\n");
|
//DEBUG DPRINTF(E_DEBUG, L_METADATA, "Metadata:\n");
|
||||||
while( (tag = av_metadata_get(ctx->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)) )
|
while( (tag = av_dict_get(ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)) )
|
||||||
{
|
{
|
||||||
//DEBUG DPRINTF(E_DEBUG, L_METADATA, " %-16s: %s\n", tag->key, tag->value);
|
//DEBUG DPRINTF(E_DEBUG, L_METADATA, " %-16s: %s\n", tag->key, tag->value);
|
||||||
if( strcmp(tag->key, "title") == 0 )
|
if( strcmp(tag->key, "title") == 0 )
|
||||||
@ -1581,7 +1611,7 @@ GetVideoMetadata(const char * path, char * name)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
video_no_dlna:
|
video_no_dlna:
|
||||||
av_close_input_file(ctx);
|
lav_close(ctx);
|
||||||
|
|
||||||
#ifdef TIVO_SUPPORT
|
#ifdef TIVO_SUPPORT
|
||||||
if( ends_with(path, ".TiVo") && is_tivo_file(path) )
|
if( ends_with(path, ".TiVo") && is_tivo_file(path) )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user