From acc4477cf37bb2b46aae33d3d90335a763cea5b5 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 6 Jul 2004 02:10:22 +0000 Subject: [PATCH] multi-threaded lavc patch by (Loren Merritt ) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12761 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 8 ++++++++ libmpcodecs/ve_lavc.c | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/configure b/configure index 375648f063..8730f47deb 100755 --- a/configure +++ b/configure @@ -2496,8 +2496,12 @@ else fi if test "$_ld_pthread" != '' ; then echores "yes (using $_ld_pthread)" + _pthreads='yes' + _def_pthreads='#define HAVE_PTHREADS 1' else echores "no" + _pthreads='' + _def_pthreads='#undef HAVE_PTHREADS' fi @@ -6134,6 +6138,7 @@ HAVE_MLIB = $_mlib WIN32_LIB = $_ld_win32libs STATIC_LIB = $_ld_static ENCA_LIB = $_ld_enca +HAVE_PTHREADS = $_pthreads X11_INC = $_inc_x11 X11DIR = $_ld_x11 @@ -6478,6 +6483,9 @@ $_def_gettimeofday /* Define this if your system has glob */ $_def_glob +/* Define this if your system has pthreads */ +$_def_pthreads + /* LIRC (remote control, see www.lirc.org) support: */ $_def_lirc diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c index bc5ac55a3f..0569293c03 100644 --- a/libmpcodecs/ve_lavc.c +++ b/libmpcodecs/ve_lavc.c @@ -150,6 +150,7 @@ static int lavc_param_top= -1; static int lavc_param_alt= 0; static int lavc_param_ilme= 0; static int lavc_param_nssew= 8; +static int lavc_param_threads= 1; char *lavc_param_acodec = "mp2"; @@ -292,6 +293,7 @@ m_option_t lavcopts_conf[]={ {"top", &lavc_param_top, CONF_TYPE_INT, CONF_RANGE, -1, 1, NULL}, {"qns", &lavc_param_qns, CONF_TYPE_INT, CONF_RANGE, 0, 1000000, NULL}, {"nssew", &lavc_param_nssew, CONF_TYPE_INT, CONF_RANGE, 0, 1000000, NULL}, + {"threads", &lavc_param_threads, CONF_TYPE_INT, CONF_RANGE, 1, 8, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} }; #endif @@ -661,6 +663,11 @@ static int config(struct vf_instance_s* vf, #endif vf->priv->pic->quality = (int)(FF_QP2LAMBDA * lavc_param_vqscale + 0.5); } + +#if LIBAVCODEC_BUILD >= 4716 + if(lavc_param_threads > 1) + avcodec_thread_init(lavc_venc_context, lavc_param_threads); +#endif if (avcodec_open(lavc_venc_context, vf->priv->codec) != 0) { mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantOpenCodec);