From c106fe7751426c8c30706d2f131491dc8f37ee85 Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 2 Mar 2010 19:57:17 +0000 Subject: Drop support for old-style DVB code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30818 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/xml/en/video.xml | 4 - configure | 59 ++-------- libao2/ao_mpegpes.c | 17 +-- libvo/vo_mpegpes.c | 21 ---- stream/dvb_tune.c | 292 +------------------------------------------------- stream/dvbin.h | 24 +---- stream/stream_dvb.c | 9 -- 7 files changed, 15 insertions(+), 411 deletions(-) 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. Configure should detect your DVB card. If it did not, force detection with ./configure --enable-dvb -If you have ost headers at a non-standard path, set the path with - -./configure --with-extraincdir=DVB source directory/ost/include - Then compile and install as usual. USAGE diff --git a/configure b/configure index 931b187c9f..17aa2e9f6f 100755 --- a/configure +++ b/configure @@ -384,7 +384,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] @@ -605,7 +604,6 @@ _svga=auto _vesa=auto _fbdev=auto _dvb=auto -_dvbhead=auto _dxr2=auto _dxr3=auto _ivtv=auto @@ -982,8 +980,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 ;; @@ -4965,36 +4961,6 @@ cat >$TMPC << EOF #include #include #include -#include -#include -#include -#include -#include -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 -#include -#include -#include -#include #include #include #include @@ -5002,35 +4968,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 @@ -9129,7 +9087,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 f1f89dddb1..7b2d3a5788 100644 --- a/libao2/ao_mpegpes.c +++ b/libao2/ao_mpegpes.c @@ -30,11 +30,6 @@ #include "config.h" -#ifdef CONFIG_DVB -#include -#include -#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 -audioMixer_t dvb_mixer={255,255}; -#else +#include +#include #include 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/libvo/vo_mpegpes.c b/libvo/vo_mpegpes.c index f9f02c7654..211a17b8fd 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 - -#include -#include -#include - -#include -#include -#include -#include -#include - -#else #define true 1 #define false 0 #include @@ -65,7 +51,6 @@ #include #include #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/stream/dvb_tune.c b/stream/dvb_tune.c index e03a4eb1e6..56deadc034 100644 --- a/stream/dvb_tune.c +++ b/stream/dvb_tune.c @@ -32,17 +32,9 @@ #include #include #include +#include +#include #include "config.h" - -#ifdef CONFIG_DVB_HEAD - #include - #include -#else - #include - #include - #include -#endif - #include "dvbin.h" #include "dvb_tune.h" #include "mp_msg.h" @@ -51,11 +43,7 @@ int dvb_get_tuner_type(int fe_fd) { -#ifdef CONFIG_DVB_HEAD struct dvb_frontend_info fe_info; -#else - FrontendInfo fe_info; -#endif int res; @@ -96,35 +84,16 @@ int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt) { int i; char frontend_dev[32], dvr_dev[32], demux_dev[32]; -#ifndef CONFIG_DVB_HEAD - char sec_dev[32]; -#endif -#ifdef CONFIG_DVB_HEAD sprintf(frontend_dev, "/dev/dvb/adapter%d/frontend0", n); sprintf(dvr_dev, "/dev/dvb/adapter%d/dvr0", n); sprintf(demux_dev, "/dev/dvb/adapter%d/demux0", n); -#else - sprintf(frontend_dev, "/dev/ost/frontend%d", n); - sprintf(dvr_dev, "/dev/ost/dvr%d", n); - sprintf(demux_dev, "/dev/ost/demux%d", n); - sprintf(sec_dev, "/dev/ost/sec%d", n); -#endif priv->fe_fd = open(frontend_dev, O_RDWR | O_NONBLOCK); if(priv->fe_fd < 0) { mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", frontend_dev, errno); return 0; } -#ifndef CONFIG_DVB_HEAD - priv->sec_fd = open(sec_dev, O_RDWR); - if(priv->sec_fd < 0) - { - mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING SEC DEVICE %s: ERRNO %d\n", sec_dev, errno); - close(priv->fe_fd); - return 0; - } -#endif priv->demux_fds_cnt = 0; mp_msg(MSGT_DEMUX, MSGL_V, "DVB_OPEN_DEVICES(%d)\n", demux_cnt); for(i = 0; i < demux_cnt; i++) @@ -159,12 +128,7 @@ int dvb_fix_demuxes(dvb_priv_t *priv, int cnt) int i; char demux_dev[32]; -#ifdef CONFIG_DVB_HEAD sprintf(demux_dev, "/dev/dvb/adapter%d/demux0", priv->card); -#else - sprintf(demux_dev, "/dev/ost/demux%d", priv->card); -#endif - mp_msg(MSGT_DEMUX, MSGL_V, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt); if(priv->demux_fds_cnt >= cnt) { @@ -202,12 +166,7 @@ int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype) pesFilterParams.pid = pid; pesFilterParams.input = DMX_IN_FRONTEND; pesFilterParams.output = DMX_OUT_TS_TAP; -#ifdef CONFIG_DVB_HEAD pesFilterParams.pes_type = pestype; -#else - pesFilterParams.pesType = pestype; -#endif - pesFilterParams.flags = DMX_IMMEDIATE_START; errno = 0; @@ -248,13 +207,7 @@ static void print_status(fe_status_t festatus) { mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:"); if (festatus & FE_HAS_SIGNAL) mp_msg(MSGT_DEMUX, MSGL_V," FE_HAS_SIGNAL"); -#ifdef CONFIG_DVB_HEAD if (festatus & FE_TIMEDOUT) mp_msg(MSGT_DEMUX, MSGL_V, " FE_TIMEDOUT"); -#else - if (festatus & FE_HAS_POWER) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_POWER"); - if (festatus & FE_SPECTRUM_INV) mp_msg(MSGT_DEMUX, MSGL_V, " FE_SPECTRUM_INV"); - if (festatus & FE_TUNER_HAS_LOCK) mp_msg(MSGT_DEMUX, MSGL_V, " FE_TUNER_HAS_LOCK"); -#endif if (festatus & FE_HAS_LOCK) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_LOCK"); if (festatus & FE_HAS_CARRIER) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_CARRIER"); if (festatus & FE_HAS_VITERBI) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_VITERBI"); @@ -263,7 +216,6 @@ static void print_status(fe_status_t festatus) } -#ifdef CONFIG_DVB_HEAD static int check_status(int fd_frontend, int tmout) { int32_t strength; @@ -368,202 +320,14 @@ static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) (sat_no / 4) % 2 ? SEC_MINI_B : SEC_MINI_A); } -#else - -static int SecGetStatus (int fd, struct secStatus *state) -{ - if(ioctl(fd, SEC_GET_STATUS, state) < 0) - { - mp_msg(MSGT_DEMUX, MSGL_ERR, ("SEC GET STATUS: ")); - return -1; - } - - switch (state->busMode) - { - case SEC_BUS_IDLE: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: IDLE (%d)\n",state->busMode); - break; - case SEC_BUS_BUSY: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: BUSY (%d)\n",state->busMode); - break; - case SEC_BUS_OFF: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OFF (%d)\n",state->busMode); - break; - case SEC_BUS_OVERLOAD: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OVERLOAD (%d)\n",state->busMode); - break; - default: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: unknown (%d)\n",state->busMode); - break; - } - - switch (state->selVolt) - { - case SEC_VOLTAGE_OFF: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: OFF (%d)\n",state->selVolt); - break; - case SEC_VOLTAGE_LT: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: LT (%d)\n",state->selVolt); - break; - case SEC_VOLTAGE_13: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13 (%d)\n",state->selVolt); - break; - case SEC_VOLTAGE_13_5: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13.5 (%d)\n",state->selVolt); - break; - case SEC_VOLTAGE_18: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18 (%d)\n",state->selVolt); - break; - case SEC_VOLTAGE_18_5: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18.5 (%d)\n",state->selVolt); - break; - default: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: unknown (%d)\n",state->selVolt); - break; - } - - mp_msg(MSGT_DEMUX, MSGL_V, "SEC CONT TONE: %s\n", (state->contTone == SEC_TONE_ON ? "ON" : "OFF")); - return 0; -} - -static int check_status(int fd_frontend, int tmout) -{ - int i,res; - int32_t strength; - fe_status_t festatus; - FrontendEvent event; - - struct pollfd pfd[1]; - - i = 0; res = -1; - while ((i < 3) && (res < 0)) - { - pfd[0].fd = fd_frontend; - pfd[0].events = POLLIN | POLLPRI; - - if(poll(pfd,1,tmout*1000) > 0) - { - if (pfd[0].revents & POLLPRI) - { - mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend event\n"); - if ( ioctl(fd_frontend, FE_GET_EVENT, &event) < 0) - { - mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_EVENT"); - return -1; - } - mp_msg(MSGT_DEMUX, MSGL_V, "Received "); - switch(event.type) - { - case FE_UNEXPECTED_EV: - mp_msg(MSGT_DEMUX, MSGL_V, "unexpected event\n"); - res = -1; - break; - - case FE_FAILURE_EV: - mp_msg(MSGT_DEMUX, MSGL_V, "failure event\n"); - res = -1; - break; - - case FE_COMPLETION_EV: - mp_msg(MSGT_DEMUX, MSGL_V, "completion event\n"); - res = 0; - break; - } - } - i++; - } - } - - if (res > 0) - switch (event.type) - { - case FE_UNEXPECTED_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_UNEXPECTED_EV\n"); - break; - case FE_COMPLETION_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_COMPLETION_EV\n"); - break; - case FE_FAILURE_EV: mp_msg(MSGT_DEMUX, MSGL_V, "FE_FAILURE_EV\n"); - break; - } - - if (event.type == FE_COMPLETION_EV) - { - strength=0; - if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0) - mp_msg(MSGT_DEMUX, MSGL_V, "Bit error rate: %d\n",strength); - - strength=0; - if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0) - mp_msg(MSGT_DEMUX, MSGL_V, "Signal strength: %d\n",strength); - - strength=0; - if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0) - mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength); - - festatus=0; - mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:"); - - if(ioctl(fd_frontend,FE_READ_STATUS,&festatus) >= 0) - print_status(festatus); - else - mp_msg(MSGT_DEMUX, MSGL_ERR, " ERROR, UNABLE TO READ_STATUS"); - - mp_msg(MSGT_DEMUX, MSGL_V, "\n"); - } - else - { - mp_msg(MSGT_DEMUX, MSGL_V, "Not able to lock to the signal on the given frequency\n"); - return -1; - } - return 0; -} - -static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) -{ - struct secCommand scmd; - struct secCmdSequence scmds; - - scmds.continuousTone = (hi_lo ? SEC_TONE_ON : SEC_TONE_OFF); - scmds.voltage = (polv ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); - scmds.miniCommand = SEC_MINI_NONE; - - scmd.type = SEC_CMDTYPE_DISEQC; - scmds.numCommands = 1; - scmds.commands = &scmd; - - scmd.u.diseqc.addr = 0x10; - scmd.u.diseqc.cmd = 0x38; - scmd.u.diseqc.numParams = 1; - scmd.u.diseqc.params[0] = 0xf0 | - (((sat_no) << 2) & 0x0F) | - (hi_lo ? 1 : 0) | - (polv ? 0 : 2); - - if (ioctl(secfd,SEC_SEND_SEQUENCE,&scmds) < 0) - { - mp_msg(MSGT_DEMUX, MSGL_ERR, "Error sending DisEqC"); - return -1; - } - - return 0; -} -#endif - static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone, fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate, fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth, fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout) { int res, hi_lo, dfd; -#ifdef CONFIG_DVB_HEAD struct dvb_frontend_parameters feparams; struct dvb_frontend_info fe_info; -#else - FrontendParameters feparams; - FrontendInfo fe_info; - FrontendEvent event; - struct secStatus sec_state; -#endif - mp_msg(MSGT_DEMUX, MSGL_V, "TUNE_IT, fd_frontend %d, fd_sec %d\nfreq %lu, srate %lu, pol %c, tone %i, specInv, diseqc %u, fe_modulation_t modulation,fe_code_rate_t HP_CodeRate, fe_transmit_mode_t TransmissionMode,fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth\n", fd_frontend, fd_sec, (long unsigned int)freq, (long unsigned int)srate, pol, tone, diseqc); @@ -576,15 +340,11 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int return -1; } - -#ifdef CONFIG_DVB_HEAD mp_msg(MSGT_DEMUX, MSGL_V, "Using DVB card \"%s\"\n", fe_info.name); -#endif switch(fe_info.type) { case FE_OFDM: -#ifdef CONFIG_DVB_HEAD if (freq < 1000000) freq*=1000UL; feparams.frequency=freq; feparams.inversion=specInv; @@ -595,18 +355,6 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int feparams.u.ofdm.transmission_mode=TransmissionMode; feparams.u.ofdm.guard_interval=guardInterval; feparams.u.ofdm.hierarchy_information=hier; -#else - if (freq < 1000000) freq*=1000UL; - feparams.Frequency=freq; - feparams.Inversion=specInv; - feparams.u.ofdm.bandWidth=bandwidth; - feparams.u.ofdm.HP_CodeRate=HP_CodeRate; - feparams.u.ofdm.LP_CodeRate=LP_CodeRate; - feparams.u.ofdm.Constellation=modulation; - feparams.u.ofdm.TransmissionMode=TransmissionMode; - feparams.u.ofdm.guardInterval=guardInterval; - feparams.u.ofdm.HierarchyInformation=hier; -#endif mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-T to %d Hz, bandwidth: %d\n",freq, bandwidth); break; case FE_QPSK: @@ -615,44 +363,25 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int // this must be an absolute frequency if (freq < SLOF) { -#ifdef CONFIG_DVB_HEAD freq = feparams.frequency=(freq-LOF1); -#else - freq = feparams.Frequency=(freq-LOF1); -#endif hi_lo = 0; } else { -#ifdef CONFIG_DVB_HEAD freq = feparams.frequency=(freq-LOF2); -#else - freq = feparams.Frequency=(freq-LOF2); -#endif hi_lo = 1; } } else { // this is an L-Band frequency -#ifdef CONFIG_DVB_HEAD feparams.frequency=freq; -#else - feparams.Frequency=freq; -#endif } -#ifdef CONFIG_DVB_HEAD feparams.inversion=specInv; feparams.u.qpsk.symbol_rate=srate; feparams.u.qpsk.fec_inner=HP_CodeRate; dfd = fd_frontend; -#else - feparams.Inversion=specInv; - feparams.u.qpsk.SymbolRate=srate; - feparams.u.qpsk.FEC_inner=HP_CodeRate; - dfd = fd_sec; -#endif mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-S to Freq: %u, Pol: %c Srate: %d, 22kHz: %s, LNB: %d\n",freq,pol,srate,hi_lo ? "on" : "off", diseqc); @@ -666,19 +395,11 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int break; case FE_QAM: mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-C to %d, srate=%d\n",freq,srate); -#ifdef CONFIG_DVB_HEAD feparams.frequency=freq; feparams.inversion=specInv; feparams.u.qam.symbol_rate = srate; feparams.u.qam.fec_inner = HP_CodeRate; feparams.u.qam.modulation = modulation; -#else - feparams.Frequency=freq; - feparams.Inversion=specInv; - feparams.u.qam.SymbolRate = srate; - feparams.u.qam.FEC_inner = HP_CodeRate; - feparams.u.qam.QAM = modulation; -#endif break; #ifdef DVB_ATSC case FE_ATSC: @@ -693,15 +414,6 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int } usleep(100000); -#ifndef CONFIG_DVB_HEAD - if (fd_sec) SecGetStatus(fd_sec, &sec_state); - while(1) - { - if(ioctl(fd_frontend, FE_GET_EVENT, &event) == -1) - break; - } -#endif - if(ioctl(fd_frontend,FE_SET_FRONTEND,&feparams) < 0) { mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR tuning channel\n"); diff --git a/stream/dvbin.h b/stream/dvbin.h index 18a37d9522..e278e79489 100644 --- a/stream/dvbin.h +++ b/stream/dvbin.h @@ -15,27 +15,9 @@ #define LOF1 (9750*1000UL) #define LOF2 (10600*1000UL) -#ifdef CONFIG_DVB_HEAD - #include - #include - #include -#else - #include - #include - #include - #define fe_status_t FrontendStatus - #define fe_spectral_inversion_t SpectralInversion - #define fe_modulation_t Modulation - #define fe_code_rate_t CodeRate - #define fe_transmit_mode_t TransmitMode - #define fe_guard_interval_t GuardInterval - #define fe_bandwidth_t BandWidth - #define fe_hierarchy_t Hierarchy - #define fe_sec_voltage_t SecVoltage - #define dmx_pes_filter_params dmxPesFilterParams - #define dmx_sct_filter_params dmxSctFilterParams - #define dmx_pes_type_t dmxPesType_t -#endif +#include +#include +#include #undef DVB_ATSC #if defined(DVB_API_VERSION_MINOR) diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index 9df4566e62..4a7efe2724 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -288,14 +288,12 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type) ptr->cr =FEC_2_3; else if(! strcmp(cr, "FEC_3_4")) ptr->cr =FEC_3_4; -#ifdef CONFIG_DVB_HEAD else if(! strcmp(cr, "FEC_4_5")) ptr->cr =FEC_4_5; else if(! strcmp(cr, "FEC_6_7")) ptr->cr =FEC_6_7; else if(! strcmp(cr, "FEC_8_9")) ptr->cr =FEC_8_9; -#endif else if(! strcmp(cr, "FEC_5_6")) ptr->cr =FEC_5_6; else if(! strcmp(cr, "FEC_7_8")) @@ -362,14 +360,12 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type) ptr->cr_lp =FEC_2_3; else if(! strcmp(tmp_lcr, "FEC_3_4")) ptr->cr_lp =FEC_3_4; -#ifdef CONFIG_DVB_HEAD else if(! strcmp(tmp_lcr, "FEC_4_5")) ptr->cr_lp =FEC_4_5; else if(! strcmp(tmp_lcr, "FEC_6_7")) ptr->cr_lp =FEC_6_7; else if(! strcmp(tmp_lcr, "FEC_8_9")) ptr->cr_lp =FEC_8_9; -#endif else if(! strcmp(tmp_lcr, "FEC_5_6")) ptr->cr_lp =FEC_5_6; else if(! strcmp(tmp_lcr, "FEC_7_8")) @@ -385,10 +381,8 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type) ptr->hier = HIERARCHY_2; else if(! strcmp(tmp_hier, "HIERARCHY_4")) ptr->hier = HIERARCHY_4; -#ifdef CONFIG_DVB_HEAD else if(! strcmp(tmp_hier, "HIERARCHY_AUTO")) ptr->hier = HIERARCHY_AUTO; -#endif else ptr->hier = HIERARCHY_NONE; } @@ -615,9 +609,6 @@ static void dvbin_close(stream_t *stream) close(priv->dvr_fd); close(priv->fe_fd); -#ifndef CONFIG_DVB_HEAD - close(priv->sec_fd); -#endif priv->fe_fd = priv->sec_fd = priv->dvr_fd = -1; priv->is_on = 0; -- cgit v1.2.3 From 9beeeb1a9ecec3916f16e8315edc026b7f48ac21 Mon Sep 17 00:00:00 2001 From: komh Date: Wed, 3 Mar 2010 14:32:29 +0000 Subject: Add a VCD support for OS/2 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30819 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 2 +- stream/stream_vcd.c | 17 ++++ stream/vcd_read_os2.h | 237 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 stream/vcd_read_os2.h diff --git a/configure b/configure index 17aa2e9f6f..0ecef04b20 100755 --- a/configure +++ b/configure @@ -6113,7 +6113,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 diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c index 9ed8ac7a58..819c3e52ea 100644 --- a/stream/stream_vcd.c +++ b/stream/stream_vcd.c @@ -22,6 +22,8 @@ #include #endif +#include "osdep/osdep.h" + #include "mp_msg.h" #include "stream.h" #include "help_mp.h" @@ -42,6 +44,8 @@ #include "vcd_read_darwin.h" #elif defined(__MINGW32__) || defined(__CYGWIN__) #include "vcd_read_win32.h" +#elif defined(__OS2__) +#include "vcd_read_os2.h" #else #include "vcd_read.h" #endif @@ -102,6 +106,12 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { HANDLE hd; char device[] = "\\\\.\\?:"; #endif +#if defined(__OS2__) + char device[] = "X:"; + HFILE hcd; + ULONG ulAction; + ULONG rc; +#endif if(mode != STREAM_READ #if defined(__MINGW32__) || defined(__CYGWIN__) @@ -125,6 +135,13 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { hd = CreateFile(device, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); f = _open_osfhandle((long)hd, _O_RDONLY); +#elif defined(__OS2__) + device[0] = p->device[0]; + rc = DosOpen(device, &hcd, &ulAction, 0, FILE_NORMAL, + OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, + OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD, + NULL); + f = rc ? -1 : hcd; #else f=open(p->device,O_RDONLY); #endif diff --git a/stream/vcd_read_os2.h b/stream/vcd_read_os2.h new file mode 100644 index 0000000000..7d37b33e23 --- /dev/null +++ b/stream/vcd_read_os2.h @@ -0,0 +1,237 @@ +/* + * implementation of VCD IO for OS/2 + * + * Copyright (c) 2009 KO Myung-Hun (komh@chollian.net) + * + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_VCD_READ_OS2_H +#define MPLAYER_VCD_READ_OS2_H + +#include "mp_msg.h" + +struct __attribute__((packed)) msf { + BYTE bFrame; + BYTE bSecond; + BYTE bMinute; + BYTE bReserved; +}; + +typedef struct { + HFILE hcd; + struct msf msfCurrent; + int iFirstTrack; + int iLastTrack; + struct msf msfLeadOut; + BYTE abVCDSector[VCD_SECTOR_SIZE]; +} mp_vcd_priv_t; + +static inline void vcd_set_msf(mp_vcd_priv_t *vcd, unsigned sect) +{ + sect += 150; + vcd->msfCurrent.bFrame = sect % 75; + sect = sect / 75; + vcd->msfCurrent.bSecond = sect % 60; + sect = sect / 60; + vcd->msfCurrent.bMinute = sect; +} + +static inline unsigned vcd_get_msf(mp_vcd_priv_t *vcd) +{ + return vcd->msfCurrent.bFrame + + (vcd->msfCurrent.bSecond + vcd->msfCurrent.bMinute * 60) * 75 - 150; +} + +int vcd_seek_to_track(mp_vcd_priv_t *vcd, int track) +{ + struct { + UCHAR auchSign[4]; + BYTE bTrack; + } __attribute__((packed)) sParam = {{'C', 'D', '0', '1'},}; + + struct { + struct msf msfStart; + BYTE bControlInfo; + } __attribute__((packed)) sData; + + ULONG ulParamLen; + ULONG ulDataLen; + ULONG rc; + + sParam.bTrack = track; + rc = DosDevIOCtl(vcd->hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK, + &sParam, sizeof(sParam), &ulParamLen, + &sData, sizeof(sData), &ulDataLen); + if (rc) { + mp_msg(MSGT_STREAM, MSGL_ERR, "DosDevIOCtl(GETAUDIOTRACK) = 0x%lx\n", rc); + return -1; + } + + vcd->msfCurrent = sData.msfStart; + + return VCD_SECTOR_DATA * vcd_get_msf(vcd); +} + +static int vcd_get_track_end(mp_vcd_priv_t *vcd, int track) +{ + if (track < vcd->iLastTrack) + return vcd_seek_to_track(vcd, track + 1); + + vcd->msfCurrent = vcd->msfLeadOut; + + return VCD_SECTOR_DATA * vcd_get_msf(vcd); +} + +static mp_vcd_priv_t *vcd_read_toc(int fd) +{ + mp_vcd_priv_t *vcd; + + UCHAR auchParamDisk[4] = {'C', 'D', '0', '1'}; + + struct { + BYTE bFirstTrack; + BYTE bLastTrack; + struct msf msfLeadOut; + } __attribute__((packed)) sDataDisk; + + struct { + UCHAR auchSign[4]; + BYTE bTrack; + } __attribute__((packed)) sParamTrack = {{'C', 'D', '0', '1'},}; + + struct { + struct msf msfStart; + BYTE bControlInfo; + } __attribute__((packed)) sDataTrack; + + ULONG ulParamLen; + ULONG ulDataLen; + ULONG rc; + int i, iMinute = 0, iSecond = 0, iFrame = 0; + + rc = DosDevIOCtl(fd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIODISK, + auchParamDisk, sizeof(auchParamDisk), &ulParamLen, + &sDataDisk, sizeof(sDataDisk), &ulDataLen); + if (rc) { + mp_msg(MSGT_OPEN, MSGL_ERR, "DosDevIOCtl(GETAUDIODISK) = 0x%lx\n", rc); + return NULL; + } + + mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", sDataDisk.bFirstTrack); + mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", sDataDisk.bLastTrack); + + for (i = sDataDisk.bFirstTrack; i <= sDataDisk.bLastTrack + 1; i++) { + if (i <= sDataDisk.bLastTrack) { + sParamTrack.bTrack = i; + rc = DosDevIOCtl(fd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK, + &sParamTrack, sizeof(sParamTrack), &ulParamLen, + &sDataTrack, sizeof(sDataTrack), &ulDataLen); + if (rc) { + mp_msg(MSGT_OPEN, MSGL_ERR, "DosDevIOCtl(GETAUDIOTRACK) = 0x%lx\n", rc); + return NULL; + } + + mp_msg(MSGT_OPEN, MSGL_INFO, "track %02d: adr=%d ctrl=%d %02d:%02d:%02d\n", + i, + sDataTrack.bControlInfo & 0x0F, + sDataTrack.bControlInfo >> 4, + sDataTrack.msfStart.bMinute, + sDataTrack.msfStart.bSecond, + sDataTrack.msfStart.bFrame); + } else + sDataTrack.msfStart = sDataDisk.msfLeadOut; + + if (mp_msg_test(MSGT_IDENTIFY, MSGL_INFO)) { + if (i > sDataDisk.bFirstTrack) { + iMinute = sDataTrack.msfStart.bMinute - iMinute; + iSecond = sDataTrack.msfStart.bSecond - iSecond; + iFrame = sDataTrack.msfStart.bFrame - iFrame; + if (iFrame < 0) { + iFrame += 75; + iSecond--; + } + if (iSecond < 0) { + iSecond += 60; + iMinute--; + } + mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n", + i - 1, iMinute, iSecond, iFrame); + } + + iMinute = sDataTrack.msfStart.bMinute; + iSecond = sDataTrack.msfStart.bSecond; + iFrame = sDataTrack.msfStart.bFrame; + } + } + + vcd = calloc(1, sizeof(mp_vcd_priv_t)); + vcd->hcd = fd; + vcd->iFirstTrack = sDataDisk.bFirstTrack; + vcd->iLastTrack = sDataDisk.bLastTrack; + vcd->msfLeadOut = sDataDisk.msfLeadOut; + + return vcd; +} + +static int vcd_read(mp_vcd_priv_t *vcd, char *mem) +{ + struct { + UCHAR auchSign[4]; + BYTE bAddrMode; + USHORT usSectors; + struct msf msfStart; + BYTE bReserved; + BYTE bInterleavedSize; + } __attribute__((packed)) sParam = {{'C', 'D', '0', '1'}, 1, 1,}; + + ULONG ulParamLen; + ULONG ulDataLen; + ULONG rc; + + /* lead-out ? */ + if (vcd->msfCurrent.bMinute == vcd->msfLeadOut.bMinute && + vcd->msfCurrent.bSecond == vcd->msfLeadOut.bSecond && + vcd->msfCurrent.bFrame == vcd->msfLeadOut.bFrame) + return 0; + + sParam.msfStart = vcd->msfCurrent; + rc = DosDevIOCtl(vcd->hcd, IOCTL_CDROMDISK, CDROMDISK_READLONG, + &sParam, sizeof(sParam), &ulParamLen, + vcd->abVCDSector, sizeof(vcd->abVCDSector), &ulDataLen); + if (rc) { + mp_msg(MSGT_STREAM, MSGL_ERR, "DosDevIOCtl(READLONG) = 0x%lx\n", rc); + return 0; + } + + memcpy(mem, &vcd->abVCDSector[VCD_SECTOR_OFFS], VCD_SECTOR_DATA); + + vcd->msfCurrent.bFrame++; + if (vcd->msfCurrent.bFrame == 75) { + vcd->msfCurrent.bFrame = 0; + vcd->msfCurrent.bSecond++; + if (vcd->msfCurrent.bSecond == 60) { + vcd->msfCurrent.bSecond = 0; + vcd->msfCurrent.bMinute++; + } + } + + return VCD_SECTOR_DATA; +} + +#endif /* MPLAYER_VCD_READ_OS2_H */ + -- cgit v1.2.3 From 55b3c6f0901e7240a4360007c2bc98f372b8e127 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Mar 2010 20:24:46 +0000 Subject: Avoid very deep indentation level and RESET_GEOMETRY macro in -geometry parsing. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30820 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/geometry.c | 73 ++++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/libvo/geometry.c b/libvo/geometry.c index 056a05facb..ec9e7f0a5f 100644 --- a/libvo/geometry.c +++ b/libvo/geometry.c @@ -30,53 +30,50 @@ 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) - { + int width, height, xoff, yoff, xper, yper; + int i; + int ok = 0; + for (i = 0; !ok && i < 8; i++) { + char percent[2]; + width = height = xoff = yoff = xper = yper = INT_MIN; + switch (i) { + case 0: + ok = sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) == 4; + break; + case 1: + ok = sscanf(vo_geometry, "%ix%i", &width, &height) == 2; + break; + case 2: + ok = sscanf(vo_geometry, "+%i+%i", &xoff, &yoff) == 2; + break; + case 3: + ok = sscanf(vo_geometry, "%i%%:%i%1[%]", &xper, &yper, percent) == 3; + break; + case 4: + ok = sscanf(vo_geometry, "%i:%i%1[%]", &xoff, &yper, percent) == 3; + 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%1[%]", &xper, percent) == 2; + break; + } + } + if (!ok) { mp_msg(MSGT_VO, MSGL_ERR, "-geometry must be in [WxH][+X+Y] | [X[%%]:[Y[%%]]] format, incorrect (%s)\n", vo_geometry); return 0; } - } - } - } - } - } - } - } mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i," "height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n", @@ -101,5 +98,3 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) } return 1; } - -#undef RESET_GEOMETRY -- cgit v1.2.3 From 0833aaa64d0a933b3d65d00643f0b737683c2801 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Mar 2010 20:36:35 +0000 Subject: Simplify sscanf format strings and get rid of useless percent variable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30821 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/geometry.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libvo/geometry.c b/libvo/geometry.c index ec9e7f0a5f..7576f9feb4 100644 --- a/libvo/geometry.c +++ b/libvo/geometry.c @@ -40,7 +40,6 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) int i; int ok = 0; for (i = 0; !ok && i < 8; i++) { - char percent[2]; width = height = xoff = yoff = xper = yper = INT_MIN; switch (i) { case 0: @@ -53,10 +52,10 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) ok = sscanf(vo_geometry, "+%i+%i", &xoff, &yoff) == 2; break; case 3: - ok = sscanf(vo_geometry, "%i%%:%i%1[%]", &xper, &yper, percent) == 3; + ok = sscanf(vo_geometry, "%i%%:%i%%", &xper, &yper) == 2; break; case 4: - ok = sscanf(vo_geometry, "%i:%i%1[%]", &xoff, &yper, percent) == 3; + ok = sscanf(vo_geometry, "%i:%i%%", &xoff, &yper) == 2; break; case 5: ok = sscanf(vo_geometry, "%i%%:%i", &xper, &yoff) == 2; @@ -65,7 +64,7 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) ok = sscanf(vo_geometry, "%i:%i", &xoff, &yoff) == 2; break; case 7: - ok = sscanf(vo_geometry, "%i%1[%]", &xper, percent) == 2; + ok = sscanf(vo_geometry, "%i%%", &xper) == 1; break; } } -- cgit v1.2.3 From 90188f0e5fce3948dde3d89a409804c492f8375b Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Mar 2010 20:57:56 +0000 Subject: Add support for specifying window position relative to right and bottom screen borders with -geometry. Based on patch by Melchior FRANZ [melchior franz gmail com]. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30822 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/en/mplayer.1 | 7 +++++-- libvo/geometry.c | 15 ++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 0f3bfb1e95..cf89c3ba70 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -3143,13 +3143,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/libvo/geometry.c b/libvo/geometry.c index 7576f9feb4..6653373976 100644 --- a/libvo/geometry.c +++ b/libvo/geometry.c @@ -36,20 +36,23 @@ int geometry_xy_changed; int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) { if(vo_geometry != NULL) { + 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+%i+%i", &width, &height, &xoff, &yoff) == 4; + 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, "+%i+%i", &xoff, &yoff) == 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; @@ -70,14 +73,16 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) } 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 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(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); -- cgit v1.2.3 From baae4d1add5b184dcf0dc3271330ead267e048d7 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Mar 2010 21:01:57 +0000 Subject: Save the new width and height earlier so that e.g. -geometry 30x30-50-50 gives the correct behaviour - before placement would depend on the original movie size instead of the one scaled according to -geometry. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30823 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/geometry.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libvo/geometry.c b/libvo/geometry.c index 6653373976..39ff209b7b 100644 --- a/libvo/geometry.c +++ b/libvo/geometry.c @@ -77,10 +77,16 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) 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: %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); @@ -89,13 +95,9 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int 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); - 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; -- cgit v1.2.3 From 57f4448e7a267d26496e52384f3e1c9c4fcb317d Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Mar 2010 21:32:31 +0000 Subject: Partially revert r30645, the final output format is determined by mpcodecs_config_vo so we need to query it afterwards. Still try to set a more sensible, codec-dependant preferred format even though it is currently ignored. Fixes bug #1659, based on patch by Andrew Wason [rectalogic rectalogic com] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30824 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_dmo.c | 4 +++- libmpcodecs/vd_dshow.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libmpcodecs/vd_dmo.c b/libmpcodecs/vd_dmo.c index 0b2e20e90e..6866aa202b 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 8a1d29c321..82a0193b35 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: -- cgit v1.2.3 From a2a9a53d3f3cf5eaf08e54239e9b07fbf3d8a47c Mon Sep 17 00:00:00 2001 From: stefano Date: Thu, 4 Mar 2010 00:31:10 +0000 Subject: Make swscale-test take in input the name of the input and the output format. Make swscale-test only perform the test from the input to the output format rather than perform all. Also implement swscale-test-all.sh, for performing all the tests. Improve flexibility of the swscale-test tool, this way is simpler to perform only a subset of tests. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30825 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale-test-all.sh | 11 +++++++++++ libswscale/swscale-test.c | 42 ++++++++++++++++++++++++------------------ 2 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 libswscale/swscale-test-all.sh diff --git a/libswscale/swscale-test-all.sh b/libswscale/swscale-test-all.sh new file mode 100644 index 0000000000..569c9020eb --- /dev/null +++ b/libswscale/swscale-test-all.sh @@ -0,0 +1,11 @@ +#! /bin/sh +FFMPEG=../ffmpeg + +input_pix_fmts=$($FFMPEG -pix_fmts | sed -ne '9,$p' | grep '^I' | cut -d" " -f2) +output_pix_fmts=$($FFMPEG -pix_fmts | sed -ne '9,$p' | grep '^.O' | cut -d" " -f2) + +for input_pix_fmt in $input_pix_fmts; do + for output_pix_fmt in $output_pix_fmts; do + swscale-test $input_pix_fmt $output_pix_fmt + done +done diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c index 887973a40e..2ece78a254 100644 --- a/libswscale/swscale-test.c +++ b/libswscale/swscale-test.c @@ -25,9 +25,12 @@ #include #undef HAVE_AV_CONFIG_H + +#include "libavutil/log.h" #include "libavutil/mem.h" #include "libavutil/avutil.h" #include "libavutil/lfg.h" +#include "libavutil/pixdesc.h" #include "swscale.h" /* HACK Duplicated from swscale_internal.h. @@ -186,27 +189,16 @@ end: return res; } -static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h) +static void selfTest(uint8_t *ref[4], int refStride[4], enum PixelFormat srcFormat, enum PixelFormat dstFormat, int w, int h) { const int flags[] = { SWS_FAST_BILINEAR, SWS_BILINEAR, SWS_BICUBIC, SWS_X , SWS_POINT , SWS_AREA, 0 }; const int srcW = w; const int srcH = h; + int i, j, k, res = 0; const int dstW[] = { srcW - srcW/3, srcW, srcW + srcW/3, 0 }; const int dstH[] = { srcH - srcH/3, srcH, srcH + srcH/3, 0 }; - enum PixelFormat srcFormat, dstFormat; - - for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) { - if (!sws_isSupportedInput(srcFormat) || !sws_isSupportedOutput(srcFormat)) - continue; - - for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) { - int i, j, k; - int res = 0; - - if (!sws_isSupportedInput(dstFormat) || !sws_isSupportedOutput(dstFormat)) - continue; printf("%s -> %s\n", sws_format_name(srcFormat), @@ -217,9 +209,7 @@ static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h) for (j = 0; dstH[j] && !res; j++) for (k = 0; flags[k] && !res; k++) res = doTest(ref, refStride, w, h, srcFormat, dstFormat, - srcW, srcH, dstW[i], dstH[j], flags[k]); - } - } + srcW, srcH, dstW[i], dstH[j], flags[k]|SWS_PRINT_INFO); } #define W 96 @@ -235,12 +225,28 @@ int main(int argc, char **argv) int stride[4]={W, W, W, W}; int x, y; struct SwsContext *sws; + enum PixelFormat srcFmt, dstFmt; AVLFG rand; + av_log_set_level(AV_LOG_INFO); + + if (argc < 3) { + fprintf(stderr, "Usage: swscale-test SRC_PIX_FMT DST_PIX_FMT\n"); + return -1; + } + if ((srcFmt = av_get_pix_fmt(argv[1])) == PIX_FMT_NONE) { + fprintf(stderr, "Unknown pixel input format name: '%s'\n", argv[1]); + return -1; + } + if ((dstFmt = av_get_pix_fmt(argv[2])) == PIX_FMT_NONE) { + fprintf(stderr, "Unknown pixel output format name: '%s'\n", argv[2]); + return -1; + } if (!rgb_data || !data) return -1; - sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUVA420P, SWS_BILINEAR, NULL, NULL, NULL); + sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUVA420P, + SWS_BILINEAR|SWS_PRINT_INFO, NULL, NULL, NULL); av_lfg_init(&rand, 1); @@ -253,7 +259,7 @@ int main(int argc, char **argv) sws_freeContext(sws); av_free(rgb_data); - selfTest(src, stride, W, H); + selfTest(src, stride, srcFmt, dstFmt, W, H); av_free(data); return 0; -- cgit v1.2.3 From ff232e1f6f979948a61f6b86a369a87690877cdb Mon Sep 17 00:00:00 2001 From: stefano Date: Thu, 4 Mar 2010 00:31:13 +0000 Subject: Fill the r, g, b values used for computing the c->pal_yuv table in the case where the source format is PIX_FMT_GRAY8. This is required as PIX_FMT_GRAY8 has been declared as a paletted format in FFmpeg r22191, fix GRAY8 -> RGB conversion. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30826 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 689233c07b..83607d2b77 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1849,6 +1849,8 @@ int sws_scale(SwsContext *c, const uint8_t* const src[], const int srcStride[], r= (i>>3 )*255; g= ((i>>1)&3)*85; b= (i&1 )*255; + } else if(c->srcFormat == PIX_FMT_GRAY8) { + r = g = b = i; } else { assert(c->srcFormat == PIX_FMT_BGR4_BYTE); b= (i>>3 )*255; -- cgit v1.2.3 From 6cf92cd32a416ab6fd4741983f0b1d989f6e7158 Mon Sep 17 00:00:00 2001 From: stefano Date: Thu, 4 Mar 2010 01:02:24 +0000 Subject: Revert r30825, it was not supposed to be committed. 127.32L to me, beware when using git svn dcommit for committing stuff to svn... git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30827 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale-test-all.sh | 11 ----------- libswscale/swscale-test.c | 42 ++++++++++++++++++------------------------ 2 files changed, 18 insertions(+), 35 deletions(-) delete mode 100644 libswscale/swscale-test-all.sh diff --git a/libswscale/swscale-test-all.sh b/libswscale/swscale-test-all.sh deleted file mode 100644 index 569c9020eb..0000000000 --- a/libswscale/swscale-test-all.sh +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh -FFMPEG=../ffmpeg - -input_pix_fmts=$($FFMPEG -pix_fmts | sed -ne '9,$p' | grep '^I' | cut -d" " -f2) -output_pix_fmts=$($FFMPEG -pix_fmts | sed -ne '9,$p' | grep '^.O' | cut -d" " -f2) - -for input_pix_fmt in $input_pix_fmts; do - for output_pix_fmt in $output_pix_fmts; do - swscale-test $input_pix_fmt $output_pix_fmt - done -done diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c index 2ece78a254..887973a40e 100644 --- a/libswscale/swscale-test.c +++ b/libswscale/swscale-test.c @@ -25,12 +25,9 @@ #include #undef HAVE_AV_CONFIG_H - -#include "libavutil/log.h" #include "libavutil/mem.h" #include "libavutil/avutil.h" #include "libavutil/lfg.h" -#include "libavutil/pixdesc.h" #include "swscale.h" /* HACK Duplicated from swscale_internal.h. @@ -189,16 +186,27 @@ end: return res; } -static void selfTest(uint8_t *ref[4], int refStride[4], enum PixelFormat srcFormat, enum PixelFormat dstFormat, int w, int h) +static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h) { const int flags[] = { SWS_FAST_BILINEAR, SWS_BILINEAR, SWS_BICUBIC, SWS_X , SWS_POINT , SWS_AREA, 0 }; const int srcW = w; const int srcH = h; - int i, j, k, res = 0; const int dstW[] = { srcW - srcW/3, srcW, srcW + srcW/3, 0 }; const int dstH[] = { srcH - srcH/3, srcH, srcH + srcH/3, 0 }; + enum PixelFormat srcFormat, dstFormat; + + for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) { + if (!sws_isSupportedInput(srcFormat) || !sws_isSupportedOutput(srcFormat)) + continue; + + for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) { + int i, j, k; + int res = 0; + + if (!sws_isSupportedInput(dstFormat) || !sws_isSupportedOutput(dstFormat)) + continue; printf("%s -> %s\n", sws_format_name(srcFormat), @@ -209,7 +217,9 @@ static void selfTest(uint8_t *ref[4], int refStride[4], enum PixelFormat srcForm for (j = 0; dstH[j] && !res; j++) for (k = 0; flags[k] && !res; k++) res = doTest(ref, refStride, w, h, srcFormat, dstFormat, - srcW, srcH, dstW[i], dstH[j], flags[k]|SWS_PRINT_INFO); + srcW, srcH, dstW[i], dstH[j], flags[k]); + } + } } #define W 96 @@ -225,28 +235,12 @@ int main(int argc, char **argv) int stride[4]={W, W, W, W}; int x, y; struct SwsContext *sws; - enum PixelFormat srcFmt, dstFmt; AVLFG rand; - av_log_set_level(AV_LOG_INFO); - - if (argc < 3) { - fprintf(stderr, "Usage: swscale-test SRC_PIX_FMT DST_PIX_FMT\n"); - return -1; - } - if ((srcFmt = av_get_pix_fmt(argv[1])) == PIX_FMT_NONE) { - fprintf(stderr, "Unknown pixel input format name: '%s'\n", argv[1]); - return -1; - } - if ((dstFmt = av_get_pix_fmt(argv[2])) == PIX_FMT_NONE) { - fprintf(stderr, "Unknown pixel output format name: '%s'\n", argv[2]); - return -1; - } if (!rgb_data || !data) return -1; - sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUVA420P, - SWS_BILINEAR|SWS_PRINT_INFO, NULL, NULL, NULL); + sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUVA420P, SWS_BILINEAR, NULL, NULL, NULL); av_lfg_init(&rand, 1); @@ -259,7 +253,7 @@ int main(int argc, char **argv) sws_freeContext(sws); av_free(rgb_data); - selfTest(src, stride, srcFmt, dstFmt, W, H); + selfTest(src, stride, W, H); av_free(data); return 0; -- cgit v1.2.3 From 66278a55ec69be0c4acc8650926f634ebc7f3f9e Mon Sep 17 00:00:00 2001 From: komh Date: Thu, 4 Mar 2010 12:55:30 +0000 Subject: 1. Move the macros for priority classes for OS/2 from priority.c to osdep.h 2. Define SetPriorityClass() and GetCurrentProcess() in osdep.h 3. Include osdep.h in priority.c This removes OS2-platform check in priority.c git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30828 b3059339-0415-0410-9bf9-f77b7e298cf2 --- osdep/osdep.h | 19 ++++++++++++++++++- osdep/priority.c | 25 +++---------------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/osdep/osdep.h b/osdep/osdep.h index 0a64c31120..654309c015 100644 --- a/osdep/osdep.h +++ b/osdep/osdep.h @@ -27,7 +27,24 @@ #define INCL_DOS #define INCL_DOSDEVIOCTL #include -#endif + +#include /* getpid() */ + +#define REALTIME_PRIORITY_CLASS MAKESHORT(0, PRTYC_TIMECRITICAL) +#define HIGH_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM, PRTYC_REGULAR) +#define ABOVE_NORMAL_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM / 2, PRTYC_REGULAR) +#define NORMAL_PRIORITY_CLASS MAKESHORT(0, PRTYC_REGULAR) +#define BELOW_NORMAL_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM, PRTYC_IDLETIME) +#define IDLE_PRIORITY_CLASS MAKESHORT(0, PRTYC_IDLETIME) + +#define SetPriorityClass(pid, prio) \ + DosSetPriority(PRTYS_PROCESS, \ + HIBYTE(prio), \ + LOBYTE(prio), \ + pid) + +#define GetCurrentProcess() getpid() +#endif /* __OS2__ */ #endif /* MPLAYER_OSDEP_H */ diff --git a/osdep/priority.c b/osdep/priority.c index 7d3733e9a7..2f9bafe12b 100644 --- a/osdep/priority.c +++ b/osdep/priority.c @@ -20,23 +20,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifdef __OS2__ - -#define INCL_DOS -#include - -#define REALTIME_PRIORITY_CLASS MAKESHORT(0, PRTYC_TIMECRITICAL) -#define HIGH_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM, PRTYC_REGULAR) -#define ABOVE_NORMAL_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM / 2, PRTYC_REGULAR) -#define NORMAL_PRIORITY_CLASS MAKESHORT(0, PRTYC_REGULAR) -#define BELOW_NORMAL_PRIORITY_CLASS MAKESHORT(PRTYD_MAXIMUM, PRTYC_IDLETIME) -#define IDLE_PRIORITY_CLASS MAKESHORT(0, PRTYC_IDLETIME) - -#else +#include "osdep.h" +#ifdef _WIN32 #include - -#endif /* __OS2__ */ +#endif #include @@ -76,13 +64,6 @@ void set_priority(void) mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_SettingProcessPriority, priority_presets_defs[i].name); -#ifdef __OS2__ - DosSetPriority(PRTYS_PROCESS, - HIBYTE(priority_presets_defs[i].prio), - LOBYTE(priority_presets_defs[i].prio), - 0); -#else SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio); -#endif } } -- cgit v1.2.3 From b10a6917f456125491411f0fc13dd3efae455df8 Mon Sep 17 00:00:00 2001 From: komh Date: Thu, 4 Mar 2010 14:46:44 +0000 Subject: Define HAVE_SETMODE conditionally, and use it in stream/stream_file.c instead of platform specific predefined macros. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30829 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 13 ++++++++++++- stream/stream_file.c | 8 ++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 0ecef04b20..cd48fe088d 100755 --- a/configure +++ b/configure @@ -4050,6 +4050,17 @@ fi echores "$_setenv" +echocheck "setmode()" +_setmode=no +def_setmode='#define HAVE_SETMODE 0' +cat > $TMPC << EOF +#include +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 @@ -8870,6 +8881,7 @@ $def_nanosleep $def_posix_select $def_select $def_setenv +$def_setmode $def_shm $def_strsep $def_swab @@ -9225,7 +9237,6 @@ $def_yasm #define HAVE_LDBRX 0 #define HAVE_POLL_H 1 #define HAVE_PPC4XX 0 -#define HAVE_SETMODE 0 #define HAVE_SYS_SELECT_H 0 #define HAVE_VFP_ARGS 1 #define HAVE_VIRTUALALLOC 0 diff --git a/stream/stream_file.c b/stream/stream_file.c index dceea84db0..9fda32b185 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -145,14 +145,14 @@ static int open_f(stream_t *stream,int mode, void* opts, int* file_format) { // read from stdin mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_ReadSTDIN); f=0; // 0=stdin -#if defined(__MINGW32__) || defined(__OS2__) - setmode(fileno(stdin),O_BINARY); +#if HAVE_SETMODE + setmode(fileno(stdin),O_BINARY); #endif } else { mp_msg(MSGT_OPEN,MSGL_INFO,"Writing to stdout\n"); f=1; -#if defined(__MINGW32__) || defined(__OS2__) - setmode(fileno(stdout),O_BINARY); +#if HAVE_SETMODE + setmode(fileno(stdout),O_BINARY); #endif } } else { -- cgit v1.2.3 From 84bcc5642a5f58807493b776b565c28679870c4e Mon Sep 17 00:00:00 2001 From: sesse Date: Thu, 4 Mar 2010 15:23:52 +0000 Subject: Fix return values of WaitForSingleObject when checking an event. These were simply inverted compared to what they should be. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30830 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/win32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loader/win32.c b/loader/win32.c index f560ffdfb4..b69cf103f1 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -817,8 +817,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) -- cgit v1.2.3 From c6fb73d6b1e9cbcb469b4a98352c6f3c504ba7fc Mon Sep 17 00:00:00 2001 From: sesse Date: Thu, 4 Mar 2010 15:28:02 +0000 Subject: Fix manual reset behavior of Win32 events. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Events have a “reset” member that specify if they flag is automatically set back on read/wait. However, this was populated by bManualReset, so the flag was inverted and once an event was set, it would forever be counted as so. Fixed by inverting the flag. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30831 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/win32.c b/loader/win32.c index b69cf103f1..20eda49c01 100644 --- a/loader/win