[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[595] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-22 12:15:57
|
Revision: 595 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=595&view=rev Author: nickols_k Date: 2012-12-22 12:15:42 +0000 (Sat, 22 Dec 2012) Log Message: ----------- convert MSG_* into mpxp_ostream compatible output Modified Paths: -------------- mplayerxp/libmpstream2/cache2.cpp mplayerxp/libmpstream2/cdda.cpp mplayerxp/libmpstream2/cddb.cpp mplayerxp/libmpstream2/cookies.cpp mplayerxp/libmpstream2/http.cpp mplayerxp/libmpstream2/librtsp/rtsp.cpp mplayerxp/libmpstream2/librtsp/rtsp_rtp.cpp mplayerxp/libmpstream2/librtsp/rtsp_session.cpp mplayerxp/libmpstream2/mrl.cpp mplayerxp/libmpstream2/network.cpp mplayerxp/libmpstream2/network_asf.cpp mplayerxp/libmpstream2/network_asf_mmst.cpp mplayerxp/libmpstream2/network_nop.cpp mplayerxp/libmpstream2/pnm.cpp mplayerxp/libmpstream2/realrtsp/asmrp.cpp mplayerxp/libmpstream2/realrtsp/real.cpp mplayerxp/libmpstream2/realrtsp/rmff.cpp mplayerxp/libmpstream2/realrtsp/sdpplin.cpp mplayerxp/libmpstream2/rtp_cache.cpp mplayerxp/libmpstream2/stream_msg.h mplayerxp/libmpstream2/tcp.cpp mplayerxp/libmpstream2/tvi/tvi_bsdbt848.cpp mplayerxp/libmpstream2/tvi/tvi_v4l.cpp mplayerxp/libmpstream2/udp.cpp mplayerxp/libmpstream2/url.cpp mplayerxp/nls/mpxp_help-en.h mplayerxp/nls/mpxp_help-ru.h Modified: mplayerxp/libmpstream2/cache2.cpp =================================================================== --- mplayerxp/libmpstream2/cache2.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/cache2.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -84,7 +84,7 @@ inline void COREDUMP() {} #endif -inline void C2_ASSERT(int cond) { if(cond) MSG_FATAL("internal error at cache2.c: (%i)\n",cond); } +inline void C2_ASSERT(int cond) { if(cond) mpxp_fatal<<"internal error at cache2.c: "<<cond<<std::endl; } static int __FASTCALL__ c2_cache_fill(cache_vars_t* c){ int len,in_cache,legacy_eof,seek_eof; @@ -99,16 +99,17 @@ seek_eof=0; if(!in_cache && c->stream->type()&Stream::Type_Seekable) { /* seeking... */ - MSG_DBG2("Out of boundaries... seeking to %lli {in_cache(%i) %lli<%lli>%lli} \n" - ,new_start,in_cache,START_FILEPOS(*c),readpos,END_FILEPOS(*c)); + mpxp_dbg2<<"Out of boundaries... seeking to "<<new_start + <<" {in_cache("<<in_cache<<") " + <<START_FILEPOS(*c)<<"<"<<readpos<<">"<<END_FILEPOS(*c)<<"}"<<std::endl; if(c->stream->eof() || c->eof) c->stream->reset(); c->stream->seek(new_start); - if(errno) { MSG_WARN("c2_seek(drv:%s) error: %s\n",c->stream->driver_info->mrl,strerror(errno)); errno=0; } + if(errno) { mpxp_warn<<"c2_seek(drv:"<<c->stream->driver_info->mrl<<") error: "<<strerror(errno)<<std::endl; errno=0; } if((c->packets[c->first].filepos=c->stream->tell())<0) seek_eof=1; c->last=c->first; if(c->packets[c->first].filepos < new_start-(off_t)c->stream->sector_size()) - MSG_WARN("CACHE2: found wrong offset after seeking %lli (wanted: %lli)\n",c->packets[c->first].filepos,new_start); - MSG_DBG2("Seek done. new pos: %lli\n",START_FILEPOS(*c)); + mpxp_warn<<"CACHE2: found wrong offset after seeking "<<c->packets[c->first].filepos<<" (wanted: "<<new_start<<")"<<std::endl; + mpxp_dbg2<<"Seek done. new pos: "<<START_FILEPOS(*c)<<std::endl; } else { /* find new start of buffer according on readpos */ cidx=c->first; @@ -117,12 +118,12 @@ && !c->packets[cidx].sp.type) break; cidx=CP_NEXT(*c,cidx); }while(cidx!=c->first); - MSG_DBG2("CACHE2: Assigning first as %p for %lli\n",c->first,START_FILEPOS(*c)); + mpxp_dbg2<<"CACHE2: Assigning first as "<<reinterpret_cast<any_t*>(c->first)<<" for "<<START_FILEPOS(*c)<<std::endl; c->first=cidx; } CACHE2_TUNLOCK(*c); if(CP_NEXT(*c,c->last) == c->first || c->eof) { - MSG_DBG2("CACHE2: cache full\n"); + mpxp_dbg2<<"CACHE2: cache full"<<std::endl; return 0; /* cache full */ } len=0; @@ -136,24 +137,24 @@ c->packets[cidx].sp.len=c->sector_size; c->packets[cidx].filepos = c->stream->tell(); c->stream->read(c->packets[cidx].sp.buf,c->packets[cidx].sp.len); - MSG_DBG2("CACHE2: read_packet at %lli (wanted %u got %u type %i)",c->packets[cidx].filepos,c->sector_size,c->packets[cidx].sp.len,c->packets[cidx].sp.type); + mpxp_dbg2<<"CACHE2: read_packet at "<<c->packets[cidx].filepos<<" (wanted "<<c->sector_size<<" got "<<c->packets[cidx].sp.len<<" type "<<c->packets[cidx].sp.type<<")"; if(mp_conf.verbose>1) if(c->packets[cidx].sp.len>8) { int i; for(i=0;i<8;i++) - MSG_DBG2("%02X ",(int)(unsigned char)c->packets[cidx].sp.buf[i]); + mpxp_dbg2<<std::hex<<(unsigned)(unsigned char)c->packets[cidx].sp.buf[i]<<" "; } - MSG_DBG2("\n"); + mpxp_dbg2<<std::endl; if(c->stream->ctrl(SCTRL_EOF,NULL)==MPXP_Ok) legacy_eof=1; else legacy_eof=0; if(c->packets[cidx].sp.len < 0 || (c->packets[cidx].sp.len == 0 && c->packets[cidx].sp.type == 0) || legacy_eof || seek_eof) { /* EOF */ - MSG_DBG2("CACHE2: guess EOF: %lli %lli\n",START_FILEPOS(*c),END_FILEPOS(*c)); + mpxp_dbg2<<"CACHE2: guess EOF: "<<START_FILEPOS(*c)<<" "<<END_FILEPOS(*c)<<std::endl; c->packets[cidx].state|=CPF_EOF; c->eof=1; c->packets[cidx].state&=~CPF_EMPTY; c->packets[cidx].state&=~CPF_DONE; - if(errno) { MSG_WARN("c2_fill_buffer(drv:%s) error: %s\n",c->stream->driver_info->mrl,strerror(errno)); errno=0; } + if(errno) { mpxp_warn<<"c2_fill_buffer(drv:"<<c->stream->driver_info->mrl<<") error: "<<strerror(errno)<<std::endl; errno=0; } CACHE2_PACKET_TUNLOCK(c->packets[cidx]); break; } @@ -163,15 +164,15 @@ c->packets[cidx].state&=~CPF_DONE; CACHE2_PACKET_TUNLOCK(c->packets[cidx]); cidx=CP_NEXT(*c,cidx); - MSG_DBG2("CACHE2: start=%lli end_filepos = %lli\n",START_FILEPOS(*c),END_FILEPOS(*c)); + mpxp_dbg2<<"CACHE2: start="<<START_FILEPOS(*c)<<" end_filepos = "<<END_FILEPOS(*c)<<std::endl; if(cidx==c->first) { - MSG_DBG2("CACHE2: end of queue is reached: %p\n",c->first); + mpxp_dbg2<<"CACHE2: end of queue is reached: "<<reinterpret_cast<any_t*>(c->first)<<std::endl; break; } CACHE2_TUNLOCK(*c); } c->in_fill=0; - MSG_DBG2("CACHE2: totally got %u bytes\n",len); + mpxp_dbg2<<"CACHE2: totally got "<<len<<" bytes"<<std::endl; return len; } @@ -187,12 +188,12 @@ c->mem=new char [num*sector]; if(!c->packets || !c->mem) { - MSG_ERR(MSGTR_OutOfMemory); + mpxp_err<<MSGTR_OutOfMemory<<std::endl; delete c; return 0; } pmem = c->mem; - MSG_DBG2("For cache navigation was allocated %u bytes as %u packets (%u/%u)\n",i,num,size,sector); + mpxp_dbg2<<"For cache navigation was allocated "<<i<<" bytes as "<<num<<" packets ("<<size<<"/"<<sector<<")"<<std::endl; c->first=c->last=0; for(i=0;i<num;i++) { @@ -203,7 +204,7 @@ } if(mp_conf.verbose>1) for(i=0;i<num;i++) { - MSG_DBG2("sizeof(c)=%u c=%i c->sp.buf=%p\n",sizeof(cache_packet_t),i,c->packets[i].sp.buf); + mpxp_dbg2<<"sizeof(c)="<<sizeof(cache_packet_t)<<" c="<<i<<" c->sp.buf="<<reinterpret_cast<any_t*>(c->packets[i].sp.buf)<<std::endl; } c->buffer_size=num*sector; c->sector_size=sector; @@ -215,7 +216,7 @@ static void sig_cache2( void ) { - MSG_V("cache2 segfault\n"); + mpxp_v<<"cache2 segfault"<<std::endl; mpxp_print_flush(); xmp_killall_threads(pthread_self()); __exit_sighandler(); @@ -259,13 +260,13 @@ static int __FASTCALL__ c2_stream_fill_buffer(cache_vars_t* c) { - MSG_DBG2( "c2_stream_fill_buffer\n"); + mpxp_dbg2<<"c2_stream_fill_buffer"<<std::endl; if(c->eof) return 0; while(c->read_filepos>=END_FILEPOS(*c) || c->read_filepos<START_FILEPOS(*c)) { if(c->eof) break; usleep(READ_USLEEP_TIME); // 10ms - MSG_DBG2("Waiting for %lli in %lli %lli\n",c->read_filepos,START_FILEPOS(*c),END_FILEPOS(*c)); + mpxp_dbg2<<"Waiting for "<<c->read_filepos<<" in "<<START_FILEPOS(*c)<<" "<<END_FILEPOS(*c)<<std::endl; continue; // try again... } return c->eof?0:1; @@ -275,7 +276,7 @@ { unsigned cidx; int was_eof; - MSG_DBG2("c2_stream_reset\n"); + mpxp_dbg2<<"c2_stream_reset"<<std::endl; c->stream->reset(); cidx=c->first; was_eof=0; @@ -293,7 +294,7 @@ static int __FASTCALL__ c2_stream_seek_long(cache_vars_t* c,off_t pos){ - MSG_DBG2("CACHE2_SEEK: %lli,%lli,%lli <> %lli\n",START_FILEPOS(*c),c->read_filepos,END_FILEPOS(*c),pos); + mpxp_dbg2<<"CACHE2_SEEK: "<<START_FILEPOS(*c)<<","<<c->read_filepos<<","<<END_FILEPOS(*c)<<" <> "<<pos<<std::endl; if(pos<0/* || pos>END_FILEPOS(*c)*/) { c->eof=1; return 0; } while(c->in_fill) yield_timeslice(); CACHE2_LOCK(*c); @@ -325,7 +326,7 @@ retval=CP_NEXT(*c,retval); if(retval==c->first) { - MSG_DBG2("Can't find packet for offset %lli\n",pos); + mpxp_dbg2<<"Can't find packet for offset "<<pos<<std::endl; CACHE2_UNLOCK(*c); return UINT_MAX; } @@ -374,7 +375,7 @@ static unsigned c2_next_packet(cache_vars_t* c,unsigned cidx,int *len,unsigned *npackets) { - MSG_DBG2("next_packet: start=%p cur=%i\n",c->first,cidx); + mpxp_dbg2<<"next_packet: start="<<reinterpret_cast<any_t*>(c->first)<<" cur="<<cidx<<std::endl; while(1) { CACHE2_LOCK(*c); @@ -393,7 +394,7 @@ CACHE2_PACKET_UNLOCK(c->packets[cidx]); } c2_get_continious_mem(c,cidx,len,npackets); - MSG_DBG2("next_packet: rp: %lli fp: %lli len %lu type %i\n",c->read_filepos,c->packets[cidx].filepos,c->packets[cidx].sp.len,c->packets[cidx].sp.type); + mpxp_dbg2<<"next_packet: rp: "<<c->read_filepos<<" fp: "<<c->packets[cidx].filepos<<" len "<<c->packets[cidx].sp.len<<" type "<<c->packets[cidx].sp.type<<std::endl; return cidx; } @@ -405,7 +406,7 @@ cur=c2_wait_packet(c,c->read_filepos,&mlen,&npackets); eof = cur!=UINT_MAX?((int)(c->packets[cur].state&CPF_EOF)):c->eof; if(cur==UINT_MAX||eof) { if(cur!=UINT_MAX) CACHE2_PACKET_UNLOCK(c->packets[cur]); return 0; } - MSG_DBG2( "c2_stream_read %i bytes from %lli\n",total,c->read_filepos); + mpxp_dbg2<<"c2_stream_read "<<total<<" bytes from "<<c->read_filepos<<std::endl; while(len){ int x; if(c->read_filepos>=c->packets[cur].filepos+mlen){ @@ -423,7 +424,7 @@ x=mlen-buf_pos; C2_ASSERT(buf_pos>=(unsigned)mlen); if(x>len) x=len; - if(!x) MSG_WARN( "c2_read: dead-lock\n"); + if(!x) mpxp_warn<<"c2_read: dead-lock"<<std::endl; memcpy(mem,&c->packets[cur].sp.buf[buf_pos],x); buf_pos+=x; mem+=x; len-=x; @@ -432,9 +433,9 @@ CACHE2_PACKET_UNLOCK(c->packets[cur]); if(mp_conf.verbose>2) { - MSG_DBG2( "c2_stream_read got %u bytes ",total); - for(i=0;i<std::min(8,total);i++) MSG_DBG2("%02X ",(int)((unsigned char)_mem[i])); - MSG_DBG2("\n"); + mpxp_dbg2<<"c2_stream_read got "<<total<<" bytes "; + for(i=0;i<std::min(8,total);i++) mpxp_dbg2<<std::hex<<(unsigned)((unsigned char)_mem[i]); + mpxp_dbg2<<std::endl; } return total; } @@ -446,7 +447,7 @@ static int __FASTCALL__ c2_stream_seek(cache_vars_t* c,off_t pos) { - MSG_DBG2( "c2_seek to %lli (%lli %lli) %i\n",(long long)pos,(long long)START_FILEPOS(*c),(long long)END_FILEPOS(*c),c->first); + mpxp_dbg2<<"c2_seek to "<<pos<<" ("<<START_FILEPOS(*c)<<" "<<END_FILEPOS(*c)<<") "<<c->first<<std::endl; if(pos>=START_FILEPOS(*c) && pos < END_FILEPOS(*c)) { c->read_filepos=pos; @@ -467,7 +468,7 @@ cur = c2_find_packet(c,c->read_filepos); if(cur!=UINT_MAX) CACHE2_PACKET_UNLOCK(c->packets[cur]); retval = cur!=UINT_MAX?((int)(c->packets[cur].state&CPF_EOF)):c->eof; - MSG_DBG2("stream_eof: %i\n",retval); + mpxp_dbg2<<"stream_eof: "<<retval<<std::endl; return retval; } @@ -482,7 +483,7 @@ CACHE2_PACKET_UNLOCK(c->packets[cur]); } c->eof=eof; - MSG_DBG2("stream_set_eof: %i\n",eof); + mpxp_dbg2<<"stream_set_eof: "<<eof<<std::endl; } /* @@ -496,7 +497,7 @@ if (!(type()&Stream::Type_Seekable)) { // The stream has no 'fd' behind it, so is non-cacheable - MSG_WARN("\rThis stream is non-cacheable\n"); + mpxp_warn<<"\rThis stream is non-cacheable"<<std::endl; return; } @@ -512,23 +513,18 @@ if((rc=xmp_register_thread(NULL,sig_cache2,cache2_routine,"cache2"))==UINT_MAX) return; c->pth=mpxp_context().engine().xp_core->mpxp_threads[rc]; // wait until cache is filled at least prefill_init % - MSG_V("CACHE_PRE_INIT: %lld [%lld] %lld pre:%d eof:%d SS=%u \n", - START_FILEPOS(*c),c->read_filepos,END_FILEPOS(*c),_min,c->eof,ss); + mpxp_v<<"CACHE_PRE_INIT: "<<START_FILEPOS(*c)<<" ["<<c->read_filepos<<"] "<<END_FILEPOS(*c)<<" pre:"<<_min<<" eof:"<<c->eof<<" SS="<<ss<<std::endl; while((c->read_filepos<START_FILEPOS(*c) || END_FILEPOS(*c)-c->read_filepos<_min) && !c->eof && CP_NEXT(*c,c->last)!=c->first){ if(!(type()&Stream::Type_Seekable)) - MSG_STATUS("\rCache fill: %5.2f%% (%d bytes) ", - 100.0*(float)(END_FILEPOS(*c)-c->read_filepos)/(float)(c->buffer_size), - END_FILEPOS(*c)-c->read_filepos); + mpxp_status<<"\rCache fill: "<<(100.0*(float)(END_FILEPOS(*c)-c->read_filepos)/(float)(c->buffer_size))<<"% ("<<(END_FILEPOS(*c)-c->read_filepos)<<" bytes) "; else - MSG_V("\rCache fill: %5.2f%% (%d bytes) ", - 100.0*(float)(END_FILEPOS(*c)-c->read_filepos)/(float)(c->buffer_size), - END_FILEPOS(*c)-c->read_filepos); + mpxp_v<<"\rCache fill: "<<(100.0*(float)(END_FILEPOS(*c)-c->read_filepos)/(float)(c->buffer_size))<<"% ("<<(END_FILEPOS(*c)-c->read_filepos)<<" bytes) "; if(c->eof) break; // file is smaller than prefill size if(mpdemux_check_interrupt(libinput,PREFILL_SLEEP_TIME)) return; } - MSG_STATUS("cache info: size=%u min=%u prefill=%u\n",size,_min,prefill); + mpxp_status<<"cache info: size="<<size<<" min="<<_min<<" prefill="<<prefill<<std::endl; return; // parent exits } Modified: mplayerxp/libmpstream2/cdda.cpp =================================================================== --- mplayerxp/libmpstream2/cdda.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/cdda.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -85,39 +85,39 @@ cd = cdio_cddap_identify(dev.c_str(),mp_conf.verbose?1:0,NULL); if(!cd) { - MSG_ERR("Can't open cdda device: %s\n",dev.c_str()); + mpxp_err<<"Can't open cdda device: "<<dev<<std::endl; return MPXP_False; } cdio_cddap_verbose_set(cd, mp_conf.verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT, mp_conf.verbose?CDDA_MESSAGE_PRINTIT:CDDA_MESSAGE_FORGETIT); if(cdio_cddap_open(cd) != 0) { - MSG_ERR("Can't open disc\n"); + mpxp_err<<"Can't open disc"<<std::endl; cdda_close(cd); return MPXP_False; } cd_tracks=cdio_cddap_tracks(cd); - MSG_V("Found %d tracks on disc\n",cd_tracks); + mpxp_v<<"Found "<<cd_tracks<<" tracks on disc"<<std::endl; if(!arg[0]) for(i=1;i<=cd_tracks;i++) tracks[i-1].play=1; cdda_parse_tracks(arr,sizeof(arr)/sizeof(unsigned),arg); for(i=1;i<=256;i++) if (arr[i]) tracks[i-1].play=1; st_inited=0; - MSG_V("[CDDA] Queued tracks:"); + mpxp_v<<"[CDDA] Queued tracks:"; for(i=0;i<cd_tracks;i++) { if(tracks[i].play) { tracks[i].start_sector=cdio_cddap_track_firstsector(cd,i+1); tracks[i].end_sector=cdio_cddap_track_lastsector(cd,i+1); - MSG_V(" %d[%d-%d]",i+1,tracks[i].start_sector,tracks[i].end_sector); + mpxp_v<<" "<<i+1<<"["<<tracks[i].start_sector<<"-"<<tracks[i].end_sector<<"]"; if(!st_inited) { start_sector=tracks[i].start_sector; st_inited=1; } end_sector=tracks[i].end_sector; audiolen +=tracks[i].end_sector-tracks[i].start_sector+1; } } for(;i<256;i++) tracks[i].play=0; - MSG_V("\n"); + mpxp_v<<std::endl; min = (unsigned int)(audiolen/(60*75)); sec = (unsigned int)((audiolen/75)%60); msec = (unsigned int)(audiolen%75); @@ -138,12 +138,12 @@ for(i=0;i<256;i++){ if(tracks[i].play && tracks[i].end_sector==_sector) { cd_track=0; - MSG_V("Found track changing. old track=%u Sector=%u",i,_sector); + mpxp_v<<"Found track changing. old track="<<i<<" Sector="<<_sector<<std::endl; for(j=i+1;j<256;j++) { if(tracks[j].play && tracks[j].start_sector==_sector+1) { cd_track=tracks[j].start_sector; if(tr) *tr=j; - MSG_V("new track=%u Sector=%u",j,cd_track); + mpxp_v<<"new track="<<j<<" Sector="<<cd_track<<std::endl; } } } @@ -170,12 +170,12 @@ track_t i=255; if(cdio_cddap_read(cd, buf, sector, 1)==0) { - MSG_ERR("[CD-DA]: read error occured\n"); + mpxp_err<<"[CD-DA]: read error occured"<<std::endl; return -1; /* EOF */ } sector++; if(sector == end_sector) { - MSG_DBG2("EOF was reached\n"); + mpxp_dbg2<<"EOF was reached"<<std::endl; return -1; /* EOF */ } @@ -183,8 +183,8 @@ if(!sector) return -1; if(i!=255) { *tr=i+1; - MSG_V("Track %d, sector=%d\n", *tr, sector); - } else MSG_DBG2("Track %d, sector=%d\n", *tr, sector); + mpxp_v<<"Track "<<*tr<<", sector="<<sector<<std::endl; + } else mpxp_dbg2<<"Track "<<*tr<<", sector="<<sector<<std::endl; return CDIO_CD_FRAMESIZE_RAW; } @@ -194,7 +194,7 @@ track_t j=255; _sec = pos/CDIO_CD_FRAMESIZE_RAW; - MSG_DBG2("[CDDA] prepare seek to %ld\n",_sec); + mpxp_dbg2<<"[CDDA] prepare seek to "<<_sec<<std::endl; seeked_track=_sec; *tr=255; if( sector!=seeked_track ) { Modified: mplayerxp/libmpstream2/cddb.cpp =================================================================== --- mplayerxp/libmpstream2/cddb.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/cddb.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -150,21 +150,21 @@ if( reply_parser==NULL || command==NULL || cddb_data==NULL ) return -1; sprintf( request, "http://%s/~cddb/cddb.cgi?cmd=%s%s&proto=%d", cddb_data->freedb_server, command, cddb_data->cddb_hello.c_str(), cddb_data->freedb_proto_level ); - MSG_V("Request[%s]\n", request ); + mpxp_v<<"Request["<<request<<"]"<<std::endl; if(url.redirect(request)!=MPXP_Ok) { - MSG_ERR("Not valid URL: '%s'\n",request); + mpxp_err<<"Not valid URL: "<<request<<std::endl; return -1; } if(http_send_request(tcp,url,0)!=MPXP_Ok) { - MSG_ERR("failed to send the http request\n"); + mpxp_err<<"failed to send the http request"<<std::endl; return -1; } HTTP_Header* http_hdr = http_read_response( tcp ); if( http_hdr==NULL ) { - MSG_ERR("Failed to read the http response\n"); + mpxp_err<<"Failed to read the http response"<<std::endl; return -1; } @@ -175,10 +175,10 @@ ret = reply_parser(*http_hdr, cddb_data); break; case 400: - MSG_V("Not Found\n"); + mpxp_v<<"Not Found"<<std::endl; break; default: - MSG_V("Unknown Error code\n"); + mpxp_v<<"Unknown Error code"<<std::endl; } delete http_hdr; @@ -188,78 +188,74 @@ } static int __FASTCALL__ cddb_read_cache(cddb_data_t *cddb_data) { - char file_name[100]; - struct stat stats; - int file_fd, ret; - size_t file_size; + char file_name[100]; + struct stat stats; + int file_fd, ret; + size_t file_size; - if( cddb_data==NULL || cddb_data->cache_dir==NULL ) return -1; + if( cddb_data==NULL || cddb_data->cache_dir==NULL ) return -1; - sprintf( file_name, "%s%08lx", cddb_data->cache_dir, cddb_data->disc_id); + sprintf( file_name, "%s%08lx", cddb_data->cache_dir, cddb_data->disc_id); - file_fd = open(file_name, O_RDONLY); - if( file_fd<0 ) { - MSG_ERR("No cache found\n"); - return -1; - } + file_fd = ::open(file_name, O_RDONLY); + if( file_fd<0 ) { + mpxp_err<<"No cache found"<<std::endl; + return -1; + } - ret = fstat( file_fd, &stats ); - if( ret<0 ) { - perror("fstat"); - file_size = 4096; - } else { - file_size = stats.st_size; - } + ret = fstat( file_fd, &stats ); + if( ret<0 ) { + ::perror("fstat"); + file_size = 4096; + } else { + file_size = stats.st_size; + } - cddb_data->xmcd_file = new char [file_size]; - if( cddb_data->xmcd_file==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - close(file_fd); - return -1; - } - cddb_data->xmcd_file_size = read(file_fd, cddb_data->xmcd_file, file_size); - if( cddb_data->xmcd_file_size!=file_size ) { - MSG_FATAL("Not all the xmcd file has been read\n"); - close(file_fd); - return -1; - } - - close(file_fd); - - return 0; + cddb_data->xmcd_file = new char [file_size]; + if( cddb_data->xmcd_file==NULL ) { + mpxp_fatal<<"Memory allocation failed"<<std::endl; + ::close(file_fd); + return -1; + } + cddb_data->xmcd_file_size = ::read(file_fd, cddb_data->xmcd_file, file_size); + if( cddb_data->xmcd_file_size!=file_size ) { + mpxp_fatal<<"Not all the xmcd file has been read"<<std::endl; + ::close(file_fd); + return -1; + } + ::close(file_fd); + return 0; } static int __FASTCALL__ cddb_write_cache(cddb_data_t *cddb_data) { - // We have the file, save it for cache. - char file_name[100]; - int file_fd; - int wrote=0; + // We have the file, save it for cache. + char file_name[100]; + int file_fd; + int wrote=0; - if( cddb_data==NULL || cddb_data->cache_dir==NULL ) return -1; + if( cddb_data==NULL || cddb_data->cache_dir==NULL ) return -1; - sprintf( file_name, "%s%08lx", cddb_data->cache_dir, cddb_data->disc_id); + sprintf( file_name, "%s%08lx", cddb_data->cache_dir, cddb_data->disc_id); - file_fd = creat(file_name, S_IREAD|S_IWRITE); - if( file_fd<0 ) { - perror("open"); - return -1; - } + file_fd = ::creat(file_name, S_IREAD|S_IWRITE); + if( file_fd<0 ) { + ::perror("open"); + return -1; + } - wrote = write(file_fd, cddb_data->xmcd_file, cddb_data->xmcd_file_size); - if( wrote<0 ) { - MSG_ERR("write: %s",strerror(errno)); - close(file_fd); - return -1; - } - if( (unsigned)wrote!=cddb_data->xmcd_file_size ) { - MSG_FATAL("Not all the xmcd file has been written\n"); - close(file_fd); - return -1; - } - - close(file_fd); - - return 0; + wrote = ::write(file_fd, cddb_data->xmcd_file, cddb_data->xmcd_file_size); + if( wrote<0 ) { + mpxp_err<<"write: "<<strerror(errno)<<std::endl; + ::close(file_fd); + return -1; + } + if( (unsigned)wrote!=cddb_data->xmcd_file_size ) { + mpxp_fatal<<"Not all the xmcd file has been written"<<std::endl; + ::close(file_fd); + return -1; + } + ::close(file_fd); + return 0; } static int cddb_read_parse(HTTP_Header& http_hdr, cddb_data_t *cddb_data) { @@ -272,7 +268,7 @@ ret = sscanf(http_hdr.get_body(), "%d ", &status); if( ret!=1 ) { - MSG_ERR("Parse error\n"); + mpxp_err<<"Parse error"<<std::endl; return -1; } @@ -280,13 +276,13 @@ case 210: ret = sscanf(http_hdr.get_body(), "%d %s %08lx", &status, category, &disc_id); if( ret!=3 ) { - MSG_ERR("Parse error\n"); + mpxp_err<<"Parse error"<<std::endl; return -1; } // Check if it's a xmcd database file ptr = strstr(const_cast<char*>(http_hdr.get_body()), "# xmcd"); if( ptr==NULL ) { - MSG_ERR("Invalid xmcd database file returned\n"); + mpxp_err<<"Invalid xmcd database file returned"<<std::endl; return -1; } // Ok found the beginning of the file @@ -295,14 +291,14 @@ if( ptr2==NULL ) { ptr2 = strstr(ptr, "\n.\n"); if( ptr2==NULL ) { - MSG_ERR("Unable to find '.'\n"); + mpxp_err<<"Unable to find '.'"<<std::endl; return -1; } } // Ok found the end // do a sanity check if( http_hdr.get_body_size()<(unsigned long)(ptr2-ptr) ) { - MSG_ERR("Unexpected fix me\n"); + mpxp_err<<"Unexpected fix me"<<std::endl; return -1; } cddb_data->xmcd_file = ptr; @@ -312,7 +308,7 @@ http_hdr.erase_body(); return cddb_write_cache(cddb_data); default: - MSG_ERR("Unhandled code\n"); + mpxp_err<<"Unhandled code"<<std::endl; } return 0; } @@ -330,7 +326,7 @@ ret = sscanf(http_hdr.get_body(), "%d ", &status); if( ret!=1 ) { - MSG_ERR("Parse error\n"); + mpxp_err<<"Parse error"<<std::endl; return -1; } @@ -339,7 +335,7 @@ // Found exact match ret = sscanf(http_hdr.get_body(), "%d %s %08lx %s", &status, cddb_data->category.c_str(), &(cddb_data->disc_id), album_title); if( ret!=4 ) { - MSG_ERR("Parse error\n"); + mpxp_err<<"Parse error"<<std::endl; return -1; } ptr = strstr(const_cast<char*>(http_hdr.get_body()), album_title); @@ -355,17 +351,17 @@ strncpy(album_title, ptr, len); album_title[len-2]='\0'; } - MSG_V("Parse OK, found: %s\n", album_title); + mpxp_v<<"Parse OK, found: "<<album_title<<std::endl; return cddb_request_titles(cddb_data); case 202: // No match found - MSG_ERR("Album not found\n"); + mpxp_err<<"Album not found"<<std::endl; break; case 210: // Found exact matches, list follows ptr = strstr(const_cast<char*>(http_hdr.get_body()), "\n"); if( ptr==NULL ) { - MSG_ERR("Unable to find end of line\n"); + mpxp_err<<"Unable to find end of line"<<std::endl; return -1; } ptr++; @@ -373,7 +369,7 @@ // we use? So let's take the first one. ret = sscanf(ptr, "%s %08lx %s", cddb_data->category.c_str(), &(cddb_data->disc_id), album_title); if( ret!=3 ) { - MSG_ERR("Parse error\n"); + mpxp_err<<"Parse error"<<std::endl; return -1; } ptr = strstr(const_cast<char*>(http_hdr.get_body()), album_title); @@ -389,7 +385,7 @@ strncpy(album_title, ptr, len); album_title[len-2]='\0'; } - MSG_V("Parse OK, found: %s\n", album_title); + mpxp_v<<"Parse OK, found: "<<album_title<<std::endl; return cddb_request_titles(cddb_data); /* body=[210 Found exact matches, list follows (until terminating `.') @@ -400,10 +396,10 @@ */ case 211: // Found inexact matches, list follows - MSG_WARN("No exact matches found, list follows\n"); + mpxp_warn<<"No exact matches found, list follows"<<std::endl; break; default: - MSG_ERR("Unhandled code\n"); + mpxp_err<<"Unhandled code"<<std::endl; } return -1; } @@ -415,7 +411,7 @@ ret = sscanf(http_hdr.get_body(), "%d ", &status); if( ret!=1 ) { - MSG_ERR("Parse error\n"); + mpxp_err<<"Parse error"<<std::endl; return -1; } @@ -423,18 +419,18 @@ case 210: ptr = strstr(const_cast<char*>(http_hdr.get_body()), "max proto:"); if( ptr==NULL ) { - MSG_ERR("Parse error\n"); + mpxp_err<<"Parse error"<<std::endl; return -1; } ret = sscanf(ptr, "max proto: %d", &max); if( ret!=1 ) { - MSG_ERR("Parse error\n"); + mpxp_err<<"Parse error"<<std::endl; return -1; } cddb_data->freedb_proto_level = max; return 0; default: - MSG_ERR("Unhandled code\n"); + mpxp_err<<"Unhandled code"<<std::endl; } return -1; } @@ -448,7 +444,7 @@ UNUSED(cddb_data); ret = sscanf((const char*)http_hdr.get_body(), "%d ", &status); if( ret!=1 ) { - MSG_ERR("Parse error\n"); + mpxp_err<<"Parse error"<<std::endl; return -1; } @@ -457,10 +453,10 @@ // Parse the sites return 0; case 401: - MSG_ERR("No sites information available\n"); + mpxp_err<<"No sites information available"<<std::endl; break; default: - MSG_ERR("Unhandled code\n"); + mpxp_err<<"Unhandled code"<<std::endl; } return -1; } @@ -508,7 +504,7 @@ cddb_create_hello(cddb_data); if( cddb_get_proto_level(cddb_data)<0 ) { - MSG_ERR("Failed to get the protocol level\n"); + mpxp_err<<"Failed to get the protocol level"<<std::endl; return -1; } @@ -539,7 +535,7 @@ } else { cddb_data.cache_dir = (char*)mp_malloc(strlen(home_dir)+strlen(cddb_cache_dir)+1); if( cddb_data.cache_dir==NULL ) { - MSG_FATAL("Memory allocation failed\n"); + mpxp_fatal<<"Memory allocation failed"<<std::endl; return MPXP_False; } sprintf(cddb_data.cache_dir, "%s%s", home_dir, cddb_cache_dir ); @@ -553,7 +549,6 @@ } if( cddb_data.xmcd_file!=NULL ) { -// printf("%s\n", cddb_data.xmcd_file ); *xmcd_file = cddb_data.xmcd_file; return MPXP_Ok; } @@ -590,8 +585,8 @@ cd_track = new(zeromem) cd_track_t; if( cd_track==NULL ) { - MSG_FATAL("Memory allocation failed\n"); - return NULL; + mpxp_fatal<<"Memory allocation failed"<<std::endl; + return NULL; } cd_track->name=track_name; cd_track->track_nb = track_nb; @@ -627,23 +622,23 @@ void CD_Info::print() const { cd_track_t *current_track; - MSG_INFO("================ CD INFO === start =========\n"); - MSG_INFO(" artist=[%s]\n" - " album=[%s]\n" - " genre=[%s]\n" - " nb_tracks=%d\n" - " length= %2d:%02d.%02d\n" - , artist.c_str() - , album.c_str() - , genre.c_str() - , nb_tracks - , min, sec, msec); + mpxp_info<<"================ CD INFO === start ========="<<std::endl; + mpxp_info<<" artist=["<<artist<<"]"<<std::endl; + mpxp_info<<" album=["<<album<<"]"<<std::endl; + mpxp_info<<" genre=["<<genre<<"]"<<std::endl; + mpxp_info<<" nb_tracks="<<nb_tracks<<std::endl; + mpxp_info<<" length= "<<min<<":"<<sec<<"."<<msec<<std::endl; current_track = first; while( current_track!=NULL ) { - MSG_V(" #%2d %2d:%02d.%02d @ %7ld\t[%s] \n", current_track->track_nb, current_track->min, current_track->sec, current_track->msec, current_track->frame_begin, current_track->name.c_str()); + mpxp_v<<" #"<<current_track->track_nb + <<" "<<current_track->min + <<":"<<current_track->sec + <<"."<<current_track->msec + <<" @ "<<current_track->frame_begin<<"\t[" + <<current_track->name<<"]"<<std::endl; current_track = current_track->next; } - MSG_INFO("================ CD INFO === end =========\n"); + mpxp_info<<"================ CD INFO === end ========="<<std::endl; } static char* __FASTCALL__ xmcd_parse_dtitle(CD_Info& cd_info,char *line) { Modified: mplayerxp/libmpstream2/cookies.cpp =================================================================== --- mplayerxp/libmpstream2/cookies.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/cookies.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -101,24 +101,24 @@ int fd; char *buffer; - MSG_V("Loading cookie file: %s\n", filename); + mpxp_v<<"Loading cookie file: "<<filename<<std::endl; fd = open(filename, O_RDONLY); if (fd < 0) { - MSG_V("Could not open"); + mpxp_v<<"Could not open"<<std::endl; return NULL; } *length = lseek(fd, 0, SEEK_END); if (*length < 0) { - MSG_V("Could not find EOF"); + mpxp_v<<"Could not find EOF"<<std::endl; close(fd); return NULL; } if (unsigned(*length) > std::numeric_limits<size_t>::max() - 1) { - MSG_V("File too big, could not mp_malloc."); + mpxp_v<<"File too big, could not mp_malloc"<<std::endl; close(fd); return NULL; } @@ -126,14 +126,14 @@ lseek(fd, SEEK_SET, 0); if (!(buffer = new char [*length + 1])) { - MSG_V("Could not mp_malloc."); + mpxp_v<<"Could not mp_malloc"<<std::endl; close(fd); return NULL; } if (read(fd, buffer, *length) != *length) { delete buffer; - MSG_V("Read is behaving funny."); + mpxp_v<<"Read is behaving funny"<<std::endl; close(fd); return NULL; } @@ -151,7 +151,7 @@ char *ptr; off_t length; - MSG_V("Loading cookie file: %s\n", filename); + mpxp_v<<"Loading cookie file: "<<filename<<std::endl; ptr = load_file(filename, &length); if (!ptr) Modified: mplayerxp/libmpstream2/http.cpp =================================================================== --- mplayerxp/libmpstream2/http.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/http.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -30,12 +30,12 @@ if( response==NULL) return -1; if( (unsigned)length > std::numeric_limits<size_t>::max() - buffer_size - 1) { - MSG_FATAL("Bad size in memory (re)allocation\n"); + mpxp_fatal<<"Bad size in memory (re)allocation"<<std::endl; return -1; } buffer = (uint8_t*)mp_realloc( buffer, buffer_size+length+1 ); if(buffer ==NULL ) { - MSG_FATAL("Memory allocation failed\n"); + mpxp_fatal<<"Memory allocation failed"<<std::endl; return -1; } memcpy( buffer+buffer_size, response, length ); @@ -62,7 +62,7 @@ // Get the protocol hdr_ptr = strstr( (char*)buffer, " " ); if( hdr_ptr==NULL ) { - MSG_FATAL("Malformed answer. No space separator found.\n"); + mpxp_fatal<<"Malformed answer. No space separator found"<<std::endl; return -1; } len = hdr_ptr-(char*)buffer; @@ -71,14 +71,14 @@ std::transform(sstr.begin(), sstr.end(),sstr.begin(), ::toupper); if(sstr=="HTTP") { if( sscanf( &protocol.c_str()[5],"1.%d", &(http_minor_version) )!=1 ) { - MSG_FATAL("Malformed answer. Unable to get HTTP minor version.\n"); + mpxp_fatal<<"Malformed answer. Unable to get HTTP minor version"<<std::endl; return -1; } } // Get the status code if( sscanf( ++hdr_ptr, "%d", &status_code )!=1 ) { - MSG_FATAL("Malformed answer. Unable to get status code.\n"); + mpxp_fatal<<"Malformed answer. Unable to get status code"<<std::endl; return -1; } hdr_ptr += 4; @@ -86,7 +86,7 @@ // Get the reason phrase ptr = strstr( hdr_ptr, "\n" ); if( hdr_ptr==NULL ) { - MSG_FATAL("Malformed answer. Unable to get the reason phrase.\n"); + mpxp_fatal<<"Malformed answer. Unable to get the reason phrase"<<std::endl; return -1; } len = ptr-hdr_ptr; @@ -103,7 +103,7 @@ if( ptr==NULL ) { ptr = strstr( (char*)buffer, "\n\n" ); if( ptr==NULL ) { - MSG_ERR("Header may be incomplete. No CRLF CRLF found.\n"); + mpxp_err<<"Header may be incomplete. No CRLF CRLF found"<<std::endl; return -1; } hdr_sep_len = 2; @@ -119,7 +119,7 @@ if( len==0 ) break; field = (char*)mp_realloc(field, len+1); if( field==NULL ) { - MSG_FATAL("Memory allocation failed\n"); + mpxp_fatal<<"Memory allocation failed"<<std::endl; return -1; } strncpy( field, hdr_ptr, len ); @@ -165,7 +165,7 @@ } buffer = new uint8_t [len+1]; if( buffer==NULL ) { - MSG_FATAL("Memory allocation failed\n"); + mpxp_fatal<<"Memory allocation failed"<<std::endl; return NULL; } buffer_size = len; @@ -234,7 +234,7 @@ usr_pass = new char [username.length()+pass_len+2]; if( usr_pass==NULL ) { - MSG_FATAL("Memory allocation failed\n"); + mpxp_fatal<<"Memory allocation failed"<<std::endl; goto out; } @@ -244,13 +244,13 @@ encoded_len = strlen(usr_pass)*2; b64_usr_pass = new char [encoded_len]; if( b64_usr_pass==NULL ) { - MSG_FATAL("Memory allocation failed\n"); + mpxp_fatal<<"Memory allocation failed"<<std::endl; goto out; } out_len = base64_encode( usr_pass, strlen(usr_pass), b64_usr_pass, encoded_len); if( out_len<0 ) { - MSG_FATAL("Base64 out overflow\n"); + mpxp_fatal<<"Base64 out overflow"<<std::endl; goto out; } @@ -258,7 +258,7 @@ auth = new char [encoded_len+22]; if( auth==NULL ) { - MSG_FATAL("Memory allocation failed\n"); + mpxp_fatal<<"Memory allocation failed"<<std::endl; goto out; } @@ -280,26 +280,19 @@ void HTTP_Header::debug_hdr( ) { unsigned i = 0; - MSG_V( "--- HTTP DEBUG HEADER --- START ---\n" - "protocol: [%s]\n" - "http minor version: [%d]\n" - "uri: [%s]\n" - "method: [%s]\n" - "status code: [%d]\n" - "reason phrase: [%s]\n" - "body size: [%d]\n" - ,protocol.c_str() - ,http_minor_version - ,uri.c_str() - ,method.c_str() - ,status_code - ,reason_phrase.c_str() - ,body.length() ); + mpxp_v<<"--- HTTP DEBUG HEADER --- START ---"<<std::endl; + mpxp_v<<"protocol: ["<<protocol<<"]"<<std::endl; + mpxp_v<<"http minor version: ["<<http_minor_version<<"]"<<std::endl; + mpxp_v<<"uri: ["<<uri<<"]"<<std::endl; + mpxp_v<<"method: ["<<method<<"]"<<std::endl; + mpxp_v<<"status code: ["<<status_code<<"]"<<std::endl; + mpxp_v<<"reason phrase: ["<<reason_phrase<<"]"<<std::endl; + mpxp_v<<"body size: ["<<body.length()<<"]"<<std::endl; - MSG_V("Fields:\n"); + mpxp_v<<"Fields:"<<std::endl; std::vector<std::string>::size_type sz = fields.size(); - for(i=0;i<sz;i++) MSG_V(" %d - %s\n", i, fields[i].c_str()); - MSG_V("--- HTTP DEBUG HEADER --- END ---\n"); + for(i=0;i<sz;i++) mpxp_v<<" "<<i<<" - "<<fields[i]<<std::endl; + mpxp_v<<"--- HTTP DEBUG HEADER --- END ---"<<std::endl; } int HTTP_Header::authenticate(URL& url, int *auth_retry) { @@ -316,15 +309,15 @@ const char *aut_space; aut_space = strstr(aut, "realm="); if( aut_space!=NULL ) aut_space += 6; - MSG_INFO("Authentication required for %s\n", aut_space); + mpxp_info<<"Authentication required for "<<aut_space<<std::endl; } else { - MSG_INFO("Authentication required\n"); + mpxp_info<<"Authentication required"<<std::endl; } if( !net_conf.username ) { mpxp_err<<MSGTR_ConnAuthFailed<<std::endl; return -1; } - if( !net_conf.password ) MSG_INFO("No password provided, trying blank password\n"); + if( !net_conf.password ) mpxp_info<<"No password provided, trying blank password"<<std::endl; url.set_login(net_conf.username,net_conf.password?net_conf.password:""); (*auth_retry)++; return 0; Modified: mplayerxp/libmpstream2/librtsp/rtsp.cpp =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/librtsp/rtsp.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -179,7 +179,7 @@ } if (n>=BUF_SIZE) { - MSG_FATAL("librtsp: buffer overflow in rtsp_get\n"); + mpxp_fatal<<"librtsp: buffer overflow in rtsp_get"<<std::endl; exit(1); } string=new char [n]; @@ -187,7 +187,7 @@ string[n-1]=0; #ifdef LOG - MSG_INFO("librtsp: << '%s'\n", string); + mpxp_info<<"librtsp: << "<<string<<std::endl; #endif delete buffer; @@ -203,7 +203,7 @@ char *buf=new char [len+2]; #ifdef LOG - MSG_INFO("librtsp: >> '%s'", string); + mpxp_info<<"librtsp: >> "<<string<<std::endl; #endif memcpy(buf,string,len); @@ -213,7 +213,7 @@ write_stream(buf, len+2); #ifdef LOG - MSG_INFO(" done.\n"); + mpxp_info>>" done"<<std::endl; #endif delete buf; } @@ -233,7 +233,7 @@ } else if (!strncmp(string, RTSP_METHOD_SET_PARAMETER,8)) { return RTSP_STATUS_SET_PARAMETER; } - if(code != RTSP_STATUS_OK) MSG_INFO("librtsp: server responds: '%s'\n",string); + if(code != RTSP_STATUS_OK) mpxp_info<<"librtsp: server responds: "<<string<<std::endl; return code; } @@ -303,7 +303,7 @@ sscanf(answer,"%*s %u",&answer_seq); if (cseq != answer_seq) { #ifdef LOG - MSG_WARN("librtsp: warning: CSeq mismatch. got %u, assumed %u", answer_seq, s->cseq); + mpxp_warn<<"librtsp: warning: CSeq mismatch. got "<<answer_seq<<", assumed "<<s->cseq<<std::endl; #endif cseq=answer_seq; } @@ -320,13 +320,13 @@ sscanf(answer,"%*s %s",buf); if (session) { if (strcmp(buf, session)) { - MSG_WARN("rtsp: warning: setting NEW session: %s\n", buf); + mpxp_warn<<"rtsp: warning: setting NEW session: "<<buf<<std::endl; delete session; session=mp_strdup(buf); } } else { #ifdef LOG - MSG_INFO("rtsp: setting session id to: %s\n", buf); + mpxp_info<<"rtsp: setting session id to: "<<buf<<std::endl; #endif session=mp_strdup(buf); } @@ -473,7 +473,7 @@ delete rest; if (seq<0) { #ifdef LOG - MSG_WARN("rtsp: warning: CSeq not recognized!\n"); + mpxp_warn<<"rtsp: warning: CSeq not recognized!"<<std::endl; #endif seq=1; } @@ -491,7 +491,7 @@ } } else i=read_stream(buffer, size); #ifdef LOG - MSG_INFO("librtsp: << %d of %d bytes\n", i, size); + mpxp_info<<"librtsp: << "<<i<<" of "<<size<<" bytes"<<std::endl; #endif return i; } @@ -533,7 +533,7 @@ s.param++; if (!tcp.established()) { - MSG_ERR("rtsp: failed to connect to '%s'\n", s.host); + mpxp_err<<"rtsp: failed to connect to "<<s.host<<std::endl; s.close(); delete &s; return NULL; Modified: mplayerxp/libmpstream2/librtsp/rtsp_rtp.cpp =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp_rtp.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/librtsp/rtsp_rtp.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -241,7 +241,7 @@ /* Increase the socket rx buffer size to maximum -- this is UDP */ rxsockbufsz = 240 * 1024; if (::setsockopt (s, SOL_SOCKET, SO_RCVBUF, &rxsockbufsz, sizeof (rxsockbufsz))) - MSG_ERR("Couldn't set receive socket buffer size\n"); + mpxp_err<<"Couldn't set receive socket buffer size"<<std::endl; /* if multicast address, add membership */ if ((::ntohl (sin.sin_addr.s_addr) >> 28) == 0xe) { @@ -250,7 +250,7 @@ mcast.imr_interface.s_addr = 0; if (::setsockopt (s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mcast, sizeof (mcast))) { - MSG_ERR("IP_ADD_MEMBERSHIP failed\n"); + mpxp_err<<"IP_ADD_MEMBERSHIP failed"<<std::endl; ::close (s); return -1; } @@ -264,7 +264,7 @@ if (WSAGetLastError() != WSAEINPROGRESS) #endif { - MSG_ERR("bind: %s\n", strerror (errno)); + mpxp_err<<"bind: "<<strerror(errno)<<std::endl; ::close (s); return -1; } @@ -278,11 +278,11 @@ err = ::select (s + 1, &set, NULL, NULL, &tv); if (err < 0) { - MSG_ERR("Select failed: %s\n", strerror (errno)); + mpxp_err<<"Select failed: "<<strerror (errno)<<std::endl; ::close (s); return -1; } else if (err == 0) { - MSG_ERR("Timeout! No data from host %s\n", hostname); + mpxp_err<<"Timeout! No data from host "<<hostname<<std::endl; ::close (s); return -1; } @@ -290,7 +290,7 @@ err_len = sizeof (err); ::getsockopt (s, SOL_SOCKET, SO_ERROR, &err, (socklen_t *) &err_len); if (err) { - MSG_ERR("Socket error: %d\n", err); + mpxp_err<<"Socket error: "<<err<<std::endl; ::close (s); return -1; } @@ -369,12 +369,12 @@ fsdp_description_delete (dsc); return NULL; } - MSG_V("SDP:\n%s\n", sdp); + mpxp_v<<"SDP: "<<sdp<<std::endl; delete sdp; /* 4. check for number of media streams: only one is supported */ if (fsdp_get_media_count (dsc) != 1) { - MSG_ERR("A single media stream only is supported atm.\n"); + mpxp_err<<"A single media stream only is supported atm"<<std::endl; fsdp_description_delete (dsc); return NULL; } @@ -429,8 +429,8 @@ /* RTCP port generally is RTP port + 1 */ client_rtcp_port = client_rtp_port + 1; - MSG_V("RTP Port from SDP appears to be: %d\n", client_rtp_port); - MSG_V("RTCP Port from SDP appears to be: %d\n", client_rtcp_port); + mpxp_v<<"RTP Port from SDP appears to be: "<<client_rtp_port<<std::endl; + mpxp_v<<"RTCP Port from SDP appears to be: "<<client_rtcp_port<<std::endl; /* 7. parse the `c=<network type> <addr type> <connection address>' line */ /* check for a valid media network type (inet) */ @@ -491,7 +491,7 @@ is_multicast ? RTSP_TRANSPORT_MULTICAST : RTSP_TRANSPORT_UNICAST, is_multicast ? RTSP_MULTICAST_PORT : RTSP_UNICAST_CLIENT_PORT, client_rtp_port, client_rtcp_port); - MSG_V("RTSP Transport: %s\n", temp_buf); + mpxp_v<<"RTSP Transport: "<<temp_buf<<std::endl; rtsp.unschedule_field (RTSP_SESSION); rtsp.schedule_field (temp_buf); @@ -537,16 +537,11 @@ if (!destination) destination = mp_strdup (server_addr); delete server_addr; - MSG_V("RTSP Destination: %s\n" - "Client RTP port : %d\n" - "Client RTCP port : %d\n" - "Server RTP port : %d\n" - "Server RTCP port : %d\n" - , destination - , client_rtp_port - , client_rtcp_port - , server_rtp_port - , server_rtcp_port); + mpxp_v<<"RTSP Destination: "<<destination<<std::endl; + mpxp_v<<"Client RTP port : "<<client_rtp_port<<std::endl; + mpxp_v<<"Client RTCP port : "<<client_rtcp_port<<std::endl; + mpxp_v<<"Server RTP port : "<<server_rtp_port<<std::endl; + mpxp_v<<"Server RTCP port : "<<server_rtcp_port<<std::endl; /* 12. performs RTSP PLAY request */ rtsp.schedule_field (npt); @@ -563,7 +558,7 @@ rtp_session->set_fd (rtp_sock, rtcp_sock); delete destination; - MSG_V("RTP Sock : %d\nRTCP Sock : %d\n",rtp_session->rtp_socket, rtp_session->rtcp_socket); + mpxp_v<<"RTP Sock : "<<rtp_session->rtp_socket<<" RTCP Sock : "<<rtp_session->rtcp_socket<<std::endl; if (rtp_session->rtp_socket == -1) { delete rtp_session; Modified: mplayerxp/libmpstream2/librtsp/rtsp_session.cpp =================================================================== --- mplayerxp/libmpstream2/librtsp/rtsp_session.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/librtsp/rtsp_session.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -91,7 +91,7 @@ rtsp_session->s=Rtsp::connect(tcp,*mrl,path.c_str(),host.c_str(),port,NULL); if (!rtsp_session->s) { - MSG_ERR("rtsp_session: failed to connect to server %s\n", path.c_str()); + mpxp_err<<"rtsp_session: failed to connect to server "<<path<<std::endl; delete rtsp_session; return NULL; } @@ -116,7 +116,7 @@ { delete mrl_line; mrl_line=mp_strdup(rtsp_session->s->search_answers(RTSP_OPTIONS_LOCATION)); - MSG_INFO("rtsp_session: redirected to %s\n", mrl_line); + mpxp_info<<"rtsp_session: redirected to "<<mrl_line<<std::endl; rtsp_session->s->close(); delete server; delete *mrl; @@ -128,7 +128,7 @@ // goto connect; /* *shudder* i made a design mistake somewhere */ } else { - MSG_ERR("rtsp_session: session can not be established.\n"); + mpxp_err<<"rtsp_session: session can not be established"<<std::endl; rtsp_session->s->close(); delete server; delete rtsp_session; @@ -142,13 +142,13 @@ rtsp_session->real_session->header_len = 0; rtsp_session->real_session->recv_size = 0; rtsp_session->real_session->rdt_rawdata = 1; - MSG_V("smil-over-realrtsp playlist, switching to raw rdt mode\n"); + mpxp_v<<"smil-over-realrtsp playlist, switching to raw rdt mode"<<std::endl; } else { rtsp_session->real_session->header_len = rmff_dump_header (h, (char *) rtsp_session->real_session->header, HEADER_SIZE); if (rtsp_session->real_session->header_len < 0) { - MSG_ERR("rtsp_session: error while dumping RMFF headers, session can not be established.\n"); + mpxp_err<<"rtsp_session: error while dumping RMFF headers, session can not be established"<<std::endl; free_real_rtsp_session(rtsp_session->real_session); rtsp_session->s->close(); delete server; @@ -186,7 +186,7 @@ || !strstr (publics, RTSP_METHOD_PLAY) || !strstr (publics, RTSP_METHOD_TEARDOWN)) { - MSG_ERR("Remote server does not meet minimal RTSP 1.0 compliance.\n"); + mpxp_err<<"Remote server does not meet minimal RTSP 1.0 compliance"<<std::endl; rtsp_session->s->close (); delete server; delete mrl_line; @@ -201,7 +201,7 @@ /* neither a Real or an RTP server */ if (!rtsp_session->rtp_session) { - MSG_ERR("rtsp_session: unsupported RTSP server. Server type is '%s'.\n", server); + mpxp_err<<"rtsp_session: unsupported RTSP server. Server type is "<<server<<std::endl; rtsp_session->s->close (); delete server; delete mrl_line; @@ -241,7 +241,7 @@ fill = real_session->recv_size; if (real_session->recv_size == 0) { #ifdef LOG - MSG_INFO("librtsp: %d of %d bytes provided\n", len-to_copy, len); + mpxp_info<<"librtsp: "<<(len-to_copy)<<" of "<<len<<" bytes provided"<<std::endl; #endif return len-to_copy; } @@ -249,7 +249,7 @@ memcpy(dest, source, to_copy); real_session->recv_read += to_copy; #ifdef LOG - MSG_INFO("librtsp: %d bytes provided\n", len); + mpxp_info<<"librtsp: "<<len<<" bytes provided"<<std::endl; #endif return len; } else if (rtp_session) { Modified: mplayerxp/libmpstream2/mrl.cpp =================================================================== --- mplayerxp/libmpstream2/mrl.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/mrl.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -86,7 +86,7 @@ static void mrl_store_args(const std::string& arg,char *value, const mrl_config_t * args) { #ifdef TEST_MRL - printf("arg='%s' value='%s'\n",arg,value); + mpxp_info<<"arg='"<<arg<<"' value='"<<value<<std::endl; return; #endif unsigned i; @@ -97,7 +97,7 @@ done=1; switch(args[i].type) { case MRL_TYPE_PRINT: - MSG_INFO("%s", (char *)args[i].value); + mpxp_info<<(char *)args[i].value<<std::endl; default: delete value; break; @@ -136,7 +136,7 @@ } i++; } - if(!done) MSG_WARN(" Can't handle argument: '%s'",arg.c_str()); + if(!done) mpxp_warn<<" Can't handle argument: "<<arg<<std::endl; } #define MRL_ARG_SEP ',' Modified: mplayerxp/libmpstream2/network.cpp =================================================================== --- mplayerxp/libmpstream2/network.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/network.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -114,12 +114,12 @@ server_url.assign_port(80); tcp.open(server_url, Tcp::IP4); } - if(!tcp.established()) { MSG_ERR("Cannot establish connection\n"); goto err_out; } - MSG_DBG2("Request: [%s]\n", http_hdr.get_buffer() ); + if(!tcp.established()) { mpxp_err<<"Cannot establish connection"<<std::endl; goto err_out; } + mpxp_dbg2<<"Request: ["<<http_hdr.get_buffer()<<"]"<<std::endl; ret = tcp.write((uint8_t*)(http_hdr.get_buffer()), http_hdr.get_buffer_size()); if( ret!=(int)http_hdr.get_buffer_size() ) { - MSG_ERR("Error while sending HTTP request: didn't sent all the request\n"); + mpxp_err<<"Error while sending HTTP request: didn't sent all the request"<<std::endl; goto err_out; } @@ -131,28 +131,28 @@ } HTTP_Header* http_read_response( Tcp& tcp ) { - HTTP_Header* http_hdr = new(zeromem) HTTP_Header; - uint8_t response[BUFFER_SIZE]; - int i; + HTTP_Header* http_hdr = new(zeromem) HTTP_Header; + uint8_t response[BUFFER_SIZE]; + int i; - if( http_hdr==NULL ) return NULL; + if( http_hdr==NULL ) return NULL; - do { - i = tcp.read(response, BUFFER_SIZE); - if( i<0 ) { - MSG_ERR("Read failed\n"); - delete http_hdr; - return NULL; - } - if( i==0 ) { - MSG_ERR("http_read_response read 0 -ie- EOF\n"); - delete http_hdr; - return NULL; - } - http_hdr->response_append(response,i); - } while( !http_hdr->is_header_entire() ); - http_hdr->response_parse(); - return http_hdr; + do { + i = tcp.read(response, BUFFER_SIZE); + if( i<0 ) { + mpxp_err<<"Read failed"<<std::endl; + delete http_hdr; + return NULL; + } + if( i==0 ) { + mpxp_err<<"http_read_response read 0 -ie- EOF"<<std::endl; + delete http_hdr; + return NULL; + } + http_hdr->response_append(response,i); + } while( !http_hdr->is_header_entire() ); + http_hdr->response_parse(); + return http_hdr; } off_t http_seek(Tcp& tcp, Networking& networking, off_t pos ) { @@ -168,8 +168,8 @@ switch( http_hdr->get_status() ) { case 200: case 206: // OK - MSG_V("Content-Type: [%s]\n", http_hdr->get_field("Content-Type") ); - MSG_V("Content-Length: [%s]\n", http_hdr->get_field("Content-Length") ); + mpxp_v<<"Content-Type: ["<<http_hdr->get_field("Content-Type")<<"]"<<std::endl; + mpxp_v<<"Content-Length: ["<<http_hdr->get_field("Content-Length")<<"]"<<std::endl; if( http_hdr->get_body_size()>0 ) { if( networking.bufferize((unsigned char *)http_hdr->get_body(), http_hdr->get_body_size() )<0 ) { delete http_hdr; @@ -178,7 +178,7 @@ } break; default: - MSG_ERR("Server return %d: %s\n", http_hdr->get_status(), http_hdr->get_reason_phrase()); + mpxp_err<<"Server return "<<http_hdr->get_status()<<": "<<http_hdr->get_reason_phrase()<<std::endl; tcp.close(); } @@ -221,7 +221,7 @@ // Checking for RTP if( url.protocol2lower()=="rtp") { if( url.port()==0 ) { - MSG_ERR("You must enter a port number for RTP streams!\n"); + mpxp_err<<"You must enter a port number for RTP streams!"<<std::endl; goto err_out; } return MPXP_Ok; @@ -251,34 +251,34 @@ // note: I skip icy-notice1 and 2, as they contain html <BR> // and are IMHO useless info ::atmos if( (field_data = http_hdr->get_field("icy-name")) != NULL ) - MSG_INFO("Name : %s\n", field_data); field_data = NULL; + mpxp_info<<"Name : "<<field_data<<std::endl; field_data = NULL; if( (field_data = http_hdr->get_field("icy-genre")) != NULL ) - MSG_INFO("Genre : %s\n", field_data); field_data = NULL; + mpxp_info<<"Genre : "<<field_data<<std::endl; field_data = NULL; if( (field_data = http_hdr->get_field("icy-url")) != NULL ) - MSG_INFO("Website: %s\n", field_data); field_data = NULL; + mpxp_info<<"Website: "<<field_data<<std::endl; field_data = NULL; // XXX: does this really mean public server? ::atmos if( (field_data = http_hdr->get_field("icy-pub")) != NULL ) - MSG_INFO("Public : %s\n", atoi(field_data)?"yes":"no"); field_data = NULL; + mpxp_info<<"Public : "<<(atoi(field_data)?"yes":"no")<<std::endl; field_data = NULL; if( (field_data = http_hdr->get_field("icy-br")) != NULL ) - MSG_INFO("Bitrate: %skbit/s\n", field_data); field_data = NULL; + mpxp_info<<"Bitrate: "<<field_data<<"kbit/s"<<std::endl; field_data = NULL; if ( (field_data = http_hdr->get_field("content-type")) != NULL ) networking.mime = field_data; return MPXP_Ok; } case 400: // Server Full - MSG_ERR("Error: ICY-Server is full, skipping!\n"); + mpxp_err<<"Error: ICY-Server is full, skipping!"<<std::endl; goto err_out; case 401: // Service Unavailable - MSG_ERR("Error: ICY-Server return service unavailable, skipping!\n"); + mpxp_err<<"Error: ICY-Server return service unavailable, skipping!"<<std::endl; goto err_out; case 403: // Service Forbidden - MSG_ERR("Error: ICY-Server return 'Service Forbidden'\n"); + mpxp_err<<"Error: ICY-Server return 'Service Forbidden'"<<std::endl; goto err_out; case 404: // Resource Not Found - MSG_ERR("Error: ICY-Server couldn't find requested stream, skipping!\n"); + mpxp_err<<"Error: ICY-Server couldn't find requested stream, skipping!"<<std::endl; goto err_out; default: - MSG_ERR("Error: unhandled ICY-Errorcode, contact MPlayer developers!\n"); + mpxp_err<<"Error: unhandled ICY-Errorcode, contact MPlayer developers!"<<std::endl; goto err_out; } } @@ -290,9 +290,9 @@ content_type = http_hdr->get_field("Content-Type" ); if( content_type!=NULL ) { const char *content_length = NULL; - MSG_V("Content-Type: [%s]\n", content_type ); + mpxp_v<<"Content-Type: ["<<content_type<<"]"<<std::endl; if( (content_length = http_hdr->get_field("Content-Length")) != NULL) - MSG_V("Content-Length: [%s]\n", http_hdr->get_field("Content-Length")); + mpxp_v<<"Content-Length: ["<<http_hdr->get_field("Content-Length")<<"]"<<std::endl; } // Not found in the mime type table, don't fail, // we should try raw HTTP @@ -306,7 +306,7 @@ url.redirect(next_url); if (url.protocol2lower()=="mms") goto err_out; if (url.protocol2lower()=="http") { - MSG_WARN("Unsupported http %d redirect to %s protocol\n", http_hdr->get_status(), url.protocol().c_str()); + mpxp_warn<<"Unsupported http "<<http_hdr->get_status()<<" redirect to "<<url.protocol()<<" protocol"<<std::endl; goto err_out; } redirect = 1; @@ -317,11 +317,11 @@ redirect = 1; break; default: - MSG_ERR("Server returned %d: %s\n", http_hdr->get_status(), http_hdr->get_reason_phrase()); + mpxp_err<<"Server returned "<<http_hdr->get_status()<<": "<<http_hdr->get_reason_phrase()<<std::endl; goto err_out; } } else { - MSG_ERR("Unknown protocol '%s'\n", url.protocol().c_str()); + mpxp_err<<"Unknown protocol: "<<url.protocol()<<std::endl; goto err_out; } } while( redirect ); @@ -332,10 +332,9 @@ } int Networking::bufferize(unsigned char *_buffer, int size) { -//printf("networking_bufferize\n"); buffer = new char [size]; if( buffer==NULL ) { - MSG_FATAL(MSGTR_OutOfMemory); + mpxp_fatal<<MSGTR_OutOfMemory<<std::endl; return -1; } memcpy( buffer, _buffer, size ); @@ -351,7 +350,7 @@ mp_conf.s_cache_size = (prebuffer_size/1024)*5; if( mp_conf.s_cache_size<64 ) mp_conf.s_cache_size = 64; // 16KBytes min buffer } - MSG_INFO("[network] cache size set to: %i\n", mp_conf.s_cache_size); + mpxp_info<<"[network] cache size set to: "<<mp_conf.s_cache_size<<std::endl; } } @@ -373,18 +372,18 @@ tcp.close(); rc = Pnm_Networking::start(tcp, net_protocol); if (!rc) { - MSG_INFO("Can't connect with pnm, retrying with http.\n"); + mpxp_info<<"Can't connect with pnm, retrying with http"<<std::endl; return NULL; } } else if( url.protocol2lower()=="rtsp") { if ((rc = RealRtsp_Networking::start( tcp, net_protocol )) == NULL) { - MSG_INFO("Not a Realmedia rtsp url. Trying standard rtsp protocol.\n"); + mpxp_info<<"Not a Realmedia rtsp url. Trying standard rtsp protocol"<<std::endl; #ifdef STREAMING_LIVE_DOT_COM rc = Rtsp_Networking::start( tcp, net_protocol ); - if(!rc) MSG_ERR("rtsp_networking_start failed\n"); + if(!rc) mpxp_err<<"rtsp_networking_start failed"<<std::endl; return rc; #else - MSG_ERR("RTSP support requires the \"LIVE.COM Streaming Media\" libraries!\n"); + mpxp_err<<"RTSP support requires the \"LIVE.COM Streaming Media\" libraries!"<<std::endl; return NULL; #endif } @@ -392,7 +391,7 @@ tcp.close(); rc = Rtp_Networking::start(tcp, net_protocol, 1); if(!rc) { - MSG_ERR("rtp_networking_start(udp) failed\n"); + mpxp_err<<"rtp_networking_start(udp) failed"<<std::endl; return NULL; } } else if(url.protocol2lower()=="mms" || @@ -400,7 +399,7 @@ url.protocol2lower()=="mmsu") { rc=Asf_Mmst_Networking::start(tcp,net_protocol); if(!rc) { - MSG_ERR("asf_mmst_networking_start() failed\n"); + mpxp_err<<"asf_mmst_networking_start() failed"<<std::endl; return NULL; } } else { @@ -414,14 +413,14 @@ //sometimes a file is just on a webserver and it is not streamed. //try loading them default method as last resort for http protocol if (url.protocol2lower()=="http") { - MSG_STATUS("Trying default networking for http protocol\n "); + mpxp_status<<"Trying default networking for http protocol"<<std::endl; //reset stream tcp.close(); rc=Nop_Networking::start(tcp,net_protocol); } if (!rc) { - MSG_ERR("asf_networking_start failed\n"); - MSG_STATUS("Check if this is a playlist which requires -playlist option\nExample: mplayer -playlist <url>\n"); + mpxp_err<<"asf_networking_start failed"<<std::endl; + mpxp_status<<"Check if this is a playlist which requires -playlist option"<<std::endl<<"Example: mplayer -playlist <url>"<<std::endl; } } } Modified: mplayerxp/libmpstream2/network_asf.cpp =================================================================== --- mplayerxp/libmpstream2/network_asf.cpp 2012-12-21 17:47:42 UTC (rev 594) +++ mplayerxp/libmpstream2/network_asf.cpp 2012-12-22 12:15:42 UTC (rev 595) @@ -56,36 +56,36 @@ static int asf_networking(ASF_stream_chunck_t *stream_chunck, int *drop_packet ) { - if( drop_packet!=NULL ) *drop_packet = 0; + if( drop_packet!=NULL ) *drop_packet = 0; - if( stream_chunck->size<8 ) { - MSG_ERR("Ahhhh, stream_chunck size is too small: %d\n", stream_chunck->size); - return -1; - } - if( stream_chunck->size!=stream_chunck->size_confirm ) { - MSG_ERR("size_confirm mismatch!: %d %d\n", stream_chunck->size, stream_chunck->size_confirm); - return -1; - } - switch(stream_chunck->type) { - case ASF_STREAMING_CLEAR: // $C Clear ASF configuration - MSG_V("=====> Clearing ASF stream configuration!\n"); - if( drop_packet!=NULL ) *drop_packet = 1; - return stream_chunck->size; - break; - case ASF_STREAMING_DATA: // $D Data follows - break; - case ASF_STREAMING_END_TRANS: // $E Transfer complete - MSG_V("=====> Transfer complete\n"); - if( drop_packet!=NULL ) *drop_packet = 1; - return stream_chunck->size; - break; - case ASF_STREAMING_HEADER: // $H ASF header chunk follows - MSG_V("=====> ASF header chunk follows\n"); - break; - default... [truncated message content] |