[main/transcode] Fix some libav compability + log what ffmpeg/libav we are using
This commit is contained in:
parent
7cc9a8b02b
commit
eec98e3b7e
19
configure.ac
19
configure.ac
|
@ -227,15 +227,24 @@ FORK_MODULES_CHECK([FORKED], [LIBAV],
|
|||
[libavfilter/buffersink.h])
|
||||
FORK_CHECK_DECLS([avfilter_graph_parse_ptr],
|
||||
[libavfilter/avfilter.h])
|
||||
FORK_CHECK_DECLS([av_packet_unref], [libavcodec/avcodec.h])
|
||||
FORK_CHECK_DECLS([av_packet_rescale_ts], [libavcodec/avcodec.h])
|
||||
FORK_CHECK_DECLS([av_packet_unref],
|
||||
[libavcodec/avcodec.h])
|
||||
FORK_CHECK_DECLS([av_packet_rescale_ts],
|
||||
[libavcodec/avcodec.h])
|
||||
FORK_CHECK_DECLS([avformat_alloc_output_context2],
|
||||
[libavformat/avformat.h])
|
||||
FORK_CHECK_DECLS([av_frame_alloc], [libavutil/frame.h])
|
||||
FORK_CHECK_DECLS([avformat_network_init],
|
||||
[libavformat/avformat.h])
|
||||
FORK_CHECK_DECLS([av_version_info],
|
||||
[libavutil/avutil.h])
|
||||
FORK_CHECK_DECLS([av_frame_alloc],
|
||||
[libavutil/frame.h])
|
||||
FORK_CHECK_DECLS([av_frame_get_best_effort_timestamp],
|
||||
[libavutil/frame.h])
|
||||
FORK_CHECK_DECLS([av_image_fill_arrays], [libavutil/imgutils.h])
|
||||
FORK_CHECK_DECLS([av_image_get_buffer_size], [libavutil/imgutils.h])
|
||||
FORK_CHECK_DECLS([av_image_fill_arrays],
|
||||
[libavutil/imgutils.h])
|
||||
FORK_CHECK_DECLS([av_image_get_buffer_size],
|
||||
[libavutil/imgutils.h])
|
||||
AC_CHECK_HEADERS([libavutil/channel_layout.h libavutil/mathematics.h])
|
||||
])
|
||||
])
|
||||
|
|
18
src/main.c
18
src/main.c
|
@ -49,6 +49,7 @@
|
|||
#ifdef HAVE_LIBEVENT_PTHREADS
|
||||
# include <event2/thread.h>
|
||||
#endif
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/log.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavfilter/avfilter.h>
|
||||
|
@ -466,6 +467,7 @@ main(int argc, char **argv)
|
|||
char *ffid;
|
||||
char *pidfile;
|
||||
char **buildopts;
|
||||
const char *av_version;
|
||||
const char *gcry_version;
|
||||
sigset_t sigs;
|
||||
int sigfd;
|
||||
|
@ -599,6 +601,18 @@ main(int argc, char **argv)
|
|||
DPRINTF(E_LOG, L_MAIN, "- %s\n", buildopts[i]);
|
||||
}
|
||||
|
||||
#if HAVE_DECL_AV_VERSION_INFO
|
||||
av_version = av_version_info();
|
||||
#else
|
||||
av_version = "(unknown version)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
DPRINTF(E_INFO, L_MAIN, "Initialized with ffmpeg %s\n", av_version);
|
||||
#else
|
||||
DPRINTF(E_INFO, L_MAIN, "Initialized with libav %s\n", av_version);
|
||||
#endif
|
||||
|
||||
ret = av_lockmgr_register(ffmpeg_lockmgr);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
@ -610,7 +624,7 @@ main(int argc, char **argv)
|
|||
|
||||
av_register_all();
|
||||
avfilter_register_all();
|
||||
#if LIBAVFORMAT_VERSION_MAJOR >= 54 || (LIBAVFORMAT_VERSION_MAJOR == 53 && LIBAVFORMAT_VERSION_MINOR >= 13)
|
||||
#if HAVE_DECL_AVFORMAT_NETWORK_INIT
|
||||
avformat_network_init();
|
||||
#endif
|
||||
av_log_set_callback(logger_ffmpeg);
|
||||
|
@ -916,7 +930,7 @@ main(int argc, char **argv)
|
|||
#ifdef HAVE_LIBCURL
|
||||
curl_global_cleanup();
|
||||
#endif
|
||||
#if LIBAVFORMAT_VERSION_MAJOR >= 54 || (LIBAVFORMAT_VERSION_MAJOR == 53 && LIBAVFORMAT_VERSION_MINOR >= 13)
|
||||
#if HAVE_DECL_AVFORMAT_NETWORK_INIT
|
||||
avformat_network_deinit();
|
||||
#endif
|
||||
av_lockmgr_register(NULL);
|
||||
|
|
|
@ -48,6 +48,11 @@
|
|||
|
||||
static char *buildopts[] =
|
||||
{
|
||||
#ifdef HAVE_FFMPEG
|
||||
"ffmpeg",
|
||||
#else
|
||||
"libav",
|
||||
#endif
|
||||
#ifdef ITUNES
|
||||
"iTunes XML",
|
||||
#endif
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavfilter/avfiltergraph.h>
|
||||
#include <libavfilter/avfilter.h>
|
||||
#include <libavfilter/buffersink.h>
|
||||
#include <libavfilter/buffersrc.h>
|
||||
#include <libavutil/opt.h>
|
||||
|
@ -384,7 +384,7 @@ stream_add(struct encode_ctx *ctx, struct stream_ctx *s, enum AVCodecID codec_id
|
|||
}
|
||||
|
||||
if (ctx->ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
|
||||
s->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||
s->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
|
||||
ret = avcodec_open2(s->codec, NULL, NULL);
|
||||
if (ret < 0)
|
||||
|
|
Loading…
Reference in New Issue