Mercurial > mplayer.hg
comparison libvo/vo_dxr3.c @ 4755:67c33b0fb847
Accidentally mixed experimental code with stable one during last commit,
fixed...
Also updated changelog to reflect recent changes
author | mswitch |
---|---|
date | Mon, 18 Feb 2002 18:23:14 +0000 |
parents | ad892563d9c4 |
children | e0122262fb3c |
comparison
equal
deleted
inserted
replaced
4754:ad892563d9c4 | 4755:67c33b0fb847 |
---|---|
4 * Copyright (C) 2002 David Holm <dholm@iname.com> | 4 * Copyright (C) 2002 David Holm <dholm@iname.com> |
5 * | 5 * |
6 */ | 6 */ |
7 | 7 |
8 /* ChangeLog added 2002-01-10 | 8 /* ChangeLog added 2002-01-10 |
9 * 2002-02-18: | |
10 * Fixed sync problems when pausing video (while using prebuffering) | |
11 * | |
9 * 2002-02-16: | 12 * 2002-02-16: |
10 * Fixed bug which would case invalid output when using :noprebuf | 13 * Fixed bug which would case invalid output when using :noprebuf |
11 * Removed equalization code, it caused problems on slow systems | 14 * Removed equalization code, it caused problems on slow systems |
12 * | 15 * |
13 * 2002-02-13: | 16 * 2002-02-13: |
91 static int d_pos_x, d_pos_y; | 94 static int d_pos_x, d_pos_y; |
92 static int osd_w, osd_h; | 95 static int osd_w, osd_h; |
93 static int noprebuf = 0; | 96 static int noprebuf = 0; |
94 static int img_format = 0; | 97 static int img_format = 0; |
95 static SwsContext * sws = NULL; | 98 static SwsContext * sws = NULL; |
96 float scalefactor = 1.0; | |
97 | 99 |
98 /* File descriptors */ | 100 /* File descriptors */ |
99 static int fd_control = -1; | 101 static int fd_control = -1; |
100 static int fd_video = -1; | 102 static int fd_video = -1; |
101 static int fd_spu = -1; | 103 static int fd_spu = -1; |
102 static char fdv_name[80]; | 104 static char fdv_name[80]; |
103 | 105 |
104 /* Static variable used in ioctl's */ | 106 /* Static variable used in ioctl's */ |
105 static int ioval = 0; | 107 static int ioval = 0; |
106 static int ptsdiff = 0; | |
107 static int writesize = 0; | |
108 | 108 |
109 static vo_info_t vo_info = | 109 static vo_info_t vo_info = |
110 { | 110 { |
111 "DXR3/H+ video out", | 111 "DXR3/H+ video out", |
112 "dxr3", | 112 "dxr3", |
240 } else { | 240 } else { |
241 ioval = EM8300_ASPECTRATIO_16_9; | 241 ioval = EM8300_ASPECTRATIO_16_9; |
242 printf("VO: [dxr3] Setting aspect ratio to 16:9\n"); | 242 printf("VO: [dxr3] Setting aspect ratio to 16:9\n"); |
243 } | 243 } |
244 ioctl(fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval); | 244 ioctl(fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval); |
245 | |
246 size = s_width * s_height; | |
247 picture_buf = malloc((size * 3) / 2); | |
248 | 245 |
249 if (format != IMGFMT_MPEGPES) { | 246 if (format != IMGFMT_MPEGPES) { |
250 #ifdef USE_LIBAVCODEC | 247 #ifdef USE_LIBAVCODEC |
251 avc_codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO); | 248 avc_codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO); |
252 if (!avc_codec) { | 249 if (!avc_codec) { |
306 /* Create a pixel buffer and set up pointers for color components */ | 303 /* Create a pixel buffer and set up pointers for color components */ |
307 memset(&avc_picture, 0, sizeof(avc_picture)); | 304 memset(&avc_picture, 0, sizeof(avc_picture)); |
308 avc_picture.linesize[0] = s_width; | 305 avc_picture.linesize[0] = s_width; |
309 avc_picture.linesize[1] = s_width / 2; | 306 avc_picture.linesize[1] = s_width / 2; |
310 avc_picture.linesize[2] = s_width / 2; | 307 avc_picture.linesize[2] = s_width / 2; |
308 size = s_width * s_height; | |
309 picture_buf = malloc((size * 3) / 2); | |
311 | 310 |
312 avc_picture.data[0] = picture_buf; | 311 avc_picture.data[0] = picture_buf; |
313 avc_picture.data[1] = avc_picture.data[0] + size; | 312 avc_picture.data[1] = avc_picture.data[0] + size; |
314 avc_picture.data[2] = avc_picture.data[1] + size / 4; | 313 avc_picture.data[2] = avc_picture.data[1] + size / 4; |
315 if (format == IMGFMT_BGR24) { | 314 if (format == IMGFMT_BGR24) { |
350 } | 349 } |
351 } | 350 } |
352 | 351 |
353 static uint32_t draw_frame(uint8_t * src[]) | 352 static uint32_t draw_frame(uint8_t * src[]) |
354 { | 353 { |
355 if (!noprebuf) { | |
356 ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts); | |
357 } | |
358 if (img_format == IMGFMT_MPEGPES) { | 354 if (img_format == IMGFMT_MPEGPES) { |
359 vo_mpegpes_t *p = (vo_mpegpes_t *) src[0]; | 355 vo_mpegpes_t *p = (vo_mpegpes_t *) src[0]; |
360 | 356 |
361 if (p->id == 0x20) { | 357 if (p->id == 0x20) { |
362 if (!noprebuf) { | 358 if (!noprebuf) { |
363 ioctl(fd_spu, EM8300_IOCTL_SPU_SETPTS, &vo_pts); | 359 ioctl(fd_spu, EM8300_IOCTL_SPU_SETPTS, &vo_pts); |
364 } | 360 } |
365 write(fd_spu, p->data, p->size); | 361 write(fd_spu, p->data, p->size); |
366 } else { | 362 } else { |
367 writesize = p->size; | 363 write(fd_video, p->data, p->size); |
368 memcpy(picture_buf, p->data, p->size); | |
369 } | 364 } |
370 return 0; | 365 return 0; |
371 #ifdef USE_LIBAVCODEC | 366 #ifdef USE_LIBAVCODEC |
372 } else { | 367 } else { |
373 int srcStride = (img_format == IMGFMT_YUY2) ? (v_width * 2) : (v_width * 3); | 368 int size, srcStride = (img_format == IMGFMT_YUY2) ? (v_width * 2) : (v_width * 3); |
374 sws->swScale(sws, src, &srcStride, 0, v_height, avc_picture.data, avc_picture.linesize); | 369 sws->swScale(sws, src, &srcStride, 0, v_height, avc_picture.data, avc_picture.linesize); |
375 draw_osd(); | 370 draw_osd(); |
376 writesize = avcodec_encode_video(avc_context, picture_buf, avc_outbuf_size, &avc_picture); | 371 size = avcodec_encode_video(avc_context, picture_buf, avc_outbuf_size, &avc_picture); |
372 write(fd_video, picture_buf, size); | |
377 return 0; | 373 return 0; |
378 #endif | 374 #endif |
379 } | 375 } |
380 return -1; | 376 return -1; |
381 } | 377 } |
382 | 378 |
383 static void flip_page(void) | 379 static void flip_page(void) |
384 { | 380 { |
381 if (!noprebuf) { | |
382 ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts); | |
383 } | |
385 #ifdef USE_LIBAVCODEC | 384 #ifdef USE_LIBAVCODEC |
386 if (img_format == IMGFMT_YV12) { | 385 if (img_format == IMGFMT_YV12) { |
387 writesize = avcodec_encode_video(avc_context, picture_buf, avc_outbuf_size, &avc_picture); | 386 int size = avcodec_encode_video(avc_context, picture_buf, avc_outbuf_size, &avc_picture); |
388 if (!noprebuf) { | 387 if (!noprebuf) { |
389 ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts); | 388 ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts); |
390 } | 389 } |
391 } | 390 write(fd_video, picture_buf, size); |
392 #endif | 391 } |
393 write(fd_video, picture_buf, writesize); | 392 #endif |
394 writesize = 0; | |
395 } | 393 } |
396 | 394 |
397 static uint32_t draw_slice(uint8_t *srcimg[], int stride[], int w, int h, int x0, int y0) | 395 static uint32_t draw_slice(uint8_t *srcimg[], int stride[], int w, int h, int x0, int y0) |
398 { | 396 { |
399 #ifdef USE_LIBAVCODEC | 397 #ifdef USE_LIBAVCODEC |
413 } | 411 } |
414 #ifdef USE_LIBAVCODEC | 412 #ifdef USE_LIBAVCODEC |
415 if (avc_context) { | 413 if (avc_context) { |
416 avcodec_close(avc_context); | 414 avcodec_close(avc_context); |
417 } | 415 } |
418 #endif | |
419 if (picture_buf) { | 416 if (picture_buf) { |
420 free(picture_buf); | 417 free(picture_buf); |
421 } | 418 } |
419 #endif | |
422 if (fd_video) { | 420 if (fd_video) { |
423 close(fd_video); | 421 close(fd_video); |
424 } | 422 } |
425 if (fd_spu) { | 423 if (fd_spu) { |
426 close(fd_spu); | 424 close(fd_spu); |