# HG changeset patch # User mswitch # Date 1017168462 0 # Node ID 3e81a50e33ffc0c1c22fc79dcdaeb497b76963b4 # Parent 40f87aaaa2f355a0f4d9c3d4c309f115548fc6e9 XorA added the option of switching between fame/avcodec without recompiling. Docs updated accordingly diff -r 40f87aaaa2f3 -r 3e81a50e33ff DOCS/DXR3 --- a/DOCS/DXR3 Tue Mar 26 17:05:09 2002 +0000 +++ b/DOCS/DXR3 Tue Mar 26 18:47:42 2002 +0000 @@ -7,8 +7,10 @@ 1. Requirements * First of all you will need the DXR3/H+ drivers properly installed. - Version 0.10.0 or later. You can find it at + Version 0.12.0 or later. You can find it at http://dxr3.sourceforge.net/ + (you only need to run "make install devices" in em8300-x.y.z/modules + not in the root dir) * Run /configure and make sure that DXR3/H+ support = yes if you want to play files other than mpeg libmp1e should be = yes as well @@ -19,57 +21,40 @@ 2. Usage - - -vo dxr3: For video output : is not - needed unless you have more than one - em8300 device in your computer - -vo dxr3:noprebuf Turn of prebuffering. This is only - needed if you are having sync issues - with normal playback, this will make - playback appear less smooth and will - not use all available cpu power when - playing non-mpeg content. - * With prebuffering A-V: should be - negative, if it's nonnegative your - computer is too slow to properly - play the video and you should - disble prebuffering if you have - sync issues. - Without prebuffering this value - should stay close to 0 at all - times. - * Some very fast computers seems to - have issues with prebuffering. - Blame Sigma for that ;). - You can safely use :noprebuf since - your machines are fast enough to give - you smooth playback anyway. - * If you plan to do other stuff that - uses resources simultaneously with - watching video, this options is - probably preffered as it is much less - sensitive to syncloss. - * If you loose sync do a small seek - (using left/right arrow, it will - resync) - -ao oss: For audio output + -vo dxr3:::Where noprebuf specifies to turn off + prebuffering. This is done automatically + on athlons. If playback is out of sync + try disabling prebuffering. If noprebuf + is left out prebuffering is enabled + (except on athlons). + + = fame/avcodec, avcodec produces + better quality output, but fame is + faster for those of you with slow + machines. The default is to use + libavcodec. Note that you need + libavcodec properly installed (read + DOCS/codecs.html) + + = device number to use in case + you have more than one em8300 card + + Any of these options may be left out, + but they must be specified in this order + i.e. dxr3:fame works, dxr3:1 works but + dxr3:1:avcodec will not. + These new features were added by XorA, + he usually hangs out in #dxr3 on + irc.openprojects.net, let him know + you like it... + -ao oss:/dev/em8300_ma-X For audio output, where X is the device + number (0 if one card) -ac hwac3 For digital audio output instead of analog - -vc mpegpes For mpeg playback + -vc mpegpes For hardware accelerated mpeg playback -aop list=resample:fout=48000 If samplerate is below 44100Hz This does not work with digital audio output (-ac hwac3) - Number of device to use for playback - (if you have more than one card.). - This can usually be left out (-vo dxr3). - Mandrake 8.1 uses devfs by default. If - you are running mandrake 8.1 please use - -vo dxr3:0 - Normally /dev/em8300_ma or - /dev/em8300_ma- - (-ao dxr3:/dev/em8300_ma). If left out - the default oss device will be used - (normally soundcard). MPEG-1, MPEG-2, VCD and DVD Notes There are some important notes to take into account here for optimum playback. @@ -80,14 +65,6 @@ Note that you cannot use -vc mpegpes with movies that aren't mpeg 1 or 2 or you will get an error message saying "Can't find codec for video format...". -* If you run mplayer as root, or set userid root it will use your pc's internal - realtime clockgenerator for syncing. (If your kernel supports it (It's - located in character devices and called "Enhanced realtime clock support")). - Some people report that this has improved playback (which it should), but - others have had problems with it. You will have to experiment yourself with - this to find your optimum setup. - - 3. Contacting me diff -r 40f87aaaa2f3 -r 3e81a50e33ff libvo/vo_dxr3.c --- a/libvo/vo_dxr3.c Tue Mar 26 17:05:09 2002 +0000 +++ b/libvo/vo_dxr3.c Tue Mar 26 18:47:42 2002 +0000 @@ -6,6 +6,10 @@ */ /* ChangeLog added 2002-01-10 + * 2002-03-26: + * XorA added an option parser and support for selecting encoder + * codec. We thank him again. + * * 2002-03-25: * A couple of bugfixes by XorA * @@ -83,11 +87,9 @@ #include "../postproc/swscale.h" #include "../cpudetect.h" -#ifndef USE_LIBAVCODEC -# define USE_LIBFAME -#else -# undef USE_LIBFAME -#endif +#define USE_LIBFAME + +/* Libfame codec initialisation */ #ifdef USE_LIBFAME #include "../libfame/fame.h" static unsigned char *outbuf = NULL; @@ -95,7 +97,10 @@ static fame_yuv_t fame_yuv; static fame_context_t *fame_ctx = NULL; static fame_object_t *fame_obj; -#elif USE_LIBAVCODEC +#endif + +/* libavcodec codec initialisation */ +#ifdef USE_LIBAVCODEC #ifdef USE_LIBAVCODEC_SO #include #else @@ -116,6 +121,21 @@ #endif LIBVO_EXTERN (dxr3) +/* codec control */ +enum MpegCodec +{ + MPG_CODEC_NON, + MPG_CODEC_AVCODEC, + MPG_CODEC_FAME +}; + +#if defined(USE_LIBFAME) +static int mpeg_codec = MPG_CODEC_FAME; +#elif defined(USE_LIBAVCODEC) +static int mpeg_codec = MPG_CODEC_AVCODEC; +#else +statuc int mpeg_codec = MPG_CODEC_NONE; +#endif /* Resolutions and positions */ static int v_width, v_height; @@ -284,7 +304,11 @@ picture_linesize[0] = s_width; picture_linesize[1] = s_width / 2; picture_linesize[2] = s_width / 2; + switch(mpeg_codec) + { #ifdef USE_LIBFAME + case MPG_CODEC_FAME: + printf("VO: [dxr3] Using FAME\n"); fame_ctx = fame_open(); if (!fame_ctx) { printf("VO: [dxr3] Cannot open libFAME!\n"); @@ -340,7 +364,11 @@ fame_yuv.y = picture_data[0]; fame_yuv.u = picture_data[1]; fame_yuv.v = picture_data[2]; -#elif USE_LIBAVCODEC + break; +#endif +#ifdef USE_LIBAVCODEC + case MPG_CODEC_AVCODEC: + printf("VO: [dxr3] Using AVCODEC\n"); avc_codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO); if (!avc_codec) { printf("VO: [dxr3] Unable to find mpeg1video codec\n"); @@ -376,7 +404,10 @@ avc_picture.data[0] = picture_data[0]; avc_picture.data[1] = picture_data[1]; avc_picture.data[2] = picture_data[2]; + break; #endif + } + sws = getSwsContextFromCmdLine(v_width, v_height, img_format, s_width, s_height, IMGFMT_YV12); if (!sws) { printf("vo_vesa: Can't initialize SwScaler\n"); @@ -441,13 +472,21 @@ int size, srcStride = (img_format == IMGFMT_YUY2) ? (v_width * 2) : (v_width * 3); sws->swScale(sws, src, &srcStride, 0, v_height, picture_data, picture_linesize); draw_osd(); + switch(mpeg_codec) + { #ifdef USE_LIBFAME + case MPG_CODEC_FAME: size = fame_encode_frame(fame_ctx, &fame_yuv, NULL); write(fd_video, outbuf, size); -#elif USE_LIBAVCODEC + break; +#endif +#ifdef USE_LIBAVCODEC + case MPG_CODEC_AVCODEC: size = avcodec_encode_video(avc_context, picture_data[0], avc_outbuf_size, &avc_picture); write(fd_video, picture_data[0], size); + break; #endif + } return 0; } return -1; @@ -455,20 +494,29 @@ static void flip_page(void) { + int size; if (!noprebuf) { ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts); } if (img_format == IMGFMT_YV12) { + switch(mpeg_codec) + { #ifdef USE_LIBFAME - int size = fame_encode_frame(fame_ctx, &fame_yuv, NULL); + case MPG_CODEC_FAME: + size = fame_encode_frame(fame_ctx, &fame_yuv, NULL); write(fd_video, outbuf, size); -#elif USE_LIBAVCODEC - int size = avcodec_encode_video(avc_context, picture_data[0], avc_outbuf_size, &avc_picture); + break; +#endif +#ifdef USE_LIBAVCODEC + case MPG_CODEC_AVCODEC: + size = avcodec_encode_video(avc_context, picture_data[0], avc_outbuf_size, &avc_picture); if (!noprebuf) { ioctl(fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts); } write(fd_video, picture_data[0], size); + break; #endif + } } } @@ -487,15 +535,24 @@ if (sws) { freeSwsContext(sws); } + + switch(mpeg_codec) + { #ifdef USE_LIBFAME + case MPG_CODEC_FAME: if (fame_ctx) { fame_close(fame_ctx); } -#elif USE_LIBAVCODEC + break; +#endif +#ifdef USE_LIBAVCODEC + case MPG_CODEC_AVCODEC: if (avc_context) { avcodec_close(avc_context); } + break; #endif + } if (picture_data[0]) { free(picture_data[0]); } @@ -522,13 +579,39 @@ GetCpuCaps(&cpucaps); /* Open the control interface */ - if ((arg && !strcmp("noprebuf", arg)) || cpucaps.has3DNowExt) { + if (arg && !strncmp("noprebuf", arg,8)) { printf("VO: [dxr3] Disabling prebuffering.\n"); noprebuf = 1; fdflags |= O_NONBLOCK; + arg=strchr(arg,':'); + if(arg) arg++; + } + + if(cpucaps.has3DNowExt) + { + printf("VO: [dxr3] fast AMD special disabling prebuffering.\n"); + noprebuf = 1; + fdflags |= O_NONBLOCK; } - if (arg && !noprebuf) { +#if defined(USE_LIBFAME) + printf("VO: [dxr3] FAME supported\n"); + if (arg && !strncmp("fame",arg,4)) { + mpeg_codec=MPG_CODEC_FAME; + arg=strchr(arg,':'); + if(arg) arg++; + } +#endif +#if defined(USE_LIBAVCODEC) + printf("VO: [dxr3] AVCODEC supported\n"); + if (arg && !strncmp("avcodec",arg,7)) { + mpeg_codec=MPG_CODEC_AVCODEC; + arg=strchr(arg,':'); + if(arg) arg++; + } +#endif + + if (arg && arg[0]) { printf("VO: [dxr3] Forcing use of device %s\n", arg); sprintf(devname, "/dev/em8300-%s", arg); } else { @@ -590,10 +673,11 @@ } } -#if !defined(USE_LIBFAME) && defined(USE_LIBAVCODEC) - avcodec_init(); - avcodec_register_all(); -#endif + if(mpeg_codec==MPG_CODEC_AVCODEC) + { + avcodec_init(); + avcodec_register_all(); + } return 0; }