diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 891e4bf9fc..46486245ec 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -608,6 +608,10 @@ lavcopts=mbd=2:trell=yes:v4mv=yes .SH "GENERAL OPTIONS" . .TP +.B \-codecpath +Specify a directory for binary codecs. +. +.TP .B \-codecs\-file (also see \-afm, \-ac, \-vfm, \-vc) Override the standard search path and use the specified file instead of the builtin codecs.conf. diff --git a/DOCS/man/zh_CN/mplayer.1 b/DOCS/man/zh_CN/mplayer.1 index 1589cabd78..fdc0d0f7ae 100644 --- a/DOCS/man/zh_CN/mplayer.1 +++ b/DOCS/man/zh_CN/mplayer.1 @@ -1,4 +1,4 @@ -.\" sync with en/mplayer.1 rev. 30822 +.\" sync with en/mplayer.1 rev. 30868 .\" Encoding: UTF-8 .\" Reminder of hard terms which need better/final solution later: .\" /capture; playtree in parent list; colorkey; retrace; desync; downmix; @@ -7003,6 +7003,45 @@ h参数值。 的像素(默认值:16)。 .RE. . +.TP +.B fixpts[=options] +修正视频帧的呈现时间戳(PTS)。 +默认行为是丢弃传递至下一级滤镜的 PTS,但以下选项可以改变这一行为: +.RSs +.IPs print +打印得到的 PTS。 +.IPs fps= +指定一个每秒帧数值 +.IPs start= +为 PTS 指定一个初始值 +Specify an initial value for the PTS. +.IPs autostart= +使用 +.IR 第 n 个 +得到的 PTS 作为初始 PTS。 +保留所有之前的 PTS,因此如果设置了一个很大的值或设为 \-1 则将完整保留 PTS。 +.IPs autofps= +在自动开始后使用 +.IR 第 n 个 +得到的 PTS 判断帧率。 +.RE +.sp 1 +.RS +.I 示例: +.RE +.PD 0 +.RSs +.IPs "\-vf fixpts=fps=24000/1001,ass,fixpts" +产生一个新的 PTS 序列,将其用于 ASS 字幕,然后将其丢弃。 +在节目结束后时间戳就重置的情况下,生成一个新的序列是有效的;该情形在 DVD 中很常见。 +丢弃该序列对于避免编码器判断错误是有必要的 +.RE +.PD 1 +.sp 1 +.RS +.I 注意: +将该滤镜与任何种类的定位选项(包括 -ss 和 EDL)一同使用可能会产生意想不到的结果。 +.RE . . .SH "通用编码选项(仅用于MENCODER)" @@ -9971,6 +10010,48 @@ Windows CMD.EXE的用户如果尝试使用全部CQM列表时,可能在解析 .TP .B (no)aud 将存取单元的分隔标志写入数据流(默认值:禁用)。 +除非你的目标存储格式需要有存取单元分隔标志,否则不要启用该选项。 +. +.TP +.B overscan= +在媒体流中包含 VUI 全画面模式信息(默认值:禁用)。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B videoformat= +在媒体流中包含 VUI 视频格式信息(默认值:禁用)。 +该选项只是用以描述最初媒体来源的一个提供信息的选项。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B (no)fullrange +在媒体流中包含 VUI 全信号范围信息(默认值:禁用)。 +如果你的源视频不限制信号范围则使用该选项。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B colorprim= +包含元色彩信息(默认值:禁用)。 +该选项可用于色彩修正。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B transfer= +在媒体流中包含 VUI 传输特征信息(默认值:禁用)。 +该选项可用于色彩修正。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B colormatrix= +在媒体流中包含 VUI 矩阵系数(默认值:禁用)。 +该选项可用于色彩修正。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B chromaloc=<0-5> +在媒体流中包含 VUI 色度样本位置信息(默认值:禁用)。 +使用该选项能保证色彩空间转换后色度和亮度平面正确排列。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 . .TP .B log=<\-1\-3> diff --git a/cfg-common-opts.h b/cfg-common-opts.h index 1dea0485ed..f8ba7b446f 100644 --- a/cfg-common-opts.h +++ b/cfg-common-opts.h @@ -31,6 +31,9 @@ #endif #ifdef CONFIG_PRIORITY {"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL}, +#endif +#ifdef CONFIG_WIN32DLL + {"codecpath", &codec_path, CONF_TYPE_STRING, 0, 0, 0, NULL}, #endif {"noconfig", (void *) noconfig_opts, CONF_TYPE_SUBCONFIG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 0, NULL}, diff --git a/configure b/configure index 43aadf4826..facff63e75 100755 --- a/configure +++ b/configure @@ -220,9 +220,6 @@ Installation directories: --localedir=DIR directory for locale tree [PREFIX/share/locale] --libdir=DIR directory for object code libraries [PREFIX/lib] --codecsdir=DIR directory for binary codecs [LIBDIR/codecs] - --win32codecsdir=DIR directory for Windows DLLs [LIBDIR/codecs] - --xanimcodecsdir=DIR directory for XAnim codecs [LIBDIR/codecs] - --realcodecsdir=DIR directory for RealPlayer codecs [LIBDIR/codecs] Optional features: --disable-mencoder disable MEncoder (A/V encoder) compilation [enable] @@ -731,15 +728,6 @@ for ac_option do --codecsdir=*) _codecsdir=$(echo $ac_option | cut -d '=' -f 2) ;; - --win32codecsdir=*) - _win32codecsdir=$(echo $ac_option | cut -d '=' -f 2) - ;; - --xanimcodecsdir=*) - _xanimcodecsdir=$(echo $ac_option | cut -d '=' -f 2) - ;; - --realcodecsdir=*) - _realcodecsdir=$(echo $ac_option | cut -d '=' -f 2) - ;; --localedir=*) _localedir=$(echo $ac_option | cut -d '=' -f 2) ;; @@ -2430,6 +2418,7 @@ if test "$cc_vendor" = "gnu" ; then cc_check -Wdisabled-optimization && CFLAGS="-Wdisabled-optimization $CFLAGS" cc_check -Wundef && CFLAGS="-Wundef $CFLAGS" cc_check -Wmissing-prototypes && CFLAGS="-Wmissing-prototypes $CFLAGS" + cc_check -Wstrict-prototypes && CFLAGS="-Wstrict-prototypes $CFLAGS" else CFLAGS="-D_ISOC99_SOURCE -D_BSD_SOURCE $CFLAGS" fi @@ -2590,14 +2579,12 @@ fi echo "pabsw xmm0, xmm0" > $TMPS yasm_check || _yasm="" if test $_yasm ; then - test "$_mmx" = "yes" && fft_mmx="yes" def_yasm='#define HAVE_YASM 1' - _have_yasm="yes" + have_yasm="yes" echores "$_yasm" else def_yasm='#define HAVE_YASM 0' - fft_mmx="no" - _have_yasm="no" + have_yasm="no" echores "no" fi @@ -6754,8 +6741,7 @@ fi # Fall back on default directory. if test -z "$_codecsdir" ; then _codecsdir="$_libdir/codecs" - mingw32 && _codecsdir="codecs" - os2 && _codecsdir="codecs" + mingw32 || os2 && _codecsdir="codecs" fi @@ -6768,8 +6754,6 @@ if test "$_win32dll" = auto ; then fi if test "$_win32dll" = yes ; then def_win32dll='#define CONFIG_WIN32DLL 1' - test -z "$_win32codecsdir" && _win32codecsdir=$_codecsdir - _res_comment="using $_win32codecsdir" if ! win32 ; then def_win32_loader='#define WIN32_LOADER 1' _win32_emulation=yes @@ -6795,14 +6779,10 @@ if test "$_xanim" = auto ; then fi fi if test "$_xanim" = yes ; then - test -z "$_xanimcodecsdir" && _xanimcodecsdir=$_codecsdir def_xanim='#define CONFIG_XANIM 1' - def_xanim_path="#define XACODEC_PATH \"$_xanimcodecsdir\"" _codecmodules="xanim $_codecmodules" - _res_comment="using $_xanimcodecsdir" else def_xanim='#undef CONFIG_XANIM' - def_xanim_path='#undef XACODEC_PATH' _nocodecmodules="xanim $_nocodecmodules" fi echores "$_xanim" @@ -6818,14 +6798,10 @@ if test "$_real" = auto ; then fi fi if test "$_real" = yes ; then - test -z "$_realcodecsdir" && _realcodecsdir="$_codecsdir" def_real='#define CONFIG_REALCODECS 1' - def_real_path="#define REALCODEC_PATH \"$_realcodecsdir\"" _codecmodules="real $_codecmodules" - _res_comment="using $_realcodecsdir" else def_real='#undef CONFIG_REALCODECS' - def_real_path="#undef REALCODEC_PATH" _nocodecmodules="real $_nocodecmodules" fi echores "$_real" @@ -8074,8 +8050,8 @@ FFMPEG_SOURCE_PATH = $_ffmpeg_source # Some FFmpeg codecs depend on these. Enable them unconditionally for now. CONFIG_AANDCT=yes CONFIG_FFT=yes -CONFIG_FFT_MMX=$fft_mmx CONFIG_GOLOMB=yes +CONFIG_H264DSP=yes CONFIG_LPC=yes CONFIG_MDCT=yes CONFIG_RDFT=yes @@ -8092,7 +8068,7 @@ CONFIG_ZLIB=$_zlib HAVE_PTHREADS = $_pthreads HAVE_SHM = $_shm HAVE_W32THREADS = $_w32threads -HAVE_YASM = $_have_yasm +HAVE_YASM = $have_yasm EOF @@ -8312,13 +8288,11 @@ $def_libnut $def_qtx $def_qtx_win32 $def_real -$def_real_path $def_win32_loader $def_win32dll -#define WIN32_PATH "$_win32codecsdir" $def_xanim -$def_xanim_path $def_xmms +#define BINARY_CODECS_PATH "$_codecsdir" #define XMMS_INPUT_PLUGIN_DIR "$_xmmsplugindir" @@ -8533,8 +8507,11 @@ $def_yasm /* Some FFmpeg codecs depend on these. Enable them unconditionally for now. */ #define CONFIG_AANDCT 1 +#define CONFIG_DCT 1 +#define CONFIG_DWT 1 #define CONFIG_FFT 1 #define CONFIG_GOLOMB 1 +#define CONFIG_H264DSP 1 #define CONFIG_LPC 1 #define CONFIG_MDCT 1 #define CONFIG_RDFT 1 diff --git a/etc/codecs.conf b/etc/codecs.conf index d52e7c7a3d..2c5a89e44d 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -2070,7 +2070,7 @@ videocodec fftheora format 0xFFFC driver ffmpeg dll "theora" - out YV12 + out YV12,422P,444P videocodec vp3 info "On2 Open Source VP3 Codec" @@ -2753,6 +2753,25 @@ videocodec qtcine out BGR32,BGR24,BGR8,Y800,RGB32,RGB24,RGB8 out YV12,YUY2 +videocodec qtaic + info "QuickTime AIC video decoder" + comment "Mac OS X only" + status untested + fourcc icod + driver qtvideo + dll "QuickTime.qts" + out UYVY + +videocodec qtprores + info "Apple ProRes 422 (HQ) decoder" + status working + fourcc apch + fourcc apcn + fourcc apcs + driver qtvideo + dll "AppleProResDecoder.qtx" + out YUY2 + ; VSS codecs (http://vsofts.com/solutions.html): videocodec vsslight @@ -4447,6 +4466,7 @@ audiocodec speex status working comment "Speex driver using libspeex" fourcc 'spx ' + format 0xA109 driver speex dll "speex" diff --git a/get_path.c b/get_path.c index 4a04f9ebb7..ad3c422639 100644 --- a/get_path.c +++ b/get_path.c @@ -40,11 +40,10 @@ #elif defined(__CYGWIN__) #include #include -#elif defined(__OS2__) -#define INCL_DOS -#include #endif +#include "osdep/osdep.h" + char *get_path(const char *filename){ char *homedir; char *buff; @@ -160,36 +159,19 @@ char *get_path(const char *filename){ void set_path_env(void) { /*make our codec dirs available for LoadLibraryA()*/ - char tmppath[MAX_PATH*2 + 1]; char win32path[MAX_PATH]; - char realpath[MAX_PATH]; #ifdef __CYGWIN__ - cygwin_conv_to_full_win32_path(WIN32_PATH,win32path); - strcpy(tmppath,win32path); -#ifdef CONFIG_REALCODECS - cygwin_conv_to_full_win32_path(REALCODEC_PATH,realpath); - sprintf(tmppath,"%s;%s",win32path,realpath); -#endif /*CONFIG_REALCODECS*/ + cygwin_conv_to_full_win32_path(BINARY_CODECS_PATH, win32path); #else /*__CYGWIN__*/ /* Expand to absolute path unless it's already absolute */ - if (!strstr(WIN32_PATH,":") && WIN32_PATH[0] != '\\'){ + if (!strstr(BINARY_CODECS_PATH,":") && BINARY_CODECS_PATH[0] != '\\') { GetModuleFileNameA(NULL, win32path, MAX_PATH); - strcpy(strrchr(win32path, '\\') + 1, WIN32_PATH); + strcpy(strrchr(win32path, '\\') + 1, BINARY_CODECS_PATH); } - else strcpy(win32path,WIN32_PATH); - strcpy(tmppath,win32path); -#ifdef CONFIG_REALCODECS - /* Expand to absolute path unless it's already absolute */ - if (!strstr(REALCODEC_PATH,":") && REALCODEC_PATH[0] != '\\'){ - GetModuleFileNameA(NULL, realpath, MAX_PATH); - strcpy(strrchr(realpath, '\\') + 1, REALCODEC_PATH); - } - else strcpy(realpath,REALCODEC_PATH); - sprintf(tmppath,"%s;%s",win32path,realpath); -#endif /*CONFIG_REALCODECS*/ + else strcpy(win32path, BINARY_CODECS_PATH); #endif /*__CYGWIN__*/ - mp_msg(MSGT_WIN32, MSGL_V,"Setting PATH to %s\n",tmppath); - if (!SetEnvironmentVariableA("PATH", tmppath)) + mp_msg(MSGT_WIN32, MSGL_V, "Setting PATH to %s\n", win32path); + if (!SetEnvironmentVariableA("PATH", win32path)) mp_msg(MSGT_WIN32, MSGL_WARN, "Cannot set PATH!"); } #endif /* (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) */ diff --git a/get_path.h b/get_path.h index 2f1909b601..759356e527 100644 --- a/get_path.h +++ b/get_path.h @@ -24,4 +24,10 @@ char *get_path(const char *filename); void set_path_env(void); +#ifdef CONFIG_WIN32DLL +extern void SetCodecPath(const char *); // in loader/drv.c + +static char *codec_path=NULL; +#endif + #endif /* MPLAYER_GET_PATH_H */ diff --git a/libao2/ao_kai.c b/libao2/ao_kai.c index cc0a3373a7..98a3e49b44 100644 --- a/libao2/ao_kai.c +++ b/libao2/ao_kai.c @@ -38,6 +38,7 @@ #include "mp_msg.h" #include "libvo/fastmemcpy.h" #include "subopt-helper.h" +#include "libavutil/avutil.h" #include "libavutil/fifo.h" static const ao_info_t info = { diff --git a/libmpcodecs/ad_realaud.c b/libmpcodecs/ad_realaud.c index 917f4b13d2..dd8b2947ec 100644 --- a/libmpcodecs/ad_realaud.c +++ b/libmpcodecs/ad_realaud.c @@ -220,9 +220,9 @@ static int preinit(sh_audio_t *sh){ unsigned int result; char *path; - path = malloc(strlen(REALCODEC_PATH)+strlen(sh->codec->dll)+2); + path = malloc(strlen(BINARY_CODECS_PATH) + strlen(sh->codec->dll) + 2); if (!path) return 0; - sprintf(path, REALCODEC_PATH "/%s", sh->codec->dll); + sprintf(path, BINARY_CODECS_PATH "/%s", sh->codec->dll); /* first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones */ @@ -246,8 +246,8 @@ static int preinit(sh_audio_t *sh){ if(raSetDLLAccessPath){ #endif // used by 'SIPR' - path = realloc(path, strlen(REALCODEC_PATH) + 13); - sprintf(path, "DT_Codecs=" REALCODEC_PATH); + path = realloc(path, strlen(BINARY_CODECS_PATH) + 13); + sprintf(path, "DT_Codecs=" BINARY_CODECS_PATH); if(path[strlen(path)-1]!='/'){ path[strlen(path)+1]=0; path[strlen(path)]='/'; @@ -269,13 +269,13 @@ static int preinit(sh_audio_t *sh){ #ifdef CONFIG_WIN32DLL if (dll_type == 1){ if(wraOpenCodec2) - result=wraOpenCodec2(&sh->context,REALCODEC_PATH "\\"); + result = wraOpenCodec2(&sh->context, BINARY_CODECS_PATH "\\"); else result=wraOpenCodec(&sh->context); } else #endif if(raOpenCodec2) - result=raOpenCodec2(&sh->context,REALCODEC_PATH "/"); + result = raOpenCodec2(&sh->context, BINARY_CODECS_PATH "/"); else result=raOpenCodec(&sh->context); if(result){ diff --git a/libmpcodecs/ad_speex.c b/libmpcodecs/ad_speex.c index 4eca5293df..a93a245492 100644 --- a/libmpcodecs/ad_speex.c +++ b/libmpcodecs/ad_speex.c @@ -52,8 +52,15 @@ static int preinit(sh_audio_t *sh) { return 1; } +static int read_le32(const uint8_t **src) { + const uint8_t *p = *src; + *src += 4; + return p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24); +} + static int init(sh_audio_t *sh) { context_t *ctx = calloc(1, sizeof(context_t)); + const uint8_t *hdr = (const uint8_t *)(sh->wf + 1); const SpeexMode *spx_mode; const SpeexStereoState st_st = SPEEX_STEREO_STATE_INIT; // hack if (!sh->wf || sh->wf->cbSize < 80) { @@ -61,6 +68,27 @@ static int init(sh_audio_t *sh) { return 0; } ctx->hdr = speex_packet_to_header((char *)&sh->wf[1], sh->wf->cbSize); + if (!ctx->hdr && sh->wf->cbSize == 0x72 && hdr[0] == 1 && hdr[1] == 0) { + // speex.acm format: raw SpeexHeader dump + ctx->hdr = calloc(1, sizeof(*ctx->hdr)); + hdr += 2; + hdr += 8; // identifier string + hdr += 20; // version string + ctx->hdr->speex_version_id = read_le32(&hdr); + ctx->hdr->header_size = read_le32(&hdr); + ctx->hdr->rate = read_le32(&hdr); + ctx->hdr->mode = read_le32(&hdr); + ctx->hdr->mode_bitstream_version = read_le32(&hdr); + ctx->hdr->nb_channels = read_le32(&hdr); + ctx->hdr->bitrate = read_le32(&hdr); + ctx->hdr->frame_size = read_le32(&hdr); + ctx->hdr->vbr = read_le32(&hdr); + ctx->hdr->frames_per_packet = read_le32(&hdr); + } + if (!ctx->hdr) { + mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Invalid extradata!\n"); + return 0; + } if (ctx->hdr->nb_channels != 1 && ctx->hdr->nb_channels != 2) { mp_msg(MSGT_DECAUDIO, MSGL_WARN, "Invalid number of channels (%i), " "assuming mono\n", ctx->hdr->nb_channels); diff --git a/libmpcodecs/vd_qtvideo.c b/libmpcodecs/vd_qtvideo.c index aeead624e0..ea7aa4eaa1 100644 --- a/libmpcodecs/vd_qtvideo.c +++ b/libmpcodecs/vd_qtvideo.c @@ -44,18 +44,12 @@ static const vd_info_t info = { LIBVD_EXTERN(qtvideo) -//static ComponentDescription desc; // for FindNextComponent() -static ComponentInstance ci=NULL; // codec handle -//static CodecInfo cinfo; // for ImageCodecGetCodecInfo() -//Component prev=NULL; -//ComponentResult cres; // -static CodecCapabilities codeccap; // for decpar -static CodecDecompressParams decpar; // for ImageCodecPreDecompress() -//static ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize() +static mp_image_t* mpi; static Rect OutBufferRect; //the dimensions of our GWorld static GWorldPtr OutBufferGWorld = NULL;//a GWorld is some kind of description for a drawing environment static ImageDescriptionHandle framedescHandle; +static ImageSequence imageSeq; #ifndef CONFIG_QUICKTIME HMODULE WINAPI LoadLibraryA(LPCSTR); @@ -63,24 +57,26 @@ FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR); int WINAPI FreeLibrary(HMODULE); static HINSTANCE qtime_qts; // handle to the preloaded quicktime.qts static HMODULE handler; -static Component (*FindNextComponent)(Component prev,ComponentDescription* desc); -static OSErr (*GetComponentInfo)(Component prev,ComponentDescription* desc,Handle h1,Handle h2,Handle h3); -static long (*CountComponents)(ComponentDescription* desc); static OSErr (*InitializeQTML)(long flags); static OSErr (*EnterMovies)(void); -static ComponentInstance (*OpenComponent)(Component c); -static ComponentResult (*ImageCodecInitialize)(ComponentInstance ci, - ImageSubCodecDecompressCapabilities * cap); -static ComponentResult (*ImageCodecBeginBand)(ComponentInstance ci, - CodecDecompressParams * params, - ImageSubCodecDecompressRecord * drp, - long flags); -static ComponentResult (*ImageCodecGetCodecInfo)(ComponentInstance ci, - CodecInfo * info); -static ComponentResult (*ImageCodecPreDecompress)(ComponentInstance ci, - CodecDecompressParams * params); -static ComponentResult (*ImageCodecBandDecompress)(ComponentInstance ci, - CodecDecompressParams * params); +static OSErr (*ExitMovies)(void); +static OSErr (*DecompressSequenceBegin)(ImageSequence *seqID, + ImageDescriptionHandle desc, + CGrafPtr port, + /*GDHandle*/void* gdh, + const Rect *srcRect, + MatrixRecordPtr matrix, + short mode, + RgnHandle mask, + CodecFlags flags, + CodecQ accuracy, + DecompressorComponent codec); +static OSErr (*DecompressSequenceFrameS)(ImageSequence seqID, + Ptr data, + long dataSize, + CodecFlags inFlags, + CodecFlags *outFlags, + ICMCompletionProcRecordPtr asyncCompletionProc); static PixMapHandle (*GetGWorldPixMap)(GWorldPtr offscreenGWorld); static OSErr (*QTNewGWorldFromPtr)(GWorldPtr *gw, OSType pixelFormat, @@ -91,6 +87,9 @@ static OSErr (*QTNewGWorldFromPtr)(GWorldPtr *gw, void *baseAddr, long rowBytes); static Handle (*NewHandleClear)(Size byteCount); +static void (*DisposeHandle)(Handle h); +static void (*DisposeGWorld)(GWorldPtr offscreenGWorld); +static OSErr (*CDSequenceEnd)(ImageSequence seqID); #endif /* #ifndef CONFIG_QUICKTIME */ // to set/get/query special features/parameters @@ -98,24 +97,18 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ return CONTROL_UNKNOWN; } -static int codec_initialized=0; - // init driver static int init(sh_video_t *sh){ #ifndef CONFIG_QUICKTIME OSErr result = 1; #endif - ComponentResult cres; - ComponentDescription desc; - Component prev=NULL; - CodecInfo cinfo; // for ImageCodecGetCodecInfo() - ImageSubCodecDecompressCapabilities icap; // for ImageCodecInitialize() - codec_initialized = 0; -#ifdef CONFIG_QUICKTIME - EnterMovies(); -#else + if (sh->ImageDesc == NULL) { + mp_msg(MSGT_DECVIDEO,MSGL_ERR,"sh->ImageDesc not set, cannot use binary QuickTime codecs (try -demuxer mov?)\n"); + return 0; + } +#ifndef CONFIG_QUICKTIME #ifdef WIN32_LOADER Setup_LDT_Keeper(); #endif @@ -135,89 +128,29 @@ static int init(sh_video_t *sh){ InitializeQTML = (OSErr (*)(long))GetProcAddress(handler, "InitializeQTML"); EnterMovies = (OSErr (*)(void))GetProcAddress(handler, "EnterMovies"); - FindNextComponent = (Component (*)(Component,ComponentDescription*))GetProcAddress(handler, "FindNextComponent"); - CountComponents = (long (*)(ComponentDescription*))GetProcAddress(handler, "CountComponents"); - GetComponentInfo = (OSErr (*)(Component,ComponentDescription*,Handle,Handle,Handle))GetProcAddress(handler, "GetComponentInfo"); - OpenComponent = (ComponentInstance (*)(Component))GetProcAddress(handler, "OpenComponent"); - ImageCodecInitialize = (ComponentResult (*)(ComponentInstance,ImageSubCodecDecompressCapabilities *))GetProcAddress(handler, "ImageCodecInitialize"); - ImageCodecGetCodecInfo = (ComponentResult (*)(ComponentInstance,CodecInfo *))GetProcAddress(handler, "ImageCodecGetCodecInfo"); - ImageCodecBeginBand = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *,ImageSubCodecDecompressRecord *,long))GetProcAddress(handler, "ImageCodecBeginBand"); - ImageCodecPreDecompress = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *))GetProcAddress(handler, "ImageCodecPreDecompress"); - ImageCodecBandDecompress = (ComponentResult (*)(ComponentInstance,CodecDecompressParams *))GetProcAddress(handler, "ImageCodecBandDecompress"); + ExitMovies = (OSErr (*)(void))GetProcAddress(handler, "ExitMovies"); + DecompressSequenceBegin = (OSErr (*)(ImageSequence*,ImageDescriptionHandle,CGrafPtr,void *,const Rect *,MatrixRecordPtr,short,RgnHandle,CodecFlags,CodecQ,DecompressorComponent))GetProcAddress(handler, "DecompressSequenceBegin"); + DecompressSequenceFrameS = (OSErr (*)(ImageSequence,Ptr,long,CodecFlags,CodecFlags*,ICMCompletionProcRecordPtr))GetProcAddress(handler, "DecompressSequenceFrameS"); GetGWorldPixMap = (PixMapHandle (*)(GWorldPtr))GetProcAddress(handler, "GetGWorldPixMap"); QTNewGWorldFromPtr = (OSErr(*)(GWorldPtr *,OSType,const Rect *,CTabHandle,void*,GWorldFlags,void *,long))GetProcAddress(handler, "QTNewGWorldFromPtr"); NewHandleClear = (OSErr(*)(Size))GetProcAddress(handler, "NewHandleClear"); - // = GetProcAddress(handler, ""); + DisposeHandle = (void (*)(Handle))GetProcAddress(handler, "DisposeHandle"); + DisposeGWorld = (void (*)(GWorldPtr))GetProcAddress(handler, "DisposeGWorld"); + CDSequenceEnd = (OSErr (*)(ImageSequence))GetProcAddress(handler, "CDSequenceEnd"); - if(!InitializeQTML || !EnterMovies || !FindNextComponent || !ImageCodecBandDecompress){ + if(!InitializeQTML || !EnterMovies || !DecompressSequenceBegin || !DecompressSequenceFrameS){ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"invalid qtmlClient.dll!\n"); return 0; } - result=InitializeQTML(6+16); -// result=InitializeQTML(0); + result=InitializeQTML(kInitializeQTMLDisableDirectSound | + kInitializeQTMLUseGDIFlag | + kInitializeQTMLDisableDDClippers); mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"InitializeQTML returned %d\n",result); -// result=EnterMovies(); -// printf("EnterMovies->%d\n",result); #endif /* CONFIG_QUICKTIME */ -#if 0 - memset(&desc,0,sizeof(desc)); - while((prev=FindNextComponent(prev,&desc))){ - ComponentDescription desc2; - unsigned char* c1=&desc2.componentType; - unsigned char* c2=&desc2.componentSubType; - memset(&desc2,0,sizeof(desc2)); -// printf("juhee %p (%p)\n",prev,&desc); - GetComponentInfo(prev,&desc2,NULL,NULL,NULL); - mp_msg(MSGT_DECVIDEO,MSGL_DGB2,"DESC: %c%c%c%c/%c%c%c%c [0x%X/0x%X] 0x%X\n", - c1[3],c1[2],c1[1],c1[0], - c2[3],c2[2],c2[1],c2[0], - desc2.componentType,desc2.componentSubType, - desc2.componentFlags); - } -#endif - - - memset(&desc,0,sizeof(desc)); - desc.componentType= (((unsigned char)'i')<<24)| - (((unsigned char)'m')<<16)| - (((unsigned char)'d')<<8)| - (((unsigned char)'c')); -#if 0 - desc.componentSubType= - (((unsigned char)'S'<<24))| - (((unsigned char)'V')<<16)| - (((unsigned char)'Q')<<8)| - (((unsigned char)'3')); -#else - desc.componentSubType = bswap_32(sh->format); -#endif - desc.componentManufacturer=0; - desc.componentFlags=0; - desc.componentFlagsMask=0; - - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Count = %ld\n",CountComponents(&desc)); - prev=FindNextComponent(NULL,&desc); - if(!prev){ - mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Cannot find requested component\n"); - return 0; - } - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Found it! ID = %p\n",prev); - - ci=OpenComponent(prev); - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ci=%p\n",ci); - - memset(&icap,0,sizeof(icap)); - cres=ImageCodecInitialize(ci,&icap); - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecInitialize->%#x size=%d (%d)\n",cres,icap.recordSize,icap.decompressRecordSize); - - memset(&cinfo,0,sizeof(cinfo)); - cres=ImageCodecGetCodecInfo(ci,&cinfo); - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Flags: compr: 0x%X decomp: 0x%X format: 0x%X\n", - cinfo.compressFlags, cinfo.decompressFlags, cinfo.formatFlags); - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"Codec name: %.*s\n",((unsigned char*)&cinfo.typeName)[0], - ((unsigned char*)&cinfo.typeName)+1); + result=EnterMovies(); + mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"EnterMovies returned %d\n",result); //make a yuy2 gworld OutBufferRect.top=0; @@ -227,27 +160,14 @@ static int init(sh_video_t *sh){ //Fill the imagedescription for our SVQ3 frame //we can probably get this from Demuxer -#if 0 - framedescHandle=(ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription)+200); - printf("framedescHandle=%p *p=%p\n",framedescHandle,*framedescHandle); -{ FILE* f=fopen("/root/.wine/fake_windows/IDesc","r"); - if(!f) printf("filenot found: IDesc\n"); - fread(*framedescHandle,sizeof(ImageDescription)+200,1,f); - fclose(f); -} -#else if(!sh->ImageDesc) sh->ImageDesc=(sh->bih+1); // hack for SVQ3-in-AVI mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageDescription size: %d\n",((ImageDescription*)(sh->ImageDesc))->idSize); framedescHandle=(ImageDescriptionHandle)NewHandleClear(((ImageDescription*)(sh->ImageDesc))->idSize); memcpy(*framedescHandle,sh->ImageDesc,((ImageDescription*)(sh->ImageDesc))->idSize); dump_ImageDescription(*framedescHandle); -#endif -//Find codecscomponent for video decompression -// result = FindCodec ('SVQ1',anyCodec,&compressor,&decompressor ); -// printf("FindCodec SVQ1 returned:%i compressor: 0x%X decompressor: 0x%X\n",result,compressor,decompressor); + (**framedescHandle).cType = bswap_32(sh->format); sh->context = (void *)kYUVSPixelFormat; -#if 1 { int imgfmt = sh->codec->outfmt[sh->outfmtidx]; int qt_imgfmt; @@ -263,7 +183,7 @@ static int init(sh_video_t *sh){ qt_imgfmt = 0x79343230; break; case IMGFMT_UYVY: - qt_imgfmt = kUYVY422PixelFormat; + qt_imgfmt = k2vuyPixelFormat; break; case IMGFMT_YVYU: qt_imgfmt = kYVYU422PixelFormat; @@ -289,45 +209,13 @@ static int init(sh_video_t *sh){ sh->context = (void *)qt_imgfmt; if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,imgfmt)) return 0; } -#else - if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0; -#endif - - return 1; -} - -// uninit driver -static void uninit(sh_video_t *sh){ -#ifdef CONFIG_QUICKTIME - ExitMovies(); -#endif -} - -// decode a frame -static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ - OSErr result = 1; - int i; - mp_image_t* mpi; - ComponentResult cres; - - if(len<=0) return NULL; // skipped frame mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, sh->disp_w, sh->disp_h); - if(!mpi) return NULL; + if(!mpi) return 0; -#ifdef WIN32_LOADER - Setup_FS_Segment(); -#endif - - decpar.data = (char*)data; - decpar.bufferSize = len; - (**framedescHandle).dataSize=len; - -if(!codec_initialized){ result = QTNewGWorldFromPtr( &OutBufferGWorld, -// kYUVSPixelFormat, //pixel format of new GWorld == YUY2 (OSType)sh->context, &OutBufferRect, //we should benchmark if yvu9 is faster for svq3, too 0, @@ -335,88 +223,63 @@ if(!codec_initialized){ 0, mpi->planes[0], mpi->stride[0]); - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"NewGWorldFromPtr returned:%d\n",result); -// if (65536-(result&0xFFFF) != 10000) -// return NULL; - -// printf("IDesc=%d\n",sizeof(ImageDescription)); - - decpar.imageDescription = framedescHandle; - decpar.startLine=0; - decpar.stopLine=(**framedescHandle).height; - decpar.frameNumber = 1; //1 -// decpar.conditionFlags=0xFFD; // first -// decpar.callerFlags=0x2001; // first - decpar.matrixFlags = 0; - decpar.matrixType = 0; - decpar.matrix = 0; - decpar.capabilities=&codeccap; -// decpar.accuracy = 0x1680000; //codecNormalQuality; - decpar.accuracy = codecNormalQuality; -// decpar.port = OutBufferGWorld; -// decpar.preferredOffscreenPixelSize=17207; - -// decpar.sequenceID=malloc(1000); -// memset(decpar.sequenceID,0,1000); - -// SrcRect.top=17207; -// SrcRect.left=0; -// SrcRect.right=0;//image_width; -// SrcRect.bottom=0;//image_height; - -// decpar.srcRect = SrcRect; - decpar.srcRect = OutBufferRect; - - decpar.transferMode = srcCopy; - decpar.dstPixMap = **GetGWorldPixMap( OutBufferGWorld);//destPixmap; - - cres=ImageCodecPreDecompress(ci,&decpar); - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecPreDecompress cres=0x%X\n",cres); - - if(decpar.wantedDestinationPixelTypes) - { OSType *p=*(decpar.wantedDestinationPixelTypes); - if(p) while(*p){ - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"supported csp: 0x%08X %.4s\n",*p,(char *)p); - ++p; - } + if (result) { + mp_msg(MSGT_DECVIDEO,MSGL_ERR,"QTNewGWorldFromPtr result=%d\n",result); + return 0; } + result = DecompressSequenceBegin(&imageSeq, framedescHandle, (CGrafPtr)OutBufferGWorld, + NULL, NULL, NULL, srcCopy, NULL, 0, + codecNormalQuality, 0); + if(result) { + mp_msg(MSGT_DECVIDEO,MSGL_ERR,"DecompressSequenceBegin result=%d\n",result); + return 0; + } -// decpar.conditionFlags=0x10FFF; // first -// decpar.preferredOffscreenPixelSize=17207; - -// decpar.conditionFlags=0x10FFD; // first - -// cres=ImageCodecPreDecompress(ci,&decpar); -// printf("ImageCodecPreDecompress cres=0x%X\n",cres); - - - codec_initialized=1; + return 1; } -#if 0 - if(decpar.frameNumber==124){ - decpar.frameNumber=1; - cres=ImageCodecPreDecompress(ci,&decpar); - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecPreDecompress cres=0x%lX\n",cres); +// uninit driver +static void uninit(sh_video_t *sh){ + OSErr result; + if(OutBufferGWorld) { + DisposeGWorld(OutBufferGWorld); + OutBufferGWorld = NULL; } + if(framedescHandle) { + DisposeHandle((Handle)framedescHandle); + framedescHandle = NULL; + } + if(imageSeq) { + CDSequenceEnd(imageSeq); + imageSeq = 0; + } + result=ExitMovies(); + mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ExitMovies returned %d\n",result); +} + +// decode a frame +static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ + OSErr result = 1; + CodecFlags ignore; + + if(len<=0) return NULL; // skipped frame + +#ifdef WIN32_LOADER + Setup_FS_Segment(); #endif - cres=ImageCodecBandDecompress(ci,&decpar); - - ++decpar.frameNumber; - - if(cres) { - mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageCodecBandDecompress cres=0x%X (-0x%X) %d\n",cres,-cres,cres); - return NULL; + result = DecompressSequenceFrameS(imageSeq, data, len, 0, &ignore, NULL); + if(result) { + mp_msg(MSGT_DECVIDEO,MSGL_ERR,"DecompressSequenceFrameS result=0x%d\n",result); + return NULL; } -// for(i=0;i<8;i++) -// printf("img_base[%d]=%p\n",i,((int*)decpar.dstPixMap.baseAddr)[i]); - if((int)sh->context==0x73797639){ // Sorenson 16-bit YUV -> std YVU9 + int i; - short *src0=(short *)((char*)decpar.dstPixMap.baseAddr+0x20); + PixMap dstPixMap = **GetGWorldPixMap(OutBufferGWorld); + short *src0=(short *)((char*)dstPixMap.baseAddr+0x20); for(i=0;ih;i++){ int x; diff --git a/libmpcodecs/vd_realvid.c b/libmpcodecs/vd_realvid.c index 2331e9d756..be67210f88 100644 --- a/libmpcodecs/vd_realvid.c +++ b/libmpcodecs/vd_realvid.c @@ -292,9 +292,9 @@ static int init(sh_video_t *sh){ mp_msg(MSGT_DECVIDEO,MSGL_V,"realvideo codec id: 0x%08X sub-id: 0x%08X\n",be2me_32(((unsigned int*)extrahdr)[1]),be2me_32(((unsigned int*)extrahdr)[0])); - path = malloc(strlen(REALCODEC_PATH)+strlen(sh->codec->dll)+2); + path = malloc(strlen(BINARY_CODECS_PATH) + strlen(sh->codec->dll) + 2); if (!path) return 0; - sprintf(path, REALCODEC_PATH "/%s", sh->codec->dll); + sprintf(path, BINARY_CODECS_PATH "/%s", sh->codec->dll); /* first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones */ diff --git a/libmpcodecs/vd_xanim.c b/libmpcodecs/vd_xanim.c index a7f98add49..c756c8b8b7 100644 --- a/libmpcodecs/vd_xanim.c +++ b/libmpcodecs/vd_xanim.c @@ -649,7 +649,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ static int init(sh_video_t *sh) { vd_xanim_ctx *priv; - char *def_path = XACODEC_PATH; + char *def_path = BINARY_CODECS_PATH; char dll[1024]; XA_CODEC_HDR codec_hdr; int i; diff --git a/libmpdemux/mpeg_hdr.c b/libmpdemux/mpeg_hdr.c index d91019ad13..4fb1dc22b0 100644 --- a/libmpdemux/mpeg_hdr.c +++ b/libmpdemux/mpeg_hdr.c @@ -251,14 +251,20 @@ int mp4_header_process_vol(mp_mpeg_header_t * picture, unsigned char * buffer) n++; //marker bit - if(getbits(buffer, n, 1)) { //fixed_vop_timeinc - n++; - n = read_timeinc(picture, buffer, n); + if(getbits(buffer, n++, 1)) { //fixed_vop_timeinc + n += read_timeinc(picture, buffer, n); if(picture->timeinc_unit) picture->fps = (float) picture->timeinc_resolution / (float) picture->timeinc_unit; } + n++; //marker bit + picture->display_picture_width = getbits16(buffer, n, 13); + n += 13; + n++; //marker bit + picture->display_picture_height = getbits16(buffer, n, 13); + n += 13; + //fprintf(stderr, "ASPECT: %d, PARW=%d, PARH=%d, TIMEINCRESOLUTION: %d, FIXED_TIMEINC: %d (number of bits: %d), FPS: %u\n", // aspect, aspectw, aspecth, picture->timeinc_resolution, picture->timeinc_unit, picture->timeinc_bits, picture->fps); @@ -276,7 +282,7 @@ void mp4_header_process_vop(mp_mpeg_header_t * picture, unsigned char * buffer) n++; getbits(buffer, n, 1); n++; - n = read_timeinc(picture, buffer, n); + n += read_timeinc(picture, buffer, n); } #define min(a, b) ((a) <= (b) ? (a) : (b)) diff --git a/libmpdemux/video.c b/libmpdemux/video.c index 448824aa04..cf0cc9f6a5 100644 --- a/libmpdemux/video.c +++ b/libmpdemux/video.c @@ -168,6 +168,8 @@ switch(video_codec){ return 0; } mp4_header_process_vop(&picture, &(videobuffer[pos])); + sh_video->disp_w = picture.display_picture_width; + sh_video->disp_h = picture.display_picture_height; units[vop_cnt] = picture.timeinc_unit; vop_cnt++; //mp_msg(MSGT_DECVIDEO,MSGL_V, "TYPE: %d, unit: %d\n", picture.picture_type, picture.timeinc_unit); diff --git a/libvo/gl_common.c b/libvo/gl_common.c index ce65873349..3daeab046d 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -856,168 +856,168 @@ static void gen_spline_lookup_tex(GLenum unit) { } static const char *bilin_filt_template = - "TEX yuv.%c, fragment.texcoord[%c], texture[%c], %s;"; + "TEX yuv.%c, fragment.texcoord[%c], texture[%c], %s;\n"; #define BICUB_FILT_MAIN(textype) \ /* first y-interpolation */ \ - "ADD coord, fragment.texcoord[%c].xyxy, cdelta.xyxw;" \ - "ADD coord2, fragment.texcoord[%c].xyxy, cdelta.zyzw;" \ - "TEX a.r, coord.xyxy, texture[%c], "textype";" \ - "TEX a.g, coord.zwzw, texture[%c], "textype";" \ + "ADD coord, fragment.texcoord[%c].xyxy, cdelta.xyxw;\n" \ + "ADD coord2, fragment.texcoord[%c].xyxy, cdelta.zyzw;\n" \ + "TEX a.r, coord.xyxy, texture[%c], "textype";\n" \ + "TEX a.g, coord.zwzw, texture[%c], "textype";\n" \ /* second y-interpolation */ \ - "TEX b.r, coord2.xyxy, texture[%c], "textype";" \ - "TEX b.g, coord2.zwzw, texture[%c], "textype";" \ - "LRP a.b, parmy.b, a.rrrr, a.gggg;" \ - "LRP a.a, parmy.b, b.rrrr, b.gggg;" \ + "TEX b.r, coord2.xyxy, texture[%c], "textype";\n" \ + "TEX b.g, coord2.zwzw, texture[%c], "textype";\n" \ + "LRP a.b, parmy.b, a.rrrr, a.gggg;\n" \ + "LRP a.a, parmy.b, b.rrrr, b.gggg;\n" \ /* x-interpolation */ \ - "LRP yuv.%c, parmx.b, a.bbbb, a.aaaa;" + "LRP yuv.%c, parmx.b, a.bbbb, a.aaaa;\n" static const char *bicub_filt_template_2D = - "MAD coord.xy, fragment.texcoord[%c], {%e, %e}, {0.5, 0.5};" - "TEX parmx, coord.x, texture[%c], 1D;" - "MUL cdelta.xz, parmx.rrgg, {-%e, 0, %e, 0};" - "TEX parmy, coord.y, texture[%c], 1D;" - "MUL cdelta.yw, parmy.rrgg, {0, -%e, 0, %e};" + "MAD coord.xy, fragment.texcoord[%c], {%e, %e}, {0.5, 0.5};\n" + "TEX parmx, coord.x, texture[%c], 1D;\n" + "MUL cdelta.xz, parmx.rrgg, {-%e, 0, %e, 0};\n" + "TEX parmy, coord.y, texture[%c], 1D;\n" + "MUL cdelta.yw, parmy.rrgg, {0, -%e, 0, %e};\n" BICUB_FILT_MAIN("2D"); static const char *bicub_filt_template_RECT = - "ADD coord, fragment.texcoord[%c], {0.5, 0.5};" - "TEX parmx, coord.x, texture[%c], 1D;" - "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};" - "TEX parmy, coord.y, texture[%c], 1D;" - "MUL cdelta.yw, parmy.rrgg, {0, -1, 0, 1};" + "ADD coord, fragment.texcoord[%c], {0.5, 0.5};\n" + "TEX parmx, coord.x, texture[%c], 1D;\n" + "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};\n" + "TEX parmy, coord.y, texture[%c], 1D;\n" + "MUL cdelta.yw, parmy.rrgg, {0, -1, 0, 1};\n" BICUB_FILT_MAIN("RECT"); #define CALCWEIGHTS(t, s) \ - "MAD "t", {-0.5, 0.1666, 0.3333, -0.3333}, "s", {1, 0, -0.5, 0.5};" \ - "MAD "t", "t", "s", {0, 0, -0.5, 0.5};" \ - "MAD "t", "t", "s", {-0.6666, 0, 0.8333, 0.1666};" \ - "RCP a.x, "t".z;" \ - "RCP a.y, "t".w;" \ - "MAD "t".xy, "t".xyxy, a.xyxy, {1, 1, 0, 0};" \ - "ADD "t".x, "t".xxxx, "s";" \ - "SUB "t".y, "t".yyyy, "s";" + "MAD "t", {-0.5, 0.1666, 0.3333, -0.3333}, "s", {1, 0, -0.5, 0.5};\n" \ + "MAD "t", "t", "s", {0, 0, -0.5, 0.5};\n" \ + "MAD "t", "t", "s", {-0.6666, 0, 0.8333, 0.1666};\n" \ + "RCP a.x, "t".z;\n" \ + "RCP a.y, "t".w;\n" \ + "MAD "t".xy, "t".xyxy, a.xyxy, {1, 1, 0, 0};\n" \ + "ADD "t".x, "t".xxxx, "s";\n" \ + "SUB "t".y, "t".yyyy, "s";\n" static const char *bicub_notex_filt_template_2D = - "MAD coord.xy, fragment.texcoord[%c], {%e, %e}, {0.5, 0.5};" - "FRC coord.xy, coord.xyxy;" + "MAD coord.xy, fragment.texcoord[%c], {%e, %e}, {0.5, 0.5};\n" + "FRC coord.xy, coord.xyxy;\n" CALCWEIGHTS("parmx", "coord.xxxx") - "MUL cdelta.xz, parmx.rrgg, {-%e, 0, %e, 0};" + "MUL cdelta.xz, parmx.rrgg, {-%e, 0, %e, 0};\n" CALCWEIGHTS("parmy", "coord.yyyy") - "MUL cdelta.yw, parmy.rrgg, {0, -%e, 0, %e};" + "MUL cdelta.yw, parmy.rrgg, {0, -%e, 0, %e};\n" BICUB_FILT_MAIN("2D"); static const char *bicub_notex_filt_template_RECT = - "ADD coord, fragment.texcoord[%c], {0.5, 0.5};" - "FRC coord.xy, coord.xyxy;" + "ADD coord, fragment.texcoord[%c], {0.5, 0.5};\n" + "FRC coord.xy, coord.xyxy;\n" CALCWEIGHTS("parmx", "coord.xxxx") - "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};" + "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};\n" CALCWEIGHTS("parmy", "coord.yyyy") - "MUL cdelta.yw, parmy.rrgg, {0, -1, 0, 1};" + "MUL cdelta.yw, parmy.rrgg, {0, -1, 0, 1};\n" BICUB_FILT_MAIN("RECT"); #define BICUB_X_FILT_MAIN(textype) \ - "ADD coord.xy, fragment.texcoord[%c].xyxy, cdelta.xyxy;" \ - "ADD coord2.xy, fragment.texcoord[%c].xyxy, cdelta.zyzy;" \ - "TEX a.r, coord, texture[%c], "textype";" \ - "TEX b.r, coord2, texture[%c], "textype";" \ + "ADD coord.xy, fragment.texcoord[%c].xyxy, cdelta.xyxy;\n" \ + "ADD coord2.xy, fragment.texcoord[%c].xyxy, cdelta.zyzy;\n" \ + "TEX a.r, coord, texture[%c], "textype";\n" \ + "TEX b.r, coord2, texture[%c], "textype";\n" \ /* x-interpolation */ \ - "LRP yuv.%c, parmx.b, a.rrrr, b.rrrr;" + "LRP yuv.%c, parmx.b, a.rrrr, b.rrrr;\n" static const char *bicub_x_filt_template_2D = - "MAD coord.x, fragment.texcoord[%c], {%e}, {0.5};" - "TEX parmx, coord, texture[%c], 1D;" - "MUL cdelta.xyz, parmx.rrgg, {-%e, 0, %e};" + "MAD coord.x, fragment.texcoord[%c], {%e}, {0.5};\n" + "TEX parmx, coord, texture[%c], 1D;\n" + "MUL cdelta.xyz, parmx.rrgg, {-%e, 0, %e};\n" BICUB_X_FILT_MAIN("2D"); static const char *bicub_x_filt_template_RECT = - "ADD coord.x, fragment.texcoord[%c], {0.5};" - "TEX parmx, coord, texture[%c], 1D;" - "MUL cdelta.xyz, parmx.rrgg, {-1, 0, 1};" + "ADD coord.x, fragment.texcoord[%c], {0.5};\n" + "TEX parmx, coord, texture[%c], 1D;\n" + "MUL cdelta.xyz, parmx.rrgg, {-1, 0, 1};\n" BICUB_X_FILT_MAIN("RECT"); static const char *unsharp_filt_template = - "PARAM dcoord%c = {%e, %e, %e, %e};" - "ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;" - "SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;" - "TEX a.r, fragment.texcoord[%c], texture[%c], %s;" - "TEX b.r, coord.xyxy, texture[%c], %s;" - "TEX b.g, coord.zwzw, texture[%c], %s;" - "ADD b.r, b.r, b.g;" - "TEX b.b, coord2.xyxy, texture[%c], %s;" - "TEX b.g, coord2.zwzw, texture[%c], %s;" - "DP3 b, b, {0.25, 0.25, 0.25};" - "SUB b.r, a.r, b.r;" - "MAD yuv.%c, b.r, {%e}, a.r;"; + "PARAM dcoord%c = {%e, %e, %e, %e};\n" + "ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;\n" + "SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;\n" + "TEX a.r, fragment.texcoord[%c], texture[%c], %s;\n" + "TEX b.r, coord.xyxy, texture[%c], %s;\n" + "TEX b.g, coord.zwzw, texture[%c], %s;\n" + "ADD b.r, b.r, b.g;\n" + "TEX b.b, coord2.xyxy, texture[%c], %s;\n" + "TEX b.g, coord2.zwzw, texture[%c], %s;\n" + "DP3 b, b, {0.25, 0.25, 0.25};\n" + "SUB b.r, a.r, b.r;\n" + "MAD yuv.%c, b.r, {%e}, a.r;\n"; static const char *unsharp_filt_template2 = - "PARAM dcoord%c = {%e, %e, %e, %e};" - "PARAM dcoord2%c = {%e, 0, 0, %e};" - "ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;" - "SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;" - "TEX a.r, fragment.texcoord[%c], texture[%c], %s;" - "TEX b.r, coord.xyxy, texture[%c], %s;" - "TEX b.g, coord.zwzw, texture[%c], %s;" - "ADD b.r, b.r, b.g;" - "TEX b.b, coord2.xyxy, texture[%c], %s;" - "TEX b.g, coord2.zwzw, texture[%c], %s;" - "ADD b.r, b.r, b.b;" - "ADD b.a, b.r, b.g;" - "ADD coord, fragment.texcoord[%c].xyxy, dcoord2%c;" - "SUB coord2, fragment.texcoord[%c].xyxy, dcoord2%c;" - "TEX b.r, coord.xyxy, texture[%c], %s;" - "TEX b.g, coord.zwzw, texture[%c], %s;" - "ADD b.r, b.r, b.g;" - "TEX b.b, coord2.xyxy, texture[%c], %s;" - "TEX b.g, coord2.zwzw, texture[%c], %s;" - "DP4 b.r, b, {-0.1171875, -0.1171875, -0.1171875, -0.09765625};" - "MAD b.r, a.r, {0.859375}, b.r;" - "MAD yuv.%c, b.r, {%e}, a.r;"; + "PARAM dcoord%c = {%e, %e, %e, %e};\n" + "PARAM dcoord2%c = {%e, 0, 0, %e};\n" + "ADD coord, fragment.texcoord[%c].xyxy, dcoord%c;\n" + "SUB coord2, fragment.texcoord[%c].xyxy, dcoord%c;\n" + "TEX a.r, fragment.texcoord[%c], texture[%c], %s;\n" + "TEX b.r, coord.xyxy, texture[%c], %s;\n" + "TEX b.g, coord.zwzw, texture[%c], %s;\n" + "ADD b.r, b.r, b.g;\n" + "TEX b.b, coord2.xyxy, texture[%c], %s;\n" + "TEX b.g, coord2.zwzw, texture[%c], %s;\n" + "ADD b.r, b.r, b.b;\n" + "ADD b.a, b.r, b.g;\n" + "ADD coord, fragment.texcoord[%c].xyxy, dcoord2%c;\n" + "SUB coord2, fragment.texcoord[%c].xyxy, dcoord2%c;\n" + "TEX b.r, coord.xyxy, texture[%c], %s;\n" + "TEX b.g, coord.zwzw, texture[%c], %s;\n" + "ADD b.r, b.r, b.g;\n" + "TEX b.b, coord2.xyxy, texture[%c], %s;\n" + "TEX b.g, coord2.zwzw, texture[%c], %s;\n" + "DP4 b.r, b, {-0.1171875, -0.1171875, -0.1171875, -0.09765625};\n" + "MAD b.r, a.r, {0.859375}, b.r;\n" + "MAD yuv.%c, b.r, {%e}, a.r;\n"; static const char *yuv_prog_template = - "PARAM ycoef = {%e, %e, %e};" - "PARAM ucoef = {%e, %e, %e};" - "PARAM vcoef = {%e, %e, %e};" - "PARAM offsets = {%e, %e, %e};" - "TEMP res;" - "MAD res.rgb, yuv.rrrr, ycoef, offsets;" - "MAD res.rgb, yuv.gggg, ucoef, res;" - "MAD result.color.rgb, yuv.bbbb, vcoef, res;" + "PARAM ycoef = {%e, %e, %e};\n" + "PARAM ucoef = {%e, %e, %e};\n" + "PARAM vcoef = {%e, %e, %e};\n" + "PARAM offsets = {%e, %e, %e};\n" + "TEMP res;\n" + "MAD res.rgb, yuv.rrrr, ycoef, offsets;\n" + "MAD res.rgb, yuv.gggg, ucoef, res;\n" + "MAD result.color.rgb, yuv.bbbb, vcoef, res;\n" "END"; static const char *yuv_pow_prog_template = - "PARAM ycoef = {%e, %e, %e};" - "PARAM ucoef = {%e, %e, %e};" - "PARAM vcoef = {%e, %e, %e};" - "PARAM offsets = {%e, %e, %e};" - "PARAM gamma = {%e, %e, %e};" - "TEMP res;" - "MAD res.rgb, yuv.rrrr, ycoef, offsets;" - "MAD res.rgb, yuv.gggg, ucoef, res;" - "MAD_SAT res.rgb, yuv.bbbb, vcoef, res;" - "POW result.color.r, res.r, gamma.r;" - "POW result.color.g, res.g, gamma.g;" - "POW result.color.b, res.b, gamma.b;" + "PARAM ycoef = {%e, %e, %e};\n" + "PARAM ucoef = {%e, %e, %e};\n" + "PARAM vcoef = {%e, %e, %e};\n" + "PARAM offsets = {%e, %e, %e};\n" + "PARAM gamma = {%e, %e, %e};\n" + "TEMP res;\n" + "MAD res.rgb, yuv.rrrr, ycoef, offsets;\n" + "MAD res.rgb, yuv.gggg, ucoef, res;\n" + "MAD_SAT res.rgb, yuv.bbbb, vcoef, res;\n" + "POW result.color.r, res.r, gamma.r;\n" + "POW result.color.g, res.g, gamma.g;\n" + "POW result.color.b, res.b, gamma.b;\n" "END"; static const char *yuv_lookup_prog_template = - "PARAM ycoef = {%e, %e, %e, 0};" - "PARAM ucoef = {%e, %e, %e, 0};" - "PARAM vcoef = {%e, %e, %e, 0};" - "PARAM offsets = {%e, %e, %e, 0.125};" - "TEMP res;" - "MAD res, yuv.rrrr, ycoef, offsets;" - "MAD res.rgb, yuv.gggg, ucoef, res;" - "MAD res.rgb, yuv.bbbb, vcoef, res;" - "TEX result.color.r, res.raaa, texture[%c], 2D;" - "ADD res.a, res.a, 0.25;" - "TEX result.color.g, res.gaaa, texture[%c], 2D;" - "ADD res.a, res.a, 0.25;" - "TEX result.color.b, res.baaa, texture[%c], 2D;" + "PARAM ycoef = {%e, %e, %e, 0};\n" + "PARAM ucoef = {%e, %e, %e, 0};\n" + "PARAM vcoef = {%e, %e, %e, 0};\n" + "PARAM offsets = {%e, %e, %e, 0.125};\n" + "TEMP res;\n" + "MAD res, yuv.rrrr, ycoef, offsets;\n" + "MAD res.rgb, yuv.gggg, ucoef, res;\n" + "MAD res.rgb, yuv.bbbb, vcoef, res;\n" + "TEX result.color.r, res.raaa, texture[%c], 2D;\n" + "ADD res.a, res.a, 0.25;\n" + "TEX result.color.g, res.gaaa, texture[%c], 2D;\n" + "ADD res.a, res.a, 0.25;\n" + "TEX result.color.b, res.baaa, texture[%c], 2D;\n" "END"; static const char *yuv_lookup3d_prog_template = - "TEX result.color, yuv, texture[%c], 3D;" + "TEX result.color, yuv, texture[%c], 3D;\n" "END"; /** @@ -1255,10 +1255,10 @@ static void glSetupYUVFragprog(gl_conversion_params_t *params) { int rect = params->target == GL_TEXTURE_RECTANGLE; static const char prog_hdr[] = "!!ARBfp1.0\n" - "OPTION ARB_precision_hint_fastest;" + "OPTION ARB_precision_hint_fastest;\n" // all scaler variables must go here so they aren't defined // multiple times when the same scaler is used more than once - "TEMP coord, coord2, cdelta, parmx, parmy, a, b, yuv;"; + "TEMP coord, coord2, cdelta, parmx, parmy, a, b, yuv;\n"; int prog_remain; char *yuv_prog, *prog_pos; int cur_texu = 3; diff --git a/loader/drv.c b/loader/drv.c index 9479e6944d..13945538d2 100644 --- a/loader/drv.c +++ b/loader/drv.c @@ -27,7 +27,7 @@ #endif #ifndef WIN32_LOADER -char* def_path=WIN32_PATH; +char* def_path = BINARY_CODECS_PATH; #else extern char* def_path; #endif @@ -71,7 +71,7 @@ void SetCodecPath(const char* path) if(needs_free)free(def_path); if(path==0) { - def_path=WIN32_PATH; + def_path = BINARY_CODECS_PATH; needs_free=0; return; } diff --git a/loader/qt_comp.h b/loader/qt_comp.h index 4c1d8d165c..9da5c35e33 100644 --- a/loader/qt_comp.h +++ b/loader/qt_comp.h @@ -25,6 +25,8 @@ DECL_COMPONENT(yuvu,"YUVU_CDComponentDispatch",0) DECL_COMPONENT(qdm2d,"QDM2Decompressor",0) DECL_COMPONENT(mace3d,"Mace3DecompDispatch",0) +DECL_COMPONENT(prores,"IcpDecompressorComponentDispatch",0) + //DECL_COMPONENT(,"",0) #endif /* MPLAYER_QT_COMP_H */ diff --git a/loader/qtx/qtxsdk/components.h b/loader/qtx/qtxsdk/components.h index 2e42a0412f..19a3219060 100644 --- a/loader/qtx/qtxsdk/components.h +++ b/loader/qtx/qtxsdk/components.h @@ -29,6 +29,14 @@ typedef int32_t SInt32; typedef void *GlobalsPtr; typedef void **Globals; +enum { + kInitializeQTMLNoSoundFlag = (1L << 0), + kInitializeQTMLUseGDIFlag = (1L << 1), + kInitializeQTMLDisableDirectSound = (1L << 2), + kInitializeQTMLUseExclusiveFullScreenModeFlag = (1L << 3), + kInitializeQTMLDisableDDClippers = (1L << 4) +}; + //==================== COMPONENTS =========================== struct __attribute__((__packed__)) ComponentParameters { diff --git a/loader/win32.c b/loader/win32.c index d540e6dfe2..9143702878 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -77,7 +77,7 @@ for DLL to know too much about its environment. #include "osdep/mmap_anon.h" #include "libavutil/avstring.h" -char* def_path = WIN32_PATH; +char* def_path = BINARY_CODECS_PATH; static void do_cpuid(unsigned int ax, unsigned int *regs) { @@ -792,6 +792,18 @@ static void* WINAPI expCreateEventA(void* pSecAttr, char bManualReset, return ret; } +static void* WINAPI expCreateEventW(void* pSecAttr, char bManualReset, + char bInitialState, const WCHAR* name) +{ + char ascii_name[256]; + char *aname = NULL; + if (name) { + WideCharToMultiByte(65001, 0x0, name, -1, ascii_name, 256, NULL, NULL); + aname = ascii_name; + } + return expCreateEventA(pSecAttr, bManualReset, bInitialState, aname); +} + static void* WINAPI expSetEvent(void* event) { mutex_list *ml = (mutex_list *)event; @@ -1798,6 +1810,7 @@ static long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1 if(s2)dbgprintf(" dest: %s\n", s2); return result; } + static long WINAPI expGetVersionExA(OSVERSIONINFOA* c) { dbgprintf("GetVersionExA(0x%x) => 1\n"); @@ -1817,6 +1830,33 @@ static long WINAPI expGetVersionExA(OSVERSIONINFOA* c) " Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 3'\n"); return 1; } + +static long WINAPI expGetVersionExW(OSVERSIONINFOW* c) +{ + char CSDVersion[128]; + dbgprintf("GetVersionExW(0x%x) => 1\n"); + c->dwOSVersionInfoSize=sizeof(*c); + c->dwMajorVersion=5; + c->dwMinorVersion=0; + c->dwBuildNumber=0x5000457; +#if 1 + // leave it here for testing win9x-only codecs + c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS; + strcpy(CSDVersion, " B"); +#else + c->dwPlatformId=VER_PLATFORM_WIN32_NT; // let's not make DLL assume that it can read CR* registers + strcpy(CSDVersion, "Service Pack 3"); +#endif + MultiByteToWideChar(65001, 0x0, CSDVersion, -1, c->szCSDVersion, 128); + dbgprintf(" Major version: %d\n Minor version: %d\n Build number: 0x%08x\n" + " Platform Id: %s\n Version string: '%s'\n", + c->dwMajorVersion, c->dwMinorVersion, c->dwBuildNumber, + (c->dwPlatformId==VER_PLATFORM_WIN32_WINDOWS ? "VER_PLATFORM_WIN32_WINDOWS" : + (c->dwPlatformId==VER_PLATFORM_WIN32_NT ? "VER_PLATFORM_WIN32_NT" : "Unknown")), + CSDVersion); + return 1; +} + static HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count, long max_count, char* name) { @@ -1891,6 +1931,18 @@ static HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count, return ret; } +static HANDLE WINAPI expCreateSemaphoreW(char* v1, long init_count, + long max_count, const WCHAR* name) +{ + char ascii_name[256]; + char *aname = NULL; + if (name) { + WideCharToMultiByte(65001, 0x0, name, -1, ascii_name, 256, NULL, NULL); + aname = ascii_name; + } + return expCreateSemaphoreA(v1, init_count, max_count, aname); +} + static long WINAPI expReleaseSemaphore(long hsem, long increment, long* prev_count) { // The state of a semaphore object is signaled when its count @@ -1977,6 +2029,17 @@ static HANDLE WINAPI expCreateMutexA(void *pSecAttr, return ret; } +static HANDLE WINAPI expCreateMutexW(void *pSecAttr, char bInitialOwner, const WCHAR *name) +{ + char ascii_name[256]; + char *aname = NULL; + if (name) { + WideCharToMultiByte(65001, 0x0, name, -1, ascii_name, 256, NULL, NULL); + aname = ascii_name; + } + return expCreateMutexA(pSecAttr, bInitialOwner, aname); +} + static int WINAPI expReleaseMutex(HANDLE hMutex) { mutex_list *ml = (mutex_list *)hMutex; @@ -5130,6 +5193,7 @@ struct exports exp_kernel32[]= FF(CreateThread, -1) FF(ResumeThread, -1) FF(CreateEventA, -1) + FF(CreateEventW, -1) FF(SetEvent, -1) FF(ResetEvent, -1) FF(WaitForSingleObject, -1) @@ -5169,7 +5233,9 @@ struct exports exp_kernel32[]= FF(MultiByteToWideChar, 427) FF(WideCharToMultiByte, -1) FF(GetVersionExA, -1) + FF(GetVersionExW, -1) FF(CreateSemaphoreA, -1) + FF(CreateSemaphoreW, -1) FF(QueryPerformanceCounter, -1) FF(QueryPerformanceFrequency, -1) FF(LocalHandle, -1) @@ -5181,6 +5247,7 @@ struct exports exp_kernel32[]= FF(LoadResource, -1) FF(ReleaseSemaphore, -1) FF(CreateMutexA, -1) + FF(CreateMutexW, -1) FF(ReleaseMutex, -1) FF(SignalObjectAndWait, -1) FF(FindResourceA, -1) diff --git a/mencoder.c b/mencoder.c index df1c568cb9..bc7a3db059 100644 --- a/mencoder.c +++ b/mencoder.c @@ -272,8 +272,6 @@ static m_time_size_t end_at = { .type = END_AT_NONE, .pos = 0 }; static char * frameno_filename=NULL; -//static uint8_t* flip_upside_down(uint8_t* dst, const uint8_t* src, int width, int height); - typedef struct { unsigned char* start; int in_size; @@ -412,8 +410,6 @@ void add_subtitles(char *filename, float fps, int silent) subdata = subd; } -void print_wave_header(WAVEFORMATEX *h, int verbose_level); - int main(int argc,char* argv[]){ stream_t* stream=NULL; @@ -541,6 +537,11 @@ if (frameno_filename) { set_priority(); #endif +#ifdef CONFIG_WIN32DLL + if (codec_path) + SetCodecPath(codec_path); +#endif + // check font #ifdef CONFIG_FREETYPE init_freetype(); @@ -1676,27 +1677,6 @@ return interrupted; } -#if 0 -/* Flip the image in src and store the result in dst. src and dst may overlap. - width is the size of each line in bytes. */ -static uint8_t* flip_upside_down(uint8_t* dst, const uint8_t* src, int width, - int height) -{ - uint8_t* tmp = malloc(width); - int i; - - for(i = 0; i < height/2; i++) { - fast_memcpy(tmp, &src[i*width], width); - fast_memcpy(&dst[i * width], &src[(height - i) * width], width); - fast_memcpy(&dst[(height - i) * width], tmp, width); - } - - free(tmp); - return dst; -} -#endif - - static float stop_time(demuxer_t* demuxer, muxer_stream_t* mux_v) { float timeleft = -1; if (play_n_frames >= 0) timeleft = mux_v->timer + play_n_frames * (double)(mux_v->h.dwScale) / mux_v->h.dwRate; diff --git a/mplayer.c b/mplayer.c index a27fe13706..b6ddd90f72 100644 --- a/mplayer.c +++ b/mplayer.c @@ -3142,6 +3142,11 @@ int i; set_priority(); #endif +#ifdef CONFIG_WIN32DLL + if (codec_path) + SetCodecPath(codec_path); +#endif + if(opts->video_driver_list && strcmp(opts->video_driver_list[0],"help")==0){ list_video_out(); opt_exit = 1;