[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[578] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-19 12:02:34
|
Revision: 578 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=578&view=rev Author: nickols_k Date: 2012-12-19 12:02:27 +0000 (Wed, 19 Dec 2012) Log Message: ----------- simplify logic Modified Paths: -------------- mplayerxp/input2/input.cpp mplayerxp/libao3/audio_out.h mplayerxp/libmpdemux/demuxer.cpp mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_stream.cpp mplayerxp/libmpdemux/demuxer_stream.h mplayerxp/libmpstream2/stream.cpp mplayerxp/libmpstream2/stream.h mplayerxp/libvo2/video_out.cpp mplayerxp/libvo2/video_out.h mplayerxp/mplayerxp.cpp mplayerxp/osdep/mplib.cpp mplayerxp/osdep/mplib.h mplayerxp/postproc/af.cpp mplayerxp/postproc/af.h mplayerxp/postproc/af_internal.h mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf.h mplayerxp/postproc/vf_internal.h Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/input2/input.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -87,8 +87,11 @@ mp_cmd_filter_t* next; }; -struct libinput_t { - char antiviral_hole[RND_CHAR1]; +struct libinput_t : public Opaque { + libinput_t() {} + virtual ~libinput_t() {} + + Opaque unusable; // These are the user defined binds mp_cmd_bind_t* cmd_binds; mp_cmd_filter_t* cmd_filters; @@ -743,7 +746,6 @@ filter->ctx = ctx; filter->next = priv.cmd_filters; priv.cmd_filters = filter; - fill_false_pointers(priv.antiviral_hole,offsetof(libinput_t,cmd_binds)-offsetof(libinput_t,antiviral_hole)); } static const char* mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) { Modified: mplayerxp/libao3/audio_out.h =================================================================== --- mplayerxp/libao3/audio_out.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libao3/audio_out.h 2012-12-19 12:02:27 UTC (rev 578) @@ -64,6 +64,7 @@ //virtual void mixer_setbothvolume( int v ); inline void mixer_setbothvolume(float v) const { mixer_setvolume(v,v); } + Opaque unusable; char* subdevice; float pts; /**< PTS of audio buffer */ private: Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpdemux/demuxer.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -149,7 +149,6 @@ :demuxer_priv(new(zeromem) demuxer_priv_t), _info(new(zeromem) Demuxer_Info) { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); pin=DEMUX_PIN; } @@ -157,7 +156,6 @@ :demuxer_priv(new(zeromem) demuxer_priv_t), _info(new(zeromem) Demuxer_Info) { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); pin=DEMUX_PIN; _init(_stream,a_id,v_id,s_id); } Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpdemux/demuxer.h 2012-12-19 12:02:27 UTC (rev 578) @@ -123,7 +123,7 @@ virtual int switch_subtitle(int id) const; virtual MPXP_Rc ctrl(int cmd, any_t*arg) const; - char antiviral_hole[RND_CHAR3]; + Opaque unusable; unsigned pin; /**< personal identification number */ Stream* stream; /**< stream for movie reading */ Demuxer_Stream* audio; /**< audio buffer/demuxer */ Modified: mplayerxp/libmpdemux/demuxer_stream.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpdemux/demuxer_stream.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -16,7 +16,6 @@ Demuxer_Stream::Demuxer_Stream(Demuxer *_demuxer,int _id) { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole)); pin=DS_PIN; _buffer_pos=_buffer_size=0; _buffer=NULL; Modified: mplayerxp/libmpdemux/demuxer_stream.h =================================================================== --- mplayerxp/libmpdemux/demuxer_stream.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpdemux/demuxer_stream.h 2012-12-19 12:02:27 UTC (rev 578) @@ -33,7 +33,7 @@ void buffer_roll_back(int size); // deprecated (added for ad_lavc) int id; /**< stream ID (for multiple audio/video streams) */ - char antiviral_hole[RND_CHAR2]; + Opaque unusable; unsigned pin; /**< personal identification number */ float pts; /**< current buffer's PTS */ int eof; /**< end of demuxed stream? (true if all buffer empty) */ Modified: mplayerxp/libmpstream2/stream.cpp =================================================================== --- mplayerxp/libmpstream2/stream.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpstream2/stream.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -96,7 +96,6 @@ Stream::Stream(Stream::type_e t) :_type(t) { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&pin)-reinterpret_cast<long>(&antiviral_hole[0])); pin=STREAM_PIN; reset(); } Modified: mplayerxp/libmpstream2/stream.h =================================================================== --- mplayerxp/libmpstream2/stream.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libmpstream2/stream.h 2012-12-19 12:02:27 UTC (rev 578) @@ -84,7 +84,7 @@ virtual unsigned read_int24(); uint32_t read_fourcc() { return read_dword_le(); } - char antiviral_hole[RND_CHAR3]; + Opaque unusable; unsigned pin; /**< personal identification number */ int file_format; /**< detected file format (by http:// protocol for example) */ const stream_interface_info_t* driver_info; Modified: mplayerxp/libvo2/video_out.cpp =================================================================== --- mplayerxp/libvo2/video_out.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libvo2/video_out.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -111,7 +111,7 @@ vo_priv_t(); virtual ~vo_priv_t(); - char antiviral_hole[RND_CHAR8]; + Opaque unusable; uint32_t srcFourcc,image_format,image_width,image_height; uint32_t org_width,org_height; unsigned ps_off[4]; /* offsets for y,u,v in panscan mode */ @@ -125,7 +125,6 @@ }; vo_priv_t::vo_priv_t() { - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&srcFourcc)-reinterpret_cast<long>(antiviral_hole)); dri.num_xp_frames=1; } @@ -139,8 +138,6 @@ inited=0; osd_progbar_type=-1; osd_progbar_value=100; // 0..256 - - fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&flags)-reinterpret_cast<long>(&antiviral_hole[0])); } Video_Output::~Video_Output() { Modified: mplayerxp/libvo2/video_out.h =================================================================== --- mplayerxp/libvo2/video_out.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/libvo2/video_out.h 2012-12-19 12:02:27 UTC (rev 578) @@ -200,7 +200,7 @@ virtual void dri_remove_osd(unsigned idx,int x0,int _y0, int w,int h) const; virtual void dri_draw_osd(unsigned idx,int x0,int _y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) const; - char antiviral_hole[RND_CHAR4]; + Opaque unusable; vo_flags_e flags; /* subtitle support */ char* osd_text; Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/mplayerxp.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -109,9 +109,9 @@ int next_file; }; -struct MPXPSystem { +struct MPXPSystem : public Opaque { public: - MPXPSystem():inited_flags(0),osd_function(OSD_PLAY),_libinput(mp_input_open()) { fill_false_pointers(antiviral_hole,reinterpret_cast<long>(&_demuxer)-reinterpret_cast<long>(&antiviral_hole)); } + MPXPSystem():inited_flags(0),osd_function(OSD_PLAY),_libinput(mp_input_open()) { } virtual ~MPXPSystem() {} void uninit_player(unsigned int mask); @@ -154,7 +154,7 @@ int osd_function; play_tree_t* playtree; private: - char antiviral_hole[RND_CHAR0]; + Opaque unusable; Demuxer* _demuxer; libinput_t& _libinput; }; Modified: mplayerxp/osdep/mplib.cpp =================================================================== --- mplayerxp/osdep/mplib.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/osdep/mplib.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -36,7 +36,7 @@ for(i=0;i<psize/sizeof(long);i++) { filler=rand()&lo_mask; filler=(reinterpret_cast<long>(buffer)&hi_mask)|lo_mask; - ((long *)buffer)[i]=filler; + ((long *)buffer)[i]=rand()%2?filler:0; } memset(&((char *)buffer)[psize],0,size-psize); return buffer; @@ -48,4 +48,10 @@ return stack[2+num_caller]; } +Opaque::Opaque() { + fill_false_pointers(&false_pointers,reinterpret_cast<long>(&unusable)-reinterpret_cast<long>(&false_pointers)); + fill_false_pointers(&unusable,sizeof(any_t*)); +} + +Opaque::~Opaque() {} } // namespace mpxp Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/osdep/mplib.h 2012-12-19 12:02:27 UTC (rev 578) @@ -62,7 +62,7 @@ MP_PROT_READ =0x1, /* Page can be read. */ MP_PROT_WRITE =0x2, /* Page can be written. */ MP_PROT_EXEC =0x4, /* Page can be executed. */ - MP_DENY_ALL =0x0, /* Page can not be accessed. */ + MP_DENY_ALL =0x0, /* Page can not be accessed. */ }; int __FASTCALL__ mp_mprotect(any_t* addr,size_t len,enum mp_prot_e flags); void print_backtrace(const std::string& why,any_t** stack,unsigned num); @@ -93,8 +93,11 @@ class Opaque { public: - Opaque() {} - virtual ~Opaque() {} + Opaque(); + virtual ~Opaque(); + + any_t* false_pointers[RND_CHAR0]; + any_t* unusable; }; } // namespace mpxp Modified: mplayerxp/postproc/af.cpp =================================================================== --- mplayerxp/postproc/af.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/af.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -112,7 +112,6 @@ MSG_ERR(MSGTR_OutOfMemory); return NULL; } - fill_false_pointers(_new->antiviral_hole,offsetof(af_instance_t,pin)-offsetof(af_instance_t,antiviral_hole)); _new->pin=AF_PIN; _new->parent=s; // Check for commandline parameters @@ -617,7 +616,6 @@ af_stream_t *rval; rval = new(zeromem) af_stream_t; rval->parent = _parent; - fill_false_pointers(rval->antiviral_hole,offsetof(af_stream_t,first)-offsetof(af_stream_t,antiviral_hole)); return rval; } Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/af.h 2012-12-19 12:02:27 UTC (rev 578) @@ -79,7 +79,7 @@ // Current audio stream struct af_stream_t { - char antiviral_hole[RND_CHAR7]; + Opaque unusable; // The first and last filter in the list af_instance_t* first; af_instance_t* last; Modified: mplayerxp/postproc/af_internal.h =================================================================== --- mplayerxp/postproc/af_internal.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/af_internal.h 2012-12-19 12:02:27 UTC (rev 578) @@ -3,8 +3,8 @@ // Linked list of audio filters struct af_instance_t { + Opaque unusable; const af_info_t* info; - char antiviral_hole[RND_CHAR6]; unsigned pin; // personal identification number MPXP_Rc (* __FASTCALL__ config_af)(af_instance_t* af, const af_conf_t* arg); MPXP_Rc (* __FASTCALL__ control_af)(af_instance_t* af, int cmd, any_t* arg); Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/vf.cpp 2012-12-19 12:02:27 UTC (rev 578) @@ -302,7 +302,6 @@ if(!strcmp(filter_list[i]->name,name)) break; } vf=new(zeromem) vf_instance_t(libinput); - fill_false_pointers(vf->antiviral_hole,reinterpret_cast<long>(&vf->pin)-reinterpret_cast<long>(&vf->antiviral_hole)); vf->pin=VF_PIN; vf->info=filter_list[i]; vf->next=next; Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/vf.h 2012-12-19 12:02:27 UTC (rev 578) @@ -51,6 +51,7 @@ vf_stream_t(libinput_t& _libinput):libinput(_libinput) {} ~vf_stream_t() {} + Opaque unusable; vf_instance_t* first; libinput_t& libinput; }; Modified: mplayerxp/postproc/vf_internal.h =================================================================== --- mplayerxp/postproc/vf_internal.h 2012-12-19 09:28:13 UTC (rev 577) +++ mplayerxp/postproc/vf_internal.h 2012-12-19 12:02:27 UTC (rev 578) @@ -31,22 +31,17 @@ ~vf_instance_t() {} const vf_info_t* info; - char antiviral_hole[RND_CHAR5]; + Opaque unusable; unsigned pin; // personal identification number // funcs: int (* __FASTCALL__ config_vf)(vf_instance_t* vf, int width, int height, int d_width, int d_height, vo_flags_e flags, unsigned int outfmt); - MPXP_Rc (* __FASTCALL__ control_vf)(vf_instance_t* vf, - int request, any_t* data); - int (* __FASTCALL__ query_format)(vf_instance_t* vf, - unsigned int fmt,unsigned w,unsigned h); - void (* __FASTCALL__ get_image)(vf_instance_t* vf, - mp_image_t *mpi); - int (* __FASTCALL__ put_slice)(vf_instance_t* vf, - mp_image_t *mpi); - void (* __FASTCALL__ start_slice)(vf_instance_t* vf, - mp_image_t *mpi); + MPXP_Rc (* __FASTCALL__ control_vf)(vf_instance_t* vf, int request, any_t* data); + int (* __FASTCALL__ query_format)(vf_instance_t* vf,unsigned int fmt,unsigned w,unsigned h); + void (* __FASTCALL__ get_image)(vf_instance_t* vf, mp_image_t *mpi); + int (* __FASTCALL__ put_slice)(vf_instance_t* vf, mp_image_t *mpi); + void (* __FASTCALL__ start_slice)(vf_instance_t* vf, mp_image_t *mpi); void (* __FASTCALL__ uninit)(vf_instance_t* vf); // optional: maybe NULL void (* __FASTCALL__ print_conf)(vf_instance_t* vf); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |