[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[370] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-11-15 06:58:33
|
Revision: 370 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=370&view=rev Author: nickols_k Date: 2012-11-15 06:58:22 +0000 (Thu, 15 Nov 2012) Log Message: ----------- make whole folder as sources of c++ Modified Paths: -------------- mplayerxp/Makefile mplayerxp/dump.h mplayerxp/mp_msg.h mplayerxp/mplayerxp.cpp mplayerxp/xmpcore/xmp_adecoder.cpp mplayerxp/xmpcore/xmp_aplayer.cpp mplayerxp/xmpcore/xmp_vdecoder.cpp mplayerxp/xmpcore/xmp_vplayer.cpp Added Paths: ----------- mplayerxp/dump.cpp mplayerxp/mp-opt-reg.cpp mplayerxp/mp_msg.cpp Removed Paths: ------------- mplayerxp/dump.c mplayerxp/mp-opt-reg.c mplayerxp/mp_msg.c Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/Makefile 2012-11-15 06:58:22 UTC (rev 370) @@ -21,11 +21,9 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS = mp-opt-reg.c dump.c mp_msg.c -XXSRCS = mplayerxp.cpp +SRCS = mplayerxp.cpp mp-opt-reg.cpp dump.cpp mp_msg.cpp -OBJS = $(SRCS:.c=.o) -XXOBJS = $(XXSRCS:.cpp=.o) +OBJS = $(SRCS:.cpp=.o) FF_LIBS = ../ffmpeg/libavcodec/libavcodec$(FF_SUFFIX).a \ ../ffmpeg/libswscale/libswscale$(FF_SUFFIX).a \ @@ -51,7 +49,6 @@ endif LIBS+= $(MP_LIBS) $(FF_LIBS) $(EXTRALIBS) -lm -CFLAGS = $(OPTFLAGS) $(EXTRA_INC) CXXFLAGS = $(OPTXXFLAGS) $(EXTRA_INC) .SUFFIXES: .cpp .c .o @@ -60,18 +57,15 @@ all: $(TARGET_EXE) $(SUBDIRS) -.c.o: - $(CC) -c $(CFLAGS) -o $@ $< - .cpp.o: $(CXX) -c $(CXXFLAGS) -o $@ $< .PHONY: subdirs $(MP_LIBS) subdirs: $(MP_LIBS) -$(TARGET_EXE): $(OBJS) $(XXOBJS) $(MP_LIBS) +$(TARGET_EXE): $(OBJS) $(MP_LIBS) $(DO_MAKE_ALL) - $(CXX) -o $(TARGET_EXE) $(XXOBJS) $(OBJS) $(LDFLAGS) $(LDXXFLAGS) $(LIBS) + $(CXX) -o $(TARGET_EXE) $(OBJS) $(LDFLAGS) $(LDXXFLAGS) $(LIBS) #-Xlinker --export-dynamic -Xlinker --gc-sections -Xlinker --sort-common $(SRCS): version.h @@ -113,7 +107,7 @@ $(MAKE) dep dep: - $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend + $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend $(DO_MAKE) # Deleted: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/dump.c 2012-11-15 06:58:22 UTC (rev 370) @@ -1,463 +0,0 @@ -/* - dump.c - stream dumper -*/ - -#include <stdio.h> -#include <stdlib.h> -#define __USE_ISOC99 1 /* for lrint */ -#include <math.h> - -#include "mp_config.h" - -#include "dump.h" -#include "xmpcore/sig_hand.h" -#include "help_mp.h" -#include "input2/input.h" -#include "mplayerxp.h" -#include "libmpdemux/muxer.h" -#include "libmpdemux/mrl.h" -#include "osdep/mplib.h" -#define MSGT_CLASS MSGT_GLOBAL -#include "mp_msg.h" - -static char *media=NULL,*port=NULL; - -/* example: -dump @avi:my_file.avi#rate=50 */ -int dump_parse(const char *param) -{ - int type=0; - const char *tile; - tile=mrl_parse_line(param,NULL,NULL,&media,&port); - if(!media) return 0; - if(strcmp(media,"stream")==0) type=1; - else type=2; - return type; -} - -void dump_stream(stream_t *stream) -{ - char buf[4096]; - int len; - FILE *f; - const char *ext,*name; - MP_UNIT("dumpstream"); - stream_reset(stream); - stream_seek(stream,stream->start_pos); - ext=".ext"; - if(!port) - { - strcpy(buf,"stream_dump"); - strcat(buf,ext); - } - else - { - strcpy(buf,port); - } - name=buf; - f=fopen(name,"wb"); - if(!f){ - MSG_FATAL(MSGTR_CantOpenDumpfile); - exit_player(MSGTR_Exit_error); - } - MSG_INFO("Dumping stream to %s\n",name); - while(!stream_eof(stream)){ - len=stream_read(stream,buf,4096); - if(len>0) fwrite(buf,len,1,f); - } - fclose(f); - MSG_INFO(MSGTR_CoreDumped); /* nice joke ;) */ - exit_player(MSGTR_Exit_eof); -} - -#define MUX_HAVE_AUDIO 0x01 -#define MUX_HAVE_VIDEO 0x02 -#define MUX_HAVE_SUBS 0x04 -typedef struct priv_s { - int my_use_pts; - FILE* mux_file; - muxer_t* muxer; - muxer_stream_t *m_audio,*m_video,*m_subs; - unsigned decoded_frameno; - unsigned a_frameno; - int mux_type; - uint64_t vsize,asize,ssize; - float timer_corr; /* use common time-base */ - float vtimer; - any_t* libinput; -}priv_t; - -void __FASTCALL__ dump_stream_event_handler(struct stream_s *s,const stream_packet_t*sp) -{ -} - -/* - returns: 0 - nothing interested - -1 - quit -*/ -static int check_cmd(priv_t* priv) -{ - mp_cmd_t* cmd; - int retval; - retval = 0; - while((cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) - { - switch(cmd->id) - { - case MP_CMD_QUIT: - case MP_CMD_SOFT_QUIT: - retval = -1; - break; - default: break; - } - } - return retval; -} - -void dump_mux_init(demuxer_t *demuxer,any_t* libinput) -{ - sh_audio_t* sha=demuxer->audio->sh; - sh_video_t* shv=demuxer->video->sh; - char stream_dump_name[1024]; - /* TODO copy it from demuxer */ - if(demuxer->priv) return; - demuxer->priv=mp_mallocz(sizeof(priv_t)); - priv_t*priv=demuxer->priv; - priv->libinput=libinput; - /* describe other useless dumps */ - priv->mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; - if(port) { - if(strcmp(port,"audio") ==0 ) { strcpy(stream_dump_name,"a_"); priv->mux_type&=~(MUX_HAVE_VIDEO|MUX_HAVE_SUBS); } - else if(strcmp(port,"video") ==0 ) { strcpy(stream_dump_name,"v_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_SUBS); } - else if(strcmp(port,"sub") ==0 ) { strcpy(stream_dump_name,"s_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_VIDEO); } - else strcpy(stream_dump_name,port); - } else strcpy(stream_dump_name,"avs_"); - if(strcmp(media,"lavf") == 0) { strcpy(stream_dump_name,"avs_dump."); strcat(stream_dump_name,port); } - 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); - exit_player(MSGTR_Exit_error); - } - priv->mux_file=fopen(stream_dump_name,"wb"); - MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); - if(!priv->mux_file){ - MSG_FATAL(MSGTR_CantOpenDumpfile); - exit_player(MSGTR_Exit_error); - } - if(!(priv->muxer=muxer_new_muxer(media,port,priv->mux_file))) { - MSG_FATAL("Can't initialize muxer\n"); - exit_player(MSGTR_Exit_error); - } - if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) { - priv->m_audio=muxer_new_stream(priv->muxer,MUXER_TYPE_AUDIO); - priv->m_audio->buffer_size=0x100000; //16384; - priv->m_audio->source=sha; - priv->m_audio->codec=0; - if(!sha->wf) { - sha->wf=mp_malloc(sizeof(WAVEFORMATEX)); - sha->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; - sha->wf->wFormatTag = sha->wtag; - sha->wf->nChannels = sha->nch; - sha->wf->nSamplesPerSec = sha->rate; - sha->wf->nAvgBytesPerSec=sha->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; - sha->wf->wBitsPerSample = 16; // FIXME - sha->wf->cbSize=0; // FIXME for l3codeca.acm - } - priv->m_audio->wf=mp_malloc(sha->wf->cbSize+sizeof(WAVEFORMATEX)); - memcpy(priv->m_audio->wf,sha->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); - if(!sha->wf->cbSize && sha->codecdata_len) { - priv->m_audio->wf->cbSize=sha->wf->cbSize=sha->codecdata_len; - priv->m_audio->wf=mp_realloc(priv->m_audio->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); - memcpy((char *)(priv->m_audio->wf+1),sha->codecdata,sha->codecdata_len); - } - if(!sha->i_bps) sha->i_bps=priv->m_audio->wf->nAvgBytesPerSec; - if(sha->audio.dwScale){ - priv->m_audio->h.dwSampleSize=sha->audio.dwSampleSize; - priv->m_audio->h.dwScale=sha->audio.dwScale; - priv->m_audio->h.dwRate=sha->audio.dwRate; - } else { - priv->m_audio->h.dwSampleSize=priv->m_audio->wf->nBlockAlign; - priv->m_audio->h.dwScale=priv->m_audio->h.dwSampleSize; - priv->m_audio->h.dwRate=priv->m_audio->wf->nAvgBytesPerSec; - } - } else priv->m_audio=NULL; - if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) { - priv->m_video=muxer_new_stream(priv->muxer,MUXER_TYPE_VIDEO); - priv->m_video->buffer_size=0x200000; // 2MB - priv->m_video->source=shv; - priv->m_video->h.dwSampleSize=0; // VBR - priv->m_video->h.dwScale=10000; - 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=mp_malloc(sizeof(BITMAPINFOHEADER)); - shv->bih->biSize=sizeof(BITMAPINFOHEADER); - shv->bih->biWidth=shv->src_w; - shv->bih->biHeight=shv->src_h; - shv->bih->biCompression=shv->fourcc; - shv->bih->biPlanes=1; - shv->bih->biBitCount=24; // FIXME!!! - shv->bih->biSizeImage=shv->bih->biWidth*shv->bih->biHeight*(shv->bih->biBitCount/8); - } - priv->m_video->bih=mp_malloc(shv->bih->biSize); - memcpy(priv->m_video->bih,shv->bih,shv->bih->biSize); - priv->m_video->ImageDesc=shv->ImageDesc; - priv->m_video->aspect=shv->aspect; - priv->m_video->codec=0; - } else priv->m_video=NULL; - if(demuxer->sub->sh && (priv->mux_type&MUX_HAVE_SUBS)) { - priv->m_subs=muxer_new_stream(priv->muxer,MUXER_TYPE_SUBS); - priv->m_subs->buffer_size=0x100000; //16384; - 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); - muxer_fix_parameters(priv->muxer); - muxer_write_header(priv->muxer,demuxer); -} - -void dump_mux_close(demuxer_t *demuxer) -{ - priv_t* priv=demuxer->priv; - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; - sh_audio_t* sha=d_audio->sh; - sh_video_t* shv=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); - 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); - /* fixup avi header */ - if(shv) { - if(priv->vtimer) shv->fps=(float)priv->decoded_frameno/(priv->vtimer+priv->timer_corr); - 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); - } - } - 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); - } - } - if(demuxer->sub->sh) { - if(priv->m_subs) MSG_V("Finishing sstream as\n"); - } - fseeko(priv->mux_file,0,SEEK_SET); - muxer_write_header(priv->muxer,demuxer); - fclose(priv->mux_file); - mp_free(demuxer->priv); - demuxer->priv=NULL; - } - MSG_INFO(MSGTR_CoreDumped); -} - - -void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames) -{ - priv_t* priv=demuxer->priv; - demux_stream_t *d_audio=demuxer->audio; - demux_stream_t *d_video=demuxer->video; - demux_stream_t *d_sub=demuxer->sub; - sh_audio_t* sha=d_audio->sh; - sh_video_t* shv=d_video->sh; - float frame_time,a_duration; - float mpeg_vtimer=HUGE,mpeg_atimer=HUGE; - unsigned char* start=NULL; - int in_size,aeof,veof,seof,cmd; - - if(!priv) return; - MP_UNIT("dump"); - priv->my_use_pts=use_pts; - /* test stream property */ - MSG_INFO("%s using PTS method\n",use_pts?"":"not"); - 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(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); - 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(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); - 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; - - seek_to_sec = NULL; - MSG_INFO("seeking to %u seconds\n"); - seek_p.secs=rel_seek_secs; - demux_seek_r(demuxer,&seek_p); - } - aeof=sha?0:1; - veof=shv?0:1; - if(shv) priv->vtimer=0; - if(sha) sha->timer=0; - while(!(aeof && veof)){ - in_size=0; - if(sha && !aeof) - { - float a_pts; - while(sha->timer < (shv?priv->vtimer:HUGE) || !shv || veof) /* autolimitation of audio reading */ - { - /* we should try to keep structure of audio packets here - and don't generate badly interlaved stream. - The ideal case is: type=read_packet(ANY_TYPE); put_packet(type); - */ - in_size=ds_get_packet_r(sha->ds,&start,&a_pts); - cmd = check_cmd(priv); - if(cmd == -1) goto done; - else - a_duration=(float)in_size/(float)(sha->i_bps); - if(mpeg_atimer==HUGE) mpeg_atimer=a_pts; - else - { - if( mpeg_atimer-a_duration<a_pts) mpeg_atimer=a_pts; - else mpeg_atimer+=a_duration; - } - 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); - 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); - if(priv->m_audio) - muxer_write_chunk(priv->m_audio,in_size,priv->m_video?0:AVIIF_KEYFRAME,sha->timer+priv->timer_corr); - } - if(!priv->m_audio->h.dwSampleSize && priv->m_audio->timer>0) - priv->m_audio->wf->nAvgBytesPerSec=0.5f+(double)priv->m_audio->size/priv->m_audio->timer; - } - priv->asize += in_size; - } - } - if(shv && !veof) - { - float v_pts; - in_size=video_read_frame(shv,&frame_time,&v_pts,&start,0); - cmd = check_cmd(priv); - if(cmd == -1) goto done; - else - if(mpeg_vtimer==HUGE) mpeg_vtimer=v_pts; - else - { - if( mpeg_vtimer-frame_time<v_pts ) mpeg_vtimer=v_pts; - else mpeg_vtimer+=frame_time; - } - if(use_pts) priv->vtimer=v_pts; - 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); - 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); - 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); - } - if(demuxer->sub->sh) - { - float s_pts=0; - while(s_pts < (shv?priv->vtimer:HUGE) || !shv || veof) /* autolimitation of sub reading */ - { - in_size=ds_get_packet_r(demuxer->sub,&start,&s_pts); - seof=demuxer->sub->eof; - if(seof) break; - cmd = check_cmd(priv); - if(cmd == -1) goto done; - else - MSG_V("Got sub frame: %f\n",s_pts); - if(priv->m_subs) - { - priv->m_subs->buffer=start; - if(in_size>0) - { - MSG_V("put subs: %f %u\n",s_pts,in_size); - if(priv->m_subs) - muxer_write_chunk(priv->m_subs,in_size,priv->m_video?0:AVIIF_KEYFRAME,s_pts); - } - } - } - } - if(priv->decoded_frameno>play_n_frames) break; - } - done: - if(shv) priv->timer_corr+=priv->vtimer+frame_time; - else - { - if(sha) priv->timer_corr+=d_audio->pts; - if(priv->m_audio->wf->nAvgBytesPerSec) - priv->timer_corr+=((float)ds_tell_pts(d_audio))/((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); -} Copied: mplayerxp/dump.cpp (from rev 369, mplayerxp/dump.c) =================================================================== --- mplayerxp/dump.cpp (rev 0) +++ mplayerxp/dump.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -0,0 +1,463 @@ +/* + dump.c - stream dumper +*/ + +#include <stdio.h> +#include <stdlib.h> +#define __USE_ISOC99 1 /* for lrint */ +#include <math.h> +extern "C"{ +#include "mp_config.h" + +#include "xmpcore/sig_hand.h" +#include "help_mp.h" +#include "input2/input.h" +#include "mplayerxp.h" +#include "libmpdemux/muxer.h" +#include "libmpdemux/mrl.h" +#include "osdep/mplib.h" +#define MSGT_CLASS MSGT_GLOBAL +#include "mp_msg.h" +} +#include "dump.h" + +static char *media=NULL,*port=NULL; + +/* example: -dump @avi:my_file.avi#rate=50 */ +int dump_parse(const char *param) +{ + int type=0; + const char *tile; + tile=mrl_parse_line(param,NULL,NULL,&media,&port); + if(!media) return 0; + if(strcmp(media,"stream")==0) type=1; + else type=2; + return type; +} + +void dump_stream(stream_t *stream) +{ + char buf[4096]; + int len; + FILE *f; + const char *ext,*name; + MP_UNIT("dumpstream"); + stream_reset(stream); + stream_seek(stream,stream->start_pos); + ext=".ext"; + if(!port) + { + strcpy(buf,"stream_dump"); + strcat(buf,ext); + } + else + { + strcpy(buf,port); + } + name=buf; + f=fopen(name,"wb"); + if(!f){ + MSG_FATAL(MSGTR_CantOpenDumpfile); + exit_player(MSGTR_Exit_error); + } + MSG_INFO("Dumping stream to %s\n",name); + while(!stream_eof(stream)){ + len=stream_read(stream,buf,4096); + if(len>0) fwrite(buf,len,1,f); + } + fclose(f); + MSG_INFO(MSGTR_CoreDumped); /* nice joke ;) */ + exit_player(MSGTR_Exit_eof); +} + +#define MUX_HAVE_AUDIO 0x01 +#define MUX_HAVE_VIDEO 0x02 +#define MUX_HAVE_SUBS 0x04 +typedef struct priv_s { + int my_use_pts; + FILE* mux_file; + muxer_t* muxer; + muxer_stream_t *m_audio,*m_video,*m_subs; + unsigned decoded_frameno; + unsigned a_frameno; + int mux_type; + uint64_t vsize,asize,ssize; + float timer_corr; /* use common time-base */ + float vtimer; + any_t* libinput; +}priv_t; + +void __FASTCALL__ dump_stream_event_handler(struct stream_s *s,const stream_packet_t*sp) +{ +} + +/* + returns: 0 - nothing interested + -1 - quit +*/ +static int check_cmd(priv_t* priv) +{ + mp_cmd_t* cmd; + int retval; + retval = 0; + while((cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) + { + switch(cmd->id) + { + case MP_CMD_QUIT: + case MP_CMD_SOFT_QUIT: + retval = -1; + break; + default: break; + } + } + return retval; +} + +void dump_mux_init(demuxer_t *demuxer,any_t* libinput) +{ + sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(demuxer->audio->sh); + sh_video_t* shv=reinterpret_cast<sh_video_t*>(demuxer->video->sh); + char stream_dump_name[1024]; + /* TODO copy it from demuxer */ + if(demuxer->priv) return; + demuxer->priv=mp_mallocz(sizeof(priv_t)); + priv_t*priv=reinterpret_cast<priv_t*>(demuxer->priv); + priv->libinput=libinput; + /* describe other useless dumps */ + priv->mux_type=MUX_HAVE_AUDIO|MUX_HAVE_VIDEO|MUX_HAVE_SUBS; + if(port) { + if(strcmp(port,"audio") ==0 ) { strcpy(stream_dump_name,"a_"); priv->mux_type&=~(MUX_HAVE_VIDEO|MUX_HAVE_SUBS); } + else if(strcmp(port,"video") ==0 ) { strcpy(stream_dump_name,"v_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_SUBS); } + else if(strcmp(port,"sub") ==0 ) { strcpy(stream_dump_name,"s_"); priv->mux_type&=~(MUX_HAVE_AUDIO|MUX_HAVE_VIDEO); } + else strcpy(stream_dump_name,port); + } else strcpy(stream_dump_name,"avs_"); + if(strcmp(media,"lavf") == 0) { strcpy(stream_dump_name,"avs_dump."); strcat(stream_dump_name,port); } + 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); + exit_player(MSGTR_Exit_error); + } + priv->mux_file=fopen(stream_dump_name,"wb"); + MSG_DBG2("Preparing stream dumping: %s\n",stream_dump_name); + if(!priv->mux_file){ + MSG_FATAL(MSGTR_CantOpenDumpfile); + exit_player(MSGTR_Exit_error); + } + if(!(priv->muxer=muxer_new_muxer(media,port,priv->mux_file))) { + MSG_FATAL("Can't initialize muxer\n"); + exit_player(MSGTR_Exit_error); + } + if(sha && (priv->mux_type&MUX_HAVE_AUDIO)) { + priv->m_audio=muxer_new_stream(priv->muxer,MUXER_TYPE_AUDIO); + priv->m_audio->buffer_size=0x100000; //16384; + priv->m_audio->source=sha; + priv->m_audio->codec=0; + if(!sha->wf) { + sha->wf=(WAVEFORMATEX*)mp_malloc(sizeof(WAVEFORMATEX)); + sha->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; + sha->wf->wFormatTag = sha->wtag; + sha->wf->nChannels = sha->nch; + sha->wf->nSamplesPerSec = sha->rate; + sha->wf->nAvgBytesPerSec=sha->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; + sha->wf->wBitsPerSample = 16; // FIXME + sha->wf->cbSize=0; // FIXME for l3codeca.acm + } + priv->m_audio->wf=(WAVEFORMATEX*)mp_malloc(sha->wf->cbSize+sizeof(WAVEFORMATEX)); + memcpy(priv->m_audio->wf,sha->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); + if(!sha->wf->cbSize && sha->codecdata_len) { + priv->m_audio->wf->cbSize=sha->wf->cbSize=sha->codecdata_len; + priv->m_audio->wf=(WAVEFORMATEX*)mp_realloc(priv->m_audio->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); + memcpy((char *)(priv->m_audio->wf+1),sha->codecdata,sha->codecdata_len); + } + if(!sha->i_bps) sha->i_bps=priv->m_audio->wf->nAvgBytesPerSec; + if(sha->audio.dwScale){ + priv->m_audio->h.dwSampleSize=sha->audio.dwSampleSize; + priv->m_audio->h.dwScale=sha->audio.dwScale; + priv->m_audio->h.dwRate=sha->audio.dwRate; + } else { + priv->m_audio->h.dwSampleSize=priv->m_audio->wf->nBlockAlign; + priv->m_audio->h.dwScale=priv->m_audio->h.dwSampleSize; + priv->m_audio->h.dwRate=priv->m_audio->wf->nAvgBytesPerSec; + } + } else priv->m_audio=NULL; + if(shv && (priv->mux_type&MUX_HAVE_VIDEO)) { + priv->m_video=muxer_new_stream(priv->muxer,MUXER_TYPE_VIDEO); + priv->m_video->buffer_size=0x200000; // 2MB + priv->m_video->source=shv; + priv->m_video->h.dwSampleSize=0; // VBR + priv->m_video->h.dwScale=10000; + 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->biSize=sizeof(BITMAPINFOHEADER); + shv->bih->biWidth=shv->src_w; + shv->bih->biHeight=shv->src_h; + shv->bih->biCompression=shv->fourcc; + shv->bih->biPlanes=1; + shv->bih->biBitCount=24; // FIXME!!! + shv->bih->biSizeImage=shv->bih->biWidth*shv->bih->biHeight*(shv->bih->biBitCount/8); + } + priv->m_video->bih=(BITMAPINFOHEADER*)mp_malloc(shv->bih->biSize); + memcpy(priv->m_video->bih,shv->bih,shv->bih->biSize); + priv->m_video->ImageDesc=shv->ImageDesc; + priv->m_video->aspect=shv->aspect; + priv->m_video->codec=0; + } else priv->m_video=NULL; + if(demuxer->sub->sh && (priv->mux_type&MUX_HAVE_SUBS)) { + priv->m_subs=muxer_new_stream(priv->muxer,MUXER_TYPE_SUBS); + priv->m_subs->buffer_size=0x100000; //16384; + 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); + muxer_fix_parameters(priv->muxer); + muxer_write_header(priv->muxer,demuxer); +} + +void dump_mux_close(demuxer_t *demuxer) +{ + priv_t* priv=reinterpret_cast<priv_t*>(demuxer->priv); + demux_stream_t *d_audio=demuxer->audio; + demux_stream_t *d_video=demuxer->video; + 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); + 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); + /* fixup avi header */ + if(shv) { + if(priv->vtimer) shv->fps=(float)priv->decoded_frameno/(priv->vtimer+priv->timer_corr); + 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); + } + } + 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); + } + } + if(demuxer->sub->sh) { + if(priv->m_subs) MSG_V("Finishing sstream as\n"); + } + fseeko(priv->mux_file,0,SEEK_SET); + muxer_write_header(priv->muxer,demuxer); + fclose(priv->mux_file); + mp_free(demuxer->priv); + demuxer->priv=NULL; + } + MSG_INFO(MSGTR_CoreDumped); +} + + +void dump_mux(demuxer_t *demuxer,int use_pts,const char *seek_to_sec,unsigned play_n_frames) +{ + priv_t* priv=reinterpret_cast<priv_t*>(demuxer->priv); + demux_stream_t *d_audio=demuxer->audio; + demux_stream_t *d_video=demuxer->video; + sh_audio_t* sha=reinterpret_cast<sh_audio_t*>(d_audio->sh); + sh_video_t* shv=reinterpret_cast<sh_video_t*>(d_video->sh); + float frame_time,a_duration; + float mpeg_vtimer=HUGE,mpeg_atimer=HUGE; + unsigned char* start=NULL; + int in_size,aeof,veof,seof,cmd; + + if(!priv) return; + MP_UNIT("dump"); + priv->my_use_pts=use_pts; + /* test stream property */ + MSG_INFO("%s using PTS method\n",use_pts?"":"not"); + 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(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); + 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(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); + 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; + + seek_to_sec = NULL; + MSG_INFO("seeking to %u seconds\n"); + seek_p.secs=rel_seek_secs; + demux_seek_r(demuxer,&seek_p); + } + aeof=sha?0:1; + veof=shv?0:1; + if(shv) priv->vtimer=0; + if(sha) sha->timer=0; + while(!(aeof && veof)){ + in_size=0; + if(sha && !aeof) + { + float a_pts; + while(sha->timer < (shv?priv->vtimer:HUGE) || !shv || veof) /* autolimitation of audio reading */ + { + /* we should try to keep structure of audio packets here + and don't generate badly interlaved stream. + The ideal case is: type=read_packet(ANY_TYPE); put_packet(type); + */ + in_size=ds_get_packet_r(sha->ds,&start,&a_pts); + cmd = check_cmd(priv); + if(cmd == -1) goto done; + else + a_duration=(float)in_size/(float)(sha->i_bps); + if(mpeg_atimer==HUGE) mpeg_atimer=a_pts; + else + { + if( mpeg_atimer-a_duration<a_pts) mpeg_atimer=a_pts; + else mpeg_atimer+=a_duration; + } + 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); + 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); + if(priv->m_audio) + muxer_write_chunk(priv->m_audio,in_size,priv->m_video?0:AVIIF_KEYFRAME,sha->timer+priv->timer_corr); + } + if(!priv->m_audio->h.dwSampleSize && priv->m_audio->timer>0) + priv->m_audio->wf->nAvgBytesPerSec=0.5f+(double)priv->m_audio->size/priv->m_audio->timer; + } + priv->asize += in_size; + } + } + if(shv && !veof) + { + float v_pts; + in_size=video_read_frame(shv,&frame_time,&v_pts,&start,0); + cmd = check_cmd(priv); + if(cmd == -1) goto done; + else + if(mpeg_vtimer==HUGE) mpeg_vtimer=v_pts; + else + { + if( mpeg_vtimer-frame_time<v_pts ) mpeg_vtimer=v_pts; + else mpeg_vtimer+=frame_time; + } + if(use_pts) priv->vtimer=v_pts; + 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); + 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); + 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); + } + if(demuxer->sub->sh) + { + float s_pts=0; + while(s_pts < (shv?priv->vtimer:HUGE) || !shv || veof) /* autolimitation of sub reading */ + { + in_size=ds_get_packet_r(demuxer->sub,&start,&s_pts); + seof=demuxer->sub->eof; + if(seof) break; + cmd = check_cmd(priv); + if(cmd == -1) goto done; + else + MSG_V("Got sub frame: %f\n",s_pts); + if(priv->m_subs) + { + priv->m_subs->buffer=start; + if(in_size>0) + { + MSG_V("put subs: %f %u\n",s_pts,in_size); + if(priv->m_subs) + muxer_write_chunk(priv->m_subs,in_size,priv->m_video?0:AVIIF_KEYFRAME,s_pts); + } + } + } + } + if(priv->decoded_frameno>play_n_frames) break; + } + done: + if(shv) priv->timer_corr+=priv->vtimer+frame_time; + else + { + if(sha) priv->timer_corr+=d_audio->pts; + if(priv->m_audio->wf->nAvgBytesPerSec) + priv->timer_corr+=((float)ds_tell_pts(d_audio))/((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); +} Modified: mplayerxp/dump.h =================================================================== --- mplayerxp/dump.h 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/dump.h 2012-11-15 06:58:22 UTC (rev 370) @@ -1,7 +1,6 @@ /* dump.h - stream dumper interface */ - #ifndef DUMP_H_INCLUDED #define DUMP_H_INCLUDED 1 #include "libmpdemux/demuxer_r.h" Deleted: mplayerxp/mp-opt-reg.c =================================================================== --- mplayerxp/mp-opt-reg.c 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/mp-opt-reg.c 2012-11-15 06:58:22 UTC (rev 370) @@ -1,27 +0,0 @@ - -#include "mp_config.h" -#include <stdlib.h> -#include <stdio.h> -#include "libmpdemux/stream.h" -#include "libmpconf/cfgparser.h" - -extern void mp_input_register_options(m_config_t* cfg); -extern void libmpdemux_register_options(m_config_t* cfg); -extern void demuxer_register_options(m_config_t* cfg); -#ifdef HAVE_LIBCDIO -extern void cdda_register_options(m_config_t* cfg); -#endif -extern void libmpcodecs_ad_register_options(m_config_t* cfg); -extern void libmpcodecs_vd_register_options(m_config_t* cfg); - -void mp_register_options(m_config_t* cfg) -{ - mp_input_register_options(cfg); - libmpdemux_register_options(cfg); - demuxer_register_options(cfg); -#ifdef HAVE_LIBCDIO - cdda_register_options(cfg); -#endif - libmpcodecs_ad_register_options(cfg); - libmpcodecs_vd_register_options(cfg); -} Copied: mplayerxp/mp-opt-reg.cpp (from rev 369, mplayerxp/mp-opt-reg.c) =================================================================== --- mplayerxp/mp-opt-reg.cpp (rev 0) +++ mplayerxp/mp-opt-reg.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -0,0 +1,29 @@ +#include "mp_config.h" + +#include <stdlib.h> +#include <stdio.h> +#include "libmpdemux/stream.h" +#include "libmpconf/cfgparser.h" + +extern "C" { +extern void mp_input_register_options(m_config_t* cfg); +extern void libmpdemux_register_options(m_config_t* cfg); +extern void demuxer_register_options(m_config_t* cfg); +#ifdef HAVE_LIBCDIO +extern void cdda_register_options(m_config_t* cfg); +#endif +extern void libmpcodecs_ad_register_options(m_config_t* cfg); +extern void libmpcodecs_vd_register_options(m_config_t* cfg); +} + +extern "C" void mp_register_options(m_config_t* cfg) +{ + mp_input_register_options(cfg); + libmpdemux_register_options(cfg); + demuxer_register_options(cfg); +#ifdef HAVE_LIBCDIO + cdda_register_options(cfg); +#endif + libmpcodecs_ad_register_options(cfg); + libmpcodecs_vd_register_options(cfg); +} Deleted: mplayerxp/mp_msg.c =================================================================== --- mplayerxp/mp_msg.c 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/mp_msg.c 2012-11-15 06:58:22 UTC (rev 370) @@ -1,132 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <unistd.h> -#include <string.h> -#include <inttypes.h> -#include <pthread.h> -#include "mp_config.h" -#include "nls/nls.h" -#include "mp_msg.h" -#include "osdep/mplib.h" - -#define _bg(x) ((x) >> 4) -#define _fg(x) ((x) & 0x0f) -typedef struct priv_s { - int _color[8]; - char vtmp[100]; - char scol[9][20]; - pthread_mutex_t mp_msg_mutex; -}priv_t; -const char hl[9] = { 0xC, 0x4, 0xE, 0xA, 0xB, 0x7, 0x9, 0x3, 0x7 }; - -static char *_2ansi(unsigned char attr) -{ - priv_t*priv=mp_data->msg_priv; - int bg = _bg(attr); - int bc = priv->_color[bg & 7]; - - sprintf(priv->vtmp, - "\033[%d;3%d;4%d%sm", - _fg(attr) > 7, - priv->_color[_fg(attr) & 7], - bc, - bg > 7 ? ";5" : "" - ); - return priv->vtmp; -} - -void mp_msg_init(int verbose) -{ - pthread_mutexattr_t attr; - unsigned i; - int _color[8]={0,4,2,6,1,5,3,7}; - mp_data->msg_priv=mp_mallocz(sizeof(priv_t)); - priv_t*priv=mp_data->msg_priv; - memcpy(priv->_color,_color,sizeof(_color)); - pthread_mutexattr_init(&attr); - pthread_mutex_init(&priv->mp_msg_mutex,&attr); - pthread_mutexattr_destroy(&attr); - for(i=0;i<sizeof(hl)/sizeof(char);i++) - memcpy(priv->scol[i],_2ansi(hl[i]),sizeof(priv->scol[0])); -} - -void mp_msg_uninit(void) -{ - priv_t*priv=mp_data->msg_priv; - if(isatty(fileno(stderr))) fprintf(stderr,priv->scol[8]); - mp_msg_flush(); - pthread_mutex_destroy(&priv->mp_msg_mutex); - mp_free(priv); -} - -const char * msg_prefix[] = -{ - "GLOBAL", - "PLAYER", - "LIBVO", - "LIBAO", - "DEMUX", - "CFGPRS", - "DECAUD", - "DECVID", - "VOBSUB", - "OSDEP", - "SPUDEC", - "PLAYTR", - "INPUT", - "OSD", - "CPUDTC", - "CODCFG", - "SWS", - "FINDSB", - "SUBRDR", - "POSTPR" -}; - -int mp_msg_c( unsigned x, const char *format, ... ){ -/* TODO: more useful usage of module_id */ - int rc=0; - priv_t*priv=NULL; - va_list va; - char sbuf[0xFFFFF]; - unsigned ssize; - unsigned level=(x>>28)&0xF; - unsigned mod=x&0x0FFFFFFF; - static int was_eol=1; - if(mp_data) priv=mp_data->msg_priv; - if(level>mp_conf.verbose+MSGL_V-1) return 0; /* do not display */ - if((mod&mp_conf.msg_filter)==0) return 0; /* do not display */ - if(priv) { - pthread_mutex_lock(&priv->mp_msg_mutex); - if(isatty(fileno(stderr))) - fprintf(stderr,priv->scol[level<9?level:8]); - } - if(mp_conf.verbose>1 && was_eol) - { - unsigned mod_name; - const char *smod=NULL; - mod_name = 0; - while((mod&0x1)==0) { mod_name++; mod>>=1; } - if(mod_name < sizeof(msg_prefix)/sizeof(msg_prefix[0])) - smod = msg_prefix[mod_name]; - fprintf(stderr,"%s: ",smod?smod:"UNKNOWN"); - } - va_start(va, format); - ssize=vsprintf(sbuf,format, va); - va_end(va); - if(strcmp(nls_get_screen_cp(),"UTF-8")!=0) { - char *obuf; - obuf=nls_recode2screen_cp("UTF-8",sbuf,ssize); - rc=fputs(obuf,stderr); - mp_free(obuf); - } - else rc=fputs(sbuf,stderr); - if(format[strlen(format)-1]=='\n') was_eol=1; - else was_eol=0; - fflush(stderr); - if(priv) pthread_mutex_unlock(&priv->mp_msg_mutex); - return rc; -} - -void mp_msg_flush(void) { fflush(stderr); } Copied: mplayerxp/mp_msg.cpp (from rev 369, mplayerxp/mp_msg.c) =================================================================== --- mplayerxp/mp_msg.cpp (rev 0) +++ mplayerxp/mp_msg.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -0,0 +1,133 @@ +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <unistd.h> +#include <string.h> +#include <inttypes.h> +#include <pthread.h> +extern "C" { +#include "mp_config.h" +#include "nls/nls.h" +#include "mp_msg.h" +#include "osdep/mplib.h" +} +#define _bg(x) ((x) >> 4) +#define _fg(x) ((x) & 0x0f) +typedef struct priv_s { + int _color[8]; + char vtmp[100]; + char scol[9][20]; + pthread_mutex_t mp_msg_mutex; +}priv_t; +const char hl[9] = { 0xC, 0x4, 0xE, 0xA, 0xB, 0x7, 0x9, 0x3, 0x7 }; + +static char *_2ansi(unsigned char attr) +{ + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + int bg = _bg(attr); + int bc = priv->_color[bg & 7]; + + sprintf(priv->vtmp, + "\033[%d;3%d;4%d%sm", + _fg(attr) > 7, + priv->_color[_fg(attr) & 7], + bc, + bg > 7 ? ";5" : "" + ); + return priv->vtmp; +} + +void mp_msg_init(int verbose) +{ + pthread_mutexattr_t attr; + unsigned i; + int _color[8]={0,4,2,6,1,5,3,7}; + mp_data->msg_priv=mp_mallocz(sizeof(priv_t)); + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + memcpy(priv->_color,_color,sizeof(_color)); + pthread_mutexattr_init(&attr); + pthread_mutex_init(&priv->mp_msg_mutex,&attr); + pthread_mutexattr_destroy(&attr); + for(i=0;i<sizeof(hl)/sizeof(char);i++) + memcpy(priv->scol[i],_2ansi(hl[i]),sizeof(priv->scol[0])); +} + +void mp_msg_uninit(void) +{ + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + if(isatty(fileno(stderr))) fprintf(stderr,priv->scol[8]); + mp_msg_flush(); + pthread_mutex_destroy(&priv->mp_msg_mutex); + mp_free(priv); +} + +const char * msg_prefix[] = +{ + "GLOBAL", + "PLAYER", + "LIBVO", + "LIBAO", + "DEMUX", + "CFGPRS", + "DECAUD", + "DECVID", + "VOBSUB", + "OSDEP", + "SPUDEC", + "PLAYTR", + "INPUT", + "OSD", + "CPUDTC", + "CODCFG", + "SWS", + "FINDSB", + "SUBRDR", + "POSTPR" +}; + +int mp_msg_c( unsigned x, const char *format, ... ){ +/* TODO: more useful usage of module_id */ + int rc=0; + priv_t*priv=NULL; + va_list va; + char sbuf[0xFFFFF]; + unsigned ssize; + unsigned level=(x>>28)&0xF; + unsigned mod=x&0x0FFFFFFF; + static int was_eol=1; + if(mp_data) priv=reinterpret_cast<priv_t*>(mp_data->msg_priv); + if(level>mp_conf.verbose+MSGL_V-1) return 0; /* do not display */ + if((mod&mp_conf.msg_filter)==0) return 0; /* do not display */ + if(priv) { + pthread_mutex_lock(&priv->mp_msg_mutex); + if(isatty(fileno(stderr))) + fprintf(stderr,priv->scol[level<9?level:8]); + } + if(mp_conf.verbose>1 && was_eol) + { + unsigned mod_name; + const char *smod=NULL; + mod_name = 0; + while((mod&0x1)==0) { mod_name++; mod>>=1; } + if(mod_name < sizeof(msg_prefix)/sizeof(msg_prefix[0])) + smod = msg_prefix[mod_name]; + fprintf(stderr,"%s: ",smod?smod:"UNKNOWN"); + } + va_start(va, format); + ssize=vsprintf(sbuf,format, va); + va_end(va); + if(strcmp(nls_get_screen_cp(),"UTF-8")!=0) { + char *obuf; + obuf=nls_recode2screen_cp("UTF-8",sbuf,ssize); + rc=fputs(obuf,stderr); + mp_free(obuf); + } + else rc=fputs(sbuf,stderr); + if(format[strlen(format)-1]=='\n') was_eol=1; + else was_eol=0; + fflush(stderr); + if(priv) pthread_mutex_unlock(&priv->mp_msg_mutex); + return rc; +} + +void mp_msg_flush(void) { fflush(stderr); } Modified: mplayerxp/mp_msg.h =================================================================== --- mplayerxp/mp_msg.h 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/mp_msg.h 2012-11-15 06:58:22 UTC (rev 370) @@ -3,6 +3,9 @@ #include "mplayerxp.h" +#ifdef __cplusplus +extern "C" { +#endif // verbosity elevel: // stuff from level MSGL_FATAL-MSGL_HINT should be translated. @@ -111,7 +114,9 @@ #define MSG_DBG2(args...) #define MSG_DBG3(args...) #endif - #endif // __va_arg_pack +#ifdef __cplusplus +} +#endif #endif // __MP_MSG_H Modified: mplayerxp/mplayerxp.cpp =================================================================== --- mplayerxp/mplayerxp.cpp 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/mplayerxp.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -66,7 +66,6 @@ #include "osdep/mm_accel.h" #include "input2/input.h" -#include "dump.h" #include "nls/nls.h" #include "postproc/libmenu/menu.h" #include "libao2/mixer.h" @@ -78,6 +77,7 @@ #define MSGT_CLASS MSGT_CPLAYER #include "mp_msg.h" } // extern "C" +#include "dump.h" /************************************************************************** Private data **************************************************************************/ @@ -199,7 +199,7 @@ mp_data->use_pts_fix2=-1; mp_data->rtc_fd=-1; mp_data->priv=mp_mallocz(sizeof(priv_t)); - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); priv->osd_function=OSD_PLAY; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) memset(&x86,-1,sizeof(x86_features_t)); @@ -245,14 +245,14 @@ } void uninit_player(unsigned int mask){ - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); stream_t* stream=NULL; sh_audio_t* sh_audio=NULL; sh_video_t* sh_video=NULL; if(priv->demuxer) { stream=priv->demuxer->stream; - sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video=(sh_video_t*)priv->demuxer->video->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); } fflush(stdout); fflush(stderr); @@ -414,7 +414,7 @@ // The function return a new value for eof. static int libmpdemux_was_interrupted(int eof) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); mp_cmd_t* cmd; if((cmd = mp_input_get_cmd(priv->libinput,0,0,0)) != NULL) { switch(cmd->id) { @@ -562,7 +562,7 @@ } extern "C" void show_long_help(void) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); m_config_show_options(mp_data->mconfig); mp_input_print_binds(priv->libinput); print_stream_drivers(); @@ -591,7 +591,7 @@ //================= Update OSD ==================== void update_osd( float v_pts ) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); static char osd_text_buffer[64]; static int osd_last_pts=-303; //================= Update OSD ==================== @@ -635,9 +635,9 @@ void mpxp_seek( osd_args_t *osd,const seek_args_t* seek) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); demux_stream_t *d_dvdsub=priv->demuxer->sub; int seek_rval=1; xp_core->audio->eof=0; @@ -706,8 +706,8 @@ void mpxp_reset_vcache(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); seek_args_t seek = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; if(sh_video) mpxp_seek(NULL,&seek); return; @@ -715,8 +715,8 @@ void mpxp_resync_audio_stream(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); mpca_resync_stream(sh_audio->decoder); } @@ -768,8 +768,8 @@ static void show_benchmark_status(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); if(xmp_test_model(XMP_Run_AudioPlayback)) MSG_STATUS("A:%6.1f %4.1f%%\r" ,sh_audio->timer-ao_get_delay(ao_data) @@ -788,7 +788,7 @@ static void mpxp_init_keyboard_fifo(void) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); #ifdef HAVE_TERMCAP load_termcap(NULL); // load key-codes #endif @@ -799,7 +799,7 @@ } void mplayer_put_key(int code){ - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); mp_cmd_t* cmd; cmd=mp_input_get_cmd_from_keys(priv->libinput,1,&code); mp_input_queue_cmd(priv->libinput,cmd); @@ -838,7 +838,7 @@ } static char * mpxp_init_output_subsystems(void) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); char* rs=NULL; unsigned i; // check video_out driver name: @@ -883,7 +883,7 @@ } static int mpxp_init_vobsub(const char *filename) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); int forced_subs_only=0; MP_UNIT("vobsub"); if (mp_conf.vobsub_name){ @@ -912,7 +912,7 @@ } static int mpxp_handle_playlist(const char *filename) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); stream_t* stream=priv->demuxer->stream; int eof=0; play_tree_t* entry; @@ -949,7 +949,7 @@ static void mpxp_init_dvd_nls(void) { /* Add NLS support here */ - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); stream_t* stream=priv->demuxer->stream; char *lang; if(!mp_conf.audio_lang) mp_conf.audio_lang=nls_get_screen_cp(); @@ -973,9 +973,9 @@ } static void mpxp_print_stream_formats(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); int fmt; char *c; MSG_INFO("[Stream]:"); @@ -1002,14 +1002,14 @@ } static void mpxp_read_video_properties(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); demux_stream_t *d_video=priv->demuxer->video; MP_UNIT("video_read_properties"); if(!video_read_properties(sh_video)) { MSG_ERR("Video: can't read properties\n"); d_video->sh=NULL; - sh_video=(sh_video_t*)d_video->sh; + sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); } else { MSG_V("[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n", priv->demuxer->file_format,sh_video->fourcc, sh_video->src_w,sh_video->src_h, @@ -1023,14 +1023,14 @@ if(!sh_video->fps && !mp_conf.force_fps){ MSG_ERR(MSGTR_FPSnotspecified); d_video->sh=NULL; - sh_video=(sh_video_t*)d_video->sh; + sh_video=reinterpret_cast<sh_video_t*>(d_video->sh); } } } static void mpxp_read_subtitles(const char *filename,int forced_subs_only,int stream_dump_type) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); stream_t* stream=priv->demuxer->stream; if (mp_conf.spudec_ifo) { unsigned int palette[16], width, height; @@ -1080,8 +1080,8 @@ static void mpxp_find_acodec(void) { int found=0; any_t* mpca=0; - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); demux_stream_t *d_audio=priv->demuxer->audio; sh_audio->codec=NULL; mpca=RND_RENAME2(mpca_init)(sh_audio); // try auto-probe first @@ -1125,14 +1125,14 @@ MSG_ERR(" 0x%08X!\n",sh_audio->wtag); MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("win32codecs.conf")); d_audio->sh=NULL; - sh_audio=(sh_audio_t*)d_audio->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } } static MPXP_Rc mpxp_find_vcodec(void) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); demux_stream_t *d_video=priv->demuxer->video; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); MPXP_Rc rc=MPXP_Ok; MP_UNIT("init_video_codec"); sh_video->inited=0; @@ -1175,7 +1175,7 @@ MSG_ERR(" 0x%08X!\n",sh_video->fourcc); MSG_HINT( MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("win32codecs.conf")); d_video->sh = NULL; - sh_video = (sh_video_t*)d_video->sh; + sh_video = reinterpret_cast<sh_video_t*>(d_video->sh); rc=MPXP_False; } else priv->inited_flags|=INITED_VCODEC; @@ -1186,9 +1186,9 @@ } static int mpxp_configure_audio(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); demux_stream_t *d_audio=priv->demuxer->audio; int rc=0; const ao_info_t *info=ao_get_info(ao_data); @@ -1233,7 +1233,7 @@ ao_data->channels,ao_data->format)) { MSG_ERR("Can't configure audio device\n"); d_audio->sh=NULL; - sh_audio=(sh_audio_t*)d_audio->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); if(sh_video == NULL) rc=-1; } else { priv->inited_flags|=INITED_AO; @@ -1250,9 +1250,9 @@ } static void mpxp_run_ahead_engine(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); MP_UNIT("init_xp"); if(sh_video && xp_core->num_v_buffs < 3) {/* we need at least 3 buffers to suppress screen judering */ MSG_FATAL("Not enough buffers for DECODING AHEAD!\nNeed %u buffers but exist only %u\n",3,xp_core->num_v_buffs); @@ -1270,8 +1270,8 @@ } static void mpxp_print_audio_status(void) { - priv_t*priv=(priv_t*)mp_data->priv; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); /* PAINT audio OSD */ unsigned ipts,rpts; unsigned char h,m,s,rh,rm,rs; @@ -1296,10 +1296,10 @@ #ifdef USE_OSD static int mpxp_paint_osd(int* osd_visible,int* in_pause) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); const stream_t* stream=priv->demuxer->stream; - sh_audio_t* sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video_t* sh_video=(sh_video_t*)priv->demuxer->video->sh; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); int rc=0; if(*osd_visible) { if (!--(*osd_visible)) { @@ -1373,7 +1373,7 @@ }input_state_t; static int mpxp_handle_input(seek_args_t* seek,osd_args_t* osd,input_state_t* state) { - priv_t*priv=(priv_t*)mp_data->priv; + priv_t*priv=reinterpret_cast<priv_t*>(mp_data->priv); stream_t* stream=priv->demuxer->stream; sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); int v_bright=0; @@ -1806,8 +1806,8 @@ sh_audio_t* sh_audio; sh_video_t* sh_video; - sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; - sh_video=(sh_video_t*)priv->demuxer->video->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); + sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); mpxp_print_stream_formats(); @@ -1827,7 +1827,7 @@ MP_UNIT("init_audio_codec"); if(sh_audio) mpxp_find_acodec(); - sh_audio=(sh_audio_t*)priv->demuxer->audio->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(priv->demuxer->audio->sh); if(stream_dump_type>1) { dump_mux_init(priv->demuxer,priv->libinput); @@ -1837,7 +1837,7 @@ if(!(ao_data=RND_RENAME5(ao_init)(ao_subdevice))) { MSG_ERR(MSGTR_CannotInitAO); d_audio->sh=NULL; - sh_audio=(sh_audio_t*)d_audio->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } if(ao_subdevice) mp_free(ao_subdevice); priv->ao_inited=RND_RENAME4(ao_register)(ao_data,mp_conf.audio_driver,0); @@ -1852,7 +1852,7 @@ if(RND_RENAME2(mpca_init)(sh_audio)==NULL){ MSG_ERR(MSGTR_CouldntInitAudioCodec); d_audio->sh=NULL; - sh_audio=(sh_audio_t*)d_audio->sh; + sh_audio=reinterpret_cast<sh_audio_t*>(d_audio->sh); } } if(sh_audio) { @@ -1878,7 +1878,7 @@ sh_video->vfilter_inited=1; } if((mpxp_find_vcodec())!=MPXP_Ok) { - sh_video=(sh_video_t*)priv->demuxer->video->sh; + sh_video=reinterpret_cast<sh_video_t*>(priv->demuxer->video->sh); if(!sh_audio) goto goto_next_file; goto main; } Modified: mplayerxp/xmpcore/xmp_adecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/xmpcore/xmp_adecoder.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -378,9 +378,9 @@ volatile float dec_ahead_audio_delay; int xp_thread_decode_audio(demux_stream_t *d_audio) { - sh_audio_t* sh_audio=(sh_audio_t*)xp_core->audio->sh; + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(xp_core->audio->sh); sh_video_t* sh_video=NULL; - if(xp_core->video) sh_video=(sh_video_t*)xp_core->video->sh; + if(xp_core->video) sh_video=reinterpret_cast<sh_video_t*>(xp_core->video->sh); int free_buf, vbuf_size, pref_buf; unsigned len=0; @@ -419,8 +419,8 @@ /* this routine decodes audio only */ any_t* a_dec_ahead_routine( any_t* arg ) { - mpxp_thread_t* priv=(mpxp_thread_t*)arg; - sh_audio_t* sh_audio=(sh_audio_t*)priv->dae->sh; + mpxp_thread_t* priv=reinterpret_cast<mpxp_thread_t*>(arg); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->dae->sh); demux_stream_t *d_audio=sh_audio->ds; int ret; Modified: mplayerxp/xmpcore/xmp_aplayer.cpp =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/xmpcore/xmp_aplayer.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -128,11 +128,11 @@ extern ao_data_t* ao_data; any_t* audio_play_routine( any_t* arg ) { - mpxp_thread_t* priv=(mpxp_thread_t*)arg; - sh_audio_t* sh_audio=(sh_audio_t*)priv->dae->sh; + mpxp_thread_t* priv=reinterpret_cast<mpxp_thread_t*>(arg); + sh_audio_t* sh_audio=reinterpret_cast<sh_audio_t*>(priv->dae->sh); demux_stream_t *d_audio=sh_audio->ds; demuxer_t *demuxer=d_audio->demuxer; - sh_video_t* sh_video=(sh_video_t*)demuxer->video->sh; + sh_video_t* sh_video=reinterpret_cast<sh_video_t*>(demuxer->video->sh); int eof = 0; struct timeval now; Modified: mplayerxp/xmpcore/xmp_vdecoder.cpp =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-11-15 06:13:28 UTC (rev 369) +++ mplayerxp/xmpcore/xmp_vdecoder.cpp 2012-11-15 06:58:22 UTC (rev 370) @@ -111,8 +111,8 @@ any_t* xmp_video_decoder( any_t* arg ) { - mpxp_thread_t* priv=(mpxp_th... [truncated message content] |