Thread: [Mplayerxp-cvslog] SF.net SVN: mplayerxp:[621] mplayerxp (Page 10)
Brought to you by:
olov
From: <nic...@us...> - 2012-12-28 14:18:42
|
Revision: 621 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=621&view=rev Author: nickols_k Date: 2012-12-28 14:18:34 +0000 (Fri, 28 Dec 2012) Log Message: ----------- rename libplaytree -> libplaytree2 (TRANSACTION END) Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libplaytree2/Makefile mplayerxp/mplayerxp.cpp mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu_cmdlist.cpp mplayerxp/postproc/libmenu/menu_param.cpp mplayerxp/postproc/libmenu/menu_pt.cpp Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-28 14:12:56 UTC (rev 620) +++ mplayerxp/Makefile 2012-12-28 14:18:34 UTC (rev 621) @@ -11,7 +11,7 @@ TARGET_EXE = $(PROGNAME) # these subdirectories required installation due binaries within them -SUBDIRS = libmpdemux libmpstream2 libmpsub libplaytree libmpcodecs libmpconf libao3 osdep postproc input2 nls libvo2 xmpcore +SUBDIRS = libmpdemux libmpstream2 libmpsub libplaytree2 libmpcodecs libmpconf libao3 osdep postproc input2 nls libvo2 xmpcore ifeq ($(ENABLE_WIN32LOADER),yes) SUBDIRS+=win32loader endif @@ -36,7 +36,7 @@ libmpdemux/libmpdemux.a \ libmpcodecs/libmpcodecs.a \ libmpsub/libmpsub.a \ - libplaytree/libplaytree.a \ + libplaytree2/libplaytree2.a \ libao3/libao3.a \ postproc/libpostproc.a \ input2/libinput2.a \ Modified: mplayerxp/libmpconf/cfgparser.cpp =================================================================== --- mplayerxp/libmpconf/cfgparser.cpp 2012-12-28 14:12:56 UTC (rev 620) +++ mplayerxp/libmpconf/cfgparser.cpp 2012-12-28 14:18:34 UTC (rev 621) @@ -24,7 +24,7 @@ #include "mplayerxp.h" #include "mpxp_help.h" #include "cfgparser.h" -#include "libplaytree/playtree.h" +#include "libplaytree2/playtree.h" #include "parser_msg.h" namespace mpxp { Modified: mplayerxp/libplaytree2/Makefile =================================================================== --- mplayerxp/libplaytree2/Makefile 2012-12-28 14:12:56 UTC (rev 620) +++ mplayerxp/libplaytree2/Makefile 2012-12-28 14:18:34 UTC (rev 621) @@ -1,5 +1,5 @@ -LIBNAME = libplaytree.a +LIBNAME = libplaytree2.a include ../mpxp_config.mak Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-28 14:12:56 UTC (rev 620) +++ mplayerxp/mplayerxp.cpp 2012-12-28 14:18:34 UTC (rev 621) @@ -41,7 +41,7 @@ #include "libmpdemux/demuxer.h" #include "libmpconf/codec-cfg.h" -#include "libplaytree/playtree.h" +#include "libplaytree2/playtree.h" #include "libmpcodecs/dec_video.h" #include "libmpcodecs/dec_audio.h" Modified: mplayerxp/postproc/libmenu/menu.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu.cpp 2012-12-28 14:12:56 UTC (rev 620) +++ mplayerxp/postproc/libmenu/menu.cpp 2012-12-28 14:18:34 UTC (rev 621) @@ -15,7 +15,7 @@ #include "libvo2/font_load.h" #include "libvo2/sub.h" #include "osdep/keycodes.h" -#include "libplaytree/asxparser.h" +#include "libplaytree2/asxparser.h" #include "nls/nls.h" #include "libvo2/img_format.h" Modified: mplayerxp/postproc/libmenu/menu_cmdlist.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-28 14:12:56 UTC (rev 620) +++ mplayerxp/postproc/libmenu/menu_cmdlist.cpp 2012-12-28 14:18:34 UTC (rev 621) @@ -14,7 +14,7 @@ #include "libmpconf/m_option.h" #include "libmpconf/m_struct.h" -#include "libplaytree/asxparser.h" +#include "libplaytree2/asxparser.h" #include "menu.h" #include "menu_list.h" Modified: mplayerxp/postproc/libmenu/menu_param.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-28 14:12:56 UTC (rev 620) +++ mplayerxp/postproc/libmenu/menu_param.cpp 2012-12-28 14:18:34 UTC (rev 621) @@ -17,7 +17,7 @@ #include "libmpconf/m_struct.h" #include "libmpconf/m_option.h" #include "libmpconf/m_property.h" -#include "libplaytree/asxparser.h" +#include "libplaytree2/asxparser.h" #include "libvo2/img_format.h" #include "xmpcore/xmp_image.h" Modified: mplayerxp/postproc/libmenu/menu_pt.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_pt.cpp 2012-12-28 14:12:56 UTC (rev 620) +++ mplayerxp/postproc/libmenu/menu_pt.cpp 2012-12-28 14:18:34 UTC (rev 621) @@ -15,7 +15,7 @@ #include "menu.h" #include "menu_list.h" -#include "libplaytree/playtree.h" +#include "libplaytree2/playtree.h" #include "input2/input.h" #include "pp_msg.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-29 10:39:14
|
Revision: 624 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=624&view=rev Author: nickols_k Date: 2012-12-29 10:39:06 +0000 (Sat, 29 Dec 2012) Log Message: ----------- remove dependencies from ::getenv() Note about illegal-patch: binary of project still contains getenv in list of imported names. Therefore project still has illegal patch with viral nature. Modified Paths: -------------- mplayerxp/libao3/ao_nas.cpp mplayerxp/libmpcodecs/vd_xanim.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpstream2/cddb.cpp mplayerxp/libmpstream2/cookies.cpp mplayerxp/libmpstream2/url.cpp mplayerxp/libvo2/vo_fbdev.cpp mplayerxp/libvo2/vo_opengl.cpp mplayerxp/libvo2/vo_sdl.cpp mplayerxp/libvo2/vo_x11.cpp mplayerxp/libvo2/vo_xv.cpp mplayerxp/libvo2/x11_system.cpp mplayerxp/libvo2/x11_system.h mplayerxp/mplayerxp.cpp mplayerxp/mpxp_msg.cpp mplayerxp/nls/nls.h mplayerxp/nls/recode.cpp mplayerxp/osdep/get_path.cpp mplayerxp/osdep/getch2.cpp mplayerxp/osdep/getch2.h Modified: mplayerxp/libao3/ao_nas.cpp =================================================================== --- mplayerxp/libao3/ao_nas.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libao3/ao_nas.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -435,7 +435,7 @@ unsigned char auformat = nas_aformat_to_auformat(&f); unsigned bytes_per_sample = _channels * AuSizeofFormat(auformat); unsigned buffer_size; - char *server; + std::string server; _format = f; _samplerate = r; @@ -462,15 +462,22 @@ return MPXP_False; } - if (!(server = ::getenv("AUDIOSERVER")) && - !(server = ::getenv("DISPLAY"))) { + const std::map<std::string,std::string>& envm=mpxp_get_environment(); + std::map<std::string,std::string>::const_iterator it; + it = envm.find("AUDIOSERVER"); + if(it!=envm.end()) server = (*it).second; + if(server.empty()) { + it = envm.find("DISPLAY"); + if(it!=envm.end()) server = (*it).second; + } + if (server.empty()) { mpxp_err<<"ao_nas: init(): AUDIOSERVER environment variable not set -> nosound"<<std::endl; return MPXP_False; } mpxp_v<<"ao_nas: init(): Using audioserver "<<server<<std::endl; - aud = AuOpenServer(server, 0, NULL, 0, NULL, NULL); + aud = AuOpenServer(server.c_str(), 0, NULL, 0, NULL, NULL); if (!aud) { mpxp_err<<"ao_nas: init(): Can't open nas audio server -> nosound"<<std::endl; return MPXP_False; Modified: mplayerxp/libmpcodecs/vd_xanim.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_xanim.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libmpcodecs/vd_xanim.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -365,7 +365,7 @@ } } -const char *xacodec_def_path = "/usr/lib/xanim/mods"; +static std::string xacodec_def_path = "/usr/lib/xanim/mods"; static int xacodec_init_video(xa_private_t& priv, int out_format) { @@ -387,10 +387,12 @@ for (i=0; i < XA_CLOSE_FUNCS; i++) priv.xacodec_driver->close_func[i] = NULL; - if (getenv("XANIM_MOD_DIR")) - xacodec_def_path = ::getenv("XANIM_MOD_DIR"); + const std::map<std::string,std::string>& envm=mpxp_get_environment(); + std::map<std::string,std::string>::const_iterator it; + it = envm.find("XANIM_MOD_DIR"); + if(it!=envm.end()) xacodec_def_path = (*it).second; - snprintf(dll, 1024, "%s/%s", xacodec_def_path, sh_video->codec->dll_name); + snprintf(dll, 1024, "%s/%s", xacodec_def_path.c_str(), sh_video->codec->dll_name); if (xacodec_init(dll, priv.xacodec_driver) == 0) return 0; Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -410,7 +410,7 @@ { str=new char [len]; s->read(str,len); - sub_data.cp=nls_get_screen_cp(); + sub_data.cp=nls_get_screen_cp(mpxp_get_environment()); demuxer->info().add(infot,nls_recode2screen_cp(codepage,str,len)); delete str; } Modified: mplayerxp/libmpstream2/cddb.cpp =================================================================== --- mplayerxp/libmpstream2/cddb.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libmpstream2/cddb.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -46,6 +46,7 @@ #include "cdd.h" #include "tcp.h" #include "version.h" +#include "osdep/get_path.h" #include "network.h" #include "stream_msg.h" @@ -467,7 +468,7 @@ static void __FASTCALL__ cddb_create_hello(cddb_data_t *cddb_data) { char host_name[51]; - const char *user_name; + std::string user_name; if( cddb_data->anonymous ) { // Default is anonymous /* Note from Eduardo P\xE9rez Ureta <ep...@it...> : @@ -481,7 +482,10 @@ if( gethostname(host_name, 50)<0 ) { strcpy(host_name, "localhost"); } - user_name = getenv("LOGNAME"); + const std::map<std::string,std::string>& envm=mpxp_get_environment(); + std::map<std::string,std::string>::const_iterator it; + it = envm.find("LOGNAME"); + if(it!=envm.end()) user_name = (*it).second; } cddb_data->cddb_hello=std::string("&hello=")+user_name+"+"+host_name+"+"+"MPlayerXP"+"+"+VERSION; } @@ -526,11 +530,7 @@ cddb_data.disc_id = cddb_discid(cddb_data.tracks); cddb_data.anonymous = 1; // Don't send user info by default - const std::map<std::string,std::string>& envm=mpxp_get_environment(); - std::map<std::string,std::string>::const_iterator it; - it = envm.find("HOME"); - home_dir = (*it).second; - if( !home_dir.empty() ) cddb_data.cache_dir=home_dir+cddb_cache_dir; + cddb_data.cache_dir=get_path(mpxp_get_environment(),cddb_cache_dir); // Check for a cached file if( cddb_read_cache(&cddb_data)<0 ) { // No Cache found Modified: mplayerxp/libmpstream2/cookies.cpp =================================================================== --- mplayerxp/libmpstream2/cookies.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libmpstream2/cookies.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -95,55 +95,55 @@ } /* Loads a file into RAM */ -static char *load_file(const char *filename, off_t * length) +static char *load_file(const std::string& filename, off_t * length) { int fd; char *buffer; mpxp_v<<"Loading cookie file: "<<filename<<std::endl; - fd = open(filename, O_RDONLY); + fd = ::open(filename.c_str(), O_RDONLY); if (fd < 0) { mpxp_v<<"Could not open"<<std::endl; return NULL; } - *length = lseek(fd, 0, SEEK_END); + *length = ::lseek(fd, 0, SEEK_END); if (*length < 0) { mpxp_v<<"Could not find EOF"<<std::endl; - close(fd); + ::close(fd); return NULL; } if (unsigned(*length) > std::numeric_limits<size_t>::max() - 1) { mpxp_v<<"File too big, could not mp_malloc"<<std::endl; - close(fd); + ::close(fd); return NULL; } - lseek(fd, SEEK_SET, 0); + ::lseek(fd, SEEK_SET, 0); if (!(buffer = new char [*length + 1])) { mpxp_v<<"Could not mp_malloc"<<std::endl; - close(fd); + ::close(fd); return NULL; } - if (read(fd, buffer, *length) != *length) { + if (::read(fd, buffer, *length) != *length) { delete buffer; mpxp_v<<"Read is behaving funny"<<std::endl; - close(fd); + ::close(fd); return NULL; } - close(fd); + ::close(fd); buffer[*length] = 0; return buffer; } /* Loads a cookies.txt file into a linked list. */ -static struct cookie_list_type *load_cookies_from(const char *filename, +static struct cookie_list_type *load_cookies_from(const std::string& filename, struct cookie_list_type *list) { @@ -179,42 +179,33 @@ DIR *dir; struct dirent *ent; struct cookie_list_type *list = NULL; - char *buf; + std::string homedir,buf; - char *homedir; - if (net_conf.cookies_file) return load_cookies_from(net_conf.cookies_file, list); - homedir = getenv("HOME"); - if (!homedir) - return list; + const std::map<std::string,std::string>& envm=mpxp_get_environment(); + std::map<std::string,std::string>::const_iterator it; + it = envm.find("HOME"); + if(it==envm.end()) throw "No 'HOME' environment found"; + homedir = (*it).second; + buf=homedir+"/.mozilla/default"; + dir = ::opendir(buf.c_str()); - buf = new char [strlen(homedir) + sizeof("/.mozilla/default") + 1]; - sprintf(buf, "%s/.mozilla/default", homedir); - dir = opendir(buf); - delete buf; - if (dir) { - while ((ent = readdir(dir)) != NULL) { + while ((ent = ::readdir(dir)) != NULL) { if ((ent->d_name)[0] != '.') { - buf = new char [strlen(getenv("HOME")) + - sizeof("/.mozilla/default/") + - strlen(ent->d_name) + sizeof("cookies.txt") + 1]; - sprintf(buf, "%s/.mozilla/default/%s/cookies.txt", - getenv("HOME"), ent->d_name); - list = load_cookies_from(buf, list); - delete buf; + std::string buf2; + buf2=buf+"/"+std::string(ent->d_name)+"/cookies.txt"; + list = load_cookies_from(buf2, list); } } - closedir(dir); + ::closedir(dir); } - buf = new char [strlen(homedir) + sizeof("/.netscape/cookies.txt") + 1]; - sprintf(buf, "%s/.netscape/cookies.txt", homedir); + buf=homedir+"/.netscape/cookies.txt"; list = load_cookies_from(buf, list); - delete buf; return list; } Modified: mplayerxp/libmpstream2/url.cpp =================================================================== --- mplayerxp/libmpstream2/url.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libmpstream2/url.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -170,10 +170,14 @@ } // Check if the http_proxy environment variable is set. if( protocol2lower()=="http") { - const char *proxy; - proxy = getenv("http_proxy"); - if( proxy!=NULL ) { + std::string proxy; + const std::map<std::string,std::string>& envm=mpxp_get_environment(); + std::map<std::string,std::string>::const_iterator it; + it = envm.find("http_proxy"); + if(it!=envm.end()) proxy = (*it).second; + if( !proxy.empty() ) { std::string new_url=proxy; + mpxp_v<<"Using "<<proxy<<" as http_proxy"<<std::endl; URL proxy_url(new_url); #ifdef HAVE_AF_INET6 if (net_conf.ipv4_only_proxy && (::gethostbyname(_host.c_str())==NULL)) { Modified: mplayerxp/libvo2/vo_fbdev.cpp =================================================================== --- mplayerxp/libvo2/vo_fbdev.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libvo2/vo_fbdev.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -183,6 +183,7 @@ #endif int fb_preinit_done; MPXP_Rc fb_works; + std::string dev_name; }; std::string FBDev_VO_Interface::parse_sub_device(const std::string& sd) @@ -207,8 +208,14 @@ if (fb_preinit_done) return fb_works; - if (!priv_conf.dev_name && !(priv_conf.dev_name = getenv("FRAMEBUFFER"))) - priv_conf.dev_name = (char *)"/dev/fb0"; + dev_name=""; + const std::map<std::string,std::string>& envm=mpxp_get_environment(); + std::map<std::string,std::string>::const_iterator it; + it = envm.find("FRAMEBUFFER"); + if(it!=envm.end()) dev_name = (*it).second; + + if(dev_name.empty()) dev_name = "/dev/fb0"; + priv_conf.dev_name = const_cast<char*>(dev_name.c_str()); mpxp_dbg2<<FBDEV<< "using "<<priv_conf.dev_name<<std::endl; if ((dev_fd = ::open(priv_conf.dev_name, O_RDWR)) == -1) { Modified: mplayerxp/libvo2/vo_opengl.cpp =================================================================== --- mplayerxp/libvo2/vo_opengl.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libvo2/vo_opengl.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -96,7 +96,7 @@ OpenGL_VO_Interface::OpenGL_VO_Interface(const std::string& arg) :VO_Interface(arg), aspect(new(zeromem) Aspect(mp_conf.monitor_pixel_aspect)), - glx(new(zeromem) GLX_System(vo_conf.mDisplayName,vo_conf.xinerama_screen)) + glx(new(zeromem) GLX_System(vo_conf.mDisplayName?vo_conf.mDisplayName:"",vo_conf.xinerama_screen)) { num_buffers=1; glx->saver_off(); Modified: mplayerxp/libvo2/vo_sdl.cpp =================================================================== --- mplayerxp/libvo2/vo_sdl.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libvo2/vo_sdl.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -266,7 +266,7 @@ :VO_Interface(arg), aspect(new(zeromem) Aspect(mp_conf.monitor_pixel_aspect)) #ifdef HAVE_X11 - ,x11(new(zeromem) X11_System(vo_conf.mDisplayName,vo_conf.xinerama_screen)) + ,x11(new(zeromem) X11_System(vo_conf.mDisplayName?vo_conf.mDisplayName:"",vo_conf.xinerama_screen)) #endif { std::string vidix_name; Modified: mplayerxp/libvo2/vo_x11.cpp =================================================================== --- mplayerxp/libvo2/vo_x11.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libvo2/vo_x11.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -130,7 +130,7 @@ X11_VO_Interface::X11_VO_Interface(const std::string& arg) :VO_Interface(arg), aspect(new(zeromem) Aspect(mp_conf.monitor_pixel_aspect)), - x11(new(zeromem) X11_System(vo_conf.mDisplayName,vo_conf.xinerama_screen)) + x11(new(zeromem) X11_System(vo_conf.mDisplayName?vo_conf.mDisplayName:"",vo_conf.xinerama_screen)) { std::string vidix_name; num_buffers=1; Modified: mplayerxp/libvo2/vo_xv.cpp =================================================================== --- mplayerxp/libvo2/vo_xv.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libvo2/vo_xv.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -86,7 +86,7 @@ Xv_VO_Interface::Xv_VO_Interface(const std::string& arg) :VO_Interface(arg), aspect(new(zeromem) Aspect(mp_conf.monitor_pixel_aspect)), - xv(new(zeromem) Xv_System(vo_conf.mDisplayName,vo_conf.xinerama_screen)) + xv(new(zeromem) Xv_System(vo_conf.mDisplayName?vo_conf.mDisplayName:"",vo_conf.xinerama_screen)) { num_buffers=1; if(!arg.empty()) { Modified: mplayerxp/libvo2/x11_system.cpp =================================================================== --- mplayerxp/libvo2/x11_system.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libvo2/x11_system.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -44,7 +44,7 @@ return 0; } -X11_System::X11_System(const char* DisplayName,int xinerama_screen) +X11_System::X11_System(const std::string& DisplayName,int xinerama_screen) :screenwidth(0), screenheight(0) { @@ -53,7 +53,7 @@ // char * DisplayName = ":0.0"; ::XImage * mXImage = NULL; ::XWindowAttributes attribs; - const char* dispName; + std::string dispName; MotifHints = None; @@ -62,14 +62,19 @@ #endif ::XSetErrorHandler(x11_errorhandler); - if (!DisplayName) - if (!(DisplayName=getenv("DISPLAY"))) - DisplayName=":0.0"; - dispName = ::XDisplayName(DisplayName); + dispName=DisplayName; + if (dispName.empty()) { + const std::map<std::string,std::string>& envm=mpxp_get_environment(); + std::map<std::string,std::string>::const_iterator it; + it = envm.find("DISPLAY"); + if(it!=envm.end()) dispName = (*it).second; + if(dispName.empty()) dispName =":0.0"; + } + dispName = ::XDisplayName(dispName.c_str()); mpxp_v<<"X11 opening display: "<<dispName<<std::endl; - if(!(mDisplay=::XOpenDisplay(dispName))) { + if(!(mDisplay=::XOpenDisplay(dispName.c_str()))) { mpxp_err<<"X11_System: couldn't open the X11 display: "<<dispName<<std::endl; exit_player("X11_System error"); } @@ -141,9 +146,10 @@ else if(mask==0xFFFF) _depth=16; } /* slightly improved local display detection AST */ - if ( strncmp(dispName, "unix:", 5) == 0) dispName += 4; - else if ( strncmp(dispName, "localhost:", 10) == 0) dispName += 9; - if (*dispName==':') mLocalDisplay=1; + char ch=dispName[0]; + if ( dispName.substr(0,5)=="unix:") ch=dispName[4]; + else if ( dispName.substr(0,10)=="localhost:") ch=dispName[9]; + if (ch==':') mLocalDisplay=1; else mLocalDisplay=0; XA_NET_WM_STATE=::XInternAtom(mDisplay,"_NET_WM_STATE",0 ); XA_NET_WM_STATE_FULLSCREEN=::XInternAtom(mDisplay,"_NET_WM_STATE_FULLSCREEN",0 ); @@ -153,7 +159,7 @@ X11_System::~X11_System() { ::XSetErrorHandler(NULL); /* and -wid is set */ - ::XDestroyWindow(mDisplay, window); + if(window) ::XDestroyWindow(mDisplay, window); ::XCloseDisplay(mDisplay); } @@ -950,7 +956,7 @@ #ifdef HAVE_XV #include "img_format.h" -Xv_System::Xv_System(const char* DisplayName,int xinerama_screen) +Xv_System::Xv_System(const std::string& DisplayName,int xinerama_screen) :X11_System(DisplayName,xinerama_screen) {} Xv_System::~Xv_System() {} @@ -1166,7 +1172,7 @@ #endif #ifdef HAVE_OPENGL -GLX_System::GLX_System(const char* DisplayName,int xinerama_screen) +GLX_System::GLX_System(const std::string& DisplayName,int xinerama_screen) :X11_System(DisplayName,xinerama_screen) { static int visual_attribs[] = { Modified: mplayerxp/libvo2/x11_system.h =================================================================== --- mplayerxp/libvo2/x11_system.h 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/libvo2/x11_system.h 2012-12-29 10:39:06 UTC (rev 624) @@ -1,6 +1,8 @@ #ifndef X11_COMMON_H #define X11_COMMON_H +#include <string> + #include <X11/Xlib.h> #include <X11/Xutil.h> #ifdef HAVE_SHM @@ -31,7 +33,7 @@ class X11_System { public: - X11_System(const char* DisplayName,int ximerama_screen); + X11_System(const std::string& DisplayName,int ximerama_screen); virtual ~X11_System(); unsigned screen_width() const; @@ -121,7 +123,7 @@ #include <sys/shm.h> class Xv_System : public X11_System { public: - Xv_System(const char* DisplayName,int ximerama_screen); + Xv_System(const std::string& DisplayName,int ximerama_screen); virtual ~Xv_System(); unsigned query_port(uint32_t fourcc); @@ -150,7 +152,7 @@ #include <GL/glut.h> class GLX_System : public X11_System { public: - GLX_System(const char* DisplayName,int ximerama_screen); + GLX_System(const std::string& DisplayName,int ximerama_screen); virtual ~GLX_System(); virtual void create_window(const XSizeHints& hint,XVisualInfo* visual,unsigned flags,unsigned depth,const std::string& title); Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/mplayerxp.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -907,7 +907,7 @@ /* Add NLS support here */ Stream* stream=static_cast<Stream*>(_demuxer->stream); char *lang; - if(!mp_conf.audio_lang) mp_conf.audio_lang=nls_get_screen_cp(); + if(!mp_conf.audio_lang) mp_conf.audio_lang=nls_get_screen_cp(envm); MP_UNIT("dvd lang->id"); if(mp_conf.audio_lang) { lang=new char [std::max(strlen(mp_conf.audio_lang)+1,size_t(4))]; Modified: mplayerxp/mpxp_msg.cpp =================================================================== --- mplayerxp/mpxp_msg.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/mpxp_msg.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -237,7 +237,7 @@ va_start(va, format); ssize=vsprintf(sbuf,format.c_str(), va); va_end(va); - if(strcmp(nls_get_screen_cp(),"UTF-8")!=0) { + if(strcmp(nls_get_screen_cp(mpxp_get_environment()),"UTF-8")!=0) { char *obuf; obuf=nls_recode2screen_cp("UTF-8",sbuf,ssize); rc=fputs(obuf,stderr); Modified: mplayerxp/nls/nls.h =================================================================== --- mplayerxp/nls/nls.h 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/nls/nls.h 2012-12-29 10:39:06 UTC (rev 624) @@ -1,28 +1,32 @@ #ifndef __NLS_NLS_H #define __NLS_NLS_H 1 +#include "mpxp_config.h" +#include <map> -/** Returns pointer to screen's codepage - * @return pointer into environment. -**/ -extern char *nls_get_screen_cp(void); +namespace mpxp { + /** Returns pointer to screen's codepage + * @return pointer into environment. + **/ + extern char *nls_get_screen_cp(const std::map<std::string,std::string>& envm); -/** Recodes from given codepage into screen's codepage - * @param src_cp decribes source codepage - * @param param points buffer to be converted - * @param len length of buffer to be converted - * @return allocated buffer with result or performs mp_strdup() function - * if convertion was failed. -**/ -extern char *nls_recode2screen_cp(const char *src_cp,const char *param,unsigned len); + /** Recodes from given codepage into screen's codepage + * @param src_cp decribes source codepage + * @param param points buffer to be converted + * @param len length of buffer to be converted + * @return allocated buffer with result or performs mp_strdup() function + * if convertion was failed. + **/ + extern char *nls_recode2screen_cp(const char *src_cp,const char *param,unsigned len); -/** Recodes to given codepage from screen's codepage - * @param to_cp decribes given codepage - * @param param points buffer to be converted - * @param size points buffer where size of resulting buffer will be stored - * @return allocated buffer with result or performs mp_strdup() function - * if convertion was failed. -**/ -extern char *nls_recode_from_screen_cp(const char *to_cp,const char *param,size_t *size); + /** Recodes to given codepage from screen's codepage + * @param to_cp decribes given codepage + * @param param points buffer to be converted + * @param size points buffer where size of resulting buffer will be stored + * @return allocated buffer with result or performs mp_strdup() function + * if convertion was failed. + **/ + extern char *nls_recode_from_screen_cp(const char *to_cp,const char *param,size_t *size); -extern unsigned utf8_get_char(const char **str); + extern unsigned utf8_get_char(const char **str); +} // namespace mpxp #endif Modified: mplayerxp/nls/recode.cpp =================================================================== --- mplayerxp/nls/recode.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/nls/recode.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -16,6 +16,7 @@ #include "nls.h" #include "nls_msg.h" +namespace mpxp { /* *We have to proceed with the POSIX methods of looking to `LANG'. On some systems this can be done by the `setlocale' function itself. @@ -28,20 +29,21 @@ LINGUAS=ru Output of locale program contains `LANG' variable only! */ -static const char * langs[] = { "LANG", "LANGUAGE", "LINGUAS" }; +static const char* langs[] = { "LANG", "LANGUAGE", "LINGUAS" }; -char *nls_get_screen_cp(void) +char *nls_get_screen_cp(const std::map<std::string,std::string>& envm) { unsigned i; - char *nls; + std::string nls; static char to_cp[256]; strcpy(to_cp,"UTF-8"); - for(i=0;i<sizeof(langs)/sizeof(char *);i++) - { - if((nls=getenv(langs[i]))!=NULL) - { - nls=strchr(nls,'.'); - if(nls) strcpy(to_cp,nls+1); + for(i=0;i<sizeof(langs)/sizeof(char *);i++) { + std::map<std::string,std::string>::const_iterator it; + it = envm.find(langs[i]); + if(it!=envm.end()) { + nls = (*it).second; + nls=nls.substr(nls.find('.')+1); + if(!nls.empty()) strcpy(to_cp,nls.c_str()); break; } } @@ -58,7 +60,7 @@ const char *ibuff,*ib; char *ob,*to_cp; size_t inb,outb; - to_cp=nls_get_screen_cp(); + to_cp=nls_get_screen_cp(mpxp_get_environment()); errno=0; ic=iconv_open(to_cp,src_cp); if(errno) @@ -133,7 +135,7 @@ const char *ibuff,*ib; char *ob,*src_cp; size_t inb; - src_cp=nls_get_screen_cp(); + src_cp=nls_get_screen_cp(mpxp_get_environment()); errno=0; ic=iconv_open(to_cp,src_cp); if(errno) @@ -175,3 +177,4 @@ #endif return obuff; } +} // namespace mpxp Modified: mplayerxp/osdep/get_path.cpp =================================================================== --- mplayerxp/osdep/get_path.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/osdep/get_path.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -6,9 +6,10 @@ namespace mpxp { std::string get_path(const std::map<std::string,std::string>& envm,const std::string& filename) { + std::string homedir; std::map<std::string,std::string>::const_iterator it; it = envm.find("HOME"); - const std::string homedir = (*it).second; + if(it!=envm.end()) homedir = (*it).second; std::string rs; std::string config_dir = std::string("/.")+PROGNAME; Modified: mplayerxp/osdep/getch2.cpp =================================================================== --- mplayerxp/osdep/getch2.cpp 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/osdep/getch2.cpp 2012-12-29 10:39:06 UTC (rev 624) @@ -69,51 +69,57 @@ static char *term_p=term_buffer2; static void termcap_add(char *id,int code){ -char *p=tgetstr(id,&term_p); - if(!p) return; - if(getch2_key_db>=MAX_KEYS) return; - getch2_keys[getch2_key_db].len=strlen(p); - strncpy(getch2_keys[getch2_key_db].chars,p,8); - getch2_keys[getch2_key_db].code=code; - ++getch2_key_db; + char *p=::tgetstr(id,&term_p); + if(!p) return; + if(getch2_key_db>=MAX_KEYS) return; + getch2_keys[getch2_key_db].len=strlen(p); + strncpy(getch2_keys[getch2_key_db].chars,p,8); + getch2_keys[getch2_key_db].code=code; + ++getch2_key_db; } static int success=0; -int load_termcap(const char *termtype){ - if(!termtype) termtype=getenv("TERM"); - success=tgetent(term_buffer, termtype); - if(success<0){ mpxp_err<<"Could not access the 'termcap' data base"<<std::endl; return 0; } - if(success==0){ mpxp_err<<"Terminal type `"<<termtype<<"' is not defined"<<std::endl; return 0;} +int load_termcap(const std::string& _termtype,const std::map<std::string,std::string>& envm){ + std::string termtype=_termtype; + if(termtype.empty()) { + std::map<std::string,std::string>::const_iterator it; + it = envm.find("TERM"); + if(it!=envm.end()) termtype = (*it).second; + } - screen_width=tgetnum("co"); - screen_height=tgetnum("li"); - if(screen_width<1 || screen_width>255) screen_width=80; - if(screen_height<1 || screen_height>255) screen_height=24; + success=::tgetent(term_buffer, termtype); + if(success<0){ mpxp_err<<"Could not access the 'termcap' data base"<<std::endl; return 0; } + if(success==0){ mpxp_err<<"Terminal type `"<<termtype<<"' is not defined"<<std::endl; return 0;} - termcap_add("kP",KEY_PGUP); - termcap_add("kN",KEY_PGDWN); - termcap_add("kh",KEY_HOME); - termcap_add("kH",KEY_END); - termcap_add("kI",KEY_INS); - termcap_add("kD",KEY_DEL); - termcap_add("kb",KEY_BS); - termcap_add("kl",KEY_LEFT); - termcap_add("kd",KEY_DOWN); - termcap_add("ku",KEY_UP); - termcap_add("kr",KEY_RIGHT); - termcap_add("k0",KEY_F+0); - termcap_add("k1",KEY_F+1); - termcap_add("k2",KEY_F+2); - termcap_add("k3",KEY_F+3); - termcap_add("k4",KEY_F+4); - termcap_add("k5",KEY_F+5); - termcap_add("k6",KEY_F+6); - termcap_add("k7",KEY_F+7); - termcap_add("k8",KEY_F+8); - termcap_add("k9",KEY_F+9); - termcap_add("k;",KEY_F+10); - return getch2_key_db; + screen_width=::tgetnum("co"); + screen_height=::tgetnum("li"); + if(screen_width<1 || screen_width>255) screen_width=80; + if(screen_height<1 || screen_height>255) screen_height=24; + + termcap_add("kP",KEY_PGUP); + termcap_add("kN",KEY_PGDWN); + termcap_add("kh",KEY_HOME); + termcap_add("kH",KEY_END); + termcap_add("kI",KEY_INS); + termcap_add("kD",KEY_DEL); + termcap_add("kb",KEY_BS); + termcap_add("kl",KEY_LEFT); + termcap_add("kd",KEY_DOWN); + termcap_add("ku",KEY_UP); + termcap_add("kr",KEY_RIGHT); + termcap_add("k0",KEY_F+0); + termcap_add("k1",KEY_F+1); + termcap_add("k2",KEY_F+2); + termcap_add("k3",KEY_F+3); + termcap_add("k4",KEY_F+4); + termcap_add("k5",KEY_F+5); + termcap_add("k6",KEY_F+6); + termcap_add("k7",KEY_F+7); + termcap_add("k8",KEY_F+8); + termcap_add("k9",KEY_F+9); + termcap_add("k;",KEY_F+10); + return getch2_key_db; } #endif Modified: mplayerxp/osdep/getch2.h =================================================================== --- mplayerxp/osdep/getch2.h 2012-12-28 17:27:59 UTC (rev 623) +++ mplayerxp/osdep/getch2.h 2012-12-29 10:39:06 UTC (rev 624) @@ -4,7 +4,7 @@ /* GyS-TermIO v2.0 (for GySmail v3) (C) 1999 A'rpi/ESP-team */ /* a very small replacement of ncurses library */ /* Load key definitions from the TERMCAP database. 'termtype' can be NULL */ - int load_termcap(const char *termtype); + int load_termcap(const std::string& termtype,const std::map<std::string,std::string>& envm); /* Enable and disable STDIN line-buffering */ void getch2_enable(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-12-29 17:26:40
|
Revision: 626 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=626&view=rev Author: nickols_k Date: 2012-12-29 17:26:32 +0000 (Sat, 29 Dec 2012) Log Message: ----------- *** This is the last message (at least in this year!) *** Comments about illegal-patch: changeset[580]: gdb shows that copy g++ which i use for developemnt has been hacked by malefactor(s) for their dark deals. Furthermore, any copy of gcc, which i had, ignored: #ifdef NDEBUG directive exactly for mplayer* projects. That happens since my participation in mplayerhq development. changeset[611]: gdb shows that real segfault has been happened within of illegal patch, but malefactor(s) have masked its sources by legal sources of the project. Else impossibly to explain how instruction pointer have jumped from: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.4/../../../../include/c++/4.5.4/bits/vector.tcc:159 to: cfgparser.cpp:160 Reading this log above: warning: Could not load shared library symbols for linux-vdso.so.1 it's strange that gdb attempts to read symbols from pure virtual object. May it exists in form of real object on HDD? $ldconfig -p | grep vdso shows empty result. But my doubts about vdso are explainted below. changeset[623]: It's clear that malefactor(s) substituted context of glibc. Else impossibly to explain how these logic errors never throw segfaults early. changeset[625]: It's clear that illegal-patch receives control before main() function. Else impossibly to explain why environment contains additional 0x21 (33) arguments (if i correctly understand the ?read-only? value of envp[j+1] which comes right after official NULL in envp[j]). Well, where exist the illegal-patch since it can't exist in air? Most probably, it exists on the HDD where i perform development of the project. In this case, the system contains hacked linux-kernel with other illegal-patch which hides from me some files and directories (including so far non-virtual linux-vdso.so.1). Moreover, the system contains hacked 'make' utility which hides from me viral subfolder with illegal-patch. My current environment: Linux kas-wifi.ap 3.6.6 #1 SMP PREEMPT Fri Nov 9 19:27:30 MSK 2012 x86_64 GNU/Linux g++ (GCC) 4.5.4 GNU ld (GNU Binutils) 2.23 ldd (GNU libc) 2.16 GNU gdb (GDB) 7.5 GNU Make 3.81 After all i would say that development of the project has been turned into war between malefactor(s) and me. I'm spending much more my efforts not for improvements but for rewritting some places of the project in way of simplification to make them unusable for illegal-patch. (Fresh example: struct config_save_t + m_config_t.config_stack + m_config_t.cs_level m_config_t.dynamics + m_config_t.dynasize m_config_t.sub_conf which were tear out in changeset[617-618] and contained unreal, at least for this project, code: if(sub_conf) o=std::string(sub_conf)+":"+opt; else o=opt; Could illegal-patch to use this pieces of code for own dark deals, considering that removal this stuff much improved the project? Noter: early changesets contains removal of other unused and specially badly coded places which did the project non-workable without illegal-patch.) Do i need to continue this project when exists whole world of commercially available media-players? Total price of development so-called free software disproportionally superior the price of any commercial product (if we will at least count the money which were spent for internet) not counting spent time which could be spent for commerce. For all who are interested with quality of this project: HAPPY NEW YEAR!!! Modified Paths: -------------- mplayerxp/libmpdemux/demux_mp3.cpp mplayerxp/mplayerxp.cpp Modified: mplayerxp/libmpdemux/demux_mp3.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mp3.cpp 2012-12-29 12:10:43 UTC (rev 625) +++ mplayerxp/libmpdemux/demux_mp3.cpp 2012-12-29 17:26:32 UTC (rev 626) @@ -525,7 +525,7 @@ sh_audio->rate=mp3_samplerate; sh_audio->nch=mp3_channels; demuxer->movi_start-=HDR_SIZE; - if(!read_mp3v1_tags(demuxer,hdr,pos)) return 0; /* id3v1 may coexist with id3v2 */ + read_mp3v1_tags(demuxer,hdr,pos); /* id3v1 may coexist with id3v2 */ break; case RAW_MP3: sh_audio->wtag = 0x55; @@ -533,7 +533,7 @@ sh_audio->rate=mp3_samplerate; sh_audio->nch=mp3_channels; demuxer->movi_start-=HDR_SIZE; - if(!read_mp3v1_tags(demuxer,hdr,pos)) return 0; /* id3v1 may coexist with id3v2 */ + read_mp3v1_tags(demuxer,hdr,pos); /* id3v1 may coexist with id3v2 */ break; } Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-12-29 12:10:43 UTC (rev 625) +++ mplayerxp/mplayerxp.cpp 2012-12-29 17:26:32 UTC (rev 626) @@ -150,7 +150,7 @@ int handle_input(seek_args_t* seek,osd_args_t* osd,input_state_t* state); unsigned inited_flags; - int vo_inited; + MPXP_Rc vo_inited; MPXP_Rc ao_inited; int osd_show_framedrop; int osd_function; @@ -324,6 +324,7 @@ MP_UNIT("uninit_vo"); delete mpxp_context().video().output; mpxp_context().video().output=NULL; + vo_inited=MPXP_False; } if(mask&INITED_ACODEC){ @@ -338,6 +339,7 @@ MP_UNIT("uninit_ao"); delete mpxp_context().audio().output; mpxp_context().audio().output=NULL; + ao_inited=MPXP_False; } if(mask&INITED_DEMUXER) uninit_demuxer(); @@ -818,9 +820,12 @@ unsigned i; // check video_out driver name: MP_UNIT("vo_init"); - vo_inited = (mpxp_context().video().output->init(mp_conf.video_driver?mp_conf.video_driver:"")==MPXP_Ok)?1:0; + if(vo_inited==MPXP_False) { + if(!mpxp_context().video().output) mpxp_context().video().output=new(zeromem) Video_Output; + vo_inited = mpxp_context().video().output->init(mp_conf.video_driver?mp_conf.video_driver:""); + } - if(!vo_inited){ + if(vo_inited==MPXP_False){ mpxp_fatal<<MSGTR_InvalidVOdriver<<": "<<(mp_conf.video_driver?mp_conf.video_driver:"?")<<std::endl; exit_player(MSGTR_Fatal_error); } @@ -860,8 +865,7 @@ std::string buf = filename.substr(0,filename.length()-4); mpxp_context().video().output->vobsub=vobsub_open(buf,mp_conf.spudec_ifo,0,&mpxp_context().video().output->spudec); } - if(mpxp_context().video().output->vobsub) - { + if(mpxp_context().video().output->vobsub) { mp_conf.sub_auto=0; // don't do autosub for textsubs if vobsub found inited_flags|=INITED_VOBSUB; } @@ -1574,7 +1578,6 @@ PointerProtector<MPXPSecureKeys> ptr_protector; secure_keys=ptr_protector.protect(new(zeromem) MPXPSecureKeys(10)); - mpxp_context().video().output=new(zeromem) Video_Output; init_signal_handling(); xmp_init(); @@ -1651,6 +1654,7 @@ mpxp_info<<std::endl; } + mpxp_context().video().output=new(zeromem) Video_Output; //------ load global data first ------ mpxp_init_osd(envm); // ========== Init keyboard FIFO (connection to libvo) ============ @@ -1923,6 +1927,7 @@ MP_UNIT("Update timers"); if(sh_audio) eof = mpxp_context().engine().xp_core->audio->eof; if(sh_video) eof|=dae_played_eof(mpxp_context().engine().xp_core->video); + if(eof) break; if(!sh_video) { if(mp_conf.benchmark && mp_conf.verbose) show_benchmark_status(); else MPXPSys.print_audio_status(); @@ -2038,19 +2043,16 @@ int flg; flg=INITED_ALL; if(input_state.after_dvdmenu) flg &=~(INITED_STREAM|INITED_DEMUXER); - MPXPSys.uninit_player(flg&(~INITED_INPUT)); /* TODO: |(~INITED_AO)|(~INITED_VO) */ - MPXPSys.vo_inited=0; - MPXPSys.ao_inited=MPXP_False; + MPXPSys.uninit_player(flg&(~(INITED_INPUT|INITED_VO|INITED_SPUDEC))); /* TODO: |(~INITED_AO)|(~INITED_VO) */ eof = 0; - mpxp_context().engine().xp_core->audio->eof=0; goto play_next_file; } if(stream_dump_type>1) dump_mux_close(MPXPSys.demuxer()); - exit_player(MSGTR_Exit_eof); mpxp_uninit_structs(); delete ptr_protector.unprotect(secure_keys); + exit_player(MSGTR_Exit_eof); return EXIT_SUCCESS; } } // namespace mpxp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2013-04-12 07:48:59
|
Revision: 627 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=627&view=rev Author: nickols_k Date: 2013-04-12 07:48:43 +0000 (Fri, 12 Apr 2013) Log Message: ----------- restore efficiency Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libmpdemux/demuxer.cpp Added Paths: ----------- mplayerxp/main.cpp Removed Paths: ------------- mplayerxp/mplayerxp.cpp Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-29 17:26:32 UTC (rev 626) +++ mplayerxp/Makefile 2013-04-12 07:48:43 UTC (rev 627) @@ -21,7 +21,7 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS = mplayerxp.cpp dump.cpp mpxp_msg.cpp +SRCS = main.cpp dump.cpp mpxp_msg.cpp OBJS = $(SRCS:.cpp=.o) Modified: mplayerxp/libmpdemux/demuxer.cpp =================================================================== --- mplayerxp/libmpdemux/demuxer.cpp 2012-12-29 17:26:32 UTC (rev 626) +++ mplayerxp/libmpdemux/demuxer.cpp 2013-04-12 07:48:43 UTC (rev 627) @@ -347,8 +347,10 @@ // Real Media { "audio/x-pn-realaudio", &demux_realaud }, // OGG Streaming +#ifdef HAVE_LIBVORBIS { "application/ogg", &demux_ogg }, { "application/x-ogg", &demux_ogg }, +#endif // NullSoft Streaming Video { "video/nsv", &demux_nsv}, { "misc/ultravox", &demux_nsv}, Copied: mplayerxp/main.cpp (from rev 626, mplayerxp/mplayerxp.cpp) =================================================================== --- mplayerxp/main.cpp (rev 0) +++ mplayerxp/main.cpp 2013-04-12 07:48:43 UTC (rev 627) @@ -0,0 +1,2124 @@ +#include "mpxp_config.h" +#include "osdep/mplib.h" +using namespace mpxp; +/* MplayerXP (C) 2000-2002. by A'rpi/ESP-team (C) 2002. by Nickols_K */ +#include <algorithm> +#include <iostream> +#include <iomanip> +#include <map> + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <limits.h> +#ifdef _OPENMP +#include <omp.h> +#endif +#define __USE_ISOC99 1 /* for lrint */ +#include <math.h> +#include <errno.h> +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <sys/time.h> +#include <sys/stat.h> +#include <signal.h> +#include <time.h> +#include <fcntl.h> + +#include "version.h" +#include "mplayerxp.h" +#include "xmpcore/sig_hand.h" + +#include "postproc/af.h" +#include "postproc/vf.h" +#define HELP_MPXP_DEFINE_STATIC +#include "mpxp_help.h" + +#include "libmpstream2/stream.h" +#include "libmpdemux/demuxer.h" + +#include "libmpconf/codec-cfg.h" +#include "libplaytree2/playtree.h" + +#include "libmpcodecs/dec_video.h" +#include "libmpcodecs/dec_audio.h" + +#include "libmpsub/spudec.h" +#include "libmpsub/vobsub.h" + +#include "osdep/get_path.h" +#include "osdep/cpudetect.h" +#include "osdep/mm_accel.h" +#include "osdep/timer.h" + +#include "nls/nls.h" +#include "postproc/libmenu/menu.h" + +#include "input2/input.h" +#include "player_msg.h" +#include "xmpcore/xmp_core.h" +#include "xmpcore/xmp_vplayer.h" +#include "xmpcore/xmp_adecoder.h" +#include "xmpcore/xmp_context.h" +#include "xmpcore/PointerProtector.h" +#include "dump.h" + +namespace mpxp { +/************************************************************************** + Private data +**************************************************************************/ +static volatile char antiviral_hole1[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; +/************************************************************************** + Config file +**************************************************************************/ +enum { + INITED_VO =0x00000001, + INITED_AO =0x00000002, + INITED_RESERVED =0x00000004, + INITED_LIRC =0x00000008, + INITED_SPUDEC =0x00000010, + INITED_STREAM =0x00000020, + INITED_INPUT =0x00000040, + INITED_DEMUXER =0x00000080, + INITED_ACODEC =0x00000100, + INITED_VCODEC =0x00000200, + INITED_VOBSUB =0x00000400, + INITED_SUBTITLE =0x10000000, + INITED_XMP =0x80000000, + INITED_ALL =0xFFFFFFFF +}; + +enum { + PT_NEXT_ENTRY =1, + PT_PREV_ENTRY =-1, + PT_NEXT_SRC =2, + PT_PREV_SRC =-2, + PT_UP_NEXT =3, + PT_UP_PREV =-3 +}; + +struct osd_args_t { + int visible; + int info_factor; +}; + +struct input_state_t { + int need_repaint; + int after_dvdmenu; + int next_file; +}; + +struct MPXPSystem : public Opaque { + public: + MPXPSystem(const std::map<std::string,std::string>& _envm):inited_flags(0),osd_function(OSD_PLAY),envm(_envm),_libinput(mp_input_open(_envm)) { } + virtual ~MPXPSystem() {} + + void uninit_player(unsigned int mask); + Demuxer* demuxer() const { return _demuxer; } + Demuxer* assign_demuxer(Demuxer* _d) { uninit_demuxer(); _demuxer=_d; if(_d) inited_flags|=INITED_DEMUXER; return _demuxer; } + libinput_t& libinput() const { return _libinput; } + void uninit_demuxer(); + void uninit_input(); + + int libmpdemux_was_interrupted(int eof) const; + void seek(osd_args_t *osd,const seek_args_t* seek) const; + void init_keyboard_fifo(); + char* init_output_subsystems(); + int init_vobsub(const std::string& filename); + void init_dvd_nls() const; + + int handle_playlist(const std::string& filename) const; + + void print_stream_formats() const; + void print_audio_status() const; + void read_video_properties() const; + void read_subtitles(const std::string& filename,int forced_subs_only,int stream_dump_type); + + void find_acodec(const char *ao_subdevice); + int configure_audio(); + + MPXP_Rc find_vcodec(); + + void run_ahead_engine(); + +#ifdef USE_OSD + int paint_osd(int* osd_visible,int* in_pause); +#endif + int handle_input(seek_args_t* seek,osd_args_t* osd,input_state_t* state); + + unsigned inited_flags; + MPXP_Rc vo_inited; + MPXP_Rc ao_inited; + int osd_show_framedrop; + int osd_function; + PlayTree* playtree; + // for multifile support: + PlayTree_Iter* playtree_iter; + const std::map<std::string,std::string>& envm; + private: + Opaque unusable; + Demuxer* _demuxer; + libinput_t& _libinput; +}; + +struct MPXPSecureKeys { +public: + MPXPSecureKeys(unsigned _nkeys):nkeys(_nkeys) { keys = new unsigned [nkeys]; for(unsigned i=0;i<nkeys;i++) keys[i]=rand()%UINT_MAX; } + ~MPXPSecureKeys() { delete [] keys; } +private: + unsigned nkeys; + unsigned* keys; +}; + +MP_Config::MP_Config() { + memset(&has_video,0,reinterpret_cast<long>(&monitor_pixel_aspect)-reinterpret_cast<long>(&has_video)); + xp=get_number_cpu(); + audio_id=-1; + video_id=-1; + dvdsub_id=-1; + vobsub_id=-1; + audio_lang=I18N_LANGUAGE; + dvdsub_lang=I18N_LANGUAGE; + av_sync_pts=-1; + frame_reorder=1; + av_force_pts_fix2=-1; + loop_times=-1; + play_n_frames=-1; + font_factor=0.75; + sub_auto=1; + has_audio=1; + has_video=1; + has_dvdsub=1; + osd_level=2; + playbackspeed_factor=1.0; + ao_channels=2; + monitor_pixel_aspect=1; + msg_filter=0xFFFFFFFF; + max_trace=10; +} +MP_Config mp_conf; + +MPXPContext::MPXPContext() + :_engine(new(zeromem) mpxp_engine_t), + _audio(new(zeromem) audio_processing_t), + _video(new(zeromem) video_processing_t) +{ + seek_time=-1; + bench=new(zeromem) time_usage_t; + use_pts_fix2=-1; + rtc_fd=-1; +} + +MPXPContext::~MPXPContext() +{ + delete _engine->MPXPSys; + delete bench; +} + +static volatile char antiviral_hole2[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; +static LocalPtr<MPXPContext> MPXPCtx(new(zeromem) MPXPContext); +static volatile char antiviral_hole3[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; +volatile MPXPSecureKeys* secure_keys; +/************************************************************************** + Decoding ahead +**************************************************************************/ +static volatile char antiviral_hole4[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; +/**************************************************************************/ +MPXPContext& mpxp_context() { return *MPXPCtx; } + +static MPXP_Rc mpxp_test_antiviral_protection(int* verbose) +{ + if(*verbose) mpxp_info<<"Your've specified test-av option!\nRight now MPlayerXP should make coredump!"<<std::endl; + *verbose=antiviral_hole1[0]|antiviral_hole2[0]|antiviral_hole3[0]|antiviral_hole4[0]; + mpxp_err<<"Antiviral protection of MPlayerXP doesn't work!"<<std::endl; + return MPXP_Virus; +} + +static void __attribute__ ((noinline)) mpxp_test_backtrace(void) { + goto *(reinterpret_cast<any_t*>(get_caller_address())); + kill(getpid(), SIGILL); +} + +unsigned xp_num_cpu; +unsigned get_number_cpu(void) { +#ifdef _OPENMP + return omp_get_num_procs(); +#else + /* TODO ? */ + return 1; +#endif +} + +static void mpxp_uninit_structs(void) { +#ifdef ENABLE_WIN32LOADER + free_codec_cfg(); +#endif + if(mpxp_context().video().output) delete mpxp_context().video().output; + if(mpxp_context().audio().output) delete mpxp_context().audio().output; + xmp_uninit(); + mp_uninit_malloc(mp_conf.verbose); +} + +void MPXPSystem::uninit_demuxer() { + if(inited_flags&INITED_DEMUXER) { + inited_flags&=~INITED_DEMUXER; + MP_UNIT("free_priv->demuxer"); + delete _demuxer; + _demuxer=NULL; + } +} + +void MPXPSystem::uninit_input() { + if(inited_flags&INITED_INPUT) { + inited_flags&=~INITED_INPUT; + MP_UNIT("uninit_input"); + mp_input_close(_libinput); + } +} +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); + } + fflush(stdout); + fflush(stderr); + mask=inited_flags&mask; + + MP_UNIT("uninit_xp"); + if(mask&INITED_XMP) { + inited_flags&=~INITED_XMP; + MP_UNIT("uninit_xmp"); + xmp_uninit_engine(0); + } + + if (mask&INITED_SPUDEC){ + inited_flags&=~INITED_SPUDEC; + MP_UNIT("uninit_spudec"); + spudec_free(mpxp_context().video().output->spudec); + mpxp_context().video().output->spudec=NULL; + } + + if (mask&INITED_VOBSUB){ + inited_flags&=~INITED_VOBSUB; + MP_UNIT("uninit_vobsub"); + vobsub_close(mpxp_context().video().output->vobsub); + mpxp_context().video().output->vobsub=NULL; + } + + if(mask&INITED_VCODEC){ + inited_flags&=~INITED_VCODEC; + MP_UNIT("uninit_vcodec"); + mpcv_uninit(*mpxp_context().video().decoder); + sh_video=NULL; + } + + if(mask&INITED_VO){ + inited_flags&=~INITED_VO; + MP_UNIT("uninit_vo"); + delete mpxp_context().video().output; + mpxp_context().video().output=NULL; + vo_inited=MPXP_False; + } + + if(mask&INITED_ACODEC){ + inited_flags&=~INITED_ACODEC; + MP_UNIT("uninit_acodec"); + mpca_uninit(*mpxp_context().audio().decoder); + sh_audio=NULL; + } + + if(mask&INITED_AO){ + inited_flags&=~INITED_AO; + MP_UNIT("uninit_ao"); + delete mpxp_context().audio().output; + mpxp_context().audio().output=NULL; + ao_inited=MPXP_False; + } + + if(mask&INITED_DEMUXER) uninit_demuxer(); + + if(mask&INITED_STREAM){ + inited_flags&=~INITED_STREAM; + MP_UNIT("uninit_stream"); + if(stream) delete stream; + stream=NULL; + } + + if(mask&INITED_INPUT) uninit_input(); +#ifdef USE_SUB + if(mask&INITED_SUBTITLE){ + inited_flags&=~INITED_SUBTITLE; + MP_UNIT("sub_free"); + sub_free( mpxp_context().subtitles ); + mp_conf.sub_name=NULL; + mpxp_context().video().output->sub=NULL; + mpxp_context().subtitles=NULL; + } +#endif + MP_UNIT(NULL); +} + +void exit_player(const std::string& why){ + + fflush(stdout); + fflush(stderr); + mpxp_context().engine().MPXPSys->uninit_player(INITED_ALL); + + MP_UNIT("exit_player"); + + if(!why.empty()) mpxp_hint<<std::endl<<MSGTR_Exiting<<"...("<<why<<")"<<std::endl; + if(mpxp_context().mconfig) delete mpxp_context().mconfig; + mpxp_print_uninit(); + mpxp_uninit_structs(); + if(!why.empty()) ::exit(0); + return; /* Still try coredump!!!*/ +} + +void __exit_sighandler(void) +{ + static int sig_count=0; + ++sig_count; +// return; + if(sig_count==2) return; + if(sig_count>2){ + // can't stop :( + kill(getpid(),SIGKILL); + return; + } + exit_player(""); +} + + +void exit_sighandler(void) +{ + xmp_killall_threads(pthread_self()); + __exit_sighandler(); +} + +// When libmpdemux perform a blocking operation (network connection or cache filling) +// if the operation fail we use this function to check if it was interrupted by the user. +// The function return a new value for eof. +int MPXPSystem::libmpdemux_was_interrupted(int eof) const +{ + mp_cmd_t* cmd; + if((cmd = mp_input_get_cmd(_libinput,0,0,0)) != NULL) { + switch(cmd->id) { + case MP_CMD_QUIT: + case MP_CMD_SOFT_QUIT: // should never happen + exit_player(MSGTR_Exit_quit); + case MP_CMD_PLAY_TREE_STEP: { + eof = (cmd->args[0].v.i > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY; + } break; + case MP_CMD_PLAY_TREE_UP_STEP: { + eof = (cmd->args[0].v.i > 0) ? PT_UP_NEXT : PT_UP_PREV; + } break; + case MP_CMD_PLAY_ALT_SRC_STEP: { + eof = (cmd->args[0].v.i > 0) ? PT_NEXT_SRC : PT_PREV_SRC; + } break; + } + mp_cmd_free(cmd); + } + return eof; +} + +#if defined( ARCH_X86 ) || defined(ARCH_X86_64) +static void get_mmx_optimizations( void ) +{ + GetCpuCaps(&gCpuCaps); + + if(mp_conf.x86.simd) { + if(mp_conf.x86.mmx != -1) gCpuCaps.hasMMX=mp_conf.x86.mmx; + if(mp_conf.x86.mmx2 != -1) gCpuCaps.hasMMX2=mp_conf.x86.mmx2; + if(mp_conf.x86._3dnow != -1) gCpuCaps.has3DNow=mp_conf.x86._3dnow; + if(mp_conf.x86._3dnow2 != -1) gCpuCaps.has3DNowExt=mp_conf.x86._3dnow2; + if(mp_conf.x86.sse != -1) gCpuCaps.hasSSE=mp_conf.x86.sse; + if(mp_conf.x86.sse2 != -1) gCpuCaps.hasSSE2=mp_conf.x86.sse2; + if(mp_conf.x86.sse3 != -1) gCpuCaps.hasSSE2=mp_conf.x86.sse3; + if(mp_conf.x86.ssse3 != -1) gCpuCaps.hasSSSE3=mp_conf.x86.ssse3; + if(mp_conf.x86.sse41 != -1) gCpuCaps.hasSSE41=mp_conf.x86.sse41; + if(mp_conf.x86.sse42 != -1) gCpuCaps.hasSSE42=mp_conf.x86.sse42; + if(mp_conf.x86.aes != -1) gCpuCaps.hasAES=mp_conf.x86.aes; + if(mp_conf.x86.avx != -1) gCpuCaps.hasAVX=mp_conf.x86.avx; + if(mp_conf.x86.fma != -1) gCpuCaps.hasFMA=mp_conf.x86.fma; + } else { + gCpuCaps.hasMMX= + gCpuCaps.hasMMX2= + gCpuCaps.has3DNow= + gCpuCaps.has3DNowExt= + gCpuCaps.hasSSE= + gCpuCaps.hasSSE2= + gCpuCaps.hasSSE3= + gCpuCaps.hasSSSE3= + gCpuCaps.hasSSE41= + gCpuCaps.hasSSE42= + gCpuCaps.hasAES= + gCpuCaps.hasAVX= + gCpuCaps.hasFMA=0; + } + mpxp_v<<"User corrected CPU flags: MMX="<<gCpuCaps.hasMMX + <<" MMX2="<<gCpuCaps.hasMMX2 + <<" 3DNow="<<gCpuCaps.has3DNow + <<" 3DNow2="<<gCpuCaps.has3DNowExt + <<" SSE="<<gCpuCaps.hasSSE + <<" SSE2="<<gCpuCaps.hasSSE2 + <<" SSE3="<<gCpuCaps.hasSSE3 + <<" SSSE3="<<gCpuCaps.hasSSSE3 + <<" SSE41="<<gCpuCaps.hasSSE41 + <<" SSE42="<<gCpuCaps.hasSSE42 + <<" AES="<<gCpuCaps.hasAES + <<" AVX="<<gCpuCaps.hasAVX + <<" FMA="<<gCpuCaps.hasFMA + <<std::endl; + if(gCpuCaps.hasMMX) mpxp_context().mplayer_accel |= MM_ACCEL_X86_MMX; + if(gCpuCaps.hasMMX2) mpxp_context().mplayer_accel |= MM_ACCEL_X86_MMXEXT; + if(gCpuCaps.hasSSE) mpxp_context().mplayer_accel |= MM_ACCEL_X86_SSE; + if(gCpuCaps.has3DNow) mpxp_context().mplayer_accel |= MM_ACCEL_X86_3DNOW; + if(gCpuCaps.has3DNowExt) mpxp_context().mplayer_accel |= MM_ACCEL_X86_3DNOWEXT; + mpxp_v<<"mpxp_context().mplayer_accel="<<mpxp_context().mplayer_accel<<std::endl; +} +#endif + + +static void init_player(const std::map<std::string,std::string>& envm) +{ + if(mp_conf.video_driver && strcmp(mp_conf.video_driver,"help")==0) { + mpxp_context().video().output->print_help(); + mpxp_uninit_structs(); + exit(0); + } + if(mp_conf.audio_driver && strcmp(mp_conf.audio_driver,"help")==0) { + mpxp_context().audio().output->print_help(); + mpxp_uninit_structs(); + exit(0); + } + if(mp_conf.video_family && strcmp(mp_conf.video_family,"help")==0) { + vfm_help(); + mpxp_uninit_structs(); + exit(0); + } + if(mp_conf.audio_family && strcmp(mp_conf.audio_family,"help")==0) { + afm_help(); + mpxp_uninit_structs(); + exit(0); + } + if(vf_cfg.list && strcmp(vf_cfg.list,"help")==0) { + vf_help(); + mpxp_uninit_structs(); + exit(0); + } + if(af_cfg.list && strcmp(af_cfg.list,"help")==0) { + af_help(); + mpxp_uninit_structs(); + exit(0); + } + +#ifdef ENABLE_WIN32LOADER + /* check codec.conf*/ + if(!parse_codec_cfg(get_path(envm,"win32codecs.conf").c_str())) { + if(!parse_codec_cfg(CONFDIR"/win32codecs.conf")) { + mpxp_hint<<MSGTR_CopyCodecsConf<<std::endl; + mpxp_uninit_structs(); + exit(0); + } + } +#endif + if(mp_conf.audio_codec && strcmp(mp_conf.audio_codec,"help")==0) { +#ifdef ENABLE_WIN32LOADER + list_codecs(1); +#endif + mpxp_uninit_structs(); + exit(0); + } + if(mp_conf.video_codec && strcmp(mp_conf.video_codec,"help")==0) { +#ifdef ENABLE_WIN32LOADER + list_codecs(0); +#endif + mpxp_uninit_structs(); + exit(0); + } +} + +void show_help(void) { + // no file/vcd/dvd -> show HELP: + for(unsigned j=0;help_text[j];j++) mpxp_info<<help_text[j]<<std::endl; + Stream::print_drivers(); + mpxp_info<<std::endl; + mpxp_info<<"Example: mplayerxp -ao alsa:hw:0 -vo x11 your.avi"<<std::endl; + mpxp_info<<"Use --long-help option for full help"<<std::endl; +} + +void show_long_help(const M_Config& cfg,const std::map<std::string,std::string>& envm) { + MPXPSystem& MPXPSys=*mpxp_context().engine().MPXPSys; + cfg.show_options(); + mp_input_print_binds(MPXPSys.libinput()); + Stream::print_drivers(); + Video_Output::print_help(); + Audio_Output::print_help(); + vf_help(); + af_help(); + vfm_help(); + afm_help(); +#ifdef ENABLE_WIN32LOADER + /* check codec.conf*/ + if(!parse_codec_cfg(get_path(envm,"win32codecs.conf").c_str())){ + if(!parse_codec_cfg(CONFDIR"/win32codecs.conf")){ + mpxp_hint<<MSGTR_CopyCodecsConf<<std::endl; + mpxp_uninit_structs(); + exit(0); + } + } + list_codecs(0); + list_codecs(1); +#endif +} + +#ifdef USE_OSD + +//================= Update OSD ==================== +void update_osd( float v_pts ) +{ + MPXPSystem& MPXPSys=*mpxp_context().engine().MPXPSys; + static char osd_text_buffer[64]; + static int osd_last_pts=-303; +//================= Update OSD ==================== + if(mp_conf.osd_level>=2){ + int pts=(mp_conf.osd_level==3&&MPXPSys.demuxer()->movi_length!=UINT_MAX)?MPXPSys.demuxer()->movi_length-v_pts:v_pts; + int addon=(mp_conf.osd_level==3&&MPXPSys.demuxer()->movi_length!=UINT_MAX)?-1:1; + char osd_text_tmp[64]; + if(pts==osd_last_pts-addon) + { + if(mp_conf.osd_level==3&&MPXPSys.demuxer()->movi_length!=UINT_MAX) ++pts; + else --pts; + } + else osd_last_pts=pts; + mpxp_context().video().output->osd_text=osd_text_buffer; + if (MPXPSys.osd_show_framedrop) { + sprintf(osd_text_tmp, "Framedrop: %s",mp_conf.frame_dropping>1?"hard":mp_conf.frame_dropping?"vo":"none"); + MPXPSys.osd_show_framedrop--; + } else +#ifdef ENABLE_DEC_AHEAD_DEBUG + if(mp_conf.verbose) sprintf(osd_text_tmp,"%c %02d:%02d:%02d",MPXPSys.osd_function,pts/3600,(pts/60)%60,pts%60); + else sprintf(osd_text_tmp,"%c %02d:%02d:%02d",MPXPSys.osd_function,pts/3600,(pts/60)%60,pts%60); +#else + sprintf(osd_text_tmp,"%c %02d:%02d:%02d",MPXPSys.osd_function,pts/3600,(pts/60)%60,pts%60); +#endif + if(strcmp(mpxp_context().video().output->osd_text, osd_text_tmp)) { + strcpy(mpxp_context().video().output->osd_text, osd_text_tmp); + vo_osd_changed(OSDTYPE_OSD); + } + } else { + if(mpxp_context().video().output->osd_text) { + mpxp_context().video().output->osd_text=NULL; + vo_osd_changed(OSDTYPE_OSD); + } + } +} +#endif + +void MPXPSystem::seek( osd_args_t *osd,const seek_args_t* _seek) const +{ + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(_demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); + Demuxer_Stream *d_dvdsub=_demuxer->sub; + int seek_rval=1; + mpxp_context().engine().xp_core->audio->eof=0; + if(_seek->secs || _seek->flags&DEMUX_SEEK_SET) { + seek_rval=demux_seek_r(*_demuxer,_seek); + mpxp_context().mpxp_after_seek=25; /* 1 sec delay */ + } + if(seek_rval){ + mpxp_context().seek_time = GetTimerMS(); + + // success: + /* FIXME there should be real seeking for vobsub */ + if (mpxp_context().video().output->vobsub) vobsub_reset(mpxp_context().video().output->vobsub); + if (mpxp_context().video().output->spudec) spudec_reset(mpxp_context().video().output->spudec); + + if(sh_audio){ + sh_audio->chapter_change=0; + sh_audio->a_pts=HUGE; + } + fflush(stdout); + + if(sh_video){ + MP_UNIT("seek_video_reset"); + mpcv_resync_stream(*mpxp_context().video().decoder); + mpxp_context().video().output->reset(); + sh_video->chapter_change=-1; + } + + if(sh_audio){ + MP_UNIT("seek_audio_reset"); + mpca_resync_stream(*mpxp_context().audio().decoder); + mpxp_context().audio().output->reset(); // stop audio, throwing away buffered data + } + + if (mpxp_context().video().output->vobsub) { + MP_UNIT("seek_vobsub_reset"); + vobsub_seek_r(mpxp_context().video().output->vobsub, _seek); + } + +#ifdef USE_OSD + // Set OSD: + if(mp_conf.osd_level){ + int len=((_demuxer->movi_end-_demuxer->movi_start)>>8); + if (len>0){ + if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; + mpxp_context().video().output->osd_progbar_type=0; + mpxp_context().video().output->osd_progbar_value=(_demuxer->filepos-_demuxer->movi_start)/len; + vo_osd_changed(OSDTYPE_PROGBAR); + } + } +#endif + if(sh_video) { + max_pts_correction=0.1; + if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; // to rewert to PLAY pointer after 1 sec + mpxp_context().bench->audio=0; mpxp_context().bench->audio_decode=0; mpxp_context().bench->video=0; mpxp_context().bench->vout=0; + if(mpxp_context().video().output->spudec) { + unsigned char* packet=NULL; + while(ds_get_packet_sub_r(*d_dvdsub,&packet)>0) ; // Empty stream + spudec_reset(mpxp_context().video().output->spudec); + } + } + } + + if(sh_video) dae_wait_decoder_outrun(mpxp_context().engine().xp_core->video); +} + +void mpxp_reset_vcache(void) +{ + MPXPSystem& MPXPSys=*mpxp_context().engine().MPXPSys; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(MPXPSys.demuxer()->video->sh); + seek_args_t _seek = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; + if(sh_video) MPXPSys.seek(NULL,&_seek); + return; +} + +void mpxp_resync_audio_stream(void) +{ + mpca_resync_stream(*mpxp_context().audio().decoder); +} + +static void init_benchmark(void) +{ + mpxp_context().bench->max_audio=0; mpxp_context().bench->max_video=0; mpxp_context().bench->max_vout=0; + mpxp_context().bench->min_audio=HUGE; mpxp_context().bench->min_video=HUGE; mpxp_context().bench->min_vout=HUGE; + + mpxp_context().bench->min_audio_decode=HUGE; + mpxp_context().bench->max_audio_decode=0; + + mpxp_context().bench->max_demux=0; + mpxp_context().bench->demux=0; + mpxp_context().bench->min_demux=HUGE; + + mpxp_context().bench->cur_video=0; + mpxp_context().bench->cur_vout=0; + mpxp_context().bench->cur_audio=0; +} + +static void show_benchmark(void) +{ + double tot=(mpxp_context().bench->video+mpxp_context().bench->vout+mpxp_context().bench->audio+mpxp_context().bench->audio_decode+mpxp_context().bench->demux+mpxp_context().bench->c2); + double total_time_usage; + + mpxp_context().bench->total_start=GetTimer()-mpxp_context().bench->total_start; + total_time_usage = (float)mpxp_context().bench->total_start*0.000001; + + mpxp_info<<std::endl<<std::setprecision(3) + <<"AVE BENCHMARKs: VC:"<<mpxp_context().bench->video<<"s" + <<" VO:"<<mpxp_context().bench->vout<<"s" + <<" A:"<<mpxp_context().bench->audio+mpxp_context().bench->audio_decode<<"s" + <<" D:"<<mpxp_context().bench->demux<<"s="<<mpxp_context().bench->c2<<"s" + <<" C:"<<tot<<"s"<<std::endl; + if(total_time_usage>0.0) + mpxp_info<<std::setprecision(4) + <<"AVE BENCHMARK%: VC:"<<100.0*mpxp_context().bench->video/total_time_usage<<"%" + <<" VO:"<<100.0*mpxp_context().bench->vout/total_time_usage<<"%" + <<" A:"<<100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/total_time_usage<<"%" + <<" D:"<<100.0*mpxp_context().bench->demux/total_time_usage<<"%" + <<" C:"<<100.0*mpxp_context().bench->c2/total_time_usage<<"%" + <<" = "<<100.0*tot/total_time_usage<<"%"<<std::endl; + unsigned nframes=mpxp_context().engine().xp_core->video->num_played_frames; + mpxp_info<<std::endl<<"REAL RESULTS: from "<<nframes<<"was dropped="<<mpxp_context().engine().xp_core->video->num_dropped_frames<<std::endl; +} + +static void show_benchmark_status(void) +{ + MPXPSystem& MPXPSys=*mpxp_context().engine().MPXPSys; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(MPXPSys.demuxer()->audio->sh); + float rev_time=(sh_audio->timer>0.5)?100.0*(mpxp_context().bench->audio+mpxp_context().bench->audio_decode)/(double)sh_audio->timer:0; + if(xmp_test_model(XMP_Run_AudioPlayback)) + mpxp_status<<std::setprecision(1) + <<"A:"<<sh_audio->timer-mpxp_context().audio().output->get_delay() + <<" "<<rev_time + <<"\r"; + else + mpxp_status<<std::setprecision(1) + <<"A:"<<sh_audio->timer-mpxp_context().audio().output->get_delay() + <<" "<<rev_time + <<" B:"<<get_delay_audio_buffer() + <<"\r"; + mpxp_status.flush(); +} + +void MPXPSystem::init_keyboard_fifo() +{ +#ifdef HAVE_TERMCAP + load_termcap(NULL); // load key-codes +#endif +} + +void mplayer_put_key(int code){ + MPXPSystem& MPXPSys=*mpxp_context().engine().MPXPSys; + mp_cmd_t* cmd; + cmd=mp_input_get_cmd_from_keys(MPXPSys.libinput(),1,&code); + mp_input_queue_cmd(MPXPSys.libinput(),cmd); +} + + +static void mpxp_init_osd(const std::map<std::string,std::string>& envm) { +// check font +#ifdef USE_OSD + if(mp_conf.font_name){ + mpxp_context().video().output->font=read_font_desc(mp_conf.font_name,mp_conf.font_factor,mp_conf.verbose>1); + if(!mpxp_context().video().output->font) + mpxp_err<<MSGTR_CantLoadFont<<": "<<mp_conf.font_name<<std::endl; + } else { + // try default: + mpxp_context().video().output->font=read_font_desc(get_path(envm,"font/font.desc").c_str(),mp_conf.font_factor,mp_conf.verbose>1); + if(!mpxp_context().video().output->font) + mpxp_context().video().output->font=read_font_desc(DATADIR"/font/font.desc",mp_conf.font_factor,mp_conf.verbose>1); + } +#endif + /* Configure menu here */ + { + std::string menu_cfg; + menu_cfg = get_path(envm,"menu.conf"); + if(menu_init(NULL, menu_cfg.c_str())) + mpxp_info<<"Menu initialized: "<<menu_cfg<<std::endl; + else { + menu_cfg="/etc/menu.conf"; + if(menu_init(NULL, menu_cfg.c_str())) + mpxp_info<<"Menu initialized: "<<menu_cfg<<std::endl; + else + mpxp_warn<<"Menu init failed"<<std::endl; + } + } + MP_UNIT("init_osd"); + vo_init_osd(); +} + +char* MPXPSystem::init_output_subsystems() { + char* rs=NULL; + unsigned i; + // check video_out driver name: + MP_UNIT("vo_init"); + if(vo_inited==MPXP_False) { + if(!mpxp_context().video().output) mpxp_context().video().output=new(zeromem) Video_Output; + vo_inited = mpxp_context().video().output->init(mp_conf.video_driver?mp_conf.video_driver:""); + } + + if(vo_inited==MPXP_False){ + mpxp_fatal<<MSGTR_InvalidVOdriver<<": "<<(mp_conf.video_driver?mp_conf.video_driver:"?")<<std::endl; + exit_player(MSGTR_Fatal_error); + } + +// check audio_out driver name: + MP_UNIT("ao_init"); + if (mp_conf.audio_driver) + if ((i=strcspn(mp_conf.audio_driver, ":")) > 0) + { + size_t i2 = strlen(mp_conf.audio_driver); + + if (mp_conf.audio_driver[i] == ':') + { + rs = new char [i2-i]; + if (rs != NULL) strncpy(rs, (char *)(mp_conf.audio_driver+i+1), i2-i); + mp_conf.audio_driver[i] = '\0'; + } + } + return rs; +} + +int MPXPSystem::init_vobsub(const std::string& filename) { + int forced_subs_only=0; + MP_UNIT("vobsub"); + if (mp_conf.vobsub_name){ + mpxp_context().video().output->vobsub=vobsub_open(mp_conf.vobsub_name,mp_conf.spudec_ifo,1,&mpxp_context().video().output->spudec); + if(mpxp_context().video().output->vobsub==NULL) + mpxp_err<<MSGTR_CantLoadSub<<": "<<mp_conf.vobsub_name<<std::endl; + else { + inited_flags|=INITED_VOBSUB; + vobsub_set_from_lang(mpxp_context().video().output->vobsub, mp_conf.dvdsub_lang); + // check if vobsub requested only to display forced subtitles + forced_subs_only=vobsub_get_forced_subs_flag(mpxp_context().video().output->vobsub); + } + }else if(mp_conf.sub_auto && !filename.empty() && filename.length()>=5){ + /* try to autodetect vobsub from movie filename ::atmos */ + std::string buf = filename.substr(0,filename.length()-4); + mpxp_context().video().output->vobsub=vobsub_open(buf,mp_conf.spudec_ifo,0,&mpxp_context().video().output->spudec); + } + if(mpxp_context().video().output->vobsub) { + mp_conf.sub_auto=0; // don't do autosub for textsubs if vobsub found + inited_flags|=INITED_VOBSUB; + } + return forced_subs_only; +} + +int MPXPSystem::handle_playlist(const std::string& filename) const { + Stream* stream=static_cast<Stream*>(_demuxer->stream); + int eof=0; + PlayTree* entry; + // Handle playlist + MP_UNIT("handle_playlist"); + mpxp_v<<"Parsing playlist "<<filename<<"..."<<std::endl; + entry = PlayTree::parse_playtree(_libinput,stream); + if(!entry) { + entry = playtree_iter->get_tree(); + if(playtree_iter->step(1,0) != PLAY_TREE_ITER_ENTRY) { + eof = PT_NEXT_ENTRY; + return eof; + } + if(playtree_iter->get_tree() == entry ) { // Loop with a single file + if(playtree_iter->up_step(1,0) != PLAY_TREE_ITER_ENTRY) { + eof = PT_NEXT_ENTRY; + return eof; + } + } + entry->remove(1,1); + eof = PT_NEXT_SRC; + return eof; + } + playtree_iter->get_tree()->insert_entry(entry); + entry = playtree_iter->get_tree(); + if(playtree_iter->step(1,0) != PLAY_TREE_ITER_ENTRY) { + eof = PT_NEXT_ENTRY; + return eof; + } + entry->remove(1,1); + eof = PT_NEXT_SRC; + return eof; +} + +void MPXPSystem::init_dvd_nls() const { +/* Add NLS support here */ + Stream* stream=static_cast<Stream*>(_demuxer->stream); + char *lang; + if(!mp_conf.audio_lang) mp_conf.audio_lang=nls_get_screen_cp(envm); + MP_UNIT("dvd lang->id"); + if(mp_conf.audio_lang) { + lang=new char [std::max(strlen(mp_conf.audio_lang)+1,size_t(4))]; + strcpy(lang,mp_conf.audio_lang); + if(mp_conf.audio_id==-1 && stream->ctrl(SCTRL_LNG_GET_AID,lang)==MPXP_Ok) { + mp_conf.audio_id=*(int *)lang; + } + delete lang; + } + if(mp_conf.dvdsub_lang) { + lang=new char [std::max(strlen(mp_conf.dvdsub_lang)+1,size_t(4))]; + strcpy(lang,mp_conf.dvdsub_lang); + if(mp_conf.dvdsub_id==-1 && stream->ctrl(SCTRL_LNG_GET_SID,lang)==MPXP_Ok) { + mp_conf.dvdsub_id=*(int *)lang; + } + delete lang; + } +} + +void MPXPSystem::print_stream_formats() const { + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(_demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); + int fmt; + mpxp_info<<"[Stream]:"; + if(sh_video) { + mpxp_info<<"Video="; + if(sh_video->bih)fmt=sh_video->bih->biCompression; + else fmt=sh_video->fourcc; + fourcc(mpxp_info,fmt); + } + if(sh_audio) { + mpxp_info<<" Audio="; + fmt=sh_audio->wtag; + fourcc(mpxp_info,fmt); + } + mpxp_info<<std::endl; +} + +void MPXPSystem::read_video_properties() const { + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); + Demuxer_Stream *d_video=_demuxer->video; + MP_UNIT("video_read_properties"); + if(!sh_video->read_properties()) { + mpxp_err<<"Video: can't read properties"<<std::endl; + d_video->sh=NULL; + sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); + } else { + mpxp_v<<"[V] filefmt:"<<_demuxer->file_format + <<"fourcc:0x"<<std::hex<<sh_video->fourcc + <<" size:"<<sh_video->src_w<<"x"<<sh_video->src_h + <<" fps:"<<std::setprecision(2)<<sh_video->fps + <<" ftime:="<<1/sh_video->fps<<std::endl; + /* need to set fps here for output encoders to pick it up in their init */ + if(mp_conf.force_fps){ + sh_video->fps=mp_conf.force_fps; + } + + if(!sh_video->fps && !mp_conf.force_fps){ + mpxp_err<<MSGTR_FPSnotspecified<<std::endl; + d_video->sh=NULL; + sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); + } + } +} + +void MPXPSystem::read_subtitles(const std::string& filename,int forced_subs_only,int stream_dump_type) { + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); + Stream* stream=static_cast<Stream*>(_demuxer->stream); + if (mp_conf.spudec_ifo) { + unsigned int palette[16], width, height; + MP_UNIT("spudec_init_vobsub"); + std::string buf=""; + if (vobsub_parse_ifo(NULL,mp_conf.spudec_ifo, palette, &width, &height, 1, -1, buf) >= 0) + mpxp_context().video().output->spudec=spudec_new_scaled(palette, sh_video->src_w, sh_video->src_h); + } + + if (mpxp_context().video().output->spudec==NULL) { + unsigned *pal; + MP_UNIT("spudec_init"); + if(stream->ctrl(SCTRL_VID_GET_PALETTE,&pal)==MPXP_Ok) + mpxp_context().video().output->spudec=spudec_new_scaled(pal,sh_video->src_w, sh_video->src_h); + } + + if (mpxp_context().video().output->spudec==NULL) { + MP_UNIT("spudec_init_normal"); + mpxp_context().video().output->spudec=spudec_new_scaled(NULL, sh_video->src_w, sh_video->src_h); + spudec_set_font_factor(mpxp_context().video().output->spudec,mp_conf.font_factor); + } + + if (mpxp_context().video().output->spudec!=NULL) { + inited_flags|=INITED_SPUDEC; + // Apply current settings for forced subs + spudec_set_forced_subs_only(mpxp_context().video().output->spudec,forced_subs_only); + } + +#ifdef USE_SUB +// after reading video params we should load subtitles because +// we know fps so now we can adjust subtitles time to ~6 seconds AST +// check .sub + MP_UNIT("read_subtitles_file"); + if(mp_conf.sub_name){ + mpxp_context().subtitles=sub_read_file(mp_conf.sub_name, sh_video->fps); + if(!mpxp_context().subtitles) mpxp_err<<MSGTR_CantLoadSub<<": "<<mp_conf.sub_name<<std::endl; + } else if(mp_conf.sub_auto) { // auto load sub file ... + mpxp_context().subtitles=sub_read_file( !filename.empty() ? sub_filename(get_path(envm,"sub/").c_str(), filename.c_str() ) + : "default.sub", sh_video->fps ); + } + if(mpxp_context().subtitles) { + inited_flags|=INITED_SUBTITLE; + if(stream_dump_type>1) list_sub_file(mpxp_context().subtitles); + } +#endif +} + +void MPXPSystem::find_acodec(const char *ao_subdevice) { + int found=0; + audio_decoder_t* mpca=0; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(_demuxer->audio->sh); + Demuxer_Stream *d_audio=_demuxer->audio; + sh_audio->codec=NULL; + mpca=mpca_init(sh_audio); // try auto-probe first + if(mpca) { mpxp_context().audio().decoder=mpca; found=1; } +#ifdef ENABLE_WIN32LOADER + if(!found) { +// Go through the codec.conf and find the best codec... + if(mp_conf.audio_family) mpxp_info<<MSGTR_TryForceAudioFmt<<": "<<mp_conf.audio_family<<std::endl; + while(1) { + sh_audio->codec=find_codec(sh_audio->wtag,NULL,sh_audio->codec,1); + if(!sh_audio->codec) { + if(mp_conf.audio_family) { + sh_audio->codec=NULL; /* re-search */ + mpxp_err<<MSGTR_CantFindAfmtFallback<<std::endl; + mp_conf.audio_family=NULL; + continue; + } + break; + } + if(mp_conf.audio_codec && strcmp(sh_audio->codec->codec_name,mp_conf.audio_codec)) continue; + else if(mp_conf.audio_family && strcmp(sh_audio->codec->driver_name,mp_conf.audio_family)) continue; + if(afm_find_driver(sh_audio->codec->driver_name)) { + mpxp_v<<(mp_conf.audio_codec?"Forcing":"Detected") + <<" audio codec: ["<<std::string(sh_audio->codec->codec_name) + <<"] drv:"<<std::string(sh_audio->codec->driver_name) + <<" ("<<std::string(sh_audio->codec->s_info)<<")"<<std::endl; + found=1; + break; + } + } + if(!found) { + sh_audio->codec=find_lavc_audio(sh_audio); + if(sh_audio->codec) found=1; + } + } +#endif + if(!found) { + mpxp_err<<MSGTR_CantFindAudioCodec<<std::endl; + fourcc(mpxp_err,sh_audio->wtag); + mpxp_hint<<get_path(envm,"win32codecs.conf")<<":"<<MSGTR_TryUpgradeCodecsConfOrRTFM<<std::endl; + d_audio->sh=NULL; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); + } else { + if(!(mpxp_context().audio().output=new(zeromem) Audio_Output(ao_subdevice?ao_subdevice:""))) { + mpxp_err<<MSGTR_CannotInitAO<<std::endl; + d_audio->sh=NULL; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); + } + if(ao_subdevice) delete ao_subdevice; + ao_inited=mpxp_context().audio().output->_register(mp_conf.audio_driver?mp_conf.audio_driver:"",0); + if (ao_inited!=MPXP_Ok){ + mpxp_fatal<<MSGTR_InvalidAOdriver<<": "<<mp_conf.audio_driver<<std::endl; + exit_player(MSGTR_Fatal_error); + } + } +} + +MPXP_Rc MPXPSystem::find_vcodec() { + Demuxer_Stream *d_video=_demuxer->video; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); + MPXP_Rc rc=MPXP_Ok; + MP_UNIT("init_video_codec"); + sh_video->inited=0; + mpxp_context().video().output->flags=VOFLAG_NONE; + /* configure flags */ + if(vo_conf.fullscreen) mpxp_context().video().output->FS_SET(); + if(vo_conf.softzoom) mpxp_context().video().output->ZOOM_SET(); + if(vo_conf.flip>0) mpxp_context().video().output->FLIP_SET(); + if(vo_conf.vidmode) mpxp_context().video().output->VM_SET(); + if((mpxp_context().video().decoder=mpcv_init(sh_video,mp_conf.video_codec?mp_conf.video_codec:"",mp_conf.video_family?mp_conf.video_family:"",-1,_libinput))) sh_video->inited=1; +#ifdef ENABLE_WIN32LOADER + if(!sh_video->inited) { +/* Go through the codec.conf and find the best codec...*/ + codecs_reset_selection(0); + if(mp_conf.video_codec) { + /* forced codec by name: */ + mpxp_info<<"Forced video codec: "<<mp_conf.video_codec<<std::endl; + mpxp_context().video().decoder=mpcv_init(sh_video,video_codec?mp_conf.video_codec:"","",-1,_libinput); + } else { + int status; + /* try in stability order: UNTESTED, WORKING, BUGGY, BROKEN */ + if(mp_conf.video_family) mpxp_info<<MSGTR_TryForceVideoFmt<<": "<<mp_conf.video_family<<std::endl; + for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status){ + if(mp_conf.video_family) /* try first the preferred codec family:*/ + if((mpxp_context().video().decoder=mpcv_init(sh_video,"",mp_conf.video_family?mp_conf.video_family:"",status,_libinput))) break; + if((mpxp_context().video().decoder=mpcv_init(sh_video,"","",status,_libinput))) break; + } + } + } + /* Use lavc decoders as last hope */ + if(!sh_video->inited) mpxp_context().video().decoder=mpcv_lavc_init(sh_video,_libinput); +#endif + + if(!sh_video->inited) { + mpxp_err<<MSGTR_CantFindVideoCodec<<std::endl; + fourcc(mpxp_err,sh_video->fourcc); + mpxp_hint<<get_path(envm,"win32codecs.conf")<<":"<<MSGTR_TryUpgradeCodecsConfOrRTFM<<std::endl; + d_video->sh = NULL; + sh_video = reinterpret_cast<sh_video_t*>(d_video->sh); + rc=MPXP_False; + } else inited_flags|=INITED_VCODEC; + + if(sh_video) + mpxp_v<<(mp_conf.video_codec?"Forcing":"Detected") + <<" video codec: ["<<std::string(sh_video->codec->codec_name) + <<"] vfm:"<<std::string(sh_video->codec->driver_name) + <<" ("<<std::string(sh_video->codec->s_info)<<std::endl; + return rc; +} + +int MPXPSystem::configure_audio() { + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(_demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); + Demuxer_Stream *d_audio=_demuxer->audio; + int rc=0; + const ao_info_t *info=mpxp_context().audio().output->get_info(); + MP_UNIT("setup_audio"); + mpxp_v<<"AO: ["<<info->short_name<<"] " + <<(mp_conf.force_srate?mp_conf.force_srate:sh_audio->rate)<<"Hz " + <<(sh_audio->nch>7?"surround71": + sh_audio->nch>6?"surround61": + sh_audio->nch>5?"surround51": + sh_audio->nch>4?"surround41": + sh_audio->nch>3?"surround40": + sh_audio->nch>2?"stereo2.1": + sh_audio->nch>1?"Stereo":"Mono") + <<ao_format_name(sh_audio->afmt)<<std::endl; + mpxp_v<<"AO: Description: "<<info->name<<std::endl; + mpxp_v<<"AO: Author: "<<info->author<<std::endl; + if(strlen(info->comment) > 0) mpxp_v<<"AO: Comment: "<<info->comment<<std::endl; + + MP_UNIT("af_preinit"); + unsigned samplerate,channels,format; + samplerate=mp_conf.force_srate?mp_conf.force_srate:sh_audio->rate; + channels=mp_conf.ao_channels?mp_conf.ao_channels:sh_audio->nch; + format=sh_audio->afmt; + + if(mpca_preinit_filters(*mpxp_context().audio().decoder, + // input: + (int)(sh_audio->rate), + sh_audio->nch, sh_audio->afmt, + // output: + samplerate, channels, format)!=MPXP_Ok){ + mpxp_err<<"Audio filter chain preinit failed"<<std::endl; + } else { + mpxp_v<<"AF_pre: "<<samplerate<<"Hz "<<channels<<"ch (" + <<ao_format_name(format)<< + ") afmt="<<std::hex<<std::setfill('0')<<std::setw(8)<<format + <<" sh_audio_min="<<sh_audio->audio_out_minsize<<std::endl; + } + + if(MPXP_Ok!=mpxp_context().audio().output->configure( + samplerate, + channels, + format)) { + mpxp_err<<"Can't configure audio device"<<std::endl; + d_audio->sh=NULL; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); + if(sh_video == NULL) rc=-1; + } else { + inited_flags|=INITED_AO; + MP_UNIT("af_init"); + if(mpca_init_filters(*mpxp_context().audio().decoder, + sh_audio->rate, + sh_audio->nch, mpaf_format_e(sh_audio->afmt), + mpxp_context().audio().output->samplerate(), + mpxp_context().audio().output->channels(), + mpaf_format_e(mpxp_context().audio().output->format()), + mpxp_context().audio().output->outburst()*4, + mpxp_context().audio().output->buffersize())!=MPXP_Ok) { + mpxp_err<<"No matching audio filter found!"<<std::endl; + } + } + return rc; +} + +void MPXPSystem::run_ahead_engine() { + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(_demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); + MP_UNIT("init_xp"); + if(sh_video && mpxp_context().engine().xp_core->num_v_buffs < 3) {/* we need at least 3 buffers to suppress screen judering */ + mpxp_fatal<<"Not enough buffers for DECODING AHEAD!"<<std::endl; + mpxp_fatal<<"Need 3 buffers but exist only " + <<mpxp_context().engine().xp_core->num_v_buffs<<std::endl; + exit_player("Try other '-vo' driver.\n"); + } + if(xmp_init_engine(sh_video,sh_audio)!=0) + exit_player("Can't initialize decoding ahead!\n"); + if(xmp_run_decoders()!=0) + exit_player("Can't run decoding ahead!\n"); + if(sh_video) + mpxp_ok<<"Using DECODING AHEAD mplayer's core with "<<mpxp_context().engine().xp_core->num_v_buffs<<" video buffers"<<std::endl; + else + mpxp_ok<<"Using DECODING AHEAD mplayer's core with "<<mpxp_context().engine().xp_core->num_a_buffs<<" audio buffers"<<std::endl; +/* reset counters */ + if(sh_video) mpxp_context().engine().xp_core->video->num_dropped_frames=0; + inited_flags|=INITED_XMP; +} + +void MPXPSystem::print_audio_status() const { + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(_demuxer->audio->sh); + /* PAINT audio OSD */ + unsigned ipts,rpts; + unsigned h,m,s,rh,rm,rs; + static unsigned ph=0,pm=0,ps=0; + ipts=(unsigned)(sh_audio->timer-mpxp_context().audio().output->get_delay()); + rpts=_demuxer->movi_length-ipts; + h = ipts/3600; + m = (ipts/60)%60; + s = ipts%60; + if(_demuxer->movi_length!=UINT_MAX) { + rh = rpts/3600; + rm = (rpts/60)%60; + rs = rpts%60; + } else rh=rm=rs=0; + if(h != ph || m != pm || s != ps) { + mpxp_status<<">"<<std::setfill('0')<<std::setw(2)<<h<<":" + <<std::setfill('0')<<std::setw(2)<<m<<":" + <<std::setfill('0')<<std::setw(2)<<s<<"(" + <<std::setfill('0')<<std::setw(2)<<rh<<":" + <<std::setfill('0')<<std::setw(2)<<rm<<":" + <<std::setfill('0')<<std::setw(2)<<rs<<")\r"; + mpxp_status.flush(); + ph = h; + pm = m; + ps = s; + } +} + +#ifdef USE_OSD +int MPXPSystem::paint_osd(int* osd_visible,int* in_pause) { + Stream* stream=static_cast<Stream*>(_demuxer->stream); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(_demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); + int rc=0; + if(*osd_visible) { + if (!--(*osd_visible)) { + mpxp_context().video().output->osd_progbar_type=-1; // disable + vo_osd_changed(OSDTYPE_PROGBAR); + if (!((osd_function == OSD_PAUSE)||(osd_function==OSD_DVDMENU))) + osd_function = OSD_PLAY; + } + } + if(osd_function==OSD_DVDMENU) { + rect_highlight_t hl; + if(stream->ctrl(SCTRL_VID_GET_HILIGHT,&hl)==MPXP_Ok) { + osd_set_nav_box (hl.sx, hl.sy, hl.ex, hl.ey); + mpxp_v<<"Set nav box: "<<hl.sx<<" "<<hl.sy<<" "<<hl.ex<<" "<<hl.ey<<std::endl; + vo_osd_changed (OSDTYPE_DVDNAV); + } + } + if(osd_function==OSD_PAUSE||osd_function==OSD_DVDMENU) { + mp_cmd_t* cmd; + if (vo_inited && sh_video) { + if(mp_conf.osd_level>1 && !*in_pause) { + *in_pause = 1; + return -1; + } + mpxp_context().video().output->pause(); + } + if(mp_conf.verbose) { + mpxp_status<<std::endl<<"------ PAUSED -------\r"; + mpxp_status.flush(); + } + + if (ao_inited==MPXP_Ok && sh_audio) { + if(xmp_test_model(XMP_Run_AudioPlayer)) { + mpxp_context().engine().xp_core->in_pause=1; + while( !dec_ahead_can_aseek ) yield_timeslice(); + } + mpxp_context().audio().output->pause(); // pause audio, keep data if possible + } + + while( (cmd = mp_input_get_cmd(_libinput,20,1,1)) == NULL) { + if(sh_video && vo_inited) mpxp_context().video().output->check_events(); + yield_timeslice(); + } + + if (cmd && cmd->id == MP_CMD_PAUSE) { + cmd = mp_input_get_cmd(_libinput,0,1,0); + mp_cmd_free(cmd); + } + + if(osd_function==OSD_PAUSE) osd_function=OSD_PLAY; + if (ao_inited==MPXP_Ok && sh_audio) { + mpxp_context().audio().output->resume(); // resume audio + if(xmp_test_model(XMP_Run_AudioPlayer)) { + mpxp_context().engine().xp_core->in_pause=0; + __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); + } + } + if (vo_inited && sh_video) + mpxp_context().video().output->resume(); // resume video + *in_pause=0; + (void)GetRelativeTime(); // keep TF around FT in next cycle + } + return rc; +} +#endif + +int MPXPSystem::handle_input(seek_args_t* _seek,osd_args_t* osd,input_state_t* state) { + Stream* stream=static_cast<Stream*>(_demuxer->stream); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(_demuxer->video->sh); + int v_bright=0; + int v_cont=0; + int v_hue=0; + int v_saturation=0; +/* +For future: + int v_red_intensity=0; + int v_green_intensity=0; + int v_blue_intensity=0; +*/ + int eof=0; + mp_cmd_t* cmd; + while( (cmd = mp_input_get_cmd(_libinput,0,0,0)) != NULL) { + switch(cmd->id) { + case MP_CMD_SEEK : { + int v,i_abs; + v = cmd->args[0].v.i; + i_abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; + if(i_abs) { + _seek->flags = DEMUX_SEEK_SET|DEMUX_SEEK_PERCENTS; + if(sh_video) osd_function= (v > dae_played_frame(mpxp_context().engine().xp_core->video).v_pts) ? OSD_FFW : OSD_REW; + _seek->secs = v/100.; + } else { + _seek->flags = DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS; + if(sh_video) osd_function= (v > 0) ? OSD_FFW : OSD_REW; + _seek->secs+= v; + } + } break; + case MP_CMD_SPEED_INCR : + case MP_CMD_SPEED_MULT : + case MP_CMD_SPEED_SET : + mpxp_warn<<"Speed adjusting is not implemented yet!"<<std::endl; + break; + case MP_CMD_SWITCH_AUDIO : + mpxp_info<<"ID_AUDIO_TRACK="<<demuxer_switch_audio_r(*_demuxer, _demuxer->audio->id+1)<<std::endl; + break; + case MP_CMD_SWITCH_VIDEO : + mpxp_info<<"ID_VIDEO_TRACK="<<demuxer_switch_video_r(*_demuxer, _demuxer->video->id+1)<<std::endl; + break; + case MP_CMD_SWITCH_SUB : + mpxp_info<<"ID_SUB_TRACK="<<demuxer_switch_subtitle_r(*_demuxer, _demuxer->sub->id+1)<<std::endl; + break; + case MP_CMD_FRAME_STEP : + case MP_CMD_PAUSE : + osd_function=OSD_PAUSE; + break; + case MP_CMD_SOFT_QUIT : + exit_player(MSGTR_Exit_quit); + case MP_CMD_QUIT : + exit_player(MSGTR_Exit_quit); + case MP_CMD_PLAY_TREE_STEP : { + int n = cmd->args[0].v.i > 0 ? 1 : -1; + PlayTree_Iter* it = new PlayTree_Iter(*playtree_iter); + + if(it->step(n,0) == PLAY_TREE_ITER_ENTRY) + eof = (n > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY; + delete it; + } break; + case MP_CMD_PLAY_TREE_UP_STEP : { + int n = cmd->args[0].v.i > 0 ? 1 : -1; + PlayTree_Iter* it = new PlayTree_Iter(*playtree_iter); + if(it->up_step(n,0) == PLAY_TREE_ITER_ENTRY) + eof = (n > 0) ? PT_UP_NEXT : PT_UP_PREV; + delete it; + } break; + case MP_CMD_PLAY_ALT_SRC_STEP : + if(playtree_iter->get_num_files() > 1) { + int v = cmd->args[0].v.i; + if(v > 0 && playtree_iter->get_file() < playtree_iter->get_num_files()) + eof = PT_NEXT_SRC; + else if(v < 0 && playtree_iter->get_file() > 1) + eof = PT_PREV_SRC; + } + break; + case MP_CMD_OSD : + if(sh_video) { + int v = cmd->args[0].v.i; + if(v < 0) mp_conf.osd_level=(mp_conf.osd_level+1)%4; + else mp_conf.osd_level= v > 3 ? 3 : v; + } + break; + case MP_CMD_MUTE: + mpxp_context().audio().output->mixer_mute(); + break; + case MP_CMD_VOLUME : { + int v = cmd->args[0].v.i; + if(v > 0) mpxp_context().audio().output->mixer_incvolume(); + else mpxp_context().audio().output->mixer_decvolume(); +#ifdef USE_OSD + if(mp_conf.osd_level){ + osd->visible=sh_video->fps; // 1 sec + mpxp_context().video().output->osd_progbar_type=OSD_VOLUME; + mpxp_context().video().output->osd_progbar_value=(mpxp_context().audio().output->mixer_getbothvolume()*256.0)/100.0; + vo_osd_changed(OSDTYPE_PROGBAR); + } +#endif + } break; + case MP_CMD_CONTRAST : { + int v = cmd->args[0].v.i, i_abs = cmd->args[1].v.i; + if(i_abs) v_cont=v; + else v_cont+=v; + if(v_cont > 100) v_cont=100; + if(v_cont < -100) v_cont = -100; + if(mpcv_set_colors(*mpxp_context().video().decoder,VO_EC_CONTRAST,v_cont)==MPXP_Ok) { +#ifdef USE_OSD + if(mp_conf.osd_level){ + osd->visible=sh_video->fps; // 1 sec + mpxp_context().video().output->osd_progbar_type=OSD_CONTRAST; + mpxp_context().video().output->osd_progbar_value=((v_cont)<<8)/100; + mpxp_context().video().output->osd_progbar_value = ((v_cont+100)<<8)/200; + vo_osd_changed(OSDTYPE_PROGBAR); + } +#endif + } + } break; + case MP_CMD_BRIGHTNESS : { + int v = cmd->args[0].v.i, i_abs = cmd->args[1].v.i; + if(i_abs) v_bright=v; + else v_bright+=v; + if(v_bright > 100) v_bright = 100; + if(v_bright < -100) v_bright = -100; + if(mpcv_set_colors(*mpxp_context().video().decoder,VO_EC_BRIGHTNESS,v_bright)==MPXP_Ok) { +#ifdef USE_OSD + if(mp_conf.osd_level){ + osd->visible=sh_video->fps; // 1 sec + mpxp_context().video().output->osd_progbar_type=OSD_BRIGHTNESS; + mpxp_context().video().output->osd_progbar_value=((v_bright)<<8)/100; + mpxp_context().video().output->osd_progbar_value = ((v_bright+100)<<8)/200; + vo_osd_changed(OSDTYPE_PROGBAR); + } +#endif + } + } break; + case MP_CMD_HUE : { + int v = cmd->args[0].v.i, i_abs = cmd->args[1].v.i; + if(i_abs) v_hue=v; + else v_hue+=v; + if(v_hue > 100) v_hue = 100; + if(v_hue < -100) v_hue = -100; + if(mpcv_set_colors(*mpxp_context().video().decoder,VO_EC_HUE,v_hue)==MPXP_Ok) { +#ifdef USE_OSD + if(mp_conf.osd_level){ + osd->visible=sh_video->fps; // 1 sec + mpxp_context().video().output->osd_progbar_type=OSD_HUE; + mpxp_context().video().output->osd_progbar_value=((v_hue)<<8)/100; + mpxp_context().video().output->osd_progbar_value = ((v_hue+100)<<8)/200; + vo_osd_changed(OSDTYPE_PROGBAR); + } +#endif + } + } break; + case MP_CMD_SATURATION : { + int v = cmd->args[0].v.i, i_abs = cmd->args[1].v.i; + if(i_abs) v_saturation=v; + else v_saturation+=v; + if(v_saturation > 100) v_saturation = 100; + if(v_saturation < -100) v_saturation = -100; + if(mpcv_set_colors(*mpxp_context().video().decoder,VO_EC_SATURATION,v_saturation)==MPXP_Ok) { +#ifdef USE_OSD + if(mp_conf.osd_level){ + osd->visible=sh_video->fps; // 1 sec + mpxp_context().video().output->osd_progbar_type=OSD_SATURATION; + mpxp_context().video().output->osd_progbar_value=((v_saturation)<<8)/100; + mpxp_context().video().output->osd_progbar_value = ((v_saturation+100)<<8)/200; + vo_osd_changed(OSDTYPE_PROGBAR); + } +#endif + } + } break; + case MP_CMD_FRAMEDROPPING : { + int v = cmd->args[0].v.i; + if(v < 0) mp_conf.frame_dropping = (mp_conf.frame_dropping+1)%3; + else mp_conf.frame_dropping = v > 2 ? 2 : v; + osd_show_framedrop = osd->info_factor; + } break; + case MP_CMD_TV_STEP_CHANNEL: + if(cmd->args[0].v.i > 0)cmd->id=MP_CMD_TV_STEP_CHANNEL_UP; + else cmd->id=MP_CMD_TV_STEP_CHANNEL_DOWN; + case MP_CMD_TV_STEP_NORM: + case MP_CMD_TV_STEP_CHANNEL_LIST: + stream->ctrl(SCRTL_MPXP_CMD,(any_t*)cmd->id); + break; + case MP_CMD_DVDNAV: + if(stream->ctrl(SCRTL_MPXP_CMD,(any_t*)cmd->args[0].v.i)==MPXP_Ok) { + if(cmd->args[0].v.i!=MP_CMD_DVDNAV_SELECT) { + stream->type(Stream::Type_Menu); + state->need_repaint=1; + } + osd_function=OSD_DVDMENU; + if(cmd->args[0].v.i==MP_CMD_DVDNAV_SELECT) { + osd_function=0; + state->need_repaint=1; + state->after_dvdmenu=1; + state->next_file=1; + return eof; + } + } + break; + case MP_CMD_VO_FULLSCREEN: + mpxp_context().video().output->fullscreen(); + break; + case MP_CMD_VO_SCREENSHOT: + mpxp_context().video().output->screenshot(dae_curr_vplayed(mpxp_context().engine().xp_core)); + break; + case MP_CMD_SUB_POS: { + int v; + v = cmd->args[0].v.i; + + sub_data.pos+=v; + if(sub_data.pos >100) sub_data.pos=100; + if(sub_data.pos <0) sub_data.pos=0; + vo_osd_changed(OSDTYPE_SUBTITLE); + } break; + default : + mpxp_err<<"Received unknow cmd "<<cmd->name<<std::endl; + } + mp_cmd_free(cmd); + } + return eof; +} + +PlayTree_Iter& mpxp_get_playtree_iter() { return *(mpxp_context().engine().MPXPSys->playtree_iter); } +const std::map<std::string,std::string>& mpxp_get_environment() { return mpxp_context().engine().MPXPSys->envm; } +/******************************************\ +* MAIN MPLAYERXP FUNCTION !!! * +\******************************************/ +int MPlayerXP(const std::vector<std::string>& argv, const std::map<std::string,std::string>& envm){ +// mpxp_test_backtrace(); + Stream* stream=NULL; + int stream_dump_type=0; + input_state_t input_state = { 0, 0, 0 }; + const char *ao_subdevice; + std::string filename=""; //"MI2-Trailer.avi"; + int file_format=Demuxer::Type_UNKNOWN; + +// movie info: + int eof=0; + osd_args_t osd = { 100, 9 }; + int forced_subs_only=0; + seek_args_t seek_args = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; + + // Yes, it really must be placed in stack or in very secret place + PointerProtector<MPXPSecureKeys> ptr_protector; + secure_keys=ptr_protector.protect(new(zeromem) MPXPSecureKeys(10)); + + init_signal_handling(); + + xmp_init(); + xmp_register_main(exit_sighandler); + + mpxp_print_init(mp_conf.verbose+MSGL_STATUS); + for(unsigned j=0;banner_text[j];j++) mpxp_info<<banner_text[j]<<std::endl; + + /* currently it's lowest point of MPXPSystem initialization */ + mpxp_context().engine().MPXPSys = new(zeromem) MPXPSystem(envm); + MPXPSystem& MPXPSys=*mpxp_context().engine().MPXPSys; + MPXPSys.init_keyboard_fifo(); + + MPXPSys.playtree = new(zeromem) PlayTree(); + + M_Config& m_config=*new(zeromem) M_Config(MPXPSys.playtree,MPXPSys.libinput()); + mpxp_context().mconfig = &m_config; + m_config.register_options(mplayerxp_opts); + // TODO : add something to let modules register their options + mp_register_options(m_config); + m_config.parse_cfgfiles(envm); + + if(m_config.parse_command_line(argv,envm)!=MPXP_Ok) + exit_player("Error parse command line"); // error parsing cmdline + + if(!mp_conf.xp) { + mpxp_err<<"Error: detected option: -core.xp=0"<<std::endl; + mpxp_err<<"Note! Single-thread mode is not longer supported by MPlayerXP"<<std::endl; + exit_player(MSGTR_Exit_quit); + } + if(mp_conf.test_av) { + int verb=1; + if(mpxp_test_antiviral_protection(&verb)==MPXP_Virus) + exit_player("Bad test of antiviral protection"); + } + + xp_num_cpu=get_number_cpu(); +#if defined( ARCH_X86 ) || defined(ARCH_X86_64) + get_mmx_optimizations(); +#endif + if(mp_conf.shuffle_playback) MPXPSys.playtree->set_flags(MPXPSys.playtree->get_flags()|PLAY_TREE_RND); + else MPXPSys.playtree->set_flags(MPXPSys.playtree->get_flags()&~PLAY_TREE_RND); + +// MPXPSys.playtree = play_tree_cleanup(MPXPSys.playtree); + if(MPXPSys.playtree) { + MPXPSys.playtree_iter = new PlayTree_Iter(MPXPSys.playtree,m_config); + if(MPXPSys.playtree_iter) { + if(MPXPSys.playtree_iter->step(0,0) != PLAY_TREE_ITER_ENTRY) { + delete MPXPSys.playtree_iter; + MPXPSys.playtree_iter = NULL; + } + else filename = MPXPSys.playtree_iter->get_playable_source_name(1); + } + } + + mpxp_context().engine().xp_core->num_a_buffs = vo_conf.xp_buffs; + + init_player(envm); + + if(filename.empty()){ + show_help(); + exit_player(MSGTR_Exit_quit); + } + + // Many users forget to include command line in bugreports... + if(mp_conf.verbose){ + std::map<std::string,std::string>::const_iterator it; + mpxp_info<<"Environment:"<<std::endl; + for(it=envm.begin();it!=envm.end();it++) + mpxp_info<<(*it).first<<" => "<<(*it).second<<std::endl; + size_t i,sz=argv.size(); + mpxp_info<<"CommandLine:"; + for(i=1;i<sz;i++) mpxp_info<<" '"<<argv[i]<<"'"; + mpxp_info<<std::endl; + } + + mpxp_context().video().output=new(zeromem) Video_Output; +//------ load global data first ------ + mpxp_init_osd(envm); +// ========== Init keyboard FIFO (connection to libvo) ============ + + MP_UNIT(NULL); + + +// ******************* Now, let's see the per-file stuff ******************** +play_next_file: + + ao_subdevice=MPXPSys.init_output_subsystems(); + if(!filename.empty()) mpxp_ok<<MSGTR_Playing<<" "<<filename<<std::endl; + + forced_subs_only=MPXPSys.init_vobsub(filename); + + MP_UNIT("mplayer"); + if(!input_state.after_dvdmenu && MPXPSys.demuxer()) { + delete MPXPSys.demuxer()->stream; + MPXPSys.demuxer()->stream=NULL; + MPXPSys.inited_flags&=~INITED_STREAM; + MPXPSys.uninit_demuxer(); + } + if(MPXPSys.demuxer()) { + MPXPSys.demuxer()->audio=NULL; + MPXPSys.demuxer()->video=NULL; + MPXPSys.demuxer()->sub=NULL; + MPXPSys.demuxer()->audio->sh=NULL; + MPXPSys.demuxer()->video->sh=NULL; + } +//============ Open & Sync STREAM --- fork cache2 ==================== + stream_dump_type=0; + if(mp_conf.stream_dump) + if((stream_dump_type=dump_parse(mp_conf.stream_dump))==0) { + mpxp_err<<"Wrong dump parameters! Unable to continue"<<std::endl; + exit_player(MSGTR_Fatal_error); + } + + if(stream_dump_type) mp_conf.s_cache_size=0; + MP_UNIT("open_stream"); + // CACHE2: initial prefill: 20% later: 5% (should be set by -cacheopts) + if(!input_state.after_dvdmenu) + stream=(mp_conf.s_cache_size && !stream_dump_type)? + new(zeromem) Cached_Stream(MPXPSys.libinput(),mp_conf.s_cache_size*1024,mp_conf.s_cache_size*1024/5,mp_conf.s_cache_size*1024/20): + new(zeromem) Stream; + if(stream->open(MPXPSys.libinput(),filename,&file_format)!=MPXP_Ok) { // error... + mpxp_err<<"Can't open: "<<filename<<std::endl; + eof = MPXPSys.libmpdemux_was_interrupted(PT_NEXT_ENTRY); + goto goto_next_file; + } + MPXPSys.inited_flags|=INITED_STREAM; + + if(stream->type() & Stream::Type_Text) { + eof=MPXPSys.handle_playlist(filename); + goto goto_next_file; + } + + MP_UNIT(NULL); + + // DUMP STREAMS: + if(stream_dump_type==1) dump_stream(stream); + +//============ Open MPXPSys.demuxer()S --- DETECT file type ======================= + if(mp_conf.playb... [truncated message content] |
From: <nic...@us...> - 2013-04-17 09:54:35
|
Revision: 628 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=628&view=rev Author: nickols_k Date: 2013-04-17 09:54:29 +0000 (Wed, 17 Apr 2013) Log Message: ----------- fixed compilation with gcc-4.8.0 Modified Paths: -------------- mplayerxp/configure mplayerxp/osdep/mp_malloc.cpp mplayerxp/osdep/mplib.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2013-04-12 07:48:43 UTC (rev 627) +++ mplayerxp/configure 2013-04-17 09:54:29 UTC (rev 628) @@ -644,7 +644,7 @@ fi if enabled png; then -require2 png png.h PNG_LIBPNG_VER_STRING -lpng +require3 png png.h Z_BEST_SPEED PNG_LIBPNG_VER_STRING -lpng print_config HAVE_ mpxp_config.h mpxp_config.mak png disabled png && require2 libpng_png libpng/png.h PNG_LIBPNG_VER_STRING -lpng -lm print_config HAVE_ mpxp_config.h mpxp_config.mak libpng_png Modified: mplayerxp/osdep/mp_malloc.cpp =================================================================== --- mplayerxp/osdep/mp_malloc.cpp 2013-04-12 07:48:43 UTC (rev 627) +++ mplayerxp/osdep/mp_malloc.cpp 2013-04-17 09:54:29 UTC (rev 628) @@ -570,13 +570,13 @@ mp_free(ptr); } -any_t *operator new(size_t size) { return SECURE_NAME0(_mp_malloc)(size); } -any_t *operator new(size_t size,const zeromemory_t&) { return SECURE_NAME1(_mp_mallocz)(size); } -any_t *operator new(size_t size,const alignedmemory_t&,size_t boundary) { return SECURE_NAME2(_mp_memalign)(boundary,size); } -any_t *operator new(size_t size,const std::nothrow_t&) { return mp_malloc(size); } -any_t *operator new[](size_t size) { return SECURE_NAME0(_mp_malloc)(size); } -any_t *operator new[](size_t size,const zeromemory_t&) { return SECURE_NAME1(_mp_mallocz)(size); } -any_t *operator new[](size_t size,const alignedmemory_t&,size_t boundary) { return SECURE_NAME2(_mp_memalign)(boundary,size); } -any_t *operator new[](size_t size,const std::nothrow_t&) { return mp_malloc(size); } -void operator delete(any_t* p) { SECURE_NAME3(_mp_free)(p); } -void operator delete[](any_t* p) { SECURE_NAME3(_mp_free)(p); } +any_t* operator new(size_t size) throw(std::bad_alloc) { return SECURE_NAME0(_mp_malloc)(size); } +any_t* operator new(size_t size,const zeromemory_t&) { return SECURE_NAME1(_mp_mallocz)(size); } +any_t* operator new(size_t size,const alignedmemory_t&,size_t boundary) { return SECURE_NAME2(_mp_memalign)(boundary,size); } +any_t* operator new(size_t size,const std::nothrow_t&) { return mp_malloc(size); } +any_t* operator new[](size_t size) throw(std::bad_alloc) { return SECURE_NAME0(_mp_malloc)(size); } +any_t* operator new[](size_t size,const zeromemory_t&) { return SECURE_NAME1(_mp_mallocz)(size); } +any_t* operator new[](size_t size,const alignedmemory_t&,size_t boundary) { return SECURE_NAME2(_mp_memalign)(boundary,size); } +any_t* operator new[](size_t size,const std::nothrow_t&) { return mp_malloc(size); } +void operator delete(any_t* p) throw() { SECURE_NAME3(_mp_free)(p); } +void operator delete[](any_t* p) throw() { SECURE_NAME3(_mp_free)(p); } Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2013-04-12 07:48:43 UTC (rev 627) +++ mplayerxp/osdep/mplib.h 2013-04-17 09:54:29 UTC (rev 628) @@ -108,14 +108,14 @@ #include <new> enum zeromemory_t{ zeromem=0 }; enum alignedmemory_t{ alignmem=0 }; -any_t *operator new(size_t size); -any_t *operator new(size_t size,const zeromemory_t&); -any_t *operator new(size_t size,const alignedmemory_t&,size_t boundary); -any_t *operator new(size_t size,const std::nothrow_t&); -any_t *operator new[](size_t size); -any_t *operator new[](size_t size,const zeromemory_t&); -any_t *operator new[](size_t size,const alignedmemory_t&,size_t boundary); -any_t *operator new[](size_t size,const std::nothrow_t&); +any_t* operator new(size_t size); +any_t* operator new(size_t size,const zeromemory_t&); +any_t* operator new(size_t size,const alignedmemory_t&,size_t boundary); +any_t* operator new(size_t size,const std::nothrow_t&); +any_t* operator new[](size_t size); +any_t* operator new[](size_t size,const zeromemory_t&); +any_t* operator new[](size_t size,const alignedmemory_t&,size_t boundary); +any_t* operator new[](size_t size,const std::nothrow_t&); void operator delete(any_t* p); void operator delete[](any_t* p); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2013-04-17 13:05:56
|
Revision: 629 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=629&view=rev Author: nickols_k Date: 2013-04-17 13:05:49 +0000 (Wed, 17 Apr 2013) Log Message: ----------- restore -vo fbdev efficiency Modified Paths: -------------- mplayerxp/libvo2/vo_fbdev.cpp mplayerxp/main.cpp Modified: mplayerxp/libvo2/vo_fbdev.cpp =================================================================== --- mplayerxp/libvo2/vo_fbdev.cpp 2013-04-17 09:54:29 UTC (rev 628) +++ mplayerxp/libvo2/vo_fbdev.cpp 2013-04-17 13:05:49 UTC (rev 629) @@ -252,6 +252,7 @@ } fb_preinit_done = 1; + pre_init_err= MPXP_Ok; fb_works = MPXP_Ok; return MPXP_Ok; err_out_tty_fd: @@ -263,6 +264,7 @@ err_out: fb_preinit_done = 1; fb_works = MPXP_False; + pre_init_err= MPXP_Error; return MPXP_False; } @@ -889,7 +891,10 @@ mpxp_err<<FBDEV<< "Internal fatal error: init() was called before preinit()"<<std::endl; return MPXP_False; } - if (pre_init_err!=MPXP_Ok) return MPXP_False; + if (pre_init_err!=MPXP_Ok) { + mpxp_err<<FBDEV<<"fb_prenit() was failed"<<std::endl; + return MPXP_False; + } if (priv_conf.mode_name && !flags&VOFLAG_MODESWITCHING) { mpxp_err<<FBDEV<< "-fbmode can only be used with -vm"<<std::endl; Modified: mplayerxp/main.cpp =================================================================== --- mplayerxp/main.cpp 2013-04-17 09:54:29 UTC (rev 628) +++ mplayerxp/main.cpp 2013-04-17 13:05:49 UTC (rev 629) @@ -2078,7 +2078,6 @@ str=str.substr(0,pos); envm[str]=stmp; } - envp[j+1] = NULL; /* init antiviral protection */ int rc; rc=mp_mprotect((any_t*)antiviral_hole1,sizeof(antiviral_hole1),MP_DENY_ALL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2013-04-17 14:04:39
|
Revision: 630 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=630&view=rev Author: nickols_k Date: 2013-04-17 14:04:33 +0000 (Wed, 17 Apr 2013) Log Message: ----------- impove informativeness. Really: after migrating on archlinux with precompiled gcc-4.8.0 illegal patch still exists on the development computer: main.cpp:2081 doesn't modify environment variables and env[j+1] still points on ELF Modified Paths: -------------- mplayerxp/libmpconf/cfgparser.cpp mplayerxp/main.cpp Modified: mplayerxp/libmpconf/cfgparser.cpp =================================================================== --- mplayerxp/libmpconf/cfgparser.cpp 2013-04-17 13:05:49 UTC (rev 629) +++ mplayerxp/libmpconf/cfgparser.cpp 2013-04-17 14:04:33 UTC (rev 630) @@ -112,7 +112,7 @@ if (lopt==lname) goto option_found; } } - mpxp_err<<"invalid option: "<<opt<<std::endl; + mpxp_err<<"read_option: invalid option: "<<opt<<std::endl; ret = ERR_NOT_AN_OPTION; goto out; option_found : @@ -124,7 +124,7 @@ goto out; } if (conf[i].flags & CONF_NOCMD && parser_mode == M_Config::CmdLine) { - mpxp_err<<"this option can only be used in config file:"<<opt<<std::endl; + mpxp_err<<"read_option: this option can only be used in config file:"<<opt<<std::endl; ret = ERR_NOT_AN_OPTION; goto out; } @@ -156,14 +156,14 @@ lparm=="0") *((int *) conf[i].p) = conf[i].min; else { - mpxp_err<<"invalid parameter for flag: "<<param<<std::endl; + mpxp_err<<"read_option: invalid parameter for flag: "<<param<<std::endl; ret = ERR_OUT_OF_RANGE; goto out; } ret = 1; } else { /* parser_mode == COMMAND_LINE */ *((int *) conf[i].p) = conf[i].max; - mpxp_dbg3<<"assigning "<<conf[i].name<<"="<<conf[i].max<<" as flag value"<<std::endl; + mpxp_dbg3<<"read_option: assigning "<<conf[i].name<<"="<<conf[i].max<<" as flag value"<<std::endl; ret = 0; } break; @@ -173,27 +173,27 @@ tmp_int = ::strtol(param.c_str(), &endptr, 0); if (*endptr) { - mpxp_err<<"parameter must be an integer: "<<param<<std::endl; + mpxp_err<<"read_option: parameter must be an integer: "<<param<<std::endl; ret = ERR_OUT_OF_RANGE; goto out; } if (conf[i].flags & CONF_MIN) if (tmp_int < conf[i].min) { - mpxp_err<<"parameter must be >= "<<(int) conf[i].min<<": "<<param<<std::endl; + mpxp_err<<"read_option: parameter must be >= "<<(int) conf[i].min<<": "<<param<<std::endl; ret = ERR_OUT_OF_RANGE; goto out; } if (conf[i].flags & CONF_MAX) if (tmp_int > conf[i].max) { - mpxp_err<<"parameter must be <= "<<(int) conf[i].max<<": "<<param<<std::endl; + mpxp_err<<"read_option: parameter must be <= "<<(int) conf[i].max<<": "<<param<<std::endl; ret = ERR_OUT_OF_RANGE; goto out; } *((int *) conf[i].p) = tmp_int; - mpxp_dbg3<<"assigning "<<conf[i].name<<"="<<tmp_int<<" as int value"<<std::endl; + mpxp_dbg3<<"read_option: assigning "<<conf[i].name<<"="<<tmp_int<<" as int value"<<std::endl; ret = 1; break; case CONF_TYPE_FLOAT: @@ -206,27 +206,27 @@ tmp_float /= ::strtod(endptr+1, &endptr); if (*endptr) { - mpxp_err<<"parameter must be a floating point number or a ratio (numerator[:/]denominator): "<<param<<std::endl; + mpxp_err<<"read_option: parameter must be a floating point number or a ratio (numerator[:/]denominator): "<<param<<std::endl; ret = ERR_MISSING_PARAM; goto out; } if (conf[i].flags & CONF_MIN) if (tmp_float < conf[i].min) { - mpxp_err<<"parameter must be >= "<<(float)conf[i].min<<": "<<param<<std::endl; + mpxp_err<<"read_option: parameter must be >= "<<(float)conf[i].min<<": "<<param<<std::endl; ret = ERR_OUT_OF_RANGE; goto out; } if (conf[i].flags & CONF_MAX) if (tmp_float > conf[i].max) { - mpxp_err<<"parameter must be <= "<<(float)conf[i].max<<": "<<param<<std::endl; + mpxp_err<<"read_option: parameter must be <= "<<(float)conf[i].max<<": "<<param<<std::endl; ret = ERR_OUT_OF_RANGE; goto out; } *((float *) conf[i].p) = tmp_float; - mpxp_dbg3<<"assigning "<<conf[i].name<<"="<<tmp_float<<" as float value"<<std::endl; + mpxp_dbg3<<"read_option: assigning "<<conf[i].name<<"="<<tmp_float<<" as float value"<<std::endl; ret = 1; break; case CONF_TYPE_STRING: @@ -235,19 +235,19 @@ if (conf[i].flags & CONF_MIN) if (param.length() < conf[i].min) { - mpxp_err<<"parameter must be >= "<<(int) conf[i].min<<" chars: "<<param<<std::endl; + mpxp_err<<"read_option: parameter must be >= "<<(int) conf[i].min<<" chars: "<<param<<std::endl; ret = ERR_OUT_OF_RANGE; goto out; } if (conf[i].flags & CONF_MAX) if (param.length() > conf[i].max) { - mpxp_err<<"parameter must be <= "<<(int) conf[i].max<<" chars: "<<param<<std::endl; + mpxp_err<<"read_option: parameter must be <= "<<(int) conf[i].max<<" chars: "<<param<<std::endl; ret = ERR_OUT_OF_RANGE; goto out; } *((char **) conf[i].p) = mp_strdup(param.c_str()); - mpxp_dbg3<<"assigning "<<conf[i].name<<"="<<param<<" as string value"<<std::endl; + mpxp_dbg3<<"read_option: assigning "<<conf[i].name<<"="<<param<<" as string value"<<std::endl; ret = 1; break; case CONF_TYPE_INC: @@ -267,7 +267,7 @@ mpxp_info<<(char *)conf[i].p; exit(1); default: - mpxp_err<<"Unknown config type specified in conf-mplayerxp.h!"<<std::endl; + mpxp_err<<"read_option: Unknown config type specified in conf-mplayerxp.h!"<<std::endl; break; } out: @@ -279,7 +279,7 @@ } return ret; err_missing_param: - mpxp_err<<"missing parameter for option: "<<opt<<std::endl; + mpxp_err<<"read_option: missing parameter for option: "<<opt<<std::endl; ret = ERR_MISSING_PARAM; goto out; } Modified: mplayerxp/main.cpp =================================================================== --- mplayerxp/main.cpp 2013-04-17 13:05:49 UTC (rev 629) +++ mplayerxp/main.cpp 2013-04-17 14:04:33 UTC (rev 630) @@ -2078,6 +2078,7 @@ str=str.substr(0,pos); envm[str]=stmp; } + envp[j+1] = NULL; /* init antiviral protection */ int rc; rc=mp_mprotect((any_t*)antiviral_hole1,sizeof(antiviral_hole1),MP_DENY_ALL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2013-04-26 06:56:52
|
Revision: 632 http://sourceforge.net/p/mplayerxp/code/632 Author: nickols_k Date: 2013-04-26 06:56:49 +0000 (Fri, 26 Apr 2013) Log Message: ----------- sync with http://beye.sf.bet Modified Paths: -------------- mplayerxp/main.cpp mplayerxp/osdep/mp_malloc.cpp Modified: mplayerxp/main.cpp =================================================================== --- mplayerxp/main.cpp 2013-04-23 12:51:09 UTC (rev 631) +++ mplayerxp/main.cpp 2013-04-26 06:56:49 UTC (rev 632) @@ -2060,6 +2060,27 @@ int main(int argc,char* args[], char *envp[]) { try { + /* init malloc */ + size_t pos; + mp_conf.malloc_debug=0; + mp_malloc_e flg=MPA_FLG_RANDOMIZER; + for(int i=0;i<argc;i++) { + std::string s=args[i]; + if(s.substr(0,18)=="-core.malloc-debug") { + if((pos=s.find('='))!=std::string::npos) { + mp_conf.malloc_debug=::atoi(s.substr(pos+1).c_str()); + } + switch(mp_conf.malloc_debug) { + default: + case 0: flg=MPA_FLG_RANDOMIZER; break; + case 1: flg=MPA_FLG_BOUNDS_CHECK; break; + case 2: flg=MPA_FLG_BEFORE_CHECK; break; + case 3: flg=MPA_FLG_BACKTRACE; break; + } + break; + } + } + mp_init_malloc(args[0],1000,10,flg); std::vector<std::string> argv; std::string str,stmp; for(int i=0;i<argc;i++) { @@ -2069,7 +2090,6 @@ args[argc] = (char*)make_false_pointer((any_t*)antiviral_hole1); std::map<std::string,std::string> envm; unsigned j=0; - size_t pos; while(envp[j]) { str=envp[j++]; pos=str.find('='); @@ -2090,27 +2110,6 @@ return EXIT_FAILURE; } mpxp_ok<<"*** Antiviral protection was inited ***!!!"<<std::endl; - /* init malloc */ - size_t i,sz=argv.size(); - mp_conf.malloc_debug=0; - mp_malloc_e flg=MPA_FLG_RANDOMIZER; - for(i=0;i<sz;i++) { - std::string s=argv[i]; - if(s.substr(0,18)=="-core.malloc-debug") { - if((pos=s.find('='))!=std::string::npos) { - mp_conf.malloc_debug=::atoi(s.substr(pos+1).c_str()); - } - switch(mp_conf.malloc_debug) { - default: - case 0: flg=MPA_FLG_RANDOMIZER; break; - case 1: flg=MPA_FLG_BOUNDS_CHECK; break; - case 2: flg=MPA_FLG_BEFORE_CHECK; break; - case 3: flg=MPA_FLG_BACKTRACE; break; - } - break; - } - } - mp_init_malloc(argv[0],1000,10,flg); /* init structs */ #if defined( ARCH_X86 ) || defined(ARCH_X86_64) memset(&mp_conf.x86,-1,sizeof(x86_features_t)); Modified: mplayerxp/osdep/mp_malloc.cpp =================================================================== --- mplayerxp/osdep/mp_malloc.cpp 2013-04-23 12:51:09 UTC (rev 631) +++ mplayerxp/osdep/mp_malloc.cpp 2013-04-26 06:56:49 UTC (rev 632) @@ -220,7 +220,7 @@ any_t *page_ptr=prot_page_align(ptr); mp_slot_t* slot=prot_find_slot(&priv->mallocs,page_ptr); if(!slot) { - ::printf("[__prot_free_append] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,page_ptr); + mpxp_info<<"[__prot_free_append] suspect call found! Can't find slot for address: "<<ptr<<" [aligned: "<<page_ptr<<"]"<<std::endl; __prot_print_slots(&priv->mallocs); __print_backtrace(Max_BackTraces); ::kill(::getpid(), SIGILL); @@ -236,7 +236,7 @@ if((rp=__prot_malloc_append(size))!=NULL && ptr) { mp_slot_t* slot=prot_find_slot(&priv->mallocs,prot_page_align(ptr)); if(!slot) { - ::printf("[__prot_realloc_append] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,prot_page_align(ptr)); + mpxp_info<<"[__prot_realloc_append] suspect call found! Can't find slot for address: "<<ptr<<" [aligned: "<<prot_page_align(ptr)<<"]"<<std::endl; __prot_print_slots(&priv->mallocs); __print_backtrace(Max_BackTraces); ::kill(::getpid(), SIGILL); @@ -270,7 +270,7 @@ any_t *page_ptr=pre_page_align(ptr); mp_slot_t* slot=prot_find_slot(&priv->mallocs,page_ptr); if(!slot) { - ::printf("[__prot_free_prepend] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,page_ptr); + mpxp_info<<"[__prot_free_prepend] suspect call found! Can't find slot for address: "<<ptr<<" [aligned: "<<page_ptr<<"]"<<std::endl; __prot_print_slots(&priv->mallocs); __print_backtrace(Max_BackTraces); ::kill(::getpid(), SIGILL); @@ -285,7 +285,7 @@ if((rp=__prot_malloc_prepend(size))!=NULL && ptr) { mp_slot_t* slot=prot_find_slot(&priv->mallocs,pre_page_align(ptr)); if(!slot) { - ::printf("[__prot_realloc_prepend] suspect call found! Can't find slot for address: %p [aligned: %p]\n",ptr,pre_page_align(ptr)); + mpxp_info<<"[__prot_realloc_prepend] suspect call found! Can't find slot for address: "<<ptr<<" [aligned: "<<pre_page_align(ptr)<<"]"<<std::endl; __prot_print_slots(&priv->mallocs); __print_backtrace(Max_BackTraces); ::kill(getpid(), SIGILL); @@ -536,7 +536,7 @@ using namespace mpxp; #include <new> -any_t* SECURE_NAME0(_mp_malloc)(size_t size) { +extern "C" any_t* SECURE_NAME0(_mp_malloc)(size_t size) { any_t* ptr; ptr = mp_malloc(size); if(!ptr) { @@ -546,7 +546,7 @@ return ptr; } -any_t* SECURE_NAME1(_mp_mallocz)(size_t size) { +extern "C" any_t* SECURE_NAME1(_mp_mallocz)(size_t size) { any_t* ptr; ptr = mp_mallocz(size); if(!ptr) { @@ -556,7 +556,7 @@ return ptr; } -any_t* SECURE_NAME2(_mp_memalign)(size_t boundary,size_t size) { +extern "C" any_t* SECURE_NAME2(_mp_memalign)(size_t boundary,size_t size) { any_t* ptr; ptr = mp_memalign(boundary,size); if(!ptr) { @@ -566,7 +566,7 @@ return ptr; } -void SECURE_NAME3(_mp_free)(any_t* ptr) { +extern "C" void SECURE_NAME3(_mp_free)(any_t* ptr) { mp_free(ptr); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2013-04-27 17:29:35
|
Revision: 633 http://sourceforge.net/p/mplayerxp/code/633 Author: nickols_k Date: 2013-04-27 17:29:31 +0000 (Sat, 27 Apr 2013) Log Message: ----------- sync with beye Modified Paths: -------------- mplayerxp/libmpcodecs/vd.h mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_packet.h mplayerxp/libmpstream2/stream.h mplayerxp/libvo2/video_out.h mplayerxp/xmpcore/xmp_aframe.h mplayerxp/xmpcore/xmp_core.h Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2013-04-26 06:56:49 UTC (rev 632) +++ mplayerxp/libmpcodecs/vd.h 2013-04-27 17:29:31 UTC (rev 633) @@ -19,9 +19,9 @@ inline video_flags_e operator|(video_flags_e a, video_flags_e b) { return static_cast<video_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } inline video_flags_e operator&(video_flags_e a, video_flags_e b) { return static_cast<video_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } inline video_flags_e operator^(video_flags_e a, video_flags_e b) { return static_cast<video_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } -inline video_flags_e operator|=(video_flags_e a, video_flags_e b) { return (a=static_cast<video_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } -inline video_flags_e operator&=(video_flags_e a, video_flags_e b) { return (a=static_cast<video_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } -inline video_flags_e operator^=(video_flags_e a, video_flags_e b) { return (a=static_cast<video_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } +inline video_flags_e operator|=(video_flags_e& a, video_flags_e b) { return (a=static_cast<video_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } +inline video_flags_e operator&=(video_flags_e& a, video_flags_e b) { return (a=static_cast<video_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } +inline video_flags_e operator^=(video_flags_e& a, video_flags_e b) { return (a=static_cast<video_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } typedef enum { VCodecStatus_Working =3, Modified: mplayerxp/libmpconf/cfgparser.h =================================================================== --- mplayerxp/libmpconf/cfgparser.h 2013-04-26 06:56:49 UTC (rev 632) +++ mplayerxp/libmpconf/cfgparser.h 2013-04-27 17:29:31 UTC (rev 633) @@ -142,9 +142,9 @@ inline M_Config::flags_e operator|(M_Config::flags_e a, M_Config::flags_e b) { return static_cast<M_Config::flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } inline M_Config::flags_e operator&(M_Config::flags_e a, M_Config::flags_e b) { return static_cast<M_Config::flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } inline M_Config::flags_e operator^(M_Config::flags_e a, M_Config::flags_e b) { return static_cast<M_Config::flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } - inline M_Config::flags_e operator|=(M_Config::flags_e a, M_Config::flags_e b) { return (a=static_cast<M_Config::flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } - inline M_Config::flags_e operator&=(M_Config::flags_e a, M_Config::flags_e b) { return (a=static_cast<M_Config::flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } - inline M_Config::flags_e operator^=(M_Config::flags_e a, M_Config::flags_e b) { return (a=static_cast<M_Config::flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } + inline M_Config::flags_e operator|=(M_Config::flags_e& a, M_Config::flags_e b) { return (a=static_cast<M_Config::flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } + inline M_Config::flags_e operator&=(M_Config::flags_e& a, M_Config::flags_e b) { return (a=static_cast<M_Config::flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } + inline M_Config::flags_e operator^=(M_Config::flags_e& a, M_Config::flags_e b) { return (a=static_cast<M_Config::flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } } // namespace mpxp #endif /* __CONFIG_H */ Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2013-04-26 06:56:49 UTC (rev 632) +++ mplayerxp/libmpdemux/demuxer.h 2013-04-27 17:29:31 UTC (rev 633) @@ -147,9 +147,9 @@ inline Demuxer::demuxer_flags_e operator|(Demuxer::demuxer_flags_e a, Demuxer::demuxer_flags_e b) { return static_cast<Demuxer::demuxer_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } inline Demuxer::demuxer_flags_e operator&(Demuxer::demuxer_flags_e a, Demuxer::demuxer_flags_e b) { return static_cast<Demuxer::demuxer_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } inline Demuxer::demuxer_flags_e operator^(Demuxer::demuxer_flags_e a, Demuxer::demuxer_flags_e b) { return static_cast<Demuxer::demuxer_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } - inline Demuxer::demuxer_flags_e operator|=(Demuxer::demuxer_flags_e a, Demuxer::demuxer_flags_e b) { return (a=static_cast<Demuxer::demuxer_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } - inline Demuxer::demuxer_flags_e operator&=(Demuxer::demuxer_flags_e a, Demuxer::demuxer_flags_e b) { return (a=static_cast<Demuxer::demuxer_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } - inline Demuxer::demuxer_flags_e operator^=(Demuxer::demuxer_flags_e a, Demuxer::demuxer_flags_e b) { return (a=static_cast<Demuxer::demuxer_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } + inline Demuxer::demuxer_flags_e operator|=(Demuxer::demuxer_flags_e& a, Demuxer::demuxer_flags_e b) { return (a=static_cast<Demuxer::demuxer_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } + inline Demuxer::demuxer_flags_e operator&=(Demuxer::demuxer_flags_e& a, Demuxer::demuxer_flags_e b) { return (a=static_cast<Demuxer::demuxer_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } + inline Demuxer::demuxer_flags_e operator^=(Demuxer::demuxer_flags_e& a, Demuxer::demuxer_flags_e b) { return (a=static_cast<Demuxer::demuxer_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } Demuxer* new_demuxers_demuxer(Demuxer* vd, Demuxer* ad, Demuxer* sd); }// namespace mpxp Modified: mplayerxp/libmpdemux/demuxer_packet.h =================================================================== --- mplayerxp/libmpdemux/demuxer_packet.h 2013-04-26 06:56:49 UTC (rev 632) +++ mplayerxp/libmpdemux/demuxer_packet.h 2013-04-27 17:29:31 UTC (rev 633) @@ -20,9 +20,9 @@ inline dp_flags_e operator|(dp_flags_e a, dp_flags_e b) { return static_cast<dp_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } inline dp_flags_e operator&(dp_flags_e a, dp_flags_e b) { return static_cast<dp_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } inline dp_flags_e operator^(dp_flags_e a, dp_flags_e b) { return static_cast<dp_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } - inline dp_flags_e operator|=(dp_flags_e a, dp_flags_e b) { return (a=static_cast<dp_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } - inline dp_flags_e operator&=(dp_flags_e a, dp_flags_e b) { return (a=static_cast<dp_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } - inline dp_flags_e operator^=(dp_flags_e a, dp_flags_e b) { return (a=static_cast<dp_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } + inline dp_flags_e operator|=(dp_flags_e& a, dp_flags_e b) { return (a=static_cast<dp_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } + inline dp_flags_e operator&=(dp_flags_e& a, dp_flags_e b) { return (a=static_cast<dp_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } + inline dp_flags_e operator^=(dp_flags_e& a, dp_flags_e b) { return (a=static_cast<dp_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } /** Describes demuxer's packet */ class Demuxer_Packet : public Opaque { Modified: mplayerxp/libmpstream2/stream.h =================================================================== --- mplayerxp/libmpstream2/stream.h 2013-04-26 06:56:49 UTC (rev 632) +++ mplayerxp/libmpstream2/stream.h 2013-04-27 17:29:31 UTC (rev 633) @@ -98,9 +98,9 @@ inline Stream::type_e operator|(Stream::type_e a, Stream::type_e b) { return static_cast<Stream::type_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } inline Stream::type_e operator&(Stream::type_e a, Stream::type_e b) { return static_cast<Stream::type_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } inline Stream::type_e operator^(Stream::type_e a, Stream::type_e b) { return static_cast<Stream::type_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } - inline Stream::type_e operator|=(Stream::type_e a, Stream::type_e b) { return (a=static_cast<Stream::type_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } - inline Stream::type_e operator&=(Stream::type_e a, Stream::type_e b) { return (a=static_cast<Stream::type_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } - inline Stream::type_e operator^=(Stream::type_e a, Stream::type_e b) { return (a=static_cast<Stream::type_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } + inline Stream::type_e operator|=(Stream::type_e& a, Stream::type_e b) { return (a=static_cast<Stream::type_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } + inline Stream::type_e operator&=(Stream::type_e& a, Stream::type_e b) { return (a=static_cast<Stream::type_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } + inline Stream::type_e operator^=(Stream::type_e& a, Stream::type_e b) { return (a=static_cast<Stream::type_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } struct Memory_Stream : public Stream { public: Modified: mplayerxp/libvo2/video_out.h =================================================================== --- mplayerxp/libvo2/video_out.h 2013-04-26 06:56:49 UTC (rev 632) +++ mplayerxp/libvo2/video_out.h 2013-04-27 17:29:31 UTC (rev 633) @@ -70,9 +70,9 @@ inline vo_flags_e operator|(vo_flags_e a, vo_flags_e b) { return static_cast<vo_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } inline vo_flags_e operator&(vo_flags_e a, vo_flags_e b) { return static_cast<vo_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } inline vo_flags_e operator^(vo_flags_e a, vo_flags_e b) { return static_cast<vo_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } - inline vo_flags_e operator|=(vo_flags_e a, vo_flags_e b) { return (a=static_cast<vo_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } - inline vo_flags_e operator&=(vo_flags_e a, vo_flags_e b) { return (a=static_cast<vo_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } - inline vo_flags_e operator^=(vo_flags_e a, vo_flags_e b) { return (a=static_cast<vo_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } + inline vo_flags_e operator|=(vo_flags_e& a, vo_flags_e b) { return (a=static_cast<vo_flags_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } + inline vo_flags_e operator&=(vo_flags_e& a, vo_flags_e b) { return (a=static_cast<vo_flags_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } + inline vo_flags_e operator^=(vo_flags_e& a, vo_flags_e b) { return (a=static_cast<vo_flags_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } /** Request for supported FOURCC by VO-driver */ struct vo_query_fourcc_t { Modified: mplayerxp/xmpcore/xmp_aframe.h =================================================================== --- mplayerxp/xmpcore/xmp_aframe.h 2013-04-26 06:56:49 UTC (rev 632) +++ mplayerxp/xmpcore/xmp_aframe.h 2013-04-27 17:29:31 UTC (rev 633) @@ -45,9 +45,9 @@ inline mpaf_format_e operator|(mpaf_format_e a, mpaf_format_e b) { return static_cast<mpaf_format_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } inline mpaf_format_e operator&(mpaf_format_e a, mpaf_format_e b) { return static_cast<mpaf_format_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } inline mpaf_format_e operator^(mpaf_format_e a, mpaf_format_e b) { return static_cast<mpaf_format_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } - inline mpaf_format_e operator|=(mpaf_format_e a, mpaf_format_e b) { return (a=static_cast<mpaf_format_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } - inline mpaf_format_e operator&=(mpaf_format_e a, mpaf_format_e b) { return (a=static_cast<mpaf_format_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } - inline mpaf_format_e operator^=(mpaf_format_e a, mpaf_format_e b) { return (a=static_cast<mpaf_format_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } + inline mpaf_format_e operator|=(mpaf_format_e& a, mpaf_format_e b) { return (a=static_cast<mpaf_format_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } + inline mpaf_format_e operator&=(mpaf_format_e& a, mpaf_format_e b) { return (a=static_cast<mpaf_format_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } + inline mpaf_format_e operator^=(mpaf_format_e& a, mpaf_format_e b) { return (a=static_cast<mpaf_format_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } /* Decodes the format from mplayer format to libaf format */ mpaf_format_e __FASTCALL__ afmt2mpaf(unsigned format); Modified: mplayerxp/xmpcore/xmp_core.h =================================================================== --- mplayerxp/xmpcore/xmp_core.h 2013-04-26 06:56:49 UTC (rev 632) +++ mplayerxp/xmpcore/xmp_core.h 2013-04-27 17:29:31 UTC (rev 633) @@ -69,9 +69,9 @@ inline xmp_model_e operator|(xmp_model_e a, xmp_model_e b) { return static_cast<xmp_model_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b)); } inline xmp_model_e operator&(xmp_model_e a, xmp_model_e b) { return static_cast<xmp_model_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b)); } inline xmp_model_e operator^(xmp_model_e a, xmp_model_e b) { return static_cast<xmp_model_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b)); } - inline xmp_model_e operator|=(xmp_model_e a, xmp_model_e b) { return (a=static_cast<xmp_model_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } - inline xmp_model_e operator&=(xmp_model_e a, xmp_model_e b) { return (a=static_cast<xmp_model_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } - inline xmp_model_e operator^=(xmp_model_e a, xmp_model_e b) { return (a=static_cast<xmp_model_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } + inline xmp_model_e operator|=(xmp_model_e& a, xmp_model_e b) { return (a=static_cast<xmp_model_e>(static_cast<unsigned>(a)|static_cast<unsigned>(b))); } + inline xmp_model_e operator&=(xmp_model_e& a, xmp_model_e b) { return (a=static_cast<xmp_model_e>(static_cast<unsigned>(a)&static_cast<unsigned>(b))); } + inline xmp_model_e operator^=(xmp_model_e& a, xmp_model_e b) { return (a=static_cast<xmp_model_e>(static_cast<unsigned>(a)^static_cast<unsigned>(b))); } struct mpxp_thread_t { unsigned p_idx; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <nic...@us...> - 2013-05-14 12:02:23
|
Revision: 638 http://sourceforge.net/p/mplayerxp/code/638 Author: nickols_k Date: 2013-05-14 12:02:20 +0000 (Tue, 14 May 2013) Log Message: ----------- more streams Modified Paths: -------------- mplayerxp/libmpstream2/s_file.cpp mplayerxp/libvo2/vo_fbdev.cpp Modified: mplayerxp/libmpstream2/s_file.cpp =================================================================== --- mplayerxp/libmpstream2/s_file.cpp 2013-05-08 13:49:59 UTC (rev 637) +++ mplayerxp/libmpstream2/s_file.cpp 2013-05-14 12:02:20 UTC (rev 638) @@ -4,6 +4,9 @@ /* s_file - stream interface for file i/o. */ +#include <iostream> +#include <fstream> + #include <errno.h> #include <stdlib.h> #include <stdio.h> @@ -36,29 +39,29 @@ virtual off_t sector_size() const; virtual std::string mime_type() const; private: - int fd; - int was_open; + std::ifstream fs; off_t spos; off_t end_pos; }; File_Stream_Interface::File_Stream_Interface(libinput_t&l) :Stream_Interface(l), - fd(0),was_open(0),spos(0) {} + spos(0) {} File_Stream_Interface::~File_Stream_Interface() {} MPXP_Rc File_Stream_Interface::open(const std::string& filename,unsigned flags) { UNUSED(flags); - if(filename=="-") fd=0; - else fd=::open(filename.c_str(),O_RDONLY); - if(fd<0) { +// if(filename=="-") fd=0; +// else fd=::open(filename.c_str(),O_RDONLY); + fs.open(filename.c_str(),std::ios_base::binary | std::ios_base::in); + if(!fs.is_open()) { mpxp_err<<"[s_file] Cannot open file: "<<filename<<std::endl; return MPXP_False; } - was_open = (fd==0)?0:1; - end_pos = ::lseek(fd,0,SEEK_END); - ::lseek(fd,0,SEEK_SET); + fs.seekg(0,std::ios_base::end); + end_pos = fs.tellg(); + fs.seekg(0,std::ios_base::beg); /* decreasing number of packet from 256 to 10 speedups cache2 from 3.27% to 1.26% with full speed 1.04% for -nocache */ /* Note: Please locate sector_size changinf after all read/write operations of open() function */ @@ -76,14 +79,18 @@ Should we repeate read() again on these errno: `EAGAIN', `EIO' ??? */ sp->type=0; - sp->len = ::read(fd,sp->buf,sp->len); - if(sp->len>0) spos += sp->len; - return sp->len; + fs.read(sp->buf,sp->len); + spos = fs.tellg(); + return fs.good()?sp->len:-1; } off_t File_Stream_Interface::seek(off_t pos) { - spos=::lseek(fd,pos,SEEK_SET); + fs.clear(fs.failbit); + fs.clear(fs.badbit); + fs.clear(fs.eofbit); + fs.seekg(pos,std::ios_base::beg); + spos=fs.tellg(); return spos; } @@ -94,7 +101,7 @@ void File_Stream_Interface::close() { - if(was_open) ::close(fd); + if(fs.is_open()) fs.close(); } MPXP_Rc File_Stream_Interface::ctrl(unsigned cmd,any_t*args) { Modified: mplayerxp/libvo2/vo_fbdev.cpp =================================================================== --- mplayerxp/libvo2/vo_fbdev.cpp 2013-05-08 13:49:59 UTC (rev 637) +++ mplayerxp/libvo2/vo_fbdev.cpp 2013-05-14 12:02:20 UTC (rev 638) @@ -8,6 +8,8 @@ * * Some idea and code borrowed from Chris Lawrence's ppmtofb-0.27 */ +#include <iostream> +#include <fstream> static const char* FBDEV= "fbdev: "; @@ -128,12 +130,11 @@ MPXP_Rc fb_preinit(); std::string parse_sub_device(const std::string& sd); int parse_fbmode_cfg(const std::string& cfgfile); - int get_token(int num); + int get_token(std::ifstream&,int num); void vt_set_textarea(int u, int l); void lots_of_printf() const; LocalPtr<Aspect>aspect; - FILE * fp; int line_num; char * line; char * token[MAX_NR_TOKEN]; @@ -145,8 +146,7 @@ range_t * monitor_dotclock; fb_mode_t * mode; /* vt related variables */ - int vt_fd; - FILE * vt_fp; + std::ofstream vt_fp; int vt_doit; /* vo_fbdev related variables */ int dev_fd; @@ -175,7 +175,6 @@ unsigned out_width; unsigned out_height; int last_row; - int fs; MPXP_Rc pre_init_err; #ifdef CONFIG_VIDIX /* Name of VIDIX driver */ @@ -314,7 +313,7 @@ if(fb_preinit()!=MPXP_Ok) exit_player("FBDev preinit"); } -int FBDev_VO_Interface::get_token(int num) +int FBDev_VO_Interface::get_token(std::ifstream& fp,int num) { static int read_nextline = 1; static int line_pos; @@ -327,7 +326,8 @@ } if (read_nextline) { - if (!fgets(line, MAX_LINE_LEN, fp)) goto out_eof; + fp.getline(line, MAX_LINE_LEN); + if (!fp.good()) goto out_eof; line_pos = 0; ++line_num; read_nextline = 0; @@ -374,10 +374,12 @@ char *endptr; // strtoul()... int in_mode_def = 0; int tmp, i; + std::ifstream fp; mpxp_dbg2<<"Reading "<<cfgfile.c_str()<<":"; - if ((fp = fopen(cfgfile.c_str(), "r")) == NULL) { + fp.open(cfgfile.c_str(),std::ios_base::in); + if (!fp.is_open()) { mpxp_err<<"can't open '"<<cfgfile<<"': "<<strerror(errno)<<std::endl; return -1; } @@ -390,12 +392,12 @@ /* * check if the cfgfile starts with 'mode' */ - while ((tmp = get_token(1)) == RET_EOL) /* NOTHING */; + while ((tmp = get_token(fp,1)) == RET_EOL) /* NOTHING */; if (tmp == RET_EOF) goto out; if (!strcmp(token[0], "mode")) goto loop_enter; goto err_out_parse_error; - while ((tmp = get_token(1)) != RET_EOF) { + while ((tmp = get_token(fp,1)) != RET_EOF) { if (tmp == RET_EOL) continue; if (!strcmp(token[0], "mode")) { if (in_mode_def) { @@ -413,7 +415,7 @@ ++nr_modes; memset(_mode,0,sizeof(fb_mode_t)); - if (get_token(1) < 0) goto err_out_parse_error; + if (get_token(fp,1) < 0) goto err_out_parse_error; for (i = 0; i < nr_modes - 1; i++) { if (!strcmp(token[0], fb_modes[i].name)) { mpxp_err<<"mode name '"<<token[0]<<"' isn't unique"<<std::endl; @@ -427,7 +429,7 @@ in_mode_def = 1; } else if (!strcmp(token[0], "geometry")) { check_in_mode_def(in_mode_def); goto err_out_print_linenum; - if (get_token(5) < 0) goto err_out_parse_error; + if (get_token(fp,5) < 0) goto err_out_parse_error; _mode->xres = strtoul(token[0], &endptr, 0); if (*endptr) goto err_out_parse_error; _mode->yres = strtoul(token[1], &endptr, 0); @@ -440,7 +442,7 @@ if (*endptr) goto err_out_parse_error; } else if (!strcmp(token[0], "timings")) { check_in_mode_def(in_mode_def); goto err_out_print_linenum; - if (get_token(7) < 0) goto err_out_parse_error; + if (get_token(fp,7) < 0) goto err_out_parse_error; _mode->pixclock = strtoul(token[0], &endptr, 0); if (*endptr) goto err_out_parse_error; _mode->left = strtoul(token[1], &endptr, 0); @@ -460,44 +462,44 @@ in_mode_def = 0; } else if (!strcmp(token[0], "accel")) { check_in_mode_def(in_mode_def); goto err_out_print_linenum; - if (get_token(1) < 0) goto err_out_parse_error; + if (get_token(fp,1) < 0) goto err_out_parse_error; /* * it's only used for text acceleration * so we just ignore it. */ } else if (!strcmp(token[0], "hsync")) { check_in_mode_def(in_mode_def); goto err_out_print_linenum; - if (get_token(1) < 0) goto err_out_parse_error; + if (get_token(fp,1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_HOR_HIGH_ACT; else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_HOR_HIGH_ACT; else goto err_out_parse_error; } else if (!strcmp(token[0], "vsync")) { check_in_mode_def(in_mode_def); goto err_out_print_linenum; - if (get_token(1) < 0) goto err_out_parse_error; + if (get_token(fp,1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_VERT_HIGH_ACT; else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_VERT_HIGH_ACT; else goto err_out_parse_error; } else if (!strcmp(token[0], "csync")) { check_in_mode_def(in_mode_def); goto err_out_print_linenum; - if (get_token(1) < 0) goto err_out_parse_error; + if (get_token(fp,1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_COMP_HIGH_ACT; else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_COMP_HIGH_ACT; else goto err_out_parse_error; } else if (!strcmp(token[0], "extsync")) { check_in_mode_def(in_mode_def); goto err_out_print_linenum; - if (get_token(1) < 0) goto err_out_parse_error; + if (get_token(fp,1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "false")) _mode->sync &= ~FB_SYNC_EXT; else if(!strcmp(token[0], "true")) _mode->sync |= FB_SYNC_EXT; else goto err_out_parse_error; } else if (!strcmp(token[0], "laced")) { check_in_mode_def(in_mode_def); goto err_out_print_linenum; - if (get_token(1) < 0) goto err_out_parse_error; + if (get_token(fp,1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "false")) _mode->vmode = FB_VMODE_NONINTERLACED; else if (!strcmp(token[0], "true")) _mode->vmode = FB_VMODE_INTERLACED; else goto err_out_parse_error; } else if (!strcmp(token[0], "double")) { check_in_mode_def(in_mode_def); goto err_out_print_linenum; - if (get_token(1) < 0) goto err_out_parse_error; + if (get_token(fp,1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "false")) ; else if (!strcmp(token[0], "true")) _mode->vmode = FB_VMODE_DOUBLE; else goto err_out_parse_error; @@ -507,7 +509,7 @@ out: mpxp_dbg2<<nr_modes<<"modes"<<std::endl; delete line; - fclose(fp); + fp.close(); return nr_modes; err_out_parse_error: mpxp_err<<"parse error"; @@ -520,7 +522,6 @@ } nr_modes = 0; delete line; - delete fp; return -2; err_out_not_valid: mpxp_err<<"previous mode is not correct"<<std::endl; @@ -873,8 +874,8 @@ if (mp_conf.verbose > 1) mpxp_dbg2<<FBDEV<< "vt_set_textarea("<<u<<","<<l<<"): "<<urow<<","<<lrow<<std::endl; - ::fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); - ::fflush(vt_fp); + vt_fp<<"\33["<<urow<<";"<<lrow<<"r\33["<<lrow<<";0H"; + vt_fp.flush(); } MPXP_Rc FBDev_VO_Interface::configure(uint32_t width, uint32_t height, uint32_t d_width, @@ -1079,11 +1080,8 @@ return MPXP_False; } } - if (vt_doit && (vt_fd = open("/dev/tty", O_WRONLY)) == -1) { - mpxp_err<<FBDEV<< "can't open /dev/tty: "<<strerror(errno)<<std::endl; - vt_doit = 0; - } - if (vt_doit && !(vt_fp = fdopen(vt_fd, "w"))) { + vt_fp.open("/dev/tty", std::ios_base::out); + if (vt_doit && !vt_fp.is_open()) { mpxp_err<<FBDEV<< "can't fdopen /dev/tty: "<<strerror(errno)<<std::endl; vt_doit = 0; } @@ -1096,18 +1094,19 @@ MPXP_Rc FBDev_VO_Interface::query_format(vo_query_fourcc_t * format) const { + MPXP_Rc rc=MPXP_False; #ifdef CONFIG_VIDIX if(vidix) return vidix->query_fourcc(format); #endif format->flags=VOCAP_NA; switch(format->fourcc) { - case IMGFMT_BGR15: if(bpp == 15) format->flags=VOCAP_SUPPORTED; break; - case IMGFMT_BGR16: if(bpp == 16) format->flags=VOCAP_SUPPORTED; break; - case IMGFMT_BGR24: if(bpp == 24) format->flags=VOCAP_SUPPORTED; break; - case IMGFMT_BGR32: if(bpp == 32) format->flags=VOCAP_SUPPORTED; break; + case IMGFMT_BGR15: if(bpp == 15) format->flags=VOCAP_SUPPORTED; rc=MPXP_Ok; break; + case IMGFMT_BGR16: if(bpp == 16) format->flags=VOCAP_SUPPORTED; rc=MPXP_Ok; break; + case IMGFMT_BGR24: if(bpp == 24) format->flags=VOCAP_SUPPORTED; rc=MPXP_Ok; break; + case IMGFMT_BGR32: if(bpp == 32) format->flags=VOCAP_SUPPORTED; rc=MPXP_Ok; break; default: break; } - return MPXP_Ok; + return rc; } MPXP_Rc FBDev_VO_Interface::select_frame(unsigned idx) @@ -1115,14 +1114,11 @@ #ifdef CONFIG_VIDIX if(vidix) return vidix->select_frame(idx); #endif - unsigned i, out_offset = 0, in_offset = 0; - for (i = 0; i < out_height; i++) { - memcpy( L123123875 + out_offset, next_frame[idx] + in_offset, - out_width * pixel_size); - out_offset += line_len; - in_offset += out_width * pixel_size; - } + size_t src_stride=out_width*pixel_size; + size_t dst_stride=line_len; + stream_copy_pic(L123123875,next_frame[idx],src_stride,out_height,dst_stride,src_stride); + return MPXP_Ok; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2013-05-14 14:45:23
|
Revision: 639 http://sourceforge.net/p/mplayerxp/code/639 Author: nickols_k Date: 2013-05-14 14:45:21 +0000 (Tue, 14 May 2013) Log Message: ----------- more streams Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/libao3/ao_null.cpp mplayerxp/libao3/ao_wav.cpp mplayerxp/libmpcodecs/vd_qtvideo.cpp mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/mux_mpxp64.cpp mplayerxp/libmpdemux/mux_raw.cpp mplayerxp/libmpdemux/muxer.cpp mplayerxp/libmpdemux/muxer.h mplayerxp/libmpdemux/stheader.cpp mplayerxp/libmpstream2/network_asf.cpp mplayerxp/libmpstream2/s_ftp.cpp mplayerxp/libmpsub/subreader.cpp mplayerxp/libmpsub/subreader.h mplayerxp/libmpsub/vobsub.cpp mplayerxp/libvo2/font_load.cpp mplayerxp/libvo2/font_load.h mplayerxp/libvo2/screenshot.cpp mplayerxp/postproc/af_hrtf.cpp mplayerxp/postproc/af_raw.cpp mplayerxp/postproc/libmenu/menu_filesel.cpp mplayerxp/postproc/libmenu/menu_txt.cpp mplayerxp/postproc/vf_raw.cpp mplayerxp/postproc/vf_scale.cpp mplayerxp/win32loader/dshow/DS_Filter.c Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/dump.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -4,6 +4,8 @@ /* dump.c - stream dumper */ +#include <iostream> +#include <fstream> #include <stdio.h> #include <stdlib.h> @@ -28,8 +30,7 @@ int dump_parse(const char *param) { int type=0; - const char *tile; - tile=mrl_parse_line(param,NULL,NULL,&media,&port); + mrl_parse_line(param,NULL,NULL,&media,&port); if(!media) return 0; if(strcmp(media,"stream")==0) type=1; else type=2; @@ -40,7 +41,7 @@ { char buf[4096]; int len; - FILE *f; + std::ofstream f; const char *ext,*name; MP_UNIT("dumpstream"); stream->reset(); @@ -56,17 +57,17 @@ strcpy(buf,port); } name=buf; - f=fopen(name,"wb"); - if(!f){ + f.open(name,std::ios_base::out|std::ios_base::binary); + if(!f.is_open()){ MSG_FATAL(MSGTR_CantOpenDumpfile); exit_player(MSGTR_Fatal_error); } MSG_INFO("Dumping stream to %s\n",name); while(!stream->eof()){ len=stream->read(buf,4096); - if(len>0) fwrite(buf,len,1,f); + if(len>0) f.write(buf,len); } - fclose(f); + f.close(); mpxp_info<<MSGTR_StreamDumped<<std::endl; exit_player(MSGTR_Exit_eof); } @@ -82,7 +83,7 @@ virtual ~dump_priv_t() {} int my_use_pts; - FILE* mux_file; + std::ofstream mux_file; muxer_t* muxer; muxer_stream_t *m_audio,*m_video,*m_subs; unsigned decoded_frameno; @@ -141,9 +142,9 @@ MSG_FATAL("Unsupported muxer format %s found\n",media); exit_player(MSGTR_Fatal_error); } - priv->mux_file=fopen(stream_dump_name,"wb"); + priv->mux_file.open(stream_dump_name,std::ios_base::out|std::ios_base::binary); MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); - if(!priv->mux_file){ + if(!priv->mux_file.is_open()){ MSG_FATAL(MSGTR_CantOpenDumpfile); exit_player(MSGTR_Fatal_error); } @@ -270,10 +271,10 @@ if(demuxer->sub->sh) { if(priv->m_subs) MSG_V("Finishing sstream as\n"); } - fseeko(priv->mux_file,0,SEEK_SET); + priv->mux_file.seekp(0,std::ios_base::beg); muxer_write_header(priv->muxer,demuxer); - fclose(priv->mux_file); - delete demuxer->priv; + priv->mux_file.close(); + delete priv; demuxer->priv=NULL; } mpxp_info<<MSGTR_StreamDumped<<std::endl; Modified: mplayerxp/libao3/ao_null.cpp =================================================================== --- mplayerxp/libao3/ao_null.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libao3/ao_null.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -1,6 +1,9 @@ #include "mpxp_config.h" #include "osdep/mplib.h" using namespace usr; +#include <iostream> +#include <fstream> + #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -88,7 +91,7 @@ struct timeval last_tv; int buffer; - FILE* fd; + std::ofstream fd; int fast_mode; int wav_mode; }; @@ -96,13 +99,14 @@ Null_AO_Interface::Null_AO_Interface(const std::string& _subdevice) :AO_Interface(_subdevice) {} Null_AO_Interface::~Null_AO_Interface() { - if(fd && wav_mode && fseeko(fd, 0, SEEK_SET) == 0){ /* Write wave header */ + if(fd.is_open() && wav_mode){ /* Write wave header */ + fd.seekp(0, std::ios_base::beg); wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8; wavhdr.file_length = le2me_32(wavhdr.file_length); wavhdr.data_length = le2me_32(wavhdr.data_length); - ::fwrite(&wavhdr,sizeof(wavhdr),1,fd); + fd.write((char*)&wavhdr,sizeof(wavhdr)); } - if(fd) ::fclose(fd); + if(fd.is_open()) fd.close(); } void Null_AO_Interface::drain() { @@ -139,8 +143,7 @@ UNUSED(flags); if (!subdevice.empty()) { mrl_parse_line(subdevice,NULL,NULL,&null_dev,&mode); - fd=NULL; - if(null_dev) fd = ::fopen(null_dev, "wb"); + if(null_dev) fd.open(null_dev, std::ios_base::out|std::ios_base::binary); if(::strcmp(mode,"wav")==0) wav_mode=1; } //end parsing subdevice return MPXP_Ok; @@ -179,7 +182,7 @@ } buffer=0; gettimeofday(&last_tv, 0); - if(fd && wav_mode) { + if(fd.is_open() && wav_mode) { wavhdr.channels = le2me_16(_channels); wavhdr.sample_rate = le2me_32(_samplerate); wavhdr.bytes_per_second = le2me_32(afmt2bps(_format)); @@ -188,7 +191,7 @@ wavhdr.data_length=le2me_32(0x7ffff000); wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8; - ::fwrite(&wavhdr,sizeof(wavhdr),1,fd); + fd.write((char*)&wavhdr,sizeof(wavhdr)); wavhdr.file_length=wavhdr.data_length=0; } return MPXP_Ok; @@ -225,7 +228,7 @@ UNUSED(flags); if(fd && len) { mpxp_dbg2<<"writing "<<len<<" bytes into file"<<std::endl; - ::fwrite(data,len,1,fd); + fd.write((const char*)data,len); wavhdr.data_length += len; } return fast_mode?bursts*_outburst:len; Modified: mplayerxp/libao3/ao_wav.cpp =================================================================== --- mplayerxp/libao3/ao_wav.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libao3/ao_wav.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -20,6 +20,9 @@ * with MPlayer; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include <iostream> +#include <fstream> + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -92,7 +95,7 @@ int fast; uint64_t data_length; - FILE* fp; + std::ofstream fp; WaveHeader wavhdr; unsigned _channels,_samplerate,_format; unsigned _buffersize,_outburst; @@ -102,13 +105,8 @@ :AO_Interface(_subdevice) {} Wave_AO_Interface::~Wave_AO_Interface() { if(pcm_waveheader){ /* Rewrite wave header */ - int broken_seek = 0; -#ifdef __MINGW32__ - // Windows, in its usual idiocy "emulates" seeks on pipes so it always looks - // like they work. So we have to detect them brute-force. - broken_seek = GetFileType((HANDLE)_get_osfhandle(_fileno(fp))) != FILE_TYPE_DISK; -#endif - if (broken_seek || fseek(fp, 0, SEEK_SET) != 0) + fp.seekp(0,std::ios_base::beg); + if (!fp.good()) mpxp_err<<"Could not seek to start, WAV size headers not updated!"<<std::endl; else if (data_length > 0x7ffff000) mpxp_err<<"File larger than allowed for WAV files, may play truncated!"<<std::endl; @@ -116,10 +114,10 @@ wavhdr.file_length = data_length + sizeof(wavhdr) - 8; wavhdr.file_length = le2me_32(wavhdr.file_length); wavhdr.data_length = le2me_32(data_length); - ::fwrite(&wavhdr,sizeof(wavhdr),1,fp); + fp.write((char*)&wavhdr,sizeof(wavhdr)); } } - ::fclose(fp); + fp.close(); } // to set/get/query special features/parameters @@ -189,10 +187,10 @@ wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8; mpxp_info<<"ao_wav: "<<out_filename<<" "<<_samplerate<<"-"<<((_channels > 1) ? "Stereo" : "Mono")<<" "<<afmt2str(_format)<<std::endl; - fp = ::fopen(out_filename.c_str(), "wb"); - if(fp) { + fp.open(out_filename.c_str(),std::ios_base::out|std::ios_base::binary); + if(fp.is_open()) { if(pcm_waveheader){ /* Reserve space for wave header */ - ::fwrite(&wavhdr,sizeof(wavhdr),1,fp); + fp.write((char*)&wavhdr,sizeof(wavhdr)); } return MPXP_Ok; } @@ -222,7 +220,7 @@ // return: number of bytes played unsigned Wave_AO_Interface::play(const any_t* data,unsigned len,unsigned flags){ UNUSED(flags); - ::fwrite(data,len,1,fp); + fp.write((const char*)data,len); if(pcm_waveheader) data_length += len; return len; } Modified: mplayerxp/libmpcodecs/vd_qtvideo.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_qtvideo.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpcodecs/vd_qtvideo.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -260,21 +260,12 @@ //Fill the imagedescription for our SVQ3 frame //we can probably get this from Demuxer -#if 0 - framedescHandle=(ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription)+200); - MSG_V("framedescHandle=%p *p=%p\n",framedescHandle,*framedescHandle); -{ FILE* f=fopen("/root/.wine/fake_windows/IDesc","r"); - if(!f) MSG_ERR("filenot found: IDesc\n"); - fread(*framedescHandle,sizeof(ImageDescription)+200,1,f); - fclose(f); -} -#else if(!sh->ImageDesc) sh->ImageDesc=reinterpret_cast<ImageDescription*>(sh->bih+1); // hack for SVQ3-in-AVI MSG_V("ImageDescription size: %d\n",((ImageDescription*)(sh->ImageDesc))->idSize); framedescHandle=(ImageDescriptionHandle)NewHandleClear(((ImageDescription*)(sh->ImageDesc))->idSize); memcpy(*framedescHandle,sh->ImageDesc,((ImageDescription*)(sh->ImageDesc))->idSize); dump_ImageDescription(*framedescHandle); -#endif + //Find codecscomponent for video decompression // result = FindCodec ('SVQ1',anyCodec,&compressor,&decompressor ); // MSG_V("FindCodec SVQ1 returned:%i compressor: 0x%X decompressor: 0x%X\n",result,compressor,decompressor); Modified: mplayerxp/libmpconf/cfgparser.cpp =================================================================== --- mplayerxp/libmpconf/cfgparser.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpconf/cfgparser.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -10,6 +10,8 @@ */ #include <algorithm> #include <limits> +#include <iostream> +#include <fstream> #include <stdlib.h> #include <stdio.h> @@ -342,7 +344,7 @@ static const int MAX_PARAM_LEN=100; MPXP_Rc M_Config::parse_config_file(const std::string& conffile) { - FILE *fp; + std::ifstream fs; char *line; char opt[MAX_OPT_LEN + 1]; char param[MAX_PARAM_LEN + 1]; @@ -374,7 +376,8 @@ goto out; } - if ((fp = ::fopen(conffile.c_str(), "r")) == NULL) { + fs.open(conffile.c_str(),std::ios_base::in); + if (!fs.is_open()) { if (recursion_depth > 1) mpxp_err<<": "<<::strerror(errno)<<std::endl; delete line; ret = MPXP_Ok; @@ -382,7 +385,8 @@ } if (recursion_depth > 1) mpxp_fatal<<std::endl; - while (fgets(line, MAX_LINE_LEN, fp)) { + while (!fs.eof()) { + fs.getline(line, MAX_LINE_LEN); if (errors >= 16) { mpxp_fatal<<"too many errors"<<std::endl; goto out; @@ -504,7 +508,7 @@ } delete line; - fclose(fp); + fs.close(); out: --recursion_depth; return ret; Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpdemux/demux_avi.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -622,45 +622,6 @@ delete priv->suidx; } -/* Read a saved index file */ -#if 0 -if (index_file_load) { - FILE *fp; - char magic[7]; - unsigned int i; - - if ((fp = fopen(index_file_load, "r")) == NULL) { - MSG_ERR(MSGTR_MPDEMUX_AVIHDR_CantReadIdxFile, index_file_load, strerror(errno)); - goto gen_index; - } - fread(&magic, 6, 1, fp); - if (strncmp(magic, "MPIDX1", 6)) { - MSG_ERR(MSGTR_MPDEMUX_AVIHDR_NotValidMPidxFile, index_file_load); - goto gen_index; - } - fread(&priv->idx_size, sizeof(priv->idx_size), 1, fp); - priv->idx=mp_malloc(priv->idx_size*sizeof(AVIINDEXENTRY)); - if (!priv->idx) { - MSG_ERR(MSGTR_MPDEMUX_AVIHDR_FailedMallocForIdxFile, index_file_load); - priv->idx_size = 0; - goto gen_index; - } - - for (i=0; i<priv->idx_size;i++) { - AVIINDEXENTRY *idx; - idx=&((AVIINDEXENTRY *)priv->idx)[i]; - fread(idx, sizeof(AVIINDEXENTRY), 1, fp); - if (feof(fp)) { - MSG_ERR(MSGTR_MPDEMUX_AVIHDR_PrematureEOF, index_file_load); - delete priv->idx; - priv->idx_size = 0; - goto gen_index; - } - } - fclose(fp); - mp_msg(MSGT_HEADER,MSGL_INFO, MSGTR_MPDEMUX_AVIHDR_IdxFileLoaded, index_file_load); -} -#endif /* Generate indexes */ if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){ // build index for file: @@ -735,27 +696,6 @@ priv->idx_size=priv->idx_pos; MSG_INFO("Indexed are generated for %ul chunks\n",priv->idx_size); if(mp_conf.verbose>=2) print_index(priv->idx,priv->idx_size); - -#if 0 - /* Write generated index to a file */ - if (index_file_save) { - FILE *fp; - unsigned int i; - - if ((fp=fopen(index_file_save, "w")) == NULL) { - MSG_ERR(MSGTR_MPDEMUX_AVIHDR_Failed2WriteIdxFile, index_file_save, strerror(errno)); - return; - } - fwrite("MPIDX1", 6, 1, fp); - fwrite(&priv->idx_size, sizeof(priv->idx_size), 1, fp); - for (i=0; i<priv->idx_size; i++) { - AVIINDEXENTRY *idx = &((AVIINDEXENTRY *)priv->idx)[i]; - fwrite(idx, sizeof(AVIINDEXENTRY), 1, fp); - } - fclose(fp); - MSG_INFO(MSGTR_MPDEMUX_AVIHDR_IdxFileSaved, index_file_save); - } -#endif } } #undef MIN Modified: mplayerxp/libmpdemux/demux_ogg.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ogg.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpdemux/demux_ogg.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -182,7 +182,6 @@ static subtitle ogg_sub; static float clear_sub; -//FILE* subout; static MPXP_Rc ogg_probe(Demuxer *demuxer) { Modified: mplayerxp/libmpdemux/mux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/mux_mpxp64.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpdemux/mux_mpxp64.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -62,105 +62,105 @@ float prev_seek; }priv_mpxpav64_t; -static void mpxpav64_put64(FILE *f,uint64_t value) +static void mpxpav64_put64(std::ofstream& f,uint64_t value) { uint64_t val; val = me2le_64(value); - fwrite(&val,8,1,f); + f.write((char*)&val,8); } -static void mpxpav64_put32(FILE *f,uint32_t value) +static void mpxpav64_put32(std::ofstream& f,uint32_t value) { uint32_t val; val = me2le_32(value); - fwrite(&val,4,1,f); + f.write((char*)&val,4); } -static void mpxpav64_put16(FILE *f,uint16_t value) +static void mpxpav64_put16(std::ofstream& f,uint16_t value) { uint16_t val; val = me2le_16(value); - fwrite(&val,2,1,f); + f.write((char*)&val,2); } -static void mpxpav64_put8(FILE *f,uint8_t value) +static void mpxpav64_put8(std::ofstream& f,uint8_t value) { - fwrite(&value,1,1,f); + f.write((char*)&value,1); } -static void mpxpav64_put_pts64(FILE *f,double value) +static void mpxpav64_put_pts64(std::ofstream& f,double value) { uint64_t val; val = llrint(value*1000); /* 1 ms */ mpxpav64_put64(f,val); } -static void mpxpav64_put_pts32(FILE *f,float value) +static void mpxpav64_put_pts32(std::ofstream& f,float value) { uint32_t val; val = PTS2INT(value); /* 1 ms */ mpxpav64_put32(f,val); } -static void mpxpav64_put_pts16(FILE *f,float value) +static void mpxpav64_put_pts16(std::ofstream& f,float value) { uint16_t val; val = PTS2INT(value); /* 1 ms */ mpxpav64_put16(f,val); } -static void mpxpav64_put_pts8(FILE *f,float value) +static void mpxpav64_put_pts8(std::ofstream& f,float value) { uint8_t val; val = PTS2INT(value); /* 1 ms */ mpxpav64_put8(f,val); } -static void mpxpav64_put_unicode(FILE *f, const char *tag) +static void mpxpav64_put_unicode(std::ofstream& f, const char *tag) { size_t len; char *str=nls_recode_from_screen_cp("UTF-16LE",tag,&len); mpxpav64_put16(f,len); - fwrite(str,len,1,f); + f.write(str,len); delete str; } -static void mpxpav64_put_frcc_unicode(FILE *f, const char *frcc,const char *tag) +static void mpxpav64_put_frcc_unicode(std::ofstream& f, const char *frcc,const char *tag) { - fwrite(frcc,4,1,f); + f.write(frcc,4); mpxpav64_put_unicode(f,tag); } -static uint64_t mpxpav64_open_header64(FILE *f,const char *id) +static uint64_t mpxpav64_open_header64(std::ofstream& f,const char *id) { - fwrite(id,8,1,f); + f.write(id,8); mpxpav64_put64(f,-1); - return ftello(f); + return f.tellp(); } -static void mpxpav64_close_header64(FILE *f,uint64_t header_start) +static void mpxpav64_close_header64(std::ofstream& f,uint64_t header_start) { uint64_t header_end; - header_end = ftello(f); - fseeko(f,header_start-8,SEEK_SET); + header_end = f.tellp(); + f.seekp(header_start-8,std::ios_base::beg); mpxpav64_put64(f,header_end-header_start); - fseeko(f,header_end,SEEK_SET); + f.seekp(header_end,std::ios_base::beg); } -static uint64_t mpxpav64_open_header32(FILE *f,const char *id) +static uint64_t mpxpav64_open_header32(std::ofstream& f,const char *id) { - fwrite(id,4,1,f); + f.write(id,4); mpxpav64_put32(f,-1); - return ftello(f); + return f.tellp(); } -static void mpxpav64_close_header32(FILE *f,uint64_t header_start) +static void mpxpav64_close_header32(std::ofstream& f,uint64_t header_start) { uint64_t header_end; - header_end = ftello(f); - fseeko(f,header_start-4,SEEK_SET); + header_end = f.tellp(); + f.seekp(header_start-4,std::ios_base::beg); mpxpav64_put32(f,header_end-header_start); - fseeko(f,header_end,SEEK_SET); + f.seekp(header_end,std::ios_base::beg); } static muxer_stream_t* mpxpav64_new_stream(muxer_t *muxer,int type) @@ -206,7 +206,7 @@ static void mpxpav64_put_fcnt(muxer_t *muxer,Demuxer*dinfo) { uint64_t fpos; - FILE *f = muxer->file; + std::ofstream& f = muxer->file; const char *sname; fpos=mpxpav64_open_header32(f,"FCNT"); #ifdef USE_ICONV @@ -297,19 +297,19 @@ priv_mpxpav64_stream_t *privs=(priv_mpxpav64_stream_t *)s->priv; uint64_t fpos,spos,flags=0; uint8_t* frcc; - FILE *f = muxer->file; + std::ofstream& f = muxer->file; VideoPropHeader vprp; fpos=mpxpav64_open_header32(f,"ST64"); switch(s->type) { case MUXER_TYPE_VIDEO: - fwrite("vids",4,1,f); + f.write("vids",4); break; case MUXER_TYPE_AUDIO: - fwrite("auds",4,1,f); + f.write("auds",4); break; default: - fwrite("gens",4,1,f); + f.write("gens",4); break; } mpxpav64_put64(f,privs->data_off); @@ -336,10 +336,10 @@ case MUXER_TYPE_VIDEO: flags=13; mpxpav64_put8(f,flags); - fwrite("video/x-video",flags,1,f); + f.write("video/x-video",flags); spos=mpxpav64_open_header32(f,"BIH "); le2me_BITMAPINFOHEADER(s->bih); - fwrite(s->bih,s->bih->biSize,1,f); + f.write((char*)s->bih,s->bih->biSize); le2me_BITMAPINFOHEADER(s->bih); mpxpav64_close_header32(f,spos); if(s->aspect) @@ -363,7 +363,7 @@ le2me_VIDEO_FIELD_DESC(&vprp.FieldInfo[0]); le2me_VIDEO_FIELD_DESC(&vprp.FieldInfo[1]); spos=mpxpav64_open_header32(f,"vprp"); - fwrite(&vprp,sizeof(VideoPropHeader),1,f); + f.write((char*)&vprp,sizeof(VideoPropHeader)); le2me_VideoPropHeader(&vprp); le2me_VIDEO_FIELD_DESC(&vprp.FieldInfo[0]); le2me_VIDEO_FIELD_DESC(&vprp.FieldInfo[1]); @@ -374,7 +374,7 @@ ImageDescription id; spos=mpxpav64_open_header32(f,"IMGD"); le2me_ImageDesc(&id); - fwrite(&id,sizeof(ImageDescription),1,f); + f.write((char*)&id,sizeof(ImageDescription)); le2me_ImageDesc(&id); mpxpav64_close_header32(f,spos); } @@ -382,10 +382,10 @@ case MUXER_TYPE_AUDIO: flags=13; mpxpav64_put8(f,flags); - fwrite("audio/x-audio",flags,1,f); + f.write("audio/x-audio",flags); spos=mpxpav64_open_header32(f,"WAVE"); le2me_WAVEFORMATEX(s->wf); - fwrite(s->wf,WFSIZE(s->wf),1,f); + f.write((char*)s->wf,WFSIZE(s->wf)); le2me_WAVEFORMATEX(s->wf); mpxpav64_close_header32(f,spos); frcc=(uint8_t *)(&((sh_audio_t *)(s->source))->wtag); @@ -399,7 +399,7 @@ default: flags=17; mpxpav64_put8(f,flags); - fwrite("unknown/x-unknown",flags,1,f); + f.write("unknown/x-unknown",flags); break; } @@ -414,9 +414,9 @@ uint32_t max_bitrate=0; float pts; size_t i; - FILE *f = muxer->file; + std::ofstream& f = muxer->file; if(!pass) pmpxpav64->mainh=mpxpav64_open_header64(f,"MPXPAV64"); - else fseeko(f,16,SEEK_CUR); + else f.seekp(16,std::ios_base::cur); hpos=mpxpav64_open_header64(f,"HEADER64"); fpos=mpxpav64_open_header32(f,"FPRP"); tmp=0; @@ -447,7 +447,7 @@ for(i=0;i<muxer->avih.dwStreams;i++) mpxpav64_put_st64(muxer,muxer->streams[i]); mpxpav64_close_header64(f,hpos); if(!pass) pmpxpav64->datah=mpxpav64_open_header64(f,"AVDATA64"); - else fseeko(f,16,SEEK_CUR); + else f.seekp(16,std::ios_base::cur); pass++; } @@ -456,14 +456,14 @@ { priv_mpxpav64_t *pmpxpav64=(priv_mpxpav64_t *)s->muxer->priv; priv_mpxpav64_stream_t *privs=(priv_mpxpav64_stream_t *)s->priv; - FILE *f = s->muxer->file; + std::ofstream& f = s->muxer->file; uint64_t off; float xpts; uint8_t xflg; int want_pts32,is_seek; uint8_t seek[3]= {'S','E','E'}, Dx[2]; /* make indexes */ - off=ftello(f); + off=f.tellp(); xflg=0; is_seek=0; if(!privs->data_off) privs->data_off=off; @@ -503,7 +503,7 @@ else privs->idx=mp_realloc(privs->idx,(privs->idx_size+1)*sizeof(uint64_t)); ((uint64_t *)(privs->idx))[privs->idx_size]=off; privs->idx_size++; - fwrite(seek,3,1,f); + f.write((char*)seek,3); } want_pts32=0; if(privs->prev_pts==HUGE) want_pts32=1; @@ -537,7 +537,7 @@ Dx[0]=is_seek?'K':flags&AVIIF_KEYFRAME?'D':'d'; Dx[1]=xflg; - fwrite(Dx,2,1,f); + f.write((char*)Dx,2); if((xflg&0x80)==0x80) { if(s->id < 0x100U) mpxpav64_put8(f,s->id); @@ -557,7 +557,7 @@ else if(PTS2INT(xpts)<0x100000000ULL) mpxpav64_put_pts32(f,xpts); else mpxpav64_put_pts64(f,xpts); } - fwrite(s->buffer,len,1,f); + f.write((char*)s->buffer,len); MSG_V("MUX_MPXPAV64: write %lu bytes of #%u %08X flags %f pts %f\n",len,s->id,flags,pts,xpts); /* update statistic */ privs->npackets++; @@ -582,8 +582,8 @@ priv_mpxpav64_stream_t *privs=(priv_mpxpav64_stream_t *)s->priv; uint64_t ioff; uint32_t i; - FILE *f = s->muxer->file; - if(!privs->idx_off) privs->idx_off=ftello(f); + std::ofstream& f = s->muxer->file; + if(!privs->idx_off) privs->idx_off=f.tellp(); ioff=mpxpav64_open_header64(f,"INDEX_64"); mpxpav64_put32(f,s->id); for(i=0;i<privs->idx_size;i++) mpxpav64_put64(f,((uint64_t *)privs->idx)[i]); @@ -595,8 +595,8 @@ priv_mpxpav64_stream_t *privs=(priv_mpxpav64_stream_t *)s->priv; uint64_t ioff; uint32_t i; - FILE *f = s->muxer->file; - if(!privs->idx_off) privs->idx_off=ftello(f); + std::ofstream& f = s->muxer->file; + if(!privs->idx_off) privs->idx_off=f.tellp(); ioff=mpxpav64_open_header32(f,"IX32"); mpxpav64_put32(f,s->id); for(i=0;i<privs->idx_size;i++) mpxpav64_put32(f,((uint64_t *)privs->idx)[i]); @@ -608,8 +608,8 @@ off_t avdata64_size; priv_mpxpav64_t *pmpxpav64=(priv_mpxpav64_t *)muxer->priv; unsigned i; - FILE *f = muxer->file; - avdata64_size=ftello(f); + std::ofstream& f = muxer->file; + avdata64_size=f.tellp(); mpxpav64_close_header64(f,pmpxpav64->datah); for(i=0;i<muxer->avih.dwStreams;i++) { Modified: mplayerxp/libmpdemux/mux_raw.cpp =================================================================== --- mplayerxp/libmpdemux/mux_raw.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpdemux/mux_raw.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -62,7 +62,7 @@ static void rawfile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags,float pts){ muxer_t *muxer=s->muxer; - fwrite(s->buffer,len,1,muxer->file); + muxer->file.write((char*)s->buffer,len); } static void rawfile_write_header(muxer_t *muxer,Demuxer*dinfo){ Modified: mplayerxp/libmpdemux/muxer.cpp =================================================================== --- mplayerxp/libmpdemux/muxer.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpdemux/muxer.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -34,14 +34,13 @@ delete packet; } -muxer_t *muxer_new_muxer(const char *type,const char *subtype,FILE *f){ - muxer_t* muxer=new(zeromem) muxer_t; - muxer->file = f; -// if(!strcmp(type,"lavf")) { if(!muxer_init_muxer_lavf(muxer,subtype)) { delete muxer; muxer=NULL; }} +muxer_t *muxer_new_muxer(const std::string& type,const std::string& subtype,std::ofstream& f){ + muxer_t* muxer=new(zeromem) muxer_t(f); +// if(type=="lavf") { if(!muxer_init_muxer_lavf(muxer,subtype)) { delete muxer; muxer=NULL; }} // else - if(!strcmp(type,"mpxp")) muxer_init_muxer_mpxp64(muxer); + if(type=="mpxp") muxer_init_muxer_mpxp64(muxer); else - if(!strcmp(type,"raw")) muxer_init_muxer_raw(muxer); + if(type=="raw") muxer_init_muxer_raw(muxer); else { delete muxer; muxer=NULL; } return muxer; } Modified: mplayerxp/libmpdemux/muxer.h =================================================================== --- mplayerxp/libmpdemux/muxer.h 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpdemux/muxer.h 2013-05-14 14:45:21 UTC (rev 639) @@ -1,5 +1,8 @@ #ifndef MUXER_H_INCLUDED #define MUXER_H_INCLUDED 1 +#include <string> +#include <iostream> +#include <fstream> enum { MUXER_MAX_STREAMS =16, @@ -62,6 +65,7 @@ }; struct muxer_t { + muxer_t(std::ofstream& f):file(f) {} // encoding: MainAVIHeader avih; muxer_stream_t* def_v; // default video stream (for general headers) @@ -71,18 +75,18 @@ void (*cont_write_header)(struct muxer_t *,Demuxer* dinfo); void (*cont_write_index)(struct muxer_t *); muxer_stream_t* (*cont_new_stream)(struct muxer_t *,int); - FILE* file; + std::ofstream& file; any_t*priv; }; -muxer_t *muxer_new_muxer(const char *type,const char *subtype,FILE *f); +muxer_t *muxer_new_muxer(const std::string& type,const std::string& subtype,std::ofstream& f); 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 *); +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 std::string&); #endif Modified: mplayerxp/libmpdemux/stheader.cpp =================================================================== --- mplayerxp/libmpdemux/stheader.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpdemux/stheader.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -126,7 +126,7 @@ (fourcc == mmioFOURCC('m','p','e','g')) || (fourcc == mmioFOURCC('M','P','E','G'))) { - int saved_pos; +// int saved_pos; Demuxer::demuxer_type_e saved_type; /* demuxer pos saving is required for libavcodec mpeg decoder as it's Modified: mplayerxp/libmpstream2/network_asf.cpp =================================================================== --- mplayerxp/libmpstream2/network_asf.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpstream2/network_asf.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -88,17 +88,17 @@ return stream_chunck->size+4; } -static const char asf_stream_header_guid[16] = {0x91, 0x07, 0xdc, 0xb7, +static const uint8_t asf_stream_header_guid[16] = {0x91, 0x07, 0xdc, 0xb7, 0xb7, 0xa9, 0xcf, 0x11, 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65}; -static const char asf_file_header_guid[16] = {0xa1, 0xdc, 0xab, 0x8c, +static const uint8_t asf_file_header_guid[16] = {0xa1, 0xdc, 0xab, 0x8c, 0x47, 0xa9, 0xcf, 0x11, 0x8e, 0xe4, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65}; -static const char asf_content_desc_guid[16] = {0x33, 0x26, 0xb2, 0x75, +static const uint8_t asf_content_desc_guid[16] = {0x33, 0x26, 0xb2, 0x75, 0x8e, 0x66, 0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}; -static const char asf_stream_group_guid[16] = {0xce, 0x75, 0xf8, 0x7b, +static const uint8_t asf_stream_group_guid[16] = {0xce, 0x75, 0xf8, 0x7b, 0x8d, 0x46, 0xd1, 0x11, 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}; -static const char asf_data_chunk_guid[16] = {0x36, 0x26, 0xb2, 0x75, +static const uint8_t asf_data_chunk_guid[16] = {0x36, 0x26, 0xb2, 0x75, 0x8e, 0x66, 0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c}; -static int find_asf_guid(char *buf, const char *guid, int cur_pos, int buf_len) +static int find_asf_guid(char *buf, const uint8_t *guid, int cur_pos, int buf_len) { int i; for (i = cur_pos; i < buf_len - 19; i++) { Modified: mplayerxp/libmpstream2/s_ftp.cpp =================================================================== --- mplayerxp/libmpstream2/s_ftp.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpstream2/s_ftp.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -275,7 +275,7 @@ // Close current download if(tcp.established()) { - static const char pre_cmd[]={TELNET_IAC,TELNET_IP,TELNET_IAC,TELNET_SYNCH}; + static const uint8_t pre_cmd[]={TELNET_IAC,TELNET_IP,TELNET_IAC,TELNET_SYNCH}; //int fl; // Send send the telnet sequence needed to make the server react Modified: mplayerxp/libmpsub/subreader.cpp =================================================================== --- mplayerxp/libmpsub/subreader.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpsub/subreader.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -8,8 +8,9 @@ * Some code cleanup & mp_realloc() by A'rpi/ESP-team * dunnowhat sub format by szabi */ +#include <iostream> +#include <fstream> - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -53,8 +54,7 @@ while (i > 0 && isspace(s[i])) s[i--] = '\0'; } - -static subtitle * __FASTCALL__ sub_read_line_sami(FILE *fd, subtitle *current) { +static subtitle * __FASTCALL__ sub_read_line_sami(std::ifstream& fd, subtitle *current) { static char line[LINE_LEN+1]; static char *s = NULL, *slacktime_s; char text[LINE_LEN+1], *p=NULL, *q; @@ -64,9 +64,10 @@ state = 0; /* read the first line */ - if (!s) - if (!(s = fgets(line, LINE_LEN, fd))) return 0; - + if (!s) { + fd.getline(line,LINE_LEN); + if (!fd.good()) return 0; + } do { switch (state) { @@ -124,7 +125,8 @@ } /* read next line */ - if (state != 99 && !(s = fgets (line, LINE_LEN, fd))) { + fd.getline(line,LINE_LEN); + if (state != 99 && !fd.good()) { if (current->start > 0) { break; // if it is the last subtitle } else { @@ -166,7 +168,7 @@ else return NULL; // last text field } -static subtitle * __FASTCALL__ sub_read_line_microdvd(FILE *fd,subtitle *current) { +static subtitle * __FASTCALL__ sub_read_line_microdvd(std::ifstream& fd,subtitle *current) { char line[LINE_LEN+1]; char line2[LINE_LEN+1]; char *p; @@ -174,7 +176,8 @@ int i; do { - if (!fgets (line, LINE_LEN, fd)) return NULL; + fd.getline(line,LINE_LEN); + if (!fd.good()) return NULL; } while ((sscanf (line, "{%ld}{}%[^\r\n]", &(current->start), line2) < 2) && @@ -195,19 +198,21 @@ return current; } -static subtitle * __FASTCALL__ sub_read_line_subrip(FILE *fd, subtitle *current) { +static subtitle * __FASTCALL__ sub_read_line_subrip(std::ifstream& fd, subtitle *current) { char line[LINE_LEN+1]; int a1,a2,a3,a4,b1,b2,b3,b4; char *p=NULL, *q=NULL; int len; while (1) { - if (!fgets (line, LINE_LEN, fd)) return NULL; + fd.getline(line, LINE_LEN); + if (!fd.good()) return NULL; if (sscanf (line, "%d:%d:%d.%d,%d:%d:%d.%d",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4) < 8) continue; current->start = a1*360000+a2*6000+a3*100+a4; current->end = b1*360000+b2*6000+b3*100+b4; - if (!fgets (line, LINE_LEN, fd)) return NULL; + fd.getline(line, LINE_LEN); + if (!fd.good()) return NULL; p=q=line; for (current->lines=1; current->lines < SUB_MAX_TEXT; current->lines++) { @@ -224,20 +229,22 @@ return current; } -static subtitle * __FASTCALL__ sub_read_line_subviewer(FILE *fd,subtitle *current) { +static subtitle * __FASTCALL__ sub_read_line_subviewer(std::ifstream& fd,subtitle *current) { char line[LINE_LEN+1]; int a1,a2,a3,a4,b1,b2,b3,b4; char *p=NULL; int i,len; while (!current->text[0]) { - if (!fgets (line, LINE_LEN, fd)) return NULL; + fd.getline(line, LINE_LEN); + if (!fd.good()) return NULL; if ((len=sscanf (line, "%d:%d:%d,%d --> %d:%d:%d,%d",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4)) < 8) continue; current->start = a1*360000+a2*6000+a3*100+a4/10; current->end = b1*360000+b2*6000+b3*100+b4/10; for (i=0; i<SUB_MAX_TEXT;) { - if (!fgets (line, LINE_LEN, fd)) break; + fd.getline(line, LINE_LEN); + if (!fd.good()) break; len=0; for (p=line; *p!='\n' && *p!='\r' && *p; p++,len++); if (len) { @@ -254,7 +261,7 @@ return current; } -static subtitle * __FASTCALL__ sub_read_line_vplayer(FILE *fd,subtitle *current) { +static subtitle * __FASTCALL__ sub_read_line_vplayer(std::ifstream& fd,subtitle *current) { char line[LINE_LEN+1]; int a1,a2,a3; char *p=NULL, separator; @@ -262,7 +269,8 @@ int i,len,plen; while (!current->text[0]) { - if (!fgets (line, LINE_LEN, fd)) return NULL; + fd.getline(line, LINE_LEN); + if (!fd.good()) return NULL; if ((len=sscanf (line, "%d:%d:%d%c%n",&a1,&a2,&a3,&separator,&plen)) < 4) continue; @@ -288,7 +296,7 @@ return current; } -static subtitle * __FASTCALL__ sub_read_line_rt(FILE *fd,subtitle *current) { +static subtitle * __FASTCALL__ sub_read_line_rt(std::ifstream& fd,subtitle *current) { //TODO: This format uses quite rich (sub/super)set of xhtml // I couldn't check it since DTD is not included. // WARNING: full XML parses can be required for proper parsing @@ -299,7 +307,8 @@ int i,len,plen; while (!current->text[0]) { - if (!fgets (line, LINE_LEN, fd)) return NULL; + fd.getline(line, LINE_LEN); + if (!fd.good()) return NULL; //TODO: it seems that format of time is not easily determined, it may be 1:12, 1:12.0 or 0:1:12.0 //to describe the same moment in time. Maybe there are even more formats in use. //if ((len=sscanf (line, "<Time Begin=\"%d:%d:%d.%d\" End=\"%d:%d:%d.%d\"",&a1,&a2,&a3,&a4,&b1,&b2,&b3,&b4)) < 8) @@ -327,7 +336,7 @@ return current; } -static subtitle * __FASTCALL__ sub_read_line_ssa(FILE *fd,subtitle *current) { +static subtitle * __FASTCALL__ sub_read_line_ssa(std::ifstream& fd,subtitle *current) { int hour1, min1, sec1, hunsec1, hour2, min2, sec2, hunsec2, nothing; int num; @@ -338,7 +347,8 @@ char *tmp; do { - if (!fgets (line, LINE_LEN, fd)) return NULL; + fd.getline(line, LINE_LEN); + if (!fd.good()) return NULL; } while (sscanf (line, "Dialogue: Marked=%d,%d:%d:%d.%d,%d:%d:%d.%d," "%[^\n\r]", ¬hing, &hour1, &min1, &sec1, &hunsec1, @@ -369,12 +379,12 @@ return current; } -static subtitle * __FASTCALL__ sub_read_line_dunnowhat(FILE *fd,subtitle *current) { +static subtitle * __FASTCALL__ sub_read_line_dunnowhat(std::ifstream& fd,subtitle *current) { char line[LINE_LEN+1]; char text[LINE_LEN+1]; - if (!fgets (line, LINE_LEN, fd)) - return NULL; + fd.getline(line, LINE_LEN); + if (!fd.good()) return NULL; if (sscanf (line, "%ld,%ld,\"%[^\"]", &(current->start), &(current->end), text) <3) return (subtitle*)ERR; @@ -384,7 +394,7 @@ return current; } -static subtitle * __FASTCALL__ sub_read_line_mpsub(FILE *fd, subtitle *current) { +static subtitle * __FASTCALL__ sub_read_line_mpsub(std::ifstream& fd, subtitle *current) { char line[LINE_LEN+1]; float a,b; int num=0; @@ -392,7 +402,8 @@ do { - if (!fgets(line, LINE_LEN, fd)) return NULL; + fd.getline(line, LINE_LEN); + if (!fd.good()) return NULL; } while (sscanf (line, "%f %f", &a, &b) !=2); mpsub_position += a*(sub_uses_time ? 100.0 : 1.0); @@ -401,7 +412,8 @@ current->end=(int) mpsub_position; while (num < SUB_MAX_TEXT) { - if (!fgets (line, LINE_LEN, fd)) { + fd.getline(line, LINE_LEN); + if (!fd.good()) { if (num == 0) return NULL; else return current; } @@ -425,12 +437,13 @@ static subtitle *previous_aqt_sub = NULL; -static subtitle * __FASTCALL__ sub_read_line_aqt(FILE *fd,subtitle *current) { +static subtitle * __FASTCALL__ sub_read_line_aqt(std::ifstream& fd,subtitle *current) { char line[LINE_LEN+1]; while (1) { // try to locate next subtitle - if (!fgets (line, LINE_LEN, fd)) + fd.getline(line, LINE_LEN); + if (!fd.good()) return NULL; if (!(sscanf (line, "-->> %ld", &(current->start)) <1)) break; @@ -441,15 +454,15 @@ previous_aqt_sub = current; - if (!fgets (line, LINE_LEN, fd)) - return NULL; + fd.getline(line, LINE_LEN); + if (!fd.good()) return NULL; sub_readtext(line,¤t->text[0]); current->lines = 1; current->end = current->start; // will be corrected by next subtitle - if (!fgets (line, LINE_LEN, fd)) - return current;; + fd.getline(line, LINE_LEN); + if (!fd.good()) return current; sub_readtext(line,¤t->text[1]); current->lines = 2; @@ -463,15 +476,15 @@ return current; } -static int sub_autodetect (FILE *fd) { +static int sub_autodetect (std::ifstream& fd) { char line[LINE_LEN+1]; int i,j=0; char p; while (j < 100) { j++; - if (!fgets (line, LINE_LEN, fd)) - return SUB_INVALID; + fd.getline(line, LINE_LEN); + if (!fd.good()) return SUB_INVALID; if (sscanf (line, "{%d}{%d}", &i, &i)==2) {sub_uses_time=0;return SUB_MICRODVD;} @@ -628,7 +641,7 @@ static const char *fmtname[] = { "microdvd", "subrip", "subviewer", "sami", "vplayer", "rt", "ssa", "dunnowhat", "mpsub", "aqt" }; -static subtitle * (*__FASTCALL__ func[])(FILE *fd,subtitle *dest)= +static subtitle * (*__FASTCALL__ func[])(std::ifstream& fd,subtitle *dest)= { sub_read_line_microdvd, sub_read_line_subrip, @@ -642,18 +655,18 @@ sub_read_line_aqt }; -subtitle* sub_read_file (const char *filename, float fps) { - FILE *fd; +subtitle* sub_read_file (const std::string& filename, float fps) { + std::ifstream fd; int n_max; subtitle *first; - if(filename==NULL) return NULL; //qnx segfault - fd=fopen (filename, "r"); if (!fd) return NULL; + if(filename.empty()) return NULL; //qnx segfault + fd.open (filename.c_str(),std::ios_base::in); if (!fd.is_open()) return NULL; sub_format=sub_autodetect (fd); - if (sub_format==SUB_INVALID) { MSG_ERR ("SUB: Could not determine file format\n"); fclose(fd); return NULL;} + if (sub_format==SUB_INVALID) { MSG_ERR ("SUB: Could not determine file format\n"); fd.close(); return NULL;} MSG_INFO ("SUB: Detected subtitle file format: %s\n", fmtname[sub_format]); - rewind (fd); + fd.seekg(0,std::ios_base::beg); #ifdef USE_ICONV subcp_open(); @@ -661,7 +674,7 @@ sub_num=0;n_max=32; first=(subtitle *)mp_malloc(n_max*sizeof(subtitle)); - if(!first) { fclose(fd); return NULL; } + if(!first) { fd.close(); return NULL; } while(1){ subtitle *sub; @@ -679,7 +692,7 @@ if(sub==ERR) ++sub_errs; else ++sub_num; // Error vs. Valid } - fclose(fd); + fd.close(); #ifdef USE_ICONV subcp_close(); @@ -729,31 +742,28 @@ ".aqt", ".AQT" }; -char * sub_filename(const char* path,const char * fname ) +std::string sub_filename(const std::string& path,const std::string& fname ) { char * sub_name1; char * sub_name2; char * aviptr1, * aviptr2; - const char * tmp; unsigned i,j; - FILE * f; - int pos=0; + std::ifstream f; + if (fname.empty()) return NULL; - if ( fname == NULL ) return NULL; - - sub_name1=(char *)strrchr(fname,'.'); + sub_name1=(char *)strrchr(fname.c_str(),'.'); if (!sub_name1) return NULL; - pos=sub_name1-fname; - sub_name1=new char [strlen(fname)+8]; - strcpy(sub_name1,fname); + sub_name1=new char [fname.length()+8]; + strcpy(sub_name1,fname.c_str()); - sub_name2=new char [strlen(path) + strlen(fname) + 8]; - if ((tmp=strrchr(fname,'/'))) - sprintf (sub_name2, "%s%s", path, tmp+1); + sub_name2=new char [path.length() + fname.length() + 8]; + size_t tmp=fname.rfind('/'); + if (tmp!=std::string::npos) + sprintf (sub_name2, "%s%s", path.c_str(), fname.substr(tmp+1).c_str()); else - sprintf (sub_name2, "%s%s", path, fname); + sprintf (sub_name2, "%s%s", path.c_str(), fname.c_str()); aviptr1=strrchr(sub_name1,'.'); aviptr2=strrchr(sub_name2,'.'); @@ -766,8 +776,9 @@ for ( i=0;i<(sizeof(sub_exts)/sizeof(char*));i++ ) { #endif strcpy(j?aviptr1:aviptr2,sub_exts[i]); - if((f=fopen( sub_name,"rt" ))) { - fclose( f ); + f.open(sub_name); + if(f.is_open()) { + f.close(); MSG_INFO( "SUB: Detected sub file: %s\n",sub_name ); if (i<2) sub_data.utf8=1; return sub_name; @@ -776,7 +787,7 @@ } delete sub_name1; delete sub_name2; - return NULL; + return ""; } void list_sub_file(subtitle* subs){ @@ -802,48 +813,44 @@ void dump_mpsub(subtitle* subs, float fps){ int i,j; - FILE *fd; + std::ofstream fd; float a,b; mpsub_position=0; if (mp_conf.sub_fps==0) mp_conf.sub_fps=fps; - fd=fopen ("dump.mpsub", "w"); - if (!fd) { + fd.open ("dump.mpsub",std::ios_base::out); + if (!fd.is_open()) { perror ("dump_mpsub: fopen"); return; } - if (sub_uses_time) fprintf (fd,"FORMAT=TIME\n\n"); - else fprintf (fd, "FORMAT=%5.2f\n\n", fps); + if (sub_uses_time) fd<<"FORMAT=TIME"<<std::endl<<std::endl; + else fd<<"FORMAT="<<fps<<std::endl<<std::endl; for(j=0;j<sub_num;j++){ subtitle* egysub=&subs[j]; if (sub_uses_time) { a=((egysub->start-mpsub_position)/100.0); b=((egysub->end-egysub->start)/100.0); - if ( (float)((int)a) == a) - fprintf (fd, "%.0f",a); - else - fprintf (fd, "%.2f",a); + if ( (float)((int)a) == a) fd<<(int)a; + else fd<<a; - if ( (float)((int)b) == b) - fprintf (fd, " %.0f\n",b); - else - fprintf (fd, " %.2f\n",b); + if ( (float)((int)b) == b) fd<<(int)b; + else fd<<b; } else { - fprintf (fd, "%ld %ld\n", (long)((egysub->start*(fps/mp_conf.sub_fps))-((mpsub_position*(fps/mp_conf.sub_fps)))), - (long)(((egysub->end)-(egysub->start))*(fps/mp_conf.sub_fps))); + fd<<(long)((egysub->start*(fps/mp_conf.sub_fps))-((mpsub_position*(fps/mp_conf.sub_fps)))) + <<" "<<(long)(((egysub->end)-(egysub->start))*(fps/mp_conf.sub_fps)); } mpsub_position = egysub->end; for (i=0; i<egysub->lines; i++) { - fprintf (fd, "%s\n",egysub->text[i]); + fd<<" "<<egysub->text[i]<<std::endl; } - fprintf (fd, "\n"); + fd<<std::endl; } - fclose (fd); + fd.close (); MSG_DBG2 ("SUB: Subtitles dumped in \'dump.mpsub\'.\n"); } Modified: mplayerxp/libmpsub/subreader.h =================================================================== --- mplayerxp/libmpsub/subreader.h 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpsub/subreader.h 2013-05-14 14:45:21 UTC (rev 639) @@ -1,6 +1,8 @@ #ifndef __MPLAYER_SUBREADER_H #define __MPLAYER_SUBREADER_H +#include <string> + namespace usr { class Video_Output; } @@ -36,15 +38,15 @@ char *text[SUB_MAX_TEXT]; }; -extern subtitle* sub_read_file (const char *filename, float pts); -extern char * sub_filename(const char *path,const char *fname); +extern subtitle* sub_read_file (const std::string& filename, float pts); +extern std::string sub_filename(const std::string& path,const std::string& fname); extern void list_sub_file(subtitle* subs); extern void dump_mpsub(subtitle* subs, float fps); extern void sub_free(subtitle* subs ); extern void find_sub(subtitle* subtitles,unsigned long key,Video_Output*vo_data); -extern void subcp_open (void); -extern void subcp_close (void); +extern void subcp_open (); +extern void subcp_close (); extern subtitle* subcp_recode (subtitle *sub); extern subtitle* subcp_recode1 (subtitle *sub); Modified: mplayerxp/libmpsub/vobsub.cpp =================================================================== --- mplayerxp/libmpsub/vobsub.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libmpsub/vobsub.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -5,7 +5,9 @@ * Some code freely inspired from VobSub <URL:http://vobsub.edensrising.com>, * with kind permission from Gabest <ga...@fr...> */ -/* #define HAVE_GETLINE */ +#include <iostream> +#include <fstream> + #include <ctype.h> #include <errno.h> #include <limits.h> @@ -23,12 +25,9 @@ #include "spudec.h" #include "mpsub_msg.h" -#ifdef HAVE_GETLINE -extern ssize_t getline(char **, size_t *, FILE *); -#else /* FIXME This should go into a general purpose library or even a separate file. */ -static ssize_t __FASTCALL__ __getline (char **lineptr, size_t *n, FILE *stream) +static ssize_t __FASTCALL__ __getline (char **lineptr, size_t *n, std::ifstream& stream) { size_t res = 0; int c; @@ -47,7 +46,7 @@ if (*lineptr == NULL || *n == 0) return -1; - for (c = fgetc(stream); c != EOF; c = fgetc(stream)) { + for (c = stream.get(); stream.good(); c = stream.get()) { if (res + 1 >= *n) { char *tmp = (char*)mp_realloc(*lineptr, *n * 2); if (tmp == NULL) @@ -66,7 +65,6 @@ (*lineptr)[res] = 0; return res; } -#endif /********************************************************************** * MPEG parsing @@ -725,7 +723,7 @@ return 0; } -static int __FASTCALL__ vobsub_parse_one_line(vobsub_t *vob, FILE *fd) +static int __FASTCALL__ vobsub_parse_one_line(vobsub_t *vob, std::ifstream& fd) { ssize_t line_size; int res = -1; @@ -773,15 +771,17 @@ { vobsub_t *vob = (vobsub_t*)_vob; int res = -1; - FILE *fd = ::fopen(name.c_str(), "rb"); - if (fd == NULL) { + std::ifstream fd; + fd.open(name.c_str(),std::ios_base::in|std::ios_base::binary); + if (!fd.is_open()) { if (force) mpxp_warn<<"VobSub: Can't open IFO file"<<std::endl; } else { // parse IFO header unsigned char block[0x800]; const char *const ifo_magic = "DVDVIDEO-VTS"; - if (fread(block, sizeof(block), 1, fd) != 1) { + fd.read((char*)block, sizeof(block)); + if (!fd.good()) { if (force) mpxp_err<<"VobSub: Can't read IFO header"<<std::endl; } else if (memcmp(block, ifo_magic, strlen(ifo_magic) + 1)) @@ -814,9 +814,9 @@ char *tmp = (char *)block + 0x256 + sid * 6 + 2; langid.assign(tmp,2); } - if (fseek(fd, pgci_sector * sizeof(block), SEEK_SET) - || fread(block, sizeof(block), 1, fd) != 1) - mpxp_err<<"VobSub: Can't read IFO PGCI"<<std::endl; + fd.seekg(pgci_sector * sizeof(block), std::ios_base::beg); + fd.read((char*)block, sizeof(block)); + if (!fd.good()) mpxp_err<<"VobSub: Can't read IFO PGCI"<<std::endl; else { unsigned long idx; unsigned long pgc_offset = block[0xc] << 24 | block[0xd] << 16 @@ -830,7 +830,7 @@ res = 0; } } - fclose(fd); + fd.close(); } return res; } @@ -851,7 +851,7 @@ vob->delay = 0; vob->forced_subs=0; std::string buf; - FILE *fd; + std::ifstream fd; mpeg_t *mpg; /* read in the info file */ std::string stmp=""; @@ -862,8 +862,8 @@ vobsub_parse_ifo(vob,ifo, vob->palette, &vob->orig_frame_width, &vob->orig_frame_height, force, -1, stmp); /* read in the index */ buf=name+".idx"; - fd = ::fopen(buf.c_str(), "rb"); - if (fd == NULL) { + fd.open(buf.c_str(),std::ios_base::in|std::ios_base::binary); + if (!fd.is_open()) { if(force) mpxp_err<<"VobSub: Can't open IDX file"<<std::endl; else { @@ -872,7 +872,7 @@ } } else { while (vobsub_parse_one_line(vob, fd) >= 0) /* NOOP */ ; - ::fclose(fd); + fd.close(); } /* if no palette in .idx then use custom colors */ if ((vob->custom == 0)&&(vob->have_palette!=1)) Modified: mplayerxp/libvo2/font_load.cpp =================================================================== --- mplayerxp/libvo2/font_load.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libvo2/font_load.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -2,6 +2,9 @@ #include "osdep/mplib.h" using namespace usr; +#include <iostream> +#include <fstream> + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -12,40 +15,40 @@ #include "sub.h" #include "vo_msg.h" -raw_file* load_raw(const char *name,int verbose){ +raw_file* load_raw(const std::string& name,int verbose){ int bpp; raw_file* raw=new raw_file; unsigned char head[32]; - FILE *f=fopen(name,"rb"); - if(!f) { delete raw; return NULL; } // can't open - if(fread(head,32,1,f)<1) { delete raw; fclose(f); return NULL; } // too small - if(memcmp(head,"mhwanh",6)) { delete raw; fclose(f); return NULL; } // not raw file + std::ifstream f; + f.open(name.c_str(),std::ios_base::in|std::ios_base::binary); + if(!f.is_open()) { delete raw; return NULL; } // can't open + f.read((char*)(head),32); if(!f.good()) { delete raw; f.close(); return NULL; } // too small + if(memcmp(head,"mhwanh",6)) { delete raw; f.close(); return NULL; } // not raw file raw->w=head[8]*256+head[9]; raw->h=head[10]*256+head[11]; raw->c=head[12]*256+head[13]; if(raw->w == 0) /* 2 bytes were not enough for the width... read 4 bytes from the end of the header */ raw->w = ((head[28]*0x100 + head[29])*0x100 + head[30])*0x100 + head[31]; - if(raw->c>256) { delete raw; fclose(f); return NULL; } // too many colors!? + if(raw->c>256) { delete raw; f.close(); return NULL; } // too many colors!? mpxp_v<<"RAW: "<<name<<" "<<raw->w<<" x "<<raw->h<<", "<<raw->c<<" colors"<<std::endl; if(raw->c){ raw->pal=new unsigned char [raw->c*3]; - fread(raw->pal,3,raw->c,f); + f.read((char*)(raw->pal),3*raw->c); bpp=1; } else { raw->pal=NULL; bpp=3; } raw->bmp=new unsigned char [raw->h*raw->w*bpp]; - fread(raw->bmp,raw->h*raw->w*bpp,1,f); - fclose(f); + f.read((char*)(raw->bmp),raw->h*raw->w*bpp); + f.close(); return raw; } -font_desc_t* read_font_desc(const char* fname,float factor,int verbose){ +font_desc_t* read_font_desc(const std::string& fname,float factor,int verbose){ char sor[1024]; unsigned char sor2[1024]; font_desc_t *desc; - FILE *f; char *dn; char section[64]; int i,j; @@ -55,16 +58,17 @@ desc=new(zeromem) font_desc_t; if(!desc) return NULL; - f=fopen(fname,"rt"); - if(!f) { + std::ifstream f; + f.open(fname.c_str(),std::ios_base::in); + if(!f.is_open()) { mpxp_err<<"font: can't open file: "<<fname<<std::endl; delete desc; return NULL; } - i = strlen (fname) - 9; + i = fname.length() - 9; if ((dn = new char [i+1])){ - strncpy (dn, fname, i); + strncpy (dn, fname.c_str(), i); dn[i]='\0'; } @@ -77,7 +81,7 @@ section[0]=0; - while(fgets(sor,1020,f)){ + while(f.getline(sor,1020)){ char* p[8]; int pdb=0; unsigned char *s=(unsigned char *)sor; @@ -223,7 +227,7 @@ } mpxp_err<<"Syntax error in font desc: "<<sor<<std::endl; } - fclose(f); + f.close(); for(i=0;i<=fontdb;i++){ if(!desc->pic_a[i] || !desc->pic_b[i]){ mpxp_err<<"font: Missing bitmap(s) for sub-font #"<<i<<std::endl; @@ -231,19 +235,18 @@ return NULL; } // re-sample alpha - int f=factor*256.0f; + int ff=factor*256.0f; int size=desc->pic_a[i]->w*desc->pic_a[i]->h; - int j; - mpxp_v<<"font: resampling alpha by factor "<<factor<<" ("<<f<<")"<<std::endl; + mpxp_v<<"font: resampling alpha by factor "<<factor<<" ("<<ff<<")"<<std::endl; for(j=0;j<size;j++){ int x=desc->pic_a[i]->bmp[j]; // alpha int y=desc->pic_b[i]->bmp[j]; // bitmap #ifdef FAST_OSD - x=(x<(255-f))?0:1; + x=(x<(255-ff))?0:1; #else - x=255-((x*f)>>8); // scale + x=255-((x*ff)>>8); // scale if(x+y>255) x=255-y; // to avoid overflows Modified: mplayerxp/libvo2/font_load.h =================================================================== --- mplayerxp/libvo2/font_load.h 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libvo2/font_load.h 2013-05-14 14:45:21 UTC (rev 639) @@ -1,5 +1,6 @@ #ifndef __FONT_LOAD_H #define __FONT_LOAD_H 1 +#include <string> struct raw_file { unsigned char *bmp; @@ -22,7 +23,7 @@ short width[65536]; }; -raw_file* load_raw(const char *name,int verbose); -font_desc_t* read_font_desc(const char* fname,float factor,int verbose); +raw_file* load_raw(const std::string& name,int verbose); +font_desc_t* read_font_desc(const std::string& fname,float factor,int verbose); #endif Modified: mplayerxp/libvo2/screenshot.cpp =================================================================== --- mplayerxp/libvo2/screenshot.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/libvo2/screenshot.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -9,6 +9,8 @@ * Uses libpng (which uses zlib), so see according licenses. * */ +#include <iostream> +#include <fstream> #include <stdio.h> #include <stdlib.h> @@ -123,62 +125,61 @@ /* Note: this is LE version */ static void write_bmp(const char *fname,unsigned w,unsigned h,uint8_t *data) { - FILE* out; + std::ofstream f; char c[4]; uint32_t udata; unsigned i; unsigned long fsize_off,data_off,fsize_val,data_val; - if(!(out=fopen(fname,"wb"))) return; + f.open(fname,std::ios_base::out|std::ios_base::binary); + if(!f.is_open()) return; c[0]='B'; c[1]='M'; - fwrite(c,2,1,out); - fsize_off = ftello(out); - fseeko(out,4,SEEK_CUR); + f.write(c,2); + fsize_off = f.tellp(); + f.seekp(4,std::ios_base::cur); memset(c,0,4); - fwrite(c,4,1,out); - data_off=ftello(out); - fseeko(out,4,SEEK_CUR); + f.write(c,4); + data_off=f.tellp(); + f.seekp(4,std::ios_base::cur); udata=40; - fwrite(&udata,4,1,out); /* sizeof BITMAPINFOHEADER == biSize */ + f.write((char*)&udata,4); /* sizeof BITMAPINFOHEADER == biSize */ udata=w; - fwrite(&udata,4,1,out); /* sizeof biWidth */ + f.write((char*)&udata,4); /* sizeof biWidth */ udata=h; - fwrite(&udata,4,1,out); /* sizeof biHeight */ + f.write((char*)&udata,4); /* sizeof biHeight */ udata=1; - fwrite(&udata,2,1,out); /* sizeof biPlanes */ + f.write((char*)&udata,2); /* sizeof biPlanes */ udata=24; - fwrite(&udata,2,1,out); /* sizeof biBitCount */ + f.write((char*)&udata,2); /* sizeof biBitCount */ udata=0; - fwrite(&udata,4,1,out); /* sizeof biCompression */ + f.write((char*)&udata,4); /* sizeof biCompression */ udata=w*h*3; - fwrite(&udata,4,1,out); /* sizeof biSizeImage */ + f.write((char*)&udata,4); /* sizeof biSizeImage */ udata=0; - fwrite(&udata,4,1,out); /* sizeof biXPelsPerMeter */ + f.write((char*)&udata,4); /* sizeof biXPelsPerMeter */ udata=0; - fwrite(&udata,4,1,out); /* sizeof biYPelsPerMeter */ + f.write((char*)&udata,4); /* sizeof biYPelsPerMeter */ udata=0; - fwrite(&udata,4,1,out); /* sizeof biClrUsed */ + f.write((char*)&udata,4); /* sizeof biClrUsed */ udata=0; - fwrite(&udata,4,1,out); /* sizeof biClrImportant */ - data_val=ftello(out); - for(i=0;i<h;i++) /* flip picture here */ - { - fwrite(data+(w*3)*(h-i-1),w*3,1,out); + f.write((char*)&udata,4); /* sizeof biClrImportant */ + data_val=f.tellp(); + for(i=0;i<h;i++) {/* flip picture here */ + f.write((char*)(data+(w*3)*(h-i-1)),w*3); } - fsize_val=ftello(out); - fseeko(out,fsize_off,SEEK_SET); - fwrite(&fsize_val,4,1,out); - fseeko(out,data_off,SEEK_SET); - fwrite(&data_val,2,1,out); - fseeko(out,fsize_val,SEEK_SET); - fclose(out); + fsize_val=f.tellp(); + f.seekp(fsize_off,std::ios_base::beg); + f.write((char*)&fsize_val,4); + f.seekp(data_off,std::ios_base::beg); + f.write((char*)&data_val,2); + f.seekp(fsize_val,std::ios_base::beg); + f.close(); } #endif MPXP_Rc gr_screenshot(const char *fname,const uint8_t *planes[],const unsigned *strides,uint32_t fourcc,unsigned w,unsigned h) { - unsigned k; char buf[256]; #ifdef HAVE_PNG struct pngdata png; @@ -186,7 +187,6 @@ uint8_t *image_data=NULL; uint8_t *dst[3]; int dstStride[3]; - unsigned bpp = 24; struct SwsContext * sws = NULL; Modified: mplayerxp/postproc/af_hrtf.cpp =================================================================== --- mplayerxp/postproc/af_hrtf.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/postproc/af_hrtf.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -136,17 +136,6 @@ float l_agc, r_agc, lpr_agc, lmr_agc; float f, d_gain, c_gain, c_agc_cfk; -#if 0 - static int counter = 0; - static FILE *fp_out; - - if(counter == 0) - fp_out = fopen("af_hrtf.log", "w"); - if(counter % 240 == 0) - fprintf(fp_out, "%g %g %g %g %g ", counter * (1.0 / 48000), - l_gain, r_gain, lpr_gain, lmr_gain); -#endif - /*** AXIS NO. 1: (Lt, Rt) -> (C, Ls, Rs) ***/ /* AGC adaption */ d_gain = (fabs(l_gain - *adapt_l_gain) + Modified: mplayerxp/postproc/af_raw.cpp =================================================================== --- mplayerxp/postproc/af_raw.cpp 2013-05-14 12:02:20 UTC (rev 638) +++ mplayerxp/postproc/af_raw.cpp 2013-05-14 14:45:21 UTC (rev 639) @@ -5,6 +5,8 @@ This audio filter exports the incoming signal to raw or RIFF WAVE file TODO: add length + pts to export into sockets */ +#include <iostream> +#include <fstream> #include <stdio.h> #include <stdlib.h> @@ -50,7 +52,7 @@ char* filename; // File to export data int wav_mode; struct WaveHeader wavhdr; - FILE *fd; + std::ofstream fd; }; /* Initialization and runtime control_af @@ -64,13 +66,14 @@ char *pt; // Accepts any streams memcpy(&af->conf,arg,sizeof(af_conf_t)); - if(!s->fd) { /* reenterability */ - if(!(s->fd=fopen(s->filename,"wb"))) + if(s->fd.is_open()) { /* reenterability */ + s->fd.open(s->filename,std::ios_base::out|std::ios_base::binary); + if(!(s->fd.is_open())) MSG_ERR("Can't open %s\n",s->filename); pt=strchr(s->filename,'.'); s->wav_mode=0; if(pt) if(strcmp(pt+1,"wav")==0) s->wav_mode=1; - if(s->wav_mode && s->fd) + if(s->wav_mode && s->fd.is_open()) { uint16_t fmt=af->conf.format>>16; if(!fmt) fmt=0x01; /* pcm */ @@ -87,7 +90,7 @@ s->wavhdr.bits = le2me_16((af->conf.format&MPAF_BPS_MASK)*8); s->wavhdr.data=le2me_32(WAV_ID_DATA); s->wavhdr.data_length=le2me_32(0x7ffff000); - fwrite(&s->wavhdr,sizeof(struct WaveHeader),1,s->fd); + s->fd.write((char*)(&s->wavhdr),sizeof(struct WaveHeader)); s->wavhdr.file_length=s->wavhdr.data_length=0; } } @@ -119,21 +122,20 @@ { af_raw_t* s = reinterpret_cast<af_raw_t*>(af->setup); if(s) { - if(s->fd) { - off_t pos = ftello(s->fd); + if(s->fd.is_open()) { + off_t pos = s->fd.tellp(); if(s->wav_mode){ /* Write wave header */ - fseeko(s->fd, 0, SEEK_SET); + s->fd.seekp(0, std::ios_base::beg); s->wavhdr.file_length = pos-8; s->wavhdr.file_length = le2me_32(s->wavhdr.file_length); s->wavhdr.data_length = le2me_32(s->wavhdr.data_length); - fwrite(&s->wavhdr,sizeof(struct WaveHeader),1,s->fd); - fseeko(s->fd, pos, SEEK_SET); + s->fd.write((c... [truncated message content] |
From: <nic...@us...> - 2013-05-26 12:23:00
|
Revision: 647 http://sourceforge.net/p/mplayerxp/code/647 Author: nickols_k Date: 2013-05-26 12:22:56 +0000 (Sun, 26 May 2013) Log Message: ----------- use throw technique Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/libmpcodecs/ad_twin.cpp mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.cpp mplayerxp/libmpcodecs/vd_real.cpp mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libmpstream2/librtsp/rtsp.cpp mplayerxp/libmpstream2/realrtsp/sdpplin.cpp mplayerxp/libvo2/vidix_system.cpp mplayerxp/libvo2/vo_fbdev.cpp mplayerxp/libvo2/vo_sdl.cpp mplayerxp/libvo2/vo_vesa.cpp mplayerxp/libvo2/vo_x11.cpp mplayerxp/libvo2/vo_xv.cpp mplayerxp/libvo2/x11_system.cpp mplayerxp/main.cpp mplayerxp/mplayerxp.h mplayerxp/osdep/cpudetect.cpp mplayerxp/osdep/cpudetect.h mplayerxp/osdep/mp_malloc.cpp mplayerxp/postproc/libmenu/menu_console.cpp mplayerxp/postproc/postprocess.cpp mplayerxp/postproc/vf.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/dump.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -6,6 +6,7 @@ */ #include <iostream> #include <fstream> +#include <stdexcept> #include <stdio.h> #include <stdlib.h> @@ -60,7 +61,7 @@ f.open(name,std::ios_base::out|std::ios_base::binary); if(!f.is_open()){ MSG_FATAL(MSGTR_CantOpenDumpfile); - exit_player(MSGTR_Fatal_error); + throw std::runtime_error(MSGTR_Fatal_error); } MSG_INFO("Dumping stream to %s\n",name); while(!stream->eof()){ @@ -69,7 +70,7 @@ } f.close(); mpxp_info<<MSGTR_StreamDumped<<std::endl; - exit_player(MSGTR_Exit_eof); + throw std::runtime_error(MSGTR_Exit_eof); } enum { @@ -140,17 +141,17 @@ else if(strcmp(media,"raw") == 0) strcat(stream_dump_name,"dump.raw"); else { MSG_FATAL("Unsupported muxer format %s found\n",media); - exit_player(MSGTR_Fatal_error); + throw std::runtime_error(MSGTR_Fatal_error); } priv->mux_file.open(stream_dump_name,std::ios_base::out|std::ios_base::binary); MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); if(!priv->mux_file.is_open()){ MSG_FATAL(MSGTR_CantOpenDumpfile); - exit_player(MSGTR_Fatal_error); + throw std::runtime_error(MSGTR_Fatal_error); } if(!(priv->muxer=muxer_new_muxer(media,port,priv->mux_file))) { MSG_FATAL("Can't initialize muxer\n"); - exit_player(MSGTR_Fatal_error); + throw std::runtime_error(MSGTR_Fatal_error); } if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) { priv->m_audio=muxer_new_stream(priv->muxer,MUXER_TYPE_AUDIO); Modified: mplayerxp/libmpcodecs/ad_twin.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_twin.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libmpcodecs/ad_twin.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -1,6 +1,8 @@ #include "mpxp_config.h" #include "osdep/mplib.h" using namespace usr; +#include <stdexcept> + #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -426,11 +428,8 @@ char tmpbit[BITS_INT]; int retval; - if ( nbits > BITS_INT ){ - MSG_ERR( "get_bstm(): %d: %d Error.\n", - nbits, BITS_INT); - exit(1); - } + if ( nbits > BITS_INT ) throw std::runtime_error("get_bstm(): falied"); + retval = bread(tmpbit, sizeof(*tmpbit), nbits, priv, pts ); for (ibit=retval; ibit<nbits; ibit++){ tmpbit[ibit] = 0; Modified: mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.cpp =================================================================== --- mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -3120,22 +3120,16 @@ void RTjpeg_init_mcompress(void) { - unsigned long tmp; + unsigned long tmp; - if(!RTjpeg_old) - { - RTjpeg_old=(__s16*)mp_malloc((4*RTjpeg_width*RTjpeg_height)+32); - tmp=(unsigned long)RTjpeg_old; - tmp+=32; - tmp=tmp>>5; - RTjpeg_old=(__s16 *)(tmp<<5); - } - if (!RTjpeg_old) - { - fprintf(stderr, "RTjpeg: Could not allocate memory\n"); - exit(-1); - } - bzero(RTjpeg_old, ((4*RTjpeg_width*RTjpeg_height))); + if(!RTjpeg_old) { + RTjpeg_old=new __s16[(4*RTjpeg_width*RTjpeg_height)+32]; + tmp=(unsigned long)RTjpeg_old; + tmp+=32; + tmp=tmp>>5; + RTjpeg_old=(__s16 *)(tmp<<5); + } + bzero(RTjpeg_old, ((4*RTjpeg_width*RTjpeg_height))); } #ifdef MMX Modified: mplayerxp/libmpcodecs/vd_real.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_real.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libmpcodecs/vd_real.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -1,6 +1,8 @@ #include "mpxp_config.h" #include "osdep/mplib.h" using namespace usr; +#include <stdexcept> + #include <stdio.h> #include <stdlib.h> #include <inttypes.h> @@ -83,8 +85,7 @@ void __pure_virtual(void) { - MSG_ERR( "I'm outa here!\n"); - exit(1); + throw std::runtime_error( "I'm outa here!\n"); } #endif struct vreal_private_t : public Opaque { Modified: mplayerxp/libmpconf/cfgparser.cpp =================================================================== --- mplayerxp/libmpconf/cfgparser.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libmpconf/cfgparser.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -12,6 +12,7 @@ #include <limits> #include <iostream> #include <fstream> +#include <stdexcept> #include <stdlib.h> #include <stdio.h> @@ -883,7 +884,7 @@ ::write(conffile_fd, default_config, strlen(default_config)); ::close(conffile_fd); } - if (parse_config_file(conffile) != MPXP_Ok) ::exit(1); + if (parse_config_file(conffile) != MPXP_Ok) throw std::runtime_error("Error in config file"); } } Modified: mplayerxp/libmpstream2/librtsp/rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libmpstream2/librtsp/rtsp.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -31,6 +31,7 @@ * 2006, Benjamin Zores and Vincent Mussard * fixed a lot of RFC compliance issues. */ +#include <stdexcept> #include <unistd.h> #include <stdio.h> @@ -178,10 +179,8 @@ n++; } - if (n>=BUF_SIZE) { - mpxp_fatal<<"librtsp: buffer overflow in rtsp_get"<<std::endl; - exit(1); - } + if (n>=BUF_SIZE) throw std::runtime_error("librtsp: buffer overflow in rtsp_get"); + string=new char [n]; memcpy(string,buffer,n-1); string[n-1]=0; Modified: mplayerxp/libmpstream2/realrtsp/sdpplin.cpp =================================================================== --- mplayerxp/libmpstream2/realrtsp/sdpplin.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libmpstream2/realrtsp/sdpplin.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -76,7 +76,6 @@ if (dtable[c] & 0x80) { mpxp_info<<"Illegal character '"<<c<<"' in input"<<std::endl; -// exit(1); return NULL; } a[i] = (char) c; Modified: mplayerxp/libvo2/vidix_system.cpp =================================================================== --- mplayerxp/libvo2/vidix_system.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libvo2/vidix_system.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -13,6 +13,7 @@ * (Partly based on vesa_lvo.c from mplayer's package) */ #include <iomanip> +#include <stdexcept> #include <errno.h> #include <inttypes.h> @@ -51,15 +52,15 @@ mpxp_dbg2<<"vidix_preinit("<<drvname<<") was called"<<std::endl; if(vidix->version() != VIDIX_VERSION) { mpxp_fatal<<"You have wrong version of VIDIX library"<<std::endl; - exit_player("Vidix"); + throw std::runtime_error("Vidix"); } if(vidix->is_error()) { mpxp_fatal<<"Couldn't find working VIDIX driver"<<std::endl; - exit_player("Vidix"); + throw std::runtime_error("Vidix"); } if((err=vidix->get_capabilities()) != 0) { mpxp_fatal<<"Couldn't get capability: "<<strerror(err)<<std::endl; - exit_player("Vidix"); + throw std::runtime_error("Vidix"); } else mpxp_v<<"Driver capability: "<<std::hex<<vidix->cap.flags<<std::endl; mpxp_v<<"Using: "<<vidix->cap.name<<" by "<<vidix->cap.author<<std::endl; @@ -152,9 +153,8 @@ err=vidix->dma_copy_frame(); if(err) { /* We can switch back to DR here but for now exit */ - mpxp_fatal<<"error '"<<strerror(err)<<"' occured during DMA transfer"<<std::endl; mpxp_fatal<<"Please send BUGREPORT to developers!!!"<<std::endl; - exit(EXIT_FAILURE); /* it's OK vidix_term will be called */ + throw std::runtime_error(std::string("error '")+strerror(err)+"' occured during DMA transfer"); } #if 0 mpxp_info<<"frame is DMA copied"<<std::endl; Modified: mplayerxp/libvo2/vo_fbdev.cpp =================================================================== --- mplayerxp/libvo2/vo_fbdev.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libvo2/vo_fbdev.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -10,6 +10,7 @@ */ #include <iostream> #include <fstream> +#include <stdexcept> static const char* FBDEV= "fbdev: "; @@ -306,11 +307,11 @@ if(!vidix_name.empty()) { if(!(vidix=new(zeromem) Vidix_System(vidix_name))) { mpxp_err<<"Cannot initialze vidix with '"<<vidix_name<<"' argument"<<std::endl; - exit_player("Vidix error"); + throw std::runtime_error("Vidix error"); } } #endif - if(fb_preinit()!=MPXP_Ok) exit_player("FBDev preinit"); + if(fb_preinit()!=MPXP_Ok) throw std::runtime_error("FBDev preinit"); } int FBDev_VO_Interface::get_token(std::ifstream& fp,int num) Modified: mplayerxp/libvo2/vo_sdl.cpp =================================================================== --- mplayerxp/libvo2/vo_sdl.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libvo2/vo_sdl.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -93,6 +93,7 @@ * */ #include <algorithm> +#include <stdexcept> /* define to force software-surface (video surface stored in system memory)*/ #undef SDL_NOHWSURFACE @@ -278,7 +279,7 @@ if(!vidix_name.empty()) { if(!(vidix=new(zeromem) Vidix_System(vidix_name))) { mpxp_err<<"Cannot initialze vidix with '"<<vidix_name<<"' argument"<<std::endl; - exit_player("Vidix error"); + throw std::runtime_error("Vidix error"); } } #endif @@ -343,7 +344,7 @@ if (!SDL_WasInit(SDL_INIT_VIDEO)) { if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE)) { mpxp_err<<"SDL: Initializing of SDL failed: "<<SDL_GetError()<<std::endl; - exit_player("SDL error"); + throw std::runtime_error("SDL error"); } } @@ -389,7 +390,7 @@ sdlflags &= ~SDL_HWSURFACE; if ((!SDL_ListModes (vidInfo->vfmt, sdlflags)) && (!fullmodes)) { mpxp_err<<"SDL: Couldn't get any acceptable SDL Mode for output."<<std::endl; - exit_player("SDL error"); + throw std::runtime_error("SDL error"); } } /* YUV overlays need at least 16-bit color depth, but the @@ -835,7 +836,7 @@ (*vrest->adjust_size)(vrest->vo,windowsize.w,windowsize.h,reinterpret_cast<unsigned*>(&event.resize.w), reinterpret_cast<unsigned*>(&event.resize.h)); if(set_video_mode(event.resize.w, event.resize.h, bpp, sdlflags)!=0) - exit_player("SDL set video mode"); + throw std::runtime_error("SDL set video mode"); /* save video extents, to restore them after going fullscreen */ windowsize.w = surface->w; @@ -884,7 +885,7 @@ /* select next fullscreen mode */ fullmode++; if (fullmode > (findArrayEnd(fullmodes) - 1)) fullmode = 0; - if(set_fullmode(fullmode)!=0) exit_player("SDL set full mode"); + if(set_fullmode(fullmode)!=0) throw std::runtime_error("SDL set full mode"); mpxp_v<<"SDL: Set next available fullscreen mode."<<std::endl; retval = VO_EVENT_RESIZE; } else if ( keypressed == SDLK_n ) { @@ -892,13 +893,13 @@ aspect->calc(dstwidth, dstheight,flags&VOFLAG_FULLSCREEN?Aspect::ZOOM:Aspect::NOZOOM); #endif if (unsigned(surface->w) != dstwidth || unsigned(surface->h) != dstheight) { - if(set_video_mode(dstwidth, dstheight, bpp, sdlflags)!=0) exit_player("SDL set video mode"); + if(set_video_mode(dstwidth, dstheight, bpp, sdlflags)!=0) throw std::runtime_error("SDL set video mode"); windowsize.w = surface->w; windowsize.h = surface->h; mpxp_v<<"SDL: Normal size"<<std::endl; retval |= VO_EVENT_RESIZE; } else if (unsigned(surface->w) != dstwidth * 2 || unsigned(surface->h) != dstheight * 2) { - if(set_video_mode(dstwidth * 2, dstheight * 2, bpp, sdlflags)!=0) exit_player("SDL set video mode"); + if(set_video_mode(dstwidth * 2, dstheight * 2, bpp, sdlflags)!=0) throw std::runtime_error("SDL set video mode"); windowsize.w = surface->w; windowsize.h = surface->h; mpxp_v<<"SDL: Double size"<<std::endl; @@ -1217,11 +1218,11 @@ MPXP_Rc SDL_VO_Interface::toggle_fullscreen() { if (surface->flags & SDL_FULLSCREEN) { - if(set_video_mode(windowsize.w, windowsize.h, bpp, sdlflags)!=0) exit_player("SDL set fullscreen"); + if(set_video_mode(windowsize.w, windowsize.h, bpp, sdlflags)!=0) throw std::runtime_error("SDL set fullscreen"); SDL_ShowCursor(1); mpxp_v<<"SDL: Windowed mode"<<std::endl; } else if (fullmodes) { - if(set_fullmode(fullmode)!=0) exit_player("SDL set fullmode"); + if(set_fullmode(fullmode)!=0) throw std::runtime_error("SDL set fullmode"); mpxp_v<<"SDL: Set fullscreen mode"<<std::endl; } return MPXP_True; Modified: mplayerxp/libvo2/vo_vesa.cpp =================================================================== --- mplayerxp/libvo2/vo_vesa.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libvo2/vo_vesa.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -20,6 +20,7 @@ */ #include <algorithm> #include <iomanip> +#include <stdexcept> #include <stdio.h> #include <stdlib.h> @@ -175,7 +176,7 @@ if(!vidix_name.empty()) { if(!(vidix=new(zeromem) Vidix_System(vidix_name))) { mpxp_err<<"Cannot initialze vidix with '"<<vidix_name<<"' argument"<<std::endl; - exit_player("Vidix error"); + throw std::runtime_error("Vidix error"); } } #endif @@ -184,7 +185,7 @@ if(vbeInit()!=VBE_OK) { pre_init_err=MPXP_False; PRINT_VBE_ERR("vbeInit",pre_init_err); - exit_player("VESA preinit"); + throw std::runtime_error("VESA preinit"); } } @@ -214,7 +215,7 @@ vesa_term(); PRINT_VBE_ERR("vbeSetWindow",err); mpxp_fatal<<"vo_vesa: Fatal error occured! Can't continue"<<std::endl; - exit_player("VESA error"); + throw std::runtime_error("VESA error"); } win.low = new_offset * gran; win.high = win.low + vmode_info.WinSize*1024; @@ -301,7 +302,7 @@ vesa_term(); PRINT_VBE_ERR("vbeSetDisplayStart",err); mpxp_fatal<<"vo_vesa: Fatal error occured! Can't continue"<<std::endl; - exit_player("VESA error"); + throw std::runtime_error("VESA error"); } win.ptr = dga_buffer = video_base + multi_buff[(idx+1)%multi_size]; } Modified: mplayerxp/libvo2/vo_x11.cpp =================================================================== --- mplayerxp/libvo2/vo_x11.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libvo2/vo_x11.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -17,6 +17,7 @@ * runtime fullscreen switching by alex * */ +#include <stdexcept> #include <limits.h> #include <stdio.h> @@ -144,7 +145,7 @@ mpxp_info<<"args="<<arg<<" vidix_name="<<vidix_name<<std::endl; if(!(vidix=new(zeromem) Vidix_System(vidix_name))) { mpxp_err<<"Cannot initialze vidix with '"<<vidix_name<<"' argument"<<std::endl; - exit_player("Vidix error"); + throw std::runtime_error("Vidix error"); } } #endif @@ -176,9 +177,9 @@ { mpxp_fatal<<"Can't initialize VIDIX: "<<strerror(errno)<<std::endl; delete vidix; - exit_player("Vidix init"); /* !!! */ + throw std::runtime_error("Vidix init"); /* !!! */ } - if(vidix->start()!=0) { delete vidix; exit_player("Vidix start"); } + if(vidix->start()!=0) { delete vidix; throw std::runtime_error("Vidix start"); } } #endif Modified: mplayerxp/libvo2/vo_xv.cpp =================================================================== --- mplayerxp/libvo2/vo_xv.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libvo2/vo_xv.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -15,6 +15,7 @@ * double buffering support by A'rpi */ #include <algorithm> +#imclude <stdexcept> #include <stdio.h> #include <stdlib.h> @@ -91,7 +92,7 @@ num_buffers=1; if(!arg.empty()) { mpxp_err<<"vo_xv: Unknown subdevice: "<<arg<<std::endl; - exit_player("Xv error"); + throw std::runtime_error("Xv error"); } } Modified: mplayerxp/libvo2/x11_system.cpp =================================================================== --- mplayerxp/libvo2/x11_system.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/libvo2/x11_system.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -2,6 +2,7 @@ #include "osdep/mplib.h" using namespace usr; #include <iomanip> +#include <stdexcept> #include <errno.h> #include <stdio.h> @@ -76,7 +77,7 @@ if(!(mDisplay=::XOpenDisplay(dispName.c_str()))) { mpxp_err<<"X11_System: couldn't open the X11 display: "<<dispName<<std::endl; - exit_player("X11_System error"); + throw std::runtime_error("X11_System error"); } mScreen=DefaultScreen( mDisplay ); mRootWin=RootWindow( mDisplay,mScreen );// Root window ID. @@ -1211,7 +1212,7 @@ ctx=::glXCreateContext(get_display(), vi, NULL, GL_TRUE); if (ctx == NULL) { mpxp_err<<"[GLX_System]: Can't create GLX context"<<std::endl; - exit_player("vo error"); + throw std::runtime_error("vo error"); } theCmap =::XCreateColormap( get_display(),RootWindow( get_display(),vi->screen), Modified: mplayerxp/main.cpp =================================================================== --- mplayerxp/main.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/main.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -483,37 +483,37 @@ #endif -static void init_player(const std::map<std::string,std::string>& envm) +static MPXP_Rc init_player(const std::map<std::string,std::string>& envm) { if(mp_conf.video_driver && strcmp(mp_conf.video_driver,"help")==0) { mpxp_context().video().output->print_help(); mpxp_uninit_structs(); - exit(0); + return MPXP_False; } if(mp_conf.audio_driver && strcmp(mp_conf.audio_driver,"help")==0) { mpxp_context().audio().output->print_help(); mpxp_uninit_structs(); - exit(0); + return MPXP_False; } if(mp_conf.video_family && strcmp(mp_conf.video_family,"help")==0) { vfm_help(); mpxp_uninit_structs(); - exit(0); + return MPXP_False; } if(mp_conf.audio_family && strcmp(mp_conf.audio_family,"help")==0) { afm_help(); mpxp_uninit_structs(); - exit(0); + return MPXP_False; } if(vf_cfg.list && strcmp(vf_cfg.list,"help")==0) { vf_help(); mpxp_uninit_structs(); - exit(0); + return MPXP_False; } if(af_cfg.list && strcmp(af_cfg.list,"help")==0) { af_help(); mpxp_uninit_structs(); - exit(0); + return MPXP_False; } #ifdef ENABLE_WIN32LOADER @@ -522,7 +522,7 @@ if(!parse_codec_cfg(CONFDIR"/win32codecs.conf")) { mpxp_hint<<MSGTR_CopyCodecsConf<<std::endl; mpxp_uninit_structs(); - exit(0); + return MPXP_False; } } #endif @@ -531,15 +531,16 @@ list_codecs(1); #endif mpxp_uninit_structs(); - exit(0); + return MPXP_False; } if(mp_conf.video_codec && strcmp(mp_conf.video_codec,"help")==0) { #ifdef ENABLE_WIN32LOADER list_codecs(0); #endif mpxp_uninit_structs(); - exit(0); + return MPXP_False; } + return MPXP_Ok; } void show_help(void) { @@ -824,7 +825,7 @@ if(vo_inited==MPXP_False){ mpxp_fatal<<MSGTR_InvalidVOdriver<<": "<<(mp_conf.video_driver?mp_conf.video_driver:"?")<<std::endl; - exit_player(MSGTR_Fatal_error); + throw std::runtime_error(MSGTR_Fatal_error); } // check audio_out driver name: @@ -1079,7 +1080,7 @@ ao_inited=mpxp_context().audio().output->_register(mp_conf.audio_driver?mp_conf.audio_driver:"",0); if (ao_inited!=MPXP_Ok){ mpxp_fatal<<MSGTR_InvalidAOdriver<<": "<<mp_conf.audio_driver<<std::endl; - exit_player(MSGTR_Fatal_error); + throw std::runtime_error(MSGTR_Fatal_error); } } } @@ -1211,12 +1212,12 @@ mpxp_fatal<<"Not enough buffers for DECODING AHEAD!"<<std::endl; mpxp_fatal<<"Need 3 buffers but exist only " <<mpxp_context().engine().xp_core->num_v_buffs<<std::endl; - exit_player("Try other '-vo' driver.\n"); + throw std::runtime_error("Try other '-vo' driver."); } if(xmp_init_engine(sh_video,sh_audio)!=0) - exit_player("Can't initialize decoding ahead!\n"); + throw std::runtime_error("Can't initialize decoding ahead!"); if(xmp_run_decoders()!=0) - exit_player("Can't run decoding ahead!\n"); + throw std::runtime_error("Can't run decoding ahead!"); if(sh_video) mpxp_ok<<"Using DECODING AHEAD mplayer's core with "<<mpxp_context().engine().xp_core->num_v_buffs<<" video buffers"<<std::endl; else @@ -1598,17 +1599,16 @@ m_config.parse_cfgfiles(envm); if(m_config.parse_command_line(argv,envm)!=MPXP_Ok) - exit_player("Error parse command line"); // error parsing cmdline + throw std::runtime_error("Error parse command line"); // error parsing cmdline if(!mp_conf.xp) { - mpxp_err<<"Error: detected option: -core.xp=0"<<std::endl; mpxp_err<<"Note! Single-thread mode is not longer supported by MPlayerXP"<<std::endl; - exit_player(MSGTR_Exit_quit); + throw std::runtime_error("Error: detected option: -core.xp=0"); } if(mp_conf.test_av) { int verb=1; if(mpxp_test_antiviral_protection(&verb)==MPXP_Virus) - exit_player("Bad test of antiviral protection"); + throw std::runtime_error("Bad test of antiviral protection"); } MPXPSys.xp_num_cpu=get_number_cpu(); @@ -1632,7 +1632,7 @@ mpxp_context().engine().xp_core->num_a_buffs = vo_conf.xp_buffs; - init_player(envm); + if(init_player(envm)!=MPXP_Ok) return EXIT_SUCCESS; if(filename.empty()){ show_help(); @@ -1686,7 +1686,7 @@ if(mp_conf.stream_dump) if((stream_dump_type=dump_parse(mp_conf.stream_dump))==0) { mpxp_err<<"Wrong dump parameters! Unable to continue"<<std::endl; - exit_player(MSGTR_Fatal_error); + throw std::runtime_error(MSGTR_Fatal_error); } if(stream_dump_type) mp_conf.s_cache_size=0; @@ -1866,7 +1866,7 @@ if(MPXPSys.vo_inited) MPXPSys.uninit_player(INITED_VO); } - if(!sh_audio && !sh_video) exit_player("Nothing to do"); + if(!sh_audio && !sh_video) throw std::runtime_error("Nothing to do"); if(mp_conf.force_fps && sh_video) { sh_video->fps=mp_conf.force_fps; @@ -1903,7 +1903,7 @@ // TODO: rewrite test backtrace in .asm // mpxp_test_backtrace(); - if(xmp_run_players()!=0) exit_player("Can't run xp players!\n"); + if(xmp_run_players()!=0) throw std::runtime_error("Can't run xp players!"); mpxp_ok<<"Using the next "<<mpxp_context().engine().xp_core->num_threads<<" threads:"<<std::endl; unsigned idx; for(idx=0;idx<mpxp_context().engine().xp_core->num_threads;idx++) Modified: mplayerxp/mplayerxp.h =================================================================== --- mplayerxp/mplayerxp.h 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/mplayerxp.h 2013-05-26 12:22:56 UTC (rev 647) @@ -1,6 +1,6 @@ #ifndef __MPLAYERXP_MAIN #define __MPLAYERXP_MAIN 1 - +#include <stdexcept> #include <string> #include <map> @@ -212,7 +212,7 @@ inline void escape_player(const std::string& why,unsigned num_calls) { show_backtrace(why,num_calls); - exit_player(why); + throw std::runtime_error(why); } inline MPXP_Rc check_pin(const std::string& module,unsigned pin1,unsigned pin2) { Modified: mplayerxp/osdep/cpudetect.cpp =================================================================== --- mplayerxp/osdep/cpudetect.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/osdep/cpudetect.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -92,14 +92,13 @@ } do_cpuid(0x00000000, regs); // get _max_ cpuid level and vendor name if (regs[0]>=0x00000001) { - char *tmpstr; + std::string tmpstr; unsigned cl_size; do_cpuid(0x00000001, regs2); tmpstr=GetCpuFriendlyName(regs, regs2); mpxp_v<<"CPU: "<<tmpstr<<std::endl; - delete tmpstr; caps->cpuType=(regs2[0] >> 8)&0xf; if(caps->cpuType==0xf){ @@ -163,16 +162,14 @@ #define CPUID_MODEL ((regs2[0] >> 4)&0x0F) /* 07..04 */ #define CPUID_STEPPING ((regs2[0] >> 0)&0x0F) /* 03..00 */ -char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]){ +std::string GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]){ #include "cputable.h" /* get cpuname and cpuvendors */ char vendor[17]; char *retname; int i; + std::string rc; - if (NULL==(retname=(char*)mp_malloc(256))) { - mpxp_err<<MSGTR_OutOfMemory<<std::endl; - ::exit(1); - } + retname=new char[256]; sprintf(vendor,"%.4s%.4s%.4s",(char*)(regs+1),(char*)(regs+3),(char*)(regs+2)); @@ -194,8 +191,9 @@ } } - //printf("Detected CPU: %s\n", retname); - return retname; + rc=retname; + delete retname; + return rc; } #undef CPUID_EXTFAMILY Modified: mplayerxp/osdep/cpudetect.h =================================================================== --- mplayerxp/osdep/cpudetect.h 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/osdep/cpudetect.h 2013-05-26 12:22:56 UTC (rev 647) @@ -62,7 +62,7 @@ void GetCpuCaps(CpuCaps *caps); /* returned value is mp_malloc()'ed so mp_free() it after use */ - char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]); + std::string GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]); } // namespace usr #endif /* !CPUDETECT_H */ Modified: mplayerxp/osdep/mp_malloc.cpp =================================================================== --- mplayerxp/osdep/mp_malloc.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/osdep/mp_malloc.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -570,13 +570,45 @@ mp_free(ptr); } -any_t* operator new(size_t size) throw(std::bad_alloc) { return SECURE_NAME0(_mp_malloc)(size); } -any_t* operator new(size_t size,const zeromemory_t&) { return SECURE_NAME1(_mp_mallocz)(size); } -any_t* operator new(size_t size,const alignedmemory_t&,size_t boundary) { return SECURE_NAME2(_mp_memalign)(boundary,size); } +any_t* operator new(size_t size) throw(std::bad_alloc) { + any_t* rc; + rc=SECURE_NAME0(_mp_malloc)(size); + if(!rc) throw std::runtime_error("Memory allocation failed"); + return rc; +} +any_t* operator new(size_t size,const zeromemory_t&) { + any_t* rc; + rc=SECURE_NAME1(_mp_mallocz)(size); + if(!rc) throw std::runtime_error("Memory allocation failed"); + return rc; +} +any_t* operator new(size_t size,const alignedmemory_t&,size_t boundary) { + any_t* rc; + rc=SECURE_NAME2(_mp_memalign)(boundary,size); + if(!rc) throw std::runtime_error("Memory allocation failed"); + return rc; +} any_t* operator new(size_t size,const std::nothrow_t&) { return mp_malloc(size); } -any_t* operator new[](size_t size) throw(std::bad_alloc) { return SECURE_NAME0(_mp_malloc)(size); } -any_t* operator new[](size_t size,const zeromemory_t&) { return SECURE_NAME1(_mp_mallocz)(size); } -any_t* operator new[](size_t size,const alignedmemory_t&,size_t boundary) { return SECURE_NAME2(_mp_memalign)(boundary,size); } + +any_t* operator new[](size_t size) throw(std::bad_alloc) { + any_t* rc; + rc=SECURE_NAME0(_mp_malloc)(size); + if(!rc) throw std::runtime_error("Memory allocation failed"); + return rc; +} +any_t* operator new[](size_t size,const zeromemory_t&) { + any_t* rc; + rc=SECURE_NAME1(_mp_mallocz)(size); + if(!rc) throw std::runtime_error("Memory allocation failed"); + return rc; +} +any_t* operator new[](size_t size,const alignedmemory_t&,size_t boundary) { + any_t* rc; + rc=SECURE_NAME2(_mp_memalign)(boundary,size); + if(!rc) throw std::runtime_error("Memory allocation failed"); + return rc; +} any_t* operator new[](size_t size,const std::nothrow_t&) { return mp_malloc(size); } + void operator delete(any_t* p) throw() { SECURE_NAME3(_mp_free)(p); } void operator delete[](any_t* p) throw() { SECURE_NAME3(_mp_free)(p); } Modified: mplayerxp/postproc/libmenu/menu_console.cpp =================================================================== --- mplayerxp/postproc/libmenu/menu_console.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/postproc/libmenu/menu_console.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -1,6 +1,7 @@ #include "mpxp_config.h" #include "osdep/mplib.h" using namespace usr; +#include <stdexcept> #include "mpxp_help.h" @@ -294,6 +295,7 @@ #define close_pipe(pipe) close(pipe[0]); close(pipe[1]) +#if 0 static int run_shell_cmd(menu_t* menu, char* cmd) { #ifndef __MINGW32__ int in[2],out[2],err[2]; @@ -317,15 +319,12 @@ return 0; } if(!mpriv->child) { // Chlid process - int err_fd = dup(2); - FILE* errf = fdopen(err_fd,"w"); // Bind the std fd to our pipes dup2(in[0],0); dup2(out[1],1); dup2(err[1],2); execl("/bin/sh","sh","-c",cmd,(any_t*)NULL); - fprintf(errf,"exec failed : %s\n",strerror(errno)); - exit(1); + throw std::runtime_error(std::string("exec failed : ")+strerror(errno)); } // MPlayer mpriv->child_fd[0] = in[1]; @@ -336,6 +335,7 @@ #endif return 1; } +#endif static void enter_cmd(menu_t* menu) { history_t* h; Modified: mplayerxp/postproc/postprocess.cpp =================================================================== --- mplayerxp/postproc/postprocess.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/postproc/postprocess.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -12,6 +12,7 @@ #include "postprocess.h" #include "libmpcodecs/codecs_ld.h" #include "osdep/cpudetect.h" +#include "mpxp_help.h" #include "pp_msg.h" pp_context *pp2_get_context(int width, int height, int flags) @@ -29,7 +30,7 @@ { if(strcmp(mp_conf.npp_options,"help")==0) { MSG_INFO(pp_help); - exit_player(""); + exit_player(MSGTR_Exit_quit); } return 1; } Modified: mplayerxp/postproc/vf.cpp =================================================================== --- mplayerxp/postproc/vf.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/postproc/vf.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -1,6 +1,8 @@ #include "mpxp_config.h" #include "osdep/mplib.h" using namespace usr; +#include <stdexcept> + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -678,7 +680,7 @@ vf_stream_t* vf_init(libinput_t& libinput,const vf_conf_t* conf) { if(!sws_init()) { MSG_ERR("MPlayerXP requires working copy of libswscaler\n"); - exit_player(MSGTR_Exit_quit); + throw std::runtime_error("libswscaler"); } vf_stream_t* s = new(zeromem) vf_stream_t(libinput); vf_instance_t* first; Modified: mplayerxp/xmpcore/xmp_vdecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.cpp 2013-05-26 08:28:07 UTC (rev 646) +++ mplayerxp/xmpcore/xmp_vdecoder.cpp 2013-05-26 12:22:56 UTC (rev 647) @@ -1,6 +1,8 @@ #include "mpxp_config.h" #include "osdep/mplib.h" using namespace usr; +#include <stdexcept> + #include <stdio.h> #include <math.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2013-06-08 14:04:16
|
Revision: 649 http://sourceforge.net/p/mplayerxp/code/649 Author: nickols_k Date: 2013-06-08 14:04:10 +0000 (Sat, 08 Jun 2013) Log Message: ----------- import idea of binary_packet from beye Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/libmpdemux/demux_ac3.cpp mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_dca.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_flac.cpp mplayerxp/libmpdemux/demux_fli.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_nsv.cpp mplayerxp/libmpdemux/demux_nuv.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/libmpdemux/demux_pva.cpp mplayerxp/libmpdemux/demux_rawaudio.cpp mplayerxp/libmpdemux/demux_real.cpp mplayerxp/libmpdemux/demux_realaud.cpp mplayerxp/libmpdemux/demux_roq.cpp mplayerxp/libmpdemux/demux_smjpeg.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/demux_y4m.cpp mplayerxp/libmpdemux/demuxer_r.cpp mplayerxp/libmpdemux/demuxer_stream.cpp mplayerxp/libmpdemux/mp3_hdr.cpp mplayerxp/libmpdemux/mp3_hdr.h mplayerxp/libmpdemux/mpeg_hdr.cpp mplayerxp/libmpdemux/mux_mpxp64.cpp mplayerxp/libmpdemux/parse_mp4.cpp mplayerxp/libmpdemux/yuv4mpeg.cpp mplayerxp/libmpstream2/cache2.cpp mplayerxp/libmpstream2/stream.cpp mplayerxp/libmpstream2/stream.h mplayerxp/libmpsub/vobsub.cpp mplayerxp/libplaytree2/playtreeparser.cpp mplayerxp/xmpcore/Makefile Added Paths: ----------- mplayerxp/xmpcore/binary_packet.cpp mplayerxp/xmpcore/binary_packet.h Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/dump.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -41,7 +41,6 @@ void dump_stream(Stream *stream) { char buf[4096]; - int len; std::ofstream f; const char *ext,*name; MP_UNIT("dumpstream"); @@ -65,8 +64,8 @@ } MSG_INFO("Dumping stream to %s\n",name); while(!stream->eof()){ - len=stream->read(buf,4096); - if(len>0) f.write(buf,len); + binary_packet bp=stream->read(4096); + if(bp.size()>0) f.write(bp.cdata(),bp.size()); } f.close(); mpxp_info<<MSGTR_StreamDumped<<std::endl; Modified: mplayerxp/libmpdemux/demux_ac3.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ac3.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_ac3.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -141,39 +141,38 @@ demuxer->movi_end = s->end_pos(); memcpy(b,hdr,4); s->seek(pos+4); - s->read(&b[4],4); + binary_packet bp=s->read(4); + memcpy(&b[4],bp.data(),bp.size()); for(n = 0; n < 5 ; n++) { - MSG_DBG2("read_ac3_tags\n"); - pos = ac3_decode_header(b,bitrate,samplerate,channels); - if(pos < 0) - return 0; - s->skip(pos-8); - if(s->eof()) - return 0; - s->read(b,8); - if(s->eof()) - return 0; + MSG_DBG2("read_ac3_tags\n"); + pos = ac3_decode_header(b,bitrate,samplerate,channels); + if(pos < 0) return 0; + s->skip(pos-8); + if(s->eof()) return 0; + bp=s->read(8); + memcpy(b,bp.data(),bp.size()); + if(s->eof()) return 0; } return 1; } static int ac3_get_raw_id(Demuxer *demuxer,off_t fptr,unsigned *brate,unsigned *samplerate,unsigned *channels) { - uint32_t fcc,fcc1,fmt; - uint8_t *p,b[32]; - Stream *s; - *brate=*samplerate=*channels=0; - s = demuxer->stream; - s->seek(fptr); - fcc=fcc1=s->read_dword(); - fcc1=me2be_32(fcc1); - p = (uint8_t *)&fcc1; - s->seek(fptr); - s->read(b,sizeof(b)); - /* ac3 header check */ - if(ac3_decode_header(b,samplerate,brate,channels)>0) return 1; - s->seek(fptr); - return 0; + uint32_t fcc,fcc1; + uint8_t *p; + Stream *s; + *brate=*samplerate=*channels=0; + s = demuxer->stream; + s->seek(fptr); + fcc=fcc1=s->read_dword(); + fcc1=me2be_32(fcc1); + p = (uint8_t *)&fcc1; + s->seek(fptr); + binary_packet bp=s->read(32); + /* ac3 header check */ + if(ac3_decode_header((const uint8_t*)bp.data(),samplerate,brate,channels)>0) return 1; + s->seek(fptr); + return 0; } static MPXP_Rc ac3_probe(Demuxer* demuxer) @@ -213,7 +212,8 @@ step = 1; if(pos < HDR_SIZE) { - s->read(&hdr[pos],HDR_SIZE-pos); + binary_packet bp=s->read(HDR_SIZE-pos); + memcpy(&hdr[pos],bp.data(),bp.size()); pos = HDR_SIZE; } @@ -224,7 +224,8 @@ uint8_t b[21]; MSG_DBG2("initial mp3_header: 0x%08X at %lu\n",*(uint32_t *)hdr,st_pos); memcpy(b,hdr,HDR_SIZE); - s->read(&b[HDR_SIZE],12-HDR_SIZE); + binary_packet bp=s->read(12-HDR_SIZE); + memcpy(&b[HDR_SIZE],bp.data(),bp.size()); if((n = ac3_decode_header(b,&fmt,&fmt,&fmt)) > 0) { demuxer->movi_start = st_pos; break; @@ -294,11 +295,10 @@ } frmt=priv->frmt; while(!s->eof() || (demux->movi_end && s->tell() >= demux->movi_end) ) { - uint8_t hdr[8]; int len; unsigned dummy; - s->read(hdr,8); - len = ac3_decode_header(hdr,&dummy,&dummy,&dummy); + binary_packet hdr=s->read(8); + len = ac3_decode_header((const uint8_t*)hdr.data(),&dummy,&dummy,&dummy); MSG_DBG2("ac3_fillbuffer %u bytes\n",len); if(s->eof()) return 0; /* workaround for dead-lock (skip(-7)) below */ if(len < 0) { @@ -309,9 +309,11 @@ if(len>8) { Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(len); - memcpy(dp->buffer(),hdr,8); + memcpy(dp->buffer(),hdr.data(),hdr.size()); dp->resize(len+8); - len=s->read(dp->buffer()+8,len-8); + binary_packet bp=s->read(len-8); + len=bp.size(); + memcpy(dp->buffer()+8,bp.data(),bp.size()); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + len/(float)sh_audio->i_bps; dp->pts = priv->last_pts - (demux->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; @@ -325,25 +327,24 @@ } static void high_res_ac3_seek(Demuxer *demuxer,float _time) { - uint8_t hdr[8]; - int len,nf; - unsigned tmp; - ac3_priv_t* priv = static_cast<ac3_priv_t*>(demuxer->priv); - sh_audio_t* sh = (sh_audio_t*)demuxer->audio->sh; + int len,nf; + unsigned tmp; + ac3_priv_t* priv = static_cast<ac3_priv_t*>(demuxer->priv); + sh_audio_t* sh = (sh_audio_t*)demuxer->audio->sh; - nf = _time*sh->rate/1152; - while(nf > 0) { - demuxer->stream->read(hdr,8); - MSG_DBG2("high_res_mp3_seek\n"); - len = ac3_decode_header(hdr,&tmp,&tmp,&tmp); - if(len < 0) { - demuxer->stream->skip(-7); - continue; + nf = _time*sh->rate/1152; + while(nf > 0) { + binary_packet bp = demuxer->stream->read(8); + MSG_DBG2("high_res_mp3_seek\n"); + len = ac3_decode_header((const uint8_t*)bp.data(),&tmp,&tmp,&tmp); + if(len < 0) { + demuxer->stream->skip(-7); + continue; + } + demuxer->stream->skip(len-8); + priv->last_pts += 1152/(float)sh->rate; + nf--; } - demuxer->stream->skip(len-8); - priv->last_pts += 1152/(float)sh->rate; - nf--; - } } static void ac3_seek(Demuxer *demuxer,const seek_args_t* seeka){ Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -42,13 +42,14 @@ static MPXP_Rc aiff_probe(Demuxer* demuxer) { - char buf[12]; - Stream *s; - s = demuxer->stream; - s->read(buf,12); - if(*((uint32_t *)&buf[0])==mmioFOURCC('F','O','R','M') && *((uint32_t *)&buf[8])==mmioFOURCC('A','I','F','F')) return MPXP_Ok; - if(*((uint32_t *)&buf[0])==mmioFOURCC('F','O','R','M') && *((uint32_t *)&buf[8])==mmioFOURCC('A','I','F','C')) return MPXP_Ok; - return MPXP_False; + char buf[12]; + Stream *s; + s = demuxer->stream; + binary_packet bp=s->read(12); + memcpy(buf,bp.data(),bp.size()); + if(*((uint32_t *)&buf[0])==mmioFOURCC('F','O','R','M') && *((uint32_t *)&buf[8])==mmioFOURCC('A','I','F','F')) return MPXP_Ok; + if(*((uint32_t *)&buf[0])==mmioFOURCC('F','O','R','M') && *((uint32_t *)&buf[8])==mmioFOURCC('A','I','F','C')) return MPXP_Ok; + return MPXP_False; } static Opaque* aiff_open(Demuxer* demuxer) { @@ -72,14 +73,18 @@ w->cbSize = 0; s->reset(); s->seek(8); - if(s->read(preamble,4)!=4) return NULL; + binary_packet bp=s->read(4); + if(bp.size()!=4) return NULL; + memcpy(preamble,bp.data(),bp.size()); if(*((uint32_t *)&preamble[0])==mmioFOURCC('A','I','F','C')) priv->verc=1; demuxer->movi_start=0; while(1) { unsigned frames=0; - int chunk_size; - if(s->read(preamble,8)!=8) break; + unsigned chunk_size; + bp=s->read(8); + if(bp.size()!=8) return NULL; + memcpy(preamble,bp.data(),bp.size()); chunk_size=be2me_32(*((uint32_t *)&preamble[4])); MSG_V("Got preamble: %c%c%c%c\n",preamble[0],preamble[1],preamble[2],preamble[3]); if(*((uint32_t *)&preamble[0])==mmioFOURCC('F','V','E','R')) @@ -89,7 +94,9 @@ MSG_V("Wrong length of VFER chunk %lu\n",be2me_32(*((uint32_t *)&preamble[4]))); return NULL; } - if(s->read(preamble,4)!=4) return NULL; + bp=s->read(4); + if(bp.size()!=4) return NULL; + memcpy(preamble,bp.data(),bp.size()); if(be2me_32(*((uint32_t *)&preamble[0])) == 0xA2805140) priv->verc=1; else { @@ -102,12 +109,13 @@ { char buf[chunk_size]; unsigned clen=priv->verc?22:18; - if(chunk_size < clen) - { + if(chunk_size < clen) { MSG_V("Invalid COMM length %u\n",chunk_size); return NULL; } - if(s->read(buf,chunk_size)!=chunk_size) return NULL; + bp=s->read(chunk_size); + if(bp.size()!=chunk_size) return NULL; + memcpy(buf,bp.data(),bp.size()); w->nChannels = sh_audio->nch = be2me_16(*((uint16_t *)&buf[0])); frames=be2me_32(*((uint32_t *)&buf[2])); w->wBitsPerSample = be2me_16(*((uint16_t *)&buf[6])); @@ -136,37 +144,37 @@ else if(*((uint32_t *)&preamble[0])==mmioFOURCC('N','A','M','E')) { - char buf[chunk_size+1]; - s->read(buf,chunk_size); - buf[chunk_size]=0; - demuxer->info().add(INFOT_NAME, buf); + bp=s->read(chunk_size); + bp.resize(bp.size()+1); + bp[chunk_size]=0; + demuxer->info().add(INFOT_NAME, bp.cdata()); if(priv->verc && (chunk_size&1)) s->read_char(); } else if(*((uint32_t *)&preamble[0])==mmioFOURCC('A','U','T','H')) { - char buf[chunk_size+1]; - s->read(buf,chunk_size); - buf[chunk_size]=0; - demuxer->info().add(INFOT_AUTHOR, buf); + bp=s->read(chunk_size); + bp.resize(bp.size()+1); + bp[chunk_size]=0; + demuxer->info().add(INFOT_AUTHOR, bp.cdata()); if(priv->verc && (chunk_size&1)) s->read_char(); } else if(*((uint32_t *)&preamble[0])==mmioFOURCC('(','c',')',' ')) { - char buf[chunk_size+1]; - s->read(buf,chunk_size); - buf[chunk_size]=0; - demuxer->info().add(INFOT_COPYRIGHT, buf); + bp=s->read(chunk_size); + bp.resize(bp.size()+1); + bp[chunk_size]=0; + demuxer->info().add(INFOT_COPYRIGHT, bp.cdata()); if(priv->verc && (chunk_size&1)) s->read_char(); } else if(*((uint32_t *)&preamble[0])==mmioFOURCC('A','N','N','O')) { - char buf[chunk_size+1]; - s->read(buf,chunk_size); - buf[chunk_size]=0; - demuxer->info().add(INFOT_DESCRIPTION, buf); + bp=s->read(chunk_size); + bp.resize(bp.size()+1); + bp[chunk_size]=0; + demuxer->info().add(INFOT_DESCRIPTION, bp.cdata()); if(priv->verc && (chunk_size&1)) s->read_char(); } else @@ -185,23 +193,24 @@ } static int aiff_demux(Demuxer* demuxer, Demuxer_Stream *ds) { - sh_audio_t* sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); - int l = sh_audio->wf->nAvgBytesPerSec; - off_t spos = demuxer->stream->tell(); + sh_audio_t* sh_audio = reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); + int l = sh_audio->wf->nAvgBytesPerSec; + off_t spos = demuxer->stream->tell(); - if(demuxer->stream->eof()) - return 0; + if(demuxer->stream->eof()) return 0; - Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(l); - dp->pts = spos / (float)(sh_audio->wf->nAvgBytesPerSec); - dp->pos = spos; - dp->flags = DP_NONKEYFRAME; + Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(l); + dp->pts = spos / (float)(sh_audio->wf->nAvgBytesPerSec); + dp->pos = spos; + dp->flags = DP_NONKEYFRAME; - l=demuxer->stream->read(dp->buffer(),l); - dp->resize(l); - ds->add_packet(dp); + binary_packet bp=demuxer->stream->read(l); + l=bp.size(); + memcpy(dp->buffer(),bp.data(),l); + dp->resize(l); + ds->add_packet(dp); - return 1; + return 1; } static void aiff_seek(Demuxer *demuxer,const seek_args_t* seeka){ Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_asf.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -133,7 +133,8 @@ apriv->asf_packetrate=0; apriv->asf_movielength=0; - demuxer->stream->read((char*)&apriv->asfh,sizeof(ASF_header_t)); // header obj + binary_packet bp=demuxer->stream->read(sizeof(ASF_header_t)); // header obj + memcpy((char*)&apriv->asfh,bp.data(),bp.size()); le2me_ASF_header_t(&apriv->asfh); // swap to machine endian if(memcmp(asf2hdrguid,apriv->asfh.objh.guid,16)==0){ MSG_ERR("ASF_check: found ASF v2 guid!\nCurrently is not supported - please report!\n"); @@ -155,25 +156,27 @@ } static Opaque* asf_open(Demuxer *demuxer){ - static unsigned char buffer[2048]; - uint32_t* streams = NULL; - int audio_streams=0; - int video_streams=0; - uint16_t stream_count=0; - int best_video = -1; - int best_audio = -1; - asf_priv_t *apriv=static_cast<asf_priv_t*>(demuxer->priv); + binary_packet bp(1); + uint32_t* streams = NULL; + int audio_streams=0; + int video_streams=0; + uint16_t stream_count=0; + int best_video = -1; + int best_audio = -1; + asf_priv_t *apriv=static_cast<asf_priv_t*>(demuxer->priv); while(!demuxer->stream->eof()){ - int pos,endpos; - pos=demuxer->stream->tell(); - demuxer->stream->read((char*) &apriv->objh,sizeof(ASF_obj_header_t)); - le2me_ASF_obj_header_t(&apriv->objh); - if(demuxer->stream->eof()) break; // EOF - endpos=pos+apriv->objh.size; - switch(ASF_LOAD_GUID_PREFIX(apriv->objh.guid)){ + int pos,endpos; + pos=demuxer->stream->tell(); + bp=demuxer->stream->read(sizeof(ASF_obj_header_t)); + memcpy(&apriv->objh,bp.data(),bp.size()); + le2me_ASF_obj_header_t(&apriv->objh); + if(demuxer->stream->eof()) break; // EOF + endpos=pos+apriv->objh.size; + switch(ASF_LOAD_GUID_PREFIX(apriv->objh.guid)){ case ASF_GUID_PREFIX_stream_header: - demuxer->stream->read((char*) &apriv->streamh,sizeof(ASF_stream_header_t)); + bp=demuxer->stream->read(sizeof(ASF_stream_header_t)); + memcpy(&apriv->streamh,bp.data(),bp.size()); le2me_ASF_stream_header_t(&apriv->streamh); MSG_V("stream type: %s\n" "stream concealment: %s\n" @@ -186,20 +189,20 @@ ,(unsigned long)apriv->streamh.unk1,(unsigned int)apriv->streamh.unk2 ,demuxer->stream->tell()); // type-specific data: - demuxer->stream->read((char*) buffer,apriv->streamh.type_size); + bp=demuxer->stream->read(apriv->streamh.type_size); switch(ASF_LOAD_GUID_PREFIX(apriv->streamh.type)){ case ASF_GUID_PREFIX_audio_stream: { sh_audio_t* sh_audio=demuxer->new_sh_audio(apriv->streamh.stream_no & 0x7F); ++audio_streams; sh_audio->wf=(WAVEFORMATEX*)mp_calloc((apriv->streamh.type_size<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):apriv->streamh.type_size,1); - memcpy(sh_audio->wf,buffer,apriv->streamh.type_size); + memcpy(sh_audio->wf,bp.data(),bp.size()); le2me_WAVEFORMATEX(sh_audio->wf); if(mp_conf.verbose>=1) print_wave_header(sh_audio->wf,apriv->streamh.type_size); if(ASF_LOAD_GUID_PREFIX(apriv->streamh.concealment)==ASF_GUID_PREFIX_audio_conceal_interleave){ - demuxer->stream->read((char*) buffer,apriv->streamh.stream_size); - apriv->asf_scrambling_h=buffer[0]; - apriv->asf_scrambling_w=(buffer[2]<<8)|buffer[1]; - apriv->asf_scrambling_b=(buffer[4]<<8)|buffer[3]; + bp=demuxer->stream->read(apriv->streamh.stream_size); + apriv->asf_scrambling_h=bp.cdata()[0]; + apriv->asf_scrambling_w=(bp.cdata()[2]<<8)|bp.cdata()[1]; + apriv->asf_scrambling_b=(bp.cdata()[4]<<8)|bp.cdata()[3]; apriv->asf_scrambling_w/=apriv->asf_scrambling_b; } else { apriv->asf_scrambling_b=apriv->asf_scrambling_h=apriv->asf_scrambling_w=1; @@ -212,7 +215,7 @@ unsigned int len=apriv->streamh.type_size-(4+4+1+2); ++video_streams; sh_video->bih=(BITMAPINFOHEADER*)mp_mallocz(len<sizeof(BITMAPINFOHEADER)?sizeof(BITMAPINFOHEADER):len); - memcpy(sh_video->bih,&buffer[4+4+1+2],len); + memcpy(sh_video->bih,&bp.cdata()[4+4+1+2],len); le2me_BITMAPINFOHEADER(sh_video->bih); if(mp_conf.verbose>=1) print_video_header(sh_video->bih,len); break; @@ -222,7 +225,8 @@ break; // case ASF_GUID_PREFIX_header_2_0: return "guid_header_2_0"; case ASF_GUID_PREFIX_file_header: // guid_file_header - demuxer->stream->read((char*) &apriv->fileh,sizeof(ASF_file_header_t)); + bp=demuxer->stream->read(sizeof(ASF_file_header_t)); + memcpy((char*) &apriv->fileh,bp.data(),bp.size()); le2me_ASF_file_header_t(&apriv->fileh); MSG_V("ASF: size: %llu play_duration: %llu send_duration: %llu packets: %d\nflags: %d min_packet_size: %d max_packet_size: %d max_bitrate: %d preroll: %d\n", (uint64_t)apriv->fileh.file_size,(uint64_t)apriv->fileh.play_duration,(uint64_t)apriv->fileh.send_duration, @@ -242,49 +246,39 @@ case ASF_GUID_PREFIX_content_desc: // Content description { - char *string=NULL; - demuxer->stream->read((char*) &apriv->contenth,sizeof(ASF_content_description_t)); + bp=demuxer->stream->read(sizeof(ASF_content_description_t)); + memcpy((char*) &apriv->contenth,bp.data(),bp.size()); le2me_ASF_content_description_t(&apriv->contenth); MSG_V("\n"); // extract the title if( apriv->contenth.title_size!=0 ) { - string=new char[apriv->contenth.title_size]; - demuxer->stream->read( string, apriv->contenth.title_size); - pack_asf_string(string, apriv->contenth.title_size); - demuxer->info().add(INFOT_NAME, string); - delete string; + bp=demuxer->stream->read(apriv->contenth.title_size); + pack_asf_string(bp.cdata(), bp.size()); + demuxer->info().add(INFOT_NAME, bp.cdata()); } // extract the author if( apriv->contenth.author_size!=0 ) { - string=new char [apriv->contenth.author_size]; - demuxer->stream->read( string, apriv->contenth.author_size); - pack_asf_string(string, apriv->contenth.author_size); - demuxer->info().add(INFOT_AUTHOR, string); - delete string; + bp=demuxer->stream->read(apriv->contenth.author_size); + pack_asf_string(bp.cdata(),bp.size()); + demuxer->info().add(INFOT_AUTHOR, bp.cdata()); } // extract the copyright if( apriv->contenth.copyright_size!=0 ) { - string=new char [apriv->contenth.copyright_size]; - demuxer->stream->read( string, apriv->contenth.copyright_size); - pack_asf_string(string, apriv->contenth.copyright_size); - demuxer->info().add(INFOT_COPYRIGHT, string); - delete string; + bp=demuxer->stream->read(apriv->contenth.copyright_size); + pack_asf_string(bp.cdata(), bp.size()); + demuxer->info().add(INFOT_COPYRIGHT, bp.cdata()); } // extract the comment if( apriv->contenth.comment_size!=0 ) { - string=new char [apriv->contenth.comment_size]; - demuxer->stream->read( string, apriv->contenth.comment_size); - pack_asf_string(string, apriv->contenth.comment_size); - demuxer->info().add(INFOT_COMMENTS, string); - delete string; + bp=demuxer->stream->read(apriv->contenth.comment_size); + pack_asf_string(bp.cdata(), bp.size()); + demuxer->info().add(INFOT_COMMENTS, bp.cdata()); } // extract the rating if( apriv->contenth.rating_size!=0 ) { - string=new char [apriv->contenth.rating_size]; - demuxer->stream->read( string, apriv->contenth.rating_size); - pack_asf_string(string, apriv->contenth.comment_size); - demuxer->info().add(INFOT_RATING, string); - delete string; + bp=demuxer->stream->read(apriv->contenth.rating_size); + pack_asf_string(bp.cdata(), bp.size()); + demuxer->info().add(INFOT_RATING, bp.cdata()); } MSG_V("\n"); break; @@ -295,19 +289,12 @@ char *object=NULL, *ptr=NULL; MSG_V("============ ASF Stream group == START ===\n"); MSG_V(" object size = %d\n", (int)apriv->objh.size); - object = new char[apriv->objh.size]; - if( object==NULL ) { - MSG_ERR("Memory allocation failed\n"); - delete demuxer->priv; - return NULL; - } - demuxer->stream->read(object, apriv->objh.size ); + bp=demuxer->stream->read(apriv->objh.size ); // FIXME: We need some endian handling below... - ptr = object; + ptr = bp.cdata(); stream_count = le2me_16(*(uint16_t*)ptr); ptr += sizeof(uint16_t); - if(stream_count > 0) - streams = (uint32_t*)mp_malloc(2*stream_count*sizeof(uint32_t)); + if(stream_count > 0) streams = new uint32_t[2*stream_count]; MSG_V(" stream count=[0x%x][%u]\n", stream_count, stream_count ); for( i=0 ; i<stream_count && ptr<((char*)object+apriv->objh.size) ; i++ ) { stream_id = le2me_16(*(uint16_t*)ptr); @@ -321,7 +308,6 @@ streams[2*i+1] = max_bitrate; } MSG_V("============ ASF Stream group == END ===\n"); - delete object ; break; } } // switch GUID @@ -460,7 +446,8 @@ if(dp->length()!=unsigned(offs) && offs!=-1) MSG_V("warning! fragment.len=%d BUT next fragment offset=%d \n",dp->length(),offs); dp->resize(dp->length()+len); demux->stream->seek(dataoff); - demux->stream->read(dp->buffer()+dp->length(),len); + binary_packet bp=demux->stream->read(len); + memcpy(dp->buffer()+dp->length(),bp.data(),bp.size()); MSG_DBG3("data appended! %d+%d\n",dp->length(),len); // we are ready now. return 1; @@ -474,7 +461,9 @@ } Demuxer_Packet* dp=new(zeromem) Demuxer_Packet(len); demux->stream->seek(dataoff); - len=demux->stream->read(dp->buffer(),len); + binary_packet bp=demux->stream->read(len); + len=bp.size(); + memcpy(dp->buffer(),bp.data(),len); dp->resize(len); dp->pts=time*0.001f; dp->flags=keyframe?DP_KEYFRAME:DP_NONKEYFRAME; Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_avi.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -118,14 +118,15 @@ extern const demuxer_driver_t demux_avi; static void read_avi_header(Demuxer *demuxer,int index_mode){ -MainAVIHeader avih; -sh_audio_t *sh_audio=NULL; -sh_video_t *sh_video=NULL; -int stream_id=-1; -int idxfix_videostream=0; -int idxfix_divx=0; -avi_priv_t* priv=static_cast<avi_priv_t*>(demuxer->priv); -off_t list_end=0; + binary_packet bp(1); + MainAVIHeader avih; + sh_audio_t *sh_audio=NULL; + sh_video_t *sh_video=NULL; + int stream_id=-1; + int idxfix_videostream=0; + int idxfix_divx=0; + avi_priv_t* priv=static_cast<avi_priv_t*>(demuxer->priv); + off_t list_end=0; //---- AVI header: priv->idx_size=0; @@ -248,7 +249,8 @@ case mmioFOURCC('I','D','I','T'): hdr="Digitization Time";break; case ckidAVIMAINHDR: // read 'avih' - demuxer->stream->read((char*) &avih,std::min(size2,unsigned(sizeof(avih)))); + bp=demuxer->stream->read(std::min(size2,unsigned(sizeof(avih)))); + memcpy(&avih,bp.data(),bp.size()); le2me_MainAVIHeader(&avih); // swap to machine endian chunksize-=std::min(size2,unsigned(sizeof(avih))); demuxer->movi_length=avih.dwTotalFrames; @@ -256,7 +258,8 @@ break; case ckidSTREAMHEADER: { // read 'strh' AVIStreamHeader h; - demuxer->stream->read((char*) &h,std::min(size2,unsigned(sizeof(h)))); + bp=demuxer->stream->read(std::min(size2,unsigned(sizeof(h)))); + memcpy(&h,bp.data(),bp.size()); le2me_AVIStreamHeader(&h); // swap to machine endian chunksize-=std::min(size2,unsigned(sizeof(h))); ++stream_id; @@ -293,8 +296,9 @@ s->bIndexType = demuxer->stream->read_char(); s->nEntriesInUse = demuxer->stream->read_dword_le(); *(uint32_t *)s->dwChunkId = demuxer->stream->read_dword_le(); - demuxer->stream->read( (char *)s->dwReserved, 3*4); - memset(s->dwReserved, 0, 3*4); + bp=demuxer->stream->read(3*4); + memcpy(s->dwReserved,bp.data(),bp.size()); + memset(s->dwReserved,0,3*4); print_avisuperindex_chunk(s); @@ -319,7 +323,8 @@ if(last_fccType==streamtypeVIDEO){ sh_video->bih=(BITMAPINFOHEADER*)mp_mallocz((chunksize<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):chunksize); MSG_V("found 'bih', %u bytes of %d\n",chunksize,sizeof(BITMAPINFOHEADER)); - demuxer->stream->read((char*) sh_video->bih,chunksize); + bp=demuxer->stream->read(chunksize); + memcpy(sh_video->bih,bp.data(),bp.size()); le2me_BITMAPINFOHEADER(sh_video->bih); // swap to machine endian // fixup MS-RLE header (seems to be broken for <256 color files) if(sh_video->bih->biCompression<=1 && sh_video->bih->biSize==40) @@ -372,7 +377,8 @@ unsigned wf_size = chunksize<sizeof(WAVEFORMATEX)?sizeof(WAVEFORMATEX):chunksize; sh_audio->wf=(WAVEFORMATEX*)mp_mallocz(wf_size); MSG_V("found 'wf', %d bytes of %d\n",chunksize,sizeof(WAVEFORMATEX)); - demuxer->stream->read((char*) sh_audio->wf,chunksize); + bp=demuxer->stream->read(chunksize); + memcpy(sh_audio->wf,bp.data(),bp.size()); le2me_WAVEFORMATEX(sh_audio->wf); if (sh_audio->wf->cbSize != 0 && wf_size < sizeof(WAVEFORMATEX)+sh_audio->wf->cbSize) { @@ -388,7 +394,8 @@ case mmioFOURCC('v', 'p', 'r', 'p'): { VideoPropHeader* vprp = (VideoPropHeader*)mp_malloc(chunksize); unsigned int i; - demuxer->stream->read( (any_t*)vprp, chunksize); + bp=demuxer->stream->read(chunksize); + memcpy(vprp,bp.data(),bp.size()); le2me_VideoPropHeader(vprp); chunksize -= sizeof(*vprp)-sizeof(vprp->FieldInfo); chunksize /= sizeof(VIDEO_FIELD_DESC); @@ -423,7 +430,8 @@ MSG_V("Reading INDEX block, %d chunks for %ld frames\n", priv->idx_size,avih.dwTotalFrames); priv->idx=(AVIINDEXENTRY*)mp_malloc(priv->idx_size<<4); - demuxer->stream->read((char*)priv->idx,priv->idx_size<<4); + bp=demuxer->stream->read(priv->idx_size<<4); + memcpy(priv->idx,bp.data(),bp.size()); for (i = 0; i < priv->idx_size; i++) { // swap index to machine endian AVIINDEXENTRY *entry=(AVIINDEXENTRY*)priv->idx + i; le2me_AVIINDEXENTRY(entry); @@ -469,14 +477,14 @@ if(size2==3) chunksize=1; // empty else { - char buf[256]; int len=(size2<250)?size2:250; - demuxer->stream->read(buf,len); + bp=demuxer->stream->read(len); chunksize-=len; - buf[len]=0; - MSG_V("%-10s: %s\n",hdr,buf); - if(infot!=-1) demuxer->info().add(infot, buf); - else MSG_V(" %s: %s\n",hdr,buf); + bp.resize(bp.size()+1); + bp.cdata()[len]=0; + MSG_V("%-10s: %s\n",hdr,bp.cdata()); + if(infot!=-1) demuxer->info().add(infot, bp.cdata()); + else MSG_V(" %s: %s\n",hdr,bp.cdata()); } } MSG_DBG2("list_end=0x%X pos=0x%X chunksize=0x%X next=0x%X\n", @@ -520,7 +528,9 @@ int ret1, ret2; memset(&cx->stdidx[j], 0, 32); ret1 = demuxer->stream->seek( (off_t)cx->aIndex[j].qwOffset); - ret2 = demuxer->stream->read( (char *)&cx->stdidx[j], 32); + bp = demuxer->stream->read(32); + ret2 = bp.size(); + memcpy(&cx->stdidx[j],bp.data(),ret2); if (ret2 != 32 || cx->stdidx[j].nEntriesInUse==0) { // this is a broken file (probably incomplete) let the standard // gen_index routine handle this @@ -534,8 +544,8 @@ print_avistdindex_chunk(&cx->stdidx[j]); priv->idx_size += cx->stdidx[j].nEntriesInUse; cx->stdidx[j].aIndex = new avistdindex_entry[cx->stdidx[j].nEntriesInUse]; - demuxer->stream->read( (char *)cx->stdidx[j].aIndex, - cx->stdidx[j].nEntriesInUse*sizeof(avistdindex_entry)); + bp=demuxer->stream->read(cx->stdidx[j].nEntriesInUse*sizeof(avistdindex_entry)); + memcpy( (char *)cx->stdidx[j].aIndex,bp.data(),bp.size()); for (k=0;k<cx->stdidx[j].nEntriesInUse; k++) le2me_avistdindex_entry(&cx->stdidx[j].aIndex[k]); Modified: mplayerxp/libmpdemux/demux_bmp.cpp =================================================================== --- mplayerxp/libmpdemux/demux_bmp.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_bmp.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -272,8 +272,8 @@ sh_video->bih->biClrUsed = demuxer->stream->read_dword_le(); sh_video->bih->biClrImportant = demuxer->stream->read_dword_le(); // fetch the palette - demuxer->stream->read( (unsigned char *)(sh_video->bih) + 40, - sh_video->bih->biClrUsed * 4); + binary_packet bp=demuxer->stream->read(sh_video->bih->biClrUsed * 4); + memcpy((unsigned char *)(sh_video->bih) + 40,bp.data(),bp.size()); // load the data bmp_image = new(zeromem) bmp_image_t; Modified: mplayerxp/libmpdemux/demux_dca.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dca.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_dca.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -318,7 +318,8 @@ demuxer->movi_end = s->end_pos(); memcpy(b,hdr,4); s->seek(pos+4); - s->read(&b[4],8); + binary_packet bp=s->read(8); + memcpy(&b[4],bp.data(),bp.size()); for(n = 0; n < 5 ; n++) { MSG_DBG2("read_ddca_tags\n"); pos = ddca_decode_header(b,bitrate,samplerate,channels); @@ -327,7 +328,8 @@ s->skip(pos-12); if(s->eof()) return 0; - s->read(hdr,12); + bp=s->read(12); + memcpy(hdr,bp.data(),bp.size()); if(s->eof()) return 0; } @@ -336,18 +338,16 @@ static int dca_get_raw_id(Demuxer *demuxer,off_t fptr,unsigned *brate,unsigned *samplerate,unsigned *channels) { - uint32_t fcc,fcc1; - uint8_t *p,b[32]; + uint32_t fcc; Stream *s; *brate=*samplerate=*channels=0; s = demuxer->stream; s->seek(fptr); - fcc=fcc1=s->read_dword(); - fcc1=me2be_32(fcc1); - p = (uint8_t *)&fcc1; + fcc=s->read_dword(); + fcc=me2be_32(fcc); s->seek(fptr); - s->read(b,sizeof(b)); - if(ddca_decode_header(b,samplerate,brate,channels)>0) return 1; + binary_packet bp=s->read(32); + if(ddca_decode_header((const uint8_t*)bp.data(),samplerate,brate,channels)>0) return 1; s->seek(fptr); return 0; } @@ -356,11 +356,9 @@ { uint32_t fcc1,fcc2; Stream *s; - uint8_t *p; s = demuxer->stream; fcc1=s->read_dword(); fcc1=me2be_32(fcc1); - p = (uint8_t *)&fcc1; if(dca_get_raw_id(demuxer,0,&fcc1,&fcc2,&fcc2)) return MPXP_Ok; return MPXP_False; } @@ -383,13 +381,15 @@ s = demuxer->stream; s->reset(); s->seek(s->start_pos()); + binary_packet bp(1); while(n < 5 && !s->eof()) { st_pos = s->tell(); step = 1; if(pos < HDR_SIZE) { - s->read(&hdr[pos],HDR_SIZE-pos); + bp=s->read(HDR_SIZE-pos); + memcpy(&hdr[pos],bp.data(),bp.size()); pos = HDR_SIZE; } @@ -400,7 +400,8 @@ uint8_t b[21]; MSG_DBG2("initial mp3_header: 0x%08X at %lu\n",*(uint32_t *)hdr,st_pos); memcpy(b,hdr,HDR_SIZE); - s->read(&b[HDR_SIZE],12-HDR_SIZE); + bp=s->read(12-HDR_SIZE); + memcpy(&b[HDR_SIZE],bp.data(),bp.size()); if((n = ddca_decode_header(b,&fmt,&fmt,&fmt)) > 0) { demuxer->movi_start = st_pos; @@ -469,13 +470,12 @@ } return 0; } - + binary_packet bp(1); while(!s->eof() || (demux->movi_end && s->tell() >= demux->movi_end) ) { - uint8_t hdr[16]; int len; unsigned dummy; - s->read(hdr,16); - len = ddca_decode_header(hdr,&dummy,&dummy,&dummy); + bp=s->read(16); + len = ddca_decode_header((const uint8_t*)bp.data(),&dummy,&dummy,&dummy); MSG_DBG2("dca_fillbuffer %u bytes\n",len); if(s->eof()) return 0; /* workaround for dead-lock (skip(-7)) below */ if(len < 0) { @@ -487,8 +487,10 @@ { Demuxer_Packet* dp = new(zeromem) Demuxer_Packet(len); dp->resize(len+16); - memcpy(dp->buffer(),hdr,16); - len=s->read(dp->buffer()+16,len-16); + memcpy(dp->buffer(),bp.data(),16); + bp=s->read(len-16); + len=bp.size(); + memcpy(dp->buffer()+16,bp.data(),len); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + len/(float)sh_audio->i_bps; dp->pts = priv->last_pts - (demux->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; dp->flags=DP_NONKEYFRAME; @@ -502,7 +504,6 @@ } static void high_res_ddca_seek(Demuxer *demuxer,float _time) { - uint8_t hdr[12]; int len,nf; unsigned tmp; dca_priv_t* priv = static_cast<dca_priv_t*>(demuxer->priv); @@ -510,9 +511,9 @@ nf = _time*sh->rate/1152; while(nf > 0) { - demuxer->stream->read(hdr,12); + binary_packet bp=demuxer->stream->read(12); MSG_DBG2("high_res_ddca_seek\n"); - len = ddca_decode_header(hdr,&tmp,&tmp,&tmp); + len = ddca_decode_header((const uint8_t*)bp.data(),&tmp,&tmp,&tmp); if(len < 0) { demuxer->stream->skip(-11); continue; Modified: mplayerxp/libmpdemux/demux_film.cpp =================================================================== --- mplayerxp/libmpdemux/demux_film.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_film.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -116,12 +116,14 @@ // load the chunks manually (instead of using ds_read_packet()), since // they require some adjustment // (all ones in syncinfo1 indicates an audio chunk) + binary_packet bp(1); if (film_chunk.syncinfo1 == 0xFFFFFFFF) { if(demuxer->audio->id>=-1){ // audio not disabled dp = new(zeromem) Demuxer_Packet(film_chunk.chunk_size); - if (demuxer->stream->read( dp->buffer(), film_chunk.chunk_size) != - film_chunk.chunk_size) return 0; + bp=demuxer->stream->read(film_chunk.chunk_size); + if(bp.size() != size_t(film_chunk.chunk_size)) return 0; + memcpy(dp->buffer(),bp.data(),bp.size()); dp->pts = film_chunk.pts; dp->pos = film_chunk.chunk_offset; dp->flags = DP_NONKEYFRAME; @@ -158,14 +160,14 @@ dp = new(zeromem) Demuxer_Packet(film_chunk.chunk_size - length_fix_bytes); // these CVID data chunks have a few extra bytes; skip them - if (demuxer->stream->read( dp->buffer(), 10) != 10) - return 0; + bp=demuxer->stream->read(10); + if (bp.size() != 10) return 0; + memcpy(dp->buffer(),bp.data(),bp.size()); demuxer->stream->skip( length_fix_bytes); - if (demuxer->stream->read( dp->buffer() + 10, - film_chunk.chunk_size - (10 + length_fix_bytes)) != - (film_chunk.chunk_size - (10 + length_fix_bytes))) - return 0; + bp=demuxer->stream->read(film_chunk.chunk_size - (10 + length_fix_bytes)); + if(bp.size()!=size_t(film_chunk.chunk_size - (10 + length_fix_bytes))) return 0; + memcpy(dp->buffer(),bp.data(),bp.size()); dp->pts = film_chunk.pts; dp->pos = film_chunk.chunk_offset; @@ -309,7 +311,7 @@ demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; - sh_audio->wf = (WAVEFORMATEX *)mp_malloc(sizeof(WAVEFORMATEX)); + sh_audio->wf = new WAVEFORMATEX; // uncompressed PCM format sh_audio->wf->wFormatTag = 1; @@ -340,7 +342,7 @@ demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; - sh_audio->wf = (WAVEFORMATEX *)mp_malloc(sizeof(WAVEFORMATEX)); + sh_audio->wf = new WAVEFORMATEX; // uncompressed PCM format sh_audio->wf->wFormatTag = 1; @@ -374,8 +376,7 @@ " STAB chunk contains %d chunks\n", film_data->total_chunks); // allocate enough entries for the chunk - film_data->chunks = - (film_chunk_t *)mp_malloc(film_data->total_chunks * sizeof(film_chunk_t)); + film_data->chunks =new film_chunk_t[film_data->total_chunks]; // build the chunk index counting_chunks = 1; Modified: mplayerxp/libmpdemux/demux_flac.cpp =================================================================== --- mplayerxp/libmpdemux/demux_flac.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_flac.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -45,17 +45,20 @@ static int flac_get_raw_id(Demuxer *demuxer,off_t fptr,unsigned *brate,unsigned *samplerate,unsigned *channels) { - uint32_t fcc,fcc1; - uint8_t *p,b[32]; + uint32_t fcc1; Stream *s; *brate=*samplerate=*channels=0; s = demuxer->stream; s->seek(fptr); - fcc=fcc1=s->read_dword(); + fcc1=s->read_dword(); fcc1=me2be_32(fcc1); - p = (uint8_t *)&fcc1; s->seek(fptr); - s->read(b,sizeof(b)); + binary_packet bp=s->read(32); +/* + s->samplerate = get_bits_long(&gb, 20); + s->channels = get_bits(&gb, 3) + 1; + s->bps = get_bits(&gb, 5) + 1; +*/ if(fcc1 == mmioFOURCC('f','L','a','C')) return 1; s->seek(fptr); return 0; @@ -92,13 +95,15 @@ s = demuxer->stream; s->reset(); s->seek(s->start_pos()); + binary_packet bp(1); while(n < 5 && !s->eof()) { st_pos = s->tell(); step = 1; if(pos < HDR_SIZE) { - s->read(&hdr[pos],HDR_SIZE-pos); + bp=s->read(HDR_SIZE-pos); + memcpy(&hdr[pos],bp.data(),bp.size()); pos = HDR_SIZE; } @@ -130,7 +135,9 @@ /* loop through the metadata blocks; use a do-while construct since there * will always be 1 metadata block */ do { - if(s->read(chunk,4)!=4) return NULL; + bp=s->read(4); + if(bp.size()!=4) return NULL; + memcpy(chunk,bp.data(),bp.size()); block_size=(chunk[1]<<16)|(chunk[2]<<8)|chunk[3]; switch (chunk[0] & 0x7F) { /* STREAMINFO */ @@ -139,13 +146,15 @@ char sinfo[block_size]; WAVEFORMATEX* w; unsigned long long int total_samples; - sh_audio->wf = w = (WAVEFORMATEX*)mp_mallocz(sizeof(WAVEFORMATEX)); + sh_audio->wf = w = new WAVEFORMATEX; MSG_V("STREAMINFO metadata\n"); if (block_size != 34) { MSG_V("expected STREAMINFO chunk of %d bytes\n",block_size); return 0; } - if(s->read(sinfo,block_size)!=(int)block_size) return NULL; + bp=s->read(block_size); + if(bp.size()!=(int)block_size) return NULL; + memcpy(sinfo,bp.data(),bp.size()); sh_audio->rate=be2me_32(*(uint32_t *)&sinfo[10]); sh_audio->nch=w->nChannels=((sh_audio->rate>>9)&0x07)+1; w->wBitsPerSample=((sh_audio->rate>>4)&0x1F)+1; @@ -229,7 +238,9 @@ } int l = sh_audio->wf->nAvgBytesPerSec; Demuxer_Packet* dp =new(zeromem) Demuxer_Packet(l); - l=s->read(dp->buffer(),l); + binary_packet bp = s->read(l); + l=bp.size(); + memcpy(dp->buffer(),bp.data(),bp.size()); dp->resize(l); priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps; dp->pts = priv->last_pts - (demux->audio->tell_pts()-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; Modified: mplayerxp/libmpdemux/demux_fli.cpp =================================================================== --- mplayerxp/libmpdemux/demux_fli.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_fli.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -98,7 +98,8 @@ demuxer->stream->seek( 0); header = new unsigned char[sizeof(BITMAPINFOHEADER) + 128]; - demuxer->stream->read( header + sizeof(BITMAPINFOHEADER), 128); + binary_packet bp=demuxer->stream->read(128); + memcpy(header + sizeof(BITMAPINFOHEADER),bp.data(),bp.size()); demuxer->stream->seek( 0); demuxer->movi_start = 128; @@ -120,7 +121,7 @@ frames->current_frame = 0; // allocate enough entries for the indices - frames->filepos = (off_t *)mp_malloc(frames->num_frames * sizeof(off_t)); + frames->filepos = new off_t[frames->num_frames]; frames->frame_size = new unsigned int [frames->num_frames]; // create a new video stream header Modified: mplayerxp/libmpdemux/demux_lavf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_lavf.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_lavf.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -133,10 +133,11 @@ if(stream->eof()) //needed? return -1; - ret=stream->read(buf, size); + binary_packet bp=stream->read(size); + memcpy(buf,bp.data(),bp.size()); - MSG_DBG2("%d=mp_read(%p, %p, %d), eof:%d\n", ret, stream, buf, size, stream->eof()); - return ret; + MSG_DBG2("%d=mp_read(%p, %p, %d), eof:%d\n", bp.size(), stream, buf, size, stream->eof()); + return bp.size(); } static int64_t mpxp_seek(any_t*opaque, int64_t pos, int whence){ @@ -193,10 +194,12 @@ else if(mp_conf.verbose) av_log_set_level(AV_LOG_VERBOSE); else av_log_set_level(AV_LOG_INFO); - if(demuxer->stream->read( buf, PROBE_BUF_SIZE)!=PROBE_BUF_SIZE) { + binary_packet bp=demuxer->stream->read(PROBE_BUF_SIZE); + if(bp.size()!=PROBE_BUF_SIZE) { delete demuxer->priv; return MPXP_False; } + memcpy(buf,bp.data(),bp.size()); avpd.filename= "xxx"; avpd.buf= buf; avpd.buf_size= PROBE_BUF_SIZE; Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -60,11 +60,11 @@ 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_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_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"; @@ -91,11 +91,11 @@ 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_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"; @@ -286,8 +286,9 @@ case 10: { union {uint8_t data[10]; long double ld;} u; - if (s->read( u.data, 10) != 10) - return EBML_FLOAT_INVALID; + binary_packet bp=s->read(10); + if(bp.size()!=10) return EBML_FLOAT_INVALID; + memcpy(u.data, bp.data(),bp.size()); value = be2me_ldbl(u.ld); break; } @@ -318,12 +319,10 @@ if (length) *length = len + l; - str = (char *) mp_malloc (len+1); - if (s->read( str, len) != (int) len) - { - delete str; - return NULL; - } + binary_packet bp = s->read(len); + if(bp.size()!=len) return NULL; + str = new char[len+1]; + memcpy(str,bp.data(),bp.size()); str[len] = '\0'; return str; @@ -695,7 +694,8 @@ static mkv_track_t * demux_mkv_find_track_by_num (mkv_demuxer_t *d, int n, int type) { - int i, id; + int id; + unsigned i; for (i=0, id=0; i < d->num_tracks; i++) if (d->tracks[i] != NULL && d->tracks[i]->type == type) @@ -708,7 +708,8 @@ static mkv_track_t * demux_mkv_find_track_by_language (mkv_demuxer_t *d,const char *language, int type) { - int i, len; + int len; + unsigned i; language += strspn(language,","); while((len = strcspn(language,",")) > 0) @@ -890,12 +891,12 @@ void mkv_demuxer_t::free_cached_dps () { mkv_track_t *track; - int i, k; + unsigned i, k; for (k = 0; k < num_tracks; k++) { track = tracks[k]; - for (i = 0; i < track->num_cached_dps; i++) delete track->cached_dps[i]; + for (i = 0; i < unsigned(track->num_cached_dps); i++) delete track->cached_dps[i]; delete track->cached_dps; track->cached_dps = NULL; track->num_cached_dps = 0; @@ -1118,6 +1119,7 @@ mkv_content_encoding_t *ce, e; uint64_t len, length, l; int il, n; + binary_packet bp(1); ce = new mkv_content_encoding_t; n = 0; @@ -1130,7 +1132,6 @@ { case MATROSKA_ID_CONTENTENCODING: { - uint64_t len; int i; memset (&e, 0, sizeof (e)); @@ -1191,7 +1192,8 @@ case MATROSKA_ID_CONTENTCOMPSETTINGS: l = ebml_read_length (s, &i); e.comp_settings = new uint8_t[l]; - s->read( e.comp_settings, l); + bp=s->read(l); + memcpy(e.comp_settings,bp.data(),bp.size()); e.comp_settings_len = l; l += i; break; @@ -1408,6 +1410,7 @@ mkv_track_t *track; uint64_t len, length, l; int il; + binary_packet bp(1); track = new mkv_track_t; /* set default values */ @@ -1515,8 +1518,9 @@ if (num > std::numeric_limits<size_t>::max() - 1000) return 0; l = x + num; track->private_data = mp_malloc (num + LZO_INPUT_PADDING); - if (s->read( track->private_data, num) != (int) num) - goto err_out; + bp=s->read(num); + if (bp.size() != num) goto err_out; + memcpy(track->private_data,bp.data(),bp.size()); track->private_size = num; MSG_V( "[mkv] | + CodecPrivate, length " "%u\n", track->private_size); @@ -1943,11 +1947,12 @@ l = x + num; delete data; data = new char [num]; - if (s->read( data, num) != (int) num) - { + binary_packet bp=s->read(num); + if(bp.size() != num) { delete data; return 0; } + memcpy(data,bp.data(),bp.size()); data_size = num; MSG_V( "[mkv] | + FileData, length " "%u\n", data_size); @@ -2128,7 +2133,8 @@ display_create_tracks (Demuxer *demuxer) { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); - int i, vid=0, aid=0, sid=0; + int vid=0, aid=0, sid=0; + unsigned i; for (i=0; i<mkv_d->num_tracks; i++) { @@ -2259,7 +2265,8 @@ // copy type1 and type2 info from rv properties memcpy(dst, &type1, 4); memcpy(dst+4, &type2, 4); - demuxer->stream->read( dst+8, cnt); + binary_packet bp=demuxer->stream->read(cnt); + memcpy(dst+8,bp.data(),bp.size()); track->realmedia = 1; #ifdef USE_QTX_CODECS @@ -2672,7 +2679,7 @@ { mkv_demuxer_t *mkv_d = static_cast<mkv_demuxer_t*>(demuxer->priv); mkv_track_t *track; - int i, m; + unsigned i, m; unsigned size; uint8_t *buffer; @@ -2774,7 +2781,8 @@ */ static int demux_mkv_reverse_id(mkv_demuxer_t *d, int num, int type) { - int i, id; + int id; + unsigned i; for (i=0, id=0; i < d->num_tracks; i++) if (d->tracks[i] != NULL && d->tracks[i]->type == type) { @@ -2806,7 +2814,8 @@ Stream *s = demuxer->stream; mkv_demuxer_t *mkv_d; mkv_track_t *track; - int i, version, cont = 0; + int version, cont = 0; + unsigned i; char *str; s->seek( s->start_pos()); @@ -3031,7 +3040,7 @@ if (mkv_d->chapters) { - for (i=0; i < (int)mkv_d->num_chapters; i++) + for (i=0; i < mkv_d->num_chapters; i++) { mkv_d->chapters[i].start -= mkv_d->first_tc; mkv_d->chapters[i].end -= mkv_d->first_tc; @@ -3674,6 +3683,7 @@ Stream *s = demuxer->stream; uint64_t l; int il, tmp; + binary_packet bp(1); while (1) { @@ -3704,11 +3714,12 @@ if (block_length > std::numeric_limits<size_t>::max()- LZO_INPUT_PADDING) return 0; block = new uint8_t[block_length + LZO_INPUT_PADDING]; demuxer->filepos = s->tell(); - if (s->read(block,block_length) != (int) block_length) - { + bp=s->read(block_length); + if (bp.size() != block_length) { delete block; return 0; } + memcpy(block,bp.data(),bp.size()); l = tmp + block_length; break; @@ -3778,11 +3789,12 @@ block_length = ebml_read_length (s, &tmp); block = new uint8_t[block_length]; demuxer->filepos = s->tell(); - if (s->read(block,block_length) != (int) block_length) - { + bp=s->read(block_length); + if (bp.size() != block_length) { delete block; return 0; } + memcpy(block,bp.data(),bp.size()); l = tmp + block_length; res = handle_block (demuxer, block, block_length, block_duration, block_bref, block_fref, 1); Modified: mplayerxp/libmpdemux/demux_mov.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mov.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_mov.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -599,6 +599,7 @@ off_t pos, off_t len, mov_track_t* trak); static void lschunks(Demuxer* demuxer,int level,off_t endpos,mov_track_t* trak){ + binary_packet bp(1); mov_priv_t* priv=static_cast<mov_priv_t*>(demuxer->priv); while(1){ off_t pos; @@ -907,7 +908,7 @@ if(!is_vorbis) { sh->codecdata_len = esds.decoderConfigLen; - sh->codecdata = (unsigned char *)mp_malloc(sh->codecdata_len); + sh->codecdata = new uint8_t[sh->codecdata_len]; memcpy(sh->codecdata, esds.decoderConfig, sh->codecdata_len); } } @@ -920,7 +921,7 @@ if(atom_len > 8) { // copy all the atom (not only payload) for lavc alac decoder sh->codecdata_len = atom_len; - sh->codecdata = (unsigned char *)mp_malloc(sh->codecdata_len); + sh->codecdata = new uint8_t[sh->codecdata_len]; memcpy(sh->codecdata, &trak->stdata[28], sh->codecdata_len); } } break; @@ -1086,7 +1087,7 @@ // dump away the codec specific configuration for the AAC decoder trak->stream_header_len = esds.decoderConfigLen; - trak->stream_header = (unsigned char *)mp_malloc(trak->stream_header_len); + trak->stream_header = new uint8_t[trak->stream_header_len]; memcpy(trak->stream_header, esds.decoderConfig, trak->stream_header_len); } mp4_free_esds(&esds); // freeup esds mem @@ -1122,7 +1123,7 @@ // Copy avcC for the AVC decoder // This data will be put in extradata below, where BITMAPINFOHEADER is created trak->stream_header_len = atom_len-8; - trak->stream_header = (unsigned char *)mp_malloc(trak->stream_header_len); + trak->stream_header = new uint8_t[trak->stream_header_len]; memcpy(trak->stream_header, trak->stdata+pos+8, trak->stream_header_len); } break; @@ -1336,7 +1337,8 @@ } MSG_V( "Compressed header size: %d / %d\n",cmov_sz,moov_sz); - demuxer->stream->read(cmov_buf,cmov_sz); + bp=demuxer->stream->read(cmov_sz); + memcpy(cmov_buf,bp.data(),bp.size()); zstrm.zalloc = (alloc_func)0; zstrm.zfree = (free_func)0; @@ -1406,7 +1408,8 @@ { off_t text_len = demuxer->stream->read_word(); char text[text_len+2+1]; - demuxer->stream->read( (char *)&text, text_len+2); + bp=demuxer->stream->read(text_len+2); + memcpy(&text,bp.data(),bp.size()); text[text_len+2] = 0x0; switch(udta_id) { @@ -1472,7 +1475,8 @@ udta_len=udta_size; { char dump[udta_len-4]; - demuxer->stream->read( (char *)&dump, udta_len-4-4); + bp=demuxer->stream->read( udta_len-4-4); + memcpy(&dump,bp.data(),bp.size()); udta_size -= udta_len; } } @@ -1495,6 +1499,7 @@ static int lschunks_intrak(Demuxer* demuxer, int level, unsigned int id, off_t pos, off_t len, mov_track_t* trak) { + binary_packet bp(1); switch(id) { case MOV_FOURCC('m','d','a','t'): { MSG_WARN("Hmm, strange MOV, parsing mdat in lschunks?\n"); @@ -1509,7 +1514,8 @@ // read codec data trak->tkdata_len = len; trak->tkdata = new unsigned char [trak->tkdata_len]; - demuxer->stream->read( trak->tkdata, trak->tkdata_len); + bp=demuxer->stream->read(trak->tkdata_len); + memcpy(trak->tkdata,bp.data(),bp.size()); /* 0 1 Version 1 3 Flags @@ -1557,7 +1563,8 @@ /*unsigned int comp_mask =*/ demuxer->stream->read_dword(); unsigned _len = demuxer->stream->read_char(); char* str = new char [_len + 1]; - demuxer->stream->read( str, _len); + bp=demuxer->stream->read(_len); + memcpy(str,bp.data(),bp.size()); str[_len] = 0; MSG_V( "MOV: %*sHandler header: %.4s/%.4s (%.4s) %s\n", level, "", &type, &subtype, &manufact, str); @@ -1623,7 +1630,8 @@ // NOTE: trak type is not yet known at this point :((( trak->stdata_len = _len - 8; trak->stdata = new unsigned char [trak->stdata_len]; - demuxer->stream->read( trak->stdata, trak->stdata_len); + bp=demuxer->stream->read(trak->stdata_len); + memcpy(trak->stdata,bp.data(),bp.size()); } if (!demuxer->stream->seek( _pos + _len)) break; @@ -1880,7 +1888,8 @@ char buf2[newlen]; len-=4; - demuxer->stream->read( buf, len); + bp=demuxer->stream->read(len); + memcpy(buf,bp.data().bp.size()); zstrm.zalloc = (alloc_func)0; zstrm.zfree = (free_func)0; @@ -1903,7 +1912,8 @@ } { #endif - demuxer->stream->read( buf, len); + bp=demuxer->stream->read(len); + memcpy(buf,bp.data(),bp.size()); write(fd, buf, len); } close(fd); @@ -2010,7 +2020,8 @@ memcpy(dp->buffer(),trak->stream_header,trak->stream_header_len); dp->pos=demuxer->stream->tell()-trak->stream_header_len; dp->resize(x+trak->stream_header_len); - x=demuxer->stream->read(dp->buffer()+trak->stream_header_len,x); + binary_packet bp=demuxer->stream->read(x); + memcpy(dp->buffer()+trak->stream_header_len,bp.data(),bp.size()); delete trak->stream_header; trak->stream_header = NULL; trak->stream_header_len = 0; Modified: mplayerxp/libmpdemux/demux_mp3.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mp3.cpp 2013-06-04 17:51:34 UTC (rev 648) +++ mplayerxp/libmpdemux/demux_mp3.cpp 2013-06-08 14:04:10 UTC (rev 649) @@ -56,7 +56,7 @@ off_t spos; while(!demuxer->stream->eof()) { spos=demuxer->stream->tell(); - demuxer->stream->read(hdr,4); + binary_packet bp=demuxer->stream->read(4); memcpy(hdr,bp.data(),bp.size()); len = mp_decode_mp3_header(hdr,NULL,NULL,NULL,NULL); if(len < 0) { demuxer->stream->skip(-3); @@ -72,6 +72,7 @@ { unsigned n; Stream *s=demuxer->stream; + binary_packet bp(1); for(n = 0; n < 5 ; n++) { MSG_DBG2("read_mp3v1_tags\n"); pos = mp_decode_mp3_header(hdr,NULL,NULL,NULL,NULL); @@ -80,14 +81,14 @@ s->skip(pos-4); if(s->eof()) return 0; - s->read(hdr,4); + bp=s->read(4); memcpy(hdr,bp.data(),bp.size()); if(s->eof()) return 0; } if(s->end_pos()) { char tag[4]; s->seek(s->end_pos()-128); - s->read(tag,3); + bp=s->read(3); memcpy(tag,bp.data(),bp.size()); tag[3] = '\0'; if(strcmp(tag,"TAG")) demuxer->movi_end = s->end_pos(); @@ -95,19 +96,19 @@ char buf[31]; uint8_t g; demuxer->movi_end = s->tell()-3; - s->read(buf,30); + bp=s->read(30); memcpy(buf,bp.data(),bp.size()); buf[30] = '\0'; demuxer->info().add(INFOT_NAME,buf); - s->read(buf,30); + bp=s->read(30); memcpy(buf,bp.data(),bp.size()); buf[30] = '\0'; demuxer->info().add(INFOT_AUTHOR,buf); - s->read(buf,30); + bp=s->read(30); memcpy(buf,bp.data(),bp.size()); buf[30] = '\0'; demuxer->info().add(INFOT_ALBUM,buf); - s->read(buf,4); + bp=s->read(4); memcpy(buf,bp.data(),bp.size()); buf[4] = '\0'; demuxer->info().add(INFOT_DATE,buf); - s->read(buf,30); + bp=s->read(30); memcpy(buf,bp.data(),bp.size()); buf[30] = '\0'; demuxer->info().add(INFOT_COMMENTS,buf); if(buf[28] == 0 && buf[29] != 0) { @@ -143,6 +144,7 @@ { off_t pos,epos; Stream *s=demuxer->stream; + binary_packet bp(1); if( flags==ID3V22_ZERO_FLAG || flags==ID3V22_UNSYNCH_FLAG || flags==ID3V22_COMPRESS_FLAG) return 0; @@ -154,10 +156,12 @@ unsigned len; unsigned char buf[ID3V22_FRAME_HEADER_SIZE]; char data[4096]; - s->read(buf,ID3V22_FRAME_HEADER_SIZE); + bp=s->read(ID3V22_FRAME_HEADER_SIZE); + memcpy(buf,bp.data(),bp.size()); id=(buf[2] << 16) + (buf[1] << 8) + buf[0]; len=(buf[3] << 14) + (buf[4] << 7) + buf[5]; - s->read(data,std::min(len,unsigned(4096))); + bp=s->read(std::min(len,unsigned(4096))); + memcpy(data,bp.data(),bp.size()); data[std::min(len,unsigned(4096))]=0; switch(id) { @@ -212,13 +216,15 @@ { off_t pos,epos; Stream *s=demuxer->stream; + binary_packet bp(1); if( flags==ID3V23_ZERO_FLAG || flags==ID3V23_UNSYNCH_FLAG) return 0; if( flags==ID3V23_EXT_HEADER_FLAG ) { char buf[4]; unsigned ehsize; - demuxer->stream->read(buf,4); + bp=demuxer->stream->read(4); + memcpy(buf,bp.data(),bp.size()); ehsize=(buf[0] << 21) + (buf[1] << 14) + (buf[2] << 7) + buf[3]; demuxer->stream->skip(ehsize); } @@ -230,10 +236,12 @@ unsigned len; unsigned char buf[ID3V23_FRAME_HEADER_SIZE]; char data[4096]; - s->read(buf,ID3V23_FRAME_HEADER_SIZE); + bp=s->read(ID3V23_FRAME_HEADER_SIZE); + memcpy(buf,bp.data(),bp.size()); id=*((uint32_t *)buf); len=(buf[4] << 21) + (buf[5] << 14) + (buf[6] << 7) + buf[7]; - s->read(data,std::min(len,unsigned(4096))); + bp=s->read(std::min(len,unsigned(4096))); + memcpy(data,bp.data(),bp.size()); data[std::min(len,unsigned(4096))]=0; MSG_V("ID3: %4s len %u\n",buf,len); switch(id) @@ -292,13 +300,16 @@ { off_t pos,epos; Stream *s=demuxer->stream; + binary_packet bp(1); + if( flags==ID3V24_ZERO_FLAG || flags==ID3V24_UNSYNCH_FLAG) return 0; if( flags==ID3V24_EXT_HEADER_FLAG ) { char buf[4]; unsigned ehsize; - demuxer->stream->read(buf,4); + bp=demuxer->stream->read(4); + memcpy(buf,bp.data(),bp.size()); ehsize=(buf[0] << 21) + (buf[1] << 14) + (buf[2] << 7) + buf[3]; demuxer->stream->skip(ehsize); } @@ -310,10 +321,13 @@ unsigned len; unsigned char buf[ID3V23_FRAME_HEADER_SIZE]; char data[4096]; - s->read(buf,ID3V23_FRAME_HEADER_SIZE); + binary_packet bp(1); + bp=s->read(ID3V23_FRAME_HEADER_SIZE); + memcpy(buf,bp.data(),bp.size()); id=*((uint32_t *)buf); len=(buf[4] << 21) + (buf[5] << 14) + (buf[6] << 7) + buf[7]; - s->read(data,std::min(len,unsigned(4096))); + bp=s->read(std::min(len,unsigned(4096))); + memcpy(data,bp.data(),bp.size()); data[std::min(len,unsigned(4096))]=0; MSG_V("ID3: %4s len %u\n",buf,len); switch(id) @@ -352,7 +366,8 @@ vers=s->read_char(); rev=s->read_char(); flags=s->read_char(); - s->read(buf,4); + binary_packet bp=s->read(4); + memcpy(buf,bp.data(),bp.size()); hsize=(buf[0] << 21) + (buf[1] << 14) + (buf[2] << 7) + buf[3]; MSG_V("Found ID3v2.%d.%d flags %d size %d\n",vers,rev,flags,hsize); if(vers==2) return read_id3v22_tags(demuxer,flags,hsize); @@ -368,7 +383,7 @@ { int retval=0; uint32_t fcc,fcc1,fmt; - uint8_t *p,b[32]; + uint8_t *p; Stream *s; *brate=*samplerate=*channels=0; s = demuxer->stream; @@ -377,7 +392,7 @@ fcc1=me2be_32(fcc1); p = (uint8_t *)&fcc1; s->seek(fptr); - s->read(b,sizeof(b)); + binary_packet bp=s->read(32); if(mp_check_mp3_header(fcc1,&fmt,brate,samplerate,channels)) { if(fmt==1) retval = RAW_MP1; else... [truncated message content] |
From: <nic...@us...> - 2013-06-11 14:37:55
|
Revision: 651 http://sourceforge.net/p/mplayerxp/code/651 Author: nickols_k Date: 2013-06-11 14:37:50 +0000 (Tue, 11 Jun 2013) Log Message: ----------- convert libmpcodecs into class (note: doesn't work for me) about illegal-patch ==================== Log shows that it is working code, but it doesn't work for me due illegal-patch $sudo ./mplayerxp -vo fbdev -ao alsa /...path.../trassa e95.avi -v -v -v ---------------------- 8< --------------------- 8< ------------------------ *** Antiviral protection was inited ***!!! MPlayerXP svn.650 2002 Nickols_K 2000-2002 Arpad Gereoffy (?\209?\129?\208?\188. DOCS!) Can't open input config file /root/.mplayerxp/input.conf : No such file or directory Can't open input config file /usr/local/share/mplayerxp/input.conf : No such file or directory Falling back on default (hardcoded) input config Opening joystick device:/dev/input/js0 Can't open joystick device: /dev/input/js0 : No such file or directory Can't init input joystick with using: /dev/input/js0 CPU: Advanced Micro Devices (Type: 9, Stepping: 3) extended cpuid-level: 26 extended cache-info: 33587520 Detected cache-line size is 64 bytes cpudetect: MMX=1 MMX2=1 3DNow=1 3DNow2=1 SSE=1 SSE2=1 SSE3=1 SSSE3=0 SSE41=0 SSE42=0 AES=0 AVX=0 FMA=0 User corrected CPU flags: MMX=1 MMX2=1 3DNow=1 3DNow2=1 SSE=1 SSE2=1 SSE3=1 SSSE3=0 SSE41=0 SSE42=0 AES=0 AVX=0 FMA=0 mpxp_context().mplayer_accel=4160749568 Environment: HOME => /root LANG => ru_RU.UTF-8 LOGNAME => root MAIL => /var/mail/root PATH => /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl SHELL => /bin/bash SUDO_COMMAND => ./mplayerxp -vo fbdev -ao alsa /...path.../trassa e95.avi -v -v -v SUDO_GID => 1000 SUDO_UID => 1000 SUDO_USER => kas TERM => linux USER => root USERNAME => root CommandLine: '-vo' 'fbdev' '-ao' 'alsa' '/...path.../trassa e95.avi' '-v' '-v' '-v' font: can't open file: /root/.mplayerxp/font/font.desc font: can't open file: /usr/local/share/mplayerxp/font/font.desc Menu init failed fbdev: using /dev/fb0 ?\208?\146?\208?\190?\209?\129?\208?\191?\209?\128?\208?\190?\208?\184?\208?\183?\208?\178?\208?\181?\208?\180?\208?\181?\208?\189?\208?\184?\208?\181 /...path.../trassa e95.avi Filename for url is now /...path.../trassa%20e95.avi Not an URL! [Stream]: Opening *:// ... False [Demuxer]: Probing RAW audio parser ...:False [Demuxer]: Probing RAW video parser ...:False [Demuxer]: Probing AVI - Audio Video Interleaved parser ...:Ok DEMUX: LIST 'hdrl' len=8830 DEMUX: list_end=0x2292 DEMUX: CHUNK 'avih' len=56 DEMUX: ======= AVI Header ======= us/frame: 40000 (fps=25.000) max bytes/sec: 0 padding: 0 DEMUX: MainAVIHeader.dwFlags: (272) HAS_INDEX IS_INTERLEAVED DEMUX: frames total: 6198 initial: 0 streams: 2 Suggested BufferSize: 0 Size: 352 x 288 DEMUX: list_end=0x2292 pos=0x58 chunksize=0x0 next=0x58 DEMUX: LIST 'strl' len=4244 DEMUX: list_end=0x10F4 DEMUX: CHUNK 'strh' len=56 [Demuxer]: ==> Found video stream: 0 [Demuxer]: ID_VIDEO_ID=0 DEMUX: ======= STREAM Header ======= Type: vids FCC: div3 (33766964) Flags: 0 Priority: 0 Language: 0 InitialFrames: 0 Rate: 25000/1000 = 25.000 Start: 0 Len: 6198 Suggested BufferSize: 21412 Quality 10000 Sample size: 0 DEMUX: list_end=0x10F4 pos=0xA4 chunksize=0x0 next=0xA4 DEMUX: CHUNK 'strf' len=40 DEMUX: found 'bih', 40 bytes of 40 DEMUX: ======= VIDEO Format (chunk size: 40 )====== biSize 40 biWidth 352 biHeight 288 biPlanes 1 biBitCount 24 biCompression 33564944='DIV3' biSizeImage 304128 biXPelPerMeter 0 biYPelPerMeter 0 biClrUsed 0 biClrIpmortant 0 DEMUX: ======= End of Video Format ======= DEMUX: Regenerating keyframe table for DIVX 3 video DEMUX: list_end=0x10F4 pos=0xD4 chunksize=0x0 next=0xD4 DEMUX: CHUNK 'JUNK' len=4120 DEMUX: list_end=0x10F4 pos=0x10F4 chunksize=0x0 next=0x10F4 DEMUX: LIST 'strl' len=4234 DEMUX: list_end=0x2186 DEMUX: CHUNK 'strh' len=56 DEMUX: avi: Found audio stream Demuxer: ==> Found audio stream: 1 Demuxer: ID_AUDIO_ID=1 DEMUX: ======= STREAM Header ======= Type: auds FCC: (0) Flags: 0 Priority: 0 Language: 0 InitialFrames: 1 Rate: 15963/1 = 15963.000 Start: 0 Len: 3957330 Suggested BufferSize: 7467 Quality -1 Sample size: 1 DEMUX: list_end=0x2186 pos=0x1140 chunksize=0x0 next=0x1140 DEMUX: CHUNK 'strf' len=30 DEMUX: found 'wf', 30 bytes of 18 DEMUX: ======= WAVE Format (chunk size: 30 )======= Format Tag: 85 (0x55) Channels: 2 Samplerate: 44100 avg byte/sec: 15963 Block align: 1 bits/sample: 0 cbSize: 12 DEMUX: mp3.wID=1 mp3.fdwFlags=0x2 mp3.nBlockSize=417 mp3.nFramesPerBlock=1 mp3.nCodecDelay=1393 DEMUX: ======= End of WAVE Format ======= DEMUX: list_end=0x2186 pos=0x1166 chunksize=0x0 next=0x1166 DEMUX: CHUNK 'JUNK' len=4120 DEMUX: list_end=0x2186 pos=0x2186 chunksize=0x0 next=0x2186 DEMUX: LIST 'odml' len=260 DEMUX: list_end=0x2292 DEMUX: CHUNK 'dmlh' len=248 DEMUX: Found ODML header 248 frames 6198 DEMUX: list_end=0x2292 pos=0x2292 chunksize=0x0 next=0x2292 DEMUX: CHUNK 'JUNK' len=1382 DEMUX: list_end=0x2292 pos=0x2800 chunksize=0x0 next=0x2800 DEMUX: Broken chunk? chunksize=0 (id=JUNK) DEMUX: CHUNK 'JUNK' len=1382 DEMUX: list_end=0x0 pos=0x2800 chunksize=0x0 next=0x2800 DEMUX: LIST 'movi' len=23710356 DEMUX: list_end=0x169F29C DEMUX: Found movie at 0x280C - 0x169F29C DEMUX: CHUNK 'idx1' len=198144 DEMUX: Reading INDEX block, 12384 chunks for 6198 frames DEMUX: 0: 01wb 10 00000004 len: 7467 pos: 0-> 0.000 0-> 0.000 DEMUX: 1: 00dc 10 00001D38 len: 556 pos: 0-> 0.000 0-> 0.000 DEMUX: 2: 01wb 10 00001F6C len: 419 pos: 7467-> 0.398 1-> 0.042 [snip] ... [/snip] DEMUX: 12381: 00dc 0 0169C7E6 len: 122 pos:19647058->1048.011 6195->258.383 DEMUX: 12382: 00dc 0 0169C868 len: 247 pos:19647180->1048.017 6196->258.425 DEMUX: 12383: 00dc 0 0169C968 len: 292 pos:19647427->1048.031 6197->258.467 DEMUX: list_end=0x0 pos=0x16CF8A4 chunksize=0x0 next=0x16CF8A4 DEMUX: CHUNK 'JUNK' len=1876 DEMUX: list_end=0x0 pos=0x16D0000 chunksize=0x0 next=0x16D0000 DEMUX: AVI index offset: 0x2808 (movi=0x280C idx0=0x4 idx1=0x1D38) DEMUX: Auto-selected AVI audio ID = 1 DEMUX: Auto-selected AVI video ID = 0 ds_fill_buffer(d_video) called DEMUX: demux_avi.read_packet: 62773130 DEMUX: DEMUX_AVI: Read 7467 data bytes from packet 62773130 DEMUX: Append packet: len=7467 pts=0 pos=0 [_packs: A=1 V=0] ds_read_packet(7467,0,0,0) DEMUX: DEMUX_AVI: Skipping 1 bytes from packet 62773130 DEMUX: demux_avi.read_packet: 63643030 DEMUX: DEMUX_AVI: Read 556 data bytes from packet 63643030 DEMUX: Append packet: len=556 pts=0 pos=1 [_packs: A=1 V=1] ds_read_packet(556,0,0,0) DEMUX: AVI: Searching for audio stream (id:1) ds_fill_buffer(d_audio) called DEMUX: AVI video size=19647719 (6198) audio size=3957330 (3957330) DEMUX: VIDEO: [DIV3] 352x288 24bpp 25.00 fps [Demuxer]: Using: AVI - Audio Video Interleaved parser [Stream]:Video=DIV3 Audio=00000055 [V] filefmt:6fourcc:0x33564944 size:160x120 fps:25 ftime:=0.04 MPSUB: SPU: Display only forced subs now disabled [codec_ld] ?\208?\145?\208?\184?\208?\177?\208?\187?\208?\184?\208?\190?\209?\130?\208?\181?\208?\186?\208?\176 ?\208?\183?\208?\176?\208?\179?\209?\128?\209?\131?\208?\182?\208?\181?\208?\189?\208?\176 ?\209?\131?\209?\129?\208?\191?\208?\181?\209?\136?\208?\189?\208?\190:libmpg123.so initial_apts from: stream_pts=0 pts_bytes=7467 got_bytes=7467 i_bps=15963 initial_apts is: 0 mpg123_init: MPEG-1.0 [Layer:III (CBR)], Hz=44100 128-kbit Joint-Stereo, BPF=417 Out=32-bit mpg123_init: Copyrght=No Orig=Yes CRC=No Priv=No Emphas=0 Optimiz=x86-64 Probing: mp3libok Driver: mp3lib supports these outfmt for 00000055 100000 10 0 Using SSE2 optimized memcpy fast_memcpy(0x3dc27a0, 0x7fff2f5dbf88, 64) [cl_size=64] dec_audio: Allocating 8192 + 65536 = 73728 bytes for output buffer [AC] Selecting drv:mp3lib.libmpg123.so ratio 15963->352800 alsa-init: compiled for ALSA-1.0.27.1 alsa-init: got device=0, subdevice=0 alsa-init: Testing & bugs are welcome. Found 1 cards, use: hw:0,0 alsa-init: pcm opend in block-mode snd_pcm_hw_params_any() snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED) Initializing audio codec... AUDIO: srate=ac44 chans=2 bps=4 sfmt=0x100000 ratio: 3e5b->0 POSTPR: vo2(NULL, NULL) Probing: raw failed Probing: nuv failed Probing: mpeg2 failed Probing: xvid failed Probing: mpegpes failed Probing: huffyuv failed Probing: divx [codec_ld] ?\208?\157?\208?\181 ?\208?\188?\208?\190?\208?\179?\209?\131 ?\208?\183?\208?\176?\208?\179?\209?\128?\209?\131?\208?\183?\208?\184?\209?\130?\209?\140 ?\208?\177?\208?\184?\208?\177?\208?\187?\208?\184?\208?\190?\209?\130?\208?\181?\208?\186?\209?\131:libdivx.so {libdivx.so: cannot open shared object file: No such file or directory} [codec_ld] ?\208?\159?\208?\190?\208?\191?\209?\139?\209?\130?\208?\176?\208?\185?\209?\130?\208?\181?\209?\129?\209?\140 ?\208?\191?\208?\190?\208?\187?\209?\131?\209?\135?\208?\184?\209?\130?\209?\140 ?\209?\141?\209?\130?\208?\190?\209?\130 ?\208?\186?\208?\190?\208?\180?\208?\181?\208?\186 ?\209?\129:http://labs.divx.com/DivXLinuxCodec failed Probing: realvid failed Probing: xanim failed Probing: theora failed Probing: libdv failed Probing: lavc libavcodec.size: 352 x 288 Using 4 threads in lavc INFO: libavcodec.so (0) video codec[DIV3] init OK! VDec: vo config request - 352 x 288 dri_vo_dbg: vo_query_format(00000000) dri_vo: request for Unknown 0x0000 fourcc: 0 [vf_vo2] 0=query_format(Unknown 0x0000) vf_vo2->config(352,288,352,288,4,Unknown 0x0000) dri_vo_dbg: vo_config priv.video_out->config(352,288,352,288, 0x4,'MPlayerXP',Unknown 0x0000) fbdev: Can't set graphics mode: Inappropriate ioctl for device fbdev: var info: fbdev: xres: 1920 fbdev: yres: 1200 fbdev: xres_virtual: 1920 fbdev: yres_virtual: 1200 fbdev: xoffset: 0 fbdev: yoffset: 0 fbdev: bits_per_pixel: 32 fbdev: grayscale: 0 fbdev: red: 16 8 0 fbdev: green: 8 8 0 fbdev: blue: 0 8 0 fbdev: transp: 24 8 0 fbdev: nonstd: 0 fbdev: activate: 0 fbdev: height: 4294967295 fbdev: width: 4294967295 fbdev: accel_flags: 1 fbdev: timing: fbdev: pixclock: 0 fbdev: left_margin: 0 fbdev: right_margin: 0 fbdev: upper_margin: 0 fbdev: lower_margin: 0 fbdev: hsync_len: 0 fbdev: vsync_len: 0 fbdev: sync: 0 fbdev: vmode: 0 fbdev: fix info: fbdev: framebuffer size: 9216000 bytes fbdev: type: 0 fbdev: type_aux: 0 fbdev: visual: 2 fbdev: line_length: 7680 bytes fbdev: id: radeondrmfb fbdev: smem_start: 0xc0142000 fbdev: xpanstep: 1 fbdev: ypanstep: 1 fbdev: ywrapstep: 0 fbdev: mmio_start: 0 fbdev: mmio_len: 0 bytes fbdev: accel: 0 fbdev: priv.bpp: 32 fbdev: priv.real_bpp: 24 fbdev: priv.pixel_size: 4 bytes fbdev: other: fbdev: priv.in_width: 352 fbdev: priv.in_height: 288 fbdev: priv.out_width: 352 fbdev: priv.out_height: 288 fbdev: priv.last_row: 816 fbdev: frame_buffer @ 7f7549c01000 fbdev: L123123875 @ 7f7549f58c40 fbdev: pixel per line: 1920 fbdev: vt_set_textarea(330,4b0): 34,4b POSTPR: [stream: vf_reinit_vo]: 0x3de51c0 POSTPR: Call vf_reinit_vo <vo2: 352x288@Unknown 0x0000> -> <vo: 352x288@BGRA> POSTPR: vf->first: 352x288@Unknown 0x0000 POSTPR: [352x288@Unknown 0x0000](NULL<-vo2->NULL) POSTPR: Using(first:vo2) 352x288@Unknown 0x0000 POSTPR: vf_reinit->config_vf 352 288 Unknown 0x0000=> 352 288 BGRA POSTPR: Open video filter: [fmtcvt] <352x288 Unknown 0x0000> POSTPR: SwScale params: -1 x -1 (-1=no scaling) dri_vo_dbg: vo_query_format(51343434) dri_vo: request for Planar 444P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 444P 16-bit little-endian) POSTPR: scale: query(Planar 444P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34343451) dri_vo: request for Planar 444P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 444P 16-bit big-endian) POSTPR: scale: query(Planar 444P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(51323234) dri_vo: request for Planar 422P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 422P 16-bit little-endian) POSTPR: scale: query(Planar 422P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34323251) dri_vo: request for Planar 422P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 422P 16-bit big-endian) POSTPR: scale: query(Planar 422P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(51303234) dri_vo: request for Planar 420P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 420P 16-bit little-endian) POSTPR: scale: query(Planar 420P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34323051) dri_vo: request for Planar 420P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 420P 16-bit big-endian) POSTPR: scale: query(Planar 420P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(41303234) dri_vo: request for Planar YV12 with alpha fourcc: 0 [vf_vo2] 0=query_format(Planar YV12 with alpha) POSTPR: scale: query(Planar YV12 with alpha) -> 0 dri_vo_dbg: vo_query_format(50343434) dri_vo: request for Planar 444P fourcc: 0 [vf_vo2] 0=query_format(Planar 444P) POSTPR: scale: query(Planar 444P) -> 0 dri_vo_dbg: vo_query_format(50323234) dri_vo: request for Planar 422P fourcc: 0 [vf_vo2] 0=query_format(Planar 422P) POSTPR: scale: query(Planar 422P) -> 0 dri_vo_dbg: vo_query_format(32315659) dri_vo: request for Planar YV12 fourcc: 0 [vf_vo2] 0=query_format(Planar YV12) POSTPR: scale: query(Planar YV12) -> 0 dri_vo_dbg: vo_query_format(30323449) dri_vo: request for Planar I420 fourcc: 0 [vf_vo2] 0=query_format(Planar I420) POSTPR: scale: query(Planar I420) -> 0 dri_vo_dbg: vo_query_format(56555949) dri_vo: request for Planar IYUV fourcc: 0 [vf_vo2] 0=query_format(Planar IYUV) POSTPR: scale: query(Planar IYUV) -> 0 dri_vo_dbg: vo_query_format(39555659) dri_vo: request for Planar YVU9 fourcc: 0 [vf_vo2] 0=query_format(Planar YVU9) POSTPR: scale: query(Planar YVU9) -> 0 dri_vo_dbg: vo_query_format(39304649) dri_vo: request for Planar IF09 fourcc: 0 [vf_vo2] 0=query_format(Planar IF09) POSTPR: scale: query(Planar IF09) -> 0 dri_vo_dbg: vo_query_format(50313134) dri_vo: request for Planar 411P fourcc: 0 [vf_vo2] 0=query_format(Planar 411P) POSTPR: scale: query(Planar 411P) -> 0 dri_vo_dbg: vo_query_format(32595559) dri_vo: request for Packed YUY2 fourcc: 0 [vf_vo2] 0=query_format(Packed YUY2) POSTPR: scale: query(Packed YUY2) -> 0 dri_vo_dbg: vo_query_format(59565955) dri_vo: request for Packed UYVY fourcc: 0 [vf_vo2] 0=query_format(Packed UYVY) POSTPR: scale: query(Packed UYVY) -> 0 dri_vo_dbg: vo_query_format(52474230) dri_vo: request for RGB 48-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 48-bit) POSTPR: scale: query(RGB 48-bit) -> 0 dri_vo_dbg: vo_query_format(524742b0) dri_vo: request for BGR 48-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 48-bit) POSTPR: scale: query(BGR 48-bit) -> 0 dri_vo_dbg: vo_query_format(42475220) dri_vo: request for BGRA fourcc: 1 [vf_vo2] 1=query_format(BGRA) POSTPR: scale: query(BGRA) -> 1 dri_vo_dbg: vo_query_format(52474220) dri_vo: request for RGBA fourcc: 0 [vf_vo2] 0=query_format(RGBA) POSTPR: scale: query(RGBA) -> 0 dri_vo_dbg: vo_query_format(42475218) dri_vo: request for BGR 24-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 24-bit) POSTPR: scale: query(BGR 24-bit) -> 0 dri_vo_dbg: vo_query_format(52474218) dri_vo: request for RGB 24-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 24-bit) POSTPR: scale: query(RGB 24-bit) -> 0 dri_vo_dbg: vo_query_format(42475210) dri_vo: request for BGR 16-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 16-bit) POSTPR: scale: query(BGR 16-bit) -> 0 dri_vo_dbg: vo_query_format(52474210) dri_vo: request for RGB 16-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 16-bit) POSTPR: scale: query(RGB 16-bit) -> 0 dri_vo_dbg: vo_query_format(4247520f) dri_vo: request for BGR 15-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 15-bit) POSTPR: scale: query(BGR 15-bit) -> 0 dri_vo_dbg: vo_query_format(5247420f) dri_vo: request for RGB 15-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 15-bit) POSTPR: scale: query(RGB 15-bit) -> 0 dri_vo_dbg: vo_query_format(30303859) dri_vo: request for Planar Y800 fourcc: 0 [vf_vo2] 0=query_format(Planar Y800) POSTPR: scale: query(Planar Y800) -> 0 dri_vo_dbg: vo_query_format(20203859) dri_vo: request for Planar Y8 fourcc: 0 [vf_vo2] 0=query_format(Planar Y8) POSTPR: scale: query(Planar Y8) -> 0 dri_vo_dbg: vo_query_format(42475208) dri_vo: request for BGR 8-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 8-bit) POSTPR: scale: query(BGR 8-bit) -> 0 dri_vo_dbg: vo_query_format(52474208) dri_vo: request for RGB 8-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 8-bit) POSTPR: scale: query(RGB 8-bit) -> 0 dri_vo_dbg: vo_query_format(42475204) dri_vo: request for BGR 4-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 4-bit) POSTPR: scale: query(BGR 4-bit) -> 0 dri_vo_dbg: vo_query_format(52474204) dri_vo: request for RGB 4-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 4-bit) POSTPR: scale: query(RGB 4-bit) -> 0 dri_vo_dbg: vo_query_format(42475284) dri_vo: request for BGR 4-bit per byte fourcc: 0 [vf_vo2] 0=query_format(BGR 4-bit per byte) POSTPR: scale: query(BGR 4-bit per byte) -> 0 dri_vo_dbg: vo_query_format(52474284) dri_vo: request for RGB 4-bit per byte fourcc: 0 [vf_vo2] 0=query_format(RGB 4-bit per byte) POSTPR: scale: query(RGB 4-bit per byte) -> 0 dri_vo_dbg: vo_query_format(42475201) dri_vo: request for BGR 1-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 1-bit) POSTPR: scale: query(BGR 1-bit) -> 0 dri_vo_dbg: vo_query_format(52474201) dri_vo: request for RGB 1-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 1-bit) POSTPR: scale: query(RGB 1-bit) -> 0 dri_vo_dbg: vo_query_format(42475220) dri_vo: request for BGRA fourcc: 1 [vf_vo2] 1=query_format(BGRA) POSTPR: vf_scale: 1025=vf_next_query_format(0x56f2010,42475220,352,288); POSTPR: vf_scale: sws_getFlagsAndFilterFromCmdLine(...); POSTPR: vf_scale: sws_getContext(352, 288, Unknown 0x0000, 352, 288, BGRA, E0001004); [swscaler @ 0x56f25e0] (null) is not supported as input pixel format POSTPR: vf_scale: (nil)=sws_getContext POSTPR: Couldn't init SwScaler for this setup (nil) POSTPR: FATAL: ?\208?\157?\208?\181 ?\208?\188?\208?\190?\208?\179?\209?\131 ?\208?\191?\209?\128?\208?\190?\208?\184?\208?\189?\208?\184?\209?\134?\208?\184?\208?\176?\208?\187?\208?\184?\208?\183?\208?\184?\209?\128?\208?\190?\208?\178?\208?\176?\209?\130?\209?\140 ?\208?\178?\208?\184?\208?\180?\208?\181?\208?\190 ?\208?\180?\209?\128?\208?\176?\208?\185?\208?\178?\208?\181?\209?\128! POSTPR: vf->first: 352x288@Unknown 0x0000 POSTPR: [352x288@Unknown 0x0000](fmtcvt<-vo2->NULL) dri_vo_caps: driver does support DRI dri_vo_caps: caps=00000000 fourcc=42475220(BGRA) x,y,w,h(0 0 160 120) dri_vo_caps: width,height(160,120) strides(580000) priv.dri.bpp=20 dri_vo_src: w,h(160,120) d_w,d_h(160,120 dri_vo_src: flags=00000004 fourcc=00000000(Unknown 0x0000) dri_vo_dbg: vo_query_format(30323449) dri_vo: request for Planar I420 fourcc: 0 [vf_vo2] 0=query_format(Planar I420) vo_debug[step i=0]: query(Planar I420 352x288) returned 0x0 for: POSTPR: [libvf] Using video filters chain: POSTPR: VO-CONF: [fbdev] 352x288 => 352x288 Unknown 0x0000 [zoom] VO: Description: Framebuffer Device VO: Author: Szabolcs Berecz <sz...@in...> Can't find colorspace for: 'Planar I420' Trying -vf fmtcvt... Open video filter: [fmtcvt] <352x288 Planar I420> POSTPR: SwScale params: -1 x -1 (-1=no scaling) POSTPR: vf_scale: query_format(0x56f25e0, 30323449(Planar I420), 352, 288 dri_vo_dbg: vo_query_format(51343434) dri_vo: request for Planar 444P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 444P 16-bit little-endian) POSTPR: scale: query(Planar 444P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34343451) dri_vo: request for Planar 444P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 444P 16-bit big-endian) POSTPR: scale: query(Planar 444P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(51323234) dri_vo: request for Planar 422P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 422P 16-bit little-endian) POSTPR: scale: query(Planar 422P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34323251) dri_vo: request for Planar 422P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 422P 16-bit big-endian) POSTPR: scale: query(Planar 422P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(51303234) dri_vo: request for Planar 420P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 420P 16-bit little-endian) POSTPR: scale: query(Planar 420P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34323051) dri_vo: request for Planar 420P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 420P 16-bit big-endian) POSTPR: scale: query(Planar 420P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(41303234) dri_vo: request for Planar YV12 with alpha fourcc: 0 [vf_vo2] 0=query_format(Planar YV12 with alpha) POSTPR: scale: query(Planar YV12 with alpha) -> 0 dri_vo_dbg: vo_query_format(50343434) dri_vo: request for Planar 444P fourcc: 0 [vf_vo2] 0=query_format(Planar 444P) POSTPR: scale: query(Planar 444P) -> 0 dri_vo_dbg: vo_query_format(50323234) dri_vo: request for Planar 422P fourcc: 0 [vf_vo2] 0=query_format(Planar 422P) POSTPR: scale: query(Planar 422P) -> 0 dri_vo_dbg: vo_query_format(32315659) dri_vo: request for Planar YV12 fourcc: 0 [vf_vo2] 0=query_format(Planar YV12) POSTPR: scale: query(Planar YV12) -> 0 dri_vo_dbg: vo_query_format(30323449) dri_vo: request for Planar I420 fourcc: 0 [vf_vo2] 0=query_format(Planar I420) POSTPR: scale: query(Planar I420) -> 0 dri_vo_dbg: vo_query_format(56555949) dri_vo: request for Planar IYUV fourcc: 0 [vf_vo2] 0=query_format(Planar IYUV) POSTPR: scale: query(Planar IYUV) -> 0 dri_vo_dbg: vo_query_format(39555659) dri_vo: request for Planar YVU9 fourcc: 0 [vf_vo2] 0=query_format(Planar YVU9) POSTPR: scale: query(Planar YVU9) -> 0 dri_vo_dbg: vo_query_format(39304649) dri_vo: request for Planar IF09 fourcc: 0 [vf_vo2] 0=query_format(Planar IF09) POSTPR: scale: query(Planar IF09) -> 0 dri_vo_dbg: vo_query_format(50313134) dri_vo: request for Planar 411P fourcc: 0 [vf_vo2] 0=query_format(Planar 411P) POSTPR: scale: query(Planar 411P) -> 0 dri_vo_dbg: vo_query_format(32595559) dri_vo: request for Packed YUY2 fourcc: 0 [vf_vo2] 0=query_format(Packed YUY2) POSTPR: scale: query(Packed YUY2) -> 0 dri_vo_dbg: vo_query_format(59565955) dri_vo: request for Packed UYVY fourcc: 0 [vf_vo2] 0=query_format(Packed UYVY) POSTPR: scale: query(Packed UYVY) -> 0 dri_vo_dbg: vo_query_format(52474230) dri_vo: request for RGB 48-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 48-bit) POSTPR: scale: query(RGB 48-bit) -> 0 dri_vo_dbg: vo_query_format(524742b0) dri_vo: request for BGR 48-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 48-bit) POSTPR: scale: query(BGR 48-bit) -> 0 dri_vo_dbg: vo_query_format(42475220) dri_vo: request for BGRA fourcc: 1 [vf_vo2] 1=query_format(BGRA) POSTPR: scale: query(BGRA) -> 1 dri_vo_dbg: vo_query_format(52474220) dri_vo: request for RGBA fourcc: 0 [vf_vo2] 0=query_format(RGBA) POSTPR: scale: query(RGBA) -> 0 dri_vo_dbg: vo_query_format(42475218) dri_vo: request for BGR 24-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 24-bit) POSTPR: scale: query(BGR 24-bit) -> 0 dri_vo_dbg: vo_query_format(52474218) dri_vo: request for RGB 24-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 24-bit) POSTPR: scale: query(RGB 24-bit) -> 0 dri_vo_dbg: vo_query_format(42475210) dri_vo: request for BGR 16-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 16-bit) POSTPR: scale: query(BGR 16-bit) -> 0 dri_vo_dbg: vo_query_format(52474210) dri_vo: request for RGB 16-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 16-bit) POSTPR: scale: query(RGB 16-bit) -> 0 dri_vo_dbg: vo_query_format(4247520f) dri_vo: request for BGR 15-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 15-bit) POSTPR: scale: query(BGR 15-bit) -> 0 dri_vo_dbg: vo_query_format(5247420f) dri_vo: request for RGB 15-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 15-bit) POSTPR: scale: query(RGB 15-bit) -> 0 dri_vo_dbg: vo_query_format(30303859) dri_vo: request for Planar Y800 fourcc: 0 [vf_vo2] 0=query_format(Planar Y800) POSTPR: scale: query(Planar Y800) -> 0 dri_vo_dbg: vo_query_format(20203859) dri_vo: request for Planar Y8 fourcc: 0 [vf_vo2] 0=query_format(Planar Y8) POSTPR: scale: query(Planar Y8) -> 0 dri_vo_dbg: vo_query_format(42475208) dri_vo: request for BGR 8-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 8-bit) POSTPR: scale: query(BGR 8-bit) -> 0 dri_vo_dbg: vo_query_format(52474208) dri_vo: request for RGB 8-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 8-bit) POSTPR: scale: query(RGB 8-bit) -> 0 dri_vo_dbg: vo_query_format(42475204) dri_vo: request for BGR 4-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 4-bit) POSTPR: scale: query(BGR 4-bit) -> 0 dri_vo_dbg: vo_query_format(52474204) dri_vo: request for RGB 4-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 4-bit) POSTPR: scale: query(RGB 4-bit) -> 0 dri_vo_dbg: vo_query_format(42475284) dri_vo: request for BGR 4-bit per byte fourcc: 0 [vf_vo2] 0=query_format(BGR 4-bit per byte) POSTPR: scale: query(BGR 4-bit per byte) -> 0 dri_vo_dbg: vo_query_format(52474284) dri_vo: request for RGB 4-bit per byte fourcc: 0 [vf_vo2] 0=query_format(RGB 4-bit per byte) POSTPR: scale: query(RGB 4-bit per byte) -> 0 dri_vo_dbg: vo_query_format(42475201) dri_vo: request for BGR 1-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 1-bit) POSTPR: scale: query(BGR 1-bit) -> 0 dri_vo_dbg: vo_query_format(52474201) dri_vo: request for RGB 1-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 1-bit) POSTPR: scale: query(RGB 1-bit) -> 0 dri_vo_dbg: vo_query_format(42475220) dri_vo: request for BGRA fourcc: 1 [vf_vo2] 1=query_format(BGRA) POSTPR: [sw_scale] BGRA supported on vo2 like 1025 POSTPR: [sw_scale] returning: 1089 vo_debug[step i=0]: query(Planar I420 160x120) returned 0x441 for: POSTPR: [libvf] Using video filters chain: POSTPR: [vf_fmtcvt]: video[0x0] in[Unknown 0x0000] -> out[Unknown 0x0000] POSTPR: VO-CONF: [fbdev] 352x288 => 352x288 Unknown 0x0000 [zoom] VO: Description: Framebuffer Device VO: Author: Szabolcs Berecz <sz...@in...> ---------------------- 8< --------------------- 8< ------------------------ since this commit mplayerxp doesn't call exit() function at all. Therefore it's output without illegal-patch cannot be terminated here. Modified Paths: -------------- mplayerxp/input2/input.cpp mplayerxp/libmpcodecs/Makefile mplayerxp/libmpcodecs/ad.cpp mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/ad_a52.cpp mplayerxp/libmpcodecs/ad_dca.cpp mplayerxp/libmpcodecs/ad_dvdpcm.cpp mplayerxp/libmpcodecs/ad_faad.cpp mplayerxp/libmpcodecs/ad_internal.h mplayerxp/libmpcodecs/ad_lavc.cpp mplayerxp/libmpcodecs/ad_libdv.cpp mplayerxp/libmpcodecs/ad_mp3.cpp mplayerxp/libmpcodecs/ad_null.cpp mplayerxp/libmpcodecs/ad_pcm.cpp mplayerxp/libmpcodecs/ad_real.cpp mplayerxp/libmpcodecs/ad_vorbis.cpp mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/libmpcodecs/dec_audio.h mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpcodecs/vd.cpp mplayerxp/libmpcodecs/vd.h mplayerxp/libmpcodecs/vd_divx4.cpp mplayerxp/libmpcodecs/vd_huffyuv.cpp mplayerxp/libmpcodecs/vd_internal.h mplayerxp/libmpcodecs/vd_lavc.cpp mplayerxp/libmpcodecs/vd_libdv.cpp mplayerxp/libmpcodecs/vd_libmpeg2.cpp mplayerxp/libmpcodecs/vd_mpegpes.cpp mplayerxp/libmpcodecs/vd_null.cpp mplayerxp/libmpcodecs/vd_nuv.cpp mplayerxp/libmpcodecs/vd_raw.cpp mplayerxp/libmpcodecs/vd_real.cpp mplayerxp/libmpcodecs/vd_theora.cpp mplayerxp/libmpcodecs/vd_xanim.cpp mplayerxp/libmpcodecs/vd_xvid.cpp mplayerxp/libmpconf/cfgparser.cpp mplayerxp/libmpdemux/demux_dv.cpp mplayerxp/libmpdemux/demux_ogg.cpp mplayerxp/main.cpp mplayerxp/mplayerxp.h mplayerxp/osdep/mplib.cpp mplayerxp/osdep/mplib.h mplayerxp/postproc/af.h mplayerxp/postproc/vf.cpp mplayerxp/xmpcore/xmp_context.cpp Removed Paths: ------------- mplayerxp/libmpcodecs/ad_hwac3.cpp Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2013-06-10 07:27:20 UTC (rev 650) +++ mplayerxp/input2/input.cpp 2013-06-11 14:37:50 UTC (rev 651) @@ -26,6 +26,7 @@ #include "libmpconf/cfgparser.h" #include "in_msg.h" +#include "mpxp_help.h" #ifdef HAVE_LIRC #include "lirc.h" @@ -1360,7 +1361,7 @@ static int mp_input_print_key_list(libinput_t& handle) { mp_input_print_keys(handle); - exit(0); + exit_player(MSGTR_Exit_quit); } void mp_input_print_binds(libinput_t& handle) { @@ -1406,7 +1407,7 @@ static int mp_input_print_cmd_list(libinput_t& handle) { mp_input_print_cmds(handle); - exit(0); + exit_player(MSGTR_Exit_quit); } MPXP_Rc mp_input_check_interrupt(libinput_t& handle,int tim) { Modified: mplayerxp/libmpcodecs/Makefile =================================================================== --- mplayerxp/libmpcodecs/Makefile 2013-06-10 07:27:20 UTC (rev 650) +++ mplayerxp/libmpcodecs/Makefile 2013-06-11 14:37:50 UTC (rev 651) @@ -6,7 +6,7 @@ DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done CXXSRCS=dec_video.cpp vd.cpp ad.cpp dec_audio.cpp -CXXSRCS+=ad_a52.cpp ad_hwac3.cpp +CXXSRCS+=ad_a52.cpp CXXSRCS+=vd_lavc.cpp \ Modified: mplayerxp/libmpcodecs/ad.cpp =================================================================== --- mplayerxp/libmpcodecs/ad.cpp 2013-06-10 07:27:20 UTC (rev 650) +++ mplayerxp/libmpcodecs/ad.cpp 2013-06-11 14:37:50 UTC (rev 651) @@ -16,100 +16,106 @@ #include "ad_msg.h" /* Missed vorbis, mad, dshow */ +namespace usr { -extern const ad_functions_t mpcodecs_ad_null; -extern const ad_functions_t mpcodecs_ad_mp3; -extern const ad_functions_t mpcodecs_ad_lavc; -extern const ad_functions_t mpcodecs_ad_a52; -extern const ad_functions_t mpcodecs_ad_dca; -extern const ad_functions_t mpcodecs_ad_hwac3; -extern const ad_functions_t mpcodecs_ad_pcm; -extern const ad_functions_t mpcodecs_ad_libdv; -extern const ad_functions_t mpcodecs_ad_dvdpcm; -extern const ad_functions_t mpcodecs_ad_dshow; -extern const ad_functions_t mpcodecs_ad_msacm; -extern const ad_functions_t mpcodecs_ad_faad; -extern const ad_functions_t mpcodecs_ad_vorbis; -extern const ad_functions_t mpcodecs_ad_real; -extern const ad_functions_t mpcodecs_ad_twin; -extern const ad_functions_t mpcodecs_ad_dmo; -extern const ad_functions_t mpcodecs_ad_qtaudio; +extern const ad_info_t ad_null_info; +extern const ad_info_t ad_mp3_info; +extern const ad_info_t ad_lavc_info; +extern const ad_info_t ad_a52_info; +extern const ad_info_t ad_dca_info; +extern const ad_info_t ad_pcm_info; +extern const ad_info_t ad_libdv_info; +extern const ad_info_t ad_dvdpcm_info; +extern const ad_info_t ad_dshow_info; +extern const ad_info_t ad_msacm_info; +extern const ad_info_t ad_faad_info; +extern const ad_info_t ad_vorbis_info; +extern const ad_info_t ad_real_info; +extern const ad_info_t ad_twin_info; +extern const ad_info_t ad_dmo_info; +extern const ad_info_t ad_qtaudio_info; -static const ad_functions_t* mpcodecs_ad_drivers[] = { - &mpcodecs_ad_mp3, - &mpcodecs_ad_a52, - &mpcodecs_ad_dca, - &mpcodecs_ad_hwac3, - &mpcodecs_ad_pcm, - &mpcodecs_ad_dvdpcm, - &mpcodecs_ad_faad, +static const ad_info_t* mpcodecs_ad_drivers[] = { + &ad_mp3_info, + &ad_a52_info, + &ad_dca_info, + &ad_pcm_info, + &ad_dvdpcm_info, + &ad_faad_info, #ifdef HAVE_LIBVORBIS - &mpcodecs_ad_vorbis, + &ad_vorbis_info, #endif #ifdef HAVE_LIBDV - &mpcodecs_ad_libdv, + &ad_libdv_info, #endif #ifndef ENABLE_GPL_ONLY - &mpcodecs_ad_real, + &ad_real_info, #endif - &mpcodecs_ad_lavc, - &mpcodecs_ad_null, - + &ad_lavc_info, + &ad_null_info }; -static unsigned int nddrivers=sizeof(mpcodecs_ad_drivers)/sizeof(ad_functions_t*); - void libmpcodecs_ad_register_options(M_Config& cfg) { unsigned i; - for(i=0;i<nddrivers;i++) { - if(mpcodecs_ad_drivers[i]) - if(mpcodecs_ad_drivers[i]->options) - cfg.register_options(mpcodecs_ad_drivers[i]->options); - if(mpcodecs_ad_drivers[i]==&mpcodecs_ad_null) break; + for (i=0; mpcodecs_ad_drivers[i] != &ad_null_info; i++) { + if(mpcodecs_ad_drivers[i]->options) + cfg.register_options(mpcodecs_ad_drivers[i]->options); } } -const ad_functions_t* afm_find_driver(const std::string& name) { +const ad_info_t* afm_find_driver(const std::string& name) { unsigned i; - for (i=0; mpcodecs_ad_drivers[i] != &mpcodecs_ad_null; i++) { - if(name==mpcodecs_ad_drivers[i]->info->driver_name){ + for (i=0; mpcodecs_ad_drivers[i] != &ad_null_info; i++) { + if(name==mpcodecs_ad_drivers[i]->driver_name) return mpcodecs_ad_drivers[i]; - } } return NULL; } -const audio_probe_t* afm_probe_driver(Opaque& ctx,sh_audio_t *sh,audio_filter_info_t& afi) { +Audio_Decoder* afm_probe_driver(sh_audio_t& sh,audio_filter_info_t& afi) { unsigned i; - const audio_probe_t* probe; - for (i=0; mpcodecs_ad_drivers[i] != &mpcodecs_ad_null; i++) { - mpxp_v<<"Probing: "<<mpcodecs_ad_drivers[i]->info->driver_name<<std::endl; - if((probe=mpcodecs_ad_drivers[i]->probe(sh->wtag))!=NULL) { - Opaque* priv=mpcodecs_ad_drivers[i]->preinit(*probe,sh,afi); - mpxp_v<<"Driver: "<<mpcodecs_ad_drivers[i]->info->driver_name<<" supports these outfmt for "; - fourcc(mpxp_v,sh->wtag); + Audio_Decoder* drv=NULL; + for (i=0; mpcodecs_ad_drivers[i] != &ad_null_info; i++) { + mpxp_v<<"Probing: "<<mpcodecs_ad_drivers[i]->driver_name; + try { + /* Set up some common usefull defaults. ad->preinit() can override these: */ +#ifdef WORDS_BIGENDIAN + sh.afmt=AFMT_S16_BE; +#else + sh.afmt=AFMT_S16_LE; +#endif + sh.rate=0; + sh.o_bps=0; + drv=mpcodecs_ad_drivers[i]->query_interface(sh,afi,sh.wtag); + mpxp_v<<"ok"<<std::endl; + mpxp_v<<"Driver: "<<mpcodecs_ad_drivers[i]->driver_name<<" supports these outfmt for "; + fourcc(mpxp_v,sh.wtag); mpxp_v<<std::endl; + audio_probe_t probe=drv->get_probe_information(); for(i=0;i<Audio_MaxOutSample;i++) { - mpxp_v<<std::hex<<probe->sample_fmt[i]<<" "; - if(probe->sample_fmt[i]==-1||probe->sample_fmt[i]==0) break; + mpxp_v<<std::hex<<probe.sample_fmt[i]<<" "; + if(probe.sample_fmt[i]==unsigned(-1)||probe.sample_fmt[i]==0) break; } mpxp_v<<std::endl; - mpcodecs_ad_drivers[i]->uninit(*priv); - delete priv; - return probe; + break; + } catch (const bad_format_exception& ) { + mpxp_v<<"failed"<<std::endl; + delete drv; drv=NULL; + continue; } } - return NULL; + return drv; } -void afm_help(void) { - unsigned i; - mpxp_info<<"Available audio codec families/drivers:"<<std::endl; - for(i=0;i<nddrivers;i++) { - if(mpcodecs_ad_drivers[i]) - if(mpcodecs_ad_drivers[i]->options) - mpxp_info<<"\t"<<std::left<<std::setw(10)<<mpcodecs_ad_drivers[i]->info->driver_name<<" "<<mpcodecs_ad_drivers[i]->info->descr<<std::endl; - } - mpxp_info<<std::endl; +void afm_help() { + unsigned i; + mpxp_info<<"Available audio codec families/drivers:"<<std::endl; + for (i=0; mpcodecs_ad_drivers[i] != &ad_null_info; i++) { + if(mpcodecs_ad_drivers[i]) + if(mpcodecs_ad_drivers[i]->options) + mpxp_info<<"\t"<<std::left<<std::setw(10)<<mpcodecs_ad_drivers[i]->driver_name<<" "<<mpcodecs_ad_drivers[i]->descr<<std::endl; + } + mpxp_info<<std::endl; } +} //namespace usr \ No newline at end of file Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2013-06-10 07:27:20 UTC (rev 650) +++ mplayerxp/libmpcodecs/ad.h 2013-06-11 14:37:50 UTC (rev 651) @@ -8,57 +8,59 @@ #include "xmpcore/xmp_enums.h" #include "libao3/afmt.h" -struct ad_info_t { - const char *descr; /* driver description ("Autodesk FLI/FLC Animation decoder" */ - const char *driver_name; /* driver name ("dshow") */ - const char *author; /* interface author/maintainer */ - const char *url; /* URL of homepage */ -}; +namespace usr { + struct mpxp_options_t; + enum { + ADCTRL_RESYNC_STREAM=0, + ADCTRL_SKIP_FRAME =1 + }; -enum { - ADCTRL_RESYNC_STREAM=0, - ADCTRL_SKIP_FRAME =1 -}; + enum { + Audio_MaxOutSample =16, + }; -enum { - Audio_MaxOutSample =16, -}; + typedef enum { + ACodecStatus_Working =3, + ACodecStatus_Problems =2, + ACodecStatus_Untested =1, + ACodecStatus_NotWorking =0, + }acodec_status_e; -typedef enum { - ACodecStatus_Working =3, - ACodecStatus_Problems =2, - ACodecStatus_Untested =1, - ACodecStatus_NotWorking =0, -}acodec_status_e; + struct audio_probe_t { + const char* driver; + const char* codec_dll; + uint32_t wtag; + acodec_status_e status; + unsigned sample_fmt[Audio_MaxOutSample]; + }; -struct audio_probe_t { - const char* driver; - const char* codec_dll; - uint32_t wtag; - acodec_status_e status; - unsigned sample_fmt[Audio_MaxOutSample]; -}; + struct audio_filter_info_t { + af_stream_t* afilter; + int afilter_inited; + }; -struct audio_filter_info_t { - af_stream_t* afilter; - int afilter_inited; -}; + class Audio_Decoder : public Opaque { + public: + Audio_Decoder(sh_audio_t&,audio_filter_info_t&,uint32_t wtag) { UNUSED(wtag); } + virtual ~Audio_Decoder() {} -/* interface of video decoder drivers */ -struct ad_functions_t -{ - const ad_info_t* info; - const mpxp_option_t* options;/**< Optional: MPlayerXP's option related */ - const audio_probe_t*(* __FASTCALL__ probe)(uint32_t wtag); - Opaque* (* __FASTCALL__ preinit)(const audio_probe_t&,sh_audio_t*,audio_filter_info_t&); - MPXP_Rc (* __FASTCALL__ init)(Opaque& ctx); - void (* __FASTCALL__ uninit)(Opaque& ctx); - MPXP_Rc (*control_ad)(Opaque& ctx,int cmd,any_t* arg, ...); - unsigned (* __FASTCALL__ decode)(Opaque& ctx,unsigned char *buf,unsigned minlen,unsigned maxlen,float& pts); -}; + virtual unsigned run(unsigned char *buf,unsigned minlen,unsigned maxlen,float& pts) = 0; + virtual MPXP_Rc ctrl(int cmd,any_t* arg) = 0; + virtual audio_probe_t get_probe_information() const = 0; + }; -extern const ad_functions_t* afm_find_driver(const std::string& name); -extern const audio_probe_t* afm_probe_driver(Opaque& ctx,sh_audio_t*sh,audio_filter_info_t& afi); -inline float FIX_APTS(sh_audio_t* sh_audio,float& pts,unsigned in_size) { return sh_audio->i_bps?(pts+float(in_size))/float(sh_audio->i_bps):pts; } + struct ad_info_t { + const char* descr; /* driver description ("Autodesk FLI/FLC Animation decoder" */ + const char* driver_name; /* driver name ("dshow") */ + const char* author; /* interface author/maintainer */ + const char* url; /* URL of homepage */ + Audio_Decoder* (*query_interface)(sh_audio_t&,audio_filter_info_t&,uint32_t wtag); + const mpxp_option_t* options; + }; + const ad_info_t* afm_find_driver(const std::string& name); + Audio_Decoder* afm_probe_driver(sh_audio_t& sh,audio_filter_info_t& afi); + inline float FIX_APTS(sh_audio_t& sh_audio,float& pts,unsigned in_size) { return sh_audio.i_bps?(pts+float(in_size))/float(sh_audio.i_bps):pts; } +} //namespace usr + #endif Modified: mplayerxp/libmpcodecs/ad_a52.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_a52.cpp 2013-06-10 07:27:20 UTC (rev 650) +++ mplayerxp/libmpcodecs/ad_a52.cpp 2013-06-11 14:37:50 UTC (rev 651) @@ -8,6 +8,7 @@ #include <assert.h> #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" +#include "liba52/a52.h" #include "codecs_ld.h" #include "mplayerxp.h" @@ -17,41 +18,32 @@ #include "osdep/mm_accel.h" #include "mplayerxp.h" -#include "liba52/a52.h" #include "libao3/afmt.h" #include "libao3/audio_out.h" #include "postproc/af.h" -struct a52_private_t : public Opaque { - a52_private_t(); - virtual ~a52_private_t(); +namespace usr { + class a52_decoder : public Audio_Decoder { + public: + a52_decoder(sh_audio_t&,audio_filter_info_t&,uint32_t wtag); + virtual ~a52_decoder(); - sh_audio_t* sh; - float last_pts; -}; -a52_private_t::a52_private_t() {} -a52_private_t::~a52_private_t() {} + virtual unsigned run(unsigned char *buf,unsigned minlen,unsigned maxlen,float& pts); + virtual MPXP_Rc ctrl(int cmd,any_t* arg); + virtual audio_probe_t get_probe_information() const; + private: + int printinfo() const; + int fillbuffer(float& pts); -static const int MAX_AC3_FRAME=3840; + a52_state_t* mpxp_a52_state; + uint32_t mpxp_a52_accel; + uint32_t mpxp_a52_flags; + sh_audio_t& sh; + float last_pts; + const audio_probe_t* probe; + static const int MAX_AC3_FRAME=3840; + }; -a52_state_t* mpxp_a52_state; -uint32_t mpxp_a52_accel=0; -uint32_t mpxp_a52_flags=0; - -static const ad_info_t info = -{ - "liba52 AC3 driver", - "liba52", - "Nickols_K", - "build-in" -}; - -static const mpxp_option_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL} -}; - -LIBAD_EXTERN(a52) - static const audio_probe_t probes[] = { { "liba52", "liba52", 0x2000, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, { "liba52", "liba52", 0x20736D, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S16_LE} }, @@ -61,56 +53,47 @@ { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} }; -static const audio_probe_t* __FASTCALL__ probe(uint32_t wtag) { - unsigned i; - for(i=0;probes[i].driver;i++) - if(wtag==probes[i].wtag) - return &probes[i]; - return NULL; -} - -int a52_fillbuff(a52_private_t& priv,float& pts){ +int a52_decoder::fillbuffer(float& pts){ int length=0; int flags=0; int sample_rate=0; int bit_rate=0; float apts=0.,null_pts; - sh_audio_t* sh_audio = priv.sh; - sh_audio->a_in_buffer_len=0; + sh.a_in_buffer_len=0; /* sync frame:*/ while(1){ - while(sh_audio->a_in_buffer_len<8){ - int c=demux_getc_r(*sh_audio->ds,apts?null_pts:apts); - if(c<0) { priv.last_pts=pts=apts; return -1; } /* EOF*/ - sh_audio->a_in_buffer[sh_audio->a_in_buffer_len++]=c; + while(sh.a_in_buffer_len<8){ + int c=demux_getc_r(*sh.ds,apts?null_pts:apts); + if(c<0) { last_pts=pts=apts; return -1; } /* EOF*/ + sh.a_in_buffer[sh.a_in_buffer_len++]=c; } - if(sh_audio->wtag!=0x2000) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8); - length = a52_syncinfo ((uint8_t*)sh_audio->a_in_buffer, &flags, &sample_rate, &bit_rate); + if(sh.wtag!=0x2000) swab(sh.a_in_buffer,sh.a_in_buffer,8); + length = a52_syncinfo ((uint8_t*)sh.a_in_buffer, &flags, &sample_rate, &bit_rate); if(length>=7 && length<=MAX_AC3_FRAME) break; /* we're done.*/ /* bad file => resync*/ - if(sh_audio->wtag!=0x2000) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8); - memmove(sh_audio->a_in_buffer,sh_audio->a_in_buffer+1,7); - --sh_audio->a_in_buffer_len; + if(sh.wtag!=0x2000) swab(sh.a_in_buffer,sh.a_in_buffer,8); + memmove(sh.a_in_buffer,sh.a_in_buffer+1,7); + --sh.a_in_buffer_len; apts=0; } - MSG_DBG2("a52: len=%d flags=0x%X %d Hz %d bit/s\n",length,flags,sample_rate,bit_rate); - sh_audio->rate=sample_rate; - sh_audio->i_bps=bit_rate/8; - demux_read_data_r(*sh_audio->ds,(uint8_t*)sh_audio->a_in_buffer+8,length-8,apts?null_pts:apts); - if(sh_audio->wtag!=0x2000) swab(sh_audio->a_in_buffer+8,sh_audio->a_in_buffer+8,length-8); - priv.last_pts=pts=apts; - if(crc16_block((uint8_t*)sh_audio->a_in_buffer+2,length-2)!=0) - MSG_STATUS("a52: CRC check failed! \n"); + mpxp_dbg2<<"a52: len="<<length<<" flags=0x"<<std::hex<<flags<<" "<<sample_rate<<" Hz "<<bit_rate<<" bit/s"<<std::endl; + sh.rate=sample_rate; + sh.i_bps=bit_rate/8; + demux_read_data_r(*sh.ds,(uint8_t*)sh.a_in_buffer+8,length-8,apts?null_pts:apts); + if(sh.wtag!=0x2000) swab(sh.a_in_buffer+8,sh.a_in_buffer+8,length-8); + last_pts=pts=apts; + if(crc16_block((uint8_t*)sh.a_in_buffer+2,length-2)!=0) + mpxp_status<<"a52: CRC check failed!"<<std::endl; return length; } /* returns: number of available channels*/ -static int a52_printinfo(sh_audio_t *sh_audio){ +int a52_decoder::printinfo() const { int flags, sample_rate, bit_rate; const char* mode="unknown"; int channels=0; - a52_syncinfo ((uint8_t*)sh_audio->a_in_buffer, &flags, &sample_rate, &bit_rate); + a52_syncinfo ((uint8_t*)sh.a_in_buffer, &flags, &sample_rate, &bit_rate); switch(flags&A52_CHANNEL_MASK){ case A52_CHANNEL: mode="channel"; channels=2; break; case A52_MONO: mode="mono"; channels=1; break; @@ -124,20 +107,22 @@ case A52_CHANNEL2: mode="channel2"; channels=2; break; case A52_DOLBY: mode="dolby"; channels=2; break; } - MSG_INFO("AC3: %d.%d (%s%s) %d Hz %3.1f kbit/s Out: %u-bit\n", - channels, (flags&A52_LFE)?1:0, - mode, (flags&A52_LFE)?"+lfe":"", - sample_rate, bit_rate*0.001f, - afmt2bps(sh_audio->afmt)*8); - return (flags&A52_LFE) ? (channels+1) : channels; + mpxp_info<<"AC3: "<<channels<<"."<<((flags&A52_LFE)?1:0)<<" ("<<mode<<((flags&A52_LFE)?"+lfe":"")<<") "<<sample_rate<<" Hz "<<(bit_rate*0.001f)<<"f kbit/s Out: "<<(afmt2bps(sh.afmt)*8)<<"-bit"<<std::endl; + return (flags&A52_LFE) ? (channels+1) : channels; } -Opaque* preinit(const audio_probe_t& probe,sh_audio_t *sh,audio_filter_info_t& afi) +a52_decoder::a52_decoder(sh_audio_t& _sh,audio_filter_info_t& afi,uint32_t wtag) + :Audio_Decoder(_sh,afi,wtag) + ,sh(_sh) { - UNUSED(probe); - a52_private_t* ctx=new(zeromem) a52_private_t; - /* Dolby AC3 audio: */ - /* however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */ + unsigned i; + for(i=0;probes[i].driver;i++) + if(wtag==probes[i].wtag) + probe=&probes[i]; + if(!probe) throw bad_format_exception(); + + /* Dolby AC3 audio: */ + /* however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */ #ifdef WORDS_BIGENDIAN #define A52_FMT32 AFMT_S32_BE #define A52_FMT24 AFMT_S24_BE @@ -145,41 +130,26 @@ #define A52_FMT32 AFMT_S32_LE #define A52_FMT24 AFMT_S24_LE #endif - sh->afmt=bps2afmt(2); - if(af_query_fmt(afi.afilter,mpaf_format_e(AFMT_FLOAT32)) == MPXP_Ok|| - af_query_fmt(afi.afilter,mpaf_format_e(A52_FMT32)) == MPXP_Ok || - af_query_fmt(afi.afilter,mpaf_format_e(A52_FMT24)) == MPXP_Ok) { - sh->afmt=AFMT_FLOAT32; - } - sh->audio_out_minsize=mp_conf.ao_channels*afmt2bps(sh->afmt)*256*6; - sh->audio_in_minsize=MAX_AC3_FRAME; - ctx->sh=sh; - return ctx; -} + sh.afmt=bps2afmt(2); + if(af_query_fmt(afi.afilter,mpaf_format_e(AFMT_FLOAT32)) == MPXP_Ok|| + af_query_fmt(afi.afilter,mpaf_format_e(A52_FMT32)) == MPXP_Ok || + af_query_fmt(afi.afilter,mpaf_format_e(A52_FMT24)) == MPXP_Ok) sh.afmt=AFMT_FLOAT32; + sh.audio_out_minsize=mp_conf.ao_channels*afmt2bps(sh.afmt)*256*6; + sh.audio_in_minsize=MAX_AC3_FRAME; -MPXP_Rc init(Opaque& ctx) -{ - a52_private_t& priv=static_cast<a52_private_t&>(ctx); - sh_audio_t* sh_audio = priv.sh; sample_t level=1, bias=384; float pts; int flags=0; /* Dolby AC3 audio:*/ mpxp_a52_accel = mpxp_context().mplayer_accel; mpxp_a52_state=a52_init (mpxp_a52_accel); - if (mpxp_a52_state == NULL) { - MSG_ERR("A52 init failed\n"); - return MPXP_False; - } - if(a52_fillbuff(priv,pts)<0){ - MSG_ERR("A52 sync failed\n"); - return MPXP_False; - } + if (mpxp_a52_state == NULL) throw bad_format_exception(); + if(fillbuffer(pts)<0) throw bad_format_exception(); /* 'a52 cannot upmix' hotfix:*/ - a52_printinfo(priv.sh); - sh_audio->nch=mp_conf.ao_channels; - while(sh_audio->nch>0){ - switch(sh_audio->nch){ + printinfo(); + sh.nch=mp_conf.ao_channels; + while(sh.nch>0){ + switch(sh.nch){ case 1: mpxp_a52_flags=A52_MONO; break; /* case 2: mpxp_a52_flags=A52_STEREO; break; */ case 2: mpxp_a52_flags=A52_DOLBY; break; @@ -191,41 +161,34 @@ } /* test:*/ flags=mpxp_a52_flags|A52_ADJUST_LEVEL; - MSG_V("A52 flags before a52_frame: 0x%X\n",flags); - if (a52_frame (mpxp_a52_state, (uint8_t*)sh_audio->a_in_buffer, &flags, &level, bias)){ - MSG_ERR("a52: error decoding frame -> nosound\n"); - return MPXP_False; - } - MSG_V("A52 flags after a52_frame: 0x%X\n",flags); + mpxp_v<<"A52 flags before a52_frame: 0x"<<std::hex<<flags<<std::endl; + if (a52_frame (mpxp_a52_state, (uint8_t*)sh.a_in_buffer, &flags, &level, bias)) throw bad_format_exception(); + mpxp_v<<"A52 flags after a52_frame: 0x"<<std::hex<<flags<<std::endl; /* frame decoded, let's init resampler:*/ - if(afmt2bps(sh_audio->afmt)==4) { - if(a52_resample_init_float(mpxp_a52_state,mpxp_a52_accel,flags,sh_audio->nch)) break; + if(afmt2bps(sh.afmt)==4) { + if(a52_resample_init_float(mpxp_a52_state,mpxp_a52_accel,flags,sh.nch)) break; } else { - if(a52_resample_init(mpxp_a52_state,mpxp_a52_accel,flags,sh_audio->nch)) break; + if(a52_resample_init(mpxp_a52_state,mpxp_a52_accel,flags,sh.nch)) break; } - --sh_audio->nch; /* try to decrease no. of channels*/ + --sh.nch; /* try to decrease no. of channels*/ } - if(sh_audio->nch<=0){ - MSG_ERR("a52: no resampler. try different channel setup!\n"); - return MPXP_False; - } - return MPXP_Ok; + if(sh.nch<=0) throw bad_format_exception(); } -void uninit(Opaque& ctx) { UNUSED(ctx); } +a52_decoder::~a52_decoder() {} -MPXP_Rc control_ad(Opaque& ctx,int cmd,any_t* arg, ...) +audio_probe_t a52_decoder::get_probe_information() const { return *probe; } + +MPXP_Rc a52_decoder::ctrl(int cmd,any_t* arg) { - a52_private_t& priv=static_cast<a52_private_t&>(ctx); - sh_audio_t* sh = priv.sh; UNUSED(arg); switch(cmd) { case ADCTRL_RESYNC_STREAM: - sh->a_in_buffer_len=0; // reset ACM/DShow audio buffer + sh.a_in_buffer_len=0; // reset ACM/DShow audio buffer return MPXP_True; case ADCTRL_SKIP_FRAME: { float pts; - a52_fillbuff(priv,pts); // skip AC3 frame + fillbuffer(pts); // skip AC3 frame return MPXP_True; } default: @@ -234,35 +197,50 @@ return MPXP_Unknown; } -unsigned decode(Opaque& ctx,unsigned char *buf,unsigned minlen,unsigned maxlen,float& pts) +unsigned a52_decoder::run(unsigned char *buf,unsigned minlen,unsigned maxlen,float& pts) { - a52_private_t& priv=static_cast<a52_private_t&>(ctx); - sh_audio_t* sh_audio = priv.sh; sample_t level=1, bias=384; int flags=mpxp_a52_flags|A52_ADJUST_LEVEL; unsigned i; unsigned len=0; UNUSED(minlen); UNUSED(maxlen); - if(!sh_audio->a_in_buffer_len) { - if(a52_fillbuff(priv,pts)<0) return len; /* EOF */ - } else pts=priv.last_pts; - sh_audio->a_in_buffer_len=0; - if (a52_frame (mpxp_a52_state, (uint8_t*)sh_audio->a_in_buffer, &flags, &level, bias)){ - MSG_WARN("a52: error decoding frame\n"); + if(!sh.a_in_buffer_len) { + if(fillbuffer(pts)<0) return len; /* EOF */ + } else pts=last_pts; + sh.a_in_buffer_len=0; + if (a52_frame (mpxp_a52_state, (uint8_t*)sh.a_in_buffer, &flags, &level, bias)){ + mpxp_warn<<"a52: error decoding frame"<<std::endl; return len; } // a52_dynrng(&mpxp_a52_state, NULL, NULL); len=0; for (i = 0; i < 6; i++) { if (a52_block (mpxp_a52_state)){ - MSG_WARN("a52: error at resampling\n"); + mpxp_warn<<"a52: error at resampling"<<std::endl; break; } - if(afmt2bps(sh_audio->afmt)==4) + if(afmt2bps(sh.afmt)==4) len+=4*a52_resample32(a52_samples(mpxp_a52_state),(float *)&buf[len]); else len+=2*a52_resample(a52_samples(mpxp_a52_state),(int16_t *)&buf[len]); } return len; } + +static const mpxp_option_t options[] = { + { NULL, NULL, 0, 0, 0, 0, NULL} +}; + +static Audio_Decoder* query_interface(sh_audio_t& sh,audio_filter_info_t& afi,uint32_t wtag) { return new(zeromem) a52_decoder(sh,afi,wtag); } + +extern const ad_info_t ad_a52_info = { + "liba52 AC3 driver", + "liba52", + "Nickols_K", + "build-in", + query_interface, + options +}; + +} // namespace usr \ No newline at end of file Modified: mplayerxp/libmpcodecs/ad_dca.cpp =================================================================== --- mplayerxp/libmpcodecs/ad_dca.cpp 2013-06-10 07:27:20 UTC (rev 650) +++ mplayerxp/libmpcodecs/ad_dca.cpp 2013-06-11 14:37:50 UTC (rev 651) @@ -22,35 +22,29 @@ #include "libao3/audio_out.h" #include "postproc/af.h" -static const unsigned MAX_AC5_FRAME=4096; +namespace usr { + class dca_decoder : public Audio_Decoder { + public: + dca_decoder(sh_audio_t&,audio_filter_info_t&,uint32_t wtag); + virtual ~dca_decoder(); -dca_state_t* mpxp_dca_state; -uint32_t mpxp_dca_accel=0; -uint32_t mpxp_dca_flags=0; + virtual unsigned run(unsigned char *buf,unsigned minlen,unsigned maxlen,float& pts); + virtual MPXP_Rc ctrl(int cmd,any_t* arg); + virtual audio_probe_t get_probe_information() const; + private: + int fillbuffer(float& pts); + int printinfo() const; -struct dca_private_t : public Opaque { - dca_private_t(); - virtual ~dca_private_t(); + float last_pts; + sh_audio_t& sh; + const audio_probe_t*probe; - float last_pts; - sh_audio_t* sh; -}; -dca_private_t::dca_private_t() {} -dca_private_t::~dca_private_t() {} + dca_state_t* mpxp_dca_state; + uint32_t mpxp_dca_accel; + uint32_t mpxp_dca_flags; + static const unsigned MAX_AC5_FRAME=4096; + }; -static const ad_info_t info = { - "DTS Coherent Acoustics", - "libdca", - "Nickols_K", - "build-in" -}; - -static const mpxp_option_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL} -}; - -LIBAD_EXTERN(dca) - static const audio_probe_t probes[] = { { "libdca", "libdca", 0x86, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE} }, { "libdca", "libdca", 0x2001, ACodecStatus_Working, {AFMT_FLOAT32, AFMT_S24_LE, AFMT_S16_LE} }, @@ -63,51 +57,42 @@ { NULL, NULL, 0x0, ACodecStatus_NotWorking, {AFMT_S8}} }; -static const audio_probe_t* __FASTCALL__ probe(uint32_t wtag) { - unsigned i; - for(i=0;probes[i].driver;i++) - if(wtag==probes[i].wtag) - return &probes[i]; - return NULL; -} - -int dca_fillbuff(dca_private_t& priv,float& pts){ +int dca_decoder::fillbuffer(float& pts){ int length=0,flen=0; int flags=0; int sample_rate=0; int bit_rate=0; float apts=0.,null_pts; - sh_audio_t* sh_audio=priv.sh; - sh_audio->a_in_buffer_len=0; + sh.a_in_buffer_len=0; /* sync frame:*/ while(1){ - while(sh_audio->a_in_buffer_len<16){ - int c=demux_getc_r(*sh_audio->ds,apts?null_pts:apts); - if(c<0) { priv.last_pts=pts=apts; return -1; } /* EOF*/ - sh_audio->a_in_buffer[sh_audio->a_in_buffer_len++]=c; + while(sh.a_in_buffer_len<16){ + int c=demux_getc_r(*sh.ds,apts?null_pts:apts); + if(c<0) { last_pts=pts=apts; return -1; } /* EOF*/ + sh.a_in_buffer[sh.a_in_buffer_len++]=c; } - length = dca_syncinfo (mpxp_dca_state,reinterpret_cast<uint8_t*>(sh_audio->a_in_buffer), reinterpret_cast<int *>(&flags), &sample_rate, &bit_rate, &flen); - if(length>=16 && length<=MAX_AC5_FRAME) break; /* we're done.*/ + length = dca_syncinfo (mpxp_dca_state,reinterpret_cast<uint8_t*>(sh.a_in_buffer), reinterpret_cast<int *>(&flags), &sample_rate, &bit_rate, &flen); + if(length>=16 && length<=int(MAX_AC5_FRAME)) break; /* we're done.*/ /* bad file => resync*/ - memmove(sh_audio->a_in_buffer,sh_audio->a_in_buffer+1,15); - --sh_audio->a_in_buffer_len; + memmove(sh.a_in_buffer,sh.a_in_buffer+1,15); + --sh.a_in_buffer_len; apts=0; } - MSG_DBG2("dca[%08X]: len=%d flags=0x%X %d Hz %d bit/s frame=%u\n",*((long *)sh_audio->a_in_buffer),length,flags,sample_rate,bit_rate,flen); - sh_audio->rate=sample_rate; - sh_audio->i_bps=bit_rate/8; - demux_read_data_r(*sh_audio->ds,reinterpret_cast<unsigned char*>(sh_audio->a_in_buffer+16),length-16,apts?null_pts:apts); - priv.last_pts=pts=apts; + mpxp_dbg2<<"dca["<<std::hex<<std::setfill('0')<<std::setw(8)<<(*((long *)sh.a_in_buffer))<<"]: len="<<length<<" flags=0x"<<std::hex<<flags<<" "<<sample_rate<<" Hz "<<bit_rate<<" bit/s frame="<<flen<<std::endl; + sh.rate=sample_rate; + sh.i_bps=bit_rate/8; + demux_read_data_r(*sh.ds,reinterpret_cast<unsigned char*>(sh.a_in_buffer+16),length-16,apts?null_pts:apts); + last_pts=pts=apts; return length; } /* returns: number of available channels*/ -static int dca_printinfo(sh_audio_t *sh_audio){ - int flags, sample_rate, bit_rate,flen,length; +int dca_decoder::printinfo() const { + int flags, sample_rate, bit_rate,flen; const char* mode="unknown"; int channels=0; - length=dca_syncinfo (mpxp_dca_state,reinterpret_cast<uint8_t*>(sh_audio->a_in_buffer), reinterpret_cast<int*>(&flags), &sample_rate, &bit_rate,&flen); + dca_syncinfo (mpxp_dca_state,reinterpret_cast<uint8_t*>(sh.a_in_buffer), reinterpret_cast<int*>(&flags), &sample_rate, &bit_rate,&flen); switch(flags&DCA_CHANNEL_MASK){ case DCA_CHANNEL: mode="channel"; channels=2; break; case DCA_MONO: mode="mono"; channels=1; break; @@ -121,17 +106,19 @@ case DCA_DOLBY: mode="dolby"; channels=2; break; default: channels=0; break; } - MSG_INFO("DCA: %d.%d (%s%s) %d Hz %3.1f kbit/s Out: %u-bit\n", - channels, (flags&DCA_LFE)?1:0, - mode, (flags&DCA_LFE)?"+lfe":"", - sample_rate, bit_rate*0.001f, - afmt2bps(sh_audio->afmt)*8); + mpxp_info<<"DCA: "<<channels<<"."<<((flags&DCA_LFE)?1:0)<<" ("<<mode<<((flags&DCA_LFE)?"+lfe":"")<<") "<<sample_rate<<" Hz "<<bit_rate*0.001f<<" kbit/s Out: "<<(afmt2bps(sh.afmt)*8)<<"-bit"<<std::endl; return (flags&DCA_LFE) ? (channels+1) : channels; } -Opaque* preinit(const audio_probe_t& probe,sh_audio_t *sh,audio_filter_info_t& afi) +dca_decoder::dca_decoder(sh_audio_t& _sh,audio_filter_info_t& afi,uint32_t wtag) + :Audio_Decoder(_sh,afi,wtag) + ,sh(_sh) { - UNUSED(probe); + unsigned i; + for(i=0;probes[i].driver;i++) + if(wtag==probes[i].wtag) + probe=&probes[i]; + if(!probe) throw bad_format_exception(); /* DTS audio: however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */ #ifdef WORDS_BIGENDIAN @@ -141,43 +128,29 @@ #define DCA_FMT32 AFMT_S32_LE #define DCA_FMT24 AFMT_S24_LE #endif - sh->afmt=bps2afmt(2); + sh.afmt=bps2afmt(2); if( af_query_fmt(afi.afilter,afmt2mpaf(AFMT_FLOAT32)) == MPXP_Ok|| af_query_fmt(afi.afilter,afmt2mpaf(DCA_FMT32)) == MPXP_Ok || - af_query_fmt(afi.afilter,afmt2mpaf(DCA_FMT24)) == MPXP_Ok) - { - sh->afmt=AFMT_FLOAT32; + af_query_fmt(afi.afilter,afmt2mpaf(DCA_FMT24)) == MPXP_Ok) { + sh.afmt=AFMT_FLOAT32; } - sh->audio_out_minsize=mp_conf.ao_channels*afmt2bps(sh->afmt)*256*8; - sh->audio_in_minsize=MAX_AC5_FRAME; - dca_private_t* priv = new(zeromem) dca_private_t; - priv->sh = sh; - return priv; -} + sh.audio_out_minsize=mp_conf.ao_channels*afmt2bps(sh.afmt)*256*8; + sh.audio_in_minsize=MAX_AC5_FRAME; -MPXP_Rc init(Opaque& ctx) -{ - dca_private_t& priv=static_cast<dca_private_t&>(ctx); - sh_audio_t* sh_audio = priv.sh; sample_t level=1, bias=384; float pts; int flags=0; /* Dolby AC3 audio:*/ mpxp_dca_accel = mpxp_context().mplayer_accel; mpxp_dca_state = dca_init(mpxp_dca_accel); - if (mpxp_dca_state == NULL) { - MSG_ERR("dca init failed\n"); - return MPXP_False; - } - if(dca_fillbuff(priv,pts)<0){ - MSG_ERR("dca sync failed\n"); - return MPXP_False; - } + if (mpxp_dca_state == NULL) throw bad_format_exception(); + if(fillbuffer(pts)<0) throw bad_format_exception(); + /* 'dca cannot upmix' hotfix:*/ - dca_printinfo(sh_audio); - sh_audio->nch=mp_conf.ao_channels; - while(sh_audio->nch>0){ - switch(sh_audio->nch){ + printinfo(); + sh.nch=mp_conf.ao_channels; + while(sh.nch>0){ + switch(sh.nch){ case 1: mpxp_dca_flags=DCA_MONO; break; case 2: mpxp_dca_flags=DCA_STEREO; break; /* case 2: mpxp_dca_flags=DCA_DOLBY; break; */ @@ -189,40 +162,34 @@ } /* test:*/ flags=mpxp_dca_flags|DCA_ADJUST_LEVEL; - MSG_V("dca flags before dca_frame: 0x%X\n",flags); - if (dca_frame (mpxp_dca_state, reinterpret_cast<uint8_t*>(sh_audio->a_in_buffer), reinterpret_cast<int*>(&flags), &level, bias)){ - MSG_ERR("dca: error decoding frame -> nosound\n"); - return MPXP_False; - } - MSG_V("dca flags after dca_frame: 0x%X\n",flags); - if(afmt2bps(sh_audio->afmt)==4) { - if(dca_resample_init_float(mpxp_dca_state,mpxp_dca_accel,flags,sh_audio->nch)) break; + mpxp_v<<"dca flags before dca_frame: 0x"<<std::hex<<flags<<std::endl; + if (dca_frame (mpxp_dca_state, reinterpret_cast<uint8_t*>(sh.a_in_buffer), reinterpret_cast<int*>(&flag... [truncated message content] |
From: <nic...@us...> - 2013-06-12 14:05:13
|
Revision: 653 http://sourceforge.net/p/mplayerxp/code/653 Author: nickols_k Date: 2013-06-12 14:05:09 +0000 (Wed, 12 Jun 2013) Log Message: ----------- contantization Modified Paths: -------------- mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.cpp mplayerxp/libmpcodecs/libnuppelvideo/minilzo.cpp mplayerxp/libmpcodecs/vd_lavc.cpp mplayerxp/libmpcodecs/vd_libmpeg2.cpp mplayerxp/libmpdemux/demux_ac3.cpp mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_bmp.cpp mplayerxp/libmpdemux/demux_dca.cpp mplayerxp/libmpdemux/demux_film.cpp mplayerxp/libmpdemux/demux_flac.cpp mplayerxp/libmpdemux/demux_fli.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_nsv.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_smjpeg.cpp mplayerxp/libmpdemux/demux_snd_au.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpdemux/demux_viv.cpp mplayerxp/libmpdemux/demux_voc.cpp mplayerxp/libmpdemux/demux_vqf.cpp mplayerxp/libmpdemux/demux_wav.cpp mplayerxp/libmpdemux/demux_y4m.cpp mplayerxp/libmpdemux/parse_mp4.cpp mplayerxp/libmpstream2/s_oss.cpp mplayerxp/libmpstream2/stream.cpp mplayerxp/libmpstream2/stream.h mplayerxp/libmpsub/vobsub.cpp mplayerxp/libvo2/osd_render.cpp mplayerxp/libvo2/osd_render_template.h mplayerxp/libvo2/video_out.cpp mplayerxp/libvo2/video_out.h mplayerxp/osdep/aclib_template.h mplayerxp/osdep/mplib.h mplayerxp/osdep/vbelib.cpp mplayerxp/postproc/af.cpp mplayerxp/postproc/af.h mplayerxp/postproc/af_ao3.cpp mplayerxp/postproc/af_channels.cpp mplayerxp/postproc/af_crystality.cpp mplayerxp/postproc/af_delay.cpp mplayerxp/postproc/af_dyn.cpp mplayerxp/postproc/af_echo3d.cpp mplayerxp/postproc/af_equalizer.cpp mplayerxp/postproc/af_export.cpp mplayerxp/postproc/af_extrastereo.cpp mplayerxp/postproc/af_ffenc.cpp mplayerxp/postproc/af_format.cpp mplayerxp/postproc/af_hrtf.cpp mplayerxp/postproc/af_internal.h mplayerxp/postproc/af_karaoke.cpp mplayerxp/postproc/af_lp.cpp mplayerxp/postproc/af_pan.cpp mplayerxp/postproc/af_raw.cpp mplayerxp/postproc/af_resample.cpp mplayerxp/postproc/af_scaletempo.cpp mplayerxp/postproc/af_sinesuppress.cpp mplayerxp/postproc/af_sub.cpp mplayerxp/postproc/af_surround.cpp mplayerxp/postproc/af_volnorm.cpp mplayerxp/postproc/af_volume.cpp mplayerxp/postproc/aflib.cpp mplayerxp/postproc/aflib.h mplayerxp/postproc/aflib_accel.h mplayerxp/postproc/libmenu/menu.cpp mplayerxp/postproc/libmenu/menu.h mplayerxp/postproc/libmenu/menu_console.cpp mplayerxp/postproc/libmenu/menu_list.cpp mplayerxp/postproc/libmenu/menu_list.h mplayerxp/postproc/libmenu/menu_txt.cpp mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf.h mplayerxp/postproc/vf_1bpp.cpp mplayerxp/postproc/vf_2xsai.cpp mplayerxp/postproc/vf_delogo.cpp mplayerxp/postproc/vf_denoise3d.cpp mplayerxp/postproc/vf_dint.cpp mplayerxp/postproc/vf_down3dright.cpp mplayerxp/postproc/vf_eq.cpp mplayerxp/postproc/vf_expand.cpp mplayerxp/postproc/vf_flip.cpp mplayerxp/postproc/vf_framestep.cpp mplayerxp/postproc/vf_il.cpp mplayerxp/postproc/vf_internal.h mplayerxp/postproc/vf_menu.cpp mplayerxp/postproc/vf_mirror.cpp mplayerxp/postproc/vf_noise.cpp mplayerxp/postproc/vf_ow.cpp mplayerxp/postproc/vf_palette.cpp mplayerxp/postproc/vf_panscan.cpp mplayerxp/postproc/vf_perspective.cpp mplayerxp/postproc/vf_pp.cpp mplayerxp/postproc/vf_raw.cpp mplayerxp/postproc/vf_rectangle.cpp mplayerxp/postproc/vf_rgb2bgr.cpp mplayerxp/postproc/vf_rotate.cpp mplayerxp/postproc/vf_scale.cpp mplayerxp/postproc/vf_smartblur.cpp mplayerxp/postproc/vf_softpulldown.cpp mplayerxp/postproc/vf_swapuv.cpp mplayerxp/postproc/vf_test.cpp mplayerxp/postproc/vf_unsharp.cpp mplayerxp/postproc/vf_vo2.cpp mplayerxp/postproc/vf_yuvcsp.cpp mplayerxp/postproc/vf_yuy2.cpp mplayerxp/postproc/vf_yvu9.cpp mplayerxp/xmpcore/xmp_aframe.cpp mplayerxp/xmpcore/xmp_aframe.h mplayerxp/xmpcore/xmp_image.cpp mplayerxp/xmpcore/xmp_image.h Modified: mplayerxp/libmpcodecs/dec_audio.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_audio.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpcodecs/dec_audio.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -174,7 +174,6 @@ unsigned& out_samplerate, unsigned& out_channels, unsigned& out_format) const { decaudio_priv_t& priv = reinterpret_cast<decaudio_priv_t&>(ad_private); sh_audio_t& sh = priv.parent; - char strbuf[200]; af_stream_t* afs=af_new(&sh); // input format: same as codec's output format: @@ -206,7 +205,7 @@ sh.af_bps = afs->output.rate*afs->output.nch*(afs->output.format&MPAF_BPS_MASK); - mpxp_v<<"AF_pre: af format: "<<afs->output.nch<<" ch, "<<afs->output.rate<<" hz, "<<mpaf_fmt2str(afs->output.format,strbuf,200) + mpxp_v<<"AF_pre: af format: "<<afs->output.nch<<" ch, "<<afs->output.rate<<" hz, "<<mpaf_fmt2str(afs->output.format) <<" af_bps="<<sh.af_bps<<std::endl; priv.afi.afilter=afs; @@ -219,7 +218,6 @@ unsigned out_minsize, unsigned out_maxsize) const { decaudio_priv_t& priv = reinterpret_cast<decaudio_priv_t&>(ad_private); sh_audio_t& sh = priv.parent; - char strbuf[200]; af_stream_t* afs=priv.afi.afilter; if(!afs) afs = af_new(&sh); @@ -254,7 +252,7 @@ sh.af_bps = afs->output.rate*afs->output.nch*(afs->output.format&MPAF_BPS_MASK); mpxp_v<<"AF_init: af format: "<<afs->output.nch<<" ch, "<<afs->output.rate - <<" hz, "<<mpaf_fmt2str(afs->output.format,strbuf,200)<<" af_bps="<<sh.af_bps<<std::endl; + <<" hz, "<<mpaf_fmt2str(afs->output.format)<<" af_bps="<<sh.af_bps<<std::endl; sh.a_buffer_size=out_maxsize; sh.a_buffer=new char [sh.a_buffer_size]; @@ -315,36 +313,25 @@ mpxp_dbg2<<"decaudio: "<<len<<" bytes "<<pts<<" pts min "<<minlen<<" max "<<maxlen<<" buflen "<<buflen<<" o_bps="<<sh.o_bps<<" f_bps="<<sh.af_bps<<std::endl; if(len==0 || !priv.afi.afilter) return 0; // EOF? // run the filters: - mp_aframe_t* afd; // filter input - mp_aframe_t* pafd; // filter output - afd=new_mp_aframe( sh.rate, - sh.nch, - afmt2mpaf(sh.afmt) - ,0); // xp_idx + mp_aframe_t* afd=new(zeromem) mp_aframe_t(sh.rate,sh.nch,afmt2mpaf(sh.afmt),0); // xp_idx afd->audio=buf; afd->len=len; - pafd=af_play(priv.afi.afilter,afd); + mp_aframe_t pafd=af_play(priv.afi.afilter,*afd); afd->audio=NULL; // fake no buffer - if(!pafd) { - mpxp_v<<"decaudio: filter error"<<std::endl; - return 0; // error - } + mpxp_dbg2<<"decaudio: "<<std::hex<<pafd.format<<" in="<<len<<" out="<<pafd.len<<" (min "<<minlen<<" max "<<maxlen<<" buf "<<buflen<<")"<<std::endl; - mpxp_dbg2<<"decaudio: "<<std::hex<<pafd->format<<" in="<<len<<" out="<<pafd->len<<" (min "<<minlen<<" max "<<maxlen<<" buf "<<buflen<<")"<<std::endl; - - cp_size=pafd->len; - cp_size=std::min(buflen,pafd->len); - memcpy(buf,pafd->audio,cp_size); - cp_tile=pafd->len-cp_size; + cp_size=pafd.len; + cp_size=std::min(buflen,pafd.len); + memcpy(buf,pafd.audio,cp_size); + cp_tile=pafd.len-cp_size; if(cp_tile) { - sh.af_buffer=&((char *)pafd->audio)[cp_size]; + sh.af_buffer=&((char *)pafd.audio)[cp_size]; sh.af_buffer_len=cp_tile; sh.af_pts = pts+(float)cp_size/(float)sh.af_bps; mpxp_dbg2<<"decaudio: afilter->cache "<<cp_tile<<" bytes "<<pts<<" pts"<<std::endl; } else sh.af_buffer_len=0; - if(pafd!=afd) free_mp_aframe(pafd); - free_mp_aframe(afd); + delete afd; return cp_size; } Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpcodecs/dec_video.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -186,16 +186,16 @@ print_codec_info(); } -void VD_Interface::draw_image(const mp_image_t* mpi) const +void VD_Interface::draw_image(const mp_image_t& smpi) const { decvideo_priv_t& priv=reinterpret_cast<decvideo_priv_t&>(vd_private); vf_stream_t* s; const unsigned h_step=16; - unsigned num_slices = mpi->h/h_step; + unsigned num_slices = smpi.h/h_step; s=priv.vfilter; - if(!(mpi->flags&(MP_IMGFLAG_DRAW_CALLBACK))){ - if(mpi->h%h_step) num_slices++; + if(!(smpi.flags&(MP_IMGFLAG_DRAW_CALLBACK))){ + if(smpi.h%h_step) num_slices++; if(priv.psi.vf_flags&VF_FLAGS_SLICES) { unsigned j,i,y; @@ -207,8 +207,8 @@ } y=0; for(i=0;i<num_slices;i++) { - ampi[i]=new_mp_image(mpi->w,y,h_step); - mpi_fake_slice(ampi[i],mpi,y,h_step); + ampi[i]=new(zeromem) mp_image_t(smpi.w,y,h_step); + ampi[i]->fake_slice(smpi,y,h_step); y+=h_step; } #ifdef _OPENMP @@ -218,13 +218,13 @@ for(i=j;i<priv.smp_num_cpus;i++) { mpxp_dbg2<<"parallel: dec_video.put_slice["<<ampi[i]->width<<"x"<<ampi[i]->height <<"] "<<ampi[i]->x<<" "<<ampi[i]->y<<" "<<ampi[i]->w<<" "<<ampi[i]->h<<std::endl; - vf_put_slice(s,ampi[i]); + vf_put_slice(s,*ampi[i]); } } for(;j<num_slices;j++) { mpxp_dbg2<<"par_tail: dec_video.put_slice["<<ampi[i]->width<<"x"<<ampi[i]->height <<"] "<<ampi[i]->x<<" "<<ampi[i]->y<<" "<<ampi[i]->w<<" "<<ampi[i]->h<<std::endl; - vf_put_slice(s,ampi[j]); + vf_put_slice(s,*ampi[j]); } } else @@ -234,16 +234,15 @@ for(i=0;i<num_slices;i++) { mpxp_dbg2<<"dec_video.put_slice["<<ampi[i]->width<<"x"<<ampi[i]->height <<"] "<<ampi[i]->x<<" "<<ampi[i]->y<<" "<<ampi[i]->w<<" "<<ampi[i]->h<<std::endl; - vf_put_slice(s,ampi[i]); + vf_put_slice(s,*ampi[i]); } } - for(i=0;i<num_slices;i++) free_mp_image(ampi[i]); + for(i=0;i<num_slices;i++) delete ampi[i]; } else { - mpxp_dbg2<<"Put whole frame["<<mpi->width<<"x"<<mpi->height<<"]"<<std::endl; - mp_image_t dmpi=*mpi; - vf_put_slice(s,&dmpi); + mpxp_dbg2<<"Put whole frame["<<smpi.width<<"x"<<smpi.height<<"]"<<std::endl; + vf_put_slice(s,smpi); } - free_mp_image(mpi); + delete &smpi; } } @@ -267,7 +266,7 @@ /* ------------------------ frame decoded. -------------------- */ if(!mpi) return 0; // error / skipped frame - draw_image(mpi); + draw_image(*mpi); t2=GetTimer();t=t2-t; tt = t*0.000001f; @@ -537,10 +536,9 @@ return mpi; } -void VD_Interface::draw_slice(const mp_image_t* mpi) const { +void VD_Interface::draw_slice(const mp_image_t& mpi) const { decvideo_priv_t& priv=reinterpret_cast<decvideo_priv_t&>(vd_private); vf_stream_t* vf = priv.vfilter; - mp_image_t dmpi = *mpi; - vf_put_slice(vf,&dmpi); + vf_put_slice(vf,mpi); } } // namespace usr \ No newline at end of file Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpcodecs/dec_video.h 2013-06-12 14:05:09 UTC (rev 653) @@ -23,8 +23,8 @@ virtual MPXP_Rc config_vf(int w, int h) const; virtual mp_image_t* get_image(int mp_imgtype, int mp_imgflag,int w, int h) const; - virtual void draw_slice(const mp_image_t*) const; - virtual void draw_image(const mp_image_t*) const; + virtual void draw_slice(const mp_image_t&) const; + virtual void draw_image(const mp_image_t&) const; static void print_help(); private: void print_codec_info() const; Modified: mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.cpp =================================================================== --- mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -131,10 +131,10 @@ int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8) { - register int ci, co=1; - register __s16 ZZvalue; - register unsigned char bitten; - register unsigned char bitoff; + int ci, co=1; + __s16 ZZvalue; + unsigned char bitten; + unsigned char bitoff; #ifdef SHOWBLOCK @@ -302,10 +302,10 @@ int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl) { int ci; - register int co; - register int i; - register unsigned char bitten; - register unsigned char bitoff; + int co; + int i; + unsigned char bitten; + unsigned char bitoff; /* first byte always read */ i=RTjpeg_ZZ[0]; @@ -445,8 +445,8 @@ int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8) { - register int ci, co=1, tmp; - register __s16 ZZvalue; + int ci, co=1, tmp; + __s16 ZZvalue; #ifdef SHOWBLOCK @@ -505,7 +505,7 @@ int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl) { int ci=1, co=1, tmp; - register int i; + int i; i=RTjpeg_ZZ[0]; data[i]=((__u8)strm[0])*qtbl[i]; @@ -735,7 +735,7 @@ } #else volatile mmx_t tmp6, tmp7; - register mmx_t *dataptr = (mmx_t *)odata; + mmx_t *dataptr = (mmx_t *)odata; mmx_t *idata2 = (mmx_t *)idata; // first copy the input 8 bit to the destination 16 bits @@ -1573,7 +1573,7 @@ mmx_t workspace[64]; mmx_t *wsptr = workspace; - register mmx_t *dataptr = (mmx_t *)odata; + mmx_t *dataptr = (mmx_t *)odata; mmx_t *idata = (mmx_t *)data; rskip = rskip>>3; @@ -2852,11 +2852,11 @@ int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp) { __s8 * sb; - register __u8 * bp1 = bp + (RTjpeg_width<<3); - register __u8 * bp2 = bp + RTjpeg_Ysize; - register __u8 * bp3 = bp2 + (RTjpeg_Csize>>1); - register int i; - register unsigned j, k; + __u8 * bp1 = bp + (RTjpeg_width<<3); + __u8 * bp2 = bp + RTjpeg_Ysize; + __u8 * bp3 = bp2 + (RTjpeg_Csize>>1); + int i; + unsigned j, k; #ifdef MMX emms(); @@ -2907,10 +2907,10 @@ int RTjpeg_compressYUV422(__s8 *sp, unsigned char *bp) { __s8 * sb; - register __u8 * bp2 = bp + RTjpeg_Ysize; - register __u8 * bp3 = bp2 + RTjpeg_Csize; - register int i; - register unsigned j, k; + __u8 * bp2 = bp + RTjpeg_Ysize; + __u8 * bp3 = bp2 + RTjpeg_Csize; + int i; + unsigned j, k; #ifdef MMX emms(); @@ -2979,8 +2979,8 @@ void RTjpeg_decompressYUV422(__s8 *sp, __u8 *bp) { - register __u8 * bp2 = bp + RTjpeg_Ysize; - register __u8 * bp3 = bp2 + (RTjpeg_Csize); + __u8 * bp2 = bp + RTjpeg_Ysize; + __u8 * bp3 = bp2 + (RTjpeg_Csize); int i; unsigned j,k; @@ -3028,9 +3028,9 @@ void RTjpeg_decompressYUV420(__s8 *sp, __u8 *bp) { - register __u8 * bp1 = bp + (RTjpeg_width<<3); - register __u8 * bp2 = bp + RTjpeg_Ysize; - register __u8 * bp3 = bp2 + (RTjpeg_Csize>>1); + __u8 * bp1 = bp + (RTjpeg_width<<3); + __u8 * bp2 = bp + RTjpeg_Ysize; + __u8 * bp3 = bp2 + (RTjpeg_Csize>>1); int i; unsigned j,k; @@ -3204,10 +3204,10 @@ { __s8 * sb; //rh __s16 *block; - register __u8 * bp1 = bp + (RTjpeg_width<<3); - register __u8 * bp2 = bp + RTjpeg_Ysize; - register __u8 * bp3 = bp2 + (RTjpeg_Csize>>1); - register int i; + __u8 * bp1 = bp + (RTjpeg_width<<3); + __u8 * bp2 = bp + RTjpeg_Ysize; + __u8 * bp3 = bp2 + (RTjpeg_Csize>>1); + int i; unsigned j, k; #ifdef MMX @@ -3297,9 +3297,9 @@ { __s8 * sb; __s16 *_block; - register __u8 * bp2; - register __u8 * bp3; - register int i; + __u8 * bp2; + __u8 * bp3; + int i; unsigned j, k; #ifdef MMX Modified: mplayerxp/libmpcodecs/libnuppelvideo/minilzo.cpp =================================================================== --- mplayerxp/libmpcodecs/libnuppelvideo/minilzo.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpcodecs/libnuppelvideo/minilzo.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -530,7 +530,7 @@ #if !defined(MEMCPY8_DS) #define MEMCPY8_DS(dest,src,len) \ - { register lzo_uint __l = (len) / 8; \ + { lzo_uint __l = (len) / 8; \ do { \ *dest++ = *src++; \ *dest++ = *src++; \ @@ -1202,7 +1202,7 @@ { static int x[3]; static unsigned xn = 3; - register unsigned j; + unsigned j; for (j = 0; j < xn; j++) x[j] = (int)j - 3; @@ -1560,9 +1560,9 @@ lzo_voidp wrkmem ) { #if 0 && defined(__GNUC__) && defined(__i386__) - register const lzo_byte *ip __asm__(REG_S); + const lzo_byte *ip __asm__(REG_S); #else - register const lzo_byte *ip; + const lzo_byte *ip; #endif lzo_byte *op; const lzo_byte * const in_end = in + in_len; @@ -1578,9 +1578,9 @@ for (;;) { #if 0 && defined(__GNUC__) && defined(__i386__) - register const lzo_byte *m_pos __asm__(REG_D); + const lzo_byte *m_pos __asm__(REG_D); #else - register const lzo_byte *m_pos; + const lzo_byte *m_pos; #endif lzo_moff_t m_off; lzo_uint m_len; @@ -1638,7 +1638,7 @@ if (m_off <= M1_MAX_OFFSET && lit == 3) #endif { - register lzo_uint t; + lzo_uint t; t = lit; assert(op - 2 > out); op[-2] |= LZO_BYTE(t); @@ -1665,7 +1665,7 @@ UPDATE_I(dict,0,dindex,ip,in); if (ip - ii > 0) { - register lzo_uint t = ip - ii; + lzo_uint t = ip - ii; if (t <= 3) { @@ -1676,7 +1676,7 @@ *op++ = LZO_BYTE(t - 3); else { - register lzo_uint tt = t - 18; + lzo_uint tt = t - 18; *op++ = 0; while (tt > 255) @@ -1956,14 +1956,14 @@ lzo_voidp wrkmem ) #endif { - register lzo_byte *op; - register const lzo_byte *ip; - register lzo_uint t; + lzo_byte *op; + const lzo_byte *ip; + lzo_uint t; #if defined(COPY_DICT) lzo_uint m_off; const lzo_byte *dict_end; #else - register const lzo_byte *m_pos; + const lzo_byte *m_pos; #endif const lzo_byte * const ip_end = in + in_len; @@ -2438,14 +2438,14 @@ lzo_voidp wrkmem ) #endif { - register lzo_byte *op; - register const lzo_byte *ip; - register lzo_uint t; + lzo_byte *op; + const lzo_byte *ip; + lzo_uint t; #if defined(COPY_DICT) lzo_uint m_off; const lzo_byte *dict_end; #else - register const lzo_byte *m_pos; + const lzo_byte *m_pos; #endif const lzo_byte * const ip_end = in + in_len; Modified: mplayerxp/libmpcodecs/vd_lavc.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_lavc.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpcodecs/vd_lavc.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -518,7 +518,7 @@ if(mpi) { if(mpi->bpp == 8 && mpi->planes[1]) delete mpi->planes[1]; - if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) free_mp_image(mpi); + if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) delete mpi; } if(pic->type!=FF_BUFFER_TYPE_USER){ @@ -603,7 +603,7 @@ <<">["<<mpi->width<<"x"<<mpi->height<<"] "<<mpi->x<<" " <<mpi->y<<" "<<mpi->w<<" "<<mpi->h<<std::endl; __MP_ATOMIC(priv.psi.active_slices++); - priv.parent.draw_slice (mpi); + priv.parent.draw_slice (*mpi); mpi->xp_idx = orig_idx; __MP_ATOMIC(priv.psi.active_slices--); } @@ -680,9 +680,9 @@ } if(!(frame.flags&3) && use_slices) { - if(_mpi) free_mp_image(_mpi); + if(_mpi) delete _mpi; _mpi=parent.get_image(MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_DIRECT,sh.src_w, sh.src_h); - _mpi = _mpi; + mpi = _mpi; frame_number++; ctx->draw_horiz_band=draw_slice; } @@ -705,7 +705,7 @@ if(!got_picture) return NULL; // skipped image if(!ctx->draw_horiz_band) { - if(_mpi) free_mp_image(_mpi); + if(_mpi) delete _mpi; _mpi=parent.get_image(MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,sh.src_w,sh.src_h); if(!_mpi){ // temporary! mpxp_err<<"couldn't allocate image for lavc codec"<<std::endl; Modified: mplayerxp/libmpcodecs/vd_libmpeg2.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpcodecs/vd_libmpeg2.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -283,7 +283,7 @@ mpi->stride[1]= mpi->stride[2]=w>>1; mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; - parent.draw_image(mpi); + parent.draw_image(*mpi); } // decode a frame Modified: mplayerxp/libmpdemux/demux_ac3.cpp =================================================================== --- mplayerxp/libmpdemux/demux_ac3.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_ac3.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -164,7 +164,7 @@ *brate=*samplerate=*channels=0; s = demuxer->stream; s->seek(fptr); - fcc=fcc1=s->read_dword(); + fcc=fcc1=s->read(type_dword); fcc1=me2be_32(fcc1); p = (uint8_t *)&fcc1; s->seek(fptr); @@ -181,7 +181,7 @@ Stream *s; uint8_t *p; s = demuxer->stream; - fcc1=s->read_dword(); + fcc1=s->read(type_dword); fcc1=me2be_32(fcc1); p = (uint8_t *)&fcc1; if(ac3_get_raw_id(demuxer,0,&fcc1,&fcc2,&fcc2)) return MPXP_Ok; Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -148,7 +148,7 @@ bp.resize(bp.size()+1); bp[chunk_size]=0; demuxer->info().add(INFOT_NAME, bp.cdata()); - if(priv->verc && (chunk_size&1)) s->read_char(); + if(priv->verc && (chunk_size&1)) s->read(type_byte); } else if(*((uint32_t *)&preamble[0])==mmioFOURCC('A','U','T','H')) @@ -157,7 +157,7 @@ bp.resize(bp.size()+1); bp[chunk_size]=0; demuxer->info().add(INFOT_AUTHOR, bp.cdata()); - if(priv->verc && (chunk_size&1)) s->read_char(); + if(priv->verc && (chunk_size&1)) s->read(type_byte); } else if(*((uint32_t *)&preamble[0])==mmioFOURCC('(','c',')',' ')) @@ -166,7 +166,7 @@ bp.resize(bp.size()+1); bp[chunk_size]=0; demuxer->info().add(INFOT_COPYRIGHT, bp.cdata()); - if(priv->verc && (chunk_size&1)) s->read_char(); + if(priv->verc && (chunk_size&1)) s->read(type_byte); } else if(*((uint32_t *)&preamble[0])==mmioFOURCC('A','N','N','O')) @@ -175,7 +175,7 @@ bp.resize(bp.size()+1); bp[chunk_size]=0; demuxer->info().add(INFOT_DESCRIPTION, bp.cdata()); - if(priv->verc && (chunk_size&1)) s->read_char(); + if(priv->verc && (chunk_size&1)) s->read(type_byte); } else { Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_asf.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -512,34 +512,34 @@ p_start=stream->tell(); p_end = p_start+apriv->asf_packetsize; /* FIXME: parser is not ready for variable packet length */ - ecc_flags=stream->read_char(); /* read v82 header */ + ecc_flags=stream->read(type_byte); /* read v82 header */ MSG_DBG2("ecc=%02X ecc_flags=%u\n",ecc_flags,ecc_flags&0x0F); stream->skip(ecc_flags&15); - flags=stream->read_char(); - segtype=stream->read_char(); + flags=stream->read(type_byte); + segtype=stream->read(type_byte); /* Read packet size (plen): */ switch((flags>>5)&3){ - case 3: plen=stream->read_dword_le();break; // dword - case 2: plen=stream->read_word_le();break; // word - case 1: plen=stream->read_char();break; // byte + case 3: plen=stream->read_le(type_dword);break; // dword + case 2: plen=stream->read_le(type_word);break; // word + case 1: plen=stream->read(type_byte);break; // byte default: plen=0; /* not present */ // MSG_V("Invalid plen type! assuming plen=0 (flags=%02X)\n",flags); } /* Read sequence: */ switch((flags>>1)&3){ - case 3: sequence=stream->read_dword_le();break;// dword - case 2: sequence=stream->read_word_le();break; // word - case 1: sequence=stream->read_char();break; // byte + case 3: sequence=stream->read_le(type_dword);break;// dword + case 2: sequence=stream->read_le(type_word);break; // word + case 1: sequence=stream->read(type_byte);break; // byte default: sequence=0; } /* Read padding size (padding): */ switch((flags>>3)&3){ - case 3: padding=stream->read_dword_le();break; // dword - case 2: padding=stream->read_word_le();break; // word - case 1: padding=stream->read_char();break; // byte + case 3: padding=stream->read_le(type_dword);break; // dword + case 2: padding=stream->read_le(type_word);break; // word + case 1: padding=stream->read(type_byte);break; // byte default: padding=0; } @@ -553,12 +553,12 @@ } // Read time & duration: - time = stream->read_dword_le(); - duration = stream->read_word_le(); + time = stream->read_le(type_dword); + duration = stream->read_le(type_word); // Read payload flags: if(flags&1){ - unsigned char sf=stream->read_char(); + unsigned char sf=stream->read(type_byte); // multiple sub-packets segsizetype=sf>>6; segs=sf & 0x3F; @@ -580,31 +580,31 @@ if(stream->tell()>=p_end) MSG_V("Warning! invalid packet 1, sig11 coming soon...\n"); - st=stream->read_char(); + st=stream->read(type_byte); streamno=st&0x7F; if(st&0x80) keyframe=1; // Read media object number (seq): switch((segtype>>4)&3){ - case 3: seq=stream->read_dword_le();break;// dword - case 2: seq=stream->read_word_le();break; // word - case 1: seq=stream->read_char();break; // byte + case 3: seq=stream->read_le(type_dword);break;// dword + case 2: seq=stream->read_le(type_word);break; // word + case 1: seq=stream->read(type_byte);break; // byte default: seq=0; } // Read offset or timestamp: switch((segtype>>2)&3){ - case 3: x=stream->read_dword_le();break; // dword - case 2: x=stream->read_word_le();break; // word - case 1: x=stream->read_char();break; // byte + case 3: x=stream->read_le(type_dword);break; // dword + case 2: x=stream->read_le(type_word);break; // word + case 1: x=stream->read(type_byte);break; // byte default: x=0; } // Read replic.data len: switch((segtype)&3){ - case 3: rlen=stream->read_dword_le();break; // dword - case 2: rlen=stream->read_word_le();break; // word - case 1: rlen=stream->read_char();break; // byte + case 3: rlen=stream->read_le(type_dword);break; // dword + case 2: rlen=stream->read_le(type_word);break; // word + case 1: rlen=stream->read(type_byte);break; // byte default: rlen=0; } @@ -615,7 +615,7 @@ default: if(rlen>=8){ stream->skip(4);// skip object size - time2=stream->read_dword_le(); // read PTS + time2=stream->read_le(type_dword); // read PTS stream->skip(rlen-8); } else { MSG_V("unknown segment type (rlen): 0x%02X \n",rlen); @@ -627,9 +627,9 @@ if(flags&1){ // multiple segments switch(segsizetype){ - case 3: len=stream->read_dword_le();break; // dword - case 2: len=stream->read_word_le();break; // word - case 1: len=stream->read_char();break; // byte + case 3: len=stream->read_le(type_dword);break; // dword + case 2: len=stream->read_le(type_word);break; // word + case 1: len=stream->read(type_byte);break; // byte default: len=plen-(stream->tell()-p_start); // ??? } } else { @@ -645,7 +645,7 @@ case 0x01: // GROUPING: while(len>0){ - int len2=stream->read_char(); + int len2=stream->read(type_byte); if(len2<0) len2=0; done=demux_asf_read_packet(demux,stream->tell(),len2,streamno,seq,x,duration,-1,keyframe); len-=len2+1; Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_avi.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -78,8 +78,8 @@ } static int avi_idx_cmp(const any_t*elem1,const any_t*elem2) { - register off_t a = avi_idx_offset((AVIINDEXENTRY *)elem1); - register off_t b = avi_idx_offset((AVIINDEXENTRY *)elem2); + off_t a = avi_idx_offset((AVIINDEXENTRY *)elem1); + off_t b = avi_idx_offset((AVIINDEXENTRY *)elem2); return (a > b) - (b > a); } @@ -132,7 +132,7 @@ priv->idx_size=0; priv->audio_streams=0; while(1){ - int id=demuxer->stream->read_dword_le(); + int id=demuxer->stream->read_le(type_dword); unsigned chunksize,size2; static int last_fccType=0; const char* hdr=NULL; @@ -141,8 +141,8 @@ if(demuxer->stream->eof()) break; // if(id==mmioFOURCC('L','I','S','T')){ - unsigned len=demuxer->stream->read_dword_le(); // list size - id=demuxer->stream->read_dword_le(); // list type + unsigned len=demuxer->stream->read_le(type_dword); // list size + id=demuxer->stream->read_le(type_dword); // list type MSG_DBG2("LIST '%.4s' len=%u\n",(char *) &id,len); if(len >= 4) { len -= 4; @@ -165,7 +165,7 @@ } continue; } - size2=demuxer->stream->read_dword_le(); + size2=demuxer->stream->read_le(type_dword); MSG_V("CHUNK '%.4s' len=%u\n",(char *) &id,size2); chunksize=(size2+1)&(~1); infot=-1; @@ -291,11 +291,11 @@ chunksize-=24; memcpy(s->fcc, "indx", 4); s->dwSize = size2; - s->wLongsPerEntry = demuxer->stream->read_word_le(); - s->bIndexSubType = demuxer->stream->read_char(); - s->bIndexType = demuxer->stream->read_char(); - s->nEntriesInUse = demuxer->stream->read_dword_le(); - *(uint32_t *)s->dwChunkId = demuxer->stream->read_dword_le(); + s->wLongsPerEntry = demuxer->stream->read_le(type_word); + s->bIndexSubType = demuxer->stream->read(type_byte); + s->bIndexType = demuxer->stream->read(type_byte); + s->nEntriesInUse = demuxer->stream->read_le(type_dword); + *(uint32_t *)s->dwChunkId = demuxer->stream->read_le(type_dword); bp=demuxer->stream->read(3*4); memcpy(s->dwReserved,bp.data(),bp.size()); memset(s->dwReserved,0,3*4); @@ -309,10 +309,10 @@ // now the real index of indices for (i=0; i<s->nEntriesInUse; i++) { chunksize-=16; - s->aIndex[i].qwOffset = demuxer->stream->read_dword_le() & 0xffffffff; - s->aIndex[i].qwOffset |= ((uint64_t)demuxer->stream->read_dword_le() & 0xffffffff)<<32; - s->aIndex[i].dwSize = demuxer->stream->read_dword_le(); - s->aIndex[i].dwDuration = demuxer->stream->read_dword_le(); + s->aIndex[i].qwOffset = demuxer->stream->read_le(type_dword) & 0xffffffff; + s->aIndex[i].qwOffset |= ((uint64_t)demuxer->stream->read_le(type_dword) & 0xffffffff)<<32; + s->aIndex[i].dwSize = demuxer->stream->read_le(type_dword); + s->aIndex[i].dwDuration = demuxer->stream->read_le(type_dword); MSG_DBG2("ODML (%.4s): [%d] 0x%016llx 0x%04lx %ld\n", (s->dwChunkId), i, (uint64_t)s->aIndex[i].qwOffset, s->aIndex[i].dwSize, s->aIndex[i].dwDuration); @@ -415,7 +415,7 @@ } case mmioFOURCC('d', 'm', 'l', 'h'): { // dmlh 00 00 00 04 frms - unsigned int total_frames = demuxer->stream->read_dword_le(); + unsigned int total_frames = demuxer->stream->read_le(type_dword); MSG_V("Found ODML header %lu frames %lu\n", chunksize, total_frames); demuxer->stream->skip( chunksize-4); chunksize = 0; @@ -451,7 +451,7 @@ unsigned riff_type; MSG_V( "additional RIFF header...\n"); - riff_type = demuxer->stream->read_dword_le(); + riff_type = demuxer->stream->read_le(type_dword); if(riff_type != mmioFOURCC('A','V','I','X')) MSG_WARN("** warning: this is no AVIX header..\n"); else { @@ -606,7 +606,7 @@ } if (i<priv->idx_size && db) { demuxer->stream->seek( avi_idx_offset(idx)); - id = demuxer->stream->read_dword_le(); + id = demuxer->stream->read_le(type_dword); if (id && id != db) // index fcc and real fcc differ? fix it. for (idx = &((AVIINDEXENTRY *)priv->idx)[0], i=0; i<priv->idx_size; i++, idx++){ if (!(idx->dwFlags & AVIIF_KEYFRAME) && idx->ckid == db) @@ -650,10 +650,10 @@ unsigned int c; demuxer->filepos=demuxer->stream->tell(); if(demuxer->filepos>=demuxer->movi_end && demuxer->movi_start<demuxer->movi_end) break; - id=demuxer->stream->read_dword_le(); - len=demuxer->stream->read_dword_le(); + id=demuxer->stream->read_le(type_dword); + len=demuxer->stream->read_le(type_dword); if(id==mmioFOURCC('L','I','S','T') || id==mmioFOURCC('R', 'I', 'F', 'F')){ - id=demuxer->stream->read_dword_le(); // list or RIFF type + id=demuxer->stream->read_le(type_dword); // list or RIFF type continue; } if(demuxer->stream->eof()) break; @@ -672,13 +672,13 @@ idx->dwChunkOffset=(unsigned long)demuxer->filepos; idx->dwChunkLength=len; - c=demuxer->stream->read_dword(); + c=demuxer->stream->read(type_dword); // Fix keyframes for DivX files: if(idxfix_divx) if(avi_stream_id(id)==idxfix_videostream){ switch(idxfix_divx){ - case 3: c=demuxer->stream->read_dword()<<5; //skip 32+5 bits for m$mpeg4v1 + case 3: c=demuxer->stream->read(type_dword)<<5; //skip 32+5 bits for m$mpeg4v1 case 1: if(c&0x40000000) idx->dwFlags&=~AVIIF_KEYFRAME;break; // divx 3 case 2: if(c==0x1B6) idx->dwFlags&=~AVIIF_KEYFRAME;break; // divx 4 } @@ -835,7 +835,7 @@ } -// len=demux->stream->read_dword_le(); +// len=demux->stream->read_le(type_dword); skip=(len+1)&(~1); // total bytes in this chunk if(ds){ @@ -891,7 +891,7 @@ #endif demux->stream->seek(pos); demux->filepos=demux->stream->tell(); - id=demux->stream->read_dword_le(); + id=demux->stream->read_le(type_dword); if(demux->stream->eof()) return 0; // EOF! if(id!=idx->ckid){ @@ -901,7 +901,7 @@ else if(!valid_fourcc(id)) continue; // drop chunk if both id and idx bad } - len=demux->stream->read_dword_le(); + len=demux->stream->read_le(type_dword); // if((len&(~1))!=(idx->dwChunkLength&(~1))){ // if((len)!=(idx->dwChunkLength)){ if((len!=idx->dwChunkLength)&&((len+1)!=idx->dwChunkLength)){ @@ -916,12 +916,12 @@ demux->stream->eof(1); return 0; } - id=demux->stream->read_dword_le(); - len=demux->stream->read_dword_le(); + id=demux->stream->read_le(type_dword); + len=demux->stream->read_le(type_dword); if(demux->stream->eof()) return 0; // EOF! if(id==mmioFOURCC('L','I','S','T') || id==mmioFOURCC('R', 'I', 'F', 'F')){ - id=demux->stream->read_dword_le(); // list or RIFF type + id=demux->stream->read_le(type_dword); // list or RIFF type continue; } } @@ -1293,9 +1293,9 @@ { uint32_t riff,id; - riff = demuxer->stream->read_dword_le(); - demuxer->stream->read_dword_le(); /*filesize */ - id=demuxer->stream->read_dword_le(); /* "AVI " */ + riff = demuxer->stream->read_le(type_dword); + demuxer->stream->read_le(type_dword); /*filesize */ + id=demuxer->stream->read_le(type_dword); /* "AVI " */ demuxer->file_format=Demuxer::Type_AVI; if(riff == mmioFOURCC('R','I','F','F') && id == formtypeAVI) return MPXP_Ok; if(riff == mmioFOURCC('O','N','2',' ') && id == formtypeON2) return MPXP_Ok; Modified: mplayerxp/libmpdemux/demux_bmp.cpp =================================================================== --- mplayerxp/libmpdemux/demux_bmp.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_bmp.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -212,7 +212,7 @@ // Check if a file is a BMP file depending on whether starts with 'BM' static MPXP_Rc bmp_probe(Demuxer *demuxer) { - if (demuxer->stream->read_word() == (('B' << 8) | 'M')) + if (demuxer->stream->read(type_word) == (('B' << 8) | 'M')) return MPXP_Ok; else return MPXP_False; @@ -242,9 +242,9 @@ // go back to the beginning demuxer->stream->reset(); demuxer->stream->seek( demuxer->stream->start_pos()+2); - filesize = demuxer->stream->read_dword_le(); + filesize = demuxer->stream->read_le(type_dword); demuxer->stream->skip( 4); - data_offset = demuxer->stream->read_word_le(); + data_offset = demuxer->stream->read_le(type_word); demuxer->stream->skip( 2); // create a new video stream header @@ -260,17 +260,17 @@ // load the BITMAPINFOHEADER // allocate size and take the palette table into account sh_video->bih = (BITMAPINFOHEADER *)mp_malloc(data_offset - 12); - sh_video->bih->biSize = demuxer->stream->read_dword_le(); - sh_video->bih->biWidth = demuxer->stream->read_dword_le(); - sh_video->bih->biHeight = demuxer->stream->read_dword_le(); - sh_video->bih->biPlanes = demuxer->stream->read_word_le(); - sh_video->bih->biBitCount = demuxer->stream->read_word_le(); - sh_video->bih->biCompression = demuxer->stream->read_dword_le(); - sh_video->bih->biSizeImage = demuxer->stream->read_dword_le(); - sh_video->bih->biXPelsPerMeter = demuxer->stream->read_dword_le(); - sh_video->bih->biYPelsPerMeter = demuxer->stream->read_dword_le(); - sh_video->bih->biClrUsed = demuxer->stream->read_dword_le(); - sh_video->bih->biClrImportant = demuxer->stream->read_dword_le(); + sh_video->bih->biSize = demuxer->stream->read_le(type_dword); + sh_video->bih->biWidth = demuxer->stream->read_le(type_dword); + sh_video->bih->biHeight = demuxer->stream->read_le(type_dword); + sh_video->bih->biPlanes = demuxer->stream->read_le(type_word); + sh_video->bih->biBitCount = demuxer->stream->read_le(type_word); + sh_video->bih->biCompression = demuxer->stream->read_le(type_dword); + sh_video->bih->biSizeImage = demuxer->stream->read_le(type_dword); + sh_video->bih->biXPelsPerMeter = demuxer->stream->read_le(type_dword); + sh_video->bih->biYPelsPerMeter = demuxer->stream->read_le(type_dword); + sh_video->bih->biClrUsed = demuxer->stream->read_le(type_dword); + sh_video->bih->biClrImportant = demuxer->stream->read_le(type_dword); // fetch the palette binary_packet bp=demuxer->stream->read(sh_video->bih->biClrUsed * 4); memcpy((unsigned char *)(sh_video->bih) + 40,bp.data(),bp.size()); Modified: mplayerxp/libmpdemux/demux_dca.cpp =================================================================== --- mplayerxp/libmpdemux/demux_dca.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_dca.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -343,7 +343,7 @@ *brate=*samplerate=*channels=0; s = demuxer->stream; s->seek(fptr); - fcc=s->read_dword(); + fcc=s->read(type_dword); fcc=me2be_32(fcc); s->seek(fptr); binary_packet bp=s->read(32); @@ -357,7 +357,7 @@ uint32_t fcc1,fcc2; Stream *s; s = demuxer->stream; - fcc1=s->read_dword(); + fcc1=s->read(type_dword); fcc1=me2be_32(fcc1); if(dca_get_raw_id(demuxer,0,&fcc1,&fcc2,&fcc2)) return MPXP_Ok; return MPXP_False; Modified: mplayerxp/libmpdemux/demux_film.cpp =================================================================== --- mplayerxp/libmpdemux/demux_film.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_film.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -244,7 +244,7 @@ // get the header size, which implicitly points past the header and // to the start of the data - header_size = demuxer->stream->read_dword(); + header_size = demuxer->stream->read(type_dword); film_data->film_version = demuxer->stream->read_fourcc(); demuxer->movi_start = header_size; demuxer->movi_end = demuxer->stream->end_pos(); @@ -261,7 +261,7 @@ { // fetch the chunk type and size chunk_type = demuxer->stream->read_fourcc(); - chunk_size = demuxer->stream->read_dword(); + chunk_size = demuxer->stream->read(type_dword); header_size -= chunk_size; switch (chunk_type) @@ -279,8 +279,8 @@ sh_video->ds = demuxer->video; sh_video->fourcc= video_format; - sh_video->src_h = demuxer->stream->read_dword(); - sh_video->src_w = demuxer->stream->read_dword(); + sh_video->src_h = demuxer->stream->read(type_dword); + sh_video->src_w = demuxer->stream->read(type_dword); MSG_V( " FILM video: %d x %d\n", sh_video->src_w, sh_video->src_h); @@ -303,7 +303,7 @@ // don't do this if the file is a quirky file with NULL version if (film_data->film_version) { - audio_channels = demuxer->stream->read_char(); + audio_channels = demuxer->stream->read(type_byte); if (audio_channels > 0) { // create and initialize the audio stream header @@ -317,9 +317,9 @@ sh_audio->wf->wFormatTag = 1; sh_audio->wtag = 1; sh_audio->wf->nChannels = audio_channels; - sh_audio->wf->wBitsPerSample = demuxer->stream->read_char(); + sh_audio->wf->wBitsPerSample = demuxer->stream->read(type_byte); demuxer->stream->skip( 1); // skip unknown byte - sh_audio->wf->nSamplesPerSec = demuxer->stream->read_word(); + sh_audio->wf->nSamplesPerSec = demuxer->stream->read(type_word); sh_audio->wf->nAvgBytesPerSec = sh_audio->wf->nSamplesPerSec * sh_audio->wf->wBitsPerSample * sh_audio->wf->nChannels / 8; @@ -366,11 +366,11 @@ if (sh_video) { - sh_video->fps = demuxer->stream->read_dword(); + sh_video->fps = demuxer->stream->read(type_dword); } // fetch the number of chunks - film_data->total_chunks = demuxer->stream->read_dword(); + film_data->total_chunks = demuxer->stream->read(type_dword); film_data->current_chunk = 0; MSG_V( " STAB chunk contains %d chunks\n", film_data->total_chunks); @@ -384,10 +384,10 @@ { film_chunk = film_data->chunks[i]; film_chunk.chunk_offset = - demuxer->movi_start + demuxer->stream->read_dword(); - film_chunk.chunk_size = demuxer->stream->read_dword(); - film_chunk.syncinfo1 = demuxer->stream->read_dword(); - film_chunk.syncinfo2 = demuxer->stream->read_dword(); + demuxer->movi_start + demuxer->stream->read(type_dword); + film_chunk.chunk_size = demuxer->stream->read(type_dword); + film_chunk.syncinfo1 = demuxer->stream->read(type_dword); + film_chunk.syncinfo2 = demuxer->stream->read(type_dword); // count chunks for the purposes of seeking if (counting_chunks) Modified: mplayerxp/libmpdemux/demux_flac.cpp =================================================================== --- mplayerxp/libmpdemux/demux_flac.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_flac.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -50,7 +50,7 @@ *brate=*samplerate=*channels=0; s = demuxer->stream; s->seek(fptr); - fcc1=s->read_dword(); + fcc1=s->read(type_dword); fcc1=me2be_32(fcc1); s->seek(fptr); binary_packet bp=s->read(32); @@ -70,7 +70,7 @@ Stream *s; uint8_t *p; s = demuxer->stream; - fcc1=s->read_dword(); + fcc1=s->read(type_dword); fcc1=me2be_32(fcc1); p = (uint8_t *)&fcc1; if(flac_get_raw_id(demuxer,0,&fcc1,&fcc2,&fcc2)) return MPXP_Ok; Modified: mplayerxp/libmpdemux/demux_fli.cpp =================================================================== --- mplayerxp/libmpdemux/demux_fli.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_fli.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -78,7 +78,7 @@ static MPXP_Rc fli_probe(Demuxer* demuxer){ unsigned magic_number; demuxer->movi_end = demuxer->stream->skip(4); - magic_number = demuxer->stream->read_word_le(); + magic_number = demuxer->stream->read_le(type_word); if ((magic_number != 0xAF11) && (magic_number != 0xAF12)) return MPXP_False; demuxer->file_format=Demuxer::Type_FLI; return MPXP_Ok; @@ -103,9 +103,9 @@ demuxer->stream->seek( 0); demuxer->movi_start = 128; - demuxer->movi_end = demuxer->stream->read_dword_le(); + demuxer->movi_end = demuxer->stream->read_le(type_dword); - magic_number = demuxer->stream->read_word_le(); + magic_number = demuxer->stream->read_le(type_word); if ((magic_number != 0xAF11) && (magic_number != 0xAF12)) { @@ -117,7 +117,7 @@ } // fetch the number of frames - frames->num_frames = demuxer->stream->read_word_le(); + frames->num_frames = demuxer->stream->read_le(type_word); frames->current_frame = 0; // allocate enough entries for the indices @@ -139,8 +139,8 @@ // custom fourcc for internal MPlayer use sh_video->fourcc = mmioFOURCC('F', 'L', 'I', 'C'); - sh_video->src_w = demuxer->stream->read_word_le(); - sh_video->src_h = demuxer->stream->read_word_le(); + sh_video->src_w = demuxer->stream->read_le(type_word); + sh_video->src_h = demuxer->stream->read_le(type_word); // pass extradata to codec sh_video->bih = (BITMAPINFOHEADER*)header; @@ -155,7 +155,7 @@ demuxer->stream->skip( 4); // get the speed - speed = demuxer->stream->read_word_le(); + speed = demuxer->stream->read_le(type_word); if (speed == 0) speed = 1; if (magic_number == 0xAF11) @@ -168,8 +168,8 @@ while ((!demuxer->stream->eof()) && (frame_number < frames->num_frames)) { frames->filepos[frame_number] = demuxer->stream->tell(); - frame_size = demuxer->stream->read_dword_le(); - magic_number = demuxer->stream->read_word_le(); + frame_size = demuxer->stream->read_le(type_dword); + magic_number = demuxer->stream->read_le(type_word); demuxer->stream->skip( frame_size - 6); // if this chunk has the right magic number, index it Modified: mplayerxp/libmpdemux/demux_mkv.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mkv.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_mkv.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -118,14 +118,14 @@ int i, len_mask = 0x80; uint32_t id; - for (i=0, id=s->read_char(); i<4 && !(id & len_mask); i++) + for (i=0, id=s->read(type_byte); i<4 && !(id & len_mask); i++) len_mask >>= 1; if (i >= 4) return EBML_ID_INVALID; if (length) *length = i + 1; while (i--) - id = (id << 8) | s->read_char(); + id = (id << 8) | s->read(type_byte); return id; } @@ -186,7 +186,7 @@ int i, j, num_ffs = 0, len_mask = 0x80; uint64_t len; - for (i=0, len=s->read_char(); i<8 && !(len & len_mask); i++) + for (i=0, len=s->read(type_byte); i<8 && !(len & len_mask); i++) len_mask >>= 1; if (i >= 8) return EBML_UINT_INVALID; @@ -197,7 +197,7 @@ num_ffs++; while (i--) { - len = (len << 8) | s->read_char(); + len = (len << 8) | s->read(type_byte); if ((len & 0xFF) == 0xFF) num_ffs++; } @@ -222,7 +222,7 @@ *length = len + l; while (len--) - value = (value << 8) | s->read_char(); + value = (value << 8) | s->read(type_byte); return value; } @@ -244,12 +244,12 @@ *length = len + l; len--; - l = s->read_char(); + l = s->read(type_byte); if (l & 0x80) value = -1; value = (value << 8) | l; while (len--) - value = (value << 8) | s->read_char(); + value = (value << 8) | s->read(type_byte); return value; } @@ -270,7 +270,7 @@ case 4: { union {uint32_t i; float f;} u; - u.i = s->read_dword(); + u.i = s->read(type_dword); value = u.f; break; } @@ -278,7 +278,7 @@ case 8: { union {uint64_t i; double d;} u; - u.i = s->read_qword(); + u.i = s->read(type_qword); value = u.d; break; } Modified: mplayerxp/libmpdemux/demux_mov.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mov.cpp 2013-06-11 17:36:43 UTC (rev 652) +++ mplayerxp/libmpdemux/demux_mov.cpp 2013-06-12 14:05:09 UTC (rev 653) @@ -338,17 +338,17 @@ while(1){ int i; int skipped=8; - off_t len=demuxer->stream->read_dword(); - unsigned int id=demuxer->stream->read_dword(); + off_t len=demuxer->stream->read(type_dword); + unsigned int id=demuxer->stream->read(type_dword); if(demuxer->stream->eof()) break; // EOF if (len == 1) /* real size is 64bits - cjb */ { #ifndef _LARGEFILE_SOURCE - if (demuxer->stream->read_dword() != 0) + if (demuxer->stream->read(type_dword) != 0) MSG_WARN( "64bit file, but you've compiled MPlayer without LARGEFILE support!\n"); - len = demuxer->stream->read_dword(); + len = demuxer->stream->read(type_dword); #else - len = demuxer->stream->read_qword(); + len = demuxer->stream->read(type_qword); #endif skipped += 8; } @@ -370,7 +370,7 @@ // char[4] compatible_brands[] (eg. 'mp41') // compatible_brands list spans to the end of box #if 1 - tmp = demuxer->stream->read_dword(); + tmp = demuxer->stream->read(type_dword); switch(tmp) { case MOV_FOURCC('i','s','o','m'): MSG_V("MOV: File-Type Major-Brand: ISO Media File\n"); @@ -413,12 +413,12 @@ tmp = BE_32(tmp); MSG_WARN("MOV: File-Type unknown Major-Brand: %.4s\n",&tmp); } - ver=demuxer->stream->read_dword(); + ver=demuxer->stream->read(type_dword); MSG_V("MOV: File-Type Minor-Version: %d\n",ver); skipped += 8; // List all compatible brands for(i = 0; i < ((len-16)/4); i++) { - tmp = BE_32(demuxer->stream->read_dword()); + tmp = BE_32(demuxer->stream->read(type_dword)); MSG_V("MOV: File-Type Compatible-Brands #%d: %.4s\n",i,&tmp); skipped += 4; } @@ -432,24 +432,24 @@ MSG_DBG2("MOV: Movie header: start: %x end: %x\n", priv->moov_start, priv->moov_end); skipped+=8; - i = demuxer->stream->read_dword()-8; - if(demuxer->stream->read_dword()==MOV_FOURCC('r','m','r','a')){ + i = demuxer->stream->read(type_dword)-8; + if(demuxer->stream->read(type_dword)==MOV_FOURCC('r','m','r','a')){ skipped+=i; MSG_V("MOV: Reference Media file!!!\n"); //set demuxer type to playlist ... //demuxer->type=DEMUXER_TYPE_PLAYLIST; while(i>0){ - int len=demuxer->stream->read_dword()-8; - int fcc=demuxer->stream->read_dword(); + int len=demuxer->stream->read(type_dword)-8; + int fcc=demuxer->stream->read(type_dword); if(len<0) break; // EOF!? i-=8; switch(fcc){ case MOV_FOURCC('r','m','d','a'): continue; case MOV_FOURCC('r','d','r','f'): { - demuxer->stream->read_dword(); - /*int type=*/demuxer->stream->read_dword_le(); - int slen=demuxer->stream->read_dword(); + demuxer->stream->read(type_dword); + /*int type=*/demuxer->stream->read_le(type_dword); + int slen=demuxer->stream->read(type_dword); //char* s=mp_malloc(slen+1); //demuxer->stream->read(s,slen); @@ -467,13 +467,13 @@ len-=12+slen;i-=12+slen; break; } case MOV_FOURCC('r','m','d','r'): { - demuxer->stream->read_dword(); - int rate=demuxer->stream->read_dword(); + demuxer->stream->read(type_dword); + int rate=demuxer->stream->read(type_dword); MSG_V(" min. data rate: %d bits/sec\n",rate); len-=8; i-=8; break; } case MOV_FOURCC('r','m','q','u'): { - int q=demuxer->stream->read_dword(); + int q=demuxer->stream->read(type_dword); MSG_V(" quality index: %d\n",q); len-=4; i-=4; break; } @@ -608,10 +608,10 @@ // pos=demuxer->stream->tell(); if(pos>=endpos) return; // END - len=demuxer->stream->read_dword(); + len=demuxer->stream->read(type_dword); if(len<8) return; // error len-=8; - id=demuxer->stream->read_dword(); + id=demuxer->stream->read(type_dword); // MSG_DBG2("lschunks %.4s %d\n",&id,(int)len); // @@ -621,13 +621,13 @@ } else { /* not in track */ switch(id) { case MOV_FOURCC('m','v','h','d'): { - int version = demuxer->stream->read_char(); + int version = demuxer->stream->read(type_byte); demuxer->stream->skip( (version == 1) ? 19 : 11); - priv->timescale=demuxer->stream->read_dword(); + priv->timescale=demuxer->stream->read(type_dword); if (version == 1) - priv->duration=demuxer->stream->read_qword(); + priv->duration=demuxer->stream->read(type_qword); else - priv->duration=demuxer->stream->read_dword(); + priv->duration=demuxer->stream->read(type_dword); MSG_V("MOV: %*sMovie header (%d bytes): tscale=%d dur=%d\n",level,"",(int)len, (int)priv->timescale,(int)priv->duration); break; @@ -1316,14 +1316,14 @@ break; } case MOV_FOURCC('d','c','o','m'): { -// int temp=demuxer->stream->read_dword(); - unsigned int algo=be2me_32(demuxer->stream->read_dword()); +// int temp=demuxer->stream->read(type_dword); + unsigned int algo=be2me_32(demuxer->stream->read(type_dword)); MSG_V( "Compressed header uses %.4s algo!\n",&algo); break; } case MOV_FOURCC('c','m','v','d'): { -// int temp=demuxer->stream->read_dword(); - unsigned int moov_sz=demuxer->stream->read_dword(); +// int temp=demuxer->stream->read(type_dword); + unsigned int moov_sz=demuxer->stream->read(type_dword); unsigned int cmov_sz=len-4; unsigned char* cmov_buf=new unsigned char[cmov_sz]; unsigned char* moov_buf=new unsigned char[moov_sz+16]; @@ -1383,8 +1383,8 @@ while((len > 8) && (udta_size > 8)) { - udta_len = demuxer->stream->read_dword(); - udta_id = demuxer->stream->read_dword(); + udta_len = demuxer->stream->read(type_dword); + udta_id = demuxer->stream->read(type_dword); udta_size -= 8; MSG_DBG2( "udta_id: %.4s (len: %d)\n", &udta_id, udta_len); switch (udta_id) @@ -1406,7 +1406,7 @@ case MOV_FOURCC(0xa9,'a','u','t'): case MOV_FOURCC(0xa9,'s','w','r'): { - off_t text_len = demuxer->stream->read_word(); + off_t text_len = demuxer->stream->read(type_word); char text[text_len+2+1]; bp=demuxer->stream->read(text_len+2); memcpy(&text,bp.data(),bp.size()); @@ -1542,26 +1542,26 @@ break; } case MOV_FOURCC('m','d','h','d'): { - int version = demuxer->stream->read_char(); + int version = demuxer->stream->read(type_byte); MSG_V("MOV: %*sMedia header!\n", level, ""); demuxer->stream->skip( (version == 1) ? 19 : 11); // read timescale - trak->timescale = demuxer->stream->read_dword(); + trak->timescale = demuxer->stream->read(type_dword); // read length if (version == 1) - trak->length = demuxer->stream->read_qword(); + trak->length = demuxer->stream->read(type_qword); else - trak->length = demuxer->stream->read_dword(); + trak->length = demuxer->stream->read(type_dword); break; } case MOV_FOURCC('h','d','l','r'): { - demuxer->stream->read_dword(); - unsigned int type = demuxer->stream->read_dword_le(); - unsigned int subtype = demuxer->stream->read_dword_le(); - unsigned int manufact = demuxer->stream->read_dword_le(); - /*unsigned int comp_flags =*/ demuxer->stream->read_dword(); - /*unsigned int comp_mask =*/ demuxer->stream->read_dword(); - unsigned _len = demuxer->stream->read_char(); + demuxer->stream->read(type_dword); + unsigned int type = demuxer->stream->read_le(type_dword); + unsigned int subtype = demuxer->stream->read_le(type_dword); + unsigned int manufact = demuxer->stream->read_le(type_dword); + /*unsigned int comp_flags =*/ demuxer->stream->read(type_dword); + /*unsigned int comp_mask =*/ demuxer->stream->read(type_dword); + unsigned _len = demuxer->stream->read(type_byte); char* str = new char [_len + 1]; bp=demuxer->stream->read(_len); memcpy(str,bp.data(),bp.size()); @@ -1605,14 +1605,14 @@ break; } case MOV_FOURCC('s','t','s','d'): { - int i = demuxer->stream->read_dword(); // temp! - int count = demuxer->stream->read_dword(); + int i = demuxer->stream->read(type_dword); // temp! + int count = demuxer->stream->read(type_dword); MSG_V( "MOV: %*sDescription list! (cnt:%d)\n", level, "", count); for (i = 0; i < count; i++) { off_t _pos = demuxer->stream->tell(); - unsigned _len = demuxer->stream->read_dword(); - unsigned int fourcc = demuxer->stream->read_dword_le(); + unsigned _len = demuxer->stream->read(type_dword); + unsigned int fourcc = demuxer->stream->read_le(type_dword); /* some files created with Broadcast 2000 (e.g. ilacetest.mov) contain raw I420 video but have a yv12 fourcc */ if (fourcc == mmioFOURCC('y','v','1','2')) @@ -1639,15 +1639,15 @@ break; } case MOV_FOURCC('s','t','t','s'): { - demuxer->stream->read_dword(); - unsigned i,_len = demuxer->stream->read_dword(); + demuxer->stream->read(type_dword); + unsigned i,_len = demuxer->stream->read(type_dword); unsigned int pts = 0; MSG_V("MOV: %*sSample duration table! (%d blocks)\n", level, "", _len); trak->durmap = new mov_durmap_t[_len]; trak->durmap_size = _len; for (i = 0; i < _len; i++) { - trak->durmap[i].num = demuxer->stream->read_dword(); - trak->durmap[i].dur = demuxer->stream->read_dword(); + trak->durmap[i].num = demuxer->stream->read(type_dword); + trak->durmap[i].dur = demuxer->stream->read(type_dword); pts += trak->durmap[i].num * trak->durmap[i].dur; } if (trak->length != pts) @@ -1655,8 +1655,8 @@ break; } case MOV_FOURCC('s','t','s','c'): { - unsigned temp = demuxer->stream->read_dword(); - unsigned i,_len = demuxer->stream->read_dword(); + unsigned temp = demuxer->stream->read(type_dword); + unsigned i,_len = demuxer->stream->read(type_dword); unsigned ver = (temp << 24); unsigned flags = (temp << 16) | (temp << 8) | temp; MSG_V( "MOV: %*sSample->Chunk mapping table! (%d blocks) (ver:%d,flags:%ld)\n", level, "", @@ -1665,18 +1665,18 @@ trak->chunkmap_size = _len; trak->chunkmap = new mov_chunkmap_t[_len]; for (i = 0; i < _len; i++) { - trak->chunkmap[i].first = demuxer->stream->read_dword() - 1; - trak->chunkmap[i].spc = demuxer->stream->read_dword(); - trak->chunkmap[i].sdid = demuxer->stream->read_dword(); + trak->chunkmap[i].first = demuxer->stream->read(type_dword) - 1; + trak->chunkmap[i].spc = demuxer->stream->read(type_dword); + trak->chunkmap[i].sdid = demuxer->stream->read(type_dword); } break; } case MOV_FOURCC('s','t','s','z'): { - int temp = demuxer->stream->read_dword(); - int ss=demuxer->stream->read_dword(); + int temp = demuxer->stream->read(type_dword); + int ss=demuxer->stream->read(type_dword); int ver = (temp << 24); int flags = (temp << 16) | (temp << 8) | temp; - int entries = demuxer->stream->read_dword(); + int entries = demuxer->stream->read(type_dword); int i; MSG_V("MOV: %*sSample size table! (entries=%d ss=%d) (ver:%d,flags:%ld)\n", level, "", entries, ss, ver, flags); @@ -1688,13 +1688,13 @@ (mov_sample_t*)mp_calloc(entries, sizeof(mov_sample_t)); trak->samples_size = entries; for (i = 0; i < entries; i++) - trak->samples[i].size = demuxer->stream->read_dword(); + trak->samples[i].size = demuxer->stream->read(type_dword); } break; } case MOV_FOURCC('s','t','c','o'): { - demuxer->stream->read_dword(); - unsigned i,_len = demuxer->stream->read_dword(); + demuxer->stream->read(type_dword); + unsigned i,_len = demuxer->stream->read(type_dword); MSG_V( "MOV: %*sChunk offset table! (%d chunks)\n", level, "", _len); // extend array if needed: @@ -1706,12 +1706,12 @@ } // read elements: for(i = 0; i < _len; i++) - trak->chunks[i].pos = demuxer->stream->read_dword(); + trak->chunks[i].pos = demuxer->stream->read(type_dword); break; } case MOV_FOURCC('c','o','6','4'): { - demuxer->stream->read_dword(); - unsigned i,_len = demuxer->stream->read_dword(); + demuxer->stream->read(type_dword); + unsigned i,_len = demuxer->stream->read(type_dword); MSG_V( "MOV: %*s64bit chunk offset table! (%d chunks)\n", level, "", _len); // extend array if needed: @@ -1724,18 +1724,18 @@ // read elements: for (i = 0; i < _len; i++) { #ifndef _LARGEFILE_SOURCE - if (demuxer->stream->read_dword() != 0) + if (demuxer->stream->read(type_dword) != 0) MSG_WARN( "Chunk %d has got 64bit address, but you'... [truncated message content] |
From: <nic...@us...> - 2013-06-14 16:28:06
|
Revision: 654 http://sourceforge.net/p/mplayerxp/code/654 Author: nickols_k Date: 2013-06-14 16:28:01 +0000 (Fri, 14 Jun 2013) Log Message: ----------- convert MGS_xxx into mpxp_xxx and add printing of caller address about illegal-patch ==================== ------------------------ 8< -------------------------- 8< --------------------------------- *** Antiviral protection was inited ***!!! MPlayerXP svn.653 2002 Nickols_K 2000-2002 Arpad Gereoffy (?\209?\129?\208?\188. DOCS!) Can't open input config file /root/.mplayerxp/input.conf : No such file or directory Can't open input config file /usr/local/share/mplayerxp/input.conf : No such file or directory Falling back on default (hardcoded) input config Opening joystick device:/dev/input/js0 Can't open joystick device: /dev/input/js0 : No such file or directory Can't init input joystick with using: /dev/input/js0 [OSDEP.0x5a44f8]:CPU: Advanced Micro Devices (Type: 9, Stepping: 3) extended cpuid-level: 26 extended cache-info: 33587520 Detected cache-line size is 64 bytes cpudetect: MMX=1 MMX2=1 3DNow=1 3DNow2=1 SSE=1 SSE2=1 SSE3=1 SSSE3=0 SSE41=0 SSE42=0 AES=0 AVX=0 FMA=0 [PLAYER.0x467c67]:User corrected CPU flags: MMX=1 MMX2=1 3DNow=1 3DNow2=1 SSE=1 SSE2=1 SSE3=1 SSSE3=0 SSE41=0 SSE42=0 AES=0 AVX=0 FMA=0 mpxp_context().mplayer_accel=4160749568 Environment: HOME => /root LANG => ru_RU.UTF-8 LOGNAME => root MAIL => /var/mail/root PATH => /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl SHELL => /bin/bash SUDO_COMMAND => ./mplayerxp -vo fbdev -ao alsa /...path.../trassa e95.avi -v -v -v SUDO_GID => 1000 SUDO_UID => 1000 SUDO_USER => kas TERM => linux USER => root USERNAME => root CommandLine: '-vo' 'fbdev' '-ao' 'alsa' '/...path.../trassa e95.avi' '-v' '-v' '-v' [LIBVO.0x59439c]:font: can't open file: /root/.mplayerxp/font/font.desc font: can't open file: /usr/local/share/mplayerxp/font/font.desc [PLAYER.0x460f6f]:Menu init failed [LIBVO.0x59a858]:fbdev: using /dev/fb0 ?\208?\146?\208?\190?\209?\129?\208?\191?\209?\128?\208?\190?\208?\184?\208?\183?\208?\178?\208?\181?\208?\180?\208?\181?\208?\189?\208?\184?\208?\181 /...path.../trassa e95.avi [STREAM.0x47fecc]:Filename for url is now /...path.../trassa%20e95.avi Not an URL! [STREAM.0x473e98]:[Stream]: Opening *:// ... False [DEMUX.0x49de5d]:[Demuxer]: Probing RAW audio parser ...:False [Demuxer]: Probing RAW video parser ...:False [Demuxer]: Probing AVI - Audio Video Interleaved parser ...:Ok DEMUX.0x4b0bc4:LIST 'hdrl' len=8830 DEMUX.0x4b0c42:list_end=0x2292 DEMUX.0x4b0724:CHUNK 'avih' len=56 DEMUX.0x5036b5:======= AVI Header ======= us/frame: 40000 (fps=25.000) max bytes/sec: 0 padding: 0 DEMUX.0x5035ba:MainAVIHeader.dwFlags: (272) HAS_INDEX IS_INTERLEAVED DEMUX.0x50372b:frames total: 6198 initial: 0 streams: 2 Suggested BufferSize: 0 Size: 352 x 288 DEMUX.0x4b098a:list_end=0x2292 pos=0x58 chunksize=0x0 next=0x58 DEMUX.0x4b0bc4:LIST 'strl' len=4244 DEMUX.0x4b0c42:list_end=0x10F4 DEMUX.0x4b0724:CHUNK 'strh' len=56 [Demuxer]: ==> Found video stream: 0 [Demuxer]: ID_VIDEO_ID=0 DEMUX.0x5038f4:======= STREAM Header ======= Type: vids FCC: div3 (33766964) Flags: 0 Priority: 0 Language: 0 InitialFrames: 0 Rate: 25000/1000 = 25.000 Start: 0 Len: 6198 Suggested BufferSize: 21412 Quality 10000 Sample size: 0 DEMUX.0x4b098a:list_end=0x10F4 pos=0xA4 chunksize=0x0 next=0xA4 DEMUX.0x4b0724:CHUNK 'strf' len=40 DEMUX.0x4b270f:found 'bih', 40 bytes of 40 DEMUX.0x503e61:======= VIDEO Format (chunk size: 40 )====== biSize 40 biWidth 352 biHeight 288 biPlanes 1 biBitCount 24 biCompression 33564944='DIV3' biSizeImage 304128 biXPelPerMeter 0 biYPelPerMeter 0 biClrUsed 0 biClrIpmortant 0 DEMUX.0x503f1f:======= End of Video Format ======= DEMUX.0x4b2ca1:Regenerating keyframe table for DIVX 3 video DEMUX.0x4b098a:list_end=0x10F4 pos=0xD4 chunksize=0x0 next=0xD4 DEMUX.0x4b0724:CHUNK 'JUNK' len=4120 DEMUX.0x4b098a:list_end=0x10F4 pos=0x10F4 chunksize=0x0 next=0x10F4 DEMUX.0x4b0bc4:LIST 'strl' len=4234 DEMUX.0x4b0c42:list_end=0x2186 DEMUX.0x4b0724:CHUNK 'strh' len=56 DEMUX.0x4b28a3:avi: Found audio stream Demuxer: ==> Found audio stream: 1 Demuxer: ID_AUDIO_ID=1 DEMUX.0x5038f4:======= STREAM Header ======= Type: auds FCC: (0) Flags: 0 Priority: 0 Language: 0 InitialFrames: 1 Rate: 15963/1 = 15963.000 Start: 0 Len: 3957330 Suggested BufferSize: 7467 Quality -1 Sample size: 1 DEMUX.0x4b098a:list_end=0x2186 pos=0x1140 chunksize=0x0 next=0x1140 DEMUX.0x4b0724:CHUNK 'strf' len=30 DEMUX.0x4b1f36:found 'wf', 30 bytes of 18 DEMUX.0x503a16:======= WAVE Format (chunk size: 30 )======= Format Tag: 85 (0x55) Channels: 2 Samplerate: 44100 avg byte/sec: 15963 Block align: 1 bits/sample: 0 cbSize: 12 DEMUX.0x503af6:mp3.wID=1 mp3.fdwFlags=0x2 mp3.nBlockSize=417 mp3.nFramesPerBlock=1 mp3.nCodecDelay=1393 DEMUX.0x503a6e:======= End of WAVE Format ======= DEMUX.0x4b098a:list_end=0x2186 pos=0x1166 chunksize=0x0 next=0x1166 DEMUX.0x4b0724:CHUNK 'JUNK' len=4120 DEMUX.0x4b098a:list_end=0x2186 pos=0x2186 chunksize=0x0 next=0x2186 DEMUX.0x4b0bc4:LIST 'odml' len=260 DEMUX.0x4b0c42:list_end=0x2292 DEMUX.0x4b0724:CHUNK 'dmlh' len=248 DEMUX.0x4b2451:Found ODML header 248 frames 6198 DEMUX.0x4b098a:list_end=0x2292 pos=0x2292 chunksize=0x0 next=0x2292 DEMUX.0x4b0724:CHUNK 'JUNK' len=1382 DEMUX.0x4b098a:list_end=0x2292 pos=0x2800 chunksize=0x0 next=0x2800 DEMUX.0x4b0a0b:Broken chunk? chunksize=0 (id=JUNK) DEMUX.0x4b0724:CHUNK 'JUNK' len=1382 DEMUX.0x4b098a:list_end=0x0 pos=0x2800 chunksize=0x0 next=0x2800 DEMUX.0x4b0bc4:LIST 'movi' len=23710356 DEMUX.0x4b0c42:list_end=0x169F29C DEMUX.0x4b0ce7:Found movie at 0x280C - 0x169F29C DEMUX.0x4b0724:CHUNK 'idx1' len=198144 DEMUX.0x4b11ff:Reading INDEX block, 12384 chunks for 6198 frames DEMUX.0x504304: 0: 01wb 10 00000004 len: 7467 pos: 0-> 0.000 0-> 0.000 DEMUX.0x504304: 1: 00dc 10 00001D38 len: 556 pos: 0-> 0.000 0-> 0.000 DEMUX.0x504304: 2: 01wb 10 00001F6C len: 419 pos: 7467-> 0.398 1-> 0.042 DEMUX.0x504304: 3: 00dc 0 00002118 len: 106 pos: 556-> 0.030 1-> 0.042 DEMUX.0x504304: 4: 01wb 10 0000218A len: 825 pos: 7886-> 0.421 2-> 0.083 DEMUX.0x504304: 5: 00dc 0 000024CC len: 201 pos: 662-> 0.035 2-> 0.083 DEMUX.0x504304: 6: 01wb 10 0000259E len: 421 pos: 8711-> 0.465 3-> 0.125 DEMUX.0x504304: 7: 00dc 0 0000274C len: 256 pos: 863-> 0.046 3-> 0.125 DEMUX.0x504304: 8: 01wb 10 00002854 len: 841 pos: 9132-> 0.487 4-> 0.167 DEMUX.0x504304: 9: 00dc 0 00002BA6 len: 129 pos: 1119-> 0.060 4-> 0.167 DEMUX.0x504304: 10: 01wb 10 00002C30 len: 416 pos: 9973-> 0.532 5-> 0.209 DEMUX.0x504304: 11: 00dc 0 00002DD8 len: 211 pos: 1248-> 0.067 5-> 0.209 DEMUX.0x504304: 12: 01wb 10 00002EB4 len: 823 pos: 10389-> 0.554 6-> 0.250 DEMUX.0x504304: 13: 00dc 0 000031F4 len: 249 pos: 1459-> 0.078 6-> 0.250 DEMUX.0x504304: 14: 01wb 10 000032F6 len: 423 pos: 11212-> 0.598 7-> 0.292 DEMUX.0x504304: 15: 00dc 0 000034A6 len: 65 pos: 1708-> 0.091 7-> 0.292 DEMUX.0x504304: 16: 01wb 10 000034F0 len: 840 pos: 11635-> 0.621 8-> 0.334 DEMUX.0x504304: 17: 00dc 0 00003840 len: 53 pos: 1773-> 0.095 8-> 0.334 [snip]...[/snip] DEMUX.0x504304:12377: 00dc 0 0169C3B6 len: 320 pos:19646018->1047.955 6191->258.217 DEMUX.0x504304:12378: 00dc 0 0169C4FE len: 140 pos:19646338->1047.972 6192->258.258 DEMUX.0x504304:12379: 00dc 0 0169C592 len: 250 pos:19646478->1047.980 6193->258.300 DEMUX.0x504304:12380: 00dc 0 0169C694 len: 330 pos:19646728->1047.993 6194->258.342 DEMUX.0x504304:12381: 00dc 0 0169C7E6 len: 122 pos:19647058->1048.011 6195->258.383 DEMUX.0x504304:12382: 00dc 0 0169C868 len: 247 pos:19647180->1048.017 6196->258.425 DEMUX.0x504304:12383: 00dc 0 0169C968 len: 292 pos:19647427->1048.031 6197->258.467 DEMUX.0x4b098a:list_end=0x0 pos=0x16CF8A4 chunksize=0x0 next=0x16CF8A4 DEMUX.0x4b0724:CHUNK 'JUNK' len=1876 DEMUX.0x4b098a:list_end=0x0 pos=0x16D0000 chunksize=0x0 next=0x16D0000 DEMUX.0x4b3ff5:AVI index offset: 0x2808 (movi=0x280C idx0=0x4 idx1=0x1D38) DEMUX.0x4af6f0:Auto-selected AVI audio ID = 1 DEMUX.0x4af7ba:Auto-selected AVI video ID = 0 [DEMUX.0x4a1e6c]:ds_fill_buffer(d_video) called DEMUX.0x4afb43:demux_avi.read_packet: 62773130 DEMUX.0x4afbbd:DEMUX_AVI: Read 7467 data bytes from packet 62773130 [DEMUX.0x4a1811]:DEMUX: Append packet: len=7467 pts=0 pos=0 [_packs: A=1 V=0] ds_read_packet(7467,0,0,0) DEMUX.0x4aff5c:DEMUX_AVI: Skipping 1 bytes from packet 62773130 DEMUX.0x4afb43:demux_avi.read_packet: 63643030 DEMUX.0x4afbbd:DEMUX_AVI: Read 556 data bytes from packet 63643030 DEMUX: Append packet: len=556 pts=0 pos=1 [_packs: A=1 V=1] ds_read_packet(556,0,0,0) DEMUX.0x4b3c82:AVI: Searching for audio stream (id:1) ds_fill_buffer(d_audio) called DEMUX.0x4b403a:AVI video size=19647719 (6198) audio size=3957330 (3957330) DEMUX.0x4b3fcc:VIDEO: [DIV3] 352x288 24bpp 25.00 fps [DEMUX.0x49dcb3]:[Demuxer]: Using: AVI - Audio Video Interleaved parser [Stream]:Video=DIV3 Audio=00000055 [V] filefmt:6fourcc:0x33564944 size:160x120 fps:25 ftime:=0.04 [MPSUB.0x52f0d4]:SPU: Display only forced subs now disabled [GLOBAL.0x51a012]:[codec_ld] ?\208?\145?\208?\184?\208?\177?\208?\187?\208?\184?\208?\190?\209?\130?\208?\181?\208?\186?\208?\176 ?\208?\183?\208?\176?\208?\179?\209?\128?\209?\131?\208?\182?\208?\181?\208?\189?\208?\176 ?\209?\131?\209?\129?\208?\191?\208?\181?\209?\136?\208?\189?\208?\190:libmpg123.so [DEMUX.0x4a2a22]:initial_apts from: stream_pts=0 pts_bytes=7467 got_bytes=7467 i_bps=15963 initial_apts is: 0 [DECAUD.0x5190e1]:mpg123_init: MPEG-1.0 [Layer:III (CBR)], Hz=44100 128-kbit Joint-Stereo, BPF=417 Out=32-bit mpg123_init: Copyrght=No Orig=Yes CRC=No Priv=No Emphas=0 Optimiz=x86-64 [DECAUD.0x509a24]:Probing: mp3libok Driver: mp3lib supports these outfmt for 00000055 100000 10 0 [OSDEP.0x5a52f7]:Using SSE2 optimized memcpy [OSDEP.0x5a54a7]:fast_memcpy(0x33f5ae0, 0x7fff3a4d9718, 64) [cl_size=64] [DECAUD.0x50a3d4]:dec_audio: Allocating 8192 + 65536 = 73728 bytes for output buffer [DECAUD.0x50a527]:[AC] Selecting drv:mp3lib.libmpg123.so ratio 15963->352800 [LIBAO.0x549376]:alsa-init: compiled for ALSA-1.0.27.1 alsa-init: got device=0, subdevice=0 [LIBAO.0x549516]:alsa-init: Testing & bugs are welcome. Found 1 cards, use: hw:0,0 alsa-init: pcm opend in block-mode [LIBAO.0x549996]:snd_pcm_hw_params_any() snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED) Initializing audio codec... AUDIO: srate=ac44 chans=2 bps=4 sfmt=0x100000 ratio: 3e5b->0 [POSTPR.0x54f7de]:vo2(NULL, NULL) [DECVID.0x50908c]:Probing: raw failed Probing: nuv failed Probing: mpeg2 failed Probing: xvid failed Probing: mpegpes failed Probing: huffyuv failed Probing: theora failed Probing: libdv failed Probing: lavc [DECVID.0x50ee0f]:libavcodec.size: 352 x 288 [DECVID.0x50f083]:Using 4 threads in lavc INFO: libavcodec.so (0) video codec[DIV3] init OK! [DECVID.0x506ec6]:VDec: vo config request - 352 x 288 [LIBVO.0x590370]:dri_vo_dbg: vo_query_format(00000000) [LIBVO.0x590480]:dri_vo: request for Unknown 0x0000 fourcc: 0 [POSTPR.0x57ae17]:[vf_vo2] 0=query_format(Unknown 0x0000) vf_vo2->config(352,288,352,288,4,Unknown 0x0000) dri_vo_dbg: vo_config priv.video_out->config(352,288,352,288, 0x4,'MPlayerXP',Unknown 0x0000) fbdev: Can't set graphics mode: Inappropriate ioctl for device [LIBVO.0x59bb1c]:fbdev: var info: fbdev: xres: 1920 fbdev: yres: 1200 fbdev: xres_virtual: 1920 fbdev: yres_virtual: 1200 fbdev: xoffset: 0 fbdev: yoffset: 0 fbdev: bits_per_pixel: 32 fbdev: grayscale: 0 fbdev: red: 16 8 0 fbdev: green: 8 8 0 fbdev: blue: 0 8 0 fbdev: transp: 24 8 0 fbdev: nonstd: 0 fbdev: activate: 0 fbdev: height: 4294967295 fbdev: width: 4294967295 fbdev: accel_flags: 1 fbdev: timing: fbdev: pixclock: 0 fbdev: left_margin: 0 fbdev: right_margin: 0 fbdev: upper_margin: 0 fbdev: lower_margin: 0 fbdev: hsync_len: 0 fbdev: vsync_len: 0 fbdev: sync: 0 fbdev: vmode: 0 fbdev: fix info: fbdev: framebuffer size: 9216000 bytes fbdev: type: 0 fbdev: type_aux: 0 fbdev: visual: 2 fbdev: line_length: 7680 bytes fbdev: id: radeondrmfb fbdev: smem_start: 0xc0142000 fbdev: xpanstep: 1 fbdev: ypanstep: 1 fbdev: ywrapstep: 0 fbdev: mmio_start: 0 fbdev: mmio_len: 0 bytes fbdev: accel: 0 fbdev: priv.bpp: 32 fbdev: priv.real_bpp: 24 fbdev: priv.pixel_size: 4 bytes fbdev: other: fbdev: priv.in_width: 352 fbdev: priv.in_height: 288 fbdev: priv.out_width: 352 fbdev: priv.out_height: 288 fbdev: priv.last_row: 816 fbdev: frame_buffer @ 7f5515842000 fbdev: L123123875 @ 7f5515b99c40 fbdev: pixel per line: 1920 fbdev: vt_set_textarea(330,4b0): 34,4b [stream: vf_reinit_vo] Call vf_reinit_vo <vo2: 352x288@Unknown 0x0000> -> <vo: 352x288@BGRA> vf->first: 352x288@Unknown 0x0000 [352x288@Unknown 0x0000](NULL<-vo2->NULL) Using(first:vo2) 352x288@Unknown 0x0000 vf_reinit->config_vf 352 288 Unknown 0x0000=> 352 288 BGRA Open video filter: [fmtcvt] <352x288 Unknown 0x0000> [POSTPR.0x575564]:SwScale params: -1 x -1 (-1=no scaling) dri_vo_dbg: vo_query_format(51343434) dri_vo: request for Planar 444P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 444P 16-bit little-endian) [POSTPR.0x5736ba]:scale: query(Planar 444P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34343451) dri_vo: request for Planar 444P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 444P 16-bit big-endian) scale: query(Planar 444P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(51323234) dri_vo: request for Planar 422P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 422P 16-bit little-endian) scale: query(Planar 422P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34323251) dri_vo: request for Planar 422P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 422P 16-bit big-endian) scale: query(Planar 422P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(51303234) dri_vo: request for Planar 420P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 420P 16-bit little-endian) scale: query(Planar 420P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34323051) dri_vo: request for Planar 420P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 420P 16-bit big-endian) scale: query(Planar 420P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(41303234) dri_vo: request for Planar YV12 with alpha fourcc: 0 [vf_vo2] 0=query_format(Planar YV12 with alpha) scale: query(Planar YV12 with alpha) -> 0 dri_vo_dbg: vo_query_format(50343434) dri_vo: request for Planar 444P fourcc: 0 [vf_vo2] 0=query_format(Planar 444P) scale: query(Planar 444P) -> 0 dri_vo_dbg: vo_query_format(50323234) dri_vo: request for Planar 422P fourcc: 0 [vf_vo2] 0=query_format(Planar 422P) scale: query(Planar 422P) -> 0 dri_vo_dbg: vo_query_format(32315659) dri_vo: request for Planar YV12 fourcc: 0 [vf_vo2] 0=query_format(Planar YV12) scale: query(Planar YV12) -> 0 dri_vo_dbg: vo_query_format(30323449) dri_vo: request for Planar I420 fourcc: 0 [vf_vo2] 0=query_format(Planar I420) scale: query(Planar I420) -> 0 dri_vo_dbg: vo_query_format(56555949) dri_vo: request for Planar IYUV fourcc: 0 [vf_vo2] 0=query_format(Planar IYUV) scale: query(Planar IYUV) -> 0 dri_vo_dbg: vo_query_format(39555659) dri_vo: request for Planar YVU9 fourcc: 0 [vf_vo2] 0=query_format(Planar YVU9) scale: query(Planar YVU9) -> 0 dri_vo_dbg: vo_query_format(39304649) dri_vo: request for Planar IF09 fourcc: 0 [vf_vo2] 0=query_format(Planar IF09) scale: query(Planar IF09) -> 0 dri_vo_dbg: vo_query_format(50313134) dri_vo: request for Planar 411P fourcc: 0 [vf_vo2] 0=query_format(Planar 411P) scale: query(Planar 411P) -> 0 dri_vo_dbg: vo_query_format(32595559) dri_vo: request for Packed YUY2 fourcc: 0 [vf_vo2] 0=query_format(Packed YUY2) scale: query(Packed YUY2) -> 0 dri_vo_dbg: vo_query_format(59565955) dri_vo: request for Packed UYVY fourcc: 0 [vf_vo2] 0=query_format(Packed UYVY) scale: query(Packed UYVY) -> 0 dri_vo_dbg: vo_query_format(52474230) dri_vo: request for RGB 48-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 48-bit) scale: query(RGB 48-bit) -> 0 dri_vo_dbg: vo_query_format(524742b0) dri_vo: request for BGR 48-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 48-bit) scale: query(BGR 48-bit) -> 0 dri_vo_dbg: vo_query_format(42475220) dri_vo: request for BGRA fourcc: 1 [vf_vo2] 1=query_format(BGRA) scale: query(BGRA) -> 1 dri_vo_dbg: vo_query_format(52474220) dri_vo: request for RGBA fourcc: 0 [vf_vo2] 0=query_format(RGBA) scale: query(RGBA) -> 0 dri_vo_dbg: vo_query_format(42475218) dri_vo: request for BGR 24-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 24-bit) scale: query(BGR 24-bit) -> 0 dri_vo_dbg: vo_query_format(52474218) dri_vo: request for RGB 24-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 24-bit) scale: query(RGB 24-bit) -> 0 dri_vo_dbg: vo_query_format(42475210) dri_vo: request for BGR 16-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 16-bit) scale: query(BGR 16-bit) -> 0 dri_vo_dbg: vo_query_format(52474210) dri_vo: request for RGB 16-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 16-bit) scale: query(RGB 16-bit) -> 0 dri_vo_dbg: vo_query_format(4247520f) dri_vo: request for BGR 15-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 15-bit) scale: query(BGR 15-bit) -> 0 dri_vo_dbg: vo_query_format(5247420f) dri_vo: request for RGB 15-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 15-bit) scale: query(RGB 15-bit) -> 0 dri_vo_dbg: vo_query_format(30303859) dri_vo: request for Planar Y800 fourcc: 0 [vf_vo2] 0=query_format(Planar Y800) scale: query(Planar Y800) -> 0 dri_vo_dbg: vo_query_format(20203859) dri_vo: request for Planar Y8 fourcc: 0 [vf_vo2] 0=query_format(Planar Y8) scale: query(Planar Y8) -> 0 dri_vo_dbg: vo_query_format(42475208) dri_vo: request for BGR 8-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 8-bit) scale: query(BGR 8-bit) -> 0 dri_vo_dbg: vo_query_format(52474208) dri_vo: request for RGB 8-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 8-bit) scale: query(RGB 8-bit) -> 0 dri_vo_dbg: vo_query_format(42475204) dri_vo: request for BGR 4-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 4-bit) scale: query(BGR 4-bit) -> 0 dri_vo_dbg: vo_query_format(52474204) dri_vo: request for RGB 4-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 4-bit) scale: query(RGB 4-bit) -> 0 dri_vo_dbg: vo_query_format(42475284) dri_vo: request for BGR 4-bit per byte fourcc: 0 [vf_vo2] 0=query_format(BGR 4-bit per byte) scale: query(BGR 4-bit per byte) -> 0 dri_vo_dbg: vo_query_format(52474284) dri_vo: request for RGB 4-bit per byte fourcc: 0 [vf_vo2] 0=query_format(RGB 4-bit per byte) scale: query(RGB 4-bit per byte) -> 0 dri_vo_dbg: vo_query_format(42475201) dri_vo: request for BGR 1-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 1-bit) scale: query(BGR 1-bit) -> 0 dri_vo_dbg: vo_query_format(52474201) dri_vo: request for RGB 1-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 1-bit) scale: query(RGB 1-bit) -> 0 dri_vo_dbg: vo_query_format(42475220) dri_vo: request for BGRA fourcc: 1 [vf_vo2] 1=query_format(BGRA) vf_scale: 1025=vf_next_query_format(42475220,160,120); vf_scale: sws_getFlagsAndFilterFromCmdLine(...); vf_scale: sws_getContext(160, 120, Unknown 0x0000, 160, 120, BGRA, e0001004); [swscaler @ 0x4d267c0] (null) is not supported as input pixel format [POSTPR.0x5748bf]:Couldn't init SwScaler for this setup [POSTPR.0x55024f]:FATAL: ?\208?\157?\208?\181 ?\208?\188?\208?\190?\208?\179?\209?\131 ?\208?\191?\209?\128?\208?\190?\208?\184?\208?\189?\208?\184?\209?\134?\208?\184?\208?\176?\208?\187?\208?\184?\208?\183?\208?\184?\209?\128?\208?\190?\208?\178?\208?\176?\209?\130?\209?\140 ?\208?\178?\208?\184?\208?\180?\208?\181?\208?\190 ?\208?\180?\209?\128?\208?\176?\208?\185?\208?\178?\208?\181?\209?\128! vf->first: 352x288@Unknown 0x0000 [352x288@Unknown 0x0000](fmtcvt<-vo2->NULL) dri_vo_caps: driver does support DRI dri_vo_caps: caps=00000000 fourcc=42475220(BGRA) x,y,w,h(0 0 160 120) dri_vo_caps: width,height(160,120) strides(580000) priv.dri.bpp=20 dri_vo_src: w,h(160,120) d_w,d_h(160,120 dri_vo_src: flags=00000004 fourcc=00000000(Unknown 0x0000) dri_vo_dbg: vo_query_format(30323449) dri_vo: request for Planar I420 fourcc: 0 [vf_vo2] 0=query_format(Planar I420) [DECVID.0x5072e7]:vo_debug[step i=0]: query(Planar I420 352x288) returned 0x0 for: [POSTPR.0x54cf00]:[libvf] Using video filters chain: [POSTPR.0x57b671]:VO-CONF: [fbdev] 352x288 => 352x288 Unknown 0x0000 [zoom] [POSTPR.0x57b7e8]:VO: Description: Framebuffer Device VO: Author: Szabolcs Berecz <sz...@in...> [DECVID.0x506fd6]:Can't find colorspace for: 'Planar I420' Trying -vf fmtcvt... Open video filter: [fmtcvt] <352x288 Planar I420> SwScale params: -1 x -1 (-1=no scaling) [POSTPR.0x573fb2]:vf_scale: query_format(30323449(Planar I420), 160, 120 dri_vo_dbg: vo_query_format(51343434) dri_vo: request for Planar 444P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 444P 16-bit little-endian) scale: query(Planar 444P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34343451) dri_vo: request for Planar 444P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 444P 16-bit big-endian) scale: query(Planar 444P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(51323234) dri_vo: request for Planar 422P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 422P 16-bit little-endian) scale: query(Planar 422P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34323251) dri_vo: request for Planar 422P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 422P 16-bit big-endian) scale: query(Planar 422P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(51303234) dri_vo: request for Planar 420P 16-bit little-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 420P 16-bit little-endian) scale: query(Planar 420P 16-bit little-endian) -> 0 dri_vo_dbg: vo_query_format(34323051) dri_vo: request for Planar 420P 16-bit big-endian fourcc: 0 [vf_vo2] 0=query_format(Planar 420P 16-bit big-endian) scale: query(Planar 420P 16-bit big-endian) -> 0 dri_vo_dbg: vo_query_format(41303234) dri_vo: request for Planar YV12 with alpha fourcc: 0 [vf_vo2] 0=query_format(Planar YV12 with alpha) scale: query(Planar YV12 with alpha) -> 0 dri_vo_dbg: vo_query_format(50343434) dri_vo: request for Planar 444P fourcc: 0 [vf_vo2] 0=query_format(Planar 444P) scale: query(Planar 444P) -> 0 dri_vo_dbg: vo_query_format(50323234) dri_vo: request for Planar 422P fourcc: 0 [vf_vo2] 0=query_format(Planar 422P) scale: query(Planar 422P) -> 0 dri_vo_dbg: vo_query_format(32315659) dri_vo: request for Planar YV12 fourcc: 0 [vf_vo2] 0=query_format(Planar YV12) scale: query(Planar YV12) -> 0 dri_vo_dbg: vo_query_format(30323449) dri_vo: request for Planar I420 fourcc: 0 [vf_vo2] 0=query_format(Planar I420) scale: query(Planar I420) -> 0 dri_vo_dbg: vo_query_format(56555949) dri_vo: request for Planar IYUV fourcc: 0 [vf_vo2] 0=query_format(Planar IYUV) scale: query(Planar IYUV) -> 0 dri_vo_dbg: vo_query_format(39555659) dri_vo: request for Planar YVU9 fourcc: 0 [vf_vo2] 0=query_format(Planar YVU9) scale: query(Planar YVU9) -> 0 dri_vo_dbg: vo_query_format(39304649) dri_vo: request for Planar IF09 fourcc: 0 [vf_vo2] 0=query_format(Planar IF09) scale: query(Planar IF09) -> 0 dri_vo_dbg: vo_query_format(50313134) dri_vo: request for Planar 411P fourcc: 0 [vf_vo2] 0=query_format(Planar 411P) scale: query(Planar 411P) -> 0 dri_vo_dbg: vo_query_format(32595559) dri_vo: request for Packed YUY2 fourcc: 0 [vf_vo2] 0=query_format(Packed YUY2) scale: query(Packed YUY2) -> 0 dri_vo_dbg: vo_query_format(59565955) dri_vo: request for Packed UYVY fourcc: 0 [vf_vo2] 0=query_format(Packed UYVY) scale: query(Packed UYVY) -> 0 dri_vo_dbg: vo_query_format(52474230) dri_vo: request for RGB 48-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 48-bit) scale: query(RGB 48-bit) -> 0 dri_vo_dbg: vo_query_format(524742b0) dri_vo: request for BGR 48-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 48-bit) scale: query(BGR 48-bit) -> 0 dri_vo_dbg: vo_query_format(42475220) dri_vo: request for BGRA fourcc: 1 [vf_vo2] 1=query_format(BGRA) scale: query(BGRA) -> 1 dri_vo_dbg: vo_query_format(52474220) dri_vo: request for RGBA fourcc: 0 [vf_vo2] 0=query_format(RGBA) scale: query(RGBA) -> 0 dri_vo_dbg: vo_query_format(42475218) dri_vo: request for BGR 24-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 24-bit) scale: query(BGR 24-bit) -> 0 dri_vo_dbg: vo_query_format(52474218) dri_vo: request for RGB 24-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 24-bit) scale: query(RGB 24-bit) -> 0 dri_vo_dbg: vo_query_format(42475210) dri_vo: request for BGR 16-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 16-bit) scale: query(BGR 16-bit) -> 0 dri_vo_dbg: vo_query_format(52474210) dri_vo: request for RGB 16-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 16-bit) scale: query(RGB 16-bit) -> 0 dri_vo_dbg: vo_query_format(4247520f) dri_vo: request for BGR 15-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 15-bit) scale: query(BGR 15-bit) -> 0 dri_vo_dbg: vo_query_format(5247420f) dri_vo: request for RGB 15-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 15-bit) scale: query(RGB 15-bit) -> 0 dri_vo_dbg: vo_query_format(30303859) dri_vo: request for Planar Y800 fourcc: 0 [vf_vo2] 0=query_format(Planar Y800) scale: query(Planar Y800) -> 0 dri_vo_dbg: vo_query_format(20203859) dri_vo: request for Planar Y8 fourcc: 0 [vf_vo2] 0=query_format(Planar Y8) scale: query(Planar Y8) -> 0 dri_vo_dbg: vo_query_format(42475208) dri_vo: request for BGR 8-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 8-bit) scale: query(BGR 8-bit) -> 0 dri_vo_dbg: vo_query_format(52474208) dri_vo: request for RGB 8-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 8-bit) scale: query(RGB 8-bit) -> 0 dri_vo_dbg: vo_query_format(42475204) dri_vo: request for BGR 4-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 4-bit) scale: query(BGR 4-bit) -> 0 dri_vo_dbg: vo_query_format(52474204) dri_vo: request for RGB 4-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 4-bit) scale: query(RGB 4-bit) -> 0 dri_vo_dbg: vo_query_format(42475284) dri_vo: request for BGR 4-bit per byte fourcc: 0 [vf_vo2] 0=query_format(BGR 4-bit per byte) scale: query(BGR 4-bit per byte) -> 0 dri_vo_dbg: vo_query_format(52474284) dri_vo: request for RGB 4-bit per byte fourcc: 0 [vf_vo2] 0=query_format(RGB 4-bit per byte) scale: query(RGB 4-bit per byte) -> 0 dri_vo_dbg: vo_query_format(42475201) dri_vo: request for BGR 1-bit fourcc: 0 [vf_vo2] 0=query_format(BGR 1-bit) scale: query(BGR 1-bit) -> 0 dri_vo_dbg: vo_query_format(52474201) dri_vo: request for RGB 1-bit fourcc: 0 [vf_vo2] 0=query_format(RGB 1-bit) scale: query(RGB 1-bit) -> 0 dri_vo_dbg: vo_query_format(42475220) dri_vo: request for BGRA fourcc: 1 [vf_vo2] 1=query_format(BGRA) [sw_scale] BGRA supported on vo2 like 401 [sw_scale] returning: 441 vo_debug[step i=0]: query(Planar I420 160x120) returned 0x441 for: [libvf] Using video filters chain: [POSTPR.0x573c4e]:[vf_fmtcvt]: video[0x0] in[Unknown 0x0000] -> out[Unknown 0x0000] VO-CONF: [fbdev] 352x288 => 352x288 Unknown 0x0000 [zoom] VO: Description: Framebuffer Device VO: Author: Szabolcs Berecz <sz...@in...> ------------------------ 8< -------------------------- 8< --------------------------------- let detect some addresses! [OSDEP.0x5a44f8] $addr2line -s -e mplayerxp 0x5a44f8 cpudetect.cpp:101 [PLAYER.0x467c67] main.cpp:466 [LIBVO.0x59439c] font_load.cpp:64 [STREAM.0x47fecc] url.cpp:50 DEMUX.0x5036b5:======= AVI Header ======= basic_string.h:293 DEMUX.0x5038f4:======= STREAM Header ======= basic_string.h:293 DEMUX.0x504304: basic_string.h:293 let investigate address DEMUX.0x504304 with beye! ------------------------ 8< -------------------------- 8< --------------------------------- Current position information File offset: 104304H Virt. address: 504304H Prev. entry: _Z11print_indexP13AVIINDEXEBTRYi Next. entry: _Z23print_avistdindex_chunkP18_avistdindex_chunk Curr. object: #13 CODE USE64 A840H=7350B4H .text ; ;Disassembler dump of 'mplayerxp' ;Range : 1041D7H- 10442DH ;Written by Binary Viewer v 6.1.0-x86_64.Linux64 Build: Feb 6 2012 ;Dumped : Fri Jun 14 17:19:56 2013 ;Format : ELF (Executable and Linking Format) SEGMENT .text BYTE PUBLIC USE64 'CODE' ; size: 7514228 bytes public _Z18print_video_headerP16BITMAPINFOHEADERj: ; ... L001041D7: nop ax,[rax+rax+00000000] ; 660F1F840000000000 public _Z11print_indexP13AVIINDEXENTRYi: L001041E0: push r15 ; 4157 L001041E2: xor eax,eax ; 31C0 L001041E4: push r14 ; 4156 L001041E6: push r13 ; 4155 L001041E8: push r12 ; 4154 L001041EA: push rbp ; 55 L001041EB: push rbx ; 53 L001041EC: sub rsp,+00000858 ; 4881EC58080000 L001041F3: mov [rsp+24],esi ; 89742424 L001041F7: nop ax,[rax+rax+00000000] ; 660F1F840000000000 L00104200: mov (d) [rax+rsp+50],00000000 ; C744045000000000 L00104208: mov (d) [rax+rsp+00000450],00000000; C784045004000000000000 L00104213: add (q) rax,+04 ; 4883C004 L00104217: cmp rax,00000400 ; 483D00040000 L0010421D: jne L00104200 ; 75E1 L0010421F: mov esi,[rsp+24] ; 8B742424 L00104223: test esi,esi ; 85F6 L00104225: jle L0010433C ; 0F8E11010000 L0010422B: mov rbx,rdi ; 4889FB L0010422E: xor r12d,r12d ; 4531E4 L00104231: nop eax,[cs:rax+rax+00000000] ; 6666666666662E0F1F840000000000 L00104240: mov edi,[rbx] ; 8B3B L00104242: calln _Z13avi_stream_idj ; E859C3FAFF L00104247: mov ecx,000000FF ; B9FF000000 L0010424C: cmp eax,00000100 ; 3D00010000 L00104251: mov r9d,[rbx+08] ; 448B4B08 L00104255: mov r8d,[rbx+04] ; 448B4304 L00104259: cmovnc eax,ecx ; 0F43C1 L0010425C: lea rdx,[rsp+3E] ; 488D54243E L00104261: mov esi,00B52F20 ; ->"%5d: %.4s %4X %08X len:%6d pos:%7d->%7.3f %7d->%7.3f" ; BE202FB500 L00104266: movsxd rbp,rax ; 4863E8 L00104269: lea rdi,[rsp+40] ; 488D7C2440 L0010426E: mov r15d,[rbx+0C] ; 448B7B0C L00104272: mov [rsp+20],r9d ; 44894C2420 L00104277: mov [rsp+1C],r8d ; 448944241C L0010427C: mov r13d,[rbp*4+rsp+00000450] ; 448BACAC50040000 L00104284: mov r14d,[rbp*4+rsp+50] ; 448B74AC50 L00104289: calln *_ZNSsC1EPKcRKSaIcE ; E81259F0FF L0010428E: mov ecx,[rip+00AF8DC4] ; 8B0DC48DAF00 L00104294: mov r8d,[rsp+1C] ; 448B44241C L00104299: mov r9d,[rsp+20] ; 448B4C2420 L0010429E: test ecx,ecx ; 85C9 L001042A0: je L00104304 ; 7462 L001042A2: mov eax,r13d ; 4489E8 L001042A5: mov [rsp+10],r13d ; 44896C2410 L001042AA: mov [rsp+08],r14d ; 4489742408 L001042AF: mov [rsp+28],rax ; 4889442428 L001042B4: mov eax,r14d ; 4489F0 L001042B7: mov [rsp],r15d ; 44893C24 L001042BB: cvtsi2ss xmm1,[rsp+28] ; F3480F2A4C2428 L001042C2: mov [rsp+28],rax ; 4889442428 L001042C7: cvtsi2ss xmm0,[rsp+28] ; F3480F2A442428 L001042CE: mov rcx,rbx ; 4889D9 L001042D1: mov edx,r12d ; 4489E2 L001042D4: lea rsi,[rsp+40] ; 488D742440 L001042D9: mov edi,70000010 ; BF10000070 L001042DE: mov eax,00000002 ; B802000000 L001042E3: divss xmm1,[rip+0064F095] ; F30F5E0D95F06400 L001042EB: divss xmm0,[rip+0064F091] ; ->"A" ; F30F5E0591F06400 L001042F3: unpcklps xmm1,xmm1 ; 0F14C9 L001042F6: cvtps2pd xmm1,xmm1 ; 0F5AC9 L001042F9: unpcklps xmm0,xmm0 ; 0F14C0 L001042FC: cvtps2pd xmm0,xmm0 ; 0F5AC0 L001042FF: calln _ZN3usr11mpxp_printfEjRKSsz; E89CB8F6FF L00104304: mov rax,[rsp+40] ; 488B442440 L00104309: lea rdi,[rax-18] ; 488D78E8 L0010430D: cmp rdi,00FFC040 ; 4881FF40C0FF00 L00104314: jne L0010434E ; 7538 L00104316: add r14d,[rbx+0C] ; 4403730C L0010431A: inc r13d ; 41FFC5 L0010431D: inc r12d ; 41FFC4 L00104320: add (q) rbx,+10 ; 4883C310 L00104324: cmp r12d,[rsp+24] ; 443B642424 L00104329: mov [rbp*4+rsp+00000450],r13d ; 4489ACAC50040000 L00104331: mov [rbp*4+rsp+50],r14d ; 448974AC50 L00104336: jne L00104240 ; 0F8504FFFFFF L0010433C: add rsp,+00000858 ; 4881C458080000 L00104343: pop rbx ; 5B L00104344: pop rbp ; 5D L00104345: pop r12 ; 415C L00104347: pop r13 ; 415D L00104349: pop r14 ; 415E L0010434B: pop r15 ; 415F L0010434D: retn ; C3 L0010434E: mov ecx,0040A430 ; B930A44000 L00104353: lea rdx,[rdi+10] ; 488D5710 L00104357: test rcx,rcx ; 4885C9 L0010435A: je L00104393 ; 7437 L0010435C: mov eax,FFFFFFFF ; B8FFFFFFFF L00104361: lock; xadd [rdx],eax ; F00FC102 L00104365: test eax,eax ; 85C0 L00104367: jg L00104316 ; 7FAD L00104369: lea rsi,[rsp+3F] ; 488D74243F L0010436E: calln *_ZNSs4_Rep10_M_destroyERKSaIcE; E8AD53F0FF L00104373: jmps L00104316 ; EBA1 L00104375: mov rbx,rax ; 4889C3 L00104378: mov rax,[rsp+40] ; 488B442440 L0010437D: lea rsi,[rsp+3F] ; 488D74243F L00104382: lea rdi,[rax-18] ; 488D78E8 L00104386: calln *_ZNSs4_Rep10_M_disposeERKSaIcE; E89550F0FF L0010438B: mov rdi,rbx ; 4889DF L0010438E: calln *_Unwind_Resume ; E8BD61F0FF L00104393: mov edx,[rax-08] ; 8B50F8 L00104396: lea ecx,[rdx-01] ; 8D4AFF L00104399: mov [rax-08],ecx ; 8948F8 L0010439C: mov eax,edx ; 89D0 L0010439E: jmps L00104365 ; EBC5 public _Z23print_avistdindex_chunkP18_avistdindex_chunk: L001043A0: push r15 ; 4157 L001043A2: mov esi,00B52F60 ; ->"====== AVI Standard Index Header ========" ; BE602FB500 L001043A7: push r14 ; 4156 L001043A9: push r13 ; 4155 L001043AB: push r12 ; 4154 L001043AD: push rbp ; 55 L001043AE: mov rbp,rdi ; 4889FD L001043B1: push rbx ; 53 L001043B2: sub (q) rsp,+58 ; 'X' ; 4883EC58 L001043B6: movzx eax,[rdi+0A] ; 0FB6470A L001043BA: mov ecx,[rdi+04] ; 8B4F04 L001043BD: mov r15d,[rdi+1C] ; 448B7F1C L001043C1: mov r14,[rdi+14] ; 4C8B7714 L001043C5: lea rdx,[rsp+3E] ; 488D54243E L001043CA: mov r13d,[rdi+0C] ; 448B6F0C L001043CE: movzx r12d,[rdi+0B] ; 440FB6670B L001043D3: movzx ebx,[rdi+08] ; 0FB75F08 L001043D7: lea rdi,[rsp+40] ; 488D7C2440 L001043DC: mov [rsp+28],ecx ; 894C2428 L001043E0: mov [rsp+2F],al ; 8844242F L001043E4: calln *_ZNSsC1EPKcRKSaIcE ; E8B757F0FF L001043E9: mov edi,[rip+00AF8C69] ; 8B3D698CAF00 L001043EF: mov ecx,[rsp+28] ; 8B4C2428 L001043F3: test edi,edi ; 85FF L001043F5: je L00104431 ; 743A L001043F7: movzx r9d,[rsp+2F] ; 440FB64C242F L001043FD: lea rdx,[rbp+10] ; 488D5510 L00104401: mov [rsp+20],r15d ; 44897C2420 L00104406: mov [rsp+10],rdx ; 4889542410 L0010440B: mov [rsp+18],r14 ; 4C89742418 L00104410: movzx r8d,bx ; 440FB7C3 L00104414: mov [rsp+08],r13d ; 44896C2408 L00104419: mov [rsp],r12d ; 44892424 L0010441D: mov rdx,rbp ; 4889EA L00104420: lea rsi,[rsp+40] ; 488D742440 L00104425: mov edi,70000010 ; BF10000070 L0010442A: xor eax,eax ; 31C0 L0010442C: calln _ZN3usr11mpxp_printfEjRKSsz; E86FB7F6FF ------------------------ 8< -------------------------- 8< --------------------------------- this tells me that malefactor damaged addr2line utility on my development computer. Revision Links: -------------- http://sourceforge.net/p/mplayerxp/code/15 http://sourceforge.net/p/mplayerxp/code/14 http://sourceforge.net/p/mplayerxp/code/13 http://sourceforge.net/p/mplayerxp/code/12 http://sourceforge.net/p/mplayerxp/code/12 http://sourceforge.net/p/mplayerxp/code/13 http://sourceforge.net/p/mplayerxp/code/14 http://sourceforge.net/p/mplayerxp/code/15 http://sourceforge.net/p/mplayerxp/code/15 http://sourceforge.net/p/mplayerxp/code/14 http://sourceforge.net/p/mplayerxp/code/13 http://sourceforge.net/p/mplayerxp/code/12 http://sourceforge.net/p/mplayerxp/code/14 http://sourceforge.net/p/mplayerxp/code/14 Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/input2/input.cpp mplayerxp/libao3/ao_sdl.cpp mplayerxp/libmpcodecs/dec_audio.cpp mplayerxp/libmpcodecs/dec_video.cpp mplayerxp/libmpcodecs/libdca/parse.cpp mplayerxp/libmpcodecs/libnuppelvideo/nuppelvideo.cpp mplayerxp/libmpcodecs/vd_lavc.cpp mplayerxp/libmpcodecs/vd_xanim.cpp mplayerxp/libmpdemux/demux_ts.cpp mplayerxp/libmpstream2/cookies.cpp mplayerxp/libmpstream2/librtsp/rtsp_rtp.cpp mplayerxp/libmpstream2/network_asf.cpp mplayerxp/libmpstream2/s_tv.cpp mplayerxp/libmpstream2/tvi/tvi_bsdbt848.cpp mplayerxp/libmpstream2/tvi/tvi_dummy.cpp mplayerxp/libmpstream2/tvi/tvi_v4l.cpp mplayerxp/libmpsub/find_sub.cpp mplayerxp/libmpsub/spudec.cpp mplayerxp/libmpsub/subreader.cpp mplayerxp/libmpsub/vobsub.cpp mplayerxp/libvo2/jpeg_enc.cpp mplayerxp/libvo2/screenshot.cpp mplayerxp/libvo2/screenshot.h mplayerxp/libvo2/sub.cpp mplayerxp/libvo2/video_out.cpp mplayerxp/libvo2/video_out.h mplayerxp/libvo2/vo_fbdev.cpp mplayerxp/libvo2/vo_sdl.cpp mplayerxp/libvo2/vo_vesa.cpp mplayerxp/main.cpp mplayerxp/mpxp_msg.cpp mplayerxp/mpxp_msg.h mplayerxp/nls/mpxp_help-en.h mplayerxp/nls/mpxp_help-ru.h mplayerxp/postproc/af.cpp mplayerxp/postproc/af_ao3.cpp mplayerxp/postproc/af_channels.cpp mplayerxp/postproc/af_crystality.cpp mplayerxp/postproc/af_delay.cpp mplayerxp/postproc/af_dyn.cpp mplayerxp/postproc/af_echo3d.cpp mplayerxp/postproc/af_equalizer.cpp mplayerxp/postproc/af_extrastereo.cpp mplayerxp/postproc/af_ffenc.cpp mplayerxp/postproc/af_format.cpp mplayerxp/postproc/af_hrtf.cpp mplayerxp/postproc/af_lp.cpp mplayerxp/postproc/af_pan.cpp mplayerxp/postproc/af_raw.cpp mplayerxp/postproc/af_resample.cpp mplayerxp/postproc/af_scaletempo.cpp mplayerxp/postproc/af_sinesuppress.cpp mplayerxp/postproc/af_sub.cpp mplayerxp/postproc/af_surround.cpp mplayerxp/postproc/af_tools.cpp mplayerxp/postproc/af_volnorm.cpp mplayerxp/postproc/af_volume.cpp mplayerxp/postproc/libmenu/menu_filesel.cpp mplayerxp/postproc/postprocess.cpp mplayerxp/postproc/vf.cpp mplayerxp/postproc/vf_1bpp.cpp mplayerxp/postproc/vf_delogo.cpp mplayerxp/postproc/vf_dint.cpp mplayerxp/postproc/vf_eq.cpp mplayerxp/postproc/vf_format.cpp mplayerxp/postproc/vf_framestep.cpp mplayerxp/postproc/vf_menu.cpp mplayerxp/postproc/vf_mirror.cpp mplayerxp/postproc/vf_palette.cpp mplayerxp/postproc/vf_panscan.cpp mplayerxp/postproc/vf_raw.cpp mplayerxp/postproc/vf_rectangle.cpp mplayerxp/postproc/vf_rotate.cpp mplayerxp/postproc/vf_scale.cpp mplayerxp/postproc/vf_softpulldown.cpp mplayerxp/postproc/vf_test.cpp mplayerxp/postproc/vf_unsharp.cpp mplayerxp/postproc/vf_yuy2.cpp mplayerxp/postproc/vf_yvu9.cpp Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2013-06-12 14:05:09 UTC (rev 653) +++ mplayerxp/dump.cpp 2013-06-14 16:28:01 UTC (rev 654) @@ -5,6 +5,7 @@ dump.c - stream dumper */ #include <iostream> +#include <sstream> #include <fstream> #include <stdexcept> @@ -59,10 +60,10 @@ name=buf; f.open(name,std::ios_base::out|std::ios_base::binary); if(!f.is_open()){ - MSG_FATAL(MSGTR_CantOpenDumpfile); + mpxp_fatal<<MSGTR_CantOpenDumpfile<<"!!!"<<std::endl; throw std::runtime_error(MSGTR_Fatal_error); } - MSG_INFO("Dumping stream to %s\n",name); + mpxp_info<<"Dumping stream to "<<name<<std::endl; while(!stream->eof()){ binary_packet bp=stream->read(4096); if(bp.size()>0) f.write(bp.cdata(),bp.size()); @@ -139,17 +140,17 @@ else if(strcmp(media,"mpxp") == 0) strcat(stream_dump_name,"dump.mpxp"); else if(strcmp(media,"raw") == 0) strcat(stream_dump_name,"dump.raw"); else { - MSG_FATAL("Unsupported muxer format %s found\n",media); + mpxp_fatal<<"Unsupported muxer format "<<media<<" found"<<std::endl; throw std::runtime_error(MSGTR_Fatal_error); } priv->mux_file.open(stream_dump_name,std::ios_base::out|std::ios_base::binary); - MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); + mpxp_dbg2<<"Preparing stream dumping: "<<stream_dump_name<<std::endl; if(!priv->mux_file.is_open()){ - MSG_FATAL(MSGTR_CantOpenDumpfile); + mpxp_fatal<<MSGTR_CantOpenDumpfile<<"!!!"<<std::endl; throw std::runtime_error(MSGTR_Fatal_error); } if(!(priv->muxer=muxer_new_muxer(media,port,priv->mux_file))) { - MSG_FATAL("Can't initialize muxer\n"); + mpxp_fatal<<"Can't initialize muxer"<<std::endl; throw std::runtime_error(MSGTR_Fatal_error); } if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) { @@ -158,7 +159,7 @@ priv->m_audio->source=sha; priv->m_audio->codec=0; if(!sha->wf) { - sha->wf=(WAVEFORMATEX*)mp_malloc(sizeof(WAVEFORMATEX)); + sha->wf=new(zeromem) WAVEFORMATEX; sha->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; sha->wf->wFormatTag = sha->wtag; sha->wf->nChannels = sha->nch; @@ -194,7 +195,7 @@ priv->m_video->h.dwRate=priv->m_video->h.dwScale*shv->fps; priv->m_video->h.dwSuggestedBufferSize=shv->video.dwSuggestedBufferSize; if(!shv->bih) { - shv->bih=(BITMAPINFOHEADER*)mp_malloc(sizeof(BITMAPINFOHEADER)); + shv->bih=new(zeromem) BITMAPINFOHEADER; shv->bih->biSize=sizeof(BITMAPINFOHEADER); shv->bih->biWidth=shv->src_w; shv->bih->biHeight=shv->src_h; @@ -215,8 +216,8 @@ priv->m_subs->source=NULL; priv->m_subs->codec=0; } else priv->m_subs=NULL; - MSG_DBG2("Opening dump: %X\n",demuxer); - MSG_INFO("Dumping stream to %s\n",stream_dump_name); + mpxp_dbg2<<"Opening dump: "<<std::hex<<demuxer<<std::endl; + mpxp_info<<"Dumping stream to "<<stream_dump_name<<std::endl; muxer_fix_parameters(priv->muxer); muxer_write_header(priv->muxer,demuxer); } @@ -229,16 +230,13 @@ sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(d_audio->sh); sh_video_t* shv=reinterpret_cast<sh_video_t*>(d_video->sh); if(priv) { - MSG_DBG2("Closing dump: %X %f secs\n" - "As video %X-%ix%i audio %X-%ix%ix%i\n" - ,demuxer,shv?priv->vtimer:sha->timer - ,priv->m_video?priv->m_video->bih->biCompression:-1 - ,priv->m_video?priv->m_video->bih->biWidth:-1 - ,priv->m_video?priv->m_video->bih->biHeight:-1 - ,priv->m_audio?priv->m_audio->wf->wFormatTag:-1 - ,priv->m_audio?priv->m_audio->wf->nSamplesPerSec:-1 - ,priv->m_audio?priv->m_audio->wf->wBitsPerSample:-1 - ,priv->m_audio?priv->m_audio->wf->nChannels:-1); + mpxp_dbg2<<"Closing dump: "<<(shv?priv->vtimer:sha->timer)<<" secs"<<std::endl; + mpxp_dbg2<<"As video "<<std::hex<<(priv->m_video?priv->m_video->bih->biCompression:-1) + <<"-"<<(priv->m_video?priv->m_video->bih->biWidth:-1)<<"x" + <<(priv->m_video?priv->m_video->bih->biHeight:-1)<<" audio " + <<(priv->m_audio?priv->m_audio->wf->wFormatTag:-1)<<"-" + <<(priv->m_audio?priv->m_audio->wf->nSamplesPerSec:-1) + <<"x"<<(priv->m_audio?priv->m_audio->wf->wBitsPerSample:-1)<<"x"<<(priv->m_audio?priv->m_audio->wf->nChannels:-1)<<std::endl; if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) priv->m_video->source=shv; if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) priv->m_audio->source=sha; muxer_write_index(priv->muxer); @@ -248,28 +246,20 @@ if(priv->m_video) { priv->m_video->h.dwRate=priv->m_video->h.dwScale*shv->fps; priv->m_video->h.dwSuggestedBufferSize=priv->vsize/priv->decoded_frameno; - MSG_V("Finishing vstream as: scale %u rate %u fps %f (frames=%u timer=%f)\n" - ,priv->m_video->h.dwScale - ,priv->m_video->h.dwRate - ,shv->fps - ,priv->decoded_frameno - ,priv->vtimer+priv->timer_corr); + mpxp_v<<"Finishing vstream as: scale "<<priv->m_video->h.dwScale<<" rate "<<priv->m_video->h.dwRate + <<" fps "<<shv->fps<<" (frames="<<priv->decoded_frameno<<" timer="<<priv->vtimer+priv->timer_corr<<")"<<std::endl; } } if(sha) { if(priv->m_audio) { priv->m_audio->h.dwSuggestedBufferSize=priv->asize/priv->a_frameno; - MSG_V("Finishing astream as: scale %u rate %u (frames=%u timer=%f) avg=%i size=%u\n" - ,priv->m_audio->h.dwScale - ,priv->m_audio->h.dwRate - ,priv->a_frameno - ,sha->timer+priv->timer_corr - ,priv->m_audio->wf->nAvgBytesPerSec - ,priv->asize); + mpxp_v<<"Finishing astream as: scale "<<priv->m_audio->h.dwScale<<" rate "<<priv->m_audio->h.dwRate + <<" (frames="<<priv->a_frameno<<" timer="<<sha->timer+priv->timer_corr + <<") avg="<<priv->m_audio->wf->nAvgBytesPerSec<<" size="<<priv->asize<<std::endl; } } if(demuxer->sub->sh) { - if(priv->m_subs) MSG_V("Finishing sstream as\n"); + if(priv->m_subs) mpxp_v<<"Finishing sstream as"<<std::endl; } priv->mux_file.seekp(0,std::ios_base::beg); muxer_write_header(priv->muxer,demuxer); @@ -297,47 +287,67 @@ MP_UNIT("dump"); priv->my_use_pts=use_pts; /* test stream property */ - MSG_INFO("%s using PTS method\n",use_pts?"":"not"); + mpxp_info<<(use_pts?"":"not")<<" using PTS method"<<std::endl; if(priv->m_video) { - if(!shv) { MSG_ERR("Video not found!!!Skip this stream\n"); return; } - if(!shv->bih) { MSG_ERR("Video property not found!!!Skip this stream\n"); return; } + if(!shv) { mpxp_err<<"Video not found!!!Skip this stream"<<std::endl; return; } + if(!shv->bih) { mpxp_err<<"Video property not found!!!Skip this stream"<<std::endl; return; } if(memcmp(shv->bih,priv->m_video->bih,sizeof(BITMAPINFOHEADER))!=0) { - MSG_ERR("Found different video properties(%X-%ix%i)!=(%X-%ix%i)!!!\nSkip this stream\n", - shv->bih->biCompression,shv->bih->biWidth,shv->bih->biHeight, - priv->m_video->bih->biCompression,priv->m_video->bih->biWidth, - priv->m_video->bih->biHeight); + mpxp_err<<"Found different video properties("<<std::hex<<shv->bih->biCompression + <<"-"<<shv->bih->biWidth<<"x"<<shv->bih->biHeight<<")!=("<<std::hex<<priv->m_video->bih->biCompression + <<"-"<<priv->m_video->bih->biWidth<<"x"<<priv->m_video->bih->biHeight<<")!!!"<<std::endl; + mpxp_err<<"Skip this stream"<<std::endl; return; } priv->m_video->source=shv; } if(priv->m_audio) { - if(!sha) { MSG_ERR("Audio not found!!!Skip this stream\n"); return; } - if(!sha->wf) { MSG_ERR("Audio property not found!!!Skip this stream\n"); return; } + if(!sha) { mpxp_err<<"Audio not found!!! Skip this stream"<<std::endl; return; } + if(!sha->wf) { mpxp_err<<"Audio property not found!!! Skip this stream"<<std::endl; return; } if(memcmp(sha->wf,priv->m_audio->wf,sizeof(WAVEFORMATEX))!=0) { - MSG_ERR("Found different audio properties(%X-%ix%ix%i)!=(%X-%ix%ix%i)X!!!\nSkip this stream\n", - sha->wf->wFormatTag,sha->wf->nSamplesPerSec,sha->wf->wBitsPerSample,sha->wf->nChannels, - priv->m_audio->wf->wFormatTag,priv->m_audio->wf->nSamplesPerSec, - priv->m_audio->wf->wBitsPerSample,priv->m_audio->wf->nChannels); + mpxp_err<<"Found different audio properties("<<std::hex<<sha->wf->wFormatTag + <<"-"<<sha->wf->nSamplesPerSec<<"x"<<sha->wf->wBitsPerSample<<"x"<<sha->wf->nChannels + <<")!=("<<std::hex<<priv->m_audio->wf->wFormatTag<<"-"<<priv->m_audio->wf->nSamplesPerSec + <<"x"<<priv->m_audio->wf->wBitsPerSample<<"x"<<priv->m_audio->wf->nChannels + <<")X!!!"<<std::endl; + mpxp_err<<"Skip this stream"<<std::endl; return; } priv->m_audio->source=sha; } if (seek_to_sec) { - float d; - float rel_seek_secs=0; - seek_args_t seek_p = { 0, 1}; - int a,b; - if (sscanf(seek_to_sec, "%d:%d:%f", &a,&b,&d)==3) - rel_seek_secs += 3600*a +60*b +d ; - else if (sscanf(seek_to_sec, "%d:%f", &a, &d)==2) - rel_seek_secs += 60*a +d; - else if (sscanf(seek_to_sec, "%f", &d)==1) - rel_seek_secs += d; + int a,b; + float d; + char c; + int ok=1; + float rel_seek_secs=0; + seek_args_t seek_p = { 0, 1}; + std::istringstream iss(seek_to_sec); - seek_to_sec = NULL; - MSG_INFO("seeking to %u seconds\n"); - seek_p.secs=rel_seek_secs; - demux_seek_r(*demuxer,&seek_p); + iss>>a; iss>>c; + if(!iss.good() || c!=':') ok=0; + iss>>b; iss>>c; + if(!iss.good() || c!=':') ok=0; + iss>>d; + if(!iss.good()) ok=0; + if (ok) rel_seek_secs += 3600*a +60*b +d ; + else { + ok=1; + iss.str(seek_to_sec); + iss>>a; iss>>c; + if(!iss.good() || c!=':') ok=0; + iss>>b; + if(!iss.good()) ok=0; + if (ok) rel_seek_secs += 60*a +d; + else { + iss.str(mp_conf.seek_to_sec); + iss>>d; + if (iss.good()) rel_seek_secs += d; + } + } + seek_to_sec = NULL; + mpxp_info<<"seeking to "<<rel_seek_secs<<" seconds"<<std::endl; + seek_p.secs=rel_seek_secs; + demux_seek_r(*demuxer,&seek_p); } aeof=sha?0:1; veof=shv?0:1; @@ -364,14 +374,14 @@ } if(use_pts) sha->timer=a_pts; else sha->timer=mpeg_atimer; - MSG_V("Got audio frame: %f %u\n",a_pts,(!aeof)?priv->a_frameno:-1); + mpxp_v<<"Got audio frame: "<<a_pts<<" "<<((!aeof)?priv->a_frameno:-1)<<std::endl; aeof=sha->ds->eof; priv->a_frameno++; if(aeof) break; if(priv->m_audio) { priv->m_audio->buffer=start; if(in_size>0) { - MSG_V("put audio: %f %f %u\n",a_pts,sha->timer+priv->timer_corr,in_size); + mpxp_v<<"put audio: "<<a_pts<<" "<<(sha->timer+priv->timer_corr)<<" "<<in_size<<std::endl; if(priv->m_audio) muxer_write_chunk(priv->m_audio,in_size,priv->m_video?0:AVIIF_KEYFRAME,sha->timer+priv->timer_corr); } @@ -396,15 +406,15 @@ else priv->vtimer=mpeg_vtimer; ++priv->decoded_frameno; veof=shv->ds->eof; - MSG_V("Got video frame %f %i\n",v_pts,(!veof)?priv->decoded_frameno:-1); + mpxp_v<<"Got video frame "<<v_pts<<" "<<((!veof)?priv->decoded_frameno:-1)<<std::endl; if(priv->m_video) priv->m_video->buffer=start; if(in_size>0) { - MSG_V("put video: %f %f %u flg=%u\n",v_pts,priv->vtimer+priv->timer_corr,in_size,shv->ds->flags); + mpxp_v<<"put video: "<<v_pts<<" "<<(priv->vtimer+priv->timer_corr)<<" "<<in_size<<" flg="<<shv->ds->flags<<std::endl; if(priv->m_video) muxer_write_chunk(priv->m_video,in_size,(shv->ds->flags&1)?AVIIF_KEYFRAME:0,priv->vtimer+priv->timer_corr); priv->vsize += in_size; } if(!(priv->decoded_frameno%100)) - MSG_STATUS("Done %u frames\r",priv->decoded_frameno); + mpxp_status<<"Done "<<priv->decoded_frameno<<" frames\r"; } if(demuxer->sub->sh) { float s_pts=0; @@ -415,11 +425,11 @@ cmd = check_cmd(priv); if(cmd == -1) goto done; else - MSG_V("Got sub frame: %f\n",s_pts); + mpxp_v<<"Got sub frame: "<<s_pts<<std::endl; if(priv->m_subs) { priv->m_subs->buffer=start; if(in_size>0) { - MSG_V("put subs: %f %u\n",s_pts,in_size); + mpxp_v<<"put subs: "<<s_pts<<" "<<in_size<<std::endl; if(priv->m_subs) muxer_write_chunk(priv->m_subs,in_size,priv->m_video?0:AVIIF_KEYFRAME,s_pts); } @@ -435,17 +445,11 @@ if(priv->m_audio->wf->nAvgBytesPerSec) priv->timer_corr+=((float)d_audio->tell_pts())/((float)priv->m_audio->wf->nAvgBytesPerSec); } - MSG_STATUS("Done %u frames (video(%X-%ix%i): %llu bytes audio(%X-%ix%ix%i): %llu bytes)\n" - ,priv->decoded_frameno - ,priv->m_video?priv->m_video->bih->biCompression:-1 - ,priv->m_video?priv->m_video->bih->biWidth:-1 - ,priv->m_video?priv->m_video->bih->biHeight:-1 - ,priv->vsize - ,priv->m_audio?priv->m_audio->wf->wFormatTag:-1 - ,priv->m_audio?priv->m_audio->wf->nSamplesPerSec:-1 - ,priv->m_audio?priv->m_audio->wf->wBitsPerSample:-1 - ,priv->m_audio?priv->m_audio->wf->nChannels:-1 - ,priv->asize); + mpxp_status<<"Done "<<priv->decoded_frameno<<" frames (video("<<std::hex<<(priv->m_video?priv->m_video->bih->biCompression:-1) + <<"-"<<(priv->m_video?priv->m_video->bih->biWidth:-1)<<"x"<<(priv->m_video?priv->m_video->bih->biHeight:-1) + <<"): "<<priv->vsize<<" bytes audio("<<std::hex<<(priv->m_audio?priv->m_audio->wf->wFormatTag:-1) + <<"-"<<(priv->m_audio?priv->m_audio->wf->nSamplesPerSec:-1)<<"x"<<(priv->m_audio?priv->m_audio->wf->wBitsPerSample:-1) + <<"x"<<(priv->m_audio?priv->m_audio->wf->nChannels:-1)<<"): "<<priv->asize<<" bytes)"<<std::endl; } } // namespace usr Modified: mplayerxp/input2/input.cpp =================================================================== --- mplayerxp/input2/input.cpp 2013-06-12 14:05:09 UTC (rev 653) +++ mplayerxp/input2/input.cpp 2013-06-14 16:28:01 UTC (rev 654) @@ -548,7 +548,7 @@ cmd_def = &mp_cmds[i]; - cmd = (mp_cmd_t*)mp_malloc(sizeof(mp_cmd_t)); + cmd = new mp_cmd_t; cmd->id = cmd_def->id; cmd->name = mp_strdup(cmd_def->name); @@ -605,7 +605,7 @@ break; } else if(!e) e = ptr+strlen(ptr); l = e-start; - cmd->args[i].v.s = (char*)mp_malloc((l+1)*sizeof(char)); + cmd->args[i].v.s = new char[l+1]; strncpy(cmd->args[i].v.s,start,l); cmd->args[i].v.s[l] = '\0'; ptr2 = start; @@ -662,7 +662,7 @@ // Allocate the buffer if it dont exist if(!mp_fd->buffer) { - mp_fd->buffer = (char*)mp_malloc(MP_CMD_MAX_SIZE*sizeof(char)); + mp_fd->buffer = new char[MP_CMD_MAX_SIZE]; mp_fd->pos = 0; mp_fd->size = MP_CMD_MAX_SIZE; } @@ -711,7 +711,7 @@ l = end - mp_fd->buffer; // Not dropping : put the cmd in ret if( ! (mp_fd->flags & MP_FD_DROP)) { - (*ret) = (char*)mp_malloc((l+1)*sizeof(char)); + (*ret) = new char[l+1]; strncpy((*ret),mp_fd->buffer,l); (*ret)[l] = '\0'; } else { // Remove the dropping flag Modified: mplayerxp/libao3/ao_sdl.cpp =================================================================== --- mplayerxp/libao3/ao_sdl.cpp 2013-06-12 14:05:09 UTC (rev 653) +++ mplayerxp/libao3/ao_sdl.cpp 2013-06-14 16:28:01 UTC (rev 654) @@ -128,15 +128,13 @@ /* setenv is missing on solaris and HPUX */ static void setenv(const char *name, const char *val, int _xx) { - int len = strlen(name) + strlen(val) + 2; - char *env = mp_malloc(len); + int len = strlen(name) + strlen(val) + 2; + char *env = new char [len]; - if (env != NULL) { strcpy(env, name); strcat(env, "="); strcat(env, val); putenv(env); - } } #endif Modified: mplayerxp/libmpcodecs/dec_audio.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_audio.cpp 2013-06-12 14:05:09 UTC (rev 653) +++ mplayerxp/libmpcodecs/dec_audio.cpp 2013-06-14 16:28:01 UTC (rev 654) @@ -69,7 +69,7 @@ sh.o_bps=0; priv.mpadec=ai->query_interface(sh,priv.afi,sh.wtag); } catch(const bad_format_exception&) { - MSG_ERR(MSGTR_CODEC_BAD_AFAMILY,ac, afm); + mpxp_err<<MSGTR_CODEC_BAD_AFAMILY<<" "<<ac<<" ("<<afm<<")"<<std::endl; goto bye; } } @@ -119,7 +119,7 @@ sh.a_buffer=new char [sh.a_buffer_size]; if(!sh.a_buffer) { - MSG_ERR(MSGTR_CantAllocAudioBuf); + mpxp_err<<MSGTR_CantAllocAudioBuf<<std::endl; goto bye; } sh.a_buffer_len=0; @@ -127,7 +127,7 @@ if(!sh.nch || !sh.rate) { mpxp_v<<"audio format wrong: nch="<<sh.nch<<" rate="<<sh.rate<<std::endl; - MSG_WARN(MSGTR_UnknownAudio); + mpxp_warn<<MSGTR_UnknownAudio<<std::endl; goto bye; } @@ -137,7 +137,7 @@ static int warned=0; if(!warned) { warned=1; - MSG_WARN(MSGTR_CODEC_INITAL_AV_RESYNC); + mpxp_warn<<MSGTR_CODEC_INITIAL_AV_RESYNC<<std::endl; } } else if(mpxp_context().engine().xp_core->initial_apts_corr.need_correction==1) { mpxp_context().engine().xp_core->initial_apts += ((float)(mpxp_context().engine().xp_core->initial_apts_corr.pts_bytes-mpxp_context().engine().xp_core->initial_apts_corr.nbytes))/(float)sh.i_bps; @@ -291,7 +291,7 @@ if(!sh.inited) return 0; // no codec - if(minlen>maxlen) MSG_WARN(MSGTR_CODEC_XP_INT_ERR,minlen,maxlen); + if(minlen>maxlen) mpxp_warn<<MSGTR_CODEC_XP_INT_ERR<<": "<<minlen<<">"<<maxlen<<std::endl; if(sh.af_buffer_len) { cp_size=std::min(buflen,sh.af_buffer_len); memcpy(buf,sh.af_buffer,cp_size); @@ -309,7 +309,7 @@ if(sh.af_bps>sh.o_bps) maxlen=std::min(maxlen,buflen*sh.o_bps/sh.af_bps); len=priv.mpadec->run(buf, minlen, maxlen,pts); - if(len>buflen) MSG_WARN(MSGTR_CODEC_BUF_OVERFLOW,sh.codec->driver_name,len,buflen); + if(len>buflen) mpxp_warn<<"["<<sh.codec->driver_name<<"] "<<MSGTR_CODEC_BUF_OVERFLOW<<":"<<len<<">"<<buflen<<std::endl; mpxp_dbg2<<"decaudio: "<<len<<" bytes "<<pts<<" pts min "<<minlen<<" max "<<maxlen<<" buflen "<<buflen<<" o_bps="<<sh.o_bps<<" f_bps="<<sh.af_bps<<std::endl; if(len==0 || !priv.afi.afilter) return 0; // EOF? // run the filters: Modified: mplayerxp/libmpcodecs/dec_video.cpp =================================================================== --- mplayerxp/libmpcodecs/dec_video.cpp 2013-06-12 14:05:09 UTC (rev 653) +++ mplayerxp/libmpcodecs/dec_video.cpp 2013-06-14 16:28:01 UTC (rev 654) @@ -161,7 +161,7 @@ try{ priv.mpvdec=vi->query_interface(*this,sh,priv.psi,sh.fourcc); } catch(const bad_format_exception&) { - MSG_ERR(MSGTR_CODEC_CANT_INITV); + mpxp_err<<MSGTR_CODEC_CANT_INITV<<std::endl; delete priv.mpvdec; goto bye; } @@ -376,7 +376,7 @@ sh.src_w,sh.src_h, mpxp_context().video().output->flags, out_fmt)==0){ - MSG_WARN(MSGTR_CannotInitVO); + mpxp_warn<<MSGTR_CannotInitVO<<std::endl; priv.vfilter_inited=-1; return MPXP_False; } @@ -438,7 +438,7 @@ // Remove the scale filter if we added it ourself if(strcmp(vf_get_first_name(s),"fmtcvt")==0) vf_remove_first(s); } - MSG_WARN(MSGTR_VOincompCodec); + mpxp_warn<<MSGTR_VOincompCodec<<std::endl; priv.vfilter_inited=-1; return MPXP_False; // failed } @@ -512,7 +512,7 @@ screen_size_x,screen_size_y, mpxp_context().video().output->flags, out_fmt)==0){ - MSG_WARN(MSGTR_CannotInitVO); + mpxp_warn<<MSGTR_CannotInitVO<<std::endl; priv.vfilter_inited=-1; return MPXP_False; } Modified: mplayerxp/libmpcodecs/libdca/parse.cpp =================================================================== --- mplayerxp/libmpcodecs/libdca/parse.cpp 2013-06-12 14:05:09 UTC (rev 653) +++ mplayerxp/libmpcodecs/libdca/parse.cpp 2013-06-14 16:28:01 UTC (rev 654) @@ -65,20 +65,11 @@ dca_state_t * state; int i; - state = (dca_state_t *) mp_malloc (sizeof (dca_state_t)); - if (state == NULL) - return NULL; + state = new(zeromem) dca_state_t; - memset (state, 0, sizeof(dca_state_t)); - state->samples = new(alignmem,16) sample_t[256 * 12]; - if (state->samples == NULL) { - delete state; - return NULL; - } - for (i = 0; i < 256 * 12; i++) - state->samples[i] = 0; + for (i = 0; i < 256 * 12; i++) state->samples[i] = 0; /* Pre-calculate cosine modulation coefficients */ pre_calc_cosmod( state ); Modified: mplayerxp/libmpcodecs/libnuppelvideo/nuppelvideo.cpp =================================================================== --- mplayerxp/libmpcodecs/libnuppelvideo/nuppelvideo.cpp 2013-06-12 14:05:09 UTC (rev 653) +++ mplayerxp/libmpcodecs/libnuppelvideo/nuppelvideo.cpp 2013-06-14 16:28:01 UTC (rev 654) @@ -52,7 +52,7 @@ { #ifdef KEEP_BUFFER if (!previous_buffer) - previous_buffer = ( unsigned char * ) mp_malloc ( width * height + ( width * height ) / 2 ); + previous_buffer = new unsigned char[width * height + ( width * height ) / 2]; #endif if (((encodedh->comptype == '2') || @@ -77,7 +77,7 @@ break; case '2': /* RTJpeg with LZO */ if (!buffer) - buffer = ( unsigned char * ) mp_malloc ( width * height + ( width * height ) / 2 ); + buffer = new unsigned char[width * height + ( width * height ) / 2]; if (!buffer) { printf ( "Error decompressing\n" ); Modified: mplayerxp/libmpcodecs/vd_lavc.cpp =================================================================== --- mplayerxp/libmpcodecs/vd_lavc.cpp 2013-06-12 14:05:09 UTC (rev 653) +++ mplayerxp/libmpcodecs/vd_lavc.cpp 2013-06-14 16:28:01 UTC (rev 654) @@ -234,14 +234,14 @@ } lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh.codec->dll_name); if(!lavc_codec){ - MSG_V(MSGTR_MissingLAVCcodec,sh.codec->dll_name); + mpxp_v<<MSGTR_MissingLAVCcodec<<sh.codec->dll_name<<std::endl; throw bad_format_exception(); } ctx = avcodec_alloc_context3(lavc_codec); lavc_picture = avcodec_alloc_frame(); if(!(ctx && lavc_picture)) { - MSG_ERR(MSGTR_OutOfMemory); + mpxp_err<<MSGTR_OutOfMemory<<std::endl; throw std::bad_a... [truncated message content] |
From: <nic...@us...> - 2013-06-20 09:16:35
|
Revision: 656 http://sourceforge.net/p/mplayerxp/code/656 Author: nickols_k Date: 2013-06-20 09:16:33 +0000 (Thu, 20 Jun 2013) Log Message: ----------- sync with beye Modified Paths: -------------- mplayerxp/dump.cpp mplayerxp/libmpdemux/demux_aiff.cpp mplayerxp/libmpdemux/demux_asf.cpp mplayerxp/libmpdemux/demux_avi.cpp mplayerxp/libmpdemux/demux_mpxp64.cpp mplayerxp/libmpstream2/cache2.cpp mplayerxp/xmpcore/binary_packet.cpp mplayerxp/xmpcore/binary_packet.h Modified: mplayerxp/dump.cpp =================================================================== --- mplayerxp/dump.cpp 2013-06-14 21:51:03 UTC (rev 655) +++ mplayerxp/dump.cpp 2013-06-20 09:16:33 UTC (rev 656) @@ -66,7 +66,7 @@ mpxp_info<<"Dumping stream to "<<name<<std::endl; while(!stream->eof()){ binary_packet bp=stream->read(4096); - if(bp.size()>0) f.write(bp.cdata(),bp.size()); + if(bp.size()>0) f<<bp; } f.close(); mpxp_info<<MSGTR_StreamDumped<<std::endl; Modified: mplayerxp/libmpdemux/demux_aiff.cpp =================================================================== --- mplayerxp/libmpdemux/demux_aiff.cpp 2013-06-14 21:51:03 UTC (rev 655) +++ mplayerxp/libmpdemux/demux_aiff.cpp 2013-06-20 09:16:33 UTC (rev 656) @@ -147,7 +147,7 @@ bp=s->read(chunk_size); bp.resize(bp.size()+1); bp[chunk_size]=0; - demuxer->info().add(INFOT_NAME, bp.cdata()); + demuxer->info().add(INFOT_NAME, (const char*)bp.data()); if(priv->verc && (chunk_size&1)) s->read(type_byte); } else @@ -156,7 +156,7 @@ bp=s->read(chunk_size); bp.resize(bp.size()+1); bp[chunk_size]=0; - demuxer->info().add(INFOT_AUTHOR, bp.cdata()); + demuxer->info().add(INFOT_AUTHOR, (const char*)bp.data()); if(priv->verc && (chunk_size&1)) s->read(type_byte); } else @@ -165,7 +165,7 @@ bp=s->read(chunk_size); bp.resize(bp.size()+1); bp[chunk_size]=0; - demuxer->info().add(INFOT_COPYRIGHT, bp.cdata()); + demuxer->info().add(INFOT_COPYRIGHT, (const char*)bp.data()); if(priv->verc && (chunk_size&1)) s->read(type_byte); } else @@ -174,7 +174,7 @@ bp=s->read(chunk_size); bp.resize(bp.size()+1); bp[chunk_size]=0; - demuxer->info().add(INFOT_DESCRIPTION, bp.cdata()); + demuxer->info().add(INFOT_DESCRIPTION,(const char*)bp.data()); if(priv->verc && (chunk_size&1)) s->read(type_byte); } else Modified: mplayerxp/libmpdemux/demux_asf.cpp =================================================================== --- mplayerxp/libmpdemux/demux_asf.cpp 2013-06-14 21:51:03 UTC (rev 655) +++ mplayerxp/libmpdemux/demux_asf.cpp 2013-06-20 09:16:33 UTC (rev 656) @@ -64,13 +64,14 @@ }; // the variable string is modify in this function -void pack_asf_string(char* string, int length) { - int i,j; - if( string==NULL ) return; - for( i=0, j=0; i<length && string[i]!='\0'; i+=2, j++) { - string[j]=string[i]; - } - string[j]='\0'; +std::string pack_asf_string(const char* string, size_t length) { + std::string rc; + size_t i; + if( string==NULL ) return rc; + for( i=0; i<length && string[i]!='\0'; i+=2) { + rc.append(1,string[i]); + } + return rc; } // the variable string is modify in this function @@ -253,32 +254,27 @@ // extract the title if( apriv->contenth.title_size!=0 ) { bp=demuxer->stream->read(apriv->contenth.title_size); - pack_asf_string(bp.cdata(), bp.size()); - demuxer->info().add(INFOT_NAME, bp.cdata()); + demuxer->info().add(INFOT_NAME, pack_asf_string((const char*)bp.data(), bp.size()).c_str()); } // extract the author if( apriv->contenth.author_size!=0 ) { bp=demuxer->stream->read(apriv->contenth.author_size); - pack_asf_string(bp.cdata(),bp.size()); - demuxer->info().add(INFOT_AUTHOR, bp.cdata()); + demuxer->info().add(INFOT_AUTHOR, pack_asf_string((const char*)bp.data(), bp.size()).c_str()); } // extract the copyright if( apriv->contenth.copyright_size!=0 ) { bp=demuxer->stream->read(apriv->contenth.copyright_size); - pack_asf_string(bp.cdata(), bp.size()); - demuxer->info().add(INFOT_COPYRIGHT, bp.cdata()); + demuxer->info().add(INFOT_COPYRIGHT, pack_asf_string((const char*)bp.data(), bp.size()).c_str()); } // extract the comment if( apriv->contenth.comment_size!=0 ) { bp=demuxer->stream->read(apriv->contenth.comment_size); - pack_asf_string(bp.cdata(), bp.size()); - demuxer->info().add(INFOT_COMMENTS, bp.cdata()); + demuxer->info().add(INFOT_COMMENTS, pack_asf_string((const char*)bp.data(), bp.size()).c_str()); } // extract the rating if( apriv->contenth.rating_size!=0 ) { bp=demuxer->stream->read(apriv->contenth.rating_size); - pack_asf_string(bp.cdata(), bp.size()); - demuxer->info().add(INFOT_RATING, bp.cdata()); + demuxer->info().add(INFOT_RATING, pack_asf_string((const char*)bp.data(), bp.size()).c_str()); } MSG_V("\n"); break; @@ -286,12 +282,13 @@ case ASF_GUID_PREFIX_stream_group: { uint16_t stream_id, i; uint32_t max_bitrate; - char *object=NULL, *ptr=NULL; + char *object=NULL; + const char *ptr=NULL; MSG_V("============ ASF Stream group == START ===\n"); MSG_V(" object size = %d\n", (int)apriv->objh.size); bp=demuxer->stream->read(apriv->objh.size ); // FIXME: We need some endian handling below... - ptr = bp.cdata(); + ptr = (const char*)bp.data(); stream_count = le2me_16(*(uint16_t*)ptr); ptr += sizeof(uint16_t); if(stream_count > 0) streams = new uint32_t[2*stream_count]; Modified: mplayerxp/libmpdemux/demux_avi.cpp =================================================================== --- mplayerxp/libmpdemux/demux_avi.cpp 2013-06-14 21:51:03 UTC (rev 655) +++ mplayerxp/libmpdemux/demux_avi.cpp 2013-06-20 09:16:33 UTC (rev 656) @@ -482,9 +482,9 @@ chunksize-=len; bp.resize(bp.size()+1); bp.cdata()[len]=0; - MSG_V("%-10s: %s\n",hdr,bp.cdata()); - if(infot!=-1) demuxer->info().add(infot, bp.cdata()); - else MSG_V(" %s: %s\n",hdr,bp.cdata()); + MSG_V("%-10s: %s\n",hdr,(const char*)bp.data()); + if(infot!=-1) demuxer->info().add(infot, (const char*)bp.data()); + else MSG_V(" %s: %s\n",hdr,(const char*)bp.data()); } } MSG_DBG2("list_end=0x%X pos=0x%X chunksize=0x%X next=0x%X\n", Modified: mplayerxp/libmpdemux/demux_mpxp64.cpp =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.cpp 2013-06-14 21:51:03 UTC (rev 655) +++ mplayerxp/libmpdemux/demux_mpxp64.cpp 2013-06-20 09:16:33 UTC (rev 656) @@ -411,7 +411,7 @@ { binary_packet bp=s->read(len); sub_data.cp=nls_get_screen_cp(mpxp_get_environment()); - demuxer->info().add(infot,nls_recode2screen_cp(codepage,bp.cdata(),bp.size())); + demuxer->info().add(infot,nls_recode2screen_cp(codepage,(const char*)bp.data(),bp.size())); } else s->skip(len); } Modified: mplayerxp/libmpstream2/cache2.cpp =================================================================== --- mplayerxp/libmpstream2/cache2.cpp 2013-06-14 21:51:03 UTC (rev 655) +++ mplayerxp/libmpstream2/cache2.cpp 2013-06-20 09:16:33 UTC (rev 656) @@ -402,7 +402,7 @@ static binary_packet __FASTCALL__ c2_stream_read(cache_vars_t* c,size_t total){ binary_packet rc(total); int len=total,eof,mlen; - char *mem=rc.cdata(); + uint8_t *mem=rc.cdata(); unsigned buf_pos; unsigned cur,i,npackets; Modified: mplayerxp/xmpcore/binary_packet.cpp =================================================================== --- mplayerxp/xmpcore/binary_packet.cpp 2013-06-14 21:51:03 UTC (rev 655) +++ mplayerxp/xmpcore/binary_packet.cpp 2013-06-20 09:16:33 UTC (rev 656) @@ -1,9 +1,9 @@ #include "mpxp_config.h" #include "osdep/mplib.h" using namespace usr; -#include <stdexcept> +#include <stdint.h> +#include <stdlib.h> #include <string.h> - #include "binary_packet.h" namespace usr { @@ -20,7 +20,7 @@ { if(from.len) { buffer=new char[from.len]; - ::memcpy(buffer,from.buffer,len); + memcpy(buffer,from.buffer,len); } } @@ -30,7 +30,7 @@ { if(sz) { buffer=new char[sz]; - ::memcpy(buffer,src,sz); + memcpy(buffer,src,sz); } } @@ -42,7 +42,7 @@ len=sz; if(sz) { buffer = new char[sz]; - ::memcpy(buffer,_data,sz); + memcpy(buffer,_data,sz); } return *this; } @@ -50,7 +50,7 @@ binary_packet& binary_packet::append(const any_t* _data,size_t sz) { if(sz) { buffer = mp_realloc(buffer,len+sz); - ::memcpy(&((char*)buffer)[len],_data,sz); + memcpy(&((char*)buffer)[len],_data,sz); } len+=sz; return *this; @@ -58,6 +58,40 @@ binary_packet& binary_packet::append(const binary_packet& it) { return append(it.buffer,it.len); } +binary_packet& binary_packet::insert(size_t pos,const any_t* sdata,size_t slen) { + resize(len+slen); + memmove(&((uint8_t*)buffer)[pos+slen],&((uint8_t*)buffer)[pos],slen); + memcpy(&((uint8_t*)buffer)[pos],sdata,slen); + return *this; +} + +binary_packet& binary_packet::insert(size_t pos,const binary_packet& it) { return insert(pos,it.buffer,it.len); } + +binary_packet& binary_packet::replace(size_t pos,const any_t* sdata,size_t slen) { + if(pos+slen>len) { + std::ostringstream os; + os<<"."<<get_caller_address()<<" => binary_packet::replace("<<pos<<","<<slen<<")"; + throw std::out_of_range(os.str()); + } + memcpy(&((uint8_t*)buffer)[pos],sdata,slen); + return *this; +} + +binary_packet& binary_packet::replace(size_t pos,const binary_packet& it) { return replace(pos,it.buffer,it.len); } + +binary_packet& binary_packet::remove(size_t pos,size_t n) { + if(pos+n==len) resize(len-n); + else if(pos+n<len){ + memmove(&((uint8_t*)buffer)[pos],&((uint8_t*)buffer)[pos+n],n); + resize(len-n); + } else { + std::ostringstream os; + os<<"."<<get_caller_address()<<" => binary_packet::remove("<<pos<<","<<n<<")"; + throw std::out_of_range(os.str()); + } + return *this; +} + binary_packet binary_packet::operator+(const binary_packet& rhs) const { binary_packet rc(len+rhs.len); ::memcpy(rc.buffer,buffer,len); @@ -75,56 +109,74 @@ return *this; } -char& binary_packet::operator[](size_t idx) { return at(idx); } -const char& binary_packet::operator[](size_t idx) const { return at(idx); } +uint8_t& binary_packet::operator[](size_t idx) { return at(idx); } +const uint8_t& binary_packet::operator[](size_t idx) const { return at(idx); } - bool binary_packet::operator==(const binary_packet& from) const { - if(len==from.len) return ::memcmp(buffer,from.buffer,len)==0; + if(len==from.len) return memcmp(buffer,from.buffer,len)==0; return false; } bool binary_packet::operator!=(const binary_packet& from) const { - if(len==from.len) return ::memcmp(buffer,from.buffer,len)!=0; + if(len==from.len) return memcmp(buffer,from.buffer,len)!=0; return true; } bool binary_packet::operator<(const binary_packet& from) const { - if(len==from.len) return ::memcmp(buffer,from.buffer,len)<0; + if(len==from.len) return memcmp(buffer,from.buffer,len)<0; return len<from.len; } bool binary_packet::operator<=(const binary_packet& from) const { - if(len==from.len) return ::memcmp(buffer,from.buffer,len)<=0; + if(len==from.len) return memcmp(buffer,from.buffer,len)<=0; return len<from.len; } bool binary_packet::operator>(const binary_packet& from) const { - if(len==from.len) return ::memcmp(buffer,from.buffer,len)>0; + if(len==from.len) return memcmp(buffer,from.buffer,len)>0; return len>from.len; } bool binary_packet::operator>=(const binary_packet& from) const { - if(len==from.len) return ::memcmp(buffer,from.buffer,len)>=0; + if(len==from.len) return memcmp(buffer,from.buffer,len)>=0; return len>from.len; } -char& binary_packet::front() { return ((char*)buffer)[0]; } -const char& binary_packet::front() const { return ((const char*)buffer)[0]; } -char& binary_packet::back() { return ((char*)buffer)[len-1]; } -const char& binary_packet::back() const { return ((const char*)buffer)[len-1]; } +uint8_t& binary_packet::front() { return ((uint8_t*)buffer)[0]; } +const uint8_t& binary_packet::front() const { return ((const uint8_t*)buffer)[0]; } +uint8_t& binary_packet::back() { return ((uint8_t*)buffer)[len-1]; } +const uint8_t& binary_packet::back() const { return ((const uint8_t*)buffer)[len-1]; } -char& binary_packet::at(size_t idx) { - if(idx<len) return ((char*)buffer)[idx]; - throw std::out_of_range("binary_packet.at"); +uint8_t& binary_packet::at(size_t idx) { + if(idx<len) return ((uint8_t*)buffer)[idx]; + std::ostringstream os; + os<<"."<<get_caller_address()<<" => binary_packet::at("<<idx<<")"; + throw std::out_of_range(os.str()); } -const char& binary_packet::at(size_t idx) const { - if(idx<len) return ((const char*)buffer)[idx]; - throw std::out_of_range("binary_packet.at const"); +const uint8_t& binary_packet::at(size_t idx) const { + if(idx<len) return ((const uint8_t*)buffer)[idx]; + std::ostringstream os; + os<<"."<<get_caller_address()<<" => binary_packet::at("<<idx<<")"; + throw std::out_of_range(os.str()); } binary_packet binary_packet::subpacket(size_t start,size_t length) const { - if(start+length>len) throw std::out_of_range("binary_packet.subpacket"); + if(start+length>len) { + std::ostringstream os; + os<<"."<<get_caller_address()<<" => binary_packet::subpacket("<<start<<","<<length<<")"; + throw std::out_of_range(os.str()); + } binary_packet rc(length); - ::memcpy(rc.buffer,&((char*)buffer)[start],length); + memcpy(rc.buffer,&((char*)buffer)[start],length); return rc; } +std::ostream& operator<<(std::ostream& os,const binary_packet& bp) { + os.write((const char*)bp.data(),bp.size()); + return os; +} + +std::istream& operator>>(std::istream& is,binary_packet& bp) { + bp.resize(is.width()); + is.read((char*)bp.data(),bp.size()); + return is; +} + binary_packet::~binary_packet() { if(buffer) delete (char*)buffer; } } // namespace usr Modified: mplayerxp/xmpcore/binary_packet.h =================================================================== --- mplayerxp/xmpcore/binary_packet.h 2013-06-14 21:51:03 UTC (rev 655) +++ mplayerxp/xmpcore/binary_packet.h 2013-06-20 09:16:33 UTC (rev 656) @@ -1,6 +1,9 @@ #ifndef BINARY_PACKET_HPP_INCLUDED #define BINARY_PACKET_HPP_INCLUDED 1 #include "osdep/mplib.h" +#include <iostream> +#include <sstream> +#include <stdexcept> namespace usr { class binary_packet : public Opaque { @@ -13,8 +16,8 @@ binary_packet& operator=(const binary_packet& from); binary_packet& operator+=(const binary_packet& from); binary_packet operator+(const binary_packet& rhs) const; - char& operator[](size_t idx); - const char& operator[](size_t idx) const; + uint8_t& operator[](size_t idx); + const uint8_t& operator[](size_t idx) const; bool operator==(const binary_packet& from) const; bool operator!=(const binary_packet& from) const; @@ -26,12 +29,17 @@ virtual binary_packet& assign(const any_t* data,size_t len); virtual binary_packet& append(const any_t* data,size_t len); virtual binary_packet& append(const binary_packet& it); - virtual char& at(size_t idx); - virtual const char& at(size_t idx) const; - virtual char& front(); - virtual const char& front() const; - virtual char& back(); - virtual const char& back() const; + virtual binary_packet& insert(size_t pos,const any_t* data,size_t len); + virtual binary_packet& insert(size_t pos,const binary_packet& it); + virtual binary_packet& replace(size_t pos,const any_t* data,size_t len); + virtual binary_packet& replace(size_t pos,const binary_packet& it); + virtual binary_packet& remove(size_t pos,size_t n); + virtual uint8_t& at(size_t idx); + virtual const uint8_t& at(size_t idx) const; + virtual uint8_t& front(); + virtual const uint8_t& front() const; + virtual uint8_t& back(); + virtual const uint8_t& back() const; virtual binary_packet subpacket(size_t start,size_t length) const; @@ -41,11 +49,40 @@ virtual size_t size() const { return len; } virtual any_t* data() { return buffer; } virtual const any_t* data() const { return buffer; } - virtual char* cdata() { return (char*)buffer; } - virtual const char* cdata() const { return (char*)buffer; } + virtual uint8_t* cdata() { return (uint8_t*)buffer; } + virtual const uint8_t* cdata() const { return (uint8_t*)buffer; } private: any_t* buffer; size_t len; }; + + std::ostream& operator<<(std::ostream& os,const binary_packet&); + std::istream& operator>>(std::istream& is,binary_packet&); // use std::setw() or istream.width() before using this operator + + template<class T> + class objects_container : public binary_packet { + public: + objects_container(size_t sz):binary_packet(sz) {} + objects_container(const any_t* src,size_t sz):binary_packet(src,sz) {} + objects_container(const objects_container& from):binary_packet(from) {} + virtual ~objects_container() {} + + T& operator[](size_t idx) { + if((idx+1)*sizeof(T)<=size()) return ((T*)data())[idx]; + std::ostringstream os; + os<<"."<<get_caller_address()<<" => object_container["<<idx<<"]"; + throw std::out_of_range(os.str()); + } + + const T& operator[](size_t idx) const { + if((idx+1)*sizeof(T)<=size()) return ((const T*)data())[idx]; + std::ostringstream os; + os<<"."<<get_caller_address()<<" => object_container["<<idx<<"] const"; + throw std::out_of_range(os.str()); + } + + virtual T* tdata() { return (T*)data(); } + virtual const T* tdata() const { return (const T*)data(); } + }; } // namespace usr #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2013-06-20 10:08:23
|
Revision: 657 http://sourceforge.net/p/mplayerxp/code/657 Author: nickols_k Date: 2013-06-20 10:08:21 +0000 (Thu, 20 Jun 2013) Log Message: ----------- fix prefix printing Modified Paths: -------------- mplayerxp/libmpconf/cfgparser.cpp mplayerxp/xmpcore/binary_packet.h Modified: mplayerxp/libmpconf/cfgparser.cpp =================================================================== --- mplayerxp/libmpconf/cfgparser.cpp 2013-06-20 09:16:33 UTC (rev 656) +++ mplayerxp/libmpconf/cfgparser.cpp 2013-06-20 10:08:21 UTC (rev 657) @@ -777,14 +777,14 @@ pfxlen=strlen(opts[i].name)+1; if(!pfx.empty()) { pfxlen+=pfx.length(); newpfx=pfx; } else newpfx=""; - newpfx+=opts[i].name; - newpfx+="."; + if(newpfx.empty()) newpfx+=std::string("-"); + newpfx+=std::string(opts[i].name)+"."; __show_options(ntabs+2,newpfx,(const mpxp_option_t *)opts[i].p); } else if(opts[i].type<=CONF_TYPE_PRINT) { std::ostringstream os; for(n=0;n<ntabs;n++) mpxp_info<<" "; if(!pfx.empty()) os<<std::left<<pfx; - else os<<" "; + else os<<" -"; os<<opts[i].name; mpxp_info<<std::left<<std::setw(25)<<os.str()<<" "<<opts[i].help; if((opts[i].flags&CONF_NOCFG)==0) { Modified: mplayerxp/xmpcore/binary_packet.h =================================================================== --- mplayerxp/xmpcore/binary_packet.h 2013-06-20 09:16:33 UTC (rev 656) +++ mplayerxp/xmpcore/binary_packet.h 2013-06-20 10:08:21 UTC (rev 657) @@ -1,6 +1,7 @@ #ifndef BINARY_PACKET_HPP_INCLUDED #define BINARY_PACKET_HPP_INCLUDED 1 #include "osdep/mplib.h" +#include <typeinfo> #include <iostream> #include <sstream> #include <stdexcept> @@ -70,14 +71,14 @@ T& operator[](size_t idx) { if((idx+1)*sizeof(T)<=size()) return ((T*)data())[idx]; std::ostringstream os; - os<<"."<<get_caller_address()<<" => object_container["<<idx<<"]"; + os<<"."<<get_caller_address()<<" => objects_container<"<<typeid(T).name()<<">["<<idx<<"]"; throw std::out_of_range(os.str()); } const T& operator[](size_t idx) const { if((idx+1)*sizeof(T)<=size()) return ((const T*)data())[idx]; std::ostringstream os; - os<<"."<<get_caller_address()<<" => object_container["<<idx<<"] const"; + os<<"."<<get_caller_address()<<" => objects_container"<<typeid(T).name()<<">["<<idx<<"] const"; throw std::out_of_range(os.str()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2009-12-05 18:11:20
|
Revision: 13 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=13&view=rev Author: nickols_k Date: 2009-12-05 18:11:12 +0000 (Sat, 05 Dec 2009) Log Message: ----------- warning suppression Modified Paths: -------------- mplayerxp/mp_msg.c mplayerxp/subreader.c mplayerxp/subreader.h Modified: mplayerxp/mp_msg.c =================================================================== --- mplayerxp/mp_msg.c 2009-12-05 18:09:50 UTC (rev 12) +++ mplayerxp/mp_msg.c 2009-12-05 18:11:12 UTC (rev 13) @@ -7,6 +7,7 @@ #include <pthread.h> #include "config.h" #include "mp_msg.h" +#include "nls/nls.h" #define _bg(x) ((x) >> 4) #define _fg(x) ((x) & 0x0f) Modified: mplayerxp/subreader.c =================================================================== --- mplayerxp/subreader.c 2009-12-05 18:09:50 UTC (rev 12) +++ mplayerxp/subreader.c 2009-12-05 18:11:12 UTC (rev 13) @@ -435,10 +435,10 @@ if (!(sscanf (line, "-->> %ld", &(current->start)) <1)) break; } - - if (previous_aqt_sub != NULL) + + if (previous_aqt_sub != NULL) previous_aqt_sub->end = current->start-1; - + previous_aqt_sub = current; if (!fgets (line, LINE_LEN, fd)) @@ -454,7 +454,7 @@ sub_readtext(line,¤t->text[1]); current->lines = 2; - if ((current->text[0]=="") && (current->text[1]=="")) { + if (strcmp(current->text[0],"")==0 && strcmp(current->text[1],"")==0) { // void subtitle -> end of previous marked and exit previous_aqt_sub = NULL; return NULL; Modified: mplayerxp/subreader.h =================================================================== --- mplayerxp/subreader.h 2009-12-05 18:09:50 UTC (rev 12) +++ mplayerxp/subreader.h 2009-12-05 18:11:12 UTC (rev 13) @@ -30,7 +30,7 @@ unsigned long start; unsigned long end; - + char *text[SUB_MAX_TEXT]; } subtitle; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2009-12-06 12:02:00
|
Revision: 19 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=19&view=rev Author: nickols_k Date: 2009-12-06 12:01:50 +0000 (Sun, 06 Dec 2009) Log Message: ----------- remove duplicated stuff from MPlayerXP Modified Paths: -------------- mplayerxp/libmpcodecs/ad_dshow.c mplayerxp/libmpcodecs/codecs_ld.c mplayerxp/libvo/vo_x11.c mplayerxp/mplayer.c mplayerxp/postproc/Makefile mplayerxp/postproc/postprocess.c mplayerxp/postproc/swscale.c mplayerxp/postproc/swscale.h mplayerxp/postproc/vf_1bpp.c mplayerxp/postproc/vf_down3dright.c mplayerxp/postproc/vf_mirror.c mplayerxp/postproc/vf_palette.c mplayerxp/postproc/vf_raw.c mplayerxp/postproc/vf_rgb2bgr.c mplayerxp/postproc/vf_rotate.c mplayerxp/postproc/vf_test.c mplayerxp/postproc/vf_yuy2.c mplayerxp/postproc/vf_yvu9.c Removed Paths: ------------- mplayerxp/postproc/rgb2rgb.c mplayerxp/postproc/rgb2rgb.h mplayerxp/postproc/rgb2rgb_template.c mplayerxp/postproc/swscale_altivec_template.c mplayerxp/postproc/swscale_internal.h mplayerxp/postproc/swscale_template.c mplayerxp/postproc/yuv2rgb.c mplayerxp/postproc/yuv2rgb_altivec.c mplayerxp/postproc/yuv2rgb_mlib.c mplayerxp/postproc/yuv2rgb_template.c Modified: mplayerxp/libmpcodecs/ad_dshow.c =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.c 2009-12-06 09:53:07 UTC (rev 18) +++ mplayerxp/libmpcodecs/ad_dshow.c 2009-12-06 12:01:50 UTC (rev 19) @@ -40,10 +40,10 @@ static int load_lib( const char *libname ) { if(!(dll_handle=ld_codec(libname,NULL))) return 0; - DS_AudioDecoder_Open_ptr = dlsym(dll_handle,"DS_AudioDecoder_Open"); - DS_AudioDecoder_Destroy_ptr = dlsym(dll_handle,"DS_AudioDecoder_Destroy"); - DS_AudioDecoder_Convert_ptr = dlsym(dll_handle,"DS_AudioDecoder_Convert"); - DS_AudioDecoder_GetSrcSize_ptr = dlsym(dll_handle,"DS_AudioDecoder_GetSrcSize"); + DS_AudioDecoder_Open_ptr = ld_sym(dll_handle,"DS_AudioDecoder_Open"); + DS_AudioDecoder_Destroy_ptr = ld_sym(dll_handle,"DS_AudioDecoder_Destroy"); + DS_AudioDecoder_Convert_ptr = ld_sym(dll_handle,"DS_AudioDecoder_Convert"); + DS_AudioDecoder_GetSrcSize_ptr = ld_sym(dll_handle,"DS_AudioDecoder_GetSrcSize"); return DS_AudioDecoder_Open_ptr && DS_AudioDecoder_Convert_ptr && DS_AudioDecoder_GetSrcSize_ptr && DS_AudioDecoder_Destroy_ptr; } Modified: mplayerxp/libmpcodecs/codecs_ld.c =================================================================== --- mplayerxp/libmpcodecs/codecs_ld.c 2009-12-06 09:53:07 UTC (rev 18) +++ mplayerxp/libmpcodecs/codecs_ld.c 2009-12-06 12:01:50 UTC (rev 19) @@ -43,7 +43,8 @@ void * ld_sym(void *handle,const char *sym_name) { void *rval; - if(!(rval=dlsym(handle,sym_name))) + if(!(rval=dlsym(handle,sym_name))) { MSG_ERR(MSGTR_CODEC_DLL_SYM_ERR,sym_name); + } return rval; } Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2009-12-06 09:53:07 UTC (rev 18) +++ mplayerxp/libvo/vo_x11.c 2009-12-06 12:01:50 UTC (rev 19) @@ -48,7 +48,7 @@ #define MSG_D(args...) #define LOCK_VDECODING() { MSG_D(DA_PREFIX"LOCK_VDECODING\n"); pthread_mutex_lock(&vdecoding_mutex); } -#include "../postproc/rgb2rgb.h" /* for MODE_RGB(BGR) definitions */ +#include "../postproc/swscale.h" /* for MODE_RGB(BGR) definitions */ #include "video_out_internal.h" #include "dri_vo.h" #include "../mp_image.h" Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2009-12-06 09:53:07 UTC (rev 18) +++ mplayerxp/mplayer.c 2009-12-06 12:01:50 UTC (rev 19) @@ -655,7 +655,7 @@ pinfo[xp_id].current_module="uninit_xp"; uninit_dec_ahead(0); } - + if (mask&INITED_SPUDEC){ inited_flags&=~INITED_SPUDEC; pinfo[xp_id].current_module="uninit_spudec"; @@ -746,6 +746,7 @@ pinfo[xp_id].current_module="exit_player"; + sws_uninit(); if(how) MSG_HINT(MSGTR_Exiting,how); MSG_DBG2("max framesize was %d bytes\n",max_framesize); mp_msg_uninit(); @@ -2048,7 +2049,6 @@ memset(&vstat,0,sizeof(video_stat_t)); mp_msg_init(MSGL_STATUS); - MSG_INFO("%s",banner_text); // memset(&vtune,0,sizeof(vo_tune_info_t)); /* Test for cpu capabilities (and corresponding OS support) for optimizing */ @@ -2065,8 +2065,12 @@ xp_num_cpu=get_number_cpu(); #if defined( ARCH_X86 ) || defined(ARCH_X86_64) - get_mmx_optimizations(); + get_mmx_optimizations(); #endif + if(!sws_init()) { + MSG_ERR("MPlayerXP requires working copy of libswscaler\n"); + return 0; + } if(shuffle_playback) playtree->flags|=PLAY_TREE_RND; else playtree->flags&=~PLAY_TREE_RND; playtree = play_tree_cleanup(playtree); @@ -2090,7 +2094,7 @@ if(!filename){ // no file/vcd/dvd -> show HELP: MSG_INFO("%s",help_text); - exit(0); + return 0; } // Many users forget to include command line in bugreports... Modified: mplayerxp/postproc/Makefile =================================================================== --- mplayerxp/postproc/Makefile 2009-12-06 09:53:07 UTC (rev 18) +++ mplayerxp/postproc/Makefile 2009-12-06 12:01:50 UTC (rev 19) @@ -6,7 +6,7 @@ SUBDIRS=libmenu DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@ || exit; done -SRCS=postprocess.c swscale.c rgb2rgb.c yuv2rgb.c +SRCS=postprocess.c swscale.c SRCS+=af.c af_ao2.c af_crystality.c af_mp.c af_dummy.c af_delay.c af_channels.c af_format.c af_resample.c af_volume.c af_equalizer.c af_tools.c af_comp.c af_gate.c af_pan.c af_surround.c af_sub.c af_export.c af_volnorm.c af_extrastereo.c af_lp.c af_dyn.c af_echo3d.c af_hrtf.c af_ffenc.c af_raw.c af_karaoke.c af_center.c af_sinesuppress.c af_scaletempo.c SRCS+=dsp.c SRCS+=vf.c vf_vo.c vf_expand.c vf_format.c vf_yuy2.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_test.c vf_noise.c vf_yvu9.c vf_rectangle.c vf_eq.c vf_dint.c vf_1bpp.c vf_unsharp.c vf_swapuv.c vf_il.c vf_smartblur.c vf_perspective.c vf_down3dright.c vf_denoise3d.c vf_aspect.c vf_softpulldown.c vf_delogo.c vf_yuvcsp.c vf_pp.c vf_scale.c vf_panscan.c vf_raw.c vf_ow.c vf_2xsai.c vf_framestep.c vf_menu.c Modified: mplayerxp/postproc/postprocess.c =================================================================== --- mplayerxp/postproc/postprocess.c 2009-12-06 09:53:07 UTC (rev 18) +++ mplayerxp/postproc/postprocess.c 2009-12-06 12:01:50 UTC (rev 19) @@ -30,12 +30,12 @@ static int load_dll(const char *libname) { if(!(dll_handle=ld_codec(libname,"http://ffmpeg.sf.net"))) return 0; - pp_postprocess_ptr=dlsym(dll_handle,"pp_postprocess"); - pp_get_context_ptr=dlsym(dll_handle,"pp_get_context"); - pp_free_context_ptr=dlsym(dll_handle,"pp_free_context"); - pp_get_mode_by_name_and_quality_ptr=dlsym(dll_handle,"pp_get_mode_by_name_and_quality"); - pp_free_mode_ptr=dlsym(dll_handle,"pp_free_mode"); - pp_help_ptr=dlsym(dll_handle,"pp_help"); + pp_postprocess_ptr=ld_sym(dll_handle,"pp_postprocess"); + pp_get_context_ptr=ld_sym(dll_handle,"pp_get_context"); + pp_free_context_ptr=ld_sym(dll_handle,"pp_free_context"); + pp_get_mode_by_name_and_quality_ptr=ld_sym(dll_handle,"pp_get_mode_by_name_and_quality"); + pp_free_mode_ptr=ld_sym(dll_handle,"pp_free_mode"); + pp_help_ptr=ld_sym(dll_handle,"pp_help"); return pp_postprocess_ptr && pp_get_context_ptr && pp_free_context_ptr && pp_get_mode_by_name_and_quality_ptr && pp_free_mode_ptr; } @@ -48,8 +48,8 @@ { MSG_ERR("Detected error during loading libpostproc"SLIBSUFFIX"! Try to upgrade this codec\n"); return 0; - } - return 1; + } + return 1; } extern void exit_player(char *); Deleted: mplayerxp/postproc/rgb2rgb.c =================================================================== --- mplayerxp/postproc/rgb2rgb.c 2009-12-06 09:53:07 UTC (rev 18) +++ mplayerxp/postproc/rgb2rgb.c 2009-12-06 12:01:50 UTC (rev 19) @@ -1,642 +0,0 @@ -/* - * - * rgb2rgb.c, Software RGB to RGB convertor - * pluralize by Software PAL8 to RGB convertor - * Software YUV to YUV convertor - * Software YUV to RGB convertor - * Written by Nickols_K. - * palette & yuv & runtime cpu stuff by Michael (mic...@gm...) (under GPL) - */ -#include <inttypes.h> -#include "../config.h" -#include "rgb2rgb.h" -#include "swscale.h" -#include "../mangle.h" -#include "../bswap.h" -#include "../libvo/fastmemcpy.h" -#include "../cpudetect.h" - -#define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit - -rgb2rgb_f rgb24to32; -rgb2rgb_f rgb24to16; -rgb2rgb_f rgb24to15; -rgb2rgb_f rgb32to24; -rgb2rgb_f rgb32to16; -rgb2rgb_f rgb32to15; -rgb2rgb_f rgb15to16; -rgb2rgb_f rgb15to24; -rgb2rgb_f rgb15to32; -rgb2rgb_f rgb16to15; -rgb2rgb_f rgb16to24; -rgb2rgb_f rgb16to32; -rgb2rgb_f rgb24tobgr24; -rgb2rgb_f rgb24tobgr16; -rgb2rgb_f rgb24tobgr15; -rgb2rgb_f rgb32tobgr32; -rgb2rgb_f rgb32tobgr16; -rgb2rgb_f rgb32tobgr15; - -planar2packet_f yv12toyuy2; -planar2packet_f yv12touyvy; -planar2packet_f yuv422ptoyuy2; -packet2planar_f yuy2toyv12; -packet2planar_f rgb24toyv12; - -void (* __FASTCALL__ planar2x)(const uint8_t *src, uint8_t *dst, int width, int height, int srcStride, int dstStride); -void (* __FASTCALL__ interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst, - unsigned width, unsigned height, int src1Stride, - int src2Stride, int dstStride); -void (* __FASTCALL__ vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, - uint8_t *dst1, uint8_t *dst2, - unsigned width, unsigned height, - int srcStride1, int srcStride2, - int dstStride1, int dstStride2); -void (* __FASTCALL__ yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, - uint8_t *dst, - unsigned width, unsigned height, - int srcStride1, int srcStride2, - int srcStride3, int dstStride); -void (* __FASTCALL__ yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, - uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - unsigned int width, unsigned int height, int lumStride, int chromStride); -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -static const uint64_t mmx_null __attribute__((used)) __attribute__((aligned(8))) = 0x0000000000000000ULL; -static const uint64_t mmx_one __attribute__((used)) __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; -static const uint64_t mask32b __attribute__((used)) __attribute__((aligned(8))) = 0x000000FF000000FFULL; -static const uint64_t mask32g __attribute__((used)) __attribute__((aligned(8))) = 0x0000FF000000FF00ULL; -static const uint64_t mask32r __attribute__((used)) __attribute__((aligned(8))) = 0x00FF000000FF0000ULL; -static const uint64_t mask32 __attribute__((used)) __attribute__((aligned(8))) = 0x00FFFFFF00FFFFFFULL; -static const uint64_t mask3216br __attribute__((used)) __attribute__((aligned(8)))=0x00F800F800F800F8ULL; -static const uint64_t mask3216g __attribute__((used)) __attribute__((aligned(8)))=0x0000FC000000FC00ULL; -static const uint64_t mask3215g __attribute__((used)) __attribute__((aligned(8)))=0x0000F8000000F800ULL; -static const uint64_t mul3216 __attribute__((used)) __attribute__((aligned(8))) = 0x2000000420000004ULL; -static const uint64_t mul3215 __attribute__((used)) __attribute__((aligned(8))) = 0x2000000820000008ULL; -static const uint64_t mask24b __attribute__((used)) __attribute__((aligned(8))) = 0x00FF0000FF0000FFULL; -static const uint64_t mask24g __attribute__((used)) __attribute__((aligned(8))) = 0xFF0000FF0000FF00ULL; -static const uint64_t mask24r __attribute__((used)) __attribute__((aligned(8))) = 0x0000FF0000FF0000ULL; -static const uint64_t mask24l __attribute__((used)) __attribute__((aligned(8))) = 0x0000000000FFFFFFULL; -static const uint64_t mask24h __attribute__((used)) __attribute__((aligned(8))) = 0x0000FFFFFF000000ULL; -static const uint64_t mask24hh __attribute__((used)) __attribute__((aligned(8))) = 0xffff000000000000ULL; -static const uint64_t mask24hhh __attribute__((used)) __attribute__((aligned(8))) = 0xffffffff00000000ULL; -static const uint64_t mask24hhhh __attribute__((used)) __attribute__((aligned(8))) = 0xffffffffffff0000ULL; -static const uint64_t mask15b __attribute__((used)) __attribute__((aligned(8))) = 0x001F001F001F001FULL; /* 00000000 00011111 xxB */ -static const uint64_t mask15rg __attribute__((used)) __attribute__((aligned(8))) = 0x7FE07FE07FE07FE0ULL; /* 01111111 11100000 RGx */ -static const uint64_t mask15s __attribute__((used)) __attribute__((aligned(8))) = 0xFFE0FFE0FFE0FFE0ULL; -static const uint64_t mask15g __attribute__((used)) __attribute__((aligned(8))) = 0x03E003E003E003E0ULL; -static const uint64_t mask15r __attribute__((used)) __attribute__((aligned(8))) = 0x7C007C007C007C00ULL; -#define mask16b mask15b -static const uint64_t mask16g __attribute__((used)) __attribute__((aligned(8))) = 0x07E007E007E007E0ULL; -static const uint64_t mask16r __attribute__((used)) __attribute__((aligned(8))) = 0xF800F800F800F800ULL; -static const uint64_t red_16mask __attribute__((used)) __attribute__((aligned(8))) = 0x0000f8000000f800ULL; -static const uint64_t green_16mask __attribute__((used)) __attribute__((aligned(8)))= 0x000007e0000007e0ULL; -static const uint64_t blue_16mask __attribute__((used)) __attribute__((aligned(8))) = 0x0000001f0000001fULL; -static const uint64_t red_15mask __attribute__((used)) __attribute__((aligned(8))) = 0x00007c000000f800ULL; -static const uint64_t green_15mask __attribute__((used)) __attribute__((aligned(8)))= 0x000003e0000007e0ULL; -static const uint64_t blue_15mask __attribute__((used)) __attribute__((aligned(8))) = 0x0000001f0000001fULL; - -#ifdef FAST_BGR2YV12 -static const uint64_t bgr2YCoeff __attribute__((used)) __attribute__((aligned(8))) = 0x000000210041000DULL; -static const uint64_t bgr2UCoeff __attribute__((used)) __attribute__((aligned(8))) = 0x0000FFEEFFDC0038ULL; -static const uint64_t bgr2VCoeff __attribute__((used)) __attribute__((aligned(8))) = 0x00000038FFD2FFF8ULL; -#else -static const uint64_t bgr2YCoeff __attribute__((used)) __attribute__((aligned(8))) = 0x000020E540830C8BULL; -static const uint64_t bgr2UCoeff __attribute__((used)) __attribute__((aligned(8))) = 0x0000ED0FDAC23831ULL; -static const uint64_t bgr2VCoeff __attribute__((used)) __attribute__((aligned(8))) = 0x00003831D0E6F6EAULL; -#endif -static const uint64_t bgr2YOffset __attribute__((used)) __attribute__((aligned(8))) = 0x1010101010101010ULL; -static const uint64_t bgr2UVOffset __attribute__((used)) __attribute__((aligned(8)))= 0x8080808080808080ULL; -static const uint64_t w1111 __attribute__((used)) __attribute__((aligned(8))) = 0x0001000100010001ULL; - -#if 0 -static volatile uint64_t __attribute__((aligned(8))) b5Dither; -static volatile uint64_t __attribute__((aligned(8))) g5Dither; -static volatile uint64_t __attribute__((aligned(8))) g6Dither; -static volatile uint64_t __attribute__((aligned(8))) r5Dither; - -static uint64_t __attribute__((aligned(8))) dither4[2]={ - 0x0103010301030103LL, - 0x0200020002000200LL,}; - -static uint64_t __attribute__((aligned(8))) dither8[2]={ - 0x0602060206020602LL, - 0x0004000400040004LL,}; -#endif -#endif - -#define RGB2YUV_SHIFT 8 -#define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5)) -#define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5)) -#define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) -#define GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5)) -#define GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5)) -#define GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5)) -#define RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5)) -#define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) -#define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5)) - -//Note: we have C, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one -//Plain C versions -#undef HAVE_MMX -#undef HAVE_MMX2 -#undef HAVE_3DNOW -#undef HAVE_SSE2 -#define RENAME(a) a ## _C -#include "rgb2rgb_template.c" - -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) - -//MMX versions -#ifdef CAN_COMPILE_MMX -#undef RENAME -#define HAVE_MMX -#undef HAVE_MMX2 -#undef HAVE_3DNOW -#undef HAVE_SSE2 -#define RENAME(a) a ## _MMX -#include "rgb2rgb_template.c" -#endif - -//MMX2 versions -#ifdef CAN_COMPILE_MMX2 -#undef RENAME -#define HAVE_MMX -#define HAVE_MMX2 -#undef HAVE_3DNOW -#undef HAVE_SSE2 -#define RENAME(a) a ## _MMX2 -#include "rgb2rgb_template.c" -#endif - -//3DNOW versions -#ifdef CAN_COMPILE_3DNOW -#undef RENAME -#define HAVE_MMX -#undef HAVE_MMX2 -#define HAVE_3DNOW -#undef HAVE_SSE2 -#define RENAME(a) a ## _3DNOW -#include "rgb2rgb_template.c" -#endif - -#endif //ARCH_X86 - -/* - rgb15->rgb16 Original by Strepto/Astral - ported to gcc & bugfixed : A'rpi - MMX2, 3DNOW optimization by Nickols_K - 32bit c version, and and&add trick by Michael Niedermayer -*/ - -void sws_rgb2rgb_init(int flags){ -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -#ifdef CAN_COMPILE_MMX2 - if(flags & SWS_CPU_CAPS_MMX2){ - rgb15to16= rgb15to16_MMX2; - rgb15to24= rgb15to24_MMX2; - rgb15to32= rgb15to32_MMX2; - rgb16to24= rgb16to24_MMX2; - rgb16to32= rgb16to32_MMX2; - rgb16to15= rgb16to15_MMX2; - rgb24to16= rgb24to16_MMX2; - rgb24to15= rgb24to15_MMX2; - rgb24to32= rgb24to32_MMX2; - rgb32to16= rgb32to16_MMX2; - rgb32to15= rgb32to15_MMX2; - rgb32to24= rgb32to24_MMX2; - rgb24tobgr15= rgb24tobgr15_MMX2; - rgb24tobgr16= rgb24tobgr16_MMX2; - rgb24tobgr24= rgb24tobgr24_MMX2; - rgb32tobgr32= rgb32tobgr32_MMX2; - rgb32tobgr16= rgb32tobgr16_MMX2; - rgb32tobgr15= rgb32tobgr15_MMX2; - yv12toyuy2= yv12toyuy2_MMX2; - yv12touyvy= yv12touyvy_MMX2; - yuv422ptoyuy2= yuv422ptoyuy2_MMX2; - yuy2toyv12= yuy2toyv12_MMX2; -// uyvytoyv12= uyvytoyv12_MMX2; - yvu9toyv12= yvu9toyv12_MMX2; - planar2x= planar2x_MMX2; - rgb24toyv12= rgb24toyv12_MMX2; - interleaveBytes= interleaveBytes_MMX2; - vu9_to_vu12= vu9_to_vu12_MMX2; - yvu9_to_yuy2= yvu9_to_yuy2_MMX2; - }else -#endif -#ifdef CAN_COMPILE_3DNOW - if(flags & SWS_CPU_CAPS_3DNOW){ - rgb15to16= rgb15to16_3DNOW; - rgb15to24= rgb15to24_3DNOW; - rgb15to32= rgb15to32_3DNOW; - rgb16to24= rgb16to24_3DNOW; - rgb16to32= rgb16to32_3DNOW; - rgb16to15= rgb16to15_3DNOW; - rgb24to16= rgb24to16_3DNOW; - rgb24to15= rgb24to15_3DNOW; - rgb24to32= rgb24to32_3DNOW; - rgb32to16= rgb32to16_3DNOW; - rgb32to15= rgb32to15_3DNOW; - rgb32to24= rgb32to24_3DNOW; - rgb24tobgr15= rgb24tobgr15_3DNOW; - rgb24tobgr16= rgb24tobgr16_3DNOW; - rgb24tobgr24= rgb24tobgr24_3DNOW; - rgb32tobgr32= rgb32tobgr32_3DNOW; - rgb32tobgr16= rgb32tobgr16_3DNOW; - rgb32tobgr15= rgb32tobgr15_3DNOW; - yv12toyuy2= yv12toyuy2_3DNOW; - yv12touyvy= yv12touyvy_3DNOW; - yuv422ptoyuy2= yuv422ptoyuy2_3DNOW; - yuy2toyv12= yuy2toyv12_3DNOW; -// uyvytoyv12= uyvytoyv12_3DNOW; - yvu9toyv12= yvu9toyv12_3DNOW; - planar2x= planar2x_3DNOW; - rgb24toyv12= rgb24toyv12_3DNOW; - interleaveBytes= interleaveBytes_3DNOW; - vu9_to_vu12= vu9_to_vu12_3DNOW; - yvu9_to_yuy2= yvu9_to_yuy2_3DNOW; - }else -#endif -#ifdef CAN_COMPILE_MMX - if(flags & SWS_CPU_CAPS_MMX){ - rgb15to16= rgb15to16_MMX; - rgb15to24= rgb15to24_MMX; - rgb15to32= rgb15to32_MMX; - rgb16to24= rgb16to24_MMX; - rgb16to32= rgb16to32_MMX; - rgb16to15= rgb16to15_MMX; - rgb24to16= rgb24to16_MMX; - rgb24to15= rgb24to15_MMX; - rgb24to32= rgb24to32_MMX; - rgb32to16= rgb32to16_MMX; - rgb32to15= rgb32to15_MMX; - rgb32to24= rgb32to24_MMX; - rgb24tobgr15= rgb24tobgr15_MMX; - rgb24tobgr16= rgb24tobgr16_MMX; - rgb24tobgr24= rgb24tobgr24_MMX; - rgb32tobgr32= rgb32tobgr32_MMX; - rgb32tobgr16= rgb32tobgr16_MMX; - rgb32tobgr15= rgb32tobgr15_MMX; - yv12toyuy2= yv12toyuy2_MMX; - yv12touyvy= yv12touyvy_MMX; - yuv422ptoyuy2= yuv422ptoyuy2_MMX; - yuy2toyv12= yuy2toyv12_MMX; -// uyvytoyv12= uyvytoyv12_MMX; - yvu9toyv12= yvu9toyv12_MMX; - planar2x= planar2x_MMX; - rgb24toyv12= rgb24toyv12_MMX; - interleaveBytes= interleaveBytes_MMX; - vu9_to_vu12= vu9_to_vu12_MMX; - yvu9_to_yuy2= yvu9_to_yuy2_MMX; - }else -#endif -#endif - { - rgb15to16= rgb15to16_C; - rgb15to24= rgb15to24_C; - rgb15to32= rgb15to32_C; - rgb16to24= rgb16to24_C; - rgb16to32= rgb16to32_C; - rgb16to15= rgb16to15_C; - rgb24to16= rgb24to16_C; - rgb24to15= rgb24to15_C; - rgb24to32= rgb24to32_C; - rgb32to16= rgb32to16_C; - rgb32to15= rgb32to15_C; - rgb32to24= rgb32to24_C; - rgb24tobgr15= rgb24tobgr15_C; - rgb24tobgr16= rgb24tobgr16_C; - rgb24tobgr24= rgb24tobgr24_C; - rgb32tobgr32= rgb32tobgr32_C; - rgb32tobgr16= rgb32tobgr16_C; - rgb32tobgr15= rgb32tobgr15_C; - yv12toyuy2= yv12toyuy2_C; - yv12touyvy= yv12touyvy_C; - yuv422ptoyuy2= yuv422ptoyuy2_C; - yuy2toyv12= yuy2toyv12_C; -// uyvytoyv12= uyvytoyv12_C; - yvu9toyv12= yvu9toyv12_C; - planar2x= planar2x_C; - rgb24toyv12= rgb24toyv12_C; - interleaveBytes= interleaveBytes_C; - vu9_to_vu12= vu9_to_vu12_C; - yvu9_to_yuy2= yvu9_to_yuy2_C; - } -} - -/** - * Pallete is assumed to contain bgr32 - */ -void __FASTCALL__ palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) -{ - unsigned i; - -/* - for(i=0; i<num_pixels; i++) - ((unsigned *)dst)[i] = ((unsigned *)palette)[ src[i] ]; -*/ - - for(i=0; i<num_pixels; i++) - { -#ifdef WORDS_BIGENDIAN - dst[3]= palette[ src[i]*4+2 ]; - dst[2]= palette[ src[i]*4+1 ]; - dst[1]= palette[ src[i]*4+0 ]; -#else - //FIXME slow? - dst[0]= palette[ src[i]*4+2 ]; - dst[1]= palette[ src[i]*4+1 ]; - dst[2]= palette[ src[i]*4+0 ]; -// dst[3]= 0; /* do we need this cleansing? */ -#endif - dst+= 4; - } -} - -void __FASTCALL__ palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) -{ - unsigned i; - for(i=0; i<num_pixels; i++) - { -#ifdef WORDS_BIGENDIAN - dst[3]= palette[ src[i]*4+0 ]; - dst[2]= palette[ src[i]*4+1 ]; - dst[1]= palette[ src[i]*4+2 ]; -#else - //FIXME slow? - dst[0]= palette[ src[i]*4+0 ]; - dst[1]= palette[ src[i]*4+1 ]; - dst[2]= palette[ src[i]*4+2 ]; -// dst[3]= 0; /* do we need this cleansing? */ -#endif - dst+= 4; - } -} - -/** - * Pallete is assumed to contain bgr32 - */ -void __FASTCALL__ palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) -{ - unsigned i; -/* - writes 1 byte o much and might cause alignment issues on some architectures? - for(i=0; i<num_pixels; i++) - ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ]; -*/ - for(i=0; i<num_pixels; i++) - { - //FIXME slow? - dst[0]= palette[ src[i]*4+2 ]; - dst[1]= palette[ src[i]*4+1 ]; - dst[2]= palette[ src[i]*4+0 ]; - dst+= 3; - } -} - -void __FASTCALL__ palette8tobgr24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) -{ - unsigned i; -/* - writes 1 byte o much and might cause alignment issues on some architectures? - for(i=0; i<num_pixels; i++) - ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ]; -*/ - for(i=0; i<num_pixels; i++) - { - //FIXME slow? - dst[0]= palette[ src[i]*4+0 ]; - dst[1]= palette[ src[i]*4+1 ]; - dst[2]= palette[ src[i]*4+2 ]; - dst+= 3; - } -} - -/** - * Palette is assumed to contain bgr16, see rgb32to16 to convert the palette - */ -void __FASTCALL__ palette8torgb16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) -{ - unsigned i; - for(i=0; i<num_pixels; i++) - { - unsigned char r,g,b; - b=palette[src[i]*4+0]; - g=palette[src[i]*4+1]; - r=palette[src[i]*4+2]; - ((uint16_t *)dst)[i]=((b&0xF8)<<8)+((g&0xFC)<<3)+(r>>3); - } -} -void __FASTCALL__ palette8tobgr16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) -{ - unsigned i; - for(i=0; i<num_pixels; i++) - { - unsigned char r,g,b; - r=palette[src[i]*4+0]; - g=palette[src[i]*4+1]; - b=palette[src[i]*4+2]; - ((uint16_t *)dst)[i]=((b&0xF8)<<8)+((g&0xFC)<<3)+(r>>3); - } -} - -/** - * Pallete is assumed to contain bgr15, see rgb32to15 to convert the palette - */ -void __FASTCALL__ palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) -{ - unsigned i; - for(i=0; i<num_pixels; i++) - { - unsigned char r,g,b; - b=palette[src[i]*4+0]; - g=palette[src[i]*4+1]; - r=palette[src[i]*4+2]; - ((uint16_t *)dst)[i]=((b&0xF8)<<7)+((g&0xF8)<<2)+(r>>3); - } -} -void __FASTCALL__ palette8tobgr15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) -{ - unsigned i; - for(i=0; i<num_pixels; i++) - { - unsigned char r,g,b; - r=palette[src[i]*4+0]; - g=palette[src[i]*4+1]; - b=palette[src[i]*4+2]; - ((uint16_t *)dst)[i]=((b&0xF8)<<7)+((g&0xF8)<<2)+(r>>3); - } -} - -void __FASTCALL__ rgb32tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - unsigned i; - unsigned num_pixels = src_size >> 2; - for(i=0; i<num_pixels; i++) - { - dst[3*i + 0] = src[4*i + 2]; - dst[3*i + 1] = src[4*i + 1]; - dst[3*i + 2] = src[4*i + 0]; - } -} - -void __FASTCALL__ rgb24tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - unsigned i; - for(i=0; 3*i<src_size; i++) - { - dst[4*i + 0] = src[3*i + 2]; - dst[4*i + 1] = src[3*i + 1]; - dst[4*i + 2] = src[3*i + 0]; - dst[4*i + 3] = 0; - } -} - -void __FASTCALL__ rgb16tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - const uint16_t *end; - uint8_t *d = (uint8_t *)dst; - const uint16_t *s = (uint16_t *)src; - end = s + src_size/2; - while(s < end) - { - register uint16_t bgr; - bgr = *s++; - *d++ = (bgr&0xF800)>>8; - *d++ = (bgr&0x7E0)>>3; - *d++ = (bgr&0x1F)<<3; - *d++ = 0; - } -} - -void __FASTCALL__ rgb16tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - const uint16_t *end; - uint8_t *d = (uint8_t *)dst; - const uint16_t *s = (const uint16_t *)src; - end = s + src_size/2; - while(s < end) - { - register uint16_t bgr; - bgr = *s++; - *d++ = (bgr&0xF800)>>8; - *d++ = (bgr&0x7E0)>>3; - *d++ = (bgr&0x1F)<<3; - } -} - -void __FASTCALL__ rgb16tobgr16(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - unsigned i; - unsigned num_pixels = src_size >> 1; - - for(i=0; i<num_pixels; i++) - { - unsigned b,g,r; - register uint16_t rgb; - rgb = src[2*i]; - r = rgb&0x1F; - g = (rgb&0x7E0)>>5; - b = (rgb&0xF800)>>11; - dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11); - } -} - -void __FASTCALL__ rgb16tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - unsigned i; - unsigned num_pixels = src_size >> 1; - - for(i=0; i<num_pixels; i++) - { - unsigned b,g,r; - register uint16_t rgb; - rgb = src[2*i]; - r = rgb&0x1F; - g = (rgb&0x7E0)>>5; - b = (rgb&0xF800)>>11; - dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10); - } -} - -void __FASTCALL__ rgb15tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - const uint16_t *end; - uint8_t *d = (uint8_t *)dst; - const uint16_t *s = (const uint16_t *)src; - end = s + src_size/2; - while(s < end) - { - register uint16_t bgr; - bgr = *s++; - *d++ = (bgr&0x7C00)>>7; - *d++ = (bgr&0x3E0)>>2; - *d++ = (bgr&0x1F)<<3; - *d++ = 0; - } -} - -void __FASTCALL__ rgb15tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - const uint16_t *end; - uint8_t *d = (uint8_t *)dst; - const uint16_t *s = (uint16_t *)src; - end = s + src_size/2; - while(s < end) - { - register uint16_t bgr; - bgr = *s++; - *d++ = (bgr&0x7C00)>>7; - *d++ = (bgr&0x3E0)>>2; - *d++ = (bgr&0x1F)<<3; - } -} - -void __FASTCALL__ rgb15tobgr16(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - unsigned i; - unsigned num_pixels = src_size >> 1; - - for(i=0; i<num_pixels; i++) - { - unsigned b,g,r; - register uint16_t rgb; - rgb = src[2*i]; - r = rgb&0x1F; - g = (rgb&0x3E0)>>5; - b = (rgb&0x7C00)>>10; - dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11); - } -} - -void __FASTCALL__ rgb15tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - unsigned i; - unsigned num_pixels = src_size >> 1; - - for(i=0; i<num_pixels; i++) - { - unsigned b,g,r; - register uint16_t rgb; - rgb = src[2*i]; - r = rgb&0x1F; - g = (rgb&0x3E0)>>5; - b = (rgb&0x7C00)>>10; - dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10); - } -} - -void __FASTCALL__ rgb8tobgr8(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - unsigned i; - unsigned num_pixels = src_size; - for(i=0; i<num_pixels; i++) - { - unsigned b,g,r; - register uint8_t rgb; - rgb = src[i]; - r = (rgb&0x07); - g = (rgb&0x38)>>3; - b = (rgb&0xC0)>>6; - dst[i] = ((b<<1)&0x07) | ((g&0x07)<<3) | ((r&0x03)<<6); - } -} Deleted: mplayerxp/postproc/rgb2rgb.h =================================================================== --- mplayerxp/postproc/rgb2rgb.h 2009-12-06 09:53:07 UTC (rev 18) +++ mplayerxp/postproc/rgb2rgb.h 2009-12-06 12:01:50 UTC (rev 19) @@ -1,134 +0,0 @@ -/* - * - * rgb2rgb.h, Software RGB to RGB convertor - * pluralize by Software PAL8 to RGB convertor - * Software YUV to YUV convertor - * Software YUV to RGB convertor - */ - -#ifndef RGB2RGB_INCLUDED -#define RGB2RGB_INCLUDED - -// Note: do not fix the dependence on stdio.h - -/* A full collection of rgb to rgb(bgr) convertors */ -typedef void (* __FASTCALL__ rgb2rgb_f)(const uint8_t *src,uint8_t *dst,unsigned src_size); - -extern rgb2rgb_f rgb24to32; -extern rgb2rgb_f rgb24to16; -extern rgb2rgb_f rgb24to15; -extern rgb2rgb_f rgb32to24; -extern rgb2rgb_f rgb32to16; -extern rgb2rgb_f rgb32to15; -extern rgb2rgb_f rgb15to16; -extern rgb2rgb_f rgb15to24; -extern rgb2rgb_f rgb15to32; -extern rgb2rgb_f rgb16to15; -extern rgb2rgb_f rgb16to24; -extern rgb2rgb_f rgb16to32; -extern rgb2rgb_f rgb24tobgr24; -extern rgb2rgb_f rgb24tobgr16; -extern rgb2rgb_f rgb24tobgr15; -extern rgb2rgb_f rgb32tobgr32; -extern rgb2rgb_f rgb32tobgr16; -extern rgb2rgb_f rgb32tobgr15; - -extern void __FASTCALL__ rgb24tobgr32(const uint8_t *src, uint8_t *dst, unsigned src_size); -extern void __FASTCALL__ rgb32tobgr24(const uint8_t *src, uint8_t *dst, unsigned src_size); -extern void __FASTCALL__ rgb16tobgr32(const uint8_t *src, uint8_t *dst, unsigned src_size); -extern void __FASTCALL__ rgb16tobgr24(const uint8_t *src, uint8_t *dst, unsigned src_size); -extern void __FASTCALL__ rgb16tobgr16(const uint8_t *src, uint8_t *dst, unsigned src_size); -extern void __FASTCALL__ rgb16tobgr15(const uint8_t *src, uint8_t *dst, unsigned src_size); -extern void __FASTCALL__ rgb15tobgr32(const uint8_t *src, uint8_t *dst, unsigned src_size); -extern void __FASTCALL__ rgb15tobgr24(const uint8_t *src, uint8_t *dst, unsigned src_size); -extern void __FASTCALL__ rgb15tobgr16(const uint8_t *src, uint8_t *dst, unsigned src_size); -extern void __FASTCALL__ rgb15tobgr15(const uint8_t *src, uint8_t *dst, unsigned src_size); -extern void __FASTCALL__ rgb8tobgr8(const uint8_t *src, uint8_t *dst, unsigned src_size); - - -extern void __FASTCALL__ palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette); -extern void __FASTCALL__ palette8tobgr32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette); -extern void __FASTCALL__ palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette); -extern void __FASTCALL__ palette8tobgr24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette); -extern void __FASTCALL__ palette8torgb16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette); -extern void __FASTCALL__ palette8tobgr16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette); -extern void __FASTCALL__ palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette); -extern void __FASTCALL__ palette8tobgr15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette); - -/** - * - * height should be a multiple of 2 and width should be a multiple of 16 (if this is a - * problem for anyone then tell me, and ill fix it) - * chrominance data is only taken from every secound line others are ignored FIXME write HQ version - */ -//void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - -/** - * - * height should be a multiple of 2 and width should be a multiple of 16 (if this is a - * problem for anyone then tell me, and ill fix it) - */ - -typedef void (* __FASTCALL__ planar2packet_f)(const uint8_t *ysrc, const uint8_t *usrc, - const uint8_t *vsrc, uint8_t *dst, - unsigned int width, unsigned int height, - int lumStride, int chromStride, int dstStride); -typedef void (* __FASTCALL__ packet2planar_f)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - unsigned int width, unsigned int height, - int lumStride, int chromStride, int srcStride); -/** - * - * width should be a multiple of 16 - */ -extern planar2packet_f yv12toyuy2; -extern planar2packet_f yuv422ptoyuy2; - -/** - * - * height should be a multiple of 2 and width should be a multiple of 16 (if this is a - * problem for anyone then tell me, and ill fix it) - */ -extern packet2planar_f yuy2toyv12; - -/** - * - * height should be a multiple of 2 and width should be a multiple of 16 (if this is a - * problem for anyone then tell me, and ill fix it) - */ -extern planar2packet_f yv12touyvy; - -/** - * - * height should be a multiple of 2 and width should be a multiple of 2 (if this is a - * problem for anyone then tell me, and ill fix it) - * chrominance data is only taken from every secound line others are ignored FIXME write HQ version - */ -extern packet2planar_f rgb24toyv12; -extern void (* __FASTCALL__ planar2x)(const uint8_t *src, uint8_t *dst, int width, int height, int srcStride, int dstStride); - -extern void (* __FASTCALL__ interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst, - unsigned width, unsigned height, int src1Stride, - int src2Stride, int dstStride); - -extern void (* __FASTCALL__ yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, - uint8_t *ydst, uint8_t *udst, uint8_t *vdst, - unsigned int width, unsigned int height, int lumStride, int chromStride); - -extern void (* __FASTCALL__ vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, - uint8_t *dst1, uint8_t *dst2, - unsigned width, unsigned height, - int srcStride1, int srcStride2, - int dstStride1, int dstStride2); - -extern void (* __FASTCALL__ yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, - uint8_t *dst, - unsigned width, unsigned height, - int srcStride1, int srcStride2, - int srcStride3, int dstStride); - -void sws_rgb2rgb_init(int flags); - -#define MODE_RGB 0x1 -#define MODE_BGR 0x2 - -#endif Deleted: mplayerxp/postproc/rgb2rgb_template.c =================================================================== --- mplayerxp/postproc/rgb2rgb_template.c 2009-12-06 09:53:07 UTC (rev 18) +++ mplayerxp/postproc/rgb2rgb_template.c 2009-12-06 12:01:50 UTC (rev 19) @@ -1,3202 +0,0 @@ -/* - * - * rgb2rgb.c, Software RGB to RGB convertor - * pluralize by Software PAL8 to RGB convertor - * Software YUV to YUV convertor - * Software YUV to RGB convertor - * Written by Nickols_K. - * palette & yuv & runtime cpu stuff by Michael (mic...@gm...) (under GPL) - * lot of big-endian byteorder fixes by Alex Beregszaszi - */ - -#include <stddef.h> -#include <inttypes.h> /* for __WORDSIZE */ - -#ifndef __WORDSIZE -// #warning You have misconfigured system and probably will lose performance! -#define __WORDSIZE MP_WORDSIZE -#endif - -#undef PREFETCH -#undef MOVNTQ -#undef EMMS -#undef SFENCE -#undef MMREG_SIZE -#undef PREFETCHW -#undef PAVGB - -#ifdef HAVE_SSE2 -#define MMREG_SIZE 16 -#else -#define MMREG_SIZE 8 -#endif - -#ifdef HAVE_3DNOW -#define PREFETCH "prefetch" -#define PREFETCHW "prefetchw" -#define PAVGB "pavgusb" -#elif defined ( HAVE_MMX2 ) -#define PREFETCH "prefetchnta" -#define PREFETCHW "prefetcht0" -#define PAVGB "pavgb" -#else -#define PREFETCH "/nop" -#define PREFETCHW "/nop" -#endif - -#ifdef HAVE_3DNOW -/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */ -#define EMMS "femms" -#else -#define EMMS "emms" -#endif - -#ifdef HAVE_MMX2 -#define MOVNTQ "movntq" -#define SFENCE "sfence" -#else -#define MOVNTQ "movq" -#define SFENCE "/nop" -#endif - -static void __FASTCALL__ RENAME(rgb24to32)(const uint8_t *src,uint8_t *dst,unsigned src_size) -{ - uint8_t *dest = dst; - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*s):"memory"); - mm_end = end - 23; - __asm __volatile("movq %0, %%mm7"::"m"(mask32) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movd %1, %%mm0\n\t" - "punpckldq 3%1, %%mm0\n\t" - "movd 6%1, %%mm1\n\t" - "punpckldq 9%1, %%mm1\n\t" - "movd 12%1, %%mm2\n\t" - "punpckldq 15%1, %%mm2\n\t" - "movd 18%1, %%mm3\n\t" - "punpckldq 21%1, %%mm3\n\t" - "pand %%mm7, %%mm0\n\t" - "pand %%mm7, %%mm1\n\t" - "pand %%mm7, %%mm2\n\t" - "pand %%mm7, %%mm3\n\t" - MOVNTQ" %%mm0, %0\n\t" - MOVNTQ" %%mm1, 8%0\n\t" - MOVNTQ" %%mm2, 16%0\n\t" - MOVNTQ" %%mm3, 24%0" - :"=m"(*dest) - :"m"(*s) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - dest += 32; - s += 24; - } - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - while(s < end) - { -#ifdef WORDS_BIGENDIAN - *dest++ = 0; - *dest++ = *s++; - *dest++ = *s++; - *dest++ = *s++; -#else - *dest++ = *s++; - *dest++ = *s++; - *dest++ = *s++; - *dest++ = 0; -#endif - } -} - -static void __FASTCALL__ RENAME(rgb32to24)(const uint8_t *src,uint8_t *dst,unsigned src_size) -{ - uint8_t *dest = dst; - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*s):"memory"); - mm_end = end - 31; - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movq %1, %%mm0\n\t" - "movq 8%1, %%mm1\n\t" - "movq 16%1, %%mm4\n\t" - "movq 24%1, %%mm5\n\t" - "movq %%mm0, %%mm2\n\t" - "movq %%mm1, %%mm3\n\t" - "movq %%mm4, %%mm6\n\t" - "movq %%mm5, %%mm7\n\t" - "psrlq $8, %%mm2\n\t" - "psrlq $8, %%mm3\n\t" - "psrlq $8, %%mm6\n\t" - "psrlq $8, %%mm7\n\t" - "pand %2, %%mm0\n\t" - "pand %2, %%mm1\n\t" - "pand %2, %%mm4\n\t" - "pand %2, %%mm5\n\t" - "pand %3, %%mm2\n\t" - "pand %3, %%mm3\n\t" - "pand %3, %%mm6\n\t" - "pand %3, %%mm7\n\t" - "por %%mm2, %%mm0\n\t" - "por %%mm3, %%mm1\n\t" - "por %%mm6, %%mm4\n\t" - "por %%mm7, %%mm5\n\t" - - "movq %%mm1, %%mm2\n\t" - "movq %%mm4, %%mm3\n\t" - "psllq $48, %%mm2\n\t" - "psllq $32, %%mm3\n\t" - "pand %4, %%mm2\n\t" - "pand %5, %%mm3\n\t" - "por %%mm2, %%mm0\n\t" - "psrlq $16, %%mm1\n\t" - "psrlq $32, %%mm4\n\t" - "psllq $16, %%mm5\n\t" - "por %%mm3, %%mm1\n\t" - "pand %6, %%mm5\n\t" - "por %%mm5, %%mm4\n\t" - - MOVNTQ" %%mm0, %0\n\t" - MOVNTQ" %%mm1, 8%0\n\t" - MOVNTQ" %%mm4, 16%0" - :"=m"(*dest) - :"m"(*s),"m"(mask24l), - "m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - dest += 24; - s += 32; - } - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - while(s < end) - { -#ifdef WORDS_BIGENDIAN - s++; - *dest++ = *s++; - *dest++ = *s++; - *dest++ = *s++; -#else - *dest++ = *s++; - *dest++ = *s++; - *dest++ = *s++; - s++; -#endif - } -} - -/* - Original by Strepto/Astral - ported to gcc & bugfixed : A'rpi - MMX2, 3DNOW optimization by Nickols_K - 32bit c version, and and&add trick by Michael Niedermayer -*/ -static void __FASTCALL__ RENAME(rgb15to16)(const uint8_t *src,uint8_t *dst,unsigned src_size) -{ - register const uint8_t* s=src; - register uint8_t* d=dst; - register const uint8_t *end; - const uint8_t *mm_end; - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*s)); - __asm __volatile("movq %0, %%mm4"::"m"(mask15s) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - mm_end = end - 15; - while(s<mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movq %1, %%mm0\n\t" - "movq 8%1, %%mm2\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm2, %%mm3\n\t" - "pand %%mm4, %%mm0\n\t" - "pand %%mm4, %%mm2\n\t" - "paddw %%mm1, %%mm0\n\t" - "paddw %%mm3, %%mm2\n\t" - MOVNTQ" %%mm0, %0\n\t" - MOVNTQ" %%mm2, 8%0" - :"=m"(*d) - :"m"(*s) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - d+=16; - s+=16; - } - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - mm_end = end - 3; - while(s < mm_end) - { - register unsigned x= *((uint32_t *)s); - *((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0); - d+=4; - s+=4; - } - if(s < end) - { - register unsigned short x= *((uint16_t *)s); - *((uint16_t *)d) = (x&0x7FFF) + (x&0x7FE0); - } -} - -static void __FASTCALL__ RENAME(rgb16to15)(const uint8_t *src,uint8_t *dst,unsigned src_size) -{ - register const uint8_t* s=src; - register uint8_t* d=dst; - register const uint8_t *end; - const uint8_t *mm_end; - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*s)); - __asm __volatile( "movq %0, %%mm7\n\t" - "movq %1, %%mm6"::"m"(mask15rg),"m"(mask15b) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - mm_end = end - 15; - while(s<mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movq %1, %%mm0\n\t" - "movq 8%1, %%mm2\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm2, %%mm3\n\t" - "psrlq $1, %%mm0\n\t" - "psrlq $1, %%mm2\n\t" - "pand %%mm7, %%mm0\n\t" - "pand %%mm7, %%mm2\n\t" - "pand %%mm6, %%mm1\n\t" - "pand %%mm6, %%mm3\n\t" - "por %%mm1, %%mm0\n\t" - "por %%mm3, %%mm2\n\t" - MOVNTQ" %%mm0, %0\n\t" - MOVNTQ" %%mm2, 8%0" - :"=m"(*d) - :"m"(*s) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - d+=16; - s+=16; - } - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - mm_end = end - 3; - while(s < mm_end) - { - register uint32_t x= *((uint32_t *)s); - *((uint32_t *)d) = ((x>>1)&0x7FE07FE0) | (x&0x001F001F); - s+=4; - d+=4; - } - if(s < end) - { - register uint16_t x= *((uint16_t *)s); - *((uint16_t *)d) = ((x>>1)&0x7FE0) | (x&0x001F); - s+=2; - d+=2; - } -} - -static void __FASTCALL__ RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, unsigned src_size) -{ - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - uint16_t *d = (uint16_t *)dst; - end = s + src_size; -#ifdef HAVE_MMX - mm_end = end - 15; -#if 1 //is faster only if multiplies are reasonable fast (FIXME figure out on which cpus this is faster, on Athlon its slightly faster) - asm volatile( - "movq %3, %%mm5 \n\t" - "movq %4, %%mm6 \n\t" - "movq %5, %%mm7 \n\t" - ".balign 16 \n\t" - "1: \n\t" - PREFETCH" 32(%1) \n\t" - "movd (%1), %%mm0 \n\t" - "movd 4(%1), %%mm3 \n\t" - "punpckldq 8(%1), %%mm0 \n\t" - "punpckldq 12(%1), %%mm3 \n\t" - "movq %%mm0, %%mm1 \n\t" - "movq %%mm3, %%mm4 \n\t" - "pand %%mm6, %%mm0 \n\t" - "pand %%mm6, %%mm3 \n\t" - "pmaddwd %%mm7, %%mm0 \n\t" - "pmaddwd %%mm7, %%mm3 \n\t" - "pand %%mm5, %%mm1 \n\t" - "pand %%mm5, %%mm4 \n\t" - "por %%mm1, %%mm0 \n\t" - "por %%mm4, %%mm3 \n\t" - "psrld $5, %%mm0 \n\t" - "pslld $11, %%mm3 \n\t" - "por %%mm3, %%mm0 \n\t" - MOVNTQ" %%mm0, (%0) \n\t" - "add $16, %1 \n\t" - "add $8, %0 \n\t" - "cmp %2, %1 \n\t" - " jb 1b \n\t" - : "+r" (d), "+r"(s) - : "r" (mm_end), "m" (mask3216g), "m" (mask3216br), "m" (mul3216) - : "memory", "cc" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#else - __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); - __asm __volatile( - "movq %0, %%mm7\n\t" - "movq %1, %%mm6\n\t" - ::"m"(red_16mask),"m"(green_16mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movd %1, %%mm0\n\t" - "movd 4%1, %%mm3\n\t" - "punpckldq 8%1, %%mm0\n\t" - "punpckldq 12%1, %%mm3\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm0, %%mm2\n\t" - "movq %%mm3, %%mm4\n\t" - "movq %%mm3, %%mm5\n\t" - "psrlq $3, %%mm0\n\t" - "psrlq $3, %%mm3\n\t" - "pand %2, %%mm0\n\t" - "pand %2, %%mm3\n\t" - "psrlq $5, %%mm1\n\t" - "psrlq $5, %%mm4\n\t" - "pand %%mm6, %%mm1\n\t" - "pand %%mm6, %%mm4\n\t" - "psrlq $8, %%mm2\n\t" - "psrlq $8, %%mm5\n\t" - "pand %%mm7, %%mm2\n\t" - "pand %%mm7, %%mm5\n\t" - "por %%mm1, %%mm0\n\t" - "por %%mm4, %%mm3\n\t" - "por %%mm2, %%mm0\n\t" - "por %%mm5, %%mm3\n\t" - "psllq $16, %%mm3\n\t" - "por %%mm3, %%mm0\n\t" - MOVNTQ" %%mm0, %0\n\t" - :"=m"(*d):"m"(*s),"m"(blue_16mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - d += 4; - s += 16; - } -#endif - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - while(s < end) - { - // FIXME on bigendian - const int src= *s; s += 4; - *d++ = ((src&0xFF)>>3) + ((src&0xFC00)>>5) + ((src&0xF80000)>>8); -// *d++ = ((src>>3)&0x1F) + ((src>>5)&0x7E0) + ((src>>8)&0xF800); - } -} - -static void __FASTCALL__ RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - uint16_t *d = (uint16_t *)dst; - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); - __asm __volatile( - "movq %0, %%mm7\n\t" - "movq %1, %%mm6\n\t" - ::"m"(red_16mask),"m"(green_16mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - mm_end = end - 15; - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movd %1, %%mm0\n\t" - "movd 4%1, %%mm3\n\t" - "punpckldq 8%1, %%mm0\n\t" - "punpckldq 12%1, %%mm3\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm0, %%mm2\n\t" - "movq %%mm3, %%mm4\n\t" - "movq %%mm3, %%mm5\n\t" - "psllq $8, %%mm0\n\t" - "psllq $8, %%mm3\n\t" - "pand %%mm7, %%mm0\n\t" - "pand %%mm7, %%mm3\n\t" - "psrlq $5, %%mm1\n\t" - "psrlq $5, %%mm4\n\t" - "pand %%mm6, %%mm1\n\t" - "pand %%mm6, %%mm4\n\t" - "psrlq $19, %%mm2\n\t" - "psrlq $19, %%mm5\n\t" - "pand %2, %%mm2\n\t" - "pand %2, %%mm5\n\t" - "por %%mm1, %%mm0\n\t" - "por %%mm4, %%mm3\n\t" - "por %%mm2, %%mm0\n\t" - "por %%mm5, %%mm3\n\t" - "psllq $16, %%mm3\n\t" - "por %%mm3, %%mm0\n\t" - MOVNTQ" %%mm0, %0\n\t" - :"=m"(*d):"m"(*s),"m"(blue_16mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - d += 4; - s += 16; - } - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - while(s < end) - { - // FIXME on bigendian - const int src= *s; s += 4; - *d++ = ((src&0xF8)<<8) + ((src&0xFC00)>>5) + ((src&0xF80000)>>19); - } -} - -static void __FASTCALL__ RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, unsigned src_size) -{ - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - uint16_t *d = (uint16_t *)dst; - end = s + src_size; -#ifdef HAVE_MMX - mm_end = end - 15; -#if 1 //is faster only if multiplies are reasonable fast (FIXME figure out on which cpus this is faster, on Athlon its slightly faster) - asm volatile( - "movq %3, %%mm5 \n\t" - "movq %4, %%mm6 \n\t" - "movq %5, %%mm7 \n\t" - ".balign 16 \n\t" - "1: \n\t" - PREFETCH" 32(%1) \n\t" - "movd (%1), %%mm0 \n\t" - "movd 4(%1), %%mm3 \n\t" - "punpckldq 8(%1), %%mm0 \n\t" - "punpckldq 12(%1), %%mm3 \n\t" - "movq %%mm0, %%mm1 \n\t" - "movq %%mm3, %%mm4 \n\t" - "pand %%mm6, %%mm0 \n\t" - "pand %%mm6, %%mm3 \n\t" - "pmaddwd %%mm7, %%mm0 \n\t" - "pmaddwd %%mm7, %%mm3 \n\t" - "pand %%mm5, %%mm1 \n\t" - "pand %%mm5, %%mm4 \n\t" - "por %%mm1, %%mm0 \n\t" - "por %%mm4, %%mm3 \n\t" - "psrld $6, %%mm0 \n\t" - "pslld $10, %%mm3 \n\t" - "por %%mm3, %%mm0 \n\t" - MOVNTQ" %%mm0, (%0) \n\t" - "add $16, %1 \n\t" - "add $8, %0 \n\t" - "cmp %2, %1 \n\t" - " jb 1b \n\t" - : "+r" (d), "+r"(s) - : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215) - : "memory", "cc" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#else - __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); - __asm __volatile( - "movq %0, %%mm7\n\t" - "movq %1, %%mm6\n\t" - ::"m"(red_15mask),"m"(green_15mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movd %1, %%mm0\n\t" - "movd 4%1, %%mm3\n\t" - "punpckldq 8%1, %%mm0\n\t" - "punpckldq 12%1, %%mm3\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm0, %%mm2\n\t" - "movq %%mm3, %%mm4\n\t" - "movq %%mm3, %%mm5\n\t" - "psrlq $3, %%mm0\n\t" - "psrlq $3, %%mm3\n\t" - "pand %2, %%mm0\n\t" - "pand %2, %%mm3\n\t" - "psrlq $6, %%mm1\n\t" - "psrlq $6, %%mm4\n\t" - "pand %%mm6, %%mm1\n\t" - "pand %%mm6, %%mm4\n\t" - "psrlq $9, %%mm2\n\t" - "psrlq $9, %%mm5\n\t" - "pand %%mm7, %%mm2\n\t" - "pand %%mm7, %%mm5\n\t" - "por %%mm1, %%mm0\n\t" - "por %%mm4, %%mm3\n\t" - "por %%mm2, %%mm0\n\t" - "por %%mm5, %%mm3\n\t" - "psllq $16, %%mm3\n\t" - "por %%mm3, %%mm0\n\t" - MOVNTQ" %%mm0, %0\n\t" - :"=m"(*d):"m"(*s),"m"(blue_15mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - d += 4; - s += 16; - } -#endif - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - while(s < end) - { - // FIXME on bigendian - const int src= *s; s += 4; - *d++ = ((src&0xFF)>>3) + ((src&0xF800)>>6) + ((src&0xF80000)>>9); - } -} - -static void __FASTCALL__ RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size) -{ - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - uint16_t *d = (uint16_t *)dst; - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); - __asm __volatile( - "movq %0, %%mm7\n\t" - "movq %1, %%mm6\n\t" - ::"m"(red_15mask),"m"(green_15mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - mm_end = end - 15; - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movd %1, %%mm0\n\t" - "movd 4%1, %%mm3\n\t" - "punpckldq 8%1, %%mm0\n\t" - "punpckldq 12%1, %%mm3\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm0, %%mm2\n\t" - "movq %%mm3, %%mm4\n\t" - "movq %%mm3, %%mm5\n\t" - "psllq $7, %%mm0\n\t" - "psllq $7, %%mm3\n\t" - "pand %%mm7, %%mm0\n\t" - "pand %%mm7, %%mm3\n\t" - "psrlq $6, %%mm1\n\t" - "psrlq $6, %%mm4\n\t" - "pand %%mm6, %%mm1\n\t" - "pand %%mm6, %%mm4\n\t" - "psrlq $19, %%mm2\n\t" - "psrlq $19, %%mm5\n\t" - "pand %2, %%mm2\n\t" - "pand %2, %%mm5\n\t" - "por %%mm1, %%mm0\n\t" - "por %%mm4, %%mm3\n\t" - "por %%mm2, %%mm0\n\t" - "por %%mm5, %%mm3\n\t" - "psllq $16, %%mm3\n\t" - "por %%mm3, %%mm0\n\t" - MOVNTQ" %%mm0, %0\n\t" - :"=m"(*d):"m"(*s),"m"(blue_15mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - d += 4; - s += 16; - } - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - while(s < end) - { - // FIXME on bigendian - const int src= *s; s += 4; - *d++ = ((src&0xF8)<<7) + ((src&0xF800)>>6) + ((src&0xF80000)>>19); - } -} - -static void __FASTCALL__ RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, unsigned src_size) -{ - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - uint16_t *d = (uint16_t *)dst; - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); - __asm __volatile( - "movq %0, %%mm7\n\t" - "movq %1, %%mm6\n\t" - ::"m"(red_16mask),"m"(green_16mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - mm_end = end - 11; - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movd %1, %%mm0\n\t" - "movd 3%1, %%mm3\n\t" - "punpckldq 6%1, %%mm0\n\t" - "punpckldq 9%1, %%mm3\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm0, %%mm2\n\t" - "movq %%mm3, %%mm4\n\t" - "movq %%mm3, %%mm5\n\t" - "psrlq $3, %%mm0\n\t" - "psrlq $3, %%mm3\n\t" - "pand %2, %%mm0\n\t" - "pand %2, %%mm3\n\t" - "psrlq $5, %%mm1\n\t" - "psrlq $5, %%mm4\n\t" - "pand %%mm6, %%mm1\n\t" - "pand %%mm6, %%mm4\n\t" - "psrlq $8, %%mm2\n\t" - "psrlq $8, %%mm5\n\t" - "pand %%mm7, %%mm2\n\t" - "pand %%mm7, %%mm5\n\t" - "por %%mm1, %%mm0\n\t" - "por %%mm4, %%mm3\n\t" - "por %%mm2, %%mm0\n\t" - "por %%mm5, %%mm3\n\t" - "psllq $16, %%mm3\n\t" - "por %%mm3, %%mm0\n\t" - MOVNTQ" %%mm0, %0\n\t" - :"=m"(*d):"m"(*s),"m"(blue_16mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - d += 4; - s += 12; - } - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - while(s < end) - { - const int b= *s++; - const int g= *s++; - const int r= *s++; - *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8); - } -} - -static void __FASTCALL__ RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, unsigned int src_size) -{ - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - uint16_t *d = (uint16_t *)dst; - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); - __asm __volatile( - "movq %0, %%mm7\n\t" - "movq %1, %%mm6\n\t" - ::"m"(red_16mask),"m"(green_16mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - mm_end = end - 15; - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movd %1, %%mm0\n\t" - "movd 3%1, %%mm3\n\t" - "punpckldq 6%1, %%mm0\n\t" - "punpckldq 9%1, %%mm3\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm0, %%mm2\n\t" - "movq %%mm3, %%mm4\n\t" - "movq %%mm3, %%mm5\n\t" - "psllq $8, %%mm0\n\t" - "psllq $8, %%mm3\n\t" - "pand %%mm7, %%mm0\n\t" - "pand %%mm7, %%mm3\n\t" - "psrlq $5, %%mm1\n\t" - "psrlq $5, %%mm4\n\t" - "pand %%mm6, %%mm1\n\t" - "pand %%mm6, %%mm4\n\t" - "psrlq $19, %%mm2\n\t" - "psrlq $19, %%mm5\n\t" - "pand %2, %%mm2\n\t" - "pand %2, %%mm5\n\t" - "por %%mm1, %%mm0\n\t" - "por %%mm4, %%mm3\n\t" - "por %%mm2, %%mm0\n\t" - "por %%mm5, %%mm3\n\t" - "psllq $16, %%mm3\n\t" - "por %%mm3, %%mm0\n\t" - MOVNTQ" %%mm0, %0\n\t" - :"=m"(*d):"m"(*s),"m"(blue_16mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - d += 4; - s += 12; - } - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - while(s < end) - { - const int r= *s++; - const int g= *s++; - const int b= *s++; - *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8); - } -} - -static void __FASTCALL__ RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, unsigned src_size) -{ - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - uint16_t *d = (uint16_t *)dst; - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); - __asm __volatile( - "movq %0, %%mm7\n\t" - "movq %1, %%mm6\n\t" - ::"m"(red_15mask),"m"(green_15mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - mm_end = end - 11; - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movd %1, %%mm0\n\t" - "movd 3%1, %%mm3\n\t" - "punpckldq 6%1, %%mm0\n\t" - "punpckldq 9%1, %%mm3\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm0, %%mm2\n\t" - "movq %%mm3, %%mm4\n\t" - "movq %%mm3, %%mm5\n\t" - "psrlq $3, %%mm0\n\t" - "psrlq $3, %%mm3\n\t" - "pand %2, %%mm0\n\t" - "pand %2, %%mm3\n\t" - "psrlq $6, %%mm1\n\t" - "psrlq $6, %%mm4\n\t" - "pand %%mm6, %%mm1\n\t" - "pand %%mm6, %%mm4\n\t" - "psrlq $9, %%mm2\n\t" - "psrlq $9, %%mm5\n\t" - "pand %%mm7, %%mm2\n\t" - "pand %%mm7, %%mm5\n\t" - "por %%mm1, %%mm0\n\t" - "por %%mm4, %%mm3\n\t" - "por %%mm2, %%mm0\n\t" - "por %%mm5, %%mm3\n\t" - "psllq $16, %%mm3\n\t" - "por %%mm3, %%mm0\n\t" - MOVNTQ" %%mm0, %0\n\t" - :"=m"(*d):"m"(*s),"m"(blue_15mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - d += 4; - s += 12; - } - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - while(s < end) - { - const int b= *s++; - const int g= *s++; - const int r= *s++; - *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7); - } -} - -static void __FASTCALL__ RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size) -{ - const uint8_t *s = src; - const uint8_t *end; -#ifdef HAVE_MMX - const uint8_t *mm_end; -#endif - uint16_t *d = (uint16_t *)dst; - end = s + src_size; -#ifdef HAVE_MMX - __asm __volatile(PREFETCH" %0"::"m"(*src):"memory"); - __asm __volatile( - "movq %0, %%mm7\n\t" - "movq %1, %%mm6\n\t" - ::"m"(red_15mask),"m"(green_15mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - mm_end = end - 15; - while(s < mm_end) - { - __asm __volatile( - PREFETCH" 32%1\n\t" - "movd %1, %%mm0\n\t" - "movd 3%1, %%mm3\n\t" - "punpckldq 6%1, %%mm0\n\t" - "punpckldq 9%1, %%mm3\n\t" - "movq %%mm0, %%mm1\n\t" - "movq %%mm0, %%mm2\n\t" - "movq %%mm3, %%mm4\n\t" - "movq %%mm3, %%mm5\n\t" - "psllq $7, %%mm0\n\t" - "psllq $7, %%mm3\n\t" - "pand %%mm7, %%mm0\n\t" - "pand %%mm7, %%mm3\n\t" - "psrlq $6, %%mm1\n\t" - "psrlq $6, %%mm4\n\t" - "pand %%mm6, %%mm1\n\t" - "pand %%mm6, %%mm4\n\t" - "psrlq $19, %%mm2\n\t" - "psrlq $19, %%mm5\n\t" - "pand %2, %%mm2\n\t" - "pand %2, %%mm5\n\t" - "por %%mm1, %%mm0\n\t" - "por %%mm4, %%mm3\n\t" - "por %%mm2, %%mm0\n\t" - "por %%mm5, %%mm3\n\t" - "psllq $16, %%mm3\n\t" - "por %%mm3, %%mm0\n\t" - MOVNTQ" %%mm0, %0\n\t" - :"=m"(*d):"m"(*s),"m"(blue_15mask) - :"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); - d += 4; - s += 12; - } - __asm __volatile(SFENCE:::"memory"); - __asm __volatile(EMMS:::"memory" -#ifdef FPU_CLOBBERED - ,FPU_CLOBBERED -#endif -#ifdef MMX_CLOBBERED - ,MMX_CLOBBERED -#endif - ); -#endif - while(s < end) - { - const int r= *s++; - const int g= *s++; - const int b= *s++; - *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7); - } -} - -/* - I use here less accurate approximation by simply - left-shifti... [truncated message content] |
From: <nic...@us...> - 2009-12-06 16:47:43
|
Revision: 25 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=25&view=rev Author: nickols_k Date: 2009-12-06 16:47:27 +0000 (Sun, 06 Dec 2009) Log Message: ----------- fixed compilation with new source tree Modified Paths: -------------- TOOLS/asmopt.c codecs/configure mplayerxp/Makefile mplayerxp/bswap.h mplayerxp/cfg-common.h mplayerxp/cfgparser.c mplayerxp/configure mplayerxp/cpudetect.c mplayerxp/dec_ahead.c mplayerxp/dump.c mplayerxp/find_sub.c mplayerxp/input/Makefile mplayerxp/input/input.c mplayerxp/input/joystick.c mplayerxp/input/lirc.c mplayerxp/libao2/Makefile mplayerxp/libao2/ao_alsa9.c mplayerxp/libao2/ao_arts.c mplayerxp/libao2/ao_esd.c mplayerxp/libao2/ao_jack.c mplayerxp/libao2/ao_nas.c mplayerxp/libao2/ao_null.c mplayerxp/libao2/ao_openal.c mplayerxp/libao2/ao_oss.c mplayerxp/libao2/ao_wav.c mplayerxp/libao2/audio_out.c mplayerxp/libao2/audio_out.h mplayerxp/libao2/audio_out_internal.h mplayerxp/libmpcodecs/Makefile mplayerxp/libmpcodecs/ad.c mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_acm.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_dmo.c mplayerxp/libmpcodecs/ad_dshow.c mplayerxp/libmpcodecs/ad_faad.c mplayerxp/libmpcodecs/ad_ffmp3.c mplayerxp/libmpcodecs/ad_hwac3.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/ad_qtaudio.c mplayerxp/libmpcodecs/ad_real.c mplayerxp/libmpcodecs/ad_twin.c mplayerxp/libmpcodecs/ad_vorbis.c mplayerxp/libmpcodecs/codecs_ld.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/interface/ffmpeg/avcodec.h mplayerxp/libmpcodecs/interface/ffmpeg/common.h mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd_divx4.c mplayerxp/libmpcodecs/vd_dmo.c mplayerxp/libmpcodecs/vd_dshow.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_huffyuv.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_mpegpes.c mplayerxp/libmpcodecs/vd_null.c mplayerxp/libmpcodecs/vd_nuv.c mplayerxp/libmpcodecs/vd_qtvideo.c mplayerxp/libmpcodecs/vd_raw.c mplayerxp/libmpcodecs/vd_real.c mplayerxp/libmpcodecs/vd_theora.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpcodecs/vd_xanim.c mplayerxp/libmpcodecs/vd_xvid.c mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/asf.h mplayerxp/libmpdemux/asf_mmst_streaming.c mplayerxp/libmpdemux/asf_streaming.c mplayerxp/libmpdemux/aviheader.h mplayerxp/libmpdemux/aviprint.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/cddb.c mplayerxp/libmpdemux/demux_aiff.c mplayerxp/libmpdemux/demux_asf.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_bmp.c mplayerxp/libmpdemux/demux_demuxers.c mplayerxp/libmpdemux/demux_film.c mplayerxp/libmpdemux/demux_fli.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mov.c mplayerxp/libmpdemux/demux_mpg.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_nsv.c mplayerxp/libmpdemux/demux_nuv.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_pva.c mplayerxp/libmpdemux/demux_ra.c mplayerxp/libmpdemux/demux_rawaudio.c mplayerxp/libmpdemux/demux_rawvideo.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_roq.c mplayerxp/libmpdemux/demux_smjpeg.c mplayerxp/libmpdemux/demux_ts.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/demux_viv.c mplayerxp/libmpdemux/demux_vqf.c mplayerxp/libmpdemux/demux_y4m.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/dvdauth.c mplayerxp/libmpdemux/freesdp/Makefile mplayerxp/libmpdemux/librtsp/Makefile mplayerxp/libmpdemux/librtsp/rtsp.c mplayerxp/libmpdemux/librtsp/rtsp_rtp.c mplayerxp/libmpdemux/librtsp/rtsp_session.c mplayerxp/libmpdemux/mp3_hdr.c mplayerxp/libmpdemux/mpdemux.c mplayerxp/libmpdemux/mpeg_hdr.c mplayerxp/libmpdemux/mux_lavf.c mplayerxp/libmpdemux/mux_mpxp64.c mplayerxp/libmpdemux/mux_raw.c mplayerxp/libmpdemux/muxer.c mplayerxp/libmpdemux/network.c mplayerxp/libmpdemux/network.h mplayerxp/libmpdemux/parse_es.c mplayerxp/libmpdemux/pnm.c mplayerxp/libmpdemux/realrtsp/Makefile mplayerxp/libmpdemux/realrtsp/real.c mplayerxp/libmpdemux/realrtsp/rmff.h mplayerxp/libmpdemux/realrtsp/sdpplin.c mplayerxp/libmpdemux/rtp.c mplayerxp/libmpdemux/s_cdd.c mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/s_dvdplay.c mplayerxp/libmpdemux/s_dvdread.c mplayerxp/libmpdemux/s_ftp.c mplayerxp/libmpdemux/s_network.c mplayerxp/libmpdemux/s_oss.c mplayerxp/libmpdemux/s_rtsp.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libmpdemux/s_udp.c mplayerxp/libmpdemux/s_vcd.c mplayerxp/libmpdemux/s_vcdnav.c mplayerxp/libmpdemux/stream.c mplayerxp/libmpdemux/stream.h mplayerxp/libmpdemux/sub_cc.c mplayerxp/libmpdemux/sub_ty.c mplayerxp/libmpdemux/tcp.c mplayerxp/libmpdemux/test.c mplayerxp/libmpdemux/tvi_bsdbt848.c mplayerxp/libmpdemux/tvi_dummy.c mplayerxp/libmpdemux/tvi_v4l.c mplayerxp/libmpdemux/udp.c mplayerxp/libmpdemux/video.c mplayerxp/libmpdemux/yuv4mpeg.c mplayerxp/libmpdemux/yuv4mpeg_ratio.c mplayerxp/libvo/Makefile mplayerxp/libvo/aclib.c mplayerxp/libvo/aspect.h mplayerxp/libvo/fastmemcpy.h mplayerxp/libvo/font_load.c mplayerxp/libvo/img_format.c mplayerxp/libvo/img_format.h mplayerxp/libvo/jpeg_enc.c mplayerxp/libvo/osd.c mplayerxp/libvo/screenshot.c mplayerxp/libvo/sub.c mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/vosub_vidix.c mplayerxp/libvo/x11_common.c mplayerxp/m_option.c mplayerxp/m_property.c mplayerxp/m_struct.c mplayerxp/mixer.c mplayerxp/mp-opt-reg.c mplayerxp/mp_image.c mplayerxp/mp_msg.c mplayerxp/mplayer.c mplayerxp/my_malloc.h mplayerxp/nls/Makefile mplayerxp/nls/recode.c mplayerxp/osdep/Makefile mplayerxp/osdep/get_path.c mplayerxp/osdep/getch2.c mplayerxp/osdep/shmem.c mplayerxp/osdep/timer-lx.c mplayerxp/playtree.c mplayerxp/playtreeparser.c mplayerxp/postproc/Makefile mplayerxp/postproc/af.c mplayerxp/postproc/af.h mplayerxp/postproc/af_export.c mplayerxp/postproc/af_ffenc.c mplayerxp/postproc/af_mp.h mplayerxp/postproc/af_raw.c mplayerxp/postproc/dsp.c mplayerxp/postproc/dsp.h mplayerxp/postproc/libmenu/Makefile mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/libmenu/menu_cmdlist.c mplayerxp/postproc/libmenu/menu_console.c mplayerxp/postproc/libmenu/menu_filesel.c mplayerxp/postproc/libmenu/menu_list.c mplayerxp/postproc/libmenu/menu_param.c mplayerxp/postproc/libmenu/menu_pt.c mplayerxp/postproc/libmenu/menu_txt.c mplayerxp/postproc/postprocess.c mplayerxp/postproc/postprocess.h mplayerxp/postproc/swscale.c mplayerxp/postproc/swscale.h mplayerxp/postproc/vf.c mplayerxp/postproc/vf_1bpp.c mplayerxp/postproc/vf_2xsai.c mplayerxp/postproc/vf_aspect.c mplayerxp/postproc/vf_delogo.c mplayerxp/postproc/vf_denoise3d.c mplayerxp/postproc/vf_dint.c mplayerxp/postproc/vf_down3dright.c mplayerxp/postproc/vf_eq.c mplayerxp/postproc/vf_expand.c mplayerxp/postproc/vf_format.c mplayerxp/postproc/vf_framestep.c mplayerxp/postproc/vf_il.c mplayerxp/postproc/vf_menu.c mplayerxp/postproc/vf_mirror.c mplayerxp/postproc/vf_noise.c mplayerxp/postproc/vf_ow.c mplayerxp/postproc/vf_palette.c mplayerxp/postproc/vf_panscan.c mplayerxp/postproc/vf_perspective.c mplayerxp/postproc/vf_pp.c mplayerxp/postproc/vf_raw.c mplayerxp/postproc/vf_rgb2bgr.c mplayerxp/postproc/vf_rotate.c mplayerxp/postproc/vf_scale.c mplayerxp/postproc/vf_smartblur.c mplayerxp/postproc/vf_softpulldown.c mplayerxp/postproc/vf_swapuv.c mplayerxp/postproc/vf_test.c mplayerxp/postproc/vf_unsharp.c mplayerxp/postproc/vf_vo.c mplayerxp/postproc/vf_yuvcsp.c mplayerxp/postproc/vf_yuy2.c mplayerxp/postproc/vf_yvu9.c mplayerxp/spudec.c mplayerxp/subreader.c mplayerxp/vobsub.c Removed Paths: ------------- mplayerxp/libmpdemux/config.h Modified: TOOLS/asmopt.c =================================================================== --- TOOLS/asmopt.c 2009-12-06 12:48:07 UTC (rev 24) +++ TOOLS/asmopt.c 2009-12-06 16:47:27 UTC (rev 25) @@ -17,7 +17,7 @@ #include <sys/mman.h> #include <sys/time.h> -#include "../mplayerxp/config.h" +#include "../mplayerxp/mp_config.h" #include "../mplayerxp/cpudetect.h" #if defined( ARCH_X86 ) || defined(ARCH_X86_64) Modified: codecs/configure =================================================================== --- codecs/configure 2009-12-06 12:48:07 UTC (rev 24) +++ codecs/configure 2009-12-06 16:47:27 UTC (rev 25) @@ -241,10 +241,8 @@ # Fix libavcodec if test "$_ffmpeg" = yes ; then -cd libavcodec -if ! test -f Makefile ; then -#patch --force <../libavcodec.diff -#else +cd ffmpeg +if ! test -f configure ; then echo "**WARNING**: local copy of libavcodec doesn't exist! Please copy libavcodec" echo "from ffmpeg distro into mplayerxp/codecs/libavcodec subfolder." echo "Otherwise support of builtin ffmpeg's codecs will be disabled" @@ -252,41 +250,21 @@ read _answer _ffmpeg=no fi -cd ../libavutil -if ! test -f Makefile ; then -echo "**WARNING**: local copy of libavutil doesn't exist! Please copy libavutil" -echo "from ffmpeg distro into mplayerxp/codecs/libavutil subfolder." -echo "Otherwise support of builtin ffmpeg's codecs will be disabled" -echo "Press any key" -read _answer -_ffmpeg=no +_ffmpeg_args="--prefix=$_codecdir/ffmpeg --libdir=$_codecdir --shlibdir=$_codecdir --enable-shared --disable-static --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-pic --enable-postproc --enable-gpl" +if test -n $_host ; then +_arch=$_host_arch +x86_32 && _arch="x86_32" +x86_64 && _arch="x86_64" +_ffmpeg_args="--arch=$_arch $_ffmpeg_args" fi -cd ../libavformat -if ! test -f Makefile ; then -#patch --force <../libavformat.diff -#else -echo "**WARNING**: local copy of libavformat doesn't exist! Please copy libavformat" -echo "from ffmpeg distro into mplayerxp/codecs/libavformat subfolder." -echo "Otherwise support of builtin ffmpeg's codecs will be disabled" -echo "Press any key" -read _answer -_ffmpeg=no -fi -cd ../libpostproc -if ! test -f Makefile ; then -echo "**WARNING**: local copy of libpostproc doesn't exist! Please copy libpostproc" -echo "from ffmpeg distro into mplayerxp/codecs/libpostproc subfolder." -echo "Otherwise support of builtin ffmpeg's codecs will be disabled" -echo "Press any key" -read _answer -_ffmpeg=no -fi +echo "configuring ffmpeg stuff:" +echo "$_ffmpeg_args" +$(LC_ALL=C ./configure $_ffmpeg_args) cd .. fi - _subdirs="mp3lib liba52 libdca libfaad2 libmpeg2" if test "$_ffmpeg" = yes ; then -_subdirs="$_subdirs libavutil libavcodec libpostproc libavformat libswscale" +_subdirs="$_subdirs ffmpeg" fi cc_version=`$_cc -dumpversion` @@ -419,17 +397,6 @@ MLIB_LIB = $_ld_mlib MLIB_INC = $_inc_mlib -# For embeddeded libavcodec -CONFIG_GPL=yes -CONFIG_RISKY = yes -CONFIG_ENCODERS=yes -CONFIG_DECODERS=yes -CONFIG_MUXERS=yes -CONFIG_DEMUXERS=yes -CONFIG_BSFS=yes -CONFIG_PROTOCOLS=yes -CONFIG_PP=yes - BUILD_SHARED=yes SRC_PATH=$source_path BUILD_ROOT=$source_path @@ -492,27 +459,6 @@ #define INFINITY HUGE_VAL #endif -#define CONFIG_ENCODERS 1 -#define CONFIG_DECODERS 1 -#define CONFIG_MUXERS 1 -#define CONFIG_DEMUXERS 1 -#define CONFIG_BSFS 1 -#define CONFIG_PROTOCOLS 1 -#define CONFIG_PP 1 -#define CONFIG_RISKY 1 -#define CONFIG_GPL 1 -#define ENABLE_SMALL 0 -#define ENABLE_MMX 0 /* ffmpeg's build-in asm is incompatible with modern gcc-4 */ -#define ENABLE_ARMV4L 0 -#define ENABLE_MLIB 0 -#define ENABLE_VIS 0 -#define ENABLE_ALPHA 0 -#define ENABLE_POWERPC 0 -#define ENABLE_MMI 0 -#define ENABLE_SH4 0 -#define ENABLE_BFIN 0 -#define ENABLE_GRAY 1 - #ifdef HAVE_PTHREADS /* BeOS workaround */ #define HAVE_THREADS 1 @@ -535,335 +481,6 @@ EOF echo "#define restrict $_restrict" >> config.h -# find if .align arg is power-of-two or not -echocheck ".align is power-of-two" -cat > $TMPC << EOF -asm (".align 3"); -EOF -asmalign_pot="no" -cc_check && asmalign_pot="yes" -echores $asmalign_pot -if test "$asmalign_pot" = "yes" ; then - printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> config.h -else - printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> config.h -fi - -check_cc <<EOF || die "Symbol mangling check failed." -int ff_extern; -EOF -sym=$($nm -P -g $TMPO | grep ff_extern) -extern_prefix=${sym%%ff_extern*} -echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> config.h - -# Addon for newest ffmpeg's versions -echo "Generating list of ffmpeg's codecs! Please wait" -ENCODER_LIST=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"` -DECODER_LIST=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"` -PARSER_LIST=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"` -MUXER_LIST=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"` -DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"` -BSF_LIST=`sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' "$source_path/libavcodec/allcodecs.c"` -PROTOCOL_LIST=`sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' "$source_path/libavformat/allformats.c"` - -CONFIG_LIST=' - bsfs - decoders - demuxers - encoders - muxers - parsers - protocols - avisynth - gray - ipv6 - liba52 - libamr_nb - libamr_wb - libdc1394 - libfaac - libfaad - libspeex - libschroedinger - libdirac - libgsm - libmp3lame - libnut - libogg - libtheora - libvorbis - libx264 - libxvid - mpegaudio_hp - network - powerpc_perf - mlib - pp - zlib - mdct - fft - golomb - aandct -' - -DEVICE_LIST=' - audio_beos - bktr - dv1394 - oss - v4l2 - v4l - x11_grab_device - libdc1394 -' - -HAVE_LIST=' - altivec_h - arpa_inet_h - bswap - closesocket - cmov - conio_h - dcbzl - dev_bktr_ioctl_bt848_h - dev_bktr_ioctl_meteor_h - dev_ic_bt8xx_h - dev_video_meteor_ioctl_meteor_h - dev_video_bktr_ioctl_bt848_h - dlfcn_h - dlopen - dos_paths - ebp_available - ebx_available - fast_64bit - fast_cmov - fast_unaligned - fork - freetype2 - gethrtime - GetProcessTimes - getrusage - imlib2 - inet_aton - inline_asm - libdc1394_1 - libdc1394_2 - llrint - lrint - lrintf - machine_ioctl_bt848_h - machine_ioctl_meteor_h - malloc_h - memalign - mkstemp - pld - ppc - ppc64 - round - roundf - sdl - sdl_video_size - socklen_t - soundcard_h - poll_h - sys_mman_h - sys_resource_h - sys_select_h - sys_soundcard_h - sys_videoio_h - termios_h - threads - winsock2_h - yasm -' -ARCH_LIST=' - alpha - arm - bfin - ia64 - m68k - mips - parisc - powerpc - s390 - sh4 - sparc - sparc64 - x86 - x86_32 - x86_64 -' - -# decoders / encoders -ac3_decoder_deps="gpl" -dxa_decoder_deps="zlib" -flashsv_decoder_deps="zlib" -flashsv_encoder_deps="zlib" -flv_decoder_deps="h263_decoder" -h263_decoder_deps="h263_parser mpeg4video_parser" -h263i_decoder_deps="h263_decoder" -h264_decoder_deps="h264_parser" -mpeg_xvmc_decoder_deps="xvmc" -mpeg4_decoder_deps="h263_decoder" -msmpeg4v1_decoder_deps="h263_decoder" -msmpeg4v2_decoder_deps="h263_decoder" -msmpeg4v3_decoder_deps="h263_decoder" -png_decoder_deps="zlib" -png_encoder_deps="zlib" -svq3_decoder_deps="h264_parser" -vc1_decoder_deps="h263_decoder" -wmv1_decoder_deps="h263_decoder" -wmv2_decoder_deps="h263_decoder" -wmv3_decoder_deps="h263_decoder" -zmbv_decoder_deps="zlib" -zmbv_encoder_deps="zlib" - -# external libraries -liba52_decoder_deps="liba52" -liba52bin_decoder_extralibs='$ldl' -libamr_nb_decoder_deps="libamr_nb" -libamr_nb_encoder_deps="libamr_nb" -libamr_wb_decoder_deps="libamr_wb" -libamr_wb_encoder_deps="libamr_wb" -libdirac_decoder_deps="libdirac !libschroedinger" -libdirac_encoder_deps="libdirac" -libschroedinger_decoder_deps="libschroedinger" -libschroedinger_encoder_deps="libschroedinger" -libspeex_decoder_deps="libspeex" -libfaac_encoder_deps="libfaac" -libfaad_decoder_deps="libfaad" -libfaadbin_decoder_extralibs='$ldl' -libgsm_decoder_deps="libgsm" -libgsm_encoder_deps="libgsm" -libgsm_ms_decoder_deps="libgsm" -libgsm_ms_encoder_deps="libgsm" -libmp3lame_encoder_deps="libmp3lame" -libtheora_encoder_deps="libtheora" -libvorbis_encoder_deps="libvorbis" -libx264_encoder_deps="libx264" -libxvid_encoder_deps="libxvid" -mpeg4aac_decoder_deps="libfaad" - -# demuxers / muxers -ac3_demuxer_deps="ac3_parser" -audio_beos_demuxer_deps="audio_beos" -audio_beos_demuxer_extralibs="-lmedia -lbe" -audio_beos_muxer_deps="audio_beos" -audio_beos_muxer_extralibs="-lmedia -lbe" -avisynth_demuxer_deps="avisynth" -bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h" -dv1394_demuxer_deps="dv1394" -libdc1394_demuxer_deps="libdc1394" -libnut_demuxer_deps="libnut" -libnut_muxer_deps="libnut" -mp3_demuxer_deps="mpegaudio_parser" -oss_demuxer_deps_any="soundcard_h sys_soundcard_h" -oss_muxer_deps_any="soundcard_h sys_soundcard_h" -redir_demuxer_deps="network" -rtp_muxer_deps="network mpegts_demuxer" -rtsp_demuxer_deps="rtp_protocol rtp_muxer" -sdp_demuxer_deps="rtsp_demuxer" -v4l2_demuxer_deps="linux_videodev2_h" -v4l_demuxer_deps="linux_videodev_h" -x11_grab_device_demuxer_deps="x11grab XShmCreateImage" -x11_grab_device_demuxer_extralibs="-lX11 -lXext" - -# protocols -http_protocol_deps="network" -rtp_protocol_deps="udp_protocol" -tcp_protocol_deps="network" -udp_protocol_deps="network" - - -enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST $PROTOCOL_LIST $BSF_LIST $CONFIG_LIST -enabled_any $ENCODER_LIST && enable encoders -enabled_any $DECODER_LIST && enable decoders -enabled_any $MUXER_LIST && enable muxers -enabled_any $DEMUXER_LIST && enable demuxers -enabled_any $BSF_LIST && enable bsfs -enabled_any $PROTOCOLS_LIST && enable protocols - -enabled_any pthreads beosthreads os2threads w32threads && enable threads - -# suppress ffmpeg's device stuff -disable $DEVICE_LIST -disable mpeg_xvmc_decoder - -########################################## -# Network check - -if enabled network; then - # Prefer arpa/inet.h over winsock2 - check_type sys/socket.h socklen_t - if check_header arpa/inet.h ; then - check_func closesocket - elif check_header winsock2.h ; then - network_extralibs="-lws2_32" - check_func2 winsock2.h closesocket - fi -enabled ipv6 && require2 ipv6 "sys/types.h sys/socket.h netinet/in.h netdb.h" IN6_IS_ADDR_MULTICAST -fi - -# check configurable stuff -enabled liba52 && require2 liba52 a52dec/a52.h a52_init -la52 -enabled libdts && require2 libdts dts.h dts_init -ldts -lm -enabled libgsm && require2 libgsm gsm.h gsm_create -lgsm -enabled libmp3lame && require2 libmp3lame lame/lame.h lame_init -lmp3lame -lm -enabled libtheora && require3 libtheora theora/theora.h OC_PF_420 theora_info_init -ltheora -logg -enabled libvorbis && require2 libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg -enabled libogg && require2 libogg ogg/ogg.h ogg_sync_init -logg -enabled libxvid && require2 libxvid xvid.h xvid_global -lxvidcore -enabled libx264 && require2 libx264 x264.h x264_encoder_open -lx264 -enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac -enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad -enabled avisynth && require2 avisynth "windows.h vfw.h" AVIFileInit -lvfw32 -enabled libnut && require2 libnut libnut.h nut_demuxer_init -lnut -enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex -enabled mlib && require mlib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib -# NON FREE stuff: -enabled libdirac && add_cflags $(pkg-config --cflags dirac) && - require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder && - require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder -enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) && - require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0) - -if enabled libdc1394; then - { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 && - enable libdc1394_2; } || - { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 && - enable libdc1394_1; } || - die "ERROR: No version of libdc1394 found " -fi - -check_deps $CONFIG_LIST $HAVE_LIST $DECODER_LIST $ENCODER_LIST $PARSER_LIST \ - $BSF_LIST $DEMUXER_LIST $MUXER_LIST $PROTOCOL_LIST - -print_config ARCH_ config.h config.mak $ARCH_LIST -print_config HAVE_ config.h config.mak $HAVE_LIST - -enabled v4l_demuxer && check_sheader v4l_demuxer linux/videodev.h -enabled v4l2_demuxer && check_sheader v4l2_demuxer linux/videodev2.h -enabled libamr_nb && require libamr_nb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm -enabled libamr_wb && require libamr_wb amrwb/dec_if.h D_IF_init -lamrwb -lm - -disabled libamr_nb && disable libamr_nb_decoder && disable libamr_nb_encoder -disabled libamr_wb && disable libamr_wb_decoder && disable libamr_wb_encoder - -echo "/* List of ffmpeg's codecs! */" >> config.h -echo "# List of ffmpeg's codecs!" >> config.mak -for codec in $CONFIG_LIST $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $PROTOCOL_LIST $BSF_LIST $MUXER_LIST; do - ucname="`toupper $codec`" - config_name="CONFIG_$ucname" - enabled_name="ENABLE_$ucname" - if enabled $codec; then - echo "#define $config_name 1" >> config.h - echo "#define $enabled_name 1" >> config.h - echo "$config_name=yes" >> config.mak - else - echo "#define $enabled_name 0" >> config.h - fi -done - echo "EXTRALIBS=$extralibs" >> config.mak echo "LDFLAGS=$LDFLAGS" >> config.mak Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/Makefile 2009-12-06 16:47:27 UTC (rev 25) @@ -7,7 +7,7 @@ # a BSD compatible 'install' program INSTALL = install -include config.mak +include mp_config.mak PRG = $(PROGNAME) PRG_FIBMAP = fibmap_mplayerxp @@ -21,6 +21,7 @@ BINDIR = ${prefix}/bin # BINDIR = /usr/local/bin MANDIR = ${prefix}/man +LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs SRCS_COMMON = cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c my_malloc.c spudec.c playtree.c playtreeparser.c asxparser.c mp_image.c @@ -108,7 +109,7 @@ $(DO_MAKE) -rm -f *~ $(PRG) $(PRG_FIBMAP) $(OBJS) -rm -f *.o *.a .depend configure.log - -rm -f config.h config.mak version.h + -rm -f mp_config.h mp_config.mak version.h -rm -f cpuinfo help_mp.h version.h: Modified: mplayerxp/bswap.h =================================================================== --- mplayerxp/bswap.h 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/bswap.h 2009-12-06 16:47:27 UTC (rev 25) @@ -2,7 +2,7 @@ #define __BSWAP_H__ #ifdef HAVE_CONFIG_H -#include "config.h" +#include "mp_config.h" #endif #ifdef HAVE_BYTESWAP_H @@ -21,7 +21,7 @@ ((short)(unsigned char)(ch1) << 8)) -#ifdef ARCH_X86 +#if defined(__i386__) inline static unsigned short ByteSwap16(unsigned short x) { __asm("xchgb %b0,%h0" : @@ -58,7 +58,7 @@ } #define bswap_64(x) ByteSwap64(x) -#elif defined(ARCH_X86_64) +#elif defined(__x86_64__) inline static unsigned short ByteSwap16(unsigned short x) { Modified: mplayerxp/cfg-common.h =================================================================== --- mplayerxp/cfg-common.h 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/cfg-common.h 2009-12-06 16:47:27 UTC (rev 25) @@ -78,7 +78,7 @@ #else -#include "config.h" +#include "mp_config.h" extern int sws_chr_vshift; extern int sws_chr_hshift; Modified: mplayerxp/cfgparser.c =================================================================== --- mplayerxp/cfgparser.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/cfgparser.c 2009-12-06 16:47:27 UTC (rev 25) @@ -15,7 +15,7 @@ #include <fcntl.h> #include <string.h> #include <errno.h> -#include "config.h" +#include "mp_config.h" #define MSGT_CLASS MSGT_CFGPARSER #include "__mp_msg.h" Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/configure 2009-12-06 16:47:27 UTC (rev 25) @@ -19,7 +19,7 @@ # # GOTCHAS: # - config files are currently: -# config.h config.mak libvo/config.mak libao2/config.mak +# mp_config.h mp_config.mak libvo/mp_config.mak libao2/mp_config.mak # ############################################################################# . ../functions @@ -208,7 +208,7 @@ mktmps -guess_target config.mak config.h +guess_target mp_config.mak mp_config.h # config files @@ -562,6 +562,8 @@ test -z "$_codecdir" && _codecdir="$_libdir/$_prog_alias" fi +_srcdir=`pwd` + #checking for pkg-config _pkg_config=pkg-config test $($_pkg_config --version 2>/dev/null) || die "no pkg-config found" @@ -601,14 +603,14 @@ fi test -n "$_profile" && disable fastcall -print_config __USE config.h config.mak fastcall +print_config __USE mp_config.h mp_config.mak fastcall # Checking for LDFLAGS if test "$_profile" || test "$_debug" ; then LDFLAGS="$_debug $_profile" fi -test_optimizations config.mak config.h +test_optimizations mp_config.mak mp_config.h # Checking for GOMP enabled gomp && check_ldflags -fopenmp || disable gomp @@ -650,16 +652,16 @@ check_header inttypes.h || die "cannot find header inttypes.h (see in DOC/faq.html)" require2 libdl dlfcn.h dlsym -ldl || die "dynamic loader was not found" -print_config HAVE_ config.h config.mak libdl +print_config HAVE_ mp_config.h mp_config.mak libdl require2 libkstat kstat.h kstat_open -lkstat -print_config HAVE_ config.h config.mak libkstat +print_config HAVE_ mp_config.h mp_config.mak libkstat require2 posix4 time.h nanosleep -lposix4 -print_config HAVE_ config.h config.mak posix4 +print_config HAVE_ mp_config.h mp_config.mak posix4 check_func2 time.h nanosleep -print_config HAVE_ config.h config.mak nanosleep +print_config HAVE_ mp_config.h mp_config.mak nanosleep disable inet_pton if enabled streaming ; then @@ -673,36 +675,36 @@ # well, try alternative if disabled inet_pton ; then require2 aton "sys/types.h sys/socket.h arpa/inet.h" inet_aton -print_config USE_ config.h config.mak aton +print_config USE_ mp_config.h mp_config.mak aton fi -print_config HAVE_ config.h config.mak socklib +print_config HAVE_ mp_config.h mp_config.mak socklib if enabled winsock2 && ! cygwin ; then require2 winsock2 winsock2.h gethostbyname -lws2_32 -print_config HAVE_ config.h config.mak winsock2 +print_config HAVE_ mp_config.h mp_config.mak winsock2 fi fi #enabled streaming disabled inet_pton && disable streaming -print_config HAVE_ config.h config.mak streaming +print_config HAVE_ mp_config.h mp_config.mak streaming disabled streaming && disable af_inet6 if enabled af_inet6 ; then enabled winsock2 && require3 af_inet6 ws2tcpip.h AF_INET6 socket disabled winsock2 && require3 af_inet6 "sys/socket.h netinet/in.h" AF_INET6 socket -print_config HAVE_ config.h config.mak af_inet6 +print_config HAVE_ mp_config.h mp_config.mak af_inet6 fi check_func2 malloc.h malloc freebsd && disable malloc -print_config HAVE_ config.h config.mak malloc +print_config HAVE_ mp_config.h mp_config.mak malloc if enabled malloc; then check_func2 malloc.h memalign -print_config HAVE_ config.h config.mak memalign +print_config HAVE_ mp_config.h mp_config.mak memalign fi check_func2 alloca.h alloca -print_config HAVE_ config.h config.mak alloca +print_config HAVE_ mp_config.h mp_config.mak alloca # find if .align arg is power-of-two or not echocheck ".align is power-of-two" @@ -719,22 +721,22 @@ fi check_func3 _ISOC9X_SOURCE math.h lrint -lm -print_config HAVE_ config.h config.mak lrint +print_config HAVE_ mp_config.h mp_config.mak lrint check_func3 _ISOC9X_SOURCE math.h llrint -lm -print_config HAVE_ config.h config.mak llrint +print_config HAVE_ mp_config.h mp_config.mak llrint check_func3 _ISOC9X_SOURCE math.h HUGE -lm -print_config HAVE_ config.h config.mak HUGE +print_config HAVE_ mp_config.h mp_config.mak HUGE check_func2 "sys/types.h sys/mman.h" mmap sys_mman_h=$mmap -print_config HAVE_ config.h config.mak sys_mman_h +print_config HAVE_ mp_config.h mp_config.mak sys_mman_h enabled mmap && check_func2 "sys/mman.h" mlock -print_config HAVE_ config.h config.mak mlock +print_config HAVE_ mp_config.h mp_config.mak mlock check_func2 "stdarg.h" vsscanf -print_config HAVE_ config.h config.mak vsscanf +print_config HAVE_ mp_config.h mp_config.mak vsscanf if enabled termcap; then disable termcap @@ -742,43 +744,43 @@ disabled termcap && require2 termcap stdio.h tgetent $_ld_i enabled termcap && break done -print_config HAVE_ config.h config.mak termcap +print_config HAVE_ mp_config.h mp_config.mak termcap fi if enabled termios; then check_header sys/termios.h -print_config HAVE_ config.h config.mak sys_termios_h +print_config HAVE_ mp_config.h mp_config.mak sys_termios_h disabled sys_termios_h && check_header termios.h -disabled sys_termios_h && print_config HAVE_ config.h config.mak termios_h +disabled sys_termios_h && print_config HAVE_ mp_config.h mp_config.mak termios_h fi enabled shm && require2 shm "sys/types.h sys/shm.h" shmget -print_config HAVE_ config.h config.mak shm +print_config HAVE_ mp_config.h mp_config.mak shm require2 zlib zlib.h inflate -lz -print_config HAVE_ config.h config.mak zlib +print_config HAVE_ mp_config.h mp_config.mak zlib if linux; then enabled rtc && require2 rtc "sys/ioctl.h linux/rtc.h" RTC_IRQP_READ -print_config HAVE_ config.h config.mak rtc +print_config HAVE_ mp_config.h mp_config.mak rtc fi if enabled iconv; then require2 giconv giconv.h iconv_open -lgiconv -print_config HAVE_ config.h config.mak giconv +print_config HAVE_ mp_config.h mp_config.mak giconv disable iconv for _ld_i in "" -liconv ; do disabled iconv && require2 iconv iconv.h iconv_open $_ld_i enabled iconv && break done -print_config HAVE_ config.h config.mak iconv +print_config HAVE_ mp_config.h mp_config.mak iconv fi enabled lirc && require2 lirc lirc/lirc_client.h lirc_init -llirc_client -print_config HAVE_ config.h config.mak lirc +print_config HAVE_ mp_config.h mp_config.mak lirc enabled lircc && require2 lircc lirc/lircc.h lircc_init -llircc -print_config HAVE_ config.h config.mak lircc +print_config HAVE_ mp_config.h mp_config.mak lircc disable pthread for _ld_i in "-lpthreadGC2" "-lpthread" "-pthread" "" ; do @@ -786,12 +788,12 @@ enabled pthread && break done disabled pthread && die "Lib pthread not found. (needed by xp mode)" -print_config HAVE_ config.h config.mak pthread +print_config HAVE_ mp_config.h mp_config.mak pthread require2 sys_soundcard_h sys/soundcard.h SNDCARD_SB -print_config HAVE_ config.h config.mak sys_soundcard_h +print_config HAVE_ mp_config.h mp_config.mak sys_soundcard_h require2 soundcard_h soundcard.h SNDCARD_SB -print_config HAVE_ config.h config.mak soundcard_h +print_config HAVE_ mp_config.h mp_config.mak soundcard_h # XXX: FIXME, add runtime checking echocheck "linux devfs" @@ -816,19 +818,19 @@ enabled x11 && check_cflags $($_pkg_config x11 --cflags) && add_cflags $($_pkg_config x11 --cflags) || disable x11 enabled x11 && check_ldflags $($_pkg_config x11 --libs) && add_extralibs $($_pkg_config x11 --libs) || disable x11 enabled x11 && require2 x11 "X11/Xlib.h X11/Xutil.h" XCreateWindow -lXext -print_config HAVE_ config.h config.mak x11 +print_config HAVE_ mp_config.h mp_config.mak x11 enabled x11 && _vomodules="x11 $_vomodules" || _novomodules="x11 $_novomodules" enabled xdpms && require2 xdpms "X11/Xlib.h X11/extensions/dpms.h" DPMSQueryExtension disabled xdpms && require2 xdpms "X11/Xlib.h X11/extensions/dpms.h" DPMSQueryExtension -lXdpms -print_config HAVE_ config.h config.mak xdpms +print_config HAVE_ mp_config.h mp_config.mak xdpms enabled xv && require2 xv "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -print_config HAVE_ config.h config.mak xv +print_config HAVE_ mp_config.h mp_config.mak xv enabled xv && _vomodules="xv $_vomodules" || _novomodules="xv $_novomodules" enabled xinerama && require2 xinerama "X11/Xlib.h X11/extensions/Xinerama.h" XineramaIsActive -lXinerama -print_config HAVE_ config.h config.mak xv +print_config HAVE_ mp_config.h mp_config.mak xv # Note: the -lXxf86vm library is the VideoMode extension and though it's not # needed for DGA, AFAIK every distribution packages together with DGA stuffs @@ -836,19 +838,19 @@ # This check may be useful for future mplayerxp versions (to change resolution) # If you run into problems, remove '-lXxf86vm'. enabled xf86vm && require2 xf86vm "X11/Xlib.h X11/extensions/xf86vmode.h" XF86VidModeQueryExtension -lXxf86vm -print_config HAVE_ config.h config.mak xf86vm +print_config HAVE_ mp_config.h mp_config.mak xf86vm if enabled dga ; then require2 dga2 "X11/Xlib.h X11/extensions/xf86dga.h" XDGASetViewport -lXxf86dga -print_config HAVE_ config.h config.mak dga2 +print_config HAVE_ mp_config.h mp_config.mak dga2 enabled dga2 && enable dga disabled dga2 && require2 dga "X11/Xlib.h X11/extensions/xf86dga.h" XF86DGASetViewPort -lXxf86dga -print_config HAVE_ config.h config.mak dga +print_config HAVE_ mp_config.h mp_config.mak dga enabled dga && _vomodules="dga $_vomodules" || _novomodules="dga $_novomodules" fi enabled fbdev && require2 fbdev "sys/ioctl.h linux/fb.h" ioctl -print_config HAVE_ config.h config.mak fbdev +print_config HAVE_ mp_config.h mp_config.mak fbdev enabled fbdev && _vomodules="fbdev $_vomodules" || _novomodules="fbdev $_novomodules" if test "$_fbdev_nocopy" = yes ; then _def_fbdev_nocopy='#define USE_CONVERT2FB 1' @@ -856,19 +858,19 @@ if enabled png; then require2 png png.h PNG_LIBPNG_VER_STRING -lpng -print_config HAVE_ config.h config.mak png +print_config HAVE_ mp_config.h mp_config.mak png disabled png && require2 libpng_png libpng/png.h PNG_LIBPNG_VER_STRING -lpng -lm -print_config HAVE_ config.h config.mak libpng_png +print_config HAVE_ mp_config.h mp_config.mak libpng_png enabled libpng_png && enable png fi enabled png && _vomodules="png $_vomodules" || _novomodules="png $_novomodules" enabled jpg && require2 jpeg "stdio.h stdlib.h setjmp.h string.h jpeglib.h" jpeg_write_scanlines -ljpeg -print_config HAVE_ config.h config.mak jpeg +print_config HAVE_ mp_config.h mp_config.mak jpeg enabled jpeg && _vomodules="jpeg $_vomodules" || _novomodules="jpeg $_novomodules" enabled vesa && require3 vesa "asm/vm86.h string.h" VIF_MASK memset -print_config HAVE_ config.h config.mak vesa +print_config HAVE_ mp_config.h mp_config.mak vesa enabled vesa && _vomodules="vesa $_vomodules" || _novomodules="vesa $_novomodules" @@ -879,17 +881,17 @@ enabled sdl && check_cflags $($_pkg_config sdl --cflags) && add_cflags $($_pkg_config sdl --cflags) || disable sdl enabled sdl && check_ldflags $($_pkg_config sdl --libs) && add_extralibs $($_pkg_config sdl --libs) || disable sdl enabled sdl && require2 sdl SDL/SDL.h SDL_CreateYUVOverlay -print_config HAVE_ config.h config.mak sdl +print_config HAVE_ mp_config.h mp_config.mak sdl if enabled sdl; then enabled sdl_image && require2 sdl_image SDL/SDL_image.h IMG_Load_RW -lSDL_image -print_config HAVE_ config.h config.mak sdl_image +print_config HAVE_ mp_config.h mp_config.mak sdl_image fi enabled sdl && _aomodules="sdl $_aomodules" || _noaomodules="sdl $_noaomodules" enabled sdl && _vomodules="sdl $_vomodules" || _novomodules="sdl $_novomodules" enabled cdparanoia && require2 cdparanoia "cdda_interface.h cdda_paranoia.h" cdda_open -lcdda_interface -lcdda_paranoia cdda=$cdparanoia -print_config HAVE_ config.h config.mak cdda +print_config HAVE_ mp_config.h mp_config.mak cdda enabled cdparanoia && _inputmodules="cdda $_inputmodules" || _noinputmodules="cdda $_noinputmodules" ######### @@ -898,7 +900,7 @@ enabled ossaudio && require2 ossaudio sys/soundcard.h SNDCTL_DSP_SETFRAGMENT oss_audio=$ossaudio -print_config USE_ config.h config.mak oss_audio +print_config USE_ mp_config.h mp_config.mak oss_audio enabled ossaudio && _aomodules="oss $_aomodules" || _noaomodules="oss $_noaomodules" if test "$_linux_devfs" = yes; then _def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/sound/dsp"' @@ -909,74 +911,74 @@ fi enabled alsa && require2 alsa alsa/asoundlib.h SND_LIB_MAJOR -lasound -print_config HAVE_ config.h config.mak alsa +print_config HAVE_ mp_config.h mp_config.mak alsa enabled alsa && _aomodules="alsa $_aomodules" || _noaomodules="alsa $_noaomodules" # It seems that aRts doesn't support pkg-config enabled arts && check_cflags $(artsc-config --cflags) && add_cflags $(artsc-config --cflags) || disable arts enabled arts && check_ldflags $(artsc-config --libs) && add_extralibs $(artsc-config --libs) || disable arts enabled arts && require2 arts artsc.h arts_write -lartsc -print_config HAVE_ config.h config.mak arts +print_config HAVE_ mp_config.h mp_config.mak arts enabled arts && _aomodules="arts $_aomodules" || _noaomodules="arts $_noaomodules" enabled esd && check_cflags $($_pkg_config esound --cflags) && add_cflags $($_pkg_config esound --cflags) || disable esd enabled esd && check_ldflags $($_pkg_config esound --libs) && add_extralibs $($_pkg_config esound --libs) || disable esd enabled esd && require2 esd esd.h esd_open_sound -print_config HAVE_ config.h config.mak esd +print_config HAVE_ mp_config.h mp_config.mak esd enabled esd && _aomodules="esd $_aomodules" || _noaomodules="esd $_noaomodules" enabled openal && require2 openal AL/al.h alSourceQueueBuffers -lopenal -print_config HAVE_ config.h config.mak openal +print_config HAVE_ mp_config.h mp_config.mak openal enabled openal && _aomodules="openal $_aomodules" || _noaomodules="openal $_noaomodules" enabled nas && require2 nas audio/audiolib.h AuOpenServer -laudio -print_config HAVE_ config.h config.mak nas +print_config HAVE_ mp_config.h mp_config.mak nas enabled nas && _aomodules="nas $_aomodules" || _noaomodules="nas $_noaomodules" enabled jack && check_cflags $($_pkg_config jack --cflags) && add_cflags $($_pkg_config jack --cflags) || disable jack enabled jack && check_ldflags $($_pkg_config jack --libs) && add_extralibs $($_pkg_config jack --libs) || disable jack enabled jack && require2 jack jack/jack.h jack_client_open -print_config HAVE_ config.h config.mak jack +print_config HAVE_ mp_config.h mp_config.mak jack enabled jack && _aomodules="jack $_aomodules" || _noaomodules="jack $_noaomodules" enabled libcss && require2 libcss css.h CSSisEncrypted -lcss -print_config HAVE_ config.h config.mak libcss +print_config HAVE_ mp_config.h mp_config.mak libcss enabled libcss && _inputmodules="css $_inputmodules" || _noinputmodules="css $_noinputmodules" enabled libdvdread && require2 libdvdread "stdint.h dvdread/dvd_reader.h dvdread/ifo_types.h dvdread/ifo_read.h dvdread/nav_read.h" DVDOpenFile -ldvdread dvdread=$libdvdread -print_config USE_ config.h config.mak dvdread +print_config USE_ mp_config.h mp_config.mak dvdread enabled libdvdread && _inputmodules="dvdread $_inputmodules" || _noinputmodules="dvdread $_noinputmodules" enabled libdvdnav && require2 libdvdnav dvdnav/dvdnav.h dvdnav_set_PGC_positioning_flag -ldvdnav dvdnav=$libdvdnav -print_config USE_ config.h config.mak dvdnav +print_config USE_ mp_config.h mp_config.mak dvdnav enabled libdvdnav && _inputmodules="dvdnav $_inputmodules" || _noinputmodules="dvdnav $_noinputmodules" enabled libdvdplay && require2 libdvdplay dvdplay/dvdplay.h dvdplay_open -ldvdplay dvdplay=$libdvdplay -print_config USE_ config.h config.mak dvdplay +print_config USE_ mp_config.h mp_config.mak dvdplay enabled libdvdplay && _inputmodules="dvdplay $_inputmodules" || _noinputmodules="dvdplay $_noinputmodules" enabled libvcd && require2 libvcd libvcd/info.h vcdinfo_open -lvcdinfo -print_config USE_ config.h config.mak libvcd +print_config USE_ mp_config.h mp_config.mak libvcd enabled libvcd && _inputmodules="libvcd $_inputmodules" || _noinputmodules="libvcd $_noinputmodules" enabled fastmemcpy && x86 || disable fastmemcpy -print_config USE_ config.h config.mak fastmemcpy +print_config USE_ mp_config.h mp_config.mak fastmemcpy test linux -o bsdos -o freebsd -o sunos && enable vcd || disable vcd -print_config HAVE_ config.h config.mak tv +print_config HAVE_ mp_config.h mp_config.mak tv enabled vcd && _inputmodules="vcd $_inputmodules" || _noinputmodules="vcd $_noinputmodules" -print_config USE_ config.h config.mak tv +print_config USE_ mp_config.h mp_config.mak tv enabled tv && _inputmodules="tv $_inputmodules" || _noinputmodules="tv $_noinputmodules" enabled tv_v4l && require2 tv_v4l "stdlib.h linux/videodev.h" video_devdata -print_config HAVE_ config.h config.mak tv_v4l +print_config HAVE_ mp_config.h mp_config.mak tv_v4l enabled tv_v4l && _vomodules="tv-v4l $_vomodules" || _novomodules="tv-v4l $_novomodules" -print_config HAVE_ config.h config.mak audio_select +print_config HAVE_ mp_config.h mp_config.mak audio_select CFLAGS="$CFLAGS -W -Wall" # Thread support @@ -1008,15 +1010,16 @@ # Checking for VIDIX enabled vidix && require2 vidix vidix/vidixlib.h vdlAllocFourccS -lvidix -print_config CONFIG_ config.h config.mak vidix +print_config CONFIG_ mp_config.h mp_config.mak vidix enabled x11 && enabled vidix && _vomodules="xvidix $_vomodules" || _novomodules="xvidix $_novomodules" _def_ffmpeg= disable _ffmpeg # Checking for FFMPEG -test -f "../codecs/libavcodec/avcodec.h" && enable _ffmpeg +test -f "../codecs/ffmpeg/libavcodec/avcodec.h" && enable _ffmpeg if enabled _ffmpeg ; then _def_ffmpeg='#define HAVE_LOCAL_FFMPEG 1' +add_cflags "-I$_srcdir/../codecs/ffmpeg" _codecmodules="$_codecmodules builtin-ffmpeg" else _nocodecmodules="$_nocodecmodules builtin-ffmpeg" @@ -1027,11 +1030,11 @@ fi enabled joystick && test linux || disable joystick -print_config HAVE_ config.h config.mak joystick +print_config HAVE_ mp_config.h mp_config.mak joystick ############################################################################# -echo "Creating config.mak" -cat >> config.mak << EOF +echo "Creating mp_config.mak" +cat >> mp_config.mak << EOF # -------- Generated by configure ----------- LANG = C @@ -1053,12 +1056,12 @@ # --- HAZARDOUS STUFF EOF -echo "EXTRALIBS=$extralibs" >> config.mak -echo "LDFLAGS=$LDFLAGS" >> config.mak +echo "EXTRALIBS=$extralibs" >> mp_config.mak +echo "LDFLAGS=$LDFLAGS" >> mp_config.mak ############################################################################# -echo "Creating config.h" -cat >> config.h << EOF +echo "Creating mp_config.h" +cat >> mp_config.h << EOF #ifndef MPXP_CONFIG_H #define MPXP_CONFIG_H 1 /* -------- This file has been automatically generated by configure --------- Modified: mplayerxp/cpudetect.c =================================================================== --- mplayerxp/cpudetect.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/cpudetect.c 2009-12-06 16:47:27 UTC (rev 25) @@ -1,4 +1,4 @@ -#include "config.h" +#include "mp_config.h" #include "cpudetect.h" #define MSGT_CLASS MSGT_CPUDETECT #include "__mp_msg.h" Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/dec_ahead.c 2009-12-06 16:47:27 UTC (rev 25) @@ -5,7 +5,7 @@ Note: Threaded engine to decode frames ahead */ -#include "config.h" +#include "mp_config.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/dump.c 2009-12-06 16:47:27 UTC (rev 25) @@ -7,7 +7,7 @@ #define __USE_ISOC99 1 /* for lrint */ #include <math.h> -#include "config.h" +#include "mp_config.h" #include "dump.h" #define MSGT_CLASS MSGT_GLOBAL Modified: mplayerxp/find_sub.c =================================================================== --- mplayerxp/find_sub.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/find_sub.c 2009-12-06 16:47:27 UTC (rev 25) @@ -2,7 +2,7 @@ // .SUB //**************************************************************************// -#include "config.h" +#include "mp_config.h" #ifdef USE_OSD Modified: mplayerxp/input/Makefile =================================================================== --- mplayerxp/input/Makefile 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/input/Makefile 2009-12-06 16:47:27 UTC (rev 25) @@ -1,5 +1,5 @@ -include ../config.mak +include ../mp_config.mak LIBNAME = libinput.a Modified: mplayerxp/input/input.c =================================================================== --- mplayerxp/input/input.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/input/input.c 2009-12-06 16:47:27 UTC (rev 25) @@ -1,4 +1,4 @@ -#include "../config.h" +#include "../mp_config.h" #include <stdlib.h> #include <string.h> Modified: mplayerxp/input/joystick.c =================================================================== --- mplayerxp/input/joystick.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/input/joystick.c 2009-12-06 16:47:27 UTC (rev 25) @@ -1,5 +1,5 @@ -#include "../config.h" +#include "../mp_config.h" #ifdef HAVE_JOYSTICK Modified: mplayerxp/input/lirc.c =================================================================== --- mplayerxp/input/lirc.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/input/lirc.c 2009-12-06 16:47:27 UTC (rev 25) @@ -1,5 +1,5 @@ -#include "../config.h" +#include "../mp_config.h" #ifdef HAVE_LIRC Modified: mplayerxp/libao2/Makefile =================================================================== --- mplayerxp/libao2/Makefile 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/Makefile 2009-12-06 16:47:27 UTC (rev 25) @@ -1,5 +1,5 @@ -include ../config.mak +include ../mp_config.mak LIBNAME = libao2.a @@ -51,7 +51,7 @@ rm -f *.o *.a *~ distclean: - rm -f Makefile.bak *.o *.a *~ .depend config.mak + rm -f Makefile.bak *.o *.a *~ .depend dep: depend Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/ao_alsa9.c 2009-12-06 16:47:27 UTC (rev 25) @@ -17,7 +17,7 @@ #include <string.h> #include <sys/poll.h> -#include "../config.h" +#include "../mp_config.h" #include "../mplayer.h" #define ALSA_PCM_NEW_HW_PARAMS_API #define ALSA_PCM_NEW_SW_PARAMS_API Modified: mplayerxp/libao2/ao_arts.c =================================================================== --- mplayerxp/libao2/ao_arts.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/ao_arts.c 2009-12-06 16:47:27 UTC (rev 25) @@ -23,7 +23,7 @@ #include <artsc.h> #include <stdio.h> -#include "config.h" +#include "mp_config.h" #include "audio_out.h" #include "audio_out_internal.h" #include "postproc/af_format.h" Modified: mplayerxp/libao2/ao_esd.c =================================================================== --- mplayerxp/libao2/ao_esd.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/ao_esd.c 2009-12-06 16:47:27 UTC (rev 25) @@ -46,7 +46,7 @@ #endif #include <esd.h> -#include "config.h" +#include "mp_config.h" #include "audio_out.h" #include "audio_out_internal.h" #include "postproc/af_format.h" Modified: mplayerxp/libao2/ao_jack.c =================================================================== --- mplayerxp/libao2/ao_jack.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/ao_jack.c 2009-12-06 16:47:27 UTC (rev 25) @@ -26,7 +26,7 @@ #include <string.h> #include <unistd.h> -#include "config.h" +#include "mp_config.h" #include "ao_msg.h" #include "audio_out.h" Modified: mplayerxp/libao2/ao_nas.c =================================================================== --- mplayerxp/libao2/ao_nas.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/ao_nas.c 2009-12-06 16:47:27 UTC (rev 25) @@ -53,7 +53,7 @@ #include <limits.h> #include <audio/audiolib.h> -#include "config.h" +#include "mp_config.h" #include "ao_msg.h" #include "audio_out.h" Modified: mplayerxp/libao2/ao_null.c =================================================================== --- mplayerxp/libao2/ao_null.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/ao_null.c 2009-12-06 16:47:27 UTC (rev 25) @@ -5,7 +5,7 @@ #include <limits.h> #include <sys/time.h> -#include "config.h" +#include "mp_config.h" #include "../bswap.h" #include "ao_msg.h" Modified: mplayerxp/libao2/ao_openal.c =================================================================== --- mplayerxp/libao2/ao_openal.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/ao_openal.c 2009-12-06 16:47:27 UTC (rev 25) @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "config.h" +#include "mp_config.h" #include <stdlib.h> #include <stdio.h> Modified: mplayerxp/libao2/ao_oss.c =================================================================== --- mplayerxp/libao2/ao_oss.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/ao_oss.c 2009-12-06 16:47:27 UTC (rev 25) @@ -10,7 +10,7 @@ #include <errno.h> #include <string.h> -#include "../config.h" +#include "../mp_config.h" #include "../mixer.h" #include "afmt.h" @@ -292,7 +292,7 @@ int r=0; MSG_WARN("OSS-CONF: driver doesn't support SNDCTL_DSP_GETOSPACE :-(\n"); if(ioctl(audio_fd, SNDCTL_DSP_GETBLKSIZE, &r)==-1){ - MSG_V("OSS-CONF: %d bytes/frag (config.h)\n",ao_data.outburst); + MSG_V("OSS-CONF: %d bytes/frag (mp_config.h)\n",ao_data.outburst); } else { ao_data.outburst=r; MSG_V("OSS-CONF: %d bytes/frag (GETBLKSIZE)\n",ao_data.outburst); @@ -322,7 +322,7 @@ free(data); if(ao_data.buffersize==0){ MSG_ERR("\n *** OSS-CONF: Your audio driver DOES NOT support select() ***\n" - "Recompile mplayerxp with #undef HAVE_AUDIO_SELECT in config.h !\n\n"); + "Recompile mplayerxp with #undef HAVE_AUDIO_SELECT in mp_config.h !\n\n"); return 0; } #endif Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/ao_wav.c 2009-12-06 16:47:27 UTC (rev 25) @@ -18,7 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "config.h" +#include "mp_config.h" #include <stdio.h> #include <stdlib.h> Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/audio_out.c 2009-12-06 16:47:27 UTC (rev 25) @@ -2,7 +2,7 @@ #include <string.h> #include <stdlib.h> -#include "../config.h" +#include "../mp_config.h" #include "audio_out.h" #include "afmt.h" #include "ao_msg.h" Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/audio_out.h 2009-12-06 16:47:27 UTC (rev 25) @@ -1,6 +1,6 @@ #ifndef __AUDIO_OUT_H #define __AUDIO_OUT_H 1 -#include "../config.h" +#include "../mp_config.h" /** Text description of AO-driver */ typedef struct ao_info_s { Modified: mplayerxp/libao2/audio_out_internal.h =================================================================== --- mplayerxp/libao2/audio_out_internal.h 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libao2/audio_out_internal.h 2009-12-06 16:47:27 UTC (rev 25) @@ -1,4 +1,4 @@ -#include "../config.h" +#include "../mp_config.h" // prototypes: //static ao_info_t info; static int __FASTCALL__ control(int cmd,long arg); Modified: mplayerxp/libmpcodecs/Makefile =================================================================== --- mplayerxp/libmpcodecs/Makefile 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/Makefile 2009-12-06 16:47:27 UTC (rev 25) @@ -1,5 +1,5 @@ -include ../config.mak +include ../mp_config.mak LIBNAME = libmpcodecs.a Modified: mplayerxp/libmpcodecs/ad.c =================================================================== --- mplayerxp/libmpcodecs/ad.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad.c 2009-12-06 16:47:27 UTC (rev 25) @@ -6,7 +6,7 @@ #include <stdlib.h> #include <string.h> -#include "config.h" +#include "mp_config.h" #include "stream.h" #include "demuxer.h" Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_a52.c 2009-12-06 16:47:27 UTC (rev 25) @@ -7,7 +7,7 @@ #include "ad_internal.h" #include "codecs_ld.h" -#include "config.h" +#include "mp_config.h" #include "help_mp.h" #include "cpudetect.h" Modified: mplayerxp/libmpcodecs/ad_acm.c =================================================================== --- mplayerxp/libmpcodecs/ad_acm.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_acm.c 2009-12-06 16:47:27 UTC (rev 25) @@ -1,4 +1,4 @@ -#include "config.h" +#include "mp_config.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_dca.c 2009-12-06 16:47:27 UTC (rev 25) @@ -7,7 +7,7 @@ #include "ad_internal.h" #include "codecs_ld.h" -#include "config.h" +#include "mp_config.h" #include "help_mp.h" #include "cpudetect.h" Modified: mplayerxp/libmpcodecs/ad_dmo.c =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_dmo.c 2009-12-06 16:47:27 UTC (rev 25) @@ -5,7 +5,7 @@ #include "codecs_ld.h" -#include "config.h" +#include "mp_config.h" #include "mp_msg.h" #include "help_mp.h" Modified: mplayerxp/libmpcodecs/ad_dshow.c =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_dshow.c 2009-12-06 16:47:27 UTC (rev 25) @@ -3,7 +3,7 @@ #include <unistd.h> #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" -#include "config.h" +#include "mp_config.h" #include "help_mp.h" #include "interface/dshow/DS_AudioDecoder.h" #include "codecs_ld.h" Modified: mplayerxp/libmpcodecs/ad_faad.c =================================================================== --- mplayerxp/libmpcodecs/ad_faad.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_faad.c 2009-12-06 16:47:27 UTC (rev 25) @@ -12,7 +12,7 @@ #include "help_mp.h" #include "bswap.h" #include "codecs_ld.h" -#include "config.h" +#include "mp_config.h" #include "ad_internal.h" #include "../mplayer.h" #include "../../codecs/libfaad2/faad.h" Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2009-12-06 16:47:27 UTC (rev 25) @@ -7,7 +7,7 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" -#include "config.h" +#include "mp_config.h" #include "help_mp.h" #include "bswap.h" Modified: mplayerxp/libmpcodecs/ad_hwac3.c =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_hwac3.c 2009-12-06 16:47:27 UTC (rev 25) @@ -7,7 +7,7 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" -#include "config.h" +#include "mp_config.h" #include "help_mp.h" #include "codecs_ld.h" #include "cpudetect.h" Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_mp3.c 2009-12-06 16:47:27 UTC (rev 25) @@ -4,7 +4,7 @@ #include <dlfcn.h> /* GLIBC specific. Exists under cygwin too! */ #include "ad_internal.h" #include "interface/mp3.h" -#include "config.h" +#include "mp_config.h" #include "../mplayer.h" #include "../cpudetect.h" #include "../mm_accel.h" Modified: mplayerxp/libmpcodecs/ad_qtaudio.c =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_qtaudio.c 2009-12-06 16:47:27 UTC (rev 25) @@ -3,7 +3,7 @@ #include <unistd.h> #include <inttypes.h> #include <dlfcn.h> -#include "config.h" +#include "mp_config.h" #include "ad_internal.h" #include "bswap.h" Modified: mplayerxp/libmpcodecs/ad_real.c =================================================================== --- mplayerxp/libmpcodecs/ad_real.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_real.c 2009-12-06 16:47:27 UTC (rev 25) @@ -3,7 +3,7 @@ #include <stdlib.h> #include <unistd.h> -#include "config.h" +#include "mp_config.h" #include <stddef.h> #include <dlfcn.h> Modified: mplayerxp/libmpcodecs/ad_twin.c =================================================================== --- mplayerxp/libmpcodecs/ad_twin.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_twin.c 2009-12-06 16:47:27 UTC (rev 25) @@ -1,4 +1,4 @@ -#include "config.h" +#include "mp_config.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> Modified: mplayerxp/libmpcodecs/ad_vorbis.c =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/ad_vorbis.c 2009-12-06 16:47:27 UTC (rev 25) @@ -2,7 +2,7 @@ #include <stdlib.h> #include <unistd.h> #include <dlfcn.h> -#include "config.h" +#include "mp_config.h" #include "codecs_ld.h" #include "ad_internal.h" #include "libao2/afmt.h" Modified: mplayerxp/libmpcodecs/codecs_ld.c =================================================================== --- mplayerxp/libmpcodecs/codecs_ld.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/codecs_ld.c 2009-12-06 16:47:27 UTC (rev 25) @@ -6,7 +6,7 @@ #include <dlfcn.h> #include <string.h> #include "codecs_ld.h" -#include "config.h" +#include "../mp_config.h" #include "../help_mp.h" #define MSGT_CLASS MSGT_GLOBAL #include "../__mp_msg.h" Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2009-12-06 12:48:07 UTC (rev 24) +++ mplayerxp/libmpcodecs/dec_audio.c 2009-12-06 16:47:27 UTC (rev 25) @@ -2,7 +2,7 @@ #include <stdlib.h> ... [truncated message content] |
From: <nic...@us...> - 2009-12-16 15:56:11
|
Revision: 43 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=43&view=rev Author: nickols_k Date: 2009-12-16 15:56:00 +0000 (Wed, 16 Dec 2009) Log Message: ----------- import stuff from mphq (may not work) Modified Paths: -------------- mplayerxp/Makefile mplayerxp/configure mplayerxp/libvo/Makefile mplayerxp/libvo/aspect.c mplayerxp/libvo/aspect.h mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_opengl.c Added Paths: ----------- mplayerxp/libvo/vo_vdpau.c mplayerxp/subopt-helper.c mplayerxp/subopt-helper.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2009-12-15 18:08:49 UTC (rev 42) +++ mplayerxp/Makefile 2009-12-16 15:56:00 UTC (rev 43) @@ -24,7 +24,7 @@ LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS_COMMON = cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c my_malloc.c spudec.c playtree.c playtreeparser.c asxparser.c mp_image.c +SRCS_COMMON = cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c my_malloc.c spudec.c playtree.c playtreeparser.c asxparser.c mp_image.c subopt-helper.c SRCS_MPLAYER = mplayer.c $(SRCS_COMMON) find_sub.c subreader.c mixer.c vobsub.c mp-opt-reg.c sig_hand.c dump.c dec_ahead.c m_option.c m_property.c m_struct.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2009-12-15 18:08:49 UTC (rev 42) +++ mplayerxp/configure 2009-12-16 15:56:00 UTC (rev 43) @@ -92,6 +92,7 @@ --enable-xf86vm build with Xf86vm support for X11 [autodetect] --enable-xv build with Xv render support for X 4.x [autodetect] --enable-opengl build with OpenGL render support [autodetect] + --enable-vdpau build with VDPAU render support [autodetect] --enable-fbdev build with FBDev render support [autodetect] --enable-fbdev=nocopy yuv12 converts directly into framebuffer --enable-mlib build with MLIB support (Solaris only) [autodetect] @@ -374,6 +375,7 @@ xinerama xf86vm opengl + vdpau dga vesa vidix @@ -415,6 +417,8 @@ --disable-xv) xv=no ;; --enable-opengl) opengl=yes ;; --disable-opengl) opengl=no ;; + --enable-vdpau) vdpau=yes ;; + --disable-vdpau) vdpau=no ;; --enable-sdl) sdl=yes ;; --disable-sdl) sdl=no ;; --enable-sdl-image) sdl_image=yes ;; @@ -848,6 +852,10 @@ print_config HAVE_ mp_config.h mp_config.mak opengl enabled opengl && _vomodules="opengl $_vomodules" || _novomodules="opengl $_novomodules" +enabled vdpau && require3 vdpau "vdpau/vdpau_x11.h" VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 vdp_device_create_x11 -lvdpau +print_config HAVE_ mp_config.h mp_config.mak vdpau +enabled vdpau && _vomodules="vdpau $_vomodules" || _novomodules="vdpau $_novomodules" + # Note: the -lXxf86vm library is the VideoMode extension and though it's not # needed for DGA, AFAIK every distribution packages together with DGA stuffs # named 'X extensions' or something similar. Modified: mplayerxp/libvo/Makefile =================================================================== --- mplayerxp/libvo/Makefile 2009-12-15 18:08:49 UTC (rev 42) +++ mplayerxp/libvo/Makefile 2009-12-16 15:56:00 UTC (rev 43) @@ -10,6 +10,9 @@ ifeq ($(HAVE_OPENGL),yes) SRCS+=gl_common.c vo_opengl.c endif +ifeq ($(HAVE_VDPAU),yes) +SRCS+=vo_vdpau.c +endif ifeq ($(HAVE_X11),yes) SRCS+=vo_x11.c x11_common.c ifeq ($(CONFIG_VIDIX),yes) Modified: mplayerxp/libvo/aspect.c =================================================================== --- mplayerxp/libvo/aspect.c 2009-12-15 18:08:49 UTC (rev 42) +++ mplayerxp/libvo/aspect.c 2009-12-16 15:56:00 UTC (rev 43) @@ -12,25 +12,25 @@ float monitor_pixel_aspect=1; static struct { - int orgw; // real width - int orgh; // real height - int prew; // prescaled width - int preh; // prescaled height - int scrw; // horizontal resolution - int scrh; // vertical resolution + uint32_t orgw; // real width + uint32_t orgh; // real height + uint32_t prew; // prescaled width + uint32_t preh; // prescaled height + uint32_t scrw; // horizontal resolution + uint32_t scrh; // vertical resolution } aspdat; -void __FASTCALL__ aspect_save_orig(int orgw, int orgh){ +void __FASTCALL__ aspect_save_orig(uint32_t orgw, uint32_t orgh){ aspdat.orgw = orgw; aspdat.orgh = orgh; } -void __FASTCALL__ aspect_save_prescale(int prew, int preh){ +void __FASTCALL__ aspect_save_prescale(uint32_t prew, uint32_t preh){ aspdat.prew = prew; aspdat.preh = preh; } -void __FASTCALL__ aspect_save_screenres(int scrw, int scrh){ +void __FASTCALL__ aspect_save_screenres(uint32_t scrw, uint32_t scrh){ aspdat.scrw = scrw; aspdat.scrh = scrh; monitor_aspect = monitor_pixel_aspect * scrw / scrh; @@ -40,8 +40,8 @@ * resolution, that the scaled image should fit into */ -void __FASTCALL__ aspect(int *srcw, int *srch, int zoom){ - int tmpw; +void __FASTCALL__ aspect(uint32_t *srcw, uint32_t *srch, int zoom){ + uint32_t tmpw; #ifdef ASPECT_DEBUG MSG_DBG2("aspect(0) fitin: %dx%d zoom: %d \n",aspdat.scrw,aspdat.scrh,zoom); @@ -52,19 +52,19 @@ { /* Landscape mode */ *srcw = aspdat.scrw; - *srch = (int)(((float)aspdat.scrw / (float)aspdat.prew * (float)aspdat.preh) + *srch = (uint32_t)(((float)aspdat.scrw / (float)aspdat.prew * (float)aspdat.preh) * ((float)aspdat.scrh / ((float)aspdat.scrw / monitor_aspect))); } else { /* Portrait mode */ *srch = aspdat.scrh; - *srcw = (int)(((float)aspdat.scrh / (float)aspdat.preh * (float)aspdat.prew) + *srcw = (uint32_t)(((float)aspdat.scrh / (float)aspdat.preh * (float)aspdat.prew) * ((float)aspdat.scrw / ((float)aspdat.scrh * monitor_aspect))); } }else{ *srcw = aspdat.prew; - *srch = (int)((float)aspdat.preh + *srch = (uint32_t)((float)aspdat.preh * ((float)aspdat.scrh / ((float)aspdat.scrw / monitor_aspect))); } (*srch)+= (*srch)%2; // round @@ -73,10 +73,10 @@ #endif if(*srch>aspdat.scrh || *srch<aspdat.orgh){ if(zoom) - tmpw = (int)(((float)aspdat.scrh / (float)aspdat.preh * (float)aspdat.prew) + tmpw = (uint32_t)(((float)aspdat.scrh / (float)aspdat.preh * (float)aspdat.prew) * ((float)aspdat.scrw / ((float)aspdat.scrh / (1.0/monitor_aspect)))); else - tmpw = (int)((float)aspdat.prew + tmpw = (uint32_t)((float)aspdat.prew * ((float)aspdat.scrw / ((float)aspdat.scrh / (1.0/monitor_aspect)))); if(tmpw<=aspdat.scrw && tmpw>=aspdat.orgw){ *srch = zoom?aspdat.scrh:aspdat.preh; Modified: mplayerxp/libvo/aspect.h =================================================================== --- mplayerxp/libvo/aspect.h 2009-12-15 18:08:49 UTC (rev 42) +++ mplayerxp/libvo/aspect.h 2009-12-16 15:56:00 UTC (rev 43) @@ -1,16 +1,17 @@ #ifndef __ASPECT_H #define __ASPECT_H /* Stuff for correct aspect scaling. */ +#include <stdint.h> #include "../mp_config.h" -void __FASTCALL__ aspect_save_orig(int orgw, int orgh); -void __FASTCALL__ aspect_save_prescale(int prew, int preh); -void __FASTCALL__ aspect_save_screenres(int scrw, int scrh); +void __FASTCALL__ aspect_save_orig(uint32_t orgw, uint32_t orgh); +void __FASTCALL__ aspect_save_prescale(uint32_t prew, uint32_t preh); +void __FASTCALL__ aspect_save_screenres(uint32_t scrw, uint32_t scrh); #define A_ZOOM 1 #define A_NOZOOM 0 -void __FASTCALL__ aspect(int *srcw, int *srch, int zoom); +void __FASTCALL__ aspect(uint32_t *srcw, uint32_t *srch, int zoom); #endif Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2009-12-15 18:08:49 UTC (rev 42) +++ mplayerxp/libvo/video_out.c 2009-12-16 15:56:00 UTC (rev 43) @@ -111,6 +111,7 @@ extern vo_functions_t video_out_fbdev; extern vo_functions_t video_out_png; extern vo_functions_t video_out_opengl; +extern vo_functions_t video_out_vdpau; #ifdef HAVE_VESA extern vo_functions_t video_out_vesa; #endif @@ -126,6 +127,9 @@ #ifdef HAVE_OPENGL &video_out_opengl, #endif +#ifdef HAVE_VDPAU + &video_out_vdpau, +#endif #if defined(CONFIG_VIDIX) && defined(HAVE_X11) &video_out_xvidix, #endif Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2009-12-15 18:08:49 UTC (rev 42) +++ mplayerxp/libvo/video_out.h 2009-12-16 15:56:00 UTC (rev 43) @@ -182,6 +182,10 @@ extern void vo_uninit( void ); extern uint32_t __FASTCALL__ vo_control(uint32_t request, void *data); +struct vo_rect { + int left, right, top, bottom, width, height; +}; + /** Contains geometry of fourcc */ typedef struct s_vo_format_desc { Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2009-12-15 18:08:49 UTC (rev 42) +++ mplayerxp/libvo/vo_opengl.c 2009-12-16 15:56:00 UTC (rev 43) @@ -28,6 +28,7 @@ #include "video_out_internal.h" #include "font_load.h" #include "sub.h" +#include "subopt-helper.h" #include "gl_common.h" #include "aspect.h" @@ -423,6 +424,7 @@ return -1; #else { +#if 0 XVisualInfo *vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib ); if (vinfo == NULL) { @@ -430,12 +432,9 @@ return -1; } MSG_V("[gl] GLX chose visual with ID 0x%x\n", (int)vinfo->visualid); - +#endif vo_x11_calcpos(&hint,d_width,d_height,flags); glutInitDisplayMode(GLUT_RGBA); -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) - glutInitDisplayString("MPlayerXP"); -#endif glutInitWindowPosition(hint.x, hint.y); glutInitWindowSize(hint.width, hint.height); gl_win=glutCreateWindow("MPlayerXP"); @@ -853,7 +852,6 @@ glutDestroyWindow(gl_win); } -#if 0 static const opt_t subopts[] = { {"manyfmts", OPT_ARG_BOOL, &many_fmts, NULL}, {"osd", OPT_ARG_BOOL, &use_osd, NULL}, @@ -878,7 +876,6 @@ {"osdcolor", OPT_ARG_INT, &osd_color, NULL}, {NULL} }; -#endif static uint32_t __FASTCALL__ preinit(const char *arg) { @@ -904,7 +901,7 @@ custom_tlin = 1; custom_trect = 0; osd_color = 0xffffff; -#if 0 + if (subopt_parse(arg, subopts) != 0) { MSG_FATAL( "\n-vo gl command line help:\n" @@ -968,7 +965,7 @@ "\n" ); return -1; } -#endif + if (use_rectangle == 1) gl_target = GL_TEXTURE_RECTANGLE; else Added: mplayerxp/libvo/vo_vdpau.c =================================================================== --- mplayerxp/libvo/vo_vdpau.c (rev 0) +++ mplayerxp/libvo/vo_vdpau.c 2009-12-16 15:56:00 UTC (rev 43) @@ -0,0 +1,1288 @@ +/* + * VDPAU video output driver + * + * Copyright (C) 2008 NVIDIA + * + * 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. + */ + +/** + * \defgroup VDPAU_Presentation VDPAU Presentation + * \ingroup Decoder + * + * Actual decoding and presentation are implemented here. + * All necessary frame information is collected through + * the "vdpau_render_state" structure after parsing all headers + * etc. in libavcodec for different codecs. + * + * @{ + */ + +#include <stdio.h> +#include <stdlib.h> + +#include "../mp_config.h" +#include "../mplayer.h" +#include "../dec_ahead.h" +#include "video_out.h" +#include "video_out_internal.h" +#include "x11_common.h" +#include "aspect.h" +#include "sub.h" +#include "subopt-helper.h" +#include "../postproc/vfcap.h" +#include "libavcodec/vdpau.h" +#include "libavutil/common.h" +#include "libavutil/mathematics.h" + +#include "vo_msg.h" + +static vo_info_t vo_info = { + "VDPAU with X11", + "vdpau", + "Rajib Mahapatra <rma...@nv...> and others", + "" +}; + +LIBVO_EXTERN(vdpau) + +static const vo_info_t *get_info(void) +{ + return(&vo_info); +} + +#define CHECK_ST_ERROR(message) \ + if (vdp_st != VDP_STATUS_OK) { \ + MSG_ERR("[vdpau] %s: %s\n", \ + message, vdp_get_error_string(vdp_st)); \ + return -1; \ + } + +#define CHECK_ST_WARNING(message) \ + if (vdp_st != VDP_STATUS_OK) \ + MSG_WARN("[vdpau] %s: %s\n", \ + message, vdp_get_error_string(vdp_st)); + +/* number of video and output surfaces */ +#define NUM_OUTPUT_SURFACES 2 +#define MAX_VIDEO_SURFACES 50 + +/* number of palette entries */ +#define PALETTE_SIZE 256 + +/* + * Global variable declaration - VDPAU specific + */ + +/* Declaration for all variables of win_x11_init_vdpau_procs() and + * win_x11_init_vdpau_flip_queue() functions + */ +static VdpDevice vdp_device; +static VdpGetProcAddress *vdp_get_proc_address; + +static VdpPresentationQueueTarget vdp_flip_target; +static VdpPresentationQueue vdp_flip_queue; + +static VdpDeviceDestroy *vdp_device_destroy; +static VdpVideoSurfaceCreate *vdp_video_surface_create; +static VdpVideoSurfaceDestroy *vdp_video_surface_destroy; + +static VdpGetErrorString *vdp_get_error_string; + +/* May be used in software filtering/postprocessing options + * in MPlayer (./mplayer -vf ..) if we copy video_surface data to + * system memory. + */ +static VdpVideoSurfacePutBitsYCbCr *vdp_video_surface_put_bits_y_cb_cr; +static VdpOutputSurfacePutBitsNative *vdp_output_surface_put_bits_native; + +static VdpOutputSurfaceCreate *vdp_output_surface_create; +static VdpOutputSurfaceDestroy *vdp_output_surface_destroy; + +/* VideoMixer puts video_surface data on displayable output_surface. */ +static VdpVideoMixerCreate *vdp_video_mixer_create; +static VdpVideoMixerDestroy *vdp_video_mixer_destroy; +static VdpVideoMixerRender *vdp_video_mixer_render; +static VdpVideoMixerSetFeatureEnables *vdp_video_mixer_set_feature_enables; +static VdpVideoMixerSetAttributeValues *vdp_video_mixer_set_attribute_values; + +static VdpPresentationQueueTargetDestroy *vdp_presentation_queue_target_destroy; +static VdpPresentationQueueCreate *vdp_presentation_queue_create; +static VdpPresentationQueueDestroy *vdp_presentation_queue_destroy; +static VdpPresentationQueueDisplay *vdp_presentation_queue_display; +static VdpPresentationQueueBlockUntilSurfaceIdle *vdp_presentation_queue_block_until_surface_idle; +static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11; + +static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface; +static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed; +static VdpOutputSurfaceRenderBitmapSurface *vdp_output_surface_render_bitmap_surface; + +static VdpBitmapSurfaceCreate *vdp_bitmap_surface_create; +static VdpBitmapSurfaceDestroy *vdp_bitmap_surface_destroy; +static VdpBitmapSurfacePutBitsNative *vdp_bitmap_surface_putbits_native; + +static VdpDecoderCreate *vdp_decoder_create; +static VdpDecoderDestroy *vdp_decoder_destroy; +static VdpDecoderRender *vdp_decoder_render; + +static VdpGenerateCSCMatrix *vdp_generate_csc_matrix; +static VdpPreemptionCallbackRegister *vdp_preemption_callback_register; + +/* output_surfaces[NUM_OUTPUT_SURFACES] is misused for OSD. */ +#define osd_surface output_surfaces[NUM_OUTPUT_SURFACES] +static VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES + 1]; +static VdpVideoSurface deint_surfaces[3]; +static mp_image_t *deint_mpi[2]; +static uint32_t output_surface_width, output_surface_height; + +static VdpVideoMixer video_mixer; +static int deint; +static int deint_type; +static int deint_counter; +static int deint_buffer_past_frames; +static int pullup; +static float denoise; +static float sharpen; +static int colorspace; +static int chroma_deint; +static int force_mixer; +static int top_field_first; +static int hqscaling; + +static VdpDecoder decoder; +static int decoder_max_refs; + +static VdpRect src_rect_vid; +static VdpRect out_rect_vid; +static int border_x, border_y; +static uint32_t dwidth,dheight; + +static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES]; +static int surface_num; +static int vid_surface_num; +static uint32_t vid_width, vid_height; +static uint32_t image_format; +static VdpChromaType vdp_chroma_type; +static VdpYCbCrFormat vdp_pixel_format; + +static volatile int is_preempted; + +/* draw_osd */ +static unsigned char *index_data; +static int index_data_size; +static uint32_t palette[PALETTE_SIZE]; +static void draw_osd(void); + +// Video equalizer +static VdpProcamp procamp; + +/* + * X11 specific + */ +static int visible_buf; +static int int_pause; + +static void push_deint_surface(VdpVideoSurface surface) +{ + deint_surfaces[2] = deint_surfaces[1]; + deint_surfaces[1] = deint_surfaces[0]; + deint_surfaces[0] = surface; +} + +static void video_to_output_surface(void) +{ + VdpTime dummy; + VdpStatus vdp_st; + int i; + if (vid_surface_num < 0) + return; + + if (deint < 2 || deint_surfaces[0] == VDP_INVALID_HANDLE) + push_deint_surface(surface_render[vid_surface_num].surface); + + for (i = 0; i <= !!(deint > 1); i++) { + int field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; + VdpOutputSurface output_surface; + if (i) { + draw_osd(); + flip_page(0); + } + if (deint) + field = (top_field_first == i) ^ (deint > 1) ? + VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD: + VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; + output_surface = output_surfaces[surface_num]; + vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue, + output_surface, + &dummy); + CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle") + + vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0, + field, 2, deint_surfaces + 1, + deint_surfaces[0], + 1, &surface_render[vid_surface_num].surface, + &src_rect_vid, + output_surface, + NULL, &out_rect_vid, 0, NULL); + CHECK_ST_WARNING("Error when calling vdp_video_mixer_render") + push_deint_surface(surface_render[vid_surface_num].surface); + } +} + +static void resize(int x,int y) +{ + VdpStatus vdp_st; + int i; + struct vo_rect src_rect; + struct vo_rect dst_rect; + struct vo_rect borders; + int w = x, h = y; + aspect(&w,&h,A_ZOOM); + dst_rect.left=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; + dst_rect.top=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2; + w=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); + h=(dheight > vo_screenheight?vo_screenheight:dheight); + dst_rect.bottom=dst_rect.top+h; + dst_rect.right=dst_rect.left+w; + + out_rect_vid.x0 = dst_rect.left; + out_rect_vid.x1 = dst_rect.right; + out_rect_vid.y0 = dst_rect.top; + out_rect_vid.y1 = dst_rect.bottom; + src_rect_vid.x0 = src_rect.left; + src_rect_vid.x1 = src_rect.right; + src_rect_vid.y0 = flip ? src_rect.bottom : src_rect.top; + src_rect_vid.y1 = flip ? src_rect.top : src_rect.bottom; + border_x = borders.left; + border_y = borders.top; +#ifdef CONFIG_FREETYPE + // adjust font size to display size + force_load_font = 1; +#endif + vo_osd_changed(OSDTYPE_OSD); + + if (output_surface_width < vo_dwidth || output_surface_height < vo_dheight) { + if (output_surface_width < vo_dwidth) { + output_surface_width += output_surface_width >> 1; + output_surface_width = FFMAX(output_surface_width, vo_dwidth); + } + if (output_surface_height < vo_dheight) { + output_surface_height += output_surface_height >> 1; + output_surface_height = FFMAX(output_surface_height, vo_dheight); + } + // Creation of output_surfaces + for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) { + if (output_surfaces[i] != VDP_INVALID_HANDLE) + vdp_output_surface_destroy(output_surfaces[i]); + vdp_st = vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, + output_surface_width, output_surface_height, + &output_surfaces[i]); + CHECK_ST_WARNING("Error when calling vdp_output_surface_create") + MSG_DBG2("OUT CREATE: %u\n", output_surfaces[i]); + } + } + if (image_format == IMGFMT_BGRA) { + vdp_st = vdp_output_surface_render_output_surface(output_surfaces[surface_num], + NULL, VDP_INVALID_HANDLE, + NULL, NULL, NULL, + VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); + CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface") + vdp_st = vdp_output_surface_render_output_surface(output_surfaces[1 - surface_num], + NULL, VDP_INVALID_HANDLE, + NULL, NULL, NULL, + VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); + CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface") + } else + video_to_output_surface(); + if (visible_buf) + flip_page(0); +} + +static void preemption_callback(VdpDevice device, void *context) +{ + MSG_ERR("[vdpau] Display preemption detected\n"); + is_preempted = 1; +} + +/* Initialize vdp_get_proc_address, called from preinit() */ +static int win_x11_init_vdpau_procs(void) +{ + VdpStatus vdp_st; + + struct vdp_function { + const int id; + void *pointer; + }; + + const struct vdp_function *dsc; + + static const struct vdp_function vdp_func[] = { + {VDP_FUNC_ID_GET_ERROR_STRING, &vdp_get_error_string}, + {VDP_FUNC_ID_DEVICE_DESTROY, &vdp_device_destroy}, + {VDP_FUNC_ID_VIDEO_SURFACE_CREATE, &vdp_video_surface_create}, + {VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, &vdp_video_surface_destroy}, + {VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR, + &vdp_video_surface_put_bits_y_cb_cr}, + {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE, + &vdp_output_surface_put_bits_native}, + {VDP_FUNC_ID_OUTPUT_SURFACE_CREATE, &vdp_output_surface_create}, + {VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY, &vdp_output_surface_destroy}, + {VDP_FUNC_ID_VIDEO_MIXER_CREATE, &vdp_video_mixer_create}, + {VDP_FUNC_ID_VIDEO_MIXER_DESTROY, &vdp_video_mixer_destroy}, + {VDP_FUNC_ID_VIDEO_MIXER_RENDER, &vdp_video_mixer_render}, + {VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES, + &vdp_video_mixer_set_feature_enables}, + {VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES, + &vdp_video_mixer_set_attribute_values}, + {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY, + &vdp_presentation_queue_target_destroy}, + {VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE, &vdp_presentation_queue_create}, + {VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY, + &vdp_presentation_queue_destroy}, + {VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY, + &vdp_presentation_queue_display}, + {VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE, + &vdp_presentation_queue_block_until_surface_idle}, + {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11, + &vdp_presentation_queue_target_create_x11}, + {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE, + &vdp_output_surface_render_output_surface}, + {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED, + &vdp_output_surface_put_bits_indexed}, + {VDP_FUNC_ID_DECODER_CREATE, &vdp_decoder_create}, + {VDP_FUNC_ID_DECODER_RENDER, &vdp_decoder_render}, + {VDP_FUNC_ID_DECODER_DESTROY, &vdp_decoder_destroy}, + {VDP_FUNC_ID_BITMAP_SURFACE_CREATE, &vdp_bitmap_surface_create}, + {VDP_FUNC_ID_BITMAP_SURFACE_DESTROY, &vdp_bitmap_surface_destroy}, + {VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE, + &vdp_bitmap_surface_putbits_native}, + {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE, + &vdp_output_surface_render_bitmap_surface}, + {VDP_FUNC_ID_GENERATE_CSC_MATRIX, &vdp_generate_csc_matrix}, + {VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER, + &vdp_preemption_callback_register}, + {0, NULL} + }; + + vdp_st = vdp_device_create_x11(mDisplay, mScreen, + &vdp_device, &vdp_get_proc_address); + if (vdp_st != VDP_STATUS_OK) { + MSG_ERR("[vdpau] Error when calling vdp_device_create_x11: %i\n", vdp_st); + return -1; + } + + vdp_get_error_string = NULL; + for (dsc = vdp_func; dsc->pointer; dsc++) { + vdp_st = vdp_get_proc_address(vdp_device, dsc->id, dsc->pointer); + if (vdp_st != VDP_STATUS_OK) { + MSG_ERR("[vdpau] Error when calling vdp_get_proc_address(function id %d): %s\n", + dsc->id, vdp_get_error_string ? vdp_get_error_string(vdp_st) : "?"); + return -1; + } + } + vdp_st = vdp_preemption_callback_register(vdp_device, + preemption_callback, NULL); + CHECK_ST_ERROR("Error when calling vdp_preemption_callback_register") + + return 0; +} + +/* Initialize vdpau_flip_queue, called from config() */ +static int win_x11_init_vdpau_flip_queue(void) +{ + VdpStatus vdp_st; + + vdp_st = vdp_presentation_queue_target_create_x11(vdp_device, vo_window, + &vdp_flip_target); + CHECK_ST_ERROR("Error when calling vdp_presentation_queue_target_create_x11") + + vdp_st = vdp_presentation_queue_create(vdp_device, vdp_flip_target, + &vdp_flip_queue); + CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create") + + return 0; +} + +static int update_csc_matrix(void) +{ + VdpStatus vdp_st; + VdpCSCMatrix matrix; + static const VdpVideoMixerAttribute attributes[] = {VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX}; + const void *attribute_values[] = {&matrix}; + static const VdpColorStandard vdp_colors[] = {0, VDP_COLOR_STANDARD_ITUR_BT_601, VDP_COLOR_STANDARD_ITUR_BT_709, VDP_COLOR_STANDARD_SMPTE_240M}; + static const char * const vdp_names[] = {NULL, "BT.601", "BT.709", "SMPTE-240M"}; + int csp = colorspace; + + if (!csp) + csp = vid_width >= 1280 || vid_height > 576 ? 2 : 1; + + MSG_V("[vdpau] Updating CSC matrix for %s\n", + vdp_names[csp]); + + vdp_st = vdp_generate_csc_matrix(&procamp, vdp_colors[csp], &matrix); + CHECK_ST_WARNING("Error when generating CSC matrix") + + vdp_st = vdp_video_mixer_set_attribute_values(video_mixer, 1, attributes, + attribute_values); + CHECK_ST_WARNING("Error when setting CSC matrix") + return VO_TRUE; +} + +static int create_vdp_mixer(VdpChromaType vdp_chroma_type) +{ +#define VDP_NUM_MIXER_PARAMETER 3 +#define MAX_NUM_FEATURES 6 + int i; + VdpStatus vdp_st; + int feature_count = 0; + VdpVideoMixerFeature features[MAX_NUM_FEATURES]; + VdpBool feature_enables[MAX_NUM_FEATURES]; + static const VdpVideoMixerAttribute denoise_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL}; + const void * const denoise_value[] = {&denoise}; + static const VdpVideoMixerAttribute sharpen_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL}; + const void * const sharpen_value[] = {&sharpen}; + static const VdpVideoMixerAttribute skip_chroma_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE}; + const uint8_t skip_chroma_value = 1; + const void * const skip_chroma_value_ptr[] = {&skip_chroma_value}; + static const VdpVideoMixerParameter parameters[VDP_NUM_MIXER_PARAMETER] = { + VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH, + VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT, + VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE + }; + const void *const parameter_values[VDP_NUM_MIXER_PARAMETER] = { + &vid_width, + &vid_height, + &vdp_chroma_type + }; + features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL; + if (deint == 4) + features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL; + if (pullup) + features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE; + if (denoise) + features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION; + if (sharpen) + features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS; + if (hqscaling) + features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 + (hqscaling - 1); + + vdp_st = vdp_video_mixer_create(vdp_device, feature_count, features, + VDP_NUM_MIXER_PARAMETER, + parameters, parameter_values, + &video_mixer); + CHECK_ST_ERROR("Error when calling vdp_video_mixer_create") + + for (i = 0; i < feature_count; i++) + feature_enables[i] = VDP_TRUE; + if (deint < 3) + feature_enables[0] = VDP_FALSE; + if (feature_count) + vdp_video_mixer_set_feature_enables(video_mixer, feature_count, features, feature_enables); + if (denoise) + vdp_video_mixer_set_attribute_values(video_mixer, 1, denoise_attrib, denoise_value); + if (sharpen) + vdp_video_mixer_set_attribute_values(video_mixer, 1, sharpen_attrib, sharpen_value); + if (!chroma_deint) + vdp_video_mixer_set_attribute_values(video_mixer, 1, skip_chroma_attrib, skip_chroma_value_ptr); + + update_csc_matrix(); + return 0; +} + +// Free everything specific to a certain video file +static void free_video_specific(void) +{ + int i; + VdpStatus vdp_st; + + if (decoder != VDP_INVALID_HANDLE) + vdp_decoder_destroy(decoder); + decoder = VDP_INVALID_HANDLE; + decoder_max_refs = -1; + + for (i = 0; i < 3; i++) + deint_surfaces[i] = VDP_INVALID_HANDLE; + + for (i = 0; i < 2; i++) + if (deint_mpi[i]) { + deint_mpi[i] = NULL; + } + + for (i = 0; i < MAX_VIDEO_SURFACES; i++) { + if (surface_render[i].surface != VDP_INVALID_HANDLE) { + vdp_st = vdp_video_surface_destroy(surface_render[i].surface); + CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy") + } + surface_render[i].surface = VDP_INVALID_HANDLE; + } + + if (video_mixer != VDP_INVALID_HANDLE) { + vdp_st = vdp_video_mixer_destroy(video_mixer); + CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy") + } + video_mixer = VDP_INVALID_HANDLE; +} + +static int create_vdp_decoder(uint32_t format, uint32_t width, uint32_t height, + int max_refs) +{ + VdpStatus vdp_st; + VdpDecoderProfile vdp_decoder_profile; + if (decoder != VDP_INVALID_HANDLE) + vdp_decoder_destroy(decoder); + switch (format) { + case IMGFMT_VDPAU_MPEG1: + vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1; + break; + case IMGFMT_VDPAU_MPEG2: + vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG2_MAIN; + break; + case IMGFMT_VDPAU_H264: + vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH; + MSG_V("[vdpau] Creating H264 hardware decoder for %d reference frames.\n", max_refs); + break; + case IMGFMT_VDPAU_WMV3: + vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN; + break; + case IMGFMT_VDPAU_VC1: + vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED; + break; + case IMGFMT_VDPAU_MPEG4: + vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP; + break; + default: + goto err_out; + } + vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile, + width, height, max_refs, &decoder); + CHECK_ST_WARNING("Failed creating VDPAU decoder"); + if (vdp_st != VDP_STATUS_OK) { +err_out: + decoder = VDP_INVALID_HANDLE; + decoder_max_refs = 0; + return 0; + } + decoder_max_refs = max_refs; + return 1; +} + +static void mark_vdpau_objects_uninitialized(void) +{ + int i; + + decoder = VDP_INVALID_HANDLE; + for (i = 0; i < MAX_VIDEO_SURFACES; i++) + surface_render[i].surface = VDP_INVALID_HANDLE; + for (i = 0; i < 3; i++) { + deint_surfaces[i] = VDP_INVALID_HANDLE; + deint_mpi[i] = NULL; + } + video_mixer = VDP_INVALID_HANDLE; + vdp_flip_queue = VDP_INVALID_HANDLE; + vdp_flip_target = VDP_INVALID_HANDLE; + for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) + output_surfaces[i] = VDP_INVALID_HANDLE; + vdp_device = VDP_INVALID_HANDLE; + output_surface_width = output_surface_height = -1; + visible_buf = 0; +} + +static int handle_preemption(void) +{ + if (!is_preempted) + return 0; + is_preempted = 0; + MSG_INFO("[vdpau] Attempting to recover from preemption.\n"); + mark_vdpau_objects_uninitialized(); + if (win_x11_init_vdpau_procs() < 0 || + win_x11_init_vdpau_flip_queue() < 0 || + create_vdp_mixer(vdp_chroma_type) < 0) { + MSG_ERR("[vdpau] Recovering from preemption failed\n"); + is_preempted = 1; + return -1; + } +// resize(); + MSG_INFO("[vdpau] Recovered from display preemption.\n"); + return 1; +} + +/* + * connect to X server, create and map window, initialize all + * VDPAU objects, create different surfaces etc. + */ +static uint32_t __FASTCALL__ config(uint32_t width, uint32_t height, uint32_t d_width, + uint32_t d_height, uint32_t flags, char *title, + uint32_t format,const vo_tune_info_t *tune) +{ + XSizeHints hint; + XVisualInfo vinfo; + XSetWindowAttributes xswa; + XWindowAttributes attribs; + unsigned long xswamask; + int depth; + +#ifdef CONFIG_XF86VM + int vm = flags & VOFLAG_MODESWITCHING; +#endif + flip = flags & VOFLAG_FLIPPING; + + image_format = format; + vid_width = width; + vid_height = height; + dwidth = d_width; + dheight = d_height; + free_video_specific(); + if (IMGFMT_IS_VDPAU(image_format) + && !create_vdp_decoder(image_format, vid_width, vid_height, 2)) + return -1; + + int_pause = 0; + visible_buf = 0; + +#ifdef CONFIG_GUI + if (use_gui) + guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize our window + else +#endif + { +#ifdef CONFIG_XF86VM + if (vm) + vo_vm_switch(); + else +#endif + XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); + depth = attribs.depth; + if (depth != 15 && depth != 16 && depth != 24 && depth != 32) + depth = 24; + XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); + + xswa.background_pixel = 0; + xswa.border_pixel = 0; + /* Do not use CWBackPixel: It leads to VDPAU errors after + aspect ratio changes. */ + xswamask = CWBorderPixel; + + aspect_save_screenres(vo_screenwidth,vo_screenheight); + + aspect(&d_width,&d_height,softzoom?A_ZOOM:A_NOZOOM); +#ifdef X11_FULLSCREEN + if( vo_fs ) aspect(&d_width,&d_height,A_ZOOM); +#endif + vo_x11_calcpos(&hint,d_width,d_height,flags); + hint.flags = PPosition | PSize; + vo_window = XCreateWindow(mDisplay, RootWindow(mDisplay,mScreen), + hint.x, hint.y, hint.width, hint.height, + 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); +// vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height, +// flags, CopyFromParent, "vdpau", title); + XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); + +#ifdef CONFIG_XF86VM + if (vm) { + /* Grab the mouse pointer in our window */ + if (vo_grabpointer) + XGrabPointer(mDisplay, vo_window, True, 0, + GrabModeAsync, GrabModeAsync, + vo_window, None, CurrentTime); + XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); + } +#endif + } + + if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) + vo_fs = 1; + + /* -----VDPAU related code here -------- */ + if (vdp_flip_queue == VDP_INVALID_HANDLE && win_x11_init_vdpau_flip_queue()) + return -1; + + vdp_chroma_type = VDP_CHROMA_TYPE_420; + switch (image_format) { + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + vdp_pixel_format = VDP_YCBCR_FORMAT_YV12; + break; + case IMGFMT_NV12: + vdp_pixel_format = VDP_YCBCR_FORMAT_NV12; + break; + case IMGFMT_YUY2: + vdp_pixel_format = VDP_YCBCR_FORMAT_YUYV; + vdp_chroma_type = VDP_CHROMA_TYPE_422; + break; + case IMGFMT_UYVY: + vdp_pixel_format = VDP_YCBCR_FORMAT_UYVY; + vdp_chroma_type = VDP_CHROMA_TYPE_422; + } + if (create_vdp_mixer(vdp_chroma_type)) + return -1; + + surface_num = 0; + vid_surface_num = -1; +// resize(); + + return 0; +} + +static uint32_t __FASTCALL__ check_events(int (* __FASTCALL__ adjust_size)(unsigned cw,unsigned ch,unsigned *w,unsigned *h)) +{ + int e = vo_x11_check_events(mDisplay,adjust_size); + + if (handle_preemption() < 0) + return 0; + + if (e & VO_EVENT_RESIZE) + resize(vo_dwidth,vo_dheight); + + if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause) { + /* did we already draw a buffer */ + if (visible_buf) { + /* redraw the last visible buffer */ + VdpStatus vdp_st; + vdp_st = vdp_presentation_queue_display(vdp_flip_queue, + output_surfaces[surface_num], + vo_dwidth, vo_dheight, + 0); + CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") + } + } + return e; +} + +static void draw_osd_I8A8(int x0,int y0, int w,int h, const unsigned char *src, + const unsigned char *srca, int stride, unsigned char* dstbase,int dststride) +{ + VdpOutputSurface output_surface = output_surfaces[surface_num]; + VdpStatus vdp_st; + int i, j; + int pitch; + int index_data_size_required; + VdpRect output_indexed_rect_vid; + VdpOutputSurfaceRenderBlendState blend_state; + + if (!w || !h) + return; + + index_data_size_required = 2*w*h; + if (index_data_size < index_data_size_required) { + index_data = realloc(index_data, index_data_size_required); + index_data_size = index_data_size_required; + } + + // index_data creation, component order - I, A, I, A, ..... + for (i = 0; i < h; i++) + for (j = 0; j < w; j++) { + index_data[i*2*w + j*2] = src [i*stride + j]; + index_data[i*2*w + j*2 + 1] = -srca[i*stride + j]; + } + + output_indexed_rect_vid.x0 = x0; + output_indexed_rect_vid.y0 = y0; + output_indexed_rect_vid.x1 = x0 + w; + output_indexed_rect_vid.y1 = y0 + h; + + pitch = w*2; + + // write source_data to osd_surface. + vdp_st = vdp_output_surface_put_bits_indexed(osd_surface, + VDP_INDEXED_FORMAT_I8A8, + (const void *const*)&index_data, + &pitch, + &output_indexed_rect_vid, + VDP_COLOR_TABLE_FORMAT_B8G8R8X8, + (void *)palette); + CHECK_ST_WARNING("Error when calling vdp_output_surface_put_bits_indexed") + + blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION; + blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE; + blend_state.blend_factor_source_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE; + blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; + blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; + blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; + blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD; + + vdp_st = vdp_output_surface_render_output_surface(output_surface, + &output_indexed_rect_vid, + osd_surface, + &output_indexed_rect_vid, + NULL, + &blend_state, + VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); + CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface") +} + +static void draw_osd(void) +{ + MSG_DBG2("DRAW_OSD\n"); + + if (handle_preemption() < 0) + return; + + vo_draw_text(vo_dwidth, vo_dheight, draw_osd_I8A8); +} + +static void flip_page(unsigned idx) +{ + VdpStatus vdp_st; + MSG_DBG2("\nFLIP_PAGE VID:%u -> OUT:%u\n", + surface_render[vid_surface_num].surface, output_surfaces[surface_num]); + + if (handle_preemption() < 0) + return; + + vdp_st = vdp_presentation_queue_display(vdp_flip_queue, output_surfaces[surface_num], + vo_dwidth, vo_dheight, + 0); + CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display") + + surface_num = (surface_num + 1) % NUM_OUTPUT_SURFACES; + visible_buf = 1; +} + +static int draw_slice(uint8_t *image[], int stride[], int w, int h, + int x, int y) +{ + VdpStatus vdp_st; + struct vdpau_render_state *rndr = (struct vdpau_render_state *)image[0]; + int max_refs = image_format == IMGFMT_VDPAU_H264 ? rndr->info.h264.num_ref_frames : 2; + + if (handle_preemption() < 0) + return VO_TRUE; + + if (!IMGFMT_IS_VDPAU(image_format)) + return VO_FALSE; + if ((decoder == VDP_INVALID_HANDLE || decoder_max_refs < max_refs) + && !create_vdp_decoder(image_format, vid_width, vid_height, max_refs)) + return VO_FALSE; + + vdp_st = vdp_decoder_render(decoder, rndr->surface, (void *)&rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers); + CHECK_ST_WARNING("Failed VDPAU decoder rendering"); + return VO_TRUE; +} + + +static int draw_frame(uint8_t *src[]) +{ + return VO_ERROR; +} + +static struct vdpau_render_state *get_surface(int number) +{ + if (number > MAX_VIDEO_SURFACES) + return NULL; + if (surface_render[number].surface == VDP_INVALID_HANDLE) { + VdpStatus vdp_st; + vdp_st = vdp_video_surface_create(vdp_device, vdp_chroma_type, + vid_width, vid_height, + &surface_render[number].surface); + CHECK_ST_WARNING("Error when calling vdp_video_surface_create") + if (vdp_st != VDP_STATUS_OK) + return NULL; + } + MSG_DBG2("VID CREATE: %u\n", surface_render[number].surface); + return &surface_render[number]; +} + +static uint32_t draw_image(mp_image_t *mpi) +{ + if (IMGFMT_IS_VDPAU(image_format)) { + struct vdpau_render_state *rndr = mpi->priv; + vid_surface_num = rndr - surface_render; + if (deint_buffer_past_frames) { + deint_mpi[1] = deint_mpi[0]; + deint_mpi[0] = mpi; + } + } else if (image_format == IMGFMT_BGRA) { + VdpStatus vdp_st; + VdpRect r = {0, 0, vid_width, vid_height}; + vdp_st = vdp_output_surface_put_bits_native(output_surfaces[2], + (void const*const*)mpi->planes, + mpi->stride, &r); + CHECK_ST_ERROR("Error when calling vdp_output_surface_put_bits_native") + vdp_st = vdp_output_surface_render_output_surface(output_surfaces[surface_num], + &out_rect_vid, + output_surfaces[2], + &src_rect_vid, NULL, NULL, + VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); + CHECK_ST_ERROR("Error when calling vdp_output_surface_render_output_surface") + } else if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)) { + VdpStatus vdp_st; + void *destdata[3] = {mpi->planes[0], mpi->planes[2], mpi->planes[1]}; + struct vdpau_render_state *rndr = get_surface(deint_counter); + deint_counter = (deint_counter + 1) % 3; + vid_surface_num = rndr - surface_render; + if (image_format == IMGFMT_NV12) + destdata[1] = destdata[2]; + vdp_st = vdp_video_surface_put_bits_y_cb_cr(rndr->surface, + vdp_pixel_format, + (const void *const*)destdata, + mpi->stride); // pitch + CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr") + } + if (mpi->fields & MP_IMGFIELD_ORDERED) + top_field_first = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST); + else + top_field_first = 1; + + video_to_output_surface(); + return VO_TRUE; +} + +static uint32_t get_image(mp_image_t *mpi) +{ + struct vdpau_render_state *rndr; + + // no dr for non-decoding for now + if (!IMGFMT_IS_VDPAU(image_format)) + return VO_FALSE; +// if (mpi->type != MP_IMGTYPE_NUMBERED) +// return VO_FALSE; + + rndr = get_surface(0/*mpi->number*/); + if (!rndr) { + MSG_ERR("[vdpau] no surfaces available in get_image\n"); + // TODO: this probably breaks things forever, provide a dummy buffer? + return VO_FALSE; + } + mpi->flags |= MP_IMGFLAG_DIRECT; + mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = 0; + mpi->planes[0] = mpi->planes[1] = mpi->planes[2] = NULL; + // hack to get around a check and to avoid a special-case in vd_ffmpeg.c + mpi->planes[0] = (void *)rndr; + mpi->num_planes = 1; + mpi->priv = rndr; + return VO_TRUE; +} + +static int query_format(uint32_t format) +{ + int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_FLIP; + switch (format) { + case IMGFMT_BGRA: + if (force_mixer) + return 0; + case IMGFMT_YV12: + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_NV12: + case IMGFMT_YUY2: + case IMGFMT_UYVY: + return default_flags/* | VOCAP_NOSLICES*/; + case IMGFMT_VDPAU_MPEG1: + case IMGFMT_VDPAU_MPEG2: + case IMGFMT_VDPAU_H264: + case IMGFMT_VDPAU_WMV3: + case IMGFMT_VDPAU_VC1: + case IMGFMT_VDPAU_MPEG4: + if (create_vdp_decoder(format, 48, 48, 2)) + return default_flags; + } + return 0; +} + +static void DestroyVdpauObjects(void) +{ + int i; + VdpStatus vdp_st; + + free_video_specific(); + + vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue); + CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy") + + vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target); + CHECK_ST_WARNING("Error when calling vdp_presentation_queue_target_destroy") + + for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) { + vdp_st = vdp_output_surface_destroy(output_surfaces[i]); + output_surfaces[i] = VDP_INVALID_HANDLE; + CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy") + } + + vdp_st = vdp_device_destroy(vdp_device); + CHECK_ST_WARNING("Error when calling vdp_device_destroy") +} + +static void uninit(void) +{ + int i; + +// if (!vo_config_count) +// return; + visible_buf = 0; + + for (i = 0; i < MAX_VIDEO_SURFACES; i++) { + // Allocated in ff_vdpau_add_data_chunk() + free(surface_render[i].bitstream_buffers); + surface_render[i].bitstream_buffers_allocated = 0; + } + + /* Destroy all vdpau objects */ + DestroyVdpauObjects(); + + free(index_data); + index_data = NULL; + +#ifdef CONFIG_XF86VM + vo_vm_close(); +#endif + vo_x11_uninit(mDisplay,vo_window); +} + +static const opt_t subopts[] = { + {"deint", OPT_ARG_INT, &deint, (opt_test_f)int_non_neg}, + {"chroma-deint", OPT_ARG_BOOL, &chroma_deint, NULL}, + {"pullup", OPT_ARG_BOOL, &pullup, NULL}, + {"denoise", OPT_ARG_FLOAT, &denoise, NULL}, + {"sharpen", OPT_ARG_FLOAT, &sharpen, NULL}, + {"colorspace", OPT_ARG_INT, &colorspace, NULL}, + {"force-mixer", OPT_ARG_BOOL, &force_mixer, NULL}, + {"hqscaling", OPT_ARG_INT, &hqscaling, (opt_test_f)int_non_neg}, + {NULL} +}; + +static const char help_msg[] = + "\n-vo vdpau command line help:\n" + "Example: mplayer -vo vdpau:deint=2\n" + "\nOptions:\n" + " deint (all modes > 0 respect -field-dominance)\n" + " 0: no deinterlacing\n" + " 1: only show first field\n" + " 2: bob deinterlacing\n" + " 3: temporal deinterlacing (resource-hungry)\n" + " 4: temporal-spatial deinterlacing (very resource-hungry)\n" + " chroma-deint\n" + " Operate on luma and chroma when using temporal deinterlacing (default)\n" + " Use nochroma-deint to speed up temporal deinterlacing\n" + " pullup\n" + " Try to apply inverse-telecine (needs temporal deinterlacing)\n" + " denoise\n" + " Apply denoising, argument is strength from 0.0 to 1.0\n" + " sharpen\n" + " Apply sharpening or softening, argument is strength from -1.0 to 1.0\n" + " colorspace\n" + " 0: guess based on video resolution\n" + " 1: ITU-R BT.601 (default)\n" + " 2: ITU-R BT.709\n" + " 3: SMPTE-240M\n" + " hqscaling\n" + " 0: default VDPAU scaler\n" + " 1-9: high quality VDPAU scaler (needs capable hardware)\n" + " force-mixer\n" + " Use the VDPAU mixer (default)\n" + " Use noforce-mixer to allow BGRA output (disables all above options)\n" + ; + +static uint32_t __FASTCALL__ preinit(const char *arg) +{ + int i; + + deint = 0; + deint_type = 3; + deint_counter = 0; + deint_buffer_past_frames = 0; + deint_mpi[0] = deint_mpi[1] = NULL; + chroma_deint = 1; + pullup = 0; + denoise = 0; + sharpen = 0; + colorspace = 1; + force_mixer = 1; + hqscaling = 0; + if (subopt_parse(arg, subopts) != 0) { + MSG_FATAL(help_msg); + return -1; + } + if (deint) + deint_type = deint; + if (deint > 1) + deint_buffer_past_frames = 1; + if (colorspace < 0 || colorspace > 3) { + MSG_WARN("[vdpau] Invalid color space specified, " + "using BT.601\n"); + colorspace = 1; + } + + if (!vo_init(arg) || win_x11_init_vdpau_procs()) + return -1; + + decoder = VDP_INVALID_HANDLE; + for (i = 0; i < MAX_VIDEO_SURFACES; i++) + surface_render[i].surface = VDP_INVALID_HANDLE; + video_mixer = VDP_INVALID_HANDLE; + for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) + output_surfaces[i] = VDP_INVALID_HANDLE; + vdp_flip_queue = VDP_INVALID_HANDLE; + output_surface_width = output_surface_height = -1; + + // full grayscale palette. + for (i = 0; i < PALETTE_SIZE; ++i) + palette[i] = (i << 16) | (i << 8) | i; + index_data = NULL; + index_data_size = 0; + + procamp.struct_version = VDP_PROCAMP_VERSION; + procamp.brightness = 0.0; + procamp.contrast = 1.0; + procamp.saturation = 1.0; + procamp.hue = 0.0; + + return 0; +} + +static int get_equalizer(char *name, int *value) +{ + if (!strcasecmp(name, "brightness")) + *value = procamp.brightness * 100; + else if (!strcasecmp(name, "contrast")) + *value = (procamp.contrast-1.0) * 100; + else if (!strcasecmp(name, "saturation")) + *value = (procamp.saturation-1.0) * 100; + else if (!strcasecmp(name, "hue")) + *value = procamp.hue * 100 / M_PI; + else + return VO_NOTIMPL; + return VO_TRUE; +} + +static int set_equalizer(char *name, int value) +{ + if (!strcasecmp(name, "brightness")) + procamp.brightness = value / 100.0; + else if (!strcasecmp(name, "contrast")) + procamp.contrast = value / 100.0 + 1.0; + else if (!strcasecmp(name, "saturation")) + procamp.saturation = value / 100.0 + 1.0; + else if (!strcasecmp(name, "hue")) + procamp.hue = value / 100.0 * M_PI; + else + return VO_NOTIMPL; + + return update_csc_matrix(); +} + +static uint32_t control(uint32_t request, void *data) +{ + if (handle_preemption() < 0) + return VO_FALSE; + + switch (request) { + case VOCTRL_CHECK_EVENTS: + { + vo_resize_t * vrest = (vo_resize_t *)data; + vrest->event_type = check_events(vrest->adjust_size); + if(enable_xp && (vrest->event_type & VO_EVENT_RESIZE)==VO_EVENT_RESIZE) + LOCK_VDECODING(); /* just for compatibility with other vo */ + return VO_TRUE; + } +#if 0 + case VOCTRL_GET_DEINTERLACE: + *(int*)data = deint; + return VO_TRUE; + case VOCTRL_SET_DEINTERLACE: + if (image_format == IMGFMT_BGRA) + return VO_NOTIMPL; + deint = *(int*)data; + if (deint) + deint = deint_type; + if (deint_type > 2) { + VdpStatus vdp_st; + VdpVideoMixerFeature features[1] = + {deint_type == 3 ? + VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL : + VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL}; + VdpBool feature_enables[1] = {deint ? VDP_TRUE : VDP_FALSE}; + vdp_st = vdp_video_mixer_set_feature_enables(video_mixer, 1, + features, + feature_enables); + CHECK_ST_WARNING("Error changing deinterlacing settings") + deint_buffer_past_frames = 1; + } + return VO_TRUE; +#endif + case VOCTRL_PAUSE: + return int_pause = 1; + case VOCTRL_RESUME: + return int_pause = 0; + case VOCTRL_QUERY_FORMAT: + return query_format(*(uint32_t *)data); +#if 0 + case VOCTRL_GET_IMAGE: + return get_image(data); + case VOCTRL_DRAW_IMAGE: + return draw_image(data); + case VOCTRL_GUISUPPORT: + return VO_TRUE; + case VOCTRL_BORDER: + vo_x11_border(); + resize(); + return VO_TRUE; +#endif + case VOCTRL_FULLSCREEN: + vo_x11_fullscreen(); + resize(vo_dwidth, vo_dheight); + return VO_TRUE; +#if 0 + case VOCTRL_GET_PANSCAN: + return VO_TRUE; + case VOCTRL_SET_PANSCAN: + resize(); + return VO_TRUE; +#endif + case VOCTRL_SET_EQUALIZER: { + int value=*(int *)data; + if (image_format == IMGFMT_BGRA) + return VO_NOTIMPL; + return set_equalizer(data, value); + } + case VOCTRL_GET_EQUALIZER: { + int *value = (int *)data; + return get_equalizer(data, value); + } +#if 0 + case VOCTRL_ONTOP: + vo_x11_ontop(); + return VO_TRUE; + case VOCTRL_UPDATE_SCREENINFO: + update_xinerama_info(); + return VO_TRUE; + case VOCTRL_DRAW_EOSD: + if (!data) + return VO_FALSE; + generate_eosd(data); + draw_eosd(); + return VO_TRUE; + case VOCTRL_GET_EOSD_RES: { + mp_eosd_res_t *r = data; + r->mt = r->mb = r->ml = r->mr = 0; + if (vo_fs) { + r->w = vo_screenwidth; + r->h = vo_screenheight; + r->ml = r->mr = border_x; + r->mt = r->mb = border_y; + } else { + r->w = vo_dwidth; + r->h = vo_dheight; + } + return VO_TRUE; + } +#endif + } + return VO_NOTIMPL; +} + +/* @} */ Property changes on: mplayerxp/libvo/vo_vdpau.c ___________________________________________________________________ Added: svn:eol-style + native Added: mplayerxp/subopt-helper.c =================================================================== --- mplayerxp/subopt-helper.c (rev 0) +++ mplayerxp/subopt-helper.c 2009-12-16 15:56:00 UTC (rev 43) @@ -0,0 +1,335 @@ +/** + * \file subopt-helper.c + * + * \brief Compensates the suboption parsing code duplication a bit. + * + * The routines defined below are there to help you with the + * suboption parsing. Meaning extracting the options and their + * values for you and also outputting generic help message if + * a parse error is encountered. + * + * Most stuff happens in the subopt_parse function: if you call it + * it parses for the passed opts in the passed string. It calls some + * extra functions for explicit argument parsing ( where the option + * itself isn't the argument but a value given after the argument + * delimiter ('='). It also calls your test function if you supplied + * one. + * + */ +#include <stdlib.h> +#include <string.h> +#include <limits.h> +#include <assert.h> + +#include "subopt-helper.h" +#define MSGT_CLASS MSGT_GLOBAL +#include "__mp_msg.h" + + +#ifndef MPDEBUG + #defin... [truncated message content] |
From: <nic...@us...> - 2009-12-19 19:15:33
|
Revision: 51 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=51&view=rev Author: nickols_k Date: 2009-12-19 19:15:24 +0000 (Sat, 19 Dec 2009) Log Message: ----------- use libcdio instead of Xiph's paranoia and fix cdda related lacks Modified Paths: -------------- codecs/configure functions loader/configure mplayerxp/configure mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/cdd.h mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/cddb.c mplayerxp/libmpdemux/s_cdd.c mplayerxp/libmpdemux/stream.c Modified: codecs/configure =================================================================== --- codecs/configure 2009-12-19 11:08:56 UTC (rev 50) +++ codecs/configure 2009-12-19 19:15:24 UTC (rev 51) @@ -292,11 +292,6 @@ test -n "$profile" && disable fastcall print_config __USE config.h config.mak fastcall -# Checking for LDFLAGS -if test "$profile" || test "$debug" ; then - LDFLAGS="$debug $profile" -fi - test_optimizations config.mak config.h test -n "$ld_extra" && add_extralibs $ld_extra Modified: functions =================================================================== --- functions 2009-12-19 11:08:56 UTC (rev 50) +++ functions 2009-12-19 19:15:24 UTC (rev 51) @@ -1109,9 +1109,23 @@ add_asflags --32 fi +if test -z $CFLAGS ; then add_cflags $locarch +fi if enabled profile || test "$debug" || enabled gcov; then - add_cflags "-O2 -fno-builtin $debug $profile" + add_cflags "-O2 -fno-builtin" +if enabled profile ; then + add_cflags "-pg" + add_ldflags "-pg" +fi +if test -n $debug ; then + add_cflags $debug + add_ldflags $debug +fi +if enabled gcov ; then +add_cflags "-fprofile-arcs -ftest-coverage" +add_extralibs "-lgcov" +fi else add_cflags "-O3" # -ffast-math produces incorrect output in 64-bit mode on x86_64 cpus. Tested with many gcc-4.x series Modified: loader/configure =================================================================== --- loader/configure 2009-12-19 11:08:56 UTC (rev 50) +++ loader/configure 2009-12-19 19:15:24 UTC (rev 51) @@ -169,14 +169,6 @@ esac done -enabled profile && add_ldflags "-pg" -test -n $debug && add_ldflags $debug - -if enabled gcov ; then -add_cflags "-fprofile-arcs -ftest-coverage" -add_extralibs "-lgcov" -fi - guess_target config.mak config.h test_optimizations config.mak config.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/configure 2009-12-19 19:15:24 UTC (rev 51) @@ -76,7 +76,7 @@ --disable-vidix disable VIDIX stuff [autodetect] --enable-joystick enable joystick support [autodetect] --disable-sdl-image build with SDL_image support [autodetect] - --disable-cdparanoia Disable cdparanoia support [autodetect] + --disable-libcdio Disable libcdio support [autodetect] --disable-libcss Disable libcss support [autodetect] --disable-libdvdread Disable libdvdread support [autodetect] --disable-libdvdnav Disable libdvdnav support [autodetect] @@ -171,7 +171,7 @@ openal nas jack - cdparanoia + libcdio fbdev jpg lirc @@ -414,14 +414,6 @@ test -n "$profile" && disable fastcall print_config __USE mp_config.h mp_config.mak fastcall -enabled profile && add_ldflags "-pg" -test -n $debug && add_ldflags $debug - -if enabled gcov ; then -add_cflags "-fprofile-arcs -ftest-coverage" -add_extralibs "-lgcov" -fi - test_optimizations mp_config.mak mp_config.h # Checking for GOMP @@ -707,10 +699,9 @@ enabled sdl && aomodules="sdl $aomodules" || noaomodules="sdl $noaomodules" enabled sdl && vomodules="sdl $vomodules" || novomodules="sdl $novomodules" -enabled cdparanoia && require2 cdparanoia "cdda_interface.h cdda_paranoia.h" cdda_open -lcdda_interface -lcdda_paranoia -cdda=$cdparanoia -print_config HAVE_ mp_config.h mp_config.mak cdda -enabled cdparanoia && inputmodules="cdda $inputmodules" || noinputmodules="cdda $noinputmodules" +enabled libcdio && require2 libcdio "cdio/paranoia.h" cdio_paranoia_read -lcdio_paranoia +print_config HAVE_ mp_config.h mp_config.mak libcdio +enabled libcdio && inputmodules="cdda $inputmodules" || noinputmodules="cdda $noinputmodules" ######### # AUDIO # Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/Makefile 2009-12-19 19:15:24 UTC (rev 51) @@ -7,9 +7,12 @@ DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done SRCS = s_file.c s_ffmpeg.c -ifeq ($(HAVE_CDDA),yes) -SRCS += s_cdd.c +ifeq ($(HAVE_LIBCDIO),yes) +SRCS += s_cdd.c cdda.c +ifeq ($(HAVE_STREAMING),yes) +SRCS += cddb.c endif +endif ifeq ($(USE_DVDNAV),yes) SRCS += s_dvdnav.c endif @@ -27,7 +30,7 @@ SRCS += s_vcd.c endif SRCS += cache2.c dvdauth.c stream.c tvi_dummy.c tvi_v4l.c -SRCS += tvi_bsdbt848.c frequencies.c cdda.c cddb.c mrl.c +SRCS += tvi_bsdbt848.c frequencies.c mrl.c SRCS += demuxer_r.c mp3_hdr.c video.c mpeg_hdr.c aviprint.c demux_asf.c SRCS += demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_viv.c demuxer.c Modified: mplayerxp/libmpdemux/cdd.h =================================================================== --- mplayerxp/libmpdemux/cdd.h 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/cdd.h 2009-12-19 19:15:24 UTC (rev 51) @@ -1,8 +1,8 @@ #ifndef __CDD_H__ #define __CDD_H__ -#include <cdda_interface.h> -#include <cdda_paranoia.h> +#include <cdio/cdda.h> +#include <cdio/paranoia.h> typedef struct { char cddb_hello[1024]; @@ -47,13 +47,22 @@ cd_track_t *current; } cd_info_t; +typedef struct my_track_s { + int play; + unsigned long start_sector; + unsigned long end_sector; +}my_track_t; + typedef struct { - cdrom_drive* cd; - cdrom_paranoia* cdp; - int sector; - int start_sector; - int end_sector; - cd_info_t *cd_info; + cdrom_drive_t* cd; + cdrom_paranoia_t* cdp; + my_track_t tracks[256]; /* hope that's enough */ + unsigned min; + unsigned sec; + unsigned msec; + unsigned long sector; + unsigned long start_sector; + unsigned long end_sector; } cdda_priv; cd_info_t* __FASTCALL__ cd_info_new(); @@ -63,8 +72,8 @@ int __FASTCALL__ open_cdda(stream_t*,const char* dev,const char* track); int __FASTCALL__ open_cddb(stream_t*,const char* dev,const char* track); -int __FASTCALL__ read_cdda(stream_t* s,char *buf,int* trackidx); -void __FASTCALL__ seek_cdda(stream_t* s,off_t pos); +int __FASTCALL__ read_cdda(stream_t* s,char *buf,track_t* trackidx); +void __FASTCALL__ seek_cdda(stream_t* s,off_t pos,track_t *trackidx); off_t __FASTCALL__ tell_cdda(stream_t* s); void __FASTCALL__ close_cdda(stream_t* s); void cdda_register_options(m_config_t* cfg); Modified: mplayerxp/libmpdemux/cdda.c =================================================================== --- mplayerxp/libmpdemux/cdda.c 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/cdda.c 2009-12-19 19:15:24 UTC (rev 51) @@ -1,6 +1,6 @@ #include "../mp_config.h" -#ifdef HAVE_CDDA +#ifdef HAVE_LIBCDIO #include "stream.h" #include "../cfgparser.h" @@ -12,21 +12,13 @@ #include "demux_msg.h" static int speed = -1; static int paranoia_mode = 1; -static char* generic_dev = NULL; -static int sector_size = 0; static int search_overlap = -1; -static int toc_bias = 0; -static int toc_offset = 0; static int no_skip = 0; static const config_t cdda_opts[] = { { "speed", &speed, CONF_TYPE_INT, CONF_RANGE,1,100, NULL }, { "paranoia", ¶noia_mode, CONF_TYPE_INT,CONF_RANGE, 0, 2, NULL }, - { "generic-dev", &generic_dev, CONF_TYPE_STRING, 0, 0, 0, NULL }, - { "sector-size", §or_size, CONF_TYPE_INT, CONF_RANGE,1,100, NULL }, { "overlap", &search_overlap, CONF_TYPE_INT, CONF_RANGE,0,75, NULL }, - { "toc-bias", &toc_bias, CONF_TYPE_INT, 0, 0, 0, NULL }, - { "toc-offset", &toc_offset, CONF_TYPE_INT, 0, 0, 0, NULL }, { "noskip", &no_skip, CONF_TYPE_FLAG, 0 , 0, 1, NULL }, { "skip", &no_skip, CONF_TYPE_FLAG, 0 , 1, 0, NULL }, {NULL, NULL, 0, 0, 0, 0, NULL} @@ -41,127 +33,123 @@ m_config_register_options(cfg,cdda_conf); } -int __FASTCALL__ open_cdda(stream_t *st,const char* dev,const char* track) { - int start_track = 0; - int end_track = 0; +static unsigned cdda_parse_tracks(unsigned char *arr,unsigned nelem,const char *arg) +{ + const char *st,*end; + unsigned rval=0; + unsigned slen=strlen(arg); + st=arg; + memset(arr,0,sizeof(unsigned char)*nelem); + do { + size_t datalen,value,evalue,i; + char data[100],*range; + end=strchr(st,','); + if(!end) end = &st[strlen(st)]; + datalen=end-st; + memcpy(data,st,datalen); + data[datalen]='\0'; + range=strchr(data,'-'); + if(range) { + *range='\0'; + value=atoi(data); + evalue=atoi(&range[1]); + if(evalue>value && evalue<nelem) { + for(i=value;i<=evalue;i++) arr[i]=1; + rval=evalue; + } + else break; + } + else { + value=atoi(data); + if(value>nelem) break; + arr[value]=1; + rval=value; + } + st=end+1; + if(st>arg+slen) break; + }while(end); + return rval; +} + +int __FASTCALL__ open_cdda(stream_t *st,const char* dev,const char* arg) { + lsn_t lsn; int mode = paranoia_mode; - int offset = toc_offset; unsigned cd_tracks; - cdrom_drive* cdd = NULL; cdda_priv* priv; - char* end = strchr(track,'-'); - cd_info_t *cd_info; unsigned int audiolen=0; - int i; + unsigned i; + unsigned char arr[256]; - if(!end) - start_track = end_track = atoi(track); - else { - int st_len = end - track; - int ed_len = strlen(track) - 1 - st_len; + priv = (cdda_priv*)malloc(sizeof(cdda_priv)); + memset(priv, 0, sizeof(cdda_priv)); - if(st_len) { - char st[st_len + 1]; - strncpy(st,track,st_len); - st[st_len] = '\0'; - start_track = atoi(st); - } - if(ed_len) { - char ed[ed_len + 1]; - strncpy(ed,end+1,ed_len); - ed[ed_len] = '\0'; - end_track = atoi(ed); - } - } + priv->cd = cdio_cddap_identify(dev,verbose?1:0,NULL); - if(generic_dev) - cdd = cdda_identify_scsi(generic_dev,dev,verbose?1:0,NULL); - else - cdd = cdda_identify(dev,verbose?1:0,NULL); - - if(!cdd) { + if(!priv->cd) { MSG_ERR("Can't open cdda device: %s\n",dev); + free(priv); return 0; } - cdda_verbose_set(cdd, verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT, verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT); + cdio_cddap_verbose_set(priv->cd, verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT, verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT); - if(sector_size) { - cdd->nsectors = sector_size; - cdd->bigbuff = sector_size * CD_FRAMESIZE_RAW; - } - - if(cdda_open(cdd) != 0) { + if(cdio_cddap_open(priv->cd) != 0) { MSG_ERR("Can't open disc\n"); - cdda_close(cdd); + cdda_close(priv->cd); + free(priv); return 0; } - cd_info = cd_info_new(); - cd_tracks=cdda_tracks(cdd); - for(i=0;i<cdd->tracks;i++) { - char track_name[80]; - long sec=cdda_track_firstsector(cdd,i+1); - long off=cdda_track_lastsector(cdd,i+1)-sec+1; + cd_tracks=cdio_cddap_tracks(priv->cd); + MSG_V("Found %d tracks on disc\n",cd_tracks); + if(!arg[0]) + for(i=1;i<=cd_tracks;i++) priv->tracks[i-1].play=1; + cdda_parse_tracks(arr,sizeof(arr)/sizeof(unsigned),arg); + for(i=1;i<=256;i++) if (arr[i]) priv->tracks[i-1].play=1; - sprintf(track_name, "Track %d/%d", i+1,cd_tracks); - cd_info_add_track(cd_info, track_name, i+1, (unsigned int)(off/(60*75)), (unsigned int)((off/75)%60), (unsigned int)(off%75), sec, off ); - audiolen += off; + MSG_V("[CDDA] Queued tracks:"); + for(i=0;i<cd_tracks;i++) { + int st_inited=0; + if(priv->tracks[i].play) { + priv->tracks[i].start_sector=cdio_cddap_track_firstsector(priv->cd,i+1); + priv->tracks[i].end_sector=cdio_cddap_track_lastsector(priv->cd,i+1); + MSG_V(" %d[%ld-%ld]",i+1,priv->tracks[i].start_sector,priv->tracks[i].end_sector); + if(!st_inited) { priv->start_sector=priv->tracks[i].start_sector; st_inited=1; } + priv->end_sector=priv->tracks[i].end_sector; + audiolen += priv->tracks[i].end_sector-priv->tracks[i].start_sector+1; + } } - cd_info->min = (unsigned int)(audiolen/(60*75)); - cd_info->sec = (unsigned int)((audiolen/75)%60); - cd_info->msec = (unsigned int)(audiolen%75); + for(;i<256;i++) priv->tracks[i].play=0; + MSG_V("\n"); + priv->min = (unsigned int)(audiolen/(60*75)); + priv->sec = (unsigned int)((audiolen/75)%60); + priv->msec = (unsigned int)(audiolen%75); - priv = (cdda_priv*)malloc(sizeof(cdda_priv)); - memset(priv, 0, sizeof(cdda_priv)); - priv->cd = cdd; - priv->cd_info = cd_info; - - if(toc_bias) - offset -= cdda_track_firstsector(cdd,1); - - if(offset) { - int i; - for(i = 0 ; i < cdd->tracks + 1 ; i++) - cdd->disc_toc[i].dwStartSector += offset; - } - if(speed) - cdda_speed_set(cdd,speed); + cdio_cddap_speed_set(priv->cd,speed); - if(start_track) - priv->start_sector = cdda_track_firstsector(cdd,start_track); - else - priv->start_sector = cdda_disc_firstsector(cdd); - - if(end_track) { - int last = cdda_tracks(cdd); - if(end_track > last) end_track = last; - priv->end_sector = cdda_track_lastsector(cdd,end_track); - } else - priv->end_sector = cdda_disc_lastsector(cdd); - - priv->cdp = paranoia_init(cdd); + priv->cdp = cdio_paranoia_init(priv->cd); if(priv->cdp == NULL) { - cdda_close(cdd); + cdio_cddap_close(priv->cd); free(priv); return 0; } + mode = PARANOIA_MODE_FULL; if(mode == 0) mode = PARANOIA_MODE_DISABLE; else if(mode == 1) mode = PARANOIA_MODE_OVERLAP; - else - mode = PARANOIA_MODE_FULL; if(no_skip) mode |= PARANOIA_MODE_NEVERSKIP; + cdio_paranoia_modeset(priv->cdp,mode); if(search_overlap >= 0) - paranoia_overlapset(cdd,search_overlap); + cdio_paranoia_overlapset(priv->cdp,search_overlap); - paranoia_seek(priv->cdp,priv->start_sector,SEEK_SET); + lsn=cdio_paranoia_seek(priv->cdp,priv->start_sector,SEEK_SET); + MSG_DBG2("[CDDA] %ld=cdio_paranoia_seek(%p,%ld,SEEK_SET)\n",lsn,priv->cdp,priv->start_sector); priv->sector = priv->start_sector; st->type = STREAMTYPE_SEEKABLE|STREAMTYPE_RAWAUDIO; @@ -172,74 +160,84 @@ return 1; } -static void cdparanoia_callback(long inpos, int function) { +static void cdparanoia_callback(long int inpos, paranoia_cb_mode_t function) { + UNUSED(inpos); + UNUSED(function); } -int __FASTCALL__ read_cdda(stream_t* s,char *buf,int *tr) { +static unsigned long map_sector(cdda_priv*p,unsigned long sector,track_t *tr) +{ + unsigned i,j; + unsigned long cd_track=sector; + for(i=0;i<256;i++){ + if(p->tracks[i].play && p->tracks[i].end_sector==sector-1) { + cd_track=0; + for(j=i+1;j<256;j++) { + if(p->tracks[j].play) cd_track=p->tracks[j].start_sector; + if(tr) *tr=j; + } + } + } + return cd_track; +} + +/* return physical sector address */ +static unsigned long psa(cdda_priv*p,unsigned long sector) +{ + unsigned i,j; + unsigned long got_sectors=0,track_len; + for(i=0;i<256;i++){ + if(p->tracks[i].play) { + track_len=p->tracks[i].end_sector-p->tracks[i].start_sector; + if(sector>=got_sectors && sector <= track_len) return sector+p->tracks[i].start_sector; + got_sectors+=track_len; + } + } + return 0; +} + +int __FASTCALL__ read_cdda(stream_t* s,char *buf,track_t *tr) { cdda_priv* p = (cdda_priv*)s->priv; - cd_track_t *cd_track; + unsigned long cd_track; int16_t * _buf; - unsigned int i; + track_t i=255; - *tr=-1; - _buf = paranoia_read(p->cdp,cdparanoia_callback); + *tr=255; + _buf = cdio_paranoia_read(p->cdp,cdparanoia_callback); p->sector++; memcpy(buf,_buf,CD_FRAMESIZE_RAW); if(p->sector == p->end_sector) return -1; - for(i=0;i<p->cd->tracks;i++){ - if(p->cd->disc_toc[i].dwStartSector==p->sector-1) { - cd_track = cd_info_get_track(p->cd_info, i+1); -//printf("Track %d, sector=%d\n", i, p->sector-1); - *tr=i+1; - if( cd_track!=NULL ) { - MSG_V("%s\n", cd_track->name ); - } - break; - } - } - - + cd_track=map_sector(p,p->sector,&i); + if(!cd_track) return -1; + *tr=i+1; + MSG_V("Track %d, sector=%d\n", *tr, cd_track); + if(cd_track!=p->sector) { cdio_paranoia_seek(p->cdp,cd_track,SEEK_SET); p->sector=cd_track; } return CD_FRAMESIZE_RAW; } -void __FASTCALL__ seek_cdda(stream_t* s,off_t pos) { - cdda_priv* p = (cdda_priv*)s->priv; - cd_track_t *cd_track; - int sec; - int current_track=0, seeked_track=0; - int i; +void __FASTCALL__ seek_cdda(stream_t* s,off_t pos,track_t *tr) { + cdda_priv* p = (cdda_priv*)s->priv; + long sec; + long current_track=0, seeked_track=0; + unsigned i; + lsn_t lsn; + track_t j=255; - sec = pos/CD_FRAMESIZE_RAW; - - for(i=0;i<p->cd->tracks;i++){ - if( p->sector>p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) { - current_track = i; - } - if( sec>p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) { - seeked_track = i; - } - } -//printf("current: %d, seeked: %d\n", current_track, seeked_track); - if( current_track!=seeked_track ) { -//printf("Track %d, sector=%d\n", seeked_track, sec); - cd_track = cd_info_get_track(p->cd_info, seeked_track+1); - if( cd_track!=NULL ) { - MSG_V("%s\n", cd_track->name ); - } + sec = pos/CD_FRAMESIZE_RAW; + MSG_DBG2("[CDDA] prepare seek to %ld\n",sec); + seeked_track=sec; + *tr=255; + if( p->sector!=seeked_track ) { + seeked_track = map_sector(p,seeked_track,&j); + if(seeked_track) *tr=j+1; + } - } - - if(sec < p->start_sector) - sec = p->start_sector; - else if(sec > p->end_sector) - sec = p->end_sector; - - p->sector = sec; - - paranoia_seek(p->cdp,sec,SEEK_SET); + lsn=cdio_paranoia_seek(p->cdp,seeked_track,SEEK_SET); + MSG_DBG2("[CDDA] %ld=cdio_paranoia_seek(%p,%ld,SEEK_SET)\n",lsn,p->cdp,seeked_track); + p->sector=seeked_track; } off_t __FASTCALL__ tell_cdda(stream_t* s) { @@ -249,8 +247,9 @@ void __FASTCALL__ close_cdda(stream_t* s) { cdda_priv* p = (cdda_priv*)s->priv; - paranoia_free(p->cdp); - cdda_close(p->cd); + cdio_paranoia_free(p->cdp); + cdio_cddap_close(p->cd); + free(p); } #endif Modified: mplayerxp/libmpdemux/cddb.c =================================================================== --- mplayerxp/libmpdemux/cddb.c 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/cddb.c 2009-12-19 19:15:24 UTC (rev 51) @@ -14,7 +14,7 @@ #include "../mp_config.h" -#if defined(HAVE_CDDA) && defined(HAVE_STREAMING) +#if defined(HAVE_LIBCDIO) && defined(HAVE_STREAMING) #include <stdio.h> #include <stdlib.h> @@ -127,7 +127,7 @@ unsigned int i, t = 0, n = 0; i = 0; - while (i < tot_trks) { + while (i < (unsigned)tot_trks) { n = n + cddb_sum((cdtoc[i].min * 60) + cdtoc[i].sec); i++; } @@ -251,7 +251,7 @@ close(file_fd); return -1; } - if( wrote!=cddb_data->xmcd_file_size ) { + if( (unsigned)wrote!=cddb_data->xmcd_file_size ) { MSG_FATAL("Not all the xmcd file has been written\n"); close(file_fd); return -1; @@ -301,7 +301,7 @@ } // Ok found the end // do a sanity check - if( http_hdr->body_size<(ptr2-ptr) ) { + if( http_hdr->body_size<(unsigned long)(ptr2-ptr) ) { MSG_ERR("Unexpected fix me\n"); return -1; } @@ -446,7 +446,7 @@ static int cddb_freedb_sites_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) { int ret, status; - + UNUSED(cddb_data); ret = sscanf( http_hdr->body, "%d ", &status); if( ret!=1 ) { MSG_ERR("Parse error\n"); @@ -494,11 +494,12 @@ int __FASTCALL__ cddb_retrieve(cddb_data_t *cddb_data) { char offsets[1024], command[1024]; char *ptr; + unsigned idx; int i, time_len; ptr = offsets; - for( i=0; i<cddb_data->tracks ; i++ ) { - ptr += sprintf(ptr, "%d+", cdtoc[i].frame ); + for( idx=0; idx<cddb_data->tracks ; idx++ ) { + ptr += sprintf(ptr, "%d+", cdtoc[idx].frame ); } time_len = (cdtoc[cddb_data->tracks].frame)/75; @@ -584,7 +585,6 @@ void __FASTCALL__ cd_info_free(cd_info_t *cd_info) { cd_track_t *cd_track, *cd_track_next; - int i; if( cd_info==NULL ) return; if( cd_info->artist!=NULL ) free(cd_info->artist); if( cd_info->album!=NULL ) free(cd_info->album); @@ -600,7 +600,7 @@ } cd_track_t* __FASTCALL__ cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, unsigned int min, unsigned int sec, unsigned int msec, unsigned long frame_begin, unsigned long frame_length) { - cd_track_t *cd_track, current_track; + cd_track_t *cd_track; if( cd_info==NULL || track_name==NULL ) return NULL; @@ -769,14 +769,14 @@ // Search for the genre else if( xmcd_parse_dgenre(cd_info, ptr) ); // Search for a track title - else if( xmcd_parse_ttitle(cd_info, ptr) ); + else if( xmcd_parse_ttitle(cd_info, ptr) ){} } if( ptr2[1]=='\n' ) ptr2++; pos = (ptr2+1)-ptr; ptr = ptr2+1; } - audiolen = cdtoc[cd_info->nb_tracks].frame-cdtoc[0].frame; + audiolen = cdtoc[cd_info->nb_tracks].frame-cdtoc[0].frame; cd_info->min = (unsigned int)(audiolen/(60*75)); cd_info->sec = (unsigned int)((audiolen/75)%60); cd_info->msec = (unsigned int)(audiolen%75); @@ -786,7 +786,6 @@ int __FASTCALL__ open_cddb(stream_t *stream,const char *dev, const char *track) { cd_info_t *cd_info = NULL; - cdda_priv *priv; char *xmcd_file = NULL; int ret; @@ -794,19 +793,10 @@ if( ret==0 ) { cd_info = cddb_parse_xmcd(xmcd_file); free(xmcd_file); - cd_info_debug( cd_info ); + cd_info_debug( cd_info ); } ret = open_cdda(stream, dev, track); - priv = ((cdda_priv*)(stream->priv)); - if(priv) - { - cd_info_debug(priv->cd_info); - if( cd_info!=NULL ) { - cd_info_free(priv->cd_info); - priv->cd_info = cd_info; - } - } return ret; } #endif Modified: mplayerxp/libmpdemux/s_cdd.c =================================================================== --- mplayerxp/libmpdemux/s_cdd.c 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/s_cdd.c 2009-12-19 19:15:24 UTC (rev 51) @@ -2,15 +2,16 @@ s_cdd - cdda & cddb streams interface */ #include "../mp_config.h" +#include <stdio.h> #include <stdlib.h> #include <string.h> #include "stream.h" -#ifdef HAVE_CDDA +#ifdef HAVE_LIBCDIO #include "cdd.h" #include "mrl.h" -static int track_idx=-1; +static track_t track_idx=255; static int __FASTCALL__ _cdda_open(stream_t *stream,const char *filename,unsigned flags) { const char *param; @@ -58,7 +59,7 @@ static off_t __FASTCALL__ cdd_seek(stream_t*stream,off_t pos) { - seek_cdda(stream,pos); + seek_cdda(stream,pos,&track_idx); return pos; } @@ -74,23 +75,20 @@ static int __FASTCALL__ cdd_ctrl(stream_t *s,unsigned cmd,void *args) { - cdda_priv *priv=s->priv; - cd_track_t*tr=NULL; + cdda_priv *p=s->priv; switch(cmd) { case SCTRL_TXT_GET_STREAM_NAME: { - if(track_idx!=-1) tr=cd_info_get_track(priv->cd_info,track_idx); - if(tr) - { - strncpy(args,tr->name,256); - ((char *)args)[255]=0; - } + if(track_idx!=255) + sprintf((char *)args,"Track %d",track_idx); return SCTRL_OK; } break; case SCTRL_AUD_GET_CHANNELS: - *(int *)args=2; + *(int *)args=cdio_cddap_track_channels(p->cd, track_idx); + if(*(int *)args<=0) *(int *)args=2; + MSG_V("cdda channels: %u\n",*(int *)args); return SCTRL_OK; case SCTRL_AUD_GET_SAMPLERATE: *(int *)args = 44100; Modified: mplayerxp/libmpdemux/stream.c =================================================================== --- mplayerxp/libmpdemux/stream.c 2009-12-19 11:08:56 UTC (rev 50) +++ mplayerxp/libmpdemux/stream.c 2009-12-19 19:15:24 UTC (rev 51) @@ -22,7 +22,7 @@ #define min(a,b) ((a)<(b)?(a):(b)) #endif -#ifdef HAVE_CDDA +#ifdef HAVE_LIBCDIO extern const stream_driver_t cdda_stream; extern const stream_driver_t cddb_stream; #endif @@ -54,10 +54,12 @@ static const stream_driver_t *sdrivers[] = { -#ifdef HAVE_CDDA +#ifdef HAVE_LIBCDIO &cdda_stream, +#ifdef HAVE_STREAMING &cddb_stream, #endif +#endif #ifdef USE_DVDNAV &dvdnav_stream, #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2009-12-21 18:42:26
|
Revision: 52 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=52&view=rev Author: nickols_k Date: 2009-12-21 18:42:18 +0000 (Mon, 21 Dec 2009) Log Message: ----------- simplify cdio access and disable os depended stuff Modified Paths: -------------- mplayerxp/configure mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/cdd.h mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/s_cdd.c mplayerxp/libmpdemux/s_vcd.c mplayerxp/libmpdemux/stream.c Removed Paths: ------------- mplayerxp/libmpdemux/vcd_read.h mplayerxp/libmpdemux/vcd_read_fbsd.h mplayerxp/libmpdemux/vcd_read_nbsd.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2009-12-19 19:15:24 UTC (rev 51) +++ mplayerxp/configure 2009-12-21 18:42:18 UTC (rev 52) @@ -80,7 +80,6 @@ --disable-libcss Disable libcss support [autodetect] --disable-libdvdread Disable libdvdread support [autodetect] --disable-libdvdnav Disable libdvdnav support [autodetect] - --disable-vcd Disable VCD support [autodetect] Video: --enable-dga build with DGA1 or DGA2 support [autodetect] --enable-vesa build with VESA support [autodetect] @@ -185,7 +184,6 @@ sdl sdl_image libvcd - vcd tv_v4l x11 xdpms @@ -699,10 +697,15 @@ enabled sdl && aomodules="sdl $aomodules" || noaomodules="sdl $noaomodules" enabled sdl && vomodules="sdl $vomodules" || novomodules="sdl $novomodules" -enabled libcdio && require2 libcdio "cdio/paranoia.h" cdio_paranoia_read -lcdio_paranoia +enabled libcdio && require2 libcdio "cdio/cdio.h" cdio_read_mode2_sectors -lcdio print_config HAVE_ mp_config.h mp_config.mak libcdio -enabled libcdio && inputmodules="cdda $inputmodules" || noinputmodules="cdda $noinputmodules" +enabled libcdio && inputmodules="vcd $inputmodules" || noinputmodules="vcd $noinputmodules" + +enabled libcdio && require2 libcdio_cdda "cdio/cdda.h" cdio_cddap_read -lcdio_cdda +print_config HAVE_ mp_config.h mp_config.mak libcdio_cdda +enabled libcdio_cdda && inputmodules="cdda $inputmodules" || noinputmodules="cdda $noinputmodules" + ######### # AUDIO # ######### @@ -771,10 +774,6 @@ enabled fastmemcpy && x86 || disable fastmemcpy print_config USE_ mp_config.h mp_config.mak fastmemcpy -test linux -o bsdos -o freebsd -o sunos && enable vcd || disable vcd -print_config HAVE_ mp_config.h mp_config.mak vcd -enabled vcd && inputmodules="vcd $inputmodules" || noinputmodules="vcd $noinputmodules" - enabled tv && print_config USE_ mp_config.h mp_config.mak tv enabled tv && inputmodules="tv $inputmodules" || noinputmodules="tv $noinputmodules" Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2009-12-19 19:15:24 UTC (rev 51) +++ mplayerxp/libmpdemux/Makefile 2009-12-21 18:42:18 UTC (rev 52) @@ -7,7 +7,7 @@ DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done SRCS = s_file.c s_ffmpeg.c -ifeq ($(HAVE_LIBCDIO),yes) +ifeq ($(HAVE_LIBCDIO_CDDA),yes) SRCS += s_cdd.c cdda.c ifeq ($(HAVE_STREAMING),yes) SRCS += cddb.c @@ -26,7 +26,7 @@ ifeq ($(USE_LIBVCD),yes) SRCS += s_vcdnav.c endif -ifeq ($(HAVE_VCD),yes) +ifeq ($(HAVE_LIBCDIO),yes) SRCS += s_vcd.c endif SRCS += cache2.c dvdauth.c stream.c tvi_dummy.c tvi_v4l.c Modified: mplayerxp/libmpdemux/cdd.h =================================================================== --- mplayerxp/libmpdemux/cdd.h 2009-12-19 19:15:24 UTC (rev 51) +++ mplayerxp/libmpdemux/cdd.h 2009-12-21 18:42:18 UTC (rev 52) @@ -2,7 +2,6 @@ #define __CDD_H__ #include <cdio/cdda.h> -#include <cdio/paranoia.h> typedef struct { char cddb_hello[1024]; @@ -49,20 +48,19 @@ typedef struct my_track_s { int play; - unsigned long start_sector; - unsigned long end_sector; + lsn_t start_sector; + lsn_t end_sector; }my_track_t; typedef struct { cdrom_drive_t* cd; - cdrom_paranoia_t* cdp; my_track_t tracks[256]; /* hope that's enough */ unsigned min; unsigned sec; unsigned msec; - unsigned long sector; - unsigned long start_sector; - unsigned long end_sector; + lsn_t sector; + lsn_t start_sector; + lsn_t end_sector; } cdda_priv; cd_info_t* __FASTCALL__ cd_info_new(); Modified: mplayerxp/libmpdemux/cdda.c =================================================================== --- mplayerxp/libmpdemux/cdda.c 2009-12-19 19:15:24 UTC (rev 51) +++ mplayerxp/libmpdemux/cdda.c 2009-12-21 18:42:18 UTC (rev 52) @@ -11,13 +11,11 @@ #include "cdd.h" #include "demux_msg.h" static int speed = -1; -static int paranoia_mode = 1; static int search_overlap = -1; static int no_skip = 0; static const config_t cdda_opts[] = { { "speed", &speed, CONF_TYPE_INT, CONF_RANGE,1,100, NULL }, - { "paranoia", ¶noia_mode, CONF_TYPE_INT,CONF_RANGE, 0, 2, NULL }, { "overlap", &search_overlap, CONF_TYPE_INT, CONF_RANGE,0,75, NULL }, { "noskip", &no_skip, CONF_TYPE_FLAG, 0 , 0, 1, NULL }, { "skip", &no_skip, CONF_TYPE_FLAG, 0 , 1, 0, NULL }, @@ -72,8 +70,6 @@ } int __FASTCALL__ open_cdda(stream_t *st,const char* dev,const char* arg) { - lsn_t lsn; - int mode = paranoia_mode; unsigned cd_tracks; cdda_priv* priv; unsigned int audiolen=0; @@ -128,47 +124,20 @@ if(speed) cdio_cddap_speed_set(priv->cd,speed); - priv->cdp = cdio_paranoia_init(priv->cd); - if(priv->cdp == NULL) { - cdio_cddap_close(priv->cd); - free(priv); - return 0; - } - - mode = PARANOIA_MODE_FULL; - if(mode == 0) - mode = PARANOIA_MODE_DISABLE; - else if(mode == 1) - mode = PARANOIA_MODE_OVERLAP; - - if(no_skip) - mode |= PARANOIA_MODE_NEVERSKIP; - - cdio_paranoia_modeset(priv->cdp,mode); - if(search_overlap >= 0) - cdio_paranoia_overlapset(priv->cdp,search_overlap); - - lsn=cdio_paranoia_seek(priv->cdp,priv->start_sector,SEEK_SET); - MSG_DBG2("[CDDA] %ld=cdio_paranoia_seek(%p,%ld,SEEK_SET)\n",lsn,priv->cdp,priv->start_sector); priv->sector = priv->start_sector; st->type = STREAMTYPE_SEEKABLE|STREAMTYPE_RAWAUDIO; st->priv = priv; - st->start_pos = priv->start_sector*CD_FRAMESIZE_RAW; - st->end_pos = priv->end_sector*CD_FRAMESIZE_RAW; + st->start_pos = priv->start_sector*CDIO_CD_FRAMESIZE_RAW; + st->end_pos = priv->end_sector*CDIO_CD_FRAMESIZE_RAW; return 1; } -static void cdparanoia_callback(long int inpos, paranoia_cb_mode_t function) { - UNUSED(inpos); - UNUSED(function); -} - -static unsigned long map_sector(cdda_priv*p,unsigned long sector,track_t *tr) +static lsn_t map_sector(cdda_priv*p,lsn_t sector,track_t *tr) { unsigned i,j; - unsigned long cd_track=sector; + lsn_t cd_track=sector; for(i=0;i<256;i++){ if(p->tracks[i].play && p->tracks[i].end_sector==sector-1) { cd_track=0; @@ -184,8 +153,8 @@ /* return physical sector address */ static unsigned long psa(cdda_priv*p,unsigned long sector) { - unsigned i,j; - unsigned long got_sectors=0,track_len; + unsigned i; + unsigned long got_sectors=p->start_sector,track_len; for(i=0;i<256;i++){ if(p->tracks[i].play) { track_len=p->tracks[i].end_sector-p->tracks[i].start_sector; @@ -198,35 +167,30 @@ int __FASTCALL__ read_cdda(stream_t* s,char *buf,track_t *tr) { cdda_priv* p = (cdda_priv*)s->priv; - unsigned long cd_track; - int16_t * _buf; track_t i=255; *tr=255; - _buf = cdio_paranoia_read(p->cdp,cdparanoia_callback); - + if(cdio_cddap_read(p->cd, buf, p->sector, 1)==0) { + MSG_ERR("[CD-DA]: read error occured\n"); + return -1; /* EOF */ + } p->sector++; - memcpy(buf,_buf,CD_FRAMESIZE_RAW); + if(p->sector == p->end_sector) return -1; /* EOF */ - if(p->sector == p->end_sector) return -1; - - cd_track=map_sector(p,p->sector,&i); - if(!cd_track) return -1; + p->sector=map_sector(p,p->sector,&i); + if(!p->sector) return -1; *tr=i+1; - MSG_V("Track %d, sector=%d\n", *tr, cd_track); - if(cd_track!=p->sector) { cdio_paranoia_seek(p->cdp,cd_track,SEEK_SET); p->sector=cd_track; } - return CD_FRAMESIZE_RAW; + MSG_V("Track %d, sector=%d\n", *tr, p->sector); + return CDIO_CD_FRAMESIZE_RAW; } void __FASTCALL__ seek_cdda(stream_t* s,off_t pos,track_t *tr) { cdda_priv* p = (cdda_priv*)s->priv; long sec; - long current_track=0, seeked_track=0; - unsigned i; - lsn_t lsn; + long seeked_track=0; track_t j=255; - sec = pos/CD_FRAMESIZE_RAW; + sec = pos/CDIO_CD_FRAMESIZE_RAW; MSG_DBG2("[CDDA] prepare seek to %ld\n",sec); seeked_track=sec; *tr=255; @@ -234,20 +198,16 @@ seeked_track = map_sector(p,seeked_track,&j); if(seeked_track) *tr=j+1; } - - lsn=cdio_paranoia_seek(p->cdp,seeked_track,SEEK_SET); - MSG_DBG2("[CDDA] %ld=cdio_paranoia_seek(%p,%ld,SEEK_SET)\n",lsn,p->cdp,seeked_track); p->sector=seeked_track; } off_t __FASTCALL__ tell_cdda(stream_t* s) { cdda_priv* p = (cdda_priv*)s->priv; - return p->sector*CD_FRAMESIZE_RAW; + return p->sector*CDIO_CD_FRAMESIZE_RAW; } void __FASTCALL__ close_cdda(stream_t* s) { cdda_priv* p = (cdda_priv*)s->priv; - cdio_paranoia_free(p->cdp); cdio_cddap_close(p->cd); free(p); } Modified: mplayerxp/libmpdemux/s_cdd.c =================================================================== --- mplayerxp/libmpdemux/s_cdd.c 2009-12-19 19:15:24 UTC (rev 51) +++ mplayerxp/libmpdemux/s_cdd.c 2009-12-21 18:42:18 UTC (rev 52) @@ -107,7 +107,7 @@ const stream_driver_t cdda_stream= { "cdda://", - "reads multimedia stream directly from Compact Disc Digital Audio system, or CD-DA", + "reads multimedia stream directly from Digital Audio Compact Disc [CD-DA]", _cdda_open, cdd_read, cdd_seek, @@ -119,7 +119,7 @@ const stream_driver_t cddb_stream= { "cddb://", - "reads multimedia stream from Compact Disc Database or CD-DB", + "reads multimedia stream from CD-DA but tracks names from CDDB servers", _cddb_open, cdd_read, cdd_seek, Modified: mplayerxp/libmpdemux/s_vcd.c =================================================================== --- mplayerxp/libmpdemux/s_vcd.c 2009-12-19 19:15:24 UTC (rev 51) +++ mplayerxp/libmpdemux/s_vcd.c 2009-12-21 18:42:18 UTC (rev 52) @@ -2,48 +2,32 @@ s_vcd - VCD's stream interface */ #include "../mp_config.h" -#ifdef HAVE_VCD +#ifdef HAVE_LIBCDIO +#include <unistd.h> +#include <fcntl.h> #include <stdlib.h> #include <string.h> #include <stdio.h> -#include "stream.h" +#include <cdio/cdio.h> - -#ifdef __FreeBSD__ -#include <sys/cdrio.h> -#endif -#include <sys/ioctl.h> - -#include <fcntl.h> -#include <unistd.h> -#include <fcntl.h> -#ifdef __FreeBSD__ -#include "vcd_read_fbsd.h" -#elif defined(__NetBSD__) -#include "vcd_read_nbsd.h" -#else -#include "vcd_read.h" -#endif +#include "stream.h" #include "help_mp.h" #include "mrl.h" #include "demux_msg.h" typedef struct vcd_priv_s { + CdIo_t *cd; off_t spos; unsigned ssect,esect; }vcd_priv_t; static int __FASTCALL__ _vcd_open(stream_t *stream,const char *filename,unsigned flags) { - int ret,ret2; int vcd_track; vcd_priv_t *priv; const char *param; - char *device; -#ifdef __FreeBSD__ - int bsize=VCD_SECTOR_SIZE; -#endif + char *dev,*device=NULL; UNUSED(flags); /* originally was vcd:// but playtree parser replaced it */ if(strcmp(filename,"help") == 0) @@ -53,46 +37,38 @@ } param=mrl_parse_line(filename,NULL,NULL,&device,NULL); vcd_track=atoi(param); - if(!device) device=DEFAULT_CDROM_DEVICE; - stream->fd=open(device,O_RDONLY); + if(!device) dev=DEFAULT_CDROM_DEVICE; + else dev=device; + priv=stream->priv=malloc(sizeof(vcd_priv_t)); + cdio_init(); + priv->cd=cdio_open(dev,DRIVER_UNKNOWN); if(device) free(device); - if(stream->fd<0) + if(!priv->cd) { MSG_ERR(MSGTR_CdDevNotfound,device); return 0; } - vcd_read_toc(stream->fd); - ret2=vcd_get_track_end(stream->fd,vcd_track); - if(ret2<0){ MSG_ERR(MSGTR_ErrTrackSelect " (get)\n");return 0;} - ret=vcd_seek_to_track(stream->fd,vcd_track); - if(ret<0){ MSG_ERR(MSGTR_ErrTrackSelect " (seek)\n");return 0;} - priv=stream->priv=malloc(sizeof(vcd_priv_t)); - vcd_read(stream->fd,NULL); - vcd_dec_msf(); - priv->ssect=vcd_get_msf(); - priv->esect=ret2/VCD_SECTOR_DATA; - ret=VCD_SECTOR_DATA*priv->ssect; - MSG_V("VCD start byte position: 0x%X end: 0x%X\n",ret,ret2); -#ifdef __FreeBSD__ - if (ioctl (stream->f, CDRIOCSETBLOCKSIZE, &bsize) == -1) { - MSG_ERR ("Error in CDRIOCSETBLOCKSIZE"); - } -#endif + vcd_track=cdio_get_num_tracks(priv->cd); + MSG_V("CD contains: %d tracks\n",vcd_track); + priv->ssect=cdio_get_track_pregap_lsn(priv->cd,2); + priv->esect=cdio_get_track_pregap_lsn(priv->cd,vcd_track)+cdio_get_track_sec_count(priv->cd,vcd_track); + stream->type = STREAMTYPE_SEEKABLE|STREAMTYPE_PROGRAM; stream->sector_size=VCD_SECTOR_SIZE; - stream->start_pos=ret; - stream->end_pos=ret2; - ((vcd_priv_t *)stream->priv)->spos=ret; + stream->start_pos=priv->ssect*VCD_SECTOR_DATA; + stream->end_pos=priv->esect*VCD_SECTOR_DATA; + ((vcd_priv_t *)stream->priv)->spos=stream->start_pos; return 1; } static int __FASTCALL__ _vcd_read(stream_t *stream,stream_packet_t*sp) { vcd_priv_t *p=stream->priv; + ssize_t len; sp->type=0; - sp->len = vcd_read(stream->fd,sp->buf); - p->spos += sp->len; - return sp->len; + len=cdio_read(p->cd,sp->buf,sp->len); + p->spos += len; + return len; } static off_t __FASTCALL__ _vcd_seek(stream_t *stream,off_t pos) @@ -104,7 +80,7 @@ newpos=pos/VCD_SECTOR_DATA; if(newpos<p->ssect) newpos=p->ssect; if(newpos>p->esect) newpos=p->esect; - vcd_set_msf(newpos); + newpos=cdio_lseek(p->cd,newpos*VCD_SECTOR_DATA,SEEK_SET); p->spos=newpos*VCD_SECTOR_DATA; return p->spos; } @@ -117,8 +93,9 @@ static void __FASTCALL__ _vcd_close(stream_t*stream) { + vcd_priv_t *p=stream->priv; + cdio_destroy(p->cd); free(stream->priv); - close(stream->fd); } static int __FASTCALL__ _vcd_ctrl(stream_t *s,unsigned cmd,void *args) { UNUSED(s); Modified: mplayerxp/libmpdemux/stream.c =================================================================== --- mplayerxp/libmpdemux/stream.c 2009-12-19 19:15:24 UTC (rev 51) +++ mplayerxp/libmpdemux/stream.c 2009-12-21 18:42:18 UTC (rev 52) @@ -22,7 +22,7 @@ #define min(a,b) ((a)<(b)?(a):(b)) #endif -#ifdef HAVE_LIBCDIO +#ifdef HAVE_LIBCDIO_CDDA extern const stream_driver_t cdda_stream; extern const stream_driver_t cddb_stream; #endif @@ -42,7 +42,7 @@ #ifdef USE_OSS_AUDIO extern const stream_driver_t oss_stream; #endif -#ifdef HAVE_VCD +#ifdef HAVE_LIBCDIO extern const stream_driver_t vcd_stream; #endif #ifdef USE_LIBVCD @@ -54,7 +54,7 @@ static const stream_driver_t *sdrivers[] = { -#ifdef HAVE_LIBCDIO +#ifdef HAVE_LIBCDIO_CDDA &cdda_stream, #ifdef HAVE_STREAMING &cddb_stream, @@ -69,7 +69,7 @@ #ifdef USE_TV &tv_stream, #endif -#ifdef HAVE_VCD +#ifdef HAVE_LIBCDIO &vcd_stream, #endif #ifdef USE_LIBVCD Deleted: mplayerxp/libmpdemux/vcd_read.h =================================================================== --- mplayerxp/libmpdemux/vcd_read.h 2009-12-19 19:15:24 UTC (rev 51) +++ mplayerxp/libmpdemux/vcd_read.h 2009-12-21 18:42:18 UTC (rev 52) @@ -1,255 +0,0 @@ -//=================== VideoCD ========================== -#if defined(linux) || defined(sun) || defined(__bsdi__) - -#if defined(linux) -#include <linux/cdrom.h> -#elif defined(sun) -#include <sys/cdio.h> -static int sun_vcd_read(int, int*); -#elif defined(__bsdi__) -#include <dvd.h> -#endif - - -static struct cdrom_tocentry vcd_entry; - -static inline void vcd_set_msf(unsigned int sect){ - vcd_entry.cdte_addr.msf.frame=sect%75; - sect=sect/75; - vcd_entry.cdte_addr.msf.second=sect%60; - sect=sect/60; - vcd_entry.cdte_addr.msf.minute=sect; -} - -static inline unsigned int vcd_get_msf(){ - return vcd_entry.cdte_addr.msf.frame + - (vcd_entry.cdte_addr.msf.second+ - vcd_entry.cdte_addr.msf.minute*60)*75; -} - -static int vcd_seek_to_track(int fd,int track){ - vcd_entry.cdte_format = CDROM_MSF; - vcd_entry.cdte_track = track; - if (ioctl(fd, CDROMREADTOCENTRY, &vcd_entry)) { - perror("ioctl dif1"); - return -1; - } - return VCD_SECTOR_DATA*vcd_get_msf(); -} - -static int vcd_get_track_end(int fd,int track){ - struct cdrom_tochdr tochdr; - if (ioctl(fd,CDROMREADTOCHDR,&tochdr)==-1) - { perror("read CDROM toc header: "); return -1; } - vcd_entry.cdte_format = CDROM_MSF; - vcd_entry.cdte_track = track<tochdr.cdth_trk1?(track+1):CDROM_LEADOUT; - if (ioctl(fd, CDROMREADTOCENTRY, &vcd_entry)) { - perror("ioctl dif2"); - return -1; - } - return VCD_SECTOR_DATA*vcd_get_msf(); -} - -static void vcd_read_toc(int fd){ - struct cdrom_tochdr tochdr; - int i; - if (ioctl(fd,CDROMREADTOCHDR,&tochdr)==-1) - { perror("read CDROM toc header: "); return; } - for (i=tochdr.cdth_trk0 ; i<=tochdr.cdth_trk1 ; i++){ - struct cdrom_tocentry tocentry; - - tocentry.cdte_track = i; - tocentry.cdte_format = CDROM_MSF; - - if (ioctl(fd,CDROMREADTOCENTRY,&tocentry)==-1) - { perror("read CDROM toc entry: "); return; } - - MSG_V("track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d mode: %d\n", - (int)tocentry.cdte_track, - (int)tocentry.cdte_adr, - (int)tocentry.cdte_ctrl, - (int)tocentry.cdte_format, - (int)tocentry.cdte_addr.msf.minute, - (int)tocentry.cdte_addr.msf.second, - (int)tocentry.cdte_addr.msf.frame, - (int)tocentry.cdte_datamode - ); - } -} - -static unsigned char vcd_buf[VCD_SECTOR_SIZE]; - -static void vcd_inc_msf(void) -{ - vcd_entry.cdte_addr.msf.frame++; - if (vcd_entry.cdte_addr.msf.frame==75){ - vcd_entry.cdte_addr.msf.frame=0; - vcd_entry.cdte_addr.msf.second++; - if (vcd_entry.cdte_addr.msf.second==60){ - vcd_entry.cdte_addr.msf.second=0; - vcd_entry.cdte_addr.msf.minute++; - } - } -} - -static void vcd_dec_msf(void) -{ - vcd_set_msf(vcd_get_msf()-1); -} - -static int vcd_read(int fd,char *mem){ -#if defined(linux) || defined(__bsdi__) - do { - memcpy(vcd_buf,&vcd_entry.cdte_addr.msf,sizeof(struct cdrom_msf)); - if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; // EOF? - /* Check header ID for a padding sector and simply discard - these. It is alleged that VCD's put these in to keep the - bitrate constant. - */ - MSG_DBG3("MSF=%i SUBHEADER: (0) %02X %02X %02X %02X %02X %02X %02X %02X (8) %02X %02X %02X %02X %02X %02X %02X %02X (16) %02X %02X %02X %02X %02X %02X %02X %02X\n" - ,vcd_entry.cdte_addr.msf - ,vcd_buf[0] - ,vcd_buf[1] - ,vcd_buf[2] - ,vcd_buf[3] - ,vcd_buf[4] - ,vcd_buf[5] - ,vcd_buf[6] - ,vcd_buf[7] - ,vcd_buf[8] - ,vcd_buf[9] - ,vcd_buf[10] - ,vcd_buf[11] - ,vcd_buf[12] - ,vcd_buf[13] - ,vcd_buf[14] - ,vcd_buf[15] - ,vcd_buf[16] - ,vcd_buf[17] - ,vcd_buf[18] - ,vcd_buf[19] - ,vcd_buf[20] - ,vcd_buf[21] - ,vcd_buf[22] - ,vcd_buf[23]); - MSG_DBG3("DATA: %02X %02X %02X %02X %02X %02X %02X %02X\n" - ,vcd_buf[VCD_SECTOR_OFFS+0] - ,vcd_buf[VCD_SECTOR_OFFS+1] - ,vcd_buf[VCD_SECTOR_OFFS+2] - ,vcd_buf[VCD_SECTOR_OFFS+3] - ,vcd_buf[VCD_SECTOR_OFFS+4] - ,vcd_buf[VCD_SECTOR_OFFS+5] - ,vcd_buf[VCD_SECTOR_OFFS+6] - ,vcd_buf[VCD_SECTOR_OFFS+7]); - vcd_inc_msf(); - }while((vcd_buf[18]&~0x01)==0x60); - if(mem) memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA); -#elif defined(sun) - { - int offset; - if (sun_vcd_read(fd, &offset) <= 0) return 0; - if(mem) memcpy(mem,&vcd_buf[offset],VCD_SECTOR_DATA); - } - vcd_inc_msf(); -#endif - return VCD_SECTOR_DATA; -} - - -#ifdef sun -#include <sys/scsi/generic/commands.h> -#include <sys/scsi/impl/uscsi.h> - -#define SUN_XAREAD 1 /*fails on atapi drives*/ -#define SUN_MODE2READ 2 /*fails on atapi drives*/ -#define SUN_SCSIREAD 3 -#define SUN_VCDREAD SUN_SCSIREAD - -static int sun_vcd_read(int fd, int *offset) -{ -#if SUN_VCDREAD == SUN_XAREAD - struct cdrom_cdxa cdxa; - cdxa.cdxa_addr = vcd_get_msf(); - cdxa.cdxa_length = 1; - cdxa.cdxa_data = vcd_buf; - cdxa.cdxa_format = CDROM_XA_SECTOR_DATA; - - if(ioctl(fd,CDROMCDXA,&cdxa)==-1) { - perror("CDROMCDXA"); - return 0; - } - *offset = 0; -#elif SUN_VCDREAD == SUN_MODE2READ - struct cdrom_read cdread; - cdread.cdread_lba = 4*vcd_get_msf(); - cdread.cdread_bufaddr = vcd_buf; - cdread.cdread_buflen = 2336; - - if(ioctl(fd,CDROMREADMODE2,&cdread)==-1) { - perror("CDROMREADMODE2"); - return 0; - } - *offset = 8; -#elif SUN_VCDREAD == SUN_SCSIREAD - struct uscsi_cmd sc; - union scsi_cdb cdb; - int lba = vcd_get_msf(); - int blocks = 1; - int sector_type; - int sync, header_code, user_data, edc_ecc, error_field; - int sub_channel; - - /* sector_type = 3; *//* mode2 */ - sector_type = 5; /* mode2/form2 */ - sync = 0; - header_code = 0; - user_data = 1; - edc_ecc = 0; - error_field = 0; - sub_channel = 0; - - memset(&cdb, 0, sizeof(cdb)); - memset(&sc, 0, sizeof(sc)); - cdb.scc_cmd = 0xBE; - cdb.cdb_opaque[1] = (sector_type) << 2; - cdb.cdb_opaque[2] = (lba >> 24) & 0xff; - cdb.cdb_opaque[3] = (lba >> 16) & 0xff; - cdb.cdb_opaque[4] = (lba >> 8) & 0xff; - cdb.cdb_opaque[5] = lba & 0xff; - cdb.cdb_opaque[6] = (blocks >> 16) & 0xff; - cdb.cdb_opaque[7] = (blocks >> 8) & 0xff; - cdb.cdb_opaque[8] = blocks & 0xff; - cdb.cdb_opaque[9] = (sync << 7) | - (header_code << 5) | - (user_data << 4) | - (edc_ecc << 3) | - (error_field << 1); - cdb.cdb_opaque[10] = sub_channel; - - sc.uscsi_cdb = (caddr_t)&cdb; - sc.uscsi_cdblen = 12; - sc.uscsi_bufaddr = vcd_buf; - sc.uscsi_buflen = 2336; - sc.uscsi_flags = USCSI_ISOLATE | USCSI_READ; - sc.uscsi_timeout = 20; - if (ioctl(fd, USCSICMD, &sc)) { - MSG_ERR("USCSICMD: READ CD"); - return -1; - } - if (sc.uscsi_status) { - MSG_ERR( "scsi command failed with status %d\n", sc.uscsi_status); - return -1; - } - *offset = 0; - return 1; -#else -#error SUN_VCDREAD -#endif -} -#endif /*sun*/ - -#else /* linux || sun || __bsdi__ */ - -#error vcd is not yet supported on this arch... - -#endif Deleted: mplayerxp/libmpdemux/vcd_read_fbsd.h =================================================================== --- mplayerxp/libmpdemux/vcd_read_fbsd.h 2009-12-19 19:15:24 UTC (rev 51) +++ mplayerxp/libmpdemux/vcd_read_fbsd.h 2009-12-21 18:42:18 UTC (rev 52) @@ -1,97 +0,0 @@ -#include <sys/cdio.h> -#include <sys/cdrio.h> - -//=================== VideoCD ========================== -#define CDROM_LEADOUT 0xAA - -typedef struct { - uint8_t sync [12]; - uint8_t header [4]; - uint8_t subheader [8]; - uint8_t data [2324]; - uint8_t spare [4]; -} cdsector_t; - -static cdsector_t vcd_buf; -static struct ioc_read_toc_single_entry vcd_entry; - -static inline void vcd_set_msf(unsigned int sect){ - vcd_entry.entry.addr.msf.frame=sect%75; - sect=sect/75; - vcd_entry.entry.addr.msf.second=sect%60; - sect=sect/60; - vcd_entry.entry.addr.msf.minute=sect; -} - -static inline unsigned int vcd_get_msf(){ - return vcd_entry.entry.addr.msf.frame + - (vcd_entry.entry.addr.msf.second+ - vcd_entry.entry.addr.msf.minute*60)*75; -} - -int vcd_seek_to_track(int fd,int track){ - vcd_entry.address_format = CD_MSF_FORMAT; - vcd_entry.track = track; - if (ioctl(fd, CDIOREADTOCENTRY, &vcd_entry)) { - perror("ioctl dif1"); - return -1; - } - return VCD_SECTOR_DATA*vcd_get_msf(); -} - -int vcd_get_track_end(int fd,int track){ - struct ioc_toc_header tochdr; - if (ioctl(fd,CDIOREADTOCHEADER,&tochdr)==-1) - { perror("read CDROM toc header: "); return -1; } - vcd_entry.address_format = CD_MSF_FORMAT; - vcd_entry.track = track<tochdr.ending_track?(track+1):CDROM_LEADOUT; - if (ioctl(fd, CDIOREADTOCENTRY, &vcd_entry)) { - perror("ioctl dif2"); - return -1; - } - return VCD_SECTOR_DATA*vcd_get_msf(); -} - -void vcd_read_toc(int fd){ - struct ioc_toc_header tochdr; - int i; - if (ioctl(fd,CDIOREADTOCHEADER,&tochdr)==-1) - { perror("read CDROM toc header: "); return; } - for (i=tochdr.starting_track ; i<=tochdr.ending_track ; i++){ - struct ioc_read_toc_single_entry tocentry; - - tocentry.track = i; - tocentry.address_format = CD_MSF_FORMAT; - - if (ioctl(fd,CDIOREADTOCENTRY,&tocentry)==-1) - { MSG_ERR("read CDROM toc entry: "); return; } - - MSG_V("track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n", - (int)tocentry.track, - (int)tocentry.entry.addr_type, - (int)tocentry.entry.control, - (int)tocentry.address_format, - (int)tocentry.entry.addr.msf.minute, - (int)tocentry.entry.addr.msf.second, - (int)tocentry.entry.addr.msf.frame - ); - } -} - -static int vcd_read(int fd,char *mem){ - - if (pread(fd,&vcd_buf,VCD_SECTOR_SIZE,vcd_get_msf()*VCD_SECTOR_SIZE) - != VCD_SECTOR_SIZE) return 0; // EOF? - - vcd_entry.entry.addr.msf.frame++; - if (vcd_entry.entry.addr.msf.frame==75){ - vcd_entry.entry.addr.msf.frame=0; - vcd_entry.entry.addr.msf.second++; - if (vcd_entry.entry.addr.msf.second==60){ - vcd_entry.entry.addr.msf.second=0; - vcd_entry.entry.addr.msf.minute++; - } - } - memcpy(mem,vcd_buf.data,VCD_SECTOR_DATA); - return VCD_SECTOR_DATA; -} Deleted: mplayerxp/libmpdemux/vcd_read_nbsd.h =================================================================== --- mplayerxp/libmpdemux/vcd_read_nbsd.h 2009-12-19 19:15:24 UTC (rev 51) +++ mplayerxp/libmpdemux/vcd_read_nbsd.h 2009-12-21 18:42:18 UTC (rev 52) @@ -1,164 +0,0 @@ - -#include <sys/types.h> -#include <sys/inttypes.h> -#include <sys/cdio.h> -#include <sys/scsiio.h> - -#define CDROM_LEADOUT 0xAA - -static struct ioc_read_toc_entry vcd_entry; -static struct cd_toc_entry vcd_entry_data; -static char vcd_buf[VCD_SECTOR_SIZE]; - -static inline void -vcd_set_msf(unsigned int sect) -{ - unsigned int s = sect; - vcd_entry_data.addr.msf.frame = sect % 75; - sect = sect / 75; - vcd_entry_data.addr.msf.second = sect % 60; - sect = sect / 60; - vcd_entry_data.addr.msf.minute = sect; -} - -static inline void -vcd_inc_msf(void) -{ - vcd_entry_data.addr.msf.frame++; - if (vcd_entry_data.addr.msf.frame==75){ - vcd_entry_data.addr.msf.frame=0; - vcd_entry_data.addr.msf.second++; - if (vcd_entry_data.addr.msf.second==60){ - vcd_entry_data.addr.msf.second=0; - vcd_entry_data.addr.msf.minute++; - } - } -} - -static inline unsigned int -vcd_get_msf() -{ - return vcd_entry_data.addr.msf.frame + - (vcd_entry_data.addr.msf.second + - vcd_entry_data.addr.msf.minute * 60) * 75; -} - -int -vcd_seek_to_track(int fd, int track) -{ - vcd_entry.address_format = CD_MSF_FORMAT; - vcd_entry.starting_track = track; - vcd_entry.data_len = sizeof(struct cd_toc_entry); - vcd_entry.data = &vcd_entry_data; - if (ioctl(fd, CDIOREADTOCENTRIES, &vcd_entry)) { - perror("ioctl dif1"); - return -1; - } - return VCD_SECTOR_DATA * vcd_get_msf(); -} - -int -vcd_get_track_end(int fd, int track) -{ - struct ioc_toc_header tochdr; - if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) { - perror("read CDROM toc header: "); - return -1; - } - vcd_entry.address_format = CD_MSF_FORMAT; - vcd_entry.starting_track = track < tochdr.ending_track ? (track + 1) : CDROM_LEADOUT; - vcd_entry.data_len = sizeof(struct cd_toc_entry); - vcd_entry.data = &vcd_entry_data; - if (ioctl(fd, CDIOREADTOCENTRYS, &vcd_entry)) { - perror("ioctl dif2"); - return -1; - } - return VCD_SECTOR_DATA * vcd_get_msf(); -} - -void -vcd_read_toc(int fd) -{ - struct ioc_toc_header tochdr; - int i; - if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) { - perror("read CDROM toc header: "); - return; - } - for (i = tochdr.starting_track; i <= tochdr.ending_track; i++) { - struct ioc_read_toc_entry tocentry; - struct cd_toc_entry tocentry_data; - - tocentry.starting_track = i; - tocentry.address_format = CD_MSF_FORMAT; - tocentry.data_len = sizeof(struct cd_toc_entry); - tocentry.data = &tocentry_data; - - if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { - MSG_ERR("read CDROM toc entry: "); - return; - } - MSG_V("track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n", - (int) tocentry.starting_track, - (int) tocentry.data->addr_type, - (int) tocentry.data->control, - (int) tocentry.address_format, - (int) tocentry.data->addr.msf.minute, - (int) tocentry.data->addr.msf.second, - (int) tocentry.data->addr.msf.frame - ); - } -} - -static int -vcd_read(int fd, char *mem) -{ - struct scsireq sc; - int lba = vcd_get_msf(); - int blocks; - int sector_type; - int sync, header_code, user_data, edc_ecc, error_field; - int sub_channel; - int rc; - - blocks = 1; - sector_type = 5; /* mode2/form2 */ - sync = 0; - header_code = 0; - user_data = 1; - edc_ecc = 0; - error_field = 0; - sub_channel = 0; - - memset(&sc, 0, sizeof(sc)); - sc.cmd[0] = 0xBE; - sc.cmd[1] = (sector_type) << 2; - sc.cmd[2] = (lba >> 24) & 0xff; - sc.cmd[3] = (lba >> 16) & 0xff; - sc.cmd[4] = (lba >> 8) & 0xff; - sc.cmd[5] = lba & 0xff; - sc.cmd[6] = (blocks >> 16) & 0xff; - sc.cmd[7] = (blocks >> 8) & 0xff; - sc.cmd[8] = blocks & 0xff; - sc.cmd[9] = (sync << 7) | (header_code << 5) | (user_data << 4) | - (edc_ecc << 3) | (error_field << 1); - sc.cmd[10] = sub_channel; - sc.cmdlen = 12; - sc.databuf = (caddr_t) mem; - sc.datalen = 2328; - sc.senselen = sizeof(sc.sense); - sc.flags = SCCMD_READ; - sc.timeout = 10000; - rc = ioctl(fd, SCIOCCOMMAND, &sc); - if (rc == -1) { - perror("SCIOCCOMMAND"); - return -1; - } - if (sc.retsts || sc.error) { - fprintf(stderr, "scsi command failed: status %d error %d\n", sc.retsts, - sc.error); - return -1; - } - vcd_inc_msf(); - return VCD_SECTOR_DATA; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |