Thread: [Mplayerxp-cvslog] SF.net SVN: mplayerxp:[217] mplayerxp (Page 12)
Brought to you by:
olov
From: <nic...@us...> - 2012-10-26 10:24:16
|
Revision: 217 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=217&view=rev Author: nickols_k Date: 2012-10-26 10:24:02 +0000 (Fri, 26 Oct 2012) Log Message: ----------- improve readability of sources Modified Paths: -------------- mplayerxp/dump.c mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_acm.c mplayerxp/libmpcodecs/ad_ffmp3.c mplayerxp/libmpcodecs/ad_pcm.c mplayerxp/libmpcodecs/ad_qtaudio.c mplayerxp/libmpcodecs/ad_real.c mplayerxp/libmpdemux/asf.h mplayerxp/libmpdemux/aviheader.h mplayerxp/libmpdemux/demux_aiff.c mplayerxp/libmpdemux/demux_asf.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_dv.c mplayerxp/libmpdemux/demux_film.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mov.c mplayerxp/libmpdemux/demux_mpg.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_nsv.c mplayerxp/libmpdemux/demux_nuv.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_pva.c mplayerxp/libmpdemux/demux_ra.c mplayerxp/libmpdemux/demux_rawaudio.c mplayerxp/libmpdemux/demux_rawvideo.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_roq.c mplayerxp/libmpdemux/demux_smjpeg.c mplayerxp/libmpdemux/demux_ts.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/demux_viv.c mplayerxp/libmpdemux/demux_vqf.c mplayerxp/libmpdemux/demux_y4m.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/mp3_hdr.c mplayerxp/libmpdemux/mpeg_hdr.c mplayerxp/libmpdemux/mpxpav64.h mplayerxp/libmpdemux/mux_lavf.c mplayerxp/libmpdemux/mux_mpxp64.c mplayerxp/libmpdemux/muxer.h mplayerxp/libmpdemux/parse_mp4.c mplayerxp/libmpdemux/parse_mp4.h mplayerxp/libmpdemux/pnm.c mplayerxp/libmpdemux/s_dvdread.c mplayerxp/libmpdemux/s_oss.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libmpdemux/stheader.h mplayerxp/libmpdemux/stream.h mplayerxp/libmpdemux/sub_cc.c mplayerxp/libmpdemux/sub_ty.c mplayerxp/libmpdemux/test.c mplayerxp/libmpdemux/tvi_bsdbt848.c mplayerxp/libmpdemux/tvi_dummy.c mplayerxp/libmpdemux/tvi_v4l.c mplayerxp/libmpdemux/yuv4mpeg.h mplayerxp/mplayer.c mplayerxp/postproc/af_crystality.c Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/dump.c 2012-10-26 10:24:02 UTC (rev 217) @@ -164,7 +164,7 @@ { sha->wf=malloc(sizeof(WAVEFORMATEX)); sha->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; - sha->wf->wFormatTag = sha->format; + sha->wf->wFormatTag = sha->wtag; sha->wf->nChannels = sha->channels; sha->wf->nSamplesPerSec = sha->samplerate; sha->wf->nAvgBytesPerSec=sha->i_bps; //mux_a->h.dwSampleSize*mux_a->wf->nSamplesPerSec; Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-10-26 10:24:02 UTC (rev 217) @@ -59,11 +59,11 @@ if(c<0) { a52_priv->last_pts=*pts=apts; return -1; } /* EOF*/ sh_audio->a_in_buffer[sh_audio->a_in_buffer_len++]=c; } - if(sh_audio->format!=0x2000) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8); + if(sh_audio->wtag!=0x2000) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8); length = a52_syncinfo (sh_audio->a_in_buffer, &flags, &sample_rate, &bit_rate); if(length>=7 && length<=MAX_AC3_FRAME) break; /* we're done.*/ /* bad file => resync*/ - if(sh_audio->format!=0x2000) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8); + if(sh_audio->wtag!=0x2000) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8); memmove(sh_audio->a_in_buffer,sh_audio->a_in_buffer+1,7); --sh_audio->a_in_buffer_len; apts=0; @@ -72,7 +72,7 @@ sh_audio->samplerate=sample_rate; sh_audio->i_bps=bit_rate/8; demux_read_data_r(sh_audio->ds,sh_audio->a_in_buffer+8,length-8,apts?&null_pts:&apts); - if(sh_audio->format!=0x2000) swab(sh_audio->a_in_buffer+8,sh_audio->a_in_buffer+8,length-8); + if(sh_audio->wtag!=0x2000) swab(sh_audio->a_in_buffer+8,sh_audio->a_in_buffer+8,length-8); a52_priv->last_pts=*pts=apts; if(crc16_block(sh_audio->a_in_buffer+2,length-2)!=0) MSG_STATUS("a52: CRC check failed! \n"); Modified: mplayerxp/libmpcodecs/ad_acm.c =================================================================== --- mplayerxp/libmpcodecs/ad_acm.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpcodecs/ad_acm.c 2012-10-26 10:24:02 UTC (rev 217) @@ -52,7 +52,7 @@ { in_fmt=sh_audio->wf=malloc(sizeof(WAVEFORMATEX)); memcpy(in_fmt,&priv->o_wf,sizeof(WAVEFORMATEX)); - in_fmt->wFormatTag=sh_audio->format; + in_fmt->wFormatTag=sh_audio->wtag; } if(mp_conf.verbose) @@ -60,7 +60,7 @@ MSG_V("Output fmt:\n"); print_wave_header(&priv->o_wf,sizeof(WAVEFORMATEX)); } - MSACM_RegisterDriver((const char *)sh_audio->codec->dll_name, sh_audio->format, 0); + MSACM_RegisterDriver((const char *)sh_audio->codec->dll_name, sh_audio->wtag, 0); ret=acmStreamOpen(&priv->srcstream,(HACMDRIVER)NULL,in_fmt,&priv->o_wf,NULL,0,0,0); if(ret){ if(ret==ACMERR_NOTPOSSIBLE) Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-26 10:24:02 UTC (rev 217) @@ -84,7 +84,7 @@ memcpy(lavc_context->extradata, (char *)sh_audio->codecdata, lavc_context->extradata_size); } - lavc_context->codec_tag = sh_audio->format; + lavc_context->codec_tag = sh_audio->wtag; lavc_context->codec_type = lavc_codec->type; lavc_context->codec_id = lavc_codec->id; /* open it */ @@ -160,7 +160,7 @@ int len2=maxlen; int x=ds_get_packet_r(sh_audio->ds,&start,apts?&null_pts:&apts); if(x<=0) break; // error - if(sh_audio->format==mmioFOURCC('d','n','e','t')) swab(start,start,x&(~1)); + if(sh_audio->wtag==mmioFOURCC('d','n','e','t')) swab(start,start,x&(~1)); av_init_packet(&pkt); pkt.data = start; pkt.size = x; @@ -169,7 +169,7 @@ if(y<x) { sh_audio->ds->buffer_pos+=y-x; // put back data (HACK!) - if(sh_audio->format==mmioFOURCC('d','n','e','t')) + if(sh_audio->wtag==mmioFOURCC('d','n','e','t')) swab(start+y,start+y,(x-y)&~(1)); } if(len2>0){ Modified: mplayerxp/libmpcodecs/ad_pcm.c =================================================================== --- mplayerxp/libmpcodecs/ad_pcm.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpcodecs/ad_pcm.c 2012-10-26 10:24:02 UTC (rev 217) @@ -25,7 +25,7 @@ sh_audio->channels=h->nChannels; sh_audio->samplerate=h->nSamplesPerSec; sh_audio->samplesize=(h->wBitsPerSample+7)/8; - switch(sh_audio->format){ /* hardware formats: */ + switch(sh_audio->wtag){ /* hardware formats: */ case 0x3: sh_audio->sample_format=AFMT_FLOAT32; break; case 0x6: sh_audio->sample_format=AFMT_A_LAW;break; case 0x7: sh_audio->sample_format=AFMT_MU_LAW;break; Modified: mplayerxp/libmpcodecs/ad_qtaudio.c =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-26 10:24:02 UTC (rev 217) @@ -197,7 +197,7 @@ InputFormatInfo.sampleSize = sh->wf->wBitsPerSample; OutputFormatInfo.sampleSize = 16; OutputFormatInfo.sampleRate = InputFormatInfo.sampleRate = sh->wf->nSamplesPerSec; - InputFormatInfo.format = bswap_32(sh->format); //1363430706;///*1768775988;//*/1902406962;//qdm2//1768775988;//FOUR_CHAR_CODE('ima4'); + InputFormatInfo.format = bswap_32(sh->wtag); //1363430706;///*1768775988;//*/1902406962;//qdm2//1768775988;//FOUR_CHAR_CODE('ima4'); OutputFormatInfo.format = 1313820229;// FOUR_CHAR_CODE('NONE'); error = SoundConverterOpen(&InputFormatInfo, &OutputFormatInfo, &myConverter); Modified: mplayerxp/libmpcodecs/ad_real.c =================================================================== --- mplayerxp/libmpcodecs/ad_real.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpcodecs/ad_real.c 2012-10-26 10:24:02 UTC (rev 217) @@ -221,12 +221,12 @@ UNUSED(maxlen); if(sh->a_in_buffer_len<=0){ // fill the buffer! - if (sh->format == mmioFOURCC('1','4','_','4')) { + if (sh->wtag == mmioFOURCC('1','4','_','4')) { demux_read_data_r(sh->ds, sh->a_in_buffer, sh->wf->nBlockAlign,pts); sh->a_in_buffer_size= sh->a_in_buffer_len=sh->wf->nBlockAlign; } else - if (sh->format == mmioFOURCC('2','8','_','8')) { + if (sh->wtag == mmioFOURCC('2','8','_','8')) { unsigned i,j; for (j = 0; j < h; j++) for (i = 0; i < h/2; i++) Modified: mplayerxp/libmpdemux/asf.h =================================================================== --- mplayerxp/libmpdemux/asf.h 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/asf.h 2012-10-26 10:24:02 UTC (rev 217) @@ -137,7 +137,7 @@ /* * Some macros to swap little endian structures read from an ASF file - * into machine endian format + * into machine endian wtag */ #ifdef WORDS_BIGENDIAN #define le2me_ASF_obj_header_t(h) { \ Modified: mplayerxp/libmpdemux/aviheader.h =================================================================== --- mplayerxp/libmpdemux/aviheader.h 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/aviheader.h 2012-10-26 10:24:02 UTC (rev 217) @@ -6,7 +6,7 @@ /* * Some macros to swap little endian structures read from an AVI file - * into machine endian format + * into machine endian wtag */ #ifdef WORDS_BIGENDIAN #define le2me_MainAVIHeader(h) { \ Modified: mplayerxp/libmpdemux/demux_aiff.c =================================================================== --- mplayerxp/libmpdemux/demux_aiff.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_aiff.c 2012-10-26 10:24:02 UTC (rev 217) @@ -54,7 +54,7 @@ priv=demuxer->priv=malloc(sizeof(priv_t)); memset(priv,0,sizeof(priv_t)); sh_audio->wf = w = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX)); - w->wFormatTag = 0x1; sh_audio->format = mmioFOURCC('r','a','w',' '); /* S16BE */ + w->wFormatTag = 0x1; sh_audio->wtag = mmioFOURCC('r','a','w',' '); /* S16BE */ w->nChannels = sh_audio->channels = w->nSamplesPerSec = sh_audio->samplerate = w->nAvgBytesPerSec = @@ -109,9 +109,9 @@ w->nBlockAlign = sh_audio->channels*sh_audio->samplesize; if(priv->verc) { - sh_audio->format = *((uint32_t *)&buf[18]); - if(sh_audio->format == mmioFOURCC('N','O','N','E')) sh_audio->format=mmioFOURCC('r','a','w',' '); - MSG_V("AIFC: fourcc %08X ch %u frames %u bps %u rate %u\n",sh_audio->format,sh_audio->channels,frames,w->wBitsPerSample,sh_audio->samplerate); + sh_audio->wtag = *((uint32_t *)&buf[18]); + if(sh_audio->wtag == mmioFOURCC('N','O','N','E')) sh_audio->wtag=mmioFOURCC('r','a','w',' '); + MSG_V("AIFC: fourcc %08X ch %u frames %u bps %u rate %u\n",sh_audio->wtag,sh_audio->channels,frames,w->wBitsPerSample,sh_audio->samplerate); } else MSG_V("AIFF: ch %u frames %u bps %u rate %u\n",sh_audio->channels,frames,w->wBitsPerSample,sh_audio->samplerate); Modified: mplayerxp/libmpdemux/demux_asf.c =================================================================== --- mplayerxp/libmpdemux/demux_asf.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_asf.c 2012-10-26 10:24:02 UTC (rev 217) @@ -383,14 +383,14 @@ } else { sh_audio_t *sh_audio = demuxer->audio->sh; sh_audio=d_audio->sh;sh_audio->ds=d_audio; - sh_audio->format=sh_audio->wf->wFormatTag; + sh_audio->wtag=sh_audio->wf->wFormatTag; } } } return demuxer; } -// based on asf file-format doc by Eugene [http://divx.euro.ru] +// based on asf file-wtag doc by Eugene [http://divx.euro.ru] static void asf_descrambling(asf_priv_t *apriv, unsigned char *src,int len){ unsigned char *dst=malloc(len); @@ -718,7 +718,7 @@ demuxer_driver_t demux_asf = { - "ASF - Advanced stream format v1 parser", + "ASF - Advanced stream wtag v1 parser", ".asf", NULL, asf_probe, Modified: mplayerxp/libmpdemux/demux_audio.c =================================================================== --- mplayerxp/libmpdemux/demux_audio.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_audio.c 2012-10-26 10:24:02 UTC (rev 217) @@ -988,14 +988,14 @@ break; } } - /* Add here some other audio format detection */ + /* Add here some other audio wtag detection */ if(step < HDR_SIZE) memmove(hdr,&hdr[step],HDR_SIZE-step); pos -= step; } if(!frmt) { - MSG_ERR("Can't detect audio format\n"); + MSG_ERR("Can't detect audio wtag\n"); return NULL; } sh_audio = new_sh_audio(demuxer,0); @@ -1005,7 +1005,7 @@ { uint8_t chunk[4]; uint32_t block_size; - sh_audio->format = mmioFOURCC('f', 'L', 'a', 'C'); + sh_audio->wtag = mmioFOURCC('f', 'L', 'a', 'C'); /* loop through the metadata blocks; use a do-while construct since there * will always be 1 metadata block */ do { @@ -1078,9 +1078,9 @@ if(id == 27) id=WAVE_FORMAT_ALAW; else if(id == 3) id=0x1; - w->wFormatTag = sh_audio->format = id; + w->wFormatTag = sh_audio->wtag = id; /* Trickly mplayerxp will threat 'raw ' as big-endian */ - if(id == 0x1) sh_audio->format=mmioFOURCC('r','a','w',' '); + if(id == 0x1) sh_audio->wtag=mmioFOURCC('r','a','w',' '); w->nSamplesPerSec = sh_audio->samplerate = stream_read_dword(s); w->nChannels = sh_audio->channels = stream_read_dword(s); w->nAvgBytesPerSec = sh_audio->samplerate*sh_audio->samplesize*sh_audio->channels; @@ -1095,25 +1095,25 @@ break; case RAW_MP1: case RAW_MP2: - sh_audio->format = 0x50; + sh_audio->wtag = 0x50; sh_audio->i_bps=mp3_brate; sh_audio->samplerate=mp3_samplerate; sh_audio->channels=mp3_channels; if(!read_mp3v1_tags(demuxer,hdr,pos)) return 0; /* id3v1 may coexist with id3v2 */ break; case RAW_MP3: - sh_audio->format = 0x55; + sh_audio->wtag = 0x55; sh_audio->i_bps=mp3_brate; sh_audio->samplerate=mp3_samplerate; sh_audio->channels=mp3_channels; if(!read_mp3v1_tags(demuxer,hdr,pos)) return 0; /* id3v1 may coexist with id3v2 */ break; case RAW_AC3: - sh_audio->format = 0x2000; + sh_audio->wtag = 0x2000; if(!read_ac3_tags(demuxer,hdr,pos,&sh_audio->i_bps,&sh_audio->samplerate,&sh_audio->channels)) return 0; break; case RAW_DCA: - sh_audio->format = 0x2001; + sh_audio->wtag = 0x2001; if(!read_ddca_tags(demuxer,hdr,pos,&sh_audio->i_bps,&sh_audio->samplerate,&sh_audio->channels)) return 0; sh_audio->i_bps/=8; break; @@ -1122,13 +1122,13 @@ const unsigned freqs[4]={ 44100, 48000, 37800, 32000 }; uint32_t frames,ms,profile,encv,sver; unsigned char bt; - sh_audio->format = mmioFOURCC('M','P','C',' '); + sh_audio->wtag = mmioFOURCC('M','P','C',' '); stream_seek(s,4); frames = stream_read_dword(s); stream_skip(s,2); bt=stream_read_char(s); sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX)); - sh_audio->wf->wFormatTag = sh_audio->format; + sh_audio->wf->wFormatTag = sh_audio->wtag; sh_audio->wf->nChannels = 2; sh_audio->wf->nSamplesPerSec = freqs[bt & 3]; sh_audio->wf->nBlockAlign = 32 * 36; @@ -1163,7 +1163,7 @@ stream_read(s,chunk,4); if(chunk[0]!=0x01) { MSG_V("VOC unknown block type %02X\n",chunk[0]); return NULL; } size=chunk[1]|(chunk[2]<<8)|(chunk[3]<<16); - sh_audio->format = 0x01; /* PCM */ + sh_audio->wtag = 0x01; /* PCM */ stream_read(s,chunk,2); if(chunk[1]!=0) { MSG_V("VOC unknown compression type %02X\n",chunk[1]); return NULL; } demuxer->movi_start=stream_tell(s); @@ -1172,7 +1172,7 @@ sh_audio->channels=1; sh_audio->samplesize=1; sh_audio->wf = w = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX)); - w->wFormatTag = sh_audio->format; + w->wFormatTag = sh_audio->wtag; w->nChannels = sh_audio->channels; w->nSamplesPerSec = sh_audio->samplerate; w->nAvgBytesPerSec = sh_audio->samplerate*sh_audio->samplesize*sh_audio->channels; @@ -1204,7 +1204,7 @@ free_sh_audio(sh_audio); return NULL; } - w->wFormatTag = sh_audio->format = stream_read_word_le(s); + w->wFormatTag = sh_audio->wtag = stream_read_word_le(s); w->nChannels = sh_audio->channels = stream_read_word_le(s); w->nSamplesPerSec = sh_audio->samplerate = stream_read_dword_le(s); w->nAvgBytesPerSec = stream_read_dword_le(s); @@ -1286,9 +1286,9 @@ switch(raw_id) { case RAW_MP1: - case RAW_MP2: sh_audio->format=w->wFormatTag=0x50; break; - case RAW_MP3: sh_audio->format=w->wFormatTag=0x55; break; - case RAW_FLAC:sh_audio->format = mmioFOURCC('f', 'L', 'a', 'C'); break; + case RAW_MP2: sh_audio->wtag=w->wFormatTag=0x50; break; + case RAW_MP3: sh_audio->wtag=w->wFormatTag=0x55; break; + case RAW_FLAC:sh_audio->wtag = mmioFOURCC('f', 'L', 'a', 'C'); break; case RAW_SND_AU: { unsigned hsize,dsize; uint32_t id; @@ -1300,18 +1300,18 @@ if(id == 27) id=WAVE_FORMAT_ALAW; else if(id == 3) id=0x1; - w->wFormatTag = sh_audio->format = id; + w->wFormatTag = sh_audio->wtag = id; /* Trickly mplayerxp will threat 'raw ' as big-endian */ - if(id == 0x1) sh_audio->format=mmioFOURCC('r','a','w',' '); + if(id == 0x1) sh_audio->wtag=mmioFOURCC('r','a','w',' '); break; } - case RAW_AC3: sh_audio->format=w->wFormatTag=0x2000; break; - case RAW_DCA: sh_audio->format=w->wFormatTag=0x2001; + case RAW_AC3: sh_audio->wtag=w->wFormatTag=0x2000; break; + case RAW_DCA: sh_audio->wtag=w->wFormatTag=0x2001; if(brate) brate/=8; break; default: case RAW_VOC: break; - case RAW_MUSEPACK: sh_audio->format = mmioFOURCC('M','P','+',' '); break; + case RAW_MUSEPACK: sh_audio->wtag = mmioFOURCC('M','P','+',' '); break; } if(brate) sh_audio->i_bps=brate; if(channels) w->nChannels = sh_audio->channels = channels; @@ -1320,7 +1320,7 @@ } stream_seek(s,data_off); /* id3v1 tags may exist within WAV */ - if(sh_audio->format==0x50 || sh_audio->format==0x55) + if(sh_audio->wtag==0x50 || sh_audio->wtag==0x55) { stream_seek(s,data_off); stream_read(s,hdr,4); @@ -1409,7 +1409,7 @@ frmt=priv->frmt; if(frmt==RAW_WAV) { - switch(sh_audio->format) + switch(sh_audio->wtag) { case 0x50: case 0x55: frmt=RAW_MP3; break; @@ -1561,7 +1561,7 @@ return 1; } default: - MSG_ERR("Audio demuxer : unknown format %d\n",priv->frmt); + MSG_ERR("Audio demuxer : unknown wtag %d\n",priv->frmt); } return 0; } @@ -1709,7 +1709,7 @@ frmt=priv->frmt; if(frmt==RAW_WAV) { - switch(sh_audio->format) + switch(sh_audio->wtag) { case 0x2000: frmt=RAW_AC3; break; case 0x2001: frmt=RAW_DCA; break; Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_avi.c 2012-10-26 10:24:02 UTC (rev 217) @@ -199,7 +199,7 @@ // for example, "Seattle, aerial view; scenery." case mmioFOURCC('I','K','E','Y'): hdr="Keywords";break; // ILGT - Describes the changes in the lightness settings on the digitizer - // required to produce the file. Note that the format of this information + // required to produce the file. Note that the wtag of this information // depends on the hardware used. case mmioFOURCC('I','L','G','T'): hdr="Lightness";break; // IMED - Decribes the original subject of the file, such as @@ -221,7 +221,7 @@ // file, such as "Microsoft WaveEdit" case mmioFOURCC('I','S','F','T'): infot=INFOT_ENCODER; hdr="Software";break; // ISHP - Identifies the change in sharpness for the digitizer - // required to produce the file (the format depends on the hardware used). + // required to produce the file (the wtag depends on the hardware used). case mmioFOURCC('I','S','H','P'): hdr="Sharpness";break; // ISRC - Identifies the name of the person or organization who // suplied the original subject of the file; for example, "Try Research." @@ -779,7 +779,7 @@ priv->audio_block_size=sh->wf->nBlockAlign; if(!priv->audio_block_size){ // for PCM audio we can calculate the blocksize: - if(sh->format==1) + if(sh->wtag==1) priv->audio_block_size=sh->wf->nChannels*(sh->wf->wBitsPerSample/8); else priv->audio_block_size=1; // hope the best... @@ -1167,7 +1167,7 @@ priv->idx_pos_a=0; priv->idx_pos_v=0; if(priv->idx_size>1){ - // decide index format: + // decide index wtag: #if 1 if((unsigned long)((AVIINDEXENTRY *)priv->idx)[0].dwChunkOffset<demuxer->movi_start || (unsigned long)((AVIINDEXENTRY *)priv->idx)[1].dwChunkOffset<demuxer->movi_start) @@ -1243,7 +1243,7 @@ sh_audio=NULL; } else { sh_audio=d_audio->sh;sh_audio->ds=d_audio; - sh_audio->format=sh_audio->wf->wFormatTag; + sh_audio->wtag=sh_audio->wf->wFormatTag; } } // calc. FPS: @@ -1310,9 +1310,9 @@ #ifdef HAVE_LIBVORBIS if(demuxer->audio->id != -2 && sh_a) { /* support for Ogg-in-AVI: */ - if(sh_a->format == mmioFOURCC('v','r','b','s')) + if(sh_a->wtag == mmioFOURCC('v','r','b','s')) demuxer = init_avi_with_ogg(demuxer); - else if(sh_a->format == 0x674F) { + else if(sh_a->wtag == 0x674F) { stream_t* s; demuxer_t *od; s = new_ds_stream(demuxer->audio); Modified: mplayerxp/libmpdemux/demux_dv.c =================================================================== --- mplayerxp/libmpdemux/demux_dv.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_dv.c 2012-10-26 10:24:02 UTC (rev 217) @@ -174,7 +174,7 @@ sh_video->ds = demuxer->video; // custom fourcc for internal MPlayer use -// sh_video->format = mmioFOURCC('R', 'A', 'D', 'V'); +// sh_video->wtag = mmioFOURCC('R', 'A', 'D', 'V'); sh_video->fourcc = mmioFOURCC('D', 'V', 'S', 'D'); sh_video->src_w = dv_decoder->width; @@ -207,11 +207,11 @@ sh_audio->ds = demuxer->audio; MSG_V("demux_open_rawdv() chan: %d samplerate: %d\n",dv_decoder->audio->num_channels,dv_decoder->audio->frequency ); // custom fourcc for internal MPlayer use - sh_audio->format = mmioFOURCC('R', 'A', 'D', 'V'); + sh_audio->wtag = mmioFOURCC('R', 'A', 'D', 'V'); sh_audio->wf = malloc(sizeof(WAVEFORMATEX)); memset(sh_audio->wf, 0, sizeof(WAVEFORMATEX)); - sh_audio->wf->wFormatTag = sh_audio->format; + sh_audio->wf->wFormatTag = sh_audio->wtag; sh_audio->wf->nChannels = dv_decoder->audio->num_channels; sh_audio->wf->wBitsPerSample = 16; sh_audio->wf->nSamplesPerSec = dv_decoder->audio->frequency; Modified: mplayerxp/libmpdemux/demux_film.c =================================================================== --- mplayerxp/libmpdemux/demux_film.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_film.c 2012-10-26 10:24:02 UTC (rev 217) @@ -6,7 +6,7 @@ Sega Saturn CD-ROM games. FILM files have also been found on 3DO games. - Details of the FILM file format can be found at: + Details of the FILM file wtag can be found at: http://www.pcisys.net/~melanson/codecs/ TODO: demuxer->movi_length @@ -300,9 +300,9 @@ sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX)); - // uncompressed PCM format + // uncompressed PCM wtag sh_audio->wf->wFormatTag = 1; - sh_audio->format = 1; + sh_audio->wtag = 1; sh_audio->wf->nChannels = audio_channels; sh_audio->wf->wBitsPerSample = stream_read_char(demuxer->stream); stream_skip(demuxer->stream, 1); // skip unknown byte @@ -331,9 +331,9 @@ sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX)); - // uncompressed PCM format + // uncompressed PCM wtag sh_audio->wf->wFormatTag = 1; - sh_audio->format = 1; + sh_audio->wtag = 1; sh_audio->wf->nChannels = 1; sh_audio->wf->wBitsPerSample = 8; sh_audio->wf->nSamplesPerSec = 22050; Modified: mplayerxp/libmpdemux/demux_lavf.c =================================================================== --- mplayerxp/libmpdemux/demux_lavf.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_lavf.c 2012-10-26 10:24:02 UTC (rev 217) @@ -52,7 +52,7 @@ extern int ts_prog; const config_t lavf_opts[] = { - {"format", &(opt_format), CONF_TYPE_STRING, 0, 0, 0, NULL, "forces format of lavf demuxer"}, + {"wtag", &(opt_format), CONF_TYPE_STRING, 0, 0, 0, NULL, "forces wtag of lavf demuxer"}, {"cryptokey", &(opt_cryptokey), CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies cryptokey for lavf demuxer"}, {NULL, NULL, 0, 0, 0, 0, NULL, NULL} }; @@ -194,7 +194,7 @@ } priv->avif= av_find_input_format(opt_format); if (!priv->avif) { - MSG_FATAL("Unknown lavf format %s\n", opt_format); + MSG_FATAL("Unknown lavf wtag %s\n", opt_format); return 0; } MSG_INFO("Forced lavf %s demuxer\n", priv->avif->long_name); @@ -306,7 +306,7 @@ sh_audio->audio.dwRate /= g; // printf("sca:%d rat:%d fs:%d sr:%d ba:%d\n", sh_audio->audio.dwScale, sh_audio->audio.dwRate, codec->frame_size, codec->sample_rate, codec->block_align); sh_audio->ds= demuxer->audio; - sh_audio->format= codec->codec_tag; + sh_audio->wtag= codec->codec_tag; sh_audio->channels= codec->channels; sh_audio->samplerate= codec->sample_rate; sh_audio->i_bps= codec->bit_rate/8; @@ -322,10 +322,10 @@ sh_audio->samplesize = 2; break; case CODEC_ID_PCM_ALAW: - sh_audio->format = 0x6; + sh_audio->wtag = 0x6; break; case CODEC_ID_PCM_MULAW: - sh_audio->format = 0x7; + sh_audio->wtag = 0x7; break; default: break; Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-10-26 10:24:02 UTC (rev 217) @@ -2370,7 +2370,7 @@ } } - sh_a->format = track->a_formattag; + sh_a->wtag = track->a_formattag; sh_a->wf->wFormatTag = track->a_formattag; sh_a->channels = track->a_channels; sh_a->wf->nChannels = track->a_channels; @@ -2402,7 +2402,7 @@ sh_a->wf->nAvgBytesPerSec = sh_a->channels * sh_a->samplerate*2; sh_a->wf->nBlockAlign = sh_a->wf->nAvgBytesPerSec; if (!strcmp(track->codec_id, MKV_A_PCM_BE)) - sh_a->format = mmioFOURCC('t', 'w', 'o', 's'); + sh_a->wtag = mmioFOURCC('t', 'w', 'o', 's'); } else if (!strcmp(track->codec_id, MKV_A_QDMC) || !strcmp(track->codec_id, MKV_A_QDMC2)) @@ -2557,7 +2557,7 @@ } else { - sh_a->format = mmioFOURCC('f', 'L', 'a', 'C'); + sh_a->wtag = mmioFOURCC('f', 'L', 'a', 'C'); ptr = (unsigned char *) track->private_data + sizeof (WAVEFORMATEX); size = track->private_size - sizeof (WAVEFORMATEX); Modified: mplayerxp/libmpdemux/demux_mov.c =================================================================== --- mplayerxp/libmpdemux/demux_mov.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_mov.c 2012-10-26 10:24:02 UTC (rev 217) @@ -647,7 +647,7 @@ int version=0, adjust; int is_vorbis = 0; sh_audio_t* sh=new_sh_audio(demuxer,priv->track_db); - sh->format=trak->fourcc; + sh->wtag=trak->fourcc; /* crude audio delay from editlist0 hack ::atm */ if(trak->editlist_size>=1) { @@ -657,7 +657,7 @@ } } - switch( sh->format ) { + switch( sh->wtag ) { case 0x726D6173: /* samr */ /* amr narrowband */ trak->samplebytes=sh->samplesize=1; @@ -777,8 +777,8 @@ if ((len >= 22) && (char2int(trak->stdata,52+16)==MOV_FOURCC('e','n','d','a')) && (char2short(trak->stdata,52+20))) { - sh->format=char2int(trak->stdata,52+8); - MSG_V( "MOV: Found little endian PCM data, reversed fourcc:%04x\n", sh->format); + sh->wtag=char2int(trak->stdata,52+8); + MSG_V( "MOV: Found little endian PCM data, reversed fourcc:%04x\n", sh->wtag); } break; default: @@ -817,7 +817,7 @@ if(!mp4_parse_esds(&trak->stdata[36+adjust], atom_len-8, &esds)) { /* 0xdd is a "user private" id, not an official allocated id (see http://www.mp4ra.org/object.html), so perform some extra checks to be sure that this is really vorbis audio */ - if(esds.objectTypeId==0xdd && esds.streamType==0x15 && sh->format==0x6134706D && esds.decoderConfigLen > 8) + if(esds.objectTypeId==0xdd && esds.streamType==0x15 && sh->wtag==0x6134706D && esds.decoderConfigLen > 8) { //vorbis audio unsigned char *buf[3]; @@ -863,15 +863,15 @@ MSG_V( "demux_mov, vorbis extradata size: %d\n", offset); is_vorbis = 1; quit_vorbis_block: - sh->format = mmioFOURCC('v', 'r', 'b', 's'); + sh->wtag = mmioFOURCC('v', 'r', 'b', 's'); } sh->i_bps = esds.avgBitrate/8; if(esds.objectTypeId==MP4OTI_MPEG1Audio || esds.objectTypeId==MP4OTI_MPEG2AudioPart3) - sh->format=0x55; // .mp3 + sh->wtag=0x55; // .mp3 if(esds.objectTypeId==MP4OTI_13kVoice) { // 13K Voice, defined by 3GPP2 - sh->format=mmioFOURCC('Q', 'c', 'l', 'p'); + sh->wtag=mmioFOURCC('Q', 'c', 'l', 'p'); trak->nchannels=sh->channels=1; trak->samplebytes=sh->samplesize=1; } @@ -879,7 +879,7 @@ // dump away the codec specific configuration for the AAC decoder if(esds.decoderConfigLen){ if( (esds.decoderConfig[0]>>3) == 29 ) - sh->format = 0x1d61346d; // request multi-channel mp3 decoder + sh->wtag = 0x1d61346d; // request multi-channel mp3 decoder if(!is_vorbis) { sh->codecdata_len = esds.decoderConfigLen; @@ -918,7 +918,7 @@ // Emulate WAVEFORMATEX struct: sh->wf=malloc(sizeof(WAVEFORMATEX)); memset(sh->wf,0,sizeof(WAVEFORMATEX)); - sh->wf->wFormatTag=afourcc2wtag(sh->format); + sh->wf->wFormatTag=afourcc2wtag(sh->wtag); sh->wf->nChannels=sh->channels; sh->wf->wBitsPerSample=(trak->stdata[18]<<8)+trak->stdata[19]; // sh->wf->nSamplesPerSec=trak->timescale; @@ -932,7 +932,7 @@ } else { sh->wf->nAvgBytesPerSec=sh->wf->nChannels*sh->wf->wBitsPerSample*sh->wf->nSamplesPerSec/8; // workaround for ms11 ima4 - if (sh->format == 0x1100736d && trak->stdata_len >= 36) + if (sh->wtag == 0x1100736d && trak->stdata_len >= 36) sh->wf->nBlockAlign=char2int(trak->stdata,36); } Modified: mplayerxp/libmpdemux/demux_mpg.c =================================================================== --- mplayerxp/libmpdemux/demux_mpg.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_mpg.c 2012-10-26 10:24:02 UTC (rev 217) @@ -151,10 +151,10 @@ new_sh_audio(demux,aid); sh_a = (sh_audio_t*)demux->a_streams[aid]; switch(aid & 0xE0){ // 1110 0000 b (high 3 bit: type low 5: id) - case 0x00: sh_a->format=AUDIO_MP2;break; - case 0xA0: sh_a->format=AUDIO_LPCM_BE;break; - case 0x80: if((aid & 0xF8) == 0x88) sh_a->format=AUDIO_DTS; - else sh_a->format=AUDIO_A52; + case 0x00: sh_a->wtag=AUDIO_MP2;break; + case 0xA0: sh_a->wtag=AUDIO_LPCM_BE;break; + case 0x80: if((aid & 0xF8) == 0x88) sh_a->wtag=AUDIO_DTS; + else sh_a->wtag=AUDIO_A52; break; } if (mpg_d) mpg_d->a_stream_ids[mpg_d->num_a_streams++] = aid; @@ -354,7 +354,7 @@ if(priv && ds->sh) { sh_audio_t *sh = (sh_audio_t *)ds->sh; if(priv->es_map[id - 0x1B0]) { - sh->format = priv->es_map[id - 0x1B0]; + sh->wtag = priv->es_map[id - 0x1B0]; MSG_DBG2("ASSIGNED TO STREAM %d CODEC %x\n", id, priv->es_map[id - 0x1B0]); } } @@ -750,7 +750,7 @@ MSG_ERR("MPEG: " MSGTR_MissingVideoStreamBug); else { - MSG_V("Not MPEG System Stream format...\n"); + MSG_V("Not MPEG System Stream wtag...\n"); return 0; } } @@ -838,14 +838,14 @@ do { i = (i+1) % mpg_d->num_a_streams; sh_a = (sh_audio_t*)demuxer->a_streams[mpg_d->a_stream_ids[i]]; - } while (sh_a->format != sh_audio->format); + } while (sh_a->wtag != sh_audio->wtag); } else { for (i = 0; i < mpg_d->num_a_streams; i++) if (*((int*)arg) == mpg_d->a_stream_ids[i]) break; if (i < mpg_d->num_a_streams) sh_a = (sh_audio_t*)demuxer->a_streams[*((int*)arg)]; - if (sh_a->format != sh_audio->format) + if (sh_a->wtag != sh_audio->wtag) i = mpg_d->num_a_streams; } if (i < mpg_d->num_a_streams && d_audio->id != mpg_d->a_stream_ids[i]) { Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-26 10:24:02 UTC (rev 217) @@ -1,5 +1,5 @@ /* - MPlayerXP's design. MPXPAV64 format. + MPlayerXP's design. MPXPAV64 wtag. Implements of ASF v1, AVI stream parsers. */ @@ -298,7 +298,7 @@ if(demuxer->audio->id==-1) demuxer->audio->id=id; /* TODO: select best */ demuxer->audio->sh=sh; sh->ds=demuxer->audio; - sh->format=sh->wf->wFormatTag; + sh->wtag=sh->wf->wFormatTag; break; case mmioFOURCC('F','R','C','C'): if(fsize!=4) @@ -306,7 +306,7 @@ MSG_ERR("Broken chunk FRCC with size=%i found\n",fsize); goto do_def; } - sh->format=stream_read_dword_le(s); + sh->wtag=stream_read_dword_le(s); if(sh->wf) sh->wf->wFormatTag=0; break; do_def: Modified: mplayerxp/libmpdemux/demux_nsv.c =================================================================== --- mplayerxp/libmpdemux/demux_nsv.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_nsv.c 2012-10-26 10:24:02 UTC (rev 217) @@ -213,7 +213,7 @@ if((demuxer->audio->id != -2) && strncmp(hdr+8,"NONE", 4)){//&&strncmp(hdr+8,"VLB ", 4)){ sh_audio = new_sh_audio ( demuxer, 0 ); demuxer->audio->sh = sh_audio; - sh_audio->format=mmioFOURCC(hdr[8],hdr[9],hdr[10],hdr[11]); + sh_audio->wtag=mmioFOURCC(hdr[8],hdr[9],hdr[10],hdr[11]); sh_audio->ds = demuxer->audio; priv->a_format=mmioFOURCC(hdr[8],hdr[9],hdr[10],hdr[11]); } Modified: mplayerxp/libmpdemux/demux_nuv.c =================================================================== --- mplayerxp/libmpdemux/demux_nuv.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_nuv.c 2012-10-26 10:24:02 UTC (rev 217) @@ -261,13 +261,13 @@ sh_audio = new_sh_audio(demuxer, 0); demuxer->audio->sh = sh_audio; sh_audio->ds = demuxer->audio; - sh_audio->format = 0x1; + sh_audio->wtag = 0x1; sh_audio->channels = 2; sh_audio->samplerate = 44100; sh_audio->wf = malloc(sizeof(WAVEFORMATEX)); memset(sh_audio->wf, 0, sizeof(WAVEFORMATEX)); - sh_audio->wf->wFormatTag = sh_audio->format; + sh_audio->wf->wFormatTag = sh_audio->wtag; sh_audio->wf->nChannels = sh_audio->channels; sh_audio->wf->wBitsPerSample = 16; sh_audio->wf->nSamplesPerSec = sh_audio->samplerate; Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-26 10:24:02 UTC (rev 217) @@ -55,7 +55,7 @@ } theora_struct_t; //// OggDS headers -// Header for the new header format +// Header for the new header wtag typedef struct stream_header_video { ogg_int32_t width; @@ -536,17 +536,17 @@ // We jump nothing for FLAC. Ain't this great? Packet contents have to be // handled differently for each and every stream type. The joy! The joy! if(!os->flac && ((*pack->packet & PACKET_TYPE_HEADER) && - (ds != d->audio || ( ((sh_audio_t*)ds->sh)->format != FOURCC_VORBIS || os->hdr_packets >= NUM_VORBIS_HDR_PACKETS ) ) && + (ds != d->audio || ( ((sh_audio_t*)ds->sh)->wtag != FOURCC_VORBIS || os->hdr_packets >= NUM_VORBIS_HDR_PACKETS ) ) && (ds != d->video || (((sh_video_t*)ds->sh)->fourcc != FOURCC_THEORA)))) return 0; // For vorbis packet the packet is the data, for other codec we must jump // the header - if(ds == d->audio && ((sh_audio_t*)ds->sh)->format == FOURCC_VORBIS) { + if(ds == d->audio && ((sh_audio_t*)ds->sh)->wtag == FOURCC_VORBIS) { context = ((sh_audio_t *)ds->sh)->context; samplesize = ((sh_audio_t *)ds->sh)->samplesize; } - if (ds == d->video && ((sh_audio_t*)ds->sh)->format == FOURCC_THEORA) + if (ds == d->video && ((sh_audio_t*)ds->sh)->wtag == FOURCC_THEORA) context = ((sh_video_t *)ds->sh)->context; data = demux_ogg_read_packet(os,pack,context,&pts,&flags,samplesize); @@ -605,7 +605,7 @@ else { sid = demuxer->audio->id; /* demux_ogg_read_packet needs decoder context for Vorbis streams */ - if(((sh_audio_t*)demuxer->audio->sh)->format == FOURCC_VORBIS) { + if(((sh_audio_t*)demuxer->audio->sh)->wtag == FOURCC_VORBIS) { context = ((sh_audio_t*)demuxer->audio->sh)->context; samplesize = ((sh_audio_t*)demuxer->audio->sh)->samplesize; } @@ -807,7 +807,7 @@ // Check for Vorbis if(pack.bytes >= 7 && ! strncmp(&pack.packet[1],"vorbis", 6) ) { sh_a = new_sh_audio(demuxer,ogg_d->num_sub); - sh_a->format = FOURCC_VORBIS; + sh_a->wtag = FOURCC_VORBIS; ogg_d->subs[ogg_d->num_sub].vorbis = 1; ogg_d->subs[ogg_d->num_sub].id = n_audio; n_audio++; @@ -862,7 +862,7 @@ #endif else if (pack.bytes >= 4 && !strncmp (&pack.packet[0], "fLaC", 4)) { sh_a = new_sh_audio(demuxer,ogg_d->num_sub); - sh_a->format = mmioFOURCC('f', 'L', 'a', 'C'); + sh_a->wtag = mmioFOURCC('f', 'L', 'a', 'C'); ogg_d->subs[ogg_d->num_sub].id = n_audio; n_audio++; ogg_d->subs[ogg_d->num_sub].flac = 1; @@ -899,7 +899,7 @@ sh_a = new_sh_audio(demuxer,ogg_d->num_sub); extra_size = get_uint16(pack.packet+140); sh_a->wf = (WAVEFORMATEX*)calloc(1,sizeof(WAVEFORMATEX)+extra_size); - sh_a->format = sh_a->wf->wFormatTag = get_uint16(pack.packet+124); + sh_a->wtag = sh_a->wf->wFormatTag = get_uint16(pack.packet+124); sh_a->channels = sh_a->wf->nChannels = get_uint16(pack.packet+126); sh_a->samplerate = sh_a->wf->nSamplesPerSec = get_uint32(pack.packet+128); sh_a->wf->nAvgBytesPerSec = get_uint32(pack.packet+132); @@ -951,7 +951,7 @@ buffer[4] = '\0'; sh_a = new_sh_audio(demuxer,ogg_d->num_sub); sh_a->wf = (WAVEFORMATEX*)calloc(1,sizeof(WAVEFORMATEX)+extra_size); - sh_a->format = sh_a->wf->wFormatTag = strtol(buffer, NULL, 16); + sh_a->wtag = sh_a->wf->wFormatTag = strtol(buffer, NULL, 16); sh_a->channels = sh_a->wf->nChannels = get_uint16(&st->sh.audio.channels); sh_a->samplerate = sh_a->wf->nSamplesPerSec = get_uint64(&st->samples_per_unit); sh_a->wf->nAvgBytesPerSec = get_uint32(&st->sh.audio.avgbytespersec); @@ -1237,7 +1237,7 @@ od->video->id = -2; od->audio->sh = sh_audio; sh_audio->ds = od->audio; - sh_audio->format = FOURCC_VORBIS; + sh_audio->wtag = FOURCC_VORBIS; /// Return the joined demuxers return new_demuxers_demuxer(demuxer,od,demuxer); @@ -1278,7 +1278,7 @@ } else { ds = demuxer->audio; /* demux_ogg_read_packet needs decoder context for Vorbis streams */ - if(((sh_audio_t*)demuxer->audio->sh)->format == FOURCC_VORBIS) + if(((sh_audio_t*)demuxer->audio->sh)->wtag == FOURCC_VORBIS) context = ((sh_audio_t*)demuxer->audio->sh)->context; vi = &((ov_struct_t*)((sh_audio_t*)ds->sh)->context)->vi; rate = (float)vi->rate; Modified: mplayerxp/libmpdemux/demux_pva.c =================================================================== --- mplayerxp/libmpdemux/demux_pva.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_pva.c 2012-10-26 10:24:02 UTC (rev 217) @@ -160,7 +160,7 @@ /* * Audio and Video codecs: * the PVA spec only allows MPEG2 video and MPEG layer II audio. No need to check the formats then. - * Moreover, there would be no way to do that since the PVA stream format has no fields to describe + * Moreover, there would be no way to do that since the PVA stream wtag has no fields to describe * the used codecs. */ @@ -173,7 +173,7 @@ */ demuxer->audio->sh=sh_audio; - sh_audio->format=0x50; + sh_audio->wtag=0x50; sh_audio->ds=demuxer->audio; demuxer->movi_start=0; Modified: mplayerxp/libmpdemux/demux_ra.c =================================================================== --- mplayerxp/libmpdemux/demux_ra.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_ra.c 2012-10-26 10:24:02 UTC (rev 217) @@ -151,7 +151,7 @@ stream_skip(demuxer->stream, i - 4); } i = stream_read_char(demuxer->stream); - sh->format = stream_read_dword_le(demuxer->stream); + sh->wtag = stream_read_dword_le(demuxer->stream); if (i != 4) { MSG_WARN("[RealAudio] FourCC size is not 4 (%d), please report to " "MPlayer developers\n", i); @@ -193,7 +193,7 @@ if(ra_priv->hdr_size + 8 > stream_tell(demuxer->stream)) { stream_skip(demuxer->stream, 1); i = stream_read_char(demuxer->stream); - sh->format = stream_read_dword_le(demuxer->stream); + sh->wtag = stream_read_dword_le(demuxer->stream); if (i != 4) { MSG_WARN("[RealAudio] FourCC size is not 4 (%d), please report to " "MPlayer developers\n", i); @@ -201,25 +201,25 @@ } // stream_skip(demuxer->stream, 3); - if (sh->format != FOURCC_LPCJ) { + if (sh->wtag != FOURCC_LPCJ) { MSG_WARN("[RealAudio] Version 3 with FourCC %8x, please report to " - "MPlayer developers\n", sh->format); + "MPlayer developers\n", sh->wtag); } sh->channels = 1; sh->samplesize = 16; sh->samplerate = 8000; ra_priv->frame_size = 240; - sh->format = FOURCC_144; + sh->wtag = FOURCC_144; } else { // If a stream does not have fourcc, let's assume it's 14.4 - sh->format = FOURCC_LPCJ; + sh->wtag = FOURCC_LPCJ; sh->channels = 1; sh->samplesize = 16; sh->samplerate = 8000; ra_priv->frame_size = 240; - sh->format = FOURCC_144; + sh->wtag = FOURCC_144; } } @@ -232,9 +232,9 @@ sh->wf->nAvgBytesPerSec = sh->samplerate*sh->samplesize/8; sh->wf->nBlockAlign = ra_priv->frame_size; sh->wf->cbSize = 0; - sh->wf->wFormatTag = sh->format; + sh->wf->wFormatTag = sh->wtag; - switch (sh->format) { + switch (sh->wtag) { case FOURCC_144: MSG_V("Audio: 14_4\n"); sh->wf->cbSize = 10/*+codecdata_length*/; @@ -258,7 +258,7 @@ case FOURCC_DNET: /* direct support */ break; default: - MSG_V("Audio: Unknown (%d)\n", sh->format); + MSG_V("Audio: Unknown (%d)\n", sh->wtag); } print_wave_header(sh->wf,sizeof(WAVEFORMATEX)); Modified: mplayerxp/libmpdemux/demux_rawaudio.c =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_rawaudio.c 2012-10-26 10:24:02 UTC (rev 217) @@ -14,14 +14,14 @@ static int channels = 2; static int samplerate = 44100; static int samplesize = 2; -static int format = 0x1; // Raw PCM +static int wtag = 0x1; // Raw PCM static const config_t demux_rawaudio_opts[] = { { "on", &use_rawaudio, CONF_TYPE_FLAG, 0,0, 1, NULL, "forces treating stream as raw-audio" }, { "channels", &channels, CONF_TYPE_INT,CONF_RANGE,1,8, NULL, "specifies number of channels in raw-audio steram" }, { "rate", &samplerate, CONF_TYPE_INT,CONF_RANGE,1000,8*48000, NULL, "specifies sample-rate of raw-audio steram" }, { "samplesize", &samplesize, CONF_TYPE_INT,CONF_RANGE,1,8, NULL, "specifies sample-size of raw-audio steram" }, - { "format", &format, CONF_TYPE_INT, CONF_MIN, 0 , 0, NULL, "specifies compression-format of raw-audio stream" }, + { "wtag", &wtag, CONF_TYPE_INT, CONF_MIN, 0 , 0, NULL, "specifies compression-wtag of raw-audio stream" }, {NULL, NULL, 0, 0, 0, 0, NULL, NULL} }; @@ -47,10 +47,10 @@ demuxer->stream->driver->control(demuxer->stream,SCTRL_AUD_GET_CHANNELS,&channels); demuxer->stream->driver->control(demuxer->stream,SCTRL_AUD_GET_SAMPLERATE,&samplerate); demuxer->stream->driver->control(demuxer->stream,SCTRL_AUD_GET_SAMPLESIZE,&samplesize); - demuxer->stream->driver->control(demuxer->stream,SCTRL_AUD_GET_FORMAT,&format); + demuxer->stream->driver->control(demuxer->stream,SCTRL_AUD_GET_FORMAT,&wtag); sh_audio = new_sh_audio(demuxer,0); sh_audio->wf = w = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX)); - w->wFormatTag = sh_audio->format = format; + w->wFormatTag = sh_audio->wtag = wtag; w->nChannels = sh_audio->channels = channels; sh_audio->samplerate = samplerate; w->nSamplesPerSec = samplerate; Modified: mplayerxp/libmpdemux/demux_rawvideo.c =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-26 10:24:02 UTC (rev 217) @@ -16,7 +16,7 @@ typedef struct priv_s { int use_rawvideo; - int format; + int wtag; int size_id; int width; int height; @@ -38,13 +38,13 @@ { "ntsc", &priv.size_id, CONF_TYPE_FLAG,0,0,6, NULL, "sets image size to NTSC standard" }, { "16cif", &priv.size_id, CONF_TYPE_FLAG,0,0,7, NULL, "sets image size to 16CIF standard" }, { "sif", &priv.size_id, CONF_TYPE_FLAG,0,0,8, NULL, "sets image size to SIF standard" }, - // format: - { "format", &priv.format, CONF_TYPE_INT, 0, 0 , 0, NULL, "specifies colorspace (fourcc) in hex or string constant" }, - { "i420", &priv.format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_I420, NULL, "treats raw-video as I420 fourcc" }, - { "yv12", &priv.format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_YV12, NULL, "treats raw-video as YV12 fourcc" }, - { "yuy2", &priv.format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_YUY2, NULL, "treats raw-video as YUY2 fourcc" }, - { "uyvy", &priv.format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_UYVY, NULL, "treats raw-video as UYVY fourcc" }, - { "y8", &priv.format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_Y8, NULL, "treats raw-video as Y8 fourcc" }, + // wtag: + { "wtag", &priv.wtag, CONF_TYPE_INT, 0, 0 , 0, NULL, "specifies colorspace (fourcc) in hex or string constant" }, + { "i420", &priv.wtag, CONF_TYPE_FLAG, 0, 0 , IMGFMT_I420, NULL, "treats raw-video as I420 fourcc" }, + { "yv12", &priv.wtag, CONF_TYPE_FLAG, 0, 0 , IMGFMT_YV12, NULL, "treats raw-video as YV12 fourcc" }, + { "yuy2", &priv.wtag, CONF_TYPE_FLAG, 0, 0 , IMGFMT_YUY2, NULL, "treats raw-video as YUY2 fourcc" }, + { "uyvy", &priv.wtag, CONF_TYPE_FLAG, 0, 0 , IMGFMT_UYVY, NULL, "treats raw-video as UYVY fourcc" }, + { "y8", &priv.wtag, CONF_TYPE_FLAG, 0, 0 , IMGFMT_Y8, NULL, "treats raw-video as Y8 fourcc" }, // misc: { "fps", &priv.fps, CONF_TYPE_FLOAT,CONF_RANGE,0.001,1000, NULL, "specifies rate in frames per second of raw-video stream" }, { "size", &priv.imgsize, CONF_TYPE_INT, CONF_RANGE, 1 , 8192*8192*4, NULL, "specifies frame size in bytes" }, @@ -82,7 +82,7 @@ } demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_WIDTH,&priv.width); demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_HEIGHT,&priv.height); - demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_FORMAT,&priv.format); + demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_FORMAT,&priv.wtag); demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_FPS,&priv.fps); if(!priv.width || !priv.height){ @@ -91,7 +91,7 @@ } if(!priv.imgsize) - switch(priv.format){ + switch(priv.wtag){ case IMGFMT_I420: case IMGFMT_IYUV: case IMGFMT_YV12: priv.imgsize=priv.width*priv.height+2*(priv.width>>1)*(priv.height>>1);break; @@ -99,12 +99,12 @@ case IMGFMT_UYVY: priv.imgsize=priv.width*priv.height*2;break; case IMGFMT_Y8: priv.imgsize=priv.width*priv.height;break; default: - MSG_ERR("rawvideo: img size not specified and unknown format!\n"); + MSG_ERR("rawvideo: img size not specified and unknown wtag!\n"); return NULL; } sh_video = new_sh_video(demuxer,0); - sh_video->fourcc=priv.format; + sh_video->fourcc=priv.wtag; sh_video->fps=priv.fps; sh_video->src_w=priv.width; sh_video->src_h=priv.height; Modified: mplayerxp/libmpdemux/demux_real.c =================================================================== --- mplayerxp/libmpdemux/demux_real.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_real.c 2012-10-26 10:24:02 UTC (rev 217) @@ -333,7 +333,7 @@ #define SKIP_BITS(n) buffer<<=n #define SHOW_BITS(n) ((buffer)>>(32-(n))) -static float real_fix_timestamp(real_priv_t* priv, unsigned char* s, int timestamp, unsigned int format) +static float real_fix_timestamp(real_priv_t* priv, unsigned char* s, int timestamp, unsigned int wtag) { float v_pts; uint32_t buffer= (s[0]<<24) + (s[1]<<16) + (s[2]<<8) + s[3]; @@ -342,8 +342,8 @@ int orig_kf; #if 1 - if(format==mmioFOURCC('R','V','3','0') || format==mmioFOURCC('R','V','4','0')){ - if(format==mmioFOURCC('R','V','3','0')){ + if(wtag==mmioFOURCC('R','V','3','0') || wtag==mmioFOURCC('R','V','4','0')){ + if(wtag==mmioFOURCC('R','V','3','0')){ SKIP_BITS(3); pict_type= SHOW_BITS(2); SKIP_BITS(2 + 7); @@ -491,7 +491,7 @@ { unsigned plen; plen=0; - if (((sh_audio_t *)ds->sh)->format == mmioFOURCC('M', 'P', '4', 'A')) { + if (((sh_audio_t *)ds->sh)->wtag == mmioFOURCC('M', 'P', '4', 'A')) { uint16_t *sub_packet_lengths, sub_packets, i; /* AAC in Real: several AAC frames in one Real packet. */ /* Second byte, upper four bits: number of AAC frames */ @@ -1011,15 +1011,15 @@ MSG_WARN("Last header byte is not zero!\n"); stream_skip(demuxer->stream, 1); i = stream_read_char(demuxer->stream); - sh->format = stream_read_dword_le(demuxer->stream); + sh->wtag = stream_read_dword_le(demuxer->stream); if (i != 4) { MSG_WARN("Audio FourCC size is not 4 (%d), please report to " "MPlayer developers\n", i); stream_skip(demuxer->stream, i - 4); } - if (sh->format != mmioFOURCC('l','p','c','J')) { + if (sh->wtag != mmioFOURCC('l','p','c','J')) { MSG_WARN("Version 3 audio with FourCC %8x, please report to " - "MPlayer developers\n", sh->format); + "MPlayer developers\n", sh->wtag); } sh->channels = 1; sh->samplesize = 16; @@ -1083,9 +1083,9 @@ sh->wf->nAvgBytesPerSec = bitrate; sh->wf->nBlockAlign = frame_size; sh->wf->cbSize = 0; - sh->format = MKTAG(buf[0], buf[1], buf[2], buf[3]); + sh->wtag = MKTAG(buf[0], buf[1], buf[2], buf[3]); - switch (sh->format) + switch (sh->wtag) { case MKTAG('d', 'n', 'e', 't'): /* direct support */ break; @@ -1143,13 +1143,13 @@ stream_skip(demuxer->stream, 1); stream_read(demuxer->stream, sh->codecdata, sh->codecdata_len); } - sh->format = mmioFOURCC('M', 'P', '4', 'A'); + sh->wtag = mmioFOURCC('M', 'P', '4', 'A'); break; default: MSG_V("Audio: Unknown (%s)\n", buf); } - sh->wf->wFormatTag = sh->format; + sh->wf->wFormatTag = sh->wtag; if (mp_conf.verbose > 0) print_wave_header(sh->wf,sizeof(WAVEFORMATEX)); @@ -1186,7 +1186,7 @@ sh->wf->nAvgBytesPerSec = 0;//bitrate; sh->wf->nBlockAlign = 0;//frame_size; sh->wf->cbSize = 0; - sh->wf->wFormatTag = sh->format = mmioFOURCC('a','d','u',0x55); + sh->wf->wFormatTag = sh->wtag = mmioFOURCC('a','d','u',0x55); if(demuxer->audio->id==stream_id){ sh->ds=demuxer->audio; @@ -1197,7 +1197,7 @@ } else if (strstr(tmps,"x-ralf-mpeg4")) { MSG_ERR("Real lossless audio not supported yet\n"); } else { - MSG_V("Unknown audio stream format\n"); + MSG_V("Unknown audio stream wtag\n"); } } else if (!strncmp(tmps,"video/",6)) { if (strstr(tmps,"x-pn-realvideo") || strstr(tmps,"x-pn-multirate-realvideo")) { @@ -1232,7 +1232,7 @@ if (sh->fps<=0) sh->fps=24; // we probably won't even care about fps stream_skip(demuxer->stream, 4); -// if(sh->format==0x30335652 || sh->format==0x30325652 ) +// if(sh->wtag==0x30335652 || sh->wtag==0x30325652 ) if(1) { int tmp=stream_read_word(demuxer->stream); @@ -1245,7 +1245,7 @@ } stream_skip(demuxer->stream, 2); - // read codec sub-format (to make difference between low and high rate codec) + // read codec sub-wtag (to make difference between low and high rate codec) ((unsigned int*)(sh->bih+1))[0]=stream_read_dword(demuxer->stream); /* h263 hack */ @@ -1314,7 +1314,7 @@ } } else { - MSG_V("Unknown video stream format\n"); + MSG_V("Unknown video stream wtag\n"); } } else if (strstr(tmps,"logical-")) { if (strstr(tmps,"fileinfo")) { Modified: mplayerxp/libmpdemux/demux_roq.c =================================================================== --- mplayerxp/libmpdemux/demux_roq.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_roq.c 2012-10-26 10:24:02 UTC (rev 217) @@ -171,7 +171,7 @@ sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX)); // custom fourcc for internal MPlayer use - sh_audio->format = mmioFOURCC('R', 'o', 'Q', 'A'); + sh_audio->wtag = mmioFOURCC('R', 'o', 'Q', 'A'); if (chunk_id == RoQ_SOUND_STEREO) sh_audio->wf->nChannels = 2; else Modified: mplayerxp/libmpdemux/demux_smjpeg.c =================================================================== --- mplayerxp/libmpdemux/demux_smjpeg.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_smjpeg.c 2012-10-26 10:24:02 UTC (rev 217) @@ -4,7 +4,7 @@ Only for testing some files. Commited only for Nexus' request. - Based on text by Arpi (SMJPEG-format.txt) and later on + Based on text by Arpi (SMJPEG-wtag.txt) and later on http://www.lokigames.com/development/download/smjpeg/SMJPEG.txt TODO: demuxer->movi_length @@ -149,8 +149,8 @@ sh_audio->samplerate = stream_read_word(demuxer->stream); sh_audio->wf->wBitsPerSample = stream_read_char(demuxer->stream); sh_audio->channels = stream_read_char(demuxer->stream); - sh_audio->format = stream_read_dword_le(demuxer->stream); - sh_audio->wf->wFormatTag = sh_audio->format; + sh_audio->wtag = stream_read_dword_le(demuxer->stream); + sh_audio->wf->wFormatTag = sh_audio->wtag; sh_audio->wf->nChannels = sh_audio->channels; sh_audio->wf->nSamplesPerSec = sh_audio->samplerate; sh_audio->wf->nAvgBytesPerSec = sh_audio->wf->nChannels* Modified: mplayerxp/libmpdemux/demux_ts.c =================================================================== --- mplayerxp/libmpdemux/demux_ts.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_ts.c 2012-10-26 10:24:02 UTC (rev 217) @@ -294,13 +294,13 @@ sh_audio_t *sh = new_sh_audio_aid(demuxer, priv->last_aid, es->pid); if(sh) { - sh->format = IS_AUDIO(es->type) ? es->type : es->subtype; + sh->wtag = IS_AUDIO(es->type) ? es->type : es->subtype; sh->ds = demuxer->audio; priv->ts.streams[es->pid].id = priv->last_aid; priv->ts.streams[es->pid].sh = sh; priv->ts.streams[es->pid].type = TYPE_AUDIO; - MSG_V("\r\nADDED AUDIO PID %d, type: %x stream n. %d\r\n", es->pid, sh->format, priv->last_aid); + MSG_V("\r\nADDED AUDIO PID %d, type: %x stream n. %d\r\n", es->pid, sh->wtag, priv->last_aid); priv->last_aid++; } @@ -1010,7 +1010,7 @@ sh_audio = priv->ts.streams[params.apid].sh; demuxer->audio->id = priv->ts.streams[params.apid].id; sh_audio->ds = demuxer->audio; - sh_audio->format = params.atype; + sh_audio->wtag = params.atype; demuxer->audio->sh = sh_audio; } Modified: mplayerxp/libmpdemux/demux_ty.c =================================================================== --- mplayerxp/libmpdemux/demux_ty.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_ty.c 2012-10-26 10:24:02 UTC (rev 217) @@ -6,7 +6,7 @@ * The license covers the portions of this file regarding TiVo additions. * * Olaf Beck and Tridge (indirectly) were essential at providing - * information regarding the format of the TiVo streams. + * information regarding the wtag of the TiVo streams. * * However, no code in the following subsection is directly copied from * either author. @@ -584,10 +584,10 @@ ds->sh = demux->a_streams[ aid ]; sh_a = (sh_audio_t*)ds->sh; switch(aid & 0xE0){ // 1110 0000 b (high 3 bit: type low 5: id) - case 0x00: sh_a->format=0x50;break; // mpeg - case 0xA0: sh_a->format=0x10001;break; // dvd pcm - case 0x80: if((aid & 0xF8) == 0x88) sh_a->format=0x2001;//dts - else sh_a->format=0x2000;break; // ac3 + case 0x00: sh_a->wtag=0x50;break; // mpeg + case 0xA0: sh_a->wtag=0x10001;break; // dvd pcm + case 0x80: if((aid & 0xF8) == 0x88) sh_a->wtag=0x2001;//dts + else sh_a->wtag=0x2000;break; // ac3 } } } Modified: mplayerxp/libmpdemux/demux_viv.c =================================================================== --- mplayerxp/libmpdemux/demux_viv.c 2012-10-26 10:04:44 UTC (rev 216) +++ mplayerxp/libmpdemux/demux_viv.c 2012-10-26 10:24:02 UTC (rev 217) @@ -439,7 +439,7 @@ static int bufptr=0; static int bitcnt=0; static unsigned char buf=0; -static int format, width, height; +static int wtag, width, height; static unsigned int x_get_bits(int n){ unsigned int x=0; @@ -488,13 +488,13 @@ skip_bits1(&s->gb); /* camera off */ skip_bits1(&s->gb); /* freeze picture release off */ - format = get_bits(&s->gb, 3); + wtag = get_bits(&s->gb, 3); - if (format != 7) { - MSG_ERR("h263_plus = 0 format = %d\n",format); + if (wtag != 7) { + MSG_ERR("h263_plus = 0 wtag = %d\n",wtag); /* H.263v1 */ - width = h263_format[format][0]; - height = h263_format[format][1]; + width = h263_format[wtag][0]; + height = h263_format[wtag][1]; MSG_ERR("%d x %d\n",width,height); // if (!width) return -1; @@ -521,8 +521,8 @@ MSG_ERR("H.263v2 A error\n"); return -1; } - if (get_bits(&s->gb, 3) != 6){ /* custom source format */ - MSG_ERR("custom source format\n"); + if (get_bits(&s->gb, 3) != 6){ /* custom source wtag */ + MSG_ERR("custom source wtag\n"); return -1; } skip_bits(&s->gb, 12); @@ -658,12 +658,12 @@ priv->audio_codec = VIVO_AUDIO_SIREN; } - sh->format = UINT_MAX; + sh->wtag = UINT_MAX; if (priv->audio_codec == VIVO_AUDIO_G723) - sh->format = 0x111; + sh->wtag = 0x111; if (priv->audio_codec == VIVO_AUDIO_SIREN) - sh->format = 0x112; - if (sh->format == UINT_MAX) + sh->wtag = 0x112; + if (sh->wtag == UINT_MAX) { MSG_ERR( "VIVO: Not support audio codec (%d)\n", priv->audio_co... [truncated message content] |
From: <nic...@us...> - 2012-10-26 11:45:23
|
Revision: 219 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=219&view=rev Author: nickols_k Date: 2012-10-26 11:45:13 +0000 (Fri, 26 Oct 2012) Log Message: ----------- combine variables into structures Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/dec_ahead.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpdemux/video.c mplayerxp/mplayer.c mplayerxp/mplayer.h Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-26 10:58:24 UTC (rev 218) +++ mplayerxp/cfg-mplayer.h 2012-10-26 11:45:13 UTC (rev 219) @@ -2,10 +2,6 @@ * config for cfgparser */ -extern int av_sync_pts; -extern int av_force_pts_fix; -extern int av_force_pts_fix2; -extern int frame_reorder; extern int use_stdin; extern uint32_t mp_msg_filter; #ifdef HAVE_PNG @@ -42,29 +38,8 @@ extern int xinerama_screen; #endif -#ifdef HAVE_RTC -extern int nortc; -#endif - extern int enable_xp_audio; -#if defined( ARCH_X86 ) || defined(ARCH_X86_64) -extern int x86_simd; -extern int x86_mmx; -extern int x86_mmx2; -extern int x86_3dnow; -extern int x86_3dnow2; -extern int x86_sse; -extern int x86_sse2; -extern int x86_sse3; -extern int x86_ssse3; -extern int x86_sse41; -extern int x86_sse42; -extern int x86_aes; -extern int x86_avx; -extern int x86_fma; -#endif - extern float playbackspeed_factor; /* from libvo/aspect.c */ extern float monitor_pixel_aspect; @@ -137,34 +112,34 @@ #if defined( ARCH_X86 ) || defined(ARCH_X86_64) static const config_t cpu_config[]={ - {"simd", &x86_simd, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SIMD extensions of CPU"}, - {"nosimd", &x86_simd, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SIMD extensions of CPU"}, - {"mmx", &x86_mmx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX extensions of CPU"}, - {"nommx", &x86_mmx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX extensions of CPU"}, - {"mmx2", &x86_mmx2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX2 extensions of CPU"}, - {"nommx2", &x86_mmx2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX2 extensions of CPU"}, - {"3dnow", &x86_3dnow, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of 3DNow! extensions of CPU"}, - {"no3dnow", &x86_3dnow, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of 3DNow! extensions of CPU"}, - {"3dnow2", &x86_3dnow2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of 3DNow-2! extensions of CPU"}, - {"no3dnow2", &x86_3dnow2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of 3DNow-2! extensions of CPU"}, - {"sse", &x86_sse, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE extensions of CPU"}, - {"nosse", &x86_sse, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE extensions of CPU"}, - {"sse2", &x86_sse2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE2 extensions of CPU"}, - {"nosse2", &x86_sse2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE2 extensions of CPU"}, - {"sse3", &x86_sse3, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE3 extensions of CPU"}, - {"nosse3", &x86_sse3, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE3 extensions of CPU"}, - {"ssse3", &x86_ssse3, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSSE3 extensions of CPU"}, - {"nossse3", &x86_ssse3, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSSE3 extensions of CPU"}, - {"sse41", &x86_sse41, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE41 extensions of CPU"}, - {"nosse41", &x86_sse41, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE41 extensions of CPU"}, - {"sse42", &x86_sse42, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE42 extensions of CPU"}, - {"nosse42", &x86_sse42, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE42 extensions of CPU"}, - {"aes", &x86_aes, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of AES extensions of CPU"}, - {"noaes", &x86_aes, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of AES extensions of CPU"}, - {"avx", &x86_avx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of AVX extensions of CPU"}, - {"noavx", &x86_avx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of AVX extensions of CPU"}, - {"fma", &x86_fma, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of FMA extensions of CPU"}, - {"nofma", &x86_fma, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of FMA extensions of CPU"}, + {"simd", &x86.simd, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SIMD extensions of CPU"}, + {"nosimd", &x86.simd, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SIMD extensions of CPU"}, + {"mmx", &x86.mmx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX extensions of CPU"}, + {"nommx", &x86.mmx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX extensions of CPU"}, + {"mmx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX2 extensions of CPU"}, + {"nommx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX2 extensions of CPU"}, + {"3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of 3DNow! extensions of CPU"}, + {"no3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of 3DNow! extensions of CPU"}, + {"3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of 3DNow-2! extensions of CPU"}, + {"no3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of 3DNow-2! extensions of CPU"}, + {"sse", &x86.sse, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE extensions of CPU"}, + {"nosse", &x86.sse, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE extensions of CPU"}, + {"sse2", &x86.sse2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE2 extensions of CPU"}, + {"nosse2", &x86.sse2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE2 extensions of CPU"}, + {"sse3", &x86.sse3, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE3 extensions of CPU"}, + {"nosse3", &x86.sse3, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE3 extensions of CPU"}, + {"ssse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSSE3 extensions of CPU"}, + {"nossse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSSE3 extensions of CPU"}, + {"sse41", &x86.sse41, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE41 extensions of CPU"}, + {"nosse41", &x86.sse41, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE41 extensions of CPU"}, + {"sse42", &x86.sse42, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE42 extensions of CPU"}, + {"nosse42", &x86.sse42, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE42 extensions of CPU"}, + {"aes", &x86.aes, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of AES extensions of CPU"}, + {"noaes", &x86.aes, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of AES extensions of CPU"}, + {"avx", &x86.avx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of AVX extensions of CPU"}, + {"noavx", &x86.avx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of AVX extensions of CPU"}, + {"fma", &x86.fma, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of FMA extensions of CPU"}, + {"nofma", &x86.fma, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of FMA extensions of CPU"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, }; #endif @@ -194,26 +169,23 @@ static const config_t avsync_config[]={ - {"framedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables frame-dropping on slow systems: decodes all video frames, but skips displaying some ones"}, -/*UD*/ {"hardframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, NULL, "enables hard frame-dropping on slow systems: skips displaying and decoding of some frames"}, - {"noframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables frame dropping"}, - {"pts", &av_sync_pts, CONF_TYPE_FLAG, 0, 0, 1, NULL, "use PTS-based method of A/V synchronization"}, - {"nopts", &av_sync_pts, CONF_TYPE_FLAG, 0, 1, 0, NULL, "use BPS-based method of A/V synchronization"}, - {"dap", &dapsync, CONF_TYPE_FLAG, 0, 0, 1, NULL, "use alternative method of A/V synchronization"}, - {"nodap", &dapsync, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable alternative method of A/V synchronization"}, - {"force_pts_fix", &av_force_pts_fix, CONF_TYPE_FLAG, 0, 0, 1, NULL, "force PTS fixing for \"bad\" files"}, - {"noforce_pts_fix", &av_force_pts_fix, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable PTS fixing for \"bad\" files"}, - {"force_pts_fix2", &av_force_pts_fix2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "force PTS fixing for \"bad\" files without PTS changing"}, - {"noforce_pts_fix2", &av_force_pts_fix2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable PTS fixing for \"bad\" files without PTS changing"}, - {"frame_reorder", &frame_reorder, CONF_TYPE_FLAG, 0, 0, 1, NULL, "recalc PTS of frames as they were added to the buffer"}, - {"noframe_reorder", &frame_reorder, CONF_TYPE_FLAG, 0, 1, 0, NULL, "keep original PTS of each frame"}, - {"softsleep", &softsleep, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables high quality software timers for A/V synchronization"}, + {"framedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables frame-dropping on slow systems: decodes all video frames, but skips displaying some ones"}, +/*UD*/ {"hardframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, NULL, "enables hard frame-dropping on slow systems: skips displaying and decoding of some frames"}, + {"noframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables frame dropping"}, + {"pts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 0, 1, NULL, "use PTS-based method of A/V synchronization"}, + {"nopts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 1, 0, NULL, "use BPS-based method of A/V synchronization"}, + {"force_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 0, 1, NULL, "force PTS fixing for \"bad\" files"}, + {"noforce_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable PTS fixing for \"bad\" files"}, + {"force_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "force PTS fixing for \"bad\" files without PTS changing"}, + {"noforce_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable PTS fixing for \"bad\" files without PTS changing"}, + {"frame_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 0, 1, NULL, "recalc PTS of frames as they were added to the buffer"}, + {"noframe_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 1, 0, NULL, "keep original PTS of each frame"}, + {"softsleep", &mp_conf.softsleep, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables high quality software timers for A/V synchronization"}, #ifdef HAVE_RTC - {"rtc", &nortc, CONF_TYPE_FLAG, 0, 1, 0, NULL, "enables using of /dev/rtc (real-time clock chip) to compute PTS"}, - {"nortc", &nortc, CONF_TYPE_FLAG, 0, 0, 1, NULL, "disables using of /dev/rtc (real-time clock chip) to compute PTS"}, + {"rtc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 1, 0, NULL, "enables using of /dev/rtc (real-time clock chip) to compute PTS"}, + {"nortc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 0, 1, NULL, "disables using of /dev/rtc (real-time clock chip) to compute PTS"}, #endif - {"mc", &default_max_pts_correction, CONF_TYPE_FLOAT, CONF_RANGE, 0, 10, NULL, "maximum sync correction per 5 frames (in seconds)"}, - {"fps", &force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL, "forces frame rate (if value is wrong in the header)"}, + {"fps", &mp_conf.force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL, "forces frame rate (if value is wrong in the header)"}, {"vsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 0, 1, NULL, "forces video hardware to wait VSYNC signal before frame switching"}, {"novsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video hardware to wait VSYNC signal before frame switching"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, @@ -313,14 +285,14 @@ }; static const config_t playback_config[]={ - {"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL, "seek to given byte position before playback"}, - {"ss", &seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, NULL, "seek to given time position before playback"}, - {"loop", &loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, NULL, "loops movie playback given number of times. 0 means forever"}, - {"noloop", &loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL, "disable loop of playback"}, - {"shuffle",&shuffle_playback, CONF_TYPE_FLAG, 0, 0, 1, NULL, "play files in random order"}, - {"noshuffle",&shuffle_playback, CONF_TYPE_FLAG, 0, 1, 0, NULL, "play files in regular order"}, + {"sb", &mp_conf.seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL, "seek to given byte position before playback"}, + {"ss", &mp_conf.seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, NULL, "seek to given time position before playback"}, + {"loop", &mp_conf.loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, NULL, "loops movie playback given number of times. 0 means forever"}, + {"noloop", &mp_conf.loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL, "disable loop of playback"}, + {"shuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 0, 1, NULL, "play files in random order"}, + {"noshuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 1, 0, NULL, "play files in regular order"}, {"list", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies playlist (1 file/row or Winamp or ASX format)"}, - {"frames", &play_n_frames, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL, "play given number of frames and exit"}, + {"frames", &mp_conf.play_n_frames, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL, "play given number of frames and exit"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, }; Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-26 10:58:24 UTC (rev 218) +++ mplayerxp/dec_ahead.c 2012-10-26 11:45:13 UTC (rev 219) @@ -134,7 +134,6 @@ extern int decore_audio( int xp_id ); extern int mpxp_seek_time; -extern int frame_dropping; pid_t dec_ahead_pid; /* Only for testing */ pthread_t dec_ahead_pth_id; @@ -282,14 +281,14 @@ pinfo[_xp_id].pth_id = pthread_self(); pinfo[_xp_id].thread_name = (xp_core.has_audio && mp_conf.xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; drop_barrier=(float)(xp_num_frames/2)*(1/sh_video->fps); - if(av_sync_pts == -1 && !use_pts_fix2) + if(mp_conf.av_sync_pts == -1 && !use_pts_fix2) xp_is_bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG4_ES || d_video->demuxer->file_format == DEMUXER_TYPE_H264_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_PS || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS; else - xp_is_bad_pts = av_sync_pts?0:1; + xp_is_bad_pts = mp_conf.av_sync_pts?0:1; while(!xp_eof){ unsigned char* start=NULL; int in_size; @@ -343,12 +342,12 @@ } /* compute frame dropping */ xp_n_frame_to_drop=0; - if(frame_dropping) { + if(mp_conf.frame_dropping) { int cur_time; cur_time = GetTimerMS(); /* Ugly solution: disable frame dropping right after seeking! */ if(cur_time - mpxp_seek_time > (xp_num_frames/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); - } /* if( frame_dropping ) */ + } /* if( mp_conf.frame_dropping ) */ if(xp_core.in_lseek!=NoSeek) continue; #if 0 /* @@ -362,7 +361,7 @@ for(i=0;i<delay;i++) usleep(0); } #endif - if(xp_n_frame_to_drop) drop_param=frame_dropping; + if(xp_n_frame_to_drop) drop_param=mp_conf.frame_dropping; else drop_param=0; /* decode: */ if(output_quality) { @@ -392,7 +391,7 @@ int _idx = dae_prev_vdecoded(); xp_core.video->fra[_idx].duration=v_pts-xp_core.video->fra[_idx].v_pts; } - if(frame_reorder) reorder_pts_in_mpeg(); + if(mp_conf.frame_reorder) reorder_pts_in_mpeg(); } /* if (blit_frame) */ /* ------------ sleep --------------- */ Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-26 10:58:24 UTC (rev 218) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-26 11:45:13 UTC (rev 219) @@ -259,7 +259,7 @@ t2=GetTimer();t=t2-t; tt = t*0.000001f; time_usage.video+=tt; - if(mp_conf.benchmark || frame_dropping) { + if(mp_conf.benchmark || mp_conf.frame_dropping) { if(tt > time_usage.max_video) time_usage.max_video=tt; if(tt < time_usage.min_video) time_usage.min_video=tt; time_usage.cur_video=tt; @@ -272,7 +272,7 @@ t2=GetTimer()-t2; tt=t2*0.000001f; time_usage.vout+=tt; - if(mp_conf.benchmark || frame_dropping) + if(mp_conf.benchmark || mp_conf.frame_dropping) { if(tt > time_usage.max_vout) time_usage.max_vout = tt; if(tt < time_usage.min_vout) time_usage.min_vout = tt; Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-26 10:58:24 UTC (rev 218) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-10-26 11:45:13 UTC (rev 219) @@ -29,7 +29,7 @@ demuxer->file_format == DEMUXER_TYPE_H264_ES || demuxer->file_format == DEMUXER_TYPE_MPEG_PS || demuxer->file_format == DEMUXER_TYPE_MPEG_TS || - av_force_pts_fix) && av_sync_pts && av_force_pts_fix2!=1) + mp_conf.av_force_pts_fix) && mp_conf.av_sync_pts && mp_conf.av_force_pts_fix2!=1) { if(ds->pts_flags && ds->pts < 1.0 && ds->prev_pts > 2.0) { Modified: mplayerxp/libmpdemux/video.c =================================================================== --- mplayerxp/libmpdemux/video.c 2012-10-26 10:58:24 UTC (rev 218) +++ mplayerxp/libmpdemux/video.c 2012-10-26 11:45:13 UTC (rev 219) @@ -563,7 +563,7 @@ demuxer->file_format == DEMUXER_TYPE_H264_ES || demuxer->file_format == DEMUXER_TYPE_MPEG_PS || ((demuxer->file_format==DEMUXER_TYPE_MPEG_TS) && ((sh_video->fourcc==0x10000001) || (sh_video->fourcc==0x10000002))) || - av_force_pts_fix) && av_sync_pts && av_force_pts_fix2!=1) + mp_conf.av_force_pts_fix) && mp_conf.av_sync_pts && mp_conf.av_force_pts_fix2!=1) { if(d_video->pts_flags && d_video->pts < 1.0 && d_video->prev_pts > 2.0) { Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-26 10:58:24 UTC (rev 218) +++ mplayerxp/mplayer.c 2012-10-26 11:45:13 UTC (rev 219) @@ -74,7 +74,6 @@ **************************************************************************/ play_tree_t* playtree; -int shuffle_playback=0; #define PT_NEXT_ENTRY 1 #define PT_PREV_ENTRY -1 @@ -113,12 +112,7 @@ pid_t mplayer_pid; pthread_t mplayer_pth_id; -int av_sync_pts=-1; -int av_force_pts_fix=0; -int frame_reorder=1; - int use_pts_fix2=-1; -int av_force_pts_fix2=-1; /************************************************************************ Special case: inital audio PTS: @@ -149,8 +143,6 @@ Input media streaming & demultiplexer: **************************************************************************/ -static int max_framesize=0; - #include "libmpdemux/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" @@ -175,11 +167,6 @@ int osd_level=2; -// seek: -char *seek_to_sec=NULL; -off_t seek_to_byte=0; -int loop_times=-1; - /* codecs: */ int has_audio=1; int has_video=1; @@ -191,17 +178,9 @@ char *video_family=NULL; /* override video codec family */ // A-V sync: -static float default_max_pts_correction=-1;//0.01f; -static float max_pts_correction=0;//default_max_pts_correction; static float c_total=0; -static int dapsync=0; -static int softsleep=0; - -static float force_fps=0; unsigned force_srate=0; -int frame_dropping=0; // option 0=no drop 1= drop vo 2= drop decode -static int play_n_frames=-1; static uint32_t our_n_frames=0; // screen info: @@ -220,7 +199,30 @@ mp_conf_t mp_conf; +#if defined( ARCH_X86 ) || defined(ARCH_X86_64) +typedef struct x86_features_s { + int simd; + int mmx; + int mmx2; + int _3dnow; + int _3dnow2; + int sse; + int sse2; + int sse3; + int ssse3; + int sse41; + int sse42; + int aes; + int avx; + int fma; +}x86_features_t; +static x86_features_t x86; +#endif + static void mpxp_init_structs(void) { +#if defined( ARCH_X86 ) || defined(ARCH_X86_64) + memset(&x86,-1,sizeof(x86_features_t)); +#endif memset(&time_usage,0,sizeof(time_usage_t)); memset(&mp_conf,0,sizeof(mp_conf_t)); mp_conf.xp=XP_VAPlay; @@ -230,11 +232,13 @@ mp_conf.vobsub_id=-1; mp_conf.audio_lang=I18N_LANGUAGE; mp_conf.dvdsub_lang=I18N_LANGUAGE; + mp_conf.av_sync_pts=-1; + mp_conf.frame_reorder=1; + mp_conf.av_force_pts_fix2=-1; + mp_conf.loop_times=-1; + mp_conf.play_n_frames=-1; } -//char* current_module=NULL; // for debugging -int nortc; - static unsigned int inited_flags=0; #define INITED_VO 0x00000001 #define INITED_AO 0x00000002 @@ -838,38 +842,24 @@ #if defined( ARCH_X86 ) || defined(ARCH_X86_64) -int x86_simd=-1; -int x86_mmx=-1; -int x86_mmx2=-1; -int x86_3dnow=-1; -int x86_3dnow2=-1; -int x86_sse=-1; -int x86_sse2=-1; -int x86_sse3=-1; -int x86_ssse3=-1; -int x86_sse41=-1; -int x86_sse42=-1; -int x86_aes=-1; -int x86_avx=-1; -int x86_fma=-1; static void get_mmx_optimizations( void ) { GetCpuCaps(&gCpuCaps); - if(x86_simd) { - if(x86_mmx != -1) gCpuCaps.hasMMX=x86_mmx; - if(x86_mmx2 != -1) gCpuCaps.hasMMX2=x86_mmx2; - if(x86_3dnow != -1) gCpuCaps.has3DNow=x86_3dnow; - if(x86_3dnow2 != -1) gCpuCaps.has3DNowExt=x86_3dnow2; - if(x86_sse != -1) gCpuCaps.hasSSE=x86_sse; - if(x86_sse2 != -1) gCpuCaps.hasSSE2=x86_sse2; - if(x86_sse3 != -1) gCpuCaps.hasSSE2=x86_sse3; - if(x86_ssse3 != -1) gCpuCaps.hasSSSE3=x86_ssse3; - if(x86_sse41 != -1) gCpuCaps.hasSSE41=x86_sse41; - if(x86_sse42 != -1) gCpuCaps.hasSSE42=x86_sse42; - if(x86_aes != -1) gCpuCaps.hasAES=x86_aes; - if(x86_avx != -1) gCpuCaps.hasAVX=x86_avx; - if(x86_fma != -1) gCpuCaps.hasFMA=x86_fma; + if(x86.simd) { + if(x86.mmx != -1) gCpuCaps.hasMMX=x86.mmx; + if(x86.mmx2 != -1) gCpuCaps.hasMMX2=x86.mmx2; + if(x86._3dnow != -1) gCpuCaps.has3DNow=x86._3dnow; + if(x86._3dnow2 != -1) gCpuCaps.has3DNowExt=x86._3dnow2; + if(x86.sse != -1) gCpuCaps.hasSSE=x86.sse; + if(x86.sse2 != -1) gCpuCaps.hasSSE2=x86.sse2; + if(x86.sse3 != -1) gCpuCaps.hasSSE2=x86.sse3; + if(x86.ssse3 != -1) gCpuCaps.hasSSSE3=x86.ssse3; + if(x86.sse41 != -1) gCpuCaps.hasSSE41=x86.sse41; + if(x86.sse42 != -1) gCpuCaps.hasSSE42=x86.sse42; + if(x86.aes != -1) gCpuCaps.hasAES=x86.aes; + if(x86.avx != -1) gCpuCaps.hasAVX=x86.avx; + if(x86.fma != -1) gCpuCaps.hasFMA=x86.fma; } else { gCpuCaps.hasMMX= gCpuCaps.hasMMX2= @@ -1058,7 +1048,7 @@ if(playsize>0){ sh_audio->a_buffer_len-=playsize; memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[playsize],sh_audio->a_buffer_len); - if(!av_sync_pts && mp_conf.xp>=XP_VAPlay) + if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) pthread_mutex_lock(&audio_timer_mutex); if(use_pts_fix2) { if(sh_audio->a_pts != HUGE) { @@ -1082,11 +1072,11 @@ } } else sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - } else if(av_sync_pts && pts!=HUGE) + } else if(mp_conf.av_sync_pts && pts!=HUGE) sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); else sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - if(!av_sync_pts && mp_conf.xp>=XP_VAPlay) + if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) pthread_mutex_unlock(&audio_timer_mutex); } @@ -1114,7 +1104,7 @@ else osd_last_pts=pts; vo_data->osd_text=osd_text_buffer; if (osd_show_framedrop) { - sprintf(osd_text_tmp, "Framedrop: %s",frame_dropping>1?"hard":frame_dropping?"vo":"none"); + sprintf(osd_text_tmp, "Framedrop: %s",mp_conf.frame_dropping>1?"hard":mp_conf.frame_dropping?"vo":"none"); osd_show_framedrop--; } else #ifdef ENABLE_DEC_AHEAD_DEBUG @@ -1154,7 +1144,7 @@ float a_pts=0; float delay=ao_get_delay(ao_data); float video_pts = v_pts; - if(av_sync_pts) { + if(mp_conf.av_sync_pts) { a_pts = sh_audio->timer; } else if(pts_from_bps){ unsigned int samples=(sh_audio->audio.dwSampleSize)? @@ -1167,13 +1157,13 @@ a_pts=d_audio->pts; a_pts+=(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; } - if( !av_sync_pts && mp_conf.xp>=XP_VideoAudio ) delay += get_delay_audio_buffer(); + if( !mp_conf.av_sync_pts && mp_conf.xp>=XP_VideoAudio ) delay += get_delay_audio_buffer(); AV_delay = a_pts-delay-video_pts; __show_status_line(a_pts,video_pts,delay,AV_delay); } static void show_status_line_no_apts(float v_pts) { - if(av_sync_pts && sh_audio && (!audio_eof || ao_get_delay(ao_data))) { + if(mp_conf.av_sync_pts && sh_audio && (!audio_eof || ao_get_delay(ao_data))) { float a_pts = sh_audio->timer-ao_get_delay(ao_data); MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d\r" ,a_pts @@ -1203,6 +1193,7 @@ int info_factor; }osd_args_t; +static float max_pts_correction=0; int mpxp_play_video( int rtc_fd, float *v_pts ) { float time_frame=0; @@ -1257,7 +1248,7 @@ ,shva[dec_ahead_active_frame].duration); #endif if(blit_frame) { - xp_screen_pts=*v_pts-(av_sync_pts?0:initial_audio_pts); + xp_screen_pts=*v_pts-(mp_conf.av_sync_pts?0:initial_audio_pts); #ifdef USE_OSD /*--------- add OSD to the next frame contents ---------*/ MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); @@ -1314,7 +1305,7 @@ time_frame-=GetRelativeTime(); } pinfo[xp_id].current_module="sleep_usleep"; - time_frame=SleepTime(rtc_fd,softsleep,time_frame); + time_frame=SleepTime(rtc_fd,mp_conf.softsleep,time_frame); } pinfo[xp_id].current_module="change_frame2"; /* don't flip if there is nothing new to display */ @@ -1353,7 +1344,7 @@ /* FIXME: this block was added to fix A-V resync caused by some strange things like playing 48KHz audio on 44.1KHz soundcard and other. Now we know PTS of every audio frame so don't need to have it */ - if(sh_audio && (!audio_eof || ao_get_delay(ao_data)) && !av_sync_pts) { + if(sh_audio && (!audio_eof || ao_get_delay(ao_data)) && !mp_conf.av_sync_pts) { float a_pts=0; // unplayed bytes in our and soundcard/dma buffer: @@ -1381,12 +1372,9 @@ float x; AV_delay=(a_pts-delay)-*v_pts; x=AV_delay*0.1f; - if(x<-max_pts_correction) x=-max_pts_correction; else - if(x> max_pts_correction) x= max_pts_correction; - if(default_max_pts_correction>=0) - max_pts_correction=default_max_pts_correction; - else // +-10% of time - max_pts_correction=shva.duration*0.10; + if(x<-max_pts_correction) x=-max_pts_correction; + else if(x> max_pts_correction) x= max_pts_correction; + max_pts_correction=shva.duration*0.10; // +-10% of time if(mp_conf.xp>=XP_VAPlay) pthread_mutex_lock(&audio_timer_mutex); sh_audio->timer+=x; @@ -1555,16 +1543,6 @@ ); } -int v_bright=0; -int v_cont=0; -int v_hue=0; -int v_saturation=0; -/* -For future: -int v_red_intensity=0; -int v_green_intensity=0; -int v_blue_intensity=0; -*/ // for multifile support: play_tree_iter_t* playtree_iter = NULL; @@ -1790,11 +1768,11 @@ sh_video->fps,1/sh_video->fps ); /* need to set fps here for output encoders to pick it up in their init */ - if(force_fps){ - sh_video->fps=force_fps; + if(mp_conf.force_fps){ + sh_video->fps=mp_conf.force_fps; } - if(!sh_video->fps && !force_fps){ + if(!sh_video->fps && !mp_conf.force_fps){ MSG_ERR(MSGTR_FPSnotspecified); sh_video=d_video->sh=NULL; } @@ -2107,6 +2085,16 @@ }input_state_t; static int mpxp_handle_input(seek_args_t* seek,osd_args_t* osd,input_state_t* state) { + int v_bright=0; + int v_cont=0; + int v_hue=0; + int v_saturation=0; +/* +For future: + int v_red_intensity=0; + int v_green_intensity=0; + int v_blue_intensity=0; +*/ int eof=0; mp_cmd_t* cmd; while( (cmd = mp_input_get_cmd(0,0,0)) != NULL) { @@ -2276,9 +2264,9 @@ case MP_CMD_FRAMEDROPPING : { int v = cmd->args[0].v.i; if(v < 0) - frame_dropping = (frame_dropping+1)%3; + mp_conf.frame_dropping = (mp_conf.frame_dropping+1)%3; else - frame_dropping = v > 2 ? 2 : v; + mp_conf.frame_dropping = v > 2 ? 2 : v; osd_show_framedrop = osd->info_factor; } break; case MP_CMD_TV_STEP_CHANNEL: @@ -2391,8 +2379,8 @@ MSG_ERR("MPlayerXP requires working copy of libswscaler\n"); return 0; } - if(shuffle_playback) playtree->flags|=PLAY_TREE_RND; - else playtree->flags&=~PLAY_TREE_RND; + if(mp_conf.shuffle_playback) playtree->flags|=PLAY_TREE_RND; + else playtree->flags&=~PLAY_TREE_RND; playtree = play_tree_cleanup(playtree); if(playtree) { playtree_iter = play_tree_iter_new(playtree,mconfig); @@ -2511,7 +2499,7 @@ d_video=demuxer->video; d_dvdsub=demuxer->sub; - if(seek_to_byte) stream_skip(stream,seek_to_byte); + if(mp_conf.seek_to_byte) stream_skip(stream,mp_conf.seek_to_byte); sh_audio=d_audio->sh; sh_video=d_video->sh; @@ -2561,7 +2549,7 @@ if(stream_dump_type>1) { dump_file: - dump_mux(demuxer,av_sync_pts,seek_to_sec,play_n_frames); + dump_mux(demuxer,mp_conf.av_sync_pts,mp_conf.seek_to_sec,mp_conf.play_n_frames); goto goto_next_file; } /*================== Init VIDEO (codec & libvo) ==========================*/ @@ -2607,8 +2595,8 @@ pinfo[xp_id].current_module="av_init"; - if(av_force_pts_fix2==1 || - (av_force_pts_fix2==-1 && av_sync_pts && + if(mp_conf.av_force_pts_fix2==1 || + (mp_conf.av_force_pts_fix2==-1 && mp_conf.av_sync_pts && (d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG4_ES || d_video->demuxer->file_format == DEMUXER_TYPE_H264_ES || @@ -2643,15 +2631,15 @@ if(demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf! - if(force_fps && sh_video) { - sh_video->fps=force_fps; + if(mp_conf.force_fps && sh_video) { + sh_video->fps=mp_conf.force_fps; MSG_INFO(MSGTR_FPSforced,sh_video->fps,1.0f/sh_video->fps); } /* Init timers and benchmarking */ rtc_fd=InitTimer(); - if(!nortc && rtc_fd>0) { close(rtc_fd); rtc_fd=-1; } - MSG_V("Using %s timing\n",rtc_fd>0?"rtc":softsleep?"software":"usleep()"); + if(!mp_conf.nortc && rtc_fd>0) { close(rtc_fd); rtc_fd=-1; } + MSG_V("Using %s timing\n",rtc_fd>0?"rtc":mp_conf.softsleep?"software":"usleep()"); time_usage.total_start=GetTimer(); time_usage.audio=0; time_usage.audio_decode=0; time_usage.video=0; @@ -2688,9 +2676,9 @@ int in_pause=0; float v_pts=0; - if(play_n_frames>=0){ - --play_n_frames; - if(play_n_frames<0) eof = PT_NEXT_ENTRY; + if(mp_conf.play_n_frames>=0){ + --mp_conf.play_n_frames; + if(mp_conf.play_n_frames<0) eof = PT_NEXT_ENTRY; } if( mp_conf.xp < XP_VAPlay ) @@ -2731,24 +2719,24 @@ eof=mpxp_handle_input(&seek_args,&osd,&input_state); if(input_state.next_file) goto goto_next_file; - if (seek_to_sec) { + if (mp_conf.seek_to_sec) { int a,b; float d; - if (sscanf(seek_to_sec, "%d:%d:%f", &a,&b,&d)==3) + if (sscanf(mp_conf.seek_to_sec, "%d:%d:%f", &a,&b,&d)==3) seek_args.secs += 3600*a +60*b +d ; - else if (sscanf(seek_to_sec, "%d:%f", &a, &d)==2) + else if (sscanf(mp_conf.seek_to_sec, "%d:%f", &a, &d)==2) seek_args.secs += 60*a +d; - else if (sscanf(seek_to_sec, "%f", &d)==1) + else if (sscanf(mp_conf.seek_to_sec, "%f", &d)==1) seek_args.secs += d; - seek_to_sec = NULL; + mp_conf.seek_to_sec = NULL; } do_loop: /* Looping. */ - if(eof && loop_times>=0) { - MSG_V("loop_times = %d, eof = %d\n", loop_times,eof); + if(eof && mp_conf.loop_times>=0) { + MSG_V("loop_times = %d, eof = %d\n", mp_conf.loop_times,eof); - if(loop_times>1) loop_times--; else - if(loop_times==1) loop_times=-1; + if(mp_conf.loop_times>1) mp_conf.loop_times--; else + if(mp_conf.loop_times==1) mp_conf.loop_times=-1; eof=0; audio_eof=0; Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-10-26 10:58:24 UTC (rev 218) +++ mplayerxp/mplayer.h 2012-10-26 11:45:13 UTC (rev 219) @@ -21,6 +21,15 @@ int autoq; /* quality's options: */ unsigned verbose; int benchmark; +// sync + int frame_dropping; // option 0=no drop 1= drop vo 2= drop decode + int av_sync_pts; + int av_force_pts_fix; + int av_force_pts_fix2; + int frame_reorder; + float force_fps; + int softsleep; + int nortc; // streaming: int audio_id; int video_id; @@ -29,19 +38,19 @@ char* audio_lang; char* dvdsub_lang; char* spudec_ifo; +// seek: + char* seek_to_sec; + long long int seek_to_byte; + int loop_times; + int shuffle_playback; + int play_n_frames; }mp_conf_t; extern mp_conf_t mp_conf; extern unsigned xp_num_frames; extern int xp_id; extern unsigned mplayer_accel; -extern int frame_dropping; - -extern int av_sync_pts; -extern int av_force_pts_fix; -extern int frame_reorder; extern int use_pts_fix2; -extern int av_force_pts_fix2; extern void exit_player(char* how); extern void mpxp_resync_audio_stream(void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-26 12:27:23
|
Revision: 221 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=221&view=rev Author: nickols_k Date: 2012-10-26 12:27:16 +0000 (Fri, 26 Oct 2012) Log Message: ----------- prepare next step of improvements Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/dump.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpdemux/cache2.c mplayerxp/mplayer.c mplayerxp/sig_hand.h Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-26 11:54:16 UTC (rev 220) +++ mplayerxp/dec_ahead.c 2012-10-26 12:27:16 UTC (rev 221) @@ -271,10 +271,12 @@ xp_audio_eof=0; MSG_T("\nDEC_AHEAD: entering...\n"); _xp_id=init_signal_handling(sig_dec_ahead_video,uninit_dec_ahead); - pinfo[_xp_id].current_module = "dec_ahead"; + MP_UNIT(_xp_id,"dec_ahead"); pinfo[_xp_id].pid = getpid(); /* Only for testing */ pinfo[_xp_id].pth_id = pthread_self(); - pinfo[_xp_id].thread_name = (xp_core.has_audio && mp_conf.xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; + pinfo[_xp_id].thread_name = (xp_core.has_audio && mp_conf.xp < XP_VAFull) ? + "video+audio decoding+filtering ahead" : + "video decoding+vf ahead"; drop_barrier=(float)(xp_num_frames/2)*(1/sh_video->fps); if(mp_conf.av_sync_pts == -1 && !use_pts_fix2) xp_is_bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || @@ -289,28 +291,28 @@ int in_size; if(pthread_end_of_work) break; if(xp_core.in_lseek==PreSeek) { - pinfo[_xp_id].current_module = "Pre seek"; + MP_UNIT(_xp_id,"Pre seek"); xp_core.in_lseek=Seek; } - pinfo[_xp_id].current_module = "dec_ahead 1"; + MP_UNIT(_xp_id,"dec_ahead 1"); /* get it! */ #if 0 /* prevent reent access to non-reent demuxer */ //if(sh_video->num_frames>200) *((char*)0x100) = 1; // Testing crash if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { - pinfo[_xp_id].current_module = "decode audio"; + MP_UNIT(_xp_id,"decode audio"); while(2==xp_thread_decode_audio()) ; - pinfo[_xp_id].current_module = "dec_ahead 2"; + MP_UNIT(_xp_id,"dec_ahead 2"); } #endif /*-------------------- Decode a frame: -----------------------*/ in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,sh_video->fps); if(xp_core.in_lseek==Seek) { - pinfo[_xp_id].current_module = "Post seek"; + MP_UNIT(_xp_id,"Post seek"); if(xp_is_bad_pts) mpeg_timer=HUGE; xp_core.in_lseek=NoSeek; - pinfo[_xp_id].current_module = "dec_ahead 3"; + MP_UNIT(_xp_id,"dec_ahead 3"); } if(in_size<0) { xp_core.video->fra[xp_core.video->decoder_idx].eof=1; @@ -398,9 +400,9 @@ if(pthread_end_of_work) goto pt_exit; if(xp_core.in_lseek!=NoSeek) break; if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { - pinfo[_xp_id].current_module = "decode audio"; + MP_UNIT(_xp_id,"decode audio"); xp_thread_decode_audio(); - pinfo[_xp_id].current_module = "dec_ahead 5"; + MP_UNIT(_xp_id,"dec_ahead 5"); } usleep(1); } @@ -409,9 +411,9 @@ if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { while(!xp_audio_eof && !xp_core.in_lseek && !pthread_end_of_work) { - pinfo[_xp_id].current_module = "decode audio"; + MP_UNIT(_xp_id,"decode audio"); if(!xp_thread_decode_audio()) usleep(1); - pinfo[_xp_id].current_module = NULL; + MP_UNIT(_xp_id,NULL); } } pt_exit: @@ -436,12 +438,12 @@ xp_audio_eof=0; MSG_T("\nDEC_AHEAD: entering...\n"); xp_id=init_signal_handling(sig_audio_decode,uninit_dec_ahead); - pinfo[xp_id].current_module = "dec_ahead"; + MP_UNIT(xp_id,"dec_ahead"); pinfo[xp_id].thread_name = "audio decoding+af ahead"; dec_ahead_can_adseek=0; while(!a_pthread_end_of_work) { - pinfo[xp_id].current_module = "decode audio"; + MP_UNIT(xp_id,"decode audio"); while((ret = xp_thread_decode_audio()) == 2) /* Almost empty buffer */ if(xp_audio_eof) break; @@ -450,11 +452,11 @@ if(a_pthread_end_of_work) break; - pinfo[xp_id].current_module = "sleep"; + MP_UNIT(xp_id,"sleep"); LOCK_AUDIO_DECODE(); if( !xp_core.in_lseek && !a_pthread_end_of_work) { if(xp_audio_eof) { - pinfo[xp_id].current_module = "wait end of work"; + MP_UNIT(xp_id,"wait end of work"); pthread_cond_wait( &audio_decode_cond, &audio_decode_mutex ); } else if(ret==0) { /* Full buffer or end of file */ if(audio_play_in_sleep) { /* Sleep a little longer than player thread */ @@ -486,7 +488,7 @@ if(a_pthread_end_of_work) break; - pinfo[xp_id].current_module = "seek"; + MP_UNIT(xp_id,"seek"); LOCK_AUDIO_DECODE(); while( xp_core.in_lseek!=NoSeek && !a_pthread_end_of_work) { gettimeofday(&now,NULL); @@ -499,7 +501,7 @@ dec_ahead_can_adseek = 0; /* Not safe to seek */ UNLOCK_AUDIO_DECODE(); } - pinfo[xp_id].current_module = "exit"; + MP_UNIT(xp_id,"exit"); dec_ahead_can_adseek = 1; a_pthread_is_living=0; a_pthread_end_of_work=0; @@ -772,20 +774,20 @@ max_audio = 0; xp_id=init_signal_handling(sig_audio_play,uninit_dec_ahead); - pinfo[xp_id].current_module = "audio_play_routine"; + MP_UNIT(xp_id,"audio_play_routine"); pinfo[xp_id].thread_name = "audio play thread"; pthread_audio_is_living=1; dec_ahead_can_aseek=0; while(!pthread_audio_end_of_work) { - pinfo[xp_id].current_module = "audio decore_audio"; + MP_UNIT(xp_id,"audio decore_audio"); dec_ahead_audio_delay = NOTHING_PLAYED; eof = decore_audio(xp_id); if(pthread_audio_end_of_work) break; - pinfo[xp_id].current_module = "audio sleep"; + MP_UNIT(xp_id,"audio sleep"); dec_ahead_can_aseek = 1; /* Safe for other threads to seek */ @@ -856,7 +858,7 @@ LOCK_AUDIO_PLAY(); if(eof && !pthread_audio_end_of_work) { - pinfo[xp_id].current_module = "wait end of work"; + MP_UNIT(xp_id,"wait end of work"); pthread_cond_wait( &audio_play_cond, &audio_play_mutex ); } UNLOCK_AUDIO_PLAY(); @@ -864,7 +866,7 @@ if(pthread_audio_end_of_work) break; - pinfo[xp_id].current_module = "audio pause"; + MP_UNIT(xp_id,"audio pause"); LOCK_AUDIO_PLAY(); while( xp_core.in_pause && !pthread_audio_end_of_work ) { pthread_cond_wait( &audio_play_cond, &audio_play_mutex ); @@ -873,8 +875,8 @@ if(pthread_audio_end_of_work) break; - - pinfo[xp_id].current_module = "audio seek"; + + MP_UNIT(xp_id,"audio seek"); LOCK_AUDIO_PLAY(); while( xp_core.in_lseek!=NoSeek && !pthread_audio_end_of_work) { gettimeofday(&now,NULL); @@ -888,7 +890,7 @@ UNLOCK_AUDIO_PLAY(); } fflush(stdout); - pinfo[xp_id].current_module = "audio exit"; + MP_UNIT(xp_id,"audio exit"); dec_ahead_can_aseek=1; pthread_audio_is_living=0; pthread_audio_end_of_work=0; Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-10-26 11:54:16 UTC (rev 220) +++ mplayerxp/dump.c 2012-10-26 12:27:16 UTC (rev 221) @@ -39,7 +39,7 @@ int len; FILE *f; const char *ext,*name; - pinfo[xp_id].current_module="dumpstream"; + MP_UNIT(xp_id,"dumpstream"); stream_reset(stream); stream_seek(stream,stream->start_pos); ext=".ext"; @@ -306,7 +306,7 @@ int in_size,aeof,veof,seof,cmd; if(!priv) return; - pinfo[xp_id].current_module="dump"; + MP_UNIT(xp_id,"dump"); priv->my_use_pts=use_pts; /* test stream property */ MSG_INFO("%s using PTS method\n",use_pts?"":"not"); Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-26 11:54:16 UTC (rev 220) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-26 12:27:16 UTC (rev 221) @@ -300,12 +300,12 @@ if(mp_subtitles && v_pts>0){ float pts=v_pts; if(sub_fps==0) sub_fps=sh_video->fps; - pinfo[xp_id].current_module="find_sub"; + MP_UNIT(xp_id,"find_sub"); if (pts > sub_last_pts || pts < sub_last_pts-1.0 ) { find_sub(mp_subtitles,sub_uses_time?(100*pts):(pts*sub_fps),vo_data); // FIXME! frame counter... sub_last_pts = pts; } - pinfo[xp_id].current_module=NULL; + MP_UNIT(xp_id,NULL); } #endif @@ -325,7 +325,7 @@ if(vo_data->spudec){ unsigned char* packet=NULL; int len,timestamp; - pinfo[xp_id].current_module="spudec"; + MP_UNIT(xp_id,"spudec"); spudec_now_pts(vo_data->spudec,90000*v_pts); if(spudec_visible(vo_data->spudec)) { vo_draw_spudec_direct(vo_data,xp_idx); @@ -347,7 +347,7 @@ } /* detect wether the sub has changed or not */ if(spudec_changed(vo_data->spudec)) vo_draw_spudec_direct(vo_data,xp_idx); - pinfo[xp_id].current_module=NULL; + MP_UNIT(xp_id,NULL); } } } Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-10-26 11:54:16 UTC (rev 220) +++ mplayerxp/libmpdemux/cache2.c 2012-10-26 12:27:16 UTC (rev 221) @@ -261,7 +261,7 @@ cache_vars_t* c=(cache_vars_t*)arg; c->cache2_is_living=1; xp_id=init_signal_handling(sig_cache2,stream_unlink_cache); - pinfo[xp_id].current_module = "cache2_routine"; + MP_UNIT(xp_id,"cache2_routine"); c->cache2_pid = pinfo[xp_id].pid = getpid(); /* Only for testing */ c->cache2_pth_id = pinfo[xp_id].pth_id = pthread_self(); pinfo[xp_id].thread_name = "cache2"; Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-26 11:54:16 UTC (rev 220) +++ mplayerxp/mplayer.c 2012-10-26 12:27:16 UTC (rev 221) @@ -617,79 +617,79 @@ fflush(stderr); mask=inited_flags&mask; - pinfo[xp_id].current_module="uninit_xp"; + MP_UNIT(xp_id,"uninit_xp"); uninit_dec_ahead(0); if (mask&INITED_SPUDEC){ inited_flags&=~INITED_SPUDEC; - pinfo[xp_id].current_module="uninit_spudec"; + MP_UNIT(xp_id,"uninit_spudec"); spudec_free(vo_data->spudec); vo_data->spudec=NULL; } if (mask&INITED_VOBSUB){ inited_flags&=~INITED_VOBSUB; - pinfo[xp_id].current_module="uninit_vobsub"; + MP_UNIT(xp_id,"uninit_vobsub"); vobsub_close(vo_data->vobsub); vo_data->vobsub=NULL; } if(mask&INITED_VCODEC){ inited_flags&=~INITED_VCODEC; - pinfo[xp_id].current_module="uninit_vcodec"; + MP_UNIT(xp_id,"uninit_vcodec"); mpcv_uninit(sh_video); sh_video=NULL; } if(mask&INITED_VO){ inited_flags&=~INITED_VO; - pinfo[xp_id].current_module="uninit_vo"; + MP_UNIT(xp_id,"uninit_vo"); vo_uninit(vo_data); } if(mask&INITED_ACODEC){ inited_flags&=~INITED_ACODEC; - pinfo[xp_id].current_module="uninit_acodec"; + MP_UNIT(xp_id,"uninit_acodec"); mpca_uninit(sh_audio); sh_audio=NULL; } if(mask&INITED_AO){ inited_flags&=~INITED_AO; - pinfo[xp_id].current_module="uninit_ao"; + MP_UNIT(xp_id,"uninit_ao"); ao_uninit(ao_data); } if(mask&INITED_GETCH2){ inited_flags&=~INITED_GETCH2; - pinfo[xp_id].current_module="uninit_getch2"; + MP_UNIT(xp_id,"uninit_getch2"); // restore terminal: getch2_disable(); } if(mask&INITED_DEMUXER){ inited_flags&=~INITED_DEMUXER; - pinfo[xp_id].current_module="free_demuxer"; + MP_UNIT(xp_id,"free_demuxer"); FREE_DEMUXER(demuxer); } if(mask&INITED_STREAM){ inited_flags&=~INITED_STREAM; - pinfo[xp_id].current_module="uninit_stream"; + MP_UNIT(xp_id,"uninit_stream"); if(stream) free_stream(stream); stream=NULL; } if(mask&INITED_INPUT){ inited_flags&=~INITED_INPUT; - pinfo[xp_id].current_module="uninit_input"; + MP_UNIT(xp_id,"uninit_input"); mp_input_uninit(); } #ifdef USE_SUB if(mask&INITED_SUBTITLE){ inited_flags&=~INITED_SUBTITLE; - pinfo[xp_id].current_module="sub_free"; + MP_UNIT(xp_id,"sub_free"); mp_input_uninit(); sub_free( mp_subtitles ); sub_name=NULL; @@ -697,7 +697,7 @@ mp_subtitles=NULL; } #endif - pinfo[xp_id].current_module=NULL; + MP_UNIT(xp_id,NULL); } void exit_player(char* how){ @@ -706,7 +706,7 @@ fflush(stderr); uninit_player(INITED_ALL); - pinfo[xp_id].current_module="exit_player"; + MP_UNIT(xp_id,"exit_player"); sws_uninit(); if(how) MSG_HINT(MSGTR_Exiting,how); @@ -732,7 +732,7 @@ } uninit_player((INITED_ALL)&(~(INITED_STREAM|INITED_DEMUXER))); - pinfo[xp_id].current_module="exit_player"; + MP_UNIT(xp_id,"exit_player"); MSG_HINT(MSGTR_Exiting,MSGTR_Exit_quit); MSG_DBG2("max framesize was %d bytes\n",max_framesize); if(mconfig) m_config_free(mconfig); @@ -1000,7 +1000,7 @@ //if(playsize>outburst) playsize=outburst; // Update buffer if needed - pinfo[_xp_id].current_module="mpca_decode"; // Enter AUDIO decoder module + MP_UNIT(xp_id,"mpca_decode"); // Enter AUDIO decoder module t=GetTimer(); while(sh_audio->a_buffer_len<playsize && !audio_eof){ if(mp_conf.xp>=XP_VideoAudio) { @@ -1021,14 +1021,14 @@ { MSG_V("audio_stream_eof\n"); inited_flags&=~INITED_AO; - pinfo[_xp_id].current_module="uninit_ao"; + MP_UNIT(xp_id,"uninit_ao"); ao_uninit(ao_data); } audio_eof=1; break; } } - pinfo[_xp_id].current_module="play_audio"; // Leave AUDIO decoder module + MP_UNIT(xp_id,"play_audio"); // Leave AUDIO decoder module t=GetTimer()-t; tt = t*0.000001f; time_usage.audio+=tt; @@ -1251,13 +1251,13 @@ #ifdef USE_OSD /*--------- add OSD to the next frame contents ---------*/ MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); - pinfo[xp_id].current_module="draw_osd"; + MP_UNIT(xp_id,"draw_osd"); update_osd(shva.stream_pts); vo_draw_osd(vo_data,dae_curr_vplayed()); #endif } /* It's time to sleep ;)...*/ - pinfo[xp_id].current_module="sleep"; + MP_UNIT(xp_id,"sleep"); GetRelativeTime(); /* reset timer */ if(sh_audio) { /* FIXME!!! need the same technique to detect audio_eof as for video_eof! @@ -1303,10 +1303,10 @@ usleep(1); time_frame-=GetRelativeTime(); } - pinfo[xp_id].current_module="sleep_usleep"; + MP_UNIT(xp_id,"sleep_usleep"); time_frame=SleepTime(rtc_fd,mp_conf.softsleep,time_frame); } - pinfo[xp_id].current_module="change_frame2"; + MP_UNIT(xp_id,"change_frame2"); /* don't flip if there is nothing new to display */ if(!blit_frame) { static int drop_message=0; @@ -1337,7 +1337,7 @@ bench_dropped_frames ++; } } - pinfo[xp_id].current_module=NULL; + MP_UNIT(xp_id,NULL); /*================ A-V TIMESTAMP CORRECTION: =========================*/ /* FIXME: this block was added to fix A-V resync caused by some strange things @@ -1421,20 +1421,20 @@ fflush(stdout); if(sh_video){ - pinfo[_xp_id].current_module="seek_video_reset"; + MP_UNIT(xp_id,"seek_video_reset"); mpcv_resync_stream(sh_video); vo_reset(vo_data); sh_video->chapter_change=-1; } if(sh_audio){ - pinfo[_xp_id].current_module="seek_audio_reset"; + MP_UNIT(xp_id,"seek_audio_reset"); mpca_resync_stream(sh_audio); ao_reset(ao_data); // stop audio, throwing away buffered data } if (vo_data->vobsub) { - pinfo[_xp_id].current_module = "seek_vobsub_reset"; + MP_UNIT(xp_id,"seek_vobsub_reset"); vobsub_seek_r(vo_data->vobsub, seek); } @@ -1552,7 +1552,7 @@ #endif fifo_make_pipe(&keyb_fifo_get,&keyb_fifo_put); /* Init input system */ - pinfo[xp_id].current_module = "init_input"; + MP_UNIT(xp_id,"init_input"); mp_input_init(); if(keyb_fifo_get > 0) mp_input_add_key_fd(keyb_fifo_get,1,NULL,NULL); @@ -1590,7 +1590,7 @@ MSG_WARN("Menu init failed\n"); } } - pinfo[xp_id].current_module="init_osd"; + MP_UNIT(xp_id,"init_osd"); vo_init_osd(); } @@ -1608,14 +1608,14 @@ video_driver[i] = '\0'; } } - pinfo[xp_id].current_module="vo_register"; + MP_UNIT(xp_id,"vo_register"); vo_inited = (vo_register(vo_data,video_driver)!=NULL)?1:0; if(!vo_inited){ MSG_FATAL(MSGTR_InvalidVOdriver,video_driver?video_driver:"?"); exit_player(MSGTR_Exit_error); } - pinfo[xp_id].current_module="vo_init"; + MP_UNIT(xp_id,"vo_init"); if((i=vo_init(vo_data,vo_conf.subdevice))!=0) { MSG_FATAL("Error opening/initializing the selected video_out (-vo) device!\n"); @@ -1623,7 +1623,7 @@ } // check audio_out driver name: - pinfo[xp_id].current_module="ao_init"; + MP_UNIT(xp_id,"ao_init"); if (audio_driver) if ((i=strcspn(audio_driver, ":")) > 0) { @@ -1646,7 +1646,7 @@ static int mpxp_init_vobsub(const char *filename) { int forced_subs_only=0; - pinfo[xp_id].current_module="vobsub"; + MP_UNIT(xp_id,"vobsub"); if (vobsub_name){ vo_data->vobsub=vobsub_open(vobsub_name,mp_conf.spudec_ifo,1,&vo_data->spudec); if(vo_data->vobsub==NULL) @@ -1677,7 +1677,7 @@ int eof=0; play_tree_t* entry; // Handle playlist - pinfo[xp_id].current_module="handle_playlist"; + MP_UNIT(xp_id,"handle_playlist"); MSG_V("Parsing playlist %s...\n",filename); entry = parse_playtree(stream); if(!entry) { @@ -1711,7 +1711,7 @@ /* Add NLS support here */ char *lang; if(!mp_conf.audio_lang) mp_conf.audio_lang=nls_get_screen_cp(); - pinfo[xp_id].current_module="dvd lang->id"; + MP_UNIT(xp_id,"dvd lang->id"); if(mp_conf.audio_lang) { lang=malloc(max(strlen(mp_conf.audio_lang)+1,4)); strcpy(lang,mp_conf.audio_lang); @@ -1757,7 +1757,7 @@ } static void mpxp_read_video_properties(void) { - pinfo[xp_id].current_module="video_read_properties"; + MP_UNIT(xp_id,"video_read_properties"); if(!video_read_properties(sh_video)) { MSG_ERR("Video: can't read properties\n"); sh_video=d_video->sh=NULL; @@ -1781,20 +1781,20 @@ static void mpxp_read_subtitles(const char *filename,int forced_subs_only,int stream_dump_type) { if (mp_conf.spudec_ifo) { unsigned int palette[16], width, height; - pinfo[xp_id].current_module="spudec_init_vobsub"; + MP_UNIT(xp_id,"spudec_init_vobsub"); if (vobsub_parse_ifo(NULL,mp_conf.spudec_ifo, palette, &width, &height, 1, -1, NULL) >= 0) vo_data->spudec=spudec_new_scaled(palette, sh_video->src_w, sh_video->src_h); } if (vo_data->spudec==NULL) { unsigned *pal; - pinfo[xp_id].current_module="spudec_init"; + MP_UNIT(xp_id,"spudec_init"); if(stream->driver->control(stream,SCTRL_VID_GET_PALETTE,&pal)==SCTRL_OK) vo_data->spudec=spudec_new_scaled(pal,sh_video->src_w, sh_video->src_h); } if (vo_data->spudec==NULL) { - pinfo[xp_id].current_module="spudec_init_normal"; + MP_UNIT(xp_id,"spudec_init_normal"); vo_data->spudec=spudec_new_scaled(NULL, sh_video->src_w, sh_video->src_h); spudec_set_font_factor(vo_data->spudec,font_factor); } @@ -1809,7 +1809,7 @@ // after reading video params we should load subtitles because // we know fps so now we can adjust subtitles time to ~6 seconds AST // check .sub - pinfo[xp_id].current_module="read_subtitles_file"; + MP_UNIT(xp_id,"read_subtitles_file"); if(sub_name){ mp_subtitles=sub_read_file(sub_name, sh_video->fps); if(!mp_subtitles) MSG_ERR(MSGTR_CantLoadSub,sub_name); @@ -1869,7 +1869,7 @@ static int mpxp_find_vcodec(void) { int rc=0; - pinfo[xp_id].current_module="init_video_codec"; + MP_UNIT(xp_id,"init_video_codec"); /* Go through the codec.conf and find the best codec...*/ sh_video->inited=0; vo_data->flags=0; @@ -1913,7 +1913,7 @@ static int mpxp_configure_audio(void) { int rc=0; const ao_info_t *info=ao_get_info(); - pinfo[xp_id].current_module="setup_audio"; + MP_UNIT(xp_id,"setup_audio"); MSG_V("AO: [%s] %iHz %s %s\n", info->short_name, force_srate?force_srate:sh_audio->samplerate, @@ -1931,7 +1931,7 @@ if(strlen(info->comment) > 0) MSG_V("AO: Comment: %s\n", info->comment); - pinfo[xp_id].current_module="af_preinit"; + MP_UNIT(xp_id,"af_preinit"); ao_data->samplerate=force_srate?force_srate:sh_audio->samplerate; ao_data->channels=audio_output_channels?audio_output_channels:sh_audio->channels; ao_data->format=sh_audio->sample_format; @@ -1957,7 +1957,7 @@ if(sh_video == NULL) rc=-1; } else { inited_flags|=INITED_AO; - pinfo[xp_id].current_module="af_init"; + MP_UNIT(xp_id,"af_init"); if(!mpca_init_filters(sh_audio, (int)(sh_audio->samplerate), sh_audio->channels, sh_audio->sample_format, sh_audio->samplesize, @@ -1971,7 +1971,7 @@ } static void mpxp_run_ahead_engine(void) { - pinfo[xp_id].current_module="init_xp"; + MP_UNIT(xp_id,"init_xp"); if(sh_video && xp_num_frames < 5) {/* we need at least 5 buffers to suppress screen judering */ MSG_FATAL("Not enough buffers for DECODING AHEAD!\nNeed %u buffers but exist only %u\n",5,xp_num_frames); exit_player("Try other '-vo' driver.\n"); @@ -2414,7 +2414,7 @@ // ========== Init keyboard FIFO (connection to libvo) ============ mpxp_init_keyboard_fifo(); - pinfo[xp_id].current_module = NULL; + MP_UNIT(xp_id,NULL); xp_id = init_signal_handling(exit_sighandler,NULL); @@ -2433,7 +2433,7 @@ forced_subs_only=mpxp_init_vobsub(filename); - pinfo[xp_id].current_module="mplayer"; + MP_UNIT(xp_id,"mplayer"); if(!input_state.after_dvdmenu) { stream=NULL; demuxer=NULL; @@ -2452,7 +2452,7 @@ } if(stream_dump_type) mp_conf.s_cache_size=0; - pinfo[xp_id].current_module="open_stream"; + MP_UNIT(xp_id,"open_stream"); if(!input_state.after_dvdmenu) stream=open_stream(filename,&file_format,stream_dump_type>1?dump_stream_event_handler:mpxp_stream_event_handler); if(!stream) { // error... eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY); @@ -2468,11 +2468,11 @@ /* Add NLS support here */ mpxp_init_dvd_nls(); - pinfo[xp_id].current_module=NULL; + MP_UNIT(xp_id,NULL); // CACHE2: initial prefill: 20% later: 5% (should be set by -cacheopts) if(mp_conf.s_cache_size && !stream_dump_type){ - pinfo[xp_id].current_module="enable_cache"; + MP_UNIT(xp_id,"enable_cache"); if(!stream_enable_cache(stream,mp_conf.s_cache_size*1024,mp_conf.s_cache_size*1024/5,mp_conf.s_cache_size*1024/20)) if((eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY))) goto goto_next_file; } @@ -2486,7 +2486,7 @@ if(!has_video) mp_conf.video_id=-2; // do NOT read video packets... if(!has_dvdsub) mp_conf.dvdsub_id=-2;// do NOT read subtitle packets... - pinfo[xp_id].current_module="demux_open"; + MP_UNIT(xp_id,"demux_open"); if(!input_state.after_dvdmenu) demuxer=demux_open(stream,file_format,mp_conf.audio_id,mp_conf.video_id,mp_conf.dvdsub_id); if(!demuxer) goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR @@ -2517,7 +2517,7 @@ if(sh_video) mpxp_read_subtitles(filename,forced_subs_only,stream_dump_type); //================== Init AUDIO (codec) ========================== - pinfo[xp_id].current_module="init_audio_codec"; + MP_UNIT(xp_id,"init_audio_codec"); if(sh_audio) mpxp_find_acodec(); @@ -2553,7 +2553,7 @@ /*================== Init VIDEO (codec & libvo) ==========================*/ if(!sh_video) goto main; - pinfo[xp_id].current_module="init_video_filters"; + MP_UNIT(xp_id,"init_video_filters"); if(sh_video->vfilter_inited<=0) { sh_video->vfilter=vf_init(sh_video); sh_video->vfilter_inited=1; @@ -2579,7 +2579,7 @@ inited_flags|=INITED_VO; MSG_V("INFO: Video OUT driver init OK!\n"); - pinfo[xp_id].current_module="init_libvo"; + MP_UNIT(xp_id,"init_libvo"); fflush(stdout); //================== MAIN: ========================== @@ -2591,7 +2591,7 @@ if(sh_audio) if((mpxp_configure_audio())!=0) goto goto_next_file; - pinfo[xp_id].current_module="av_init"; + MP_UNIT(xp_id,"av_init"); if(mp_conf.av_force_pts_fix2==1 || (mp_conf.av_force_pts_fix2==-1 && mp_conf.av_sync_pts && @@ -2682,7 +2682,7 @@ if( mp_conf.xp < XP_VAPlay ) eof |= decore_audio(xp_id); /*========================== UPDATE TIMERS ============================*/ - pinfo[xp_id].current_module="Update timers"; + MP_UNIT(xp_id,"Update timers"); if(!sh_video) { if(mp_conf.benchmark && mp_conf.verbose) show_benchmark_status(); else mpxp_print_audio_status(); @@ -2743,7 +2743,7 @@ } if(seek_args.secs || (seek_args.flags&DEMUX_SEEK_SET)) { - pinfo[xp_id].current_module="seek"; + MP_UNIT(xp_id,"seek"); dec_ahead_halt_threads(0); @@ -2761,7 +2761,7 @@ dec_ahead_restart_threads(xp_id); /* Disable threads for DVD menus */ - pinfo[xp_id].current_module=NULL; + MP_UNIT(xp_id,NULL); } #ifdef USE_OSD update_osd(d_video->pts); Modified: mplayerxp/sig_hand.h =================================================================== --- mplayerxp/sig_hand.h 2012-10-26 11:54:16 UTC (rev 220) +++ mplayerxp/sig_hand.h 2012-10-26 12:27:16 UTC (rev 221) @@ -22,6 +22,7 @@ extern pth_info_t pinfo[MAX_XPTHREADS]; extern int xp_threads; +#define MP_UNIT(id,name) (pinfo[id].current_module=name) int init_signal_handling( void (*callback)( void ),void (*unlink)(int)); void uninit_signal_handling( int xp_id ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-27 07:38:55
|
Revision: 223 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=223&view=rev Author: nickols_k Date: 2012-10-27 07:38:46 +0000 (Sat, 27 Oct 2012) Log Message: ----------- NEW: next version of XP-CORE Modified Paths: -------------- mplayerxp/dump.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpdemux/cache2.c mplayerxp/libvo/sub.c mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/sig_hand.c mplayerxp/sig_hand.h mplayerxp/xmp_core.c mplayerxp/xmp_core.h Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-10-26 13:01:26 UTC (rev 222) +++ mplayerxp/dump.c 2012-10-27 07:38:46 UTC (rev 223) @@ -39,7 +39,7 @@ int len; FILE *f; const char *ext,*name; - MP_UNIT(xp_id,"dumpstream"); + MP_UNIT("dumpstream"); stream_reset(stream); stream_seek(stream,stream->start_pos); ext=".ext"; @@ -306,7 +306,7 @@ int in_size,aeof,veof,seof,cmd; if(!priv) return; - MP_UNIT(xp_id,"dump"); + MP_UNIT("dump"); priv->my_use_pts=use_pts; /* test stream property */ MSG_INFO("%s using PTS method\n",use_pts?"":"not"); Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-26 13:01:26 UTC (rev 222) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-27 07:38:46 UTC (rev 223) @@ -300,12 +300,12 @@ if(mp_subtitles && v_pts>0){ float pts=v_pts; if(sub_fps==0) sub_fps=sh_video->fps; - MP_UNIT(xp_id,"find_sub"); + MP_UNIT("find_sub"); if (pts > sub_last_pts || pts < sub_last_pts-1.0 ) { find_sub(mp_subtitles,sub_uses_time?(100*pts):(pts*sub_fps),vo_data); // FIXME! frame counter... sub_last_pts = pts; } - MP_UNIT(xp_id,NULL); + MP_UNIT(NULL); } #endif @@ -325,7 +325,7 @@ if(vo_data->spudec){ unsigned char* packet=NULL; int len,timestamp; - MP_UNIT(xp_id,"spudec"); + MP_UNIT("spudec"); spudec_now_pts(vo_data->spudec,90000*v_pts); if(spudec_visible(vo_data->spudec)) { vo_draw_spudec_direct(vo_data,xp_idx); @@ -347,7 +347,7 @@ } /* detect wether the sub has changed or not */ if(spudec_changed(vo_data->spudec)) vo_draw_spudec_direct(vo_data,xp_idx); - MP_UNIT(xp_id,NULL); + MP_UNIT(NULL); } } } Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-10-26 13:01:26 UTC (rev 222) +++ mplayerxp/libmpdemux/cache2.c 2012-10-27 07:38:46 UTC (rev 223) @@ -54,12 +54,7 @@ /* thread related stuff */ int in_fill; pthread_mutex_t mutex; - pthread_attr_t cache2_attr; - pthread_t cache2_thread_id; - pid_t cache2_pid; /* Only for testing */ - pthread_t cache2_pth_id; - volatile int cache2_is_living; - volatile int cache2_end_of_work; + mpxp_thread_t* pth; /* for optimization: */ cache_packet_t *packets; char * mem; @@ -242,7 +237,7 @@ { MSG_V("cache2 segfault\n"); mp_msg_flush(); - killall_threads(pthread_self()); + xmp_killall_threads(pthread_self()); __exit_sighandler(); } @@ -254,42 +249,37 @@ static any_t*cache2_routine(any_t*arg) { - double tt; - unsigned int t=0; - unsigned int t2; - int xp_id,cfill; - cache_vars_t* c=(cache_vars_t*)arg; - c->cache2_is_living=1; - xp_id=init_signal_handling(sig_cache2,stream_unlink_cache); - MP_UNIT(xp_id,"cache2_routine"); - c->cache2_pid = pinfo[xp_id].pid = getpid(); /* Only for testing */ - c->cache2_pth_id = pinfo[xp_id].pth_id = pthread_self(); - pinfo[xp_id].thread_name = "cache2"; - while(1) - { - if(mp_conf.benchmark) t=GetTimer(); - cfill=c2_cache_fill(c); - if(mp_conf.benchmark) - { - t2=GetTimer();t=t2-t; - tt = t*0.000001f; - time_usage.c2+=tt; - if(tt > time_usage.max_c2) time_usage.max_c2=tt; - if(tt < time_usage.min_c2) time_usage.min_c2=tt; + mpxp_thread_t* priv=arg; + + double tt; + unsigned int t=0; + unsigned int t2; + int cfill; + cache_vars_t* c=(cache_vars_t*)arg; + + priv->state=Pth_Run; + priv->pid = getpid(); + + while(1) { + if(mp_conf.benchmark) t=GetTimer(); + cfill=c2_cache_fill(c); + if(mp_conf.benchmark) { + t2=GetTimer();t=t2-t; + tt = t*0.000001f; + time_usage.c2+=tt; + if(tt > time_usage.max_c2) time_usage.max_c2=tt; + if(tt < time_usage.min_c2) time_usage.min_c2=tt; + } + if(!cfill) usleep(FILL_USLEEP_TIME); // idle + if(priv->state==Pth_Canceling) break; } - if(!cfill) - usleep(FILL_USLEEP_TIME); // idle - if(c->cache2_end_of_work) break; - } - c->cache2_is_living=0; - uninit_signal_handling(xp_id); - return arg; + priv->state=Pth_Stand; + return arg; } int stream_enable_cache(stream_t *stream,int size,int _min,int prefill){ int ss=stream->sector_size>1?stream->sector_size:STREAM_BUFFER_SIZE; cache_vars_t* c; - int retval; if (!(stream->type&STREAMTYPE_SEEKABLE) && stream->fd < 0) { // The stream has no 'fd' behind it, so is non-cacheable @@ -304,20 +294,10 @@ c->stream=stream; c->prefill=size*prefill; c->read_filepos=stream->start_pos; - - pthread_attr_init(&c->cache2_attr); - retval = pthread_attr_setdetachstate(&c->cache2_attr,PTHREAD_CREATE_DETACHED); - if(retval) - { - if(mp_conf.verbose) printf("running thread: attr_setdetachstate fault!!!\n"); - return retval; - } - pthread_attr_setscope(&c->cache2_attr,PTHREAD_SCOPE_SYSTEM); - c->cache2_end_of_work=0; - retval = pthread_create(&c->cache2_thread_id,&c->cache2_attr,cache2_routine,c); - if(retval) return 0; - + unsigned rc; + if((rc=xmp_register_thread(sig_cache2,cache2_routine,"cache2"))==UINT_MAX) return 0; + c->pth=&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); @@ -343,15 +323,11 @@ { cache_vars_t* c; c=st->cache_data; - if(c) - { - if(c->cache2_thread_id && c->cache2_is_living) - { - c->cache2_end_of_work=1; - while(c->cache2_is_living && !was_killed) usleep(0); - c->cache2_is_living=0; + if(c) { + if(c->pth && c->pth->state==Pth_Run) { + c->pth->state=Pth_Canceling; + while(c->pth->state==Pth_Canceling && !was_killed) usleep(0); } - pthread_attr_destroy(&c->cache2_attr); free(c->packets); free(c->mem); free(c); Modified: mplayerxp/libvo/sub.c =================================================================== --- mplayerxp/libvo/sub.c 2012-10-26 13:01:26 UTC (rev 222) +++ mplayerxp/libvo/sub.c 2012-10-27 07:38:46 UTC (rev 223) @@ -7,16 +7,17 @@ #include <malloc.h> #endif -#include "../mplayer.h" +#include "mplayer.h" +#include "xmp_core.h" #include "video_out.h" #include "font_load.h" #include "sub.h" #include "osd.h" #include "libmpsub/spudec.h" #include "libmpsub/vobsub.h" -#include "../libmpdemux/stream.h" +#include "libmpdemux/stream.h" #define MSGT_CLASS MSGT_OSD -#include "../__mp_msg.h" +#include "__mp_msg.h" static const char * __sub_osd_names[]={ "Seekbar", @@ -534,7 +535,7 @@ // obj->flags&=~OSDFLAG_OLD_BBOX; if(obj->cleared_frames>=0) { obj->cleared_frames++; - if(obj->cleared_frames>=xp_num_frames) + if(obj->cleared_frames>=xp_core.num_v_buffs) obj->cleared_frames=-1; // All cleared stop } } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-26 13:01:26 UTC (rev 222) +++ mplayerxp/mplayer.c 2012-10-27 07:38:46 UTC (rev 223) @@ -94,7 +94,6 @@ #include "xmp_core.h" volatile unsigned xp_drop_frame_cnt=0; -unsigned xp_num_frames=0; float xp_screen_pts; float playbackspeed_factor=1.0; int mpxp_seek_time=-1; @@ -108,9 +107,6 @@ subtitle* mp_subtitles=NULL; #endif -int xp_id=0; -pthread_t mplayer_pth_id; - int use_pts_fix2=-1; /************************************************************************ @@ -525,7 +521,7 @@ MSG_DBG2("decoded audio %d diff %d\n", l, l - len); if( ret <= 0 && d_audio->eof) { - MSG_V("xp_audio_eof\n"); + MSG_V("audio eof\n"); audio_buffer.eof=1; pthread_mutex_unlock( &audio_buffer.head_mutex ); pthread_mutex_lock( &audio_buffer.tail_mutex ); @@ -617,79 +613,79 @@ fflush(stderr); mask=inited_flags&mask; - MP_UNIT(xp_id,"uninit_xp"); - uninit_dec_ahead(0); + MP_UNIT("uninit_xp"); + xmp_uninit_engine(0); if (mask&INITED_SPUDEC){ inited_flags&=~INITED_SPUDEC; - MP_UNIT(xp_id,"uninit_spudec"); + MP_UNIT("uninit_spudec"); spudec_free(vo_data->spudec); vo_data->spudec=NULL; } if (mask&INITED_VOBSUB){ inited_flags&=~INITED_VOBSUB; - MP_UNIT(xp_id,"uninit_vobsub"); + MP_UNIT("uninit_vobsub"); vobsub_close(vo_data->vobsub); vo_data->vobsub=NULL; } if(mask&INITED_VCODEC){ inited_flags&=~INITED_VCODEC; - MP_UNIT(xp_id,"uninit_vcodec"); + MP_UNIT("uninit_vcodec"); mpcv_uninit(sh_video); sh_video=NULL; } if(mask&INITED_VO){ inited_flags&=~INITED_VO; - MP_UNIT(xp_id,"uninit_vo"); + MP_UNIT("uninit_vo"); vo_uninit(vo_data); } if(mask&INITED_ACODEC){ inited_flags&=~INITED_ACODEC; - MP_UNIT(xp_id,"uninit_acodec"); + MP_UNIT("uninit_acodec"); mpca_uninit(sh_audio); sh_audio=NULL; } if(mask&INITED_AO){ inited_flags&=~INITED_AO; - MP_UNIT(xp_id,"uninit_ao"); + MP_UNIT("uninit_ao"); ao_uninit(ao_data); } if(mask&INITED_GETCH2){ inited_flags&=~INITED_GETCH2; - MP_UNIT(xp_id,"uninit_getch2"); + MP_UNIT("uninit_getch2"); // restore terminal: getch2_disable(); } if(mask&INITED_DEMUXER){ inited_flags&=~INITED_DEMUXER; - MP_UNIT(xp_id,"free_demuxer"); + MP_UNIT("free_demuxer"); FREE_DEMUXER(demuxer); } if(mask&INITED_STREAM){ inited_flags&=~INITED_STREAM; - MP_UNIT(xp_id,"uninit_stream"); + MP_UNIT("uninit_stream"); if(stream) free_stream(stream); stream=NULL; } if(mask&INITED_INPUT){ inited_flags&=~INITED_INPUT; - MP_UNIT(xp_id,"uninit_input"); + MP_UNIT("uninit_input"); mp_input_uninit(); } #ifdef USE_SUB if(mask&INITED_SUBTITLE){ inited_flags&=~INITED_SUBTITLE; - MP_UNIT(xp_id,"sub_free"); + MP_UNIT("sub_free"); mp_input_uninit(); sub_free( mp_subtitles ); sub_name=NULL; @@ -697,7 +693,7 @@ mp_subtitles=NULL; } #endif - MP_UNIT(xp_id,NULL); + MP_UNIT(NULL); } void exit_player(char* how){ @@ -706,7 +702,7 @@ fflush(stderr); uninit_player(INITED_ALL); - MP_UNIT(xp_id,"exit_player"); + MP_UNIT("exit_player"); sws_uninit(); if(how) MSG_HINT(MSGTR_Exiting,how); @@ -732,7 +728,7 @@ } uninit_player((INITED_ALL)&(~(INITED_STREAM|INITED_DEMUXER))); - MP_UNIT(xp_id,"exit_player"); + MP_UNIT("exit_player"); MSG_HINT(MSGTR_Exiting,MSGTR_Exit_quit); MSG_DBG2("max framesize was %d bytes\n",max_framesize); if(mconfig) m_config_free(mconfig); @@ -740,17 +736,6 @@ exit(0); } -void killall_threads(pthread_t pth_id) -{ - unsigned i; - for(i=0;i < MAX_XPTHREADS;i++) { - if(pth_id && pinfo[i].pth_id && pinfo[i].pth_id != mplayer_pth_id) { - pthread_kill(pinfo[i].pth_id,SIGKILL); - if(pinfo[i].unlink) pinfo[i].unlink(pth_id); - } - } -} - void __exit_sighandler(void) { static int sig_count=0; @@ -768,7 +753,7 @@ void exit_sighandler(void) { - killall_threads(pthread_self()); + xmp_killall_threads(pthread_self()); __exit_sighandler(); } @@ -1000,7 +985,7 @@ //if(playsize>outburst) playsize=outburst; // Update buffer if needed - MP_UNIT(xp_id,"mpca_decode"); // Enter AUDIO decoder module + MP_UNIT("mpca_decode"); // Enter AUDIO decoder module t=GetTimer(); while(sh_audio->a_buffer_len<playsize && !audio_eof){ if(mp_conf.xp>=XP_VideoAudio) { @@ -1021,14 +1006,14 @@ { MSG_V("audio_stream_eof\n"); inited_flags&=~INITED_AO; - MP_UNIT(xp_id,"uninit_ao"); + MP_UNIT("uninit_ao"); ao_uninit(ao_data); } audio_eof=1; break; } } - MP_UNIT(xp_id,"play_audio"); // Leave AUDIO decoder module + MP_UNIT("play_audio"); // Leave AUDIO decoder module t=GetTimer()-t; tt = t*0.000001f; time_usage.audio+=tt; @@ -1139,7 +1124,7 @@ fflush(stdout); } -static void show_status_line(float v_pts,float AV_delay) { +static void show_status_line(float v_pts) { float a_pts=0; float delay=ao_get_delay(ao_data); float video_pts = v_pts; @@ -1157,6 +1142,7 @@ a_pts+=(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; } if( !mp_conf.av_sync_pts && mp_conf.xp>=XP_VideoAudio ) delay += get_delay_audio_buffer(); + float AV_delay; AV_delay = a_pts-delay-video_pts; __show_status_line(a_pts,video_pts,delay,AV_delay); } @@ -1187,6 +1173,85 @@ fflush(stdout); } +static void vplayer_check_chapter_change(frame_attr_t* shva_prev,float v_pts) +{ + if(use_pts_fix2 && sh_audio) { + if(sh_video->chapter_change == -1) { /* First frame after seek */ + while(v_pts < 1.0 && sh_audio->timer==0.0 && ao_get_delay(ao_data)==0.0) + usleep(0); /* Wait for audio to start play */ + if(sh_audio->timer > 2.0 && v_pts < 1.0) { + MSG_V("Video chapter change detected\n"); + sh_video->chapter_change=1; + } else { + sh_video->chapter_change=0; + } + } else if(v_pts < 1.0 && shva_prev->v_pts > 2.0) { + MSG_V("Video chapter change detected\n"); + sh_video->chapter_change=1; + } + if(sh_video->chapter_change && sh_audio->chapter_change) { + MSG_V("Reset chapter change\n"); + sh_video->chapter_change=0; + sh_audio->chapter_change=0; + } + } +} + +static float vplayer_compute_sleep_time(frame_attr_t* shva_prev) +{ + float sleep_time=0; + if(sh_audio) { + /* FIXME!!! need the same technique to detect audio_eof as for video_eof! + often ao_get_delay() never returns 0 :( */ + if(audio_eof && !get_delay_audio_buffer()) goto nosound_model; + if((!audio_eof || ao_get_delay(ao_data)) && + (!use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) + sleep_time=xp_screen_pts-(sh_audio->timer-ao_get_delay(ao_data)); + else if(use_pts_fix2 && sh_audio->chapter_change) + sleep_time=0; + else + goto nosound_model; + } else { + nosound_model: + sleep_time=shva_prev->duration; + } + return sleep_time; +} + +static int vplayer_do_sleep(int rtc_fd,float sleep_time,float v_pts) +{ +#define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ +#define XP_MIN_AUDIOBUFF 0.05 +#define XP_MAX_TIMESLICE 0.1 + if(sh_audio && (!audio_eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { + float t; + if(mp_conf.benchmark) show_status_line(v_pts); + + if( mp_conf.xp < XP_VAPlay ) { + t=ao_get_delay(ao_data)-XP_MIN_AUDIOBUFF; + if(t>XP_MAX_TIMESLICE) + t=XP_MAX_TIMESLICE; + } else + t = XP_MAX_TIMESLICE; + + usleep(t*1000000); + sleep_time-=GetRelativeTime(); + if(mp_conf.xp >= XP_VAPlay || t<XP_MAX_TIMESLICE || sleep_time>XP_MAX_TIMESLICE) { + // exit due no sound in soundcard + return 0; + } + } + + while(sleep_time>XP_MIN_TIMESLICE) { + /* free cpu for threads */ + usleep(1); + sleep_time-=GetRelativeTime(); + } + MP_UNIT("sleep_usleep"); + sleep_time=SleepTime(rtc_fd,mp_conf.softsleep,sleep_time); + return 1; +} + typedef struct osd_args_s { int visible; int info_factor; @@ -1195,47 +1260,26 @@ static float max_pts_correction=0; int mpxp_play_video( int rtc_fd, float *v_pts ) { - float time_frame=0; + float sleep_time=0; float AV_delay=0; /* average of A-V timestamp differences */ - int blit_frame=0; + int can_blit=0; int delay_corrected=1; int final_frame=0; frame_attr_t shva_prev,shva; shva_prev=dae_played_fra(xp_core.video); final_frame = shva_prev.eof; - if(xp_eof && final_frame) return 1; + if(xp_core.eof && final_frame) return 1; - blit_frame=dae_inc_played(xp_core.video); /* <-- SWITCH TO NEXT FRAME */ - + can_blit=dae_try_inc_played(xp_core.video); /* <-- TRY SWITCH TO NEXT FRAME */ shva=dae_played_fra(xp_core.video); - *v_pts = shva.v_pts; /*------------------------ frame decoded. --------------------*/ /* blit frame */ - if(xp_eof) blit_frame=1; /* force blitting until end of stream will be reached */ - if(use_pts_fix2 && sh_audio) { - if(sh_video->chapter_change == -1) { /* First frame after seek */ - while(*v_pts < 1.0 && sh_audio->timer==0.0 && ao_get_delay(ao_data)==0.0) - usleep(0); /* Wait for audio to start play */ - if(sh_audio->timer > 2.0 && *v_pts < 1.0) { - MSG_V("Video chapter change detected\n"); - sh_video->chapter_change=1; - } else { - sh_video->chapter_change=0; - } - } else if(*v_pts < 1.0 && shva_prev.v_pts > 2.0) { - MSG_V("Video chapter change detected\n"); - sh_video->chapter_change=1; - } - if(sh_video->chapter_change && sh_audio->chapter_change) { - MSG_V("Reset chapter change\n"); - sh_video->chapter_change=0; - sh_audio->chapter_change=0; - } - } + if(xp_core.eof) can_blit=1; /* force blitting until end of stream will be reached */ + vplayer_check_chapter_change(&shva_prev,*v_pts); #if 0 MSG_INFO("initial_audio_pts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" ,initial_audio_pts @@ -1246,69 +1290,28 @@ ,shva[dec_ahead_active_frame].stream_pts ,shva[dec_ahead_active_frame].duration); #endif - if(blit_frame) { + if(can_blit) { xp_screen_pts=*v_pts-(mp_conf.av_sync_pts?0:initial_audio_pts); #ifdef USE_OSD /*--------- add OSD to the next frame contents ---------*/ MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); - MP_UNIT(xp_id,"draw_osd"); + MP_UNIT("draw_osd"); update_osd(shva.stream_pts); - vo_draw_osd(vo_data,dae_curr_vplayed()); + vo_draw_osd(vo_data,dae_next_played(xp_core.video)); #endif } /* It's time to sleep ;)...*/ - MP_UNIT(xp_id,"sleep"); + MP_UNIT("sleep"); GetRelativeTime(); /* reset timer */ - if(sh_audio) { - /* FIXME!!! need the same technique to detect audio_eof as for video_eof! - often ao_get_delay() never returns 0 :( */ - if(audio_eof && !get_delay_audio_buffer()) goto nosound_model; - if((!audio_eof || ao_get_delay(ao_data)) && - (!use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) - time_frame=xp_screen_pts-(sh_audio->timer-ao_get_delay(ao_data)); - else if(use_pts_fix2 && sh_audio->chapter_change) - time_frame=0; - else - goto nosound_model; - } else { - nosound_model: - time_frame=shva_prev.duration; - } - if(mp_conf.benchmark && time_frame < 0 && time_frame < max_av_resync) max_av_resync=time_frame; + sleep_time=vplayer_compute_sleep_time(&shva_prev); + + if(mp_conf.benchmark && sleep_time < 0 && sleep_time < max_av_resync) max_av_resync=sleep_time; if(!(vo_data->flags&256)){ /* flag 256 means: libvo driver does its timing (dvb card) */ -#define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ -#define XP_MIN_AUDIOBUFF 0.05 -#define XP_MAX_TIMESLICE 0.1 - - if(sh_audio && (!audio_eof || ao_get_delay(ao_data)) && time_frame>XP_MAX_TIMESLICE) { - float t; - if(mp_conf.benchmark) show_status_line(*v_pts,AV_delay); - - if( mp_conf.xp < XP_VAPlay ) { - t=ao_get_delay(ao_data)-XP_MIN_AUDIOBUFF; - if(t>XP_MAX_TIMESLICE) - t=XP_MAX_TIMESLICE; - } else - t = XP_MAX_TIMESLICE; - - usleep(t*1000000); - time_frame-=GetRelativeTime(); - if(mp_conf.xp >= XP_VAPlay || t<XP_MAX_TIMESLICE || time_frame>XP_MAX_TIMESLICE) { - return 0; - } - } - - while(time_frame>XP_MIN_TIMESLICE) { - /* free cpu for threads */ - usleep(1); - time_frame-=GetRelativeTime(); - } - MP_UNIT(xp_id,"sleep_usleep"); - time_frame=SleepTime(rtc_fd,mp_conf.softsleep,time_frame); + if(!vplayer_do_sleep(rtc_fd,sleep_time,*v_pts)) return 0; } - MP_UNIT(xp_id,"change_frame2"); + MP_UNIT("change_frame2"); /* don't flip if there is nothing new to display */ - if(!blit_frame) { + if(!can_blit) { static int drop_message=0; if(!drop_message && xp_core.video->num_slow_frames > 50) { drop_message=1; @@ -1324,8 +1327,9 @@ unsigned int t2=GetTimer(); double tt; unsigned player_idx; - player_idx=dae_curr_vplayed(); + player_idx=dae_next_played(xp_core.video); vo_select_frame(vo_data,player_idx); + dae_inc_played(xp_core.video); MSG_D("\ndec_ahead_main: schedule %u on screen\n",player_idx); t2=GetTimer()-t2; tt = t2*0.000001f; @@ -1337,7 +1341,7 @@ bench_dropped_frames ++; } } - MP_UNIT(xp_id,NULL); + MP_UNIT(NULL); /*================ A-V TIMESTAMP CORRECTION: =========================*/ /* FIXME: this block was added to fix A-V resync caused by some strange things @@ -1367,7 +1371,7 @@ MSG_DBG2("### A:%8.3f (%8.3f) V:%8.3f A-V:%7.4f \n",a_pts,a_pts-delay,*v_pts,(a_pts-delay)-*v_pts); - if(delay_corrected && blit_frame){ + if(delay_corrected && can_blit){ float x; AV_delay=(a_pts-delay)-*v_pts; x=AV_delay*0.1f; @@ -1392,7 +1396,6 @@ void mpxp_seek( int _xp_id, osd_args_t *osd,float v_pts,const seek_args_t* seek) { int seek_rval=1; - xp_core.in_lseek=Seek; audio_eof=0; if(seek->secs || seek->flags&DEMUX_SEEK_SET) { seek_rval=demux_seek_r(demuxer,seek); @@ -1421,20 +1424,20 @@ fflush(stdout); if(sh_video){ - MP_UNIT(xp_id,"seek_video_reset"); + MP_UNIT("seek_video_reset"); mpcv_resync_stream(sh_video); vo_reset(vo_data); sh_video->chapter_change=-1; } if(sh_audio){ - MP_UNIT(xp_id,"seek_audio_reset"); + MP_UNIT("seek_audio_reset"); mpca_resync_stream(sh_audio); ao_reset(ao_data); // stop audio, throwing away buffered data } if (vo_data->vobsub) { - MP_UNIT(xp_id,"seek_vobsub_reset"); + MP_UNIT("seek_vobsub_reset"); vobsub_seek_r(vo_data->vobsub, seek); } @@ -1468,8 +1471,7 @@ { unsigned i; seek_args_t seek = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; - for(i=0;i<xp_threads;i++) if(strcmp(pinfo[i].thread_name,"main")==0) break; - if(sh_video) mpxp_seek(i,NULL,dae_played_fra(xp_core.video).v_pts,&seek); + if(sh_video) mpxp_seek(main_id,NULL,dae_played_fra(xp_core.video).v_pts,&seek); return; } @@ -1552,7 +1554,7 @@ #endif fifo_make_pipe(&keyb_fifo_get,&keyb_fifo_put); /* Init input system */ - MP_UNIT(xp_id,"init_input"); + MP_UNIT("init_input"); mp_input_init(); if(keyb_fifo_get > 0) mp_input_add_key_fd(keyb_fifo_get,1,NULL,NULL); @@ -1590,7 +1592,7 @@ MSG_WARN("Menu init failed\n"); } } - MP_UNIT(xp_id,"init_osd"); + MP_UNIT("init_osd"); vo_init_osd(); } @@ -1608,14 +1610,14 @@ video_driver[i] = '\0'; } } - MP_UNIT(xp_id,"vo_register"); + MP_UNIT("vo_register"); vo_inited = (vo_register(vo_data,video_driver)!=NULL)?1:0; if(!vo_inited){ MSG_FATAL(MSGTR_InvalidVOdriver,video_driver?video_driver:"?"); exit_player(MSGTR_Exit_error); } - MP_UNIT(xp_id,"vo_init"); + MP_UNIT("vo_init"); if((i=vo_init(vo_data,vo_conf.subdevice))!=0) { MSG_FATAL("Error opening/initializing the selected video_out (-vo) device!\n"); @@ -1623,7 +1625,7 @@ } // check audio_out driver name: - MP_UNIT(xp_id,"ao_init"); + MP_UNIT("ao_init"); if (audio_driver) if ((i=strcspn(audio_driver, ":")) > 0) { @@ -1646,7 +1648,7 @@ static int mpxp_init_vobsub(const char *filename) { int forced_subs_only=0; - MP_UNIT(xp_id,"vobsub"); + MP_UNIT("vobsub"); if (vobsub_name){ vo_data->vobsub=vobsub_open(vobsub_name,mp_conf.spudec_ifo,1,&vo_data->spudec); if(vo_data->vobsub==NULL) @@ -1677,7 +1679,7 @@ int eof=0; play_tree_t* entry; // Handle playlist - MP_UNIT(xp_id,"handle_playlist"); + MP_UNIT("handle_playlist"); MSG_V("Parsing playlist %s...\n",filename); entry = parse_playtree(stream); if(!entry) { @@ -1711,7 +1713,7 @@ /* Add NLS support here */ char *lang; if(!mp_conf.audio_lang) mp_conf.audio_lang=nls_get_screen_cp(); - MP_UNIT(xp_id,"dvd lang->id"); + MP_UNIT("dvd lang->id"); if(mp_conf.audio_lang) { lang=malloc(max(strlen(mp_conf.audio_lang)+1,4)); strcpy(lang,mp_conf.audio_lang); @@ -1757,7 +1759,7 @@ } static void mpxp_read_video_properties(void) { - MP_UNIT(xp_id,"video_read_properties"); + MP_UNIT("video_read_properties"); if(!video_read_properties(sh_video)) { MSG_ERR("Video: can't read properties\n"); sh_video=d_video->sh=NULL; @@ -1781,20 +1783,20 @@ static void mpxp_read_subtitles(const char *filename,int forced_subs_only,int stream_dump_type) { if (mp_conf.spudec_ifo) { unsigned int palette[16], width, height; - MP_UNIT(xp_id,"spudec_init_vobsub"); + MP_UNIT("spudec_init_vobsub"); if (vobsub_parse_ifo(NULL,mp_conf.spudec_ifo, palette, &width, &height, 1, -1, NULL) >= 0) vo_data->spudec=spudec_new_scaled(palette, sh_video->src_w, sh_video->src_h); } if (vo_data->spudec==NULL) { unsigned *pal; - MP_UNIT(xp_id,"spudec_init"); + MP_UNIT("spudec_init"); if(stream->driver->control(stream,SCTRL_VID_GET_PALETTE,&pal)==SCTRL_OK) vo_data->spudec=spudec_new_scaled(pal,sh_video->src_w, sh_video->src_h); } if (vo_data->spudec==NULL) { - MP_UNIT(xp_id,"spudec_init_normal"); + MP_UNIT("spudec_init_normal"); vo_data->spudec=spudec_new_scaled(NULL, sh_video->src_w, sh_video->src_h); spudec_set_font_factor(vo_data->spudec,font_factor); } @@ -1809,7 +1811,7 @@ // after reading video params we should load subtitles because // we know fps so now we can adjust subtitles time to ~6 seconds AST // check .sub - MP_UNIT(xp_id,"read_subtitles_file"); + MP_UNIT("read_subtitles_file"); if(sub_name){ mp_subtitles=sub_read_file(sub_name, sh_video->fps); if(!mp_subtitles) MSG_ERR(MSGTR_CantLoadSub,sub_name); @@ -1869,7 +1871,7 @@ static int mpxp_find_vcodec(void) { int rc=0; - MP_UNIT(xp_id,"init_video_codec"); + MP_UNIT("init_video_codec"); /* Go through the codec.conf and find the best codec...*/ sh_video->inited=0; vo_data->flags=0; @@ -1913,7 +1915,7 @@ static int mpxp_configure_audio(void) { int rc=0; const ao_info_t *info=ao_get_info(); - MP_UNIT(xp_id,"setup_audio"); + MP_UNIT("setup_audio"); MSG_V("AO: [%s] %iHz %s %s\n", info->short_name, force_srate?force_srate:sh_audio->samplerate, @@ -1931,7 +1933,7 @@ if(strlen(info->comment) > 0) MSG_V("AO: Comment: %s\n", info->comment); - MP_UNIT(xp_id,"af_preinit"); + MP_UNIT("af_preinit"); ao_data->samplerate=force_srate?force_srate:sh_audio->samplerate; ao_data->channels=audio_output_channels?audio_output_channels:sh_audio->channels; ao_data->format=sh_audio->sample_format; @@ -1957,7 +1959,7 @@ if(sh_video == NULL) rc=-1; } else { inited_flags|=INITED_AO; - MP_UNIT(xp_id,"af_init"); + MP_UNIT("af_init"); if(!mpca_init_filters(sh_audio, (int)(sh_audio->samplerate), sh_audio->channels, sh_audio->sample_format, sh_audio->samplesize, @@ -1971,17 +1973,17 @@ } static void mpxp_run_ahead_engine(void) { - MP_UNIT(xp_id,"init_xp"); - if(sh_video && xp_num_frames < 5) {/* we need at least 5 buffers to suppress screen judering */ - MSG_FATAL("Not enough buffers for DECODING AHEAD!\nNeed %u buffers but exist only %u\n",5,xp_num_frames); + 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); exit_player("Try other '-vo' driver.\n"); } - if(init_dec_ahead(sh_video,sh_audio)!=0) + if(xmp_init_engine(sh_video,sh_audio)!=0) exit_player("Can't initialize decoding ahead!\n"); - if(run_dec_ahead()!=0) + if(xmp_run_decoders()!=0) exit_player("Can't run decoding ahead!\n"); - if(sh_video) MSG_OK("Using DECODING AHEAD mplayer's core with %u video buffers\n",xp_num_frames); - else MSG_OK("Using DECODING AHEAD mplayer's core with %u audio buffers\n",ao_da_buffs); + if(sh_video) MSG_OK("Using DECODING AHEAD mplayer's core with %u video buffers\n",xp_core.num_v_buffs); + else MSG_OK("Using DECODING AHEAD mplayer's core with %u audio buffers\n",xp_core.num_a_buffs); /* reset counters */ xp_drop_frame_cnt=0; } @@ -2340,13 +2342,11 @@ seek_args_t seek_args = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; mpxp_init_structs(); - vo_data=vo_preinit_structs(); + init_signal_handling(); - pinfo[xp_id].pid=getpid(); - mplayer_pth_id= - pinfo[xp_id].pth_id=pthread_self(); - pinfo[xp_id].thread_name = "main"; + xmp_init(); + xmp_register_main(exit_sighandler); mp_msg_init(MSGL_STATUS); MSG_INFO("%s",banner_text); @@ -2391,7 +2391,7 @@ } } - ao_da_buffs = vo_conf.da_buffs; + xp_core.num_a_buffs = vo_conf.da_buffs; init_player(); @@ -2414,9 +2414,8 @@ // ========== Init keyboard FIFO (connection to libvo) ============ mpxp_init_keyboard_fifo(); - MP_UNIT(xp_id,NULL); + MP_UNIT(NULL); - xp_id = init_signal_handling(exit_sighandler,NULL); // ******************* Now, let's see the per-file stuff ******************** play_next_file: @@ -2433,7 +2432,7 @@ forced_subs_only=mpxp_init_vobsub(filename); - MP_UNIT(xp_id,"mplayer"); + MP_UNIT("mplayer"); if(!input_state.after_dvdmenu) { stream=NULL; demuxer=NULL; @@ -2452,7 +2451,7 @@ } if(stream_dump_type) mp_conf.s_cache_size=0; - MP_UNIT(xp_id,"open_stream"); + MP_UNIT("open_stream"); if(!input_state.after_dvdmenu) stream=open_stream(filename,&file_format,stream_dump_type>1?dump_stream_event_handler:mpxp_stream_event_handler); if(!stream) { // error... eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY); @@ -2468,11 +2467,11 @@ /* Add NLS support here */ mpxp_init_dvd_nls(); - MP_UNIT(xp_id,NULL); + MP_UNIT(NULL); // CACHE2: initial prefill: 20% later: 5% (should be set by -cacheopts) if(mp_conf.s_cache_size && !stream_dump_type){ - MP_UNIT(xp_id,"enable_cache"); + MP_UNIT("enable_cache"); if(!stream_enable_cache(stream,mp_conf.s_cache_size*1024,mp_conf.s_cache_size*1024/5,mp_conf.s_cache_size*1024/20)) if((eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY))) goto goto_next_file; } @@ -2486,7 +2485,7 @@ if(!has_video) mp_conf.video_id=-2; // do NOT read video packets... if(!has_dvdsub) mp_conf.dvdsub_id=-2;// do NOT read subtitle packets... - MP_UNIT(xp_id,"demux_open"); + MP_UNIT("demux_open"); if(!input_state.after_dvdmenu) demuxer=demux_open(stream,file_format,mp_conf.audio_id,mp_conf.video_id,mp_conf.dvdsub_id); if(!demuxer) goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR @@ -2517,7 +2516,7 @@ if(sh_video) mpxp_read_subtitles(filename,forced_subs_only,stream_dump_type); //================== Init AUDIO (codec) ========================== - MP_UNIT(xp_id,"init_audio_codec"); + MP_UNIT("init_audio_codec"); if(sh_audio) mpxp_find_acodec(); @@ -2553,7 +2552,7 @@ /*================== Init VIDEO (codec & libvo) ==========================*/ if(!sh_video) goto main; - MP_UNIT(xp_id,"init_video_filters"); + MP_UNIT("init_video_filters"); if(sh_video->vfilter_inited<=0) { sh_video->vfilter=vf_init(sh_video); sh_video->vfilter_inited=1; @@ -2563,7 +2562,7 @@ goto main; } - xp_num_frames=vo_get_num_frames(vo_data); /* that really known after init_vcodecs */ + xp_core.num_v_buffs=vo_get_num_frames(vo_data); /* that really known after init_vcodecs */ if(mp_conf.autoq>0){ /* Auto quality option enabled*/ @@ -2579,7 +2578,7 @@ inited_flags|=INITED_VO; MSG_V("INFO: Video OUT driver init OK!\n"); - MP_UNIT(xp_id,"init_libvo"); + MP_UNIT("init_libvo"); fflush(stdout); //================== MAIN: ========================== @@ -2591,7 +2590,7 @@ if(sh_audio) if((mpxp_configure_audio())!=0) goto goto_next_file; - MP_UNIT(xp_id,"av_init"); + MP_UNIT("av_init"); if(mp_conf.av_force_pts_fix2==1 || (mp_conf.av_force_pts_fix2==-1 && mp_conf.av_sync_pts && @@ -2660,11 +2659,16 @@ if(sh_video) { do { usleep(0); - }while(dae_get_decoder_outrun(xp_core.video) < xp_num_frames/2 && !xp_eof); + }while(dae_get_decoder_outrun(xp_core.video) < xp_core.num_v_buffs/2 && !xp_core.eof); } - if(run_xp_aplayers()!=0) exit_player("Can't run xp players!\n"); - MSG_OK("Using the next %i threads:\n",xp_threads); - for(i=0;i<xp_threads;i++) MSG_OK("[%i] %s (id=%u, pth_id=%lu)\n",i,pinfo[i].thread_name,pinfo[i].pid,pinfo[i].pth_id); + if(xmp_run_players()!=0) exit_player("Can't run xp players!\n"); + MSG_OK("Using the next %i threads:\n",xp_core.num_threads); + for(i=0;i<xp_core.num_threads;i++) + MSG_OK("[%i] %s (id=%u, pth_id=%lu)\n" + ,i + ,xp_core.mpxp_threads[i]->name + ,xp_core.mpxp_threads[i]->pid + ,xp_core.mpxp_threads[i]->pth_id); //==================== START PLAYING ======================= MSG_OK(MSGTR_StartPlaying);fflush(stdout); @@ -2680,9 +2684,9 @@ } if( mp_conf.xp < XP_VAPlay ) - eof |= decore_audio(xp_id); + eof |= decore_audio(main_id); /*========================== UPDATE TIMERS ============================*/ - MP_UNIT(xp_id,"Update timers"); + MP_UNIT("Update timers"); if(!sh_video) { if(mp_conf.benchmark && mp_conf.verbose) show_benchmark_status(); else mpxp_print_audio_status(); @@ -2743,9 +2747,9 @@ } if(seek_args.secs || (seek_args.flags&DEMUX_SEEK_SET)) { - MP_UNIT(xp_id,"seek"); + MP_UNIT("seek"); - dec_ahead_halt_threads(0); + xmp_halt_threads(0); if(seek_args.secs && sh_video) { frame_attr_t shvap = dae_played_fra(xp_core.video); @@ -2753,15 +2757,15 @@ seek_args.secs -= (xp_is_bad_pts?shvad.v_pts:d_video->pts)-shvap.v_pts; } - mpxp_seek(xp_id,&osd,v_pts,&seek_args); + mpxp_seek(main_id,&osd,v_pts,&seek_args); audio_eof=0; seek_args.secs=0; seek_args.flags=DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS; - dec_ahead_restart_threads(xp_id); + xmp_restart_threads(main_id); /* Disable threads for DVD menus */ - MP_UNIT(xp_id,NULL); + MP_UNIT(NULL); } #ifdef USE_OSD update_osd(d_video->pts); Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-10-26 13:01:26 UTC (rev 222) +++ mplayerxp/mplayer.h 2012-10-27 07:38:46 UTC (rev 223) @@ -47,15 +47,12 @@ }mp_conf_t; extern mp_conf_t mp_conf; -extern unsigned xp_num_frames; -extern int xp_id; extern unsigned mplayer_accel; extern int use_pts_fix2; extern void exit_player(char* how); extern void mpxp_resync_audio_stream(void); extern void mpxp_reset_vcache(void); -extern void killall_threads(pthread_t pth_id); extern void __exit_sighandler(void); extern void mplayer_put_key(int code); Modified: mplayerxp/sig_hand.c =================================================================== --- mplayerxp/sig_hand.c 2012-10-26 13:01:26 UTC (rev 222) +++ mplayerxp/sig_hand.c 2012-10-27 07:38:46 UTC (rev 223) @@ -8,6 +8,7 @@ #endif #include <string.h> #include <stdio.h> +#include <stdlib.h> #include <signal.h> #include <sys/resource.h> #include "sig_hand.h" @@ -17,9 +18,6 @@ #include "xmp_core.h" #include "mp_msg.h" -pth_info_t pinfo[MAX_XPTHREADS]; -int xp_threads = 0; - #ifdef HAVE_BACKTRACE #include <execinfo.h> /* Obtain a backtrace and print it to stdout. */ @@ -50,32 +48,28 @@ static void my_callback(int signo) { int i; - for(i=0; i < MAX_XPTHREADS && !pthread_equal(pinfo[i].pth_id, pthread_self()); i++); - if(i >= MAX_XPTHREADS || i >= xp_threads || !pthread_equal(pinfo[i].pth_id, pthread_self())) { - i = 0; /* Use 0 as default handler */ - } + pthread_t _self = pthread_self(); + for(i=0; i < xp_core.num_threads && !pthread_equal(xp_core.mpxp_threads[i]->pth_id, _self); i++); + if(i >= xp_core.num_threads || + !pthread_equal(xp_core.mpxp_threads[i]->pth_id, _self)) i = 0; /* Use 0 as default handler */ - mp_msg(MSGT_CPLAYER,MSGL_FATAL,__FILE__,__LINE__,"catching signal: %s in thread: %s (%i) in module: %s\n",strsignal(signo),pinfo[i].thread_name,i,pinfo[i].current_module); + mp_msg(MSGT_CPLAYER,MSGL_FATAL,__FILE__,__LINE__,"catching signal: %s in thread: %s (%i) in module: %s\n" + ,strsignal(signo) + ,xp_core.mpxp_threads[i]->name + ,i + ,xp_core.mpxp_threads[i]->unit); #ifdef HAVE_BACKTRACE - dump_trace(); + dump_trace(); #endif - pinfo[i].sig_handler(); + xp_core.mpxp_threads[i]->sigfunc(); - signal(signo,SIG_DFL); - /* try coredump*/ - return; + signal(signo,SIG_DFL); /* try coredump*/ + + return; } -int init_signal_handling( void (*callback)( void ),void (*_unlink)(int)) +void init_signal_handling( void ) { - if(xp_threads >= MAX_XPTHREADS) - return MAX_XPTHREADS-1; - pinfo[xp_threads].sig_handler = callback; - pinfo[xp_threads].pid = getpid(); - pinfo[xp_threads].pth_id = pthread_self(); - pinfo[xp_threads].current_module = NULL; - pinfo[xp_threads].unlink = _unlink; - xp_threads++; #ifndef MP_DEBUG /*========= Catch terminate signals: ================*/ /* terminate requests:*/ @@ -102,18 +96,4 @@ setrlimit(RLIMIT_CORE,&rl); } #endif - return xp_threads-1; } - -void uninit_signal_handling(int xp_id) -{ - pinfo[xp_id].pid = 0; - pinfo[xp_id].pth_id = 0; - pinfo[xp_id].current_module = NULL; - pinfo[xp_id].sig_handler = NULL; - - if(xp_threads == xp_id+1) { - while( xp_threads > 0 && pinfo[xp_threads-1].pid == 0 ) - xp_threads--; - } -} Modified: mplayerxp/sig_hand.h =================================================================== --- mplayerxp/sig_hand.h 2012-10-26 13:01:26 UTC (rev 222) +++ mplayerxp/sig_hand.h 2012-10-27 07:38:46 UTC (rev 223) @@ -5,28 +5,14 @@ #define __SIG_HAND_H 1 #include <sys/types.h> +#include "xmp_core.h" -#define MAX_XPTHREADS 16 +#define __MP_UNIT(id,name) (xp_core.mpxp_threads[id]->unit=name) +#define MP_UNIT(name) (xp_core.mpxp_threads[main_id]->unit=name) -typedef void (*mysighandler)(void); +extern void init_signal_handling( void ); +extern void uninit_signal_handling( int xp_id ); -typedef struct pth_info -{ - mysighandler sig_handler; - pid_t pid; - const char *thread_name; - const char *current_module; - void (*unlink)(int force); - pthread_t pth_id; -} pth_info_t; - -extern pth_info_t pinfo[MAX_XPTHREADS]; -extern int xp_threads; -#define MP_UNIT(id,name) (pinfo[id].current_module=name) - -int init_signal_handling( void (*callback)( void ),void (*unlink)(int)); -void uninit_signal_handling( int xp_id ); - #endif Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-26 13:01:26 UTC (rev 222) +++ mplayerxp/xmp_core.c 2012-10-27 07:38:46 UTC (rev 223) @@ -36,13 +36,45 @@ xp_core_t xp_core; -void xp_core_init(void) { +void xmp_init(void) { memset(&xp_core,0,sizeof(xp_core_t)); - xp_core.in_lseek=NoSeek; } -void xp_core_uninit(void) {} +void xmp_uninit(void) {} +unsigned xmp_register_main(sig_handler_t sigfunc) { + unsigned idx=0; + xp_core.mpxp_threads[idx]=malloc(sizeof(mpxp_thread_t)); + memset(xp_core.mpxp_threads[idx],0,sizeof(mpxp_thread_t)); + xp_core.mpxp_threads[idx]->p_idx=idx; + xp_core.mpxp_threads[idx]->pid=getpid(); + xp_core.main_pth_id=xp_core.mpxp_threads[idx]->pth_id=pthread_self(); + xp_core.mpxp_threads[idx]->name = "main"; + xp_core.mpxp_threads[idx]->sigfunc = sigfunc; + xp_core.num_threads++; + + return idx; +} + +static void print_stopped_thread(unsigned idx) { + MSG_OK("*** stop thread: [%i] %s\n",idx,xp_core.mpxp_threads[idx]->name); +} + +void xmp_killall_threads(pthread_t _self) +{ + unsigned i; + for(i=0;i < MAX_MPXP_THREADS;i++) { + if( _self && + xp_core.mpxp_threads[i]->pth_id && + xp_core.mpxp_threads[i]->pth_id != xp_core.main_pth_id) { + pthread_kill(xp_core.mpxp_threads[i]->pth_id,SIGKILL); + print_stopped_thread(i); + free(xp_core.mpxp_threads[i]); + xp_core.mpxp_threads[i]=NULL; + } + } +} + void dae_reset(dec_ahead_engine_t* it) { it->player_idx=0; it->decoder_idx=0; @@ -61,7 +93,7 @@ void dae_uninit(dec_ahead_engine_t* it) { free(it->fra); it->fra=0; } /* returns 1 - on success 0 - if busy */ -int dae_inc_played(dec_ahead_engine_t* it) { +int dae_try_inc_played(dec_ahead_engine_t* it) { unsigned new_idx; new_idx=(it->player_idx+1)%it->nframes; if(new_idx==it->decoder_idx) { @@ -73,6 +105,15 @@ it->num_played_frames++; return 1; } + +int dae_inc_played(dec_ahead_engine_t* it) { + unsigned new_idx; + new_idx=(it->player_idx+1)%it->nframes; + if(new_idx==it->decoder_idx) return 0; + it->player_idx=new_idx; + return 1; +} + /* returns 1 - on success 0 - if busy */ int dae_inc_decoded(dec_ahead_engine_t* it) { unsigned new_idx; @@ -113,15 +154,10 @@ extern volatile unsigned xp_drop_frame_cnt; extern int output_quality; -int ao_da_buffs; - extern volatile float xp_screen_pts; volatile int dec_ahead_can_aseek=0; /* It is safe to seek audio */ volatile int dec_ahead_can_adseek=1; /* It is safe to seek audio buffer thread */ -static pthread_t pthread_id=0; -static pthread_attr_t our_attr; -static pthread_attr_t audio_attr; static sh_video_t *sh_video; static sh_audio_t *sh_audio; extern demux_stream_t *d_video; @@ -136,9 +172,6 @@ extern int mpxp_seek_time; extern void update_osd( float v_pts ); -volatile int xp_eof=0; -int xp_audio_eof=0; -#define NORM_FRAME(a) ((a)%xp_num_frames) /* To let audio decoder thread sleep as long as player */ struct timespec audio_play_timeout; @@ -155,13 +188,6 @@ any_t* audio_play_routine( any_t* arg ); -static volatile int pthread_is_living=0; -static volatile int a_pthread_is_living=0; -static volatile int pthread_audio_is_living=0; -static volatile int pthread_end_of_work=0; -static volatile int a_pthread_end_of_work=0; -static volatile int pthread_audio_end_of_work=0; - int xp_is_bad_pts=0; /* this routine decodes video+audio but intends to be video only */ @@ -176,7 +202,7 @@ "*********************************************\n" "Try increase number of buffer for decoding ahead\n" "Exist: %u, need: %u\n" - ,xp_num_frames,(unsigned)(max_frame_delay*3*sh_video->fps)+3); + ,xp_core.num_v_buffs,(unsigned)(max_frame_delay*3*sh_video->fps)+3); prev_warn_delay=max_frame_delay; } } @@ -190,7 +216,7 @@ /* TODO: Replace the constants with some values which are depended on - xp_num_frames and max_frame_delay to find out the smoothest way + xp_core.num_v_buffs and max_frame_delay to find out the smoothest way to display frames on slow machines. MAYBE!!!: (won't work with some realmedia streams for example) Try to borrow avifile's logic (btw, GPL'ed ;) for very slow systems: @@ -200,7 +226,7 @@ */ delta=v_pts-xp_screen_pts; if(max_frame_delay*3 > drop_barrier) { - if(drop_barrier < (float)(xp_num_frames-2)/sh_video->fps) drop_barrier += 1/sh_video->fps; + if(drop_barrier < (float)(xp_core.num_v_buffs-2)/sh_video->fps) drop_barrier += 1/sh_video->fps; else if(mp_conf.verbose) show_warn_cant_sync(max_frame_delay); } @@ -243,7 +269,7 @@ fra[idx2].stream_pts = fra[idx2].v_pts; fra[idx2].duration = fra[idx1].v_pts - fra[idx2].v_pts; - idx3=(idx2-1)%xp_num_frames; + idx3=(idx2-1)%xp_core.num_v_buffs; if(fra[idx2].v_pts > fra[idx3].v_pts && fra[idx2].v_pts - fra[idx3].v_pts < 1.0) fra[idx3].duration = fra[idx2].v_pts - fra[idx3].v_pts; @@ -252,32 +278,30 @@ idx0 = idx1; idx1 = idx2; - idx2=(idx2-1)%xp_num_frames; + idx2=(idx2-1)%xp_core.num_v_buffs; } } any_t* Va_dec_ahead_routine( any_t* arg ) { + mpxp_thread_t* priv=arg; + float duration=0; float drop_barrier; int blit_frame=0; int drop_param=0; unsigned xp_n_frame_to_drop; - int _xp_id; float v_pts,mpeg_timer=HUGE; - pthread_is_living=1; - xp_eof = 0; - xp_audio_eof=0; + priv->state=Pth_Run; + xp_core.eof = 0; + xp_core.a_eof=0; MSG_T("\nDEC_AHEAD: entering...\n"); - _xp_id=init_signal_handling(sig_dec_ahead_video,uninit_dec_ahead); - MP_UNIT(_xp_id,"dec_ahead"); - pinfo[_xp_id].pid = getpid(); /* Only for testing */ - pinfo[_xp_id].pth_id = pthread_self(); - pinfo[_xp_id].thread_name = (xp_core.has_audio && mp_conf.xp < XP_VAFull) ? - "video+audio decoding+filtering ahead" : - "video decoding+vf ahead"; - drop_barrier=(float)(xp_num_frames/2)*(1/sh_video->fps); + __MP_UNIT(priv->p_idx,"dec_ahead"); + priv->pid = getpid(); + if(!(xp_core.has_audio && mp_conf.xp < XP_VAFull)) + priv->name = "video decoder+vf"; + drop_barrier=(float)(xp_core.num_v_buffs/2)*(1/sh_video->fps); if(mp_conf.av_sync_pts == -1 && !use_pts_fix2) xp_is_bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG4_ES || @@ -286,48 +310,38 @@ d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS; else xp_is_bad_pts = mp_conf.av_sync_pts?0:1; -while(!xp_eof){ +while(!xp_core.eof){ unsigned char* start=NULL; int in_size; - if(pthread_end_of_work) break; - if(xp_core.in_lseek==PreSeek) { - MP_UNIT(_xp_id,"Pre seek"); - xp_core.in_lseek=Seek; + if(priv->state==Pth_Canceling) break; + if(priv->state==Pth_Sleep) { +pt_sleep: + priv->state=Pth_ASleep; + while(priv->state==Pth_ASleep) usleep(0); + if(xp_is_bad_pts) mpeg_timer=HUGE; + continue; } - MP_UNIT(_xp_id,"dec_ahead 1"); + __MP_UNIT(priv->p_idx,"dec_ahead 1"); /* get it! */ #if 0 /* prevent reent access to non-reent demuxer */ //if(sh_video->num_frames>200) *((char*)0x100) = 1; // Testing crash if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { - MP_UNIT(_xp_id,"decode audio"); + __MP_UNIT(priv->p_idx,"decode audio"); while(2==xp_thread_decode_audio()) ; - MP_UNIT(_xp_id,"dec_ahead 2"); + __MP_UNIT(priv->p_idx,"dec_ahead 2"); } #endif /*-------------------- Decode a frame: -----------------------*/ in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,sh_video->fps); - if(xp_core.in_lseek==Seek) { - MP_UNIT(_xp_id,"Post seek"); - if(xp_is_bad_pts) mpeg_timer=HUGE; - xp_core.in_lseek=NoSeek; - MP_UNIT(_xp_id,"dec_ahead 3"); - } if(in_size<0) { xp_core.video->fra[xp_core.video->decoder_idx].eof=1; - xp_eof=1; - if(xp_core.in_lseek) { - xp_eof=0; - continue; - } + xp_core.eof=1; break; } /* in_size==0: it's or broken stream or demuxer's bug */ - if(in_size==0 && !pthread_end_of_work) { - xp_core.in_lseek=NoSeek; - continue; - } + if(in_size==0 && priv->state!=Pth_Canceling) continue; /* frame was decoded into current decoder_idx */ if(xp_is_bad_pts) { if(mpeg_timer==HUGE) mpeg_timer=v_pts; @@ -343,9 +357,8 @@ int cur_time; cur_time = GetTimerMS(); /* Ugly solution: disable frame dropping right after seeking! */ - if(cur_time - mpxp_seek_time > (xp_num_frames/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); + if(cur_time - mpxp_seek_time > (xp_core.num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); } /* if( mp_conf.frame_dropping ) */ - if(xp_core.in_lseek!=NoSeek) continue; #if 0 /* We can't seriously examine question of too slow machines @@ -362,7 +375,7 @@ else drop_param=0; /* decode: */ if(output_quality) { - unsigned total = xp_num_frames/2; + unsigned total = xp_core.num_v_buffs/2; unsigned distance = dae_get_decoder_outrun(xp_core.video); int our_quality; our_quality = output_quality*distance/total; @@ -397,66 +410,68 @@ while(!dae_inc_decoded(xp_core.video)) { MSG_T("DEC_AHEAD: sleep: player=%i decoder=%i)\n" ,dae_curr_vplayed(),dae_curr_vdecoded()); - if(pthread_end_of_work) goto pt_exit; - if(xp_core.in_lseek!=NoSeek) break; + if(priv->state==Pth_Canceling) goto pt_exit; + if(priv->state==Pth_Sleep) goto pt_sleep; if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { - MP_UNIT(_xp_id,"decode audio"); + __MP_UNIT(priv->p_idx,"decode audio"); xp_thread_decode_audio(); - MP_UNIT(_xp_id,"dec_ahead 5"); + __MP_UNIT(priv->p_idx,"dec_ahead 5"); } usleep(1); } /*------------------------ frame decoded. --------------------*/ -} /* while(!xp_eof)*/ +} /* while(!xp_core.eof)*/ if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { - while(!xp_audio_eof && !xp_core.in_lseek && !pthread_end_of_work) { - MP_UNIT(_xp_id,"decode audio"); + while(!xp_core.a_eof && priv->state!=Pth_Canceling && priv->state!=Pth_Sleep) { + __MP_UNIT(priv->p_idx,"decode audio"); if(!xp_thread_decode_audio()) usleep(1); - MP_UNIT(_xp_id,NULL); + __MP_UNIT(priv->p_idx,NULL); } } pt_exit: MSG_T("\nDEC_AHEAD: leaving...\n"); - pthread_is_living=0; - pthread_end_of_work=0; - uninit_signal_handling(_xp_id); + priv->state=Pth_Stand; return arg; /* terminate thread here !!! */ } /* this routine decodes audio only */ any_t* a_dec_ahead_routine( any_t* arg ) { - int xp_id; + mpxp_thread_t* priv=arg; + int ret, retval; struct timeval now; struct timespec timeout; float d; - a_pthread_is_living=1; - xp_eof = 0; - xp_audio_eof=0; + priv->state=Pth_Run; + xp_core.eof = 0; + xp_core.a_eof=0; MSG_T("\nDEC_AHEAD: entering...\n"); - xp_id=init_signal_handling(sig_audio_decode,uninit_dec_ahead); - MP_UNIT(xp_id,"dec_ahead"); - pinfo[xp_id].thread_name = "audio decoding+af ahead"; + priv->pid = getpid(); + __MP_UNIT(priv->p_idx,"dec_ahead"); dec_ahead_can_adseek=0; - while(!a_pthread_end_of_work) { - MP_UNIT(xp_id,"decode audio"); - while((ret = xp_thread_decode_audio()) == 2) /* Almost empty buffer */ - if(xp_audio_eof) break; - + while(priv->state!=Pth_Canceling) { + if(priv->state==Pth_Sleep) { + priv->state=Pth_ASleep; + while(priv->state==Pth_ASleep) usleep(0); + continue; + } + __MP_UNIT(priv->p_idx,"decode audio"); + while((ret = xp_thread_decode_audio()) == 2) {/* Almost empty buffer */ + if(xp_core.a_eof) break; + } dec_ahead_can_adseek=1; - - if(a_pthread_end_of_work) - break; - - MP_UNIT(xp_id,"sleep"); + + if(priv->state==Pth_Canceling) break; + + __MP_UNIT(priv->p_idx,"sleep"); LOCK_AUDIO_DECODE(); - if( !xp_core.in_lseek && !a_pthread_end_of_work) { - if(xp_audio_eof) { - MP_UNIT(xp_id,"wait end of work"); + if(priv->state!=Pth_Canceling) { + if(xp_core.a_eof) { + __MP_UNIT(priv->p_idx,"wait end of work"); pthread_cond_wait( &audio_decode_cond, &audio_decode_mutex ); } else if(ret==0) { /* Full buffer or end of file */ if(audio_play_in_sleep) { /* Sleep a little longer than player thread */ @@ -484,13 +499,13 @@ usleep(1); } UNLOCK_AUDIO_DECODE(); - - if(a_pthread_end_of_work) - break; - - MP_UNIT(xp_id,"seek"); + + if(priv->state==Pth_Canceling) break; + + __MP_UNIT(priv->p_idx,"seek"); LOCK_AUDIO_DECODE(); - while( xp_core.in_lseek!=NoSeek && !a_pthread_end_of_work) { +#if 0 + while(priv->state==Pth_Sleep && priv->state!=Pth_Canceling) { gettimeofday(&now,NULL); timeout.tv_nsec = now.tv_usec * 1000; timeout.tv_sec = now.tv_sec + 1; @@ -498,69 +513,42 @@ if( retval == ETIMEDOUT ) MSG_V("Audio decode seek timeout\n"); } +#endif dec_ahead_can_adseek = 0; /* Not safe to seek */ UNLOCK_AUDIO_DECODE(); } - MP_UNIT(xp_id,"exit"); + __MP_UNIT(priv->p_idx,"exit"); dec_ahead_can_adseek = 1; - a_pthread_is_living=0; - a_pthread_end_of_work=0; - uninit_signal_handling(xp_id); + priv->state=Pth_Stand; return arg; /* terminate thread here !!! */ } -void uninit_dec_ahead( int force ) +void xmp_uninit_engine( int force ) { - if(pthread_id && pthread_is_living && xp_core.has_video) - { - pthread_end_of_work=1; - while(pthread_is_living && !force) usleep(0); - pthread_is_living=0; - pthread_attr_destroy(&our_attr); - dae_uninit(xp_core.video); - xp_core.has_video=0; - } + xmp_stop_threads(force); - if(xp_core.has_audio && !force) { /* audio state doesn't matter on segfault :( */ - a_pthread_end_of_work=1; - xp_audio_eof=1; - if(a_pthread_is_living) { - __MP_SYNCHRONIZE(audio_decode_mutex,pthread_cond_signal(&audio_decode_cond)); - } - while(a_pthread_is_living && !force) usleep(0); - a_pthread_is_living=0; - if( pthread_audio_is_living ) { - pthread_audio_end_of_work=1; - LOCK_AUDIO_PLAY(); - pthread_cond_signal(&audio_play_cond); - uninit_audio_buffer(); - xp_core.has_audio=0; - UNLOCK_AUDIO_PLAY(); - while(pthread_audio_is_living && !force) - usleep(0); - pthread_audio_is_living=0; - pthread_attr_destroy(&audio_attr); - } - if(xp_core.has_audio) { - uninit_audio_buffer(); - xp_core.has_audio=0; - } - } - xp_core_uninit(); + if(xp_core.has_video) { + dae_uninit(xp_core.video); + xp_core.has_video=0; + } + + if(xp_core.has_audio) { /* audio state doesn't matter on segfault :( */ + uninit_audio_buffer(); + xp_core.has_audio=0; + } + xmp_uninit(); } /* Min audio buffer to keep free, used to tell differ between full and empty buffer */ #define MIN_BUFFER_RESERV 8 -int init_dec_ahead(sh_video_t *shv, sh_audio_t *sha) +int xmp_init_engine(sh_video_t *shv, sh_audio_t *sha) { - pthread_attr_init(&our_attr); - xp_core_init(); if(shv) { sh_video = shv; xp_core.has_video=1; xp_core.video=malloc(sizeof(dec_ahead_engine_t)); - dae_init(xp_core.video,xp_num_frames); + dae_init(xp_core.video,xp_core.num_v_buffs); } else {/* if (mp_conf.xp >= XP_VAFull) mp_conf.xp = XP_VAPlay;*/ } if(sha) sh_audio = sha; /* currently is unused */ @@ -570,111 +558,119 @@ unsigned o_bps; unsigned min_reserv; o_bps=sh_audio->afilter_inited?sh_audio->af_bps:sh_audio->o_bps; - if(xp_core.has_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_num_frames/sh_video->fps))+MIN_BUFFER_RESERV; - else asize = o_bps*ao_da_buffs; + if(xp_core.has_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_core.num_v_buffs/sh_video->fps))+MIN_BUFFER_RESERV; + else asize = o_bps*xp_core.num_a_buffs; /* FIXME: get better indices from asize/real_audio_packet_size */ min_reserv = sha->audio_out_minsize; if (o_bps > sha->o_bps) min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); xp_core.has_audio=1; - if( mp_conf.xp >= XP_VAPlay ) - pthread_attr_init(&audio_attr); } - return 0; } -int run_dec_ahead( void ) -{ - int retval; - retval = pthread_attr_setdetachstate(&our_attr,PTHREAD_CREATE_DETACHED); - if(retval) - { - if(mp_conf.verbose) printf("running thread: attr_setdetachstate fault!!!\n"); - return retval; - } - pthread_attr_setscope(&our_attr,PTHREAD_SCOPE_SYSTEM); - - if( xp_core.has_audio && mp_conf.xp >= XP_VAPlay ) { - retval = pthread_attr_setdetachstate(&audio_attr,PTHREAD_CREATE_DETACHED); - if(retval) { - if(mp_conf.verbose) printf("running audio thread: attr_setdetachstate fault!!!\n"); - return retval; - } - pthread_attr_setscope(&audio_attr,PTHREAD_SCOPE_SYSTEM); - } - +unsigned xmp_register_thread(sig_handler_t sigfunc,mpxp_routine_t routine,const char *name) { + unsigned idx=xp_core.num_threads; + int rc; + if(idx>=MAX_MPXP_THREADS) return UINT_MAX; + pthread_attr_t attr; + pthread_attr_init(&attr); + rc=pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); + if(rc) { + MSG_ERR("running thread: attr_setdetachstate fault!!!\n"); + pthread_attr_destroy(&attr); + return rc; + } + pthread_attr_setscope(&attr,PTHREAD_SCOPE_SYSTEM); #if 0 - /* requires root privelegies */ - pthread_attr_setschedpolicy(&our_attr,SCHED_FIFO); + /* requires root privelegies */ + pthread_attr_setschedpolicy(&attr,SCHED_FIFO); #endif - if( (xp_core.has_audio && mp_conf.xp >= XP_VAFull) || !xp_core.has_video ) - { - retval = pthread_create(&pthread_id,&audio_attr,a_dec_ahead_routine,NULL); - if( retval ) return retval; - while(!a_pthread_is_living) usleep(0); - } - if( xp_core.has_video ) { - retval = pthread_create(&pthread_id,&our_attr,Va_dec_ahead_routine,NULL); - if(retval) return retval; - while(!pthread_is_living) usleep(0); - } - return 0; + xp_core.mpxp_threads[idx]=malloc(sizeof(mpxp_thread_t)); + memset(xp_core.mpxp_threads[idx],0,sizeof(mpxp_thread_t)); + + xp_core.mpxp_threads[idx]->p_idx=idx; + xp_core.mpxp_threads[idx]->name=name; + xp_core.mpxp_threads[idx]->routine=routine; + xp_core.mpxp_threads[idx]->sigfunc=sigfunc; + xp_core.mpxp_threads[idx]->state=Pth_Stand; + + rc=pthread_create(&xp_core.mpxp_threads[idx]->pth_id,&attr,routine,xp_core.mpxp_threads[idx]); + pthread_attr_destroy(&attr); + + xp_core.num_threads++; + return (rc?UINT_MAX:idx); } -int run_xp_aplayers(void) +int xmp_run_decoders( void ) { - int retval; - if( xp_core.has_audio && mp_conf.xp >= XP_VAPlay ) - { - retval = pthread_create(&pthread_id,&audio_attr,audio_play_routine,NULL); - if( retval ) return retval; - while(!pthread_audio_is_living) usleep(0); - } - return 0; + unsigned rc; + if((xp_core.has_audio && mp_conf.xp >= XP_VAFull) || !xp_core.has_video) { + if((rc=xmp_register_thread(sig_audio_decode,a_dec_ahead_routine,"audio decoder+af"))==UINT_MAX) return rc; + while(xp_core.mpxp_threads[rc]->state!=Pth_Run) usleep(0); + } + if(xp_core.has_video) { + if((rc=xmp_register_thread(sig_dec_ahead_video,Va_dec_ahead_routine,"video+audio decoders & af+vf"))==UINT_MAX) return rc; + while(xp_core.mpxp_threads[rc]->state!=Pth_Run) usleep(0); + } + return 0; } - -/* Halt threads before seek */ -void dec_ahead_halt_threads(int is_reset_vcache) +int xmp_run_players(void) { - xp_core.in_lseek = PreSeek; - - if(pthread_audio_is_living) { - LOCK_AUDIO_PLAY(); - while(!dec_ahead_can_aseek) - usleep(1); - UNLOCK_AUDIO_PLAY(); + unsigned rc; + if( xp_core.has_audio && mp_conf.xp >= XP_VAPlay ) { + if((rc=xmp_register_thread(sig_audio_play,audio_play_routine,"audio player"))==UINT_MAX) return rc; + while(xp_core.mpxp_threads[rc]->state!=Pth_Run) usleep(0); } + return 0; +} - if(a_pthread_is_living) { - LOCK_AUDIO_DECODE(); - while(!dec_ahead_can_adseek) - usleep(1); - UNLOCK_AUDIO_DECODE(); +/* Stops threads before seek */ +void xmp_stop_threads(int force) +{ + unsigned i; + for(i=1;i<xp_core.num_threads;i++) { + if(force) pthread_kill(xp_core.mpxp_threads[i]->pth_id,SIGKILL); + else { + xp_core.mpxp_threads[i]->state=Pth_Canceling; + while(xp_core.mpxp_threads[i]->state==Pth_Canceling) usleep(0); + } + print_stopped_thread(i); + free(xp_core.mpxp_threads[i]); + xp_core.mpxp_threads[i]=NULL; } +} - if(pthread_is_living) { - while(xp_core.in_lseek==PreSeek) - usleep(1); +/* Halt threads before seek */ +void xmp_halt_threads(int is_reset_vcache) +{ + unsigned i; + for(i=1;i<xp_core.num_threads;i++) { + xp_core.mpxp_threads[i]->state=Pth_Sleep; + while(xp_core.mpxp_threads[i]->state==Pth_Sleep) usleep(0); } - xp_core.in_lseek = Seek; } /* Restart threads after seek */ -void dec_ahead_restart_threads(int xp_id) +void xmp_restart_threads(int xp_id) { /* reset counters */ dae_reset(xp_core.video); - /* tempoarry solution */ + /* temporary solution */ reset_audio_buffer(); /* Ugly hack: but we should read audio packet before video after seeking. Else we'll get picture destortion on the screen */ initial_audio_pts=HUGE; + unsigned i; + for(i=1;i<xp_core.num_threads;i++) { + xp_core.mpxp_threads[i]->state=Pth_Run; + while(xp_core.mpxp_threads[i]->state==Pth_ASleep) usleep(0); + } +#if 0 if... [truncated message content] |
From: <nic...@us...> - 2012-10-27 15:18:45
|
Revision: 229 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=229&view=rev Author: nickols_k Date: 2012-10-27 15:18:38 +0000 (Sat, 27 Oct 2012) Log Message: ----------- combine some variables into structures Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_faad.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/xmp_core.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-27 15:04:43 UTC (rev 228) +++ mplayerxp/cfg-mplayer.h 2012-10-27 15:18:38 UTC (rev 229) @@ -35,7 +35,6 @@ extern int enable_xp_audio; -extern float playbackspeed_factor; /* from libvo/aspect.c */ extern float monitor_pixel_aspect; @@ -247,7 +246,7 @@ {"zoom", &vo_conf.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, NULL, "scale output image by given factor"}, {"screenw", &vo_conf.screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the horizontal resolution of the screen (if supported)"}, {"screenh", &vo_conf.screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the vertical resolution of the screen (if supported)"}, - {"speed", &playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL, "sets playback speed factor"}, + {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL, "sets playback speed factor"}, {"aspect", &vo_conf.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL, "sets aspect-ratio of movies (autodetect)"}, {"noaspect", &vo_conf.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, NULL, "unsets aspect-ratio of movies"}, {"aspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 0, 1, NULL, "keeps aspect-ratio of the movie during window resize"}, Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-10-27 15:04:43 UTC (rev 228) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-10-27 15:18:38 UTC (rev 229) @@ -138,7 +138,7 @@ float pts; int flags=0; /* Dolby AC3 audio:*/ - mpxp_a52_accel = mplayer_accel; + mpxp_a52_accel = mp_data->mplayer_accel; mpxp_a52_state=a52_init (mpxp_a52_accel); if (mpxp_a52_state == NULL) { MSG_ERR("A52 init failed\n"); Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2012-10-27 15:04:43 UTC (rev 228) +++ mplayerxp/libmpcodecs/ad_dca.c 2012-10-27 15:18:38 UTC (rev 229) @@ -140,7 +140,7 @@ float pts; int flags=0; /* Dolby AC3 audio:*/ - mpxp_dca_accel = mplayer_accel; + mpxp_dca_accel = mp_data->mplayer_accel; mpxp_dca_state = dca_init(mpxp_dca_accel); if (mpxp_dca_state == NULL) { MSG_ERR("dca init failed\n"); Modified: mplayerxp/libmpcodecs/ad_faad.c =================================================================== --- mplayerxp/libmpcodecs/ad_faad.c 2012-10-27 15:04:43 UTC (rev 228) +++ mplayerxp/libmpcodecs/ad_faad.c 2012-10-27 15:18:38 UTC (rev 229) @@ -170,7 +170,7 @@ float pts; int NeAAC_init; NeAACDecConfigurationPtr NeAAC_conf; - if(!(NeAAC_hdec = NeAACDecOpen(mplayer_accel))) + if(!(NeAAC_hdec = NeAACDecOpen(mp_data->mplayer_accel))) { MSG_WARN("FAAD: Failed to open the decoder!\n"); // XXX: deal with cleanup! return 0; Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-27 15:04:43 UTC (rev 228) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-27 15:18:38 UTC (rev 229) @@ -288,19 +288,18 @@ } #ifdef USE_SUB -extern subtitle* mp_subtitles; static float sub_last_pts = -303; #endif static void update_subtitle(sh_video_t *sh_video,float v_pts,unsigned xp_idx) { #ifdef USE_SUB // find sub - if(mp_subtitles && v_pts>0){ + if(mp_data->subtitles && v_pts>0){ float pts=v_pts; if(mp_conf.sub_fps==0) mp_conf.sub_fps=sh_video->fps; MP_UNIT("find_sub"); if (pts > sub_last_pts || pts < sub_last_pts-1.0 ) { - find_sub(mp_subtitles,sub_uses_time?(100*pts):(pts*mp_conf.sub_fps),vo_data); // FIXME! frame counter... + find_sub(mp_data->subtitles,sub_uses_time?(100*pts):(pts*mp_conf.sub_fps),vo_data); // FIXME! frame counter... sub_last_pts = pts; } MP_UNIT(NULL); Modified: mplayerxp/libmpcodecs/vd_libmpeg2.c =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-10-27 15:04:43 UTC (rev 228) +++ mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-10-27 15:18:38 UTC (rev 229) @@ -187,7 +187,7 @@ priv_t *priv; if(!load_lib("libmpeg2"SLIBSUFFIX)) return 0; priv=sh->context=malloc(sizeof(priv_t)); - if(!(priv->mpeg2dec=mpeg2_init(mplayer_accel))) return 0; + if(!(priv->mpeg2dec=mpeg2_init(mp_data->mplayer_accel))) return 0; return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL); } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-27 15:04:43 UTC (rev 228) +++ mplayerxp/mplayer.c 2012-10-27 15:18:38 UTC (rev 229) @@ -88,18 +88,12 @@ volatile unsigned xp_drop_frame_cnt=0; float xp_screen_pts; -float playbackspeed_factor=1.0; static unsigned mpxp_after_seek=0; int audio_eof=0; demux_stream_t *d_video=NULL; static int osd_show_framedrop = 0; static int osd_function=OSD_PLAY; -#ifdef USE_SUB -subtitle* mp_subtitles=NULL; -#endif -int use_pts_fix2=-1; - /************************************************************************ Special case: inital audio PTS: example: some movies has a_pts = v_pts = XX sec @@ -108,11 +102,6 @@ float initial_audio_pts=HUGE; initial_audio_pts_correction_t initial_audio_pts_corr; -/* - Acceleration for codecs -*/ -unsigned mplayer_accel=0; - /************************************************************************** Config file **************************************************************************/ @@ -203,10 +192,12 @@ mp_conf.has_video=1; mp_conf.has_dvdsub=1; mp_conf.osd_level=2; + mp_conf.playbackspeed_factor=1.0; mp_data=random_malloc(sizeof(mp_data_t),1000); memset(mp_data,0,sizeof(mp_data_t)); mp_data->seek_time=-1; mp_data->bench=malloc(sizeof(time_usage_t)); + mp_data->use_pts_fix2=-1; memset(mp_data->bench,0,sizeof(time_usage_t)); } @@ -663,10 +654,10 @@ inited_flags&=~INITED_SUBTITLE; MP_UNIT("sub_free"); mp_input_uninit(); - sub_free( mp_subtitles ); + sub_free( mp_data->subtitles ); mp_conf.sub_name=NULL; vo_data->sub=NULL; - mp_subtitles=NULL; + mp_data->subtitles=NULL; } #endif MP_UNIT(NULL); @@ -853,12 +844,12 @@ gCpuCaps.hasAES, gCpuCaps.hasAVX, gCpuCaps.hasFMA); - if(gCpuCaps.hasMMX) mplayer_accel |= MM_ACCEL_X86_MMX; - if(gCpuCaps.hasMMX2) mplayer_accel |= MM_ACCEL_X86_MMXEXT; - if(gCpuCaps.hasSSE) mplayer_accel |= MM_ACCEL_X86_SSE; - if(gCpuCaps.has3DNow) mplayer_accel |= MM_ACCEL_X86_3DNOW; - if(gCpuCaps.has3DNowExt) mplayer_accel |= MM_ACCEL_X86_3DNOWEXT; - MSG_V("mplayer_accel=%i\n",mplayer_accel); + if(gCpuCaps.hasMMX) mp_data->mplayer_accel |= MM_ACCEL_X86_MMX; + if(gCpuCaps.hasMMX2) mp_data->mplayer_accel |= MM_ACCEL_X86_MMXEXT; + if(gCpuCaps.hasSSE) mp_data->mplayer_accel |= MM_ACCEL_X86_SSE; + if(gCpuCaps.has3DNow) mp_data->mplayer_accel |= MM_ACCEL_X86_3DNOW; + if(gCpuCaps.has3DNowExt) mp_data->mplayer_accel |= MM_ACCEL_X86_3DNOWEXT; + MSG_V("mp_data->mplayer_accel=%i\n",mp_data->mplayer_accel); } #endif @@ -1014,7 +1005,7 @@ memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[playsize],sh_audio->a_buffer_len); if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) pthread_mutex_lock(&audio_timer_mutex); - if(use_pts_fix2) { + if(mp_data->use_pts_fix2) { if(sh_audio->a_pts != HUGE) { sh_audio->a_pts_pos-=playsize; if(sh_audio->a_pts_pos > -ao_get_delay(ao_data)*sh_audio->af_bps) { @@ -1132,7 +1123,7 @@ static void vplayer_check_chapter_change(frame_attr_t* shva_prev,float v_pts) { - if(use_pts_fix2 && sh_audio) { + if(mp_data->use_pts_fix2 && sh_audio) { if(sh_video->chapter_change == -1) { /* First frame after seek */ while(v_pts < 1.0 && sh_audio->timer==0.0 && ao_get_delay(ao_data)==0.0) usleep(0); /* Wait for audio to start play */ @@ -1162,9 +1153,9 @@ often ao_get_delay() never returns 0 :( */ if(audio_eof && !get_delay_audio_buffer()) goto nosound_model; if((!audio_eof || ao_get_delay(ao_data)) && - (!use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) + (!mp_data->use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) sleep_time=xp_screen_pts-(sh_audio->timer-ao_get_delay(ao_data)); - else if(use_pts_fix2 && sh_audio->chapter_change) + else if(mp_data->use_pts_fix2 && sh_audio->chapter_change) sleep_time=0; else goto nosound_model; @@ -1765,17 +1756,17 @@ // check .sub MP_UNIT("read_subtitles_file"); if(mp_conf.sub_name){ - mp_subtitles=sub_read_file(mp_conf.sub_name, sh_video->fps); - if(!mp_subtitles) MSG_ERR(MSGTR_CantLoadSub,mp_conf.sub_name); + mp_data->subtitles=sub_read_file(mp_conf.sub_name, sh_video->fps); + if(!mp_data->subtitles) MSG_ERR(MSGTR_CantLoadSub,mp_conf.sub_name); } else if(mp_conf.sub_auto) { // auto load sub file ... - mp_subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) + mp_data->subtitles=sub_read_file( filename ? sub_filename( get_path("sub/"), filename ) : "default.sub", sh_video->fps ); } - if(mp_subtitles) + if(mp_data->subtitles) { inited_flags|=INITED_SUBTITLE; - if(stream_dump_type>1) list_sub_file(mp_subtitles); + if(stream_dump_type>1) list_sub_file(mp_data->subtitles); } #endif } @@ -2541,9 +2532,9 @@ d_video->demuxer->file_format == DEMUXER_TYPE_H264_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_PS || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS))) - use_pts_fix2=1; + mp_data->use_pts_fix2=1; else - use_pts_fix2=0; + mp_data->use_pts_fix2=0; if(sh_video) sh_video->chapter_change=0; Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-10-27 15:04:43 UTC (rev 228) +++ mplayerxp/mplayer.h 2012-10-27 15:18:38 UTC (rev 229) @@ -28,6 +28,7 @@ int autoq; /* quality's options: */ unsigned verbose; int benchmark; + float playbackspeed_factor; // sync int frame_dropping; // option 0=no drop 1= drop vo 2= drop decode int av_sync_pts; @@ -99,13 +100,14 @@ typedef struct mp_data_s { int seek_time; int output_quality; + int use_pts_fix2; + unsigned mplayer_accel; + any_t* subtitles; any_t* mconfig; time_usage_t*bench; }mp_data_t; extern mp_data_t* mp_data; -extern unsigned mplayer_accel; -extern int use_pts_fix2; extern void exit_player(char* how); extern void mpxp_resync_audio_stream(void); Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-27 15:04:43 UTC (rev 228) +++ mplayerxp/xmp_core.c 2012-10-27 15:18:38 UTC (rev 229) @@ -324,7 +324,7 @@ if(!(xp_core.has_audio && mp_conf.xp < XP_VAFull)) priv->name = "video decoder+vf"; drop_barrier=(float)(xp_core.num_v_buffs/2)*(1/sh_video->fps); - if(mp_conf.av_sync_pts == -1 && !use_pts_fix2) + if(mp_conf.av_sync_pts == -1 && !mp_data->use_pts_fix2) xp_is_bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG4_ES || d_video->demuxer->file_format == DEMUXER_TYPE_H264_ES || This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-28 08:01:48
|
Revision: 230 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=230&view=rev Author: nickols_k Date: 2012-10-28 08:01:42 +0000 (Sun, 28 Oct 2012) Log Message: ----------- use playbackspeed_factor Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/mplayer.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-27 15:18:38 UTC (rev 229) +++ mplayerxp/cfg-mplayer.h 2012-10-28 08:01:42 UTC (rev 230) @@ -81,6 +81,7 @@ {"cache", &mp_conf.s_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, NULL,"specifies amount of memory for precaching a file/URL"}, {"nocache", &mp_conf.s_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL,"disables precaching a file/URL"}, {"autoq", &mp_conf.autoq, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "dynamically changes the level of postprocessing depending on spare CPU time available"}, + {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL, "sets playback speed factor"}, {"benchmark", &mp_conf.benchmark, CONF_TYPE_FLAG, 0, 0, 1, NULL, "performs benchmarking to estimate performance of MPlayerXP"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, }; @@ -246,7 +247,6 @@ {"zoom", &vo_conf.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, NULL, "scale output image by given factor"}, {"screenw", &vo_conf.screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the horizontal resolution of the screen (if supported)"}, {"screenh", &vo_conf.screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the vertical resolution of the screen (if supported)"}, - {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL, "sets playback speed factor"}, {"aspect", &vo_conf.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL, "sets aspect-ratio of movies (autodetect)"}, {"noaspect", &vo_conf.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, NULL, "unsets aspect-ratio of movies"}, {"aspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 0, 1, NULL, "keeps aspect-ratio of the movie during window resize"}, Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-27 15:18:38 UTC (rev 229) +++ mplayerxp/mplayer.c 2012-10-28 08:01:42 UTC (rev 230) @@ -1161,7 +1161,7 @@ goto nosound_model; } else { nosound_model: - sleep_time=shva_prev->duration; + sleep_time=shva_prev->duration/mp_conf.playbackspeed_factor; } return sleep_time; } @@ -2413,6 +2413,7 @@ if(stream_dump_type==1) dump_stream(stream); //============ Open DEMUXERS --- DETECT file type ======================= + if(mp_conf.playbackspeed_factor) mp_conf.has_audio=0; initial_audio_pts=HUGE; if(!mp_conf.has_audio) mp_conf.audio_id=-2; // do NOT read audio packets... if(!mp_conf.has_video) mp_conf.video_id=-2; // do NOT read video packets... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-29 10:29:11
|
Revision: 240 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=240&view=rev Author: nickols_k Date: 2012-10-29 10:29:04 +0000 (Mon, 29 Oct 2012) Log Message: ----------- decrease number of global variables Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/stream.h mplayerxp/mplayer.c mplayerxp/xmp_core.c mplayerxp/xmp_core.h Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-29 09:40:53 UTC (rev 239) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-29 10:29:04 UTC (rev 240) @@ -292,6 +292,7 @@ #endif static void update_subtitle(sh_video_t *sh_video,float v_pts,unsigned xp_idx) { + demux_stream_t *d_dvdsub=sh_video->ds->demuxer->sub; #ifdef USE_SUB // find sub if(mp_data->subtitles && v_pts>0){ Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-10-29 09:40:53 UTC (rev 239) +++ mplayerxp/libmpdemux/cache2.c 2012-10-29 10:29:04 UTC (rev 240) @@ -296,7 +296,7 @@ c->read_filepos=stream->start_pos; unsigned rc; - if((rc=xmp_register_thread(sig_cache2,cache2_routine,"cache2"))==UINT_MAX) return 0; + if((rc=xmp_register_thread(NULL,sig_cache2,cache2_routine,"cache2"))==UINT_MAX) return 0; c->pth=&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", Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-10-29 09:40:53 UTC (rev 239) +++ mplayerxp/libmpdemux/demuxer.c 2012-10-29 10:29:04 UTC (rev 240) @@ -588,6 +588,7 @@ } } } + stream->demuxer=demuxer; return demuxer; } Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-10-29 09:40:53 UTC (rev 239) +++ mplayerxp/libmpdemux/demuxer.h 2012-10-29 10:29:04 UTC (rev 240) @@ -93,9 +93,6 @@ int pts_flags; /**< PTS flags like trigger for correction applying (DVD's PTS correction) */ } demux_stream_t; -extern demux_stream_t *d_audio; -extern demux_stream_t *d_dvdsub; - #define MAX_A_STREAMS 256 #define MAX_V_STREAMS 256 #define MAX_S_STREAMS 256 Modified: mplayerxp/libmpdemux/s_dvdnav.c =================================================================== --- mplayerxp/libmpdemux/s_dvdnav.c 2012-10-29 09:40:53 UTC (rev 239) +++ mplayerxp/libmpdemux/s_dvdnav.c 2012-10-29 10:29:04 UTC (rev 240) @@ -447,9 +447,9 @@ static void __FASTCALL__ dvdnav_event_handler(stream_t* s,const stream_packet_t*sp) { - dvdnav_priv_t *priv=s->priv; - switch(sp->type) - { + demux_stream_t *d_audio=s->demuxer->audio; + dvdnav_priv_t *priv=s->priv; + switch(sp->type) { case DVDNAV_BLOCK_OK: /* be silent about this one */ break; case DVDNAV_HIGHLIGHT: { @@ -564,7 +564,7 @@ // send new palette to SPU decoder if (vo_data->spudec) spudec_update_palette(vo_data->spudec,(const unsigned int *)(sp->buf)); break; - } + } } static void __FASTCALL__ dvdnav_cmd_handler(stream_t* s,unsigned cmd) Modified: mplayerxp/libmpdemux/stream.h =================================================================== --- mplayerxp/libmpdemux/stream.h 2012-10-29 09:40:53 UTC (rev 239) +++ mplayerxp/libmpdemux/stream.h 2012-10-29 10:29:04 UTC (rev 240) @@ -39,26 +39,27 @@ /** Stream description */ typedef struct stream_s{ - int fd; /**< file handler */ - off_t pos; /**< SOF offset from begin of stream */ - int eof; /**< indicates EOF */ - int type; /**< properties of the stream (see STREAMTYPE_ for detail) */ - int file_format; /**< detected file format (by http:// protocol for example) */ - int _Errno; /**< keeps value of errno from low-level operations */ - unsigned int buf_pos; /**< position whitin of small cache */ - unsigned int buf_len; /**< length of small cache */ - unsigned char *buffer;/**< buffer of small cache */ - off_t start_pos; /**< real start of stream (without internet's headers) */ - off_t end_pos; /**< real end of stream (media may be not fully filled) */ - unsigned sector_size; /**< alignment of read operations (1 for file, VCD_SECTOR_SIZE for VCDs) */ - any_t* cache_data; /**< large cache */ - any_t* priv; /**< private data used by stream driver */ - float stream_pts; /**< PTS correction for idiotics DVD's discontinuities */ + int fd; /**< file handler */ + off_t pos; /**< SOF offset from begin of stream */ + int eof; /**< indicates EOF */ + int type; /**< properties of the stream (see STREAMTYPE_ for detail) */ + int file_format; /**< detected file format (by http:// protocol for example) */ + int _Errno; /**< keeps value of errno from low-level operations */ + unsigned int buf_pos; /**< position whitin of small cache */ + unsigned int buf_len; /**< length of small cache */ + unsigned char *buffer;/**< buffer of small cache */ + off_t start_pos; /**< real start of stream (without internet's headers) */ + off_t end_pos; /**< real end of stream (media may be not fully filled) */ + unsigned sector_size; /**< alignment of read operations (1 for file, VCD_SECTOR_SIZE for VCDs) */ + struct demuxer_s* demuxer; /* parent demuxer */ + any_t* cache_data; /**< large cache */ + any_t* priv; /**< private data used by stream driver */ + float stream_pts; /**< PTS correction for idiotics DVD's discontinuities */ #ifdef HAVE_STREAMING - streaming_ctrl_t *streaming_ctrl; /**< callback for internet streaming control */ + streaming_ctrl_t *streaming_ctrl; /**< callback for internet streaming control */ #endif - const struct stream_driver_s *driver; /**< low-level stream driver */ - stream_callback event_handler; /**< callback for streams which provide events */ + const struct stream_driver_s *driver; /**< low-level stream driver */ + stream_callback event_handler; /**< callback for streams which provide events */ } stream_t; int stream_enable_cache(stream_t *stream,int size,int min,int prefill); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-29 09:40:53 UTC (rev 239) +++ mplayerxp/mplayer.c 2012-10-29 10:29:04 UTC (rev 240) @@ -118,10 +118,6 @@ float xp_screen_pts; int audio_eof=0; -demux_stream_t *d_video=NULL; -demux_stream_t *d_audio=NULL; -demux_stream_t *d_dvdsub=NULL; - ao_data_t* ao_data=NULL; vo_data_t* vo_data=NULL; pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; @@ -426,6 +422,8 @@ int decode_audio_buffer(unsigned len) { + priv_t*priv=mp_data->priv; + demux_stream_t *d_audio=priv->demuxer->audio; int ret, blen, l, l2; int next_idx; unsigned int t; @@ -943,6 +941,7 @@ priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; sh_video_t* sh_video=priv->demuxer->video->sh; + demux_stream_t *d_audio=priv->demuxer->audio; int eof = 0; /*========================== PLAY AUDIO ============================*/ while(sh_audio){ @@ -1232,6 +1231,7 @@ priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; sh_video_t* sh_video=priv->demuxer->video->sh; + demux_stream_t *d_audio=priv->demuxer->audio; float v_pts=0; float sleep_time=0; int can_blit=0; @@ -1372,6 +1372,7 @@ priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; sh_video_t* sh_video=priv->demuxer->video->sh; + demux_stream_t *d_dvdsub=priv->demuxer->sub; int seek_rval=1; audio_eof=0; if(seek->secs || seek->flags&DEMUX_SEEK_SET) { @@ -1750,6 +1751,7 @@ static void mpxp_read_video_properties(void) { priv_t*priv=mp_data->priv; sh_video_t* sh_video=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"); @@ -1823,6 +1825,7 @@ static void mpxp_find_acodec(void) { priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; + demux_stream_t *d_audio=priv->demuxer->audio; // Go through the codec.conf and find the best codec... sh_audio->codec=NULL; if(mp_conf.audio_family) MSG_INFO(MSGTR_TryForceAudioFmt,mp_conf.audio_family); @@ -1855,6 +1858,7 @@ static int mpxp_find_vcodec(void) { priv_t*priv=mp_data->priv; + demux_stream_t *d_video=priv->demuxer->video; sh_video_t* sh_video=priv->demuxer->video->sh; int rc=0; MP_UNIT("init_video_codec"); @@ -1902,6 +1906,7 @@ priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; sh_video_t* sh_video=priv->demuxer->video->sh; + demux_stream_t *d_audio=priv->demuxer->audio; int rc=0; const ao_info_t *info=ao_get_info(); MP_UNIT("setup_audio"); @@ -2444,9 +2449,10 @@ priv->demuxer=NULL; priv->inited_flags&=~INITED_DEMUXER; } - d_audio=NULL; - d_video=NULL; if(priv->demuxer) { + priv->demuxer->audio=NULL; + priv->demuxer->video=NULL; + priv->demuxer->sub=NULL; priv->demuxer->audio->sh=NULL; priv->demuxer->video->sh=NULL; } @@ -2498,6 +2504,9 @@ priv->inited_flags|=INITED_DEMUXER; input_state.after_dvdmenu=0; + demux_stream_t *d_video; + demux_stream_t *d_audio; + demux_stream_t *d_dvdsub; d_audio=priv->demuxer->audio; d_video=priv->demuxer->video; d_dvdsub=priv->demuxer->sub; Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-29 09:40:53 UTC (rev 239) +++ mplayerxp/xmp_core.c 2012-10-29 10:29:04 UTC (rev 240) @@ -52,6 +52,7 @@ xp_core.main_pth_id=xp_core.mpxp_threads[idx]->pth_id=pthread_self(); xp_core.mpxp_threads[idx]->name = "main"; xp_core.mpxp_threads[idx]->sigfunc = sigfunc; + xp_core.mpxp_threads[idx]->dae = NULL; xp_core.num_threads++; return idx; @@ -84,10 +85,11 @@ it->num_decoded_frames=0; } -void dae_init(dec_ahead_engine_t* it,unsigned nframes) +void dae_init(dec_ahead_engine_t* it,unsigned nframes,any_t* sh) { it->nframes=nframes; it->fra = malloc(sizeof(frame_attr_t)*nframes); + it->sh=sh; dae_reset(it); } @@ -181,10 +183,6 @@ volatile int dec_ahead_can_aseek=0; /* It is safe to seek audio */ volatile int dec_ahead_can_adseek=1; /* It is safe to seek audio buffer thread */ -static sh_video_t *sh_video; -static sh_audio_t *sh_audio; -extern demux_stream_t *d_video; - /* Support for '-loop' option */ extern int loop_times; /* it's const for xp mode */ @@ -212,9 +210,50 @@ int xp_is_bad_pts=0; +/* Audio stuff */ +volatile float dec_ahead_audio_delay; +static int xp_thread_decode_audio(void) +{ + sh_audio_t* sh_audio=xp_core.audio->sh; + sh_video_t* sh_video=xp_core.video->sh; + int free_buf, vbuf_size, pref_buf; + unsigned len=0; + + free_buf = get_free_audio_buffer(); + + if( free_buf == -1 ) { /* End of file */ + xp_core.a_eof = 1; + return 0; + } + if( free_buf < (int)sh_audio->audio_out_minsize ) /* full */ + return 0; + + len = get_len_audio_buffer(); + + if( len < MAX_OUTBURST ) /* Buffer underrun */ + return decode_audio_buffer(MAX_OUTBURST); + + if(xp_core.has_video) { + /* Match video buffer */ + vbuf_size = dae_get_decoder_outrun(xp_core.video); + pref_buf = vbuf_size / sh_video->fps * sh_audio->af_bps; + pref_buf -= len; + if( pref_buf > 0 ) { + len = min( pref_buf, free_buf ); + if( len > sh_audio->audio_out_minsize ) { + return decode_audio_buffer(len); + } + } + } else + return decode_audio_buffer(min(free_buf,MAX_OUTBURST)); + + return 0; +} + + /* this routine decodes video+audio but intends to be video only */ -static void show_warn_cant_sync(float max_frame_delay) { +static void show_warn_cant_sync(sh_video_t*sh_video,float max_frame_delay) { static int warned=0; static float prev_warn_delay=0; if(!warned || max_frame_delay > prev_warn_delay) { @@ -229,7 +268,7 @@ } } -static unsigned compute_frame_dropping(float v_pts,float drop_barrier) { +static unsigned compute_frame_dropping(sh_video_t* sh_video,float v_pts,float drop_barrier) { unsigned rc=0; static float prev_delta=64; float delta,max_frame_delay;/* delay for decoding of top slow frame */ @@ -250,7 +289,7 @@ if(max_frame_delay*3 > drop_barrier) { if(drop_barrier < (float)(xp_core.num_v_buffs-2)/sh_video->fps) drop_barrier += 1/sh_video->fps; else - if(mp_conf.verbose) show_warn_cant_sync(max_frame_delay); + if(mp_conf.verbose) show_warn_cant_sync(sh_video,max_frame_delay); } if(delta > drop_barrier) rc=0; else if(delta < max_frame_delay*3) rc=1; @@ -307,6 +346,8 @@ any_t* Va_dec_ahead_routine( any_t* arg ) { mpxp_thread_t* priv=arg; + sh_video_t* sh_video=priv->dae->sh; + demux_stream_t *d_video=sh_video->ds; float duration=0; float drop_barrier; @@ -379,7 +420,7 @@ int cur_time; cur_time = GetTimerMS(); /* Ugly solution: disable frame dropping right after seeking! */ - if(cur_time - mp_data->seek_time > (xp_core.num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); + if(cur_time - mp_data->seek_time > (xp_core.num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(sh_video,v_pts,drop_barrier); } /* if( mp_conf.frame_dropping ) */ if(!finite(v_pts)) MSG_WARN("Bug of demuxer! Value of video pts=%f\n",v_pts); #if 0 @@ -567,33 +608,33 @@ int xmp_init_engine(sh_video_t *shv, sh_audio_t *sha) { - if(shv) { - sh_video = shv; - xp_core.has_video=1; - xp_core.video=malloc(sizeof(dec_ahead_engine_t)); - dae_init(xp_core.video,xp_core.num_v_buffs); - } - else {/* if (mp_conf.xp >= XP_VAFull) mp_conf.xp = XP_VAPlay;*/ } - if(sha) sh_audio = sha; /* currently is unused */ + if(shv) { + xp_core.has_video=1; + xp_core.video=malloc(sizeof(dec_ahead_engine_t)); + dae_init(xp_core.video,xp_core.num_v_buffs,shv); + } else {/* if (mp_conf.xp >= XP_VAFull) mp_conf.xp = XP_VAPlay;*/ + } - if(mp_conf.xp>=XP_VideoAudio && sha) { - int asize; - unsigned o_bps; - unsigned min_reserv; - o_bps=sh_audio->afilter_inited?sh_audio->af_bps:sh_audio->o_bps; - if(xp_core.has_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_core.num_v_buffs/sh_video->fps))+MIN_BUFFER_RESERV; - else asize = o_bps*xp_core.num_a_buffs; - /* FIXME: get better indices from asize/real_audio_packet_size */ - min_reserv = sha->audio_out_minsize; - if (o_bps > sha->o_bps) - min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; - init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); - xp_core.has_audio=1; - } - return 0; + if(mp_conf.xp>=XP_VideoAudio && sha) { + int asize; + unsigned o_bps; + unsigned min_reserv; + o_bps=sha->afilter_inited?sha->af_bps:sha->o_bps; + if(xp_core.has_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_core.num_v_buffs/shv->fps))+MIN_BUFFER_RESERV; + else asize = o_bps*xp_core.num_a_buffs; + /* FIXME: get better indices from asize/real_audio_packet_size */ + min_reserv = sha->audio_out_minsize; + if (o_bps > sha->o_bps) + min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; + init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); + xp_core.has_audio=1; + xp_core.audio=malloc(sizeof(dec_ahead_engine_t)); + dae_init(xp_core.audio,xp_core.num_a_buffs,sha); + } + return 0; } -unsigned xmp_register_thread(sig_handler_t sigfunc,mpxp_routine_t routine,const char *name) { +unsigned xmp_register_thread(dec_ahead_engine_t* dae,sig_handler_t sigfunc,mpxp_routine_t routine,const char *name) { unsigned idx=xp_core.num_threads; int rc; if(idx>=MAX_MPXP_THREADS) return UINT_MAX; @@ -618,6 +659,7 @@ xp_core.mpxp_threads[idx]->routine=routine; xp_core.mpxp_threads[idx]->sigfunc=sigfunc; xp_core.mpxp_threads[idx]->state=Pth_Stand; + xp_core.mpxp_threads[idx]->dae=dae; rc=pthread_create(&xp_core.mpxp_threads[idx]->pth_id,&attr,routine,xp_core.mpxp_threads[idx]); pthread_attr_destroy(&attr); @@ -630,11 +672,11 @@ { unsigned rc; if((xp_core.has_audio && mp_conf.xp >= XP_VAFull) || !xp_core.has_video) { - if((rc=xmp_register_thread(sig_audio_decode,a_dec_ahead_routine,"audio decoder+af"))==UINT_MAX) return rc; + if((rc=xmp_register_thread(xp_core.audio,sig_audio_decode,a_dec_ahead_routine,"audio decoder+af"))==UINT_MAX) return rc; while(xp_core.mpxp_threads[rc]->state!=Pth_Run) usleep(0); } if(xp_core.has_video) { - if((rc=xmp_register_thread(sig_dec_ahead_video,Va_dec_ahead_routine,"video+audio decoders & af+vf"))==UINT_MAX) return rc; + if((rc=xmp_register_thread(xp_core.video,sig_dec_ahead_video,Va_dec_ahead_routine,"video+audio decoders & af+vf"))==UINT_MAX) return rc; while(xp_core.mpxp_threads[rc]->state!=Pth_Run) usleep(0); } return 0; @@ -644,7 +686,7 @@ { unsigned rc; if( xp_core.has_audio && mp_conf.xp >= XP_VAPlay ) { - if((rc=xmp_register_thread(sig_audio_play,audio_play_routine,"audio player"))==UINT_MAX) return rc; + if((rc=xmp_register_thread(xp_core.audio,sig_audio_play,audio_play_routine,"audio player"))==UINT_MAX) return rc; while(xp_core.mpxp_threads[rc]->state!=Pth_Run) usleep(0); } return 0; @@ -714,44 +756,6 @@ #endif } -/* Audio stuff */ -volatile float dec_ahead_audio_delay; -int xp_thread_decode_audio() -{ - int free_buf, vbuf_size, pref_buf; - unsigned len=0; - - free_buf = get_free_audio_buffer(); - - if( free_buf == -1 ) { /* End of file */ - xp_core.a_eof = 1; - return 0; - } - if( free_buf < (int)sh_audio->audio_out_minsize ) /* full */ - return 0; - - len = get_len_audio_buffer(); - - if( len < MAX_OUTBURST ) /* Buffer underrun */ - return decode_audio_buffer(MAX_OUTBURST); - - if(xp_core.has_video) { - /* Match video buffer */ - vbuf_size = dae_get_decoder_outrun(xp_core.video); - pref_buf = vbuf_size / sh_video->fps * sh_audio->af_bps; - pref_buf -= len; - if( pref_buf > 0 ) { - len = min( pref_buf, free_buf ); - if( len > sh_audio->audio_out_minsize ) { - return decode_audio_buffer(len); - } - } - } else - return decode_audio_buffer(min(free_buf,MAX_OUTBURST)); - - return 0; -} - #define MIN_AUDIO_TIME 0.05 #define NOTHING_PLAYED (-1.0) #define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ @@ -760,6 +764,7 @@ any_t* audio_play_routine( any_t* arg ) { mpxp_thread_t* priv=arg; + sh_audio_t* sh_audio=priv->dae->sh; int eof = 0; struct timeval now; @@ -911,6 +916,7 @@ void dec_ahead_reset_sh_video(sh_video_t *shv) { + sh_video_t* sh_video=xp_core.video->sh; sh_video->vfilter = shv->vfilter; } Modified: mplayerxp/xmp_core.h =================================================================== --- mplayerxp/xmp_core.h 2012-10-29 09:40:53 UTC (rev 239) +++ mplayerxp/xmp_core.h 2012-10-29 10:29:04 UTC (rev 240) @@ -32,6 +32,7 @@ volatile unsigned decoder_idx; /* index of frame which is currently decoded */ unsigned nframes; /* number of frames in buffer */ frame_attr_t* fra; /* frame related attributes */ + any_t* sh; /* corresponded sh_audio_t or sh_video_t */ /* for statistics */ unsigned num_slow_frames;/* number of frames which were delayed due slow computer */ long long int num_played_frames; @@ -52,6 +53,7 @@ pid_t pid; mpxp_routine_t routine; sig_handler_t sigfunc; + dec_ahead_engine_t* dae; volatile enum mpxp_thread_state state; }mpxp_thread_t; @@ -60,6 +62,7 @@ int has_video; int has_audio; dec_ahead_engine_t* video; + dec_ahead_engine_t* audio; volatile int in_pause; volatile int in_resize; volatile int eof; @@ -80,7 +83,7 @@ /* returns idx of main thread */ extern unsigned xmp_register_main(sig_handler_t sigfunc); /* returns idx of the thread or UINT_MAX on fault */ -extern unsigned xmp_register_thread(sig_handler_t sigfunc,mpxp_routine_t routine,const char *name); +extern unsigned xmp_register_thread(dec_ahead_engine_t* dae,sig_handler_t sigfunc,mpxp_routine_t routine,const char *name); extern void xmp_stop_threads(int force); extern void xmp_halt_threads(int is_reset_vcache); @@ -94,7 +97,7 @@ extern int xmp_run_players( void ); extern void xmp_reset_sh_video(sh_video_t* shv); -extern void dae_init(dec_ahead_engine_t* it,unsigned nframes); +extern void dae_init(dec_ahead_engine_t* it,unsigned nframes,any_t* sh); extern void dae_uninit(dec_ahead_engine_t* it); extern void dae_reset(dec_ahead_engine_t* it); /* after mpxp_seek */ @@ -164,5 +167,4 @@ /* Audio stuff */ extern volatile float dec_ahead_audio_delay; -int xp_thread_decode_audio(); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-29 10:51:17
|
Revision: 241 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=241&view=rev Author: nickols_k Date: 2012-10-29 10:51:07 +0000 (Mon, 29 Oct 2012) Log Message: ----------- move uncommon stuff into osdep Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libvo/osd.c mplayerxp/libvo/video_out.c mplayerxp/mplayer.c mplayerxp/osdep/Makefile Added Paths: ----------- mplayerxp/osdep/my_malloc.c mplayerxp/osdep/my_malloc.h mplayerxp/osdep/my_profile.c mplayerxp/osdep/my_profile.h Removed Paths: ------------- mplayerxp/my_malloc.c mplayerxp/my_malloc.h mplayerxp/my_profile.c mplayerxp/my_profile.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-10-29 10:29:04 UTC (rev 240) +++ mplayerxp/Makefile 2012-10-29 10:51:07 UTC (rev 241) @@ -23,7 +23,7 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS_COMMON = cpudetect.c mp_msg.c my_profile.c my_malloc.c mp_image.c +SRCS_COMMON = cpudetect.c mp_msg.c mp_image.c SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c SRCS_MPLAYER+= xmp_core.c Modified: mplayerxp/libvo/osd.c =================================================================== --- mplayerxp/libvo/osd.c 2012-10-29 10:29:04 UTC (rev 240) +++ mplayerxp/libvo/osd.c 2012-10-29 10:51:07 UTC (rev 241) @@ -6,13 +6,14 @@ #include <stdio.h> #include <pthread.h> -#include "../mp_config.h" + +#include "mp_config.h" //#define ENABLE_PROFILE -#include "../my_profile.h" +#include "osdep/my_profile.h" #include <inttypes.h> -#include "../cpudetect.h" -#include "../mangle.h" -#include "../mplayer.h" +#include "cpudetect.h" +#include "mangle.h" +#include "mplayer.h" #include "osd.h" #include "vo_msg.h" Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-29 10:29:04 UTC (rev 240) +++ mplayerxp/libvo/video_out.c 2012-10-29 10:51:07 UTC (rev 241) @@ -33,7 +33,7 @@ #include "postproc/swscale.h" #include "postproc/vf.h" #include "xmp_core.h" -#include "my_malloc.h" +#include "osdep/my_malloc.h" #include "mplayer.h" #include "fastmemcpy.h" #include "img_format.h" Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-29 10:29:04 UTC (rev 240) +++ mplayerxp/mplayer.c 2012-10-29 10:51:07 UTC (rev 241) @@ -25,7 +25,7 @@ #include "mp_config.h" #include "sig_hand.h" #include "mplayer.h" -#include "my_malloc.h" +#include "osdep/my_malloc.h" #include "postproc/swscale.h" #include "postproc/af.h" #include "postproc/vf.h" Deleted: mplayerxp/my_malloc.c =================================================================== --- mplayerxp/my_malloc.c 2012-10-29 10:29:04 UTC (rev 240) +++ mplayerxp/my_malloc.c 2012-10-29 10:51:07 UTC (rev 241) @@ -1,120 +0,0 @@ -#include "my_malloc.h" - -#include <string.h> -#include <stdio.h> -#include <time.h> - -any_t*my_malloc(size_t __size) -{ - char *retval; - long msize,mval; - msize = __size; - retval = malloc(msize+2*sizeof(long)); - if(retval) - { - mval = (long)retval; - memcpy(retval,&msize,sizeof(long)); - memcpy(retval+msize+sizeof(long),&mval,sizeof(long)); - retval += sizeof(long); - } -// printf("malloc returns: %08X for size: %08X\n",retval,__size); - return retval; -} - -any_t*my_realloc(any_t*__ptr, size_t __size) -{ - char *retval,*myptr; - long crc,osize; - long msize,mval; - msize = __size; - myptr = __ptr; - if(__ptr) - { - memcpy(&osize,(char *)__ptr-sizeof(long),sizeof(long)); - memcpy(&crc,(char *)__ptr+osize,sizeof(long)); - if(crc != (long)((char *)__ptr-sizeof(long))) - { - printf("Internal error: my_realloc found out memory corruption!\n"); - printf("INFO: ptr=%p ptr[0]=%lX crc=%lX\n", - __ptr, - osize, - crc); -#ifdef __i386__ - __asm __volatile(".short 0xffff":::"memory"); -#endif - } - myptr -= sizeof(long); - } - retval = realloc(myptr,__size+2*sizeof(long)); - { - mval = (long)retval; - memcpy(retval,&msize,sizeof(long)); - memcpy(retval+__size+sizeof(long),&mval,sizeof(long)); - retval += sizeof(long); - } - return retval; -} - -any_t*my_calloc (size_t __nelem, size_t __size) -{ - char *retval; - long my_size; - long msize,mval; - msize = __nelem*__size; - retval = malloc(msize+2*sizeof(long)); - if(retval) - { - mval = (long)retval; - memset(retval+sizeof(long),0,msize); - memcpy(retval,&msize,sizeof(long)); - memcpy(retval+msize+sizeof(long),&mval,sizeof(long)); - retval += sizeof(long); - } - return retval; -} - -void my_free(any_t*__ptr) -{ - any_t*myptr; - long crc,osize; - if(__ptr) - { - myptr = (char *)__ptr-sizeof(long); - memcpy(&osize,(char *)myptr,sizeof(long)); - memcpy(&crc,(char *)myptr+osize+sizeof(long),sizeof(long)); - if(crc != (long)myptr) - { - printf("Internal error: my_free found out memory corruption!\n"); - printf("INFO: ptr=%p ptr[0]=%lX crc=%lX\n", - __ptr, - osize, - crc); -#ifdef __i386__ - __asm __volatile(".short 0xffff":::"memory"); -#endif - } - free((char *)__ptr-sizeof(long)); - } -} - -char * my_strdup(const char *s) -{ - any_t*a; - a = my_malloc(strlen(s)+1); - strcpy(a,s); - return a; -} - -any_t* random_malloc(size_t __size,unsigned rnd_limit) -{ - any_t* rb,*rnd_buff; - static int inited=0; - if(!inited) { - srand(time(NULL)); - inited=1; - } - rnd_buff=malloc(rand()%rnd_limit); - rb = malloc(__size); - free(rnd_buff); - return rb; -} Deleted: mplayerxp/my_malloc.h =================================================================== --- mplayerxp/my_malloc.h 2012-10-29 10:29:04 UTC (rev 240) +++ mplayerxp/my_malloc.h 2012-10-29 10:51:07 UTC (rev 241) @@ -1,33 +0,0 @@ -/* - This file contains functions for debugging purposes only! - They work with triplex - ptr,size,crc to control memory boundaries - at run-time. They are useful only when you have builded mplayerxp - with debug info (./configure --enable_debug[=3]). - To use them please add '#include "my_malloc.h"' at end of mp_config.h - manually. -*/ -#ifndef __MY_MALLOC_H -#define __MY_MALLOC_H 1 -#include "mp_config.h" - -#include <stdlib.h> - -//#define __ENABLE_MALLOC_DEBUG 1 -#ifdef __ENABLE_MALLOC_DEBUG -extern any_t*my_malloc(size_t __size); -extern any_t*my_realloc(any_t*__ptr, size_t __size); -extern any_t*my_calloc (size_t __nelem, size_t __size); -extern void my_free(any_t*__ptr); -extern char *my_strdup(const char *src); -#define strdup(a) my_strdup(a) -#define malloc(a) my_malloc(a) -#define memalign(a,b) my_malloc(b) -#define realloc(a,b) my_realloc(a,b) -#define calloc(a,b) my_calloc(a,b) -#define free(a) my_free(a) -#endif - -/* Pseudo-randomizing memory objects makes memory exploits harder */ -extern any_t* random_malloc(size_t __size,unsigned upper_rnd_limit); - -#endif Deleted: mplayerxp/my_profile.c =================================================================== --- mplayerxp/my_profile.c 2012-10-29 10:29:04 UTC (rev 240) +++ mplayerxp/my_profile.c 2012-10-29 10:51:07 UTC (rev 241) @@ -1,12 +0,0 @@ -/* - * my_profile.c - * - * Copyright (C) Nickols_K <nic...@ma...> - Oct 2001 - * - * You can redistribute this file under terms and conditions - * of GNU General Public licence v2. - */ - -#include "my_profile.h" - -volatile unsigned long long int my_profile_start,my_profile_end,my_profile_total; Deleted: mplayerxp/my_profile.h =================================================================== --- mplayerxp/my_profile.h 2012-10-29 10:29:04 UTC (rev 240) +++ mplayerxp/my_profile.h 2012-10-29 10:51:07 UTC (rev 241) @@ -1,31 +0,0 @@ -/* - * my_profile.h - * - * Copyright (C) Nickols_K <nic...@ma...> - Oct 2001 - * - * You can redistribute this file under terms and conditions - * of GNU General Public licence v2. - */ -#ifndef MY_PROFILE_INC -#define MY_PROFILE_INC - -extern volatile unsigned long long int my_profile_start,my_profile_end,my_profile_total; - -#if defined ( ENABLE_PROFILE ) && (defined ( ARCH_X86 ) || defined( ARCH_X86_64 )) -static inline unsigned long long int read_tsc( void ) -{ - unsigned long long int retval; - __asm __volatile ("rdtsc":"=A"(retval)::"memory"); - return retval; -} - -#define PROFILE_RESET() (my_profile_total=0ULL) -#define PROFILE_START() { static int inited=0; if(!inited) { inited=1; my_profile_total=0ULL; } my_profile_start=read_tsc(); } -#define PROFILE_END(your_message) { my_profile_end=read_tsc(); my_profile_total+=(my_profile_end-my_profile_start); printf(your_message" current=%llu total=%llu\n\t",(my_profile_end-my_profile_start),my_profile_total); } -#else -#define PROFILE_RESET() -#define PROFILE_START() -#define PROFILE_END(your_message) -#endif - -#endif Modified: mplayerxp/osdep/Makefile =================================================================== --- mplayerxp/osdep/Makefile 2012-10-29 10:29:04 UTC (rev 240) +++ mplayerxp/osdep/Makefile 2012-10-29 10:51:07 UTC (rev 241) @@ -3,7 +3,7 @@ LIBNAME = libosdep.a -SRCS=getch2.c timer-lx.c timer.c shmem.c get_path.c +SRCS=getch2.c timer-lx.c timer.c shmem.c get_path.c my_malloc.c my_profile.c OBJS=$(SRCS:.c=.o) ifeq ($(TARGET_OS),LINUX_GNU) Copied: mplayerxp/osdep/my_malloc.c (from rev 229, mplayerxp/my_malloc.c) =================================================================== --- mplayerxp/osdep/my_malloc.c (rev 0) +++ mplayerxp/osdep/my_malloc.c 2012-10-29 10:51:07 UTC (rev 241) @@ -0,0 +1,120 @@ +#include "my_malloc.h" + +#include <string.h> +#include <stdio.h> +#include <time.h> + +any_t*my_malloc(size_t __size) +{ + char *retval; + long msize,mval; + msize = __size; + retval = malloc(msize+2*sizeof(long)); + if(retval) + { + mval = (long)retval; + memcpy(retval,&msize,sizeof(long)); + memcpy(retval+msize+sizeof(long),&mval,sizeof(long)); + retval += sizeof(long); + } +// printf("malloc returns: %08X for size: %08X\n",retval,__size); + return retval; +} + +any_t*my_realloc(any_t*__ptr, size_t __size) +{ + char *retval,*myptr; + long crc,osize; + long msize,mval; + msize = __size; + myptr = __ptr; + if(__ptr) + { + memcpy(&osize,(char *)__ptr-sizeof(long),sizeof(long)); + memcpy(&crc,(char *)__ptr+osize,sizeof(long)); + if(crc != (long)((char *)__ptr-sizeof(long))) + { + printf("Internal error: my_realloc found out memory corruption!\n"); + printf("INFO: ptr=%p ptr[0]=%lX crc=%lX\n", + __ptr, + osize, + crc); +#ifdef __i386__ + __asm __volatile(".short 0xffff":::"memory"); +#endif + } + myptr -= sizeof(long); + } + retval = realloc(myptr,__size+2*sizeof(long)); + { + mval = (long)retval; + memcpy(retval,&msize,sizeof(long)); + memcpy(retval+__size+sizeof(long),&mval,sizeof(long)); + retval += sizeof(long); + } + return retval; +} + +any_t*my_calloc (size_t __nelem, size_t __size) +{ + char *retval; + long my_size; + long msize,mval; + msize = __nelem*__size; + retval = malloc(msize+2*sizeof(long)); + if(retval) + { + mval = (long)retval; + memset(retval+sizeof(long),0,msize); + memcpy(retval,&msize,sizeof(long)); + memcpy(retval+msize+sizeof(long),&mval,sizeof(long)); + retval += sizeof(long); + } + return retval; +} + +void my_free(any_t*__ptr) +{ + any_t*myptr; + long crc,osize; + if(__ptr) + { + myptr = (char *)__ptr-sizeof(long); + memcpy(&osize,(char *)myptr,sizeof(long)); + memcpy(&crc,(char *)myptr+osize+sizeof(long),sizeof(long)); + if(crc != (long)myptr) + { + printf("Internal error: my_free found out memory corruption!\n"); + printf("INFO: ptr=%p ptr[0]=%lX crc=%lX\n", + __ptr, + osize, + crc); +#ifdef __i386__ + __asm __volatile(".short 0xffff":::"memory"); +#endif + } + free((char *)__ptr-sizeof(long)); + } +} + +char * my_strdup(const char *s) +{ + any_t*a; + a = my_malloc(strlen(s)+1); + strcpy(a,s); + return a; +} + +any_t* random_malloc(size_t __size,unsigned rnd_limit) +{ + any_t* rb,*rnd_buff; + static int inited=0; + if(!inited) { + srand(time(NULL)); + inited=1; + } + rnd_buff=malloc(rand()%rnd_limit); + rb = malloc(__size); + free(rnd_buff); + return rb; +} Copied: mplayerxp/osdep/my_malloc.h (from rev 229, mplayerxp/my_malloc.h) =================================================================== --- mplayerxp/osdep/my_malloc.h (rev 0) +++ mplayerxp/osdep/my_malloc.h 2012-10-29 10:51:07 UTC (rev 241) @@ -0,0 +1,33 @@ +/* + This file contains functions for debugging purposes only! + They work with triplex - ptr,size,crc to control memory boundaries + at run-time. They are useful only when you have builded mplayerxp + with debug info (./configure --enable_debug[=3]). + To use them please add '#include "my_malloc.h"' at end of mp_config.h + manually. +*/ +#ifndef __MY_MALLOC_H +#define __MY_MALLOC_H 1 +#include "mp_config.h" + +#include <stdlib.h> + +//#define __ENABLE_MALLOC_DEBUG 1 +#ifdef __ENABLE_MALLOC_DEBUG +extern any_t*my_malloc(size_t __size); +extern any_t*my_realloc(any_t*__ptr, size_t __size); +extern any_t*my_calloc (size_t __nelem, size_t __size); +extern void my_free(any_t*__ptr); +extern char *my_strdup(const char *src); +#define strdup(a) my_strdup(a) +#define malloc(a) my_malloc(a) +#define memalign(a,b) my_malloc(b) +#define realloc(a,b) my_realloc(a,b) +#define calloc(a,b) my_calloc(a,b) +#define free(a) my_free(a) +#endif + +/* Pseudo-randomizing memory objects makes memory exploits harder */ +extern any_t* random_malloc(size_t __size,unsigned upper_rnd_limit); + +#endif Copied: mplayerxp/osdep/my_profile.c (from rev 229, mplayerxp/my_profile.c) =================================================================== --- mplayerxp/osdep/my_profile.c (rev 0) +++ mplayerxp/osdep/my_profile.c 2012-10-29 10:51:07 UTC (rev 241) @@ -0,0 +1,12 @@ +/* + * my_profile.c + * + * Copyright (C) Nickols_K <nic...@ma...> - Oct 2001 + * + * You can redistribute this file under terms and conditions + * of GNU General Public licence v2. + */ + +#include "my_profile.h" + +volatile unsigned long long int my_profile_start,my_profile_end,my_profile_total; Copied: mplayerxp/osdep/my_profile.h (from rev 229, mplayerxp/my_profile.h) =================================================================== --- mplayerxp/osdep/my_profile.h (rev 0) +++ mplayerxp/osdep/my_profile.h 2012-10-29 10:51:07 UTC (rev 241) @@ -0,0 +1,31 @@ +/* + * my_profile.h + * + * Copyright (C) Nickols_K <nic...@ma...> - Oct 2001 + * + * You can redistribute this file under terms and conditions + * of GNU General Public licence v2. + */ +#ifndef MY_PROFILE_INC +#define MY_PROFILE_INC + +extern volatile unsigned long long int my_profile_start,my_profile_end,my_profile_total; + +#if defined ( ENABLE_PROFILE ) && (defined ( ARCH_X86 ) || defined( ARCH_X86_64 )) +static inline unsigned long long int read_tsc( void ) +{ + unsigned long long int retval; + __asm __volatile ("rdtsc":"=A"(retval)::"memory"); + return retval; +} + +#define PROFILE_RESET() (my_profile_total=0ULL) +#define PROFILE_START() { static int inited=0; if(!inited) { inited=1; my_profile_total=0ULL; } my_profile_start=read_tsc(); } +#define PROFILE_END(your_message) { my_profile_end=read_tsc(); my_profile_total+=(my_profile_end-my_profile_start); printf(your_message" current=%llu total=%llu\n\t",(my_profile_end-my_profile_start),my_profile_total); } +#else +#define PROFILE_RESET() +#define PROFILE_START() +#define PROFILE_END(your_message) +#endif + +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-29 10:56:30
|
Revision: 242 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=242&view=rev Author: nickols_k Date: 2012-10-29 10:56:23 +0000 (Mon, 29 Oct 2012) Log Message: ----------- remove unused stuff Modified Paths: -------------- mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.c Removed Paths: ------------- mplayerxp/mmx.h mplayerxp/mmx_defs.h Modified: mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.c =================================================================== --- mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.c 2012-10-29 10:51:07 UTC (rev 241) +++ mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.c 2012-10-29 10:56:23 UTC (rev 242) @@ -29,10 +29,6 @@ #include "config.h" #include "RTjpegN.h" -#ifdef CAN_COMPILE_MMX -#include "mmx.h" -#endif - //#define SHOWBLOCK 1 #define BETTERCOMPRESSION 1 Deleted: mplayerxp/mmx.h =================================================================== --- mplayerxp/mmx.h 2012-10-29 10:51:07 UTC (rev 241) +++ mplayerxp/mmx.h 2012-10-29 10:56:23 UTC (rev 242) @@ -1,706 +0,0 @@ -/* mmx.h - - MultiMedia eXtensions GCC interface library for IA32. - - To use this library, simply include this header file - and compile with GCC. You MUST have inlining enabled - in order for mmx_ok() to work; this can be done by - simply using -O on the GCC command line. - - Compiling with -DMMX_TRACE will cause detailed trace - output to be sent to stderr for each mmx operation. - This adds lots of code, and obviously slows execution to - a crawl, but can be very useful for debugging. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT - LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR ANY PARTICULAR PURPOSE. - - 1997-99 by H. Dietz and R. Fisher - - Notes: - It appears that the latest gas has the pand problem fixed, therefore - I'll undefine BROKEN_PAND by default. -*/ - -#ifndef _MMX_H -#define _MMX_H - - -/* Warning: at this writing, the version of GAS packaged - with most Linux distributions does not handle the - parallel AND operation mnemonic correctly. If the - symbol BROKEN_PAND is defined, a slower alternative - coding will be used. If execution of mmxtest results - in an illegal instruction fault, define this symbol. -*/ -#undef BROKEN_PAND -#include "cpudetect.h" - -/* The type of an value that fits in an MMX register - (note that long long constant values MUST be suffixed - by LL and unsigned long long values by ULL, lest - they be truncated by the compiler) -*/ -typedef union { - long long q; /* Quadword (64-bit) value */ - unsigned long long uq; /* Unsigned Quadword */ - int d[2]; /* 2 Doubleword (32-bit) values */ - unsigned int ud[2]; /* 2 Unsigned Doubleword */ - short w[4]; /* 4 Word (16-bit) values */ - unsigned short uw[4]; /* 4 Unsigned Word */ - char b[8]; /* 8 Byte (8-bit) values */ - unsigned char ub[8]; /* 8 Unsigned Byte */ - float s[2]; /* Single-precision (32-bit) value */ -} __attribute__ ((aligned (8))) mmx_t; /* On an 8-byte (64-bit) boundary */ - - - -/* Function to test if multimedia instructions are supported... -*/ -inline extern int -mm_support(void) -{ - /* Returns 1 if MMX instructions are supported, - 3 if Cyrix MMX and Extended MMX instructions are supported - 5 if AMD MMX and 3DNow! instructions are supported - 0 if hardware does not support any of these - */ - register int rval = 0; - - __asm__ __volatile__ ( - /* See if CPUID instruction is supported ... */ - /* ... Get copies of EFLAGS into "REG_a" and "REG_c" */ - "pushf\n\t" - "popl %%"REG_a"\n\t" - "movl %%"REG_a", %%"REG_c"\n\t" - - /* ... Toggle the ID bit in one copy and store */ - /* to the EFLAGS reg */ - "xorl $0x200000, %%"REG_a"\n\t" - "push %%"REG_a"\n\t" - "popf\n\t" - - /* ... Get the (hopefully modified) EFLAGS */ - "pushf\n\t" - "popl %%"REG_a"\n\t" - - /* ... Compare and test result */ - "xorl %%"REG_a", %%"REG_c"\n\t" - "testl $0x200000, %%"REG_c"\n\t" - "jz NotSupported1\n\t" /* CPUID not supported */ - - - /* Get standard CPUID information, and - go to a specific vendor section */ - "movl $0, %%"REG_a"\n\t" - "cpuid\n\t" - - /* Check for Intel */ - "cmpl $0x756e6547, %%"REG_b"\n\t" - "jne TryAMD\n\t" - "cmpl $0x49656e69, %%"REG_d"\n\t" - "jne TryAMD\n\t" - "cmpl $0x6c65746e, %%"REG_c"\n" - "jne TryAMD\n\t" - "jmp Intel\n\t" - - /* Check for AMD */ - "\nTryAMD:\n\t" - "cmpl $0x68747541, %%"REG_b"\n\t" - "jne TryCyrix\n\t" - "cmpl $0x69746e65, %%"REG_d"\n\t" - "jne TryCyrix\n\t" - "cmpl $0x444d4163, %%"REG_c"\n" - "jne TryCyrix\n\t" - "jmp AMD\n\t" - - /* Check for Cyrix */ - "\nTryCyrix:\n\t" - "cmpl $0x69727943, %%"REG_b"\n\t" - "jne NotSupported2\n\t" - "cmpl $0x736e4978, %%"REG_d"\n\t" - "jne NotSupported3\n\t" - "cmpl $0x64616574, %%"REG_c"\n\t" - "jne NotSupported4\n\t" - /* Drop through to Cyrix... */ - - - /* Cyrix Section */ - /* See if extended CPUID level 80000001 is supported */ - /* The value of CPUID/80000001 for the 6x86MX is undefined - according to the Cyrix CPU Detection Guide (Preliminary - Rev. 1.01 table 1), so we'll check the value of "REG_a" for - CPUID/0 to see if standard CPUID level 2 is supported. - According to the table, the only CPU which supports level - 2 is also the only one which supports extended CPUID levels. - */ - "cmpl $0x2, %%"REG_a"\n\t" - "jne MMXtest\n\t" /* Use standard CPUID instead */ - - /* Extended CPUID supported (in theory), so get extended - features */ - "movl $0x80000001, %%"REG_a"\n\t" - "cpuid\n\t" - "testl $0x00800000, %%"REG_a"\n\t" /* Test for MMX */ - "jz NotSupported5\n\t" /* MMX not supported */ - "testl $0x01000000, %%"REG_a"\n\t" /* Test for Ext'd MMX */ - "jnz EMMXSupported\n\t" - "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\n" - "EMMXSupported:\n\t" - "movl $3, %0:\n\n\t" /* EMMX and MMX Supported */ - "jmp Return\n\t" - - - /* AMD Section */ - "AMD:\n\t" - - /* See if extended CPUID is supported */ - "movl $0x80000000, %%"REG_a"\n\t" - "cpuid\n\t" - "cmpl $0x80000000, %%"REG_a"\n\t" - "jl MMXtest\n\t" /* Use standard CPUID instead */ - - /* Extended CPUID supported, so get extended features */ - "movl $0x80000001, %%"REG_a"\n\t" - "cpuid\n\t" - "testl $0x00800000, %%"REG_d"\n\t" /* Test for MMX */ - "jz NotSupported6\n\t" /* MMX not supported */ - "testl $0x80000000, %%"REG_d"\n\t" /* Test for 3DNow! */ - "jnz ThreeDNowSupported\n\t" - "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\n" - "ThreeDNowSupported:\n\t" - "movl $5, %0:\n\n\t" /* 3DNow! and MMX Supported */ - "jmp Return\n\t" - - - /* Intel Section */ - "Intel:\n\t" - - /* Check for MMX */ - "MMXtest:\n\t" - "movl $1, %%"REG_a"\n\t" - "cpuid\n\t" - "testl $0x00800000, %%"REG_d"\n\t" /* Test for MMX */ - "jz NotSupported7\n\t" /* MMX Not supported */ - "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\t" - - /* Nothing supported */ - "\nNotSupported1:\n\t" - "#movl $101, %0:\n\n\t" - "\nNotSupported2:\n\t" - "#movl $102, %0:\n\n\t" - "\nNotSupported3:\n\t" - "#movl $103, %0:\n\n\t" - "\nNotSupported4:\n\t" - "#movl $104, %0:\n\n\t" - "\nNotSupported5:\n\t" - "#movl $105, %0:\n\n\t" - "\nNotSupported6:\n\t" - "#movl $106, %0:\n\n\t" - "\nNotSupported7:\n\t" - "#movl $107, %0:\n\n\t" - "movl $0, %0:\n\n\t" - - "Return:\n\t" - : "=a" (rval) - : /* no input */ - : REG_a, REG_b, REG_c, REG_d, "cc" - ); - - /* Return */ - return(rval); -} - -/* Function to test if mmx instructions are supported... -*/ -inline extern int -mmx_ok(void) -{ - /* Returns 1 if MMX instructions are supported, 0 otherwise */ - return ( mm_support() & 0x1 ); -} - - -/* Helper functions for the instruction macros that follow... - (note that memory-to-register, m2r, instructions are nearly - as efficient as register-to-register, r2r, instructions; - however, memory-to-memory instructions are really simulated - as a convenience, and are only 1/3 as efficient) -*/ -#ifdef MMX_TRACE - -/* Include the stuff for printing a trace to stderr... -*/ - -#include <stdio.h> - -#define mmx_i2r(op, imm, reg) \ - { \ - mmx_t mmx_trace; \ - mmx_trace.uq = (imm); \ - printf(#op "_i2r(" #imm "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (imm)); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_m2r(op, mem, reg) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (mem); \ - printf(#op "_m2r(" #mem "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (mem)); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_r2m(op, reg, mem) \ - { \ - mmx_t mmx_trace; \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#op "_r2m(" #reg "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - mmx_trace = (mem); \ - printf(#mem "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=X" (mem) \ - : /* nothing */ ); \ - mmx_trace = (mem); \ - printf(#mem "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_r2r(op, regs, regd) \ - { \ - mmx_t mmx_trace; \ - __asm__ __volatile__ ("movq %%" #regs ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#op "_r2r(" #regs "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #regd ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#regd "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd); \ - __asm__ __volatile__ ("movq %%" #regd ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#regd "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_m2m(op, mems, memd) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (mems); \ - printf(#op "_m2m(" #mems "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - mmx_trace = (memd); \ - printf(#memd "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ - #op " %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)); \ - mmx_trace = (memd); \ - printf(#memd "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#else - -/* These macros are a lot simpler without the tracing... -*/ - -#define mmx_i2r(op, imm, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (imm) ) - -#define mmx_m2r(op, mem, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (mem)) - -#define mmx_r2m(op, reg, mem) \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=X" (mem) \ - : /* nothing */ ) - -#define mmx_r2r(op, regs, regd) \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd) - -#define mmx_m2m(op, mems, memd) \ - __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ - #op " %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)) - -#endif - - -/* 1x64 MOVe Quadword - (this is both a load and a store... - in fact, it is the only way to store) -*/ -#define movq_m2r(var, reg) mmx_m2r(movq, var, reg) -#define movq_r2m(reg, var) mmx_r2m(movq, reg, var) -#define movq_r2r(regs, regd) mmx_r2r(movq, regs, regd) -#define movq(vars, vard) \ - __asm__ __volatile__ ("movq %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (vard) \ - : "X" (vars)) - - -/* 1x32 MOVe Doubleword - (like movq, this is both load and store... - but is most useful for moving things between - mmx registers and ordinary registers) -*/ -#define movd_m2r(var, reg) mmx_m2r(movd, var, reg) -#define movd_r2m(reg, var) mmx_r2m(movd, reg, var) -#define movd_r2r(regs, regd) mmx_r2r(movd, regs, regd) -#define movd(vars, vard) \ - __asm__ __volatile__ ("movd %1, %%mm0\n\t" \ - "movd %%mm0, %0" \ - : "=X" (vard) \ - : "X" (vars)) - - -/* 2x32, 4x16, and 8x8 Parallel ADDs -*/ -#define paddd_m2r(var, reg) mmx_m2r(paddd, var, reg) -#define paddd_r2r(regs, regd) mmx_r2r(paddd, regs, regd) -#define paddd(vars, vard) mmx_m2m(paddd, vars, vard) - -#define paddw_m2r(var, reg) mmx_m2r(paddw, var, reg) -#define paddw_r2r(regs, regd) mmx_r2r(paddw, regs, regd) -#define paddw(vars, vard) mmx_m2m(paddw, vars, vard) - -#define paddb_m2r(var, reg) mmx_m2r(paddb, var, reg) -#define paddb_r2r(regs, regd) mmx_r2r(paddb, regs, regd) -#define paddb(vars, vard) mmx_m2m(paddb, vars, vard) - - -/* 4x16 and 8x8 Parallel ADDs using Saturation arithmetic -*/ -#define paddsw_m2r(var, reg) mmx_m2r(paddsw, var, reg) -#define paddsw_r2r(regs, regd) mmx_r2r(paddsw, regs, regd) -#define paddsw(vars, vard) mmx_m2m(paddsw, vars, vard) - -#define paddsb_m2r(var, reg) mmx_m2r(paddsb, var, reg) -#define paddsb_r2r(regs, regd) mmx_r2r(paddsb, regs, regd) -#define paddsb(vars, vard) mmx_m2m(paddsb, vars, vard) - - -/* 4x16 and 8x8 Parallel ADDs using Unsigned Saturation arithmetic -*/ -#define paddusw_m2r(var, reg) mmx_m2r(paddusw, var, reg) -#define paddusw_r2r(regs, regd) mmx_r2r(paddusw, regs, regd) -#define paddusw(vars, vard) mmx_m2m(paddusw, vars, vard) - -#define paddusb_m2r(var, reg) mmx_m2r(paddusb, var, reg) -#define paddusb_r2r(regs, regd) mmx_r2r(paddusb, regs, regd) -#define paddusb(vars, vard) mmx_m2m(paddusb, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel SUBs -*/ -#define psubd_m2r(var, reg) mmx_m2r(psubd, var, reg) -#define psubd_r2r(regs, regd) mmx_r2r(psubd, regs, regd) -#define psubd(vars, vard) mmx_m2m(psubd, vars, vard) - -#define psubw_m2r(var, reg) mmx_m2r(psubw, var, reg) -#define psubw_r2r(regs, regd) mmx_r2r(psubw, regs, regd) -#define psubw(vars, vard) mmx_m2m(psubw, vars, vard) - -#define psubb_m2r(var, reg) mmx_m2r(psubb, var, reg) -#define psubb_r2r(regs, regd) mmx_r2r(psubb, regs, regd) -#define psubb(vars, vard) mmx_m2m(psubb, vars, vard) - - -/* 4x16 and 8x8 Parallel SUBs using Saturation arithmetic -*/ -#define psubsw_m2r(var, reg) mmx_m2r(psubsw, var, reg) -#define psubsw_r2r(regs, regd) mmx_r2r(psubsw, regs, regd) -#define psubsw(vars, vard) mmx_m2m(psubsw, vars, vard) - -#define psubsb_m2r(var, reg) mmx_m2r(psubsb, var, reg) -#define psubsb_r2r(regs, regd) mmx_r2r(psubsb, regs, regd) -#define psubsb(vars, vard) mmx_m2m(psubsb, vars, vard) - - -/* 4x16 and 8x8 Parallel SUBs using Unsigned Saturation arithmetic -*/ -#define psubusw_m2r(var, reg) mmx_m2r(psubusw, var, reg) -#define psubusw_r2r(regs, regd) mmx_r2r(psubusw, regs, regd) -#define psubusw(vars, vard) mmx_m2m(psubusw, vars, vard) - -#define psubusb_m2r(var, reg) mmx_m2r(psubusb, var, reg) -#define psubusb_r2r(regs, regd) mmx_r2r(psubusb, regs, regd) -#define psubusb(vars, vard) mmx_m2m(psubusb, vars, vard) - - -/* 4x16 Parallel MULs giving Low 4x16 portions of results -*/ -#define pmullw_m2r(var, reg) mmx_m2r(pmullw, var, reg) -#define pmullw_r2r(regs, regd) mmx_r2r(pmullw, regs, regd) -#define pmullw(vars, vard) mmx_m2m(pmullw, vars, vard) - - -/* 4x16 Parallel MULs giving High 4x16 portions of results -*/ -#define pmulhw_m2r(var, reg) mmx_m2r(pmulhw, var, reg) -#define pmulhw_r2r(regs, regd) mmx_r2r(pmulhw, regs, regd) -#define pmulhw(vars, vard) mmx_m2m(pmulhw, vars, vard) - - -/* 4x16->2x32 Parallel Mul-ADD - (muls like pmullw, then adds adjacent 16-bit fields - in the multiply result to make the final 2x32 result) -*/ -#define pmaddwd_m2r(var, reg) mmx_m2r(pmaddwd, var, reg) -#define pmaddwd_r2r(regs, regd) mmx_r2r(pmaddwd, regs, regd) -#define pmaddwd(vars, vard) mmx_m2m(pmaddwd, vars, vard) - - -/* 1x64 bitwise AND -*/ -#ifdef BROKEN_PAND -#define pand_m2r(var, reg) \ - { \ - mmx_m2r(pandn, (mmx_t) -1LL, reg); \ - mmx_m2r(pandn, var, reg); \ - } -#define pand_r2r(regs, regd) \ - { \ - mmx_m2r(pandn, (mmx_t) -1LL, regd); \ - mmx_r2r(pandn, regs, regd) \ - } -#define pand(vars, vard) \ - { \ - movq_m2r(vard, mm0); \ - mmx_m2r(pandn, (mmx_t) -1LL, mm0); \ - mmx_m2r(pandn, vars, mm0); \ - movq_r2m(mm0, vard); \ - } -#else -#define pand_m2r(var, reg) mmx_m2r(pand, var, reg) -#define pand_r2r(regs, regd) mmx_r2r(pand, regs, regd) -#define pand(vars, vard) mmx_m2m(pand, vars, vard) -#endif - - -/* 1x64 bitwise AND with Not the destination -*/ -#define pandn_m2r(var, reg) mmx_m2r(pandn, var, reg) -#define pandn_r2r(regs, regd) mmx_r2r(pandn, regs, regd) -#define pandn(vars, vard) mmx_m2m(pandn, vars, vard) - - -/* 1x64 bitwise OR -*/ -#define por_m2r(var, reg) mmx_m2r(por, var, reg) -#define por_r2r(regs, regd) mmx_r2r(por, regs, regd) -#define por(vars, vard) mmx_m2m(por, vars, vard) - - -/* 1x64 bitwise eXclusive OR -*/ -#define pxor_m2r(var, reg) mmx_m2r(pxor, var, reg) -#define pxor_r2r(regs, regd) mmx_r2r(pxor, regs, regd) -#define pxor(vars, vard) mmx_m2m(pxor, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel CoMPare for EQuality - (resulting fields are either 0 or -1) -*/ -#define pcmpeqd_m2r(var, reg) mmx_m2r(pcmpeqd, var, reg) -#define pcmpeqd_r2r(regs, regd) mmx_r2r(pcmpeqd, regs, regd) -#define pcmpeqd(vars, vard) mmx_m2m(pcmpeqd, vars, vard) - -#define pcmpeqw_m2r(var, reg) mmx_m2r(pcmpeqw, var, reg) -#define pcmpeqw_r2r(regs, regd) mmx_r2r(pcmpeqw, regs, regd) -#define pcmpeqw(vars, vard) mmx_m2m(pcmpeqw, vars, vard) - -#define pcmpeqb_m2r(var, reg) mmx_m2r(pcmpeqb, var, reg) -#define pcmpeqb_r2r(regs, regd) mmx_r2r(pcmpeqb, regs, regd) -#define pcmpeqb(vars, vard) mmx_m2m(pcmpeqb, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel CoMPare for Greater Than - (resulting fields are either 0 or -1) -*/ -#define pcmpgtd_m2r(var, reg) mmx_m2r(pcmpgtd, var, reg) -#define pcmpgtd_r2r(regs, regd) mmx_r2r(pcmpgtd, regs, regd) -#define pcmpgtd(vars, vard) mmx_m2m(pcmpgtd, vars, vard) - -#define pcmpgtw_m2r(var, reg) mmx_m2r(pcmpgtw, var, reg) -#define pcmpgtw_r2r(regs, regd) mmx_r2r(pcmpgtw, regs, regd) -#define pcmpgtw(vars, vard) mmx_m2m(pcmpgtw, vars, vard) - -#define pcmpgtb_m2r(var, reg) mmx_m2r(pcmpgtb, var, reg) -#define pcmpgtb_r2r(regs, regd) mmx_r2r(pcmpgtb, regs, regd) -#define pcmpgtb(vars, vard) mmx_m2m(pcmpgtb, vars, vard) - - -/* 1x64, 2x32, and 4x16 Parallel Shift Left Logical -*/ -#define psllq_i2r(imm, reg) mmx_i2r(psllq, imm, reg) -#define psllq_m2r(var, reg) mmx_m2r(psllq, var, reg) -#define psllq_r2r(regs, regd) mmx_r2r(psllq, regs, regd) -#define psllq(vars, vard) mmx_m2m(psllq, vars, vard) - -#define pslld_i2r(imm, reg) mmx_i2r(pslld, imm, reg) -#define pslld_m2r(var, reg) mmx_m2r(pslld, var, reg) -#define pslld_r2r(regs, regd) mmx_r2r(pslld, regs, regd) -#define pslld(vars, vard) mmx_m2m(pslld, vars, vard) - -#define psllw_i2r(imm, reg) mmx_i2r(psllw, imm, reg) -#define psllw_m2r(var, reg) mmx_m2r(psllw, var, reg) -#define psllw_r2r(regs, regd) mmx_r2r(psllw, regs, regd) -#define psllw(vars, vard) mmx_m2m(psllw, vars, vard) - - -/* 1x64, 2x32, and 4x16 Parallel Shift Right Logical -*/ -#define psrlq_i2r(imm, reg) mmx_i2r(psrlq, imm, reg) -#define psrlq_m2r(var, reg) mmx_m2r(psrlq, var, reg) -#define psrlq_r2r(regs, regd) mmx_r2r(psrlq, regs, regd) -#define psrlq(vars, vard) mmx_m2m(psrlq, vars, vard) - -#define psrld_i2r(imm, reg) mmx_i2r(psrld, imm, reg) -#define psrld_m2r(var, reg) mmx_m2r(psrld, var, reg) -#define psrld_r2r(regs, regd) mmx_r2r(psrld, regs, regd) -#define psrld(vars, vard) mmx_m2m(psrld, vars, vard) - -#define psrlw_i2r(imm, reg) mmx_i2r(psrlw, imm, reg) -#define psrlw_m2r(var, reg) mmx_m2r(psrlw, var, reg) -#define psrlw_r2r(regs, regd) mmx_r2r(psrlw, regs, regd) -#define psrlw(vars, vard) mmx_m2m(psrlw, vars, vard) - - -/* 2x32 and 4x16 Parallel Shift Right Arithmetic -*/ -#define psrad_i2r(imm, reg) mmx_i2r(psrad, imm, reg) -#define psrad_m2r(var, reg) mmx_m2r(psrad, var, reg) -#define psrad_r2r(regs, regd) mmx_r2r(psrad, regs, regd) -#define psrad(vars, vard) mmx_m2m(psrad, vars, vard) - -#define psraw_i2r(imm, reg) mmx_i2r(psraw, imm, reg) -#define psraw_m2r(var, reg) mmx_m2r(psraw, var, reg) -#define psraw_r2r(regs, regd) mmx_r2r(psraw, regs, regd) -#define psraw(vars, vard) mmx_m2m(psraw, vars, vard) - - -/* 2x32->4x16 and 4x16->8x8 PACK and Signed Saturate - (packs source and dest fields into dest in that order) -*/ -#define packssdw_m2r(var, reg) mmx_m2r(packssdw, var, reg) -#define packssdw_r2r(regs, regd) mmx_r2r(packssdw, regs, regd) -#define packssdw(vars, vard) mmx_m2m(packssdw, vars, vard) - -#define packsswb_m2r(var, reg) mmx_m2r(packsswb, var, reg) -#define packsswb_r2r(regs, regd) mmx_r2r(packsswb, regs, regd) -#define packsswb(vars, vard) mmx_m2m(packsswb, vars, vard) - - -/* 4x16->8x8 PACK and Unsigned Saturate - (packs source and dest fields into dest in that order) -*/ -#define packuswb_m2r(var, reg) mmx_m2r(packuswb, var, reg) -#define packuswb_r2r(regs, regd) mmx_r2r(packuswb, regs, regd) -#define packuswb(vars, vard) mmx_m2m(packuswb, vars, vard) - - -/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK Low - (interleaves low half of dest with low half of source - as padding in each result field) -*/ -#define punpckldq_m2r(var, reg) mmx_m2r(punpckldq, var, reg) -#define punpckldq_r2r(regs, regd) mmx_r2r(punpckldq, regs, regd) -#define punpckldq(vars, vard) mmx_m2m(punpckldq, vars, vard) - -#define punpcklwd_m2r(var, reg) mmx_m2r(punpcklwd, var, reg) -#define punpcklwd_r2r(regs, regd) mmx_r2r(punpcklwd, regs, regd) -#define punpcklwd(vars, vard) mmx_m2m(punpcklwd, vars, vard) - -#define punpcklbw_m2r(var, reg) mmx_m2r(punpcklbw, var, reg) -#define punpcklbw_r2r(regs, regd) mmx_r2r(punpcklbw, regs, regd) -#define punpcklbw(vars, vard) mmx_m2m(punpcklbw, vars, vard) - - -/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK High - (interleaves high half of dest with high half of source - as padding in each result field) -*/ -#define punpckhdq_m2r(var, reg) mmx_m2r(punpckhdq, var, reg) -#define punpckhdq_r2r(regs, regd) mmx_r2r(punpckhdq, regs, regd) -#define punpckhdq(vars, vard) mmx_m2m(punpckhdq, vars, vard) - -#define punpckhwd_m2r(var, reg) mmx_m2r(punpckhwd, var, reg) -#define punpckhwd_r2r(regs, regd) mmx_r2r(punpckhwd, regs, regd) -#define punpckhwd(vars, vard) mmx_m2m(punpckhwd, vars, vard) - -#define punpckhbw_m2r(var, reg) mmx_m2r(punpckhbw, var, reg) -#define punpckhbw_r2r(regs, regd) mmx_r2r(punpckhbw, regs, regd) -#define punpckhbw(vars, vard) mmx_m2m(punpckhbw, vars, vard) - - -/* Empty MMx State - (used to clean-up when going from mmx to float use - of the registers that are shared by both; note that - there is no float-to-mmx operation needed, because - only the float tag word info is corruptible) -*/ -#ifdef MMX_TRACE - -#define emms() \ - { \ - printf("emms()\n"); \ - __asm__ __volatile__ ("emms"); \ - } - -#else - -#define emms() __asm__ __volatile__ ("emms") - -#endif - -#endif - Deleted: mplayerxp/mmx_defs.h =================================================================== --- mplayerxp/mmx_defs.h 2012-10-29 10:51:07 UTC (rev 241) +++ mplayerxp/mmx_defs.h 2012-10-29 10:56:23 UTC (rev 242) @@ -1,61 +0,0 @@ -/* - This file contains most common definitions to make MMX stuff - easy portable between different kinds of mmx clones - Written By Nickols_K <nic...@ma...> -*/ - -#undef HAVE_MMX1 -#if defined(HAVE_MMX) && !defined(HAVE_MMX2) && !defined(HAVE_3DNOW) && !defined(HAVE_SSE) -/* means: mmx v.1. Note: Since we added alignment of destinition it speedups - of memory copying on PentMMX, Celeron-1 and P2 upto 12% versus - standard (non MMX-optimized) version. - Note: on K6-2+ it speedups memory copying upto 25% and - on K7 and P3 about 500% (5 times). */ -#define HAVE_MMX1 -#endif - -#undef HAVE_K6_2PLUS -#if !defined( HAVE_MMX2 ) && defined( HAVE_3DNOW ) -#define HAVE_K6_2PLUS -#endif - -#undef MMREG_SIZE -#if defined(HAVE_SSE2) || defined (HAVE_SSE) -#define MMREG_SIZE 16 -#else -#define MMREG_SIZE 8 -#endif - -#undef PREFETCH -#undef PREFETCHW -#undef PAVGB -#ifdef HAVE_3DNOW -#define PREFETCH "prefetch" -#define PREFETCHW "prefetchw" -#define PAVGB "pavgusb" -#elif defined ( HAVE_MMX2 ) -#define PREFETCH "prefetchnta" -#define PREFETCHW "prefetcht0" -#define PAVGB "pavgb" -#else -#define PREFETCH "/nop" -#define PREFETCHW "/nop" -#endif - -#undef EMMS -#ifdef HAVE_3DNOW -/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */ -#define EMMS "femms" -#else -#define EMMS "emms" -#endif - -#undef MOVNTQ -#undef SFENCE -#ifdef HAVE_MMX2 -#define MOVNTQ "movntq" -#define SFENCE "sfence" -#else -#define MOVNTQ "movq" -#define SFENCE "/nop" -#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-29 12:54:09
|
Revision: 247 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=247&view=rev Author: nickols_k Date: 2012-10-29 12:54:02 +0000 (Mon, 29 Oct 2012) Log Message: ----------- cleanups Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/xmp_core.c mplayerxp/xmp_core.h Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-29 12:47:00 UTC (rev 246) +++ mplayerxp/mplayer.c 2012-10-29 12:54:02 UTC (rev 247) @@ -114,7 +114,6 @@ **************************************************************************/ #include "xmp_core.h" -volatile unsigned xp_drop_frame_cnt=0; float xp_screen_pts; ao_data_t* ao_data=NULL; @@ -1502,7 +1501,7 @@ 100.0*tot/total_time_usage); unsigned nframes=xp_core.video->num_played_frames; MSG_INFO("\nREAL RESULTS: from %u was dropped=%u\n" - ,nframes,xp_drop_frame_cnt); + ,nframes,xp_core.video->num_dropped_frames); MSG_INFO("\nMax. A-V resync is: %f\n",fabs(priv->max_av_resync)); } @@ -1981,7 +1980,7 @@ if(sh_video) MSG_OK("Using DECODING AHEAD mplayer's core with %u video buffers\n",xp_core.num_v_buffs); else MSG_OK("Using DECODING AHEAD mplayer's core with %u audio buffers\n",xp_core.num_a_buffs); /* reset counters */ - xp_drop_frame_cnt=0; + xp_core.video->num_dropped_frames=0; } static void mpxp_print_audio_status(void) { Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-29 12:47:00 UTC (rev 246) +++ mplayerxp/xmp_core.c 2012-10-29 12:54:02 UTC (rev 247) @@ -176,26 +176,16 @@ pthread_mutex_t audio_decode_mutex=PTHREAD_MUTEX_INITIALIZER; pthread_cond_t audio_decode_cond=PTHREAD_COND_INITIALIZER; -extern volatile int xp_drop_frame; -extern volatile unsigned xp_drop_frame_cnt; - extern volatile float xp_screen_pts; volatile int dec_ahead_can_aseek=0; /* It is safe to seek audio */ volatile int dec_ahead_can_adseek=1; /* It is safe to seek audio buffer thread */ -/* Support for '-loop' option */ -extern int loop_times; /* it's const for xp mode */ - -extern float rel_seek_secs; /* FIXME: in hope that user will not rewind */ -extern int sof_seek_pos; /* the movie at end of file :( */ - extern int decore_audio( int xp_id ); - extern void update_osd( float v_pts ); /* To let audio decoder thread sleep as long as player */ -struct timespec audio_play_timeout; -int audio_play_in_sleep=0; +static struct timespec audio_play_timeout; +static int audio_play_in_sleep=0; extern int init_audio_buffer(int size, int min_reserv, int indices, sh_audio_t *sh_audio); extern void uninit_audio_buffer(void); @@ -451,7 +441,7 @@ if(mp_data->output_quality) { if(drop_param) mpcv_set_quality(sh_video,mp_data->output_quality); } - if(!blit_frame && drop_param) xp_drop_frame_cnt++; + if(!blit_frame && drop_param) priv->dae->num_dropped_frames++; if(blit_frame) { unsigned idx=dae_curr_vdecoded(); if(xp_is_bad_pts) Modified: mplayerxp/xmp_core.h =================================================================== --- mplayerxp/xmp_core.h 2012-10-29 12:47:00 UTC (rev 246) +++ mplayerxp/xmp_core.h 2012-10-29 12:54:02 UTC (rev 247) @@ -38,6 +38,7 @@ unsigned num_slow_frames;/* number of frames which were delayed due slow computer */ long long int num_played_frames; long long int num_decoded_frames; /* for frame dropping */ + long long int num_dropped_frames; }dec_ahead_engine_t; #define MAX_MPXP_THREADS 16 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-29 15:54:21
|
Revision: 251 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=251&view=rev Author: nickols_k Date: 2012-10-29 15:54:02 +0000 (Mon, 29 Oct 2012) Log Message: ----------- use random malloc everywhere Modified Paths: -------------- mplayerxp/dump.c mplayerxp/fifo.c mplayerxp/fifo.h mplayerxp/input/input.c mplayerxp/input/input.h mplayerxp/input/lirc.c mplayerxp/libao2/ao_alsa9.c mplayerxp/libao2/ao_arts.c mplayerxp/libao2/ao_esd.c mplayerxp/libao2/ao_jack.c mplayerxp/libao2/ao_nas.c mplayerxp/libao2/ao_null.c mplayerxp/libao2/ao_openal.c mplayerxp/libao2/ao_oss.c mplayerxp/libao2/ao_sdl.c mplayerxp/libao2/ao_wav.c mplayerxp/libao2/audio_out.c mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_acm.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_dmo.c mplayerxp/libmpcodecs/ad_dshow.c mplayerxp/libmpcodecs/ad_faad.c mplayerxp/libmpcodecs/ad_ffmp3.c mplayerxp/libmpcodecs/ad_hwac3.c mplayerxp/libmpcodecs/ad_libdv.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/ad_real.c mplayerxp/libmpcodecs/ad_twin.c mplayerxp/libmpcodecs/ad_vorbis.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/liba52/a52.h mplayerxp/libmpcodecs/liba52/a52_internal.h mplayerxp/libmpcodecs/liba52/bit_allocate.c mplayerxp/libmpcodecs/liba52/bitstream.c mplayerxp/libmpcodecs/liba52/bitstream.h mplayerxp/libmpcodecs/liba52/crc.c mplayerxp/libmpcodecs/liba52/downmix.c mplayerxp/libmpcodecs/liba52/downmix_mmx.h mplayerxp/libmpcodecs/liba52/imdct.c mplayerxp/libmpcodecs/liba52/imdct_mmx.h mplayerxp/libmpcodecs/liba52/parse.c mplayerxp/libmpcodecs/liba52/tables.h mplayerxp/libmpcodecs/libdca/bitstream.c mplayerxp/libmpcodecs/libdca/bitstream.h mplayerxp/libmpcodecs/libdca/dca.h mplayerxp/libmpcodecs/libdca/dca_internal.h mplayerxp/libmpcodecs/libdca/downmix.c mplayerxp/libmpcodecs/libdca/parse.c mplayerxp/libmpcodecs/libdca/tables.h mplayerxp/libmpcodecs/libdca/tables_adpcm.h mplayerxp/libmpcodecs/libdca/tables_fir.h mplayerxp/libmpcodecs/libdca/tables_huffman.h mplayerxp/libmpcodecs/libdca/tables_quantization.h mplayerxp/libmpcodecs/libdca/tables_vq.h mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.c mplayerxp/libmpcodecs/libnuppelvideo/RTjpegN.h mplayerxp/libmpcodecs/libnuppelvideo/lzoconf.h mplayerxp/libmpcodecs/libnuppelvideo/minilzo.c mplayerxp/libmpcodecs/libnuppelvideo/minilzo.h mplayerxp/libmpcodecs/libnuppelvideo/nuppelvideo.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd_divx4.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_huffyuv.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_qtvideo.c mplayerxp/libmpcodecs/vd_real.c mplayerxp/libmpcodecs/vd_theora.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpcodecs/vd_xanim.c mplayerxp/libmpcodecs/vd_xvid.c mplayerxp/libmpconf/cfgparser.c mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpconf/codec-cfg.c mplayerxp/libmpconf/m_option.c mplayerxp/libmpconf/m_option.h mplayerxp/libmpconf/m_property.c mplayerxp/libmpconf/m_struct.c mplayerxp/libmpconf/subopt-helper.c mplayerxp/libmpconf/subopt-helper.h mplayerxp/libmpdemux/asf_mmst_streaming.c mplayerxp/libmpdemux/asf_streaming.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/cddb.c mplayerxp/libmpdemux/cookies.c mplayerxp/libmpdemux/demux_aiff.c mplayerxp/libmpdemux/demux_asf.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_bmp.c mplayerxp/libmpdemux/demux_demuxers.c mplayerxp/libmpdemux/demux_dv.c mplayerxp/libmpdemux/demux_film.c mplayerxp/libmpdemux/demux_fli.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mov.c mplayerxp/libmpdemux/demux_mpg.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_nsv.c mplayerxp/libmpdemux/demux_nuv.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_pva.c mplayerxp/libmpdemux/demux_ra.c mplayerxp/libmpdemux/demux_rawaudio.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_roq.c mplayerxp/libmpdemux/demux_smjpeg.c mplayerxp/libmpdemux/demux_ts.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/demux_viv.c mplayerxp/libmpdemux/demux_vqf.c mplayerxp/libmpdemux/demux_y4m.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/freesdp/common.c mplayerxp/libmpdemux/freesdp/common.h mplayerxp/libmpdemux/freesdp/errorlist.c mplayerxp/libmpdemux/freesdp/parser.c mplayerxp/libmpdemux/freesdp/parser.h mplayerxp/libmpdemux/freesdp/parserpriv.h mplayerxp/libmpdemux/freesdp/priv.h mplayerxp/libmpdemux/http.c mplayerxp/libmpdemux/librtsp/Makefile mplayerxp/libmpdemux/librtsp/rtsp.c mplayerxp/libmpdemux/librtsp/rtsp.h mplayerxp/libmpdemux/librtsp/rtsp_rtp.c mplayerxp/libmpdemux/librtsp/rtsp_rtp.h mplayerxp/libmpdemux/librtsp/rtsp_session.c mplayerxp/libmpdemux/librtsp/rtsp_session.h mplayerxp/libmpdemux/mpeg_hdr.c mplayerxp/libmpdemux/mrl.c mplayerxp/libmpdemux/mrl.h mplayerxp/libmpdemux/mux_lavf.c mplayerxp/libmpdemux/mux_mpxp64.c mplayerxp/libmpdemux/mux_raw.c mplayerxp/libmpdemux/muxer.c mplayerxp/libmpdemux/muxer.h mplayerxp/libmpdemux/network.c mplayerxp/libmpdemux/parse_mp4.c mplayerxp/libmpdemux/pnm.c mplayerxp/libmpdemux/pnm.h mplayerxp/libmpdemux/realrtsp/Makefile mplayerxp/libmpdemux/realrtsp/asmrp.c mplayerxp/libmpdemux/realrtsp/asmrp.h mplayerxp/libmpdemux/realrtsp/md5.c mplayerxp/libmpdemux/realrtsp/md5.h mplayerxp/libmpdemux/realrtsp/real.c mplayerxp/libmpdemux/realrtsp/real.h mplayerxp/libmpdemux/realrtsp/rmff.c mplayerxp/libmpdemux/realrtsp/rmff.h mplayerxp/libmpdemux/realrtsp/sdpplin.c mplayerxp/libmpdemux/realrtsp/sdpplin.h mplayerxp/libmpdemux/realrtsp/xbuffer.c mplayerxp/libmpdemux/s_cdd.c mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/s_dvdread.c mplayerxp/libmpdemux/s_ffmpeg.c mplayerxp/libmpdemux/s_file.c mplayerxp/libmpdemux/s_ftp.c mplayerxp/libmpdemux/s_network.c mplayerxp/libmpdemux/s_oss.c mplayerxp/libmpdemux/s_rtsp.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libmpdemux/s_vcdnav.c mplayerxp/libmpdemux/stream.c mplayerxp/libmpdemux/sub_cc.c mplayerxp/libmpdemux/sub_ty.c mplayerxp/libmpdemux/tcp.h mplayerxp/libmpdemux/tvi_bsdbt848.c mplayerxp/libmpdemux/tvi_def.h mplayerxp/libmpdemux/tvi_dummy.c mplayerxp/libmpdemux/tvi_v4l.c mplayerxp/libmpdemux/udp.c mplayerxp/libmpdemux/udp.h mplayerxp/libmpdemux/url.c mplayerxp/libmpdemux/video.c mplayerxp/libmpdemux/yuv4mpeg.c mplayerxp/libmpdemux/yuv4mpeg.h mplayerxp/libmpdemux/yuv4mpeg_intern.h mplayerxp/libmpdemux/yuv4mpeg_ratio.c mplayerxp/libmpsub/spudec.c mplayerxp/libmpsub/subreader.c mplayerxp/libmpsub/vobsub.c mplayerxp/libplaytree/asxparser.c mplayerxp/libplaytree/asxparser.h mplayerxp/libplaytree/playtree.c mplayerxp/libplaytree/playtree.h mplayerxp/libplaytree/playtreeparser.c mplayerxp/libvo/font_load.c mplayerxp/libvo/jpeg_enc.c mplayerxp/libvo/jpeg_enc.h mplayerxp/libvo/osd.c mplayerxp/libvo/screenshot.c mplayerxp/libvo/sub.c mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/vosub_vidix.c mplayerxp/libvo/x11_common.c mplayerxp/loader/afl.c mplayerxp/loader/dmo/DMO_AudioDecoder.c mplayerxp/loader/dmo/DMO_VideoDecoder.c mplayerxp/loader/dmo/buffer.c mplayerxp/loader/dmo/dmo.c mplayerxp/loader/driver.c mplayerxp/loader/dshow/DS_AudioDecoder.c mplayerxp/loader/dshow/DS_Filter.c mplayerxp/loader/dshow/DS_VideoDecoder.c mplayerxp/loader/dshow/allocator.c mplayerxp/loader/dshow/cmediasample.c mplayerxp/loader/dshow/inputpin.c mplayerxp/loader/dshow/mediatype.c mplayerxp/loader/dshow/outputpin.c mplayerxp/loader/dshow/test.c mplayerxp/loader/elfdll.c mplayerxp/loader/ext.c mplayerxp/loader/ldt_keeper.c mplayerxp/loader/mangle.h mplayerxp/loader/module.c mplayerxp/loader/pe_image.c mplayerxp/loader/registry.c mplayerxp/loader/vfl.c mplayerxp/loader/win32.c mplayerxp/mp_image.c mplayerxp/mp_msg.c mplayerxp/mplayer.c mplayerxp/nls/nls.h mplayerxp/nls/recode.c mplayerxp/osdep/Makefile mplayerxp/osdep/cpudetect.c mplayerxp/osdep/cpudetect.h mplayerxp/osdep/get_path.c mplayerxp/osdep/lrmi.c mplayerxp/osdep/lrmi.h mplayerxp/osdep/mangle.h mplayerxp/osdep/mm_accel.h mplayerxp/postproc/af.c mplayerxp/postproc/af_ao2.c mplayerxp/postproc/af_center.c mplayerxp/postproc/af_channels.c mplayerxp/postproc/af_comp.c mplayerxp/postproc/af_crystality.c mplayerxp/postproc/af_delay.c mplayerxp/postproc/af_dummy.c mplayerxp/postproc/af_dyn.c mplayerxp/postproc/af_echo3d.c mplayerxp/postproc/af_equalizer.c mplayerxp/postproc/af_export.c mplayerxp/postproc/af_extrastereo.c mplayerxp/postproc/af_ffenc.c mplayerxp/postproc/af_format.c mplayerxp/postproc/af_gate.c mplayerxp/postproc/af_hrtf.c mplayerxp/postproc/af_karaoke.c mplayerxp/postproc/af_lp.c mplayerxp/postproc/af_pan.c mplayerxp/postproc/af_raw.c mplayerxp/postproc/af_resample.c mplayerxp/postproc/af_scaletempo.c mplayerxp/postproc/af_sinesuppress.c mplayerxp/postproc/af_sub.c mplayerxp/postproc/af_surround.c mplayerxp/postproc/af_volnorm.c mplayerxp/postproc/af_volume.c mplayerxp/postproc/libmenu/Makefile mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/libmenu/menu_cmdlist.c mplayerxp/postproc/libmenu/menu_console.c mplayerxp/postproc/libmenu/menu_filesel.c mplayerxp/postproc/libmenu/menu_list.c mplayerxp/postproc/libmenu/menu_param.c mplayerxp/postproc/libmenu/menu_pt.c mplayerxp/postproc/libmenu/menu_txt.c mplayerxp/postproc/swscale.h mplayerxp/postproc/vf.c mplayerxp/postproc/vf_1bpp.c mplayerxp/postproc/vf_aspect.c mplayerxp/postproc/vf_delogo.c mplayerxp/postproc/vf_denoise3d.c mplayerxp/postproc/vf_dint.c mplayerxp/postproc/vf_down3dright.c mplayerxp/postproc/vf_eq.c mplayerxp/postproc/vf_expand.c mplayerxp/postproc/vf_flip.c mplayerxp/postproc/vf_format.c mplayerxp/postproc/vf_framestep.c mplayerxp/postproc/vf_il.c mplayerxp/postproc/vf_menu.c mplayerxp/postproc/vf_mirror.c mplayerxp/postproc/vf_noise.c mplayerxp/postproc/vf_ow.c mplayerxp/postproc/vf_palette.c mplayerxp/postproc/vf_panscan.c mplayerxp/postproc/vf_perspective.c mplayerxp/postproc/vf_pp.c mplayerxp/postproc/vf_raw.c mplayerxp/postproc/vf_rectangle.c mplayerxp/postproc/vf_rgb2bgr.c mplayerxp/postproc/vf_rotate.c mplayerxp/postproc/vf_scale.c mplayerxp/postproc/vf_smartblur.c mplayerxp/postproc/vf_softpulldown.c mplayerxp/postproc/vf_swapuv.c mplayerxp/postproc/vf_test.c mplayerxp/postproc/vf_unsharp.c mplayerxp/postproc/vf_vo.c mplayerxp/postproc/vf_yuvcsp.c mplayerxp/sig_hand.c mplayerxp/xmp_core.c Added Paths: ----------- mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.c mplayerxp/osdep/mplib.h Removed Paths: ------------- mplayerxp/osdep/my_malloc.c mplayerxp/osdep/my_malloc.h mplayerxp/osdep/my_profile.c mplayerxp/osdep/my_profile.h Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/dump.c 2012-10-29 15:54:02 UTC (rev 251) @@ -16,6 +16,7 @@ #include "mplayer.h" #include "libmpdemux/muxer.h" #include "libmpdemux/mrl.h" +#include "osdep/mplib.h" #define MSGT_CLASS MSGT_GLOBAL #include "__mp_msg.h" @@ -118,7 +119,7 @@ char stream_dump_name[1024]; /* TODO copy it from demuxer */ if(demuxer->priv) return; - demuxer->priv=malloc(sizeof(priv_t)); + demuxer->priv=mp_malloc(sizeof(priv_t)); priv_t*priv=demuxer->priv; memset(priv,0,sizeof(priv_t)); /* describe other useless dumps */ @@ -162,7 +163,7 @@ priv->m_audio->codec=0; if(!sha->wf) { - sha->wf=malloc(sizeof(WAVEFORMATEX)); + sha->wf=mp_malloc(sizeof(WAVEFORMATEX)); sha->wf->nBlockAlign = 1; //mux_a->h.dwSampleSize; sha->wf->wFormatTag = sha->wtag; sha->wf->nChannels = sha->channels; @@ -171,12 +172,12 @@ sha->wf->wBitsPerSample = 16; // FIXME sha->wf->cbSize=0; // FIXME for l3codeca.acm } - priv->m_audio->wf=malloc(sha->wf->cbSize+sizeof(WAVEFORMATEX)); + 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=realloc(priv->m_audio->wf,sha->wf->cbSize+sizeof(WAVEFORMATEX)); + 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; @@ -202,7 +203,7 @@ priv->m_video->h.dwSuggestedBufferSize=shv->video.dwSuggestedBufferSize; if(!shv->bih) { - shv->bih=malloc(sizeof(BITMAPINFOHEADER)); + shv->bih=mp_malloc(sizeof(BITMAPINFOHEADER)); shv->bih->biSize=sizeof(BITMAPINFOHEADER); shv->bih->biWidth=shv->src_w; shv->bih->biHeight=shv->src_h; @@ -211,7 +212,7 @@ shv->bih->biBitCount=24; // FIXME!!! shv->bih->biSizeImage=shv->bih->biWidth*shv->bih->biHeight*(shv->bih->biBitCount/8); } - priv->m_video->bih=malloc(shv->bih->biSize); + 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; @@ -285,7 +286,7 @@ fseeko(priv->mux_file,0,SEEK_SET); muxer_write_header(priv->muxer,demuxer); fclose(priv->mux_file); - free(demuxer->priv); + mp_free(demuxer->priv); demuxer->priv=NULL; } MSG_INFO(MSGTR_CoreDumped); Modified: mplayerxp/fifo.c =================================================================== --- mplayerxp/fifo.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/fifo.c 2012-10-29 15:54:02 UTC (rev 251) @@ -1,5 +1,6 @@ #include "mplayer.h" #include "fifo.h" +#include "osdep/mplib.h" #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) @@ -81,15 +82,15 @@ CBFifoBuffer *cb_fifo_alloc(unsigned int size) { - CBFifoBuffer *f= malloc(sizeof(CBFifoBuffer)); + CBFifoBuffer *f= mp_malloc(sizeof(CBFifoBuffer)); if(!f) return NULL; memset(f,0,sizeof(CBFifoBuffer)); - f->buffer = malloc(size); + f->buffer = mp_malloc(size); f->end = f->buffer + size; cb_fifo_reset(f); if (!f->buffer) - free(f); + mp_free(f); return f; } @@ -105,13 +106,21 @@ cb_fifo_generic_read(f, f2->buffer, len, NULL); f2->wptr += len; f2->wndx += len; - free(f->buffer); + mp_free(f->buffer); *f= *f2; - free(f2); + mp_free(f2); } return 0; } +void cb_fifo_free(CBFifoBuffer *f) +{ + if(f){ + mp_free(f->buffer); + mp_free(f); + } +} + int cb_fifo_generic_write(CBFifoBuffer *f, any_t*src, int size, int (*func)(any_t*, any_t*, int)) { int total = size; Modified: mplayerxp/fifo.h =================================================================== --- mplayerxp/fifo.h 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/fifo.h 2012-10-29 15:54:02 UTC (rev 251) @@ -35,15 +35,9 @@ /** * Frees an CBFifoBuffer. - * @param *f CBFifoBuffer to free + * @param *f CBFifoBuffer to mp_free */ -static inline void cb_fifo_free(CBFifoBuffer *f) -{ - if(f){ - free(f->buffer); - free(f); - } -} +void cb_fifo_free(CBFifoBuffer *f); /** * Resets the CBFifoBuffer to the state right after cb_fifo_alloc, in particular it is emptied. Modified: mplayerxp/input/input.c =================================================================== --- mplayerxp/input/input.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/input/input.c 2012-10-29 15:54:02 UTC (rev 251) @@ -22,6 +22,7 @@ #include "osdep/keycodes.h" #include "osdep/get_path.h" #include "osdep/timer.h" +#include "osdep/mplib.h" #include "libmpconf/cfgparser.h" #include "joystick.h" @@ -470,7 +471,7 @@ if(cmd_fds[i].close_func) cmd_fds[i].close_func(cmd_fds[i].fd); if(cmd_fds[i].buffer) - free(cmd_fds[i].buffer); + mp_free(cmd_fds[i].buffer); if(i + 1 < num_cmd_fd) memmove(&cmd_fds[i],&cmd_fds[i+1],(num_cmd_fd - i - 1)*sizeof(mp_input_fd_t)); @@ -546,9 +547,9 @@ cmd_def = &mp_cmds[i]; - cmd = (mp_cmd_t*)malloc(sizeof(mp_cmd_t)); + cmd = (mp_cmd_t*)mp_malloc(sizeof(mp_cmd_t)); cmd->id = cmd_def->id; - cmd->name = strdup(cmd_def->name); + cmd->name = mp_strdup(cmd_def->name); ptr = str; @@ -605,7 +606,7 @@ break; } else if(!e) e = ptr+strlen(ptr); l = e-start; - cmd->args[i].v.s = (char*)malloc((l+1)*sizeof(char)); + cmd->args[i].v.s = (char*)mp_malloc((l+1)*sizeof(char)); strncpy(cmd->args[i].v.s,start,l); cmd->args[i].v.s[l] = '\0'; ptr2 = start; @@ -632,7 +633,7 @@ for( ; i < MP_CMD_MAX_ARGS && cmd_def->args[i].type != -1 ; i++) { memcpy(&cmd->args[i],&cmd_def->args[i],sizeof(mp_cmd_arg_t)); if(cmd_def->args[i].type == MP_CMD_ARG_STRING && cmd_def->args[i].v.s != NULL) - cmd->args[i].v.s = strdup(cmd_def->args[i].v.s); + cmd->args[i].v.s = mp_strdup(cmd_def->args[i].v.s); } if(i < MP_CMD_MAX_ARGS) @@ -664,7 +665,7 @@ // Allocate the buffer if it dont exist if(!mp_fd->buffer) { - mp_fd->buffer = (char*)malloc(MP_CMD_MAX_SIZE*sizeof(char)); + mp_fd->buffer = (char*)mp_malloc(MP_CMD_MAX_SIZE*sizeof(char)); mp_fd->pos = 0; mp_fd->size = MP_CMD_MAX_SIZE; } @@ -718,7 +719,7 @@ // Not dropping : put the cmd in ret if( ! (mp_fd->flags & MP_FD_DROP)) { - (*ret) = (char*)malloc((l+1)*sizeof(char)); + (*ret) = (char*)mp_malloc((l+1)*sizeof(char)); strncpy((*ret),mp_fd->buffer,l); (*ret)[l] = '\0'; } else { // Remove the dropping flag @@ -757,7 +758,7 @@ void mp_input_add_cmd_filter(mp_input_cmd_filter func, any_t* ctx) { - mp_cmd_filter_t* filter = malloc(sizeof(mp_cmd_filter_t))/*, *prev*/; + mp_cmd_filter_t* filter = mp_malloc(sizeof(mp_cmd_filter_t))/*, *prev*/; filter->filter = func; filter->ctx = ctx; @@ -1089,7 +1090,7 @@ continue; } ret = mp_input_parse_cmd(cmd); - free(cmd); + mp_free(cmd); if(!ret) continue; last_loop = i; @@ -1129,7 +1130,7 @@ /** * \param peek_only when set, the returned command stays in the queue. - * Do not free the returned cmd whe you set this! + * Do not mp_free the returned cmd whe you set this! */ mp_cmd_t* mp_input_get_cmd(int time, int paused, int peek_only) { @@ -1169,13 +1170,13 @@ if ( !cmd ) return; if(cmd->name) - free(cmd->name); + mp_free(cmd->name); for(i=0; i < MP_CMD_MAX_ARGS && cmd->args[i].type != -1; i++) { if(cmd->args[i].type == MP_CMD_ARG_STRING && cmd->args[i].v.s != NULL) - free(cmd->args[i].v.s); + mp_free(cmd->args[i].v.s); } - free(cmd); + mp_free(cmd); } mp_cmd_t* @@ -1186,13 +1187,13 @@ assert(cmd != NULL); #endif - ret = (mp_cmd_t*)malloc(sizeof(mp_cmd_t)); + ret = (mp_cmd_t*)mp_malloc(sizeof(mp_cmd_t)); memcpy(ret,cmd,sizeof(mp_cmd_t)); if(cmd->name) - ret->name = strdup(cmd->name); + ret->name = mp_strdup(cmd->name); for(i = 0; i < MP_CMD_MAX_ARGS && cmd->args[i].type != -1; i++) { if(cmd->args[i].type == MP_CMD_ARG_STRING && cmd->args[i].v.s != NULL) - ret->args[i].v.s = strdup(cmd->args[i].v.s); + ret->args[i].v.s = mp_strdup(cmd->args[i].v.s); } return ret; @@ -1286,13 +1287,13 @@ } if(!bind) { - cmd_binds = (mp_cmd_bind_t*)realloc(cmd_binds,(i+2)*sizeof(mp_cmd_bind_t)); + cmd_binds = (mp_cmd_bind_t*)mp_realloc(cmd_binds,(i+2)*sizeof(mp_cmd_bind_t)); memset(&cmd_binds[i],0,2*sizeof(mp_cmd_bind_t)); bind = &cmd_binds[i]; } if(bind->cmd) - free(bind->cmd); - bind->cmd = strdup(cmd); + mp_free(bind->cmd); + bind->cmd = mp_strdup(cmd); memcpy(bind->input,keys,(MP_MAX_KEY_DOWN+1)*sizeof(int)); } @@ -1305,9 +1306,9 @@ return; for(i = 0; binds[i].cmd != NULL; i++) - free(binds[i].cmd); + mp_free(binds[i].cmd); - free(binds); + mp_free(binds); } Modified: mplayerxp/input/input.h =================================================================== --- mplayerxp/input/input.h 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/input/input.h 2012-10-29 15:54:02 UTC (rev 251) @@ -188,7 +188,7 @@ void mp_input_add_cmd_filter(mp_input_cmd_filter, any_t* ctx); -// After getting a command from mp_input_get_cmd you need to free it using this +// After getting a command from mp_input_get_cmd you need to mp_free it using this // function void mp_cmd_free(mp_cmd_t* cmd); Modified: mplayerxp/input/lirc.c =================================================================== --- mplayerxp/input/lirc.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/input/lirc.c 2012-10-29 15:54:02 UTC (rev 251) @@ -56,7 +56,7 @@ if(l > 0) memmove(cmd_buf,&cmd_buf[w],l+1); else { - free(cmd_buf); + mp_free(cmd_buf); cmd_buf = NULL; } return w; @@ -89,14 +89,14 @@ int l = strlen(c); if(l <= 0) continue; - cmd_buf = realloc(cmd_buf,cl+l+2); + cmd_buf = mp_realloc(cmd_buf,cl+l+2); memcpy(&cmd_buf[cl],c,l); cl += l+1; cmd_buf[cl-1] = '\n'; cmd_buf[cl] = '\0'; } - free(code); + mp_free(code); if(r < 0) return MP_INPUT_DEAD; @@ -110,7 +110,7 @@ void mp_input_lirc_close(int fd) { if(cmd_buf) { - free(cmd_buf); + mp_free(cmd_buf); cmd_buf = NULL; } lirc_freeconfig(lirc_config); Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/ao_alsa9.c 2012-10-29 15:54:02 UTC (rev 251) @@ -17,8 +17,8 @@ #include <string.h> #include <sys/poll.h> -#include "../mp_config.h" -#include "../mplayer.h" +#include "mp_config.h" +#include "mplayer.h" #define ALSA_PCM_NEW_HW_PARAMS_API #define ALSA_PCM_NEW_SW_PARAMS_API #include <alsa/asoundlib.h> @@ -27,7 +27,8 @@ #include "audio_out_internal.h" #include "afmt.h" #include "ao_msg.h" -#include "../libmpdemux/mrl.h" +#include "libmpdemux/mrl.h" +#include "osdep/mplib.h" static ao_info_t info = { @@ -319,7 +320,7 @@ char *alsa_port=NULL; char alsa_device[ALSA_DEVICE_SIZE]; UNUSED(flags); - ao->priv=malloc(sizeof(priv_t)); + ao->priv=mp_malloc(sizeof(priv_t)); priv_t*priv=ao->priv; memset(priv,0,sizeof(priv_t)); priv->first=1; @@ -632,21 +633,21 @@ priv_t*priv=ao->priv; if(!priv->handler) { MSG_ERR("alsa-uninit: no handler defined!\n"); - free(priv); + mp_free(priv); return; } if (!priv_conf.noblock) { if ((err = snd_pcm_drain(priv->handler)) < 0) { MSG_ERR("alsa-uninit: pcm drain error: %s\n", snd_strerror(err)); - free(priv); + mp_free(priv); return; } } if ((err = snd_pcm_close(priv->handler)) < 0) { MSG_ERR("alsa-uninit: pcm close error: %s\n", snd_strerror(err)); - free(priv); + mp_free(priv); return; } else { priv->handler = NULL; @@ -654,7 +655,7 @@ } snd_pcm_hw_params_free(priv->hwparams); snd_pcm_sw_params_free(priv->swparams); - free(priv); + mp_free(priv); } static void audio_pause(ao_data_t* ao) @@ -848,7 +849,7 @@ int count; count = snd_pcm_poll_descriptors_count (priv->handler); - ufds = malloc(sizeof(struct pollfd) * count); + ufds = mp_malloc(sizeof(struct pollfd) * count); snd_pcm_poll_descriptors(priv->handler, ufds, count); //first wait_for_poll @@ -929,7 +930,7 @@ if ((int)result < 0) result = 0; #ifdef USE_POLL - free(ufds); + mp_free(ufds); #endif return result; @@ -943,7 +944,7 @@ GET_SPACE_XRUN, GET_SPACE_UNDEFINED }space_status; -/* how many byes are free in the buffer */ +/* how many byes are mp_free in the buffer */ static unsigned get_space(ao_data_t* ao) { priv_t*priv=ao->priv; @@ -1001,7 +1002,7 @@ } if (e_status!=GET_SPACE_RUNNING) - MSG_V("alsa-space: free space = %i, status=%i, %i --\n", ret, st, e_status); + MSG_V("alsa-space: mp_free space = %i, status=%i, %i --\n", ret, st, e_status); snd_pcm_status_free(status); if (ret < 0) { Modified: mplayerxp/libao2/ao_arts.c =================================================================== --- mplayerxp/libao2/ao_arts.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/ao_arts.c 2012-10-29 15:54:02 UTC (rev 251) @@ -5,7 +5,7 @@ * * This file is part of MPlayer. * - * MPlayer is free software; you can redistribute it and/or modify + * MPlayer is mp_free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. @@ -30,7 +30,7 @@ #include "afmt.h" #include "ao_msg.h" -/* Feel free to experiment with the following values: */ +/* Feel mp_free to experiment with the following values: */ #define ARTS_PACKETS 10 /* Number of audio packets */ #define ARTS_PACKET_SIZE_LOG2 11 /* Log2 of audio packet size */ Modified: mplayerxp/libao2/ao_esd.c =================================================================== --- mplayerxp/libao2/ao_esd.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/ao_esd.c 2012-10-29 15:54:02 UTC (rev 251) @@ -5,7 +5,7 @@ * * This file is part of MPlayer. * - * MPlayer is free software; you can redistribute it and/or modify + * MPlayer is mp_free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. @@ -53,6 +53,7 @@ #include "postproc/af_format.h" #include "afmt.h" #include "ao_msg.h" +#include "osdep/mplib.h" #define ESD_RESAMPLES 0 @@ -162,7 +163,7 @@ */ static int init(ao_data_t* ao,unsigned flags) { - ao->priv=malloc(sizeof(priv_t)); + ao->priv=mp_malloc(sizeof(priv_t)); priv_t*priv=ao->priv; memset(priv,0,sizeof(priv_t)); priv->fd=priv->play_fd=-1; @@ -314,7 +315,7 @@ esd_close(priv->fd); priv->fd = -1; } - free(priv); + mp_free(priv); } @@ -453,7 +454,7 @@ if (!FD_ISSET(priv->play_fd, &wfds)) return 0; - /* try to fill 50% of the remaining "free" buffer space */ + /* try to fill 50% of the remaining "mp_free" buffer space */ space = (ESD_MAX_DELAY - current_delay) * ao->bps * 0.5f; /* round up to next multiple of ESD_BUF_SIZE */ Modified: mplayerxp/libao2/ao_jack.c =================================================================== --- mplayerxp/libao2/ao_jack.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/ao_jack.c 2012-10-29 15:54:02 UTC (rev 251) @@ -6,7 +6,7 @@ * * This file is part of MPlayer. * - * MPlayer is free software; you can redistribute it and/or modify + * MPlayer is mp_free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. @@ -33,8 +33,9 @@ #include "postproc/af_format.h" #include "afmt.h" #include "osdep/timer.h" +#include "osdep/mplib.h" -#include "../fifo.h" +#include "fifo.h" #include <jack/jack.h> #include "ao_msg.h" @@ -212,7 +213,7 @@ } #endif static int init(ao_data_t* ao,unsigned flags) { - ao->priv=malloc(sizeof(priv_t)); + ao->priv=mp_malloc(sizeof(priv_t)); priv_t*priv=ao->priv; memset(priv,0,sizeof(priv_t)); UNUSED(flags); @@ -250,7 +251,7 @@ goto err_out; } if (!client_name) { - client_name = malloc(40); + client_name = mp_malloc(40); sprintf(client_name, "MPlayerXP [%d]", getpid()); } if (!autostart) @@ -307,15 +308,15 @@ ao->bps = channels * rate * sizeof(float); ao->buffersize = CHUNK_SIZE * NUM_CHUNKS; ao->outburst = CHUNK_SIZE; - free(matching_ports); - free(port_name); - free(client_name); + mp_free(matching_ports); + mp_free(port_name); + mp_free(client_name); return 1; err_out: - free(matching_ports); - free(port_name); - free(client_name); + mp_free(matching_ports); + mp_free(port_name); + mp_free(client_name); if (priv->client) jack_client_close(priv->client); cb_fifo_free(priv->buffer); @@ -332,7 +333,7 @@ jack_client_close(priv->client); cb_fifo_free(priv->buffer); priv->buffer = NULL; - free(priv); + mp_free(priv); } /** Modified: mplayerxp/libao2/ao_nas.c =================================================================== --- mplayerxp/libao2/ao_nas.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/ao_nas.c 2012-10-29 15:54:02 UTC (rev 251) @@ -13,7 +13,7 @@ * * This file is part of MPlayer. * - * MPlayer is free software; you can redistribute it and/or modify + * MPlayer is mp_free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. @@ -58,6 +58,7 @@ #include "audio_out.h" #include "audio_out_internal.h" #include "postproc/af_format.h" +#include "osdep/mplib.h" #include "afmt.h" #include "ao_msg.h" @@ -415,7 +416,7 @@ static int init(ao_data_t* ao,unsigned flags) { - ao->priv=malloc(sizeof(priv_t)); + ao->priv=mp_malloc(sizeof(priv_t)); priv_t* priv=ao->priv; memset(priv, 0, sizeof(priv_t)); UNUSED(flags); @@ -452,9 +453,9 @@ ao->buffersize = buffer_size*3; priv->client_buffer_size = buffer_size*2; - priv->client_buffer = malloc(priv->client_buffer_size); + priv->client_buffer = mp_malloc(priv->client_buffer_size); priv->server_buffer_size = buffer_size; - priv->server_buffer = malloc(priv->server_buffer_size); + priv->server_buffer = mp_malloc(priv->server_buffer_size); if (!bytes_per_sample) { MSG_ERR("ao_nas: init(): Zero bytes per sample -> nosound\n"); @@ -531,9 +532,9 @@ pthread_join(priv->event_thread, NULL); AuCloseServer(priv->aud); priv->aud = 0; - free(priv->client_buffer); - free(priv->server_buffer); - free(priv); + mp_free(priv->client_buffer); + mp_free(priv->server_buffer); + mp_free(priv); } // stop playing and empty buffers (for seeking/pause) Modified: mplayerxp/libao2/ao_null.c =================================================================== --- mplayerxp/libao2/ao_null.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/ao_null.c 2012-10-29 15:54:02 UTC (rev 251) @@ -7,6 +7,7 @@ #include "mp_config.h" #include "osdep/bswap.h" +#include "osdep/mplib.h" #include "libmpdemux/mrl.h" #include "afmt.h" @@ -106,7 +107,7 @@ // open & setup audio device // return: 1=success 0=fail static int __FASTCALL__ init(ao_data_t* ao,unsigned flags){ - ao->priv=malloc(sizeof(priv_t)); + ao->priv=mp_malloc(sizeof(priv_t)); priv_t*priv = (priv_t*)ao->priv; memset(priv,0,sizeof(priv_t)); char *null_dev=NULL,*mode=NULL; @@ -186,7 +187,7 @@ fwrite(&wavhdr,sizeof(wavhdr),1,priv->fd); } if(priv->fd) fclose(priv->fd); - free(priv); + mp_free(priv); } // stop playing and empty priv->buffers (for seeking/pause) Modified: mplayerxp/libao2/ao_openal.c =================================================================== --- mplayerxp/libao2/ao_openal.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/ao_openal.c 2012-10-29 15:54:02 UTC (rev 251) @@ -5,7 +5,7 @@ * * This file is part of MPlayer. * - * MPlayer is free software; you can redistribute it and/or modify + * MPlayer is mp_free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. @@ -34,7 +34,7 @@ #include "postproc/af_format.h" #include "afmt.h" #include "osdep/timer.h" -//#include "subopt-helper.h" +#include "osdep/mplib.h" #include "ao_msg.h" static const ao_info_t info = @@ -93,7 +93,7 @@ #endif static int init(ao_data_t* ao,unsigned flags) { - ao->priv=malloc(sizeof(priv_t)); + ao->priv=mp_malloc(sizeof(priv_t)); priv_t*priv=ao->priv; memset(priv,0,sizeof(priv_t)); UNUSED(flags); @@ -157,7 +157,7 @@ ao->bps = channels * rate * 2; ao->buffersize = CHUNK_SIZE * NUM_BUF; ao->outburst = channels * CHUNK_SIZE; - priv->tmpbuf = malloc(CHUNK_SIZE); + priv->tmpbuf = mp_malloc(CHUNK_SIZE); return 1; err_out: @@ -170,7 +170,7 @@ ALCcontext *ctx = alcGetCurrentContext(); ALCdevice *dev = alcGetContextsDevice(ctx); priv_t*priv=ao->priv; - free(priv->tmpbuf); + mp_free(priv->tmpbuf); if (!immed) { ALint state; alGetSourcei(priv->sources[0], AL_SOURCE_STATE, &state); @@ -183,7 +183,7 @@ alcMakeContextCurrent(NULL); alcDestroyContext(ctx); alcCloseDevice(dev); - free(ao->priv); + mp_free(ao->priv); } static void unqueue_buffers(ao_data_t* ao) { Modified: mplayerxp/libao2/ao_oss.c =================================================================== --- mplayerxp/libao2/ao_oss.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/ao_oss.c 2012-10-29 15:54:02 UTC (rev 251) @@ -10,8 +10,9 @@ #include <errno.h> #include <string.h> -#include "../mp_config.h" -#include "../mixer.h" +#include "mp_config.h" +#include "mixer.h" +#include "osdep/mplib.h" #include "afmt.h" #include "audio_out.h" @@ -198,7 +199,7 @@ static int __FASTCALL__ init(ao_data_t* ao,unsigned flags){ char *mixer_channels [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; UNUSED(flags); - ao->priv=malloc(sizeof(priv_t)); + ao->priv=mp_malloc(sizeof(priv_t)); priv_t*priv=ao->priv; memset(priv,0,sizeof(priv_t)); priv->dsp=PATH_DEV_DSP; @@ -309,7 +310,7 @@ MSG_V("OSS-CONF: %d bytes/frag (GETBLKSIZE)\n",ao->outburst); } } else { - MSG_V("OSS-CONF: frags: %3d/%d (%d bytes/frag) free: %6d\n", + MSG_V("OSS-CONF: frags: %3d/%d (%d bytes/frag) mp_free: %6d\n", priv->zz.fragments, priv->zz.fragstotal, priv->zz.fragsize, priv->zz.bytes); if(ao->buffersize==0) ao->buffersize=priv->zz.bytes; ao->outburst=priv->zz.fragsize; @@ -320,7 +321,7 @@ any_t* data; ao->buffersize=0; #ifdef HAVE_AUDIO_SELECT - data=malloc(ao->outburst); memset(data,0,ao->outburst); + data=mp_malloc(ao->outburst); memset(data,0,ao->outburst); while(ao->buffersize<0x40000){ fd_set rfds; struct timeval tv; @@ -330,7 +331,7 @@ write(priv->fd,data,ao->outburst); ao->buffersize+=ao->outburst; } - free(data); + mp_free(data); if(ao->buffersize==0){ MSG_ERR("\n *** OSS-CONF: Your audio driver DOES NOT support select() ***\n" "Recompile mplayerxp with #undef HAVE_AUDIO_SELECT in mp_config.h !\n\n"); @@ -358,7 +359,7 @@ #endif close(priv->fd); priv->fd = -1; - free(ao->priv); + mp_free(ao->priv); } // stop playing and empty buffers (for seeking/pause) Modified: mplayerxp/libao2/ao_sdl.c =================================================================== --- mplayerxp/libao2/ao_sdl.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/ao_sdl.c 2012-10-29 15:54:02 UTC (rev 251) @@ -18,6 +18,7 @@ #include "afmt.h" #include <SDL/SDL.h> #include "osdep/fastmemcpy.h" +#include "osdep/mplib.h" #include "ao_msg.h" static ao_info_t info = @@ -98,7 +99,7 @@ static void setenv(const char *name, const char *val, int _xx) { int len = strlen(name) + strlen(val) + 2; - char *env = malloc(len); + char *env = mp_malloc(len); if (env != NULL) { strcpy(env, name); @@ -147,12 +148,12 @@ { unsigned i; UNUSED(flags); - ao->priv=malloc(sizeof(priv_t)); + ao->priv=mp_malloc(sizeof(priv_t)); memset(ao->priv,0,sizeof(priv_t)); priv_t*priv=ao->priv; priv->volume=127; /* Allocate ring-priv->buffer memory */ - for(i=0;i<NUM_BUFS;i++) priv->buffer[i]=(unsigned char *) malloc(BUFFSIZE); + for(i=0;i<NUM_BUFS;i++) priv->buffer[i]=(unsigned char *) mp_malloc(BUFFSIZE); if(ao->subdevice) { setenv("SDL_AUDIODRIVER", ao->subdevice, 1); @@ -276,7 +277,7 @@ MSG_V("SDL: Audio Subsystem shutting down!\n"); SDL_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); - free(ao->priv); + mp_free(ao->priv); } // stop playing and empty buffers (for seeking/pause) Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/ao_wav.c 2012-10-29 15:54:02 UTC (rev 251) @@ -3,7 +3,7 @@ * * This file is part of MPlayerXP. * - * MPlayer is free software; you can redistribute it and/or modify + * MPlayer is mp_free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. @@ -31,6 +31,7 @@ #include "audio_out.h" #include "audio_out_internal.h" #include "libvo/video_out.h" +#include "osdep/mplib.h" #include "help_mp.h" #include "ao_msg.h" @@ -98,7 +99,7 @@ static int init(ao_data_t* ao,unsigned flags) { // set defaults UNUSED(flags); - ao->priv=malloc(sizeof(priv_t)); + ao->priv=mp_malloc(sizeof(priv_t)); priv_t* priv=ao->priv; memset(priv,0,sizeof(priv_t)); priv->pcm_waveheader=1; @@ -111,7 +112,7 @@ char str[256]; if(ao->subdevice) priv->out_filename = ao->subdevice; - else priv->out_filename = strdup("mpxp_adump.wav"); + else priv->out_filename = mp_strdup("mpxp_adump.wav"); bits=8; switch(format){ @@ -196,8 +197,8 @@ } fclose(priv->fp); if (priv->out_filename) - free(priv->out_filename); - free(priv); + mp_free(priv->out_filename); + mp_free(priv); } // stop playing and empty buffers (for seeking/pause) Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libao2/audio_out.c 2012-10-29 15:54:02 UTC (rev 251) @@ -2,7 +2,8 @@ #include <string.h> #include <stdlib.h> -#include "../mp_config.h" +#include "mp_config.h" +#include "osdep/mplib.h" #include "audio_out.h" #include "afmt.h" #include "ao_msg.h" @@ -206,14 +207,14 @@ { ao_data_t* ao; int retval; - ao=malloc(sizeof(ao_data_t)); + ao=mp_malloc(sizeof(ao_data_t)); memset(ao,0,sizeof(ao_data_t)); - if(subdevice) ao->subdevice=strdup(subdevice); + if(subdevice) ao->subdevice=mp_strdup(subdevice); ao->outburst=OUTBURST; ao->buffersize=-1; retval = audio_out->init(ao,flags); if(retval) return ao; - free(ao); + mp_free(ao); return NULL; } @@ -227,8 +228,8 @@ void ao_uninit(ao_data_t*ao) { audio_out->uninit(ao); - if(ao->subdevice) free(ao->subdevice); - free(ao); + if(ao->subdevice) mp_free(ao->subdevice); + mp_free(ao); ao=NULL; } Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-10-29 15:54:02 UTC (rev 251) @@ -26,6 +26,7 @@ uint32_t mpxp_a52_flags=0; #include "osdep/bswap.h" +#include "osdep/mplib.h" static const ad_info_t info = { @@ -128,7 +129,7 @@ } sh->audio_out_minsize=audio_output_channels*sh->samplesize*256*6; sh->audio_in_minsize=MAX_AC3_FRAME; - sh->context=malloc(sizeof(a52_priv_t)); + sh->context=mp_malloc(sizeof(a52_priv_t)); return 1; } @@ -190,7 +191,7 @@ void uninit(sh_audio_t *sh) { - free(sh->context); + mp_free(sh->context); } int control(sh_audio_t *sh,int cmd,any_t* arg, ...) Modified: mplayerxp/libmpcodecs/ad_acm.c =================================================================== --- mplayerxp/libmpcodecs/ad_acm.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_acm.c 2012-10-29 15:54:02 UTC (rev 251) @@ -7,7 +7,8 @@ #include "ad_internal.h" #include "codecs_ld.h" #include "loader/wineacm.h" -#include "../libmpdemux/aviprint.h" +#include "libmpdemux/aviprint.h" +#include "osdep/mplib.h" #include "help_mp.h" static const ad_info_t info = @@ -50,7 +51,7 @@ priv->o_wf.cbSize=0; if(!in_fmt) { - in_fmt=sh_audio->wf=malloc(sizeof(WAVEFORMATEX)); + in_fmt=sh_audio->wf=mp_malloc(sizeof(WAVEFORMATEX)); memcpy(in_fmt,&priv->o_wf,sizeof(WAVEFORMATEX)); in_fmt->wFormatTag=sh_audio->wtag; } @@ -94,7 +95,7 @@ sh_audio->samplerate=priv->o_wf.nSamplesPerSec; sh_audio->samplesize=(priv->o_wf.wBitsPerSample+7)/8; sh_audio->a_in_buffer_size=2*sh_audio->audio_in_minsize; - sh_audio->a_in_buffer=malloc(sh_audio->a_in_buffer_size); + sh_audio->a_in_buffer=mp_malloc(sh_audio->a_in_buffer_size); sh_audio->a_in_buffer_len=0; return 1; @@ -142,7 +143,7 @@ { /* Win32 ACM audio codec: */ acm_priv_t *priv; - if(!(sh_audio->context=malloc(sizeof(acm_priv_t)))) return 0; + if(!(sh_audio->context=mp_malloc(sizeof(acm_priv_t)))) return 0; priv=sh_audio->context; if(!init_acm_audio_codec(sh_audio)){ MSG_ERR(MSGTR_ACMiniterror); @@ -155,7 +156,7 @@ void uninit(sh_audio_t *sh) { close_acm_audio_codec(sh); - free(sh->context); + mp_free(sh->context); } int control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_dca.c 2012-10-29 15:54:02 UTC (rev 251) @@ -18,6 +18,7 @@ #include "libao2/afmt.h" #include "libao2/audio_out.h" #include "postproc/af.h" +#include "osdep/mplib.h" #define MAX_AC5_FRAME 4096 @@ -128,7 +129,7 @@ } sh->audio_out_minsize=audio_output_channels*sh->samplesize*256*8; sh->audio_in_minsize=MAX_AC5_FRAME; - sh->context=malloc(sizeof(dca_priv_t)); + sh->context=mp_malloc(sizeof(dca_priv_t)); return 1; } @@ -189,7 +190,7 @@ void uninit(sh_audio_t *sh) { - free(sh->context); + mp_free(sh->context); } int control(sh_audio_t *sh,int cmd,any_t* arg, ...) Modified: mplayerxp/libmpcodecs/ad_dmo.c =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_dmo.c 2012-10-29 15:54:02 UTC (rev 251) @@ -7,6 +7,7 @@ #include "mp_config.h" #include "help_mp.h" +#include "osdep/mplib.h" #include "ad_internal.h" #include "ad_msg.h" @@ -46,12 +47,12 @@ dmo_priv_t*priv; int chans=(audio_output_channels==sh_audio->wf->nChannels) ? audio_output_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1); - if(!(sh_audio->context=malloc(sizeof(dmo_priv_t)))) return 0; + if(!(sh_audio->context=mp_malloc(sizeof(dmo_priv_t)))) return 0; priv=sh_audio->context; if(!(priv->ds_adec=DMO_AudioDecoder_Open(sh_audio->codec->dll_name,&sh_audio->codec->guid,sh_audio->wf,chans))) { MSG_ERR(MSGTR_MissingDLLcodec,sh_audio->codec->dll_name); - free(sh_audio->context); + mp_free(sh_audio->context); return 0; } sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; @@ -68,7 +69,7 @@ { dmo_priv_t*priv = sh->context; DMO_AudioDecoder_Destroy(priv->ds_adec); - free(priv); + mp_free(priv); } static int control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) Modified: mplayerxp/libmpcodecs/ad_dshow.c =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_dshow.c 2012-10-29 15:54:02 UTC (rev 251) @@ -5,6 +5,7 @@ #include "ad_internal.h" #include "mp_config.h" #include "help_mp.h" +#include "osdep/mplib.h" #include "loader/dshow/DS_AudioDecoder.h" #include "codecs_ld.h" @@ -37,12 +38,12 @@ int preinit(sh_audio_t *sh_audio) { dshow_priv_t *priv; - if(!(sh_audio->context=malloc(sizeof(dshow_priv_t)))) return 0; + if(!(sh_audio->context=mp_malloc(sizeof(dshow_priv_t)))) return 0; priv=sh_audio->context; if(!(priv->ds_adec=DS_AudioDecoder_Open(sh_audio->codec->dll_name,&sh_audio->codec->guid,sh_audio->wf))) { MSG_ERR(MSGTR_MissingDLLcodec,sh_audio->codec->dll_name); - free(sh_audio->context); + mp_free(sh_audio->context); return 0; } sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; @@ -59,7 +60,7 @@ { dshow_priv_t* priv = sh->context; DS_AudioDecoder_Destroy(priv->ds_adec); - free(priv); + mp_free(priv); } int control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) Modified: mplayerxp/libmpcodecs/ad_faad.c =================================================================== --- mplayerxp/libmpcodecs/ad_faad.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_faad.c 2012-10-29 15:54:02 UTC (rev 251) @@ -18,6 +18,7 @@ #include "mplayer.h" #include "osdep/cpudetect.h" #include "osdep/mm_accel.h" +#include "osdep/mplib.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" #include "postproc/af.h" @@ -159,7 +160,7 @@ { sh->audio_out_minsize=8192*FAAD_MAX_CHANNELS; sh->audio_in_minsize=FAAD_BUFFLEN; - if(!(sh->context=malloc(sizeof(faad_priv_t)))) return 0; + if(!(sh->context=mp_malloc(sizeof(faad_priv_t)))) return 0; return load_dll("libfaad"SLIBSUFFIX); } @@ -234,7 +235,7 @@ if(NeAAC_init < 0) { MSG_WARN("FAAD: Failed to initialize the decoder!\n"); // XXX: deal with cleanup! NeAACDecClose(NeAAC_hdec); - // XXX: free a_in_buffer here or in uninit? + // XXX: mp_free a_in_buffer here or in uninit? return 0; } else { NeAAC_conf = NeAACDecGetCurrentConfiguration(NeAAC_hdec); @@ -264,7 +265,7 @@ { MSG_V("FAAD: Closing decoder!\n"); NeAACDecClose(NeAAC_hdec); - free(sh->context); + mp_free(sh->context); } static int control(sh_audio_t *sh,int cmd,any_t* arg, ...) Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-29 15:54:02 UTC (rev 251) @@ -11,6 +11,7 @@ #include "mp_config.h" #include "help_mp.h" #include "osdep/bswap.h" +#include "osdep/mplib.h" #define FF_API_OLD_DECODE_AUDIO 1 #include "libavcodec/avcodec.h" @@ -70,7 +71,7 @@ lavc_context->bits_per_coded_sample = sh_audio->wf->wBitsPerSample; /* alloc extra data */ if (sh_audio->wf->cbSize > 0) { - lavc_context->extradata = malloc(sh_audio->wf->cbSize+FF_INPUT_BUFFER_PADDING_SIZE); + lavc_context->extradata = mp_malloc(sh_audio->wf->cbSize+FF_INPUT_BUFFER_PADDING_SIZE); lavc_context->extradata_size = sh_audio->wf->cbSize; memcpy(lavc_context->extradata, (char *)sh_audio->wf + sizeof(WAVEFORMATEX), lavc_context->extradata_size); @@ -79,7 +80,7 @@ // for QDM2 if (sh_audio->codecdata_len && sh_audio->codecdata && !lavc_context->extradata) { - lavc_context->extradata = malloc(sh_audio->codecdata_len); + lavc_context->extradata = mp_malloc(sh_audio->codecdata_len); lavc_context->extradata_size = sh_audio->codecdata_len; memcpy(lavc_context->extradata, (char *)sh_audio->codecdata, lavc_context->extradata_size); @@ -131,8 +132,8 @@ { AVCodecContext *lavc_context=sh->context; avcodec_close(sh->context); - if (lavc_context->extradata) free(lavc_context->extradata); - free(lavc_context); + if (lavc_context->extradata) mp_free(lavc_context->extradata); + mp_free(lavc_context); acodec_inited=0; } Modified: mplayerxp/libmpcodecs/ad_hwac3.c =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-29 15:54:02 UTC (rev 251) @@ -187,7 +187,7 @@ sh_audio->samplerate=ai.samplerate; // SET by a52_fillbuff() sh_audio->samplesize=ai.framesize; sh_audio->i_bps=ai.bitrate*(1000/8); // SET by a52_fillbuff() - sh_audio->ac3_frame=malloc(6144); + sh_audio->ac3_frame=mp_malloc(6144); sh_audio->o_bps=sh_audio->i_bps; // XXX FIXME!!! XXX o_bps is calculated from samplesize*channels*samplerate Modified: mplayerxp/libmpcodecs/ad_libdv.c =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_libdv.c 2012-10-29 15:54:02 UTC (rev 251) @@ -6,7 +6,8 @@ #include <math.h> #include "mp_config.h" -#include "../help_mp.h" +#include "help_mp.h" +#include "osdep/mplib.h" #include <libdv/dv.h> #include <libdv/dv_types.h> @@ -58,12 +59,12 @@ sh->channels=h->nChannels; sh->samplerate=h->nSamplesPerSec; sh->samplesize=(h->wBitsPerSample+7)/8; - priv = malloc(sizeof(libdv_priv_t)); + priv = mp_malloc(sizeof(libdv_priv_t)); memset(priv,0,sizeof(libdv_priv_t)); priv->decoder=init_global_rawdv_decoder(); sh->context = priv; for (i=0; i < 4; i++) - priv->audioBuffers[i] = malloc(2*DV_AUDIO_MAX_SAMPLES); + priv->audioBuffers[i] = mp_malloc(2*DV_AUDIO_MAX_SAMPLES); return 1; } @@ -74,7 +75,7 @@ unsigned i; UNUSED(sh_audio); for (i=0; i < 4; i++) - free(priv->audioBuffers[i]); + mp_free(priv->audioBuffers[i]); } static int control(sh_audio_t *sh,int cmd,any_t* arg, ...) Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-29 15:54:02 UTC (rev 251) @@ -8,6 +8,7 @@ #include "osdep/cpudetect.h" #include "osdep/mm_accel.h" #include "osdep/fastmemcpy.h" +#include "osdep/mplib.h" #include "codecs_ld.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" @@ -143,7 +144,7 @@ MPG123_ERR_16TO8TABLE, /**< Unable to allocate memory for 16 to 8 converter table! */ MPG123_BAD_PARAM, /**< Bad parameter id! */ MPG123_BAD_BUFFER, /**< Bad buffer given -- invalid pointer or too small size. */ - MPG123_OUT_OF_MEM, /**< Out of memory -- some malloc() failed. */ + MPG123_OUT_OF_MEM, /**< Out of memory -- some mp_malloc() failed. */ MPG123_NOT_INITIALIZED, /**< You didn't initialize the library! */ MPG123_BAD_DECODER, /**< Invalid decoder choice. */ MPG123_BAD_HANDLE, /**< Invalid mpg123 handle. */ @@ -272,7 +273,7 @@ sh->samplesize=4; sh->sample_format=AFMT_FLOAT32; mpg123_init(); - priv = malloc(sizeof(mp3_priv_t)); + priv = mp_malloc(sizeof(mp3_priv_t)); memset(priv,0,sizeof(mp3_priv_t)); sh->context = priv; priv->mh = mpg123_new(NULL,&err); @@ -302,7 +303,7 @@ mpg123_close(priv->mh); mpg123_delete(priv->mh); mpg123_exit(); - free(priv); + mp_free(priv); return 0; } mpg123_getformat(priv->mh, &rate, &nch, &enc); @@ -341,7 +342,7 @@ mpg123_close(priv->mh); mpg123_delete(priv->mh); mpg123_exit(); - free(priv); + mp_free(priv); dlclose(dll_handle); } Modified: mplayerxp/libmpcodecs/ad_real.c =================================================================== --- mplayerxp/libmpcodecs/ad_real.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_real.c 2012-10-29 15:54:02 UTC (rev 251) @@ -11,6 +11,7 @@ #include "ad_internal.h" #include "codecs_ld.h" #include "ad_msg.h" +#include "osdep/mplib.h" static const ad_info_t info = { "RealAudio decoder", "realaud", @@ -27,12 +28,12 @@ static any_t*handle=NULL; any_t*__builtin_new(unsigned long size) { - return malloc(size); + return mp_malloc(size); } /* required for cook's uninit: */ void __builtin_delete(any_t* ize) { - free(ize); + mp_free(ize); } #if defined(__FreeBSD__) || defined(__NetBSD__) @@ -77,10 +78,10 @@ char path[4096]; char cpath[4096]; real_priv_t *rpriv; - rpriv=sh->context=malloc(sizeof(real_priv_t)); + rpriv=sh->context=mp_malloc(sizeof(real_priv_t)); if(!(handle = dlopen (sh->codec->dll_name, RTLD_LAZY))) { - free(sh->context); + mp_free(sh->context); return 0; } @@ -98,7 +99,7 @@ if(!raCloseCodec || !raDecode || !raFreeDecoder || !raGetFlavorProperty || !(raOpenCodec2||raOpenCodec) || !raSetFlavor || !raInitDecoder){ - free(sh->context); + mp_free(sh->context); return 0; } @@ -128,7 +129,7 @@ result=raOpenCodec(&rpriv->internal); if(result){ MSG_WARN("Decoder open failed, error code: 0x%X\n",result); - free(sh->context); + mp_free(sh->context); return 0; } @@ -150,7 +151,7 @@ result=raInitDecoder(rpriv->internal,&init_data); if(result){ MSG_WARN("Decoder init failed, error code: 0x%X\n",result); - free(sh->context); + mp_free(sh->context); return 0; } } @@ -163,7 +164,7 @@ result=raSetFlavor(rpriv->internal,((short*)(sh->wf+1))[2]); if(result){ MSG_WARN("Decoder flavor setup failed, error code: 0x%X\n",result); - free(sh->context); + mp_free(sh->context); return 0; } @@ -198,7 +199,7 @@ real_priv_t *rpriv = sh->context; if (raFreeDecoder) raFreeDecoder(rpriv->internal); if (raCloseCodec) raCloseCodec(rpriv->internal); - free(sh->context); + mp_free(sh->context); } static const unsigned char sipr_swaps[38][2]={ Modified: mplayerxp/libmpcodecs/ad_twin.c =================================================================== --- mplayerxp/libmpcodecs/ad_twin.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_twin.c 2012-10-29 15:54:02 UTC (rev 251) @@ -7,8 +7,9 @@ #include "codecs_ld.h" #include "loader/ldt_keeper.h" #include "loader/wine/windef.h" -#include "../libao2/afmt.h" -#include "../libmpdemux/aviprint.h" +#include "libao2/afmt.h" +#include "libmpdemux/aviprint.h" +#include "osdep/mplib.h" #include "help_mp.h" @@ -304,7 +305,7 @@ priv->framesize=TvqGetFrameSize(); sh_audio->audio_in_minsize=priv->framesize*in_fmt->nChannels; sh_audio->a_in_buffer_size=4*sh_audio->audio_in_minsize; - sh_audio->a_in_buffer=malloc(sh_audio->a_in_buffer_size); + sh_audio->a_in_buffer=mp_malloc(sh_audio->a_in_buffer_size); sh_audio->a_in_buffer_len=0; @@ -328,7 +329,7 @@ { /* Win32 VQF audio codec: */ vqf_priv_t *priv; - if(!(sh_audio->context=malloc(sizeof(vqf_priv_t)))) return 0; + if(!(sh_audio->context=mp_malloc(sizeof(vqf_priv_t)))) return 0; priv=sh_audio->context; if(!load_dll((const char *)sh_audio->codec->dll_name)) { @@ -346,7 +347,7 @@ void uninit(sh_audio_t *sh) { close_vqf_audio_codec(sh); - free(sh->context); + mp_free(sh->context); FreeLibrary(vqf_dll); } Modified: mplayerxp/libmpcodecs/ad_vorbis.c =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-29 15:54:02 UTC (rev 251) @@ -7,6 +7,7 @@ #include "ad_internal.h" #include "libao2/afmt.h" #include "libao2/audio_out.h" +#include "osdep/mplib.h" extern ao_data_t* ao_data; @@ -38,7 +39,7 @@ static int preinit(sh_audio_t *sh) { - if(!(sh->context=malloc(sizeof(ov_struct_t)))) return 0; + if(!(sh->context=mp_malloc(sizeof(ov_struct_t)))) return 0; sh->audio_out_minsize=1024*4; // 1024 samples/frame return 1; } @@ -59,7 +60,7 @@ /// Header if(vorbis_synthesis_headerin(&ov->vi,&vc,&op) <0) { MSG_ERR("OggVorbis: initial (identification) header broken!\n"); - free(ov); + mp_free(ov); return 0; } op.bytes = ds_get_packet_r(sh->ds,&op.packet,&pts); @@ -67,14 +68,14 @@ /// Comments if(vorbis_synthesis_headerin(&ov->vi,&vc,&op) <0) { MSG_ERR("OggVorbis: comment header broken!\n"); - free(ov); + mp_free(ov); return 0; } op.bytes = ds_get_packet_r(sh->ds,&op.packet,&pts); //// Codebook if(vorbis_synthesis_headerin(&ov->vi,&vc,&op)<0) { MSG_WARN("OggVorbis: codebook header broken!\n"); - free(ov); + mp_free(ov); return 0; } else { /// Print the infos char **ptr=vc.user_comments; @@ -120,7 +121,7 @@ static void uninit(sh_audio_t *sh) { - free(sh->context); + mp_free(sh->context); } static int control(sh_audio_t *sh,int cmd,any_t* arg, ...) Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-10-29 15:28:48 UTC (rev 250) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-10-29 15:54:02 UTC (rev 251) @@ -20,6 +20,7 @@ #include "libmpdemux/demuxer_r.h" #include "postproc/af.h" #include "osdep/fastmemcpy.h" +#include "osdep/mplib.h" #include "ad_msg.h" #ifdef USE_FAKE_MONO @@ -75,7 +76,7 @@ sh_audio->a_in_buffer_size=sh_audio->audio_in_minsize; MSG_V("dec_audio: Allocating %d bytes for input buffer\n", sh_audio->a_in_buffer_size); - sh_audio->a_in_buffer=malloc(sh_audio->a_in_buffer_size); + sh_audio->a_in_buffer=mp_malloc(sh_audio->a_in_buffer_size); memset(sh_audio->a_in_buffer,0,sh_audio->a_in_buffer_size); sh_audio->a_in_buffer_len=0; } @@ -86,7 +87,7 @@ MSG_V("dec_audio: Allocating %d + %d = %d bytes for output buffer\n", sh_audio->audio_out_minsize,MAX_OUTBURST,sh_audio->a_buffer_size); - sh_audio->a_buffer=malloc(sh_audio->a_buffer_size); + sh_audio->a_buffer=mp_malloc(sh_audio->a_buffer_size); if(!sh_audio->a_buffer){ MSG_ERR(MSGTR_CantAllocAudioBuf); return 0; @@ -96,7 +97,7 @@ if(!mpadec->init(sh_audio)){ MSG_WARN(MSGTR_CODEC_CANT_INITA); - mpca_uninit(sh_audio); /* free buffers */ + mpca_uninit(sh_audio); /* mp_free buffers */ return 0; } @@ -104,7 +105,7 @@ if(!sh_audio->channels || !sh_audio->samplerate){ MSG_WARN(MSGTR_UnknownAudio); - mpca_uninit(sh_audio); /* free buffers */ + mpca_uninit(sh_audio); /* mp_free buffers */ return 0; } @@ -138,17 +139,17 @@ if(sh_audio->afilter){ MSG_V("Uninit audio filters...\n"); af_uninit(sh_audio->afilter); - free(sh_audio->afilter); + mp_free(sh_audio->afilter); sh_audio->afilter=NULL; } - if(sh_audio->a_buffer) free(sh_audio->a_buffer); + if(sh_audio->a_buffer) mp_free(sh_audio->a_buffer); sh_audio->a_buffer=NULL; - if(sh_audio->a_in_buffer) free(sh_audio->a_in_buffer); + if(sh_audio->a_in_buffer) mp_free(sh_audio->a_in_buffer); sh_audio->a_in_buffer=NULL; if(!sh_audio->inited) return; MSG_V("uninit audio: %s\n",sh_audio->codec->driver_name); mpadec->uninit(sh_audio); - if(sh_audio->a_buffer) free(sh_audio->a_buffer); + if(sh_audio->a_buffer) mp_free(sh_audio->a_buffer); sh_audio->a_buffer=NULL; sh_audio->inited=0; } @@ -182,7 +183,7 @@ // let's autoprobe it! if(0 != af_init(afs,0)){ - free(afs); + mp_free(afs); return 0; // failed :( } @@ -228,7 +229,7 @@ // let's autoprobe it! if(0 != af_init(afs,1)){ sh_audio->afilter=NULL; - free(afs); + mp_free(afs); return 0; // failed :( } ... [truncated message content] |
From: <nic...@us...> - 2012-10-30 09:08:21
|
Revision: 257 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=257&view=rev Author: nickols_k Date: 2012-10-30 09:08:10 +0000 (Tue, 30 Oct 2012) Log Message: ----------- add some antiviral protection Modified Paths: -------------- mplayerxp/configure mplayerxp/mplayer.c mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.h Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-10-30 07:35:22 UTC (rev 256) +++ mplayerxp/configure 2012-10-30 09:08:10 UTC (rev 257) @@ -416,6 +416,22 @@ def_asmalign='#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t"' fi +# find pagesize on this system +echocheck "VM pagesize is" +cat > $TMPC << EOF +#include <stdio.h> +#include <unistd.h> +int main(void) { printf("%i\n",getpagesize()); } +EOF +syspagesize="no" +cc_check && syspagesize="yes" +if enabled syspagesize ; then +vm_pagesize=`$TMPO` +else +vm_pagesize="1" +fi +echores "$vm_pagesize" + check_func3 _ISOC9X_SOURCE math.h lrint -lm print_config HAVE_ mp_config.h mp_config.mak lrint @@ -826,6 +842,14 @@ /* ASMALIGN */ $def_asmalign +/* Physical size of page on this system */ +#define __VM_PAGE_SIZE__ $vm_pagesize +#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) +#define __PAGE_ALIGNED__ __attribute__ ((aligned (__VM_PAGE_SIZE__))) +#else +#define __PAGE_ALIGNED__ +#endif + /* Define this if your system has the llrint in "math.h" header file */ #ifndef HAVE_LLRINT #define HAVE_LLRINT 1 @@ -874,6 +898,7 @@ /* libvo options */ $def_fbdev_nocopy + /* Defined to some form of __attribute__ ((...)) if the compiler supports a different, more efficient calling convention. */ #if defined ( __USE_FASTCALL ) Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-30 07:35:22 UTC (rev 256) +++ mplayerxp/mplayer.c 2012-10-30 09:08:10 UTC (rev 257) @@ -70,6 +70,7 @@ /************************************************************************** Private data **************************************************************************/ +static volatile char antiviral_hole1[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; #if defined( ARCH_X86 ) || defined(ARCH_X86_64) typedef struct x86_features_s { int simd; @@ -129,6 +130,7 @@ }priv_t; mp_conf_t mp_conf; +static volatile char antiviral_hole2[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; mp_data_t*mp_data=NULL; /************************************************************************** @@ -138,6 +140,7 @@ ao_data_t* ao_data=NULL; vo_data_t* vo_data=NULL; +static volatile char antiviral_hole3[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; /************************************************************************** Config file @@ -167,6 +170,21 @@ #include "fifo.h" /**************************************************************************/ +static int mpxp_init_antiviral_protection(int verbose) +{ + int rc; + rc=mp_mprotect(antiviral_hole1,sizeof(antiviral_hole1),PROT_NONE); + rc!=mp_mprotect(antiviral_hole2,sizeof(antiviral_hole2),PROT_NONE); + rc!=mp_mprotect(antiviral_hole3,sizeof(antiviral_hole3),PROT_NONE); + if(verbose) { + if(rc) + MSG_ERR("*** Error! Cannot initialize antiviral protection: '%s' ***!\n",strerror(errno)); + else + MSG_OK("*** Antiviral protection was inited ***!!!\n"); + } + return rc; +} + static void mpxp_init_structs(void) { mp_data=mp_malloc(sizeof(mp_data_t)); memset(mp_data,0,sizeof(mp_data_t)); @@ -2339,6 +2357,8 @@ * MAIN MPLAYERXP FUNCTION !!! * \******************************************/ int main(int argc,char* argv[], char *envp[]){ + mpxp_init_antiviral_protection(1); + int i; stream_t* stream=NULL; int stream_dump_type=0; input_state_t input_state = { 0, 0, 0 }; @@ -2350,7 +2370,6 @@ int eof=0; osd_args_t osd = { 100, 9 }; int rtc_fd=-1; - int i; int forced_subs_only=0; seek_args_t seek_args = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-10-30 07:35:22 UTC (rev 256) +++ mplayerxp/osdep/mp_malloc.c 2012-10-30 09:08:10 UTC (rev 257) @@ -211,3 +211,8 @@ ,priv->stat_num_allocs); return priv->stat_num_allocs; } + +int __FASTCALL__ mp_mprotect(const any_t* addr,size_t len,int flags) +{ + return mprotect(addr,len,flags); +} Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-10-30 07:35:22 UTC (rev 256) +++ mplayerxp/osdep/mplib.h 2012-10-30 09:08:10 UTC (rev 257) @@ -9,6 +9,7 @@ #ifndef __MPLIB_H_INCLUDED__ #define __MPLIB_H_INCLUDED__ 1 #include <stddef.h> +#include <sys/mman.h> #include "mp_config.h" extern volatile unsigned long long int my_profile_start,my_profile_end,my_profile_total; @@ -49,4 +50,6 @@ extern void __FASTCALL__ mp_free(any_t*__ptr); extern char * __FASTCALL__ mp_strdup(const char *src); +/* flags: PROT_NONE, PROT_READ, PROT_WRITE, PROT_EXEC */ +extern int __FASTCALL__ mp_mprotect(const any_t* addr,size_t len,int flags); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-30 13:43:37
|
Revision: 259 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=259&view=rev Author: nickols_k Date: 2012-10-30 13:43:23 +0000 (Tue, 30 Oct 2012) Log Message: ----------- remove unused field + minor constantization Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/input/input.c mplayerxp/libao2/ao_alsa9.c mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_acm.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_dmo.c mplayerxp/libmpcodecs/ad_dshow.c mplayerxp/libmpcodecs/ad_dvdpcm.c mplayerxp/libmpcodecs/ad_faad.c mplayerxp/libmpcodecs/ad_ffmp3.c mplayerxp/libmpcodecs/ad_hwac3.c mplayerxp/libmpcodecs/ad_libdv.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/ad_null.c mplayerxp/libmpcodecs/ad_pcm.c mplayerxp/libmpcodecs/ad_qtaudio.c mplayerxp/libmpcodecs/ad_real.c mplayerxp/libmpcodecs/ad_twin.c mplayerxp/libmpcodecs/ad_vorbis.c mplayerxp/libmpcodecs/vd_divx4.c mplayerxp/libmpcodecs/vd_dmo.c mplayerxp/libmpcodecs/vd_dshow.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_huffyuv.c mplayerxp/libmpcodecs/vd_libdv.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_mpegpes.c mplayerxp/libmpcodecs/vd_null.c mplayerxp/libmpcodecs/vd_nuv.c mplayerxp/libmpcodecs/vd_qtvideo.c mplayerxp/libmpcodecs/vd_raw.c mplayerxp/libmpcodecs/vd_real.c mplayerxp/libmpcodecs/vd_theora.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpcodecs/vd_xanim.c mplayerxp/libmpcodecs/vd_xvid.c mplayerxp/libmpconf/cfgparser.c mplayerxp/libmpconf/cfgparser.h mplayerxp/libmpconf/m_option.h mplayerxp/libmpdemux/cdda.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_rawaudio.c mplayerxp/libmpdemux/demux_rawvideo.c mplayerxp/libmpdemux/demux_viv.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/mrl.c mplayerxp/libmpdemux/mrl.h mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libvo/vo_fbdev.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/cfg-mplayer.h 2012-10-30 13:43:23 UTC (rev 259) @@ -73,260 +73,260 @@ */ static const config_t xpcore_config[]={ - {"xp", &mp_conf.xp, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL, "starts MPlayerXP in multi-thread and multi-buffer XP mode"}, - {"dump", &mp_conf.stream_dump, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies dump type and name for the dump of stream"}, - {"gomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables usage of OpenMP extensions"}, - {"nogomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables usage of OpenMP extensions"}, - {"da_buffs", &vo_conf.da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, NULL, "specifies number of buffers for decoding-ahead in XP mode"}, - {"cache", &mp_conf.s_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, NULL,"specifies amount of memory for precaching a file/URL"}, - {"nocache", &mp_conf.s_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL,"disables precaching a file/URL"}, - {"autoq", &mp_conf.autoq, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "dynamically changes the level of postprocessing depending on spare CPU time available"}, - {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL, "sets playback speed factor"}, - {"benchmark", &mp_conf.benchmark, CONF_TYPE_FLAG, 0, 0, 1, NULL, "performs benchmarking to estimate performance of MPlayerXP"}, - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {"xp", &mp_conf.xp, CONF_TYPE_INT, CONF_RANGE, 0, 4, "starts MPlayerXP in multi-thread and multi-buffer XP mode"}, + {"dump", &mp_conf.stream_dump, CONF_TYPE_STRING, 0, 0, 0, "specifies dump type and name for the dump of stream"}, + {"gomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 0, 1, "enables usage of OpenMP extensions"}, + {"nogomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 1, 0, "disables usage of OpenMP extensions"}, + {"da_buffs", &vo_conf.da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, "specifies number of buffers for decoding-ahead in XP mode"}, + {"cache", &mp_conf.s_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, "specifies amount of memory for precaching a file/URL"}, + {"nocache", &mp_conf.s_cache_size, CONF_TYPE_FLAG, 0, 1, 0, "disables precaching a file/URL"}, + {"autoq", &mp_conf.autoq, CONF_TYPE_INT, CONF_RANGE, 0, 100, "dynamically changes the level of postprocessing depending on spare CPU time available"}, + {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, "sets playback speed factor"}, + {"benchmark", &mp_conf.benchmark, CONF_TYPE_FLAG, 0, 0, 1, "performs benchmarking to estimate performance of MPlayerXP"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; #ifdef HAVE_STREAMING static const config_t net_config[]={ - {"ipv4", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 0, 1, NULL, "forces mplayerxp to use IPv4 protocol over network"}, + {"ipv4", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 0, 1, "forces mplayerxp to use IPv4 protocol over network"}, #ifdef HAVE_AF_INET6 - {"ipv6", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, NULL, "forces mplayerxp to use IPv6 protocol over network"}, + {"ipv6", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, "forces mplayerxp to use IPv6 protocol over network"}, #else {"ipv6", "MPlayerXP was compiled without IPv6 support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, #endif /* HAVE_AF_INET6 */ - {"ipv4-only-proxy", &network_ipv4_only_proxy, CONF_TYPE_FLAG, 0, 0, 1, NULL, "skip the proxy for IPv6 addresses"}, - {"user", &network_username, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies username for HTTP authentication"}, - {"passwd", &network_password, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies password for HTTP authentication"}, - {"bandwidth", &network_bandwidth, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL, "specifies the maximum bandwidth for network streaming"}, - {"user-agent", &network_useragent, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies string as user agent for HTTP streaming"}, - {"cookies", &network_cookies_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL,"send cookies when making HTTP requests"}, - {"cookies-file", &cookies_file, CONF_TYPE_STRING, 0, 0, 0, NULL,"Read HTTP cookies from file"}, - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {"ipv4-only-proxy", &network_ipv4_only_proxy, CONF_TYPE_FLAG, 0, 0, 1, "skip the proxy for IPv6 addresses"}, + {"user", &network_username, CONF_TYPE_STRING, 0, 0, 0, "specifies username for HTTP authentication"}, + {"passwd", &network_password, CONF_TYPE_STRING, 0, 0, 0, "specifies password for HTTP authentication"}, + {"bandwidth", &network_bandwidth, CONF_TYPE_INT, CONF_MIN, 0, 0, "specifies the maximum bandwidth for network streaming"}, + {"user-agent", &network_useragent, CONF_TYPE_STRING, 0, 0, 0, "specifies string as user agent for HTTP streaming"}, + {"cookies", &network_cookies_enabled, CONF_TYPE_FLAG, 0, 0, 1, "send cookies when making HTTP requests"}, + {"cookies-file", &cookies_file, CONF_TYPE_STRING, 0, 0, 0, "Read HTTP cookies from file"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; #endif #if defined( ARCH_X86 ) || defined(ARCH_X86_64) static const config_t cpu_config[]={ - {"simd", &x86.simd, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SIMD extensions of CPU"}, - {"nosimd", &x86.simd, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SIMD extensions of CPU"}, - {"mmx", &x86.mmx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX extensions of CPU"}, - {"nommx", &x86.mmx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX extensions of CPU"}, - {"mmx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of MMX2 extensions of CPU"}, - {"nommx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of MMX2 extensions of CPU"}, - {"3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of 3DNow! extensions of CPU"}, - {"no3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of 3DNow! extensions of CPU"}, - {"3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of 3DNow-2! extensions of CPU"}, - {"no3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of 3DNow-2! extensions of CPU"}, - {"sse", &x86.sse, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE extensions of CPU"}, - {"nosse", &x86.sse, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE extensions of CPU"}, - {"sse2", &x86.sse2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE2 extensions of CPU"}, - {"nosse2", &x86.sse2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE2 extensions of CPU"}, - {"sse3", &x86.sse3, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE3 extensions of CPU"}, - {"nosse3", &x86.sse3, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE3 extensions of CPU"}, - {"ssse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSSE3 extensions of CPU"}, - {"nossse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSSE3 extensions of CPU"}, - {"sse41", &x86.sse41, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE41 extensions of CPU"}, - {"nosse41", &x86.sse41, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE41 extensions of CPU"}, - {"sse42", &x86.sse42, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of SSE42 extensions of CPU"}, - {"nosse42", &x86.sse42, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of SSE42 extensions of CPU"}, - {"aes", &x86.aes, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of AES extensions of CPU"}, - {"noaes", &x86.aes, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of AES extensions of CPU"}, - {"avx", &x86.avx, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of AVX extensions of CPU"}, - {"noavx", &x86.avx, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of AVX extensions of CPU"}, - {"fma", &x86.fma, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of FMA extensions of CPU"}, - {"nofma", &x86.fma, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of FMA extensions of CPU"}, - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {"simd", &x86.simd, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SIMD extensions of CPU"}, + {"nosimd", &x86.simd, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SIMD extensions of CPU"}, + {"mmx", &x86.mmx, CONF_TYPE_FLAG, 0, 0, 1, "enables using of MMX extensions of CPU"}, + {"nommx", &x86.mmx, CONF_TYPE_FLAG, 0, 1, 0, "disables using of MMX extensions of CPU"}, + {"mmx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of MMX2 extensions of CPU"}, + {"nommx2", &x86.mmx2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of MMX2 extensions of CPU"}, + {"3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 0, 1, "enables using of 3DNow! extensions of CPU"}, + {"no3dnow", &x86._3dnow, CONF_TYPE_FLAG, 0, 1, 0, "disables using of 3DNow! extensions of CPU"}, + {"3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of 3DNow-2! extensions of CPU"}, + {"no3dnow2", &x86._3dnow2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of 3DNow-2! extensions of CPU"}, + {"sse", &x86.sse, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE extensions of CPU"}, + {"nosse", &x86.sse, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE extensions of CPU"}, + {"sse2", &x86.sse2, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE2 extensions of CPU"}, + {"nosse2", &x86.sse2, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE2 extensions of CPU"}, + {"sse3", &x86.sse3, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE3 extensions of CPU"}, + {"nosse3", &x86.sse3, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE3 extensions of CPU"}, + {"ssse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSSE3 extensions of CPU"}, + {"nossse3", &x86.ssse3, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSSE3 extensions of CPU"}, + {"sse41", &x86.sse41, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE41 extensions of CPU"}, + {"nosse41", &x86.sse41, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE41 extensions of CPU"}, + {"sse42", &x86.sse42, CONF_TYPE_FLAG, 0, 0, 1, "enables using of SSE42 extensions of CPU"}, + {"nosse42", &x86.sse42, CONF_TYPE_FLAG, 0, 1, 0, "disables using of SSE42 extensions of CPU"}, + {"aes", &x86.aes, CONF_TYPE_FLAG, 0, 0, 1, "enables using of AES extensions of CPU"}, + {"noaes", &x86.aes, CONF_TYPE_FLAG, 0, 1, 0, "disables using of AES extensions of CPU"}, + {"avx", &x86.avx, CONF_TYPE_FLAG, 0, 0, 1, "enables using of AVX extensions of CPU"}, + {"noavx", &x86.avx, CONF_TYPE_FLAG, 0, 1, 0, "disables using of AVX extensions of CPU"}, + {"fma", &x86.fma, CONF_TYPE_FLAG, 0, 0, 1, "enables using of FMA extensions of CPU"}, + {"nofma", &x86.fma, CONF_TYPE_FLAG, 0, 1, 0, "disables using of FMA extensions of CPU"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; #endif static const config_t osd_config[]={ - {"level", &mp_conf.osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , NULL, "specifies initial mode of the OSD"}, + {"level", &mp_conf.osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 2 , "specifies initial mode of the OSD"}, #ifdef USE_OSD - {"font", &mp_conf.font_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies an alternative directory of font.desc location"}, - {"ffactor", &mp_conf.font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL, "specifies resampling of alphamap of the font"}, - {"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL, "specifies align position of SPU (DVD-VOBsub) subtitles"}, - {"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL, "specifies antialiasing/scaling mode for SPU"}, - {"spugauss", &spu_gaussvar, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 3.0, NULL, "specifies variance parameter of gaussian for -spuaa"}, + {"font", &mp_conf.font_name, CONF_TYPE_STRING, 0, 0, 0, "specifies an alternative directory of font.desc location"}, + {"ffactor", &mp_conf.font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, "specifies resampling of alphamap of the font"}, + {"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, "specifies align position of SPU (DVD-VOBsub) subtitles"}, + {"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, "specifies antialiasing/scaling mode for SPU"}, + {"spugauss", &spu_gaussvar, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 3.0, "specifies variance parameter of gaussian for -spuaa"}, #endif - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; static const config_t veq_config[]={ - {"brightness",&vo_conf.gamma.brightness, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies brightness-level for output image"}, - {"saturation",&vo_conf.gamma.saturation, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies saturation-level for output image"}, - {"contrast",&vo_conf.gamma.contrast, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies contrast-level for output image"}, - {"hue",&vo_conf.gamma.hue, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies hue of gamma-correction for output image"}, - {"red",&vo_conf.gamma.red_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of red component for output image"}, - {"green",&vo_conf.gamma.green_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of green component for output image"}, - {"blue",&vo_conf.gamma.blue_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of blue component for output image"}, - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {"brightness",&vo_conf.gamma.brightness, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies brightness-level for output image"}, + {"saturation",&vo_conf.gamma.saturation, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies saturation-level for output image"}, + {"contrast",&vo_conf.gamma.contrast, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies contrast-level for output image"}, + {"hue",&vo_conf.gamma.hue, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies hue of gamma-correction for output image"}, + {"red",&vo_conf.gamma.red_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of red component for output image"}, + {"green",&vo_conf.gamma.green_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of green component for output image"}, + {"blue",&vo_conf.gamma.blue_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, "specifies intensity of blue component for output image"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; static const config_t avsync_config[]={ - {"framedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables frame-dropping on slow systems: decodes all video frames, but skips displaying some ones"}, -/*UD*/ {"hardframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, NULL, "enables hard frame-dropping on slow systems: skips displaying and decoding of some frames"}, - {"noframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables frame dropping"}, - {"pts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 0, 1, NULL, "use PTS-based method of A/V synchronization"}, - {"nopts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 1, 0, NULL, "use BPS-based method of A/V synchronization"}, - {"force_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 0, 1, NULL, "force PTS fixing for \"bad\" files"}, - {"noforce_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable PTS fixing for \"bad\" files"}, - {"force_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 0, 1, NULL, "force PTS fixing for \"bad\" files without PTS changing"}, - {"noforce_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable PTS fixing for \"bad\" files without PTS changing"}, - {"frame_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 0, 1, NULL, "recalc PTS of frames as they were added to the buffer"}, - {"noframe_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 1, 0, NULL, "keep original PTS of each frame"}, - {"softsleep", &mp_conf.softsleep, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables high quality software timers for A/V synchronization"}, + {"framedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, "enables frame-dropping on slow systems: decodes all video frames, but skips displaying some ones"}, +/*UD*/ {"hardframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, "enables hard frame-dropping on slow systems: skips displaying and decoding of some frames"}, + {"noframedrop", &mp_conf.frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, "disables frame dropping"}, + {"pts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 0, 1, "use PTS-based method of A/V synchronization"}, + {"nopts", &mp_conf.av_sync_pts, CONF_TYPE_FLAG, 0, 1, 0, "use BPS-based method of A/V synchronization"}, + {"force_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 0, 1, "force PTS fixing for \"bad\" files"}, + {"noforce_pts_fix", &mp_conf.av_force_pts_fix, CONF_TYPE_FLAG, 0, 1, 0, "disable PTS fixing for \"bad\" files"}, + {"force_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 0, 1, "force PTS fixing for \"bad\" files without PTS changing"}, + {"noforce_pts_fix2", &mp_conf.av_force_pts_fix2, CONF_TYPE_FLAG, 0, 1, 0, "disable PTS fixing for \"bad\" files without PTS changing"}, + {"frame_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 0, 1, "recalc PTS of frames as they were added to the buffer"}, + {"noframe_reorder", &mp_conf.frame_reorder, CONF_TYPE_FLAG, 0, 1, 0, "keep original PTS of each frame"}, + {"softsleep", &mp_conf.softsleep, CONF_TYPE_FLAG, 0, 0, 1, "enables high quality software timers for A/V synchronization"}, #ifdef HAVE_RTC - {"rtc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 1, 0, NULL, "enables using of /dev/rtc (real-time clock chip) to compute PTS"}, - {"nortc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 0, 1, NULL, "disables using of /dev/rtc (real-time clock chip) to compute PTS"}, + {"rtc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 1, 0, "enables using of /dev/rtc (real-time clock chip) to compute PTS"}, + {"nortc", &mp_conf.nortc, CONF_TYPE_FLAG, 0, 0, 1, "disables using of /dev/rtc (real-time clock chip) to compute PTS"}, #endif - {"fps", &mp_conf.force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL, "forces frame rate (if value is wrong in the header)"}, - {"vsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 0, 1, NULL, "forces video hardware to wait VSYNC signal before frame switching"}, - {"novsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video hardware to wait VSYNC signal before frame switching"}, - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {"fps", &mp_conf.force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, "forces frame rate (if value is wrong in the header)"}, + {"vsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 0, 1, "forces video hardware to wait VSYNC signal before frame switching"}, + {"novsync", &vo_conf.vsync, CONF_TYPE_FLAG, 0, 1, 0, "disables video hardware to wait VSYNC signal before frame switching"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; static const config_t subtitle_config[]={ - {"on", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables subtitle-steam playback"}, - {"off", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables subtitle-stream playback"}, - {"vob", &mp_conf.vobsub_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the VobSub files that are to be used for subtitle"}, - {"vobid", &mp_conf.vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL, "specifies the VobSub subtitle id"}, + {"on", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 0, 1, "enables subtitle-steam playback"}, + {"off", &mp_conf.has_dvdsub, CONF_TYPE_FLAG, 0, 1, 0, "disables subtitle-stream playback"}, + {"vob", &mp_conf.vobsub_name, CONF_TYPE_STRING, 0, 0, 0, "specifies the VobSub files that are to be used for subtitle"}, + {"vobid", &mp_conf.vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, "specifies the VobSub subtitle id"}, #ifdef USE_SUB - {"file", &mp_conf.sub_name, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the subtitle file"}, + {"file", &mp_conf.sub_name, CONF_TYPE_STRING, 0, 0, 0, "specifies the subtitle file"}, #ifdef USE_ICONV - {"cp", &sub_data.cp, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies codepage of subtitles"}, + {"cp", &sub_data.cp, CONF_TYPE_STRING, 0, 0, 0, "specifies codepage of subtitles"}, #endif - {"fps", &mp_conf.sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL, "specifies frame/sec rate of subtitle file"}, - {"noauto", &mp_conf.sub_auto, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable autodetection of vobsub for textsubs if vobsub found"}, - {"unicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL, "tells MPlayerXP to handle the subtitle file as UNICODE"}, - {"nounicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 1, 0, NULL, "tells MPlayerXP to handle the subtitle file as non-UNICODE"}, - {"utf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL, "tells MPlayerXP to handle the subtitle file as UTF8"}, - {"noutf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 1, 0, NULL, "tells MPlayerXP to handle the subtitle file as non-UTF8"}, - {"pos",&sub_data.pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "specifies vertical shift of subtitles"}, + {"fps", &mp_conf.sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, "specifies frame/sec rate of subtitle file"}, + {"noauto", &mp_conf.sub_auto, CONF_TYPE_FLAG, 0, 1, 0, "disable autodetection of vobsub for textsubs if vobsub found"}, + {"unicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 0, 1, "tells MPlayerXP to handle the subtitle file as UNICODE"}, + {"nounicode", &sub_data.unicode, CONF_TYPE_FLAG, 0, 1, 0, "tells MPlayerXP to handle the subtitle file as non-UNICODE"}, + {"utf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 0, 1, "tells MPlayerXP to handle the subtitle file as UTF8"}, + {"noutf8", &sub_data.utf8, CONF_TYPE_FLAG, 0, 1, 0, "tells MPlayerXP to handle the subtitle file as non-UTF8"}, + {"pos",&sub_data.pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, "specifies vertical shift of subtitles"}, #endif - {"cc", &subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enable DVD Closed Caption (CC) subtitles"}, - {"nocc", &subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disable DVD Closed Caption (CC) subtitles"}, - {"id", &mp_conf.dvdsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL, "selects subtitle channel"}, - {"lang", &mp_conf.dvdsub_lang, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies language of DVD-subtitle stream as two-letter country code(s)"}, - {"ifo", &mp_conf.spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies .ifo file for DVD subtitles"}, - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {"cc", &subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, "enable DVD Closed Caption (CC) subtitles"}, + {"nocc", &subcc_enabled, CONF_TYPE_FLAG, 0, 1, 0, "disable DVD Closed Caption (CC) subtitles"}, + {"id", &mp_conf.dvdsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, "selects subtitle channel"}, + {"lang", &mp_conf.dvdsub_lang, CONF_TYPE_STRING, 0, 0, 0, "specifies language of DVD-subtitle stream as two-letter country code(s)"}, + {"ifo", &mp_conf.spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, "specifies .ifo file for DVD subtitles"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; #ifdef HAVE_X11 static const config_t x11_config[]={ - {"display", &vo_conf.mDisplayName, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the hostname and display number of the X server"}, - {"wid", &vo_conf.WinID, CONF_TYPE_INT, 0, 0, 0, NULL, "tells MPlayerXP to use existing X11 window (for using MPlayerXP as plugin)"}, - {"rootwin", &vo_conf.WinID, CONF_TYPE_FLAG, 0, -1, 0, NULL, "render movie in the root window (desktop background)"}, + {"display", &vo_conf.mDisplayName, CONF_TYPE_STRING, 0, 0, 0, "specifies the hostname and display number of the X server"}, + {"wid", &vo_conf.WinID, CONF_TYPE_INT, 0, 0, 0, "tells MPlayerXP to use existing X11 window (for using MPlayerXP as plugin)"}, + {"rootwin", &vo_conf.WinID, CONF_TYPE_FLAG, 0, -1, 0, "render movie in the root window (desktop background)"}, #ifdef HAVE_XINERAMA - {"xinerama", &xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL, "tells MPlayerXP the display for movie playback"}, + {"xinerama", &xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, "tells MPlayerXP the display for movie playback"}, #endif - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; #endif static const config_t audio_config[]={ - {"on", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables audio-steam playback"}, - {"off", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables audio-stream playback"}, - {"mixer", &oss_mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL, "select audio-mixer device"}, - {"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 2, 8, NULL, "select number of audio output channels to be used"}, - {"rate", &mp_conf.force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL, "specifies Hz for audio playback"}, - {"lang", &mp_conf.audio_lang, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies language of DVD-audio stream as two-letter country code(s)"}, - {"id", &mp_conf.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL, "selects audio channel"}, + {"on", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 0, 1, "enables audio-steam playback"}, + {"off", &mp_conf.has_audio, CONF_TYPE_FLAG, 0, 1, 0, "disables audio-stream playback"}, + {"mixer", &oss_mixer_device, CONF_TYPE_STRING, 0, 0, 0, "select audio-mixer device"}, + {"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 2, 8, "select number of audio output channels to be used"}, + {"rate", &mp_conf.force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, "specifies Hz for audio playback"}, + {"lang", &mp_conf.audio_lang, CONF_TYPE_STRING, 0, 0, 0, "specifies language of DVD-audio stream as two-letter country code(s)"}, + {"id", &mp_conf.audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, "selects audio channel"}, #ifdef USE_FAKE_MONO - {"stereo", &fakemono, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL, "selects type of MP2/MP3 stereo output"}, + {"stereo", &fakemono, CONF_TYPE_INT, CONF_RANGE, 0, 2, "selects type of MP2/MP3 stereo output"}, #endif - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; static const config_t video_config[]={ - {"on", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-steam playback"}, - {"off", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video-stream playback"}, - {"width", &vo_conf.opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to width (if driver supports)"}, - {"height", &vo_conf.opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to height (if driver supports)"}, - {"zoom", &vo_conf.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, NULL, "scale output image by given factor"}, - {"screenw", &vo_conf.screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the horizontal resolution of the screen (if supported)"}, - {"screenh", &vo_conf.screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the vertical resolution of the screen (if supported)"}, - {"aspect", &vo_conf.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL, "sets aspect-ratio of movies (autodetect)"}, - {"noaspect", &vo_conf.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, NULL, "unsets aspect-ratio of movies"}, - {"aspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 0, 1, NULL, "keeps aspect-ratio of the movie during window resize"}, - {"noaspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 1, 0, NULL, "render movie to the user-defined window's geometry"}, - {"monitorpixelaspect", &monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, NULL, "sets the aspect-ratio of a single pixel of TV screen"}, - {"vm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-mode changing during playback"}, - {"novm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video-mode changing during playback"}, - {"fs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 0, 1, NULL, "fullscreen playback"}, - {"nofs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 1, 0, NULL, "windowed playback"}, - {"fsmode", &vo_conf.fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, NULL, "enables workaround for some fullscreen related problems"}, - {"flip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 1, NULL, "flip output image upside-down"}, - {"noflip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 0, NULL, "render output image as is"}, - {"bpp", &vo_conf.dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL, "use different color depth than autodetect"}, - {"bm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of bus-mastering (if it available for given OS/videocard)"}, - {"bm2", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 2, NULL, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, - {"nobm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of bus-mastering"}, - {"id", &mp_conf.video_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL, "selects video channel"}, - {"pp", &npp_options, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies options of post-processing"}, - {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL, "specifies the quality of the software scaler"}, + {"on", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 0, 1, "enables video-steam playback"}, + {"off", &mp_conf.has_video, CONF_TYPE_FLAG, 0, 1, 0, "disables video-stream playback"}, + {"width", &vo_conf.opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to width (if driver supports)"}, + {"height", &vo_conf.opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "scale output image to height (if driver supports)"}, + {"zoom", &vo_conf.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, "scale output image by given factor"}, + {"screenw", &vo_conf.screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "specifies the horizontal resolution of the screen (if supported)"}, + {"screenh", &vo_conf.screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, "specifies the vertical resolution of the screen (if supported)"}, + {"aspect", &vo_conf.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, "sets aspect-ratio of movies (autodetect)"}, + {"noaspect", &vo_conf.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, "unsets aspect-ratio of movies"}, + {"aspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 0, 1, "keeps aspect-ratio of the movie during window resize"}, + {"noaspect-ratio", &vo_conf.softzoom, CONF_TYPE_FLAG, 0, 1, 0, "render movie to the user-defined window's geometry"}, + {"monitorpixelaspect", &monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, "sets the aspect-ratio of a single pixel of TV screen"}, + {"vm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 0, 1, "enables video-mode changing during playback"}, + {"novm", &vo_conf.vidmode, CONF_TYPE_FLAG, 0, 1, 0, "disables video-mode changing during playback"}, + {"fs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 0, 1, "fullscreen playback"}, + {"nofs", &vo_conf.fullscreen, CONF_TYPE_FLAG, 0, 1, 0, "windowed playback"}, + {"fsmode", &vo_conf.fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, "enables workaround for some fullscreen related problems"}, + {"flip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 1, "flip output image upside-down"}, + {"noflip", &vo_conf.flip, CONF_TYPE_FLAG, 0, -1, 0, "render output image as is"}, + {"bpp", &vo_conf.dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, "use different color depth than autodetect"}, + {"bm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 1, "enables using of bus-mastering (if it available for given OS/videocard)"}, + {"bm2", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 0, 2, "enables using of bus-mastering to store all decoded-ahead frames in video-memory"}, + {"nobm", &vo_conf.use_bm, CONF_TYPE_FLAG, 0, 1, 0, "disables using of bus-mastering"}, + {"id", &mp_conf.video_id, CONF_TYPE_INT, CONF_RANGE, 0, 255, "selects video channel"}, + {"pp", &npp_options, CONF_TYPE_STRING, 0, 0, 0, "specifies options of post-processing"}, + {"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, "specifies the quality of the software scaler"}, #ifdef HAVE_PNG - {"z", &z_compression, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL, "specifies compression level for PNG output"}, + {"z", &z_compression, CONF_TYPE_INT, CONF_RANGE, 0, 9, "specifies compression level for PNG output"}, #endif #ifdef HAVE_SDL - {"noxv", &sdl_noxv, CONF_TYPE_FLAG, 0, 0, 1, NULL, "disable XVideo hardware acceleration for SDL"}, - {"forcexv", &sdl_forcexv, CONF_TYPE_FLAG, 0, 0, 1, NULL, "force XVideo hardware acceleration for SDL"}, - {"forcegl", &sdl_forcegl, CONF_TYPE_FLAG, 0, 0, 1, NULL, "force OpenGL hardware acceleration for SDL"}, + {"noxv", &sdl_noxv, CONF_TYPE_FLAG, 0, 0, 1, "disable XVideo hardware acceleration for SDL"}, + {"forcexv", &sdl_forcexv, CONF_TYPE_FLAG, 0, 0, 1, "force XVideo hardware acceleration for SDL"}, + {"forcegl", &sdl_forcegl, CONF_TYPE_FLAG, 0, 0, 1, "force OpenGL hardware acceleration for SDL"}, #endif - {"eq",&veq_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "Video-equalizer specific options"}, - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {"eq",&veq_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video-equalizer specific options"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; static const config_t playback_config[]={ - {"sb", &mp_conf.seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL, "seek to given byte position before playback"}, - {"ss", &mp_conf.seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, NULL, "seek to given time position before playback"}, - {"loop", &mp_conf.loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, NULL, "loops movie playback given number of times. 0 means forever"}, - {"noloop", &mp_conf.loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL, "disable loop of playback"}, - {"shuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 0, 1, NULL, "play files in random order"}, - {"noshuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 1, 0, NULL, "play files in regular order"}, - {"list", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies playlist (1 file/row or Winamp or ASX format)"}, - {"frames", &mp_conf.play_n_frames, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL, "play given number of frames and exit"}, - {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, + {"sb", &mp_conf.seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, "seek to given byte position before playback"}, + {"ss", &mp_conf.seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, "seek to given time position before playback"}, + {"loop", &mp_conf.loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, "loops movie playback given number of times. 0 means forever"}, + {"noloop", &mp_conf.loop_times, CONF_TYPE_FLAG, 0, 0, -1, "disable loop of playback"}, + {"shuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 0, 1, "play files in random order"}, + {"noshuffle",&mp_conf.shuffle_playback, CONF_TYPE_FLAG, 0, 1, 0, "play files in regular order"}, + {"list", NULL, CONF_TYPE_STRING, 0, 0, 0, "specifies playlist (1 file/row or Winamp or ASX format)"}, + {"frames", &mp_conf.play_n_frames, CONF_TYPE_INT, CONF_MIN, 0, 0, "play given number of frames and exit"}, + {NULL, NULL, 0, 0, 0, 0, NULL}, }; static const config_t mplayer_opts[]={ /* name, pointer, type, flags, min, max, help */ - {"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL, ""}, /* this don't need anymore to be the first!!! */ + {"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, ""}, /* this don't need anymore to be the first!!! */ //---------------------- libao/libvo/mplayer options ------------------------ - {"vo", &mp_conf.video_driver, CONF_TYPE_STRING, 0, 0, 0, NULL, "select video output driver and optinaly device"}, - {"ao", &mp_conf.audio_driver, CONF_TYPE_STRING, 0, 0, 0, NULL, "select audio output driver and optinaly device"}, - {"af", &af_cfg.list, CONF_TYPE_STRING, 0, 0, 0, NULL, "selects audio filter"}, - {"vf", &vf_cfg.list, CONF_TYPE_STRING, 0, 0, 0, NULL, "selects video filter"}, - {"afm", &mp_conf.audio_family, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified audio-decoders family"}, - {"vfm", &mp_conf.video_family, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified video-decoders family"}, - {"ac", &mp_conf.audio_codec, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified audio-decoder"}, - {"vc", &mp_conf.video_codec, CONF_TYPE_STRING, 0, 0, 0, NULL, "forces usage of specified video-decoder"}, -/*UD*/ {"verbose", &mp_conf.verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, NULL, "verbose output"}, - {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL, "verbose output (more -v means more verbosity)"}, - {"slave", &mp_conf.slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL, "turns MPlayerXP into slave mode as a backend for other programs"}, - {"use-stdin", &mp_conf.use_stdin, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL, "forces reading of keyboard codes from STDIN instead of terminal's console"}, - {"msgfilter", &mp_msg_filter, CONF_TYPE_INT, CONF_RANGE, 0, 0xFFFFFFFF, NULL, "specifies filter for verbosed messages"}, + {"vo", &mp_conf.video_driver, CONF_TYPE_STRING, 0, 0, 0, "select video output driver and optinaly device"}, + {"ao", &mp_conf.audio_driver, CONF_TYPE_STRING, 0, 0, 0, "select audio output driver and optinaly device"}, + {"af", &af_cfg.list, CONF_TYPE_STRING, 0, 0, 0, "selects audio filter"}, + {"vf", &vf_cfg.list, CONF_TYPE_STRING, 0, 0, 0, "selects video filter"}, + {"afm", &mp_conf.audio_family, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified audio-decoders family"}, + {"vfm", &mp_conf.video_family, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified video-decoders family"}, + {"ac", &mp_conf.audio_codec, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified audio-decoder"}, + {"vc", &mp_conf.video_codec, CONF_TYPE_STRING, 0, 0, 0, "forces usage of specified video-decoder"}, +/*UD*/ {"verbose", &mp_conf.verbose, CONF_TYPE_INT, CONF_RANGE|CONF_GLOBAL, 0, 100, "verbose output"}, + {"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, "verbose output (more -v means more verbosity)"}, + {"slave", &mp_conf.slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, "turns MPlayerXP into slave mode as a backend for other programs"}, + {"use-stdin", &mp_conf.use_stdin, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "forces reading of keyboard codes from STDIN instead of terminal's console"}, + {"msgfilter", &mp_msg_filter, CONF_TYPE_INT, CONF_RANGE, 0, 0xFFFFFFFF, "specifies filter for verbosed messages"}, - {"core", &xpcore_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "XP-core related options" }, - {"play", &playback_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "Playback specific options" }, - {"audio", &audio_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "Audio related options" }, - {"video", &video_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "Video related options" }, - {"sub", &subtitle_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "Subtitle related options" }, + {"core", &xpcore_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "XP-core related options" }, + {"play", &playback_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Playback specific options" }, + {"audio", &audio_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Audio related options" }, + {"video", &video_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Video related options" }, + {"sub", &subtitle_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Subtitle related options" }, #ifdef HAVE_X11 - {"x", &x11_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "X11-specific options" }, + {"x", &x11_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "X11-specific options" }, #endif - {"osd", &osd_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "OSD-related options"}, - {"sync", &avsync_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "AV-synchronization related options" }, + {"osd", &osd_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "OSD-related options"}, + {"sync", &avsync_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "AV-synchronization related options" }, #if defined( ARCH_X86 ) || defined(ARCH_X86_64) - {"cpu", &cpu_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "CPU specific options" }, + {"cpu", &cpu_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "CPU specific options" }, #endif // ------------------------- stream options -------------------- #ifdef HAVE_STREAMING - { "net", &net_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "Network specific options" }, + { "net", &net_config, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Network specific options" }, #endif // ------------------------- codec/pp options -------------------- - {NULL, NULL, 0, 0, 0, 0, NULL, NULL} + {NULL, NULL, 0, 0, 0, 0, NULL} }; Modified: mplayerxp/input/input.c =================================================================== --- mplayerxp/input/input.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/input/input.c 2012-10-30 13:43:23 UTC (rev 259) @@ -398,39 +398,39 @@ static const char* in_file = NULL; static int in_file_fd = -1; -static int mp_input_print_key_list(config_t* cfg); -static int mp_input_print_cmd_list(config_t* cfg); +static int mp_input_print_key_list(const config_t* cfg); +static int mp_input_print_cmd_list(const config_t* cfg); static const config_t joystick_conf[] = { - { "on", &use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL, "enables using of joystick" }, - { "off", &use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL, "disables using of joystick" }, - { "dev", &js_dev, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL, "specifies the joystick device" }, - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { "on", &use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of joystick" }, + { "off", &use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of joystick" }, + { "dev", &js_dev, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifies the joystick device" }, + { NULL, NULL, 0, 0, 0, 0, NULL} }; extern char *lirc_configfile; // Our command line options static const config_t input_conf[] = { - { "conf", &config_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL, "specifies alternative input.conf" }, - { "ar-delay", &ar_delay, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL, "autorepeate a key delay in milliseconds (0 to disable)" }, - { "ar-rate", &ar_rate, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL, "number of key-presses per second generating on autorepeat" }, - { "keylist", mp_input_print_key_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL, "prints all keys that can be bound to commands" }, - { "cmdlist", mp_input_print_cmd_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL, "prints all commands that can be bound to keys" }, - { "file", &in_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL, "specifes file with commands (useful for FIFO)" }, + { "conf", &config_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifies alternative input.conf" }, + { "ar-delay", &ar_delay, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, "autorepeate a key delay in milliseconds (0 to disable)" }, + { "ar-rate", &ar_rate, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, "number of key-presses per second generating on autorepeat" }, + { "keylist", mp_input_print_key_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, "prints all keys that can be bound to commands" }, + { "cmdlist", mp_input_print_cmd_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, "prints all commands that can be bound to keys" }, + { "file", &in_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifes file with commands (useful for FIFO)" }, #ifdef HAVE_LIRC - { "lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL, "specifies a config.file for LIRC"}, + { "lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, "specifies a config.file for LIRC"}, #endif - { "lirc", &use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL, "enables using of lirc" }, - { "nolirc", &use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL, "disables using of lirc" }, - { "lircc", &use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL, "enables using of lirc daemon" }, - { "nolircc", &use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL, "disables using of lirc daemon" }, - { "joystick", &joystick_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "Joystick related options" }, - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { "lirc", &use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of lirc" }, + { "nolirc", &use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of lirc" }, + { "lircc", &use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, "enables using of lirc daemon" }, + { "nolircc", &use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, "disables using of lirc daemon" }, + { "joystick", &joystick_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Joystick related options" }, + { NULL, NULL, 0, 0, 0, 0, NULL} }; static const config_t mp_input_opts[] = { - { "input", &input_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL, "Input specific options"}, - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { "input", &input_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, "Input specific options"}, + { NULL, NULL, 0, 0, 0, 0, NULL} }; static int mp_input_default_key_func(int fd); @@ -441,7 +441,7 @@ int -mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func) { +mp_input_add_cmd_fd(int fd, int sel, mp_cmd_func_t read_func, mp_close_func_t close_func) { if(num_cmd_fd == MP_MAX_CMD_FD) { MSG_ERR("Too much command fd, unable to register fd %d\n",fd); return 0; @@ -451,7 +451,7 @@ cmd_fds[num_cmd_fd].fd = fd; cmd_fds[num_cmd_fd].read_func = read_func ? read_func : mp_input_default_cmd_func; cmd_fds[num_cmd_fd].close_func = close_func; - if(!select) + if(!sel) cmd_fds[num_cmd_fd].flags = MP_FD_NO_SELECT; num_cmd_fd++; @@ -497,7 +497,7 @@ } int -mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func) { +mp_input_add_key_fd(int fd, int sel, mp_key_func_t read_func, mp_close_func_t close_func) { if(num_key_fd == MP_MAX_KEY_FD) { MSG_ERR("Too much key fd, unable to register fd %d\n",fd); return 0; @@ -507,7 +507,7 @@ key_fds[num_key_fd].fd = fd; key_fds[num_key_fd].read_func = read_func ? read_func : mp_input_default_key_func; key_fds[num_key_fd].close_func = close_func; - if(!select) + if(!sel) key_fds[num_key_fd].flags |= MP_FD_NO_SELECT; num_key_fd++; @@ -826,7 +826,7 @@ } int -mp_input_read_key_code(int time) { +mp_input_read_key_code(int tim) { #ifndef HAVE_NO_POSIX_SELECT fd_set fds; struct timeval tv,*time_val; @@ -864,9 +864,9 @@ // if we have fd's without MP_FD_NO_SELECT flag, call select(): if(n>0){ - if(time >= 0 ) { - tv.tv_sec=time/1000; - tv.tv_usec = (time%1000)*1000; + if(tim >= 0 ) { + tv.tv_sec=tim/1000; + tv.tv_usec = (tim%1000)*1000; time_val = &tv; } else time_val = NULL; @@ -898,7 +898,7 @@ continue; #endif if(key_fds[i].fd == 0) { // stdin is handled by getch2 - code = getch2(time); + code = getch2(tim); if(code < 0) code = MP_INPUT_NOTHING; } @@ -919,8 +919,8 @@ } static mp_cmd_t* -mp_input_read_keys(int time,int paused) { - int code = mp_input_read_key_code(time); +mp_input_read_keys(int tim,int paused) { + int code = mp_input_read_key_code(tim); unsigned int j; mp_cmd_t* ret; @@ -1010,7 +1010,7 @@ } static mp_cmd_t* -mp_input_read_cmds(int time) { +mp_input_read_cmds(int tim) { #ifndef HAVE_NO_POSIX_SELECT fd_set fds; struct timeval tv,*time_val; @@ -1046,9 +1046,9 @@ return NULL; #ifndef HAVE_NO_POSIX_SELECT - if(time >= 0) { - tv.tv_sec=time/1000; - tv.tv_usec = (time%1000)*1000; + if(tim >= 0) { + tv.tv_sec=tim/1000; + tv.tv_usec = (tim%1000)*1000; time_val = &tv; } else time_val = NULL; @@ -1133,7 +1133,7 @@ * Do not mp_free the returned cmd whe you set this! */ mp_cmd_t* -mp_input_get_cmd(int time, int paused, int peek_only) { +mp_input_get_cmd(int tim, int paused, int peek_only) { mp_cmd_t* ret = NULL; mp_cmd_filter_t* cf; int from_queue; @@ -1143,9 +1143,9 @@ ret = mp_input_get_queued_cmd(peek_only); if(ret) break; from_queue = 0; - ret = mp_input_read_keys(time,paused); + ret = mp_input_read_keys(tim,paused); if(ret) break; - ret = mp_input_read_cmds(time); + ret = mp_input_read_cmds(tim); break; } if(!ret) return NULL; @@ -1268,7 +1268,7 @@ void mp_input_bind_keys(int keys[MP_MAX_KEY_DOWN+1], char* cmd) { int i = 0,j; - mp_cmd_bind_t* bind = NULL; + mp_cmd_bind_t* _bind = NULL; #ifdef MP_DEBUG assert(keys != NULL); @@ -1280,21 +1280,21 @@ for(j = 0 ; cmd_binds[i].input[j] == keys[j] && keys[j] != 0 ; j++) /* NOTHING */; if(keys[j] == 0 && cmd_binds[i].input[j] == 0 ) { - bind = &cmd_binds[i]; + _bind = &cmd_binds[i]; break; } } } - if(!bind) { + if(!_bind) { cmd_binds = (mp_cmd_bind_t*)mp_realloc(cmd_binds,(i+2)*sizeof(mp_cmd_bind_t)); memset(&cmd_binds[i],0,2*sizeof(mp_cmd_bind_t)); - bind = &cmd_binds[i]; + _bind = &cmd_binds[i]; } - if(bind->cmd) - mp_free(bind->cmd); - bind->cmd = mp_strdup(cmd); - memcpy(bind->input,keys,(MP_MAX_KEY_DOWN+1)*sizeof(int)); + if(_bind->cmd) + mp_free(_bind->cmd); + _bind->cmd = mp_strdup(cmd); + memcpy(_bind->input,keys,(MP_MAX_KEY_DOWN+1)*sizeof(int)); } @@ -1559,7 +1559,7 @@ MSG_INFO("%s\n",key_names[i].name); } -static int mp_input_print_key_list(config_t* cfg) { +static int mp_input_print_key_list(const config_t* cfg) { mp_input_print_keys(); exit(0); } @@ -1606,15 +1606,15 @@ } } -static int mp_input_print_cmd_list(config_t* cfg) { +static int mp_input_print_cmd_list(const config_t* cfg) { mp_input_print_cmds(); exit(0); } int -mp_input_check_interrupt(int time) { +mp_input_check_interrupt(int tim) { mp_cmd_t* cmd; - if((cmd = mp_input_get_cmd(time,0,1)) == NULL) + if((cmd = mp_input_get_cmd(tim,0,1)) == NULL) return 0; switch(cmd->id) { case MP_CMD_QUIT: @@ -1626,7 +1626,7 @@ return 1; } // remove the cmd from the queue - cmd = mp_input_get_cmd(time,0,0); + cmd = mp_input_get_cmd(tim,0,0); mp_cmd_free(cmd); return 0; } Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libao2/ao_alsa9.c 2012-10-30 13:43:23 UTC (rev 259) @@ -54,7 +54,7 @@ int noblock; }priv_conf_t; static priv_conf_t priv_conf; -static mrl_config_t alsaconf[]={ +static const mrl_config_t alsaconf[]={ { "mmap", &priv_conf.mmap, MRL_TYPE_BOOL, 0, 1 }, { "noblock", &priv_conf.noblock, MRL_TYPE_BOOL, 0, 1 }, { NULL, NULL, 0, 0, 0 } Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-10-30 13:43:23 UTC (rev 259) @@ -37,7 +37,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(a52) Modified: mplayerxp/libmpcodecs/ad_acm.c =================================================================== --- mplayerxp/libmpcodecs/ad_acm.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_acm.c 2012-10-30 13:43:23 UTC (rev 259) @@ -20,7 +20,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(msacm) Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_dca.c 2012-10-30 13:43:23 UTC (rev 259) @@ -41,7 +41,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(dca) Modified: mplayerxp/libmpcodecs/ad_dmo.c =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_dmo.c 2012-10-30 13:43:23 UTC (rev 259) @@ -20,7 +20,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(dmo) Modified: mplayerxp/libmpcodecs/ad_dshow.c =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_dshow.c 2012-10-30 13:43:23 UTC (rev 259) @@ -18,7 +18,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(dshow) Modified: mplayerxp/libmpcodecs/ad_dvdpcm.c =================================================================== --- mplayerxp/libmpcodecs/ad_dvdpcm.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_dvdpcm.c 2012-10-30 13:43:23 UTC (rev 259) @@ -14,7 +14,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(dvdpcm) Modified: mplayerxp/libmpcodecs/ad_faad.c =================================================================== --- mplayerxp/libmpcodecs/ad_faad.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_faad.c 2012-10-30 13:43:23 UTC (rev 259) @@ -32,7 +32,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(faad) Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-30 13:43:23 UTC (rev 259) @@ -32,7 +32,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(ffmp3) Modified: mplayerxp/libmpcodecs/ad_hwac3.c =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-30 13:43:23 UTC (rev 259) @@ -150,7 +150,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(hwac3) Modified: mplayerxp/libmpcodecs/ad_libdv.c =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_libdv.c 2012-10-30 13:43:23 UTC (rev 259) @@ -27,7 +27,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(libdv) Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-30 13:43:23 UTC (rev 259) @@ -23,7 +23,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(mp3) Modified: mplayerxp/libmpcodecs/ad_null.c =================================================================== --- mplayerxp/libmpcodecs/ad_null.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_null.c 2012-10-30 13:43:23 UTC (rev 259) @@ -12,7 +12,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(null) Modified: mplayerxp/libmpcodecs/ad_pcm.c =================================================================== --- mplayerxp/libmpcodecs/ad_pcm.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_pcm.c 2012-10-30 13:43:23 UTC (rev 259) @@ -13,7 +13,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(pcm) Modified: mplayerxp/libmpcodecs/ad_qtaudio.c =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-30 13:43:23 UTC (rev 259) @@ -25,7 +25,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(qtaudio) Modified: mplayerxp/libmpcodecs/ad_real.c =================================================================== --- mplayerxp/libmpcodecs/ad_real.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_real.c 2012-10-30 13:43:23 UTC (rev 259) @@ -20,7 +20,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(real) Modified: mplayerxp/libmpcodecs/ad_twin.c =================================================================== --- mplayerxp/libmpcodecs/ad_twin.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_twin.c 2012-10-30 13:43:23 UTC (rev 259) @@ -22,7 +22,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(twin) Modified: mplayerxp/libmpcodecs/ad_vorbis.c =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-30 13:43:23 UTC (rev 259) @@ -20,7 +20,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBAD_EXTERN(vorbis) Modified: mplayerxp/libmpcodecs/vd_divx4.c =================================================================== --- mplayerxp/libmpcodecs/vd_divx4.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/vd_divx4.c 2012-10-30 13:43:23 UTC (rev 259) @@ -30,7 +30,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBVD_EXTERN(divx4) Modified: mplayerxp/libmpcodecs/vd_dmo.c =================================================================== --- mplayerxp/libmpcodecs/vd_dmo.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/vd_dmo.c 2012-10-30 13:43:23 UTC (rev 259) @@ -22,7 +22,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBVD_EXTERN(dmo) Modified: mplayerxp/libmpcodecs/vd_dshow.c =================================================================== --- mplayerxp/libmpcodecs/vd_dshow.c 2012-10-30 09:09:49 UTC (rev 258) +++ mplayerxp/libmpcodecs/vd_dshow.c 2012-10-30 13:43:23 UTC (rev 259) @@ -20,7 +20,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL} }; LIBVD_EXTERN(dshow) Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =====... [truncated message content] |
From: <nic...@us...> - 2012-10-30 15:15:30
|
Revision: 262 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=262&view=rev Author: nickols_k Date: 2012-10-30 15:15:18 +0000 (Tue, 30 Oct 2012) Log Message: ----------- add useful warnings Modified Paths: -------------- mplayerxp/configure mplayerxp/libmpcodecs/vd_ffmpeg.c Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-10-30 14:49:33 UTC (rev 261) +++ mplayerxp/configure 2012-10-30 15:15:18 UTC (rev 262) @@ -293,7 +293,7 @@ print_config HAVE_ mp_config.h mp_config.mak gomp #enabled gomp && check_cflags -ftree-parallelize-loops=4 ##################################################### -add_cflags "-Werror-implicit-function-declaration" +add_cflags "-Werror-implicit-function-declaration -Warray-bounds -Wreturn-type -Wuninitialized -Wlogical-op -Waddress" check_cflags "-W -Wall -Wextra" echocheck CFLAGS Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-30 14:49:33 UTC (rev 261) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-30 15:15:18 UTC (rev 262) @@ -226,8 +226,7 @@ avcodec_register_all(); vcodec_inited=1; } - vdff_ctx=mp_malloc(sizeof(priv_t)); - memset(vdff_ctx,0,sizeof(priv_t)); + vdff_ctx=mp_mallocz(sizeof(priv_t)); sh->context = vdff_ctx; vdff_ctx->frame_number=-2; vdff_ctx->lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll_name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-31 14:29:45
|
Revision: 267 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=267&view=rev Author: nickols_k Date: 2012-10-31 14:29:38 +0000 (Wed, 31 Oct 2012) Log Message: ----------- add test for antiviral protection Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.h Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-31 14:00:16 UTC (rev 266) +++ mplayerxp/cfg-mplayer.h 2012-10-31 14:29:38 UTC (rev 267) @@ -46,6 +46,7 @@ {"autoq", &mp_conf.autoq, CONF_TYPE_INT, CONF_RANGE, 0, 100, "dynamically changes the level of postprocessing depending on spare CPU time available"}, {"speed", &mp_conf.playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, "sets playback speed factor"}, {"benchmark", &mp_conf.benchmark, CONF_TYPE_FLAG, 0, 0, 1, "performs benchmarking to estimate performance of MPlayerXP"}, + {"test-av", &mp_conf.test_av, CONF_TYPE_FLAG, 0, 0, 1, "test antiviral protection of MPlayerXP"}, {NULL, NULL, 0, 0, 0, 0, NULL}, }; Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-31 14:00:16 UTC (rev 266) +++ mplayerxp/mplayer.c 2012-10-31 14:29:38 UTC (rev 267) @@ -173,9 +173,9 @@ static int mpxp_init_antiviral_protection(int verbose) { int rc; - rc=mp_mprotect(antiviral_hole1,sizeof(antiviral_hole1),PROT_NONE); - rc|=mp_mprotect(antiviral_hole2,sizeof(antiviral_hole2),PROT_NONE); - rc|=mp_mprotect(antiviral_hole3,sizeof(antiviral_hole3),PROT_NONE); + rc=mp_mprotect(antiviral_hole1,sizeof(antiviral_hole1),MP_PROT_NONE); + rc|=mp_mprotect(antiviral_hole2,sizeof(antiviral_hole2),MP_PROT_NONE); + rc|=mp_mprotect(antiviral_hole3,sizeof(antiviral_hole3),MP_PROT_NONE); if(verbose) { if(rc) MSG_ERR("*** Error! Cannot initialize antiviral protection: '%s' ***!\n",strerror(errno)); @@ -185,6 +185,15 @@ return rc; } +static int mpxp_test_antiviral_protection(int verbose) +{ + int rc; + if(verbose) MSG_INFO("Right now MPlayerXP should make coredump!\n"); + rc=antiviral_hole1[0]|antiviral_hole2[0]|antiviral_hole2[0]; + MSG_ERR("Antiviral protection of MPlayerXP doesn't work!"); + return rc; +} + static void mpxp_init_structs(void) { mp_data=mp_mallocz(sizeof(mp_data_t)); mp_data->seek_time=-1; @@ -2402,6 +2411,10 @@ "Note! Single-thread mode is not longer supported by MPlayerXP\n"); exit_player(MSGTR_Exit_quit); } + if(mp_conf.test_av) { + mpxp_test_antiviral_protection(mp_conf.verbose); + exit_player("Bad test of antiviral protection"); + } xp_num_cpu=get_number_cpu(); #if defined( ARCH_X86 ) || defined(ARCH_X86_64) Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-10-31 14:00:16 UTC (rev 266) +++ mplayerxp/mplayer.h 2012-10-31 14:29:38 UTC (rev 267) @@ -12,6 +12,7 @@ int use_stdin; int slave_mode; uint32_t msg_filter; + int test_av; // XP-core int xp; /* XP-mode */ int gomp; /* currently it's experimental feature */ Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-10-31 14:00:16 UTC (rev 266) +++ mplayerxp/osdep/mp_malloc.c 2012-10-31 14:29:38 UTC (rev 267) @@ -115,7 +115,7 @@ typedef struct priv_s { unsigned rnd_limit; unsigned every_nth_call; - unsigned flags; + enum mp_malloc_e flags; // statistics unsigned long long int total_calls; unsigned long long int num_allocs; @@ -126,7 +126,7 @@ }priv_t; static priv_t* priv; -void mp_init_malloc(unsigned rnd_limit,unsigned every_nth_call,unsigned flags) +void mp_init_malloc(unsigned rnd_limit,unsigned every_nth_call,enum mp_malloc_e flags) { if(!priv) priv=malloc(sizeof(priv_t)); memset(priv,0,sizeof(priv_t)); @@ -214,7 +214,7 @@ return priv->stat_num_allocs; } -int __FASTCALL__ mp_mprotect(const any_t* addr,size_t len,int flags) +int __FASTCALL__ mp_mprotect(const any_t* addr,size_t len,enum mp_prot_e flags) { return mprotect(addr,len,flags); } Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-10-31 14:00:16 UTC (rev 266) +++ mplayerxp/osdep/mplib.h 2012-10-31 14:29:38 UTC (rev 267) @@ -36,13 +36,13 @@ * @note Pseudo-randomizing memory objects makes memory * exploits harder */ -enum { +enum mp_malloc_e { MPA_FLG_RANDOMIZER = 0x00000000, MPA_FLG_BOUNDS_CHECK = 0x00000001, MPA_FLG_BEFORE_CHECK = 0x00000002, MPA_FLG_BACKTRACE = 0x00000004 }; -extern void __FASTCALL__ mp_init_malloc(unsigned rnd_limit,unsigned every_nth_call,unsigned flags); +extern void __FASTCALL__ mp_init_malloc(unsigned rnd_limit,unsigned every_nth_call,enum mp_malloc_e flags); extern void __FASTCALL__ mp_uninit_malloc(int verbose); extern void __FASTCALL__ mp_open_malloc_stat(void); @@ -57,5 +57,11 @@ extern char * __FASTCALL__ mp_strdup(const char *src); /* flags: PROT_NONE, PROT_READ, PROT_WRITE, PROT_EXEC */ -extern int __FASTCALL__ mp_mprotect(const any_t* addr,size_t len,int flags); +enum mp_prot_e { + MP_PROT_READ =0x1, /* Page can be read. */ + MP_PROT_WRITE =0x2, /* Page can be written. */ + MP_PROT_EXEC =0x4, /* Page can be executed. */ + MP_PROT_NONE =0x0, /* Page can not be accessed. */ +}; +extern int __FASTCALL__ mp_mprotect(const any_t* addr,size_t len,enum mp_prot_e flags); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-31 16:28:33
|
Revision: 269 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=269&view=rev Author: nickols_k Date: 2012-10-31 16:28:22 +0000 (Wed, 31 Oct 2012) Log Message: ----------- use common ControlCodes Modified Paths: -------------- mplayerxp/libao2/ao_alsa9.c mplayerxp/libao2/ao_arts.c mplayerxp/libao2/ao_esd.c mplayerxp/libao2/ao_jack.c mplayerxp/libao2/ao_nas.c mplayerxp/libao2/ao_null.c mplayerxp/libao2/ao_openal.c mplayerxp/libao2/ao_oss.c mplayerxp/libao2/ao_sdl.c mplayerxp/libao2/ao_wav.c mplayerxp/libao2/audio_out.c mplayerxp/libao2/audio_out.h mplayerxp/libao2/audio_out_internal.h mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_acm.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_dmo.c mplayerxp/libmpcodecs/ad_dshow.c mplayerxp/libmpcodecs/ad_dvdpcm.c mplayerxp/libmpcodecs/ad_faad.c mplayerxp/libmpcodecs/ad_ffmp3.c mplayerxp/libmpcodecs/ad_hwac3.c mplayerxp/libmpcodecs/ad_internal.h mplayerxp/libmpcodecs/ad_libdv.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/ad_null.c mplayerxp/libmpcodecs/ad_pcm.c mplayerxp/libmpcodecs/ad_qtaudio.c mplayerxp/libmpcodecs/ad_real.c mplayerxp/libmpcodecs/ad_twin.c mplayerxp/libmpcodecs/ad_vorbis.c mplayerxp/libmpcodecs/dec_audio.h mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpcodecs/vd.h mplayerxp/libmpcodecs/vd_divx4.c mplayerxp/libmpcodecs/vd_dmo.c mplayerxp/libmpcodecs/vd_dshow.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_huffyuv.c mplayerxp/libmpcodecs/vd_internal.h mplayerxp/libmpcodecs/vd_libdv.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_mpegpes.c mplayerxp/libmpcodecs/vd_null.c mplayerxp/libmpcodecs/vd_nuv.c mplayerxp/libmpcodecs/vd_qtvideo.c mplayerxp/libmpcodecs/vd_raw.c mplayerxp/libmpcodecs/vd_real.c mplayerxp/libmpcodecs/vd_theora.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpcodecs/vd_xanim.c mplayerxp/libmpcodecs/vd_xvid.c mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/video_out_internal.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_vesa.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/vosub_vidix.c mplayerxp/mplayer.c mplayerxp/postproc/af.c mplayerxp/postproc/af.h mplayerxp/postproc/af_ao2.c mplayerxp/postproc/af_center.c mplayerxp/postproc/af_channels.c mplayerxp/postproc/af_comp.c mplayerxp/postproc/af_control.h mplayerxp/postproc/af_crystality.c mplayerxp/postproc/af_delay.c mplayerxp/postproc/af_dummy.c mplayerxp/postproc/af_dyn.c mplayerxp/postproc/af_echo3d.c mplayerxp/postproc/af_equalizer.c mplayerxp/postproc/af_export.c mplayerxp/postproc/af_extrastereo.c mplayerxp/postproc/af_ffenc.c mplayerxp/postproc/af_format.c mplayerxp/postproc/af_format_alaw.c mplayerxp/postproc/af_format_ulaw.c mplayerxp/postproc/af_gate.c mplayerxp/postproc/af_hrtf.c mplayerxp/postproc/af_karaoke.c mplayerxp/postproc/af_lp.c mplayerxp/postproc/af_pan.c mplayerxp/postproc/af_raw.c mplayerxp/postproc/af_resample.c mplayerxp/postproc/af_scaletempo.c mplayerxp/postproc/af_sinesuppress.c mplayerxp/postproc/af_sub.c mplayerxp/postproc/af_surround.c mplayerxp/postproc/af_tools.c mplayerxp/postproc/af_volnorm.c mplayerxp/postproc/af_volume.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf.h mplayerxp/postproc/vf_1bpp.c mplayerxp/postproc/vf_2xsai.c mplayerxp/postproc/vf_aspect.c mplayerxp/postproc/vf_delogo.c mplayerxp/postproc/vf_denoise3d.c mplayerxp/postproc/vf_dint.c mplayerxp/postproc/vf_down3dright.c mplayerxp/postproc/vf_eq.c mplayerxp/postproc/vf_expand.c mplayerxp/postproc/vf_flip.c mplayerxp/postproc/vf_format.c mplayerxp/postproc/vf_framestep.c mplayerxp/postproc/vf_il.c mplayerxp/postproc/vf_menu.c mplayerxp/postproc/vf_mirror.c mplayerxp/postproc/vf_noise.c mplayerxp/postproc/vf_ow.c mplayerxp/postproc/vf_palette.c mplayerxp/postproc/vf_panscan.c mplayerxp/postproc/vf_perspective.c mplayerxp/postproc/vf_pp.c mplayerxp/postproc/vf_raw.c mplayerxp/postproc/vf_rectangle.c mplayerxp/postproc/vf_rgb2bgr.c mplayerxp/postproc/vf_rotate.c mplayerxp/postproc/vf_scale.c mplayerxp/postproc/vf_smartblur.c mplayerxp/postproc/vf_softpulldown.c mplayerxp/postproc/vf_swapuv.c mplayerxp/postproc/vf_test.c mplayerxp/postproc/vf_unsharp.c mplayerxp/postproc/vf_vo.c mplayerxp/postproc/vf_yuvcsp.c mplayerxp/postproc/vf_yuy2.c mplayerxp/postproc/vf_yvu9.c mplayerxp/xmp_enums.h Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/ao_alsa9.c 2012-10-31 16:28:22 UTC (rev 269) @@ -131,7 +131,7 @@ } /* to set/get/query special features/parameters */ -static int __FASTCALL__ control(ao_data_t* ao,int cmd, long arg) +static ControlCodes __FASTCALL__ control(ao_data_t* ao,int cmd, long arg) { priv_t*priv=ao->priv; int rval; Modified: mplayerxp/libao2/ao_arts.c =================================================================== --- mplayerxp/libao2/ao_arts.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/ao_arts.c 2012-10-31 16:28:22 UTC (rev 269) @@ -45,7 +45,7 @@ LIBAO_EXTERN(arts) -static int control(ao_data_t* ao,int cmd, long arg) +static ControlCodes control(ao_data_t* ao,int cmd, long arg) { UNUSED(ao); UNUSED(cmd); Modified: mplayerxp/libao2/ao_esd.c =================================================================== --- mplayerxp/libao2/ao_esd.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/ao_esd.c 2012-10-31 16:28:22 UTC (rev 269) @@ -93,7 +93,7 @@ /* * to set/get/query special features/parameters */ -static int control(ao_data_t* ao,int cmd, long arg) +static ControlCodes control(ao_data_t* ao,int cmd, long arg) { priv_t*priv=ao->priv; esd_player_info_t *esd_pi; Modified: mplayerxp/libao2/ao_jack.c =================================================================== --- mplayerxp/libao2/ao_jack.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/ao_jack.c 2012-10-31 16:28:22 UTC (rev 269) @@ -34,10 +34,10 @@ #include "afmt.h" #include "osdep/timer.h" #include "osdep/mplib.h" +#include "ao_msg.h" #include "fifo.h" #include <jack/jack.h> -#include "ao_msg.h" static const ao_info_t info = { @@ -140,7 +140,7 @@ // end ring priv->buffer stuff -static int control(ao_data_t* ao,int cmd, long arg) { +static ControlCodes control(ao_data_t* ao,int cmd, long arg) { UNUSED(ao); UNUSED(cmd); UNUSED(arg); Modified: mplayerxp/libao2/ao_nas.c =================================================================== --- mplayerxp/libao2/ao_nas.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/ao_nas.c 2012-10-31 16:28:22 UTC (rev 269) @@ -368,7 +368,7 @@ } // to set/get/query special features/parameters -static int control(ao_data_t* ao,int cmd, long arg) +static ControlCodes control(ao_data_t* ao,int cmd, long arg) { priv_t*priv=ao->priv; AuElementParameters aep; Modified: mplayerxp/libao2/ao_null.c =================================================================== --- mplayerxp/libao2/ao_null.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/ao_null.c 2012-10-31 16:28:22 UTC (rev 269) @@ -97,7 +97,7 @@ } // to set/get/query special features/parameters -static int __FASTCALL__ control(ao_data_t* ao,int cmd,long arg){ +static ControlCodes __FASTCALL__ control(ao_data_t* ao,int cmd,long arg){ UNUSED(ao); UNUSED(cmd); UNUSED(arg); Modified: mplayerxp/libao2/ao_openal.c =================================================================== --- mplayerxp/libao2/ao_openal.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/ao_openal.c 2012-10-31 16:28:22 UTC (rev 269) @@ -60,7 +60,7 @@ int16_t* tmpbuf; }priv_t; -static int control(ao_data_t* ao,int cmd, long arg) { +static ControlCodes control(ao_data_t* ao,int cmd, long arg) { UNUSED(ao); switch (cmd) { case AOCONTROL_GET_VOLUME: Modified: mplayerxp/libao2/ao_oss.c =================================================================== --- mplayerxp/libao2/ao_oss.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/ao_oss.c 2012-10-31 16:28:22 UTC (rev 269) @@ -42,7 +42,7 @@ const char *oss_mixer_device = PATH_DEV_MIXER; // to set/get/query special features/parameters -static int __FASTCALL__ control(ao_data_t* ao,int cmd,long arg){ +static ControlCodes __FASTCALL__ control(ao_data_t* ao,int cmd,long arg){ priv_t*priv=ao->priv; int rval; switch(cmd){ Modified: mplayerxp/libao2/ao_sdl.c =================================================================== --- mplayerxp/libao2/ao_sdl.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/ao_sdl.c 2012-10-31 16:28:22 UTC (rev 269) @@ -21,12 +21,11 @@ #include "osdep/mplib.h" #include "ao_msg.h" -static ao_info_t info = -{ - "SDLlib audio output", - "sdl", - "Felix Buenemann <atm...@us...>", - "" +static ao_info_t info = { + "SDLlib audio output", + "sdl", + "Felix Buenemann <atm...@us...>", + "" }; LIBAO_EXTERN(sdl) @@ -110,9 +109,8 @@ } #endif - // to set/get/query special features/parameters -static int __FASTCALL__ control(ao_data_t* ao,int cmd,long arg){ +static ControlCodes __FASTCALL__ control(ao_data_t* ao,int cmd,long arg){ priv_t*priv=ao->priv; switch (cmd) { case AOCONTROL_QUERY_FORMAT: Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/ao_wav.c 2012-10-31 16:28:22 UTC (rev 269) @@ -87,7 +87,7 @@ /* init with default values */ // to set/get/query special features/parameters -static int control(ao_data_t* ao,int cmd,long arg){ +static ControlCodes control(ao_data_t* ao,int cmd,long arg){ UNUSED(ao); UNUSED(cmd); UNUSED(arg); Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/audio_out.c 2012-10-31 16:28:22 UTC (rev 269) @@ -262,7 +262,7 @@ if(ao) audio_out->resume(ao); } -int __FASTCALL__ ao_control(ao_data_t*ao,int cmd,long arg) +ControlCodes __FASTCALL__ ao_control(ao_data_t*ao,int cmd,long arg) { return ao?audio_out->control(ao,cmd,arg):CONTROL_ERROR; } Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/audio_out.h 2012-10-31 16:28:22 UTC (rev 269) @@ -5,82 +5,80 @@ /** Text description of AO-driver */ typedef struct ao_info_s { - const char *name; /**< driver name ("alsa driver") */ - const char *short_name; /**< short name (for config strings) ("alsa") */ - const char *author; /**< author ("Aaron Holtzman <aho...@es...>") */ - const char *comment; /**< any additional comments */ + const char *name; /**< driver name ("alsa driver") */ + const char *short_name; /**< short name (for config strings) ("alsa") */ + const char *author; /**< author ("Aaron Holtzman <aho...@es...>") */ + const char *comment;/**< any additional comments */ } ao_info_t; /** Global data used by mplayerxp and plugins */ typedef struct ao_data_s { - char* subdevice; - unsigned samplerate; /**< rate of samples in Hz */ - unsigned channels; /**< number of audio channels */ - unsigned format; /**< format of audio samples */ - unsigned bps; /**< bytes per second */ - unsigned outburst; /**< outburst */ - unsigned buffersize; /**< size of audio buffer */ - float pts; /**< PTS of audio buffer */ - any_t* priv; + char* subdevice; + unsigned samplerate; /**< rate of samples in Hz */ + unsigned channels; /**< number of audio channels */ + unsigned format; /**< format of audio samples */ + unsigned bps; /**< bytes per second */ + unsigned outburst; /**< outburst */ + unsigned buffersize; /**< size of audio buffer */ + float pts; /**< PTS of audio buffer */ + any_t* priv; } ao_data_t; /** AO-driver interface */ typedef struct ao_functions_s { - const ao_info_t *info; /**< text-info about this driver */ + const ao_info_t *info; /**< text-info about this driver */ - /** Control interface - * @param cmd command. See AOCONTROL_** for detail - * @param arg argument associated with command - * @return CONTROL_OK if success CONTROL_FALSE CONTROL_ERROR CONTROL_NA otherwise - **/ - ControlCodes (* __FASTCALL__ control)(ao_data_t*,int cmd,long arg); + /** Control interface + * @param cmd command. See AOCONTROL_** for detail + * @param arg argument associated with command + * @return CONTROL_OK if success CONTROL_FALSE CONTROL_ERROR CONTROL_NA otherwise + **/ + ControlCodes (* __FASTCALL__ control)(ao_data_t*,int cmd,long arg); - /** Preinitializes driver - * @param flag currently unused - * @return 1 on successful initialization, 0 on error. - **/ - int (* __FASTCALL__ init)(ao_data_t*,unsigned flags); + /** Preinitializes driver + * @param flag currently unused + * @return 1 on successful initialization, 0 on error. + **/ + int (* __FASTCALL__ init)(ao_data_t*,unsigned flags); - /** Configures the audio driver. - * @param rate specifies samplerate in Hz - * @param channels specifies number of channels (1 - mono, 2 - stereo, 6 - surround) - * @param format specifies format of audio samples (see AFMT_* for detail) - * @return 1 on successful configuration, 0 on error. - **/ - int (* __FASTCALL__ configure)(ao_data_t*,unsigned rate,unsigned channels,unsigned format); + /** Configures the audio driver. + * @param rate specifies samplerate in Hz + * @param channels specifies number of channels (1 - mono, 2 - stereo, 6 - surround) + * @param format specifies format of audio samples (see AFMT_* for detail) + * @return 1 on successful configuration, 0 on error. + **/ + int (* __FASTCALL__ configure)(ao_data_t*,unsigned rate,unsigned channels,unsigned format); - /** Closes driver. Should restore the original state of the system. - **/ - void (*uninit)(ao_data_t*); + /** Closes driver. Should restore the original state of the system. + **/ + void (* __FASTCALL__ uninit)(ao_data_t*); - /** Stops playing and empties buffers (for seeking/pause) **/ - void (*reset)(ao_data_t*); + /** Stops playing and empties buffers (for seeking/pause) **/ + void (* __FASTCALL__ reset)(ao_data_t*); - /** Returns how many bytes can be played without blocking **/ - unsigned (*get_space)(ao_data_t*); + /** Returns how many bytes can be played without blocking **/ + unsigned (* __FASTCALL__ get_space)(ao_data_t*); - /** Plays decoded (PCM) audio buffer - * @param data buffer with PCM data - * @param len length of byffer in bytes - * @param flags currently unused - * return number of bytes which were copied into audio card - **/ - unsigned (* __FASTCALL__ play)(ao_data_t*,any_t* data,unsigned len,unsigned flags); + /** Plays decoded (PCM) audio buffer + * @param data buffer with PCM data + * @param len length of byffer in bytes + * @param flags currently unused + * return number of bytes which were copied into audio card + **/ + unsigned (* __FASTCALL__ play)(ao_data_t*,any_t* data,unsigned len,unsigned flags); - /** Returns delay in seconds between first and last sample in buffer **/ - float (*get_delay)(ao_data_t*); + /** Returns delay in seconds between first and last sample in buffer **/ + float (* __FASTCALL__ get_delay)(ao_data_t*); - /** Stops playing, keep buffers (for pause) */ - void (*pause)(ao_data_t*); + /** Stops playing, keep buffers (for pause) */ + void (* __FASTCALL__ pause)(ao_data_t*); - /** Resumes playing, after audio_pause() */ - void (*resume)(ao_data_t*); + /** Resumes playing, after audio_pause() */ + void (* __FASTCALL__ resume)(ao_data_t*); } ao_functions_t; -extern const ao_functions_t* audio_out_drivers[]; /**< NULL terminated array of all drivers */ - enum { AOCONTROL_SET_DEVICE =1, /**< Sets new audio device (example: /dev/dsp2) */ AOCONTROL_GET_DEVICE =2, /**< Query current audio device (example: /dev/dsp) */ @@ -91,8 +89,8 @@ AOCONTROL_SET_VOLUME =7 /**< Sets new volume level */ }; typedef struct ao_control_vol_s { - float left; - float right; + float left; + float right; } ao_control_vol_t; /* prototypes */ @@ -102,14 +100,14 @@ extern void ao_print_help( void ); extern const ao_functions_t* __FASTCALL__ ao_register(const char *driver_name); extern const ao_info_t* ao_get_info( void ); -extern ao_data_t* __FASTCALL__ ao_init(unsigned flags,const char *subdevice); -extern int __FASTCALL__ ao_configure(ao_data_t* priv,unsigned rate,unsigned channels,unsigned format); -extern void ao_uninit(ao_data_t* priv); -extern void ao_reset(ao_data_t* priv); -extern unsigned ao_get_space(ao_data_t* priv); -extern unsigned __FASTCALL__ ao_play(ao_data_t* priv,any_t* data,unsigned len,unsigned flags); -extern float ao_get_delay(ao_data_t* priv); -extern void ao_pause(ao_data_t* priv); -extern void ao_resume(ao_data_t* priv); -extern int __FASTCALL__ ao_control(ao_data_t* priv,int cmd,long arg); +extern ao_data_t* __FASTCALL__ ao_init(unsigned flags,const char *subdevice); +extern int __FASTCALL__ ao_configure(ao_data_t* priv,unsigned rate,unsigned channels,unsigned format); +extern void __FASTCALL__ ao_uninit(ao_data_t* priv); +extern void __FASTCALL__ ao_reset(ao_data_t* priv); +extern unsigned __FASTCALL__ ao_get_space(ao_data_t* priv); +extern unsigned __FASTCALL__ ao_play(ao_data_t* priv,any_t* data,unsigned len,unsigned flags); +extern float __FASTCALL__ ao_get_delay(ao_data_t* priv); +extern void __FASTCALL__ ao_pause(ao_data_t* priv); +extern void __FASTCALL__ ao_resume(ao_data_t* priv); +extern ControlCodes __FASTCALL__ ao_control(ao_data_t* priv,int cmd,long arg); #endif Modified: mplayerxp/libao2/audio_out_internal.h =================================================================== --- mplayerxp/libao2/audio_out_internal.h 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libao2/audio_out_internal.h 2012-10-31 16:28:22 UTC (rev 269) @@ -1,16 +1,16 @@ -#include "../mp_config.h" +#include "mp_config.h" // prototypes: //static ao_info_t info; -static int __FASTCALL__ control(ao_data_t*,int cmd,long arg); +static ControlCodes __FASTCALL__ control(ao_data_t*,int cmd,long arg); static int __FASTCALL__ init(ao_data_t*,unsigned flags); static int __FASTCALL__ configure(ao_data_t*,unsigned rate,unsigned channels,unsigned format); -static void uninit(ao_data_t*); -static void reset(ao_data_t*); -static unsigned get_space(ao_data_t*); +static void __FASTCALL__ uninit(ao_data_t*); +static void __FASTCALL__ reset(ao_data_t*); +static unsigned __FASTCALL__ get_space(ao_data_t*); static unsigned __FASTCALL__ play(ao_data_t*,any_t* data,unsigned len,unsigned flags); -static float get_delay(ao_data_t*); -static void audio_pause(ao_data_t*); -static void audio_resume(ao_data_t*); +static float __FASTCALL__ get_delay(ao_data_t*); +static void __FASTCALL__ audio_pause(ao_data_t*); +static void __FASTCALL__ audio_resume(ao_data_t*); #define LIBAO_EXTERN(x) const ao_functions_t audio_out_##x =\ {\ Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad.h 2012-10-31 16:28:22 UTC (rev 269) @@ -25,14 +25,13 @@ { const ad_info_t *info; const config_t* options;/**< Optional: MPlayerXP's option related */ - int (*preinit)(sh_audio_t *); - int (*init)(sh_audio_t *sh); - void (*uninit)(sh_audio_t *sh); - ControlCodes (*control)(sh_audio_t *sh,int cmd,any_t* arg, ...); - unsigned (*decode)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); + int (* __FASTCALL__ preinit)(sh_audio_t *); + int (* __FASTCALL__ init)(sh_audio_t *sh); + void (* __FASTCALL__ uninit)(sh_audio_t *sh); + ControlCodes (* __FASTCALL__ control)(sh_audio_t *sh,int cmd,any_t* arg, ...); + unsigned (* __FASTCALL__ decode)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); } ad_functions_t; -// NULL terminated array of all drivers extern const ad_functions_t* mpcodecs_ad_drivers[]; #define FIX_APTS(sh_audio,pts,in_size) (sh_audio->i_bps?((float)(pts)+(float)(in_size)/(float)sh_audio->i_bps):((float)(pts))) Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-10-31 16:28:22 UTC (rev 269) @@ -192,7 +192,7 @@ mp_free(sh->context); } -int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { UNUSED(arg); switch(cmd) Modified: mplayerxp/libmpcodecs/ad_acm.c =================================================================== --- mplayerxp/libmpcodecs/ad_acm.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_acm.c 2012-10-31 16:28:22 UTC (rev 269) @@ -159,7 +159,7 @@ mp_free(sh->context); } -int control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) { int skip; switch(cmd) Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_dca.c 2012-10-31 16:28:22 UTC (rev 269) @@ -192,7 +192,7 @@ mp_free(sh->context); } -int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { UNUSED(arg); switch(cmd) Modified: mplayerxp/libmpcodecs/ad_dmo.c =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_dmo.c 2012-10-31 16:28:22 UTC (rev 269) @@ -71,7 +71,7 @@ mp_free(priv); } -static int control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) +static ControlCodes control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) { int skip; UNUSED(arg); Modified: mplayerxp/libmpcodecs/ad_dshow.c =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_dshow.c 2012-10-31 16:28:22 UTC (rev 269) @@ -63,7 +63,7 @@ mp_free(priv); } -int control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) { int skip; UNUSED(arg); Modified: mplayerxp/libmpcodecs/ad_dvdpcm.c =================================================================== --- mplayerxp/libmpcodecs/ad_dvdpcm.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_dvdpcm.c 2012-10-31 16:28:22 UTC (rev 269) @@ -72,7 +72,7 @@ UNUSED(sh); } -int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { int skip; UNUSED(arg); Modified: mplayerxp/libmpcodecs/ad_faad.c =================================================================== --- mplayerxp/libmpcodecs/ad_faad.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_faad.c 2012-10-31 16:28:22 UTC (rev 269) @@ -268,7 +268,7 @@ mp_free(sh->context); } -static int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +static ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { UNUSED(sh); UNUSED(cmd); Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-31 16:28:22 UTC (rev 269) @@ -137,7 +137,7 @@ acodec_inited=0; } -int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { UNUSED(arg); AVCodecContext *lavc_context = sh->context; Modified: mplayerxp/libmpcodecs/ad_hwac3.c =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-31 16:28:22 UTC (rev 269) @@ -202,7 +202,7 @@ mpcodecs_ad_a52.uninit(sh); } -int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { UNUSED(arg); switch(cmd) Modified: mplayerxp/libmpcodecs/ad_internal.h =================================================================== --- mplayerxp/libmpcodecs/ad_internal.h 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_internal.h 2012-10-31 16:28:22 UTC (rev 269) @@ -13,11 +13,11 @@ #include "ad_msg.h" static const config_t options[]; -static int init(sh_audio_t *sh); -static int preinit(sh_audio_t *sh); -static void uninit(sh_audio_t *sh); -static int control(sh_audio_t *sh,int cmd,any_t* arg, ...); -static unsigned decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); +static int __FASTCALL__ init(sh_audio_t *sh); +static int __FASTCALL__ preinit(sh_audio_t *sh); +static void __FASTCALL__ uninit(sh_audio_t *sh); +static ControlCodes __FASTCALL__ control(sh_audio_t *sh,int cmd,any_t* arg, ...); +static unsigned __FASTCALL__ decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); #define LIBAD_EXTERN(x) const ad_functions_t mpcodecs_ad_##x = {\ &info,\ Modified: mplayerxp/libmpcodecs/ad_libdv.c =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_libdv.c 2012-10-31 16:28:22 UTC (rev 269) @@ -77,7 +77,7 @@ mp_free(priv->audioBuffers[i]); } -static int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +static ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { // TODO!!! UNUSED(sh); Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-31 16:28:22 UTC (rev 269) @@ -344,7 +344,7 @@ dlclose(dll_handle); } -int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { UNUSED(sh); UNUSED(cmd); Modified: mplayerxp/libmpcodecs/ad_null.c =================================================================== --- mplayerxp/libmpcodecs/ad_null.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_null.c 2012-10-31 16:28:22 UTC (rev 269) @@ -34,7 +34,7 @@ UNUSED(sh); } -int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { UNUSED(sh); UNUSED(cmd); Modified: mplayerxp/libmpcodecs/ad_pcm.c =================================================================== --- mplayerxp/libmpcodecs/ad_pcm.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_pcm.c 2012-10-31 16:28:22 UTC (rev 269) @@ -67,7 +67,7 @@ UNUSED(sh); } -int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { int skip; UNUSED(arg); Modified: mplayerxp/libmpcodecs/ad_qtaudio.c =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-31 16:28:22 UTC (rev 269) @@ -313,7 +313,7 @@ return ConvertedBytes; } -static int control(sh_audio_t *sh,int cmd,any_t* arg, ...){ +static ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...){ // various optional functions you MAY implement: UNUSED(sh); UNUSED(cmd); Modified: mplayerxp/libmpcodecs/ad_real.c =================================================================== --- mplayerxp/libmpcodecs/ad_real.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_real.c 2012-10-31 16:28:22 UTC (rev 269) @@ -282,7 +282,7 @@ // or -1 for EOF (or uncorrectable error) } -static int control(sh_audio_t *sh,int cmd,any_t* arg, ...){ +static ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...){ UNUSED(sh); UNUSED(arg); // various optional functions you MAY implement: Modified: mplayerxp/libmpcodecs/ad_twin.c =================================================================== --- mplayerxp/libmpcodecs/ad_twin.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_twin.c 2012-10-31 16:28:22 UTC (rev 269) @@ -351,7 +351,7 @@ FreeLibrary(vqf_dll); } -int control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) +ControlCodes control(sh_audio_t *sh_audio,int cmd,any_t* arg, ...) { int skip; UNUSED(arg); Modified: mplayerxp/libmpcodecs/ad_vorbis.c =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-31 16:28:22 UTC (rev 269) @@ -124,7 +124,7 @@ mp_free(sh->context); } -static int control(sh_audio_t *sh,int cmd,any_t* arg, ...) +static ControlCodes control(sh_audio_t *sh,int cmd,any_t* arg, ...) { UNUSED(sh); UNUSED(cmd); Modified: mplayerxp/libmpcodecs/dec_audio.h =================================================================== --- mplayerxp/libmpcodecs/dec_audio.h 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/dec_audio.h 2012-10-31 16:28:22 UTC (rev 269) @@ -1,11 +1,11 @@ #ifndef DEC_AUDIO_H_INCLUDED #define DEC_AUDIO_H_INCLUDED 1 // dec_audio.c: -extern int mpca_init(sh_audio_t *sh_audio); -extern void mpca_uninit(sh_audio_t *sh_audio); -extern unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts); -extern void mpca_resync_stream(sh_audio_t *sh_audio); -extern void mpca_skip_frame(sh_audio_t *sh_audio); +extern int __FASTCALL__ mpca_init(sh_audio_t *sh_audio); +extern void __FASTCALL__ mpca_uninit(sh_audio_t *sh_audio); +extern unsigned __FASTCALL__ mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts); +extern void __FASTCALL__ mpca_resync_stream(sh_audio_t *sh_audio); +extern void __FASTCALL__ mpca_skip_frame(sh_audio_t *sh_audio); extern int mpca_init_filters(sh_audio_t *sh_audio, int in_samplerate, int in_channels, int in_format, int in_bps, Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/dec_video.h 2012-10-31 16:28:22 UTC (rev 269) @@ -2,16 +2,16 @@ #define DEC_VIDEO_H_INCLUDED 1 // dec_video.c: -extern int mpcv_init(sh_video_t *sh_video, const char *codec_name,const char *family,int status); -extern void mpcv_uninit(sh_video_t *sh_video); +extern int __FASTCALL__ mpcv_init(sh_video_t *sh_video, const char *codec_name,const char *family,int status); +extern void __FASTCALL__ mpcv_uninit(sh_video_t *sh_video); -extern int mpcv_decode(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame,float pts); +extern int __FASTCALL__ mpcv_decode(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame,float pts); -extern int mpcv_get_quality_max(sh_video_t *sh_video); -extern void mpcv_set_quality(sh_video_t *sh_video,int quality); +extern int __FASTCALL__ mpcv_get_quality_max(sh_video_t *sh_video); +extern void __FASTCALL__ mpcv_set_quality(sh_video_t *sh_video,int quality); -extern int mpcv_set_colors(sh_video_t *sh_video,char *item,int value); -extern void mpcv_resync_stream(sh_video_t *sh_video); +extern int __FASTCALL__ mpcv_set_colors(sh_video_t *sh_video,char *item,int value); +extern void __FASTCALL__ mpcv_resync_stream(sh_video_t *sh_video); extern int divx_quality; Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd.h 2012-10-31 16:28:22 UTC (rev 269) @@ -17,10 +17,10 @@ { const vd_info_t *info; const config_t* options;/**< Optional: MPlayerXP's option related */ - int (*init)(sh_video_t *sh); - void (*uninit)(sh_video_t *sh); - ControlCodes (*control)(sh_video_t *sh,int cmd,any_t* arg, ...); - mp_image_t* (*decode)(sh_video_t *sh,any_t* data,int len,int flags); + int (*__FASTCALL__ init)(sh_video_t *sh); + void (*__FASTCALL__ uninit)(sh_video_t *sh); + ControlCodes (*__FASTCALL__ control)(sh_video_t *sh,int cmd,any_t* arg, ...); + mp_image_t* (*__FASTCALL__ decode)(sh_video_t *sh,any_t* data,int len,int flags); } vd_functions_t; // NULL terminated array of all drivers @@ -34,9 +34,9 @@ VDCTRL_RESYNC_STREAM =7 /* resync video stream if needed */ }; // callbacks: -int mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t*tune); -mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,int w, int h); -void mpcodecs_draw_slice(sh_video_t* sh, mp_image_t*); -void mpcodecs_draw_image(sh_video_t* sh, mp_image_t *mpi); +int __FASTCALL__ mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t*tune); +mp_image_t* __FASTCALL__ mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,int w, int h); +void __FASTCALL__ mpcodecs_draw_slice(sh_video_t* sh, mp_image_t*); +void __FASTCALL__ mpcodecs_draw_image(sh_video_t* sh, mp_image_t *mpi); #endif Modified: mplayerxp/libmpcodecs/vd_divx4.c =================================================================== --- mplayerxp/libmpcodecs/vd_divx4.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_divx4.c 2012-10-31 16:28:22 UTC (rev 269) @@ -138,7 +138,7 @@ static any_t*dll_handle; // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ priv_t*p=sh->context; switch(cmd){ case VDCTRL_QUERY_MAX_PP_LEVEL: return 100; // for divx4linux Modified: mplayerxp/libmpcodecs/vd_dmo.c =================================================================== --- mplayerxp/libmpcodecs/vd_dmo.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_dmo.c 2012-10-31 16:28:22 UTC (rev 269) @@ -28,7 +28,7 @@ LIBVD_EXTERN(dmo) // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ switch(cmd){ case VDCTRL_QUERY_FORMAT: if (*((int*)arg) == IMGFMT_YV12 || Modified: mplayerxp/libmpcodecs/vd_dshow.c =================================================================== --- mplayerxp/libmpcodecs/vd_dshow.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_dshow.c 2012-10-31 16:28:22 UTC (rev 269) @@ -26,7 +26,7 @@ LIBVD_EXTERN(dshow) // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ switch(cmd){ case VDCTRL_QUERY_MAX_PP_LEVEL: return 4; Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-31 16:28:22 UTC (rev 269) @@ -125,7 +125,7 @@ }; /* to set/get/query special features/parameters */ -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ priv_t *ctx = sh->context; uint32_t out_fourcc; AVCodecContext *avctx = ctx->ctx; Modified: mplayerxp/libmpcodecs/vd_huffyuv.c =================================================================== --- mplayerxp/libmpcodecs/vd_huffyuv.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_huffyuv.c 2012-10-31 16:28:22 UTC (rev 269) @@ -160,10 +160,8 @@ DecodeTable *decode_table, unsigned char *decode_shift); - - // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...) +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...) { switch(cmd) { case VDCTRL_QUERY_FORMAT: Modified: mplayerxp/libmpcodecs/vd_internal.h =================================================================== --- mplayerxp/libmpcodecs/vd_internal.h 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_internal.h 2012-10-31 16:28:22 UTC (rev 269) @@ -14,10 +14,10 @@ // prototypes: //static vd_info_t info; static const config_t options[]; -static int control(sh_video_t *sh,int cmd,any_t* arg,...); -static int init(sh_video_t *sh); -static void uninit(sh_video_t *sh); -static mp_image_t* decode(sh_video_t *sh,any_t* data,int len,int flags); +static ControlCodes __FASTCALL__ control(sh_video_t *sh,int cmd,any_t* arg,...); +static int __FASTCALL__ init(sh_video_t *sh); +static void __FASTCALL__ uninit(sh_video_t *sh); +static mp_image_t* __FASTCALL__ decode(sh_video_t *sh,any_t* data,int len,int flags); #define LIBVD_EXTERN(x) const vd_functions_t mpcodecs_vd_##x = {\ &info,\ Modified: mplayerxp/libmpcodecs/vd_libdv.c =================================================================== --- mplayerxp/libmpcodecs/vd_libdv.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_libdv.c 2012-10-31 16:28:22 UTC (rev 269) @@ -33,7 +33,7 @@ LIBVD_EXTERN(libdv) // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ return CONTROL_UNKNOWN; } Modified: mplayerxp/libmpcodecs/vd_libmpeg2.c =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-10-31 16:28:22 UTC (rev 269) @@ -166,7 +166,7 @@ } // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ priv_t *priv; priv=sh->context; switch(cmd) Modified: mplayerxp/libmpcodecs/vd_mpegpes.c =================================================================== --- mplayerxp/libmpcodecs/vd_mpegpes.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_mpegpes.c 2012-10-31 16:28:22 UTC (rev 269) @@ -20,7 +20,7 @@ LIBVD_EXTERN(mpegpes) // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ return CONTROL_UNKNOWN; } Modified: mplayerxp/libmpcodecs/vd_null.c =================================================================== --- mplayerxp/libmpcodecs/vd_null.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_null.c 2012-10-31 16:28:22 UTC (rev 269) @@ -20,7 +20,7 @@ LIBVD_EXTERN(null) // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ return CONTROL_UNKNOWN; } Modified: mplayerxp/libmpcodecs/vd_nuv.c =================================================================== --- mplayerxp/libmpcodecs/vd_nuv.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_nuv.c 2012-10-31 16:28:22 UTC (rev 269) @@ -19,7 +19,7 @@ LIBVD_EXTERN(nuv) // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ switch(cmd) { case VDCTRL_QUERY_FORMAT: if (*((int*)arg) == IMGFMT_I420 || Modified: mplayerxp/libmpcodecs/vd_qtvideo.c =================================================================== --- mplayerxp/libmpcodecs/vd_qtvideo.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_qtvideo.c 2012-10-31 16:28:22 UTC (rev 269) @@ -93,7 +93,7 @@ static OSErr (*NewHandleClear)(Size byteCount); // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ switch(cmd) { case VDCTRL_QUERY_FORMAT: if (*((int*)arg) == IMGFMT_YV12 || Modified: mplayerxp/libmpcodecs/vd_raw.c =================================================================== --- mplayerxp/libmpcodecs/vd_raw.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_raw.c 2012-10-31 16:28:22 UTC (rev 269) @@ -19,7 +19,7 @@ LIBVD_EXTERN(raw) // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ switch(cmd) { case VDCTRL_QUERY_FORMAT: return CONTROL_TRUE; Modified: mplayerxp/libmpcodecs/vd_real.c =================================================================== --- mplayerxp/libmpcodecs/vd_real.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_real.c 2012-10-31 16:28:22 UTC (rev 269) @@ -79,7 +79,7 @@ // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ switch(cmd){ // case VDCTRL_QUERY_MAX_PP_LEVEL: // return 9; Modified: mplayerxp/libmpcodecs/vd_theora.c =================================================================== --- mplayerxp/libmpcodecs/vd_theora.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_theora.c 2012-10-31 16:28:22 UTC (rev 269) @@ -37,7 +37,7 @@ } theora_struct_t; // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ switch(cmd) { case VDCTRL_QUERY_FORMAT: if (*((int*)arg) == IMGFMT_YV12) Modified: mplayerxp/libmpcodecs/vd_vfw.c =================================================================== --- mplayerxp/libmpcodecs/vd_vfw.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_vfw.c 2012-10-31 16:28:22 UTC (rev 269) @@ -219,7 +219,7 @@ } // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ vfw_priv_t *priv = sh->context; switch(cmd){ case VDCTRL_QUERY_MAX_PP_LEVEL: Modified: mplayerxp/libmpcodecs/vd_xanim.c =================================================================== --- mplayerxp/libmpcodecs/vd_xanim.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_xanim.c 2012-10-31 16:28:22 UTC (rev 269) @@ -893,7 +893,7 @@ /*************************** END OF XA CODEC BINARY INTERFACE ******************/ // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ switch(cmd) { case VDCTRL_QUERY_FORMAT: if (*((int*)arg) == IMGFMT_YV12 || Modified: mplayerxp/libmpcodecs/vd_xvid.c =================================================================== --- mplayerxp/libmpcodecs/vd_xvid.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libmpcodecs/vd_xvid.c 2012-10-31 16:28:22 UTC (rev 269) @@ -459,7 +459,7 @@ } // to set/get/query special features/parameters -static int control(sh_video_t *sh,int cmd,any_t* arg,...){ +static ControlCodes control(sh_video_t *sh,int cmd,any_t* arg,...){ priv_t* p = sh->context; switch(cmd){ case VDCTRL_QUERY_MAX_PP_LEVEL: Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libvo/video_out.c 2012-10-31 16:28:22 UTC (rev 269) @@ -435,7 +435,7 @@ priv->image_width = w; priv->image_height = h; ps_tune(vo,priv->image_width,priv->org_height); - if(dri_retv == VO_TRUE) dri_reconfig(vo,0); + if(dri_retv == CONTROL_TRUE) dri_reconfig(vo,0); MSG_V("dri_vo_caps: driver does %s support DRI\n",priv->dri.has_dri?"":"not"); MSG_V("dri_vo_caps: caps=%08X fourcc=%08X(%s) x,y,w,h(%u %u %u %u)\n" "dri_vo_caps: width_height(%u %u) strides(%u %u %u %u) priv->dri.bpp=%u\n" @@ -531,25 +531,25 @@ if(mpi->type==MP_IMGTYPE_STATIC && priv->dri.num_xp_frames>1) { MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL mpi->type==MP_IMGTYPE_STATIC && priv->dri.num_xp_frames>1\n"); - return VO_FALSE; + return CONTROL_FALSE; } /*I+P requires 2+ static buffers for R/W */ if(mpi->type==MP_IMGTYPE_IP && (priv->dri.num_xp_frames < 2 || (priv->dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED)) { MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL (mpi->type==MP_IMGTYPE_IP && priv->dri.num_xp_frames < 2) || (priv->dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); - return VO_FALSE; + return CONTROL_FALSE; } /*I+P+B requires 3+ static buffers for R/W */ if(mpi->type==MP_IMGTYPE_IPB && (priv->dri.num_xp_frames != 3 || (priv->dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED)) { MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL (mpi->type==MP_IMGTYPE_IPB && priv->dri.num_xp_frames != 3) || (priv->dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); - return VO_FALSE; + return CONTROL_FALSE; } /* video surface is bad thing for reading */ if(((mpi->flags&MP_IMGFLAG_READABLE)||(mpi->type==MP_IMGTYPE_TEMP)) && (priv->dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED) { MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL mpi->flags&MP_IMGFLAG_READABLE && (priv->dri.cap.caps&DRI_CAP_VIDEO_MMAPED)==DRI_CAP_VIDEO_MMAPED\n"); - return VO_FALSE; + return CONTROL_FALSE; } /* it seems that surfaces are equal */ if((((mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && width_less_stride) || priv->dri.planes_eq) && priv->dri.dr) @@ -564,12 +564,12 @@ mpi->flags|=MP_IMGFLAG_DIRECT; vo_unlock_surfaces(vo); MSG_DBG2("dri_vo_dbg: vo_get_surface OK\n"); - return VO_TRUE; + return CONTROL_TRUE; } MSG_DBG2("dri_vo_dbg: vo_get_surface FAIL (mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE && width_less_stride) || priv->dri.planes_eq) && priv->dri.dr\n"); - return VO_FALSE; + return CONTROL_FALSE; } - else return VO_FALSE; + else return CONTROL_FALSE; } static int __FASTCALL__ adjust_size(any_t*vo,unsigned cw,unsigned ch,unsigned *nw,unsigned *nh) @@ -612,7 +612,7 @@ but there is only one driver (vo_x11) which changes surfaces on 'fullscreen' key */ need_repaint=0; - if(priv->dri.has_dri && retval == VO_TRUE && (vrest.event_type & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) + if(priv->dri.has_dri && retval == CONTROL_TRUE && (vrest.event_type & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) { need_repaint=1; dri_reconfig(vo,vrest.event_type); @@ -627,9 +627,9 @@ MSG_DBG3("dri_vo_dbg: vo_fullscreen\n"); etype = 0; retval = video_out->control(vo,VOCTRL_FULLSCREEN,&etype); - if(priv->dri.has_dri && retval == VO_TRUE && (etype & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) + if(priv->dri.has_dri && retval == CONTROL_TRUE && (etype & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) dri_reconfig(vo,etype); - if(retval == VO_TRUE) priv->dri.flags ^= VOFLG_FS; + if(retval == CONTROL_TRUE) priv->dri.flags ^= VOFLG_FS; return retval; } @@ -895,7 +895,7 @@ mp_free(vo->vo_priv); } -uint32_t __FASTCALL__ vo_control(vo_data_t*vo,uint32_t request, any_t*data) +ControlCodes __FASTCALL__ vo_control(vo_data_t*vo,uint32_t request, any_t*data) { uint32_t rval; rval=video_out->control(vo,request,data); Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libvo/video_out.h 2012-10-31 16:28:22 UTC (rev 269) @@ -5,7 +5,7 @@ * Strongly modified, most parts rewritten: A'rpi/ESP-team - 2000-2001 * */ - + #ifndef __VIDEO_OUT_H #define __VIDEO_OUT_H 1 @@ -21,6 +21,7 @@ #include "libmpsub/subreader.h" #include "img_format.h" #include "mp_image.h" +#include "xmp_enums.h" enum { VO_EVENT_EXPOSE=1, @@ -48,14 +49,6 @@ }; enum { - VO_TRUE=1, - VO_FALSE=0, - VO_ERROR=-1, - VO_NOTAVAIL=-2, - VO_NOTIMPL=-3 -}; - -enum { VOFLAG_FULLSCREEN=0x01, /**< User wants to have fullscreen playback */ VOFLAG_MODESWITCHING=0x02, /**< User enables to find the best video mode */ VOFLAG_SWSCALE=0x04, /**< Obsolete. User enables slow Software scaler */ @@ -115,13 +108,13 @@ }vo_videq_t; typedef struct vo_gamma_s{ - int brightness; - int saturation; - int contrast; - int hue; - int red_intensity; - int green_intensity; - int blue_intensity; + int brightness; + int saturation; + int contrast; + int hue; + int red_intensity; + int green_intensity; + int blue_intensity; }vo_gamma_t; typedef struct vo_rect_s { @@ -229,14 +222,14 @@ /** Control interface * @param request command. See VOCTRL_** for detail * @param data data associated with command - * @return VO_TRUE if success VO_FALSE VO_ERROR VO_NOTIMPL otherwise + * @return CONTROL_TRUE if success CONTROL_FALSE VO_ERROR CONTROL_NA otherwise **/ - uint32_t (* __FASTCALL__ control)(vo_data_t* vo,uint32_t request, any_t*data); + ControlCodes (* __FASTCALL__ control)(vo_data_t* vo,uint32_t request, any_t*data); /** Returns driver information. * @return read-only pointer to a vo_info_t structure. **/ - const vo_info_t* (*get_info)(vo_data_t* vo); + const vo_info_t* (* __FASTCALL__ get_info)(vo_data_t* vo); /** Blit/Flip buffer to the screen. Must be called after each frame! * @param idex index of frame to be selected as active frame @@ -245,7 +238,7 @@ /** Closes driver. Should restore the original state of the system. **/ - void (*uninit)(vo_data_t* vo); + void (* __FASTCALL__ uninit)(vo_data_t* vo); } vo_functions_t; @@ -280,7 +273,7 @@ extern void vo_draw_osd(vo_data_t* vo,unsigned idx); extern void vo_draw_spudec_direct(vo_data_t* vo,unsigned idx); extern void vo_uninit(vo_data_t* vo); -extern uint32_t __FASTCALL__ vo_control(vo_data_t* vo,uint32_t request, any_t*data); +extern ControlCodes __FASTCALL__ vo_control(vo_data_t* vo,uint32_t request, any_t*data); extern int __FASTCALL__ vo_is_final(vo_data_t* vo); /** Contains geometry of fourcc */ Modified: mplayerxp/libvo/video_out_internal.h =================================================================== --- mplayerxp/libvo/video_out_internal.h 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libvo/video_out_internal.h 2012-10-31 16:28:22 UTC (rev 269) @@ -22,13 +22,13 @@ */ #ifndef __VIDEO_OUT_INTERNAL_H #define __VIDEO_OUT_INTERNAL_H 1 -static uint32_t __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data); +static ControlCodes __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data); static uint32_t __FASTCALL__ config(vo_data_t*vo,uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *); -static const vo_info_t* get_info(vo_data_t*vo); +static const vo_info_t* __FASTCALL__ get_info(vo_data_t*vo); static void __FASTCALL__ select_frame(vo_data_t*vo,unsigned idx); -static void uninit(vo_data_t*vo); +static void __FASTCALL__ uninit(vo_data_t*vo); static uint32_t __FASTCALL__ preinit(vo_data_t*vo,const char *); #define LIBVO_EXTERN(x) vo_functions_t video_out_##x =\ Modified: mplayerxp/libvo/vo_dga.c =================================================================== --- mplayerxp/libvo/vo_dga.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libvo/vo_dga.c 2012-10-31 16:28:22 UTC (rev 269) @@ -781,7 +781,7 @@ surf->planes[3] = 0; } -static uint32_t __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) +static ControlCodes __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) { priv_t*priv=(priv_t*)vo->priv; switch (request) { @@ -790,16 +790,16 @@ case VOCTRL_CHECK_EVENTS: check_events(vo); (*(vo_resize_t *)data).event_type = 0; /* VO_EVENT_RESIZE is meaningless here */ - return VO_TRUE; + return CONTROL_TRUE; case VOCTRL_GET_NUM_FRAMES: *(uint32_t *)data = priv->num_buffers; - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE_CAPS: dga_dri_get_surface_caps(vo,data); - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE: dga_dri_get_surface(vo,data); - return VO_TRUE; + return CONTROL_TRUE; } - return VO_NOTIMPL; + return CONTROL_NA; } Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libvo/vo_fbdev.c 2012-10-31 16:28:22 UTC (rev 269) @@ -1152,7 +1152,7 @@ surf->planes[3] = 0; } -static uint32_t __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) +static ControlCodes __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) { priv_t*priv=(priv_t*)vo->priv; switch (request) { @@ -1160,13 +1160,13 @@ return query_format(vo,(vo_query_fourcc_t*)data); case VOCTRL_GET_NUM_FRAMES: *(uint32_t *)data = priv->total_fr; - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE_CAPS: fbdev_dri_get_surface_caps(vo,data); - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE: fbdev_dri_get_surface(vo,data); - return VO_TRUE; + return CONTROL_TRUE; } - return VO_NOTIMPL; + return CONTROL_NA; } Modified: mplayerxp/libvo/vo_null.c =================================================================== --- mplayerxp/libvo/vo_null.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libvo/vo_null.c 2012-10-31 16:28:22 UTC (rev 269) @@ -256,12 +256,12 @@ case IMGFMT_BG4B: case IMGFMT_RG4B: case IMGFMT_BGR1: - case IMGFMT_RGB1: return VO_TRUE; + case IMGFMT_RGB1: return CONTROL_TRUE; } - return VO_FALSE; + return CONTROL_FALSE; } -static uint32_t __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) +static ControlCodes __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) { priv_t*priv=(priv_t*)vo->priv; switch (request) { @@ -269,15 +269,15 @@ return null_query_format(data); case VOCTRL_GET_NUM_FRAMES: *(uint32_t *)data = priv->num_frames; - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE_CAPS: null_dri_get_surface_caps(vo,data); - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE: null_dri_get_surface(vo,data); - return VO_TRUE; + return CONTROL_TRUE; case VOCTRL_FLUSH_PAGES: - return VO_TRUE; + return CONTROL_TRUE; } - return VO_NOTIMPL; + return CONTROL_NA; } Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libvo/vo_opengl.c 2012-10-31 16:28:22 UTC (rev 269) @@ -369,7 +369,7 @@ surf->planes[3] = 0; } -static uint32_t control(vo_data_t*vo,uint32_t request, any_t*data) +static ControlCodes control(vo_data_t*vo,uint32_t request, any_t*data) { priv_t*priv=(priv_t*)vo->priv; switch (request) { @@ -378,21 +378,21 @@ case VOCTRL_FULLSCREEN: vo_fullscreen(vo); resize(vo,vo->dest.w, vo->dest.h); - return VO_TRUE; + return CONTROL_TRUE; case VOCTRL_GET_NUM_FRAMES: *(uint32_t *)data = priv->num_buffers; - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE_CAPS: gl_dri_get_surface_caps(vo,data); - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE: gl_dri_get_surface(vo,data); - return VO_TRUE; + return CONTROL_TRUE; case VOCTRL_CHECK_EVENTS: { vo_resize_t * vrest = (vo_resize_t *)data; vrest->event_type = check_events(vo,vrest->adjust_size); - return VO_TRUE; + return CONTROL_TRUE; } } - return VO_NOTIMPL; + return CONTROL_NA; } Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libvo/vo_sdl.c 2012-10-31 16:28:22 UTC (rev 269) @@ -1285,7 +1285,7 @@ } } -static uint32_t __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) +static ControlCodes __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) { priv_t *priv = vo->priv; switch (request) { @@ -1293,17 +1293,17 @@ return query_format(vo,(vo_query_fourcc_t*)data); case VOCTRL_GET_NUM_FRAMES: *(uint32_t *)data = priv->num_buffs; - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE_CAPS: sdl_dri_get_surface_caps(vo,data); - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE: sdl_dri_get_surface(vo,data); - return VO_TRUE; + return CONTROL_TRUE; case VOCTRL_CHECK_EVENTS: { vo_resize_t * vrest = (vo_resize_t *)data; vrest->event_type = check_events(vo,vrest->adjust_size); - return VO_TRUE; + return CONTROL_TRUE; } case VOCTRL_FULLSCREEN: if (priv->surface->flags & SDL_FULLSCREEN) { @@ -1315,7 +1315,7 @@ MSG_V("SDL: Set fullscreen mode\n"); } *(uint32_t *)data = VO_EVENT_RESIZE; - return VO_TRUE; + return CONTROL_TRUE; } - return VO_NOTIMPL; + return CONTROL_NA; } Modified: mplayerxp/libvo/vo_vesa.c =================================================================== --- mplayerxp/libvo/vo_vesa.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libvo/vo_vesa.c 2012-10-31 16:28:22 UTC (rev 269) @@ -758,7 +758,7 @@ surf->planes[3] = 0; } -static uint32_t __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) +static ControlCodes __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) { priv_t*priv=(priv_t*)vo->priv; switch (request) { @@ -766,13 +766,13 @@ return query_format((vo_query_fourcc_t*)data); case VOCTRL_GET_NUM_FRAMES: *(uint32_t *)data = priv->multi_size; - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE_CAPS: vesa_dri_get_surface_caps(vo,data); - return VO_TRUE; + return CONTROL_TRUE; case DRI_GET_SURFACE: vesa_dri_get_surface(vo,data); - return VO_TRUE; + return CONTROL_TRUE; } - return VO_NOTIMPL; + return CONTROL_NA; } Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-10-31 14:58:47 UTC (rev 268) +++ mplayerxp/libvo/vo_x11.c 2012-10-31 16:28:22 UTC (rev 269) @@ -363,7 +363,7 @@ surf->planes[3] = 0; } -static uint32_t __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) +static ControlCodes __FASTCALL__ control(vo_data_t*vo,uint32_t request, any_t*data) { priv_t* priv=(priv_t*)vo->priv; switch (request) { @@ -373,20 +373,20 @@ { vo_resize_t * vrest = (vo_resize_t *)data; vrest->event_type = check_events(vo,vrest->adjust_size); - return VO_TRUE; + return CONTROL_TRUE; } case VOCTRL_FULLSCREEN: vo_x11_fullscreen(vo); - return VO_TRUE; + retu... [truncated message content] |
From: <nic...@us...> - 2012-11-01 08:38:20
|
Revision: 272 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=272&view=rev Author: nickols_k Date: 2012-11-01 08:38:09 +0000 (Thu, 01 Nov 2012) Log Message: ----------- remove useless fields + cleanups + segfaults-- Modified Paths: -------------- mplayerxp/libao2/ao_wav.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpsub/spudec.c mplayerxp/libvo/sub.c mplayerxp/libvo/video_out.c mplayerxp/mplayer.c mplayerxp/postproc/vf.c mplayerxp/sig_hand.c mplayerxp/sig_hand.h mplayerxp/xmp_core.c mplayerxp/xmp_core.h Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/libao2/ao_wav.c 2012-11-01 08:38:09 UTC (rev 272) @@ -222,7 +222,7 @@ extern vo_data_t* vo_data; static unsigned get_space(ao_data_t* ao){ priv_t* priv=ao->priv; - float pts=dae_played_fra(xp_core.video).v_pts; + float pts=dae_played_fra(xp_core->video).v_pts; if(pts) return ao->pts < pts + priv->fast * 30000 ? ao->outburst : 0; return ao->outburst; Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-11-01 08:38:09 UTC (rev 272) @@ -116,10 +116,10 @@ } } else - if(xp_core.initial_apts_corr.need_correction==1) + if(xp_core->initial_apts_corr.need_correction==1) { - xp_core.initial_apts += ((float)(xp_core.initial_apts_corr.pts_bytes-xp_core.initial_apts_corr.nbytes))/(float)sh_audio->i_bps; - xp_core.initial_apts_corr.need_correction=0; + xp_core->initial_apts += ((float)(xp_core->initial_apts_corr.pts_bytes-xp_core->initial_apts_corr.nbytes))/(float)sh_audio->i_bps; + xp_core->initial_apts_corr.need_correction=0; } MSG_OK("[AC] %s decoder: [%s] drv:%s.%s ratio %i->%i\n",mp_conf.audio_codec?"Forcing":"Selecting" ,sh_audio->codec->codec_name Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-01 08:38:09 UTC (rev 272) @@ -264,7 +264,7 @@ if(drop_frame) return 0; update_subtitle(sh_video,pts,mpi->xp_idx); - vo_flush_page(vo_data,dae_curr_vdecoded()); + vo_flush_page(vo_data,dae_curr_vdecoded(xp_core)); t2=GetTimer()-t2; tt=t2*0.000001f; Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/libmpcodecs/vd.c 2012-11-01 08:38:09 UTC (rev 272) @@ -272,7 +272,7 @@ // Note: buffer allocation may be moved to mpcodecs_config_vo() later... mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,int w, int h){ MSG_DBG2("mpcodecs_get_image(vf_%s,%i,%i,%i,%i) was called\n",((vf_instance_t *)(sh->vfilter))->info->name,mp_imgtype,mp_imgflag,w,h); - mp_image_t* mpi=vf_get_image(sh->vfilter,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h,dae_curr_vdecoded()); + mp_image_t* mpi=vf_get_image(sh->vfilter,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h,dae_curr_vdecoded(xp_core)); mpi->x=mpi->y=0; if(mpi->xp_idx==XP_IDX_INVALID) MSG_V("[mpcodecs_get_image] Incorrect mpi->xp_idx. Be ready for segfault!\n"); Modified: mplayerxp/libmpdemux/cache2.c =================================================================== --- mplayerxp/libmpdemux/cache2.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/libmpdemux/cache2.c 2012-11-01 08:38:09 UTC (rev 272) @@ -296,7 +296,7 @@ unsigned rc; if((rc=xmp_register_thread(NULL,sig_cache2,cache2_routine,"cache2"))==UINT_MAX) return 0; - c->pth=&xp_core.mpxp_threads[rc]; + c->pth=&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); Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-11-01 08:38:09 UTC (rev 272) @@ -22,7 +22,7 @@ { float retval; demuxer_t*demuxer=ds->demuxer; - xp_core.initial_apts_corr.need_correction=0; + xp_core->initial_apts_corr.need_correction=0; MSG_DBG2("initial_apts from: stream_pts=%f pts_bytes=%u got_bytes=%u i_bps=%u\n" ,ds->pts,ds_tell_pts(ds),nbytes,((sh_audio_t*)ds->demuxer->audio->sh)->i_bps); /* FIXUP AUDIO PTS*/ @@ -48,9 +48,9 @@ retval = ds->pts+ds->pts_corr+((float)(ds_tell_pts(ds)-nbytes))/(float)(((sh_audio_t*)ds->demuxer->audio->sh)->i_bps); else { - xp_core.initial_apts_corr.need_correction=1; - xp_core.initial_apts_corr.pts_bytes=ds_tell_pts(ds); - xp_core.initial_apts_corr.nbytes=nbytes; + xp_core->initial_apts_corr.need_correction=1; + xp_core->initial_apts_corr.pts_bytes=ds_tell_pts(ds); + xp_core->initial_apts_corr.nbytes=nbytes; retval = ds->pts; } MSG_DBG2("initial_apts is: %f\n",retval); @@ -67,7 +67,7 @@ if(mp_conf.benchmark) t=GetTimer(); retval = demux_getc(ds); *pts=get_ds_stream_pts(ds,1); - if(xp_core.initial_apts == HUGE) xp_core.initial_apts=*pts; + if(xp_core->initial_apts == HUGE) xp_core->initial_apts=*pts; if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; @@ -112,7 +112,7 @@ if(mp_conf.benchmark) t=GetTimer(); retval = demux_read_data(ds,mem,len); *pts=get_ds_stream_pts(ds,retval); - if(xp_core.initial_apts == HUGE) xp_core.initial_apts=*pts; + if(xp_core->initial_apts == HUGE) xp_core->initial_apts=*pts; if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; @@ -136,7 +136,7 @@ if(mp_conf.benchmark) t=GetTimer(); retval = ds_get_packet(ds,start); *pts=get_ds_stream_pts(ds,retval); - if(xp_core.initial_apts == HUGE) xp_core.initial_apts=*pts; + if(xp_core->initial_apts == HUGE) xp_core->initial_apts=*pts; if(mp_conf.benchmark) { t2=GetTimer();t=t2-t; Modified: mplayerxp/libmpsub/spudec.c =================================================================== --- mplayerxp/libmpsub/spudec.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/libmpsub/spudec.c 2012-11-01 08:38:09 UTC (rev 272) @@ -623,7 +623,7 @@ spudec_handle_t *spu = (spudec_handle_t *)this; if (spu->start_pts <= spu->now_pts && spu->now_pts < spu->end_pts && spu->image) { - draw_alpha(vo,dae_curr_vdecoded(),spu->start_col, spu->start_row, spu->width, spu->height, + draw_alpha(vo,dae_curr_vdecoded(xp_core),spu->start_col, spu->start_row, spu->width, spu->height, spu->image, spu->aimage, spu->stride); spu->spu_changed = 0; } @@ -779,7 +779,7 @@ || (spu->orig_frame_width == dxs && spu->orig_frame_height == dys))) { if (spu->image) { - draw_alpha(vo,dae_curr_vdecoded(),spu->start_col, spu->start_row, spu->width, spu->height, + draw_alpha(vo,dae_curr_vdecoded(xp_core),spu->start_col, spu->start_row, spu->width, spu->height, spu->image, spu->aimage, spu->stride); spu->spu_changed = 0; } @@ -1085,7 +1085,7 @@ if ((int)(spu->scaled_start_row) < 0) spu->scaled_start_row = 0; break; } - draw_alpha(vo,dae_curr_vdecoded(),spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height, + draw_alpha(vo,dae_curr_vdecoded(xp_core),spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height, spu->scaled_image, spu->scaled_aimage, spu->scaled_stride); spu->spu_changed = 0; } Modified: mplayerxp/libvo/sub.c =================================================================== --- mplayerxp/libvo/sub.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/libvo/sub.c 2012-11-01 08:38:09 UTC (rev 272) @@ -532,7 +532,7 @@ // obj->flags&=~OSDFLAG_OLD_BBOX; if(obj->cleared_frames>=0) { obj->cleared_frames++; - if(obj->cleared_frames>=xp_core.num_v_buffs) + if(obj->cleared_frames>=xp_core->num_v_buffs) obj->cleared_frames=-1; // All cleared stop } } Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/libvo/video_out.c 2012-11-01 08:38:09 UTC (rev 272) @@ -391,7 +391,7 @@ /* TODO: smart analizer of scaling possibilities of vo_driver */ if((event & VO_EVENT_RESIZE) == VO_EVENT_RESIZE) { - xp_core.in_resize=1; + xp_core->in_resize=1; vf_reinit_vo(priv->dri.cap.w,priv->dri.cap.h,priv->dri.cap.fourcc,1); } vf_reinit_vo(priv->dri.cap.w,priv->dri.cap.h,priv->dri.cap.fourcc,0); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/mplayer.c 2012-11-01 08:38:09 UTC (rev 272) @@ -116,6 +116,7 @@ #define INITED_VCODEC 0x00000200 #define INITED_VOBSUB 0x00000400 #define INITED_SUBTITLE 0x10000000 +#define INITED_XMP 0x80000000 #define INITED_ALL 0xFFFFFFFF #define PT_NEXT_ENTRY 1 @@ -144,15 +145,15 @@ mp_conf_t mp_conf; static volatile char antiviral_hole2[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; -mp_data_t*mp_data=NULL; +mp_data_t* mp_data=NULL; +xp_core_t* xp_core=NULL; /************************************************************************** Decoding ahead **************************************************************************/ - +static volatile char antiviral_hole3[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; ao_data_t* ao_data=NULL; vo_data_t* vo_data=NULL; -static volatile char antiviral_hole3[__VM_PAGE_SIZE__] __PAGE_ALIGNED__; /************************************************************************** Config file @@ -233,6 +234,7 @@ mp_free(mp_data->priv); mp_free(mp_data); mp_data=NULL; + xmp_uninit(); mp_uninit_malloc(1); } @@ -607,7 +609,11 @@ mask=priv->inited_flags&mask; MP_UNIT("uninit_xp"); - xmp_uninit_engine(0); + if(mask&INITED_XMP) { + priv->inited_flags&=~INITED_XMP; + MP_UNIT("uninit_xmp"); + xmp_uninit_engine(0); + } if (mask&INITED_SPUDEC){ priv->inited_flags&=~INITED_SPUDEC; @@ -719,7 +725,7 @@ if(sh_audio) while(get_len_audio_buffer()) usleep(0); if(sh_video) { for(;;) { - if(dae_played_fra(xp_core.video).eof) break; + if(dae_played_fra(xp_core->video).eof) break; usleep(0); } } @@ -992,7 +998,7 @@ // Update buffer if needed MP_UNIT("mpca_decode"); // Enter AUDIO decoder module t=GetTimer(); - while(sh_audio->a_buffer_len<playsize && !xp_core.audio->eof){ + while(sh_audio->a_buffer_len<playsize && !xp_core->audio->eof){ if(mp_conf.xp>=XP_VideoAudio) { ret=read_audio_buffer(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); @@ -1014,7 +1020,7 @@ MP_UNIT("uninit_ao"); ao_uninit(ao_data); } - xp_core.audio->eof=1; + xp_core->audio->eof=1; break; } } @@ -1121,12 +1127,12 @@ priv_t*priv=mp_data->priv; MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d [frms: [%i]]\n", a_pts-delay,v_pts,AV_delay,priv->c_total - ,xp_core.video->num_played_frames,xp_core.video->num_decoded_frames + ,xp_core->video->num_played_frames,xp_core->video->num_decoded_frames ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 ,mp_data->output_quality - ,dae_curr_vplayed() + ,dae_curr_vplayed(xp_core) ); fflush(stdout); } @@ -1134,14 +1140,14 @@ static void show_status_line_no_apts(float v_pts) { priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; - if(mp_conf.av_sync_pts && sh_audio && (!xp_core.audio->eof || ao_get_delay(ao_data))) { + if(mp_conf.av_sync_pts && sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data))) { float a_pts = sh_audio->timer-ao_get_delay(ao_data); MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d\r" ,a_pts ,v_pts ,a_pts-v_pts ,0.0 - ,xp_core.video->num_played_frames,xp_core.video->num_decoded_frames + ,xp_core->video->num_played_frames,xp_core->video->num_decoded_frames ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 @@ -1150,7 +1156,7 @@ } else MSG_STATUS("V:%6.1f %3d %2d%% %2d%% %4.1f%% %d\r" ,v_pts - ,xp_core.video->num_played_frames + ,xp_core->video->num_played_frames ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 @@ -1193,12 +1199,13 @@ sh_video_t* sh_video=priv->demuxer->video->sh; float sleep_time=0; if(sh_audio) { - /* FIXME!!! need the same technique to detect xp_core.audio->eof as for video_eof! + /* FIXME!!! need the same technique to detect xp_core->audio->eof as for video_eof! often ao_get_delay() never returns 0 :( */ - if(xp_core.audio->eof && !get_delay_audio_buffer()) goto nosound_model; - if((!xp_core.audio->eof || ao_get_delay(ao_data)) && + if(xp_core->audio->eof && !get_delay_audio_buffer()) goto nosound_model; + if((!xp_core->audio->eof || ao_get_delay(ao_data)) && (!mp_data->use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) - sleep_time=screen_pts-(sh_audio->timer-ao_get_delay(ao_data)); + sleep_time=screen_pts-((sh_audio->timer-ao_get_delay(ao_data)) + +(mp_conf.av_sync_pts?0:xp_core->initial_apts)); else if(mp_data->use_pts_fix2 && sh_audio->chapter_change) sleep_time=0; else @@ -1217,7 +1224,7 @@ #define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ #define XP_MIN_AUDIOBUFF 0.05 #define XP_MAX_TIMESLICE 0.1 - if(sh_audio && (!xp_core.audio->eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { + if(sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { float t; if( mp_conf.xp < XP_VAPlay ) { @@ -1257,7 +1264,6 @@ sh_audio_t* sh_audio=priv->demuxer->audio->sh; sh_video_t* sh_video=priv->demuxer->video->sh; demux_stream_t *d_audio=priv->demuxer->audio; - float screen_pts=0; float v_pts=0; float sleep_time=0; int can_blit=0; @@ -1265,44 +1271,42 @@ int final_frame=0; frame_attr_t shva_prev,shva; - shva_prev=dae_played_fra(xp_core.video); + shva_prev=dae_played_fra(xp_core->video); final_frame = shva_prev.eof; - if(xp_core.video->eof && final_frame) return 1; + if(xp_core->video->eof && final_frame) return 1; - can_blit=dae_try_inc_played(xp_core.video); /* <-- TRY SWITCH TO NEXT FRAME */ - shva=dae_next_played_fra(xp_core.video); + can_blit=dae_try_inc_played(xp_core->video); /* <-- TRY SWITCH TO NEXT FRAME */ + shva=dae_next_played_fra(xp_core->video); v_pts = shva.v_pts; - /*------------------------ frame decoded. --------------------*/ /* blit frame */ - if(xp_core.video->eof) can_blit=1; /* force blitting until end of stream will be reached */ + if(xp_core->video->eof) can_blit=1; /* force blitting until end of stream will be reached */ vplayer_check_chapter_change(&shva_prev,v_pts); #if 0 -MSG_INFO("xp_core.initial_apts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" -,xp_core.initial_apts -,xp_core.audio->eof -,sh_audio && !xp_core.audio->eof?d_audio->pts+(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps:0 -,sh_audio && !xp_core.audio->eof?sh_audio->timer-ao_get_delay(ao_data):0 +MSG_INFO("xp_core->initial_apts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" +,xp_core->initial_apts +,xp_core->audio->eof +,sh_audio && !xp_core->audio->eof?d_audio->pts+(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps:0 +,sh_audio && !xp_core->audio->eof?sh_audio->timer-ao_get_delay(ao_data):0 ,shva.v_pts ,shva.stream_pts ,shva.duration); #endif /*--------- add OSD to the next frame contents ---------*/ if(can_blit) { - screen_pts=v_pts-(mp_conf.av_sync_pts?0:xp_core.initial_apts); #ifdef USE_OSD MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); MP_UNIT("draw_osd"); update_osd(shva.stream_pts); - vo_draw_osd(vo_data,dae_next_played(xp_core.video)); + vo_draw_osd(vo_data,dae_next_played(xp_core->video)); #endif } MP_UNIT("change_frame2"); /* don't flip if there is nothing new to display */ if(!can_blit) { static int drop_message=0; - if(!drop_message && xp_core.video->num_slow_frames > 50) { + if(!drop_message && xp_core->video->num_slow_frames > 50) { drop_message=1; if(priv->mpxp_after_seek) priv->mpxp_after_seek--; else MSG_WARN(MSGTR_SystemTooSlow); @@ -1320,15 +1324,15 @@ /* It's time to sleep ;)...*/ MP_UNIT("sleep"); GetRelativeTime(); /* reset timer */ - sleep_time=vplayer_compute_sleep_time(&shva_prev,screen_pts); + sleep_time=vplayer_compute_sleep_time(&shva_prev,v_pts); if(mp_conf.benchmark && sleep_time < 0 && sleep_time < priv->max_av_resync) priv->max_av_resync=sleep_time; if(!(vo_data->flags&256)){ /* flag 256 means: libvo driver does its timing (dvb card) */ if(!vplayer_do_sleep(rtc_fd,sleep_time)) return 0; } - player_idx=dae_next_played(xp_core.video); + player_idx=dae_next_played(xp_core->video); vo_select_frame(vo_data,player_idx); - dae_inc_played(xp_core.video); + dae_inc_played(xp_core->video); MSG_D("\ndec_ahead_main: schedule %u on screen\n",player_idx); t2=GetTimer()-t2; tt = t2*0.000001f; @@ -1346,7 +1350,7 @@ /* FIXME: this block was added to fix A-V resync caused by some strange things like playing 48KHz audio on 44.1KHz soundcard and other. Now we know PTS of every audio frame so don't need to have it */ - if(sh_audio && (!xp_core.audio->eof || ao_get_delay(ao_data)) && !mp_conf.av_sync_pts) { + if(sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data)) && !mp_conf.av_sync_pts) { float a_pts=0; // unplayed bytes in our and soundcard/dma buffer: @@ -1400,7 +1404,7 @@ sh_video_t* sh_video=priv->demuxer->video->sh; demux_stream_t *d_dvdsub=priv->demuxer->sub; int seek_rval=1; - xp_core.audio->eof=0; + xp_core->audio->eof=0; if(seek->secs || seek->flags&DEMUX_SEEK_SET) { seek_rval=demux_seek_r(priv->demuxer,seek); priv->mpxp_after_seek=25; /* 1 sec delay */ @@ -1462,7 +1466,7 @@ } } - if(sh_video) dae_wait_decoder_outrun(xp_core.video); + if(sh_video) dae_wait_decoder_outrun(xp_core->video); } void mpxp_reset_vcache(void) @@ -1527,9 +1531,9 @@ 100.0*mp_data->bench->demux/total_time_usage, 100.0*mp_data->bench->c2/total_time_usage, 100.0*tot/total_time_usage); - unsigned nframes=xp_core.video->num_played_frames; + unsigned nframes=xp_core->video->num_played_frames; MSG_INFO("\nREAL RESULTS: from %u was dropped=%u\n" - ,nframes,xp_core.video->num_dropped_frames); + ,nframes,xp_core->video->num_dropped_frames); MSG_INFO("\nMax. A-V resync is: %f\n",fabs(priv->max_av_resync)); } @@ -1996,18 +2000,19 @@ sh_audio_t* sh_audio=priv->demuxer->audio->sh; sh_video_t* sh_video=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); + 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); exit_player("Try other '-vo' driver.\n"); } if(xmp_init_engine(sh_video,sh_audio)!=0) exit_player("Can't initialize decoding ahead!\n"); if(xmp_run_decoders()!=0) exit_player("Can't run decoding ahead!\n"); - if(sh_video) MSG_OK("Using DECODING AHEAD mplayer's core with %u video buffers\n",xp_core.num_v_buffs); - else MSG_OK("Using DECODING AHEAD mplayer's core with %u audio buffers\n",xp_core.num_a_buffs); + if(sh_video) MSG_OK("Using DECODING AHEAD mplayer's core with %u video buffers\n",xp_core->num_v_buffs); + else MSG_OK("Using DECODING AHEAD mplayer's core with %u audio buffers\n",xp_core->num_a_buffs); /* reset counters */ - xp_core.video->num_dropped_frames=0; + if(sh_video) xp_core->video->num_dropped_frames=0; + priv->inited_flags|=INITED_XMP; } static void mpxp_print_audio_status(void) { @@ -2074,7 +2079,7 @@ if (priv->ao_inited && sh_audio) { if( mp_conf.xp >= XP_VAPlay ) { - xp_core.in_pause=1; + xp_core->in_pause=1; while( !dec_ahead_can_aseek ) usleep(0); } ao_pause(ao_data); // pause audio, keep data if possible @@ -2094,7 +2099,7 @@ if (priv->ao_inited && sh_audio) { ao_resume(ao_data); // resume audio if( mp_conf.xp >= XP_VAPlay ) { - xp_core.in_pause=0; + xp_core->in_pause=0; __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); } } @@ -2137,7 +2142,7 @@ i_abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; if(i_abs) { seek->flags = DEMUX_SEEK_SET|DEMUX_SEEK_PERCENTS; - if(sh_video) priv->osd_function= (v > dae_played_fra(xp_core.video).v_pts) ? OSD_FFW : OSD_REW; + if(sh_video) priv->osd_function= (v > dae_played_fra(xp_core->video).v_pts) ? OSD_FFW : OSD_REW; seek->secs = v/100.; } else { @@ -2334,7 +2339,7 @@ vo_fullscreen(vo_data); break; case MP_CMD_VO_SCREENSHOT: - vo_screenshot(vo_data,dae_curr_vplayed()); + vo_screenshot(vo_data,dae_curr_vplayed(xp_core)); break; case MP_CMD_SUB_POS: { @@ -2432,7 +2437,7 @@ } } - xp_core.num_a_buffs = vo_conf.da_buffs; + xp_core->num_a_buffs = vo_conf.da_buffs; init_player(); @@ -2525,7 +2530,7 @@ //============ Open priv->demuxerS --- DETECT file type ======================= if(mp_conf.playbackspeed_factor!=1.0) mp_conf.has_audio=0; - xp_core.initial_apts=HUGE; + xp_core->initial_apts=HUGE; if(!mp_conf.has_audio) mp_conf.audio_id=-2; // do NOT read audio packets... if(!mp_conf.has_video) mp_conf.video_id=-2; // do NOT read video packets... if(!mp_conf.has_dvdsub) mp_conf.dvdsub_id=-2;// do NOT read subtitle packets... @@ -2616,7 +2621,7 @@ goto main; } - xp_core.num_v_buffs=vo_get_num_frames(vo_data); /* that really known after init_vcodecs */ + xp_core->num_v_buffs=vo_get_num_frames(vo_data); /* that really known after init_vcodecs */ if(mp_conf.autoq>0){ /* Auto quality option enabled*/ @@ -2711,17 +2716,17 @@ */ mp_data->seek_time = GetTimerMS(); - if(sh_video) dae_wait_decoder_outrun(xp_core.video); + if(sh_video) dae_wait_decoder_outrun(xp_core->video); if(xmp_run_players()!=0) exit_player("Can't run xp players!\n"); - MSG_OK("Using the next %i threads:\n",xp_core.num_threads); + MSG_OK("Using the next %i threads:\n",xp_core->num_threads); unsigned idx; - for(idx=0;idx<xp_core.num_threads;idx++) + for(idx=0;idx<xp_core->num_threads;idx++) MSG_OK("[%i] %s (id=%u, pth_id=%lu)\n" ,idx - ,xp_core.mpxp_threads[idx]->name - ,xp_core.mpxp_threads[idx]->pid - ,xp_core.mpxp_threads[idx]->pth_id); + ,xp_core->mpxp_threads[idx]->name + ,xp_core->mpxp_threads[idx]->pid + ,xp_core->mpxp_threads[idx]->pth_id); //==================== START PLAYING ======================= MSG_OK(MSGTR_StartPlaying);fflush(stdout); @@ -2743,14 +2748,14 @@ if(mp_conf.benchmark && mp_conf.verbose) show_benchmark_status(); else mpxp_print_audio_status(); - if(mp_conf.xp >= XP_VAPlay) { usleep(100000); eof = xp_core.audio->eof; } + if(mp_conf.xp >= XP_VAPlay) { usleep(100000); eof = xp_core->audio->eof; } goto read_input; } else { int l_eof; /*========================== PLAY VIDEO ============================*/ if(input_state.need_repaint) goto repaint; - if((sh_video->is_static ||(stream->type&STREAMTYPE_MENU)==STREAMTYPE_MENU) && xp_core.video->num_played_frames) { + if((sh_video->is_static ||(stream->type&STREAMTYPE_MENU)==STREAMTYPE_MENU) && xp_core->video->num_played_frames) { /* don't decode if it's picture */ usleep(0); } else { @@ -2792,7 +2797,7 @@ if(mp_conf.loop_times==1) mp_conf.loop_times=-1; eof=0; - xp_core.audio->eof=0; + xp_core->audio->eof=0; seek_args.flags=DEMUX_SEEK_SET|DEMUX_SEEK_PERCENTS; seek_args.secs=0; // seek to start of movie (0%) } @@ -2803,14 +2808,14 @@ xmp_halt_threads(0); if(seek_args.secs && sh_video) { - frame_attr_t shvap = dae_played_fra(xp_core.video); - frame_attr_t shvad = xp_core.video->fra[dae_prev_decoded(xp_core.video)]; - seek_args.secs -= (xp_core.bad_pts?shvad.v_pts:d_video->pts)-shvap.v_pts; + frame_attr_t shvap = dae_played_fra(xp_core->video); + frame_attr_t shvad = xp_core->video->fra[dae_prev_decoded(xp_core->video)]; + seek_args.secs -= (xp_core->bad_pts?shvad.v_pts:d_video->pts)-shvap.v_pts; } mpxp_seek(&osd,&seek_args); - xp_core.audio->eof=0; + xp_core->audio->eof=0; seek_args.secs=0; seek_args.flags=DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS; @@ -2877,7 +2882,7 @@ priv->vo_inited=0; priv->ao_inited=0; eof = 0; - xp_core.audio->eof=0; + xp_core->audio->eof=0; goto play_next_file; } Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/postproc/vf.c 2012-11-01 08:38:09 UTC (rev 272) @@ -244,7 +244,7 @@ } else { MSG_DBG2("vf_get_image forces xp_idx retrieving\n"); - mpi->xp_idx=dae_curr_vdecoded(); + mpi->xp_idx=dae_curr_vdecoded(xp_core); } if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) if(vf->start_slice) vf->start_slice(vf,mpi); Modified: mplayerxp/sig_hand.c =================================================================== --- mplayerxp/sig_hand.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/sig_hand.c 2012-11-01 08:38:09 UTC (rev 272) @@ -52,19 +52,19 @@ { int i; pthread_t _self = pthread_self(); - for(i=0; i < xp_core.num_threads && !pthread_equal(xp_core.mpxp_threads[i]->pth_id, _self); i++); - if(i >= xp_core.num_threads || - !pthread_equal(xp_core.mpxp_threads[i]->pth_id, _self)) i = 0; /* Use 0 as default handler */ + for(i=0; i < xp_core->num_threads && !pthread_equal(xp_core->mpxp_threads[i]->pth_id, _self); i++); + if(i >= xp_core->num_threads || + !pthread_equal(xp_core->mpxp_threads[i]->pth_id, _self)) i = 0; /* Use 0 as default handler */ mp_msg(MSGT_CPLAYER,MSGL_FATAL,__FILE__,__LINE__,"catching signal: %s in thread: %s (%i) in module: %s\n" ,strsignal(signo) - ,xp_core.mpxp_threads[i]->name + ,xp_core->mpxp_threads[i]->name ,i - ,xp_core.mpxp_threads[i]->unit); + ,xp_core->mpxp_threads[i]->unit); #ifdef HAVE_BACKTRACE dump_trace(); #endif - xp_core.mpxp_threads[i]->sigfunc(); + xp_core->mpxp_threads[i]->sigfunc(); signal(signo,SIG_DFL); /* try coredump*/ Modified: mplayerxp/sig_hand.h =================================================================== --- mplayerxp/sig_hand.h 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/sig_hand.h 2012-11-01 08:38:09 UTC (rev 272) @@ -7,8 +7,8 @@ #include <sys/types.h> #include "xmp_core.h" -static inline void __MP_UNIT(unsigned id,const char *name) { xp_core.mpxp_threads[id]->unit=name; } -static inline void MP_UNIT(const char *name) { xp_core.mpxp_threads[main_id]->unit=name; } +static inline void __MP_UNIT(unsigned id,const char *name) { xp_core->mpxp_threads[id]->unit=name; } +static inline void MP_UNIT(const char *name) { xp_core->mpxp_threads[main_id]->unit=name; } extern void init_signal_handling( void ); extern void uninit_signal_handling( int xp_id ); Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/xmp_core.c 2012-11-01 08:38:09 UTC (rev 272) @@ -35,31 +35,29 @@ #define MSG_T(args...) #endif -xp_core_t xp_core; - void xmp_init(void) { - memset(&xp_core,0,sizeof(xp_core_t)); - xp_core.initial_apts=HUGE; + xp_core=mp_mallocz(sizeof(xp_core_t)); + xp_core->initial_apts=HUGE; } -void xmp_uninit(void) {} +void xmp_uninit(void) { mp_free(xp_core); xp_core=NULL; } unsigned xmp_register_main(sig_handler_t sigfunc) { unsigned idx=0; - xp_core.mpxp_threads[idx]=mp_mallocz(sizeof(mpxp_thread_t)); - xp_core.mpxp_threads[idx]->p_idx=idx; - xp_core.mpxp_threads[idx]->pid=getpid(); - xp_core.main_pth_id=xp_core.mpxp_threads[idx]->pth_id=pthread_self(); - xp_core.mpxp_threads[idx]->name = "main"; - xp_core.mpxp_threads[idx]->sigfunc = sigfunc; - xp_core.mpxp_threads[idx]->dae = NULL; - xp_core.num_threads++; + xp_core->mpxp_threads[idx]=mp_mallocz(sizeof(mpxp_thread_t)); + xp_core->mpxp_threads[idx]->p_idx=idx; + xp_core->mpxp_threads[idx]->pid=getpid(); + xp_core->main_pth_id=xp_core->mpxp_threads[idx]->pth_id=pthread_self(); + xp_core->mpxp_threads[idx]->name = "main"; + xp_core->mpxp_threads[idx]->sigfunc = sigfunc; + xp_core->mpxp_threads[idx]->dae = NULL; + xp_core->num_threads++; return idx; } static void print_stopped_thread(unsigned idx) { - MSG_OK("*** stop thread: [%i] %s\n",idx,xp_core.mpxp_threads[idx]->name); + MSG_OK("*** stop thread: [%i] %s\n",idx,xp_core->mpxp_threads[idx]->name); } void xmp_killall_threads(pthread_t _self) @@ -67,12 +65,12 @@ unsigned i; for(i=0;i < MAX_MPXP_THREADS;i++) { if( _self && - xp_core.mpxp_threads[i]->pth_id && - xp_core.mpxp_threads[i]->pth_id != xp_core.main_pth_id) { - pthread_kill(xp_core.mpxp_threads[i]->pth_id,SIGKILL); + xp_core->mpxp_threads[i]->pth_id && + xp_core->mpxp_threads[i]->pth_id != xp_core->main_pth_id) { + pthread_kill(xp_core->mpxp_threads[i]->pth_id,SIGKILL); print_stopped_thread(i); - mp_free(xp_core.mpxp_threads[i]); - xp_core.mpxp_threads[i]=NULL; + mp_free(xp_core->mpxp_threads[i]); + xp_core->mpxp_threads[i]=NULL; } } } @@ -141,7 +139,7 @@ if(it) { do { usleep(0); - }while(dae_get_decoder_outrun(it) < xp_core.num_v_buffs/2); + }while(dae_get_decoder_outrun(it) < xp_core->num_v_buffs/2); } } @@ -201,15 +199,16 @@ volatile float dec_ahead_audio_delay; static int xp_thread_decode_audio(void) { - sh_audio_t* sh_audio=xp_core.audio->sh; - sh_video_t* sh_video=xp_core.video->sh; + sh_audio_t* sh_audio=xp_core->audio->sh; + sh_video_t* sh_video=NULL; + if(xp_core->video) sh_video=xp_core->video->sh; int free_buf, vbuf_size, pref_buf; unsigned len=0; free_buf = get_free_audio_buffer(); if( free_buf == -1 ) { /* End of file */ - xp_core.audio->eof = 1; + xp_core->audio->eof = 1; return 0; } if( free_buf < (int)sh_audio->audio_out_minsize ) /* full */ @@ -220,9 +219,9 @@ if( len < MAX_OUTBURST ) /* Buffer underrun */ return decode_audio_buffer(MAX_OUTBURST); - if(xp_core.has_video) { + if(xp_core->video) { /* Match video buffer */ - vbuf_size = dae_get_decoder_outrun(xp_core.video); + vbuf_size = dae_get_decoder_outrun(xp_core->video); pref_buf = vbuf_size / sh_video->fps * sh_audio->af_bps; pref_buf -= len; if( pref_buf > 0 ) { @@ -250,14 +249,14 @@ "*********************************************\n" "Try increase number of buffer for decoding ahead\n" "Exist: %u, need: %u\n" - ,xp_core.num_v_buffs,(unsigned)(max_frame_delay*3*sh_video->fps)+3); + ,xp_core->num_v_buffs,(unsigned)(max_frame_delay*3*sh_video->fps)+3); prev_warn_delay=max_frame_delay; } } static unsigned compute_frame_dropping(sh_video_t* sh_video,float v_pts,float drop_barrier) { unsigned rc=0; - float screen_pts=dae_played_fra(xp_core.video).v_pts-(mp_conf.av_sync_pts?0:xp_core.initial_apts); + float screen_pts=dae_played_fra(xp_core->video).v_pts-(mp_conf.av_sync_pts?0:xp_core->initial_apts); static float prev_delta=64; float delta,max_frame_delay;/* delay for decoding of top slow frame */ max_frame_delay = mp_data->bench->max_video+mp_data->bench->max_vout; @@ -265,7 +264,7 @@ /* TODO: Replace the constants with some values which are depended on - xp_core.num_v_buffs and max_frame_delay to find out the smoothest way + xp_core->num_v_buffs and max_frame_delay to find out the smoothest way to display frames on slow machines. MAYBE!!!: (won't work with some realmedia streams for example) Try to borrow avifile's logic (btw, GPL'ed ;) for very slow systems: @@ -275,7 +274,7 @@ */ delta=v_pts-screen_pts; if(max_frame_delay*3 > drop_barrier) { - if(drop_barrier < (float)(xp_core.num_v_buffs-2)/sh_video->fps) drop_barrier += 1/sh_video->fps; + if(drop_barrier < (float)(xp_core->num_v_buffs-2)/sh_video->fps) drop_barrier += 1/sh_video->fps; else if(mp_conf.verbose) show_warn_cant_sync(sh_video,max_frame_delay); } @@ -292,7 +291,7 @@ if(delta < drop_barrier*2/3) fr_skip_divisor=3; else fr_skip_divisor=4; /* delta < drop_barrier */ - rc = (dae_curr_vdecoded()%fr_skip_divisor)?0:1; + rc = (dae_curr_vdecoded(xp_core)%fr_skip_divisor)?0:1; if(delta>prev_delta) rc=0; } MSG_D("DEC_AHEAD: max_frame_delay*3=%f drop_barrier=%f prev_delta=%f delta=%f(v_pts=%f screen_pts=%f) n_fr_to_drop=%u\n",max_frame_delay*3,drop_barrier,prev_delta,delta,v_pts,xp_screen_pts,xp_n_frame_to_drop); @@ -303,10 +302,10 @@ static void reorder_pts_in_mpeg(void) { unsigned idx0=0, idx1, idx2, idx3; - idx1 = dae_curr_vdecoded(); - idx2 = dae_prev_vdecoded(); - frame_attr_t* fra=xp_core.video->fra; - while( dae_curr_vplayed() != idx2 && + idx1 = dae_curr_vdecoded(xp_core); + idx2 = dae_prev_vdecoded(xp_core); + frame_attr_t* fra=xp_core->video->fra; + while( dae_curr_vplayed(xp_core) != idx2 && fra[idx2].v_pts > fra[idx1].v_pts && fra[idx2].v_pts < fra[idx1].v_pts+1.0 ) { float tmp; @@ -318,16 +317,16 @@ fra[idx2].stream_pts = fra[idx2].v_pts; fra[idx2].duration = fra[idx1].v_pts - fra[idx2].v_pts; - idx3=(idx2-1)%xp_core.num_v_buffs; + idx3=(idx2-1)%xp_core->num_v_buffs; if(fra[idx2].v_pts > fra[idx3].v_pts && fra[idx2].v_pts - fra[idx3].v_pts < 1.0) fra[idx3].duration = fra[idx2].v_pts - fra[idx3].v_pts; - if(idx1 != dae_curr_vdecoded()) fra[idx1].duration = fra[idx0].v_pts - fra[idx1].v_pts; + if(idx1 != dae_curr_vdecoded(xp_core)) fra[idx1].duration = fra[idx0].v_pts - fra[idx1].v_pts; idx0 = idx1; idx1 = idx2; - idx2=(idx2-1)%xp_core.num_v_buffs; + idx2=(idx2-1)%xp_core->num_v_buffs; } } @@ -346,21 +345,21 @@ priv->state=Pth_Run; priv->dae->eof = 0; - xp_core.audio->eof=0; + xp_core->audio->eof=0; MSG_T("\nDEC_AHEAD: entering...\n"); __MP_UNIT(priv->p_idx,"dec_ahead"); priv->pid = getpid(); - if(!(xp_core.has_audio && mp_conf.xp < XP_VAFull)) + if(!(xp_core->audio && mp_conf.xp < XP_VAFull)) priv->name = "video decoder+vf"; - drop_barrier=(float)(xp_core.num_v_buffs/2)*(1/sh_video->fps); + drop_barrier=(float)(xp_core->num_v_buffs/2)*(1/sh_video->fps); if(mp_conf.av_sync_pts == -1 && !mp_data->use_pts_fix2) - xp_core.bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || + xp_core->bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG4_ES || d_video->demuxer->file_format == DEMUXER_TYPE_H264_ES || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_PS || d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_TS; else - xp_core.bad_pts = mp_conf.av_sync_pts?0:1; + xp_core->bad_pts = mp_conf.av_sync_pts?0:1; while(!priv->dae->eof){ unsigned char* start=NULL; int in_size; @@ -369,7 +368,7 @@ pt_sleep: priv->state=Pth_ASleep; while(priv->state==Pth_ASleep) usleep(0); - if(xp_core.bad_pts) mpeg_timer=HUGE; + if(xp_core->bad_pts) mpeg_timer=HUGE; continue; } __MP_UNIT(priv->p_idx,"dec_ahead 1"); @@ -378,7 +377,7 @@ #if 0 /* prevent reent access to non-reent demuxer */ //if(sh_video->num_frames>200) *((char*)0x100) = 1; // Testing crash - if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { + if(xp_core->audio && mp_conf.xp<XP_VAFull) { __MP_UNIT(priv->p_idx,"decode audio"); while(2==xp_thread_decode_audio()) ; __MP_UNIT(priv->p_idx,"dec_ahead 2"); @@ -387,14 +386,14 @@ /*-------------------- Decode a frame: -----------------------*/ in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,sh_video->fps); if(in_size<0) { - xp_core.video->fra[xp_core.video->decoder_idx].eof=1; + xp_core->video->fra[xp_core->video->decoder_idx].eof=1; priv->dae->eof=1; break; } /* in_size==0: it's or broken stream or demuxer's bug */ if(in_size==0 && priv->state!=Pth_Canceling) continue; /* frame was decoded into current decoder_idx */ - if(xp_core.bad_pts) { + if(xp_core->bad_pts) { if(mpeg_timer==HUGE) mpeg_timer=v_pts; else if( mpeg_timer-duration<v_pts ) { mpeg_timer=v_pts; @@ -408,7 +407,7 @@ int cur_time; cur_time = GetTimerMS(); /* Ugly solution: disable frame dropping right after seeking! */ - if(cur_time - mp_data->seek_time > (xp_core.num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(sh_video,v_pts,drop_barrier); + if(cur_time - mp_data->seek_time > (xp_core->num_v_buffs/sh_video->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(sh_video,v_pts,drop_barrier); } /* if( mp_conf.frame_dropping ) */ if(!finite(v_pts)) MSG_WARN("Bug of demuxer! Value of video pts=%f\n",v_pts); #if 0 @@ -427,8 +426,8 @@ else drop_param=0; /* decode: */ if(mp_data->output_quality) { - unsigned total = xp_core.num_v_buffs/2; - unsigned distance = dae_get_decoder_outrun(xp_core.video); + unsigned total = xp_core->num_v_buffs/2; + unsigned distance = dae_get_decoder_outrun(xp_core->video); int our_quality; our_quality = mp_data->output_quality*distance/total; if(drop_param) mpcv_set_quality(sh_video,0); @@ -436,22 +435,23 @@ if(mp_conf.autoq) mpcv_set_quality(sh_video,our_quality>0?our_quality:0); } blit_frame=mpcv_decode(sh_video,start,in_size,drop_param,v_pts); +MSG_DBG2("DECODER: %i[%i] %f\n",dae_curr_vdecoded(xp_core),in_size,v_pts); if(mp_data->output_quality) { if(drop_param) mpcv_set_quality(sh_video,mp_data->output_quality); } if(!blit_frame && drop_param) priv->dae->num_dropped_frames++; if(blit_frame) { - unsigned idx=dae_curr_vdecoded(); - if(xp_core.bad_pts) - xp_core.video->fra[idx].v_pts=mpeg_timer; + unsigned idx=dae_curr_vdecoded(xp_core); + if(xp_core->bad_pts) + xp_core->video->fra[idx].v_pts=mpeg_timer; else - xp_core.video->fra[idx].v_pts = v_pts; - xp_core.video->fra[idx].stream_pts = v_pts; - xp_core.video->fra[idx].duration=duration; - xp_core.video->fra[idx].eof=0; - if(!xp_core.bad_pts) { - int _idx = dae_prev_vdecoded(); - xp_core.video->fra[_idx].duration=v_pts-xp_core.video->fra[_idx].v_pts; + xp_core->video->fra[idx].v_pts = v_pts; + xp_core->video->fra[idx].stream_pts = v_pts; + xp_core->video->fra[idx].duration=duration; + xp_core->video->fra[idx].eof=0; + if(!xp_core->bad_pts) { + int _idx = dae_prev_vdecoded(xp_core); + xp_core->video->fra[_idx].duration=v_pts-xp_core->video->fra[_idx].v_pts; } if(mp_conf.frame_reorder) reorder_pts_in_mpeg(); } /* if (blit_frame) */ @@ -459,12 +459,12 @@ /* ------------ sleep --------------- */ /* sleep if thread is too fast ;) */ if(blit_frame) - while(!dae_inc_decoded(xp_core.video)) { + while(!dae_inc_decoded(xp_core->video)) { MSG_T("DEC_AHEAD: sleep: player=%i decoder=%i)\n" ,dae_curr_vplayed(),dae_curr_vdecoded()); if(priv->state==Pth_Canceling) goto pt_exit; if(priv->state==Pth_Sleep) goto pt_sleep; - if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { + if(xp_core->audio && mp_conf.xp<XP_VAFull) { __MP_UNIT(priv->p_idx,"decode audio"); xp_thread_decode_audio(); __MP_UNIT(priv->p_idx,"dec_ahead 5"); @@ -474,8 +474,8 @@ /*------------------------ frame decoded. --------------------*/ } /* while(!priv->dae->eof)*/ -if(xp_core.has_audio && mp_conf.xp<XP_VAFull) { - while(!xp_core.audio->eof && priv->state!=Pth_Canceling && priv->state!=Pth_Sleep) { +if(xp_core->audio && mp_conf.xp<XP_VAFull) { + while(!xp_core->audio->eof && priv->state!=Pth_Canceling && priv->state!=Pth_Sleep) { __MP_UNIT(priv->p_idx,"decode audio"); if(!xp_thread_decode_audio()) usleep(1); __MP_UNIT(priv->p_idx,NULL); @@ -498,8 +498,8 @@ float d; priv->state=Pth_Run; - xp_core.video->eof=0; - xp_core.audio->eof=0; + if(xp_core->video) xp_core->video->eof=0; + xp_core->audio->eof=0; MSG_T("\nDEC_AHEAD: entering...\n"); priv->pid = getpid(); __MP_UNIT(priv->p_idx,"dec_ahead"); @@ -513,7 +513,7 @@ } __MP_UNIT(priv->p_idx,"decode audio"); while((ret = xp_thread_decode_audio()) == 2) {/* Almost empty buffer */ - if(xp_core.audio->eof) break; + if(xp_core->audio->eof) break; } dec_ahead_can_adseek=1; @@ -522,7 +522,7 @@ __MP_UNIT(priv->p_idx,"sleep"); LOCK_AUDIO_DECODE(); if(priv->state!=Pth_Canceling) { - if(xp_core.audio->eof) { + if(xp_core->audio->eof) { __MP_UNIT(priv->p_idx,"wait end of work"); pthread_cond_wait( &audio_decode_cond, &audio_decode_mutex ); } else if(ret==0) { /* Full buffer or end of file */ @@ -534,7 +534,7 @@ } else timeout.tv_sec = audio_play_timeout.tv_sec; } else { - if(xp_core.in_pause) + if(xp_core->in_pause) d = 1.0; else d = 0.1; @@ -579,16 +579,15 @@ { xmp_stop_threads(force); - if(xp_core.has_video) { - dae_uninit(xp_core.video); - xp_core.has_video=0; + if(xp_core->video) { + dae_uninit(xp_core->video); + xp_core->video=NULL; } - if(xp_core.has_audio) { /* audio state doesn't matter on segfault :( */ + if(xp_core->audio) { /* audio state doesn't matter on segfault :( */ uninit_audio_buffer(); - xp_core.has_audio=0; + xp_core->audio=NULL; } - xmp_uninit(); } /* Min audio buffer to keep mp_free, used to tell differ between full and empty buffer */ @@ -597,33 +596,29 @@ int xmp_init_engine(sh_video_t *shv, sh_audio_t *sha) { if(shv) { - xp_core.has_video=1; - xp_core.video=mp_malloc(sizeof(dec_ahead_engine_t)); - dae_init(xp_core.video,xp_core.num_v_buffs,shv); - } else {/* if (mp_conf.xp >= XP_VAFull) mp_conf.xp = XP_VAPlay;*/ + xp_core->video=mp_mallocz(sizeof(dec_ahead_engine_t)); + dae_init(xp_core->video,xp_core->num_v_buffs,shv); } - if(mp_conf.xp>=XP_VideoAudio && sha) { int asize; unsigned o_bps; unsigned min_reserv; o_bps=sha->afilter_inited?sha->af_bps:sha->o_bps; - if(xp_core.has_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_core.num_v_buffs/shv->fps))+MIN_BUFFER_RESERV; - else asize = o_bps*xp_core.num_a_buffs; + if(xp_core->video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_core->num_v_buffs/shv->fps))+MIN_BUFFER_RESERV; + else asize = o_bps*xp_core->num_a_buffs; /* FIXME: get better indices from asize/real_audio_packet_size */ min_reserv = sha->audio_out_minsize; if (o_bps > sha->o_bps) min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); - xp_core.has_audio=1; - xp_core.audio=mp_malloc(sizeof(dec_ahead_engine_t)); - dae_init(xp_core.audio,xp_core.num_a_buffs,sha); + xp_core->audio=mp_mallocz(sizeof(dec_ahead_engine_t)); + dae_init(xp_core->audio,xp_core->num_a_buffs,sha); } return 0; } unsigned xmp_register_thread(dec_ahead_engine_t* dae,sig_handler_t sigfunc,mpxp_routine_t routine,const char *name) { - unsigned idx=xp_core.num_threads; + unsigned idx=xp_core->num_threads; int rc; if(idx>=MAX_MPXP_THREADS) return UINT_MAX; pthread_attr_t attr; @@ -639,32 +634,32 @@ /* requires root privelegies */ pthread_attr_setschedpolicy(&attr,SCHED_FIFO); #endif - xp_core.mpxp_threads[idx]=mp_mallocz(sizeof(mpxp_thread_t)); + xp_core->mpxp_threads[idx]=mp_mallocz(sizeof(mpxp_thread_t)); - xp_core.mpxp_threads[idx]->p_idx=idx; - xp_core.mpxp_threads[idx]->name=name; - xp_core.mpxp_threads[idx]->routine=routine; - xp_core.mpxp_threads[idx]->sigfunc=sigfunc; - xp_core.mpxp_threads[idx]->state=Pth_Stand; - xp_core.mpxp_threads[idx]->dae=dae; + xp_core->mpxp_threads[idx]->p_idx=idx; + xp_core->mpxp_threads[idx]->name=name; + xp_core->mpxp_threads[idx]->routine=routine; + xp_core->mpxp_threads[idx]->sigfunc=sigfunc; + xp_core->mpxp_threads[idx]->state=Pth_Stand; + xp_core->mpxp_threads[idx]->dae=dae; - rc=pthread_create(&xp_core.mpxp_threads[idx]->pth_id,&attr,routine,xp_core.mpxp_threads[idx]); + rc=pthread_create(&xp_core->mpxp_threads[idx]->pth_id,&attr,routine,xp_core->mpxp_threads[idx]); pthread_attr_destroy(&attr); - xp_core.num_threads++; + xp_core->num_threads++; return (rc?UINT_MAX:idx); } int xmp_run_decoders( void ) { unsigned rc; - if((xp_core.has_audio && mp_conf.xp >= XP_VAFull) || !xp_core.has_video) { - if((rc=xmp_register_thread(xp_core.audio,sig_audio_decode,a_dec_ahead_routine,"audio decoder+af"))==UINT_MAX) return rc; - while(xp_core.mpxp_threads[rc]->state!=Pth_Run) usleep(0); + if((xp_core->audio && mp_conf.xp >= XP_VAFull) || !xp_core->video) { + if((rc=xmp_register_thread(xp_core->audio,sig_audio_decode,a_dec_ahead_routine,"audio decoder+af"))==UINT_MAX) return rc; + while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } - if(xp_core.has_video) { - if((rc=xmp_register_thread(xp_core.video,sig_dec_ahead_video,Va_dec_ahead_routine,"video+audio decoders & af+vf"))==UINT_MAX) return rc; - while(xp_core.mpxp_threads[rc]->state!=Pth_Run) usleep(0); + if(xp_core->video) { + if((rc=xmp_register_thread(xp_core->video,sig_dec_ahead_video,Va_dec_ahead_routine,"video+audio decoders & af+vf"))==UINT_MAX) return rc; + while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } return 0; } @@ -672,9 +667,9 @@ int xmp_run_players(void) { unsigned rc; - if( xp_core.has_audio && mp_conf.xp >= XP_VAPlay ) { - if((rc=xmp_register_thread(xp_core.audio,sig_audio_play,audio_play_routine,"audio player"))==UINT_MAX) return rc; - while(xp_core.mpxp_threads[rc]->state!=Pth_Run) usleep(0); + if( xp_core->audio && mp_conf.xp >= XP_VAPlay ) { + if((rc=xmp_register_thread(xp_core->audio,sig_audio_play,audio_play_routine,"audio player"))==UINT_MAX) return rc; + while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } return 0; } @@ -683,15 +678,15 @@ void xmp_stop_threads(int force) { unsigned i; - for(i=1;i<xp_core.num_threads;i++) { - if(force) pthread_kill(xp_core.mpxp_threads[i]->pth_id,SIGKILL); + for(i=1;i<xp_core->num_threads;i++) { + if(force) pthread_kill(xp_core->mpxp_threads[i]->pth_id,SIGKILL); else { - xp_core.mpxp_threads[i]->state=Pth_Canceling; - while(xp_core.mpxp_threads[i]->state==Pth_Canceling) usleep(0); + xp_core->mpxp_threads[i]->state=Pth_Canceling; + while(xp_core->mpxp_threads[i]->state==Pth_Canceling) usleep(0); } print_stopped_thread(i); - mp_free(xp_core.mpxp_threads[i]); - xp_core.mpxp_threads[i]=NULL; + mp_free(xp_core->mpxp_threads[i]); + xp_core->mpxp_threads[i]=NULL; } } @@ -699,9 +694,9 @@ void xmp_halt_threads(int is_reset_vcache) { unsigned i; - for(i=1;i<xp_core.num_threads;i++) { - xp_core.mpxp_threads[i]->state=Pth_Sleep; - while(xp_core.mpxp_threads[i]->state==Pth_Sleep) usleep(0); + for(i=1;i<xp_core->num_threads;i++) { + xp_core->mpxp_threads[i]->state=Pth_Sleep; + while(xp_core->mpxp_threads[i]->state==Pth_Sleep) usleep(0); } } @@ -709,17 +704,17 @@ void xmp_restart_threads(int xp_id) { /* reset counters */ - dae_reset(xp_core.video); + dae_reset(xp_core->video); /* temporary solution */ reset_audio_buffer(); /* Ugly hack: but we should read audio packet before video after seeking. Else we'll get picture destortion on the screen */ - xp_core.initial_apts=HUGE; + xp_core->initial_apts=HUGE; unsigned i; - for(i=1;i<xp_core.num_threads;i++) { - xp_core.mpxp_threads[i]->state=Pth_Run; - while(xp_core.mpxp_threads[i]->state==Pth_ASleep) usleep(0); + for(i=1;i<xp_core->num_threads;i++) { + xp_core->mpxp_threads[i]->state=Pth_Run; + while(xp_core->mpxp_threads[i]->state==Pth_ASleep) usleep(0); } } @@ -795,7 +790,7 @@ samples = 10; min_audio = MAX_AUDIO_TIME; max_audio = 0; - } else if( !xp_core.audio->eof && collect_samples) { + } else if( !xp_core->audio->eof && collect_samples) { if( dec_ahead_audio_delay < min_audio ) min_audio = dec_ahead_audio_delay; if( dec_ahead_audio_delay > max_audio ) @@ -852,7 +847,7 @@ __MP_UNIT(priv->p_idx,"audio pause"); LOCK_AUDIO_PLAY(); - while( xp_core.in_pause && priv->state!=Pth_Canceling) { + while( xp_core->in_pause && priv->state!=Pth_Canceling) { pthread_cond_wait( &audio_play_cond, &audio_play_mutex ); } UNLOCK_AUDIO_PLAY(); @@ -883,7 +878,7 @@ void dec_ahead_reset_sh_video(sh_video_t *shv) { - sh_video_t* sh_video=xp_core.video->sh; + sh_video_t* sh_video=xp_core->video->sh; sh_video->vfilter = shv->vfilter; } @@ -892,8 +887,8 @@ MSG_T("sig_dec_ahead_video\n"); mp_msg_flush(); - xp_core.video->eof = 1; - xp_core.video->fra[dae_curr_vdecoded()].eof=1; + xp_core->video->eof = 1; + xp_core->video->fra[dae_curr_vdecoded(xp_core)].eof=1; /* Unlock all mutex ( man page says it may deadlock, but what is worse deadlock here or later? ) Modified: mplayerxp/xmp_core.h =================================================================== --- mplayerxp/xmp_core.h 2012-10-31 17:45:52 UTC (rev 271) +++ mplayerxp/xmp_core.h 2012-11-01 08:38:09 UTC (rev 272) @@ -68,8 +68,6 @@ }initial_audio_pts_correction_t; typedef struct xp_core_s { - int has_video; - int has_audio; dec_ahead_engine_t* video; dec_ahead_engine_t* audio; volatile int in_pause; @@ -85,7 +83,7 @@ float initial_apts; initial_audio_pts_correction_t initial_apts_corr; }xp_core_t; -extern xp_core_t xp_core; +extern xp_core_t *xp_core; extern void xmp_init(void); extern void xmp_uninit(void); @@ -124,12 +122,12 @@ extern unsigned dae_get_decoder_outrun(const dec_ahead_engine_t* it); extern void dae_wait_decoder_outrun(const dec_ahead_engine_t* it); -static inline unsigned dae_curr_vplayed() { return xp_core.video->player_idx; } -static inline unsigned dae_curr_vdecoded() { return xp_core.video->decoder_idx; } -static inline unsigned dae_prev_vplayed() { return dae_prev_played(xp_core.video); } -static inline unsigned dae_prev_vdecoded() { return dae_prev_decoded(xp_core.video); } -static inline unsigned dae_next_vplayed() { return dae_next_played(xp_core.video); } -static inline unsigned dae_next_vdecoded() { return dae_next_decoded(xp_core.video); } +static inline unsigned dae_curr_vplayed(const xp_core_t* xpc) { return xpc->video->player_idx; } +static inline unsigned dae_curr_vdecoded(const xp_core_t* xpc) { return xpc->video->decoder_idx; } +static inline unsigned dae_prev_vplayed(const xp_core_t* xpc) { return dae_prev_played(xpc->video); } +static inline unsigned dae_prev_vdecoded(const xp_core_t* xpc) { return dae_prev_decoded(xpc->video); } +static inline unsigned dae_next_vplayed(const xp_core_t* xpc) { return dae_next_played(xpc->video); } +static inline unsigned dae_next_vdecoded(const xp_core_t* xpc) { return dae_next_decoded(xpc->video); } extern frame_attr_t dae_played_fra(const dec_ahead_engine_t* it); extern frame_attr_t dae_decoded_fra(const dec_ahead_engine_t* it); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-01 16:14:03
|
Revision: 275 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=275&view=rev Author: nickols_k Date: 2012-11-01 16:13:56 +0000 (Thu, 01 Nov 2012) Log Message: ----------- remove mp_malloc's statistics because malloc_backtrace is precisiongly! TODO: rewrite demuxer: it lose 40 bytes per every packet Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.h Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-01 15:53:52 UTC (rev 274) +++ mplayerxp/mplayer.c 2012-11-01 16:13:56 UTC (rev 275) @@ -238,7 +238,7 @@ if(ao_data) mp_free(ao_data); mp_data=NULL; xmp_uninit(); - mp_uninit_malloc(1); + mp_uninit_malloc(mp_conf.verbose); } /************************************************************************ Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-11-01 15:53:52 UTC (rev 274) +++ mplayerxp/osdep/mp_malloc.c 2012-11-01 16:13:56 UTC (rev 275) @@ -25,13 +25,9 @@ unsigned rnd_limit; unsigned every_nth_call; enum mp_malloc_e flags; - // statistics + /* for randomizer */ unsigned long long int total_calls; - unsigned long long int num_allocs; - // local statistics - int enable_stat; - unsigned long long int stat_total_calls; - unsigned long long int stat_num_allocs; + /* backtrace and protector slots */ mp_slot_t* slots; size_t nslots; }priv_t; @@ -238,13 +234,11 @@ void mp_uninit_malloc(int verbose) { if(priv->flags&MPA_FLG_BACKTRACE) { - if(priv->nslots) + if(priv->nslots) { MSG_WARN("Warning! %lli slots were not freed\n",priv->nslots); - } else { - if(priv->num_allocs && verbose) - MSG_WARN("Warning! From %lli total calls of alloc() were not freed %lli buffers\n",priv->total_calls,priv->num_allocs); + if(verbose) bt_print_slots(); + } } - if(priv->flags&MPA_FLG_BACKTRACE && verbose) bt_print_slots(); free(priv); priv=NULL; } @@ -263,11 +257,6 @@ else rb=malloc(__size); if(rnd_buff) free(rnd_buff); priv->total_calls++; - priv->num_allocs++; - if(priv->enable_stat) { - priv->stat_total_calls++; - priv->stat_num_allocs++; - } return rb; } @@ -279,12 +268,6 @@ if(priv->flags&(MPA_FLG_BOUNDS_CHECK|MPA_FLG_BEFORE_CHECK)) rb=prot_memalign(boundary,__size); else if(priv->flags&MPA_FLG_BACKTRACE) rb=bt_memalign(boundary,__size); else rb=memalign(boundary,__size); - priv->total_calls++; - priv->num_allocs++; - if(priv->enable_stat) { - priv->stat_total_calls++; - priv->stat_num_allocs++; - } return rb; } @@ -300,11 +283,12 @@ { if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); if(__ptr) { - if(priv->flags&(MPA_FLG_BOUNDS_CHECK|MPA_FLG_BEFORE_CHECK)) prot_free(__ptr); - else if(priv->flags&MPA_FLG_BACKTRACE) bt_free(__ptr); - else free(__ptr); - priv->num_allocs--; - if(priv->enable_stat) priv->stat_num_allocs--; + if(priv->flags&(MPA_FLG_BOUNDS_CHECK|MPA_FLG_BEFORE_CHECK)) + prot_free(__ptr); + else if(priv->flags&MPA_FLG_BACKTRACE) + bt_free(__ptr); + else + free(__ptr); } } @@ -327,22 +311,6 @@ return rs; } -void __FASTCALL__ mp_open_malloc_stat(void) { - if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); - priv->enable_stat=1; - priv->stat_total_calls=priv->stat_num_allocs=0ULL; -} - -unsigned long long __FASTCALL__ mp_close_malloc_stat(int verbose) { - if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); - priv->enable_stat=0; - if(verbose) - MSG_INFO("mp_malloc stat: from %lli total calls of alloc() were not freed %lli buffers\n" - ,priv->stat_total_calls - ,priv->stat_num_allocs); - return priv->stat_num_allocs; -} - int __FASTCALL__ mp_mprotect(const any_t* addr,size_t len,enum mp_prot_e flags) { return mprotect(addr,len,flags); Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-11-01 15:53:52 UTC (rev 274) +++ mplayerxp/osdep/mplib.h 2012-11-01 16:13:56 UTC (rev 275) @@ -45,9 +45,6 @@ extern void __FASTCALL__ mp_init_malloc(unsigned rnd_limit,unsigned every_nth_call,enum mp_malloc_e flags); extern void __FASTCALL__ mp_uninit_malloc(int verbose); -extern void __FASTCALL__ mp_open_malloc_stat(void); -extern unsigned long long __FASTCALL__ mp_close_malloc_stat(int verbose); - extern any_t* __FASTCALL__ mp_malloc(size_t __size); extern any_t* __FASTCALL__ mp_mallocz(size_t __size); extern any_t* __FASTCALL__ mp_realloc(any_t*__ptr, size_t __size); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-01 17:11:36
|
Revision: 276 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=276&view=rev Author: nickols_k Date: 2012-11-01 17:11:30 +0000 (Thu, 01 Nov 2012) Log Message: ----------- minimize number of sources Modified Paths: -------------- mplayerxp/mplayer.c Removed Paths: ------------- mplayerxp/cfg-mplayer-def.h Deleted: mplayerxp/cfg-mplayer-def.h =================================================================== --- mplayerxp/cfg-mplayer-def.h 2012-11-01 16:13:56 UTC (rev 275) +++ mplayerxp/cfg-mplayer-def.h 2012-11-01 17:11:30 UTC (rev 276) @@ -1,6 +0,0 @@ -static char* default_config= -"# Write your default config options here!\n" -"\n" -//"nosound=nem" -"\n"; - Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-01 16:13:56 UTC (rev 275) +++ mplayerxp/mplayer.c 2012-11-01 17:11:30 UTC (rev 276) @@ -40,7 +40,6 @@ #include "libmpconf/cfgparser.h" #include "libmpconf/codec-cfg.h" #include "libmpconf/m_struct.h" -#include "cfg-mplayer-def.h" #include "libmpcodecs/dec_video.h" #include "libmpcodecs/dec_audio.h" @@ -766,6 +765,12 @@ __exit_sighandler(); } +static char* default_config= +"# Write your default config options here!\n" +"\n" +//"nosound=nein" +"\n"; + void parse_cfgfiles( m_config_t* conf ) { char *conffile; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-02 07:05:41
|
Revision: 277 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=277&view=rev Author: nickols_k Date: 2012-11-02 07:05:34 +0000 (Fri, 02 Nov 2012) Log Message: ----------- simplify code Modified Paths: -------------- mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/postproc/vf_vo.c Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-11-01 17:11:30 UTC (rev 276) +++ mplayerxp/libvo/video_out.c 2012-11-02 07:05:34 UTC (rev 277) @@ -511,13 +511,12 @@ pthread_mutex_unlock(&priv->surfaces_mutex); } -uint32_t __FASTCALL__ vo_get_surface(vo_data_t*vo,mp_image_t* mpi, unsigned decoder_idx) +uint32_t __FASTCALL__ vo_get_surface(vo_data_t*vo,mp_image_t* mpi) { vo_priv_t* priv=(vo_priv_t*)vo->vo_priv; int width_less_stride; MSG_DBG2("dri_vo_dbg: vo_get_surface type=%X flg=%X\n",mpi->type,mpi->flags); width_less_stride = 0; - mpi->xp_idx = decoder_idx; if(mpi->flags & MP_IMGFLAG_PLANAR) { width_less_stride = mpi->w <= priv->dri.cap.strides[0] && @@ -555,9 +554,9 @@ if((((mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && width_less_stride) || priv->dri.planes_eq) && priv->dri.dr) { vo_lock_surfaces(vo); - mpi->planes[0]=priv->dri.surf[decoder_idx].planes[0]+priv->dri.off[0]; - mpi->planes[1]=priv->dri.surf[decoder_idx].planes[1]+priv->dri.off[1]; - mpi->planes[2]=priv->dri.surf[decoder_idx].planes[2]+priv->dri.off[2]; + mpi->planes[0]=priv->dri.surf[mpi->xp_idx].planes[0]+priv->dri.off[0]; + mpi->planes[1]=priv->dri.surf[mpi->xp_idx].planes[1]+priv->dri.off[1]; + mpi->planes[2]=priv->dri.surf[mpi->xp_idx].planes[2]+priv->dri.off[2]; mpi->stride[0]=priv->dri.cap.strides[0]; mpi->stride[1]=priv->dri.cap.strides[1]; mpi->stride[2]=priv->dri.cap.strides[2]; Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-01 17:11:30 UTC (rev 276) +++ mplayerxp/libvo/video_out.h 2012-11-02 07:05:34 UTC (rev 277) @@ -263,7 +263,7 @@ extern void vo_lock_surfaces(vo_data_t* vo); extern void vo_unlock_surfaces(vo_data_t* vo); -extern uint32_t __FASTCALL__ vo_get_surface(vo_data_t* vo,mp_image_t* mpi,unsigned decoder_idx); +extern uint32_t __FASTCALL__ vo_get_surface(vo_data_t* vo,mp_image_t* mpi); extern int vo_check_events(vo_data_t* vo); extern unsigned __FASTCALL__ vo_get_num_frames(vo_data_t* vo); Modified: mplayerxp/postproc/vf_vo.c =================================================================== --- mplayerxp/postproc/vf_vo.c 2012-11-01 17:11:30 UTC (rev 276) +++ mplayerxp/postproc/vf_vo.c 2012-11-02 07:05:34 UTC (rev 277) @@ -124,7 +124,7 @@ unsigned i; int finalize = vo_is_final(vo_data); struct vf_priv_s *priv = vf->priv; - retval=vo_get_surface(vo_data,mpi,mpi->xp_idx); + retval=vo_get_surface(vo_data,mpi); if(retval==CONTROL_TRUE) { mpi->flags |= MP_IMGFLAG_FINAL|MP_IMGFLAG_DIRECT; if(finalize) mpi->flags |= MP_IMGFLAG_FINALIZED; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-02 09:08:50
|
Revision: 279 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=279&view=rev Author: nickols_k Date: 2012-11-02 09:08:44 +0000 (Fri, 02 Nov 2012) Log Message: ----------- use ffmpeg's video decoders as last hope Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpconf/codec-cfg.c mplayerxp/mplayer.c Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-11-02 08:57:39 UTC (rev 278) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-02 09:08:44 UTC (rev 279) @@ -88,15 +88,57 @@ static unsigned smp_num_cpus=1; static unsigned use_vf_threads=0; +static const vd_functions_t* mpcv_find_driver_by_name(const char *name) { + unsigned i; + for (i=0; mpcodecs_vd_drivers[i] != NULL; i++) + if(strcmp(mpcodecs_vd_drivers[i]->info->driver_name,name)==0) break; + return mpcodecs_vd_drivers[i]; +} + +static void mpcv_print_codec_info(sh_video_t* sh_video) { + MSG_OK("[VC] %s decoder: [%s] drv:%s.%s (%dx%d (aspect %g) %4.2ffps\n" + ,mp_conf.video_codec?"Forcing":"Selected" + ,sh_video->codec->codec_name + ,mpvdec->info->driver_name + ,sh_video->codec->dll_name + ,sh_video->src_w + ,sh_video->src_h + ,sh_video->aspect + ,sh_video->fps); + // Yeah! We got it! + sh_video->inited=1; + sh_video->vf_flags=vf_query_flags(sh_video->vfilter); +#ifdef _OPENMP + if(mp_conf.gomp) { + smp_num_cpus=omp_get_num_procs(); + use_vf_threads=0; + if(((sh_video->vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) use_vf_threads=1; + if(use_vf_threads) + MSG_STATUS("[mpdec] will perform parallel video-filter on %u CPUs\n",smp_num_cpus); + } +#else + MSG_V("[mpdec] GOMP was not compiled-in! Using single threaded video filtering!\n"); +#endif +} + +int mpcv_ffmpeg_init(sh_video_t*sh_video) { + /* Use ffmpeg's drivers as last hope */ + mpvdec=mpcv_find_driver_by_name("ffmpeg"); + if(!mpvdec->init(sh_video)){ + MSG_ERR(MSGTR_CODEC_CANT_INITV); + return 0; + } + mpcv_print_codec_info(sh_video); + return 1; +} + int mpcv_init(sh_video_t *sh_video,const char* codecname,const char * vfm,int status){ - unsigned o_bps,bpp; sh_video->codec=NULL; MSG_DBG3("mpcv_init(%p, %s, %s, %i)\n",sh_video,codecname,vfm,status); while((sh_video->codec=find_codec(sh_video->fourcc, - sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL, - sh_video->codec,0) )){ + sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL, + sh_video->codec,0) )){ // ok we found one codec - int i; if(sh_video->codec->flags&CODECS_FLAG_SELECTED) { MSG_DBG3("mpcv_init: %s already tried and failed\n",sh_video->codec->codec_name); continue; @@ -115,63 +157,14 @@ } sh_video->codec->flags|=CODECS_FLAG_SELECTED; // tagging it // ok, it matches all rules, let's find the driver! - for (i=0; mpcodecs_vd_drivers[i] != NULL; i++) - if(strcmp(mpcodecs_vd_drivers[i]->info->driver_name,sh_video->codec->driver_name)==0) break; - mpvdec=mpcodecs_vd_drivers[i]; - if(!mpvdec) continue; + if(!(mpvdec=mpcv_find_driver_by_name(sh_video->codec->driver_name))) continue; else MSG_DBG3("mpcv_init: mpcodecs_vd_drivers[%s]->mpvdec==0\n",mpcodecs_vd_drivers[i]->info->driver_name); // it's available, let's try to init! if(!mpvdec->init(sh_video)){ MSG_ERR(MSGTR_CODEC_CANT_INITV); continue; // try next... } - switch(sh_video->codec->outfmt[sh_video->outfmtidx]) - { - case IMGFMT_RGB8: - case IMGFMT_BGR8: - case IMGFMT_Y800: bpp=8; break; - case IMGFMT_YVU9: - case IMGFMT_IF09: bpp = 9; break; - case IMGFMT_YV12: - case IMGFMT_I420: - case IMGFMT_IYUV: bpp = 12; break; - default: - case IMGFMT_RGB15: - case IMGFMT_BGR15: - case IMGFMT_RGB16: - case IMGFMT_BGR16: - case IMGFMT_YUY2: - case IMGFMT_YVYU: - case IMGFMT_UYVY: bpp = 16; break; - case IMGFMT_RGB24: - case IMGFMT_BGR24: bpp = 24; break; - case IMGFMT_RGB32: - case IMGFMT_BGR32: bpp = 32; break; - } - o_bps=sh_video->fps*sh_video->src_w*sh_video->src_h*bpp/8; - MSG_OK("[VC] %s decoder: [%s] drv:%s.%s (%dx%d (aspect %g) %4.2ffps\n" - ,mp_conf.video_codec?"Forcing":"Selected" - ,sh_video->codec->codec_name - ,mpvdec->info->driver_name - ,sh_video->codec->dll_name - ,sh_video->src_w - ,sh_video->src_h - ,sh_video->aspect - ,sh_video->fps); - // Yeah! We got it! - sh_video->inited=1; - sh_video->vf_flags=vf_query_flags(sh_video->vfilter); -#ifdef _OPENMP - if(mp_conf.gomp) { - smp_num_cpus=omp_get_num_procs(); - use_vf_threads=0; - if(((sh_video->vf_flags&MPDEC_THREAD_COND)==MPDEC_THREAD_COND) && (smp_num_cpus>1)) use_vf_threads=1; - if(use_vf_threads) - MSG_STATUS("[mpdec] will perform parallel video-filter on %u CPUs\n",smp_num_cpus); - } -#else - MSG_V("[mpdec] GOMP was not compiled-in! Using single threaded video filtering!\n"); -#endif + mpcv_print_codec_info(sh_video); return 1; } return 0; Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-11-02 08:57:39 UTC (rev 278) +++ mplayerxp/libmpcodecs/dec_video.h 2012-11-02 09:08:44 UTC (rev 279) @@ -4,6 +4,7 @@ // dec_video.c: extern int __FASTCALL__ mpcv_init(sh_video_t *sh_video, const char *codec_name,const char *family,int status); extern void __FASTCALL__ mpcv_uninit(sh_video_t *sh_video); +extern int __FASTCALL__ mpcv_ffmpeg_init(sh_video_t*); extern int __FASTCALL__ mpcv_decode(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame,float pts); Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-02 08:57:39 UTC (rev 278) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-02 09:08:44 UTC (rev 279) @@ -74,6 +74,7 @@ LIBVD_EXTERN(ffmpeg) #include "libavcodec/avcodec.h" +#include "libavformat/riff.h" #include "libvo/video_out.h" @@ -214,6 +215,32 @@ return 1; } +static int find_vdecoder(sh_video_t* sh) { + unsigned i; + unsigned char flag = CODECS_FLAG_NOFLIP; + enum AVCodecID id = ff_codec_get_id(ff_codec_bmp_tags,sh->fourcc); + if (id <= 0) { + const char *fourcc; + prn_err: + fourcc=&sh->fourcc; + MSG_ERR("Cannot find AVCodecID for for '%c%c%c%c' fourcc! Try force -vc option\n" + ,fourcc[0],fourcc[1],fourcc[2],fourcc[3]); + return 0; + } + AVCodec *codec=avcodec_find_decoder(id); + if(!codec) goto prn_err; + sh->codec=mp_mallocz(sizeof(struct codecs_st)); + strcpy(sh->codec->dll_name,"ffmpeg"); + strcpy(sh->codec->driver_name,"ffmpeg"); + strcpy(sh->codec->codec_name,avcodec_get_name(id)); + for(i=0;i<CODECS_MAX_OUTFMT;i++) { + if(codec->pix_fmts[i]==-1) break; + sh->codec->outfmt[i]=avcodec_pix_fmt_to_codec_tag(codec->pix_fmts[i]); + sh->codec->outflags[i]=flag; + } + return 1; +} + extern unsigned xp_num_cpu; static int init(sh_video_t *sh){ unsigned avc_version=0; @@ -228,6 +255,10 @@ vdff_ctx=mp_mallocz(sizeof(priv_t)); sh->context = vdff_ctx; vdff_ctx->frame_number=-2; + if(!sh->codec) if(!find_vdecoder(sh)) { + MSG_ERR("Can't find ffmpeg decoder\n"); + return 0; + } vdff_ctx->lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll_name); if(!vdff_ctx->lavc_codec){ MSG_ERR(MSGTR_MissingLAVCcodec,sh->codec->dll_name); Modified: mplayerxp/libmpconf/codec-cfg.c =================================================================== --- mplayerxp/libmpconf/codec-cfg.c 2012-11-02 08:57:39 UTC (rev 278) +++ mplayerxp/libmpconf/codec-cfg.c 2012-11-02 09:08:44 UTC (rev 279) @@ -267,27 +267,25 @@ return 0; } -static int validate_codec(codecs_t *c, int type) +static int validate_codec(codecs_t *c) { - unsigned i; - char *tmp_name = mp_strdup(c->codec_name); + unsigned i; + char *tmp_name = mp_strdup(c->codec_name); - for (i = 0; i < strlen(tmp_name) && isalnum(tmp_name[i]); i++) - /* NOTHING */; + for (i = 0; i < strlen(tmp_name) && isalnum(tmp_name[i]); i++)/* NOTHING */; - if (i < strlen(tmp_name)) { - MSG_ERR("\ncodec(%s) name is not valid!\n", c->codec_name); - mp_free(tmp_name); - return 0; - } - - if (!c->s_info) - { - strncpy(c->s_info,c->codec_name,sizeof(c->s_info)); - c->s_info[sizeof(c->s_info)-1]=0; - } + if (i < strlen(tmp_name)) { + MSG_ERR("\ncodec(%s) name is not valid!\n", c->codec_name); mp_free(tmp_name); - return 1; + return 0; + } + + if (!c->s_info) { + strncpy(c->s_info,c->codec_name,sizeof(c->s_info)); + c->s_info[sizeof(c->s_info)-1]=0; + } + mp_free(tmp_name); + return 1; } static short get_cpuflags(char *s) @@ -399,9 +397,9 @@ codecs_t *codec = NULL; // current codec codecs_t **codecsp = NULL;// points to audio_codecs or to video_codecs char *endptr; // strtoul()... - int *nr_codecsp; + int *nr_codecsp=NULL; const char *err_hint=NULL; - int codec_type; /* TYPE_VIDEO/TYPE_AUDIO */ + int codec_type=0; /* TYPE_VIDEO/TYPE_AUDIO */ int tmp, i; // in case we call it secont time @@ -414,7 +412,7 @@ nr_vcodecs = 0; nr_acodecs = 0; - if(cfgfile==NULL)return 0; + if(cfgfile==NULL) return 0; if ((fp = fopen(cfgfile, "r")) == NULL) { MSG_FATAL("can't open '%s': %s\n", cfgfile, strerror(errno)); @@ -444,7 +442,7 @@ continue; if (!strcmp(token[0], "audiocodec") || !strcmp(token[0], "videocodec")) { - if (!validate_codec(codec, codec_type)) + if (!validate_codec(codec)) goto err_out_not_valid; loop_enter: if (*token[0] == 'v') { @@ -613,7 +611,7 @@ } else goto err_out_parse_error; } - if (!validate_codec(codec, codec_type)) + if (!validate_codec(codec)) goto err_out_not_valid; MSG_INFO("%d audio & %d video codecs\n", nr_acodecs, nr_vcodecs); if(video_codecs) video_codecs[nr_vcodecs].codec_name[0] = '\0'; @@ -649,106 +647,103 @@ codecs_t *find_audio_codec(unsigned int fourcc, unsigned int *fourccmap, const codecs_t *start) { - return find_codec(fourcc, fourccmap, start, 1); + return find_codec(fourcc, fourccmap, start, 1); } codecs_t *find_video_codec(unsigned int fourcc, unsigned int *fourccmap, const codecs_t *start) { - return find_codec(fourcc, fourccmap, start, 0); + return find_codec(fourcc, fourccmap, start, 0); } codecs_t* find_codec(unsigned int fourcc,unsigned int *fourccmap, const codecs_t *start, int audioflag) { - int i, j; - codecs_t *c; - { - if (audioflag) { - i = nr_acodecs; - c = audio_codecs; - } else { - i = nr_vcodecs; - c = video_codecs; - } - if(!i) return NULL; - for (/* NOTHING */; i--; c++) { - if(start && c<=start) continue; - for (j = 0; j < CODECS_MAX_FOURCC; j++) { - if (c->fourcc[j]==fourcc || c->driver_name==0) { - if (fourccmap) - *fourccmap = c->fourccmap[j]; - return c; - } - } - } + int i, j; + codecs_t *c; + if (audioflag) { + i = nr_acodecs; + c = audio_codecs; + } else { + i = nr_vcodecs; + c = video_codecs; + } + if(!i) return NULL; + for (/* NOTHING */; i--; c++) { + if(start && c<=start) continue; + for (j = 0; j < CODECS_MAX_FOURCC; j++) { + if (c->fourcc[j]==fourcc || c->driver_name==0) { + if (fourccmap) + *fourccmap = c->fourccmap[j]; + return c; + } } - return NULL; + } + return NULL; } void codecs_reset_selection(int audioflag){ - int i; - codecs_t *c; - if (audioflag) { - i = nr_acodecs; - c = audio_codecs; - } else { - i = nr_vcodecs; - c = video_codecs; - } - if(i) - for (/* NOTHING */; i--; c++) - c->flags&=(~CODECS_FLAG_SELECTED); + int i; + codecs_t *c; + if (audioflag) { + i = nr_acodecs; + c = audio_codecs; + } else { + i = nr_vcodecs; + c = video_codecs; + } + if(i) + for (/* NOTHING */; i--; c++) + c->flags&=(~CODECS_FLAG_SELECTED); } void list_codecs(int audioflag){ int i; codecs_t *c; - if (audioflag) { - i = nr_acodecs; - c = audio_codecs; - MSG_INFO("Available audio codecs:\n"); - } else { - i = nr_vcodecs; - c = video_codecs; - MSG_INFO("Available video codecs:\n"); - } - MSG_INFO(" %-11s %-10s %s %s [%s]\n" + if (audioflag) { + i = nr_acodecs; + c = audio_codecs; + MSG_INFO("Available audio codecs:\n"); + } else { + i = nr_vcodecs; + c = video_codecs; + MSG_INFO("Available video codecs:\n"); + } + MSG_INFO(" %-11s %-10s %s %s [%s]\n" ,audioflag?"ac:":"vc:" ,audioflag?"afm:":"vfm:" ,"status:" ,"info:" ,"lib/dll"); - if(!i) return; - for (/* NOTHING */; i--; c++) { - char* s="unknown "; - switch(c->status){ - case CODECS_STATUS_WORKING: s="working ";break; - case CODECS_STATUS_PROBLEMS: s="problems";break; - case CODECS_STATUS_NOT_WORKING: s="crashing";break; - case CODECS_STATUS_UNTESTED: s="untested";break; - } - if(c->dll_name) - MSG_INFO(" %-11s %-10s %s %s [%s]\n",c->codec_name,c->driver_name,s,c->s_info,c->dll_name); - else - MSG_INFO(" %-11s %-10s %s %s\n",c->codec_name,c->driver_name,s,c->s_info); + if(!i) return; + for (/* NOTHING */; i--; c++) { + char* s="unknown "; + switch(c->status){ + case CODECS_STATUS_WORKING: s="working ";break; + case CODECS_STATUS_PROBLEMS: s="problems";break; + case CODECS_STATUS_NOT_WORKING: s="crashing";break; + case CODECS_STATUS_UNTESTED: s="untested";break; } - MSG_INFO("\n"); + if(c->dll_name) + MSG_INFO(" %-11s %-10s %s %s [%s]\n",c->codec_name,c->driver_name,s,c->s_info,c->dll_name); + else + MSG_INFO(" %-11s %-10s %s %s\n",c->codec_name,c->driver_name,s,c->s_info); + } + MSG_INFO("\n"); } - - #ifdef CODECS2HTML void wrapline(FILE *f2,char *s){ int c; if(!s){ - fprintf(f2,"-"); - return; + fprintf(f2,"-"); + return; } while((c=*s++)){ - if(c==',') fprintf(f2,"<br>"); else fputc(c,f2); + if(c==',') fprintf(f2,"<br>"); + else fputc(c,f2); } } @@ -760,7 +755,7 @@ continue; } d=fgetc(f1); - + switch(d){ case '.': return; // end of section @@ -802,14 +797,14 @@ } void skiphtml(FILE *f1){ - int c,d; - while((c=fgetc(f1))>=0){ - if(c!='%'){ - continue; - } - d=fgetc(f1); - if(d=='.') return; // end of section - } + int c,d; + while((c=fgetc(f1))>=0){ + if(c!='%'){ + continue; + } + d=fgetc(f1); + if(d=='.') return; // end of section + } } int main(void) @@ -830,7 +825,7 @@ f1=fopen("DOCS/codecs-in.html","rb"); if(!f1) exit(1); f2=fopen("DOCS/codecs-status.html","wb"); if(!f2) exit(1); - + while((c=fgetc(f1))>=0){ if(c!='%'){ fputc(c,f2); @@ -890,16 +885,16 @@ fseeko(f1,pos,SEEK_SET); skiphtml(f1); //void parsehtml(FILE *f1,FILE *f2,codecs_t *codec,int section,int dshow){ - + continue; } fputc(c,f2); fputc(d,f2); - } - - fclose(f2); - fclose(f1); - return 0; + } + + fclose(f2); + fclose(f1); + return 0; } #endif Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-02 08:57:39 UTC (rev 278) +++ mplayerxp/mplayer.c 2012-11-02 09:08:44 UTC (rev 279) @@ -1208,7 +1208,7 @@ sh_audio_t* sh_audio=priv->demuxer->audio->sh; sh_video_t* sh_video=priv->demuxer->video->sh; float sleep_time=0; - if(sh_audio) { + if(sh_audio && xp_core->audio) { /* FIXME!!! need the same technique to detect xp_core->audio->eof as for video_eof! often ao_get_delay() never returns 0 :( */ if(xp_core->audio->eof && !get_delay_audio_buffer()) goto nosound_model; @@ -1234,6 +1234,7 @@ #define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ #define XP_MIN_AUDIOBUFF 0.05 #define XP_MAX_TIMESLICE 0.1 + if(!xp_core->audio) sh_audio=NULL; if(sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { float t; @@ -1360,6 +1361,7 @@ /* FIXME: this block was added to fix A-V resync caused by some strange things like playing 48KHz audio on 44.1KHz soundcard and other. Now we know PTS of every audio frame so don't need to have it */ + if(!xp_core->audio) sh_audio=NULL; if(sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data)) && !mp_conf.av_sync_pts) { float a_pts=0; @@ -1923,6 +1925,9 @@ if(mpcv_init(sh_video,NULL,NULL,status)) break; } } + /* Use ffmpeg decoders as last hope */ + if(!sh_video->inited) mpcv_ffmpeg_init(sh_video); + if(!sh_video->inited) { const char *fmt; MSG_ERR(MSGTR_CantFindVideoCodec); @@ -1936,6 +1941,7 @@ rc=-1; } else priv->inited_flags|=INITED_VCODEC; + if(sh_video) MSG_V("%s video codec: [%s] vfm:%s (%s)\n", mp_conf.video_codec?"Forcing":"Detected",sh_video->codec->codec_name,sh_video->codec->driver_name,sh_video->codec->s_info); return rc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-02 15:05:34
|
Revision: 283 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=283&view=rev Author: nickols_k Date: 2012-11-02 15:05:24 +0000 (Fri, 02 Nov 2012) Log Message: ----------- prepare next step of XP-CORE development Modified Paths: -------------- mplayerxp/libao2/ao_wav.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/mplayer.c mplayerxp/xmp_core.c mplayerxp/xmp_core.h Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-11-02 13:52:14 UTC (rev 282) +++ mplayerxp/libao2/ao_wav.c 2012-11-02 15:05:24 UTC (rev 283) @@ -222,7 +222,7 @@ extern vo_data_t* vo_data; static unsigned get_space(ao_data_t* ao){ priv_t* priv=ao->priv; - float pts=dae_played_fra(xp_core->video).v_pts; + float pts=dae_played_frame(xp_core->video).v_pts; if(pts) return ao->pts < pts + priv->fast * 30000 ? ao->outburst : 0; return ao->outburst; Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-11-02 13:52:14 UTC (rev 282) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-11-02 15:05:24 UTC (rev 283) @@ -174,8 +174,7 @@ afs->output.rate = *out_samplerate ? *out_samplerate : afs->input.rate; afs->output.nch = *out_channels ? *out_channels : afs->input.nch; if(*out_format) afs->output.format = af_format_decode(*out_format,&afs->output.bps); - else - { + else { afs->output.format = afs->input.format; afs->output.bps = out_bps ? out_bps : afs->input.bps; } @@ -223,7 +222,7 @@ afs->output.nch = out_channels ? out_channels : afs->input.nch; afs->output.format = af_format_decode(out_format ? out_format : afs->input.format,&afs->output.bps); - // filter config: + // filter config: memcpy(&afs->cfg,&af_cfg,sizeof(af_cfg_t)); MSG_V("Building audio filter chain for %dHz/%dch/%dbit (%s) -> %dHz/%dch/%dbit (%s)...\n", Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-02 13:52:14 UTC (rev 282) +++ mplayerxp/mplayer.c 2012-11-02 15:05:24 UTC (rev 283) @@ -729,7 +729,7 @@ if(sh_audio) while(get_len_audio_buffer()) usleep(0); if(sh_video) { for(;;) { - if(dae_played_fra(xp_core->video).eof) break; + if(dae_played_eof(xp_core->video)) break; usleep(0); } } @@ -1175,7 +1175,7 @@ fflush(stdout); } -static void vplayer_check_chapter_change(frame_attr_t* shva_prev,float v_pts) +static void vplayer_check_chapter_change(xmp_frame_t* shva_prev,float v_pts) { priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; @@ -1202,7 +1202,7 @@ } } -static float vplayer_compute_sleep_time(frame_attr_t* shva_prev,float screen_pts) +static float vplayer_compute_sleep_time(xmp_frame_t* shva_prev,float screen_pts) { priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; @@ -1280,14 +1280,14 @@ int can_blit=0; int delay_corrected=1; int final_frame=0; - frame_attr_t shva_prev,shva; + xmp_frame_t shva_prev,shva; - shva_prev=dae_played_fra(xp_core->video); - final_frame = shva_prev.eof; + shva_prev=dae_played_frame(xp_core->video); + final_frame = dae_played_eof(xp_core->video); if(xp_core->video->eof && final_frame) return 1; can_blit=dae_try_inc_played(xp_core->video); /* <-- TRY SWITCH TO NEXT FRAME */ - shva=dae_next_played_fra(xp_core->video); + shva=dae_next_played_frame(xp_core->video); v_pts = shva.v_pts; /*------------------------ frame decoded. --------------------*/ /* blit frame */ @@ -1309,7 +1309,7 @@ #ifdef USE_OSD MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); MP_UNIT("draw_osd"); - update_osd(shva.stream_pts); + update_osd(shva.v_pts); vo_draw_osd(vo_data,dae_next_played(xp_core->video)); #endif } @@ -2168,7 +2168,7 @@ i_abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; if(i_abs) { seek->flags = DEMUX_SEEK_SET|DEMUX_SEEK_PERCENTS; - if(sh_video) priv->osd_function= (v > dae_played_fra(xp_core->video).v_pts) ? OSD_FFW : OSD_REW; + if(sh_video) priv->osd_function= (v > dae_played_frame(xp_core->video).v_pts) ? OSD_FFW : OSD_REW; seek->secs = v/100.; } else { @@ -2834,8 +2834,8 @@ xmp_halt_threads(0); if(seek_args.secs && sh_video) { - frame_attr_t shvap = dae_played_fra(xp_core->video); - frame_attr_t shvad = xp_core->video->fra[dae_prev_decoded(xp_core->video)]; + xmp_frame_t shvap = dae_played_frame(xp_core->video); + xmp_frame_t shvad = dae_prev_decoded_frame(xp_core->video); seek_args.secs -= (xp_core->bad_pts?shvad.v_pts:d_video->pts)-shvap.v_pts; } Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-11-02 13:52:14 UTC (rev 282) +++ mplayerxp/xmp_core.c 2012-11-02 15:05:24 UTC (rev 283) @@ -90,12 +90,12 @@ void dae_init(dec_ahead_engine_t* it,unsigned nframes,any_t* sh) { it->nframes=nframes; - it->fra = mp_malloc(sizeof(frame_attr_t)*nframes); + it->frame = mp_malloc(sizeof(xmp_frame_t)*nframes); it->sh=sh; dae_reset(it); } -void dae_uninit(dec_ahead_engine_t* it) { mp_free(it->fra); it->fra=0; } +void dae_uninit(dec_ahead_engine_t* it) { mp_free(it->frame); it->frame=NULL; } /* returns 1 - on success 0 - if busy */ int dae_try_inc_played(dec_ahead_engine_t* it) { @@ -114,6 +114,7 @@ unsigned new_idx; new_idx=(it->player_idx+1)%it->nframes; if(new_idx==it->decoder_idx) return 0; + if(it->free_priv) (*it->free_priv)(it,it->frame[it->player_idx].priv); it->player_idx=new_idx; return 1; } @@ -124,6 +125,7 @@ new_idx=(it->decoder_idx+1)%it->nframes; if(new_idx==it->player_idx) return 0; it->decoder_idx=new_idx; + if(it->new_priv) it->frame[it->player_idx].priv=(*it->new_priv)(it); it->num_decoded_frames++; return 1; } @@ -147,31 +149,46 @@ } } -frame_attr_t dae_played_fra(const dec_ahead_engine_t* it) { +xmp_frame_t dae_played_frame(const dec_ahead_engine_t* it) { unsigned idx=it->player_idx; - return it->fra[idx]; + return it->frame[idx]; } -frame_attr_t dae_decoded_fra(const dec_ahead_engine_t* it) { +xmp_frame_t dae_decoded_frame(const dec_ahead_engine_t* it) { unsigned idx=it->decoder_idx; - return it->fra[idx]; + return it->frame[idx]; } -frame_attr_t dae_next_played_fra(const dec_ahead_engine_t* it) { +xmp_frame_t dae_next_played_frame(const dec_ahead_engine_t* it) { unsigned idx=dae_next_played(it); - return it->fra[idx]; + return it->frame[idx]; } -frame_attr_t dae_next_decoded_fra(const dec_ahead_engine_t* it) { +xmp_frame_t dae_next_decoded_frame(const dec_ahead_engine_t* it) { unsigned idx=dae_next_decoded(it); - return it->fra[idx]; + return it->frame[idx]; } -frame_attr_t dae_prev_played_fra(const dec_ahead_engine_t* it) { +xmp_frame_t dae_prev_played_frame(const dec_ahead_engine_t* it) { unsigned idx=dae_prev_played(it); - return it->fra[idx]; + return it->frame[idx]; } -frame_attr_t dae_prev_decoded_fra(const dec_ahead_engine_t* it) { +xmp_frame_t dae_prev_decoded_frame(const dec_ahead_engine_t* it) { unsigned idx=dae_prev_decoded(it); - return it->fra[idx]; + return it->frame[idx]; } +int dae_played_eof(const dec_ahead_engine_t* it) { + unsigned idx=it->player_idx; + return (it->frame[idx].v_pts==HUGE_VALF)?1:0; +} + +int dae_decoded_eof(const dec_ahead_engine_t* it) { + unsigned idx=it->decoder_idx; + return (it->frame[idx].v_pts==HUGE_VALF)?1:0; +} + +void dae_decoded_mark_eof(dec_ahead_engine_t* it) { + unsigned idx=it->decoder_idx; + it->frame[idx].v_pts=HUGE_VALF; +} + pthread_mutex_t audio_play_mutex=PTHREAD_MUTEX_INITIALIZER; pthread_cond_t audio_play_cond=PTHREAD_COND_INITIALIZER; @@ -260,7 +277,7 @@ static unsigned compute_frame_dropping(sh_video_t* sh_video,float v_pts,float drop_barrier) { unsigned rc=0; - float screen_pts=dae_played_fra(xp_core->video).v_pts-(mp_conf.av_sync_pts?0:xp_core->initial_apts); + float screen_pts=dae_played_frame(xp_core->video).v_pts-(mp_conf.av_sync_pts?0:xp_core->initial_apts); static float prev_delta=64; float delta,max_frame_delay;/* delay for decoding of top slow frame */ max_frame_delay = mp_data->bench->max_video+mp_data->bench->max_vout; @@ -308,7 +325,7 @@ idx1 = dae_curr_vdecoded(xp_core); idx2 = dae_prev_vdecoded(xp_core); - frame_attr_t* fra=xp_core->video->fra; + xmp_frame_t* fra=xp_core->video->frame; while( dae_curr_vplayed(xp_core) != idx2 && fra[idx2].v_pts > fra[idx1].v_pts && fra[idx2].v_pts < fra[idx1].v_pts+1.0 ) { @@ -317,8 +334,6 @@ fra[idx1].v_pts = fra[idx2].v_pts; fra[idx2].v_pts = tmp; - fra[idx1].stream_pts = fra[idx1].v_pts; - fra[idx2].stream_pts = fra[idx2].v_pts; fra[idx2].duration = fra[idx1].v_pts - fra[idx2].v_pts; idx3=(idx2-1)%xp_core->num_v_buffs; @@ -390,7 +405,7 @@ /*-------------------- Decode a frame: -----------------------*/ in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,sh_video->fps); if(in_size<0) { - xp_core->video->fra[xp_core->video->decoder_idx].eof=1; + dae_decoded_mark_eof(xp_core->video); priv->dae->eof=1; break; } @@ -447,15 +462,14 @@ if(blit_frame) { unsigned idx=dae_curr_vdecoded(xp_core); if(xp_core->bad_pts) - xp_core->video->fra[idx].v_pts=mpeg_timer; + xp_core->video->frame[idx].v_pts=mpeg_timer; else - xp_core->video->fra[idx].v_pts = v_pts; - xp_core->video->fra[idx].stream_pts = v_pts; - xp_core->video->fra[idx].duration=duration; - xp_core->video->fra[idx].eof=0; + xp_core->video->frame[idx].v_pts = v_pts; + xp_core->video->frame[idx].duration=duration; + dae_decoded_clear_eof(xp_core->video); if(!xp_core->bad_pts) { int _idx = dae_prev_vdecoded(xp_core); - xp_core->video->fra[_idx].duration=v_pts-xp_core->video->fra[_idx].v_pts; + xp_core->video->frame[_idx].duration=v_pts-xp_core->video->frame[_idx].v_pts; } if(mp_conf.frame_reorder) reorder_pts_in_mpeg(); } /* if (blit_frame) */ @@ -892,7 +906,7 @@ mp_msg_flush(); xp_core->video->eof = 1; - xp_core->video->fra[dae_curr_vdecoded(xp_core)].eof=1; + dae_decoded_mark_eof(xp_core->video); /* Unlock all mutex ( man page says it may deadlock, but what is worse deadlock here or later? ) Modified: mplayerxp/xmp_core.h =================================================================== --- mplayerxp/xmp_core.h 2012-11-02 13:52:14 UTC (rev 282) +++ mplayerxp/xmp_core.h 2012-11-02 15:05:24 UTC (rev 283) @@ -19,21 +19,29 @@ enum xp_modes { XP_NA=0, XP_Video, XP_VideoAudio, XP_VAPlay, XP_VAFull }; -typedef struct frame_attr_s +typedef struct xmp_frame_s { - int eof; /* indicates last frame in stream */ + float v_pts; /* presentation time-stamp from input stream + __huge_valf indicates EOF */ float duration; /* frame duration */ - float v_pts; /* presentation time-stamp from input stream */ - float stream_pts; /* real stream's PTS mainly for OSD */ -}frame_attr_t; + any_t* priv; +}xmp_frame_t; +struct dec_ahead_engine_s; + +typedef any_t* (*func_new_frame_priv_t)(struct dec_ahead_engine_s*); +typedef void (*func_free_frame_priv_t)(struct dec_ahead_engine_s*,any_t*); + typedef struct dec_ahead_engine_s { volatile unsigned player_idx; /* index of frame which is currently played */ volatile unsigned decoder_idx; /* index of frame which is currently decoded */ unsigned nframes; /* number of frames in buffer */ - frame_attr_t* fra; /* frame related attributes */ + xmp_frame_t* frame; /* frame related attributes */ any_t* sh; /* corresponded sh_audio_t or sh_video_t */ int eof; /* EOF for stream */ + /* methods */ + func_new_frame_priv_t new_priv; + func_free_frame_priv_t free_priv; /* for statistics */ unsigned num_slow_frames;/* number of frames which were delayed due slow computer */ long long int num_played_frames; @@ -129,13 +137,18 @@ static inline unsigned dae_next_vplayed(const xp_core_t* xpc) { return dae_next_played(xpc->video); } static inline unsigned dae_next_vdecoded(const xp_core_t* xpc) { return dae_next_decoded(xpc->video); } -extern frame_attr_t dae_played_fra(const dec_ahead_engine_t* it); -extern frame_attr_t dae_decoded_fra(const dec_ahead_engine_t* it); -extern frame_attr_t dae_next_played_fra(const dec_ahead_engine_t* it); -extern frame_attr_t dae_next_decoded_fra(const dec_ahead_engine_t* it); -extern frame_attr_t dae_prev_played_fra(const dec_ahead_engine_t* it); -extern frame_attr_t dae_prev_decoded_fra(const dec_ahead_engine_t* it); +extern xmp_frame_t dae_played_frame(const dec_ahead_engine_t* it); +extern xmp_frame_t dae_decoded_frame(const dec_ahead_engine_t* it); +extern xmp_frame_t dae_next_played_frame(const dec_ahead_engine_t* it); +extern xmp_frame_t dae_next_decoded_frame(const dec_ahead_engine_t* it); +extern xmp_frame_t dae_prev_played_frame(const dec_ahead_engine_t* it); +extern xmp_frame_t dae_prev_decoded_frame(const dec_ahead_engine_t* it); +extern int dae_played_eof(const dec_ahead_engine_t* it); +extern int dae_decoded_eof(const dec_ahead_engine_t* it); +extern void dae_decoded_mark_eof(dec_ahead_engine_t* it); +extern inline void dae_decoded_clear_eof(dec_ahead_engine_t* it) { UNUSED(it); } + extern pthread_mutex_t audio_play_mutex; extern pthread_cond_t audio_play_cond; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-02 16:03:23
|
Revision: 284 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=284&view=rev Author: nickols_k Date: 2012-11-02 16:03:16 +0000 (Fri, 02 Nov 2012) Log Message: ----------- always run video player as parallel thread Modified Paths: -------------- mplayerxp/Makefile mplayerxp/mplayer.c mplayerxp/mplayer.h mplayerxp/xmp_core.c Added Paths: ----------- mplayerxp/xmp_vplayer.c mplayerxp/xmp_vplayer.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-02 15:05:24 UTC (rev 283) +++ mplayerxp/Makefile 2012-11-02 16:03:16 UTC (rev 284) @@ -25,7 +25,7 @@ SRCS_COMMON = mp_msg.c mp_image.c SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c -SRCS_MPLAYER+= xmp_core.c +SRCS_MPLAYER+= xmp_core.c xmp_vplayer.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-02 15:05:24 UTC (rev 283) +++ mplayerxp/mplayer.c 2012-11-02 16:03:16 UTC (rev 284) @@ -73,6 +73,7 @@ #include "mixer.h" #include "xmp_core.h" +#include "xmp_vplayer.h" #define MSGT_CLASS MSGT_CPLAYER #include "mp_msg.h" @@ -129,14 +130,8 @@ unsigned inited_flags; int vo_inited; int ao_inited; - unsigned mpxp_after_seek; int osd_show_framedrop; int osd_function; -/* mp_conf.benchmark: */ - unsigned bench_dropped_frames; - float max_av_resync; -// A-V sync: - float c_total; // priv data demuxer_t* demuxer; play_tree_t*playtree; @@ -197,6 +192,7 @@ mp_data->seek_time=-1; mp_data->bench=mp_mallocz(sizeof(time_usage_t)); mp_data->use_pts_fix2=-1; + mp_data->rtc_fd=-1; mp_data->priv=mp_mallocz(sizeof(priv_t)); priv_t*priv=mp_data->priv; priv->osd_function=OSD_PLAY; @@ -244,7 +240,7 @@ AUDIO XP-CORE! ToDo: rewrite it in packet-mode ************************************************************************/ /* XP audio buffer */ -static pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; typedef struct audio_buffer_index_s { float pts; int index; @@ -1092,6 +1088,7 @@ #ifdef USE_OSD +//================= Update OSD ==================== void update_osd( float v_pts ) { priv_t*priv=mp_data->priv; @@ -1102,7 +1099,7 @@ int pts=(mp_conf.osd_level==3&&priv->demuxer->movi_length!=UINT_MAX)?priv->demuxer->movi_length-v_pts:v_pts; int addon=(mp_conf.osd_level==3&&priv->demuxer->movi_length!=UINT_MAX)?-1:1; char osd_text_tmp[64]; - if(pts==osd_last_pts-addon) + if(pts==osd_last_pts-addon) { if(mp_conf.osd_level==3&&priv->demuxer->movi_length!=UINT_MAX) ++pts; else --pts; @@ -1131,284 +1128,11 @@ } } #endif - -//================= Update OSD ==================== -static void __show_status_line(float a_pts,float v_pts,float delay,float AV_delay) { - priv_t*priv=mp_data->priv; - MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d [frms: [%i]]\n", - a_pts-delay,v_pts,AV_delay,priv->c_total - ,xp_core->video->num_played_frames,xp_core->video->num_decoded_frames - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 - ,mp_data->output_quality - ,dae_curr_vplayed(xp_core) - ); - fflush(stdout); -} - -static void show_status_line_no_apts(float v_pts) { - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - if(mp_conf.av_sync_pts && sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data))) { - float a_pts = sh_audio->timer-ao_get_delay(ao_data); - MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d\r" - ,a_pts - ,v_pts - ,a_pts-v_pts - ,0.0 - ,xp_core->video->num_played_frames,xp_core->video->num_decoded_frames - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 - ,mp_data->output_quality - ); - } else - MSG_STATUS("V:%6.1f %3d %2d%% %2d%% %4.1f%% %d\r" - ,v_pts - ,xp_core->video->num_played_frames - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 - ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 - ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 - ,mp_data->output_quality - ); - fflush(stdout); -} - -static void vplayer_check_chapter_change(xmp_frame_t* shva_prev,float v_pts) -{ - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - sh_video_t* sh_video=priv->demuxer->video->sh; - if(mp_data->use_pts_fix2 && sh_audio) { - if(sh_video->chapter_change == -1) { /* First frame after seek */ - while(v_pts < 1.0 && sh_audio->timer==0.0 && ao_get_delay(ao_data)==0.0) - usleep(0); /* Wait for audio to start play */ - if(sh_audio->timer > 2.0 && v_pts < 1.0) { - MSG_V("Video chapter change detected\n"); - sh_video->chapter_change=1; - } else { - sh_video->chapter_change=0; - } - } else if(v_pts < 1.0 && shva_prev->v_pts > 2.0) { - MSG_V("Video chapter change detected\n"); - sh_video->chapter_change=1; - } - if(sh_video->chapter_change && sh_audio->chapter_change) { - MSG_V("Reset chapter change\n"); - sh_video->chapter_change=0; - sh_audio->chapter_change=0; - } - } -} - -static float vplayer_compute_sleep_time(xmp_frame_t* shva_prev,float screen_pts) -{ - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - sh_video_t* sh_video=priv->demuxer->video->sh; - float sleep_time=0; - if(sh_audio && xp_core->audio) { - /* FIXME!!! need the same technique to detect xp_core->audio->eof as for video_eof! - often ao_get_delay() never returns 0 :( */ - if(xp_core->audio->eof && !get_delay_audio_buffer()) goto nosound_model; - if((!xp_core->audio->eof || ao_get_delay(ao_data)) && - (!mp_data->use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) - sleep_time=screen_pts-((sh_audio->timer-ao_get_delay(ao_data)) - +(mp_conf.av_sync_pts?0:xp_core->initial_apts)); - else if(mp_data->use_pts_fix2 && sh_audio->chapter_change) - sleep_time=0; - else - goto nosound_model; - } else { - nosound_model: - sleep_time=shva_prev->duration/mp_conf.playbackspeed_factor; - } - return sleep_time; -} - -static int vplayer_do_sleep(int rtc_fd,float sleep_time) -{ - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; -#define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ -#define XP_MIN_AUDIOBUFF 0.05 -#define XP_MAX_TIMESLICE 0.1 - if(!xp_core->audio) sh_audio=NULL; - if(sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { - float t; - - if( mp_conf.xp < XP_VAPlay ) { - t=ao_get_delay(ao_data)-XP_MIN_AUDIOBUFF; - if(t>XP_MAX_TIMESLICE) - t=XP_MAX_TIMESLICE; - } else - t = XP_MAX_TIMESLICE; - - usleep(t*1000000); - sleep_time-=GetRelativeTime(); - if(mp_conf.xp >= XP_VAPlay || t<XP_MAX_TIMESLICE || sleep_time>XP_MAX_TIMESLICE) { - // exit due no sound in soundcard - return 0; - } - } - - while(sleep_time>XP_MIN_TIMESLICE) { - /* mp_free cpu for threads */ - usleep(1); - sleep_time-=GetRelativeTime(); - } - MP_UNIT("sleep_usleep"); - sleep_time=SleepTime(rtc_fd,mp_conf.softsleep,sleep_time); - return 1; -} - typedef struct osd_args_s { int visible; int info_factor; }osd_args_t; -static float max_pts_correction=0; -int mpxp_play_video( int rtc_fd ) -{ - priv_t*priv=mp_data->priv; - sh_audio_t* sh_audio=priv->demuxer->audio->sh; - sh_video_t* sh_video=priv->demuxer->video->sh; - demux_stream_t *d_audio=priv->demuxer->audio; - float v_pts=0; - float sleep_time=0; - int can_blit=0; - int delay_corrected=1; - int final_frame=0; - xmp_frame_t shva_prev,shva; - - shva_prev=dae_played_frame(xp_core->video); - final_frame = dae_played_eof(xp_core->video); - if(xp_core->video->eof && final_frame) return 1; - - can_blit=dae_try_inc_played(xp_core->video); /* <-- TRY SWITCH TO NEXT FRAME */ - shva=dae_next_played_frame(xp_core->video); - v_pts = shva.v_pts; - /*------------------------ frame decoded. --------------------*/ -/* blit frame */ - - if(xp_core->video->eof) can_blit=1; /* force blitting until end of stream will be reached */ - vplayer_check_chapter_change(&shva_prev,v_pts); -#if 0 -MSG_INFO("xp_core->initial_apts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" -,xp_core->initial_apts -,xp_core->audio->eof -,sh_audio && !xp_core->audio->eof?d_audio->pts+(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps:0 -,sh_audio && !xp_core->audio->eof?sh_audio->timer-ao_get_delay(ao_data):0 -,shva.v_pts -,shva.stream_pts -,shva.duration); -#endif - /*--------- add OSD to the next frame contents ---------*/ - if(can_blit) { -#ifdef USE_OSD - MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); - MP_UNIT("draw_osd"); - update_osd(shva.v_pts); - vo_draw_osd(vo_data,dae_next_played(xp_core->video)); -#endif - } - MP_UNIT("change_frame2"); - /* don't flip if there is nothing new to display */ - if(!can_blit) { - static int drop_message=0; - if(!drop_message && xp_core->video->num_slow_frames > 50) { - drop_message=1; - if(priv->mpxp_after_seek) priv->mpxp_after_seek--; - else MSG_WARN(MSGTR_SystemTooSlow); - } - MSG_D("\ndec_ahead_main: stalling: %i %i\n",dae_cuurr_vplayed(),dae_curr_decoded()); - /* Don't burn CPU here! With using of v_pts for A-V sync we will enter - xp_decore_video without any delay (like while(1);) - Sleeping for 10 ms doesn't matter with frame dropping */ - usleep(0); - } else { - unsigned int t2=GetTimer(); - double tt; - unsigned player_idx; - - /* It's time to sleep ;)...*/ - MP_UNIT("sleep"); - GetRelativeTime(); /* reset timer */ - sleep_time=vplayer_compute_sleep_time(&shva_prev,v_pts); - if(mp_conf.benchmark && sleep_time < 0 && sleep_time < priv->max_av_resync) priv->max_av_resync=sleep_time; - if(!(vo_data->flags&256)){ /* flag 256 means: libvo driver does its timing (dvb card) */ - if(!vplayer_do_sleep(rtc_fd,sleep_time)) return 0; - } - - player_idx=dae_next_played(xp_core->video); - vo_select_frame(vo_data,player_idx); - dae_inc_played(xp_core->video); - MSG_D("\ndec_ahead_main: schedule %u on screen\n",player_idx); - t2=GetTimer()-t2; - tt = t2*0.000001f; - mp_data->bench->vout+=tt; - if(mp_conf.benchmark) { - /* we need compute draw_slice+change_frame here */ - mp_data->bench->cur_vout+=tt; - if((mp_data->bench->cur_video+mp_data->bench->cur_vout+mp_data->bench->cur_audio)*sh_video->fps > 1) - priv->bench_dropped_frames ++; - } - } - MP_UNIT(NULL); - -/*================ A-V TIMESTAMP CORRECTION: =========================*/ - /* FIXME: this block was added to fix A-V resync caused by some strange things - like playing 48KHz audio on 44.1KHz soundcard and other. - Now we know PTS of every audio frame so don't need to have it */ - if(!xp_core->audio) sh_audio=NULL; - if(sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data)) && !mp_conf.av_sync_pts) { - float a_pts=0; - - // unplayed bytes in our and soundcard/dma buffer: - float delay=ao_get_delay(ao_data)+(float)sh_audio->a_buffer_len/(float)sh_audio->af_bps; - if(mp_conf.xp>=XP_VideoAudio) - delay += get_delay_audio_buffer(); - - if(pts_from_bps){ - unsigned int samples=(sh_audio->audio.dwSampleSize)? - ((ds_tell(d_audio)-sh_audio->a_in_buffer_len)/sh_audio->audio.dwSampleSize) : - (d_audio->pack_no); // <- used for VBR audio - samples+=sh_audio->audio.dwStart; // offset - a_pts=samples*(float)sh_audio->audio.dwScale/(float)sh_audio->audio.dwRate; - delay_corrected=1; - } else { - // PTS = (last timestamp) + (bytes after last timestamp)/(bytes per sec) - a_pts=d_audio->pts; - if(!delay_corrected) if(a_pts) delay_corrected=1; - a_pts+=(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - } - - MSG_DBG2("### A:%8.3f (%8.3f) V:%8.3f A-V:%7.4f \n",a_pts,a_pts-delay,v_pts,(a_pts-delay)-*v_pts); - - if(delay_corrected && can_blit){ - float AV_delay=0; /* average of A-V timestamp differences */ - float x; - AV_delay=(a_pts-delay)-v_pts; - x=AV_delay*0.1f; - if(x<-max_pts_correction) x=-max_pts_correction; - else if(x> max_pts_correction) x= max_pts_correction; - max_pts_correction=shva.duration*0.10; // +-10% of time - if(mp_conf.xp>=XP_VAPlay) - pthread_mutex_lock(&audio_timer_mutex); - sh_audio->timer+=x; - if(mp_conf.xp>=XP_VAPlay) - pthread_mutex_unlock(&audio_timer_mutex); - priv->c_total+=x; - if(mp_conf.benchmark && mp_conf.verbose) __show_status_line(a_pts,v_pts,delay,AV_delay); - } - } else { - // No audio or pts: - if(mp_conf.benchmark && mp_conf.verbose) show_status_line_no_apts(v_pts); - } - return 0; -} - void mpxp_seek( osd_args_t *osd,const seek_args_t* seek) { priv_t*priv=mp_data->priv; @@ -1419,7 +1143,7 @@ xp_core->audio->eof=0; if(seek->secs || seek->flags&DEMUX_SEEK_SET) { seek_rval=demux_seek_r(priv->demuxer,seek); - priv->mpxp_after_seek=25; /* 1 sec delay */ + mp_data->mpxp_after_seek=25; /* 1 sec delay */ } if(seek_rval){ mp_data->seek_time = GetTimerMS(); @@ -1466,7 +1190,6 @@ } #endif if(sh_video) { - priv->c_total=0; max_pts_correction=0.1; if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; // to rewert to PLAY pointer after 1 sec mp_data->bench->audio=0; mp_data->bench->audio_decode=0; mp_data->bench->video=0; mp_data->bench->vout=0; @@ -1510,7 +1233,6 @@ mp_data->bench->min_audio_decode=HUGE; mp_data->bench->max_audio_decode=0; - priv->bench_dropped_frames=0; mp_data->bench->max_demux=0; mp_data->bench->demux=0; @@ -1519,8 +1241,6 @@ mp_data->bench->cur_video=0; mp_data->bench->cur_vout=0; mp_data->bench->cur_audio=0; - - priv->max_av_resync=0; } static void show_benchmark(void) @@ -1546,7 +1266,6 @@ unsigned nframes=xp_core->video->num_played_frames; MSG_INFO("\nREAL RESULTS: from %u was dropped=%u\n" ,nframes,xp_core->video->num_dropped_frames); - MSG_INFO("\nMax. A-V resync is: %f\n",fabs(priv->max_av_resync)); } static void show_benchmark_status(void) @@ -2401,7 +2120,6 @@ // movie info: int eof=0; osd_args_t osd = { 100, 9 }; - int rtc_fd=-1; int forced_subs_only=0; seek_args_t seek_args = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; @@ -2719,9 +2437,9 @@ } /* Init timers and benchmarking */ - rtc_fd=InitTimer(); - if(!mp_conf.nortc && rtc_fd>0) { close(rtc_fd); rtc_fd=-1; } - MSG_V("Using %s timing\n",rtc_fd>0?"rtc":mp_conf.softsleep?"software":"usleep()"); + mp_data->rtc_fd=InitTimer(); + if(!mp_conf.nortc && mp_data->rtc_fd>0) { close(mp_data->rtc_fd); mp_data->rtc_fd=-1; } + MSG_V("Using %s timing\n",mp_data->rtc_fd>0?"rtc":mp_conf.softsleep?"software":"usleep()"); mp_data->bench->total_start=GetTimer(); mp_data->bench->audio=0; mp_data->bench->audio_decode=0; mp_data->bench->video=0; @@ -2786,7 +2504,9 @@ usleep(0); } else { repaint: - l_eof = mpxp_play_video(rtc_fd); + usleep(100000); + l_eof = dae_played_eof(xp_core->video); + //mpxp_play_video(rtc_fd); eof |= l_eof; if(eof) goto do_loop; } Modified: mplayerxp/mplayer.h =================================================================== --- mplayerxp/mplayer.h 2012-11-02 15:05:24 UTC (rev 283) +++ mplayerxp/mplayer.h 2012-11-02 16:03:16 UTC (rev 284) @@ -98,8 +98,10 @@ /* non-configurable through command line stuff */ typedef struct mp_data_s { + int rtc_fd; int seek_time; int output_quality; + unsigned mpxp_after_seek; int use_pts_fix2; unsigned mplayer_accel; any_t* subtitles; @@ -110,7 +112,11 @@ }mp_data_t; extern mp_data_t* mp_data; +extern void update_osd( float v_pts ); +extern float get_delay_audio_buffer(void); +extern pthread_mutex_t audio_timer_mutex; + extern void exit_player(char* how); extern void mpxp_resync_audio_stream(void); extern void mpxp_reset_vcache(void); Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-11-02 15:05:24 UTC (rev 283) +++ mplayerxp/xmp_core.c 2012-11-02 16:03:16 UTC (rev 284) @@ -20,6 +20,8 @@ #include "mp_msg.h" #include "xmp_core.h" +#include "xmp_vplayer.h" + #include "mplayer.h" #include "libao2/audio_out.h" #include "libvo/video_out.h" @@ -689,6 +691,10 @@ if((rc=xmp_register_thread(xp_core->audio,sig_audio_play,audio_play_routine,"audio player"))==UINT_MAX) return rc; while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } + if( xp_core->video ) { + if((rc=xmp_register_thread(xp_core->video,sig_video_play,xmp_video_player,"video player"))==UINT_MAX) return rc; + while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); + } return 0; } Added: mplayerxp/xmp_vplayer.c =================================================================== --- mplayerxp/xmp_vplayer.c (rev 0) +++ mplayerxp/xmp_vplayer.c 2012-11-02 16:03:16 UTC (rev 284) @@ -0,0 +1,321 @@ +#include "mplayer.h" +#include "xmp_vplayer.h" +#include "xmp_core.h" +#include "help_mp.h" +#include "mp_msg.h" +#include "sig_hand.h" + +#include "libao2/audio_out.h" +#include "libvo/video_out.h" +#include "osdep/timer.h" +#include "libmpdemux/demuxer.h" + +#include <stdio.h> +#include <unistd.h> // for usleep() +#include <math.h> + +#ifdef ENABLE_DEC_AHEAD_DEBUG +#define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) +#else +#define MSG_T(args...) +#endif + +extern ao_data_t* ao_data; +extern vo_data_t* vo_data; + +static void __show_status_line(float a_pts,float v_pts,float delay,float AV_delay) { + MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d [frms: [%i]]\n", + a_pts-delay,v_pts,AV_delay + ,xp_core->video->num_played_frames,xp_core->video->num_decoded_frames + ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 + ,mp_data->output_quality + ,dae_curr_vplayed(xp_core) + ); + fflush(stdout); +} + +static void show_status_line_no_apts(sh_audio_t* sh_audio,float v_pts) { + if(mp_conf.av_sync_pts && sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data))) { + float a_pts = sh_audio->timer-ao_get_delay(ao_data); + MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d\r" + ,a_pts + ,v_pts + ,a_pts-v_pts + ,0.0 + ,xp_core->video->num_played_frames,xp_core->video->num_decoded_frames + ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 + ,mp_data->output_quality + ); + } else + MSG_STATUS("V:%6.1f %3d %2d%% %2d%% %4.1f%% %d\r" + ,v_pts + ,xp_core->video->num_played_frames + ,(v_pts>0.5)?(int)(100.0*mp_data->bench->video/(double)v_pts):0 + ,(v_pts>0.5)?(int)(100.0*mp_data->bench->vout/(double)v_pts):0 + ,(v_pts>0.5)?(100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)v_pts):0 + ,mp_data->output_quality + ); + fflush(stdout); +} + +static void vplayer_check_chapter_change(sh_audio_t* sh_audio,sh_video_t* sh_video,xmp_frame_t* shva_prev,float v_pts) +{ + if(mp_data->use_pts_fix2 && sh_audio) { + if(sh_video->chapter_change == -1) { /* First frame after seek */ + while(v_pts < 1.0 && sh_audio->timer==0.0 && ao_get_delay(ao_data)==0.0) + usleep(0); /* Wait for audio to start play */ + if(sh_audio->timer > 2.0 && v_pts < 1.0) { + MSG_V("Video chapter change detected\n"); + sh_video->chapter_change=1; + } else { + sh_video->chapter_change=0; + } + } else if(v_pts < 1.0 && shva_prev->v_pts > 2.0) { + MSG_V("Video chapter change detected\n"); + sh_video->chapter_change=1; + } + if(sh_video->chapter_change && sh_audio->chapter_change) { + MSG_V("Reset chapter change\n"); + sh_video->chapter_change=0; + sh_audio->chapter_change=0; + } + } +} + +static float vplayer_compute_sleep_time(sh_audio_t* sh_audio,sh_video_t* sh_video,xmp_frame_t* shva_prev,float screen_pts) +{ + float sleep_time=0; + if(sh_audio && xp_core->audio) { + /* FIXME!!! need the same technique to detect xp_core->audio->eof as for video_eof! + often ao_get_delay() never returns 0 :( */ + if(xp_core->audio->eof && !get_delay_audio_buffer()) goto nosound_model; + if((!xp_core->audio->eof || ao_get_delay(ao_data)) && + (!mp_data->use_pts_fix2 || (!sh_audio->chapter_change && !sh_video->chapter_change))) + sleep_time=screen_pts-((sh_audio->timer-ao_get_delay(ao_data)) + +(mp_conf.av_sync_pts?0:xp_core->initial_apts)); + else if(mp_data->use_pts_fix2 && sh_audio->chapter_change) + sleep_time=0; + else + goto nosound_model; + } else { + nosound_model: + sleep_time=shva_prev->duration/mp_conf.playbackspeed_factor; + } + return sleep_time; +} + +static int vplayer_do_sleep(sh_audio_t* sh_audio,int rtc_fd,float sleep_time) +{ +#define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ +#define XP_MIN_AUDIOBUFF 0.05 +#define XP_MAX_TIMESLICE 0.1 + if(!xp_core->audio) sh_audio=NULL; + if(sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { + float t; + + if( mp_conf.xp < XP_VAPlay ) { + t=ao_get_delay(ao_data)-XP_MIN_AUDIOBUFF; + if(t>XP_MAX_TIMESLICE) + t=XP_MAX_TIMESLICE; + } else + t = XP_MAX_TIMESLICE; + + usleep(t*1000000); + sleep_time-=GetRelativeTime(); + if(mp_conf.xp >= XP_VAPlay || t<XP_MAX_TIMESLICE || sleep_time>XP_MAX_TIMESLICE) { + // exit due no sound in soundcard + return 0; + } + } + + while(sleep_time>XP_MIN_TIMESLICE) { + /* mp_free cpu for threads */ + usleep(1); + sleep_time-=GetRelativeTime(); + } + MP_UNIT("sleep_usleep"); + sleep_time=SleepTime(rtc_fd,mp_conf.softsleep,sleep_time); + return 1; +} + +float max_pts_correction=0; +static int mpxp_play_video(demuxer_t* demuxer,sh_audio_t* sh_audio,sh_video_t*sh_video) +{ + demux_stream_t *d_audio=demuxer->audio; + float v_pts=0; + float sleep_time=0; + int can_blit=0; + int delay_corrected=1; + int final_frame=0; + xmp_frame_t shva_prev,shva; + + shva_prev=dae_played_frame(xp_core->video); + final_frame = dae_played_eof(xp_core->video); + if(xp_core->video->eof && final_frame) return 1; + + can_blit=dae_try_inc_played(xp_core->video); /* <-- TRY SWITCH TO NEXT FRAME */ + shva=dae_next_played_frame(xp_core->video); + v_pts = shva.v_pts; + /*------------------------ frame decoded. --------------------*/ +/* blit frame */ + + if(xp_core->video->eof) can_blit=1; /* force blitting until end of stream will be reached */ + vplayer_check_chapter_change(sh_audio,sh_video,&shva_prev,v_pts); +#if 0 +MSG_INFO("xp_core->initial_apts=%f a_eof=%i a_pts=%f sh_audio->timer=%f v_pts=%f stream_pts=%f duration=%f\n" +,xp_core->initial_apts +,xp_core->audio->eof +,sh_audio && !xp_core->audio->eof?d_audio->pts+(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps:0 +,sh_audio && !xp_core->audio->eof?sh_audio->timer-ao_get_delay(ao_data):0 +,shva.v_pts +,shva.stream_pts +,shva.duration); +#endif + /*--------- add OSD to the next frame contents ---------*/ + if(can_blit) { +#ifdef USE_OSD + MSG_D("dec_ahead_main: draw_osd to %u\n",player_idx); + MP_UNIT("draw_osd"); + update_osd(shva.v_pts); + vo_draw_osd(vo_data,dae_next_played(xp_core->video)); +#endif + } + MP_UNIT("change_frame2"); + /* don't flip if there is nothing new to display */ + if(!can_blit) { + static int drop_message=0; + if(!drop_message && xp_core->video->num_slow_frames > 50) { + drop_message=1; + if(mp_data->mpxp_after_seek) mp_data->mpxp_after_seek--; + else MSG_WARN(MSGTR_SystemTooSlow); + } + MSG_D("\ndec_ahead_main: stalling: %i %i\n",dae_cuurr_vplayed(),dae_curr_decoded()); + /* Don't burn CPU here! With using of v_pts for A-V sync we will enter + xp_decore_video without any delay (like while(1);) + Sleeping for 10 ms doesn't matter with frame dropping */ + usleep(0); + } else { + unsigned int t2=GetTimer(); + double tt; + unsigned player_idx; + + /* It's time to sleep ;)...*/ + MP_UNIT("sleep"); + GetRelativeTime(); /* reset timer */ + sleep_time=vplayer_compute_sleep_time(sh_audio,sh_video,&shva_prev,v_pts); + + if(!(vo_data->flags&256)){ /* flag 256 means: libvo driver does its timing (dvb card) */ + if(!vplayer_do_sleep(sh_audio,mp_data->rtc_fd,sleep_time)) return 0; + } + + player_idx=dae_next_played(xp_core->video); + vo_select_frame(vo_data,player_idx); + dae_inc_played(xp_core->video); + MSG_D("\ndec_ahead_main: schedule %u on screen\n",player_idx); + t2=GetTimer()-t2; + tt = t2*0.000001f; + mp_data->bench->vout+=tt; + if(mp_conf.benchmark) { + /* we need compute draw_slice+change_frame here */ + mp_data->bench->cur_vout+=tt; + } + } + MP_UNIT(NULL); + +/*================ A-V TIMESTAMP CORRECTION: =========================*/ + /* FIXME: this block was added to fix A-V resync caused by some strange things + like playing 48KHz audio on 44.1KHz soundcard and other. + Now we know PTS of every audio frame so don't need to have it */ + if(!xp_core->audio) sh_audio=NULL; + if(sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data)) && !mp_conf.av_sync_pts) { + float a_pts=0; + + // unplayed bytes in our and soundcard/dma buffer: + float delay=ao_get_delay(ao_data)+(float)sh_audio->a_buffer_len/(float)sh_audio->af_bps; + if(mp_conf.xp>=XP_VideoAudio) + delay += get_delay_audio_buffer(); + + if(pts_from_bps){ + unsigned int samples=(sh_audio->audio.dwSampleSize)? + ((ds_tell(d_audio)-sh_audio->a_in_buffer_len)/sh_audio->audio.dwSampleSize) : + (d_audio->pack_no); // <- used for VBR audio + samples+=sh_audio->audio.dwStart; // offset + a_pts=samples*(float)sh_audio->audio.dwScale/(float)sh_audio->audio.dwRate; + delay_corrected=1; + } else { + // PTS = (last timestamp) + (bytes after last timestamp)/(bytes per sec) + a_pts=d_audio->pts; + if(!delay_corrected) if(a_pts) delay_corrected=1; + a_pts+=(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + } + + MSG_DBG2("### A:%8.3f (%8.3f) V:%8.3f A-V:%7.4f \n",a_pts,a_pts-delay,v_pts,(a_pts-delay)-*v_pts); + + if(delay_corrected && can_blit){ + float AV_delay=0; /* average of A-V timestamp differences */ + float x; + AV_delay=(a_pts-delay)-v_pts; + x=AV_delay*0.1f; + if(x<-max_pts_correction) x=-max_pts_correction; + else if(x> max_pts_correction) x= max_pts_correction; + max_pts_correction=shva.duration*0.10; // +-10% of time + if(mp_conf.xp>=XP_VAPlay) + pthread_mutex_lock(&audio_timer_mutex); + sh_audio->timer+=x; + if(mp_conf.xp>=XP_VAPlay) + pthread_mutex_unlock(&audio_timer_mutex); + if(mp_conf.benchmark && mp_conf.verbose) __show_status_line(a_pts,v_pts,delay,AV_delay); + } + } else { + // No audio or pts: + if(mp_conf.benchmark && mp_conf.verbose) show_status_line_no_apts(sh_audio,v_pts); + } + return 0; +} + +any_t* xmp_video_player( any_t* arg ) +{ + mpxp_thread_t* priv=arg; + sh_video_t* sh_video=priv->dae->sh; + demux_stream_t *d_video=sh_video->ds; + demuxer_t *demuxer=d_video->demuxer; + sh_audio_t* sh_audio=demuxer->audio->sh; + + priv->state=Pth_Run; + priv->dae->eof = 0; + if(xp_core->audio) xp_core->audio->eof=0; + MSG_T("\nDEC_AHEAD: entering...\n"); + __MP_UNIT(priv->p_idx,"dec_ahead"); + priv->pid = getpid(); + +while(!priv->dae->eof){ + if(priv->state==Pth_Canceling) break; + if(priv->state==Pth_Sleep) { + priv->state=Pth_ASleep; + while(priv->state==Pth_ASleep) usleep(0); + continue; + } + __MP_UNIT(priv->p_idx,"play video"); + + priv->dae->eof=mpxp_play_video(demuxer,sh_audio,sh_video); +/*------------------------ frame decoded. --------------------*/ +} /* while(!priv->dae->eof)*/ + MSG_T("\nDEC_AHEAD: leaving...\n"); + priv->state=Pth_Stand; + return arg; /* terminate thread here !!! */ +} + +void sig_video_play( void ) +{ + MSG_T("sig_audio_play\n"); + mp_msg_flush(); + + dec_ahead_can_aseek=1; + + xmp_killall_threads(pthread_self()); + __exit_sighandler(); +} Property changes on: mplayerxp/xmp_vplayer.c ___________________________________________________________________ Added: svn:eol-style + native Added: mplayerxp/xmp_vplayer.h =================================================================== --- mplayerxp/xmp_vplayer.h (rev 0) +++ mplayerxp/xmp_vplayer.h 2012-11-02 16:03:16 UTC (rev 284) @@ -0,0 +1,8 @@ +#ifndef XMP_VPLAYER_H_INCLUDED +#define XMP_VPLAYER_H_INCLUDED 1 + +extern float max_pts_correction; + +extern any_t* xmp_video_player( any_t* arg ); +extern void sig_video_play( void ); +#endif Property changes on: mplayerxp/xmp_vplayer.h ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-11-02 17:31:38
|
Revision: 286 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=286&view=rev Author: nickols_k Date: 2012-11-02 17:31:28 +0000 (Fri, 02 Nov 2012) Log Message: ----------- move xmpcore into separate subfolder Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libao2/ao_wav.c mplayerxp/libao2/audio_out.h mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd.h mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpsub/spudec.c mplayerxp/libvo/sub.c mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/mplayer.c mplayerxp/postproc/af.h mplayerxp/postproc/mpc_info.h mplayerxp/postproc/vf.c mplayerxp/postproc/vf.h mplayerxp/sig_hand.c mplayerxp/sig_hand.h Added Paths: ----------- mplayerxp/xmpcore/ mplayerxp/xmpcore/Makefile mplayerxp/xmpcore/xmp_adecoder.c mplayerxp/xmpcore/xmp_adecoder.h mplayerxp/xmpcore/xmp_aplayer.c mplayerxp/xmpcore/xmp_aplayer.h mplayerxp/xmpcore/xmp_core.c mplayerxp/xmpcore/xmp_core.h mplayerxp/xmpcore/xmp_enums.h mplayerxp/xmpcore/xmp_vdecoder.c mplayerxp/xmpcore/xmp_vdecoder.h mplayerxp/xmpcore/xmp_vplayer.c mplayerxp/xmpcore/xmp_vplayer.h Removed Paths: ------------- mplayerxp/xmp_adecoder.c mplayerxp/xmp_adecoder.h mplayerxp/xmp_aplayer.c mplayerxp/xmp_aplayer.h mplayerxp/xmp_core.c mplayerxp/xmp_core.h mplayerxp/xmp_enums.h mplayerxp/xmp_vdecoder.c mplayerxp/xmp_vdecoder.h mplayerxp/xmp_vplayer.c mplayerxp/xmp_vplayer.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/Makefile 2012-11-02 17:31:28 UTC (rev 286) @@ -13,7 +13,7 @@ PRG_FIBMAP = fibmap_mplayerxp PRG_CFG = codec-cfg-xp # these subdirectories required installation due binaries within them -SUBDIRS = libmpdemux libmpsub libplaytree libmpcodecs libmpconf libao2 osdep postproc input nls libvo +SUBDIRS = libmpdemux libmpsub libplaytree libmpcodecs libmpconf libao2 osdep postproc input nls libvo xmpcore ifeq ($(TARGET_ARCH_X86),yes) SUBDIRS+=loader endif @@ -25,7 +25,6 @@ SRCS_COMMON = mp_msg.c mp_image.c SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c -SRCS_MPLAYER+= xmp_core.c xmp_aplayer.c xmp_vplayer.c xmp_vdecoder.c xmp_adecoder.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) @@ -45,7 +44,8 @@ libvo/libvo.a \ osdep/libosdep.a \ nls/libnls.a \ - libmpconf/libmpconf.a + libmpconf/libmpconf.a \ + xmpcore/libxmpcore.a ifeq ($(TARGET_ARCH_X86),yes) MP_LIBS += loader/libloader.a endif Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libao2/ao_wav.c 2012-11-02 17:31:28 UTC (rev 286) @@ -23,7 +23,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "osdep/bswap.h" #include "postproc/af_format.h" Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libao2/audio_out.h 2012-11-02 17:31:28 UTC (rev 286) @@ -1,7 +1,7 @@ #ifndef __AUDIO_OUT_H #define __AUDIO_OUT_H 1 #include "mp_config.h" -#include "xmp_enums.h" +#include "xmpcore/xmp_enums.h" /** Text description of AO-driver */ typedef struct ao_info_s { Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libmpcodecs/ad.h 2012-11-02 17:31:28 UTC (rev 286) @@ -5,7 +5,7 @@ #define AD_H_INCLUDED 1 #include "libmpconf/cfgparser.h" -#include "xmp_enums.h" +#include "xmpcore/xmp_enums.h" typedef struct ad_info_s { Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-11-02 17:31:28 UTC (rev 286) @@ -6,7 +6,7 @@ #include "help_mp.h" #include "mplayer.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "libmpdemux/stream.h" #include "libmpdemux/demuxer.h" Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libmpcodecs/dec_video.c 2012-11-02 17:31:28 UTC (rev 286) @@ -27,7 +27,7 @@ #include "vd.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "dec_video.h" #include "libmpsub/spudec.h" #include "libmpsub/vobsub.h" Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libmpcodecs/vd.c 2012-11-02 17:31:28 UTC (rev 286) @@ -5,7 +5,7 @@ #include "mp_config.h" #include "help_mp.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "libmpconf/codec-cfg.h" #include "libvo/img_format.h" Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libmpcodecs/vd.h 2012-11-02 17:31:28 UTC (rev 286) @@ -2,7 +2,7 @@ #define VD_H_INCLUDED 1 #include "libmpconf/cfgparser.h" -#include "xmp_enums.h" +#include "xmpcore/xmp_enums.h" typedef struct vd_info_s { Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-11-02 17:31:28 UTC (rev 286) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "mplayer.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #ifdef HAVE_GOMP #include <omp.h> #endif Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-11-02 17:31:28 UTC (rev 286) @@ -11,7 +11,7 @@ #include "osdep/timer.h" #include "mplayer.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "demux_msg.h" pthread_mutex_t demuxer_mutex=PTHREAD_MUTEX_INITIALIZER; Modified: mplayerxp/libmpsub/spudec.c =================================================================== --- mplayerxp/libmpsub/spudec.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libmpsub/spudec.c 2012-11-02 17:31:28 UTC (rev 286) @@ -21,7 +21,7 @@ #include <unistd.h> #include <math.h> -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "spudec.h" #include "postproc/swscale.h" #include "osdep/mplib.h" Modified: mplayerxp/libvo/sub.c =================================================================== --- mplayerxp/libvo/sub.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libvo/sub.c 2012-11-02 17:31:28 UTC (rev 286) @@ -5,7 +5,7 @@ #include <string.h> #include "mplayer.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "video_out.h" #include "font_load.h" #include "sub.h" Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libvo/video_out.c 2012-11-02 17:31:28 UTC (rev 286) @@ -32,7 +32,7 @@ #include "osdep/shmem.h" #include "postproc/swscale.h" #include "postproc/vf.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "osdep/mplib.h" #include "mplayer.h" #include "osdep/fastmemcpy.h" Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libvo/video_out.h 2012-11-02 17:31:28 UTC (rev 286) @@ -21,7 +21,7 @@ #include "libmpsub/subreader.h" #include "img_format.h" #include "mp_image.h" -#include "xmp_enums.h" +#include "xmpcore/xmp_enums.h" enum { VO_EVENT_EXPOSE=1, Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libvo/vo_opengl.c 2012-11-02 17:31:28 UTC (rev 286) @@ -25,7 +25,7 @@ #include "mp_config.h" #include "mplayer.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "dri_vo.h" #include "video_out.h" Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libvo/vo_sdl.c 2012-11-02 17:31:28 UTC (rev 286) @@ -109,7 +109,7 @@ #include "mp_config.h" #include "mplayer.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "video_out.h" Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libvo/vo_x11.c 2012-11-02 17:31:28 UTC (rev 286) @@ -28,7 +28,7 @@ #include "mp_config.h" #include "mplayer.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "aspect.h" #include "video_out.h" Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libvo/vo_xv.c 2012-11-02 17:31:28 UTC (rev 286) @@ -18,7 +18,7 @@ #include "mp_config.h" #include "mplayer.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "osdep/mplib.h" #include "video_out.h" #include "video_out_internal.h" Modified: mplayerxp/libvo/vo_xvidix.c =================================================================== --- mplayerxp/libvo/vo_xvidix.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/libvo/vo_xvidix.c 2012-11-02 17:31:28 UTC (rev 286) @@ -17,7 +17,7 @@ #include "mp_config.h" #include "mplayer.h" #include "osdep/mplib.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "video_out.h" #include "video_out_internal.h" Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/mplayer.c 2012-11-02 17:31:28 UTC (rev 286) @@ -72,9 +72,9 @@ #include "postproc/libmenu/menu.h" #include "mixer.h" -#include "xmp_core.h" -#include "xmp_vplayer.h" -#include "xmp_adecoder.h" +#include "xmpcore/xmp_core.h" +#include "xmpcore/xmp_vplayer.h" +#include "xmpcore/xmp_adecoder.h" #define MSGT_CLASS MSGT_CPLAYER #include "mp_msg.h" Modified: mplayerxp/postproc/af.h =================================================================== --- mplayerxp/postproc/af.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/postproc/af.h 2012-11-02 17:31:28 UTC (rev 286) @@ -4,10 +4,10 @@ #include <stdio.h> #include "af_mp.h" -#include "../mp_config.h" +#include "mp_config.h" #include "af_control.h" #include "af_format.h" -#include "xmp_enums.h" +#include "xmpcore/xmp_enums.h" struct af_instance_s; Modified: mplayerxp/postproc/mpc_info.h =================================================================== --- mplayerxp/postproc/mpc_info.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/postproc/mpc_info.h 2012-11-02 17:31:28 UTC (rev 286) @@ -1,6 +1,5 @@ #ifndef MP_CODEC_INFO_T #define MP_CODEC_INFO_T -#include "xmp_enums.h" typedef struct mp_codec_info_s { Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/postproc/vf.c 2012-11-02 17:31:28 UTC (rev 286) @@ -3,7 +3,7 @@ #include <string.h> #include "mp_config.h" -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "mplayer.h" #include "help_mp.h" Modified: mplayerxp/postproc/vf.h =================================================================== --- mplayerxp/postproc/vf.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/postproc/vf.h 2012-11-02 17:31:28 UTC (rev 286) @@ -1,6 +1,6 @@ #ifndef __VF_H #define __VF_H 1 -#include "xmp_enums.h" +#include "xmpcore/xmp_enums.h" #include "libmpdemux/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" Modified: mplayerxp/sig_hand.c =================================================================== --- mplayerxp/sig_hand.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/sig_hand.c 2012-11-02 17:31:28 UTC (rev 286) @@ -15,7 +15,7 @@ #include <sys/types.h> #include <unistd.h> #include <stdlib.h> -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" #include "mp_msg.h" #include "osdep/mplib.h" #define MSGT_CLASS MSGT_CPLAYER Modified: mplayerxp/sig_hand.h =================================================================== --- mplayerxp/sig_hand.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/sig_hand.h 2012-11-02 17:31:28 UTC (rev 286) @@ -5,7 +5,7 @@ #define __SIG_HAND_H 1 #include <sys/types.h> -#include "xmp_core.h" +#include "xmpcore/xmp_core.h" static inline void __MP_UNIT(unsigned id,const char *name) { xp_core->mpxp_threads[id]->unit=name; } static inline void MP_UNIT(const char *name) { xp_core->mpxp_threads[main_id]->unit=name; } Deleted: mplayerxp/xmp_adecoder.c =================================================================== --- mplayerxp/xmp_adecoder.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/xmp_adecoder.c 2012-11-02 17:31:28 UTC (rev 286) @@ -1,520 +0,0 @@ -#include "mplayer.h" -#include "mp_msg.h" -#include "sig_hand.h" -#include "xmp_core.h" -#include "xmp_adecoder.h" -#include "osdep/mplib.h" -#include "osdep/timer.h" -#include "libmpcodecs/dec_audio.h" - -#include <errno.h> -#include <stdio.h> -#include <unistd.h> // for usleep() -#include <math.h> - -#ifdef ENABLE_DEC_AHEAD_DEBUG -#define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) -#else -#define MSG_T(args...) -#endif - -extern int get_free_audio_buffer(void); - -/************************************************************************ - AUDIO XP-CORE! ToDo: rewrite it in packet-mode -************************************************************************/ -/* XP audio buffer */ -pthread_mutex_t audio_timer_mutex=PTHREAD_MUTEX_INITIALIZER; -typedef struct audio_buffer_index_s { - float pts; - int index; -} audio_buffer_index_t; - -typedef struct audio_buffer_s { - unsigned char* buffer; - int head; - int tail; - unsigned len; - unsigned size; - int min_reserv; - int min_len; - int eof; - int HasReset; - int blocked_readers; - pthread_mutex_t head_mutex; - pthread_mutex_t tail_mutex; - pthread_cond_t wait_buffer_cond; - sh_audio_t *sh_audio; - - audio_buffer_index_t *indices; - int index_head; - int index_tail; - int index_len; -} audio_buffer_t; - -audio_buffer_t audio_buffer; - -int init_audio_buffer( int size, int min_reserv, int indices, sh_audio_t *sha ) -{ - MSG_V("Using audio buffer %i bytes (min reserve = %i, indices %i)\n",size,min_reserv, indices); - if( !(audio_buffer.buffer = mp_malloc(size)) ) - return ENOMEM; - if( !(audio_buffer.indices = mp_malloc(indices*sizeof(audio_buffer_index_t))) ) { - mp_free(audio_buffer.buffer); - audio_buffer.buffer=NULL; - return ENOMEM; - } - audio_buffer.index_len=indices; - audio_buffer.index_head=0; - audio_buffer.index_tail=0; - audio_buffer.head = 0; - audio_buffer.tail = 0; - audio_buffer.len = size; - audio_buffer.size = size; - audio_buffer.min_reserv = min_reserv; - audio_buffer.min_len = size/indices+1; - audio_buffer.eof = 0; - audio_buffer.HasReset = 0; - audio_buffer.blocked_readers = 0; - pthread_mutex_init( &audio_buffer.head_mutex, NULL); - pthread_mutex_init( &audio_buffer.tail_mutex, NULL); - pthread_cond_init( &audio_buffer.wait_buffer_cond, NULL); - audio_buffer.sh_audio = sha; - return 0; -} - -void uninit_audio_buffer(void) -{ - audio_buffer.eof = 1; - - if( audio_buffer.blocked_readers > 0 ) { /* Make blocked reader exit */ - int loops = 10; - pthread_cond_broadcast( &audio_buffer.wait_buffer_cond ); - while( audio_buffer.blocked_readers > 0 && loops > 0 ) { - usleep(1); - loops--; - } - if( audio_buffer.blocked_readers > 0 ) - MSG_V("uninit_audio_buffer: %d blocked readers did not wake up\n", - audio_buffer.blocked_readers); - } - - audio_buffer.index_len=0; - audio_buffer.index_head=0; - audio_buffer.index_tail=0; - audio_buffer.head = 0; - audio_buffer.tail = 0; - audio_buffer.len = 0; - audio_buffer.size = 0; - audio_buffer.min_reserv = 0; - audio_buffer.min_len = 0; - audio_buffer.HasReset = 0; - audio_buffer.blocked_readers = 0; - - pthread_mutex_lock( &audio_buffer.head_mutex ); - pthread_mutex_unlock( &audio_buffer.head_mutex ); - pthread_mutex_destroy( &audio_buffer.head_mutex ); - - pthread_mutex_lock( &audio_buffer.tail_mutex ); - pthread_mutex_unlock( &audio_buffer.tail_mutex ); - pthread_mutex_destroy( &audio_buffer.tail_mutex ); - - pthread_cond_destroy( &audio_buffer.wait_buffer_cond ); - - if( audio_buffer.buffer ) - mp_free( audio_buffer.buffer ); - audio_buffer.buffer = NULL; - - if( audio_buffer.indices ) - mp_free( audio_buffer.indices ); - audio_buffer.indices = NULL; - /* audio_buffer.sh_audio = ?; */ -} - -int read_audio_buffer( sh_audio_t *audio, unsigned char *buffer, unsigned minlen, unsigned maxlen, float *pts ) -{ - unsigned len = 0; - int l = 0; - int next_idx; - int head_idx; - int head_pos; - int head; - UNUSED(audio); - pthread_mutex_lock( &audio_buffer.tail_mutex ); - - while( len < minlen ) { - if( audio_buffer.tail == audio_buffer.head ) { - if( audio_buffer.eof ) { - break; - } - audio_buffer.blocked_readers++; - dec_ahead_can_aseek=1; /* Safe to seek while we wait for data */ - pthread_cond_wait(&audio_buffer.wait_buffer_cond, &audio_buffer.tail_mutex ); - dec_ahead_can_aseek=0; - audio_buffer.blocked_readers--; - if( audio_buffer.HasReset ) { - audio_buffer.HasReset = 0; - len = 0; - l =0; - } - continue; - } - - l = min( (int)(maxlen - len), audio_buffer.head - audio_buffer.tail ); - if(l<0) { - l = min( maxlen - len, audio_buffer.len - audio_buffer.tail ); - if( l == 0 ) { - if( audio_buffer.head != audio_buffer.tail ) - audio_buffer.tail = 0; - continue; - } - } - - memcpy( &buffer[len], &audio_buffer.buffer[audio_buffer.tail], l ); - len += l; - audio_buffer.tail += l; - if( audio_buffer.tail >= audio_buffer.len && audio_buffer.tail != audio_buffer.head ) - audio_buffer.tail = 0; - } - - if( len > 0 ) { /* get pts to return and calculate next pts */ - next_idx = (audio_buffer.index_tail+1)%audio_buffer.index_len; - head_idx = audio_buffer.index_head; - head_pos = audio_buffer.indices[(head_idx-1+audio_buffer.index_len)%audio_buffer.index_len].index; - head = audio_buffer.head; - if( next_idx != head_idx && audio_buffer.indices[next_idx].index == audio_buffer.indices[audio_buffer.index_tail].index ) { - audio_buffer.index_tail = next_idx; /* Buffer was empty */ - next_idx = (audio_buffer.index_tail+1)%audio_buffer.index_len; - } - *pts = audio_buffer.indices[audio_buffer.index_tail].pts; - - MSG_DBG3("audio_ahead: len %i, tail %i pts %.3f tail_idx %3i head_idx %3i head_pos %3i\n", len,audio_buffer.tail,*pts, audio_buffer.index_tail, head_idx, head_pos ); - while( next_idx != head_idx && - ((audio_buffer.tail <= head && - (audio_buffer.indices[next_idx].index <= audio_buffer.tail || - head_pos < audio_buffer.indices[next_idx].index)) || - (head < audio_buffer.indices[next_idx].index && - audio_buffer.indices[next_idx].index <= audio_buffer.tail))) { - MSG_DBG3("audio_ahead: next_idx %3i index %3i \n", next_idx, audio_buffer.indices[next_idx].index); - next_idx=(next_idx+1)%audio_buffer.index_len; - } - audio_buffer.index_tail = (next_idx-1+audio_buffer.index_len)%audio_buffer.index_len; - if( audio_buffer.indices[audio_buffer.index_tail].index != audio_buffer.tail ) { - int buff_len = audio_buffer.len; - MSG_DBG3("audio_ahead: orig idx %3i pts %.3f pos %i \n",audio_buffer.index_tail, audio_buffer.indices[audio_buffer.index_tail].pts,audio_buffer.indices[audio_buffer.index_tail].index ); - audio_buffer.indices[audio_buffer.index_tail].pts += (float)((audio_buffer.tail - audio_buffer.indices[audio_buffer.index_tail].index + buff_len) % buff_len) / (float)audio_buffer.sh_audio->af_bps; - audio_buffer.indices[audio_buffer.index_tail].index = audio_buffer.tail; - MSG_DBG3("audio_ahead: read next_idx %3i next_pts %.3f pos %i \n", audio_buffer.index_tail,audio_buffer.indices[audio_buffer.index_tail].pts,audio_buffer.indices[audio_buffer.index_tail].index ); - } - } - - pthread_mutex_unlock( &audio_buffer.tail_mutex ); - - return len; -} - -float get_delay_audio_buffer(void) -{ - int delay = audio_buffer.head - audio_buffer.tail; - if( delay < 0 ) - delay += audio_buffer.len; - return (float)delay / (float)audio_buffer.sh_audio->af_bps; -} - -int decode_audio_buffer(demux_stream_t *d_audio,unsigned len) -{ - int ret, blen, l, l2; - int next_idx; - unsigned int t; - - pthread_mutex_lock( &audio_buffer.head_mutex ); - - t = GetTimer(); - if (len < audio_buffer.sh_audio->audio_out_minsize) - len = audio_buffer.sh_audio->audio_out_minsize; - - if( audio_buffer.size - audio_buffer.head <= audio_buffer.min_reserv ) { - if( audio_buffer.tail == 0 ) { - pthread_mutex_unlock( &audio_buffer.head_mutex ); - return 0; - } - audio_buffer.len = audio_buffer.head; - audio_buffer.head = 0; - len = min( len, audio_buffer.tail - audio_buffer.head - audio_buffer.min_reserv); - if( len < audio_buffer.sh_audio->audio_out_minsize ) { - pthread_mutex_unlock( &audio_buffer.head_mutex ); - return 0; - } - } - - blen = audio_buffer.size - audio_buffer.head; - if( (l = (blen - audio_buffer.min_reserv)) < len ) { - len = max(l,audio_buffer.sh_audio->audio_out_minsize); - } - - if( (l = (audio_buffer.tail - audio_buffer.head)) > 0 ) { - blen = l; - l -= audio_buffer.min_reserv; - if( l < len ) { - len = l; - if( len < audio_buffer.sh_audio->audio_out_minsize ) { - pthread_mutex_unlock( &audio_buffer.head_mutex ); - return 0; - } - } - } - MSG_DBG3("decode audio %d h %d, t %d, l %d \n", len, audio_buffer.head, audio_buffer.tail, audio_buffer.len); - - for( l = 0, l2 = len, ret = 0; l < len && l2 >= audio_buffer.sh_audio->audio_out_minsize; ) { - float pts; - ret = mpca_decode( audio_buffer.sh_audio, &audio_buffer.buffer[audio_buffer.head], audio_buffer.min_len, l2,blen,&pts); - if( ret <= 0 ) - break; - - next_idx = (audio_buffer.index_head+1)%audio_buffer.index_len; - if( next_idx != audio_buffer.index_tail ) { - MSG_DBG3("decode audio idx %3i tail %3i next pts %.3f %i\n",audio_buffer.index_head, audio_buffer.index_tail, pts, audio_buffer.head ); - audio_buffer.indices[audio_buffer.index_head].pts = pts; - audio_buffer.indices[audio_buffer.index_head].index = audio_buffer.head; - audio_buffer.index_head = next_idx; - } - audio_buffer.head+=ret; - MSG_DBG3("new head %6d \n", audio_buffer.head); - l += ret; - l2 -= ret; - blen -= ret; - } - MSG_DBG2("decoded audio %d diff %d\n", l, l - len); - - if( ret <= 0 && d_audio->eof) { - MSG_V("audio eof\n"); - audio_buffer.eof=1; - pthread_mutex_unlock( &audio_buffer.head_mutex ); - pthread_mutex_lock( &audio_buffer.tail_mutex ); - pthread_cond_broadcast( &audio_buffer.wait_buffer_cond ); - pthread_mutex_unlock( &audio_buffer.tail_mutex ); - return 0; - } - - if( audio_buffer.head > audio_buffer.len ) - audio_buffer.len=audio_buffer.head; - if( audio_buffer.head >= audio_buffer.size && audio_buffer.tail > 0 ) - audio_buffer.head = 0; - - pthread_cond_signal( &audio_buffer.wait_buffer_cond ); - - t=GetTimer()-t; - mp_data->bench->audio_decode+=t*0.000001f; - mp_data->bench->audio_decode-=mp_data->bench->audio_decode_correction; - if(mp_conf.benchmark) - { - if(t > mp_data->bench->max_audio_decode) mp_data->bench->max_audio_decode = t; - if(t < mp_data->bench->min_audio_decode) mp_data->bench->min_audio_decode = t; - } - - pthread_mutex_unlock( &audio_buffer.head_mutex ); - - - blen = audio_buffer.head - audio_buffer.tail; - if( blen < 0 ) - blen += audio_buffer.len; - if( blen < MAX_OUTBURST ) { - return 2; - } - return 1; -} - -void reset_audio_buffer(void) -{ - pthread_mutex_lock( &audio_buffer.head_mutex ); - pthread_mutex_lock( &audio_buffer.tail_mutex ); - - audio_buffer.tail = audio_buffer.head; - audio_buffer.len = audio_buffer.size; - audio_buffer.eof = 0; - audio_buffer.HasReset = 1; - audio_buffer.index_tail = audio_buffer.index_head; - - pthread_mutex_unlock( &audio_buffer.tail_mutex ); - pthread_mutex_unlock( &audio_buffer.head_mutex ); -} - -int get_len_audio_buffer(void) -{ - int len = audio_buffer.head - audio_buffer.tail; - if( len < 0 ) - len += audio_buffer.len; - return len; -} - -int get_free_audio_buffer(void) -{ - int len; - - if( audio_buffer.eof ) - return -1; - - if( audio_buffer.size - audio_buffer.head < audio_buffer.min_reserv && - audio_buffer.tail > 0 ) { - pthread_mutex_lock( &audio_buffer.head_mutex ); - audio_buffer.len = audio_buffer.head; - audio_buffer.head = 0; - pthread_mutex_unlock( &audio_buffer.head_mutex ); - } - - len = audio_buffer.tail - audio_buffer.head; - if( len <= 0 ) - len += audio_buffer.size; - len -= audio_buffer.min_reserv; - - if( len <= 0 ) - return 0; - - return len; -} - - -/* Audio stuff */ -volatile float dec_ahead_audio_delay; -int xp_thread_decode_audio(demux_stream_t *d_audio) -{ - sh_audio_t* sh_audio=xp_core->audio->sh; - sh_video_t* sh_video=NULL; - if(xp_core->video) sh_video=xp_core->video->sh; - int free_buf, vbuf_size, pref_buf; - unsigned len=0; - - free_buf = get_free_audio_buffer(); - - if( free_buf == -1 ) { /* End of file */ - xp_core->audio->eof = 1; - return 0; - } - if( free_buf < (int)sh_audio->audio_out_minsize ) /* full */ - return 0; - - len = get_len_audio_buffer(); - - if( len < MAX_OUTBURST ) /* Buffer underrun */ - return decode_audio_buffer(d_audio,MAX_OUTBURST); - - if(xp_core->video) { - /* Match video buffer */ - vbuf_size = dae_get_decoder_outrun(xp_core->video); - pref_buf = vbuf_size / sh_video->fps * sh_audio->af_bps; - pref_buf -= len; - if( pref_buf > 0 ) { - len = min( pref_buf, free_buf ); - if( len > sh_audio->audio_out_minsize ) { - return decode_audio_buffer(d_audio,len); - } - } - } else - return decode_audio_buffer(d_audio,min(free_buf,MAX_OUTBURST)); - - return 0; -} - -static volatile int dec_ahead_can_adseek=1; /* It is safe to seek audio buffer thread */ -/* this routine decodes audio only */ -any_t* a_dec_ahead_routine( any_t* arg ) -{ - mpxp_thread_t* priv=arg; - sh_audio_t* sh_audio=priv->dae->sh; - demux_stream_t *d_audio=sh_audio->ds; - - int ret, retval; - struct timeval now; - struct timespec timeout; - float d; - - priv->state=Pth_Run; - if(xp_core->video) xp_core->video->eof=0; - xp_core->audio->eof=0; - MSG_T("\nDEC_AHEAD: entering...\n"); - priv->pid = getpid(); - __MP_UNIT(priv->p_idx,"dec_ahead"); - - dec_ahead_can_adseek=0; - while(priv->state!=Pth_Canceling) { - if(priv->state==Pth_Sleep) { - priv->state=Pth_ASleep; - while(priv->state==Pth_ASleep) usleep(0); - continue; - } - __MP_UNIT(priv->p_idx,"decode audio"); - while((ret = xp_thread_decode_audio(d_audio)) == 2) {/* Almost empty buffer */ - if(xp_core->audio->eof) break; - } - dec_ahead_can_adseek=1; - - if(priv->state==Pth_Canceling) break; - - __MP_UNIT(priv->p_idx,"sleep"); - LOCK_AUDIO_DECODE(); - if(priv->state!=Pth_Canceling) { - if(xp_core->audio->eof) { - __MP_UNIT(priv->p_idx,"wait end of work"); - pthread_cond_wait( &audio_decode_cond, &audio_decode_mutex ); - } else if(ret==0) { /* Full buffer or end of file */ - if(audio_play_in_sleep) { /* Sleep a little longer than player thread */ - timeout.tv_nsec = audio_play_timeout.tv_nsec + 10000; - if( timeout.tv_nsec > 1000000000l ) { - timeout.tv_nsec-=1000000000l; - timeout.tv_sec = audio_play_timeout.tv_sec; - } else - timeout.tv_sec = audio_play_timeout.tv_sec; - } else { - if(xp_core->in_pause) - d = 1.0; - else - d = 0.1; - gettimeofday(&now,NULL); - timeout.tv_nsec = now.tv_usec * 1000 + d*1000000000l; - if( timeout.tv_nsec > 1000000000l ) { - timeout.tv_nsec-=1000000000l; - timeout.tv_sec = now.tv_sec + 1; - } else - timeout.tv_sec = now.tv_sec; - } - pthread_cond_timedwait( &audio_decode_cond, &audio_decode_mutex, &timeout ); - } else - usleep(1); - } - UNLOCK_AUDIO_DECODE(); - - if(priv->state==Pth_Canceling) break; - - __MP_UNIT(priv->p_idx,"seek"); - LOCK_AUDIO_DECODE(); -#if 0 - while(priv->state==Pth_Sleep && priv->state!=Pth_Canceling) { - gettimeofday(&now,NULL); - timeout.tv_nsec = now.tv_usec * 1000; - timeout.tv_sec = now.tv_sec + 1; - retval = pthread_cond_timedwait( &audio_decode_cond, &audio_decode_mutex, &timeout ); - if( retval == ETIMEDOUT ) - MSG_V("Audio decode seek timeout\n"); - } -#endif - dec_ahead_can_adseek = 0; /* Not safe to seek */ - UNLOCK_AUDIO_DECODE(); - } - __MP_UNIT(priv->p_idx,"exit"); - dec_ahead_can_adseek = 1; - priv->state=Pth_Stand; - return arg; /* terminate thread here !!! */ -} - -void sig_audio_decode( void ) -{ - MSG_T("sig_audio_decode\n"); - mp_msg_flush(); - - dec_ahead_can_adseek=1; - - UNLOCK_AUDIO_DECODE(); - - xmp_killall_threads(pthread_self()); - __exit_sighandler(); -} Deleted: mplayerxp/xmp_adecoder.h =================================================================== --- mplayerxp/xmp_adecoder.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/xmp_adecoder.h 2012-11-02 17:31:28 UTC (rev 286) @@ -1,14 +0,0 @@ -#ifndef XMP_ADECODER_H_INCLUDED -#define XMP_ADECODER_H_INCLUDED 1 - -extern int get_len_audio_buffer(void); -extern float get_delay_audio_buffer(void); -extern int init_audio_buffer(int size, int min_reserv, int indices, sh_audio_t *sh_audio); -extern void uninit_audio_buffer(void); -extern void reset_audio_buffer(void); -extern int read_audio_buffer(sh_audio_t *audio, unsigned char *buffer, unsigned minlen, unsigned maxlen, float *pts ); - -extern any_t* a_dec_ahead_routine( any_t* arg ); -extern void sig_audio_decode( void ); -extern int xp_thread_decode_audio(demux_stream_t *d_audio); -#endif Deleted: mplayerxp/xmp_aplayer.c =================================================================== --- mplayerxp/xmp_aplayer.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/xmp_aplayer.c 2012-11-02 17:31:28 UTC (rev 286) @@ -1,297 +0,0 @@ -#include "mplayer.h" -#include "mp_msg.h" -#include "sig_hand.h" -#include "xmp_core.h" -#include "xmp_aplayer.h" -#include "xmp_adecoder.h" -#include "osdep/timer.h" -#include "libmpcodecs/dec_audio.h" - -#include "libao2/audio_out.h" - -#include <stdio.h> -#include <unistd.h> // for usleep() -#include <pthread.h> -#include <math.h> - -#ifdef ENABLE_DEC_AHEAD_DEBUG -#define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) -#else -#define MSG_T(args...) -#endif - -#define MIN_AUDIO_TIME 0.05 -#define NOTHING_PLAYED (-1.0) -#define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ - -extern ao_data_t*ao_data; - -static int decore_audio(demux_stream_t *d_audio,sh_audio_t* sh_audio,sh_video_t*sh_video,unsigned _xp_id ) -{ - int eof = 0; -/*========================== PLAY AUDIO ============================*/ -while(sh_audio){ - unsigned int t; - double tt; - int playsize; - float pts=HUGE; - int ret=0; - - ao_data->pts=sh_audio->timer*90000.0; - playsize=ao_get_space(ao_data); - - if(!playsize) { - if(sh_video) - break; // buffer is full, do not block here!!! - usec_sleep(10000); // Wait a tick before retry - continue; - } - - if(playsize>MAX_OUTBURST) playsize=MAX_OUTBURST; // we shouldn't exceed it! - //if(playsize>outburst) playsize=outburst; - - // Update buffer if needed - MP_UNIT("mpca_decode"); // Enter AUDIO decoder module - t=GetTimer(); - while(sh_audio->a_buffer_len<playsize && !xp_core->audio->eof){ - if(mp_conf.xp>=XP_VideoAudio) { - ret=read_audio_buffer(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], - playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); - } else - { - ret=mpca_decode(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], - playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); - } - if(ret>0) sh_audio->a_buffer_len+=ret; - else { - if(!d_audio->eof) break; - xp_core->audio->eof=1; - break; - } - } - MP_UNIT("play_audio"); // Leave AUDIO decoder module - t=GetTimer()-t; - tt = t*0.000001f; - mp_data->bench->audio+=tt; - if(mp_conf.benchmark) - { - if(tt > mp_data->bench->max_audio) mp_data->bench->max_audio = tt; - if(tt < mp_data->bench->min_audio) mp_data->bench->min_audio = tt; - mp_data->bench->cur_audio=tt; - } - if(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; - - if(mp_conf.xp>=XP_VAPlay) dec_ahead_audio_delay=ao_get_delay(ao_data); - - playsize=ao_play(ao_data,sh_audio->a_buffer,playsize,0); - - if(playsize>0){ - sh_audio->a_buffer_len-=playsize; - memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[playsize],sh_audio->a_buffer_len); - if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) - pthread_mutex_lock(&audio_timer_mutex); - if(mp_data->use_pts_fix2) { - if(sh_audio->a_pts != HUGE) { - sh_audio->a_pts_pos-=playsize; - if(sh_audio->a_pts_pos > -ao_get_delay(ao_data)*sh_audio->af_bps) { - sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - } else { - sh_audio->timer=sh_audio->a_pts-(float)sh_audio->a_pts_pos/(float)sh_audio->af_bps; - MSG_V("Audio chapter change detected\n"); - sh_audio->chapter_change=1; - sh_audio->a_pts = HUGE; - } - } else if(pts != HUGE) { - if(pts < 1.0 && sh_audio->timer > 2.0) { - sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - sh_audio->a_pts=pts; - sh_audio->a_pts_pos=sh_audio->a_buffer_len-ret; - } else { - sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); - sh_audio->a_pts=HUGE; - } - } else - sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - } else if(mp_conf.av_sync_pts && pts!=HUGE) - sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); - else - sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) - pthread_mutex_unlock(&audio_timer_mutex); - } - - break; - } // if(sh_audio) - return eof; -} - - -extern ao_data_t* ao_data; -any_t* audio_play_routine( any_t* arg ) -{ - mpxp_thread_t* priv=arg; - sh_audio_t* sh_audio=priv->dae->sh; - demux_stream_t *d_audio=sh_audio->ds; - demuxer_t *demuxer=d_audio->demuxer; - sh_video_t* sh_video=demuxer->video->sh; - - int eof = 0; - struct timeval now; - struct timespec timeout; - float d; - int retval; - const float MAX_AUDIO_TIME = (float)ao_get_space(ao_data) / sh_audio->af_bps + ao_get_delay(ao_data); - float min_audio_time = MAX_AUDIO_TIME; - float min_audio, max_audio; - int samples, collect_samples; - float audio_buff_max, audio_buff_norm, audio_buff_min, audio_buff_alert; - - audio_buff_alert = max(XP_MIN_TIMESLICE, min(MIN_AUDIO_TIME,MAX_AUDIO_TIME/4)); - audio_buff_max = max(audio_buff_alert, min(MAX_AUDIO_TIME-XP_MIN_TIMESLICE, audio_buff_alert*4)); - audio_buff_min = min(audio_buff_max, audio_buff_alert*2); - audio_buff_norm = (audio_buff_max + audio_buff_min) / 2; - - MSG_DBG2("alert %f, min %f, norm %f, max %f \n", audio_buff_alert, audio_buff_min, audio_buff_norm, audio_buff_max ); - - samples = 5; - collect_samples = 1; - min_audio = MAX_AUDIO_TIME; - max_audio = 0; - - priv->pid = getpid(); - __MP_UNIT(priv->p_idx,"audio_play_routine"); - priv->state=Pth_Run; - dec_ahead_can_aseek=0; - - while(priv->state!=Pth_Canceling) { - if(priv->state==Pth_Sleep) { - priv->state=Pth_ASleep; - while(priv->state==Pth_ASleep) usleep(0); - continue; - } - __MP_UNIT(priv->p_idx,"audio decore_audio"); - dec_ahead_audio_delay = NOTHING_PLAYED; - eof = decore_audio(d_audio,sh_audio,sh_video,priv->p_idx); - - if(priv->state==Pth_Canceling) break; - - __MP_UNIT(priv->p_idx,"audio sleep"); - - dec_ahead_can_aseek = 1; /* Safe for other threads to seek */ - - if( dec_ahead_audio_delay == NOTHING_PLAYED ) { /* To fast, we can sleep longer */ - if( min_audio_time > audio_buff_alert ) { - min_audio_time *= 0.75; - MSG_DBG2("To fast, set min_audio_time %.5f (delay %5f) \n", min_audio_time, dec_ahead_audio_delay ); - } - collect_samples = 1; - samples = 5; - min_audio = MAX_AUDIO_TIME; - max_audio = 0; - } else if( dec_ahead_audio_delay <= audio_buff_alert ) { /* To slow, sleep shorter */ - if ( min_audio_time < MAX_AUDIO_TIME ) { - min_audio_time *= 2.0; - MSG_DBG2("To slow, set min_audio_time %.5f (delay %5f) \n", min_audio_time, dec_ahead_audio_delay ); - } - collect_samples = 1; - samples = 10; - min_audio = MAX_AUDIO_TIME; - max_audio = 0; - } else if( !xp_core->audio->eof && collect_samples) { - if( dec_ahead_audio_delay < min_audio ) - min_audio = dec_ahead_audio_delay; - if( dec_ahead_audio_delay > max_audio ) - max_audio = dec_ahead_audio_delay; - samples--; - - if( samples <= 0 ) { - if( min_audio > audio_buff_max ) { - min_audio_time -= min_audio-audio_buff_norm; - collect_samples = 1; - MSG_DBG2("Decrease min_audio_time %.5f (min %.5f max %.5f) \n", min_audio_time, min_audio, max_audio ); - } else if( max_audio < audio_buff_min ) { - min_audio_time *= 1.25; - collect_samples = 1; - MSG_DBG2("Increase min_audio_time %.5f (min %.5f max %.5f) \n", min_audio_time, min_audio, max_audio ); - } else { - collect_samples = 0; /* No change, stop */ - MSG_DBG2("Stop collecting samples time %.5f (min %.5f max %.5f) \n", min_audio_time, min_audio, max_audio ); - } - if(collect_samples) { - samples = 5; - min_audio = MAX_AUDIO_TIME; - max_audio = 0; - } - } - } - - LOCK_AUDIO_PLAY(); - d = ao_get_delay(ao_data) - min_audio_time; - if( d > 0 ) { - gettimeofday(&now,NULL); - audio_play_timeout.tv_nsec = now.tv_usec * 1000 + d*1000000000l; - if( audio_play_timeout.tv_nsec > 1000000000l ) { - audio_play_timeout.tv_nsec-=1000000000l; - audio_play_timeout.tv_sec = now.tv_sec + 1; - } else - audio_play_timeout.tv_sec = now.tv_sec; - audio_play_in_sleep=1; - pthread_cond_timedwait( &audio_play_cond, &audio_play_mutex, &audio_play_timeout ); - audio_play_in_sleep=0; - } - UNLOCK_AUDIO_PLAY(); - - if(priv->state==Pth_Canceling) break; - - LOCK_AUDIO_PLAY(); - if(eof && priv->state!=Pth_Canceling) { - __MP_UNIT(priv->p_idx,"wait end of work"); - pthread_cond_wait( &audio_play_cond, &audio_play_mutex ); - } - UNLOCK_AUDIO_PLAY(); - - if(priv->state==Pth_Canceling) break; - - __MP_UNIT(priv->p_idx,"audio pause"); - LOCK_AUDIO_PLAY(); - while( xp_core->in_pause && priv->state!=Pth_Canceling) { - pthread_cond_wait( &audio_play_cond, &audio_play_mutex ); - } - UNLOCK_AUDIO_PLAY(); - - if(priv->state==Pth_Canceling) break; - - __MP_UNIT(priv->p_idx,"audio seek"); - LOCK_AUDIO_PLAY(); -#if 0 - while( priv->state==Pth_Sleep && priv->state!=Pth_Canceling) { - gettimeofday(&now,NULL); - timeout.tv_nsec = now.tv_usec * 1000; - timeout.tv_sec = now.tv_sec + 1; - retval = pthread_cond_timedwait( &audio_play_cond, &audio_play_mutex, &timeout ); - if( retval == ETIMEDOUT ) - MSG_V("Audio seek timeout\n"); - } -#endif - dec_ahead_can_aseek = 0; /* Not safe to seek */ - UNLOCK_AUDIO_PLAY(); - } - fflush(stdout); - __MP_UNIT(priv->p_idx,"audio exit"); - dec_ahead_can_aseek=1; - priv->state=Pth_Stand; - return arg; -} - -void sig_audio_play( void ) -{ - MSG_T("sig_audio_play\n"); - mp_msg_flush(); - - dec_ahead_can_aseek=1; - - UNLOCK_AUDIO_PLAY(); - - xmp_killall_threads(pthread_self()); - __exit_sighandler(); -} Deleted: mplayerxp/xmp_aplayer.h =================================================================== --- mplayerxp/xmp_aplayer.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/xmp_aplayer.h 2012-11-02 17:31:28 UTC (rev 286) @@ -1,6 +0,0 @@ -#ifndef XMP_APLAYER_H_INCLUDED -#define XMP_APLAYER_H_INCLUDED 1 - -extern any_t* audio_play_routine( any_t* arg ); -extern void sig_audio_play( void ); -#endif Deleted: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/xmp_core.c 2012-11-02 17:31:28 UTC (rev 286) @@ -1,354 +0,0 @@ -/* - Decoding ahead - Licence: GPL v2 - Author: Nickols_K - Note: Threaded engine to decode frames ahead -*/ - -#include "mp_config.h" -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <errno.h> -#include <signal.h> -#define __USE_ISOC99 1 /* for lrint */ -#include <math.h> -#include <sys/time.h> -#include "osdep/mplib.h" -#define DA_PREFIX "DEC_AHEAD:" -#define MSGT_CLASS MSGT_CPLAYER -#include "mp_msg.h" - -#include "xmp_core.h" -#include "xmp_aplayer.h" -#include "xmp_vplayer.h" -#include "xmp_adecoder.h" -#include "xmp_vdecoder.h" - -#include "mplayer.h" -#include "libao2/audio_out.h" -#include "libvo/video_out.h" - -#include "libmpcodecs/dec_video.h" -#include "libmpcodecs/dec_audio.h" -#include "sig_hand.h" -#include "osdep/timer.h" - -#ifdef ENABLE_DEC_AHEAD_DEBUG -#define MSG_T(args...) mp_msg(MSGT_GLOBAL, MSGL_DBG2,__FILE__,__LINE__, ## args ) -#else -#define MSG_T(args...) -#endif - -void xmp_init(void) { - xp_core=mp_mallocz(sizeof(xp_core_t)); - xp_core->initial_apts=HUGE; -} - -void xmp_uninit(void) { - mp_free(xp_core->mpxp_threads[0]); - mp_free(xp_core); - xp_core=NULL; -} - -unsigned xmp_register_main(sig_handler_t sigfunc) { - unsigned idx=0; - xp_core->mpxp_threads[idx]=mp_mallocz(sizeof(mpxp_thread_t)); - xp_core->mpxp_threads[idx]->p_idx=idx; - xp_core->mpxp_threads[idx]->pid=getpid(); - xp_core->main_pth_id=xp_core->mpxp_threads[idx]->pth_id=pthread_self(); - xp_core->mpxp_threads[idx]->name = "main"; - xp_core->mpxp_threads[idx]->sigfunc = sigfunc; - xp_core->mpxp_threads[idx]->dae = NULL; - xp_core->num_threads++; - - return idx; -} - -static void print_stopped_thread(unsigned idx) { - MSG_OK("*** stop thread: [%i] %s\n",idx,xp_core->mpxp_threads[idx]->name); -} - -void xmp_killall_threads(pthread_t _self) -{ - unsigned i; - for(i=0;i < MAX_MPXP_THREADS;i++) { - if( _self && - xp_core->mpxp_threads[i]->pth_id && - xp_core->mpxp_threads[i]->pth_id != xp_core->main_pth_id) { - pthread_kill(xp_core->mpxp_threads[i]->pth_id,SIGKILL); - print_stopped_thread(i); - mp_free(xp_core->mpxp_threads[i]); - xp_core->mpxp_threads[i]=NULL; - } - } -} - -void dae_reset(dec_ahead_engine_t* it) { - it->player_idx=0; - it->decoder_idx=0; - it->num_slow_frames=0; - it->num_played_frames=0; - it->num_decoded_frames=0; -} - -void dae_init(dec_ahead_engine_t* it,unsigned nframes,any_t* sh) -{ - it->nframes=nframes; - it->frame = mp_malloc(sizeof(xmp_frame_t)*nframes); - it->sh=sh; - dae_reset(it); -} - -void dae_uninit(dec_ahead_engine_t* it) { mp_free(it->frame); it->frame=NULL; } - -/* returns 1 - on success 0 - if busy */ -int dae_try_inc_played(dec_ahead_engine_t* it) { - unsigned new_idx; - new_idx=(it->player_idx+1)%it->nframes; - if(new_idx==it->decoder_idx) { - it->num_slow_frames++; - return 0; - } - it->num_slow_frames=0; - it->num_played_frames++; - return 1; -} - -int dae_inc_played(dec_ahead_engine_t* it) { - unsigned new_idx; - new_idx=(it->player_idx+1)%it->nframes; - if(new_idx==it->decoder_idx) return 0; - if(it->free_priv) (*it->free_priv)(it,it->frame[it->player_idx].priv); - it->player_idx=new_idx; - return 1; -} - -/* returns 1 - on success 0 - if busy */ -int dae_inc_decoded(dec_ahead_engine_t* it) { - unsigned new_idx; - new_idx=(it->decoder_idx+1)%it->nframes; - if(new_idx==it->player_idx) return 0; - it->decoder_idx=new_idx; - if(it->new_priv) it->frame[it->player_idx].priv=(*it->new_priv)(it); - it->num_decoded_frames++; - return 1; -} - -unsigned dae_prev_played(const dec_ahead_engine_t* it) { return (it->player_idx-1)%it->nframes; } -unsigned dae_prev_decoded(const dec_ahead_engine_t* it) { return (it->decoder_idx-1)%it->nframes; } -unsigned dae_next_played(const dec_ahead_engine_t* it) { return (it->player_idx+1)%it->nframes; } -unsigned dae_next_decoded(const dec_ahead_engine_t* it) { return (it->decoder_idx+1)%it->nframes; } - -unsigned dae_get_decoder_outrun(const dec_ahead_engine_t* it) { - unsigned decoder_idx=it->decoder_idx; - if(decoder_idx<it->player_idx) decoder_idx+=it->nframes; - return decoder_idx-it->player_idx; -} - -void dae_wait_decoder_outrun(const dec_ahead_engine_t* it) { - if(it) { - do { - usleep(0); - }while(dae_get_decoder_outrun(it) < xp_core->num_v_buffs/2); - } -} - -xmp_frame_t dae_played_frame(const dec_ahead_engine_t* it) { - unsigned idx=it->player_idx; - return it->frame[idx]; -} -xmp_frame_t dae_decoded_frame(const dec_ahead_engine_t* it) { - unsigned idx=it->decoder_idx; - return it->frame[idx]; -} -xmp_frame_t dae_next_played_frame(const dec_ahead_engine_t* it) { - unsigned idx=dae_next_played(it); - return it->frame[idx]; -} -xmp_frame_t dae_next_decoded_frame(const dec_ahead_engine_t* it) { - unsigned idx=dae_next_decoded(it); - return it->frame[idx]; -} -xmp_frame_t dae_prev_played_frame(const dec_ahead_engine_t* it) { - unsigned idx=dae_prev_played(it); - return it->frame[idx]; -} -xmp_frame_t dae_prev_decoded_frame(const dec_ahead_engine_t* it) { - unsigned idx=dae_prev_decoded(it); - return it->frame[idx]; -} - -int dae_played_eof(const dec_ahead_engine_t* it) { - unsigned idx=it->player_idx; - return (it->frame[idx].v_pts==HUGE_VALF)?1:0; -} - -int dae_decoded_eof(const dec_ahead_engine_t* it) { - unsigned idx=it->decoder_idx; - return (it->frame[idx].v_pts==HUGE_VALF)?1:0; -} - -void dae_decoded_mark_eof(dec_ahead_engine_t* it) { - unsigned idx=it->decoder_idx; - it->frame[idx].v_pts=HUGE_VALF; -} - -pthread_mutex_t audio_play_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t audio_play_cond=PTHREAD_COND_INITIALIZER; - -pthread_mutex_t audio_decode_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t audio_decode_cond=PTHREAD_COND_INITIALIZER; - -volatile int dec_ahead_can_aseek=0; /* It is safe to seek audio */ - -/* To let audio decoder thread sleep as long as player */ -struct timespec audio_play_timeout; -int audio_play_in_sleep=0; - -/* Min audio buffer to keep mp_free, used to tell differ between full and empty buffer */ -#define MIN_BUFFER_RESERV 8 - -int xmp_init_engine(sh_video_t *shv, sh_audio_t *sha) -{ - if(shv) { - xp_core->video=mp_mallocz(sizeof(dec_ahead_engine_t)); - dae_init(xp_core->video,xp_core->num_v_buffs,shv); - } - if(mp_conf.xp>=XP_VideoAudio && sha) { - int asize; - unsigned o_bps; - unsigned min_reserv; - o_bps=sha->afilter_inited?sha->af_bps:sha->o_bps; - if(xp_core->video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_core->num_v_buffs/shv->fps))+MIN_BUFFER_RESERV; - else asize = o_bps*xp_core->num_a_buffs; - /* FIXME: get better indices from asize/real_audio_packet_size */ - min_reserv = sha->audio_out_minsize; - if (o_bps > sha->o_bps) - min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; - init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); - xp_core->audio=mp_mallocz(sizeof(dec_ahead_engine_t)); - dae_init(xp_core->audio,xp_core->num_a_buffs,sha); - } - return 0; -} - -void xmp_uninit_engine( int force ) -{ - xmp_stop_threads(force); - - if(xp_core->video) { - dae_uninit(xp_core->video); - xp_core->video=NULL; - } - - if(xp_core->audio) { /* audio state doesn't matter on segfault :( */ - uninit_audio_buffer(); - xp_core->audio=NULL; - } -} - -unsigned xmp_register_thread(dec_ahead_engine_t* dae,sig_handler_t sigfunc,mpxp_routine_t routine,const char *name) { - unsigned idx=xp_core->num_threads; - int rc; - if(idx>=MAX_MPXP_THREADS) return UINT_MAX; - pthread_attr_t attr; - pthread_attr_init(&attr); - rc=pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); - if(rc) { - MSG_ERR("running thread: attr_setdetachstate fault!!!\n"); - pthread_attr_destroy(&attr); - return rc; - } - pthread_attr_setscope(&attr,PTHREAD_SCOPE_SYSTEM); -#if 0 - /* requires root privelegies */ - pthread_attr_setschedpolicy(&attr,SCHED_FIFO); -#endif - xp_core->mpxp_threads[idx]=mp_mallocz(sizeof(mpxp_thread_t)); - - xp_core->mpxp_threads[idx]->p_idx=idx; - xp_core->mpxp_threads[idx]->name=name; - xp_core->mpxp_threads[idx]->routine=routine; - xp_core->mpxp_threads[idx]->sigfunc=sigfunc; - xp_core->mpxp_threads[idx]->state=Pth_Stand; - xp_core->mpxp_threads[idx]->dae=dae; - - rc=pthread_create(&xp_core->mpxp_threads[idx]->pth_id,&attr,routine,xp_core->mpxp_threads[idx]); - pthread_attr_destroy(&attr); - - xp_core->num_threads++; - return (rc?UINT_MAX:idx); -} - -int xmp_run_decoders( void ) -{ - unsigned rc; - if((xp_core->audio && mp_conf.xp >= XP_VAFull) || !xp_core->video) { - if((rc=xmp_register_thread(xp_core->audio,sig_audio_decode,a_dec_ahead_routine,"audio decoder+af"))==UINT_MAX) return rc; - while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); - } - if(xp_core->video) { - if((rc=xmp_register_thread(xp_core->video,sig_video_decode,xmp_video_decoder,"video+audio decoders+filters"))==UINT_MAX) return rc; - while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); - } - return 0; -} - -int xmp_run_players(void) -{ - unsigned rc; - if( xp_core->audio && mp_conf.xp >= XP_VAPlay ) { - if((rc=xmp_register_thread(xp_core->audio,sig_audio_play,audio_play_routine,"audio player"))==UINT_MAX) return rc; - while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); - } - if( xp_core->video ) { - if((rc=xmp_register_thread(xp_core->video,sig_video_play,xmp_video_player,"video player"))==UINT_MAX) return rc; - while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); - } - return 0; -} - -/* Stops threads before seek */ -void xmp_stop_threads(int force) -{ - unsigned i; - for(i=1;i<xp_core->num_threads;i++) { - if(force) pthread_kill(xp_core->mpxp_threads[i]->pth_id,SIGKILL); - else { - xp_core->mpxp_threads[i]->state=Pth_Canceling; - while(xp_core->mpxp_threads[i]->state==Pth_Canceling) usleep(0); - } - print_stopped_thread(i); - mp_free(xp_core->mpxp_threads[i]); - xp_core->mpxp_threads[i]=NULL; - } -} - -/* Halt threads before seek */ -void xmp_halt_threads(int is_reset_vcache) -{ - unsigned i; - for(i=1;i<xp_core->num_threads;i++) { - xp_core->mpxp_threads[i]->state=Pth_Sleep; - while(xp_core->mpxp_threads[i]->state==Pth_Sleep) usleep(0); - } -} - -/* Restart threads after seek */ -void xmp_restart_threads(int xp_id) -{ - /* reset counters */ - dae_reset(xp_core->video); - /* temporary solution */ - reset_audio_buffer(); - /* Ugly hack: but we should read audio packet before video after seeking. - Else we'll get picture destortion on the screen */ - xp_core->initial_apts=HUGE; - - unsigned i; - for(i=1;i<xp_core->num_threads;i++) { - xp_core->mpxp_threads[i]->state=Pth_Run; - while(xp_core->mpxp_threads[i]->state==Pth_ASleep) usleep(0); - } -} Deleted: mplayerxp/xmp_core.h =================================================================== --- mplayerxp/xmp_core.h 2012-11-02 17:03:04 UTC (rev 285) +++ mplayerxp/xmp_core.h 2012-11-02 17:31:28 UTC (rev 286) @@ -1,184 +0,0 @@ -/* - eXtra performance MPlayer's CORE - Licence: GPL v2 - Note: Threaded engine to decode frames ahead -*/ - -#ifndef __XMP_CORE_H -#define __XMP_CORE_H 1 - -#include <inttypes.h> -#include <pthread.h> -#include "libmpdemux/stream.h" -#include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" -#include "libmpdemux/demuxer_r.h" -#include "libvo/video_out.h" - -//#define ENABLE_DEC_AHEAD_DEBUG 1 - -enum xp_modes { XP_NA=0, XP_Video, XP_VideoAudio, XP_VAPlay, XP_VAFull }; - -typedef struct xmp_frame_s -{ - float v_pts; /* presentation time-stamp from input stream - __huge_valf indicates EOF */ - float duration; /* frame duration */ - any_t* priv; -}xmp_frame_t; - -struct dec_ahead_engine_s; - -typedef any_t* (*func_new_frame_priv_t)(struct dec_ahead_engine_s*); -typedef void (*func_free_frame_priv_t)(struct dec_ahead_engine_s*,any_t*); - -typedef struct dec_ahead_engine_s { - volatile unsigned player_idx; /* index of frame which is currently played */ - volatile unsigned decoder_idx; /* index of frame which is currently decoded */ - unsigned nframes; /* number of frames in buffer */ - xmp_frame_t* frame; /* frame related attributes */ - any_t* sh; /* corresponded sh_audio_t or sh_video_t */ - int eof; /* EOF for stream */ - /* methods */ - func_new_frame_priv_t new_priv; - func_free_frame_priv_t free_priv; - /* for statistics */ - unsigned num_slow_frames;/* number of frames which were delayed due slow computer */ - long long int num_played_frames; - long long int num_decoded_frames; /* for frame dropping */ - long long int num_dropped_frames; -}dec_ahead_engine_t; - -enum { main_id=0 }; -enum { MAX_MPXP_THREADS=16 }; -enum mpxp_thread_state { Pth_Stand=0, Pth_Canceling, Pth_Run, Pth_Sleep, Pth_ASleep }; - -typedef any_t*(*mpxp_routine_t)(any_t*); -typedef void (*sig_handler_t)(void); - -typedef struct mpxp_thread_s { - unsigned p_idx; - const char* name; - const char* unit; - pthread_t pth_id; - pid_t pid; - mpxp_routine_t routine; - sig_handler_t sigfunc; - dec_ahead_engine_t* dae; - volatile enum mpxp_thread_state state; -}mpxp_thread_t; - -typedef struct initial_audio_pts_correction_s -{ - int need_correction; - int pts_bytes; - int nbytes; -}initial_audio_pts_correction_t; - -typedef struct xp_core_s { - dec_ahead_engine_t* video; - dec_ahead_engine_t* audio; - volatile int in_pause; - volatile int in_resize; - /* XMP engine */ - mpxp_thread_t* mpxp_threads[MAX_MPXP_THREADS]; - unsigned num_threads; - pthread_t main_pth_id; - /* doubtful stuff */ - unsigned num_a_buffs; // number of audio buffers - unsigned num_v_buffs; // number of video buffers - int bad_pts; // for MPEGxx codecs - float initial_apts; - initial_audio_pts_correction_t initial_apts_corr; -}xp_core_t; -extern xp_core_t *xp_core; - -extern void xmp_init(void); -extern void xmp_uninit(void); - -/* returns idx of main thread */ -extern unsigned xmp_register_main(sig_handler_t sigfunc); -/* returns idx of the thread or UINT_MAX on fault */ -extern unsigned xmp_register_thread(dec_ahead_engine_t* dae,sig_handler_t sigfunc,mpxp_routine_t routine,const char *name); -extern void xmp_stop_threads(int force); - -extern void xmp_halt_threads(int is_reset_vcache); -extern void xmp_restart_threads(int xp_id); - -extern void xmp_killall_threads(pthread_t _self); - -extern int xmp_init_engine(sh_video_t*stream, sh_audio_t *astream); -extern void xmp_uninit_engine( int force ); -extern int xmp_run_decoders( void ); -extern int xmp_run_players( void ); -extern void xmp_reset_sh_video(sh_video_t* shv); - -extern void dae_init(dec_ahead_engine_t* it,unsigned nframes,any_t* sh); -extern void dae_uninit(dec_ahead_engine_t* it); -extern void dae_reset(dec_ahead_engine_t* it); /* after mpxp_seek */ - -/* returns 1 - on success 0 - if busy */ -extern int dae_try_inc_played(dec_ahead_engine_t* it); -extern int dae_inc_played(dec_ahead_engine_t* it); -extern int dae_inc_decoded(dec_ahead_engine_t* it); - -extern unsigned dae_prev_played(const dec_ahead_engine_t* it); -extern unsigned dae_prev_decoded(const dec_ahead_engine_t* it); -extern unsigned dae_next_played(const dec_ahead_engine_t* it); -extern unsigned dae_next_decoded(const dec_ahead_engine_t* it); -/* returns normalized decoder_idx-player_idx */ -extern unsigned dae_get_decoder_outrun(const dec_ahead_engine_t* it); -extern void dae_wait_decoder_outrun(const dec_ahead_engine_t* it); - -static inline unsigned dae_curr_vplayed(const xp_core_t* xpc) { return xpc->video->player_idx; } -static inline unsigned dae_curr_vdecoded(const xp_core_t* xpc) { return xpc->video->decoder_idx; } -static inline unsigned dae_prev_vplayed(const xp_core_t* xpc) { return dae_prev_played(xpc->video); } -static inline unsigned dae_prev_vdecoded(const xp_core_t* xpc) { return dae_prev_decoded(xpc->video); } -static inline unsigned dae_next_vplayed(const xp_core_t* xpc) { return dae_next_played(xpc->video); } -static inline unsigned dae_next_vdecoded(const xp_core_t* xpc) { return dae_next_decoded(xpc->video); } - -extern xmp_frame_t dae_played_frame(const dec_ahead_engine_t* it); -extern xmp_frame_t dae_decoded_frame(const dec_ahead_engine_t* it); -extern xmp_frame_t dae_next_played_frame(const dec_ahead_engine_t* it); -extern xmp_frame_t dae_next_decoded_frame(const dec_ahead_engine_t* it); -extern xmp_frame_t dae_prev_played_frame(const dec_ahead_engine_t* it); -extern xmp_frame_t dae_prev_decoded_frame(const dec_ahead_engine_t* it); - -extern int dae_played_eof(const dec_ahead_engine_t* it); -extern int dae_decoded_eof(const dec_ahead_engine_t* it); -extern void dae_decoded_mark_eof(dec_ahead_engine_t* it); -extern inline void dae_decoded_clear_eof(dec_ahead_engine_t* it) { UNUSED(it); } - -extern pthread_mutex_t audio_play_mutex; -extern pthread_cond_t audio_play_cond; - -extern pthread_mutex_t audio_decode_mutex; -extern pthread_cond_t audio_decode_cond; - -#ifdef ENABLE_DEC_AHEAD_DEBUG -#include "mp_msg.h" -#ifndef DA_PREFIX -#define DA_PREFIX "dec_ahead:" -#endif -#define MSG_D(args...) { mp_msg(MSGT_GLOBAL, MSGL_V, __FILE__, __LINE__, ## args ); mp_msg_flush(); } -#else -#define MSG_D(args...) -#endif - -#define LOCK_AUDIO_PLAY() { MSG_D(DA_PREFIX"LOCK_AUDIO_PLAY\n"); pthread_mutex_lock(&audio_play_mutex); } -#define ... [truncated message content] |
From: <nic...@us...> - 2012-11-03 14:41:39
|
Revision: 289 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=289&view=rev Author: nickols_k Date: 2012-11-03 14:41:33 +0000 (Sat, 03 Nov 2012) Log Message: ----------- print source lines in backtracer if addr2line is available Modified Paths: -------------- DOCS/mplayerxp.1 mplayerxp/configure mplayerxp/mp_msg.c mplayerxp/mp_msg.h mplayerxp/mplayer.c mplayerxp/osdep/mp_malloc.c mplayerxp/osdep/mplib.h mplayerxp/xmpcore/xmp_core.h Modified: DOCS/mplayerxp.1 =================================================================== --- DOCS/mplayerxp.1 2012-11-03 14:39:31 UTC (rev 288) +++ DOCS/mplayerxp.1 2012-11-03 14:41:33 UTC (rev 289) @@ -41,7 +41,7 @@ .TP .B \-core.xp\ Specifies number cpus to use for playback. - 0 : not playback possible. (Immediate exit) + 0 : no playback possible. (Immediate exit) 1 : build multi-thread model for Uni-Processor systems 2 : build multi-thread model for Dual-Processors systems 3 : build multi-thread model for Tripple-Processors systems Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-11-03 14:39:31 UTC (rev 288) +++ mplayerxp/configure 2012-11-03 14:41:33 UTC (rev 289) @@ -570,7 +570,7 @@ enabled opengl && require2 opengl "windows.h GL/gl.h" wglCreateContext -lopengl32 -lgdi32 else disabled x11 && disable opengl -enabled opengl && require2 opengl "GL/gl.h GL/glx.h GL/glut.h" glutInitWindowSize -lglut -lGL +enabled opengl && require2 opengl "GL/gl.h GL/glx.h GL/glut.h" glutInitWindowSize -lglut -lGL -lGLU fi print_config HAVE_ mp_config.h mp_config.mak opengl enabled opengl && vomodules="opengl $vomodules" || novomodules="opengl $novomodules" Modified: mplayerxp/mp_msg.c =================================================================== --- mplayerxp/mp_msg.c 2012-11-03 14:39:31 UTC (rev 288) +++ mplayerxp/mp_msg.c 2012-11-03 14:41:33 UTC (rev 289) @@ -84,8 +84,9 @@ "POSTPR" }; -void mp_msg_c( unsigned x, const char *format, ... ){ +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]; @@ -117,14 +118,15 @@ if(strcmp(nls_get_screen_cp(),"UTF-8")!=0) { char *obuf; obuf=nls_recode2screen_cp("UTF-8",sbuf,ssize); - fputs(obuf,stderr); + rc=fputs(obuf,stderr); mp_free(obuf); } - else fputs(sbuf,stderr); + 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-03 14:39:31 UTC (rev 288) +++ mplayerxp/mp_msg.h 2012-11-03 14:41:33 UTC (rev 289) @@ -54,10 +54,10 @@ void mp_msg_init(int verbose); void mp_msg_uninit(void); void mp_msg_flush(void); -void mp_msg_c( unsigned x, const char *format, ... ); +int mp_msg_c( unsigned x, const char *format, ... ); #ifdef __GNUC__ -static inline void mp_msg_dummy(void) {} +static inline int mp_msg_dummy(void) {return 0; } #define mp_msg(mod,lev, args... ) ((lev<(mp_conf.verbose+MSGL_V))?(mp_msg_c(((lev&0xF)<<28)|(mod&0x0FFFFFFF),## args)):(mp_msg_dummy())) #else #define mp_msg(mod,lev, ... ) mp_msg_c(((lev&0xF)<<28)|(mod&0x0FFFFFFF),__VA_ARGS__) @@ -68,18 +68,18 @@ #endif #ifdef __va_arg_pack /* requires gcc-4.3.x */ -static __always_inline void MSG_INFO(const char* args,...) { mp_msg(MSGT_CLASS,MSGL_INFO,args,__va_arg_pack ()); } -static __always_inline void MSG_FATAL(const char* args,...) { mp_msg(MSGT_CLASS,MSGL_FATAL,args,__va_arg_pack ()); } -static __always_inline void MSG_WARN(const char* args,...) { mp_msg(MSGT_CLASS,MSGL_WARN,args,__va_arg_pack ()); } -static __always_inline void MSG_ERR(const char* args,...) { mp_msg(MSGT_CLASS,MSGL_ERR,args,__va_arg_pack ()); } -static __always_inline void MSG_V(const char* args,...) { mp_msg(MSGT_CLASS,MSGL_V,args,__va_arg_pack ()); } -static __always_inline void MSG_OK(const char* args,...) { mp_msg(MSGT_CLASS,MSGL_OK,args,__va_arg_pack ()); } -static __always_inline void MSG_HINT(const char* args,...) { mp_msg(MSGT_CLASS,MSGL_HINT,args,__va_arg_pack ()); } -static __always_inline void MSG_STATUS(const char* args,...) { mp_msg(MSGT_CLASS,MSGL_STATUS,args,__va_arg_pack ()); } +static __always_inline int MSG_INFO(const char* args,...) { return mp_msg(MSGT_CLASS,MSGL_INFO,args,__va_arg_pack ()); } +static __always_inline int MSG_FATAL(const char* args,...) { return mp_msg(MSGT_CLASS,MSGL_FATAL,args,__va_arg_pack ()); } +static __always_inline int MSG_WARN(const char* args,...) { return mp_msg(MSGT_CLASS,MSGL_WARN,args,__va_arg_pack ()); } +static __always_inline int MSG_ERR(const char* args,...) { return mp_msg(MSGT_CLASS,MSGL_ERR,args,__va_arg_pack ()); } +static __always_inline int MSG_V(const char* args,...) { return mp_msg(MSGT_CLASS,MSGL_V,args,__va_arg_pack ()); } +static __always_inline int MSG_OK(const char* args,...) { return mp_msg(MSGT_CLASS,MSGL_OK,args,__va_arg_pack ()); } +static __always_inline int MSG_HINT(const char* args,...) { return mp_msg(MSGT_CLASS,MSGL_HINT,args,__va_arg_pack ()); } +static __always_inline int MSG_STATUS(const char* args,...) { return mp_msg(MSGT_CLASS,MSGL_STATUS,args,__va_arg_pack ()); } #ifdef MP_DEBUG -static __always_inline void MSG_DBG2(const char* args,...) { mp_msg(MSGT_CLASS,MSGL_DBG3,args,__va_arg_pack ()); } -static __always_inline void MSG_DBG3(const char* args,...) { mp_msg(MSGT_CLASS,MSGL_DBG4,args,__va_arg_pack ()); } +static __always_inline int MSG_DBG2(const char* args,...) { return mp_msg(MSGT_CLASS,MSGL_DBG3,args,__va_arg_pack ()); } +static __always_inline int MSG_DBG3(const char* args,...) { return mp_msg(MSGT_CLASS,MSGL_DBG4,args,__va_arg_pack ()); } #else #define MSG_DBG2(args...) #define MSG_DBG3(args...) Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-03 14:39:31 UTC (rev 288) +++ mplayerxp/mplayer.c 2012-11-03 14:41:33 UTC (rev 289) @@ -1653,7 +1653,7 @@ int forced_subs_only=0; seek_args_t seek_args = { 0, DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS }; - mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); // MPA_FLG_BACKTRACE + mp_init_malloc(argv[0],1000,10,MPA_FLG_RANDOMIZER); // MPA_FLG_BACKTRACE mpxp_init_structs(); priv_t*priv=mp_data->priv; Modified: mplayerxp/osdep/mp_malloc.c =================================================================== --- mplayerxp/osdep/mp_malloc.c 2012-11-03 14:39:31 UTC (rev 288) +++ mplayerxp/osdep/mp_malloc.c 2012-11-03 14:41:33 UTC (rev 289) @@ -22,6 +22,7 @@ }mp_slot_t; typedef struct priv_s { + const char* argv0; unsigned rnd_limit; unsigned every_nth_call; enum mp_malloc_e flags; @@ -181,7 +182,7 @@ rp=realloc(ptr,size); if(rp) { slot=prot_find_slot(ptr); - if(!slot) MSG_WARN("Internal error! Can't find slot for address: %p\n",ptr); + if(!slot) MSG_WARN("BT Internal error! Can't find slot for address: %p\n",ptr); else { slot->page_ptr=rp; // update address after realloc slot->size=size; @@ -192,12 +193,75 @@ static __always_inline void bt_free(any_t*ptr) { mp_slot_t* slot=prot_find_slot(ptr); - if(!slot) MSG_WARN("Internal error! Can't find slot for address: %p\n",ptr); + if(!slot) MSG_WARN("BT Internal error! Can't find slot for address: %p\n",ptr); prot_free_slot(ptr); free(ptr); } +/*======== STATISTICS =======*/ +typedef struct bt_cache_entry_s { + any_t* addr; + char* str; +}bt_cache_entry_t; + +typedef struct bt_cache_s { + bt_cache_entry_t* entry; + unsigned num_entries; +}bt_cache_t; + +static bt_cache_t* init_bt_cache(void) { return calloc(1,sizeof(bt_cache_t)); } + +static void uninit_bt_cache(bt_cache_t* cache) { + unsigned i; + for(i=0;i<cache->num_entries;i++) free(cache->entry[i].str); + free(cache->entry); + free(cache); +} + +static char* bt_find_cache(bt_cache_t* cache,any_t* ptr) { + unsigned i; + for(i=0;i<cache->num_entries;i++) if(cache->entry[i].addr==ptr) return cache->entry[i].str; + return NULL; +} + +static bt_cache_entry_t* bt_append_cache(bt_cache_t* cache,any_t* ptr,const char *str) { + if(!cache->entry) cache->entry=malloc(sizeof(bt_cache_entry_t)); + else cache->entry=realloc(cache->entry,sizeof(bt_cache_entry_t)*(cache->num_entries+1)); + cache->entry[cache->num_entries].addr=ptr; + cache->entry[cache->num_entries].str=strdup(str); + cache->num_entries++; + return &cache->entry[cache->num_entries-1]; +} + +static char * addr2line(bt_cache_t* cache,any_t*ptr) { + char *rs; + if(priv->argv0) { + bt_cache_entry_t* centry; + unsigned i; + char cmd[4096],result[4096]; + char ch; + if((rs=bt_find_cache(cache,ptr))!=NULL) return rs; + sprintf(cmd,"addr2line -s -e %s %p\n",priv->argv0,ptr); + FILE* in=popen(cmd,"r"); + if(!in) return NULL; + i=0; + while(1) { + ch=fgetc(in); + if(feof(in)) break; + if(ch=='\n') break; + result[i++]=ch; + if(i>=sizeof(result)-1) break; + } + result[i]='\0'; + pclose(in); + centry=bt_append_cache(cache,ptr,result); + return centry->str; + } + return NULL; +} + static void bt_print_slots(void) { + bt_cache_t* cache=init_bt_cache(); size_t i,j; for(i=0;i<priv->nslots;i++) { char *s; @@ -216,16 +280,18 @@ } MSG_INFO("\n"); for(j=0;j<priv->slots[i].ncalls;j++) { - MSG_INFO(" %p\n",priv->slots[i].calls[j]); + MSG_INFO("%s%p -> %s\n",j==0?"bt=>":" ",priv->slots[i].calls[j],addr2line(cache,priv->slots[i].calls[j])); } } - MSG_HINT("For source lines print in (gdb): list *0xADDRESS\n"); + MSG_HINT("For source lines you may also print in (gdb): list *0xADDRESS\n"); + uninit_bt_cache(cache); } /* ================== HEAD FUNCTIONS ======================= */ -void mp_init_malloc(unsigned rnd_limit,unsigned every_nth_call,enum mp_malloc_e flags) +void mp_init_malloc(const char *argv0,unsigned rnd_limit,unsigned every_nth_call,enum mp_malloc_e flags) { if(!priv) priv=malloc(sizeof(priv_t)); memset(priv,0,sizeof(priv_t)); + priv->argv0=argv0; priv->rnd_limit=rnd_limit; priv->every_nth_call=every_nth_call; priv->flags=flags; @@ -246,7 +312,7 @@ any_t* mp_malloc(size_t __size) { any_t* rb,*rnd_buff=NULL; - if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); + if(!priv) mp_init_malloc(NULL,1000,10,MPA_FLG_RANDOMIZER); if(priv->every_nth_call && priv->rnd_limit && !priv->flags) { if(priv->total_calls%priv->every_nth_call==0) { rnd_buff=malloc(rand()%priv->rnd_limit); @@ -264,7 +330,7 @@ any_t* mp_memalign (size_t boundary, size_t __size) { any_t* rb; - if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); + if(!priv) mp_init_malloc(NULL,1000,10,MPA_FLG_RANDOMIZER); if(priv->flags&(MPA_FLG_BOUNDS_CHECK|MPA_FLG_BEFORE_CHECK)) rb=prot_memalign(boundary,__size); else if(priv->flags&MPA_FLG_BACKTRACE) rb=bt_memalign(boundary,__size); else rb=memalign(boundary,__size); @@ -281,7 +347,7 @@ void mp_free(any_t*__ptr) { - if(!priv) mp_init_malloc(1000,10,MPA_FLG_RANDOMIZER); + if(!priv) mp_init_malloc(NULL,1000,10,MPA_FLG_RANDOMIZER); if(__ptr) { if(priv->flags&(MPA_FLG_BOUNDS_CHECK|MPA_FLG_BEFORE_CHECK)) prot_free(__ptr); Modified: mplayerxp/osdep/mplib.h =================================================================== --- mplayerxp/osdep/mplib.h 2012-11-03 14:39:31 UTC (rev 288) +++ mplayerxp/osdep/mplib.h 2012-11-03 14:41:33 UTC (rev 289) @@ -42,7 +42,7 @@ MPA_FLG_BEFORE_CHECK = 0x00000002, MPA_FLG_BACKTRACE = 0x00000004 }; -extern void __FASTCALL__ mp_init_malloc(unsigned rnd_limit,unsigned every_nth_call,enum mp_malloc_e flags); +extern void __FASTCALL__ mp_init_malloc(const char *argv0,unsigned rnd_limit,unsigned every_nth_call,enum mp_malloc_e flags); extern void __FASTCALL__ mp_uninit_malloc(int verbose); extern any_t* __FASTCALL__ mp_malloc(size_t __size); Modified: mplayerxp/xmpcore/xmp_core.h =================================================================== --- mplayerxp/xmpcore/xmp_core.h 2012-11-03 14:39:31 UTC (rev 288) +++ mplayerxp/xmpcore/xmp_core.h 2012-11-03 14:41:33 UTC (rev 289) @@ -101,7 +101,7 @@ }xp_core_t; extern xp_core_t *xp_core; -static inline int xmp_test_model(unsigned value) { return (xp_core->flags&value)!=0; } +static inline int xmp_test_model(xmp_model_e value) { return (xp_core->flags&value)!=0; } extern void xmp_init(void); extern void xmp_uninit(void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |