[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[622] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-28 17:03:20
|
Revision: 622 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=622&view=rev Author: nickols_k Date: 2012-12-28 17:03:09 +0000 (Fri, 28 Dec 2012) Log Message: ----------- use new version of get_path() + cleanups + fixes Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/input2/input.cpp mplayerxp/input2/input.h mplayerxp/libao3/ao_alsa.cpp mplayerxp/libao3/ao_arts.cpp mplayerxp/libao3/ao_esd.cpp mplayerxp/libao3/ao_jack.cpp mplayerxp/libao3/ao_nas.cpp mplayerxp/libao3/ao_null.cpp mplayerxp/libao3/ao_openal.cpp mplayerxp/libao3/ao_sdl.cpp mplayerxp/libao3/ao_wav.cpp mplayerxp/libao3/audio_out.cpp mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libmpdemux/asf.h mplayerxp/libmpdemux/demux_ac3.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_dca.cpp mplayerxp/libmpdemux/demux_dv.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_flac.cpp mplayerxp/libmpdemux/demux_lavf.cpp mplayerxp/libmpdemux/demux_mkv.cpp mplayerxp/libmpdemux/demux_mov.cpp mplayerxp/libmpdemux/demux_mp3.cpp mplayerxp/libmpdemux/demux_mpg.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpdemux/demux_musepack.cpp mplayerxp/libmpdemux/demux_nuv.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_pva.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_realaud.cpp mplayerxp/libmpdemux/demux_roq.cpp mplayerxp/libmpdemux/demux_snd_au.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_ty.cpp mplayerxp/libmpdemux/demux_viv.cpp mplayerxp/libmpdemux/demux_voc.cpp mplayerxp/libmpdemux/demux_vqf.cpp mplayerxp/libmpdemux/demux_wav.cpp mplayerxp/libmpdemux/mux_mpxp64.cpp mplayerxp/libmpdemux/muxer.h mplayerxp/libmpdemux/stheader.cpp mplayerxp/libmpdemux/sub_cc.cpp mplayerxp/libmpdemux/sub_ty.cpp mplayerxp/libmpdemux/yuv4mpeg_intern.h mplayerxp/libmpstream2/cdd.h mplayerxp/libmpstream2/cddb.cpp mplayerxp/libmpstream2/cookies.cpp mplayerxp/libmpstream2/librtsp/rtsp.h mplayerxp/libmpstream2/librtsp/rtsp_rtp.h mplayerxp/libmpstream2/mrl.cpp mplayerxp/libmpstream2/network.h mplayerxp/libmpstream2/network_asf_mmst.cpp mplayerxp/libmpstream2/pnm.cpp mplayerxp/libmpstream2/realrtsp/real.h mplayerxp/libmpstream2/rtp_cache.cpp mplayerxp/libmpstream2/rtp_cache.h mplayerxp/libmpstream2/s_dvdnav.cpp mplayerxp/libmpstream2/s_dvdread.cpp mplayerxp/libmpstream2/s_ftp.cpp mplayerxp/libmpsub/subreader.cpp mplayerxp/libplaytree2/playtree.cpp mplayerxp/libplaytree2/playtree.h mplayerxp/mplayerxp.cpp mplayerxp/mplayerxp.h mplayerxp/osdep/cpudetect.cpp mplayerxp/osdep/get_path.cpp mplayerxp/osdep/get_path.h mplayerxp/postproc/af_export.cpp mplayerxp/postproc/libmenu/menu_filesel.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/dump.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -71,9 +71,11 @@ exit_player(MSGTR_Exit_eof); } -#define MUX_HAVE_AUDIO 0x01 -#define MUX_HAVE_VIDEO 0x02 -#define MUX_HAVE_SUBS 0x04 +enum { + MUX_HAVE_AUDIO=0x01, + MUX_HAVE_VIDEO=0x02, + MUX_HAVE_SUBS=0x04 +}; struct dump_priv_t : public Opaque { public: dump_priv_t(libinput_t& l):libinput(l) {} Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/input2/input.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -39,22 +39,19 @@ namespace mpxp { -#ifndef MP_MAX_KEY_FD -#define MP_MAX_KEY_FD 10 -#endif +static const int MP_MAX_KEY_FD=10; +static const int MP_MAX_CMD_FD=10; -#ifndef MP_MAX_CMD_FD -#define MP_MAX_CMD_FD 10 -#endif +enum { + MP_FD_EOF=(1<<0), + MP_FD_DROP=(1<<1), + MP_FD_DEAD=(1<<2), + MP_FD_GOT_CMD=(1<<3), + MP_FD_NO_SELECT=(1<<4) +}; -#define MP_FD_EOF (1<<0) -#define MP_FD_DROP (1<<1) -#define MP_FD_DEAD (1<<2) -#define MP_FD_GOT_CMD (1<<3) -#define MP_FD_NO_SELECT (1<<4) +static const int CMD_QUEUE_SIZE=100; -#define CMD_QUEUE_SIZE 100 - typedef int (*mp_key_func_t)(any_t* ctx); // These functions should return the key code or one of the error code typedef int (*mp_cmd_func_t)(any_t* ctx,char* dest,int size); // These functions should act like read but they must use our error code (if needed ;-) typedef void (*mp_close_func_t)(any_t* ctx); // These are used to close the driver @@ -90,7 +87,7 @@ }; struct libinput_t : public Opaque { - libinput_t() {} + libinput_t(const std::map<std::string,std::string>& _envm):envm(_envm) {} virtual ~libinput_t() {} Opaque unusable; @@ -115,6 +112,7 @@ int in_file_fd; int tim; //for getch2 char key_str[12]; + const std::map<std::string,std::string>& envm; }; struct input_conf_t { @@ -656,7 +654,7 @@ return code; } -#define MP_CMD_MAX_SIZE 256 +static const int MP_CMD_MAX_SIZE=256; static int mp_input_read_cmd(mp_input_fd_t* mp_fd, char** ret) { char* end; (*ret) = NULL; @@ -1124,8 +1122,8 @@ delete binds; } -#define BS_MAX 256 -#define SPACE_CHAR " \n\r\t" +static const int BS_MAX=256; +static const char* SPACE_CHAR=" \n\r\t"; static int mp_input_parse_config(libinput_t& priv,const std::string& file) { int fd; @@ -1268,7 +1266,7 @@ static void mp_input_init(libinput_t& priv) { std::string file; - file = config_file[0] != '/' ? get_path(config_file) : config_file; + file = config_file[0] != '/' ? get_path(priv.envm,config_file) : config_file; if(file.empty()) return; if(! mp_input_parse_config(priv,file)) { @@ -1334,8 +1332,8 @@ if(priv.in_file_fd==0) getch2_disable(); } -libinput_t& mp_input_open() { - libinput_t& priv=*new(zeromem) libinput_t; +libinput_t& mp_input_open(const std::map<std::string,std::string>& envm) { + libinput_t& priv=*new(zeromem) libinput_t(envm); priv.ar_state=-1; priv.in_file_fd=-1; mp_input_init(priv); Modified: mplayerxp/input2/input.h =================================================================== --- mplayerxp/input2/input.h 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/input2/input.h 2012-12-28 17:03:09 UTC (rev 622) @@ -4,6 +4,8 @@ #include "osdep/mplib.h" using namespace mpxp; +#include <map> + #include "xmpcore/xmp_enums.h" namespace mpxp { @@ -155,7 +157,7 @@ extern void mp_cmd_free(mp_cmd_t* cmd); // When you create a new driver you should add it in this 2 functions. - extern libinput_t& mp_input_open(); + extern libinput_t& mp_input_open(const std::map<std::string,std::string>& envm); extern void mp_input_close(libinput_t& handle); extern void mp_input_print_keys(libinput_t& handle); Modified: mplayerxp/libao3/ao_alsa.cpp =================================================================== --- mplayerxp/libao3/ao_alsa.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libao3/ao_alsa.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -107,7 +107,7 @@ snd_pcm_sw_params_free(swparams); } -#define ALSA_DEVICE_SIZE 48 +static const int ALSA_DEVICE_SIZE=48; #define BUFFERTIME // else SET_CHUNK_SIZE #undef USE_POLL Modified: mplayerxp/libao3/ao_arts.cpp =================================================================== --- mplayerxp/libao3/ao_arts.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libao3/ao_arts.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -34,8 +34,8 @@ namespace mpxp { /* Feel mp_free to experiment with the following values: */ -#define ARTS_PACKETS 10 /* Number of audio packets */ -#define ARTS_PACKET_SIZE_LOG2 11 /* Log2 of audio packet size */ +static const int ARTS_PACKETS=10; /* Number of audio packets */ +static const int ARTS_PACKET_SIZE_LOG2=11; /* Log2 of audio packet size */ class Arts_AO_Interface : public AO_Interface { public: Modified: mplayerxp/libao3/ao_esd.cpp =================================================================== --- mplayerxp/libao3/ao_esd.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libao3/ao_esd.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -58,7 +58,7 @@ namespace mpxp { -#define ESD_RESAMPLES 0 +static const int ESD_RESAMPLES=0; #define ESD_DEBUG 0 #if ESD_DEBUG @@ -67,8 +67,8 @@ #define dprintf(...) /**/ #endif -#define ESD_CLIENT_NAME "MPlayerXP" -#define ESD_MAX_DELAY (1.0f) /* max amount of data buffered in esd (#sec) */ +static const char* ESD_CLIENT_NAME="MPlayerXP"; +static const float ESD_MAX_DELAY=1.0f; /* max amount of data buffered in esd (#sec) */ class Esd_AO_Interface : public AO_Interface { public: Modified: mplayerxp/libao3/ao_jack.cpp =================================================================== --- mplayerxp/libao3/ao_jack.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libao3/ao_jack.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -42,7 +42,7 @@ namespace mpxp { //! maximum number of channels supported, avoids lots of mallocs -#define MAX_CHANS 6 +static const int MAX_CHANS=6; class Jack_AO_Interface : public AO_Interface { public: Jack_AO_Interface(const std::string& subdevice); @@ -90,10 +90,10 @@ }; //! size of one chunk, if this is too small MPlayer will start to "stutter" //! after a short time of playback -#define CHUNK_SIZE (16 * 1024) +static const int CHUNK_SIZE=(16 * 1024); //! number of "virtual" chunks the priv->buffer consists of -#define NUM_CHUNKS 8 -#define BUFFSIZE (NUM_CHUNKS * CHUNK_SIZE) +static const int NUM_CHUNKS=8; +static const int BUFFSIZE=(NUM_CHUNKS * CHUNK_SIZE); Jack_AO_Interface::Jack_AO_Interface(const std::string& _subdevice) :AO_Interface(_subdevice) {} Jack_AO_Interface::~Jack_AO_Interface() { Modified: mplayerxp/libao3/ao_nas.cpp =================================================================== --- mplayerxp/libao3/ao_nas.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libao3/ao_nas.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -64,7 +64,7 @@ namespace mpxp { /* NAS_FRAG_SIZE must be a power-of-two value */ -#define NAS_FRAG_SIZE 4096 +static const int NAS_FRAG_SIZE=4096; static const char * const nas_event_types[] = { "Undefined", Modified: mplayerxp/libao3/ao_null.cpp =================================================================== --- mplayerxp/libao3/ao_null.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libao3/ao_null.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -19,11 +19,11 @@ #include "ao_msg.h" namespace mpxp { -#define WAV_ID_RIFF FOURCC_TAG(0x46,0x46,0x49,0x52) /* "RIFF" */ -#define WAV_ID_WAVE FOURCC_TAG(0x45,0x56,0x41,0x57) /* "WAVE" */ -#define WAV_ID_FMT FOURCC_TAG(0x20,0x74,0x6d,0x66) /* "fmt " */ -#define WAV_ID_DATA FOURCC_TAG(0x61,0x74,0x61,0x64) /* "data" */ -#define WAV_ID_PCM TWOCC_TAG (0x00,0x01) +static const uint32_t WAV_ID_RIFF=FOURCC_TAG(0x46,0x46,0x49,0x52); /* "RIFF" */ +static const uint32_t WAV_ID_WAVE=FOURCC_TAG(0x45,0x56,0x41,0x57); /* "WAVE" */ +static const uint32_t WAV_ID_FMT =FOURCC_TAG(0x20,0x74,0x6d,0x66); /* "fmt " */ +static const uint32_t WAV_ID_DATA=FOURCC_TAG(0x61,0x74,0x61,0x64); /* "data" */ +static const uint32_t WAV_ID_PCM =TWOCC_TAG (0x00,0x01); struct WaveHeader { uint32_t riff; uint32_t file_length; Modified: mplayerxp/libao3/ao_openal.cpp =================================================================== --- mplayerxp/libao3/ao_openal.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libao3/ao_openal.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -37,9 +37,9 @@ #include "ao_msg.h" namespace mpxp { -#define MAX_CHANS 8 -#define NUM_BUF 128 -#define CHUNK_SIZE 512 +static const int MAX_CHANS=8; +static const int NUM_BUF=128; +static const int CHUNK_SIZE=512; class OpenAL_AO_Interface : public AO_Interface { public: OpenAL_AO_Interface(const std::string& subdevice); Modified: mplayerxp/libao3/ao_sdl.cpp =================================================================== --- mplayerxp/libao3/ao_sdl.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libao3/ao_sdl.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -28,12 +28,12 @@ namespace mpxp { // Samplesize used by the SDLlib AudioSpec struct -#define SAMPLESIZE 1024 +static const int SAMPLESIZE=1024; // General purpose Ring-buffering routines -#define BUFFSIZE 4096 -#define NUM_BUFS 16 +static const int BUFFSIZE=4096; +static const int NUM_BUFS=16; class SDL_AO_Interface : public AO_Interface { public: SDL_AO_Interface(const std::string& subdevice); Modified: mplayerxp/libao3/ao_wav.cpp =================================================================== --- mplayerxp/libao3/ao_wav.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libao3/ao_wav.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -40,12 +40,12 @@ #endif namespace mpxp { -#define WAV_ID_RIFF 0x46464952 /* "RIFF" */ -#define WAV_ID_WAVE 0x45564157 /* "WAVE" */ -#define WAV_ID_FMT 0x20746d66 /* "fmt " */ -#define WAV_ID_DATA 0x61746164 /* "data" */ -#define WAV_ID_PCM 0x0001 -#define WAV_ID_FLOAT_PCM 0x0003 +static const uint32_t WAV_ID_RIFF=0x46464952; /* "RIFF" */ +static const uint32_t WAV_ID_WAVE=0x45564157; /* "WAVE" */ +static const uint32_t WAV_ID_FMT =0x20746d66; /* "fmt " */ +static const uint32_t WAV_ID_DATA=0x61746164; /* "data" */ +static const uint32_t WAV_ID_PCM =0x0001; +static const uint32_t WAV_ID_FLOAT_PCM=0x0003; struct WaveHeader { Modified: mplayerxp/libao3/audio_out.cpp =================================================================== --- mplayerxp/libao3/audio_out.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libao3/audio_out.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -327,7 +327,7 @@ ctrl(AOCONTROL_SET_VOLUME,(long)&vol); } -#define MIXER_CHANGE 3 +static const int MIXER_CHANGE=3; void Audio_Output::mixer_incvolume() const { float mixer_l, mixer_r; Modified: mplayerxp/libmpconf/cfgparser.cpp =================================================================== --- mplayerxp/libmpconf/cfgparser.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpconf/cfgparser.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -26,6 +26,7 @@ #include "cfgparser.h" #include "libplaytree2/playtree.h" #include "parser_msg.h" +#include "osdep/get_path.h" namespace mpxp { static const int MAX_RECURSION_DEPTH=8; @@ -86,7 +87,7 @@ int M_Config::cfg_inc_int(int value){ return ++value; } int M_Config::read_option(const std::vector<const mpxp_option_t*>& conf_list,const std::string& opt,const std::string& param) { - int i=0,nconf = 0; + int i=0; long tmp_int; double tmp_float; int ret = -1; @@ -96,7 +97,8 @@ mpxp_dbg3<<"read_option: opt='"<<opt<<"' param='"<<param<<"'"<<std::endl; std::string lopt=opt; std::transform(lopt.begin(),lopt.end(),lopt.begin(), ::tolower); - for(nconf = 0 ; conf_list[nconf] != NULL; nconf++) { + size_t nconf,sz = conf_list.size(); + for(nconf = 0 ; nconf<sz ; nconf++) { conf = conf_list[nconf]; for (i = 0; conf[i].name != NULL; i++) { std::string lname=conf[i].name; @@ -629,12 +631,13 @@ } const mpxp_option_t* M_Config::find_option(const std::vector<const mpxp_option_t*>& list,const std::string& name) const { - unsigned i,j; + unsigned i; const mpxp_option_t *conf; if(!list.empty()) { std::string ln=name; std::transform(ln.begin(),ln.end(),ln.begin(), ::tolower); - for(j = 0; list[j] != NULL ; j++) { + size_t j,sz=list.size(); + for(j = 0; j<sz ; j++) { conf = list[j]; for(i=0; conf[i].name != NULL; i++) { std::string lcn=conf[i].name; @@ -860,20 +863,6 @@ //"nosound=nein" "\n"; -__always_inline std::string get_path(const std::map<std::string,std::string>& envm,const std::string& filename="") { - std::map<std::string,std::string>::const_iterator it; - it = envm.find("HOME"); - const std::string homedir = (*it).second; - std::string rs; - std::string config_dir = std::string("/.")+PROGNAME; - - if (homedir.empty()) throw "No 'HOME' environment found"; - rs=homedir+config_dir; - if (!filename.empty()) rs+="/"+filename; - mpxp_v<<"get_path('"<<homedir<<":"<<filename<<"') -> "<<rs<<std::endl; - return rs; -} - void M_Config::parse_cfgfiles(const std::map<std::string,std::string>& envm) { std::string conffile; Modified: mplayerxp/libmpdemux/asf.h =================================================================== --- mplayerxp/libmpdemux/asf.h 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/asf.h 2012-12-28 17:03:09 UTC (rev 622) @@ -8,10 +8,6 @@ #include "win32loader/wine/vfw.h" #include "osdep/bswap.h" -#ifndef MIN -#define MIN(a,b) ((a<b)?a:b) -#endif - /////////////////////// // MS GUID definition /////////////////////// Modified: mplayerxp/libmpdemux/demux_ac3.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ac3.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_ac3.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -22,7 +22,7 @@ #include "mp3_hdr.h" #include "demux_msg.h" -#define HDR_SIZE 4 +static const int HDR_SIZE=4; struct ac3_priv_t : public Opaque { public: @@ -43,20 +43,22 @@ unsigned char toc[100]; /* like AVI's indexes */ }; -#define AC3_CHANNEL 0 -#define AC3_MONO 1 -#define AC3_STEREO 2 -#define AC3_3F 3 -#define AC3_2F1R 4 -#define AC3_3F1R 5 -#define AC3_2F2R 6 -#define AC3_3F2R 7 -#define AC3_CHANNEL1 8 -#define AC3_CHANNEL2 9 -#define AC3_DOLBY 10 -#define AC3_CHANNEL_MASK 15 -#define AC3_LFE 16 -#define AC3_ADJUST_LEVEL 32 +enum { + AC3_CHANNEL=0, + AC3_MONO=1, + AC3_STEREO=2, + AC3_3F=3, + AC3_2F1R=4, + AC3_3F1R=5, + AC3_2F2R=6, + AC3_3F2R=7, + AC3_CHANNEL1=8, + AC3_CHANNEL2=9, + AC3_DOLBY=10, + AC3_CHANNEL_MASK=15, + AC3_LFE=16, + AC3_ADJUST_LEVEL=32 +}; static int ac3_decode_header (const uint8_t * buf,unsigned* sample_rate,unsigned* bit_rate,unsigned* channels) { static int rate[] = { 32, 40, 48, 56, 64, 80, 96, 112, Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_avi.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -59,7 +59,7 @@ if(idx_size > 0) delete idx; } -#define MAX_PACKS 4096 +static const int MAX_PACKS=4096; inline uint64_t avi_idx_offset(AVIINDEXENTRY* x) { return ((x->dwFlags&0xffff0000)<<16)+x->dwChunkOffset; } static int odml_get_vstream_id(int id, unsigned char res[]) @@ -815,15 +815,14 @@ return NULL; } +static int FCC_CHR_CHECK(char x) { return (x<48 || x>=96); } static int valid_fourcc(unsigned int id){ unsigned char* fcc=(unsigned char*)(&id); -#define FCC_CHR_CHECK(x) (x<48 || x>=96) if(FCC_CHR_CHECK(fcc[0])) return 0; if(FCC_CHR_CHECK(fcc[1])) return 0; if(FCC_CHR_CHECK(fcc[2])) return 0; if(FCC_CHR_CHECK(fcc[3])) return 0; return 1; -#undef FCC_CHR_CHECK } static int choose_chunk_len(unsigned int len1,unsigned int len2){ @@ -1339,7 +1338,7 @@ d_video->pts=priv->avi_video_pts; // OSD } -#define formtypeON2 mmioFOURCC('O', 'N', '2', 'f') +static const uint32_t formtypeON2=mmioFOURCC('O', 'N', '2', 'f'); static MPXP_Rc avi_probe(Demuxer *demuxer) { uint32_t riff,id; Modified: mplayerxp/libmpdemux/demux_dca.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dca.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_dca.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -22,7 +22,7 @@ #include "mp3_hdr.h" #include "demux_msg.h" -#define HDR_SIZE 4 +static const int HDR_SIZE=4; struct dca_priv_t : public Opaque { public: @@ -43,27 +43,28 @@ unsigned char toc[100]; /* like AVI's indexes */ }; -#define DDCA_MONO 0 -#define DDCA_CHANNEL 1 -#define DDCA_STEREO 2 -#define DDCA_STEREO_SUMDIFF 3 -#define DDCA_STEREO_TOTAL 4 -#define DDCA_3F 5 -#define DDCA_2F1R 6 -#define DDCA_3F1R 7 -#define DDCA_2F2R 8 -#define DDCA_3F2R 9 -#define DDCA_4F2R 10 +enum { + DDCA_MONO=0, + DDCA_CHANNEL=1, + DDCA_STEREO=2, + DDCA_STEREO_SUMDIFF=3, + DDCA_STEREO_TOTAL=4, + DDCA_3F=5, + DDCA_2F1R=6, + DDCA_3F1R=7, + DDCA_2F2R=8, + DDCA_3F2R=9, + DDCA_4F2R=10, + DDCA_DOLBY=101, /* FIXME */ + DDCA_CHANNEL_MAX=DDCA_3F2R /* We don't handle anything above that */ +}; -#define DDCA_DOLBY 101 /* FIXME */ +static const int DDCA_CHANNEL_BITS=6; +static const int DDCA_CHANNEL_MASK=0x3F; -#define DDCA_CHANNEL_MAX DDCA_3F2R /* We don't handle anything above that */ -#define DDCA_CHANNEL_BITS 6 -#define DDCA_CHANNEL_MASK 0x3F +static const int DDCA_LFE=0x80; +static const int DDCA_ADJUST_LEVEL=0x100; -#define DDCA_LFE 0x80 -#define DDCA_ADJUST_LEVEL 0x100 - typedef struct ddca_state_s { const uint32_t *buffer_start; Modified: mplayerxp/libmpdemux/demux_dv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dv.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_dv.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -37,8 +37,8 @@ #include "demuxer_internal.h" #include "stheader.h" -#define DV_PAL_FRAME_SIZE 144000 -#define DV_NTSC_FRAME_SIZE 122000 +static const int DV_PAL_FRAME_SIZE =144000; +static const int DV_NTSC_FRAME_SIZE=122000; struct rawdv_frames_t : public Opaque { Modified: mplayerxp/libmpdemux/demux_film.cpp =================================================================== --- mplayerxp/libmpdemux/demux_film.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_film.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -28,9 +28,9 @@ #include "demux_msg.h" // chunk types found in a FILM file -#define CHUNK_FILM mmioFOURCC('F', 'I', 'L', 'M') -#define CHUNK_FDSC mmioFOURCC('F', 'D', 'S', 'C') -#define CHUNK_STAB mmioFOURCC('S', 'T', 'A', 'B') +static const uint32_t CHUNK_FILM=mmioFOURCC('F', 'I', 'L', 'M'); +static const uint32_t CHUNK_FDSC=mmioFOURCC('F', 'D', 'S', 'C'); +static const uint32_t CHUNK_STAB=mmioFOURCC('S', 'T', 'A', 'B'); typedef struct _film_chunk_t { Modified: mplayerxp/libmpdemux/demux_flac.cpp =================================================================== --- mplayerxp/libmpdemux/demux_flac.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_flac.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -22,7 +22,7 @@ #include "mp3_hdr.h" #include "demux_msg.h" -#define HDR_SIZE 4 +static const int HDR_SIZE=4; struct flac_priv_t : public Opaque { public: Modified: mplayerxp/libmpdemux/demux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_lavf.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_lavf.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -35,10 +35,9 @@ #include "libao3/afmt.h" #include "demux_msg.h" -#define PROBE_BUF_SIZE 2048 +static const int PROBE_BUF_SIZE=2048; +static const int BIO_BUFFER_SIZE=32768; -#define BIO_BUFFER_SIZE 32768 - struct lavf_priv_t : public Opaque { public: lavf_priv_t() {} Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -55,64 +55,63 @@ #define EBML_UINT_INVALID std::numeric_limits<uint64_t>::max() #define EBML_INT_INVALID std::numeric_limits<int64_t>::max() -#define EBML_FLOAT_INVALID -1000000000.0 +static const float EBML_FLOAT_INVALID=-1000000000.0f; -#define MKV_A_AAC_2MAIN "A_AAC/MPEG2/MAIN" -#define MKV_A_AAC_2LC "A_AAC/MPEG2/LC" -#define MKV_A_AAC_2SBR "A_AAC/MPEG2/LC/SBR" -#define MKV_A_AAC_2SSR "A_AAC/MPEG2/SSR" -#define MKV_A_AAC_4MAIN "A_AAC/MPEG4/MAIN" -#define MKV_A_AAC_4LC "A_AAC/MPEG4/LC" -#define MKV_A_AAC_4SBR "A_AAC/MPEG4/LC/SBR" -#define MKV_A_AAC_4SSR "A_AAC/MPEG4/SSR" -#define MKV_A_AAC_4LTP "A_AAC/MPEG4/LTP" -#define MKV_A_AAC "A_AAC" -#define MKV_A_AC3 "A_AC3" -#define MKV_A_DTS "A_DTS" -#define MKV_A_MP2 "A_MPEG/L2" -#define MKV_A_MP3 "A_MPEG/L3" -#define MKV_A_PCM "A_PCM/INT/LIT" -#define MKV_A_PCM_BE "A_PCM/INT/BIG" -#define MKV_A_VORBIS "A_VORBIS" -#define MKV_A_ACM "A_MS/ACM" -#define MKV_A_REAL28 "A_REAL/28_8" -#define MKV_A_REALATRC "A_REAL/ATRC" -#define MKV_A_REALCOOK "A_REAL/COOK" -#define MKV_A_REALDNET "A_REAL/DNET" -#define MKV_A_REALSIPR "A_REAL/SIPR" -#define MKV_A_QDMC "A_QUICKTIME/QDMC" -#define MKV_A_QDMC2 "A_QUICKTIME/QDM2" -#define MKV_A_FLAC "A_FLAC" -#define MKV_A_WAVPACK "A_WAVPACK4" +static const char* MKV_A_AAC_2MAIN ="A_AAC/MPEG2/MAIN"; +static const char* MKV_A_AAC_2LC ="A_AAC/MPEG2/LC"; +static const char* MKV_A_AAC_2SBR ="A_AAC/MPEG2/LC/SBR"; +static const char* MKV_A_AAC_2SSR ="A_AAC/MPEG2/SSR"; +static const char* MKV_A_AAC_4MAIN ="A_AAC/MPEG4/MAIN"; +static const char* MKV_A_AAC_4LC ="A_AAC/MPEG4/LC"; +static const char* MKV_A_AAC_4SBR ="A_AAC/MPEG4/LC/SBR"; +static const char* MKV_A_AAC_4SSR ="A_AAC/MPEG4/SSR"; +static const char* MKV_A_AAC_4LTP ="A_AAC/MPEG4/LTP"; +static const char* MKV_A_AAC ="A_AAC"; +static const char* MKV_A_AC3 ="A_AC3"; +static const char* MKV_A_DTS ="A_DTS"; +static const char* MKV_A_MP2 ="A_MPEG/L2"; +static const char* MKV_A_MP3 ="A_MPEG/L3"; +static const char* MKV_A_PCM ="A_PCM/INT/LIT"; +static const char* MKV_A_PCM_BE ="A_PCM/INT/BIG"; +static const char* MKV_A_VORBIS ="A_VORBIS"; +static const char* MKV_A_ACM ="A_MS/ACM"; +static const char* MKV_A_REAL28 ="A_REAL/28_8"; +static const char* MKV_A_REALATRC ="A_REAL/ATRC"; +static const char* MKV_A_REALCOOK ="A_REAL/COOK"; +static const char* MKV_A_REALDNET ="A_REAL/DNET"; +static const char* MKV_A_REALSIPR ="A_REAL/SIPR"; +static const char* MKV_A_QDMC ="A_QUICKTIME/QDMC"; +static const char* MKV_A_QDMC2 ="A_QUICKTIME/QDM2"; +static const char* MKV_A_FLAC ="A_FLAC"; +static const char* MKV_A_WAVPACK ="A_WAVPACK4"; -#define MKV_V_MSCOMP "V_MS/VFW/FOURCC" -#define MKV_V_REALV10 "V_REAL/RV10" -#define MKV_V_REALV20 "V_REAL/RV20" -#define MKV_V_REALV30 "V_REAL/RV30" -#define MKV_V_REALV40 "V_REAL/RV40" -#define MKV_V_SORENSONV1 "V_SORENSON/V1" -#define MKV_V_SORENSONV2 "V_SORENSON/V2" -#define MKV_V_SORENSONV3 "V_SORENSON/V3" -#define MKV_V_CINEPAK "V_CINEPAK" -#define MKV_V_QUICKTIME "V_QUICKTIME" -#define MKV_V_MPEG1 "V_MPEG1" -#define MKV_V_MPEG2 "V_MPEG2" -#define MKV_V_MPEG4_SP "V_MPEG4/ISO/SP" -#define MKV_V_MPEG4_ASP "V_MPEG4/ISO/ASP" -#define MKV_V_MPEG4_AP "V_MPEG4/ISO/AP" -#define MKV_V_MPEG4_AVC "V_MPEG4/ISO/AVC" -#define MKV_V_THEORA "V_THEORA" +static const char* MKV_V_MSCOMP ="V_MS/VFW/FOURCC"; +static const char* MKV_V_REALV10 ="V_REAL/RV10"; +static const char* MKV_V_REALV20 ="V_REAL/RV20"; +static const char* MKV_V_REALV30 ="V_REAL/RV30"; +static const char* MKV_V_REALV40 ="V_REAL/RV40"; +static const char* MKV_V_SORENSONV1 ="V_SORENSON/V1"; +static const char* MKV_V_SORENSONV2 ="V_SORENSON/V2"; +static const char* MKV_V_SORENSONV3 ="V_SORENSON/V3"; +static const char* MKV_V_CINEPAK ="V_CINEPAK"; +static const char* MKV_V_QUICKTIME ="V_QUICKTIME"; +static const char* MKV_V_MPEG1 ="V_MPEG1"; +static const char* MKV_V_MPEG2 ="V_MPEG2"; +static const char* MKV_V_MPEG4_SP ="V_MPEG4/ISO/SP"; +static const char* MKV_V_MPEG4_ASP ="V_MPEG4/ISO/ASP"; +static const char* MKV_V_MPEG4_AP ="V_MPEG4/ISO/AP"; +static const char* MKV_V_MPEG4_AVC ="V_MPEG4/ISO/AVC"; +static const char* MKV_V_THEORA ="V_THEORA"; -#define MKV_S_TEXTASCII "S_TEXT/ASCII" -#define MKV_S_TEXTUTF8 "S_TEXT/UTF8" -#define MKV_S_TEXTSSA "S_TEXT/SSA" -#define MKV_S_TEXTASS "S_TEXT/ASS" -#define MKV_S_VOBSUB "S_VOBSUB" -#define MKV_S_SSA "S_SSA" // Deprecated -#define MKV_S_ASS "S_ASS" // Deprecated +static const char* MKV_S_TEXTASCII ="S_TEXT/ASCII"; +static const char* MKV_S_TEXTUTF8 ="S_TEXT/UTF8"; +static const char* MKV_S_TEXTSSA ="S_TEXT/SSA"; +static const char* MKV_S_TEXTASS ="S_TEXT/ASS"; +static const char* MKV_S_VOBSUB ="S_VOBSUB"; +static const char* MKV_S_SSA ="S_SSA"; // Deprecated +static const char* MKV_S_ASS ="S_ASS"; // Deprecated - static uint32_t ebml_read_id (Stream *s, int *length) { @@ -466,9 +465,11 @@ {77,80} }; // Map flavour to bytes per second -#define SIPR_FLAVORS 4 -#define ATRC_FLAVORS 8 -#define COOK_FLAVORS 34 +enum { + SIPR_FLAVORS=4, + ATRC_FLAVORS=8, + COOK_FLAVORS=34 +}; static int sipr_fl2bps[SIPR_FLAVORS] = {813, 1062, 625, 2000}; static int atrc_fl2bps[ATRC_FLAVORS] = {8269, 11714, 13092, 16538, 18260, 22050, 33075, 44100}; static int cook_fl2bps[COOK_FLAVORS] = {1000, 1378, 2024, 2584, 4005, 5513, 8010, 4005, 750, 2498, @@ -676,10 +677,10 @@ static int dvd_last_chapter; static int dvd_chapter; -#define REALHEADER_SIZE 16 -#define RVPROPERTIES_SIZE 34 -#define RAPROPERTIES4_SIZE 56 -#define RAPROPERTIES5_SIZE 70 +static const int REALHEADER_SIZE =16; +static const int RVPROPERTIES_SIZE =34; +static const int RAPROPERTIES4_SIZE =56; +static const int RAPROPERTIES5_SIZE =70; /** * \brief ensures there is space for at least one additional element @@ -739,9 +740,8 @@ } -#define AAC_SYNC_EXTENSION_TYPE 0x02b7 -static int -aac_get_sample_rate_index (uint32_t sample_rate) +static const int AAC_SYNC_EXTENSION_TYPE=0x02b7; +static int aac_get_sample_rate_index (uint32_t sample_rate) { if (92017 <= sample_rate) return 0; Modified: mplayerxp/libmpdemux/demux_mov.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mov.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_mov.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -54,8 +54,8 @@ inline uint16_t BE_16(uint16_t x) { return be2me_16(x); } inline uint32_t BE_32(uint32_t x) { return be2me_32(x); } -#define char2short(x,y) BE_16(*((uint16_t *)&(((unsigned char *)(x))[(y)]))) -#define char2int(x,y) BE_32(*((uint32_t *)&(((unsigned char *)(x))[(y)]))) +static uint16_t char2short(unsigned char* x,int y) { return BE_16(*((uint16_t *)&x[y])); } +static uint32_t char2int(unsigned char* x, int y) { return BE_32(*((uint32_t *)&x[y])); } typedef struct { unsigned int pts; // duration @@ -92,12 +92,14 @@ int pts_offset; } mov_editlist_t; -#define MOV_TRAK_UNKNOWN 0 -#define MOV_TRAK_VIDEO 1 -#define MOV_TRAK_AUDIO 2 -#define MOV_TRAK_FLASH 3 -#define MOV_TRAK_GENERIC 4 -#define MOV_TRAK_CODE 5 +enum { + MOV_TRAK_UNKNOWN=0, + MOV_TRAK_VIDEO=1, + MOV_TRAK_AUDIO=2, + MOV_TRAK_FLASH=3, + MOV_TRAK_GENERIC=4, + MOV_TRAK_CODE=5 +}; typedef struct { int id; @@ -281,11 +283,10 @@ (float)(el->dur)/(float)timescale, el->pts_offset); } } - } -#define MOV_MAX_TRACKS 256 -#define MOV_MAX_SUBLEN 1024 +static const int MOV_MAX_TRACKS=256; +static const int MOV_MAX_SUBLEN=1024; struct mov_priv_t : public Opaque { public: Modified: mplayerxp/libmpdemux/demux_mp3.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mp3.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_mp3.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -23,10 +23,12 @@ #include "mp3_hdr.h" #include "demux_msg.h" -#define RAW_MP1 1 -#define RAW_MP2 2 -#define RAW_MP3 3 -#define HDR_SIZE 4 +enum { + RAW_MP1=1, + RAW_MP2=2, + RAW_MP3=3, + HDR_SIZE=4 +}; struct mp3_priv_t : public Opaque { public: @@ -121,21 +123,22 @@ } /* id3v2 */ -#define FOURCC_TAG BE_FOURCC -#define ID3V22_TAG FOURCC_TAG('I', 'D', '3', 2) /* id3 v2.2 tags */ -#define ID3V23_TAG FOURCC_TAG('I', 'D', '3', 3) /* id3 v2.3 tags */ -#define ID3V24_TAG FOURCC_TAG('I', 'D', '3', 4) /* id3 v2.4 tags */ +static const uint32_t ID3V22_TAG=FOURCC_TAG('I', 'D', '3', 2); /* id3 v2.2 tags */ +static const uint32_t ID3V23_TAG=FOURCC_TAG('I', 'D', '3', 3); /* id3 v2.3 tags */ +static const uint32_t ID3V24_TAG=FOURCC_TAG('I', 'D', '3', 4); /* id3 v2.4 tags */ /* * ID3 v2.2 */ /* tag header */ -#define ID3V22_UNSYNCH_FLAG 0x80 -#define ID3V22_COMPRESS_FLAG 0x40 -#define ID3V22_ZERO_FLAG 0x3F +enum { + ID3V22_UNSYNCH_FLAG=0x80, + ID3V22_COMPRESS_FLAG=0x40, + ID3V22_ZERO_FLAG=0x3F +}; /* frame header */ -#define ID3V22_FRAME_HEADER_SIZE 6 +static const int ID3V22_FRAME_HEADER_SIZE=6; static int read_id3v22_tags(Demuxer *demuxer,unsigned flags,unsigned hsize) { off_t pos,epos; @@ -186,20 +189,24 @@ * ID3 v2.3 */ /* tag header */ -#define ID3V23_UNSYNCH_FLAG 0x80 -#define ID3V23_EXT_HEADER_FLAG 0x40 -#define ID3V23_EXPERIMENTAL_FLAG 0x20 -#define ID3V23_ZERO_FLAG 0x1F +enum { + ID3V23_UNSYNCH_FLAG=0x80, + ID3V23_EXT_HEADER_FLAG=0x40, + ID3V23_EXPERIMENTAL_FLAG=0x20, + ID3V23_ZERO_FLAG=0x1F +}; /* frame header */ -#define ID3V23_FRAME_HEADER_SIZE 10 -#define ID3V23_FRAME_TAG_PRESERV_FLAG 0x8000 -#define ID3V23_FRAME_FILE_PRESERV_FLAG 0x4000 -#define ID3V23_FRAME_READ_ONLY_FLAG 0x2000 -#define ID3V23_FRAME_COMPRESS_FLAG 0x0080 -#define ID3V23_FRAME_ENCRYPT_FLAG 0x0040 -#define ID3V23_FRAME_GROUP_ID_FLAG 0x0020 -#define ID3V23_FRAME_ZERO_FLAG 0x1F1F +enum { + ID3V23_FRAME_HEADER_SIZE =10, + ID3V23_FRAME_TAG_PRESERV_FLAG=0x8000, + ID3V23_FRAME_FILE_PRESERV_FLAG=0x4000, + ID3V23_FRAME_READ_ONLY_FLAG =0x2000, + ID3V23_FRAME_COMPRESS_FLAG =0x0080, + ID3V23_FRAME_ENCRYPT_FLAG =0x0040, + ID3V23_FRAME_GROUP_ID_FLAG =0x0020, + ID3V23_FRAME_ZERO_FLAG =0x1F1F +}; static int read_id3v23_tags(Demuxer *demuxer,unsigned flags,unsigned hsize) { @@ -259,23 +266,27 @@ * ID3 v2.4 */ /* tag header */ -#define ID3V24_UNSYNCH_FLAG 0x80 -#define ID3V24_EXT_HEADER_FLAG 0x40 -#define ID3V24_EXPERIMENTAL_FLAG 0x20 -#define ID3V24_FOOTER_FLAG 0x10 -#define ID3V24_ZERO_FLAG 0x0F +enum { + ID3V24_UNSYNCH_FLAG=0x80, + ID3V24_EXT_HEADER_FLAG=0x40, + ID3V24_EXPERIMENTAL_FLAG=0x20, + ID3V24_FOOTER_FLAG=0x10, + ID3V24_ZERO_FLAG=0x0F +}; /* frame header */ -#define ID3V24_FRAME_HEADER_SIZE 10 -#define ID3V24_FRAME_TAG_PRESERV_FLAG 0x4000 -#define ID3V24_FRAME_FILE_PRESERV_FLAG 0x2000 -#define ID3V24_FRAME_READ_ONLY_FLAG 0x1000 -#define ID3V24_FRAME_GROUP_ID_FLAG 0x0040 -#define ID3V24_FRAME_COMPRESS_FLAG 0x0008 -#define ID3V24_FRAME_ENCRYPT_FLAG 0x0004 -#define ID3V24_FRAME_UNSYNCH_FLAG 0x0002 -#define ID3V24_FRAME_DATA_LEN_FLAG 0x0001 -#define ID3V24_FRAME_ZERO_FLAG 0x8FB0 +enum { + ID3V24_FRAME_HEADER_SIZE =10, + ID3V24_FRAME_TAG_PRESERV_FLAG=0x4000, + ID3V24_FRAME_FILE_PRESERV_FLAG=0x2000, + ID3V24_FRAME_READ_ONLY_FLAG =0x1000, + ID3V24_FRAME_GROUP_ID_FLAG =0x0040, + ID3V24_FRAME_COMPRESS_FLAG =0x0008, + ID3V24_FRAME_ENCRYPT_FLAG =0x0004, + ID3V24_FRAME_UNSYNCH_FLAG =0x0002, + ID3V24_FRAME_DATA_LEN_FLAG =0x0001, + ID3V24_FRAME_ZERO_FLAG =0x8FB0 +}; static int read_id3v24_tags(Demuxer *demuxer,unsigned flags,unsigned hsize) { @@ -392,12 +403,14 @@ return MPXP_False; } -#define FRAMES_FLAG 0x0001 -#define BYTES_FLAG 0x0002 -#define TOC_FLAG 0x0004 -#define VBR_SCALE_FLAG 0x0008 -#define FRAMES_AND_BYTES (FRAMES_FLAG | BYTES_FLAG) -#define MPG_MD_MONO 3 +enum { + FRAMES_FLAG =0x0001, + BYTES_FLAG =0x0002, + TOC_FLAG =0x0004, + VBR_SCALE_FLAG=0x0008, + FRAMES_AND_BYTES=(FRAMES_FLAG | BYTES_FLAG) +}; +static const int MPG_MD_MONO=3; static void Xing_test(Stream *s,uint8_t *hdr,mp3_priv_t *priv) { Modified: mplayerxp/libmpdemux/demux_mpg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpg.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_mpg.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -27,23 +27,23 @@ #include "libmpcodecs/dec_audio.h" #include "demux_msg.h" -//#define MAX_PS_PACKETSIZE 2048 -#define MAX_PS_PACKETSIZE (224*1024) +static const int MAX_PS_PACKETSIZE=(224*1024); -#define UNKNOWN 0 -#define VIDEO_MPEG1 0x10000001 -#define VIDEO_MPEG2 0x10000002 -#define VIDEO_MPEG4 0x10000004 -#define VIDEO_H264 0x10000005 -#define AUDIO_MP2 0x50 -#define AUDIO_MP3 0x55 -#define AUDIO_A52 0x2000 -#define AUDIO_DTS 0x2001 -#define AUDIO_LPCM_BE 0x10001 -#define AUDIO_AAC mmioFOURCC('M', 'P', '4', 'A') +enum { + UNKNOWN =0, + VIDEO_MPEG1 =0x10000001, + VIDEO_MPEG2 =0x10000002, + VIDEO_MPEG4 =0x10000004, + VIDEO_H264 =0x10000005, + AUDIO_MP2 =0x50, + AUDIO_MP3 =0x55, + AUDIO_A52 =0x2000, + AUDIO_DTS =0x2001, + AUDIO_LPCM_BE =0x10001, + AUDIO_AAC =mmioFOURCC('M', 'P', '4', 'A') +}; +static const int MPGPES_BAD_PTS=-1; -#define MPGPES_BAD_PTS -1 - typedef int (*alt_demuxer_t)(Demuxer *demux,Demuxer_Stream *__ds); struct mpg_demuxer_t : public Opaque { public: Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -29,7 +29,7 @@ #include "mpxpav64.h" #include "demux_msg.h" -#define MAX_AV_STREAMS MAX_V_STREAMS+MAX_A_STREAMS+MAX_S_STREAMS +static const int MAX_AV_STREAMS=MAX_V_STREAMS+MAX_A_STREAMS+MAX_S_STREAMS; struct mpxpav64_priv_t : public Opaque { public: @@ -71,7 +71,7 @@ h->clutID = le2me_16(h->clutID); } -#define MAX_PACKS 4096 +static const int MAX_PACKS=4096; static void print_FileProp(mpxpav64FileProperties_t *fp) { @@ -773,7 +773,7 @@ return 0; } -#define USE_INDEXES 1 +static const int USE_INDEXES=1; static void mpxpav64_seek(Demuxer *demuxer,const seek_args_t* seeka){ mpxpav64_priv_t *priv=static_cast<mpxpav64_priv_t*>(demuxer->priv); float brate=priv->fprop.AveBitrate; Modified: mplayerxp/libmpdemux/demux_musepack.cpp =================================================================== --- mplayerxp/libmpdemux/demux_musepack.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_musepack.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -22,7 +22,7 @@ #include "mp3_hdr.h" #include "demux_msg.h" -#define HDR_SIZE 4 +static const int HDR_SIZE=4; struct musepack_priv_t : public Opaque { public: Modified: mplayerxp/libmpdemux/demux_nuv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_nuv.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_nuv.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -64,9 +64,9 @@ /** * Seek to a position relative to the current position, indicated in time. */ +static const int MAX_TIME=1000000; static void nuv_seek ( Demuxer *demuxer, const seek_args_t* seeka ) { -#define MAX_TIME 1000000 nuv_priv_t* priv = static_cast<nuv_priv_t*>(demuxer->priv); struct rtframeheader rtjpeg_frameheader; off_t orig_pos; Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -29,9 +29,9 @@ #include "libao3/afmt.h" #include "demux_msg.h" -#define BLOCK_SIZE 4096 -#define FOURCC_VORBIS mmioFOURCC('v', 'r', 'b', 's') -#define FOURCC_THEORA mmioFOURCC('t', 'h', 'e', 'o') +static const int BLOCK_SIZE=4096; +static const uint32_t FOURCC_VORBIS=mmioFOURCC('v', 'r', 'b', 's'); +static const uint32_t FOURCC_THEORA=mmioFOURCC('t', 'h', 'e', 'o'); /// Vorbis decoder context : we need the vorbis_info for vorbis timestamping /// Shall we put this struct def in a common header ? @@ -163,21 +163,22 @@ delete ov; } -#define NUM_VORBIS_HDR_PACKETS 3 +static const int NUM_VORBIS_HDR_PACKETS=3; /// Some defines from OggDS -#define PACKET_TYPE_HEADER 0x01 -#define PACKET_TYPE_BITS 0x07 -#define PACKET_LEN_BITS01 0xc0 -#define PACKET_LEN_BITS2 0x02 -#define PACKET_IS_SYNCPOINT 0x08 - +enum { + PACKET_TYPE_HEADER =0x01, + PACKET_TYPE_BITS =0x07, + PACKET_LEN_BITS01 =0xc0, + PACKET_LEN_BITS2 =0x02, + PACKET_IS_SYNCPOINT =0x08 +}; //-------- subtitle support - should be moved to decoder layer, and queue // - subtitles up in demuxer buffer... #include "libmpsub/subreader.h" #include "libvo2/sub.h" -#define OGG_SUB_MAX_LINE 128 +static const int OGG_SUB_MAX_LINE=128; static subtitle ogg_sub; static float clear_sub; Modified: mplayerxp/libmpdemux/demux_pva.cpp =================================================================== --- mplayerxp/libmpdemux/demux_pva.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_pva.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -43,10 +43,12 @@ * #defines below taken from PVA spec (see URL above) */ -#define PVA_MAX_VIDEO_PACK_LEN 6*1024 +static const int PVA_MAX_VIDEO_PACK_LEN=6*1024; -#define VIDEOSTREAM 0x01 -#define MAINAUDIOSTREAM 0x02 +enum { + VIDEOSTREAM=0x01, + MAINAUDIOSTREAM=0x02 +}; typedef struct { off_t offset; Modified: mplayerxp/libmpdemux/demux_real.cpp =================================================================== --- mplayerxp/libmpdemux/demux_real.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_real.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -40,7 +40,7 @@ #define MKTAG(a, b, c, d) (a | (b << 8) | (c << 16) | (d << 24)) -#define MAX_STREAMS 32 +static const int MAX_STREAMS=32; typedef struct { int timestamp; Modified: mplayerxp/libmpdemux/demux_realaud.cpp =================================================================== --- mplayerxp/libmpdemux/demux_realaud.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_realaud.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -22,11 +22,11 @@ #include "aviprint.h" #include "demux_msg.h" -#define FOURCC_DOTRA mmioFOURCC('.','r','a', 0xfd) -#define FOURCC_144 mmioFOURCC('1','4','_','4') -#define FOURCC_288 mmioFOURCC('2','8','_','8') -#define FOURCC_DNET mmioFOURCC('d','n','e','t') -#define FOURCC_LPCJ mmioFOURCC('l','p','c','J') +static const uint32_t FOURCC_DOTRA=mmioFOURCC('.','r','a', 0xfd); +static const uint32_t FOURCC_144=mmioFOURCC('1','4','_','4'); +static const uint32_t FOURCC_288=mmioFOURCC('2','8','_','8'); +static const uint32_t FOURCC_DNET=mmioFOURCC('d','n','e','t'); +static const uint32_t FOURCC_LPCJ=mmioFOURCC('l','p','c','J'); struct realaud_priv_t : public Opaque { public: Modified: mplayerxp/libmpdemux/demux_roq.cpp =================================================================== --- mplayerxp/libmpdemux/demux_roq.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_roq.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -23,14 +23,18 @@ #include "stheader.h" #include "demux_msg.h" -#define RoQ_INFO 0x1001 -#define RoQ_QUAD_CODEBOOK 0x1002 -#define RoQ_QUAD_VQ 0x1011 -#define RoQ_SOUND_MONO 0x1020 -#define RoQ_SOUND_STEREO 0x1021 +enum { + RoQ_INFO =0x1001, + RoQ_QUAD_CODEBOOK =0x1002, + RoQ_QUAD_VQ =0x1011, + RoQ_SOUND_MONO =0x1020, + RoQ_SOUND_STEREO =0x1021 +}; -#define CHUNK_TYPE_AUDIO 0 -#define CHUNK_TYPE_VIDEO 1 +enum { + CHUNK_TYPE_AUDIO=0, + CHUNK_TYPE_VIDEO=1 +}; typedef struct roq_chunk_t { Modified: mplayerxp/libmpdemux/demux_snd_au.cpp =================================================================== --- mplayerxp/libmpdemux/demux_snd_au.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_snd_au.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -22,7 +22,7 @@ #include "mp3_hdr.h" #include "demux_msg.h" -#define HDR_SIZE 4 +static const int HDR_SIZE=4; struct snd_au_priv_t : public Opaque { public: Modified: mplayerxp/libmpdemux/demux_ts.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ts.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_ts.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -43,22 +43,23 @@ #include "mpeg_hdr.h" #include "demux_msg.h" +static const int TS_PH_PACKET_SIZE=192; +static const int TS_FEC_PACKET_SIZE=204; +static const int TS_PACKET_SIZE=188; +static const int NB_PID_MAX=8192; -#define TS_PH_PACKET_SIZE 192 -#define TS_FEC_PACKET_SIZE 204 -#define TS_PACKET_SIZE 188 -#define NB_PID_MAX 8192 +static const int MAX_HEADER_SIZE=6; /* enough for PES header + length */ +static const int MAX_CHECK_SIZE=65535; +static const int TS_MAX_PROBE_SIZE=2000000; /* dont forget to change this in cfg-common.h too */ +static const int NUM_CONSECUTIVE_TS_PACKETS=32; +static const int NUM_CONSECUTIVE_AUDIO_PACKETS=348; +static const int MAX_A52_FRAME_SIZE=3840; -#define MAX_HEADER_SIZE 6 /* enough for PES header + length */ -#define MAX_CHECK_SIZE 65535 -#define TS_MAX_PROBE_SIZE 2000000 /* dont forget to change this in cfg-common.h too */ -#define NUM_CONSECUTIVE_TS_PACKETS 32 -#define NUM_CONSECUTIVE_AUDIO_PACKETS 348 -#define MAX_A52_FRAME_SIZE 3840 +enum { + TYPE_AUDIO=1, + TYPE_VIDEO=2 +}; -#define TYPE_AUDIO 1 -#define TYPE_VIDEO 2 - int ts_prog; int ts_keep_broken=0; off_t _ts_probe = TS_MAX_PROBE_SIZE; @@ -127,7 +128,7 @@ int offset, buffer_size; } av_fifo_t; -#define MAX_EXTRADATA_SIZE 64*1024 +static const int MAX_EXTRADATA_SIZE=64*1024; typedef struct { int32_t object_type; //aka codec used int32_t stream_type; //video, audio etc. Modified: mplayerxp/libmpdemux/demux_ty.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ty.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_ty.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -72,14 +72,16 @@ // e/02: Extended data services data -#define TIVO_PES_FILEID 0xf5467abd -#define TIVO_PART_LENGTH 0x20000000 +static const int TIVO_PES_FILEID=0xf5467abd; +static const int TIVO_PART_LENGTH=0x20000000; -#define CHUNKSIZE ( 128 * 1024 ) -#define MAX_AUDIO_BUFFER ( 16 * 1024 ) +static const int CHUNKSIZE =( 128 * 1024 ); +static const int MAX_AUDIO_BUFFER =( 16 * 1024 ); -#define TY_V 1 -#define TY_A 2 +enum { + TY_V=1, + TY_A=2 +}; typedef struct { @@ -88,7 +90,7 @@ int chunks; } tmf_fileParts; -#define MAX_TMF_PARTS 16 +static const int MAX_TMF_PARTS=16; struct TiVoInfo : public Opaque { public: @@ -112,7 +114,7 @@ void ty_ClearOSD( int start ); // =========================================================================== -#define TMF_SIG "showing.xml" +static const char* TMF_SIG="showing.xml"; // =========================================================================== static int ty_tmf_filetoparts( Demuxer *demux, TiVoInfo *tivo ) @@ -228,12 +230,12 @@ // SA TiVo 864 // DTiVo AC-3 1550 // -#define SERIES1_PTS_LENGTH 11 -#define SERIES1_PTS_OFFSET 6 -#define SERIES2_PTS_LENGTH 16 -#define SERIES2_PTS_OFFSET 9 -#define AC3_PTS_LENGTH 16 -#define AC3_PTS_OFFSET 9 +static const int SERIES1_PTS_LENGTH=11; +static const int SERIES1_PTS_OFFSET=6; +static const int SERIES2_PTS_LENGTH=16; +static const int SERIES2_PTS_OFFSET=9; +static const int AC3_PTS_LENGTH=16; +static const int AC3_PTS_OFFSET=9; static int IsValidAudioPacket( int size, int *ptsOffset, int *ptsLen ) { @@ -332,9 +334,11 @@ *esOffset2 += *esOffset1 + 1; } -#define VIDEO_NAL 0xe0 -#define AUDIO_NAL 0xc0 -#define AC3_NAL 0xbd +enum { + VIDEO_NAL=0xe0, + AUDIO_NAL=0xc0, + AC3_NAL=0xbd +}; static int ty_demux( Demuxer *demux, Demuxer_Stream *dsds ) { Modified: mplayerxp/libmpdemux/demux_viv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_viv.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_viv.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -69,8 +69,10 @@ //enum { VIVO_AUDIO_G723, VIVO_AUDIO_SIREN }; -#define VIVO_AUDIO_G723 1 -#define VIVO_AUDIO_SIREN 2 +enum { + VIVO_AUDIO_G723=1, + VIVO_AUDIO_SIREN +}; struct vivo_priv_t : public Opaque { public: @@ -126,8 +128,8 @@ /* parse all possible extra headers */ /* (audio headers are seperate - mostly with recordtype=3 or 4) */ -#define TEXTPARSE_ALL 1 +#define TEXTPARSE_ALL static void vivo_parse_text_header(Demuxer *demux, int header_len) { vivo_priv_t* priv = static_cast<vivo_priv_t*>(demux->priv); Modified: mplayerxp/libmpdemux/demux_voc.cpp =================================================================== --- mplayerxp/libmpdemux/demux_voc.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_voc.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -22,7 +22,7 @@ #include "mp3_hdr.h" #include "demux_msg.h" -#define HDR_SIZE 4 +static const int HDR_SIZE=4; struct voc_priv_t : public Opaque { public: Modified: mplayerxp/libmpdemux/demux_vqf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_vqf.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_vqf.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -16,9 +16,9 @@ #include "libao3/afmt.h" #include "demux_msg.h" -#define KEYWORD_BYTES 4 -#define VERSION_BYTES 8 -#define ELEM_BYTES sizeof(unsigned long) +static const int KEYWORD_BYTES=4; +static const int VERSION_BYTES=8; +static const int ELEM_BYTES=sizeof(unsigned long); typedef struct{ char ID[KEYWORD_BYTES+VERSION_BYTES+1]; int size; Modified: mplayerxp/libmpdemux/demux_wav.cpp =================================================================== --- mplayerxp/libmpdemux/demux_wav.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/demux_wav.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -22,7 +22,7 @@ #include "mp3_hdr.h" #include "demux_msg.h" -#define HDR_SIZE 4 +static const int HDR_SIZE=4; struct da_priv_t : public Opaque { public: Modified: mplayerxp/libmpdemux/mux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/mux_mpxp64.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/mux_mpxp64.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -52,8 +52,8 @@ float prev_xpts; }priv_mpxpav64_stream_t; -#define SEEKPOINT_THRESHOLD 1.0 -#define PTS2INT(pts) (lrint(pts*1000)) +static const float SEEKPOINT_THRESHOLD=1.0f; +static int PTS2INT(float pts) { return lrint(pts*1000); } typedef struct priv_mpxpav64_s { @@ -270,28 +270,28 @@ return MAKE_AVI_ASPECT(x, y); } -#define le2me_ImageDesc(h) { \ - (h)->idSize = le2me_32((h)->idSize); \ - (h)->cType = le2me_32((h)->cType); \ - (h)->resvd1 = le2me_32((h)->resvd1); \ - (h)->resvd2 = le2me_16((h)->resvd2); \ - (h)->dataRefIndex = le2me_16((h)->dataRefIndex); \ - (h)->version = le2me_16((h)->version); \ - (h)->revisionLevel = le2me_16((h)->revisionLevel); \ - (h)->vendor = le2me_32((h)->vendor); \ - (h)->temporalQuality = le2me_32((h)->temporalQuality); \ - (h)->spatialQuality = le2me_32((h)->spatialQuality); \ - (h)->width = le2me_16((h)->width); \ - (h)->height = le2me_16((h)->height); \ - (h)->vRes = le2me_32((h)->vRes); \ - (h)->hRes = le2me_32((h)->hRes); \ - (h)->dataSize = le2me_32((h)->dataSize); \ - (h)->frameCount = le2me_16((h)->frameCount); \ - (h)->depth = le2me_16((h)->depth); \ - (h)->clutID = le2me_16((h)->clutID); \ +static void le2me_ImageDesc(ImageDescription* h) { + h->idSize = le2me_32(h->idSize); + h->cType = le2me_32(h->cType); + h->resvd1 = le2me_32(h->resvd1); + h->resvd2 = le2me_16(h->resvd2); + h->dataRefIndex = le2me_16(h->dataRefIndex); + h->version = le2me_16(h->version); + h->revisionLevel = le2me_16(h->revisionLevel); + h->vendor = le2me_32(h->vendor); + h->temporalQuality = le2me_32(h->temporalQuality); + h->spatialQuality = le2me_32(h->spatialQuality); + h->width = le2me_16(h->width); + h->height = le2me_16(h->height); + h->vRes = le2me_32(h->vRes); + h->hRes = le2me_32(h->hRes); + h->dataSize = le2me_32(h->dataSize); + h->frameCount = le2me_16(h->frameCount); + h->depth = le2me_16(h->depth); + h->clutID = le2me_16(h->clutID); } -#define WFSIZE(wf) (sizeof(WAVEFORMATEX)+(((wf)->cbSize)?((wf)->cbSize):0)) +static int WFSIZE(WAVEFORMATEX* wf) { return sizeof(WAVEFORMATEX)+(wf->cbSize?wf->cbSize:0); } static void mpxpav64_put_st64(muxer_t *muxer,muxer_stream_t* s) { priv_mpxpav64_stream_t *privs=(priv_mpxpav64_stream_t *)s->priv; Modified: mplayerxp/libmpdemux/muxer.h =================================================================== --- mplayerxp/libmpdemux/muxer.h 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/muxer.h 2012-12-28 17:03:09 UTC (rev 622) @@ -76,11 +76,11 @@ }; muxer_t *muxer_new_muxer(const char *type,const char *subtype,FILE *f); -#define muxer_new_stream(muxer,a) muxer->cont_new_stream(muxer,a) -#define muxer_write_chunk(a,b,c,d) a->muxer->cont_write_chunk(a,b,c,d) -#define muxer_write_header(muxer,info) if(muxer->cont_write_header) muxer->cont_write_header(muxer,info) -#define muxer_write_index(muxer) if(muxer->cont_write_index) muxer->cont_write_index(muxer) -#define muxer_fix_parameters(muxer) if(muxer->fix_parameters) muxer->fix_parameters(muxer) +inline muxer_stream_t* muxer_new_stream(muxer_t* muxer,int a) { return muxer->cont_new_stream(muxer,a); } +inline void muxer_write_chunk(muxer_stream_t* a,size_t b,unsigned c,float d) { a->muxer->cont_write_chunk(a,b,c,d); } +inline void muxer_write_header(muxer_t* muxer,Demuxer* info) { if(muxer->cont_write_header) muxer->cont_write_header(muxer,info); } +inline void muxer_write_index(muxer_t* muxer) { if(muxer->cont_write_index) muxer->cont_write_index(muxer); } +inline void muxer_fix_parameters(muxer_t* muxer) { if(muxer->fix_parameters) muxer->fix_parameters(muxer); } extern void muxer_init_muxer_raw(muxer_t *); extern void muxer_init_muxer_mpxp64(muxer_t *); extern int muxer_init_muxer_lavf(muxer_t *,const char *); Modified: mplayerxp/libmpdemux/stheader.cpp =================================================================== --- mplayerxp/libmpdemux/stheader.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/stheader.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -33,7 +33,7 @@ } /* biCompression constant */ -#define BI_RGB 0L +static const int BI_RGB=0L; static mp_mpeg_header_t picture; static int telecine=0; Modified: mplayerxp/libmpdemux/sub_cc.cpp =================================================================== --- mplayerxp/libmpdemux/sub_cc.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/sub_cc.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -28,7 +28,7 @@ #include "libvo2/video_out.h" #include "libvo2/sub.h" -#define CC_MAX_LINE_LENGTH 64 +static const int CC_MAX_LINE_LENGTH=64; static char chartbl[128]; @@ -39,8 +39,10 @@ static int inited=0; -#define CC_ROLLON 1 -#define CC_ROLLUP 2 +enum { + CC_ROLLON=1, + CC_ROLLUP=2 +}; static int cc_mode=CC_ROLLON; static int cc_lines=4; ///< number of visible rows in CC roll-up mode, not used in CC roll-on mode Modified: mplayerxp/libmpdemux/sub_ty.cpp =================================================================== --- mplayerxp/libmpdemux/sub_ty.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/sub_ty.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -25,8 +25,10 @@ extern int sub_justify; -#define TY_TEXT_MODE ( 1 << 0 ) -#define TY_OSD_MODE ( 1 << 1 ) +enum { + TY_TEXT_MODE=( 1 << 0 ), + TY_OSD_MODE =( 1 << 1 ) +}; static int TY_OSD_flags = TY_TEXT_MODE | TY_OSD_MODE; static int TY_OSD_debug = 0; @@ -34,13 +36,13 @@ // =========================================================================== // Closed Caption Decoding and OSD Presentation // =========================================================================== -#define TY_CCNONE ( -3 ) -#define TY_CCTEXTMODE ( -2 ) -#define TY_CCPOPUPNB ( -1 ) -#define TY_CCPOPUP ( 0 ) -#define TY_CCPAINTON ( 1 ) +static const int TY_CCNONE =( -3 ); +static const int TY_CCTEXTMODE =( -2 ); +static const int TY_CCPOPUPNB =( -1 ); +static const int TY_CCPOPUP =( 0 ); +static const int TY_CCPAINTON =( 1 ); -#define TY_CC_MAX_X ( 45 ) +static const int TY_CC_MAX_X =( 45 ); static int TY_CC_CUR_X; static int TY_CC_CUR_Y; @@ -182,6 +184,7 @@ // char specialchar[] = { '®', '°', '½', '¿', '*', '¢', '£', 14, 'à', ' ', 'è', 'â', 'ê', 'î', 'ô', 'û' }; +#define CURRENT ((b1&0x08)>>3) static int ty_CCdecode( char b1, char b2 ) { int x; @@ -201,7 +204,6 @@ } else if ( ( b1 & 0x10 ) && ( b2 > 0x1F ) && ( data != CC_last ) ) { -#define CURRENT ( ( b1 & 0x08 ) >> 3 ) if ( CC_mode != CURRENT && TY_CC_stat != TY_CCNONE ) { @@ -465,13 +467,12 @@ // =========================================================================== // Extended Data Service Decoding and OSD Presentation // =========================================================================== -#define XDS_BUFFER_LENGTH ( 16 ) -#define XDS_DISPLAY_FRAMES ( 120 ) +static const int XDS_BUFFER_LENGTH=( 16 ); +static const int XDS_DISPLAY_FRAMES=( 120 ); static char *ty_XDS_Display[ XDS_BUFFER_LENGTH ]; static int ty_XDSAddLine = -1; static int ty_XDSDisplayCount = -1; - static void ty_AddXDSToDisplay( const char *format, ... ) { char line[ 80 ]; Modified: mplayerxp/libmpdemux/yuv4mpeg_intern.h =================================================================== --- mplayerxp/libmpdemux/yuv4mpeg_intern.h 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpdemux/yuv4mpeg_intern.h 2012-12-28 17:03:09 UTC (rev 622) @@ -23,12 +23,12 @@ #define __YUV4MPEG_INTERN_H__ -#define Y4M_MAGIC "YUV4MPEG2" -#define Y4M_FRAME_MAGIC "FRAME" +static const char* Y4M_MAGIC="YUV4MPEG2"; +static const char* Y4M_FRAME_MAGIC="FRAME"; -#define Y4M_DELIM " " /* single-character(space) separating tagged fields */ +static const char* Y4M_DELIM=" "; /* single-character(space) separating tagged fields */ -#define Y4M_LINE_MAX 256 /* max number of characters in a header line +static const int Y4M_LINE_MAX=256; /* max number of characters in a header line (including the '\n', but not the '\0') */ Modified: mplayerxp/libmpstream2/cdd.h =================================================================== --- mplayerxp/libmpstream2/cdd.h 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpstream2/cdd.h 2012-12-28 17:03:09 UTC (rev 622) @@ -13,7 +13,7 @@ std::string cddb_hello; unsigned long disc_id; unsigned int tracks; - char* cache_dir; + std::string cache_dir; const char* freedb_server; int freedb_proto_level; int anonymous; Modified: mplayerxp/libmpstream2/cddb.cpp =================================================================== --- mplayerxp/libmpstream2/cddb.cpp 2012-12-28 14:18:34 UTC (rev 621) +++ mplayerxp/libmpstream2/cddb.cpp 2012-12-28 17:03:09 UTC (rev 622) @@ -51,8 +51,8 @@ namespace mpxp { -#define DEFAULT_FREEDB_SERVER "freedb.freedb.org" -#define DEFAULT_CACHE_DIR "/.cddb/" +static const char* DEFAULT_FREEDB_SERVER="freedb.freedb.org"; +static const char* DEFAULT_CACHE_DIR ="/.cddb/"; static cd_toc_t cdtoc[100]; @@ -193,9 +193,9 @@ int file_fd, ret; size_t file_size; - if( cddb_data==NULL || cddb_data->cache_dir==NULL ) return -1; + if( cddb_data==NULL || cddb_data->cache_dir.empty()) return -1; - sprintf( file_name, "%s%08lx", cddb_data->cache_dir, cddb_data->disc_id); + sprintf( file_name, "%s%08lx", cddb_data->cache_dir.c_str(), cddb_data->disc_id); file_fd = ::open(file_name, O_RDONLY); if( file_fd<0 ) { @@ -233,9 +233,9 @@ int file_fd; int wrote=0; - if( cddb_data==NULL || cddb_data->cache_dir==NULL ) return -1; + if( cddb_data==NULL || cddb_data->cache_dir.empty... [truncated message content] |