diff options
-rw-r--r-- | DOCS/man/en/mplayer.1 | 7 | ||||
-rw-r--r-- | DOCS/man/zh_CN/mplayer.1 | 21 | ||||
-rw-r--r-- | DOCS/tech/mirrors/update_mplayer_rsync | 9 | ||||
-rw-r--r-- | DOCS/tech/nut.txt | 6 | ||||
-rw-r--r-- | DOCS/tech/oggless-xiph-codecs.txt | 6 | ||||
-rw-r--r-- | DOCS/tech/svn-howto.txt | 6 | ||||
-rw-r--r-- | DOCS/xml/en/video.xml | 4 | ||||
-rwxr-xr-x | configure | 73 | ||||
-rw-r--r-- | libao2/ao_mpegpes.c | 17 | ||||
-rw-r--r-- | libmpcodecs/vd_dmo.c | 4 | ||||
-rw-r--r-- | libmpcodecs/vd_dshow.c | 4 | ||||
-rw-r--r-- | libvo/geometry.c | 93 | ||||
-rw-r--r-- | libvo/vo_fbdev.c | 16 | ||||
-rw-r--r-- | libvo/vo_mpegpes.c | 21 | ||||
-rw-r--r-- | loader/win32.c | 92 | ||||
-rw-r--r-- | osdep/osdep.h | 19 | ||||
-rw-r--r-- | osdep/priority.c | 25 | ||||
-rw-r--r-- | stream/dvb_tune.c | 292 | ||||
-rw-r--r-- | stream/dvbin.h | 24 | ||||
-rw-r--r-- | stream/stream_dvb.c | 9 | ||||
-rw-r--r-- | stream/stream_file.c | 8 | ||||
-rw-r--r-- | stream/stream_vcd.c | 17 | ||||
-rw-r--r-- | stream/vcd_read_os2.h | 237 |
23 files changed, 457 insertions, 553 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 427260187a..beb16e4551 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -3114,13 +3114,16 @@ Fixes fullscreen switching on OpenBox 1.x. .PD 1 . .TP -.B \-geometry x[%][:y[%]] or [WxH][+x+y] +.B \-geometry x[%][:y[%]] or [WxH][+-x+-y] Adjust where the output is on the screen initially. The x and y specifications are in pixels measured from the top-left of the screen to the top-left of the image being displayed, however if a percentage sign is given after the argument it turns the value into a percentage of the screen size in that direction. -It also supports the standard X11 \-geometry option format. +It also supports the standard X11 \-geometry option format, in which e.g. ++10-50 means "place 10 pixels from the left border and 50 pixels from the lower +border" and "--20+-10" means "place 20 pixels beyond the right and 10 pixels +beyond the top border". If an external window is specified using the \-wid option, then the x and y coordinates are relative to the top-left corner of the window rather than the screen. diff --git a/DOCS/man/zh_CN/mplayer.1 b/DOCS/man/zh_CN/mplayer.1 index 4ea42df5d6..1589cabd78 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. 30677 +.\" sync with en/mplayer.1 rev. 30822 .\" Encoding: UTF-8 .\" Reminder of hard terms which need better/final solution later: .\" /capture; playtree in parent list; colorkey; retrace; desync; downmix; @@ -2676,11 +2676,11 @@ OS/2 KAI 音频输出驱动 .PD 0 .RSs .IPs uniaud -强制使用 UNIAUD 模式 +强制使用 UNIAUD 模式。 .IPs dart -强制使用 DART 模式 +强制使用 DART 模式。 .IPs (no)share -以共享或独占模式打开音频 +以共享或独占模式打开音频。 .IPs bufsize=<size> 设置缓冲大小为 <size>,以采样数为单位(默认值:2048)。 .RE @@ -2946,13 +2946,14 @@ VESA 帧缓冲不支持改变模式。 .PD 1 . .TP -.B \-geometry x[%][:y[%]] or [WxH][+x+y] +.B \-geometry x[%][:y[%]] 或 [WxH][+-x+-y] 调整屏幕输出的初始位置。 x 和 y 代表从屏幕左上角到显示图像左上角的距离(以像素为单位)。 不过如果在参数值后有百分号记号, 参数值就变为该方向上的屏幕尺寸的百分数。 -它也支持标准 X11 的 \-geometry 选项格式。 -如果使用 \-wid 选项指定了外部窗口, -那么 x 和 y 坐标是相对于窗口而不是屏幕的左上角。 +它也支持标准 X11 的 \-geometry 选项格式。在这种方式下,例如,‘+10-50’表示“放在距左 +边界 10 个像素,距下边界 50 个像素的地方”,而‘--20+-10’表示“放在越出右边界 20 个像 +素,越出上边界 10 个像素的地方。” +如果使用 \-wid 选项指定了外部窗口,那么 x 和 y 坐标是相对于窗口而不是屏幕的左上角。 坐标是相对于 \-xineramascreen 选项给出的屏幕,该屏幕用于完全支持 \-xineramascreen 的 视频输出的驱动(direct3d、gl、gl2、vdpau、x11、xv、xvmc、corevideo)。 The coordinates are relative to the screen given with \-xineramascreen for @@ -5427,6 +5428,10 @@ Completely empties the filter list. 计数值,用以决定多少帧后 cropdetect 将重置先前侦测到的最大视频区域,并重 新侦测当前的最优切割区域。该选项在电视台台标影响了视频区域时可能有用。0 表示从不重置而是返回播放过程中遇到的最大区域。(默认值:0)。 +计数值,用以决定多少帧后 cropdetect 将重置先前侦测到的最大视频区域,并 +重新开始侦测当前的最优切割区域(默认值:0)。 +该选项在频道台标破坏了视频区域的情况下很有效。 +0 代表从不重置并返回整个播放过程中遇到的最大视频区域。 .RE .PD 1 . diff --git a/DOCS/tech/mirrors/update_mplayer_rsync b/DOCS/tech/mirrors/update_mplayer_rsync index cafaabe594..563ec77bc7 100644 --- a/DOCS/tech/mirrors/update_mplayer_rsync +++ b/DOCS/tech/mirrors/update_mplayer_rsync @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # MPlayer mirroring script # $Id$ @@ -10,7 +10,7 @@ MAILADR=<report_mail_to_adr> #TMPDIR = /tmp #export TMPDIR -TMPFILE=`mktemp -t mplayer.XXXXXXXXXXX` +TMPFILE=$(mktemp -t mplayer.XXXXXXXXXXX) # Check to see if another sync is in progress if lockfile -! -l 43200 -r 0 "$LOCK"; then @@ -30,9 +30,8 @@ rsync -pxlrHtWv --delete --delete-after --exclude '/benchmark' \ --exclude '/old_stuff' --exclude '/tests' rsync.mplayerhq.hu::ftp/ \ MPlayer >> $TMPFILE 2>&1 -x=`wc -l $TMPFILE | awk '{print $1}'` -if [ "$x" -ne "10" ] -then +x=$(wc -l $TMPFILE | awk '{print $1}') +if [ "$x" -ne "10" ]; then mailx -s "MPlayer mirror" $MAILADR < $TMPFILE fi rm -f $TMPFILE diff --git a/DOCS/tech/nut.txt b/DOCS/tech/nut.txt deleted file mode 100644 index 0d26d5f42b..0000000000 --- a/DOCS/tech/nut.txt +++ /dev/null @@ -1,6 +0,0 @@ -The NUT specification has been moved to another Subversion repository. -You can find it at: -http://svn.mplayerhq.hu/nut/docs/nut.txt?view=markup - -Its future location will be in a git repository. This file will be -updated when its location changes again. diff --git a/DOCS/tech/oggless-xiph-codecs.txt b/DOCS/tech/oggless-xiph-codecs.txt deleted file mode 100644 index 2b780b70de..0000000000 --- a/DOCS/tech/oggless-xiph-codecs.txt +++ /dev/null @@ -1,6 +0,0 @@ -oggless-xiph-codecs.txt has been moved to another Subversion repository. -You can find it at: -http://svn.mplayerhq.hu/nut/docs/oggless-xiph-codecs.txt?view=markup - -Its future location will be in a git repository. This file will be -updated when its location changes again. diff --git a/DOCS/tech/svn-howto.txt b/DOCS/tech/svn-howto.txt index 054e18b4f3..932dad237d 100644 --- a/DOCS/tech/svn-howto.txt +++ b/DOCS/tech/svn-howto.txt @@ -21,10 +21,14 @@ http://svnbook.org/ For more information about the Subversion project, visit -http://subversion.tigris.org/ +http://subversion.apache.org/ Consult these resources whenever you have problems, they are quite exhaustive. +You do not need a special checkout that works through ssh or similar in order +to be able to commit changes. All you need is the username and password pair +that you received from the MPlayer Subversion server admin. + What follows now is a basic introduction to Subversion and some MPlayer-specific guidelines. Read it at least once, if you are granted commit privileges to the MPlayer project you are expected to be familiar with these rules. diff --git a/DOCS/xml/en/video.xml b/DOCS/xml/en/video.xml index d4eda61ae8..001aaff90b 100644 --- a/DOCS/xml/en/video.xml +++ b/DOCS/xml/en/video.xml @@ -1754,10 +1754,6 @@ If you want to do software transcoding you should have at least a 1GHz CPU. <para> Configure should detect your DVB card. If it did not, force detection with <screen>./configure --enable-dvb</screen> -If you have ost headers at a non-standard path, set the path with -<screen> -./configure --with-extraincdir=<replaceable>DVB source directory</replaceable>/ost/include -</screen> Then compile and install as usual.</para> <formalpara><title>USAGE</title> @@ -353,7 +353,6 @@ Video output: --enable-ivtv enable IVTV TV-Out video output [autodetect] --enable-v4l2 enable V4L2 Decoder audio/video output [autodetect] --enable-dvb enable DVB video output [autodetect] - --enable-dvbhead enable DVB video output (HEAD version) [autodetect] --enable-mga enable mga_vid video output [autodetect] --enable-xmga enable mga_vid X11 video output [autodetect] --enable-xv enable Xv video output [autodetect] @@ -551,7 +550,6 @@ _svga=auto _vesa=auto _fbdev=auto _dvb=auto -_dvbhead=auto _dxr2=auto _dxr3=auto _ivtv=auto @@ -921,8 +919,6 @@ for ac_option do --disable-fbdev) _fbdev=no ;; --enable-dvb) _dvb=yes ;; --disable-dvb) _dvb=no ;; - --enable-dvbhead) _dvbhead=yes ;; - --disable-dvbhead) _dvbhead=no ;; --enable-dxr2) _dxr2=yes ;; --disable-dxr2) _dxr2=no ;; --enable-dxr3) _dxr3=yes ;; @@ -3827,6 +3823,17 @@ fi echores "$_setenv" +echocheck "setmode()" +_setmode=no +def_setmode='#define HAVE_SETMODE 0' +cat > $TMPC << EOF +#include <io.h> +int main(void) { setmode(0, 0); return 0; } +EOF +cc_check && _setmode=yes && def_setmode='#define HAVE_SETMODE 1' +echores "$_setmode" + + if sunos; then echocheck "sysi86()" cat > $TMPC << EOF @@ -4707,36 +4714,6 @@ cat >$TMPC << EOF #include <stdio.h> #include <time.h> #include <unistd.h> -#include <ost/dmx.h> -#include <ost/frontend.h> -#include <ost/sec.h> -#include <ost/video.h> -#include <ost/audio.h> -int main(void) {return 0;} -EOF - for _inc_tmp in "" "-I/usr/src/DVB/ost/include" ; do - cc_check $_inc_tmp && _dvb=yes && \ - extra_cflags="$extra_cflags $_inc_tmp" && break - done -fi -echores "$_dvb" -if test "$_dvb" = yes ; then - def_dvb='#define CONFIG_DVB 1' - def_dvbin='#define CONFIG_DVBIN 1' - _aomodules="mpegpes(dvb) $_aomodules" - _vomodules="mpegpes(dvb) $_vomodules" -fi - -echocheck "DVB HEAD" -if test "$_dvbhead" = auto ; then - _dvbhead=no - -cat >$TMPC << EOF -#include <poll.h> -#include <sys/ioctl.h> -#include <stdio.h> -#include <time.h> -#include <unistd.h> #include <linux/dvb/dmx.h> #include <linux/dvb/frontend.h> #include <linux/dvb/video.h> @@ -4744,35 +4721,27 @@ cat >$TMPC << EOF int main(void) {return 0;} EOF for _inc_tmp in "" "-I/usr/src/DVB/include" ; do - cc_check $_inc_tmp && _dvbhead=yes && \ + cc_check $_inc_tmp && _dvb=yes && \ extra_cflags="$extra_cflags $_inc_tmp" && break done fi -echores "$_dvbhead" -if test "$_dvbhead" = yes ; then +echores "$_dvb" +if test "$_dvb" = yes ; then + _dvbin=yes + _inputmodules="dvb $_inputmodules" def_dvb='#define CONFIG_DVB 1' - def_dvb_head='#define CONFIG_DVB_HEAD 1' def_dvbin='#define CONFIG_DVBIN 1' _aomodules="mpegpes(dvb) $_aomodules" _vomodules="mpegpes(dvb) $_vomodules" -fi - -if test "$_dvbhead" = no && test "$_dvb" = no ; then +else + _dvbin=no + _noinputmodules="dvb $_noinputmodules" def_dvb='#undef CONFIG_DVB' - def_dvb_head='#undef CONFIG_DVB_HEAD' def_dvbin='#undef CONFIG_DVBIN ' _aomodules="mpegpes(file) $_aomodules" _vomodules="mpegpes(file) $_vomodules" fi -if test "$_dvb" = yes || test "$_dvbhead" = yes ; then - _dvbin=yes - _inputmodules="dvb $_inputmodules" -else - _dvbin=no - _noinputmodules="dvb $_noinputmodules" -fi - if darwin; then @@ -5884,7 +5853,7 @@ fi echocheck "VCD support" if test "$_vcd" = auto; then _vcd=no - if linux || freebsd || netbsd || openbsd || dragonfly || bsdos || darwin || sunos; then + if linux || freebsd || netbsd || openbsd || dragonfly || bsdos || darwin || sunos || os2; then _vcd=yes elif mingw32; then cat > $TMPC << EOF @@ -8241,6 +8210,7 @@ $def_nanosleep $def_posix_select $def_select $def_setenv +$def_setmode $def_shm $def_strsep $def_swab @@ -8445,7 +8415,6 @@ $def_directfb $def_directfb_version $def_directx $def_dvb -$def_dvb_head $def_dvbin $def_dxr2 $def_dxr3 diff --git a/libao2/ao_mpegpes.c b/libao2/ao_mpegpes.c index e359d06536..b2521529b5 100644 --- a/libao2/ao_mpegpes.c +++ b/libao2/ao_mpegpes.c @@ -30,11 +30,6 @@ #include "config.h" -#ifdef CONFIG_DVB -#include <poll.h> -#include <sys/ioctl.h> -#endif - #include "audio_out.h" #include "audio_out_internal.h" @@ -46,14 +41,11 @@ #include "help_mp.h" #ifdef CONFIG_DVB -#ifndef CONFIG_DVB_HEAD -#include <ost/audio.h> -audioMixer_t dvb_mixer={255,255}; -#else +#include <poll.h> +#include <sys/ioctl.h> #include <linux/dvb/audio.h> audio_mixer_t dvb_mixer={255,255}; #endif -#endif #define true 1 #define false 0 @@ -116,13 +108,8 @@ static int freq_id=0; static int init_device(int card) { char ao_file[30]; -#ifndef CONFIG_DVB_HEAD - mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/ost/audio\n"); - sprintf(ao_file, "/dev/ost/audio"); -#else mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/dvb/adapter%d/audio0\n", card); sprintf(ao_file, "/dev/dvb/adapter%d/audio0", card); -#endif if((vo_mpegpes_fd2 = open(ao_file,O_RDWR|O_NONBLOCK)) < 0) { mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO DEVICE: %s\n", strerror(errno)); diff --git a/libmpcodecs/vd_dmo.c b/libmpcodecs/vd_dmo.c index 125357fc8e..c113e07d8a 100644 --- a/libmpcodecs/vd_dmo.c +++ b/libmpcodecs/vd_dmo.c @@ -55,7 +55,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ // init driver static int init(sh_video_t *sh){ - unsigned int out_fmt=sh->codec->outfmt[sh->outfmtidx]; + unsigned int out_fmt=sh->codec->outfmt[0]; struct context *ctx; void *decoder; if(!(decoder=DMO_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){ @@ -64,6 +64,8 @@ static int init(sh_video_t *sh){ return 0; } if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,out_fmt)) return 0; + // mpcodecs_config_vo can change the format + out_fmt=sh->codec->outfmt[sh->outfmtidx]; sh->context = ctx = calloc(1, sizeof(*ctx)); ctx->decoder = decoder; switch(out_fmt){ diff --git a/libmpcodecs/vd_dshow.c b/libmpcodecs/vd_dshow.c index a960f5dffe..ad02cabb06 100644 --- a/libmpcodecs/vd_dshow.c +++ b/libmpcodecs/vd_dshow.c @@ -66,7 +66,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ // init driver static int init(sh_video_t *sh){ - unsigned int out_fmt=sh->codec->outfmt[sh->outfmtidx]; + unsigned int out_fmt=sh->codec->outfmt[0]; /* Hack for VSSH codec: new dll can't decode old files * In my samples old files have no extradata, so use that info @@ -81,6 +81,8 @@ static int init(sh_video_t *sh){ return 0; } if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,out_fmt)) return 0; + // mpcodecs_config_vo can change the format + out_fmt=sh->codec->outfmt[sh->outfmtidx]; switch(out_fmt){ case IMGFMT_YUY2: case IMGFMT_UYVY: diff --git a/libvo/geometry.c b/libvo/geometry.c index 056a05facb..39ff209b7b 100644 --- a/libvo/geometry.c +++ b/libvo/geometry.c @@ -30,76 +30,77 @@ char *vo_geometry; int geometry_wh_changed; int geometry_xy_changed; -#define RESET_GEOMETRY width = height = xoff = yoff = xper = yper = INT_MIN; - // xpos,ypos: position of the left upper corner // widw,widh: width and height of the window // scrw,scrh: width and height of the current screen int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) { - int width, height, xoff, yoff, xper, yper; - - RESET_GEOMETRY - if(vo_geometry != NULL) { - if(sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) != 4 ) - { - RESET_GEOMETRY - if(sscanf(vo_geometry, "%ix%i", &width, &height) != 2) - { - RESET_GEOMETRY - if(sscanf(vo_geometry, "+%i+%i", &xoff, &yoff) != 2) - { - char percent[2]; - RESET_GEOMETRY - if(sscanf(vo_geometry, "%i%%:%i%1[%]", &xper, &yper, percent) != 3) - { - RESET_GEOMETRY - if(sscanf(vo_geometry, "%i:%i%1[%]", &xoff, &yper, percent) != 3) - { - RESET_GEOMETRY - if(sscanf(vo_geometry, "%i%%:%i", &xper, &yoff) != 2) - { - RESET_GEOMETRY - if(sscanf(vo_geometry, "%i:%i", &xoff, &yoff) != 2) - { - RESET_GEOMETRY - if(sscanf(vo_geometry, "%i%1[%]", &xper, percent) != 2) - { + char xsign[2], ysign[2]; + int width, height, xoff, yoff, xper, yper; + int i; + int ok = 0; + for (i = 0; !ok && i < 8; i++) { + width = height = xoff = yoff = xper = yper = INT_MIN; + strcpy(xsign, "+"); + strcpy(ysign, "+"); + switch (i) { + case 0: + ok = sscanf(vo_geometry, "%ix%i%1[+-]%i%1[+-]%i", &width, &height, xsign, &xoff, ysign, &yoff) == 6; + break; + case 1: + ok = sscanf(vo_geometry, "%ix%i", &width, &height) == 2; + break; + case 2: + ok = sscanf(vo_geometry, "%1[+-]%i%1[+-]%i", xsign, &xoff, ysign, &yoff) == 4; + break; + case 3: + ok = sscanf(vo_geometry, "%i%%:%i%%", &xper, &yper) == 2; + break; + case 4: + ok = sscanf(vo_geometry, "%i:%i%%", &xoff, &yper) == 2; + break; + case 5: + ok = sscanf(vo_geometry, "%i%%:%i", &xper, &yoff) == 2; + break; + case 6: + ok = sscanf(vo_geometry, "%i:%i", &xoff, &yoff) == 2; + break; + case 7: + ok = sscanf(vo_geometry, "%i%%", &xper) == 1; + break; + } + } + if (!ok) { mp_msg(MSGT_VO, MSGL_ERR, - "-geometry must be in [WxH][+X+Y] | [X[%%]:[Y[%%]]] format, incorrect (%s)\n", vo_geometry); + "-geometry must be in [WxH][[+-]X[+-]Y] | [X[%%]:[Y[%%]]] format, incorrect (%s)\n", vo_geometry); return 0; } - } - } - } - } - } - } - } + + mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i," + " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh); mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i," - "height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n", - width, height, xoff, yoff, xper, yper); + "height: %i, xoff: %s%i, yoff: %s%i, xper: %i, yper: %i\n", + width, height, xsign, xoff, ysign, yoff, xper, yper); + if (width > 0 && widw) *widw = width; + if (height > 0 && widh) *widh = height; + + if(xoff != INT_MIN && xsign[0] == '-') xoff = scrw - *widw - xoff; + if(yoff != INT_MIN && ysign[0] == '-') yoff = scrh - *widh - yoff; if(xper >= 0 && xper <= 100) xoff = (scrw - *widw) * ((float)xper / 100.0); if(yper >= 0 && yper <= 100) yoff = (scrh - *widh) * ((float)yper / 100.0); mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i," "height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n", width, height, xoff, yoff, xper, yper); - mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i," - " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh); if (xoff != INT_MIN && xpos) *xpos = xoff; if (yoff != INT_MIN && ypos) *ypos = yoff; - if (width > 0 && widw) *widw = width; - if (height > 0 && widh) *widh = height; geometry_wh_changed = width > 0 || height > 0; geometry_xy_changed = xoff != INT_MIN || yoff != INT_MIN; } return 1; } - -#undef RESET_GEOMETRY diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c index 96a173938c..df3f21299c 100644 --- a/libvo/vo_fbdev.c +++ b/libvo/vo_fbdev.c @@ -554,9 +554,6 @@ char *fb_mode_name = NULL; static fb_mode_t *fb_mode = NULL; -/* vt related variables */ -static FILE *vt_fp = NULL; - /* vo_fbdev related variables */ static int fb_dev_fd; static int fb_tty_fd = -1; @@ -736,9 +733,11 @@ static void vt_set_textarea(int u, int l) int lrow = l / 16; mp_msg(MSGT_VO, MSGL_DBG2, "vt_set_textarea(%d,%d): %d,%d\n", u, l, urow, lrow); - if (vt_fp) { - fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); - fflush(vt_fp); + if (fb_tty_fd >= 0) { + char modestring[100]; + snprintf(modestring, sizeof(modestring), "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); + write(fb_tty_fd, modestring, strlen(modestring)); + fsync(fb_tty_fd); } } @@ -973,9 +972,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, if (fs || vm) memset(frame_buffer, '\0', fb_line_len * fb_yres); } - if (!(vt_fp = fopen("/dev/tty", "w"))) { - mp_msg(MSGT_VO, MSGL_ERR, "can't fopen /dev/tty: %s\n", strerror(errno)); - } vt_set_textarea(last_row, fb_yres); @@ -1056,8 +1052,6 @@ static void uninit(void) mp_msg(MSGT_VO, MSGL_WARN, "Can't restore text mode: %s\n", strerror(errno)); } vt_set_textarea(0, fb_orig_vinfo.yres); - if (vt_fp) - fclose(vt_fp); close(fb_tty_fd); close(fb_dev_fd); if (frame_buffer) diff --git a/libvo/vo_mpegpes.c b/libvo/vo_mpegpes.c index b96b0af639..f7b2a5b0b7 100644 --- a/libvo/vo_mpegpes.c +++ b/libvo/vo_mpegpes.c @@ -38,20 +38,6 @@ #include "mp_msg.h" #ifdef CONFIG_DVB -#ifndef CONFIG_DVB_HEAD -#include <poll.h> - -#include <sys/ioctl.h> -#include <stdio.h> -#include <time.h> - -#include <ost/dmx.h> -#include <ost/frontend.h> -#include <ost/sec.h> -#include <ost/video.h> -#include <ost/audio.h> - -#else #define true 1 #define false 0 #include <poll.h> @@ -65,7 +51,6 @@ #include <linux/dvb/video.h> #include <linux/dvb/audio.h> #endif -#endif #include "config.h" #include "video_out.h" @@ -141,15 +126,9 @@ static int preinit(const char *arg){ mp_msg(MSGT_VO,MSGL_INFO, "Couldn't find a usable dvb video device, exiting\n"); return -1; } -#ifndef CONFIG_DVB_HEAD - mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/ost/video+audio\n"); - sprintf(vo_file, "/dev/ost/video"); - sprintf(ao_file, "/dev/ost/audio"); -#else mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/dvb/adapter%d/video0+audio0\n", card); sprintf(vo_file, "/dev/dvb/adapter%d/video0", card); sprintf(ao_file, "/dev/dvb/adapter%d/audio0", card); -#endif if((vo_mpegpes_fd = open(vo_file,O_RDWR)) < 0){ perror("DVB VIDEO DEVICE: "); return -1; diff --git a/loader/win32.c b/loader/win32.c index f560ffdfb4..08985a28e1 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -350,7 +350,8 @@ struct CRITSECT { pthread_t id; pthread_mutex_t mutex; - int locked; + pthread_cond_t unlocked; + int lock_count; long deadbeef; }; @@ -568,16 +569,30 @@ static HMODULE WINAPI expGetDriverModuleHandle(DRVR* pdrv) #define MODULE_HANDLE_winmm ((HMODULE)0x128) #define MODULE_HANDLE_psapi ((HMODULE)0x129) +// Fake PE header, since some software (and the Microsoft CRT v8 and newer) +// assume GetModuleHandle(NULL) returns a pointer to a PE header. +// We simulate a very simple header with only one section. +// +// NOTE: If you have a section called .mixcrt, the Microsoft CRT will assume +// it's running in a POSIX binary, and stop using EncodePointer/DecodePointer. +static const struct { + IMAGE_DOS_HEADER doshdr; + IMAGE_NT_HEADERS nthdr; + IMAGE_SECTION_HEADER opthdr; +} __attribute__((__packed__)) mp_exe = { + .doshdr.e_lfanew = sizeof(IMAGE_DOS_HEADER), + .nthdr.FileHeader.NumberOfSections = 1, + .nthdr.FileHeader.SizeOfOptionalHeader = + sizeof(IMAGE_NT_HEADERS) - FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader), /* 0xe0 */ + .opthdr.Name = ".text" +}; + static HMODULE WINAPI expGetModuleHandleA(const char* name) { WINE_MODREF* wm; HMODULE result; if(!name) -#ifdef CONFIG_QTX_CODECS - result=1; -#else - result=0; -#endif + result=(HMODULE)&mp_exe.doshdr; else { wm=MODULE_FindModule(name); @@ -736,7 +751,7 @@ static void* WINAPI expCreateEventA(void* pSecAttr, char bManualReset, mlist->pm=pm; mlist->pc=pc; mlist->state=bInitialState; - mlist->reset=bManualReset; + mlist->reset=!bManualReset; if(name) strncpy(mlist->name, name, 127); else @@ -786,6 +801,7 @@ static void* WINAPI expWaitForSingleObject(void* object, int duration) // FIXME FIXME FIXME - this value is sometime unititialize !!! int ret = WAIT_FAILED; mutex_list* pp=mlist; + th_list* tp=list; if(object == (void*)0xcfcf9898) { /** @@ -801,6 +817,17 @@ static void* WINAPI expWaitForSingleObject(void* object, int duration) } dbgprintf("WaitForSingleObject(0x%x, duration %d) =>\n",object, duration); + // See if this is a thread. + while (tp && (tp->thread != object)) + tp = tp->prev; + if (tp) { + if (pthread_join(*(pthread_t*)object, NULL) == 0) { + return (void*)WAIT_OBJECT_0; + } else { + return (void*)WAIT_FAILED; + } + } + // loop below was slightly fixed - its used just for checking if // this object really exists in our list if (!ml) @@ -817,8 +844,8 @@ static void* WINAPI expWaitForSingleObject(void* object, int duration) switch(ml->type) { case 0: /* Event */ if (duration == 0) { /* Check Only */ - if (ml->state == 1) ret = WAIT_FAILED; - else ret = WAIT_OBJECT_0; + if (ml->state == 1) ret = WAIT_OBJECT_0; + else ret = WAIT_FAILED; } if (duration == -1) { /* INFINITE */ if (ml->state == 0) @@ -1331,7 +1358,8 @@ static void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c) return; } pthread_mutex_init(&cs->mutex, NULL); - cs->locked = 0; + pthread_cond_init(&cs->unlocked, NULL); + cs->lock_count = 0; critsecs_list[i].cs_win = c; critsecs_list[i].cs_unix = cs; dbgprintf("InitializeCriticalSection -> itemno=%d, cs_win=%p, cs_unix=%p\n", @@ -1342,7 +1370,8 @@ static void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c) struct CRITSECT* cs = mreq_private(sizeof(struct CRITSECT) + sizeof(CRITICAL_SECTION), 0, AREATYPE_CRITSECT); pthread_mutex_init(&cs->mutex, NULL); - cs->locked=0; + pthread_cond_init(&cs->unlocked, NULL); + cs->lock_count = 0; cs->deadbeef = 0xdeadbeef; *(void**)c = cs; } @@ -1374,12 +1403,17 @@ static void WINAPI expEnterCriticalSection(CRITICAL_SECTION* c) #endif dbgprintf("Win32 Warning: Accessed uninitialized Critical Section (%p)!\n", c); } - if(cs->locked) - if(cs->id==pthread_self()) - return; pthread_mutex_lock(&(cs->mutex)); - cs->locked=1; - cs->id=pthread_self(); + if (cs->lock_count > 0 && cs->id == pthread_self()) { + cs->lock_count++; + } else { + while (cs->lock_count != 0) { + pthread_cond_wait(&(cs->unlocked), &(cs->mutex)); + } + cs->lock_count = 1; + cs->id = pthread_self(); + } + pthread_mutex_unlock(&(cs->mutex)); return; } static void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c) @@ -1396,13 +1430,16 @@ static void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c) dbgprintf("Win32 Warning: Leaving uninitialized Critical Section %p!!\n", c); return; } - if (cs->locked) - { - cs->locked=0; - pthread_mutex_unlock(&(cs->mutex)); + pthread_mutex_lock(&(cs->mutex)); + if (cs->lock_count == 0) { + dbgprintf("Win32 Warning: Unlocking unlocked Critical Section %p!!\n", c); + } else { + cs->lock_count--; } - else - dbgprintf("Win32 Warning: Unlocking unlocked Critical Section %p!!\n", c); + if (cs->lock_count == 0) { + pthread_cond_signal(&(cs->unlocked)); + } + pthread_mutex_unlock(&(cs->mutex)); return; } @@ -1424,14 +1461,16 @@ static void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c) return; } - if (cs->locked) + pthread_mutex_lock(&(cs->mutex)); + if (cs->lock_count > 0) { - dbgprintf("Win32 Warning: Deleting unlocked Critical Section %p!!\n", c); - pthread_mutex_unlock(&(cs->mutex)); + dbgprintf("Win32 Warning: Deleting locked Critical Section |