changeset 12760:787a1ce375df

multi-threaded lavc patch by (Loren Merritt <lorenm at u dot washington dot edu>)
author michael
date Tue, 06 Jul 2004 02:10:22 +0000
parents 111a9feec18c
children 236b49c548a5
files configure libmpcodecs/ve_lavc.c
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Mon Jul 05 16:46:54 2004 +0000
+++ b/configure	Tue Jul 06 02:10:22 2004 +0000
@@ -2496,8 +2496,12 @@
 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 @@
 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 @@
 /* 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
 
--- a/libmpcodecs/ve_lavc.c	Mon Jul 05 16:46:54 2004 +0000
+++ b/libmpcodecs/ve_lavc.c	Tue Jul 06 02:10:22 2004 +0000
@@ -150,6 +150,7 @@
 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 @@
 	{"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 @@
 #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);