changeset 7905:b062996d9794

added an option for specifying the size of capture buffer
author henry
date Fri, 25 Oct 2002 09:42:41 +0000
parents 98168d30f67d
children 40aa6cf5a66b
files cfg-common.h libmpdemux/tv.c libmpdemux/tv.h libmpdemux/tvi_v4l.c
diffstat 4 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-common.h	Thu Oct 24 22:06:09 2002 +0000
+++ b/cfg-common.h	Fri Oct 25 09:42:41 2002 +0000
@@ -253,6 +253,7 @@
 	{"balance", &tv_param_balance, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
 	{"forcechan", &tv_param_forcechan, CONF_TYPE_INT, CONF_RANGE, 1, 2, NULL},
 	{"forceaudio", &tv_param_force_audio, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"buffersize", &tv_param_buffer_size, CONF_TYPE_INT, CONF_RANGE, 16, 1024, NULL},
 #ifdef HAVE_ALSA9
 	{"alsa", &tv_param_alsa, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 #endif
--- a/libmpdemux/tv.c	Thu Oct 24 22:06:09 2002 +0000
+++ b/libmpdemux/tv.c	Fri Oct 25 09:42:41 2002 +0000
@@ -60,6 +60,7 @@
 int tv_param_balance = -1;
 int tv_param_forcechan = -1;
 int tv_param_force_audio = 0;
+int tv_param_buffer_size = -1;
 #ifdef HAVE_ALSA9
 int tv_param_alsa = 0;
 #endif
--- a/libmpdemux/tv.h	Thu Oct 24 22:06:09 2002 +0000
+++ b/libmpdemux/tv.h	Fri Oct 25 09:42:41 2002 +0000
@@ -32,6 +32,7 @@
 extern int tv_param_balance;
 extern int tv_param_forcechan;
 extern int tv_param_force_audio;
+extern int tv_param_buffer_size;
 #ifdef HAVE_ALSA9
 extern int tv_param_alsa;
 #endif
--- a/libmpdemux/tvi_v4l.c	Thu Oct 24 22:06:09 2002 +0000
+++ b/libmpdemux/tvi_v4l.c	Fri Oct 25 09:42:41 2002 +0000
@@ -579,19 +579,24 @@
 static int get_capture_buffer_size(priv_t *priv)
 {
     int bufsize, cnt;
-#ifdef HAVE_SYS_SYSINFO_H
-    struct sysinfo si;
-    
-    sysinfo(&si);
-    if (si.totalram<2*1024*1024) {
-	bufsize = 1024*1024;
+
+    if (tv_param_buffer_size) {
+	bufsize = tv_param_buffer_size*1024*1024;
     } else {
-	bufsize = si.totalram/2;
-    }
+#ifdef HAVE_SYS_SYSINFO_H
+	struct sysinfo si;
+	
+	sysinfo(&si);
+	if (si.totalram<2*1024*1024) {
+	    bufsize = 1024*1024;
+	} else {
+	    bufsize = si.totalram/2;
+	}
 #else
-    bufsize = 16*1024*1024;
+	bufsize = 16*1024*1024;
 #endif
-
+    }
+    
     cnt = bufsize/(priv->height*priv->bytesperline);
     if (cnt < 2) cnt = 2;