Commit 217213c1 authored by Rafaël Carré's avatar Rafaël Carré

libavutil: set verbosity based on VLC own verbosity

parent 071f1afb
...@@ -140,7 +140,7 @@ int OpenAvio(vlc_object_t *object) ...@@ -140,7 +140,7 @@ int OpenAvio(vlc_object_t *object)
} }
/* */ /* */
vlc_init_avformat(); vlc_init_avformat(object);
int ret; int ret;
#if LIBAVFORMAT_VERSION_MAJOR < 54 #if LIBAVFORMAT_VERSION_MAJOR < 54
...@@ -224,7 +224,7 @@ int OutOpenAvio(vlc_object_t *object) ...@@ -224,7 +224,7 @@ int OutOpenAvio(vlc_object_t *object)
sys->context = NULL; sys->context = NULL;
/* */ /* */
vlc_init_avformat(); vlc_init_avformat(object);
if (!access->psz_path) if (!access->psz_path)
goto error; goto error;
......
...@@ -269,7 +269,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -269,7 +269,7 @@ static int OpenDecoder( vlc_object_t *p_this )
} }
/* Initialization must be done before avcodec_find_decoder() */ /* Initialization must be done before avcodec_find_decoder() */
vlc_init_avcodec(); vlc_init_avcodec(p_this);
/* *** ask ffmpeg for a decoder *** */ /* *** ask ffmpeg for a decoder *** */
char *psz_decoder = var_CreateGetString( p_this, "avcodec-codec" ); char *psz_decoder = var_CreateGetString( p_this, "avcodec-codec" );
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#ifdef HAVE_LIBAVUTIL_AVUTIL_H #ifdef HAVE_LIBAVUTIL_AVUTIL_H
# include <libavutil/avutil.h> # include <libavutil/avutil.h>
# include <libavutil/dict.h> # include <libavutil/dict.h>
# include <libavutil/log.h>
#define AV_OPTIONS_TEXT "Advanced options" #define AV_OPTIONS_TEXT "Advanced options"
#define AV_OPTIONS_LONGTEXT "Advanced options, in the form {opt=val,opt2=val2}." #define AV_OPTIONS_LONGTEXT "Advanced options, in the form {opt=val,opt2=val2}."
...@@ -58,16 +59,41 @@ static inline AVDictionary *vlc_av_get_options(const char *psz_opts) ...@@ -58,16 +59,41 @@ static inline AVDictionary *vlc_av_get_options(const char *psz_opts)
} }
return options; return options;
} }
static inline void vlc_init_avutil(vlc_object_t *obj)
{
int level = AV_LOG_QUIET;
if (!var_InheritBool(obj, "quiet")) {
int64_t verbose = var_InheritInteger(obj, "verbose");
if (verbose >= 0) switch(verbose + VLC_MSG_ERR) {
case VLC_MSG_ERR:
level = AV_LOG_ERROR;
break;
case VLC_MSG_WARN:
level = AV_LOG_WARNING;
break;
case VLC_MSG_DBG:
level = AV_LOG_DEBUG;
default:
break;
}
}
av_log_set_level(level);
}
#endif #endif
unsigned GetVlcDspMask( void ); unsigned GetVlcDspMask( void );
#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
# include <libavformat/avformat.h> # include <libavformat/avformat.h>
static inline void vlc_init_avformat(void) static inline void vlc_init_avformat(vlc_object_t *obj)
{ {
vlc_avcodec_lock(); vlc_avcodec_lock();
vlc_init_avutil(obj);
#if LIBAVUTIL_VERSION_CHECK(51, 25, 0, 42, 100) #if LIBAVUTIL_VERSION_CHECK(51, 25, 0, 42, 100)
av_set_cpu_flags_mask( INT_MAX & ~GetVlcDspMask() ); av_set_cpu_flags_mask( INT_MAX & ~GetVlcDspMask() );
#endif #endif
...@@ -80,10 +106,12 @@ static inline void vlc_init_avformat(void) ...@@ -80,10 +106,12 @@ static inline void vlc_init_avformat(void)
#ifdef HAVE_LIBAVCODEC_AVCODEC_H #ifdef HAVE_LIBAVCODEC_AVCODEC_H
# include <libavcodec/avcodec.h> # include <libavcodec/avcodec.h>
static inline void vlc_init_avcodec(void) static inline void vlc_init_avcodec(vlc_object_t *obj)
{ {
vlc_avcodec_lock(); vlc_avcodec_lock();
vlc_init_avutil(obj);
#if LIBAVCODEC_VERSION_MAJOR < 54 #if LIBAVCODEC_VERSION_MAJOR < 54
avcodec_init(); avcodec_init();
#endif #endif
......
...@@ -216,7 +216,7 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -216,7 +216,7 @@ int OpenEncoder( vlc_object_t *p_this )
char *psz_val; char *psz_val;
/* Initialization must be done before avcodec_find_encoder() */ /* Initialization must be done before avcodec_find_encoder() */
vlc_init_avcodec(); vlc_init_avcodec(p_this);
config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg ); config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
......
...@@ -129,7 +129,7 @@ int OpenDemux( vlc_object_t *p_this ) ...@@ -129,7 +129,7 @@ int OpenDemux( vlc_object_t *p_this )
} }
stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_can_seek ); stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_can_seek );
vlc_init_avformat(); vlc_init_avformat(p_this);
char *psz_format = var_InheritString( p_this, "avformat-format" ); char *psz_format = var_InheritString( p_this, "avformat-format" );
if( psz_format ) if( psz_format )
......
...@@ -83,7 +83,7 @@ int OpenMux( vlc_object_t *p_this ) ...@@ -83,7 +83,7 @@ int OpenMux( vlc_object_t *p_this )
sout_mux_sys_t *p_sys; sout_mux_sys_t *p_sys;
char *psz_mux; char *psz_mux;
vlc_init_avformat(); vlc_init_avformat(p_this);
config_ChainParse( p_mux, "sout-avformat-", ppsz_mux_options, p_mux->p_cfg ); config_ChainParse( p_mux, "sout-avformat-", ppsz_mux_options, p_mux->p_cfg );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment