[Mplayer-cvslog] CVS: main/libvo vo_zr.c,1.20,1.21
Rik Snel CVS
rik at mplayerhq.hu
Tue Oct 29 20:06:29 CET 2002
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv20052
Modified Files:
vo_zr.c
Log Message:
some card/mobo combos can't handle buffers larger than 128kB, we change the default buffer to 128kB, add warnings if the buffer becomes full, add a commandline option to enlarge the buffer and give suggestions to users to lessen the buffer size requirements (lower quality/resolution). 128kB should, however, be enough for everybody :-). Bug reported by Brain Edmonds, cause explained (to allow me to fix the driver) by Ronald Bultje (mjpegtools developer)
Index: vo_zr.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_zr.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- vo_zr.c 24 Oct 2002 21:34:54 -0000 1.20
+++ vo_zr.c 29 Oct 2002 19:06:26 -0000 1.21
@@ -66,6 +66,7 @@
char *device; /* /dev/video1 */
int bw; /* if bw == 1, display in black&white */
int norm; /* PAL/NTSC */
+ int buffer_size; /* MJPEG buffer size */
/* buffers + pointers + info */
@@ -90,20 +91,20 @@
} zr_info_t;
static zr_info_t zr_info[ZR_MAX_DEVICES] = {
- {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, NULL, 0, 0, 0, 0, 0,
+ {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0,
0, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, NULL, 0, 0, 0, 0, 0,
+ {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0,
0, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, NULL, 0, 0, 0, 0, 0,
+ {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0,
0, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, NULL, 0, 0, 0, 0, 0,
+ {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0,
0, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
#define MJPEG_NBUFFERS 2
-#define MJPEG_SIZE 1024*256
+/*#define MJPEG_SIZE 1024*128*/
int zoran_getcap(zr_info_t *zr) {
@@ -224,7 +225,7 @@
}
zrq.count = MJPEG_NBUFFERS;
- zrq.size = MJPEG_SIZE;
+ zrq.size = 1024*zr->buffer_size;
if (ioctl(zr->vdes, MJPIOC_REQBUFS, &zrq)) {
mp_msg(MSGT_VO, MSGL_ERR, "zr: error requesting %d buffers of size %d\n", zrq.count, zrq.size);
@@ -500,7 +501,9 @@
k+=jpeg_enc_frame(zr->j, zr->y_data + i*zr->y_stride,
zr->u_data + i*zr->u_stride,
zr->v_data + i*zr->v_stride,
- zr->buf+zr->frame*MJPEG_SIZE+k);
+ zr->buf+
+ 1024*zr->frame*zr->buffer_size+k);
+ if (k > 1024*zr->buffer_size) mp_msg(MSGT_VO, MSGL_WARN, "zr: jpeg image too large or buffer size too small, try -zrbsize 256. If your\nmotherboard/card combo can't handle that: lower the jpeg encoding quality\nor the resolution of the movie. Image may become distorted, MPlayer may crash.\nDon't bugreport, it is a known problem. The standard buffer size of 128kB\nshould be sufficient and is a safe-for-almost-all choice.\n");
}
/* Warning: Only the first jpeg image contains huffman- and
* quantisation tables, so don't expect files other than
@@ -693,6 +696,11 @@
if (i != 1 && i != 2 && i != 4) return ERR_OUT_OF_RANGE;
zr->hdec = i;
return 1;
+ }else if (!strcasecmp(opt, "zrbsize")) {
+ i = atoi(param);
+ if (i < 32) return ERR_OUT_OF_RANGE;
+ zr->buffer_size = i;
+ return 1;
}else if (!strcasecmp(opt, "zrvdec")) {
i = atoi(param);
if (i != 1 && i != 2 && i != 4) return ERR_OUT_OF_RANGE;
@@ -745,6 +753,11 @@
" -zrquality jpeg compression quality [BEST] 1 - 20 [VERY BAD]\n"
" -zrdev playback device (example -zrdev /dev/video1)\n"
" -zrnorm specify norm PAL/NTSC (default: leave at current setting)\n"
+ " -zrbsize set the MPJEG buffer size to a number of kilobytes (def. 128)\n"
+ " use this if MPlayer complains about the MJPEG buffer size\n"
+ " being too small, 256kB is recommended. If your card/mobo\n"
+ " doesn't allow buffers > 128kB lower the jpeg encoding\n"
+ " quality or the resolution of the movie\n"
"\n"
"Cinerama support: additional occurances of -zrcrop activate cinerama mode,\n"
"suppose you have a 704x272 movie, two DC10+ cards and two beamers (or tv's),\n"
@@ -780,6 +793,8 @@
zr->fd=0;
else if (!strcasecmp(param, "zrcrop"))
zr->g.set = zr->g.xoff = zr->g.yoff = 0;
+ else if (!strcasecmp(param, "zrbsize"))
+ zr->buffer_size = 128;
else if (!strcasecmp(param, "zrhdec"))
zr->hdec = 1;
else if (!strcasecmp(param, "zrvdec"))
More information about the MPlayer-cvslog
mailing list