[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[637] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2013-05-08 13:50:06
|
Revision: 637 http://sourceforge.net/p/mplayerxp/code/637 Author: nickols_k Date: 2013-05-08 13:49:59 +0000 (Wed, 08 May 2013) Log Message: ----------- sync with beye + minor constantization Modified Paths: -------------- mplayerxp/libao3/audio_out.cpp mplayerxp/libmpdemux/aviprint.cpp mplayerxp/libmpstream2/stream.cpp mplayerxp/libmpstream2/stream.h mplayerxp/libvo2/font_load.cpp mplayerxp/libvo2/video_out.cpp mplayerxp/main.cpp Modified: mplayerxp/libao3/audio_out.cpp =================================================================== --- mplayerxp/libao3/audio_out.cpp 2013-05-08 12:54:26 UTC (rev 636) +++ mplayerxp/libao3/audio_out.cpp 2013-05-08 13:49:59 UTC (rev 637) @@ -1,6 +1,8 @@ #include "mpxp_config.h" #include "osdep/mplib.h" using namespace usr; +#include <vector> + #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -71,16 +73,46 @@ struct priv_t : public Opaque { public: - priv_t() {} + priv_t(); virtual ~priv_t() {} char antiviral_hole[RND_CHAR5]; const ao_info_t*info; AO_Interface* driver; + std::vector<const ao_info_t*> list; int muted; float mute_l,mute_r; }; +priv_t::priv_t() { +#ifdef USE_OSS_AUDIO + list.push_back(&audio_out_oss); +#endif +#ifdef HAVE_SDL + list.push_back(&audio_out_sdl); +#endif +#ifdef HAVE_ALSA + list.push_back(&audio_out_alsa); +#endif +#ifdef HAVE_ARTS + list.push_back(&audio_out_arts); +#endif +#ifdef HAVE_ESD + list.push_back(&audio_out_esd); +#endif +#ifdef HAVE_OPENAL + list.push_back(&audio_out_openal); +#endif +#ifdef HAVE_NAS + list.push_back(&audio_out_nas); +#endif +#ifdef HAVE_JACK + list.push_back(&audio_out_jack); +#endif + list.push_back(&audio_out_wav); + list.push_back(&audio_out_null); +} + const char * __FASTCALL__ ao_format_name(int format) { switch (format) @@ -207,17 +239,17 @@ MPXP_Rc Audio_Output::_register(const std::string& driver_name,unsigned flags) const { priv_t& priv=static_cast<priv_t&>(opaque); - unsigned i; + size_t i,sz=priv.list.size(); if(driver_name.empty()) { - priv.info=audio_out_drivers[0]; - priv.driver=audio_out_drivers[0]->query_interface(subdevice?subdevice:""); + priv.info=priv.list[0]; + priv.driver=priv.list[0]->query_interface(subdevice?subdevice:""); } else - for (i=0; audio_out_drivers[i] != &audio_out_null; i++) { - const ao_info_t *info = audio_out_drivers[i]; + for (i=0; i<sz; i++) { + const ao_info_t *info = priv.list[i]; if(info->short_name==driver_name){ - priv.info = audio_out_drivers[i]; - priv.driver = audio_out_drivers[i]->query_interface(subdevice?subdevice:""); + priv.info = priv.list[i]; + priv.driver = priv.list[i]->query_interface(subdevice?subdevice:""); break; } } Modified: mplayerxp/libmpdemux/aviprint.cpp =================================================================== --- mplayerxp/libmpdemux/aviprint.cpp 2013-05-08 12:54:26 UTC (rev 636) +++ mplayerxp/libmpdemux/aviprint.cpp 2013-05-08 13:49:59 UTC (rev 637) @@ -109,7 +109,7 @@ MSG_V("======= End of WAVE Format =======\n"); } -static char * aspect_ratios[]= +static const char * aspect_ratios[]= { "forbidden", "1.0000 (VGA)", @@ -129,7 +129,7 @@ "reserved" }; -static char *decode_aspect_ratio(unsigned char id) +static const char *decode_aspect_ratio(unsigned char id) { if(id>15) id=0; return aspect_ratios[id]; Modified: mplayerxp/libmpstream2/stream.cpp =================================================================== --- mplayerxp/libmpstream2/stream.cpp 2013-05-08 12:54:26 UTC (rev 636) +++ mplayerxp/libmpstream2/stream.cpp 2013-05-08 13:49:59 UTC (rev 637) @@ -58,45 +58,40 @@ extern const stream_interface_info_t file_stream; extern const stream_interface_info_t null_stream; -static const stream_interface_info_t* sdrivers[] = +Stream::Stream(Stream::type_e t) + :_type(t) { #ifdef HAVE_LIBCDIO_CDDA - &cdda_stream, + list.push_back(&cdda_stream); #ifdef HAVE_STREAMING - &cddb_stream, + list.push_back(&cddb_stream); #endif #endif #ifdef USE_DVDNAV - &dvdnav_stream, + list.push_back(&dvdnav_stream); #endif #ifdef USE_DVDREAD - &dvdread_stream, + list.push_back(&dvdread_stream); #endif #ifdef USE_TV - &tv_stream, + list.push_back(&tv_stream); #endif #ifdef USE_LIBVCD - &vcdnav_stream, + list.push_back(&vcdnav_stream); #endif #ifdef USE_OSS_AUDIO - &oss_stream, + list.push_back(&oss_stream); #endif #ifdef HAVE_STREAMING - &ftp_stream, - &rtsp_stream, - &udp_stream, - &network_stream, + list.push_back(&ftp_stream); + list.push_back(&rtsp_stream); + list.push_back(&udp_stream); + list.push_back(&network_stream); #endif - &lavs_stream, - &stdin_stream, - &file_stream, - &null_stream, - NULL -}; - -Stream::Stream(Stream::type_e t) - :_type(t) -{ + list.push_back(&lavs_stream); + list.push_back(&stdin_stream); + list.push_back(&file_stream); + list.push_back(&null_stream); pin=STREAM_PIN; reset(); } @@ -125,20 +120,19 @@ MPXP_Rc Stream::open(libinput_t&libinput,const std::string& filename,int* ff) { - unsigned i,done; + size_t i,sz=list.size(); unsigned mrl_len; file_format=*ff; - done=0; - for(i=0;sdrivers[i]!=&null_stream;i++) { - mrl_len=strlen(sdrivers[i]->mrl); - if(filename.substr(0,mrl_len)==sdrivers[i]->mrl||sdrivers[i]->mrl[0]=='*') { - mpxp_v<<"[Stream]: "<<"Opening "<<sdrivers[i]->mrl<<" ... "; - Stream_Interface* drv = sdrivers[i]->query_interface(libinput); - if(sdrivers[i]->mrl[0]=='*') mrl_len=0; + for(i=0;i<sz;i++) { + mrl_len=strlen(list[i]->mrl); + if(filename.substr(0,mrl_len)==list[i]->mrl||list[i]->mrl[0]=='*') { + mpxp_v<<"[Stream]: "<<"Opening "<<list[i]->mrl<<" ... "; + Stream_Interface* drv = list[i]->query_interface(libinput); + if(list[i]->mrl[0]=='*') mrl_len=0; if(drv->open(&filename[mrl_len],0)==MPXP_Ok) { mpxp_v<<"Ok"<<std::endl; *ff = file_format; - driver_info=sdrivers[i]; + driver_info=list[i]; driver=drv; return MPXP_Ok; } @@ -243,6 +237,41 @@ return y; } +static const stream_interface_info_t* sdrivers[] = +{ +#ifdef HAVE_LIBCDIO_CDDA + &cdda_stream, +#ifdef HAVE_STREAMING + &cddb_stream, +#endif +#endif +#ifdef USE_DVDNAV + &dvdnav_stream, +#endif +#ifdef USE_DVDREAD + &dvdread_stream, +#endif +#ifdef USE_TV + &tv_stream, +#endif +#ifdef USE_LIBVCD + &vcdnav_stream, +#endif +#ifdef USE_OSS_AUDIO + &oss_stream, +#endif +#ifdef HAVE_STREAMING + &ftp_stream, + &rtsp_stream, + &udp_stream, + &network_stream, +#endif + &lavs_stream, + &stdin_stream, + &file_stream, + &null_stream, + NULL +}; void Stream::print_drivers() { unsigned i; Modified: mplayerxp/libmpstream2/stream.h =================================================================== --- mplayerxp/libmpstream2/stream.h 2013-05-08 12:54:26 UTC (rev 636) +++ mplayerxp/libmpstream2/stream.h 2013-05-08 13:49:59 UTC (rev 637) @@ -4,6 +4,7 @@ #include "osdep/mplib.h" using namespace usr; +#include <vector> #include <string> #include <inttypes.h> #include <sys/types.h> @@ -91,6 +92,7 @@ private: int read(stream_packet_t* sp); Stream_Interface* driver; /**< low-level stream driver */ + std::vector<const stream_interface_info_t*> list; type_e _type; int _eof; /**< indicates EOF */ }; Modified: mplayerxp/libvo2/font_load.cpp =================================================================== --- mplayerxp/libvo2/font_load.cpp 2013-05-08 12:54:26 UTC (rev 636) +++ mplayerxp/libvo2/font_load.cpp 2013-05-08 13:49:59 UTC (rev 637) @@ -51,7 +51,6 @@ int i,j; int chardb=0; int fontdb=-1; - int version=0; desc=new(zeromem) font_desc_t; if(!desc) return NULL; @@ -135,7 +134,7 @@ continue; } } else if(strcmp(section,"[files]")==0){ - char *default_dir=DATADIR"/font"; + const char *default_dir=DATADIR"/font"; if(pdb==2 && strcmp(p[0],"alpha")==0){ char *cp; if (!(cp=new char [strlen(desc->fpath)+strlen(p[1])+2])) { @@ -193,10 +192,6 @@ desc->name=mp_strdup(p[1]); continue; } - if(pdb==2 && strcmp(p[0],"descversion")==0){ - version=atoi(p[1]); - continue; - } if(pdb==2 && strcmp(p[0],"spacewidth")==0){ desc->spacewidth=atoi(p[1]); continue; Modified: mplayerxp/libvo2/video_out.cpp =================================================================== --- mplayerxp/libvo2/video_out.cpp 2013-05-08 12:54:26 UTC (rev 636) +++ mplayerxp/libvo2/video_out.cpp 2013-05-08 13:49:59 UTC (rev 637) @@ -23,6 +23,7 @@ */ #include <algorithm> #include <iomanip> +#include <vector> #include <stdio.h> #include <stdint.h> @@ -121,11 +122,31 @@ dri_priv_t dri; const vo_info_t* video_out; class VO_Interface* vo_iface; + std::vector<const vo_info_t*> list; const OSD_Render* draw_alpha; vf_stream_t* parent; }; vo_priv_t::vo_priv_t() { +#ifdef HAVE_XV + list.push_back(&xv_vo_info); +#endif +#ifdef HAVE_OPENGL + list.push_back(&opengl_vo_info); +#endif +#ifdef HAVE_X11 + list.push_back(&x11_vo_info); +#endif +#ifdef HAVE_SDL + list.push_back(&sdl_vo_info); +#endif +#ifdef HAVE_VESA + list.push_back(&vesa_vo_info); +#endif +#ifdef HAVE_FBDEV + list.push_back(&fbdev_vo_info); +#endif + list.push_back(&null_vo_info); dri.num_xp_frames=1; } @@ -174,13 +195,13 @@ if(offset!=std::string::npos) subdev = drv_name.substr(offset+1); } vo_priv_t& priv=static_cast<vo_priv_t&>(vo_priv); - unsigned i; - if(drv_name.empty()) priv.video_out=vo_infos[0]; + size_t i,sz=priv.list.size(); + if(drv_name.empty()) priv.video_out=priv.list[0]; else - for (i=0; vo_infos[i] != &null_vo_info; i++){ - const vo_info_t *info = vo_infos[i]; + for (i=0; i<sz; i++){ + const vo_info_t *info = priv.list[i]; if(info->short_name==drv_name){ - priv.video_out = vo_infos[i]; + priv.video_out = priv.list[i]; break; } } Modified: mplayerxp/main.cpp =================================================================== --- mplayerxp/main.cpp 2013-05-08 12:54:26 UTC (rev 636) +++ mplayerxp/main.cpp 2013-05-08 13:49:59 UTC (rev 637) @@ -284,13 +284,8 @@ } void MPXPSystem::uninit_player(unsigned int mask){ Stream* stream=NULL; - sh_audio_t* sh_audio=NULL; - sh_video_t* sh_video=NULL; - if(_demuxer) { - stream=static_cast<Stream*>(_demuxer->stream); - sh_audio=reinterpret_cast<sh_audio_t*>(_demuxer->audio->sh); - sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); - } + if(_demuxer) stream=static_cast<Stream*>(_demuxer->stream); + fflush(stdout); fflush(stderr); mask=inited_flags&mask; @@ -320,7 +315,6 @@ inited_flags&=~INITED_VCODEC; MP_UNIT("uninit_vcodec"); mpcv_uninit(*mpxp_context().video().decoder); - sh_video=NULL; } if(mask&INITED_VO){ @@ -335,7 +329,6 @@ inited_flags&=~INITED_ACODEC; MP_UNIT("uninit_acodec"); mpca_uninit(*mpxp_context().audio().decoder); - sh_audio=NULL; } if(mask&INITED_AO){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |