diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-04-26 16:57:25 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-04-26 16:57:25 +0300 |
commit | ff559b8e90c343eb465400d77fe8881eff09c6e3 (patch) | |
tree | f97a23e6945e91be5be86baf2cfc06e0d384e867 | |
parent | d2e25a90c40c47b97becaa6eaefa16e61f7f0cdf (diff) | |
parent | b864ff1b8d73616e2e5bab1e00ef2bdb8fe50278 (diff) | |
download | mpv-ff559b8e90c343eb465400d77fe8881eff09c6e3.tar.bz2 mpv-ff559b8e90c343eb465400d77fe8881eff09c6e3.tar.xz |
Merge svn changes up to r30907
-rw-r--r-- | DOCS/man/en/mplayer.1 | 4 | ||||
-rw-r--r-- | DOCS/man/zh_CN/mplayer.1 | 83 | ||||
-rw-r--r-- | cfg-common-opts.h | 3 | ||||
-rwxr-xr-x | configure | 43 | ||||
-rw-r--r-- | etc/codecs.conf | 22 | ||||
-rw-r--r-- | get_path.c | 34 | ||||
-rw-r--r-- | get_path.h | 6 | ||||
-rw-r--r-- | libao2/ao_kai.c | 1 | ||||
-rw-r--r-- | libmpcodecs/ad_realaud.c | 12 | ||||
-rw-r--r-- | libmpcodecs/ad_speex.c | 28 | ||||
-rw-r--r-- | libmpcodecs/vd_qtvideo.c | 311 | ||||
-rw-r--r-- | libmpcodecs/vd_realvid.c | 4 | ||||
-rw-r--r-- | libmpcodecs/vd_xanim.c | 2 | ||||
-rw-r--r-- | libmpdemux/mpeg_hdr.c | 14 | ||||
-rw-r--r-- | libmpdemux/video.c | 2 | ||||
-rw-r--r-- | libvo/gl_common.c | 234 | ||||
-rw-r--r-- | loader/drv.c | 4 | ||||
-rw-r--r-- | loader/qt_comp.h | 2 | ||||
-rw-r--r-- | loader/qtx/qtxsdk/components.h | 8 | ||||
-rw-r--r-- | loader/win32.c | 69 | ||||
-rw-r--r-- | mencoder.c | 30 | ||||
-rw-r--r-- | mplayer.c | 5 |
22 files changed, 478 insertions, 443 deletions
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 <dir> +Specify a directory for binary codecs. +. +.TP .B \-codecs\-file <filename> (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=<fps> +指定一个每秒帧数值 +.IPs start=<pts> +为 PTS 指定一个初始值 +Specify an initial value for the PTS. +.IPs autostart=<n> +使用 +.IR 第 n 个 +得到的 PTS 作为初始 PTS。 +保留所有之前的 PTS,因此如果设置了一个很大的值或设为 \-1 则将完整保留 PTS。 +.IPs autofps=<n> +在自动开始后使用 +.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=<undef|show|crop> +在媒体流中包含 VUI 全画面模式信息(默认值:禁用)。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B videoformat=<component|pal|ntsc|secam|mac|undef> +在媒体流中包含 VUI 视频格式信息(默认值:禁用)。 +该选项只是用以描述最初媒体来源的一个提供信息的选项。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B (no)fullrange +在媒体流中包含 VUI 全信号范围信息(默认值:禁用)。 +如果你的源视频不限制信号范围则使用该选项。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B colorprim=<bt709|bt470m|bt470bg|smpte170m|smpte240m|film|undef> +包含元色彩信息(默认值:禁用)。 +该选项可用于色彩修正。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B transfer=<bt709|bt470m|bt470bg|linear|log100|log316|smpte170m|smpte240m> +在媒体流中包含 VUI 传输特征信息(默认值:禁用)。 +该选项可用于色彩修正。 +参见 x264 源代码中的 doc/vui.txt 以获取更多信息。 +. +.TP +.B colormatrix=<bt709|fcc|bt470bg|smpte170m|smpte240m|GBR|YCgCo> +在媒体流中包含 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 @@ -32,6 +32,9 @@ #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}, // ------------------------- stream options -------------------- @@ -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 <windows.h> #include <sys/cygwin.h> -#elif defined(__OS2__) -#define INCL_DOS -#include <os2.h> #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); - } - 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); + strcpy(strrchr(win32path, '\\') + 1, BINARY_CODECS_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; -} |