From c106fe7751426c8c30706d2f131491dc8f37ee85 Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 2 Mar 2010 19:57:17 +0000 Subject: [PATCH 01/31] 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; From 9beeeb1a9ecec3916f16e8315edc026b7f48ac21 Mon Sep 17 00:00:00 2001 From: komh Date: Wed, 3 Mar 2010 14:32:29 +0000 Subject: [PATCH 02/31] 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 */ + From 55b3c6f0901e7240a4360007c2bc98f372b8e127 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Mar 2010 20:24:46 +0000 Subject: [PATCH 03/31] 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 From 0833aaa64d0a933b3d65d00643f0b737683c2801 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Mar 2010 20:36:35 +0000 Subject: [PATCH 04/31] 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; } } From 90188f0e5fce3948dde3d89a409804c492f8375b Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Mar 2010 20:57:56 +0000 Subject: [PATCH 05/31] 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); From baae4d1add5b184dcf0dc3271330ead267e048d7 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Mar 2010 21:01:57 +0000 Subject: [PATCH 06/31] 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; From 57f4448e7a267d26496e52384f3e1c9c4fcb317d Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Mar 2010 21:32:31 +0000 Subject: [PATCH 07/31] 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: From a2a9a53d3f3cf5eaf08e54239e9b07fbf3d8a47c Mon Sep 17 00:00:00 2001 From: stefano Date: Thu, 4 Mar 2010 00:31:10 +0000 Subject: [PATCH 08/31] 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; From ff232e1f6f979948a61f6b86a369a87690877cdb Mon Sep 17 00:00:00 2001 From: stefano Date: Thu, 4 Mar 2010 00:31:13 +0000 Subject: [PATCH 09/31] 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; From 6cf92cd32a416ab6fd4741983f0b1d989f6e7158 Mon Sep 17 00:00:00 2001 From: stefano Date: Thu, 4 Mar 2010 01:02:24 +0000 Subject: [PATCH 10/31] 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; From 66278a55ec69be0c4acc8650926f634ebc7f3f9e Mon Sep 17 00:00:00 2001 From: komh Date: Thu, 4 Mar 2010 12:55:30 +0000 Subject: [PATCH 11/31] 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 } } From b10a6917f456125491411f0fc13dd3efae455df8 Mon Sep 17 00:00:00 2001 From: komh Date: Thu, 4 Mar 2010 14:46:44 +0000 Subject: [PATCH 12/31] 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 { From 84bcc5642a5f58807493b776b565c28679870c4e Mon Sep 17 00:00:00 2001 From: sesse Date: Thu, 4 Mar 2010 15:23:52 +0000 Subject: [PATCH 13/31] 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) From c6fb73d6b1e9cbcb469b4a98352c6f3c504ba7fc Mon Sep 17 00:00:00 2001 From: sesse Date: Thu, 4 Mar 2010 15:28:02 +0000 Subject: [PATCH 14/31] 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/win32.c +++ b/loader/win32.c @@ -736,7 +736,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 From f32e92b849b99e6001bc426c08edabf07762ca45 Mon Sep 17 00:00:00 2001 From: sesse Date: Thu, 4 Mar 2010 15:31:54 +0000 Subject: [PATCH 15/31] Fix crashes in CreatePalette by fixing the LOGPALETTE struct. CreatePalette had problems for me, and looking at the code it was quite obvious why; someone had reversed the order of the two elements of the LOGPALETTE struct, causing it to allocate and copy a bogus amount of memory. Why on earth anybody would want to do that is beyond me; whoever did it even left a comment, but it wasn't very helpful, as it crashed nevertheless. :-) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30832 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/win32.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/loader/win32.c b/loader/win32.c index 20eda49c01..f31de74730 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -4701,10 +4701,9 @@ typedef struct tagPALETTEENTRY { BYTE peFlags; } PALETTEENTRY; -/* reversed the first 2 entries */ typedef struct tagLOGPALETTE { - WORD palNumEntries; WORD palVersion; + WORD palNumEntries; PALETTEENTRY palPalEntry[1]; } LOGPALETTE; From d36623c01964c5eb9150862924dc717812033c9f Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 4 Mar 2010 15:45:32 +0000 Subject: [PATCH 16/31] Update URL for Subversion homepage. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30833 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/svn-howto.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DOCS/tech/svn-howto.txt b/DOCS/tech/svn-howto.txt index 054e18b4f3..832fb302be 100644 --- a/DOCS/tech/svn-howto.txt +++ b/DOCS/tech/svn-howto.txt @@ -21,7 +21,7 @@ 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. From d19a8ba6d4d89c34b71cc58e04d29ea3f1cf007f Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 4 Mar 2010 15:53:56 +0000 Subject: [PATCH 17/31] Clarify that ssh is not required for committing to MPlayer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30834 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/svn-howto.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DOCS/tech/svn-howto.txt b/DOCS/tech/svn-howto.txt index 832fb302be..932dad237d 100644 --- a/DOCS/tech/svn-howto.txt +++ b/DOCS/tech/svn-howto.txt @@ -25,6 +25,10 @@ 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. From 64513539c1f51b2e58d5d6f354ce4b7c0fb7a0a7 Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 4 Mar 2010 15:55:35 +0000 Subject: [PATCH 18/31] Use $() syntax instead of backticks, it is easier to nest. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30835 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/mirrors/update_mplayer_rsync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DOCS/tech/mirrors/update_mplayer_rsync b/DOCS/tech/mirrors/update_mplayer_rsync index cafaabe594..034ff0db89 100644 --- a/DOCS/tech/mirrors/update_mplayer_rsync +++ b/DOCS/tech/mirrors/update_mplayer_rsync @@ -10,7 +10,7 @@ MAILADR= #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,7 +30,7 @@ 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}'` +x=$(wc -l $TMPFILE | awk '{print $1}') if [ "$x" -ne "10" ] then mailx -s "MPlayer mirror" $MAILADR < $TMPFILE From c62d2888ab077a94d02dfcf0517e1d56c434c05b Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 4 Mar 2010 15:56:34 +0000 Subject: [PATCH 19/31] cosmetics: Use consistent if expression syntax. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30836 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/mirrors/update_mplayer_rsync | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DOCS/tech/mirrors/update_mplayer_rsync b/DOCS/tech/mirrors/update_mplayer_rsync index 034ff0db89..cde19d9140 100644 --- a/DOCS/tech/mirrors/update_mplayer_rsync +++ b/DOCS/tech/mirrors/update_mplayer_rsync @@ -31,8 +31,7 @@ rsync -pxlrHtWv --delete --delete-after --exclude '/benchmark' \ MPlayer >> $TMPFILE 2>&1 x=$(wc -l $TMPFILE | awk '{print $1}') -if [ "$x" -ne "10" ] -then +if [ "$x" -ne "10" ]; then mailx -s "MPlayer mirror" $MAILADR < $TMPFILE fi rm -f $TMPFILE From 5fb74d581fbd03748aa94782645dec2e14e19b4d Mon Sep 17 00:00:00 2001 From: sesse Date: Thu, 4 Mar 2010 15:57:08 +0000 Subject: [PATCH 20/31] Make emulated Win32 critical sections thread safe. Earlier, cs->locked was accessed outside the mutex to get around the problem that default pthread mutexes are not recursive (ie., you cannot do a double-lock from the same thread), causing a thread-safety problem, as both detected by Helgrind and showing up in some multithreaded codecs. The ideal solution here would be to simply use recursive pthread mutexes, but there were concerns about reduced debuggability and possibly portability. Thus, instead, rewrite the critical sections to be a simple lock count (with owner) protected by a regular mutex. Whenever a thread wants to enter the critical section and lock_count is not 0, it sleeps on a special event that tells it when the critical section is available. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30837 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/win32.c | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/loader/win32.c b/loader/win32.c index f31de74730..2906d14102 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; }; @@ -1331,7 +1332,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 +1344,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 +1377,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 +1404,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 +1435,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 %p!!\n", c); } + pthread_mutex_unlock(&(cs->mutex)); #ifndef GARBAGE pthread_mutex_destroy(&(cs->mutex)); + pthread_cond_destroy(&(cs->unlocked)); // released by GarbageCollector in my_relase otherwise #endif my_release(cs); From d8c9cd8bbd4411ef2942dbdc4f1641e45d7b2d80 Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 4 Mar 2010 15:57:21 +0000 Subject: [PATCH 21/31] Run script with /bin/sh instead of bash. There is nothing bash-specific in this shell script. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30838 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/mirrors/update_mplayer_rsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DOCS/tech/mirrors/update_mplayer_rsync b/DOCS/tech/mirrors/update_mplayer_rsync index cde19d9140..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$ From ceb90b2c199b1fe6bea1e9dc20834718d3c53b18 Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 4 Mar 2010 15:58:09 +0000 Subject: [PATCH 22/31] Remove NUT specification stubs. They have been obsolete for a long time and point nowhere. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30839 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/nut.txt | 6 ------ DOCS/tech/oggless-xiph-codecs.txt | 6 ------ 2 files changed, 12 deletions(-) delete mode 100644 DOCS/tech/nut.txt delete mode 100644 DOCS/tech/oggless-xiph-codecs.txt 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. From 487b94aa88f26bef0b520de127d2eb354ae96f48 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Thu, 4 Mar 2010 16:57:04 +0000 Subject: [PATCH 23/31] Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in libswscale. Patch by Alexis Ballier, alexis D ballier A gmail git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30840 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 12 ++++++++---- libswscale/swscale_internal.h | 12 ++++++++---- libswscale/yuv2rgb.c | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 83607d2b77..a4e9aa7a5f 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -765,8 +765,10 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc dest+=6;\ }\ break;\ - case PIX_FMT_RGB565:\ - case PIX_FMT_BGR565:\ + case PIX_FMT_RGB565BE:\ + case PIX_FMT_RGB565LE:\ + case PIX_FMT_BGR565BE:\ + case PIX_FMT_BGR565LE:\ {\ const int dr1= dither_2x2_8[y&1 ][0];\ const int dg1= dither_2x2_4[y&1 ][0];\ @@ -780,8 +782,10 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc }\ }\ break;\ - case PIX_FMT_RGB555:\ - case PIX_FMT_BGR555:\ + case PIX_FMT_RGB555BE:\ + case PIX_FMT_RGB555LE:\ + case PIX_FMT_BGR555BE:\ + case PIX_FMT_BGR555LE:\ {\ const int dr1= dither_2x2_8[y&1 ][0];\ const int dg1= dither_2x2_8[y&1 ][1];\ diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 836a868055..5534e467ea 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -391,8 +391,10 @@ const char *sws_format_name(enum PixelFormat format); || (x)==PIX_FMT_RGB32 \ || (x)==PIX_FMT_RGB32_1 \ || (x)==PIX_FMT_RGB24 \ - || (x)==PIX_FMT_RGB565 \ - || (x)==PIX_FMT_RGB555 \ + || (x)==PIX_FMT_RGB565BE \ + || (x)==PIX_FMT_RGB565LE \ + || (x)==PIX_FMT_RGB555BE \ + || (x)==PIX_FMT_RGB555LE \ || (x)==PIX_FMT_RGB8 \ || (x)==PIX_FMT_RGB4 \ || (x)==PIX_FMT_RGB4_BYTE \ @@ -403,8 +405,10 @@ const char *sws_format_name(enum PixelFormat format); (x)==PIX_FMT_BGR32 \ || (x)==PIX_FMT_BGR32_1 \ || (x)==PIX_FMT_BGR24 \ - || (x)==PIX_FMT_BGR565 \ - || (x)==PIX_FMT_BGR555 \ + || (x)==PIX_FMT_BGR565BE \ + || (x)==PIX_FMT_BGR565LE \ + || (x)==PIX_FMT_BGR555BE \ + || (x)==PIX_FMT_BGR555LE \ || (x)==PIX_FMT_BGR8 \ || (x)==PIX_FMT_BGR4 \ || (x)==PIX_FMT_BGR4_BYTE \ diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 2a05477bda..babc8c311e 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -33,6 +33,7 @@ #include "swscale.h" #include "swscale_internal.h" #include "libavutil/x86_cpu.h" +#include "libavutil/bswap.h" extern const uint8_t dither_8x8_32[8][8]; extern const uint8_t dither_8x8_73[8][8]; @@ -596,12 +597,18 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int const int isRgb = c->dstFormat==PIX_FMT_RGB32 || c->dstFormat==PIX_FMT_RGB32_1 || c->dstFormat==PIX_FMT_BGR24 - || c->dstFormat==PIX_FMT_RGB565 - || c->dstFormat==PIX_FMT_RGB555 + || c->dstFormat==PIX_FMT_RGB565BE + || c->dstFormat==PIX_FMT_RGB565LE + || c->dstFormat==PIX_FMT_RGB555BE + || c->dstFormat==PIX_FMT_RGB555LE || c->dstFormat==PIX_FMT_RGB8 || c->dstFormat==PIX_FMT_RGB4 || c->dstFormat==PIX_FMT_RGB4_BYTE || c->dstFormat==PIX_FMT_MONOBLACK; + const int isNotNe = c->dstFormat==PIX_FMT_NE(RGB565LE,RGB565BE) + || c->dstFormat==PIX_FMT_NE(RGB555LE,RGB555BE) + || c->dstFormat==PIX_FMT_NE(BGR565LE,BGR565BE) + || c->dstFormat==PIX_FMT_NE(BGR555LE,BGR555BE); const int bpp = c->dstFormatBpp; uint8_t *y_table; uint16_t *y_table16; @@ -709,6 +716,9 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int y_table16[i+2048] = (yval >> 3) << bbase; yb += cy; } + if(isNotNe) + for (i = 0; i < 1024*3; i++) + y_table16[i] = bswap_16(y_table16[i]); fill_table(c->table_rV, 2, crv, y_table16 + yoffs); fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024); fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048); From 11d73c297d4508cc857fd9cfc350cd37f6c779bf Mon Sep 17 00:00:00 2001 From: benoit Date: Fri, 5 Mar 2010 08:32:54 +0000 Subject: [PATCH 24/31] libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special converter with support for rgb444 output format. Patch by Janusz Krzysztofik jkrzyszt chez tis icnet pl git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30841 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 9 ++++++- libswscale/swscale_internal.h | 2 ++ libswscale/yuv2rgb.c | 49 +++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index a4e9aa7a5f..ab77537ff2 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -27,7 +27,7 @@ {BGR,RGB}{1,4,8,15,16} support dithering unscaled special converters (YV12=I420=IYUV, Y800=Y8) - YV12 -> {BGR,RGB}{1,4,8,15,16,24,32} + YV12 -> {BGR,RGB}{1,4,8,12,15,16,24,32} x -> x YUV9 -> YV12 YUV9/YV12 -> Y800 @@ -198,6 +198,13 @@ DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_8)[2][8]={ { 0, 4, 0, 4, 0, 4, 0, 4, }, }; +DECLARE_ALIGNED(8, const uint8_t, dither_4x4_16)[4][8]={ +{ 8, 4, 11, 7, 8, 4, 11, 7, }, +{ 2, 14, 1, 13, 2, 14, 1, 13, }, +{ 10, 6, 9, 5, 10, 6, 9, 5, }, +{ 0, 12, 3, 15, 0, 12, 3, 15, }, +}; + DECLARE_ALIGNED(8, const uint8_t, dither_8x8_32)[8][8]={ { 17, 9, 23, 15, 16, 8, 22, 14, }, { 5, 29, 3, 27, 4, 28, 2, 26, }, diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 5534e467ea..856b61c484 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -395,6 +395,7 @@ const char *sws_format_name(enum PixelFormat format); || (x)==PIX_FMT_RGB565LE \ || (x)==PIX_FMT_RGB555BE \ || (x)==PIX_FMT_RGB555LE \ + || (x)==PIX_FMT_RGB444 \ || (x)==PIX_FMT_RGB8 \ || (x)==PIX_FMT_RGB4 \ || (x)==PIX_FMT_RGB4_BYTE \ @@ -409,6 +410,7 @@ const char *sws_format_name(enum PixelFormat format); || (x)==PIX_FMT_BGR565LE \ || (x)==PIX_FMT_BGR555BE \ || (x)==PIX_FMT_BGR555LE \ + || (x)==PIX_FMT_BGR444 \ || (x)==PIX_FMT_BGR8 \ || (x)==PIX_FMT_BGR4 \ || (x)==PIX_FMT_BGR4_BYTE \ diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index babc8c311e..c3c2e74ac9 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -35,6 +35,7 @@ #include "libavutil/x86_cpu.h" #include "libavutil/bswap.h" +extern const uint8_t dither_4x4_16[4][8]; extern const uint8_t dither_8x8_32[8][8]; extern const uint8_t dither_8x8_73[8][8]; extern const uint8_t dither_8x8_220[8][8]; @@ -351,6 +352,32 @@ YUV2RGBFUNC(yuv2rgb_c_8, uint8_t, 0) CLOSEYUV2RGBFUNC(8) #endif +// r, g, b, dst_1, dst_2 +YUV2RGBFUNC(yuv2rgb_c_12_ordered_dither, uint16_t, 0) + const uint8_t *d16 = dither_4x4_16[y&3]; +#define PUTRGB12(dst,src,i,o) \ + Y = src[2*i]; \ + dst[2*i] = r[Y+d16[0+o]] + g[Y+d16[0+o]] + b[Y+d16[0+o]]; \ + Y = src[2*i+1]; \ + dst[2*i+1] = r[Y+d16[1+o]] + g[Y+d16[1+o]] + b[Y+d16[1+o]]; + + LOADCHROMA(0); + PUTRGB12(dst_1,py_1,0,0); + PUTRGB12(dst_2,py_2,0,0+8); + + LOADCHROMA(1); + PUTRGB12(dst_2,py_2,1,2+8); + PUTRGB12(dst_1,py_1,1,2); + + LOADCHROMA(2); + PUTRGB12(dst_1,py_1,2,4); + PUTRGB12(dst_2,py_2,2,4+8); + + LOADCHROMA(3); + PUTRGB12(dst_2,py_2,3,6+8); + PUTRGB12(dst_1,py_1,3,6); +CLOSEYUV2RGBFUNC(8) + // r, g, b, dst_1, dst_2 YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0) const uint8_t *d32 = dither_8x8_32[y&7]; @@ -553,6 +580,8 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c) case PIX_FMT_BGR565: case PIX_FMT_RGB555: case PIX_FMT_BGR555: return yuv2rgb_c_16; + case PIX_FMT_RGB444: + case PIX_FMT_BGR444: return yuv2rgb_c_12_ordered_dither; case PIX_FMT_RGB8: case PIX_FMT_BGR8: return yuv2rgb_c_8_ordered_dither; case PIX_FMT_RGB4: @@ -601,6 +630,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int || c->dstFormat==PIX_FMT_RGB565LE || c->dstFormat==PIX_FMT_RGB555BE || c->dstFormat==PIX_FMT_RGB555LE + || c->dstFormat==PIX_FMT_RGB444 || c->dstFormat==PIX_FMT_RGB8 || c->dstFormat==PIX_FMT_RGB4 || c->dstFormat==PIX_FMT_RGB4_BYTE @@ -701,6 +731,25 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048); fill_gv_table(c->table_gV, 1, cgv); break; + case 12: + rbase = isRgb ? 8 : 0; + gbase = 4; + bbase = isRgb ? 0 : 8; + c->yuvTable = av_malloc(1024*3*2); + y_table16 = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024; i++) { + uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); + y_table16[i ] = (yval >> 4) << rbase; + y_table16[i+1024] = (yval >> 4) << gbase; + y_table16[i+2048] = (yval >> 4) << bbase; + yb += cy; + } + fill_table(c->table_rV, 2, crv, y_table16 + yoffs); + fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024); + fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048); + fill_gv_table(c->table_gV, 2, cgv); + break; case 15: case 16: rbase = isRgb ? bpp - 5 : 0; From de6f717b0902140971a16f30ff81a752c9c940a5 Mon Sep 17 00:00:00 2001 From: benoit Date: Fri, 5 Mar 2010 08:41:35 +0000 Subject: [PATCH 25/31] Cosmetics: fix vertical alignment. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30842 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/yuv2rgb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index c3c2e74ac9..c7afb18deb 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -740,9 +740,9 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int yb = -(384<<16) - oy; for (i = 0; i < 1024; i++) { uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); - y_table16[i ] = (yval >> 4) << rbase; + y_table16[i ] = (yval >> 4) << rbase; y_table16[i+1024] = (yval >> 4) << gbase; - y_table16[i+2048] = (yval >> 4) << bbase; + y_table16[i+2048] = (yval >> 4) << bbase; yb += cy; } fill_table(c->table_rV, 2, crv, y_table16 + yoffs); From 61f351dc908b4868290aa69629e22befcb633ee4 Mon Sep 17 00:00:00 2001 From: sesse Date: Fri, 5 Mar 2010 11:11:47 +0000 Subject: [PATCH 26/31] Support thread handles in WaitForSingleObject. Some codecs need this for clean shutdown (as opposed to a crash); we don't really support timed wait since POSIX doesn't, but it doesn't seem necessary. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30843 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/win32.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/loader/win32.c b/loader/win32.c index 2906d14102..2282258d8d 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -569,16 +569,28 @@ static HMODULE WINAPI expGetDriverModuleHandle(DRVR* pdrv) #define MODULE_HANDLE_winmm ((HMODULE)0x128) #define MODULE_HANDLE_psapi ((HMODULE)0x129) +/* fake EXE struct to make msvcrt8+ not to crash: + it checks all exe sections for a section named .mixcrt + we fake a section with that name, so the crt will avoid + using Encode/Decode Pointer, as we was a posix binary */ +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 = ".mixcrt" +}; + 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); @@ -787,6 +799,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) { /** @@ -802,6 +815,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) From c27b99441b75a8a6c49583c70e4e27d4f61a35a5 Mon Sep 17 00:00:00 2001 From: sesse Date: Fri, 5 Mar 2010 11:14:07 +0000 Subject: [PATCH 27/31] Partial revert of r30843. Some extra changes snuck into my commit; they'll probably be reviewed and committed to Subversion eventually, but were not part of the fix for WaitForSingleObject on thread handles. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30844 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/win32.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/loader/win32.c b/loader/win32.c index 2282258d8d..e224d24aec 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -569,28 +569,16 @@ static HMODULE WINAPI expGetDriverModuleHandle(DRVR* pdrv) #define MODULE_HANDLE_winmm ((HMODULE)0x128) #define MODULE_HANDLE_psapi ((HMODULE)0x129) -/* fake EXE struct to make msvcrt8+ not to crash: - it checks all exe sections for a section named .mixcrt - we fake a section with that name, so the crt will avoid - using Encode/Decode Pointer, as we was a posix binary */ -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 = ".mixcrt" -}; - static HMODULE WINAPI expGetModuleHandleA(const char* name) { WINE_MODREF* wm; HMODULE result; if(!name) - result=(HMODULE)&mp_exe.doshdr; - +#ifdef CONFIG_QTX_CODECS + result=1; +#else + result=0; +#endif else { wm=MODULE_FindModule(name); From 4a6758e1fdd1725bf863598dc86f6927cbb89378 Mon Sep 17 00:00:00 2001 From: jrash Date: Fri, 5 Mar 2010 12:43:15 +0000 Subject: [PATCH 28/31] sync with en/mplayer.1 rev. 30822 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30845 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/man/zh_CN/mplayer.1 | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) 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= 设置缓冲大小为 ,以采样数为单位(默认值: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 . From 7852aff0c4b29e0de9a16b74e0d9d1d4cd6586ec Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 5 Mar 2010 20:15:16 +0000 Subject: [PATCH 29/31] Reuse fb_tty_fd for setting up the text area. This avoids the fopen call which could end up creating a /dev/tty file if it did not exist. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30846 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_fbdev.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c index c3341858c2..075b6486ed 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) From 75f3bd09ea815d3db0790d40f679fde172b336dc Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 5 Mar 2010 21:39:27 +0000 Subject: [PATCH 30/31] try to avoid returning odd slices. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30847 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_template.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index bbd9a1f701..48450f7629 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -2651,8 +2651,10 @@ static int RENAME(swScale)(SwsContext *c, const uint8_t* src[], int srcStride[], unsigned char *aDest=(CONFIG_SWSCALE_ALPHA && alpPixBuf) ? dst[3]+dstStride[3]*dstY : NULL; const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input + const int firstLumSrcY2= vLumFilterPos[FFMIN(dstY | ((1<chrDstVSubSample) - 1), dstH-1)]; const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input int lastLumSrcY= firstLumSrcY + vLumFilterSize -1; // Last line needed as input + int lastLumSrcY2=firstLumSrcY2+ vLumFilterSize -1; // Last line needed as input int lastChrSrcY= firstChrSrcY + vChrFilterSize -1; // Last line needed as input int enough_lines; @@ -2669,7 +2671,8 @@ static int RENAME(swScale)(SwsContext *c, const uint8_t* src[], int srcStride[], firstChrSrcY, lastChrSrcY, lastInChrBuf); // Do we have enough lines in this slice to output the dstY line - enough_lines = lastLumSrcY < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample); + enough_lines = lastLumSrcY2 < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample); + if (!enough_lines) { lastLumSrcY = srcSliceY + srcSliceH - 1; lastChrSrcY = chrSrcSliceY + chrSrcSliceH - 1; From fbb74e16a38d6a5af31a7fb369195988f7414766 Mon Sep 17 00:00:00 2001 From: sesse Date: Fri, 5 Mar 2010 23:09:36 +0000 Subject: [PATCH 31/31] Make GetModuleHandle(NULL) return a valid pointer. Some codecs, and more recently Microsoft's CRT library, expect GetModuleHandle(NULL) to return a pointer to the program's PE header mapped in memory. Thus, just returning 0x0 or 0x1 won't do it anymore, so create a minimal PE header and return that. Patch originally by Gianluigi Tiesi ( mplayer (at) netfarm (dot) it ). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30848 b3059339-0415-0410-9bf9-f77b7e298cf2 --- loader/win32.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/loader/win32.c b/loader/win32.c index e224d24aec..08985a28e1 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -569,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);