Mercurial > mplayer.hg
comparison libvo/vo_zr.c @ 9976:5843993013a8
fixes to the zr driver (uninit->reinit) by Stephan Bain <sjbain@akamail.com>
author | rik |
---|---|
date | Thu, 24 Apr 2003 17:17:57 +0000 |
parents | 5b39e79af5fe |
children | 2e9b7465d242 |
comparison
equal
deleted
inserted
replaced
9975:3914afe5c0a7 | 9976:5843993013a8 |
---|---|
73 unsigned char *image; | 73 unsigned char *image; |
74 int image_width, image_height, size; | 74 int image_width, image_height, size; |
75 int off_y, off_c, stride; /* for use by 'draw slice/frame' */ | 75 int off_y, off_c, stride; /* for use by 'draw slice/frame' */ |
76 | 76 |
77 unsigned char *buf; /* the jpeg images will be placed here */ | 77 unsigned char *buf; /* the jpeg images will be placed here */ |
78 unsigned int buf_allocated; /* size of the block actually allocated */ | |
78 jpeg_enc_t *j; | 79 jpeg_enc_t *j; |
79 unsigned char *y_data, *u_data, *v_data; /* used by the jpeg encoder */ | 80 unsigned char *y_data, *u_data, *v_data; /* used by the jpeg encoder */ |
80 int y_stride, u_stride, v_stride; /* these point somewhere in image */ | 81 int y_stride, u_stride, v_stride; /* these point somewhere in image */ |
81 | 82 |
82 /* information for (and about) the zoran card */ | 83 /* information for (and about) the zoran card */ |
90 or stretched to fit on the screen? */ | 91 or stretched to fit on the screen? */ |
91 } zr_info_t; | 92 } zr_info_t; |
92 | 93 |
93 static zr_info_t zr_info[ZR_MAX_DEVICES] = { | 94 static zr_info_t zr_info[ZR_MAX_DEVICES] = { |
94 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0, | 95 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0, |
95 0, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | 96 0, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, |
96 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0, | 97 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0, |
97 0, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | 98 0, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, |
98 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0, | 99 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0, |
99 0, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | 100 0, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, |
100 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0, | 101 {1, 1, 1, -1, -1, 2, {0, 0, 0, 0, 0}, NULL, 0, VIDEO_MODE_AUTO, 128, NULL, 0, 0, 0, 0, 0, |
101 0, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; | 102 0, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; |
102 | 103 |
103 | 104 |
104 | 105 |
105 | 106 |
106 #define MJPEG_NBUFFERS 2 | 107 #define MJPEG_NBUFFERS 2 |
230 if (ioctl(zr->vdes, MJPIOC_REQBUFS, &zrq)) { | 231 if (ioctl(zr->vdes, MJPIOC_REQBUFS, &zrq)) { |
231 mp_msg(MSGT_VO, MSGL_ERR, "zr: error requesting %d buffers of size %d\n", zrq.count, zrq.size); | 232 mp_msg(MSGT_VO, MSGL_ERR, "zr: error requesting %d buffers of size %d\n", zrq.count, zrq.size); |
232 return 1; | 233 return 1; |
233 } | 234 } |
234 | 235 |
236 /* the buffer count allocated may be different to the request */ | |
237 zr->buf_allocated = zrq.count * zrq.size; | |
235 zr->buf = (unsigned char*)mmap(0, zrq.count*zrq.size, | 238 zr->buf = (unsigned char*)mmap(0, zrq.count*zrq.size, |
236 PROT_READ|PROT_WRITE, MAP_SHARED, zr->vdes, 0); | 239 PROT_READ|PROT_WRITE, MAP_SHARED, zr->vdes, 0); |
237 | 240 |
238 if (zr->buf == MAP_FAILED) { | 241 if (zr->buf == MAP_FAILED) { |
239 mp_msg(MSGT_VO, MSGL_ERR, "zr: error requesting %d buffers of size %d\n", zrq.count, zrq.size); | 242 mp_msg(MSGT_VO, MSGL_ERR, "zr: error requesting %d buffers of size %d\n", zrq.count, zrq.size); |
240 return 1; | 243 return 1; |
241 } | 244 } |
245 | |
246 zr->queue = 0; | |
247 zr->synco = 0; | |
248 | |
242 return 0; | 249 return 0; |
243 } | 250 } |
244 | 251 |
245 void uninit_zoran(zr_info_t *zr) { | 252 void uninit_zoran(zr_info_t *zr) { |
246 if (zr->image) { | 253 if (zr->image) { |
254 } | 261 } |
255 /* stop streaming */ | 262 /* stop streaming */ |
256 zr->frame = -1; | 263 zr->frame = -1; |
257 if (ioctl(zr->vdes, MJPIOC_QBUF_PLAY, &zr->frame) < 0) | 264 if (ioctl(zr->vdes, MJPIOC_QBUF_PLAY, &zr->frame) < 0) |
258 mp_msg(MSGT_VO, MSGL_ERR, "zr: error stopping playback of last frame\n"); | 265 mp_msg(MSGT_VO, MSGL_ERR, "zr: error stopping playback of last frame\n"); |
266 if (munmap(zr->buf,zr->buf_allocated)) | |
267 mp_msg(MSGT_VO, MSGL_ERR, "zr: error unmapping buffer\n"); | |
259 close(zr->vdes); | 268 close(zr->vdes); |
260 } | 269 } |
261 | 270 |
262 int zr_geometry_sane(geo_t *g, unsigned int width, unsigned int height) { | 271 int zr_geometry_sane(geo_t *g, unsigned int width, unsigned int height) { |
263 if (g->set) { | 272 if (g->set) { |