[Mplayer-cvslog] CVS: main/libvo jpeg_enc.c,1.15,1.16 vo_zr.c,1.22,1.23

Rik Snel CVS rik at mplayerhq.hu
Thu Apr 24 19:18:19 CEST 2003


Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv17571

Modified Files:
	jpeg_enc.c vo_zr.c 
Log Message:
fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain at akamail.com>

Index: jpeg_enc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/jpeg_enc.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- jpeg_enc.c	12 Mar 2003 17:11:34 -0000	1.15
+++ jpeg_enc.c	24 Apr 2003 17:17:57 -0000	1.16
@@ -297,6 +297,7 @@
 	if (j == NULL) return NULL;
 
 	j->s = av_malloc(sizeof(MpegEncContext));
+	memset(j->s,0x00,sizeof(MpegEncContext));
 	if (j->s == NULL) {
 		av_free(j);
 		return NULL;
@@ -314,6 +315,7 @@
 	j->s->height = h;
 	j->s->qscale = q;
 
+	j->s->mjpeg_data_only_frames = 0;
 	j->s->out_format = FMT_MJPEG;
 	j->s->intra_only = 1;
 	j->s->encoding = 1;

Index: vo_zr.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_zr.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- vo_zr.c	11 Nov 2002 15:20:26 -0000	1.22
+++ vo_zr.c	24 Apr 2003 17:17:57 -0000	1.23
@@ -75,6 +75,7 @@
 	int off_y, off_c, stride;    /* for use by 'draw slice/frame' */
 
 	unsigned char *buf;   /* the jpeg images will be placed here */
+	unsigned int buf_allocated; /* size of the block actually allocated */
 	jpeg_enc_t *j;
 	unsigned char *y_data, *u_data, *v_data; /* used by the jpeg encoder */
 	int y_stride, u_stride, v_stride; /* these point somewhere in image */
@@ -92,13 +93,13 @@
 
 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, 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},
+	0, NULL, 0, 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, 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},
+	0, NULL, 0, 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, 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},
+	0, NULL, 0, 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, 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}};
+	0, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
 
 
 
@@ -232,6 +233,8 @@
 		return 1;
 	}
 
+	/* the buffer count allocated may be different to the request */
+	zr->buf_allocated = zrq.count * zrq.size;
 	zr->buf = (unsigned char*)mmap(0, zrq.count*zrq.size, 
 			PROT_READ|PROT_WRITE, MAP_SHARED, zr->vdes, 0);
 
@@ -239,6 +242,10 @@
 		mp_msg(MSGT_VO, MSGL_ERR, "zr: error requesting %d buffers of size %d\n", zrq.count, zrq.size);
 		return 1;
 	}
+
+	zr->queue = 0;
+	zr->synco = 0;
+
 	return 0;
 }
 
@@ -256,6 +263,8 @@
 	zr->frame = -1;
 	if (ioctl(zr->vdes, MJPIOC_QBUF_PLAY, &zr->frame) < 0) 
 		mp_msg(MSGT_VO, MSGL_ERR, "zr: error stopping playback of last frame\n");
+	if (munmap(zr->buf,zr->buf_allocated))
+	   mp_msg(MSGT_VO, MSGL_ERR, "zr: error unmapping buffer\n");
 	close(zr->vdes);
 }
 



More information about the MPlayer-cvslog mailing list