comparison libvo/vo_dxr3.c @ 5199:72817be5265f

Automatically use avcodec if it exists, otherwise fall back to fame (due to some unresolved problems with fame) Bitrate is set to a constant 6e6 Fixed a bug occuring with round() Fixed a little #elif bug that would cause compilation to fail when not compiling with avcodec
author mswitch
date Tue, 19 Mar 2002 15:08:15 +0000
parents 83b3dc5132a5
children a4a39919022a
comparison
equal deleted inserted replaced
5198:a528f6c891b5 5199:72817be5265f
73 #include "video_out_internal.h" 73 #include "video_out_internal.h"
74 #include "aspect.h" 74 #include "aspect.h"
75 #include "../postproc/rgb2rgb.h" 75 #include "../postproc/rgb2rgb.h"
76 #include "../postproc/swscale.h" 76 #include "../postproc/swscale.h"
77 77
78 #ifndef USE_LIBAVCODEC
79 # define USE_LIBFAME
80 #else
81 # undef USE_LIBFAME
82 #endif
78 #ifdef USE_LIBFAME 83 #ifdef USE_LIBFAME
79 #include "../libfame/fame.h" 84 #include "../libfame/fame.h"
80 static unsigned char *outbuf = NULL; 85 static unsigned char *outbuf = NULL;
81 static fame_parameters_t fame_params; 86 static fame_parameters_t fame_params;
82 static fame_yuv_t fame_yuv; 87 static fame_yuv_t fame_yuv;
274 } 279 }
275 280
276 fame_params.width = s_width; 281 fame_params.width = s_width;
277 fame_params.height = s_height; 282 fame_params.height = s_height;
278 fame_params.coding = "I"; 283 fame_params.coding = "I";
279 fame_params.quality = 100; 284 fame_params.quality = 90;
280 fame_params.bitrate = 0; 285 fame_params.bitrate = 6e6;
281 fame_params.slices_per_frame = 1; 286 fame_params.slices_per_frame = 1;
282 fame_params.frames_per_sequence = (int) round(vo_fps); 287 fame_params.frames_per_sequence = (int) (vo_fps + 0.5);
283 fame_params.shape_quality = 100; 288 fame_params.shape_quality = 100;
284 fame_params.search_range = 8; 289 fame_params.search_range = 8;
285 fame_params.verbose = 0; 290 fame_params.verbose = 0;
286 fame_params.profile = NULL; 291 fame_params.profile = NULL;
287 292
335 avc_context->gop_size = 18; 340 avc_context->gop_size = 18;
336 } else { 341 } else {
337 avc_context->gop_size = 15; 342 avc_context->gop_size = 15;
338 } 343 }
339 avc_context->frame_rate = (int) vo_fps * FRAME_RATE_BASE; 344 avc_context->frame_rate = (int) vo_fps * FRAME_RATE_BASE;
340 avc_context->bit_rate = 8e6; 345 avc_context->bit_rate = 6e6;
341 avc_context->flags = CODEC_FLAG_HQ | CODEC_FLAG_QSCALE; 346 avc_context->flags = CODEC_FLAG_HQ | CODEC_FLAG_QSCALE;
342 avc_context->quality = 2; 347 avc_context->quality = 2;
343 avc_context->pix_fmt = PIX_FMT_YUV420P; 348 avc_context->pix_fmt = PIX_FMT_YUV420P;
344 if (avcodec_open(avc_context, avc_codec) < 0) { 349 if (avcodec_open(avc_context, avc_codec) < 0) {
345 printf("VO: [dxr3] Unable to open codec\n"); 350 printf("VO: [dxr3] Unable to open codec\n");
421 sws->swScale(sws, src, &srcStride, 0, v_height, picture_data, picture_linesize); 426 sws->swScale(sws, src, &srcStride, 0, v_height, picture_data, picture_linesize);
422 draw_osd(); 427 draw_osd();
423 #ifdef USE_LIBFAME 428 #ifdef USE_LIBFAME
424 size = fame_encode_frame(fame_ctx, &fame_yuv, NULL); 429 size = fame_encode_frame(fame_ctx, &fame_yuv, NULL);
425 write(fd_video, outbuf, size); 430 write(fd_video, outbuf, size);
426 #else USE_LIBAVCODEC 431 #elif USE_LIBAVCODEC
427 size = avcodec_encode_video(avc_context, picture_data[0], avc_outbuf_size, &avc_picture); 432 size = avcodec_encode_video(avc_context, picture_data[0], avc_outbuf_size, &avc_picture);
428 write(fd_video, picture_data[0], size); 433 write(fd_video, picture_data[0], size);
429 #endif 434 #endif
430 return 0; 435 return 0;
431 } 436 }
497 { 502 {
498 char devname[80]; 503 char devname[80];
499 int fdflags = O_WRONLY; 504 int fdflags = O_WRONLY;
500 505
501 #ifdef USE_LIBFAME 506 #ifdef USE_LIBFAME
502 printf("VO: [dxr3] You are using fame, due to a small problem I have to disable prebuffering\n"); 507 printf("VO: [dxr3] Prebuffering is temporarily disabled\n");
503 noprebuf = 1; 508 noprebuf = 1;
504 #else 509 #else
505 /* Open the control interface */ 510 /* Open the control interface */
506 if (arg && !strcmp("noprebuf", arg)) { 511 if (arg && !strcmp("noprebuf", arg)) {
507 printf("VO: [dxr3] Disabling prebuffering.\n"); 512 printf("VO: [dxr3] Disabling prebuffering.\n");