Thread: [Mplayerxp-cvslog] SF.net SVN: mplayerxp:[165] mplayerxp (Page 3)
Brought to you by:
olov
From: <nic...@us...> - 2012-10-16 17:42:57
|
Revision: 165 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=165&view=rev Author: nickols_k Date: 2012-10-16 17:42:50 +0000 (Tue, 16 Oct 2012) Log Message: ----------- minor improvements Modified Paths: -------------- mplayerxp/Makefile mplayerxp/configure mplayerxp/dec_ahead.c mplayerxp/fifo.c mplayerxp/fifo.h mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_opengl.c mplayerxp/libvo/vo_x11.c mplayerxp/libvo/vo_xv.c mplayerxp/libvo/vo_xvidix.c mplayerxp/libvo/x11_common.c mplayerxp/mplayer.c Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/Makefile 2012-10-16 17:42:50 UTC (rev 165) @@ -24,7 +24,7 @@ LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs SRCS_COMMON = cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c my_malloc.c spudec.c playtree.c playtreeparser.c asxparser.c mp_image.c subopt-helper.c -SRCS_MPLAYER = mplayer.c $(SRCS_COMMON) find_sub.c subreader.c mixer.c vobsub.c mp-opt-reg.c sig_hand.c dump.c dec_ahead.c m_option.c m_property.c m_struct.c +SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) find_sub.c subreader.c mixer.c vobsub.c mp-opt-reg.c sig_hand.c dump.c dec_ahead.c m_option.c m_property.c m_struct.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/configure 2012-10-16 17:42:50 UTC (rev 165) @@ -712,7 +712,7 @@ enabled libbz2 && require2 libbz2 bzlib.h BZ2_bzlibVersion -lbz2 || disable libbz2 print_config HAVE_ mp_config.h mp_config.mak libbz2 -CFLAGS="$CFLAGS -W -Wall" +CFLAGS="$CFLAGS -W -Wall -Wextra -Wshadow" # Thread support if linux ; then CFLAGS="$CFLAGS -D_REENTRANT" Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/dec_ahead.c 2012-10-16 17:42:50 UTC (rev 165) @@ -135,20 +135,20 @@ int drop_param=0; volatile unsigned da_active_frame,lda_active_frame,ada_active_frame; unsigned xp_n_frame_to_drop; - int xp_id; + int _xp_id; static float prev_delta=0; float v_pts,mpeg_timer=HUGE; pthread_is_living=1; xp_eof = 0; 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"; + _xp_id=init_signal_handling(sig_dec_ahead_video,uninit_dec_ahead); + pinfo[_xp_id].current_module = "dec_ahead"; dec_ahead_pid = - pinfo[xp_id].pid = getpid(); /* Only for testing */ + pinfo[_xp_id].pid = getpid(); /* Only for testing */ dec_ahead_pth_id = - pinfo[xp_id].pth_id = pthread_self(); - pinfo[xp_id].thread_name = (has_xp_audio && enable_xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; + pinfo[_xp_id].pth_id = pthread_self(); + pinfo[_xp_id].thread_name = (has_xp_audio && enable_xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; prev_delta=xp_num_frames; drop_barrier=(float)(xp_num_frames/2)*(1/vo.fps); if(av_sync_pts == -1 && !use_pts_fix2) @@ -165,13 +165,13 @@ { unsigned char* start=NULL; int in_size; if(dec_ahead_in_lseek==PreSeek) { - pinfo[xp_id].current_module = "Pre seek"; + pinfo[_xp_id].current_module = "Pre seek"; LOCK_VIDEO_DECODE(); dec_ahead_in_lseek=Seek; pthread_cond_wait( &video_decode_cond, &video_decode_mutex ); UNLOCK_VIDEO_DECODE(); } - pinfo[xp_id].current_module = "dec_ahead 1"; + pinfo[_xp_id].current_module = "dec_ahead 1"; /* get it! */ LOCK_VREADING(); if(dec_ahead_in_lseek==Seek) @@ -183,15 +183,15 @@ /* prevent reent access to non-reent demuxer */ //if(sh_video->num_frames>200) *((char*)0x100) = 1; // Testing crash if(has_xp_audio && enable_xp<XP_VAFull) { - pinfo[xp_id].current_module = "decode audio"; + pinfo[_xp_id].current_module = "decode audio"; while(2==xp_thread_decode_audio()) ; - pinfo[xp_id].current_module = "dec_ahead 2"; + pinfo[_xp_id].current_module = "dec_ahead 2"; } in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,vo.fps); UNLOCK_VREADING(); if(dec_ahead_in_lseek==Seek) { - pinfo[xp_id].current_module = "Post seek"; + pinfo[_xp_id].current_module = "Post seek"; /* reset counters */ vo_get_active_frame(&dec_ahead_locked_frame); LOCK_VDEC_ACTIVE(); @@ -204,7 +204,7 @@ if(xp_is_bad_pts) mpeg_timer=HUGE; dec_ahead_in_lseek=NoSeek; MSG_T("\nDEC_AHEAD: reset counters to (%u %u) due lseek\n",dec_ahead_locked_frame,abs_dec_ahead_locked_frame); - pinfo[xp_id].current_module = "dec_ahead 3"; + pinfo[_xp_id].current_module = "dec_ahead 3"; } if(in_size<0) { @@ -212,10 +212,10 @@ xp_eof=1; if(has_xp_audio && enable_xp<XP_VAFull) { while(!xp_audio_eof && !dec_ahead_in_lseek && !pthread_end_of_work) { - pinfo[xp_id].current_module = "decode audio"; + pinfo[_xp_id].current_module = "decode audio"; if(!xp_thread_decode_audio()) usleep(1); - pinfo[xp_id].current_module = NULL; + pinfo[_xp_id].current_module = NULL; } if(dec_ahead_in_lseek) { xp_eof=0; @@ -224,7 +224,7 @@ } LOCK_VIDEO_DECODE(); if(!pthread_end_of_work) { - pinfo[xp_id].current_module = "wait for end of work"; + pinfo[_xp_id].current_module = "wait for end of work"; pthread_cond_wait(&video_decode_cond,&video_decode_mutex); } UNLOCK_VIDEO_DECODE(); @@ -334,9 +334,9 @@ if(pthread_end_of_work) goto pt_exit; if(dec_ahead_in_lseek!=NoSeek) break; if(has_xp_audio && enable_xp<XP_VAFull) { - pinfo[xp_id].current_module = "decode audio"; + pinfo[_xp_id].current_module = "decode audio"; xp_thread_decode_audio(); - pinfo[xp_id].current_module = "dec_ahead 5"; + pinfo[_xp_id].current_module = "dec_ahead 5"; } usleep(1); LOCK_VDEC_ACTIVE(); @@ -465,7 +465,7 @@ MSG_T("\nDEC_AHEAD: leaving...\n"); pthread_is_living=0; pthread_end_of_work=0; - uninit_signal_handling(xp_id); + uninit_signal_handling(_xp_id); return arg; /* terminate thread here !!! */ } Modified: mplayerxp/fifo.c =================================================================== --- mplayerxp/fifo.c 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/fifo.c 2012-10-16 17:42:50 UTC (rev 165) @@ -1,10 +1,14 @@ #include "fifo.h" +#ifndef min +#define min(a,b) ((a)<(b)?(a):(b)) +#endif + // keyboard: -static int keyb_fifo_put=-1; -static int keyb_fifo_get=-1; +int keyb_fifo_put=-1; +int keyb_fifo_get=-1; -static void __FASTCALL__ make_pipe(int* pr,int* pw){ +void __FASTCALL__ fifo_make_pipe(int* pr,int* pw){ int temp[2]; if(pipe(temp)!=0) MSG_ERR("Cannot make PIPE!\n"); *pr=temp[0]; @@ -129,7 +133,6 @@ return total - size; } - int cb_fifo_generic_read(CBFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)) { // Read memory barrier needed for SMP here in theory Modified: mplayerxp/fifo.h =================================================================== --- mplayerxp/fifo.h 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/fifo.h 2012-10-16 17:42:50 UTC (rev 165) @@ -2,8 +2,22 @@ * @file libavutil/fifo.h * a very simple circular buffer FIFO implementation */ +#include "mp_config.h" +#define MSGT_CLASS MSGT_GLOBAL +#include "__mp_msg.h" + #include <stdint.h> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +// keyboard: +extern int keyb_fifo_put; +extern int keyb_fifo_get; + +extern void __FASTCALL__ fifo_make_pipe(int* pr,int* pw); + typedef struct CBFifoBuffer { uint8_t *buffer; uint8_t *rptr, *wptr, *end; Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/libvo/video_out.h 2012-10-16 17:42:50 UTC (rev 165) @@ -188,7 +188,11 @@ extern uint32_t __FASTCALL__ vo_control(uint32_t request, void *data); extern int __FASTCALL__ vo_is_final(void); -struct vo_rect { +typedef struct vo_rect_s { + unsigned x,y,w,h; +}vo_rect_t; + +struct vo_rect2 { int left, right, top, bottom, width, height; }; @@ -235,16 +239,10 @@ unsigned screenheight; // requested resolution/bpp: (-x -y -bpp options) - unsigned dx; - unsigned dy; - unsigned dwidth; - unsigned dheight; + vo_rect_t dest; unsigned dbpp; - unsigned old_x; - unsigned old_y; - unsigned old_width; - unsigned old_height; + vo_rect_t prev; int doublebuffering; int vsync; Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/libvo/vo_opengl.c 2012-10-16 17:42:50 UTC (rev 165) @@ -175,7 +175,7 @@ vo.fs=flags&VOFLAG_FULLSCREEN; vo.softzoom=flags&VOFLAG_SWSCALE; if ( vo.fs ) - { vo.old_width=d_width; vo.old_height=d_height; } + { vo.prev.w=d_width; vo.prev.h=d_height; } #ifdef HAVE_XF86VM if( flags&0x02 ) vm = 1; @@ -289,7 +289,7 @@ static uint32_t __FASTCALL__ check_events(int (* __FASTCALL__ adjust_size)(unsigned cw,unsigned ch,unsigned *w,unsigned *h)) { int e=vo_x11_check_events(vo.mDisplay,adjust_size); - if(e&VO_EVENT_RESIZE) resize(vo.dwidth,vo.dheight); + if(e&VO_EVENT_RESIZE) resize(vo.dest.w,vo.dest.h); return e|VO_EVENT_FORCE_UPDATE; } @@ -381,7 +381,7 @@ return query_format((vo_query_fourcc_t*)data); case VOCTRL_FULLSCREEN: vo_fullscreen(); - resize(vo.dwidth, vo.dheight); + resize(vo.dest.w, vo.dest.h); return VO_TRUE; case VOCTRL_GET_NUM_FRAMES: *(uint32_t *)data = vogl.num_buffers; Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/libvo/vo_x11.c 2012-10-16 17:42:50 UTC (rev 165) @@ -97,8 +97,8 @@ if (ret & VO_EVENT_RESIZE) { unsigned idx; - unsigned newW= vo.dwidth; - unsigned newH= vo.dheight; + unsigned newW= vo.dest.w; + unsigned newH= vo.dest.h; int newAspect= (newW*(1<<16) + (newH>>1))/newH; if(newAspect>vox11.baseAspect) newW= (newH*vox11.baseAspect + (1<<15))>>16; else newH= ((newW<<16) + (vox11.baseAspect>>1)) /vox11.baseAspect; @@ -169,8 +169,8 @@ bg=WhitePixel( vo.mDisplay,vo.mScreen ); fg=BlackPixel( vo.mDisplay,vo.mScreen ); - vo.dwidth=hint.width; - vo.dheight=hint.height; + vo.dest.w=hint.width; + vo.dest.h=hint.height; vox11.image_width=d_width; vox11.image_height=d_height; @@ -284,7 +284,7 @@ { XShmPutImage( vo.mDisplay,vo.window,vo.gc,myximage, 0,0, - ( vo.dwidth - myximage->width ) / 2,( vo.dheight - myximage->height ) / 2, + ( vo.dest.w - myximage->width ) / 2,( vo.dest.h - myximage->height ) / 2, myximage->width,myximage->height,True ); } else @@ -292,7 +292,7 @@ { XPutImage( vo.mDisplay,vo.window,vo.gc,myximage, 0,0, - ( vo.dwidth - myximage->width ) / 2,( vo.dheight - myximage->height ) / 2, + ( vo.dest.w - myximage->width ) / 2,( vo.dest.h - myximage->height ) / 2, myximage->width,myximage->height); } #endif Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/libvo/vo_xv.c 2012-10-16 17:42:50 UTC (rev 165) @@ -329,7 +329,7 @@ vo.fs=flags&VOFLAG_FULLSCREEN; vo.softzoom=flags&VOFLAG_SWSCALE; if ( vo.fs ) - { vo.old_width=d_width; vo.old_height=d_height; } + { vo.prev.w=d_width; vo.prev.h=d_height; } #ifdef HAVE_XF86VM if( flags&0x02 ) vm = 1; Modified: mplayerxp/libvo/vo_xvidix.c =================================================================== --- mplayerxp/libvo/vo_xvidix.c 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/libvo/vo_xvidix.c 2012-10-16 17:42:50 UTC (rev 165) @@ -224,7 +224,7 @@ vo.fs = flags&0x01; if (vo.fs) - { vo.old_width=d_width; vo.old_height=d_height; } + { vo.prev.w=d_width; vo.prev.h=d_height; } xvidix.X_already_started++; Modified: mplayerxp/libvo/x11_common.c =================================================================== --- mplayerxp/libvo/x11_common.c 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/libvo/x11_common.c 2012-10-16 17:42:50 UTC (rev 165) @@ -692,11 +692,11 @@ case ConfigureNotify: nw = Event.xconfigure.width; nh = Event.xconfigure.height; - if(adjust_size) adj_ret = (*adjust_size)(vo.dwidth,vo.dheight,&nw,&nh); - ow = vo.dwidth; - oh = vo.dheight; - vo.dwidth=nw; - vo.dheight=nh; + if(adjust_size) adj_ret = (*adjust_size)(vo.dest.w,vo.dest.h,&nw,&nh); + ow = vo.dest.w; + oh = vo.dest.h; + vo.dest.w=nw; + vo.dest.h=nh; { Window root; unsigned foo; @@ -704,14 +704,14 @@ XGetGeometry(mydisplay, vo.window, &root, &foo, &foo, &foo/*width*/, &foo/*height*/, &foo, &foo); XTranslateCoordinates(mydisplay, vo.window, root, 0, 0, - &vo.dx, &vo.dy, &win); + &vo.dest.x, &vo.dest.y, &win); } - if(adjust_size && ow != vo.dwidth && oh != vo.dheight && adj_ret) + if(adjust_size && ow != vo.dest.w && oh != vo.dest.h && adj_ret) { - XResizeWindow( vo.mDisplay,vo.window,vo.dwidth,vo.dheight ); + XResizeWindow( vo.mDisplay,vo.window,vo.dest.w,vo.dest.h ); XSync( vo.mDisplay,True); } - MSG_V("X11 Window %dx%d-%dx%d\n", vo.dx, vo.dy, vo.dwidth, vo.dheight); + MSG_V("X11 Window %dx%d-%dx%d\n", vo.dest.x, vo.dest.y, vo.dest.w, vo.dest.h); ret|=VO_EVENT_RESIZE; break; case KeyPress: @@ -793,18 +793,18 @@ if ( !vo.fs ) { vo.fs=VO_TRUE; - vo.old_x=vo.dx; vo.old_y=vo.dy; vo.old_width=vo.dwidth; vo.old_height=vo.dheight; - vo.dx=0; vo.dy=0; vo.dwidth=vo.screenwidth; vo.dheight=vo.screenheight; + vo.prev=vo.dest; + vo.dest.x=0; vo.dest.y=0; vo.dest.w=vo.screenwidth; vo.dest.h=vo.screenheight; vo_x11_decoration( vo.mDisplay,vo.window,0 ); } else { vo.fs=VO_FALSE; - vo.dx=vo.old_x; vo.dy=vo.old_y; vo.dwidth=vo.old_width; vo.dheight=vo.old_height; + vo.dest=vo.prev; vo_x11_decoration( vo.mDisplay,vo.window,1 ); } - vo_x11_sizehint( vo.dx,vo.dy,vo.dwidth,vo.dheight ); - XMoveResizeWindow( vo.mDisplay,vo.window,vo.dx,vo.dy,vo.dwidth,vo.dheight ); + vo_x11_sizehint( vo.dest.x,vo.dest.y,vo.dest.w,vo.dest.h ); + XMoveResizeWindow( vo.mDisplay,vo.window,vo.dest.x,vo.dest.y,vo.dest.w,vo.dest.h ); XMapWindow( vo.mDisplay,vo.window ); XSync( vo.mDisplay,False ); } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-16 16:31:36 UTC (rev 164) +++ mplayerxp/mplayer.c 2012-10-16 17:42:50 UTC (rev 165) @@ -168,7 +168,7 @@ #include "libmpcodecs/dec_audio.h" /* Common FIFO functions, and keyboard/event FIFO code */ -#include "fifo.c" +#include "fifo.h" int use_stdin=0; /**************************************************************************/ @@ -327,7 +327,7 @@ audio_buffer_t audio_buffer; -int init_audio_buffer( int size, int min_reserv, int indices, sh_audio_t *sh_audio ) +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 = malloc(size)) ) @@ -352,7 +352,7 @@ 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 = sh_audio; + audio_buffer.sh_audio = sha; return 0; } @@ -766,7 +766,6 @@ if(sh_audio) while(get_len_audio_buffer()) usleep(0); if(sh_video && shva) { - volatile int dec_ahead_active_frame; for(;;) { __MP_SYNCHRONIZE(vdec_active_mutex,vo_get_active_frame(&dec_ahead_active_frame)); @@ -1042,7 +1041,7 @@ list_codecs(1); } -int decore_audio( int xp_id ) +int decore_audio( int _xp_id ) { int eof = 0; /*========================== PLAY AUDIO ============================*/ @@ -1067,7 +1066,7 @@ //if(playsize>outburst) playsize=outburst; // Update buffer if needed - pinfo[xp_id].current_module="decode_audio"; // Enter AUDIO decoder module + pinfo[_xp_id].current_module="decode_audio"; // Enter AUDIO decoder module t=GetTimer(); while(sh_audio->a_buffer_len<playsize && !audio_eof){ if(enable_xp>=XP_VideoAudio) { @@ -1088,14 +1087,14 @@ { MSG_V("audio_stream_eof\n"); inited_flags&=~INITED_AO; - pinfo[xp_id].current_module="uninit_ao"; + pinfo[_xp_id].current_module="uninit_ao"; ao_uninit(); } audio_eof=1; break; } } - pinfo[xp_id].current_module="play_audio"; // Leave AUDIO decoder module + pinfo[_xp_id].current_module="play_audio"; // Leave AUDIO decoder module t=GetTimer()-t; tt = t*0.000001f; audio_time_usage+=tt; @@ -1820,7 +1819,7 @@ return 0; } -void mpxp_seek( int xp_id, video_stat_t *vstat, int *osd_visible,float v_pts,float pos,int flags) +void mpxp_seek( int _xp_id, video_stat_t *vstat, int *osd_visible,float v_pts,float pos,int flags) { int seek_rval=1; audio_eof=0; @@ -1858,20 +1857,20 @@ fflush(stdout); if(sh_video){ - pinfo[xp_id].current_module="seek_video_reset"; + pinfo[_xp_id].current_module="seek_video_reset"; resync_video_stream(sh_video); vo_reset(); sh_video->chapter_change=-1; } if(sh_audio){ - pinfo[xp_id].current_module="seek_audio_reset"; + pinfo[_xp_id].current_module="seek_audio_reset"; resync_audio_stream(sh_audio); ao_reset(); // stop audio, throwing away buffered data } if (vo.vobsub) { - pinfo[xp_id].current_module = "seek_vobsub_reset"; + pinfo[_xp_id].current_module = "seek_vobsub_reset"; vobsub_seek(vo.vobsub, v_pts); } @@ -2190,7 +2189,7 @@ #endif // ========== Init keyboard FIFO (connection to libvo) ============ -make_pipe(&keyb_fifo_get,&keyb_fifo_put); +fifo_make_pipe(&keyb_fifo_get,&keyb_fifo_put); /* Init input system */ pinfo[xp_id].current_module = "init_input"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-17 11:27:15
|
Revision: 166 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=166&view=rev Author: nickols_k Date: 2012-10-17 11:27:01 +0000 (Wed, 17 Oct 2012) Log Message: ----------- since mplayerxp became the victim of some religious wars: rename void* -> any_t* Modified Paths: -------------- mplayerxp/asxparser.c mplayerxp/asxparser.h mplayerxp/cfg-mplayer.h mplayerxp/cfgparser.c mplayerxp/cfgparser.h mplayerxp/configure mplayerxp/dec_ahead.c mplayerxp/fifo.c mplayerxp/fifo.h mplayerxp/input/input.c mplayerxp/input/input.h 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/codecs_ld.c mplayerxp/libmpcodecs/codecs_ld.h mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/liba52/a52.h mplayerxp/libmpcodecs/liba52/a52_internal.h mplayerxp/libmpcodecs/liba52/parse.c mplayerxp/libmpcodecs/liba52/resample.c mplayerxp/libmpcodecs/liba52/resample_c.c mplayerxp/libmpcodecs/liba52/resample_mmx.c mplayerxp/libmpcodecs/libdca/dca.h mplayerxp/libmpcodecs/libdca/dca_internal.h mplayerxp/libmpcodecs/libdca/parse.c mplayerxp/libmpcodecs/libdca/resample.c mplayerxp/libmpcodecs/libdca/resample_c.c mplayerxp/libmpcodecs/libdca/resample_mmx.c mplayerxp/libmpcodecs/libnuppelvideo/minilzo.c mplayerxp/libmpcodecs/vd.c 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/libmpdemux/asf_streaming.c mplayerxp/libmpdemux/cache2.c mplayerxp/libmpdemux/cdd.h 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_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_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/dvdauth.c mplayerxp/libmpdemux/freesdp/common.c mplayerxp/libmpdemux/freesdp/common.h mplayerxp/libmpdemux/freesdp/parser.c mplayerxp/libmpdemux/http.c mplayerxp/libmpdemux/http.h mplayerxp/libmpdemux/librtsp/rtsp.c mplayerxp/libmpdemux/mrl.h mplayerxp/libmpdemux/mux_lavf.c mplayerxp/libmpdemux/mux_mpxp64.c mplayerxp/libmpdemux/muxer.h mplayerxp/libmpdemux/network.c mplayerxp/libmpdemux/network.h mplayerxp/libmpdemux/pnm.c mplayerxp/libmpdemux/realrtsp/xbuffer.c mplayerxp/libmpdemux/realrtsp/xbuffer.h 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_udp.c mplayerxp/libmpdemux/s_vcdnav.c mplayerxp/libmpdemux/stheader.h mplayerxp/libmpdemux/stream.c mplayerxp/libmpdemux/stream.h mplayerxp/libmpdemux/tcp.c mplayerxp/libmpdemux/tv.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/video.c mplayerxp/libmpdemux/yuv4mpeg.c mplayerxp/libvo/aclib.c mplayerxp/libvo/aclib_template.c mplayerxp/libvo/dri_vo.h mplayerxp/libvo/fastmemcpy.h mplayerxp/libvo/img_format.h mplayerxp/libvo/osd_template.c mplayerxp/libvo/sub.h 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/libvo/vosub_vidix.h mplayerxp/loader/com.h mplayerxp/loader/dmo/DMO_AudioDecoder.c mplayerxp/loader/dmo/DMO_AudioDecoder.h mplayerxp/loader/dmo/DMO_Filter.h mplayerxp/loader/dmo/DMO_VideoDecoder.c mplayerxp/loader/dmo/DMO_VideoDecoder.h mplayerxp/loader/dmo/buffer.c mplayerxp/loader/dmo/dmo.c mplayerxp/loader/driver.c mplayerxp/loader/dshow/DS_AudioDecoder.c mplayerxp/loader/dshow/DS_AudioDecoder.h mplayerxp/loader/dshow/DS_Filter.c mplayerxp/loader/dshow/DS_VideoDecoder.c mplayerxp/loader/dshow/DS_VideoDecoder.h mplayerxp/loader/dshow/allocator.c mplayerxp/loader/dshow/cmediasample.c mplayerxp/loader/dshow/inputpin.c mplayerxp/loader/dshow/interfaces.h mplayerxp/loader/dshow/iunk.h mplayerxp/loader/dshow/outputpin.c mplayerxp/loader/dshow/outputpin.h mplayerxp/loader/elfdll.c mplayerxp/loader/ext.c mplayerxp/loader/ldt_keeper.c mplayerxp/loader/ldt_keeper.h mplayerxp/loader/module.c mplayerxp/loader/pe_image.c mplayerxp/loader/qtx/qtxsdk/components.h mplayerxp/loader/registry.c mplayerxp/loader/registry.h mplayerxp/loader/vfl.c mplayerxp/loader/win32.c mplayerxp/loader/win32.h mplayerxp/loader/wine/windef.h mplayerxp/loader/wrapper.h mplayerxp/m_option.c mplayerxp/m_option.h mplayerxp/m_property.c mplayerxp/m_property.h mplayerxp/m_struct.c mplayerxp/m_struct.h mplayerxp/mp_image.h mplayerxp/mplayer.c mplayerxp/my_malloc.c mplayerxp/my_malloc.h mplayerxp/osdep/lrmi.c mplayerxp/osdep/lrmi.h mplayerxp/osdep/shmem.c mplayerxp/osdep/shmem.h mplayerxp/osdep/vbelib.c mplayerxp/osdep/vbelib.h 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_mp.c mplayerxp/postproc/af_mp.h 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/dsp.c mplayerxp/postproc/dsp.h mplayerxp/postproc/dsp_accel.h mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/libmenu/menu_console.c mplayerxp/postproc/libmenu/menu_filesel.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_format.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/pvector/mmx2c.h mplayerxp/pvector/pvector.h mplayerxp/pvector/pvector_f32_x86.h mplayerxp/pvector/pvector_int_x86.h mplayerxp/sig_hand.c mplayerxp/spudec.c mplayerxp/spudec.h mplayerxp/subopt-helper.h mplayerxp/subreader.c mplayerxp/vobsub.c mplayerxp/vobsub.h Modified: mplayerxp/asxparser.c =================================================================== --- mplayerxp/asxparser.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/asxparser.c 2012-10-17 11:27:01 UTC (rev 166) @@ -15,24 +15,24 @@ ////// List utils -static void __FASTCALL__ asx_list_add(void* list_ptr,void* entry){ - void** list = *(void***)list_ptr; +static void __FASTCALL__ asx_list_add(any_t* list_ptr,any_t* entry){ + any_t** list = *(any_t***)list_ptr; int c = 0; if(list != NULL) for( ; list[c] != NULL; c++) ; - list = (void*)realloc(list,sizeof(void*)*(c+2)); + list = (any_t*)realloc(list,sizeof(any_t*)*(c+2)); list[c] = entry; list[c+1] = NULL; - *(void***)list_ptr = list; + *(any_t***)list_ptr = list; } -static void __FASTCALL__ asx_list_remove(void* list_ptr,void* entry,ASX_FreeFunc free_func) { - void** list = *(void***)list_ptr; +static void __FASTCALL__ asx_list_remove(any_t* list_ptr,any_t* entry,ASX_FreeFunc free_func) { + any_t** list = *(any_t***)list_ptr; int c,e = -1; if(list == NULL) return; @@ -47,28 +47,28 @@ if(c == 1) { // Only one entry, we drop all free(list); - *(void**)list_ptr = NULL; + *(any_t**)list_ptr = NULL; return; } if(c > e) // If c==e the memmove is not needed - memmove(list+e,list+e+1,(c-e)*sizeof(void*)); + memmove(list+e,list+e+1,(c-e)*sizeof(any_t*)); - list = (void*)realloc(list,(c-1)*sizeof(void*)); + list = (any_t*)realloc(list,(c-1)*sizeof(any_t*)); list[c-1] = NULL; - *(void***)list_ptr = list; + *(any_t***)list_ptr = list; } -void __FASTCALL__ asx_list_free(void* list_ptr,ASX_FreeFunc free_func) { - void** ptr = *(void***)list_ptr; +void __FASTCALL__ asx_list_free(any_t* list_ptr,ASX_FreeFunc free_func) { + any_t** ptr = *(any_t***)list_ptr; if(ptr == NULL) return; if(free_func != NULL) { for( ; *ptr != NULL ; ptr++) free_func(*ptr); } - free(*(void**)list_ptr); - *(void**)list_ptr = NULL; + free(*(any_t**)list_ptr); + *(any_t**)list_ptr = NULL; } /////// Attribs utils Modified: mplayerxp/asxparser.h =================================================================== --- mplayerxp/asxparser.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/asxparser.h 2012-10-17 11:27:01 UTC (rev 166) @@ -42,8 +42,8 @@ ////// List utils -typedef void (* __FASTCALL__ ASX_FreeFunc)(void* arg); +typedef void (* __FASTCALL__ ASX_FreeFunc)(any_t* arg); -extern void __FASTCALL__ asx_list_free(void* list_ptr,ASX_FreeFunc free_func); +extern void __FASTCALL__ asx_list_free(any_t* list_ptr,ASX_FreeFunc free_func); #endif Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/cfg-mplayer.h 2012-10-17 11:27:01 UTC (rev 166) @@ -75,7 +75,7 @@ extern int audio_output_channels; extern int sws_flags; -extern int readPPOpt(void *conf, char *arg); +extern int readPPOpt(any_t*conf, char *arg); extern char *npp_options; extern int shuffle_playback; Modified: mplayerxp/cfgparser.c =================================================================== --- mplayerxp/cfgparser.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/cfgparser.c 2012-10-17 11:27:01 UTC (rev 166) @@ -261,9 +261,9 @@ return config; } -static void m_config_add_dynamic(m_config_t *conf,void *ptr) { - if(!conf->dynasize) conf->dynamics = malloc(sizeof(void *)); - else conf->dynamics = realloc(conf->dynamics,(conf->dynasize+1)*sizeof(void *)); +static void m_config_add_dynamic(m_config_t *conf,any_t*ptr) { + if(!conf->dynasize) conf->dynamics = malloc(sizeof(any_t*)); + else conf->dynamics = realloc(conf->dynamics,(conf->dynasize+1)*sizeof(any_t*)); conf->dynamics[conf->dynasize] = ptr; conf->dynasize++; } @@ -1111,7 +1111,7 @@ return m_config_find_option(conf_list,arg); } -void* m_config_get_option_ptr(m_config_t const*config,const char* arg) { +any_t* m_config_get_option_ptr(m_config_t const*config,const char* arg) { config_t* conf; #ifdef MP_DEBUG Modified: mplayerxp/cfgparser.h =================================================================== --- mplayerxp/cfgparser.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/cfgparser.h 2012-10-17 11:27:01 UTC (rev 166) @@ -42,7 +42,7 @@ struct config { const char *name; - void * const p; + any_t* const p; unsigned int type; unsigned int flags; float min,max; @@ -55,7 +55,7 @@ struct m_config { const config_t** opt_list; config_save_t** config_stack; - void **dynamics; + any_t**dynamics; unsigned dynasize; int cs_level; int parser_mode; /* COMMAND_LINE or CONFIG_FILE */ @@ -72,7 +72,7 @@ union { int as_int; float as_float; - void* as_pointer; + any_t* as_pointer; } param; char* opt_name; }; @@ -128,7 +128,7 @@ /** Get the p field of the struct defining an option * @return NULL on error **/ -void* m_config_get_option_ptr(m_config_t const *config,const char* arg); +any_t* m_config_get_option_ptr(m_config_t const *config,const char* arg); /** Tell is an option is alredy set or not * @return -1 one error (requested option arg exist) otherwise 0 or 1 Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/configure 2012-10-17 11:27:01 UTC (rev 166) @@ -897,8 +897,10 @@ #endif #endif +typedef void any_t; + /* Removes warning about unused arguments */ -# define UNUSED(x) ((void)(x)) +# define UNUSED(x) ((any_t)(x)) #endif /* MPXP_CONFIG_H */ EOF Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/dec_ahead.c 2012-10-17 11:27:01 UTC (rev 166) @@ -116,7 +116,7 @@ extern int get_len_audio_buffer(void); extern int get_free_audio_buffer(void); -void * audio_play_routine( void * arg ); +any_t* audio_play_routine( any_t* arg ); static volatile int pthread_is_living=0; static volatile int a_pthread_is_living=0; @@ -127,7 +127,7 @@ int xp_is_bad_pts=0; /* this routine decodes video+audio but intends to be video only */ -void * Va_dec_ahead_routine( void * arg ) +any_t* Va_dec_ahead_routine( any_t* arg ) { float duration=0; float drop_barrier; @@ -470,7 +470,7 @@ } /* this routine decodes audio only */ -void * a_dec_ahead_routine( void * arg ) +any_t* a_dec_ahead_routine( any_t* arg ) { int xp_id; int ret, retval; @@ -793,7 +793,7 @@ #define NOTHING_PLAYED (-1.0) #define XP_MIN_TIMESLICE 0.010 /* under Linux on x86 min time_slice = 10 ms */ -void * audio_play_routine( void * arg ) +any_t* audio_play_routine( any_t* arg ) { int xp_id; int eof = 0; Modified: mplayerxp/fifo.c =================================================================== --- mplayerxp/fifo.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/fifo.c 2012-10-17 11:27:01 UTC (rev 166) @@ -111,7 +111,7 @@ return 0; } -int cb_fifo_generic_write(CBFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)) +int cb_fifo_generic_write(CBFifoBuffer *f, any_t*src, int size, int (*func)(any_t*, any_t*, int)) { int total = size; do { @@ -133,7 +133,7 @@ return total - size; } -int cb_fifo_generic_read(CBFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)) +int cb_fifo_generic_read(CBFifoBuffer *f, any_t*dest, int buf_size, void (*func)(any_t*, any_t*, int)) { // Read memory barrier needed for SMP here in theory do { Modified: mplayerxp/fifo.h =================================================================== --- mplayerxp/fifo.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/fifo.h 2012-10-17 11:27:01 UTC (rev 166) @@ -82,7 +82,7 @@ * @param *func generic read function * @param *dest data destination */ -int cb_fifo_generic_read(CBFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); +int cb_fifo_generic_read(CBFifoBuffer *f, any_t*dest, int buf_size, void (*func)(any_t*, any_t*, int)); /** * Feeds data from a user-supplied callback to an CBFifoBuffer. @@ -96,7 +96,7 @@ * If func is NULL, src is interpreted as a simple byte array for source data. * @return the number of bytes written to the FIFO */ -int cb_fifo_generic_write(CBFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); +int cb_fifo_generic_write(CBFifoBuffer *f, any_t*src, int size, int (*func)(any_t*, any_t*, int)); /** * Resizes an CBFifoBuffer. Modified: mplayerxp/input/input.c =================================================================== --- mplayerxp/input/input.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/input/input.c 2012-10-17 11:27:01 UTC (rev 166) @@ -356,7 +356,7 @@ typedef struct mp_input_fd { int fd; - void* read_func; + any_t* read_func; mp_close_func_t close_func; int flags; // This fields are for the cmd fds @@ -368,7 +368,7 @@ struct mp_cmd_filter_st { mp_input_cmd_filter filter; - void* ctx; + any_t* ctx; mp_cmd_filter_t* next; }; @@ -762,7 +762,7 @@ void -mp_input_add_cmd_filter(mp_input_cmd_filter func, void* ctx) { +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*/; filter->filter = func; Modified: mplayerxp/input/input.h =================================================================== --- mplayerxp/input/input.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/input/input.h 2012-10-17 11:27:01 UTC (rev 166) @@ -105,7 +105,7 @@ int i; float f; char* s; - void* v; + any_t* v; } mp_cmd_arg_value_t; typedef struct mp_cmd_arg { @@ -144,7 +144,7 @@ // Set this to grab all incoming key code extern void (*mp_input_key_cb)(int code); // Should return 1 if the command was processed -typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, void* ctx); +typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, any_t* ctx); // This function add a new key driver. // The first arg is a file descriptor (use a negative value if you don't use any fd) @@ -186,7 +186,7 @@ /// These filter allow you to process the command before mplayer /// If a filter return a true value mp_input_get_cmd will return NULL void -mp_input_add_cmd_filter(mp_input_cmd_filter, void* ctx); +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 // function Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/ao_alsa9.c 2012-10-17 11:27:01 UTC (rev 166) @@ -744,10 +744,10 @@ return 1; /* ok, data should be accepted again */ } -static unsigned __FASTCALL__ play_normal(void* data, unsigned len); -static unsigned __FASTCALL__ play_mmap(void* data, unsigned len); +static unsigned __FASTCALL__ play_normal(any_t* data, unsigned len); +static unsigned __FASTCALL__ play_mmap(any_t* data, unsigned len); -static unsigned __FASTCALL__ play(void* data, unsigned len, unsigned flags) +static unsigned __FASTCALL__ play(any_t* data, unsigned len, unsigned flags) { unsigned result; UNUSED(flags); @@ -764,7 +764,7 @@ thanxs for marius <ma...@ro...> for giving us the light ;) */ -static unsigned __FASTCALL__ play_normal(void* data, unsigned len) +static unsigned __FASTCALL__ play_normal(any_t* data, unsigned len) { //alsa.bytes_per_sample is always 4 for 2 chn S16_LE unsigned num_frames = len / alsa.bytes_per_sample; @@ -779,7 +779,7 @@ } while (num_frames > 0) { - res = snd_pcm_writei(alsa.handler, (void *)output_samples, num_frames); + res = snd_pcm_writei(alsa.handler, (any_t*)output_samples, num_frames); if (res == -EAGAIN) { snd_pcm_wait(alsa.handler, 1000); } else if (res == -EPIPE) { /* underrun */ @@ -817,12 +817,12 @@ * 'An overview of the ALSA API' http://people.debian.org/~joshua/x66.html * and some help by Paul Davis <pb...@op...> */ -static unsigned __FASTCALL__ play_mmap(void* data, unsigned len) +static unsigned __FASTCALL__ play_mmap(any_t* data, unsigned len) { snd_pcm_sframes_t commitres, frames_available; snd_pcm_uframes_t frames_transmit, size, offset; const snd_pcm_channel_area_t *area; - void *outbuffer; + any_t*outbuffer; unsigned result; #ifdef USE_POLL //seems not really be needed Modified: mplayerxp/libao2/ao_arts.c =================================================================== --- mplayerxp/libao2/ao_arts.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/ao_arts.c 2012-10-17 11:27:01 UTC (rev 166) @@ -139,7 +139,7 @@ arts_free(); } -static unsigned play(void* data,unsigned len,unsigned flags) +static unsigned play(any_t* data,unsigned len,unsigned flags) { UNUSED(flags); return arts_write(stream, data, len); Modified: mplayerxp/libao2/ao_esd.c =================================================================== --- mplayerxp/libao2/ao_esd.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/ao_esd.c 2012-10-17 11:27:01 UTC (rev 166) @@ -317,7 +317,7 @@ * it should round it down to outburst*n * return: number of bytes played */ -static unsigned play(void* data, unsigned len, unsigned flags) +static unsigned play(any_t* data, unsigned len, unsigned flags) { unsigned offs; unsigned nwritten; Modified: mplayerxp/libao2/ao_jack.c =================================================================== --- mplayerxp/libao2/ao_jack.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/ao_jack.c 2012-10-17 11:27:01 UTC (rev 166) @@ -99,7 +99,7 @@ int pos; }; -static void deinterleave(void *info, void *src, int len) { +static void deinterleave(any_t*info, any_t*src, int len) { struct deinterleave *di = info; float *s = src; int i; @@ -165,7 +165,7 @@ * * Write silence into buffers if paused or an underrun occured */ -static int outputaudio(jack_nframes_t nframes, void *arg) { +static int outputaudio(jack_nframes_t nframes, any_t*arg) { float *bufs[MAX_CHANS]; unsigned i; UNUSED(arg); @@ -355,7 +355,7 @@ /** * \brief write data into buffer and reset underrun flag */ -static unsigned play(void *data, unsigned len, unsigned flags) { +static unsigned play(any_t*data, unsigned len, unsigned flags) { underrun = 0; UNUSED(flags); return write_buffer(data, len); Modified: mplayerxp/libao2/ao_nas.c =================================================================== --- mplayerxp/libao2/ao_nas.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/ao_nas.c 2012-10-17 11:27:01 UTC (rev 166) @@ -208,7 +208,7 @@ return num; } -static int nas_writeBuffer(struct ao_nas_data *nas_data, void *data, unsigned int len) +static int nas_writeBuffer(struct ao_nas_data *nas_data, any_t*data, unsigned int len) { pthread_mutex_lock(&nas_data->buffer_mutex); MSG_DBG2("ao_nas: nas_writeBuffer(): len=%d client=%d/%d server=%d/%d\n", @@ -239,7 +239,7 @@ return result; } -static void *nas_event_thread_start(void *data) +static any_t*nas_event_thread_start(any_t*data) { struct ao_nas_data *nas_data = data; @@ -591,7 +591,7 @@ // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static unsigned play(void* data,unsigned len,unsigned flags) +static unsigned play(any_t* data,unsigned len,unsigned flags) { unsigned written, maxbursts = 0, playbursts = 0; AuStatus as; Modified: mplayerxp/libao2/ao_null.c =================================================================== --- mplayerxp/libao2/ao_null.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/ao_null.c 2012-10-17 11:27:01 UTC (rev 166) @@ -206,7 +206,7 @@ // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static unsigned __FASTCALL__ play(void* data,unsigned len,unsigned flags) +static unsigned __FASTCALL__ play(any_t* data,unsigned len,unsigned flags) { unsigned maxbursts = (ao_data.buffersize - null.buffer) / ao_data.outburst; unsigned playbursts = len / ao_data.outburst; Modified: mplayerxp/libao2/ao_openal.c =================================================================== --- mplayerxp/libao2/ao_openal.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/ao_openal.c 2012-10-17 11:27:01 UTC (rev 166) @@ -231,7 +231,7 @@ /** * \brief write data into buffer and reset underrun flag */ -static unsigned play(void *data, unsigned len, unsigned flags) { +static unsigned play(any_t*data, unsigned len, unsigned flags) { ALint state; unsigned i, j, k; unsigned ch; Modified: mplayerxp/libao2/ao_oss.c =================================================================== --- mplayerxp/libao2/ao_oss.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/ao_oss.c 2012-10-17 11:27:01 UTC (rev 166) @@ -306,7 +306,7 @@ if(ao_data.buffersize==0){ // Measuring buffer size: - void* data; + any_t* data; ao_data.buffersize=0; #ifdef HAVE_AUDIO_SELECT data=malloc(ao_data.outburst); memset(data,0,ao_data.outburst); @@ -418,7 +418,7 @@ // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static unsigned __FASTCALL__ play(void* data,unsigned len,unsigned flags){ +static unsigned __FASTCALL__ play(any_t* data,unsigned len,unsigned flags){ UNUSED(flags); len/=ao_data.outburst; len=write(oss.fd,data,len*ao_data.outburst); Modified: mplayerxp/libao2/ao_sdl.c =================================================================== --- mplayerxp/libao2/ao_sdl.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/ao_sdl.c 2012-10-17 11:27:01 UTC (rev 166) @@ -135,7 +135,7 @@ } // SDL Callback function -static void outputaudio(void *unused, Uint8 *stream, int len) { +static void outputaudio(any_t*unused, Uint8 *stream, int len) { UNUSED(unused); read_buffer(stream, len); } @@ -204,7 +204,7 @@ aspec.samples = SAMPLESIZE; /* This should be set to a function that will be called when the audio device is ready for more data. It is passed a pointer to the audio sdl.buffer, and the length in bytes of the audio sdl.buffer. This function usually runs in a separate thread, and so you should protect data structures that it accesses by calling SDL_LockAudio and SDL_UnlockAudio in your code. The callback prototype is: -void callback(void *userdata, Uint8 *stream, int len); userdata is the pointer stored in userdata field of the SDL_AudioSpec. stream is a pointer to the audio sdl.buffer you want to fill with information and len is the length of the audio sdl.buffer in bytes. */ +void callback(any_t*userdata, Uint8 *stream, int len); userdata is the pointer stored in userdata field of the SDL_AudioSpec. stream is a pointer to the audio sdl.buffer you want to fill with information and len is the length of the audio sdl.buffer in bytes. */ aspec.callback = outputaudio; /* This pointer is passed as the first parameter to the callback function. */ @@ -308,7 +308,7 @@ // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static unsigned __FASTCALL__ play(void* data,unsigned len,unsigned flags) +static unsigned __FASTCALL__ play(any_t* data,unsigned len,unsigned flags) { UNUSED(flags); #if 0 Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/ao_wav.c 2012-10-17 11:27:01 UTC (rev 166) @@ -220,7 +220,7 @@ // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static unsigned play(void* data,unsigned len,unsigned flags){ +static unsigned play(any_t* data,unsigned len,unsigned flags){ UNUSED(flags); fwrite(data,len,1,wav.fp); if(wav.pcm_waveheader) Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/audio_out.c 2012-10-17 11:27:01 UTC (rev 166) @@ -243,7 +243,7 @@ return ao_inited?audio_out->get_delay():0; } -unsigned __FASTCALL__ ao_play(void* data,unsigned len,unsigned flags) +unsigned __FASTCALL__ ao_play(any_t* data,unsigned len,unsigned flags) { return ao_inited?audio_out->play(data,len,flags):0; } Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/audio_out.h 2012-10-17 11:27:01 UTC (rev 166) @@ -52,7 +52,7 @@ * @param flags currently unused * return number of bytes which were copied into audio card **/ - unsigned (* __FASTCALL__ play)(void* data,unsigned len,unsigned flags); + unsigned (* __FASTCALL__ play)(any_t* data,unsigned len,unsigned flags); /** Returns delay in seconds between first and last sample in buffer **/ float (*get_delay)(void); @@ -113,7 +113,7 @@ extern void ao_uninit(void); extern void ao_reset(void); extern unsigned ao_get_space(void); -extern unsigned __FASTCALL__ ao_play(void* data,unsigned len,unsigned flags); +extern unsigned __FASTCALL__ ao_play(any_t* data,unsigned len,unsigned flags); extern float ao_get_delay(void); extern void ao_pause(void); extern void ao_resume(void); Modified: mplayerxp/libao2/audio_out_internal.h =================================================================== --- mplayerxp/libao2/audio_out_internal.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libao2/audio_out_internal.h 2012-10-17 11:27:01 UTC (rev 166) @@ -7,7 +7,7 @@ static void uninit(void); static void reset(void); static unsigned get_space(void); -static unsigned __FASTCALL__ play(void* data,unsigned len,unsigned flags); +static unsigned __FASTCALL__ play(any_t* data,unsigned len,unsigned flags); static float get_delay(void); static void audio_pause(void); static void audio_resume(void); Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad.h 2012-10-17 11:27:01 UTC (rev 166) @@ -34,7 +34,7 @@ int (*preinit)(sh_audio_t *); int (*init)(sh_audio_t *sh); void (*uninit)(sh_audio_t *sh); - int (*control)(sh_audio_t *sh,int cmd,void* arg, ...); + int (*control)(sh_audio_t *sh,int cmd,any_t* arg, ...); unsigned (*decode_audio)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); } ad_functions_t; Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-10-17 11:27:01 UTC (rev 166) @@ -193,7 +193,7 @@ free(sh->context); } -int control(sh_audio_t *sh,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_acm.c 2012-10-17 11:27:01 UTC (rev 166) @@ -158,7 +158,7 @@ free(sh->context); } -int control(sh_audio_t *sh_audio,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_dca.c 2012-10-17 11:27:01 UTC (rev 166) @@ -194,7 +194,7 @@ free(sh->context); } -int control(sh_audio_t *sh,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_dmo.c 2012-10-17 11:27:01 UTC (rev 166) @@ -71,7 +71,7 @@ free(priv); } -static int control(sh_audio_t *sh_audio,int cmd,void* arg, ...) +static int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_dshow.c 2012-10-17 11:27:01 UTC (rev 166) @@ -62,7 +62,7 @@ free(priv); } -int control(sh_audio_t *sh_audio,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_dvdpcm.c 2012-10-17 11:27:01 UTC (rev 166) @@ -72,7 +72,7 @@ UNUSED(sh); } -int control(sh_audio_t *sh,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_faad.c 2012-10-17 11:27:01 UTC (rev 166) @@ -3,6 +3,7 @@ * (c)2002 by Felix Buenemann <atmosfear at users.sourceforge.net> * File licensed under the GPL, see http://www.fsf.org/ for more info. */ +#include "mp_config.h" #include <stdio.h> #include <stdlib.h> @@ -40,7 +41,7 @@ float pts; }faad_priv_t; -typedef void *NeAACDecHandle; +typedef any_t*NeAACDecHandle; typedef struct NeAACDecConfiguration { unsigned char defObjectType; @@ -122,7 +123,7 @@ static void (*NEAACDECAPI NeAACDecClose_ptr)(NeAACDecHandle hDecoder); #define NeAACDecClose(a) (*NeAACDecClose_ptr)(a) -static void* (*NEAACDECAPI NeAACDecDecode_ptr)(NeAACDecHandle hDecoder, +static any_t* (*NEAACDECAPI NeAACDecDecode_ptr)(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, unsigned char *buffer, unsigned long buffer_size); @@ -135,7 +136,7 @@ static NeAACDecHandle NeAAC_hdec; static NeAACDecFrameInfo NeAAC_finfo; -static void *dll_handle; +static any_t*dll_handle; static int load_dll(const char *libname) { if(!(dll_handle=ld_codec(libname,mpcodecs_ad_faad.info->url))) return 0; @@ -266,7 +267,7 @@ free(sh->context); } -static int control(sh_audio_t *sh,int cmd,void* arg, ...) +static int control(sh_audio_t *sh,int cmd,any_t* arg, ...) { UNUSED(sh); UNUSED(cmd); @@ -279,7 +280,7 @@ faad_priv_t *priv=sh->context; int j = 0; unsigned len = 0; - void *NeAAC_sample_buffer; + any_t*NeAAC_sample_buffer; UNUSED(maxlen); while(len < minlen) { Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-17 11:27:01 UTC (rev 166) @@ -146,7 +146,7 @@ acodec_inited=0; } -int control(sh_audio_t *sh,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-17 11:27:01 UTC (rev 166) @@ -202,7 +202,7 @@ mpcodecs_ad_a52.uninit(sh); } -int control(sh_audio_t *sh,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_internal.h 2012-10-17 11:27:01 UTC (rev 166) @@ -16,7 +16,7 @@ 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,void* arg, ...); +static int control(sh_audio_t *sh,int cmd,any_t* arg, ...); static unsigned decode_audio(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 = {\ Modified: mplayerxp/libmpcodecs/ad_libdv.c =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_libdv.c 2012-10-17 11:27:01 UTC (rev 166) @@ -77,7 +77,7 @@ free(priv->audioBuffers[i]); } -static int control(sh_audio_t *sh,int cmd,void* arg, ...) +static int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-17 11:27:01 UTC (rev 166) @@ -216,7 +216,7 @@ #define mpg123_tell_stream(a) (*mpg123_tell_stream_ptr)(a) -static void *dll_handle; +static any_t*dll_handle; static int load_dll(const char *libname) { if(!(dll_handle=ld_codec(libname,mpcodecs_ad_mp3.info->url))) return 0; @@ -346,7 +346,7 @@ dlclose(dll_handle); } -int control(sh_audio_t *sh,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_null.c 2012-10-17 11:27:01 UTC (rev 166) @@ -34,7 +34,7 @@ UNUSED(sh); } -int control(sh_audio_t *sh,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_pcm.c 2012-10-17 11:27:01 UTC (rev 166) @@ -67,7 +67,7 @@ UNUSED(sh); } -int control(sh_audio_t *sh,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-17 11:27:01 UTC (rev 166) @@ -49,20 +49,20 @@ typedef int (__cdecl* LPFUNC2)(const SoundComponentData *, const SoundComponentData *,SoundConverter *); typedef int (__cdecl* LPFUNC3)(SoundConverter sc); typedef int (__cdecl* LPFUNC4)(void); -typedef int (__cdecl* LPFUNC5)(SoundConverter sc, OSType selector,void * infoPtr); +typedef int (__cdecl* LPFUNC5)(SoundConverter sc, OSType selector,any_t* infoPtr); typedef int (__cdecl* LPFUNC6)(SoundConverter sc, unsigned long inputBytesTarget, unsigned long *inputFrames, unsigned long *inputBytes, unsigned long *outputBytes ); typedef int (__cdecl* LPFUNC7)(SoundConverter sc, - const void *inputPtr, + const any_t*inputPtr, unsigned long inputFrames, - void *outputPtr, + any_t*outputPtr, unsigned long *outputFrames, unsigned long *outputBytes ); typedef int (__cdecl* LPFUNC8)(SoundConverter sc, - void *outputPtr, + any_t*outputPtr, unsigned long *outputFrames, unsigned long *outputBytes); typedef int (__cdecl* LPFUNC9)(SoundConverter sc); @@ -324,7 +324,7 @@ return ConvertedBytes; } -static int control(sh_audio_t *sh,int cmd,void* arg, ...){ +static int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_real.c 2012-10-17 11:27:01 UTC (rev 166) @@ -24,30 +24,30 @@ LIBAD_EXTERN(real) -static void *handle=NULL; +static any_t*handle=NULL; -void *__builtin_new(unsigned long size) { +any_t*__builtin_new(unsigned long size) { return malloc(size); } /* required for cook's uninit: */ -void __builtin_delete(void* ize) { +void __builtin_delete(any_t* ize) { free(ize); } #if defined(__FreeBSD__) || defined(__NetBSD__) -void* __ctype_b=NULL; +any_t* __ctype_b=NULL; #endif static uint32_t (*raCloseCodec)(uint32_t); -static uint32_t (*raDecode)(void*,void*,uint32_t,void*,void*,uint32_t); +static uint32_t (*raDecode)(any_t*,any_t*,uint32_t,any_t*,any_t*,uint32_t); static uint32_t (*raFreeDecoder)(uint32_t); -static void* (*raGetFlavorProperty)(void*,uint32_t,uint32_t,void*); +static any_t* (*raGetFlavorProperty)(any_t*,uint32_t,uint32_t,any_t*); //static uint32_t (*raGetNumberOfFlavors2)(void); -static uint32_t (*raInitDecoder)(void*,void*); -static uint32_t (*raOpenCodec2)(void*,void*); -static uint32_t (*raOpenCodec)(void*); -static uint32_t (*raSetFlavor)(void*,uint32_t); +static uint32_t (*raInitDecoder)(any_t*,any_t*); +static uint32_t (*raOpenCodec2)(any_t*,any_t*); +static uint32_t (*raOpenCodec)(any_t*); +static uint32_t (*raSetFlavor)(any_t*,uint32_t); static void (*raSetDLLAccessPath)(uint32_t); static void (*raSetPwd)(char*,char*); @@ -60,11 +60,11 @@ int bits_per_frame; int packetsize; int extradata_len; - void* extradata; + any_t* extradata; } ra_init_t; typedef struct { - void *internal; + any_t*internal; float pts; } real_priv_t; @@ -73,7 +73,7 @@ // (you should do that if you use external lib(s) which is optional) unsigned int result; int len=0; - void* prop; + any_t* prop; char path[4096]; char cpath[4096]; real_priv_t *rpriv; @@ -281,7 +281,7 @@ // or -1 for EOF (or uncorrectable error) } -static int control(sh_audio_t *sh,int cmd,void* arg, ...){ +static int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_twin.c 2012-10-17 11:27:01 UTC (rev 166) @@ -105,7 +105,7 @@ /* EBC info */ int *bc[ N_CH_MAX ]; - void *manager; + any_t*manager; } INDEX; /***********************************************/ @@ -350,7 +350,7 @@ FreeLibrary(vqf_dll); } -int control(sh_audio_t *sh_audio,int cmd,void* arg, ...) +int 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-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-17 11:27:01 UTC (rev 166) @@ -121,7 +121,7 @@ free(sh->context); } -static int control(sh_audio_t *sh,int cmd,void* arg, ...) +static int control(sh_audio_t *sh,int cmd,any_t* arg, ...) { UNUSED(sh); UNUSED(cmd); Modified: mplayerxp/libmpcodecs/codecs_ld.c =================================================================== --- mplayerxp/libmpcodecs/codecs_ld.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/codecs_ld.c 2012-10-17 11:27:01 UTC (rev 166) @@ -12,9 +12,9 @@ #define MSGT_CLASS MSGT_GLOBAL #include "../__mp_msg.h" -void * ld_codec(const char *name,const char *url_hint) +any_t* ld_codec(const char *name,const char *url_hint) { - void *dll_handle; + any_t*dll_handle; if(!(dll_handle=dlopen(name,RTLD_LAZY|RTLD_GLOBAL))) { MSG_FATAL(MSGTR_CODEC_CANT_LOAD_DLL,name,dlerror()); @@ -36,18 +36,18 @@ } #endif -void * ld_sym(void *handle,const char *sym_name) +any_t* ld_sym(any_t*handle,const char *sym_name) { - void *rval; + any_t*rval; if(!(rval=dlsym(handle,sym_name))) { MSG_ERR(MSGTR_CODEC_DLL_SYM_ERR,sym_name); } return rval; } -void * ld_aliased_sym(void *handle,const char *sym_name,...) +any_t* ld_aliased_sym(any_t*handle,const char *sym_name,...) { - void *rval=dlsym(handle,sym_name); + any_t*rval=dlsym(handle,sym_name); if(!rval) { const char *alias; va_list list; Modified: mplayerxp/libmpcodecs/codecs_ld.h =================================================================== --- mplayerxp/libmpcodecs/codecs_ld.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/codecs_ld.h 2012-10-17 11:27:01 UTC (rev 166) @@ -5,11 +5,13 @@ #ifndef __CODECS_LD #define __CODECS_LD -extern void * ld_codec(const char *name,const char *url_hint); +#include "mp_config.h" + +extern any_t* ld_codec(const char *name,const char *url_hint); /*extern char * codec_name( const char *name );*/ -extern void * ld_sym(void *handle,const char *sym_name); -extern void * ld_aliased_sym(void *handle,const char *sym_name,...); +extern any_t* ld_sym(any_t*handle,const char *sym_name); +extern any_t* ld_aliased_sym(any_t*handle,const char *sym_name,...); #if defined(__OpenBSD__) && !defined(__ELF__) #define dlsym(h,s) ld_sym(h, "_" s) #endif Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-10-17 11:27:01 UTC (rev 166) @@ -191,7 +191,7 @@ *out_samplerate=afs->output.rate; *out_channels=afs->output.nch; - *out_format=af_format_encode((void*)(&afs->output)); + *out_format=af_format_encode((any_t*)(&afs->output)); sh_audio->af_bps = afs->output.rate*afs->output.nch*afs->output.bps; @@ -199,7 +199,7 @@ afs->output.bps, afs->output.nch, afs->output.rate, fmt2str(afs->output.format,afs->output.bps,strbuf,200)); - sh_audio->afilter=(void*)afs; + sh_audio->afilter=(any_t*)afs; return 1; } @@ -247,7 +247,7 @@ sh_audio->a_buffer_len=0; af_showconf(afs->first); - sh_audio->afilter=(void*)afs; + sh_audio->afilter=(any_t*)afs; sh_audio->afilter_inited=1; return 1; } Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-17 11:27:01 UTC (rev 166) @@ -55,7 +55,7 @@ void set_video_quality(sh_video_t *sh_video,int quality){ if(mpvdec) - mpvdec->control(sh_video,VDCTRL_SET_PP_LEVEL, (void*)(&quality)); + mpvdec->control(sh_video,VDCTRL_SET_PP_LEVEL, (any_t*)(&quality)); } int set_video_colors(sh_video_t *sh_video,char *item,int value) Modified: mplayerxp/libmpcodecs/liba52/a52.h =================================================================== --- mplayerxp/libmpcodecs/liba52/a52.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/liba52/a52.h 2012-10-17 11:27:01 UTC (rev 166) @@ -24,6 +24,8 @@ #ifndef A52_H #define A52_H +#include "mp_config.h" + #ifndef LIBA52_DOUBLE typedef float sample_t; #else @@ -55,12 +57,12 @@ extern int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, sample_t * level, sample_t bias); extern void a52_dynrng (a52_state_t * state, - sample_t (* call) (sample_t, void *), void * data); + sample_t (* call) (sample_t, any_t*), any_t* data); extern int a52_block (a52_state_t * state); extern void a52_free (a52_state_t * state); extern uint16_t crc16_block(uint8_t *data,uint32_t num_bytes); -extern void* a52_resample_init_float(a52_state_t * state,uint32_t mm_accel,int flags,int chans); -extern void* a52_resample_init(a52_state_t * state,uint32_t mm_accel,int flags,int chans); +extern any_t* a52_resample_init_float(a52_state_t * state,uint32_t mm_accel,int flags,int chans); +extern any_t* a52_resample_init(a52_state_t * state,uint32_t mm_accel,int flags,int chans); extern int (* a52_resample) (float * _f, int16_t * s16); extern int (* a52_resample32) (float * _f, float * s16); Modified: mplayerxp/libmpcodecs/liba52/a52_internal.h =================================================================== --- mplayerxp/libmpcodecs/liba52/a52_internal.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/liba52/a52_internal.h 2012-10-17 11:27:01 UTC (rev 166) @@ -46,8 +46,8 @@ int dynrnge; /* apply dynamic range */ sample_t dynrng; /* dynamic range */ - void * dynrngdata; /* dynamic range callback funtion and data */ - sample_t (* dynrngcall) (sample_t range, void * dynrngdata); + any_t* dynrngdata; /* dynamic range callback funtion and data */ + sample_t (* dynrngcall) (sample_t range, any_t* dynrngdata); uint8_t chincpl; /* channel coupled */ uint8_t phsflginu; /* phase flags in use (stereo only) */ Modified: mplayerxp/libmpcodecs/liba52/parse.c =================================================================== --- mplayerxp/libmpcodecs/liba52/parse.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/liba52/parse.c 2012-10-17 11:27:01 UTC (rev 166) @@ -35,7 +35,7 @@ #ifdef HAVE_MEMALIGN /* some systems have memalign() but no declaration for it */ -void * memalign (size_t align, size_t size); +any_t* memalign (size_t align, size_t size); #else /* assume malloc alignment is sufficient */ #define memalign(align,size) malloc (size) @@ -207,7 +207,7 @@ } void a52_dynrng (a52_state_t * state, - sample_t (* call) (sample_t, void *), void * data) + sample_t (* call) (sample_t, any_t*), any_t* data) { state->dynrnge = 0; if (call) { Modified: mplayerxp/libmpcodecs/liba52/resample.c =================================================================== --- mplayerxp/libmpcodecs/liba52/resample.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/liba52/resample.c 2012-10-17 11:27:01 UTC (rev 166) @@ -22,8 +22,8 @@ #include "resample_mmx.c" #endif -void* a52_resample_init(a52_state_t * state,uint32_t mm_accel,int flags,int chans){ -void* tmp; +any_t* a52_resample_init(a52_state_t * state,uint32_t mm_accel,int flags,int chans){ +any_t* tmp; #ifdef CAN_COMPILE_MMX if(mm_accel&MM_ACCEL_X86_MMX){ @@ -47,8 +47,8 @@ return NULL; } -void* a52_resample_init_float(a52_state_t * state,uint32_t mm_accel,int flags,int chans){ -void* tmp; +any_t* a52_resample_init_float(a52_state_t * state,uint32_t mm_accel,int flags,int chans){ +any_t* tmp; #if 0 //#if defined( ARCH_X86 ) || defined(ARCH_X86_64) if(mm_accel&MM_ACCEL_X86_MMX){ Modified: mplayerxp/libmpcodecs/liba52/resample_c.c =================================================================== --- mplayerxp/libmpcodecs/liba52/resample_c.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/liba52/resample_c.c 2012-10-17 11:27:01 UTC (rev 166) @@ -143,7 +143,7 @@ } -static void* a52_resample_C(a52_state_t * state,int flags, int ch){ +static any_t* a52_resample_C(a52_state_t * state,int flags, int ch){ bias=state->bias; level=state->level; switch (flags) { @@ -312,7 +312,7 @@ return 6*256; } -static void* a52_resample_f32(a52_state_t * state,int flags, int ch){ +static any_t* a52_resample_f32(a52_state_t * state,int flags, int ch){ bias=state->bias; level=state->level; switch (flags) { Modified: mplayerxp/libmpcodecs/liba52/resample_mmx.c =================================================================== --- mplayerxp/libmpcodecs/liba52/resample_mmx.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/liba52/resample_mmx.c 2012-10-17 11:27:01 UTC (rev 166) @@ -555,7 +555,7 @@ } -static void* a52_resample_MMX(a52_state_t * state,int flags, int ch){ +static any_t* a52_resample_MMX(a52_state_t * state,int flags, int ch){ switch (flags) { case A52_MONO: if(ch==5) return a52_resample_MONO_to_5_MMX; Modified: mplayerxp/libmpcodecs/libdca/dca.h =================================================================== --- mplayerxp/libmpcodecs/libdca/dca.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/libdca/dca.h 2012-10-17 11:27:01 UTC (rev 166) @@ -23,6 +23,8 @@ #ifndef DCA_H #define DCA_H +#include "mp_config.h" + /* x86 accelerations */ #define MM_ACCEL_X86_MMX 0x80000000 #define MM_ACCEL_X86_3DNOW 0x40000000 @@ -70,13 +72,13 @@ extern int dca_frame (dca_state_t * state, uint8_t * buf, int * flags, level_t * level, sample_t bias); extern void dca_dynrng (dca_state_t * state, - level_t (* call) (level_t, void *), void * data); + level_t (* call) (level_t, any_t*), any_t* data); extern int dca_blocks_num (dca_state_t * state); extern int dca_block (dca_state_t * state); extern sample_t * dca_samples (dca_state_t * state); extern void dca_free (dca_state_t * state); -extern void* dca_resample_init(dca_state_t * state,uint32_t mm_accel,int flags,int chans); -extern void* dca_resample_init_float(dca_state_t * state,uint32_t mm_accel,int flags,int chans); +extern any_t* dca_resample_init(dca_state_t * state,uint32_t mm_accel,int flags,int chans); +extern any_t* dca_resample_init_float(dca_state_t * state,uint32_t mm_accel,int flags,int chans); extern int (*dca_resample) (float * _f, int16_t * s16); extern int (*dca_resample32) (float * _f, float * s16); Modified: mplayerxp/libmpcodecs/libdca/dca_internal.h =================================================================== --- mplayerxp/libmpcodecs/libdca/dca_internal.h 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/libdca/dca_internal.h 2012-10-17 11:27:01 UTC (rev 166) @@ -129,8 +129,8 @@ int dynrnge; /* apply dynamic range */ level_t dynrng; /* dynamic range */ - void * dynrngdata; /* dynamic range callback funtion and data */ - level_t (* dynrngcall) (level_t range, void * dynrngdata); + any_t* dynrngdata; /* dynamic range callback funtion and data */ + level_t (* dynrngcall) (level_t range, any_t* dynrngdata); /* Bitstream handling */ uint32_t * buffer_start; Modified: mplayerxp/libmpcodecs/libdca/parse.c =================================================================== --- mplayerxp/libmpcodecs/libdca/parse.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/libdca/parse.c 2012-10-17 11:27:01 UTC (rev 166) @@ -49,7 +49,7 @@ #if defined(HAVE_MEMALIGN) && !defined(__cplusplus) /* some systems have memalign() but no declaration for it */ -void * memalign (size_t align, size_t size); +any_t* memalign (size_t align, size_t size); #else /* assume malloc alignment is sufficient */ #define memalign(align,size) malloc (size) @@ -1281,7 +1281,7 @@ } void dca_dynrng (dca_state_t * state, - level_t (* call) (level_t, void *), void * data) + level_t (* call) (level_t, any_t*), any_t* data) { state->dynrange = 0; if (call) { Modified: mplayerxp/libmpcodecs/libdca/resample.c =================================================================== --- mplayerxp/libmpcodecs/libdca/resample.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/libdca/resample.c 2012-10-17 11:27:01 UTC (rev 166) @@ -22,8 +22,8 @@ #include "resample_mmx.c" #endif -void* dca_resample_init(dca_state_t * state,uint32_t mm_accel,int flags,int chans){ -void* tmp; +any_t* dca_resample_init(dca_state_t * state,uint32_t mm_accel,int flags,int chans){ +any_t* tmp; #ifdef CAN_COMPILE_MMX if(mm_accel&MM_ACCEL_X86_MMX){ @@ -47,8 +47,8 @@ return NULL; } -void* dca_resample_init_float(dca_state_t * state,uint32_t mm_accel,int flags,int chans){ -void* tmp; +any_t* dca_resample_init_float(dca_state_t * state,uint32_t mm_accel,int flags,int chans){ +any_t* tmp; #if 0 //#if defined( ARCH_X86 ) || defined(ARCH_X86_64) if(mm_accel&MM_ACCEL_X86_MMX){ Modified: mplayerxp/libmpcodecs/libdca/resample_c.c =================================================================== --- mplayerxp/libmpcodecs/libdca/resample_c.c 2012-10-16 17:42:50 UTC (rev 165) +++ mplayerxp/libmpcodecs/libdca/resample_c.c 2012-10-17 11:27:01 UTC (rev 166) @@ -143,7 +143,7 @@ } -static void* dca_resample_C(dca_state_t * state,int flags, int ch){ +static any_t* dca_resample_C(dca_state_t * state,int flags, int ch){ bias=state->bias; level=state->level; switch (flags) { @@ -312,7 +312,7 @@ return 6*256; } -static void* dca_resample_f32(dca_state_t * state,int flags, int ch){ +static any_t* dca_resample_f32(dca_state_t * state,int flags, int ch){ bias=state->bias; level=state->level; switch (flags) { Modified: mplayerxp/libmpcodecs/libdca/resample_mmx.c =================================================================== --- mplayerxp/libmpcodecs/libdca/resample_mmx.c 2012-10-16 17:42:... [truncated message content] |
From: <nic...@us...> - 2012-10-18 13:17:02
|
Revision: 169 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=169&view=rev Author: nickols_k Date: 2012-10-18 13:16:54 +0000 (Thu, 18 Oct 2012) Log Message: ----------- remove old mp09_decore+single-buffering. Abandon single-thread support to simplify internal logic of code. XP-modes only are available from now Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/dec_ahead.h mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.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/vosub_vidix.c mplayerxp/mplayer.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/cfg-mplayer.h 2012-10-18 13:16:54 UTC (rev 169) @@ -107,13 +107,10 @@ static const config_t xpcore_config[]={ {"xp", &enable_xp, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL, "starts MPlayerXP in multi-thread and multi-buffer XP mode"}, - {"noxp", &enable_xp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "starts MPlayerXP in single-thread mode"}, {"dump", &stream_dump, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies dump type and name for the dump of stream"}, {"gomp", &enable_gomp, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables usage of OpenMP extensions"}, {"nogomp", &enable_gomp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables usage of OpenMP extensions"}, {"da_buffs", &vo.da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, NULL, "specifies number of buffers for decoding-ahead in XP mode"}, - {"double", &vo.doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables double-buffering for single-thread decoding"}, - {"nodouble", &vo.doublebuffering, CONF_TYPE_FLAG, 0, 1, 0, NULL, "enables single-buffer for single-thread decoding"}, {"cache", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, NULL,"specifies amount of memory for precaching a file/URL"}, {"nocache", &stream_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL,"disables precaching a file/URL"}, {"autoq", &auto_quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "dynamically changes the level of postprocessing depending on spare CPU time available"}, Modified: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/dec_ahead.h 2012-10-18 13:16:54 UTC (rev 169) @@ -20,7 +20,7 @@ enum seek_states { NoSeek=0, PreSeek, Seek }; -enum xp_modes { XP_None=0, XP_Video, XP_VideoAudio, XP_VAPlay, XP_VAFull }; +enum xp_modes { XP_Old=0, XP_Video, XP_VideoAudio, XP_VAPlay, XP_VAFull }; extern pthread_mutex_t vdec_active_mutex; /* it's related with video decoding (main process) */ extern pthread_mutex_t vdec_locked_mutex; /* it's related with video decoding (thread) */ Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/libvo/video_out.c 2012-10-18 13:16:54 UTC (rev 169) @@ -176,7 +176,6 @@ memset(&dri,0,sizeof(dri_priv_t)); dri.nframes=1; memset(&vo,0,sizeof(vo_priv_t)); - vo.doublebuffering=1; vo.movie_aspect=-1.0; vo.flip=-1; vo.da_buffs=64; @@ -691,12 +690,10 @@ void vo_change_frame(void) { MSG_DBG2("dri_vo_dbg: vo_change_frame [dri.active_frame=%u]\n",dri.active_frame); - if(vo.doublebuffering || (dri.cap.caps & DRI_CAP_VIDEO_MMAPED)!=DRI_CAP_VIDEO_MMAPED) - { - video_out->change_frame(dri.active_frame); - dri.active_frame = (dri.active_frame+1)%dri.nframes; - if(!dri.has_thread) dri.xp_frame = (dri.xp_frame+1)%dri.nframes; - } + + video_out->change_frame(dri.active_frame); + dri.active_frame = (dri.active_frame+1)%dri.nframes; + if(!dri.has_thread) dri.xp_frame = (dri.xp_frame+1)%dri.nframes; } void vo_flush_pages(void) @@ -709,56 +706,56 @@ /* DRAW OSD */ -static void __FASTCALL__ clear_rect(unsigned y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) +static void __FASTCALL__ clear_rect(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) { unsigned i; for(i=0;i<h;i++) { - if(y0+i<dri.cap.y||y0+i>=dri.cap.y+dri.cap.h) memset(dest,filler,stride); + if(_y0+i<dri.cap.y||_y0+i>=dri.cap.y+dri.cap.h) memset(dest,filler,stride); dest += dstride; } } -static void __FASTCALL__ clear_rect2(unsigned y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) +static void __FASTCALL__ clear_rect2(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) { unsigned i; unsigned y1 = dri.cap.y/2; unsigned y2 = (dri.cap.y+dri.cap.h)/2; for(i=0;i<h;i++) { - if(y0+i<y1||y0+i>=y2) memset(dest,filler,stride); + if(_y0+i<y1||_y0+i>=y2) memset(dest,filler,stride); dest += dstride; } } -static void __FASTCALL__ clear_rect4(unsigned y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) +static void __FASTCALL__ clear_rect4(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride,uint8_t filler) { unsigned i; unsigned y1 = dri.cap.y/4; unsigned y2 = (dri.cap.y+dri.cap.h)/4; for(i=0;i<h;i++) { - if(y0+i<y1||y0+i>=y2) memset(dest,filler,stride); + if(_y0+i<y1||_y0+i>=y2) memset(dest,filler,stride); dest += dstride; } } -static void __FASTCALL__ clear_rect_rgb(unsigned y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) +static void __FASTCALL__ clear_rect_rgb(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) { unsigned i; for(i=0;i<h;i++) { - if(y0+i<dri.cap.y||y0+i>=dri.cap.y+dri.cap.h) memset(dest,0,stride); + if(_y0+i<dri.cap.y||_y0+i>=dri.cap.y+dri.cap.h) memset(dest,0,stride); dest += dstride; } } -static void __FASTCALL__ clear_rect_yuy2(unsigned y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) +static void __FASTCALL__ clear_rect_yuy2(unsigned _y0,unsigned h,uint8_t *dest,unsigned stride,unsigned dstride) { unsigned i; for(i=0;i<h;i++) { - if(y0+i<dri.cap.y||y0+i>=dri.cap.y+dri.cap.h) + if(_y0+i<dri.cap.y||_y0+i>=dri.cap.y+dri.cap.h) { uint32_t *dst32; unsigned j,size32; @@ -773,9 +770,9 @@ } } -static void __FASTCALL__ dri_remove_osd(int x0,int y0, int w,int h) +static void __FASTCALL__ dri_remove_osd(int x0,int _y0, int w,int h) { - if(x0+w<=dri.cap.width&&y0+h<=dri.cap.height) + if(x0+w<=dri.cap.width&&_y0+h<=dri.cap.height) switch(dri.cap.fourcc) { case IMGFMT_RGB15: @@ -786,39 +783,39 @@ case IMGFMT_BGR24: case IMGFMT_RGB32: case IMGFMT_BGR32: - clear_rect_rgb( y0,h,dri.surf[dri.active_frame].planes[0]+y0*dri.cap.strides[0]+x0*((dri.bpp+7)/8), + clear_rect_rgb( _y0,h,dri.surf[dri.active_frame].planes[0]+_y0*dri.cap.strides[0]+x0*((dri.bpp+7)/8), w*(dri.bpp+7)/8,dri.cap.strides[0]); break; case IMGFMT_YVYU: case IMGFMT_YUY2: - clear_rect_yuy2( y0,h,dri.surf[dri.active_frame].planes[0]+y0*dri.cap.strides[0]+x0*2, + clear_rect_yuy2( _y0,h,dri.surf[dri.active_frame].planes[0]+_y0*dri.cap.strides[0]+x0*2, w*2,dri.cap.strides[0]); break; case IMGFMT_UYVY: - clear_rect_yuy2( y0,h,dri.surf[dri.active_frame].planes[0]+y0*dri.cap.strides[0]+x0*2+1, + clear_rect_yuy2( _y0,h,dri.surf[dri.active_frame].planes[0]+_y0*dri.cap.strides[0]+x0*2+1, w*2,dri.cap.strides[0]); break; case IMGFMT_Y800: - clear_rect( y0,h,dri.surf[dri.active_frame].planes[0]+y0*dri.cap.strides[0]+x0, + clear_rect( _y0,h,dri.surf[dri.active_frame].planes[0]+_y0*dri.cap.strides[0]+x0, w,dri.cap.strides[0],0x10); break; case IMGFMT_YV12: case IMGFMT_I420: case IMGFMT_IYUV: - clear_rect( y0,h,dri.surf[dri.active_frame].planes[0]+y0*dri.cap.strides[0]+x0, + clear_rect( _y0,h,dri.surf[dri.active_frame].planes[0]+_y0*dri.cap.strides[0]+x0, w,dri.cap.strides[0],0x10); - clear_rect2( y0/2,h/2,dri.surf[dri.active_frame].planes[1]+y0/2*dri.cap.strides[1]+x0/2, + clear_rect2( _y0/2,h/2,dri.surf[dri.active_frame].planes[1]+_y0/2*dri.cap.strides[1]+x0/2, w/2,dri.cap.strides[1],0x80); - clear_rect2( y0/2,h/2,dri.surf[dri.active_frame].planes[2]+y0/2*dri.cap.strides[2]+x0/2, + clear_rect2( _y0/2,h/2,dri.surf[dri.active_frame].planes[2]+_y0/2*dri.cap.strides[2]+x0/2, w/2,dri.cap.strides[2],0x80); break; case IMGFMT_YVU9: case IMGFMT_IF09: - clear_rect( y0,h,dri.surf[dri.active_frame].planes[0]+y0*dri.cap.strides[0]+x0, + clear_rect( _y0,h,dri.surf[dri.active_frame].planes[0]+_y0*dri.cap.strides[0]+x0, w,dri.cap.strides[0],0x10); - clear_rect4( y0/4,h/4,dri.surf[dri.active_frame].planes[1]+y0/4*dri.cap.strides[1]+x0/4, + clear_rect4( _y0/4,h/4,dri.surf[dri.active_frame].planes[1]+_y0/4*dri.cap.strides[1]+x0/4, w/4,dri.cap.strides[1],0x80); - clear_rect4( y0/4,h/4,dri.surf[dri.active_frame].planes[2]+y0/4*dri.cap.strides[2]+x0/4, + clear_rect4( _y0/4,h/4,dri.surf[dri.active_frame].planes[2]+_y0/4*dri.cap.strides[2]+x0/4, w/4,dri.cap.strides[2],0x80); break; } @@ -857,15 +854,15 @@ return NULL; } -static void __FASTCALL__ dri_draw_osd(int x0,int y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) +static void __FASTCALL__ dri_draw_osd(int x0,int _y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride) { int finalize=vo_is_final(); - if(x0+w<=dri.cap.width&&y0+h<=dri.cap.height) + if(x0+w<=dri.cap.width&&_y0+h<=dri.cap.height) { if(!draw_alpha) draw_alpha=get_draw_alpha(dri.cap.fourcc); if(draw_alpha) (*draw_alpha)(w,h,src,srca,stride, - dri.surf[dri.active_frame].planes[0]+dri.cap.strides[0]*y0+x0*((dri.bpp+7)/8), + dri.surf[dri.active_frame].planes[0]+dri.cap.strides[0]*_y0+x0*((dri.bpp+7)/8), dri.cap.strides[0],finalize); } } Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/libvo/video_out.h 2012-10-18 13:16:54 UTC (rev 169) @@ -244,7 +244,6 @@ vo_rect_t prev; - int doublebuffering; int vsync; int fs; int fsmode; Modified: mplayerxp/libvo/vo_dga.c =================================================================== --- mplayerxp/libvo/vo_dga.c 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/libvo/vo_dga.c 2012-10-18 13:16:54 UTC (rev 169) @@ -746,8 +746,6 @@ vo_dga.dbf_mem_offset[0] = 0; dest_frame_size = vo_dga.width*HW_MODE.vdm_bytespp*vo_dga.vp_height; - if(vo.doublebuffering) - { vo_dga.num_buffers = (ram_size*1024)/dest_frame_size; if(vo_dga.num_buffers > vo.da_buffs) vo_dga.num_buffers = vo.da_buffs; if(vo_dga.num_buffers > MAX_DRI_BUFFERS) vo_dga.num_buffers = MAX_DRI_BUFFERS; @@ -757,7 +755,7 @@ vo_dga.dbf_y_offset[freq] = vo_dga.dbf_y_offset[freq-1] + vo_dga.vp_height; vo_dga.dbf_mem_offset[freq] = vo_dga.dbf_mem_offset[freq-1] + dest_frame_size; } - } + /* clear screen */ for(freq=0;freq<vo_dga.num_buffers;freq++) { Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/libvo/vo_fbdev.c 2012-10-18 13:16:54 UTC (rev 169) @@ -1107,7 +1107,7 @@ MSG_DBG2(FBDEV "fb.L123123875 @ %p\n", fb.L123123875); MSG_V(FBDEV "pixel per fb.line: %d\n", fb.line_len / fb.pixel_size); - fb.total_fr=vo.doublebuffering?vo.da_buffs:1; + fb.total_fr=vo.da_buffs; for(i=0;i<fb.total_fr;i++) if (!(fb.next_frame[i] = (uint8_t *) malloc(fb.out_width * fb.out_height * fb.pixel_size))) { MSG_ERR(FBDEV "Can't malloc fb.next_frame: %s\n", strerror(errno)); Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/libvo/vo_opengl.c 2012-10-18 13:16:54 UTC (rev 169) @@ -181,7 +181,7 @@ if( flags&0x02 ) vm = 1; #endif vo.flip=flags&VOFLAG_FLIPPING; - vogl.num_buffers=vo.doublebuffering?vo.da_buffs:1; + vogl.num_buffers=vo.da_buffs; aspect_save_screenres(vo.screenwidth,vo.screenheight); Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/libvo/vo_sdl.c 2012-10-18 13:16:54 UTC (rev 169) @@ -760,7 +760,7 @@ { struct sdl_priv_s *priv = &sdl_priv; unsigned i,retval; - priv->num_buffs=vo.doublebuffering?vo.da_buffs:1; + priv->num_buffs=vo.da_buffs; #ifdef CONFIG_VIDIX if(!vidix_name) { Modified: mplayerxp/libvo/vo_vesa.c =================================================================== --- mplayerxp/libvo/vo_vesa.c 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/libvo/vo_vesa.c 2012-10-18 13:16:54 UTC (rev 169) @@ -324,19 +324,14 @@ int y_res = priv.vmode_info.YResolution; int x, y; - for (y = 0; y < y_res; ++y) - { - for (x = 0; x < x_res; ++x) - { + for (y = 0; y < y_res; ++y) { + for (x = 0; x < x_res; ++x) { int r, g, b; - if ((x & 16) ^ (y & 16)) - { + if ((x & 16) ^ (y & 16)) { r = x * 255 / x_res; g = y * 255 / y_res; b = 255 - x * 255 / x_res; - } - else - { + } else { r = 255 - x * 255 / x_res; g = y * 255 / y_res; b = 255 - y * 255 / y_res; @@ -420,25 +415,21 @@ priv.srcW = priv.dstW = width; priv.srcH = priv.dstH = height; fs_mode = 0; - if(priv.subdev_flags == 0xFFFFFFFEUL) - { - MSG_ERR("vo_vesa: detected internal fatal error: init is called before preinit\n"); - return -1; + if(priv.subdev_flags == 0xFFFFFFFEUL) { + MSG_ERR("vo_vesa: detected internal fatal error: init is called before preinit\n"); + return -1; } if(priv.subdev_flags == 0xFFFFFFFFUL) return -1; - if(flags & 0x8) - { - MSG_WARN("vo_vesa: switch -flip is not supported\n"); + if(flags & 0x8) { + MSG_WARN("vo_vesa: switch -flip is not supported\n"); } if(flags & 0x04) use_scaler = 1; - if(flags & 0x01) - { - if(use_scaler) use_scaler = 2; - else fs_mode = 1; - } + if(flags & 0x01) { + if(use_scaler) use_scaler = 2; + else fs_mode = 1; + } memcpy(vib.VESASignature,"VBE2",4); - if((err=vbeGetControllerInfo(&vib)) != VBE_OK) - { + if((err=vbeGetControllerInfo(&vib)) != VBE_OK) { PRINT_VBE_ERR("vbeGetControllerInfo",err); MSG_FATAL("vo_vesa: possible reason: No VBE2 BIOS found\n"); return -1; @@ -468,8 +459,7 @@ num_modes = 0; mode_ptr = vib.VideoModePtr; while(*mode_ptr++ != 0xffff) num_modes++; - switch(format) - { + switch(format) { case IMGFMT_BGR8: case IMGFMT_RGB8: bpp = 8; break; case IMGFMT_BGR15: @@ -485,8 +475,7 @@ priv.srcBpp = bpp; priv.srcFourcc = format; if(vo.dbpp) bpp = vo.dbpp; - switch(bpp) - { + switch(bpp) { case 8: priv.dstFourcc = IMGFMT_BGR8; break; @@ -506,21 +495,18 @@ priv.dstFourcc = IMGFMT_BGR16; break; } - if(verbose) - { + if(verbose) { MSG_V("vo_vesa: Requested mode: %ux%u@%u (%s)\n",width,height,bpp,vo_format_name(format)); MSG_V("vo_vesa: Total modes found: %u\n",num_modes); mode_ptr = vib.VideoModePtr; MSG_V("vo_vesa: Mode list:"); - for(i = 0;i < num_modes;i++) - { - MSG_V(" %04X",mode_ptr[i]); + for(i = 0;i < num_modes;i++) { + MSG_V(" %04X",mode_ptr[i]); } MSG_V("\nvo_vesa: Modes in detail:\n"); } mode_ptr = vib.VideoModePtr; - if(use_scaler) - { + if(use_scaler) { priv.dstW = d_width; priv.dstH = d_height; } @@ -528,29 +514,24 @@ else w = max(priv.dstW,width); if(vo.screenheight) h = vo.screenheight; else h = max(priv.dstH,height); - for(i=0;i < num_modes;i++) - { - if((err=vbeGetModeInfo(mode_ptr[i],&vmib)) != VBE_OK) - { + for(i=0;i < num_modes;i++) { + if((err=vbeGetModeInfo(mode_ptr[i],&vmib)) != VBE_OK) { PRINT_VBE_ERR("vbeGetModeInfo",err); return -1; } if(vmib.XResolution >= w && vmib.YResolution >= h && (vmib.ModeAttributes & MOVIE_MODE) == MOVIE_MODE && - vmib.BitsPerPixel == bpp) - { + vmib.BitsPerPixel == bpp) { if((bpp > 8 && vmib.MemoryModel == memRGB) || bpp < 15) if(vmib.XResolution <= best_x && - vmib.YResolution <= best_y) - { + vmib.YResolution <= best_y) { best_x = vmib.XResolution; best_y = vmib.YResolution; best_mode_idx = i; } } - if(verbose) - { + if(verbose) { MSG_V("vo_vesa: Mode (%03u): mode=%04X %ux%u@%u attr=%04X\n" "vo_vesa: #planes=%u model=%u(%s) #pages=%u\n" "vo_vesa: winA=%X(attr=%u) winB=%X(attr=%u) winSize=%u winGran=%u\n" @@ -565,18 +546,15 @@ fflush(stdout); } } - if(best_mode_idx != UINT_MAX) - { + if(best_mode_idx != UINT_MAX) { priv.video_mode = vib.VideoModePtr[best_mode_idx]; fflush(stdout); - if((err=vbeGetMode(&priv.init_mode)) != VBE_OK) - { + if((err=vbeGetMode(&priv.init_mode)) != VBE_OK) { PRINT_VBE_ERR("vbeGetMode",err); return -1; } MSG_V("vo_vesa: Initial video mode: %x\n",priv.init_mode); - if((err=vbeGetModeInfo(priv.video_mode,&priv.vmode_info)) != VBE_OK) - { + if((err=vbeGetModeInfo(priv.video_mode,&priv.vmode_info)) != VBE_OK) { PRINT_VBE_ERR("vbeGetModeInfo",err); return -1; } @@ -585,19 +563,14 @@ ,best_mode_idx,priv.video_mode,priv.vmode_info.XResolution ,priv.vmode_info.YResolution,priv.dstBpp); if(priv.subdev_flags & SUBDEV_NODGA) priv.vmode_info.PhysBasePtr = 0; - if(use_scaler || fs_mode) - { + if(use_scaler || fs_mode) { /* software scale */ - if(use_scaler > 1) - { + if(use_scaler > 1) { aspect_save_orig(width,height); aspect_save_prescale(d_width,d_height); aspect_save_screenres(priv.vmode_info.XResolution,priv.vmode_info.YResolution); aspect(&priv.dstW,&priv.dstH,A_ZOOM); - } - else - if(fs_mode) - { + } else if(fs_mode) { priv.dstW = priv.vmode_info.XResolution; priv.dstH = priv.vmode_info.YResolution; } @@ -610,16 +583,14 @@ priv.win.idx = 1; /* frame B */ else priv.win.idx = -2; /* Try use DGA instead */ - if(priv.vmode_info.PhysBasePtr && vib.TotalMemory && (priv.vmode_info.ModeAttributes & MODE_ATTR_LINEAR)) - { + if(priv.vmode_info.PhysBasePtr && vib.TotalMemory && (priv.vmode_info.ModeAttributes & MODE_ATTR_LINEAR)) { any_t*lfb; unsigned long vsize; vsize = vib.TotalMemory*64*1024; lfb = vbeMapVideoBuffer(priv.vmode_info.PhysBasePtr,vsize); if(lfb == NULL) MSG_WARN("vo_vesa: Can't use DGA. Force bank switching mode. :(\n"); - else - { + else { priv.video_base = priv.win.ptr = lfb; priv.win.low = 0UL; priv.win.high = vsize; @@ -631,26 +602,22 @@ MSG_V(" at %08lXh",(unsigned long)lfb); MSG_V("\n"); if(!(priv.multi_size = fillMultiBuffer(vsize,vo.da_buffs))) return -1; - if(vo.doublebuffering && priv.multi_size < 2) + if(priv.multi_size < 2) MSG_ERR("vo_vesa: Can't use double buffering: not enough video memory\n"); else - MSG_V("vo_vesa: using %u buffers for multi buffering\n",priv.multi_size); + MSG_V("vo_vesa: using %u buffers for multi buffering\n",priv.multi_size); } } - if(priv.win.idx == -2) - { + if(priv.win.idx == -2) { MSG_ERR("vo_vesa: Can't find neither DGA nor relocatable window's frame.\n"); return -1; } - if(!HAS_DGA()) - { - if(priv.subdev_flags & SUBDEV_FORCEDGA) - { + if(!HAS_DGA()) { + if(priv.subdev_flags & SUBDEV_FORCEDGA) { MSG_ERR("vo_vesa: you've forced DGA. Exiting\n"); return -1; } - if(!(win_seg = priv.win.idx == 0 ? priv.vmode_info.WinASegment:priv.vmode_info.WinBSegment)) - { + if(!(win_seg = priv.win.idx == 0 ? priv.vmode_info.WinASegment:priv.vmode_info.WinBSegment)) { MSG_ERR("vo_vesa: Can't find valid window address\n"); return -1; } @@ -670,33 +637,28 @@ ,priv.dstW,priv.dstH ,priv.vmode_info.XResolution,priv.vmode_info.YResolution ,priv.x_offset,priv.y_offset); - if(HAS_DGA()) - { + if(HAS_DGA()) { priv.dga_buffer = priv.win.ptr; /* Trickly ;) */ cpy_blk_fnc = __vbeCopyBlockFast; } - else - { + else { cpy_blk_fnc = __vbeCopyBlock; #ifdef CONFIG_VIDIX if(!priv.vidix_name) #endif { - if(!(priv.dga_buffer = memalign(64,priv.vmode_info.XResolution*priv.vmode_info.YResolution*priv.dstBpp))) - { + if(!(priv.dga_buffer = memalign(64,priv.vmode_info.XResolution*priv.vmode_info.YResolution*priv.dstBpp))) { MSG_ERR("vo_vesa: Can't allocate temporary buffer\n"); return -1; } MSG_V("vo_vesa: dga emulator was allocated = %p\n",priv.dga_buffer); } } - if((err=vbeSaveState(&priv.init_state)) != VBE_OK) - { + if((err=vbeSaveState(&priv.init_state)) != VBE_OK) { PRINT_VBE_ERR("vbeSaveState",err); return -1; } - if((err=vbeSetMode(priv.video_mode,NULL)) != VBE_OK) - { + if((err=vbeSetMode(priv.video_mode,NULL)) != VBE_OK) { PRINT_VBE_ERR("vbeSetMode",err); return -1; } @@ -704,51 +666,41 @@ /* Below 'return -1' is impossible */ MSG_V("vo_vesa: Graphics mode was activated\n"); #ifdef CONFIG_VIDIX - if(priv.vidix_name) - { + if(priv.vidix_name) { if(vidix_init(width,height,priv.x_offset,priv.y_offset,priv.dstW, priv.dstH,format,priv.dstBpp, - priv.vmode_info.XResolution,priv.vmode_info.YResolution,info) != 0) - { + priv.vmode_info.XResolution,priv.vmode_info.YResolution,info) != 0) { MSG_ERR("vo_vesa: Can't initialize VIDIX driver\n"); priv.vidix_name = NULL; vesa_term(); return -1; } else MSG_V("vo_vesa: Using VIDIX\n"); - if(vidix_start()!=0) - { + if(vidix_start()!=0) { vesa_term(); return -1; } } #endif } - else - { + else { MSG_ERR("vo_vesa: Can't find mode for: %ux%u@%u\n",width,height,bpp); return -1; } MSG_V("vo_vesa: VESA initialization complete\n"); - if(HAS_DGA() && vo.doublebuffering) - { - for(i=0;i<priv.multi_size;i++) - { + if(HAS_DGA()) { + for(i=0;i<priv.multi_size;i++) { priv.win.ptr = priv.dga_buffer = priv.video_base + priv.multi_buff[i]; if(verbose>1) paintBkGnd(); else clear_screen_fast(); } - } - else - { + } else { + int x; if(verbose>1) paintBkGnd(); else clear_screen(); - { - int x; - x = (priv.vmode_info.XResolution/priv.vmode_info.XCharSize)/2-strlen(title)/2; - if(x < 0) x = 0; - vbeWriteString(x,0,7,title); - } + x = (priv.vmode_info.XResolution/priv.vmode_info.XCharSize)/2-strlen(title)/2; + if(x < 0) x = 0; + vbeWriteString(x,0,7,title); } return 0; } Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/libvo/vo_x11.c 2012-10-18 13:16:54 UTC (rev 169) @@ -133,7 +133,7 @@ UNUSED(info); - vox11.num_buffers=vo.doublebuffering?vo.da_buffs:1; + vox11.num_buffers=vo.da_buffs; if (!title) title = strdup("MPlayerXP X11 (XImage/Shm) render"); Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/libvo/vo_xv.c 2012-10-18 13:16:54 UTC (rev 169) @@ -335,7 +335,7 @@ if( flags&0x02 ) vm = 1; #endif voxv.flip_flag=flags&VOFLAG_FLIPPING; - voxv.num_buffers=vo.doublebuffering?vo.da_buffs:1; + voxv.num_buffers=vo.da_buffs; aspect_save_screenres(vo.screenwidth,vo.screenheight); Modified: mplayerxp/libvo/vosub_vidix.c =================================================================== --- mplayerxp/libvo/vosub_vidix.c 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/libvo/vosub_vidix.c 2012-10-18 13:16:54 UTC (rev 169) @@ -425,7 +425,7 @@ priv.play->dest.y = y_org; priv.play->dest.w = dst_width; priv.play->dest.h = dst_height; - priv.play->num_frames=(vo.doublebuffering && vo.use_bm != 1)?NUM_FRAMES-1:1; + priv.play->num_frames=(vo.use_bm!=1)?NUM_FRAMES-1:1; if(priv.play->num_frames > vo.da_buffs) priv.play->num_frames = vo.da_buffs; priv.play->src.pitch.y = priv.play->src.pitch.u = priv.play->src.pitch.v = 0; if(info) Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-18 11:32:55 UTC (rev 168) +++ mplayerxp/mplayer.c 2012-10-18 13:16:54 UTC (rev 169) @@ -648,96 +648,91 @@ void uninit_player(unsigned int mask){ - fflush(stdout); - fflush(stderr); - mask=inited_flags&mask; + fflush(stdout); + fflush(stderr); + mask=inited_flags&mask; - if(enable_xp!=XP_None) - { pinfo[xp_id].current_module="uninit_xp"; uninit_dec_ahead(0); - } - if (mask&INITED_SPUDEC){ - inited_flags&=~INITED_SPUDEC; - pinfo[xp_id].current_module="uninit_spudec"; - spudec_free(vo.spudec); - vo.spudec=NULL; - } + if (mask&INITED_SPUDEC){ + inited_flags&=~INITED_SPUDEC; + pinfo[xp_id].current_module="uninit_spudec"; + spudec_free(vo.spudec); + vo.spudec=NULL; + } - if (mask&INITED_VOBSUB){ - inited_flags&=~INITED_VOBSUB; - pinfo[xp_id].current_module="uninit_vobsub"; - vobsub_close(vo.vobsub); - vo.vobsub=NULL; - } + if (mask&INITED_VOBSUB){ + inited_flags&=~INITED_VOBSUB; + pinfo[xp_id].current_module="uninit_vobsub"; + vobsub_close(vo.vobsub); + vo.vobsub=NULL; + } - if(mask&INITED_VCODEC){ - inited_flags&=~INITED_VCODEC; - pinfo[xp_id].current_module="uninit_vcodec"; - uninit_video(sh_video); - sh_video=NULL; - } + if(mask&INITED_VCODEC){ + inited_flags&=~INITED_VCODEC; + pinfo[xp_id].current_module="uninit_vcodec"; + uninit_video(sh_video); + sh_video=NULL; + } - if(mask&INITED_VO){ - inited_flags&=~INITED_VO; - pinfo[xp_id].current_module="uninit_vo"; - vo_uninit(); - } + if(mask&INITED_VO){ + inited_flags&=~INITED_VO; + pinfo[xp_id].current_module="uninit_vo"; + vo_uninit(); + } - if(mask&INITED_ACODEC){ - inited_flags&=~INITED_ACODEC; - pinfo[xp_id].current_module="uninit_acodec"; - uninit_audio(sh_audio); - sh_audio=NULL; - } + if(mask&INITED_ACODEC){ + inited_flags&=~INITED_ACODEC; + pinfo[xp_id].current_module="uninit_acodec"; + uninit_audio(sh_audio); + sh_audio=NULL; + } - if(mask&INITED_AO){ - inited_flags&=~INITED_AO; - pinfo[xp_id].current_module="uninit_ao"; - ao_uninit(); - } + if(mask&INITED_AO){ + inited_flags&=~INITED_AO; + pinfo[xp_id].current_module="uninit_ao"; + ao_uninit(); + } - if(mask&INITED_GETCH2){ - inited_flags&=~INITED_GETCH2; - pinfo[xp_id].current_module="uninit_getch2"; - // restore terminal: - getch2_disable(); - } + if(mask&INITED_GETCH2){ + inited_flags&=~INITED_GETCH2; + pinfo[xp_id].current_module="uninit_getch2"; + // restore terminal: + getch2_disable(); + } - if(mask&INITED_DEMUXER){ - inited_flags&=~INITED_DEMUXER; - pinfo[xp_id].current_module="free_demuxer"; - FREE_DEMUXER(demuxer); - } + if(mask&INITED_DEMUXER){ + inited_flags&=~INITED_DEMUXER; + pinfo[xp_id].current_module="free_demuxer"; + FREE_DEMUXER(demuxer); + } - if(mask&INITED_STREAM){ - inited_flags&=~INITED_STREAM; - pinfo[xp_id].current_module="uninit_stream"; - if(stream) free_stream(stream); - stream=NULL; - } + if(mask&INITED_STREAM){ + inited_flags&=~INITED_STREAM; + pinfo[xp_id].current_module="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_input_uninit(); - } + if(mask&INITED_INPUT){ + inited_flags&=~INITED_INPUT; + pinfo[xp_id].current_module="uninit_input"; + mp_input_uninit(); + } #ifdef USE_SUB - if(mask&INITED_SUBTITLE){ - inited_flags&=~INITED_SUBTITLE; - pinfo[xp_id].current_module="sub_free"; - mp_input_uninit(); - sub_free( subtitles ); - sub_name=NULL; - vo.sub=NULL; - subtitles=NULL; - } + if(mask&INITED_SUBTITLE){ + inited_flags&=~INITED_SUBTITLE; + pinfo[xp_id].current_module="sub_free"; + mp_input_uninit(); + sub_free( subtitles ); + sub_name=NULL; + vo.sub=NULL; + subtitles=NULL; + } #endif - - pinfo[xp_id].current_module=NULL; - + pinfo[xp_id].current_module=NULL; } void exit_player(char* how){ @@ -786,19 +781,13 @@ void killall_threads(pthread_t pth_id) { - if(enable_xp > XP_None) - { - 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); - } + 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); } - enable_xp=XP_None; - } + } } void __exit_sighandler(void) @@ -1264,260 +1253,6 @@ } } -int mp09_decore_video( int rtc_fd, video_stat_t *vstat, float *aq_sleep_time, float *v_pts ) -{ -/*========================== PLAY VIDEO ============================*/ - - static float next_frame_time=0; - static int frame_time_remaining=0; // flag - static int dropped_frames=0; // how many frames dropped since last non-dropped frame - static int drop_frame=0; // current dropping status - static int total_frame_cnt=0; - static unsigned int lastframeout_ts=0; - float frame_time=next_frame_time; - float time_frame=0; - float AV_delay=0; // average of A-V timestamp differences - float time_frame_corr_avg=0; - int blit_frame=0; - int delay_corrected=1; - vo.pts=sh_video->timer*90000.0; - vo.fps=sh_video->fps; - - if(!frame_time_remaining){ - //-------------------- Decode a frame: ----------------------- - while(1) - { unsigned char* start=NULL; - int in_size; - float v_pts; - // get it! - pinfo[xp_id].current_module="video_read_frame"; - in_size=video_read_frame(sh_video,&next_frame_time,&v_pts,&start,force_fps); - if(in_size<0) return 1; - if(in_size>max_framesize) max_framesize=in_size; // stats - sh_video->timer+=frame_time; - time_frame+=frame_time; // for nosound - // check for frame-drop: - pinfo[xp_id].current_module="check_framedrop"; - if(sh_audio && !d_audio->eof){ - float delay=ao_get_delay(); - float d=(sh_video->timer)-(sh_audio->timer-delay); - // we should avoid dropping to many frames in sequence unless we - // are too late. and we allow 100ms A-V delay here: - if(d<-dropped_frames*frame_time-0.100){ - drop_frame=frame_dropping; - ++vstat->drop_frame_cnt; - ++dropped_frames; - } else { - drop_frame=dropped_frames=0; - } - ++total_frame_cnt; - } - // decode: - pinfo[xp_id].current_module="decode_video"; - blit_frame=decode_video(sh_video,start,in_size,drop_frame,v_pts); - break; - } - //------------------------ frame decoded. -------------------- - - MSG_DBG2("*** ftime=%5.3f ***\n",frame_time); - - } - -// ========================================================================== - - pinfo[xp_id].current_module="draw_osd"; - vo_draw_osd(); - - pinfo[xp_id].current_module="calc_sleep_time"; - -#if 0 -{ // debug frame dropping code - float delay=ao_get_delay(); - MSG_V("\r[V] %5.3f [A] %5.3f => {%5.3f} (%5.3f) [%d] \n", - sh_video->timer,sh_audio->timer-delay, - sh_video->timer-(sh_audio->timer-delay), - delay,drop_frame); -} -#endif - - if(drop_frame && !frame_time_remaining){ - - time_frame=0; // don't sleep! - blit_frame=0; // don't display! - - } else { - - // It's time to sleep... - - frame_time_remaining=0; - time_frame-=GetRelativeTime(); // reset timer - - if(sh_audio && !d_audio->eof){ - float delay=ao_get_delay(); - MSG_DBG2("delay=%f\n",delay); - if(!dapsync){ - /* Arpi's AV-sync */ - time_frame=sh_video->timer; - time_frame-=sh_audio->timer-delay; - } else { // if(!dapsync) - /* DaP's AV-sync */ - float SH_AV_delay; - /* SH_AV_delay = sh_video->timer - (sh_audio->timer - (float)((float)delay + sh_audio->a_buffer_len) / (float)sh_audio->af_bps); */ - SH_AV_delay = sh_video->timer - (sh_audio->timer - (float)((float)delay) / (float)sh_audio->af_bps); - if(SH_AV_delay<-2*frame_time){ - static int drop_message=0; - drop_frame=frame_dropping; // tricky! - ++vstat->drop_frame_cnt; - if(vstat->drop_frame_cnt>50 && AV_delay>0.5 && !drop_message){ - drop_message=1; - if(mpxp_after_seek) mpxp_after_seek--; - else { - MSG_WARN(MSGTR_SystemTooSlow); - } - } - MSG_INFO("A-V SYNC: FRAMEDROP (SH_AV_delay=%.3f)!\n", SH_AV_delay); - MSG_DBG2("\nframe drop %d, %.2f\n", drop_frame, time_frame); - /* go into unlimited-TF cycle */ - time_frame = SH_AV_delay; - } else { -#define SL_CORR_AVG_LEN 125 - /* don't adjust under framedropping */ - time_frame_corr_avg = (time_frame_corr_avg * (SL_CORR_AVG_LEN - 1) + - (SH_AV_delay - time_frame)) / SL_CORR_AVG_LEN; -#define UNEXP_CORR_MAX 0.1 /* limit of unexpected correction between two frames (percentage) */ -#define UNEXP_CORR_WARN 1.0 /* warn limit of A-V lag (percentage) */ - time_frame += time_frame_corr_avg; - if (SH_AV_delay - time_frame < (frame_time + time_frame_corr_avg) * UNEXP_CORR_MAX && - SH_AV_delay - time_frame > (frame_time + time_frame_corr_avg) * -UNEXP_CORR_MAX) - time_frame = SH_AV_delay; - else { - if (SH_AV_delay - time_frame > (frame_time + time_frame_corr_avg) * UNEXP_CORR_WARN || - SH_AV_delay - time_frame < (frame_time + time_frame_corr_avg) * -UNEXP_CORR_WARN) - MSG_WARN( "WARNING: A-V SYNC LAG TOO LARGE: %.3f {%.3f - %.3f} (too little UNEXP_CORR_MAX?)\n", - SH_AV_delay - time_frame, SH_AV_delay, time_frame); - time_frame += (frame_time + time_frame_corr_avg) * ((SH_AV_delay > time_frame) ? - UNEXP_CORR_MAX : -UNEXP_CORR_MAX); - } - } /* /start dropframe */ - - } // if(dapsync) - - if(delay>0.25) delay=0.25; else - if(delay<0.10) delay=0.10; - if(time_frame>delay*0.6){ - // sleep time too big - may cause audio drops (buffer underrun) - frame_time_remaining=1; - time_frame=delay*0.5; - } - } else { - // NOSOUND: - if( (time_frame<-3*frame_time || time_frame>3*frame_time) || benchmark) - time_frame=0; - } - (*aq_sleep_time)+=time_frame; - } // !drop_frame - -//============================== SLEEP: =================================== - -// flag 256 means: libvo driver does its timing (dvb card) -if(time_frame>0.001 && !(vo.flags&256)){ - pinfo[xp_id].current_module="sleep_usleep"; - time_frame=SleepTime(rtc_fd,softsleep,time_frame); -} - -//if(!frame_time_remaining){ // should we display the frame now? - -//====================== FLIP PAGE (VIDEO BLT): ========================= - - pinfo[xp_id].current_module="change_frame1"; - - vo_check_events(); /* check events AST */ - if(blit_frame && !frame_time_remaining){ - unsigned int t2=GetTimer(); - double tt; - float j; -#define FRAME_LAG_WARN 0.2 - j = ((float)t2 - lastframeout_ts) / 1000000; - lastframeout_ts = GetTimer(); - if (j < frame_time + frame_time * -FRAME_LAG_WARN) - vstat->too_fast_frame_cnt++; - /* printf ("PANIC: too fast frame (%.3f)!\n", j); */ - else if (j > frame_time + frame_time * FRAME_LAG_WARN) - vstat->too_slow_frame_cnt++; - /* printf ("PANIC: too slow frame (%.3f)!\n", j); */ - - vo_change_frame(); -// usec_sleep(50000); // test only! - t2=GetTimer()-t2; - tt = t2*0.000001f; - vout_time_usage+=tt; - if(benchmark) - { - /* we need compute draw_slice+change_frame here */ - cur_vout_time_usage+=tt; - if(cur_vout_time_usage > max_vout_time_usage) max_vout_time_usage = cur_vout_time_usage; - if(cur_vout_time_usage < min_vout_time_usage) min_vout_time_usage = cur_vout_time_usage; - if((cur_video_time_usage + cur_vout_time_usage + cur_audio_time_usage)*vo.fps > 1) - bench_dropped_frames ++; - } - } - -//====================== A-V TIMESTAMP CORRECTION: ========================= - - pinfo[xp_id].current_module="av_sync"; - - if(sh_audio){ - float a_pts=0; - - // unplayed bytes in our and soundcard/dma buffer: - float delay=ao_get_delay()+(float)sh_audio->a_buffer_len/(float)sh_audio->af_bps; - - if(pts_from_bps){ - // PTS = sample_no / samplerate - 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(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - } - *v_pts=d_video->pts; - - MSG_DBG2("### A:%8.3f (%8.3f) V:%8.3f A-V:%7.4f \n",a_pts,a_pts-audio_delay-delay,*v_pts,(a_pts-delay-audio_delay)-*v_pts); - - if(delay_corrected){ - float x; - AV_delay=(a_pts-delay-audio_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 - max_pts_correction=sh_video->frametime*0.10; // +-10% of time - if(!frame_time_remaining){ sh_audio->timer+=x; c_total+=x;} // correction - if(benchmark) MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d %d\r", - a_pts-audio_delay-delay,*v_pts,AV_delay,c_total, - (int)sh_video->num_frames,(int)sh_video->num_frames_decoded, - (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0, - (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0, - (sh_video->timer>0.5)?(100.0*audio_time_usage/(double)sh_video->timer):0 - ,vstat->drop_frame_cnt - ,output_quality - ); - fflush(stdout); - } - } - /* let it paints audio timer instead of video */ - if(sh_audio) *v_pts = sh_audio->timer-ao_get_delay(); - return 0; -} - static void __show_status_line(float a_pts,float video_pts,float delay,float AV_delay,video_stat_t *vstat) { MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d %d [frms: [%i]]\n", a_pts-audio_delay-delay,video_pts,AV_delay,c_total, @@ -1586,7 +1321,7 @@ int info_factor; }osd_args_t; -int xp_decore_video( int rtc_fd, video_stat_t *vstat, float *aq_sleep_time, float *v_pts ) +int mpxp_play_video( int rtc_fd, video_stat_t *vstat, float *aq_sleep_time, float *v_pts ) { float time_frame=0; float AV_delay=0; /* average of A-V timestamp differences */ @@ -1822,104 +1557,100 @@ void mpxp_seek( int _xp_id, video_stat_t *vstat, osd_args_t *osd,float v_pts,const seek_args_t* seek) { - int seek_rval=1; - audio_eof=0; - if(seek->secs || seek->flags&DEMUX_SEEK_SET) { - seek_rval=demux_seek_r(demuxer,seek); - mpxp_after_seek=25; /* 1 sec delay */ - } - if(seek_rval){ - mpxp_seek_time = GetTimerMS(); - if(enable_xp!=XP_None && sh_video) - { // Send back frame info to decoding thread - dec_ahead_seek_num_frames = sh_video->num_frames; - dec_ahead_seek_num_frames_decoded = sh_video->num_frames_decoded; - } + int seek_rval=1; + audio_eof=0; + if(seek->secs || seek->flags&DEMUX_SEEK_SET) { + seek_rval=demux_seek_r(demuxer,seek); + mpxp_after_seek=25; /* 1 sec delay */ + } + if(seek_rval){ + mpxp_seek_time = GetTimerMS(); + if(sh_video) { + // Send back frame info to decoding thread + dec_ahead_seek_num_frames = sh_video->num_frames; + dec_ahead_seek_num_frames_decoded = sh_video->num_frames_decoded; + } - // success: - /* FIXME there should be real seeking for vobsub */ - if (vo.vobsub) - vobsub_reset(vo.vobsub); - if (vo.spudec) - spudec_reset(vo.spudec); + // success: + /* FIXME there should be real seeking for vobsub */ + if (vo.vobsub) vobsub_reset(vo.vobsub); + if (vo.spudec) spudec_reset(vo.spudec); - if(sh_audio){ - if(verbose){ - float a_pts=d_audio->pts; - a_pts+=(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - MSG_V("SEEK: A: %5.3f V: %5.3f A-V: %5.3f \n",a_pts,v_pts,a_pts-v_pts); + if(sh_audio){ + if(verbose){ + float a_pts=d_audio->pts; + a_pts+=(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; + MSG_V("SEEK: A: %5.3f V: %5.3f A-V: %5.3f \n",a_pts,v_pts,a_pts-v_pts); + } + MSG_V("A:%6.1f V:%6.1f A-V:%7.3f ct: ? \r",d_audio->pts,v_pts,0.0f); + sh_audio->chapter_change=0; + sh_audio->a_pts=HUGE; + } else { + MSG_V("A: --- V:%6.1f \r",v_pts); } - MSG_V("A:%6.1f V:%6.1f A-V:%7.3f ct: ? \r",d_audio->pts,v_pts,0.0f); - sh_audio->chapter_change=0; - sh_audio->a_pts=HUGE; - } else { - MSG_V("A: --- V:%6.1f \r",v_pts); - } - fflush(stdout); + fflush(stdout); - if(sh_video){ - pinfo[_xp_id].current_module="seek_video_reset"; - resync_video_stream(sh_video); - vo_reset(); - sh_video->chapter_change=-1; - } + if(sh_video){ + pinfo[_xp_id].current_module="seek_video_reset"; + resync_video_stream(sh_video); + vo_reset(); + sh_video->chapter_change=-1; + } - if(sh_audio){ - pinfo[_xp_id].current_module="seek_audio_reset"; - resync_audio_stream(sh_audio); - ao_reset(); // stop audio, throwing away buffered data - } + if(sh_audio){ + pinfo[_xp_id].current_module="seek_audio_reset"; + resync_audio_stream(sh_audio); + ao_reset(); // stop audio, throwing away buffered data + } - if (vo.vobsub) { - pinfo[_xp_id].current_module = "seek_vobsub_reset"; - vobsub_seek(vo.vobsub, v_pts); - } + if (vo.vobsub) { + pinfo[_xp_id].current_module = "seek_vobsub_reset"; + vobsub_seek(vo.vobsub, v_pts); + } #ifdef USE_OSD - // Set OSD: - if(osd_level){ - int len=((demuxer->movi_end-demuxer->movi_start)>>8); - if (len>0){ - if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; - vo.osd_progbar_type=0; - vo.osd_progbar_value=(demuxer->filepos-demuxer->movi_start)/len; - vo_osd_changed(OSDTYPE_PROGBAR); + // Set OSD: + if(osd_level){ + int len=((demuxer->movi_end-demuxer->movi_start)>>8); + if (len>0){ + if(osd) osd->visible=sh_video->fps<=60?sh_video->fps:25; + vo.osd_progbar_type=0; + vo.osd_progbar_value=(demuxer->filepos-demuxer->movi_start)/len; + vo_osd_changed(OSDTYPE_PROGBAR); + } } - } #endif - if(sh_video) { - 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 - audio_time_usage=0; audio_decode_time_usage=0; video_time_usage=0; vout_time_usage=0; - if(vstat) - { - vstat->drop_frame_cnt=0; - vstat->too_slow_frame_cnt=0; - vstat->too_fast_frame_cnt=0; + if(sh_video) { + 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 + audio_time_usage=0; audio_decode_time_usage=0; video_time_usage=0; vout_time_usage=0; + if(vstat) { + vstat->drop_frame_cnt=0; + vstat->too_slow_frame_cnt=0; + vstat->too_fast_frame_cnt=0; + } + if(vo.spudec) { + unsigned char* packet=NULL; + while(ds_get_packet_sub(d_dvdsub,&packet)>0) ; // Empty stream + spudec_reset(vo.spudec); + } } - if(vo.spudec) { - unsigned char* packet=NULL; - while(ds_get_packet_sub(d_dvdsub,&packet)>0) - ; // Empty stream - spudec_reset(vo.spudec); - } - } - } + } } void mpxp_reset_vcache(void) { - 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(shva) mpxp_seek(i,NULL,NULL,shva[dec_ahead_active_frame].v_pts,&seek); - return; + 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(shva) mpxp_seek(i,NULL,NULL,shva[dec_ahead_active_frame].v_pts,&seek); + return; } void mpxp_resync_audio_stream(void) { - resync_audio_stream(sh_audio); + resync_audio_stream(sh_audio); } static void __FASTCALL__ mpxp_stream_event_handler(struct stream_s *s,const stream_packet_t *sp) @@ -1947,92 +1678,28 @@ max_av_resync=0; } -static void show_benchmark(video_stat_t *vstat) +static void show_benchmark(void) { - double tot=(video_time_usage+vout_time_usage+audio_time_usage+audio_decode_time_usage+demux_time_usage+c2_time_usage); - double min_tot=(min_video_time_usage+min_vout_time_usage+min_audio_time_usage+min_audio_decode_time_usage+min_demux_time_usage+min_c2_time_usage)*our_n_frames; - double max_tot=(max_video_time_usage+max_vout_time_usage+max_audio_time_usage+max_audio_decode_time_usage+max_demux_time_usage+max_c2_time_usage)*our_n_frames; - double total_time_usage; - if(enable_xp==XP_None) - { - max_video_time_usage *= our_n_frames; - max_vout_time_usage *= our_n_frames; - max_audio_time_usage *= our_n_frames; - max_demux_time_usage *= our_n_frames; - max_c2_time_usage *= our_n_frames; - min_video_time_usage *= our_n_frames; - min_vout_time_usage *= our_n_frames; - min_audio_time_usage *= our_n_frames; - min_demux_time_usage *= our_n_frames; - min_c2_time_usage *= our_n_frames; - } - total_time_usage_start=GetTimer()-total_time_usage_start; - total_time_usage = (float)total_time_usage_start*0.000001; - if(enable_xp!=XP_None) - { - MSG_INFO("\nMIN BENCHMARKs: *** MEANINGLESS IN XP MODE *** \n"); - MSG_INFO("MIN BENCHMARK%%: *** MEANINGLESS IN XP MODE *** \n"); - } - else - { - MSG_INFO("\nMIN BENCHMARKs: VC:%8.3fs VO:%8.3fs A:%8.3fs D:%8.3fs C:%8.3fs\n", - min_video_time_usage,min_vout_time_usage, - min_audio_time_usage+min_audio_decode_time_usage, - min_demux_time_usage,min_c2_time_usage); - if(total_time_usage>0.0) - MSG_INFO("MIN BENCHMARK%%: VC:%8.4f%% VO:%8.4f%% A:%8.4f%% D:%8.4f%% C:%8.4f%%= %8.4f%%\n", - 100.0*min_video_time_usage/total_time_usage, - 100.0*min_vout_time_usage/total_time_usage, - 100.0*(min_audio_time_usage+min_audio_decode_time_usage)/total_time_usage, - 100.0*min_demux_time_usage/total_time_usage, - 100.0*min_c2_time_usage/total_time_usage, - 100.0*min_tot/total_time_usage - ); - } - MSG_INFO("\nAVE BENCHMARKs: VC:%8.3fs VO:%8.3fs A:%8.3fs D:%8.3fs = %8.4fs C:%8.3fs\n", + double tot=(video_time_usage+vout_time_usage+audio_time_usage+audio_decode_time_usage+demux_time_usage+c2_time_usage); + double total_time_usage; + + total_time_usage_start=GetTimer()-total_time_usage_start; + total_time_usage = (float)total_time_usage_start*0.000001; + + MSG_INFO("\nAVE BENCHMARKs: VC:%8.3fs VO:%8.3fs A:%8.3fs D:%8.3fs = %8.4fs C:%8.3fs\n", video_time_usage,vout_time_usage,audio_time_usage+audio_decode_time_usage, demux_time_usage,c2_time_usage,tot); - if(total_time_usage>0.0) - MSG_INFO("AVE BENCHMARK%%: VC:%8.4f%% VO:%8.4f%% A:%8.4f%% D:%8.4f%% C:%8.4f%% = %8.4f%%\n", + if(total_time_usage>0.0) + MSG_INFO("AVE BENCHMARK%%: VC:%8.4f%% VO:%8.4f%% A:%8.4f%% D:%8.4f%% C:%8.4f%% = %8.4f%%\n", 100.0*video_time_usage/total_time_usage, 100.0*vout_time_usage/total_time_usage, 100.0*(audio_time_usage+audio_decode_time_usage)/total_time_usage, 100.0*demux_time_usage/total_time_usage, 100.0*c2_time_usage/total_time_usage, 100.0*tot/total_time_usage); - if(enable_xp!=XP_None) - { - MSG_INFO("\nMAX BENCHMARKs: *** MEANINGLESS IN XP MODE *** \n"); - MSG_INFO("MAX BENCHMARK%%: *** MEANINGLESS IN XP MODE *** \n"); - } - else - { - MSG_INFO("\nMAX BENCHMARKs: VC:%8.3fs VO:%8.3fs A:%8.3fs D:%8.3fs C:%8.3fs\n", - max_video_time_usage,max_vout_time_usage, - max_audio_time_usage+max_audio_decode_time_usage,max_demux_time_usage, - max_c2_time_usage); - if(total_time_usage>0.0) - MSG_INFO("MAX BENCHMARK%%: VC:%8.4f%% VO:%8.4f%% A:%8.4f%% D:%8.4f%% C:%8.4f%% = %8.4f%%\n", - 100.0*max_video_time_usage/total_time_usage, - 100.0*max_vout_time_usage/total_time_usage, - 100.0*(max_audio_time_usage+max_audio_decode_time_usage)/total_time_usage, - 100.0*max_demux_time_usage/total_time_usage, - 100.0*max_c2_time_usage/total_time_usage, - 100.0*max_tot/total_time_usage - ); -/* This code computes number of frame which should be dropped - in ideal case (without SYSTIME); i.e. when file is located - in RAM and kernel+other_tasks eat 0% of CPU. */ - MSG_INFO("TOTAL BENCHMARK: from %u frames should be dropped: %u (at least)\n" - ,our_n_frames,bench_dropped_frames); - } - if(enable_xp!=XP_None) - MSG_INFO("\nREAL RESULTS: from %u was dropped=%u\n" + MSG_INFO("\nREAL RESULTS: from %u was dropped=%u\n" ,our_n_frames,xp_drop_frame_cnt); - else - MSG_INFO("\nREAL RESULTS: dropped=%u too slow=%u too fast=%u\n" - ,vstat->drop_frame_cnt,vstat->too_slow_frame_cnt,vstat->too_fast_frame_cnt); - MSG_INFO("\nMax. A-V resync is: %f\n",fabs(max_av_resync)); + MSG_INFO("\nMax. A-V resync is: %f\n",fabs(max_av_resync)); } static void show_benchmark_status(void) @@ -2511,14 +2178,10 @@ 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"); } - if(init_dec_ahead(sh_video,sh_audio)!=0) { - enable_xp = XP_None; + if(init_dec_ahead(sh_video,sh_audio)!=0) exit_player("Can't initialize decoding ahead!\n"); - } - if(run_dec_ahead()!=0) { - enable_xp = XP_None; + if(run_dec_ahead()!=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); /* reset counters */ @@ -2882,8 +2545,6 @@ input_state_t input_state = { 0, 0, 0 }; char* filename=NULL; //"MI2-Trailer.avi"; int file_format=DEMUXER_TYPE_UNKNOWN; - int (*decore_video_ptr)( int rtc_fd, video_stat_t *vstat, float *aq_sleep_time, float *v_pts ) - = mp09_decore_video; // movie info: int eof=0; @@ -2918,6 +2579,12 @@ if(m_config_parse_command_line(mconfig, argc, argv, envp) < 0) exit(1); // error parsing cmdline + if(!enable_xp) { + MSG_ERR("Error: detected option: -core.xp=0\n" + "Note! Single-thread mode is not longer supported by MPlayerXP\n"); + return 0; + } + xp_num_cpu=get_number_cpu(); #if defined( ARCH_X86 ) || defined(ARCH_X86_64) get_mmx_optimizations(); @@ -2941,8 +2608,6 @@ } ao_da_buffs = vo.da_buffs; - if(enable_xp!=XP_None) vo.doublebuffering=1; - else vo.use_bm = 0; init_player(); @@ -3059,13 +2724,6 @@ if(sh_video) mpxp_read_video_properties(); - if(sh_video) { - if(sh_video->is_static || (stream->type&STREAMTYPE_MENU)==STREAMTYPE_MENU) { - vo.da_buffs=1; - enable_xp=XP_None; /* supress video mode for static pictures */ - } - } else if(enable_xp < XP_VAPlay) enable_xp=XP_None; - fflush(stdout); if(!sh_video && !sh_audio) { @@ -3196,11 +2854,7 @@ MSG_INFO(MSGTR_FPSforced,sh_video->fps,sh_video->frametime); } - if(vo_get_num_frames(&xp_num_frames)!=VO_TRUE) { - if(enable_xp!=XP_None) - exit_player("Selected -vo driver doesn't support DECODING AHEAD! Try other."); - xp_num_frames=0; - } + vo_get_num_frames(&xp_num_frames); /* Init timers and benchmarking */ rtc_fd=InitTimer(); @@ -3215,11 +2869,9 @@ /* display clip info */ demux_info_print(demuxer,filename); - if(enable_xp!=XP_None) { - mpxp_run_ahead_engine(); - decore_video_ptr = xp_decore_video; - } + mpxp_run_ahead_engine(); + fflush(stdout); fflush(stderr); /* @@ -3227,8 +2879,7 @@ We may print something in block window ;) */ mpxp_seek_time = GetTimerMS(); - if(enable_xp!=XP_None && sh_video) - { + if(sh_video) { volatile unsigned ada_blitted_frame; do { usleep(0); @@ -3279,7 +2930,7 @@ if(vo_check_events()) goto repaint; } else { repaint: - l_eof = (*decore_video_ptr)(rtc_fd,&vstat,&aq_sleep_time,&v_pts); + l_eof = mpxp_play_video(rtc_fd,&vstat,&aq_sleep_time,&v_pts); eof |= l_eof; if(eof) goto do_loop; } @@ -3334,15 +2985,11 @@ if(seek_args.secs || (seek_args.flags&DEMUX_SEEK_SET)) { pinfo[xp_id].current_module="seek"; - if(enable_xp!=XP_None) { - dec_ahead_halt_threads(0); - LOCK_VREADING(); - } + dec_ahead_halt_threads(0); + LOCK_VREADING(); - if(seek_args.secs) { - if(enable_xp>XP_None && sh_video) - seek_args.secs -= (xp_is_bad_pts?shva[dec_ahead_locked_frame>0?dec_ahead_locked_frame-1:xp_num_frames-1].v_pts:d_video->pts)-shva[dec_ahead_active_frame].v_pts; - } + if(seek_args.secs && sh_video) + seek_args.secs -= (xp_is_bad_pts?shva[dec_ahead_locked_frame>0?dec_ahead_locked_frame-1:xp_num_frames-1].v_pts:d_video->pts)-shva[dec_ahead_active_frame].v_pts; mpxp_seek(xp_id,&vstat,&osd,v_pts,&seek_args); @@ -3350,15 +2997,13 @@ seek_args.secs=0; seek_args.flags=DEMUX_SEEK_CUR|DEMUX_SEEK_SECONDS; - if(enable_xp!=XP_None) { - UNLOCK_VREADING(); - dec_ahead_restart_threads(xp_id); - } + UNLOCK_VREADING(); + dec_ahead_restart_threads(xp_id); /* Disable threads for DVD menus */ pinfo[xp_id].current_module=NULL; } #ifdef USE_OSD - if(!enable_xp!=XP_None) update_osd(d_video->pts); + update_osd(d_video->pts); #endif } // while(!eof) @@ -3366,7 +3011,7 @@ goto_next_file: // don't jump here after ao/vo/getch initialization! - if(benchmark) show_benchmark(&vstat); + if(benchmark) show_benchmark(); if(playtree_iter != NULL && !input_state.after_dvdmenu) { if(eof == PT_NEXT_ENTRY || eof == PT_PREV_ENTRY) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-18 14:08:58
|
Revision: 170 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=170&view=rev Author: nickols_k Date: 2012-10-18 14:08:52 +0000 (Thu, 18 Oct 2012) Log Message: ----------- new option: -video.on(off) Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/fifo.h mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/dec_audio.h mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpcodecs/vd.h mplayerxp/mplayer.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-18 13:16:54 UTC (rev 169) +++ mplayerxp/cfg-mplayer.h 2012-10-18 14:08:52 UTC (rev 170) @@ -276,6 +276,8 @@ }; static const config_t video_config[]={ + {"on", &has_video, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-steam playback"}, + {"off", &has_video, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video-stream playback"}, {"width", &vo.opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to width (if driver supports)"}, {"height", &vo.opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to height (if driver supports)"}, {"zoom", &vo.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, NULL, "scale output image by given factor"}, Modified: mplayerxp/fifo.h =================================================================== --- mplayerxp/fifo.h 2012-10-18 13:16:54 UTC (rev 169) +++ mplayerxp/fifo.h 2012-10-18 14:08:52 UTC (rev 170) @@ -3,7 +3,9 @@ * a very simple circular buffer FIFO implementation */ #include "mp_config.h" +#ifndef MSGT_CLASS #define MSGT_CLASS MSGT_GLOBAL +#endif #include "__mp_msg.h" #include <stdint.h> Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-10-18 13:16:54 UTC (rev 169) +++ mplayerxp/libmpcodecs/ad.h 2012-10-18 14:08:52 UTC (rev 170) @@ -1,8 +1,8 @@ /* ad.h - audio decoders interface */ -#ifndef __AD_H -#define __AD_H +#ifndef AD_H_INCLUDED +#define AD_H_INCLUDED 1 typedef struct ad_info_s { @@ -40,7 +40,6 @@ // 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))) #endif Modified: mplayerxp/libmpcodecs/dec_audio.h =================================================================== --- mplayerxp/libmpcodecs/dec_audio.h 2012-10-18 13:16:54 UTC (rev 169) +++ mplayerxp/libmpcodecs/dec_audio.h 2012-10-18 14:08:52 UTC (rev 170) @@ -1,4 +1,5 @@ - +#ifndef DEC_AUDIO_H_INCLUDED +#define DEC_AUDIO_H_INCLUDED 1 // dec_audio.c: extern int init_audio(sh_audio_t *sh_audio); extern void uninit_audio(sh_audio_t *sh_audio); @@ -17,5 +18,5 @@ int in_samplerate, int in_channels, int in_format, int in_bps, int out_samplerate, int out_channels, int out_format, int out_bps, int out_minsize, int out_maxsize); - extern void afm_help(void); +#endif Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-18 13:16:54 UTC (rev 169) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-18 14:08:52 UTC (rev 170) @@ -232,39 +232,38 @@ extern void update_subtitle(float v_pts); int decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, float pts){ - vf_instance_t* vf; -mp_image_t *mpi=NULL; -unsigned int t; -unsigned int t2; -double tt; + vf_instance_t* vf; + mp_image_t *mpi=NULL; + unsigned int t; + unsigned int t2; + double tt; -vf=sh_video->vfilter; + vf=sh_video->vfilter; -t=GetTimer(); -vf->control(vf,VFCTRL_START_FRAME,NULL); + t=GetTimer(); + vf->control(vf,VFCTRL_START_FRAME,NULL); -sh_video->active_slices=0; -mpi=mpvdec->decode(sh_video, start, in_size, drop_frame); -MSG_DBG2("decvideo: decoding video %u bytes\n",in_size); -while(sh_video->active_slices!=0) usleep(0); + sh_video->active_slices=0; + mpi=mpvdec->decode(sh_video, start, in_size, drop_frame); + MSG_DBG2("decvideo: decoding video %u bytes\n",in_size); + while(sh_video->active_slices!=0) usleep(0); /* ------------------------ frame decoded. -------------------- */ -if(!mpi) return 0; // error / skipped frame -mpcodecs_draw_image(sh_video,mpi); + if(!mpi) return 0; // error / skipped frame + mpcodecs_draw_image(sh_video,mpi); -t2=GetTimer();t=t2-t; -tt = t*0.000001f; -video_time_usage+=tt; -if(benchmark || frame_dropping) -{ - if(tt > max_video_time_usage) max_video_time_usage=tt; - if(tt < min_video_time_usage) min_video_time_usage=tt; - cur_video_time_usage=tt; -} + t2=GetTimer();t=t2-t; + tt = t*0.000001f; + video_time_usage+=tt; + if(benchmark || frame_dropping) { + if(tt > max_video_time_usage) max_video_time_usage=tt; + if(tt < min_video_time_usage) min_video_time_usage=tt; + cur_video_time_usage=tt; + } -if(drop_frame) return 0; -update_subtitle(pts); -vo_flush_pages(); + if(drop_frame) return 0; + update_subtitle(pts); + vo_flush_pages(); t2=GetTimer()-t2; tt=t2*0.000001f; @@ -276,7 +275,7 @@ cur_vout_time_usage=tt; } - return 1; + return 1; } void resync_video_stream(sh_video_t *sh_video) Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-10-18 13:16:54 UTC (rev 169) +++ mplayerxp/libmpcodecs/dec_video.h 2012-10-18 14:08:52 UTC (rev 170) @@ -1,18 +1,19 @@ +#ifndef DEC_VIDEO_H_INCLUDED +#define DEC_VIDEO_H_INCLUDED 1 // dec_video.c: -extern int video_read_properties(sh_video_t *sh_video); - extern int init_video(sh_video_t *sh_video, const char *codec_name,const char *family,int status); -void uninit_video(sh_video_t *sh_video); +extern void uninit_video(sh_video_t *sh_video); extern int decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame,float pts); extern int get_video_quality_max(sh_video_t *sh_video); extern void set_video_quality(sh_video_t *sh_video,int quality); -int set_video_colors(sh_video_t *sh_video,char *item,int value); +extern int set_video_colors(sh_video_t *sh_video,char *item,int value); extern void resync_video_stream(sh_video_t *sh_video); extern int divx_quality; extern void vfm_help(void); +#endif Modified: mplayerxp/libmpcodecs/vd.h =================================================================== --- mplayerxp/libmpcodecs/vd.h 2012-10-18 13:16:54 UTC (rev 169) +++ mplayerxp/libmpcodecs/vd.h 2012-10-18 14:08:52 UTC (rev 170) @@ -1,3 +1,6 @@ +#ifndef VD_H_INCLUDED +#define VD_H_INCLUDED 1 + typedef struct vd_info_s { /* driver description ("Autodesk FLI/FLC Animation decoder" */ @@ -43,4 +46,4 @@ void mpcodecs_draw_slice(sh_video_t* sh, mp_image_t*); void mpcodecs_draw_image(sh_video_t* sh, mp_image_t *mpi); - +#endif Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-18 13:16:54 UTC (rev 169) +++ mplayerxp/mplayer.c 2012-10-18 14:08:52 UTC (rev 170) @@ -2703,6 +2703,7 @@ //============ Open DEMUXERS --- DETECT file type ======================= initial_audio_pts=HUGE; if(!has_audio) audio_id=-2; // do NOT read audio packets... + if(!has_video) video_id=-2; // do NOT read video packets... pinfo[xp_id].current_module="demux_open"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-19 12:33:18
|
Revision: 172 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=172&view=rev Author: nickols_k Date: 2012-10-19 12:33:03 +0000 (Fri, 19 Oct 2012) Log Message: ----------- new version of XP-CORE Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/dec_ahead.h mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpdemux/demuxer_r.h mplayerxp/libvo/screenshot.c mplayerxp/libvo/screenshot.h mplayerxp/libvo/sub.c mplayerxp/libvo/sub.h 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/libvo/vosub_vidix.h mplayerxp/mp_image.c mplayerxp/mplayer.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf.h mplayerxp/postproc/vf_1bpp.c mplayerxp/postproc/vf_2xsai.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_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/spudec.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/dec_ahead.c 2012-10-19 12:33:03 UTC (rev 172) @@ -33,25 +33,82 @@ #else #define MSG_T(args...) #endif -pthread_mutex_t vdecoding_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_mutex_t vreading_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_mutex_t vdec_active_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_mutex_t vdec_locked_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_mutex_t vdeca_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_mutex_t seek_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_mutex_t seek_cond_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t seek_cond=PTHREAD_COND_INITIALIZER; +xp_core_t xp_core; +void xp_core_init(void) { + pthread_mutexattr_t attr; + memset(&xp_core,0,sizeof(xp_core_t)); + xp_core.in_lseek=NoSeek; + pthread_mutexattr_init(&attr); + pthread_mutex_init(&xp_core.seek_mutex, &attr); +} + +void xp_core_uninit(void) {} + +void xp_core_lock_seeking(void) { pthread_mutex_lock(&xp_core.seek_mutex); } +void xp_core_unlock_seeking(void) { pthread_mutex_unlock(&xp_core.seek_mutex); } + +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) +{ + it->nframes=nframes; + it->fra = malloc(sizeof(frame_attr_t)*nframes); + dae_reset(it); +} + +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) { + unsigned new_idx; + new_idx=(it->player_idx+1)%it->nframes; + if(new_idx==it->decoder_idx) { + it->num_slow_frames++; + return 0; + } + it->player_idx=new_idx; + it->num_slow_frames=0; + it->num_played_frames++; + 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; + 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; } + +frame_attr_t dae_played_fra(const dec_ahead_engine_t* it) { + unsigned idx=it->player_idx; + return it->fra[idx]; +} +frame_attr_t dae_decoded_fra(const dec_ahead_engine_t* it) { + unsigned idx=it->decoder_idx; + return it->fra[idx]; +} + 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; -pthread_mutex_t video_decode_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t video_decode_cond=PTHREAD_COND_INITIALIZER; - extern volatile int xp_drop_frame; extern volatile unsigned xp_drop_frame_cnt; extern int output_quality; @@ -59,21 +116,11 @@ int ao_da_buffs; -volatile int dec_ahead_locked_frame=0; -volatile unsigned abs_dec_ahead_locked_frame=0; -volatile unsigned abs_dec_ahead_blitted_frame=0; -extern volatile unsigned abs_dec_ahead_active_frame; -extern volatile unsigned dec_ahead_active_frame; -extern volatile unsigned loc_dec_ahead_active_frame; extern volatile float xp_screen_pts; -volatile int dec_ahead_in_lseek=NoSeek; 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 */ -volatile int dec_ahead_in_pause=0; -volatile int dec_ahead_in_resize=0; volatile float dec_ahead_seek_num_frames=0; /* frames played after seek */ volatile int dec_ahead_seek_num_frames_decoded=0; /* frames decoded after seek */ -volatile int dec_ahead_num_frames_decoded=0; /* frames decoded by thread */ static pthread_t pthread_id=0; static pthread_attr_t our_attr; @@ -96,11 +143,8 @@ pthread_t dec_ahead_pth_id; extern void update_osd( float v_pts ); -shva_t *shva; volatile int xp_eof=0; int xp_audio_eof=0; -int has_xp_audio=0; -int has_xp_video=0; #define NORM_FRAME(a) ((a)%xp_num_frames) /* To let audio decoder thread sleep as long as player */ @@ -127,17 +171,111 @@ int xp_is_bad_pts=0; /* this routine decodes video+audio but intends to be video only */ + +static void show_warn_cant_sync(float max_frame_delay) { + static int warned=0; + static float prev_warn_delay=0; + if(!warned || max_frame_delay > prev_warn_delay) { + warned=1; + MSG_WARN("*********************************************\n" + "** Can't stabilize A-V sync!!! **\n" + "*********************************************\n" + "Try increase number of buffer for decoding ahead\n" + "Exist: %u, need: %u\n" + ,xp_num_frames,(unsigned)(max_frame_delay*3*vo.fps)+3); + prev_warn_delay=max_frame_delay; + } +} + +static unsigned compute_frame_dropping(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 */ + /* + ada_active_frame - abs frame num. which is being displayed + abs_dec_ahead_locked_frame - abs frame num. which is being decoded + */ + max_frame_delay = max_video_time_usage+max_vout_time_usage; + + /* + TODO: + Replace the constants with some values which are depended on + xp_num_frames 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: + - fill a full buffer (is not always reachable) + - while(video.pts < audio.pts) + video.seek_to_key_frame(video.get_next_key_frame(video.get_cur_pos())) + */ + delta=v_pts-xp_screen_pts; + if(max_frame_delay*3 > drop_barrier) { + if(drop_barrier < (float)(xp_num_frames-2)/vo.fps) drop_barrier += 1/vo.fps; + else + if(verbose) show_warn_cant_sync(max_frame_delay); + } + if(delta > drop_barrier) rc=0; + else if(delta < max_frame_delay*3) rc=1; + else { + unsigned fr_skip_divisor; + /* + if(delta < drop_barrier/4) fr_skip_divisor=1; -- drop every frame is not smooth thing + else + */ + if(delta < drop_barrier/2) fr_skip_divisor=2; + else + 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; + 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); + prev_delta=delta; + return rc; +} + +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 && + fra[idx2].v_pts > fra[idx1].v_pts && + fra[idx2].v_pts < fra[idx1].v_pts+1.0 ) { + float tmp; + tmp = fra[idx1].v_pts; + 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_num_frames; + 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; + + idx0 = idx1; + idx1 = idx2; + idx2=(idx2-1)%xp_num_frames; + } +} + any_t* Va_dec_ahead_routine( any_t* arg ) { float duration=0; float drop_barrier; int blit_frame=0; int drop_param=0; - volatile unsigned da_active_frame,lda_active_frame,ada_active_frame; unsigned xp_n_frame_to_drop; int _xp_id; - static float prev_delta=0; float v_pts,mpeg_timer=HUGE; + pthread_is_living=1; xp_eof = 0; xp_audio_eof=0; @@ -148,8 +286,7 @@ pinfo[_xp_id].pid = getpid(); /* Only for testing */ dec_ahead_pth_id = pinfo[_xp_id].pth_id = pthread_self(); - pinfo[_xp_id].thread_name = (has_xp_audio && enable_xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; - prev_delta=xp_num_frames; + pinfo[_xp_id].thread_name = (xp_core.has_audio && enable_xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; drop_barrier=(float)(xp_num_frames/2)*(1/vo.fps); if(av_sync_pts == -1 && !use_pts_fix2) xp_is_bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || @@ -160,196 +297,75 @@ else xp_is_bad_pts = av_sync_pts?0:1; while(!xp_eof){ + unsigned char* start=NULL; + int in_size; if(pthread_end_of_work) break; - /*-------------------- Decode a frame: -----------------------*/ - { unsigned char* start=NULL; - int in_size; - if(dec_ahead_in_lseek==PreSeek) { - pinfo[_xp_id].current_module = "Pre seek"; - LOCK_VIDEO_DECODE(); - dec_ahead_in_lseek=Seek; - pthread_cond_wait( &video_decode_cond, &video_decode_mutex ); - UNLOCK_VIDEO_DECODE(); - } - pinfo[_xp_id].current_module = "dec_ahead 1"; - /* get it! */ - LOCK_VREADING(); - if(dec_ahead_in_lseek==Seek) - { /* Get info from player after a seek */ - //*((char*)0x100) = 1; // Testing crash - sh_video->num_frames = dec_ahead_seek_num_frames; - sh_video->num_frames_decoded = dec_ahead_seek_num_frames_decoded; - } - /* prevent reent access to non-reent demuxer */ - //if(sh_video->num_frames>200) *((char*)0x100) = 1; // Testing crash - if(has_xp_audio && enable_xp<XP_VAFull) { - pinfo[_xp_id].current_module = "decode audio"; - while(2==xp_thread_decode_audio()) ; - pinfo[_xp_id].current_module = "dec_ahead 2"; - } - in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,vo.fps); - UNLOCK_VREADING(); - if(dec_ahead_in_lseek==Seek) - { - pinfo[_xp_id].current_module = "Post seek"; - /* reset counters */ - vo_get_active_frame(&dec_ahead_locked_frame); - LOCK_VDEC_ACTIVE(); - LOCK_VDEC_LOCKED(); - abs_dec_ahead_locked_frame = abs_dec_ahead_active_frame; - abs_dec_ahead_blitted_frame = loc_dec_ahead_active_frame; - dec_ahead_locked_frame = dec_ahead_active_frame; - UNLOCK_VDEC_LOCKED(); - UNLOCK_VDEC_ACTIVE(); - if(xp_is_bad_pts) mpeg_timer=HUGE; - dec_ahead_in_lseek=NoSeek; - MSG_T("\nDEC_AHEAD: reset counters to (%u %u) due lseek\n",dec_ahead_locked_frame,abs_dec_ahead_locked_frame); - pinfo[_xp_id].current_module = "dec_ahead 3"; - } - if(in_size<0) - { - __MP_SYNCHRONIZE(vdeca_mutex,shva[dec_ahead_locked_frame].eof=1); - xp_eof=1; - if(has_xp_audio && enable_xp<XP_VAFull) { - while(!xp_audio_eof && !dec_ahead_in_lseek && !pthread_end_of_work) { - pinfo[_xp_id].current_module = "decode audio"; - if(!xp_thread_decode_audio()) - usleep(1); - pinfo[_xp_id].current_module = NULL; - } - if(dec_ahead_in_lseek) { - xp_eof=0; - continue; - } - } - LOCK_VIDEO_DECODE(); - if(!pthread_end_of_work) { - pinfo[_xp_id].current_module = "wait for end of work"; - pthread_cond_wait(&video_decode_cond,&video_decode_mutex); - } - UNLOCK_VIDEO_DECODE(); - if(dec_ahead_in_lseek) { - xp_eof=0; - continue; - } - break; - } - /* in_size==0: it's or broken stream or demuxer's bug */ - if(in_size==0 && !pthread_end_of_work) { - dec_ahead_in_lseek=NoSeek; + if(xp_core.in_lseek==PreSeek) { + pinfo[_xp_id].current_module = "Pre seek"; + xp_core.in_lseek=Seek; + } + pinfo[_xp_id].current_module = "dec_ahead 1"; + if(xp_core.in_lseek==Seek) { + /* Get info from player after a seek */ + //*((char*)0x100) = 1; // Testing crash + sh_video->num_frames = dec_ahead_seek_num_frames; + sh_video->num_frames_decoded = dec_ahead_seek_num_frames_decoded; + } +/* get it! */ + xp_core_lock_seeking(); +#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 && enable_xp<XP_VAFull) { + pinfo[_xp_id].current_module = "decode audio"; + while(2==xp_thread_decode_audio()) ; + pinfo[_xp_id].current_module = "dec_ahead 2"; + } +#endif +/*-------------------- Decode a frame: -----------------------*/ + in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,vo.fps); + xp_core_unlock_seeking(); + if(xp_core.in_lseek==Seek) { + pinfo[_xp_id].current_module = "Post seek"; + /* reset counters */ + dae_reset(xp_core.video); + if(xp_is_bad_pts) mpeg_timer=HUGE; + xp_core.in_lseek=NoSeek; + MSG_T("\nDEC_AHEAD: reset counters to (%u %u) due lseek\n",dec_ahead_locked_frame,abs_dec_ahead_locked_frame); + pinfo[_xp_id].current_module = "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; } - if(xp_is_bad_pts) - { - if(mpeg_timer==HUGE)mpeg_timer=v_pts; - else if( mpeg_timer-duration<v_pts ) { - mpeg_timer=v_pts; - MSG_DBG2("Sync mpeg pts %f\n", mpeg_timer); - } else mpeg_timer+=duration; + 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; + } + /* frame was decoded into current decoder_idx */ + if(xp_is_bad_pts) { + if(mpeg_timer==HUGE) mpeg_timer=v_pts; + else if( mpeg_timer-duration<v_pts ) { + mpeg_timer=v_pts; + MSG_DBG2("Sync mpeg pts %f\n", mpeg_timer); } - vo_set_decoding_frame_num(&dec_ahead_locked_frame); - /* ----------- compute frame dropping ------------- */ - LOCK_VDEC_ACTIVE(); - ada_active_frame= abs_dec_ahead_active_frame; - lda_active_frame= loc_dec_ahead_active_frame; - da_active_frame = dec_ahead_active_frame; - UNLOCK_VDEC_ACTIVE(); - xp_n_frame_to_drop=0; - if(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/vo.fps)*100 && - ada_active_frame>=xp_num_frames) - { - float delta,max_frame_delay;/* delay for decoding of top slow frame */ - /* - ada_active_frame - abs frame num. which is being displayed - abs_dec_ahead_locked_frame - abs frame num. which is being decoded - */ - max_frame_delay = max_video_time_usage+max_vout_time_usage; - - /* - TODO: - Replace the constants with some values which are depended on - xp_num_frames 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: - - fill a full buffer (is not always reachable) - - while(video.pts < audio.pts) - video.seek_to_key_frame(video.get_next_key_frame(video.get_cur_pos())) - */ - delta=v_pts-xp_screen_pts; - if(max_frame_delay*3 > drop_barrier) - { - if(drop_barrier < (float)(xp_num_frames-2)/vo.fps) drop_barrier += 1/vo.fps; - else - if(verbose) - { - static int warned=0; - static float prev_warn_delay=0; - if(!warned || max_frame_delay > prev_warn_delay) - { - warned=1; - MSG_WARN("*********************************************\n" - "** Can't stabilize A-V sync!!! **\n" - "*********************************************\n" - "Try increase number of buffer for decoding ahead\n" - "Exist: %u, need: %u\n" - ,xp_num_frames,(unsigned)(max_frame_delay*3*vo.fps)+3); - prev_warn_delay=max_frame_delay; - } - } - } - if(delta > drop_barrier) xp_n_frame_to_drop=0; - else - if(delta < max_frame_delay*3) xp_n_frame_to_drop=1; - else - { - unsigned fr_skip_divisor; - /* - if(delta < drop_barrier/4) fr_skip_divisor=1; -- drop every frame is not smooth thing - else - */ - if(delta < drop_barrier/2) fr_skip_divisor=2; - else - if(delta < drop_barrier*2/3) fr_skip_divisor=3; - else - fr_skip_divisor=4; /* delta < drop_barrier */ - xp_n_frame_to_drop = (abs_dec_ahead_locked_frame%fr_skip_divisor)?0:1; - if(delta>prev_delta) xp_n_frame_to_drop=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); - prev_delta=delta; - } - } - /* ------------ sleep --------------- */ - /* sleep if thread is too fast ;) */ - while(abs_dec_ahead_blitted_frame >= lda_active_frame+xp_num_frames-2) - { - MSG_T("DEC_AHEAD: sleep (abs (blitted(%u)>=active+xp-2(%u)))\n" - ,abs_dec_ahead_blitted_frame,lda_active_frame+xp_num_frames-2); - if(pthread_end_of_work) goto pt_exit; - if(dec_ahead_in_lseek!=NoSeek) break; - if(has_xp_audio && enable_xp<XP_VAFull) { - pinfo[_xp_id].current_module = "decode audio"; - xp_thread_decode_audio(); - pinfo[_xp_id].current_module = "dec_ahead 5"; - } - usleep(1); - LOCK_VDEC_ACTIVE(); - lda_active_frame= loc_dec_ahead_active_frame; - da_active_frame = dec_ahead_active_frame; - UNLOCK_VDEC_ACTIVE(); - } - if(dec_ahead_in_lseek!=NoSeek) continue; - LOCK_VDECODING(); - if(dec_ahead_in_lseek!=NoSeek) { - UNLOCK_VDECODING(); - continue; - } + else mpeg_timer+=duration; + } + /* compute frame dropping */ + xp_n_frame_to_drop=0; + if(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/vo.fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); + } /* if( frame_dropping ) */ + if(xp_core.in_lseek!=NoSeek) continue; #if 0 /* We can't seriously examine question of too slow machines @@ -362,105 +378,74 @@ for(i=0;i<delay;i++) usleep(0); } #endif - if(xp_n_frame_to_drop) drop_param=frame_dropping; - else drop_param=0; - /* decode: */ - MSG_T("\nDEC_AHEAD: decode to %u (abs (blitted(%u)>=active+xp-2(%u)))\n" + if(xp_n_frame_to_drop) drop_param=frame_dropping; + else drop_param=0; + /* decode: */ + MSG_T("\nDEC_AHEAD: decode to %u (abs (blitted(%u)>=active+xp-2(%u)))\n" ,abs_dec_ahead_blitted_frame,abs_dec_ahead_locked_frame,lda_active_frame+xp_num_frames-2); - if(output_quality) - { - unsigned total = xp_num_frames/2; - unsigned distance = abs_dec_ahead_blitted_frame-lda_active_frame; - int our_quality; - our_quality = output_quality*distance/total; - if(drop_param) set_video_quality(sh_video,0); - else - if(auto_quality) set_video_quality(sh_video,our_quality>0?our_quality:0); - } - blit_frame=decode_video(sh_video,start,in_size,drop_param,v_pts); - if(output_quality) - { - if(drop_param) set_video_quality(sh_video,output_quality); - } - if(!blit_frame && drop_param) xp_drop_frame_cnt++; - UNLOCK_VDECODING(); - if(dec_ahead_in_resize) - { - dec_ahead_in_resize=0; - } + if(output_quality) { + unsigned total = xp_num_frames/2; + unsigned distance = dae_curr_vdecoded()-dae_curr_vplayed(); + int our_quality; + our_quality = output_quality*distance/total; + if(drop_param) set_video_quality(sh_video,0); + else + if(auto_quality) set_video_quality(sh_video,our_quality>0?our_quality:0); + } + blit_frame=decode_video(sh_video,start,in_size,drop_param,v_pts); + if(output_quality) { + if(drop_param) set_video_quality(sh_video,output_quality); + } + if(!blit_frame && drop_param) xp_drop_frame_cnt++; #ifdef ENABLE_DEC_AHEAD_DEBUG - if(verbose) - { + if(verbose) { MSG_T("\nDEC_AHEAD: frame %u decoded (blit=%u blit_param=%u size=%i)\n" ,abs_dec_ahead_locked_frame,blit_frame,drop_param,in_size); - } + } #endif - LOCK_VDEC_LOCKED(); - abs_dec_ahead_locked_frame++; - if(blit_frame) - { - LOCK_VDECA(); - if(xp_is_bad_pts) - shva[dec_ahead_locked_frame].v_pts=mpeg_timer; - else - shva[dec_ahead_locked_frame].v_pts = v_pts; - shva[dec_ahead_locked_frame].stream_pts = v_pts; - shva[dec_ahead_locked_frame].duration=duration; - shva[dec_ahead_locked_frame].eof=0; - shva[dec_ahead_locked_frame].num_frames = sh_video->num_frames; - shva[dec_ahead_locked_frame].num_frames_decoded = sh_video->num_frames_decoded; - if(!xp_is_bad_pts) { - int idx = dec_ahead_locked_frame>0?dec_ahead_locked_frame-1:xp_num_frames-1; - shva[idx].duration=v_pts-shva[idx].v_pts; - } - if(frame_reorder) { /* Reorder pts in mpeg streams */ - int idx0=0, idx1, idx2, idx3; - - idx1 = dec_ahead_locked_frame; - idx2 = dec_ahead_locked_frame>0?dec_ahead_locked_frame-1:xp_num_frames-1; - while( dec_ahead_active_frame != idx2 && - shva[idx2].v_pts > shva[idx1].v_pts && - shva[idx2].v_pts < shva[idx1].v_pts+1.0 ) { - float tmp; - tmp = shva[idx1].v_pts; - shva[idx1].v_pts = shva[idx2].v_pts; - shva[idx2].v_pts = tmp; + if(blit_frame) { + unsigned idx=dae_curr_vdecoded(); + if(xp_is_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; + xp_core.video->fra[idx].num_frames = sh_video->num_frames; + xp_core.video->fra[idx].frame_no = sh_video->num_frames_decoded; + if(!xp_is_bad_pts) { + 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 (blit_frame) */ - shva[idx1].stream_pts = shva[idx1].v_pts; - shva[idx2].stream_pts = shva[idx2].v_pts; - shva[idx2].duration = shva[idx1].v_pts - shva[idx2].v_pts; - - idx3=idx2-1; - if(idx3<0) - idx3 = xp_num_frames-1; - if(shva[idx2].v_pts > shva[idx3].v_pts && - shva[idx2].v_pts - shva[idx3].v_pts < 1.0) - shva[idx3].duration = shva[idx2].v_pts - shva[idx3].v_pts; - - if(idx1 != dec_ahead_locked_frame) - shva[idx1].duration = shva[idx0].v_pts - shva[idx1].v_pts; - - idx0 = idx1; - idx1 = idx2; - idx2--; - if(idx2<0) - idx2 = xp_num_frames-1; - } - } - - dec_ahead_num_frames_decoded = sh_video->num_frames_decoded; - UNLOCK_VDECA(); - dec_ahead_locked_frame=(dec_ahead_locked_frame+1)%xp_num_frames; - abs_dec_ahead_blitted_frame++; + /* ------------ sleep --------------- */ + /* sleep if thread is too fast ;) */ + if(blit_frame) + 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(xp_core.has_audio && enable_xp<XP_VAFull) { + pinfo[_xp_id].current_module = "decode audio"; + xp_thread_decode_audio(); + pinfo[_xp_id].current_module = "dec_ahead 5"; } - else - if(in_size && !drop_param) - /* do not count broken frames */ - abs_dec_ahead_locked_frame--; - UNLOCK_VDEC_LOCKED(); + usleep(1); } - /*------------------------ frame decoded. --------------------*/ +/*------------------------ frame decoded. --------------------*/ } /* while(!xp_eof)*/ + +if(xp_core.has_audio && enable_xp<XP_VAFull) { + while(!xp_audio_eof && !xp_core.in_lseek && !pthread_end_of_work) { + pinfo[_xp_id].current_module = "decode audio"; + if(!xp_thread_decode_audio()) usleep(1); + pinfo[_xp_id].current_module = NULL; + } +} pt_exit: MSG_T("\nDEC_AHEAD: leaving...\n"); pthread_is_living=0; @@ -499,7 +484,7 @@ pinfo[xp_id].current_module = "sleep"; LOCK_AUDIO_DECODE(); - if( !dec_ahead_in_lseek && !a_pthread_end_of_work) { + if( !xp_core.in_lseek && !a_pthread_end_of_work) { if(xp_audio_eof) { pinfo[xp_id].current_module = "wait end of work"; pthread_cond_wait( &audio_decode_cond, &audio_decode_mutex ); @@ -512,7 +497,7 @@ } else timeout.tv_sec = audio_play_timeout.tv_sec; } else { - if(dec_ahead_in_pause) + if(xp_core.in_pause) d = 1.0; else d = 0.1; @@ -535,7 +520,7 @@ pinfo[xp_id].current_module = "seek"; LOCK_AUDIO_DECODE(); - while( dec_ahead_in_lseek!=NoSeek && !a_pthread_end_of_work) { + while( xp_core.in_lseek!=NoSeek && !a_pthread_end_of_work) { gettimeofday(&now,NULL); timeout.tv_nsec = now.tv_usec * 1000; timeout.tv_sec = now.tv_sec + 1; @@ -556,19 +541,17 @@ void uninit_dec_ahead( int force ) { - if(pthread_id && pthread_is_living && has_xp_video) + if(pthread_id && pthread_is_living && xp_core.has_video) { pthread_end_of_work=1; - __MP_SYNCHRONIZE(video_decode_mutex,pthread_cond_signal(&video_decode_cond)); while(pthread_is_living && !force) usleep(0); pthread_is_living=0; pthread_attr_destroy(&our_attr); - free(shva); - shva=NULL; - has_xp_video=0; + dae_uninit(xp_core.video); + xp_core.has_video=0; } - if(has_xp_audio && !force) { /* audio state doesn't matter on segfault :( */ + 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) { @@ -581,18 +564,19 @@ LOCK_AUDIO_PLAY(); pthread_cond_signal(&audio_play_cond); uninit_audio_buffer(); - has_xp_audio=0; + 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(has_xp_audio) { + if(xp_core.has_audio) { uninit_audio_buffer(); - has_xp_audio=0; + xp_core.has_audio=0; } } + xp_core_uninit(); } /* Min audio buffer to keep free, used to tell differ between full and empty buffer */ @@ -601,29 +585,29 @@ int init_dec_ahead(sh_video_t *shv, sh_audio_t *sha) { pthread_attr_init(&our_attr); - if(shv) { sh_video = shv; has_xp_video=1; } + 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); + } else {/* if (enable_xp >= XP_VAFull) enable_xp = XP_VAPlay;*/ } - if(!(shva = malloc(sizeof(shva_t)*xp_num_frames))) return ENOMEM; if(sha) sh_audio = sha; /* currently is unused */ - dec_ahead_locked_frame=0; - abs_dec_ahead_locked_frame=0; - abs_dec_ahead_blitted_frame=0; - dec_ahead_in_lseek=NoSeek; - dec_ahead_in_resize=0; if(enable_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(has_xp_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_num_frames/vo.fps))+MIN_BUFFER_RESERV; + if(xp_core.has_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_num_frames/vo.fps))+MIN_BUFFER_RESERV; else asize = o_bps*ao_da_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); - has_xp_audio=1; + xp_core.has_audio=1; if( enable_xp >= XP_VAPlay ) pthread_attr_init(&audio_attr); } @@ -642,7 +626,7 @@ } pthread_attr_setscope(&our_attr,PTHREAD_SCOPE_SYSTEM); - if( has_xp_audio && enable_xp >= XP_VAPlay ) { + if( xp_core.has_audio && enable_xp >= XP_VAPlay ) { retval = pthread_attr_setdetachstate(&audio_attr,PTHREAD_CREATE_DETACHED); if(retval) { if(verbose) printf("running audio thread: attr_setdetachstate fault!!!\n"); @@ -655,13 +639,13 @@ /* requires root privelegies */ pthread_attr_setschedpolicy(&our_attr,SCHED_FIFO); #endif - if( (has_xp_audio && enable_xp >= XP_VAFull) || !has_xp_video ) + if( (xp_core.has_audio && enable_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( has_xp_video ) { + 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); @@ -672,7 +656,7 @@ int run_xp_players(void) { int retval; - if( has_xp_audio && enable_xp >= XP_VAPlay ) + if( xp_core.has_audio && enable_xp >= XP_VAPlay ) { retval = pthread_create(&pthread_id,&audio_attr,audio_play_routine,NULL); if( retval ) return retval; @@ -685,7 +669,7 @@ /* Halt threads before seek */ void dec_ahead_halt_threads(int is_reset_vcache) { - dec_ahead_in_lseek = PreSeek; + xp_core.in_lseek = PreSeek; if(pthread_audio_is_living) { LOCK_AUDIO_PLAY(); @@ -701,14 +685,11 @@ UNLOCK_AUDIO_DECODE(); } - if (is_reset_vcache) - UNLOCK_VDECODING(); /* Release lock from vo_x11 */ if(pthread_is_living) { - __MP_SYNCHRONIZE(video_decode_mutex,pthread_cond_signal(&video_decode_cond)); - while(dec_ahead_in_lseek==PreSeek) + while(xp_core.in_lseek==PreSeek) usleep(1); } - dec_ahead_in_lseek = Seek; + xp_core.in_lseek = Seek; } /* Restart threads after seek */ @@ -719,23 +700,21 @@ initial_audio_pts=HUGE; if(enable_xp && !pthread_is_living && !a_pthread_is_living) { - dec_ahead_in_lseek = NoSeek; /* Threads not started, do nothing */ + xp_core.in_lseek = NoSeek; /* Threads not started, do nothing */ return; } - if(!has_xp_audio) + if(!xp_core.has_audio) decore_audio(xp_id); else xp_thread_decode_audio(); if(pthread_is_living) { - __MP_SYNCHRONIZE(video_decode_mutex,pthread_cond_signal(&video_decode_cond)); - while(dec_ahead_in_lseek==Seek) - usleep(1); - while(abs_dec_ahead_locked_frame == abs_dec_ahead_active_frame && !xp_eof) + while(xp_core.in_lseek==Seek) usleep(1); + while(dae_curr_vdecoded() == dae_curr_vplayed() && !xp_eof) usleep(1); /* Wait for thread to decode first frame */ } - dec_ahead_in_lseek = NoSeek; + xp_core.in_lseek = NoSeek; if(a_pthread_is_living) __MP_SYNCHRONIZE(audio_decode_mutex,pthread_cond_signal(&audio_decode_cond)); @@ -751,7 +730,7 @@ int free_buf, vbuf_size, pref_buf; unsigned len=0; - if(dec_ahead_in_lseek) { + if(xp_core.in_lseek) { xp_audio_eof = 0; reset_audio_buffer(); decode_audio_buffer(MAX_OUTBURST); @@ -772,9 +751,9 @@ if( len < MAX_OUTBURST ) /* Buffer underrun */ return decode_audio_buffer(MAX_OUTBURST); - if(has_xp_video) { + if(xp_core.has_video) { /* Match video buffer */ - vbuf_size = abs_dec_ahead_locked_frame - abs_dec_ahead_active_frame; + vbuf_size = dae_curr_vdecoded() - dae_curr_vplayed(); pref_buf = vbuf_size / vo.fps * sh_audio->af_bps; pref_buf -= len; if( pref_buf > 0 ) { @@ -885,7 +864,7 @@ LOCK_AUDIO_PLAY(); d = ao_get_delay() - min_audio_time; - if( !dec_ahead_in_lseek && d > 0 ) { + if( !xp_core.in_lseek && d > 0 ) { gettimeofday(&now,NULL); audio_play_timeout.tv_nsec = now.tv_usec * 1000 + d*1000000000l; if( audio_play_timeout.tv_nsec > 1000000000l ) { @@ -914,7 +893,7 @@ pinfo[xp_id].current_module = "audio pause"; LOCK_AUDIO_PLAY(); - while( dec_ahead_in_pause && !pthread_audio_end_of_work ) { + while( xp_core.in_pause && !pthread_audio_end_of_work ) { pthread_cond_wait( &audio_play_cond, &audio_play_mutex ); } UNLOCK_AUDIO_PLAY(); @@ -924,7 +903,7 @@ pinfo[xp_id].current_module = "audio seek"; LOCK_AUDIO_PLAY(); - while( dec_ahead_in_lseek!=NoSeek && !pthread_audio_end_of_work) { + while( xp_core.in_lseek!=NoSeek && !pthread_audio_end_of_work) { gettimeofday(&now,NULL); timeout.tv_nsec = now.tv_usec * 1000; timeout.tv_sec = now.tv_sec + 1; @@ -957,20 +936,15 @@ mp_msg_flush(); xp_eof = 1; - shva[dec_ahead_locked_frame].eof=1; + xp_core.video->fra[dae_curr_vdecoded()].eof=1; /* Unlock all mutex ( man page says it may deadlock, but what is worse deadlock here or later? ) */ - UNLOCK_VREADING(); - UNLOCK_VDEC_LOCKED(); - UNLOCK_VDEC_ACTIVE(); - UNLOCK_VDECA(); - UNLOCK_VDECODING(); - UNLOCK_VIDEO_DECODE(); + xp_core_unlock_seeking(); pthread_is_living=0; - dec_ahead_in_lseek=NoSeek; + xp_core.in_lseek=NoSeek; killall_threads(pthread_self()); __exit_sighandler(); } Modified: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/dec_ahead.h 2012-10-19 12:33:03 UTC (rev 172) @@ -20,14 +20,70 @@ enum seek_states { NoSeek=0, PreSeek, Seek }; -enum xp_modes { XP_Old=0, XP_Video, XP_VideoAudio, XP_VAPlay, XP_VAFull }; +enum xp_modes { XP_NA=0, XP_Video, XP_VideoAudio, XP_VAPlay, XP_VAFull }; -extern pthread_mutex_t vdec_active_mutex; /* it's related with video decoding (main process) */ -extern pthread_mutex_t vdec_locked_mutex; /* it's related with video decoding (thread) */ -extern pthread_mutex_t vreading_mutex; /* it's related with reading of video stream */ -extern pthread_mutex_t vdecoding_mutex; /* it's related with video decoding process */ -extern pthread_mutex_t vdeca_mutex; /* it's related with video decoding attributes */ +typedef struct frame_attr_s +{ + int eof; /* indicates last frame in stream */ + float duration; /* frame duration */ + float v_pts; /* presentation time-stamp from input stream */ + float stream_pts; /* real stream's PTS mainly for OSD */ + float num_frames; /* ??? is it really needed */ + long long int frame_no; /* total number of frame */ +}frame_attr_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 */ + /* 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 */ +}dec_ahead_engine_t; + +typedef struct xp_core_s { + int has_video; + int has_audio; + dec_ahead_engine_t* video; + pthread_mutex_t seek_mutex; + volatile enum seek_states in_lseek; + volatile int in_pause; + volatile int in_resize; +}xp_core_t; +extern xp_core_t xp_core; + +extern void xp_core_init(void); +extern void xp_core_uninit(void); + +extern void xp_core_lock_seeking(void); +extern void xp_core_unlock_seeking(void); + +extern void dae_init(dec_ahead_engine_t* it,unsigned nframes); +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_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); + +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); } + +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 pthread_mutex_t audio_play_mutex; extern pthread_cond_t audio_play_cond; @@ -43,63 +99,25 @@ #else #define MSG_D(args...) #endif -#define LOCK_VDEC_ACTIVE() { MSG_D(DA_PREFIX"LOCK_VDEC_ACTIVE\n"); pthread_mutex_lock(&vdec_active_mutex); } -#define UNLOCK_VDEC_ACTIVE() { MSG_D(DA_PREFIX"UNLOCK_VDEC_ACTIVE\n"); pthread_mutex_unlock(&vdec_active_mutex); } -#define LOCK_VDEC_LOCKED() { MSG_D(DA_PREFIX"LOCK_VDEC_LOCKED\n"); pthread_mutex_lock(&vdec_locked_mutex); } -#define UNLOCK_VDEC_LOCKED() { MSG_D(DA_PREFIX"UNLOCK_VDEC_LOCKED\n"); pthread_mutex_unlock(&vdec_locked_mutex); } - -#define LOCK_VDECODING() { MSG_D(DA_PREFIX"LOCK_VDECODING\n"); pthread_mutex_lock(&vdecoding_mutex); } -#define UNLOCK_VDECODING() { MSG_D(DA_PREFIX"UNLOCK_VDECODING\n"); pthread_mutex_unlock(&vdecoding_mutex); } - -#define LOCK_VREADING() { MSG_D(DA_PREFIX"LOCK_VREADING\n"); pthread_mutex_lock(&vreading_mutex); } -#define UNLOCK_VREADING() { MSG_D(DA_PREFIX"UNLOCK_VREADING\n"); pthread_mutex_unlock(&vreading_mutex); } - -#define LOCK_VDECA() { MSG_D(DA_PREFIX"LOCK_VDECA\n"); pthread_mutex_lock(&vdeca_mutex); } -#define UNLOCK_VDECA() { MSG_D(DA_PREFIX"UNLOCK_VDECA\n"); pthread_mutex_unlock(&vdeca_mutex); } - #define LOCK_AUDIO_PLAY() { MSG_D(DA_PREFIX"LOCK_AUDIO_PLAY\n"); pthread_mutex_lock(&audio_play_mutex); } #define UNLOCK_AUDIO_PLAY() { MSG_D(DA_PREFIX"UNLOCK_AUDIO_PLAY\n"); pthread_mutex_unlock(&audio_play_mutex); } #define LOCK_AUDIO_DECODE() { MSG_D(DA_PREFIX"LOCK_AUDIO_DECODE\n"); pthread_mutex_lock(&audio_decode_mutex); } #define UNLOCK_AUDIO_DECODE() { MSG_D(DA_PREFIX"UNLOCK_AUDIO_DECODE\n"); pthread_mutex_unlock(&audio_decode_mutex); } -#define LOCK_VIDEO_DECODE() { MSG_D(DA_PREFIX"LOCK_VIDEO_DECODE\n"); pthread_mutex_lock(&video_decode_mutex); } -#define UNLOCK_VIDEO_DECODE() { MSG_D(DA_PREFIX"UNLOCK_VIDEO_DECODE\n"); pthread_mutex_unlock(&video_decode_mutex); } - #define __MP_ATOMIC(OP) { static pthread_mutex_t loc_mutex; pthread_mutex_lock(&loc_mutex); OP; pthread_mutex_unlock(&loc_mutex); } #define __MP_SYNCHRONIZE(mtx,OP) { pthread_mutex_lock(&mtx); OP; pthread_mutex_unlock(&mtx); } -typedef struct sh_video_attr -{ - int eof; /* indicates last frame in stream */ - float duration; /* frame duration */ - float v_pts; /* presentation time-stamp from input stream */ - float stream_pts; /* real stream's PTS mainly for OSD */ - float num_frames; /* number of frames played */ - int num_frames_decoded; /* number of frames decoded */ -}shva_t; - -extern shva_t* shva; - extern volatile int xp_eof; extern int xp_audio_eof; -extern int has_xp_audio; -extern int has_xp_video; extern int xp_is_bad_pts; -extern volatile int dec_ahead_locked_frame; -extern volatile unsigned abs_dec_ahead_locked_frame; -extern volatile unsigned abs_dec_ahead_blitted_frame; -extern volatile int dec_ahead_in_lseek; -extern volatile int dec_ahead_in_pause; -extern volatile int dec_ahead_in_resize; extern volatile float dec_ahead_seek_num_frames; // frames played after seek extern volatile int dec_ahead_seek_num_frames_decoded; // frames decoded after seek -extern volatile int dec_ahead_num_frames_decoded; // frames decoded by thread extern volatile int dec_ahead_can_aseek; extern int ao_da_buffs; - /* + /* stream - pointer to openned stream astream - pointer to audio stream */ Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-19 12:33:03 UTC (rev 172) @@ -28,6 +28,7 @@ #include "stheader.h" #include "vd.h" +#include "dec_ahead.h" #include "dec_video.h" // =================================================================== vf_cfg_t vf_cfg; // Configuration for audio filters @@ -115,10 +116,8 @@ 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) { - MSG_DBG3("init_video: mpcodecs_vd_drivers[%s]->mpvdec==0\n",mpcodecs_vd_drivers[i]->info->driver_name); - continue; - } + if(!mpvdec) continue; + else MSG_DBG3("init_video: 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); @@ -184,6 +183,7 @@ const unsigned h_step=16; unsigned num_slices = mpi->h/h_step; vf=sh->vfilter; + if(!(mpi->flags&(MP_IMGFLAG_DRAW_CALLBACK))){ if(mpi->h%h_step) num_slices++; if(sh->vf_flags&VF_FLAGS_SLICES) @@ -219,7 +219,7 @@ { /* execute slices instead of whole frame make faster multiple filters */ for(i=0;i<num_slices;i++) { - MSG_DBG2("dec_video.put_slice[%ux%u] %i %i %i %i\n",ampi[i].width,ampi[i].height,ampi[i].x,ampi[i].y,ampi[i].w,ampi[i].h); + MSG_DBG2("dec_video.put_slice[%ux%u] %i %i %i %i -> [%i]\n",ampi[i].width,ampi[i].height,ampi[i].x,ampi[i].y,ampi[i].w,ampi[i].h,ampi[i].xp_idx); vf->put_slice(vf,&i[i]); } } @@ -263,7 +263,7 @@ if(drop_frame) return 0; update_subtitle(pts); - vo_flush_pages(); + vo_flush_page(dae_curr_vdecoded()); t2=GetTimer()-t2; tt=t2*0.000001f; Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/libmpcodecs/vd.c 2012-10-19 12:33:03 UTC (rev 172) @@ -9,6 +9,7 @@ #include <malloc.h> #endif +#include "dec_ahead.h" #include "codec-cfg.h" #include "../libvo/img_format.h" @@ -166,7 +167,7 @@ goto csp_again; } else { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc - vf_instance_t* vo, *vp = NULL, *ve; + vf_instance_t* voi, *vp = NULL, *ve; // Remove the scale filter if we added it ourself if(vf == sc) { ve = vf; @@ -174,8 +175,8 @@ vf_uninit_filter(ve); } // Find the last filter (vf_vo) - for(vo = vf ; vo->next ; vo = vo->next) - vp = vo; + for(voi = vf ; voi->next ; voi = voi->next) + vp = voi; } MSG_WARN(MSGTR_VOincompCodec); sh->vfilter_inited=-1; @@ -226,17 +227,17 @@ } } if(sh->aspect>0.01){ - int w; + int _w; MSG_V("Movie-Aspect is %.2f:1 - prescaling to correct movie aspect.\n", sh->aspect); - w=(int)((float)screen_size_y*sh->aspect); w+=w%2; // round + _w=(int)((float)screen_size_y*sh->aspect); _w+=_w%2; // round // we don't like horizontal downscale || user forced width: - if(w<screen_size_x || vo.screen_size_xy>8){ + if(_w<screen_size_x || vo.screen_size_xy>8){ screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect)); screen_size_y+=screen_size_y%2; // round if(screen_size_y<sh->disp_h) // Do not downscale verticaly screen_size_y=sh->disp_h; - } else screen_size_x=w; // keep new width + } else screen_size_x=_w; // keep new width } else { MSG_V("Movie-Aspect is undefined - no prescaling applied.\n"); } @@ -260,7 +261,7 @@ MSG_DBG2("vf->config(%dx%d->%dx%d,flags=%d,'%s',%p)\n", sh->disp_w,sh->disp_h, screen_size_x,screen_size_y, - fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3), + vo.fullscreen|(vo.vidmode<<1)|(vo.softzoom<<2)|(vo.flip<<3), vo_format_name(out_fmt),tune); return 1; } @@ -271,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); + mp_image_t* mpi=vf_get_image(sh->vfilter,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h,dae_curr_vdecoded()); 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/demux_audio.c =================================================================== --- mplayerxp/libmpdemux/demux_audio.c 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/libmpdemux/demux_audio.c 2012-10-19 12:33:03 UTC (rev 172) @@ -1675,7 +1675,7 @@ npercents=(seeka->flags&DEMUX_SEEK_SET)?percents:cpercents+percents; if(npercents>100) npercents=100; newpos=demuxer->movi_start+(off_t)(((float)priv->toc[npercents]/256.0)*priv->nbytes); - MSG_DBG2("xing seeking: secs=%f prcnts=%u cprcnts=%u spos=%llu newpos=%llu\n",rel_seek_secs,npercents,cpercents,spos,newpos); + MSG_DBG2("xing seeking: secs=%f prcnts=%u cprcnts=%u spos=%llu newpos=%llu\n",seeka->secs,npercents,cpercents,spos,newpos); stream_seek(demuxer->stream,newpos); priv->last_pts=(((float)demuxer->movi_length*npercents)/100.)*1000.; return; Modified: mplayerxp/libmpdemux/demux_ty.c =================================================================== --- mplayerxp/libmpdemux/demux_ty.c 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/libmpdemux/demux_ty.c 2012-10-19 12:33:03 UTC (rev 172) @@ -754,7 +754,7 @@ off_t res; TiVoInfo *tivo = demuxer->priv; - MSG_DBG3( "ty:Seeking to %7.1f\n", rel_seek_secs ); + MSG_DBG3( "ty:Seeking to %7.1f\n", seeka->secs ); tivo->lastAudioEnd = 0; tivo->lastAudioPTS = -1; Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-10-19 12:33:03 UTC (rev 172) @@ -12,6 +12,8 @@ #include "../dec_ahead.h" pthread_mutex_t demuxer_mutex=PTHREAD_MUTEX_INITIALIZER; +#define LOCK_DEMUXER() { pthread_mutex_lock(&demuxer_mutex); } +#define UNLOCK_DEMUXER() { pthread_mutex_unlock(&demuxer_mutex); } static float get_ds_stream_pts(demux_stream_t *ds,int nbytes) { Modified: mplayerxp/libmpdemux/demuxer_r.h =================================================================== --- mplayerxp/libmpdemux/demuxer_r.h 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/libmpdemux/demuxer_r.h 2012-10-19 12:33:03 UTC (rev 172) @@ -11,10 +11,6 @@ extern "C" { #endif -extern pthread_mutex_t demuxer_mutex; -#define LOCK_DEMUXER() { pthread_mutex_lock(&demuxer_mutex); } -#define UNLOCK_DEMUXER() { pthread_mutex_unlock(&demuxer_mutex); } - #define ds_tell_pts_r(ds) ds_tell_pts(ds) extern int demux_getc_r(demux_stream_t *ds,float *pts); Modified: mplayerxp/libvo/screenshot.c =================================================================== --- mplayerxp/libvo/screenshot.c 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/libvo/screenshot.c 2012-10-19 12:33:03 UTC (rev 172) @@ -43,7 +43,7 @@ FILE * fp; png_structp png_ptr; png_infop info_ptr; - enum {OK,ERROR} status; + enum {OK,ERROR} status; }; static struct pngdata create_png (char * fname) @@ -68,22 +68,22 @@ png.status = ERROR; return png; } - + if (setjmp(png.png_ptr->jmpbuf)) { - MSG_V("PNG Internal error!\n"); + MSG_V("PNG Internal error!\n"); png_destroy_write_struct(&png.png_ptr, &png.info_ptr); fclose(png.fp); png.status = ERROR; return png; } - + png.fp = fopen (fname, "wb"); if (png.fp == NULL) { MSG_ERR("\nPNG Error opening %s for writing!\n", strerror(errno)); - png.status = ERROR; - return png; - } - + png.status = ERROR; + return png; + } + MSG_V("PNG Init IO\n"); png_init_io(png.png_ptr, png.fp); @@ -93,28 +93,28 @@ png_set_IHDR(png.png_ptr, png.info_ptr, sshot.image_width, sshot.image_height, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - + MSG_V("PNG Write Info\n"); png_write_info(png.png_ptr, png.info_ptr); - + if(sshot.cspace) { MSG_V("PNG Set BGR Conversion\n"); png_set_bgr(png.png_ptr); - } + } png.status = OK; return png; - -} - + +} + static uint8_t destroy_png(struct pngdata png) { - + MSG_V("PNG Write End\n"); png_write_end(png.png_ptr, png.info_ptr); MSG_V("PNG Destroy Write Struct\n"); png_destroy_write_struct(&png.png_ptr, &png.info_ptr); - + fclose (png.fp); return 0; @@ -177,7 +177,7 @@ } #endif -int gr_screenshot(const char *fname,uint8_t *planes[],int *strides,uint32_t fourcc,unsigned w,unsigned h) +int gr_screenshot(const char *fname,uint8_t *planes[],unsigned *strides,uint32_t fourcc,unsigned w,unsigned h) { unsigned k; char buf[256]; @@ -186,7 +186,7 @@ #endif uint8_t *image_data=NULL; uint8_t *dst[3]; - int dstStride[3],bpp = 24; + unsigned dstStride[3],bpp = 24; struct SwsContext * sws = NULL; @@ -215,9 +215,9 @@ MSG_HINT("PNG Warning: compression level set to 0, compression disabled!\n"); MSG_HINT("PNG Info: Use the -z <n> switch to set compression level from 0 to 9.\n"); MSG_HINT("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n"); - } + } } - else { + else { MSG_WARN("PNG Warning: compression level out of range setting to 1!\n"); MSG_WARN("PNG Info: Use the -z <n> switch to set compression level from 0 to 9.\n"); MSG_WARN("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n"); @@ -243,7 +243,7 @@ if(png.status){ MSG_ERR("PNG Error in create_png\n"); - } + } { png_byte *row_pointers[sshot.image_height]; @@ -251,7 +251,7 @@ for ( k = 0; k < sshot.image_height; k++ ) row_pointers[k] = &image_data[sshot.image_width*k*bppmul]; png_write_image(png.png_ptr, row_pointers); } - + destroy_png(png); #else write_bmp(buf,w,h,image_data); Modified: mplayerxp/libvo/screenshot.h =================================================================== --- mplayerxp/libvo/screenshot.h 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/libvo/screenshot.h 2012-10-19 12:33:03 UTC (rev 172) @@ -3,6 +3,6 @@ #ifndef __VO_SCREENSHOT #define __VO_SCREENSHOT 1 -extern int gr_screenshot(const char *fname,uint8_t *planes[],int *strides,uint32_t fourcc,unsigned w,unsigned h); +extern int gr_screenshot(const char *fname,uint8_t *planes[],unsigned *strides,uint32_t fourcc,unsigned w,unsigned h); #endif Modified: mplayerxp/libvo/sub.c =================================================================== --- mplayerxp/libvo/sub.c 2012-10-18 14:27:24 UTC (rev 171) +++ mplayerxp/libvo/sub.c 2012-10-19 12:33:03 UTC (rev 172) @@ -17,7 +17,6 @@ #include "../libmpdemux/stream.h" #define MSGT_CLASS MSGT_OSD #include "../__mp_msg.h" -#define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */ static const char * __sub_osd_names[]={ "Seekbar", @@ -68,9 +67,10 @@ } // renders the buffer -inline static void vo_draw_text_from_buffer(mp_osd_obj_t* obj,draw_osd_f draw_alpha){ +inline static void vo_draw_text_from_buffer(unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ if (obj->allocated > 0) { - draw_alpha(obj->bbox.x1,obj->bbox.y1, + draw_alpha(idx, + obj->bbox.x1,obj->bbox.y1, obj->bbox.x2-obj->bbox.x1, obj->bbox.y2-obj->bbox.y1, obj->bitmap_buffer, @@ -131,7 +131,7 @@ } -inline static void __FASTCALL__ vo_draw_text_osd(mp_osd_obj_t* obj,draw_osd_f draw_alpha){ +inline static void __FASTCALL__ vo_draw_text_osd(unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ unsigned char *cp=(unsigned char *)vo.osd_text; int font; int x=obj->x; @@ -139,13 +139,14 @@ while (*cp){ int c=*cp++; if ((font=vo.font->font[c])>=0 && c != ' ') - draw_alpha(x,obj->y, - vo.font->width[c], - vo.font->pic_a[font]->h, - vo.font->pic_b[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->w); - x+=vo.font->width[c]+vo.font->charspace; + draw_alpha( idx, + x,obj->y, + vo.font->width[c], + vo.font->pic_a[font]->h, + vo.font->pic_b[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->w); + x+=vo.font->width[c]+vo.font->charspace; } } @@ -189,7 +190,7 @@ } -inline static void __FASTCALL__ vo_draw_text_progbar(mp_osd_obj_t* obj,draw_osd_f draw_alpha){ +inline static void __FASTCALL__ vo_draw_text_progbar(unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ unsigned char *s; unsigned char *sa; int i,w,h,st,mark; @@ -208,41 +209,41 @@ if (mark>elems) mark=elems; } - c=vo.osd_progbar_type; - if(vo.osd_progbar_type>0 && (font=vo.font->font[c])>=0) { + c=vo.osd_progbar_type; + if(vo.osd_progbar_type>0 && (font=vo.font->font[c])>=0) { int xp=x-vo.font->width[c]-vo.font->spacewidth; - draw_alpha((xp<0?0:xp),y, - vo.font->width[c], - vo.font->pic_a[font]->h, - vo.font->pic_b[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->w); + draw_alpha(idx,(xp<0?0:xp),y, + vo.font->width[c], + vo.font->pic_a[font]->h, + vo.font->pic_b[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->w); } - c=OSD_PB_START; - if ((font=vo.font->font[c])>=0) - draw_alpha(x,y, - vo.font->width[c], - vo.font->pic_a[font]->h, - vo.font->pic_b[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->w); - x+=vo.font->width[c]+vo.font->charspace; + c=OSD_PB_START; + if ((font=vo.font->font[c])>=0) + draw_alpha(idx,x,y, + vo.font->width[c], + vo.font->pic_a[font]->h, + vo.font->pic_b[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->w); + x+=vo.font->width[c]+vo.font->charspace; - c=OSD_PB_0; - if ((font=vo.font->font[c])>=0){ + c=OSD_PB_0; + if ((font=vo.font->font[c])>=0){ w=vo.font->width[c]; h=vo.font->pic_a[font]->h; s=vo.font->pic_b[font]->bmp+vo.font->start[c]; sa=vo.font->pic_a[font]->bmp+vo.font->start[c]; st=vo.font->pic_a[font]->w; if ((i=mark)) do { - draw_alpha(x,y,w,h,s,sa,st); + draw_alpha(idx,x,y,w,h,s,sa,st); x+=charw; } while(--i); } - c=OSD_PB_1; + c=OSD_PB_1; if ((font=vo.font->font[c])>=0){ w=vo.font->width[c]; h=vo.font->pic_a[font]->h; @@ -250,19 +251,19 @@ sa=vo.font->pic_a[font]->bmp+vo.font->start[c]; st=vo.font->pic_a[font]->w; if ((i=elems-mark)) do { - draw_alpha(x,y,w,h,s,sa,st); + draw_alpha(idx,x,y,w,h,s,sa,st); x+=charw; } while(--i); } - c=OSD_PB_END; - if ((font=vo.font->font[c])>=0) - draw_alpha(x,y, - vo.font->width[c], - vo.font->pic_a[font]->h, - vo.font->pic_b[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->w); + c=OSD_PB_END; + if ((font=vo.font->font[c])>=0) + draw_alpha(idx,x,y, + vo.font->width[c], + vo.font->pic_a[font]->h, + vo.font->pic_b[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->bmp+vo.font->start[c], + vo.font->pic_a[font]->w); // x+=vo.font->width[c]+vo.font->charspace; @@ -379,7 +380,7 @@ } -inline static void __FASTCALL__ vo_draw_text_sub(mp_osd_obj_t* obj,draw_osd_f draw_alpha){ +inline static void __FASTCALL__ vo_draw_text_sub(unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ int i,j,c,x,l,font; int y=obj->y; @@ -388,7 +389,7 @@ x=obj->params.subtitle.xtbl[i++]; while ((c=obj->params.subtitle.utbl[j++])){ if ((font=vo.font->font[c])>=0) - draw_alpha(x,y, + draw_alpha(idx,x,y, vo.font->width[c], vo.font->pic_a[font]->h+y<obj->dys ? vo.font->pic_a[font]->h : obj->dys-y, vo.font->pic_b[font]->bmp+vo.font->start[c], @@ -506,7 +507,7 @@ new_osd_obj(OSDTYPE_DVDNAV); } -void __FASTCALL__ vo_remove_text(int dxs,int dys,clear_osd_f remove){ +void __FASTCALL__ vo_remove_text(unsigned idx,int dxs,int dys,clear_osd_f f_remove){ mp_osd_obj_t* obj=vo_osd_list; vo_update_osd(dxs,dys); while(obj){ @@ -517,7 +518,7 @@ int h=obj->old_bbox.y2-obj->old_bbox.y1; if(w>0 && h>0){ vo.osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack - remove(obj->old_bbox.x1,obj->old_bbox.y1,w,h); + f_remove(idx,obj->old_bbox.x1,obj->old_bbox.y1,w,h); } // obj->flags&=~OSDFLAG_OLD_BBOX; if(obj->cleared_frames>=0) { @@ -530,7 +531,7 @@ } } -void __FASTCALL__ vo_draw_text(... [truncated message content] |
From: <nic...@us...> - 2012-10-19 13:51:54
|
Revision: 173 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=173&view=rev Author: nickols_k Date: 2012-10-19 13:51:44 +0000 (Fri, 19 Oct 2012) Log Message: ----------- remove useless feature: correcting A-V delay by hands Modified Paths: -------------- DOCS/mplayerxp.1 mplayerxp/cfg-mplayer.h mplayerxp/input/input.c mplayerxp/input/input.h mplayerxp/mplayer.c mplayerxp/nls/help_mp-bg.h mplayerxp/nls/help_mp-cz.h mplayerxp/nls/help_mp-de.h mplayerxp/nls/help_mp-dk.h mplayerxp/nls/help_mp-el.h mplayerxp/nls/help_mp-en.h mplayerxp/nls/help_mp-es.h mplayerxp/nls/help_mp-fr.h mplayerxp/nls/help_mp-hu.h mplayerxp/nls/help_mp-it.h mplayerxp/nls/help_mp-ja.h mplayerxp/nls/help_mp-ko.h mplayerxp/nls/help_mp-mk.h mplayerxp/nls/help_mp-nb.h mplayerxp/nls/help_mp-nl.h mplayerxp/nls/help_mp-no.h mplayerxp/nls/help_mp-pl.h mplayerxp/nls/help_mp-pt.h mplayerxp/nls/help_mp-ro.h mplayerxp/nls/help_mp-ru.h mplayerxp/nls/help_mp-sk.h mplayerxp/nls/help_mp-sv.h mplayerxp/nls/help_mp-tr.h mplayerxp/nls/help_mp-uk.h mplayerxp/nls/help_mp-zh.h Modified: DOCS/mplayerxp.1 =================================================================== --- DOCS/mplayerxp.1 2012-10-19 12:33:03 UTC (rev 172) +++ DOCS/mplayerxp.1 2012-10-19 13:51:44 UTC (rev 173) @@ -141,9 +141,6 @@ Useful with -pts in XP mode on some MPEG where the frames are not stored in order. The frames pts is reordered as they are add to buffer. .TP -.B \-sync.delay\ <secs> -audio delay in seconds (may be +/- float value) -.TP .B \-sync.fps\ <value> force frame rate (if value is wrong in the header) (float number) (works with @@ -1884,9 +1881,6 @@ .SS manual A-V synchronization keys .TP -.B +/- -adjust audio delay by +/- 0.1 second -.TP .B z/x adjust subtitle delay by +/- 0.1 second .TP Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/cfg-mplayer.h 2012-10-19 13:51:44 UTC (rev 173) @@ -196,7 +196,6 @@ static const config_t avsync_config[]={ - {"delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL, "specifies delay in seconds audio stream relatively video"}, {"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"}, Modified: mplayerxp/input/input.c =================================================================== --- mplayerxp/input/input.c 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/input/input.c 2012-10-19 13:51:44 UTC (rev 173) @@ -49,7 +49,6 @@ static const mp_cmd_t mp_cmds[] = { { MP_CMD_SEEK, "seek", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, - { MP_CMD_AUDIO_DELAY, "audio_delay", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, { MP_CMD_SPEED_INCR, "speed_incr", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, { MP_CMD_SPEED_MULT, "speed_mult", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, { MP_CMD_SPEED_SET, "speed_set", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, @@ -252,8 +251,6 @@ { { KEY_DOWN, 0 }, "seek -60" }, { { KEY_PAGE_UP, 0 }, "seek 600" }, { { KEY_PAGE_DOWN, 0 }, "seek -600" }, - { { '-', 0 }, "audio_delay 0.100" }, - { { '+', 0 }, "audio_delay -0.100" }, { { '[', 0 }, "speed_mult 0.9091" }, { { ']', 0 }, "speed_mult 1.1" }, { { '{', 0 }, "speed_mult 0.5" }, Modified: mplayerxp/input/input.h =================================================================== --- mplayerxp/input/input.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/input/input.h 2012-10-19 13:51:44 UTC (rev 173) @@ -1,6 +1,6 @@ // All commands id #define MP_CMD_SEEK 0 -#define MP_CMD_AUDIO_DELAY 1 +#define MP_CMD_RESERVED 1 #define MP_CMD_QUIT 2 #define MP_CMD_PAUSE 3 #define MP_CMD_SOFT_QUIT 4 Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/mplayer.c 2012-10-19 13:51:44 UTC (rev 173) @@ -109,7 +109,6 @@ int audio_eof=0; demux_stream_t *d_video=NULL; static int osd_show_framedrop = 0; -static int osd_show_av_delay = 0; static int osd_show_sub_delay = 0; static int osd_function=OSD_PLAY; int output_quality=0; @@ -240,7 +239,6 @@ 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 float audio_delay=0; static int dapsync=0; static int softsleep=0; @@ -1161,15 +1159,10 @@ if (osd_show_sub_delay) { sprintf(osd_text_tmp, "Sub delay: %d ms",(int)(sub_delay*1000)); osd_show_sub_delay--; - } else - if (osd_show_framedrop) { + } else if (osd_show_framedrop) { sprintf(osd_text_tmp, "Framedrop: %s",frame_dropping>1?"hard":frame_dropping?"vo":"none"); osd_show_framedrop--; } else - if (osd_show_av_delay) { - sprintf(osd_text_tmp, "A-V delay: %d ms",(int)(audio_delay*1000)); - osd_show_av_delay--; - } else #ifdef ENABLE_DEC_AHEAD_DEBUG if(verbose) sprintf(osd_text_tmp,"%c %02d:%02d:%02d abs frame: %u",osd_function,pts/3600,(pts/60)%60,pts%60,abs_dec_ahead_active_frame); else sprintf(osd_text_tmp,"%c %02d:%02d:%02d",osd_function,pts/3600,(pts/60)%60,pts%60); @@ -1249,7 +1242,7 @@ static void __show_status_line(float a_pts,float video_pts,float delay,float AV_delay,video_stat_t *vstat) { MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d %d [frms: [%i]]\n", - a_pts-audio_delay-delay,video_pts,AV_delay,c_total, + a_pts-delay,video_pts,AV_delay,c_total, (int)sh_video->num_frames,sh_video->num_frames_decoded, (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0, (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0, @@ -1279,7 +1272,7 @@ a_pts+=(ds_tell_pts_r(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; } if( !av_sync_pts && enable_xp>=XP_VideoAudio ) delay += get_delay_audio_buffer(); - AV_delay = a_pts-audio_delay-delay - video_pts; + AV_delay = a_pts-delay-video_pts; __show_status_line(a_pts,video_pts,delay,AV_delay,vstat); } @@ -1497,7 +1490,7 @@ if(delay_corrected && blit_frame){ float x; - AV_delay=(a_pts-delay-audio_delay)-*v_pts; + 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; @@ -2273,18 +2266,6 @@ seek->secs+= v; } } break; - case MP_CMD_AUDIO_DELAY : { - float v = cmd->args[0].v.f; - audio_delay += v; - osd_show_av_delay = osd->info_factor; - if(sh_audio) { - if(enable_xp>=XP_VAPlay) - pthread_mutex_lock(&audio_timer_mutex); - sh_audio->timer+= v; - if(enable_xp>=XP_VAPlay) - pthread_mutex_unlock(&audio_timer_mutex); - } - } break; case MP_CMD_SPEED_INCR : case MP_CMD_SPEED_MULT : case MP_CMD_SPEED_SET : @@ -2794,7 +2775,6 @@ } if(sh_audio) { // <- ??? always true - sh_audio->timer=-audio_delay; sh_audio->chapter_change=0; sh_audio->a_pts=HUGE; } else { Modified: mplayerxp/nls/help_mp-bg.h =================================================================== --- mplayerxp/nls/help_mp-bg.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-bg.h 2012-10-19 13:51:44 UTC (rev 173) @@ -28,7 +28,6 @@ " < или > стъпка назад/напред в playlist списъка\n" " p или SPACE пауза (натиснете произволен клавиш за продължение)\n" " q или ESC спиране на възпроизвеждането и изход от програмата\n" -" + или - промяна закъснението на звука с +/- 0.1 секунда\n" " o превключва OSD режима: без/лента за превъртане/лента и таймер\n" " * или / увеличава или намалява силата на звука (PCM)\n" " z или x променя закъснението на субтитрите с +/- 0.1 секунда\n" Modified: mplayerxp/nls/help_mp-cz.h =================================================================== --- mplayerxp/nls/help_mp-cz.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-cz.h 2012-10-19 13:51:44 UTC (rev 173) @@ -31,7 +31,6 @@ " < nebo > posun vzad/vpřed v seznamu přehrávaných souborů\n" " p nebo mezerník pauza při přehrávání (pokračování stiskem kterékoliv klávesy)\n" " q nebo ESC konec přehrávání a ukončení programu\n" -" + nebo - upravit zpoždění zvuku v krocích +/- 0.1 sekundy\n" " o cyklická změna režimu OSD: nic / pozice / pozice+čas\n" " * nebo / přidat nebo ubrat hlasitost (stiskem 'm' výběr master/pcm)\n" " z nebo x upravit zpoždění titulků v krocích +/- 0.1 sekundy\n" Modified: mplayerxp/nls/help_mp-de.h =================================================================== --- mplayerxp/nls/help_mp-de.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-de.h 2012-10-19 13:51:44 UTC (rev 173) @@ -27,7 +27,6 @@ " rauf / runter Springe eine Minute vor/zurück\n" " p oder LEER PAUSE (beliebige Taste zum Fortsetzen)\n" " q oder ESC Abspielen stoppen und Programm beenden\n" -" + oder - Audioverzögerung um +/- 0.1 Sekunde verändern\n" " o OSD Mode: Aus / Suchleiste / Suchleiste + Zeit\n" " * oder / Lautstärke verstellen ('m' für Auswahl Master/Wave)\n" " z oder x Untertitelverzögerung um +/- 0.1 Sekunde verändern\n" Modified: mplayerxp/nls/help_mp-dk.h =================================================================== --- mplayerxp/nls/help_mp-dk.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-dk.h 2012-10-19 13:51:44 UTC (rev 173) @@ -28,7 +28,6 @@ " < or > søger frem og tilbage i en afspilningsliste\n" " p or SPACE pause filmen (starter igen ved en vilkårlig tast)\n" " q or ESC stop afspilning og afslut program\n" -" + or - juster lyd forsinkelse med +/- 0.1 sekund\n" " o vælger OSD typer: ingen / søgebar / søgebar+tid\n" " * or / forøjer eller formindsker volumen (tryk 'm' for at vælge master/pcm)\n" " z or x justerer undertekst forsinkelse med +/- 0.1 sekund\n" Modified: mplayerxp/nls/help_mp-el.h =================================================================== --- mplayerxp/nls/help_mp-el.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-el.h 2012-10-19 13:51:44 UTC (rev 173) @@ -28,7 +28,6 @@ " < ή > αναζήτηση μπρος/πίσω στην λίστα αναπαραγωγής\n" " p ή SPACE παύση ταινίας (πατήστε οποιοδήποτε πλήκτρο για να συνεχίσετε)\n" " q ή ESC στοπ την αναπαραγωγή και έξοδος προγράμματος\n" -" + ή - ρύθμιση καθυστέρησης ήχου κατά +/- 0.1 δευτερόλεπτα\n" " o αλλαγή της OSD μεθόδου: τίποτα / μπάρα προόδου / μπάρα προόδου+χρόνος\n" " * ή / αύξηση ή μείωση της έντασης του ήχου (πατήστε 'm' για επιλογή master/pcm)\n" " z ή x ρύθμιση καθυστέρησης υποτίτλων κατά +/- 0.1 δευτερόλεπτα\n" Modified: mplayerxp/nls/help_mp-en.h =================================================================== --- mplayerxp/nls/help_mp-en.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-en.h 2012-10-19 13:51:44 UTC (rev 173) @@ -33,7 +33,6 @@ " < or > seek backward/forward in playlist\n" " p or SPACE pause movie (press any key to continue)\n" " q or ESC stop playing and quit program\n" -" + or - adjust audio delay by +/- 0.1 second\n" " o cycle OSD mode: none / seekbar / seekbar+timer\n" " * or / increase or decrease volume (press 'm' to select master/pcm)\n" " z or x adjust subtitle delay by +/- 0.1 second\n" Modified: mplayerxp/nls/help_mp-es.h =================================================================== --- mplayerxp/nls/help_mp-es.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-es.h 2012-10-19 13:51:44 UTC (rev 173) @@ -29,7 +29,6 @@ " < o > avanza/retrocede en la lista de reproducción\n" " p o ESPACIO pausa el video (presione cualquier tecla para continuar)\n" " q o ESC detiene la reproducción y sale del programa\n" -" + o - ajusta el retardo de audio en +/- 0.1 segundos\n" " o cambia el modo OSD: nada / búsqueda / búsqueda+tiempo\n" " * o / aumenta o disminuye el volumen (presione 'm' para elegir entre master/pcm)\n" " z o x ajusta el retardo del subtítulo en +/- 0.1 segundos\n" Modified: mplayerxp/nls/help_mp-fr.h =================================================================== --- mplayerxp/nls/help_mp-fr.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-fr.h 2012-10-19 13:51:44 UTC (rev 173) @@ -32,7 +32,6 @@ " < ou > Saute en avant/arrière dans la playlist\n" " p ou ESPACE Pause (presser n'importe quelle touche pour continuer)\n" " q ou ESC Arrête la lecture et quitter le programme\n" -" + ou - Ajuste le délai audio de +/- 0.1 seconde\n" " o Mode OSD: aucun / cherchable / cherchable+temps\n" " * ou / Augmente/diminue volume ('m' pour sélectionner maître/pcm)\n" " z ou x Ajuste le délai des sous-titres de +/- 0.1 seconde\n" Modified: mplayerxp/nls/help_mp-hu.h =================================================================== --- mplayerxp/nls/help_mp-hu.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-hu.h 2012-10-19 13:51:44 UTC (rev 173) @@ -27,7 +27,6 @@ " pgup v. pgdown 10 percnyi hátra/előre ugrás\n" " p vagy SPACE pillanatállj (bármely billentyűre továbbmegy)\n" " q vagy ESC kilépés\n" -" + vagy - audio késleltetése +/- 0.1 másodperccel\n" " o OSD-mód váltása: nincs / keresősáv / keresősáv+idő\n" " * vagy / hangerő fel/le ('m' billentyű master/pcm között vált)\n" " z vagy x felirat késleltetése +/- 0.1 másodperccel\n" Modified: mplayerxp/nls/help_mp-it.h =================================================================== --- mplayerxp/nls/help_mp-it.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-it.h 2012-10-19 13:51:44 UTC (rev 173) @@ -31,7 +31,6 @@ " < o > va indietro/avanti nella playlist\n" " p o SPAZIO mette in pausa il filmato (premere un qualunque tasto per continuare)\n" " q o ESC ferma la riproduzione ed esce dal programma\n" -" + o - regola il ritardo audio di +/- 0.1 secondi\n" " o cambia tra le modalità OSD: niente / barra di ricerca / barra di ricerca + tempo\n" " * o / incrementa o decrementa il volume (premere 'm' per selezionare master/pcm)\n" " z o x regola il ritardo dei sottotitoli di +/- 0.1 secondi\n" Modified: mplayerxp/nls/help_mp-ja.h =================================================================== --- mplayerxp/nls/help_mp-ja.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-ja.h 2012-10-19 13:51:44 UTC (rev 173) @@ -28,7 +28,6 @@ " < or > プレイリストを元に前後のファイルに遷移します\n" " p or SPACE 再生を静止します(何かボタンを押下すると再生を開始します)\n" " q or ESC 再生を静止し、プログラムを停止します\n" -" + or - 音声を 0.1 秒単位で早めたり遅れさせたり調整する\n" " o cycle OSD mode: none / seekbar / seekbar + timer\n" " * or / PCM 音量を上げたり下げたりする\n" " z or x subtitleを 0.1 秒単位で早めたり遅れさせたり調整する\n" Modified: mplayerxp/nls/help_mp-ko.h =================================================================== --- mplayerxp/nls/help_mp-ko.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-ko.h 2012-10-19 13:51:44 UTC (rev 173) @@ -31,7 +31,6 @@ " < 또는 > 재생목록에서 뒤로/앞으로 이동\n" " p 또는 SPACE 잠시 멈춤 (아무키나 누르면 계속)\n" " q 또는 ESC 재생을 멈추고 프로그램을 끝냄\n" -" + 또는 - +/- 0.1초 오디오 지연 조절\n" " o OSD모드 변경: 없음/탐색줄/탐색줄+타이머\n" " * 또는 / 볼륨 높임/낮춤 ('m'을 눌러 master/pcm 선택)\n" " z 또는 x +/- 0.1초 자막 지연 조절\n" Modified: mplayerxp/nls/help_mp-mk.h =================================================================== --- mplayerxp/nls/help_mp-mk.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-mk.h 2012-10-19 13:51:44 UTC (rev 173) @@ -28,7 +28,6 @@ " < или > чекор назад/напред во плејлистата\n" " p или SPACE го паузира филмот (притиснете на било кое копче да продолжи)\n" " q или ESC го стопира пуштањето и излегува од програмата\n" -" + или - приспосубување на аудио задоцнувањето со +/- 0.1 секунда\n" " o цикличен OSD мод: ниеден / барот за барање / барот за барање + тајмер\n" " * или / зголемување или намалување на PCM тонот\n" " z или x прилагодување на задоцнувањето на преводот со +/- 0.1 секунда\n" Modified: mplayerxp/nls/help_mp-nb.h =================================================================== --- mplayerxp/nls/help_mp-nb.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-nb.h 2012-10-19 13:51:44 UTC (rev 173) @@ -26,7 +26,6 @@ " < or > søk bakover/fremover i playlisten\n" " p eller MELLOMROM pause filmen (trykk en tast for å fortsette)\n" " q eller ESC stopp avspilling og avslutt programmet\n" -" + eller - juster lyd-forsinkelse med +/- 0.1 sekund\n" " o gå gjennom OSD modi: ingen / søkelinje / søkelinje+tidsvisning\n" " * eller / øk eller mink volumet (trykk 'm' for å velge master/pcm)\n" " z or x juster undertittelens forsinkelse med +/- 0.1 sekund\n" Modified: mplayerxp/nls/help_mp-nl.h =================================================================== --- mplayerxp/nls/help_mp-nl.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-nl.h 2012-10-19 13:51:44 UTC (rev 173) @@ -27,7 +27,6 @@ " < or > ga naar vorige/volgende item in playlist\n" " p of SPACE pauzeer film (druk eender welke toets om verder te gaan)\n" " q of ESC stop afspelen en sluit programma af\n" -" + of - pas audio vertraging aan met +/- 0.1 seconde\n" " o cycle OSD mode: geen / zoekbalk / zoekbalk+tijd\n" " * of / verhoog of verlaag volume (druk 'm' om master/pcm te selecteren)\n" " z of x pas ondertiteling vertraging aan met +/- 0.1 seconde\n" Modified: mplayerxp/nls/help_mp-no.h =================================================================== --- mplayerxp/nls/help_mp-no.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-no.h 2012-10-19 13:51:44 UTC (rev 173) @@ -28,7 +28,6 @@ " < or > søk bakover/fremover i playlisten\n" " p eller MELLOMROM pause filmen (trykk en tast for å fortsette)\n" " q eller ESC stopp avspilling og avslutt programmet\n" -" + eller - juster lyd-forsinkelse med +/- 0.1 sekund\n" " o gå gjennom OSD modi: ingen / søkelinje / søkelinje+tidsvisning\n" " * eller / øk eller mink volumet (trykk 'm' for å velge master/pcm)\n" " z or x juster undertittelens forsinkelse med +/- 0.1 sekund\n" Modified: mplayerxp/nls/help_mp-pl.h =================================================================== --- mplayerxp/nls/help_mp-pl.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-pl.h 2012-10-19 13:51:44 UTC (rev 173) @@ -28,7 +28,6 @@ " < lub > przeskok o jedną pozycję w playliście\n" " p lub SPACE zatrzymanie filmu (kontynuacja - dowolny klawisz)\n" " q lub ESC zatrzymanie odtwarzania i wyjście z programu\n" -" + lub - regulacja opóźnienia dźwięku o +/- 0.1 sekundy\n" " o przełączanie trybów OSD: pusty / belka / belka i zegar\n" " * lub / zwiększenie lub zmniejszenie natężenia dźwięku\n" " (naciśnij 'm' żeby wybrać master/pcm)\n" Modified: mplayerxp/nls/help_mp-pt.h =================================================================== --- mplayerxp/nls/help_mp-pt.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-pt.h 2012-10-19 13:51:44 UTC (rev 173) @@ -31,7 +31,6 @@ " < ou > retorna/avança na lista de reprodução\n" " p ou ESPAÇO pausa o filme (pressione qualquer tecla para continuar)\n" " q ou ESC para a reprodução e sai do programa\n" -" + ou - ajusta o atraso do audio de +/- 0.1 segundo\n" " o alterna modo OSD: nenhum / busca / busca+cronômetro\n" " * ou / aumenta ou diminui o volume pcm\n" " z ou x ajusta o atraso da legenda de +/- 0.1 segundo\n" Modified: mplayerxp/nls/help_mp-ro.h =================================================================== --- mplayerxp/nls/help_mp-ro.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-ro.h 2012-10-19 13:51:44 UTC (rev 173) @@ -26,7 +26,6 @@ " sus sau jos caută faţă/spate cu 1 minut\n" " p sau SPACE pune filmul pe pauză (orice tastă pentru a continua)\n" " q sau ESC opreşte filmul şi iese din program\n" -" + sau - ajustează decalajul audio cu +/- 0.1 secunde\n" " o roteşte modurile OSD: nimic / bară progres / bară progres+ceas\n" " * sau / creşte sau scade volumul (apăsaţi 'm' pentru principal/wav)\n" " z sau x ajustează decalajul subtitrării cu +/- 0.1 secunde\n" Modified: mplayerxp/nls/help_mp-ru.h =================================================================== --- mplayerxp/nls/help_mp-ru.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-ru.h 2012-10-19 13:51:44 UTC (rev 173) @@ -29,7 +29,6 @@ " < или > перемещение вперёд/назад в playlist'е\n" " p или ПРОБЕЛ приостановить фильм (любая клавиша - продолжить)\n" " q или ESC остановить воспроизведение и выход\n" -" + или - регулировать задержку звука по +/- 0.1 секунде\n" " o цикличный перебор OSD режимов: нет / навигация / навигация+таймер\n" " * или / прибавить или убавить громкость (нажатие 'm' выбирает master/pcm)\n" " z или x регулировать задержку субтитров по +/- 0.1 секунде\n" Modified: mplayerxp/nls/help_mp-sk.h =================================================================== --- mplayerxp/nls/help_mp-sk.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-sk.h 2012-10-19 13:51:44 UTC (rev 173) @@ -30,7 +30,6 @@ " < alebo > posun vzad/vpred v zozname prehrávaných súborov\n" " p al. medzerník pauza pri prehrávaní (pokračovaní stlačením niektorej klávesy)\n" " q alebo ESC koniec prehrávania a ukončenie programu\n" -" + alebo - upraviť spozdenie zvuku v krokoch +/- 0.1 sekundy\n" " o cyklická zmena režimu OSD: nič / pozícia / pozícia+čas\n" " * alebo / pridať alebo ubrať hlasitosť (stlačením 'm' výber master/pcm)\n" " z alebo x upraviť spozdenie titulkov v krokoch +/- 0.1 sekundy\n" Modified: mplayerxp/nls/help_mp-sv.h =================================================================== --- mplayerxp/nls/help_mp-sv.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-sv.h 2012-10-19 13:51:44 UTC (rev 173) @@ -28,7 +28,6 @@ " < eller > stega bakåt/framåt i spellistan\n" " p eller SPACE pausa filmen (tryck på valfri tagent för att fortsätta)\n" " q eller ESC stanna spelningen och avsluta programmet\n" -" + eller - ställ in audiofördröjning med ± 0.1 sekund\n" " o växla OSD läge: ingen / lägesindikator / lägesindikator + tidtagare\n" " * eller / öka eller sänk PCM-volym\n" " z eller x ställ in textningsfördröjning med ± 0.1 sekund\n" Modified: mplayerxp/nls/help_mp-tr.h =================================================================== --- mplayerxp/nls/help_mp-tr.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-tr.h 2012-10-19 13:51:44 UTC (rev 173) @@ -31,7 +31,6 @@ " < veya > çalma listesinde önceki/sonraki \n" " p veya BOŞLUK duraklat (devam etmek için herhangi bir tuşa basınız)\n" " q veya ESC durdur ve uygulamadan çık\n" -" + veya - ses gecikmesini +/- 0.1 saniye olarak ayarla\n" " o OSD modunu değiştir: yok / oynatma imi / oynatma imi + zamanlayıcı\n" " * veya / sesi yükselt veya alçalt\n" " z veya x altyazı gecikmesini +/- 0.1 saniye olarak ayarla\n" Modified: mplayerxp/nls/help_mp-uk.h =================================================================== --- mplayerxp/nls/help_mp-uk.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-uk.h 2012-10-19 13:51:44 UTC (rev 173) @@ -28,7 +28,6 @@ " < або > перемотування вперед/назад у списку програвання\n" " p або ПРОБІЛ зупинити фільм (будь-яка клавіша - продовжити)\n" " q або ESC зупинити відтворення і вихід\n" -" + або - регулювати затримку звуку по +/- 0.1 секунді\n" " o циклічний перебір OSD режимів: нема / навігація / навігація+таймер\n" " * або / додати або зменшити гучність (натискання 'm' вибирає master/pcm)\n" " z або x регулювати затримку субтитрів по +/- 0.1 секунді\n" Modified: mplayerxp/nls/help_mp-zh.h =================================================================== --- mplayerxp/nls/help_mp-zh.h 2012-10-19 12:33:03 UTC (rev 172) +++ mplayerxp/nls/help_mp-zh.h 2012-10-19 13:51:44 UTC (rev 173) @@ -39,7 +39,6 @@ " < 或 > 跳到播放列表中的前一个/后一个\n" " p 或 空格键 暂停影片(按任意键继续)\n" " q 或 ESC 停止播放并退出程序\n" -" + 或 - 音频延迟 +/- 0.1 秒\n" " o 循环切换 OSD 模式:无/定位条/定位条加计时器\n" " * 或 / 增加或减少 PCM 音量\n" " x 或 z 字幕延迟 +/- 0.1 秒\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-20 07:45:21
|
Revision: 178 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=178&view=rev Author: nickols_k Date: 2012-10-20 07:45:14 +0000 (Sat, 20 Oct 2012) Log Message: ----------- more correct computing of decoder outrun Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/dec_ahead.h mplayerxp/mplayer.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-19 17:06:52 UTC (rev 177) +++ mplayerxp/dec_ahead.c 2012-10-20 07:45:14 UTC (rev 178) @@ -94,6 +94,12 @@ 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; +} + frame_attr_t dae_played_fra(const dec_ahead_engine_t* it) { unsigned idx=it->player_idx; return it->fra[idx]; @@ -385,7 +391,7 @@ ,abs_dec_ahead_blitted_frame,abs_dec_ahead_locked_frame,lda_active_frame+xp_num_frames-2); if(output_quality) { unsigned total = xp_num_frames/2; - unsigned distance = dae_curr_vdecoded()-dae_curr_vplayed(); + unsigned distance = dae_get_decoder_outrun(xp_core.video); int our_quality; our_quality = output_quality*distance/total; if(drop_param) set_video_quality(sh_video,0); @@ -753,7 +759,7 @@ if(xp_core.has_video) { /* Match video buffer */ - vbuf_size = dae_curr_vdecoded() - dae_curr_vplayed(); + vbuf_size = dae_get_decoder_outrun(xp_core.video); pref_buf = vbuf_size / vo.fps * sh_audio->af_bps; pref_buf -= len; if( pref_buf > 0 ) { Modified: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2012-10-19 17:06:52 UTC (rev 177) +++ mplayerxp/dec_ahead.h 2012-10-20 07:45:14 UTC (rev 178) @@ -43,6 +43,7 @@ long long int num_decoded_frames; /* for frame dropping */ }dec_ahead_engine_t; + typedef struct xp_core_s { int has_video; int has_audio; @@ -72,6 +73,8 @@ 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); static inline unsigned dae_curr_vplayed() { return xp_core.video->player_idx; } static inline unsigned dae_curr_vdecoded() { return xp_core.video->decoder_idx; } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-19 17:06:52 UTC (rev 177) +++ mplayerxp/mplayer.c 2012-10-20 07:45:14 UTC (rev 178) @@ -2732,7 +2732,7 @@ if(sh_video) { do { usleep(0); - }while(dae_curr_vdecoded() < xp_num_frames/2 && !xp_eof); + }while(dae_get_decoder_outrun(xp_core.video) < xp_num_frames/2 && !xp_eof); } if(run_xp_players()!=0) exit_player("Can't run xp players!\n"); MSG_OK("Using the next %i threads:\n",xp_threads); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-20 09:00:03
|
Revision: 181 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=181&view=rev Author: nickols_k Date: 2012-10-20 08:59:56 +0000 (Sat, 20 Oct 2012) Log Message: ----------- make libvo re-enterable during resize events Modified Paths: -------------- mplayerxp/__mp_msg.h mplayerxp/dec_ahead.c mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_sdl.c mplayerxp/libvo/vo_x11.c mplayerxp/mplayer.c Modified: mplayerxp/__mp_msg.h =================================================================== --- mplayerxp/__mp_msg.h 2012-10-20 08:01:33 UTC (rev 180) +++ mplayerxp/__mp_msg.h 2012-10-20 08:59:56 UTC (rev 181) @@ -19,11 +19,11 @@ #define MSG_OK(args...) mp_msg(MSGT_CLASS,MSGL_OK,__FILE__,__LINE__,##args ) #define MSG_HINT(args...) mp_msg(MSGT_CLASS,MSGL_HINT,__FILE__,__LINE__,##args ) #define MSG_STATUS(args...) mp_msg(MSGT_CLASS,MSGL_STATUS,__FILE__,__LINE__,##args ) -#ifdef MP_DEBUG +//#ifdef MP_DEBUG #define MSG_DBG2(args...) mp_msg(MSGT_CLASS,MSGL_DBG2,__FILE__,__LINE__,##args ) #define MSG_DBG3(args...) mp_msg(MSGT_CLASS,MSGL_DBG3,__FILE__,__LINE__,##args ) -#else -#define MSG_DBG2(args...) -#define MSG_DBG3(args...) +//#else +//#define MSG_DBG2(args...) +//#define MSG_DBG3(args...) +//#endif #endif -#endif Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-20 08:01:33 UTC (rev 180) +++ mplayerxp/dec_ahead.c 2012-10-20 08:59:56 UTC (rev 181) @@ -936,7 +936,7 @@ xp_eof = 1; xp_core.video->fra[dae_curr_vdecoded()].eof=1; /* - Unlock all mutex + Unlock all mutex ( man page says it may deadlock, but what is worse deadlock here or later? ) */ pthread_is_living=0; Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-20 08:01:33 UTC (rev 180) +++ mplayerxp/libvo/video_out.c 2012-10-20 08:59:56 UTC (rev 181) @@ -134,6 +134,7 @@ uint32_t org_width,org_height; unsigned ps_off[4]; /* offsets for y,u,v in panscan mode */ unsigned long long int frame_counter; + pthread_mutex_t surfaces_mutex; }vo_priv_data_t; static vo_priv_data_t vo_data; @@ -171,6 +172,7 @@ void __FASTCALL__ vo_preinit_structs( void ) { + pthread_mutexattr_t attr; memset(&dri,0,sizeof(dri_priv_t)); dri.num_xp_frames=1; memset(&vo,0,sizeof(vo_priv_t)); @@ -181,6 +183,9 @@ vo.WinID=-1; vo.osd_progbar_type=-1; vo.osd_progbar_value=100; // 0..256 + memset(&vo_data,0,sizeof(vo_priv_data_t)); + pthread_mutexattr_init(&attr); + pthread_mutex_init(&vo_data.surfaces_mutex,&attr); } int __FASTCALL__ vo_init(const char *subdevice) @@ -484,6 +489,9 @@ return video_out->control(VOCTRL_RESUME,0); } +void vo_lock_surfaces(void) { pthread_mutex_lock(&vo_data.surfaces_mutex); } +void vo_unlock_surfaces(void) { pthread_mutex_unlock(&vo_data.surfaces_mutex); } + uint32_t __FASTCALL__ vo_get_surface( mp_image_t* mpi, unsigned decoder_idx) { int width_less_stride; @@ -526,6 +534,7 @@ /* it seems that surfaces are equal */ if((((mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE) && width_less_stride) || dri.planes_eq) && dri.dr) { + vo_lock_surfaces(); mpi->planes[0]=dri.surf[decoder_idx].planes[0]+dri.off[0]; mpi->planes[1]=dri.surf[decoder_idx].planes[1]+dri.off[1]; mpi->planes[2]=dri.surf[decoder_idx].planes[2]+dri.off[2]; @@ -533,6 +542,7 @@ mpi->stride[1]=dri.cap.strides[1]; mpi->stride[2]=dri.cap.strides[2]; mpi->flags|=MP_IMGFLAG_DIRECT; + vo_unlock_surfaces(); MSG_DBG2("dri_vo_dbg: vo_get_surface OK\n"); return VO_TRUE; } @@ -641,8 +651,9 @@ void vo_select_frame(unsigned play_idx) { MSG_DBG2("dri_vo_dbg: vo_select_frame(play_idx=%u)\n",play_idx); - + vo_lock_surfaces(); video_out->select_frame(play_idx); + vo_unlock_surfaces(); } void vo_flush_page(unsigned decoder_idx) Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-10-20 08:01:33 UTC (rev 180) +++ mplayerxp/libvo/video_out.h 2012-10-20 08:59:56 UTC (rev 181) @@ -172,7 +172,11 @@ extern uint32_t vo_screenshot( unsigned idx ); extern uint32_t vo_pause( void ); extern uint32_t vo_resume( void ); + +extern void vo_lock_surfaces(void); +extern void vo_unlock_surfaces(void); extern uint32_t __FASTCALL__ vo_get_surface( mp_image_t* mpi,unsigned decoder_idx); + extern int vo_check_events( void ); extern unsigned __FASTCALL__ vo_get_num_frames( void ); extern uint32_t __FASTCALL__ vo_draw_slice(const mp_image_t *mpi); Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-10-20 08:01:33 UTC (rev 180) +++ mplayerxp/libvo/vo_sdl.c 2012-10-20 08:59:56 UTC (rev 181) @@ -489,24 +489,26 @@ static int __FASTCALL__ set_video_mode(int width, int height, int bpp, uint32_t sdlflags) { struct sdl_priv_s *priv = &sdl_priv; - SDL_Surface* newsurface; + SDL_Surface* newsurface; int retval=-1; newsurface = SDL_SetVideoMode(width, height, bpp, sdlflags); if(newsurface) { - /* priv->surface will be NULL the first time this function is called. */ - if(priv->surface) - SDL_FreeSurface(priv->surface); + vo_lock_surfaces(); + /* priv->surface will be NULL the first time this function is called. */ + if(priv->surface) + SDL_FreeSurface(priv->surface); - priv->surface = newsurface; - priv->dstwidth = width; - priv->dstheight = height; + priv->surface = newsurface; + priv->dstwidth = width; + priv->dstheight = height; - retval = setup_surfaces(); + retval = setup_surfaces(); + vo_unlock_surfaces(); } else - MSG_ERR("set_video_mode: SDL_SetVideoMode failed: %s\n", SDL_GetError()); + MSG_ERR("set_video_mode: SDL_SetVideoMode failed: %s\n", SDL_GetError()); return retval; } @@ -556,14 +558,16 @@ /* if creation of new surface was successfull, save it and hide mouse cursor */ if(newsurface) { - if (priv->surface) - SDL_FreeSurface(priv->surface); - priv->surface = newsurface; - SDL_ShowCursor(0); - SDL_SRF_LOCK(priv->surface, -1) - SDL_FillRect(priv->surface, NULL, 0); - SDL_SRF_UNLOCK(priv->surface) - retval = setup_surfaces(); + vo_lock_surfaces(); + if (priv->surface) + SDL_FreeSurface(priv->surface); + priv->surface = newsurface; + SDL_ShowCursor(0); + SDL_SRF_LOCK(priv->surface, -1) + SDL_FillRect(priv->surface, NULL, 0); + SDL_SRF_UNLOCK(priv->surface) + retval = setup_surfaces(); + vo_unlock_surfaces(); } else MSG_ERR("set_fullmode: SDL_SetVideoMode failed: %s\n", SDL_GetError()); Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-10-20 08:01:33 UTC (rev 180) +++ mplayerxp/libvo/vo_x11.c 2012-10-20 08:59:56 UTC (rev 181) @@ -100,11 +100,13 @@ XClearWindow(vo.mDisplay, vo.window); vox11.image_width= (newW+7)&(~7); vox11.image_height= newH; + vo_lock_surfaces(); for(idx=0;idx<vox11.num_buffers;idx++) { vo_x11_freeMyXImage(idx); vo_x11_getMyXImage(idx,vox11.vinfo.visual,vox11.depth,vox11.image_width,vox11.image_height); } + vo_unlock_surfaces(); } return ret; } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-20 08:01:33 UTC (rev 180) +++ mplayerxp/mplayer.c 2012-10-20 08:59:56 UTC (rev 181) @@ -1422,7 +1422,7 @@ 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-audio_delay-delay,*v_pts,(a_pts-delay-audio_delay)-*v_pts); + 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){ float x; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-20 13:37:50
|
Revision: 184 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=184&view=rev Author: nickols_k Date: 2012-10-20 13:37:43 +0000 (Sat, 20 Oct 2012) Log Message: ----------- rename some functions Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/dec_ahead.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.c mplayerxp/libmpcodecs/dec_audio.h mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/dec_video.h mplayerxp/libmpdemux/demux_aiff.c mplayerxp/libmpdemux/demux_asf.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_mpg.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_rawaudio.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_ts.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/demux_vqf.c mplayerxp/libmpdemux/test.c mplayerxp/mplayer.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/dec_ahead.c 2012-10-20 13:37:43 UTC (rev 184) @@ -386,13 +386,13 @@ unsigned distance = dae_get_decoder_outrun(xp_core.video); int our_quality; our_quality = output_quality*distance/total; - if(drop_param) set_video_quality(sh_video,0); + if(drop_param) mpcv_set_quality(sh_video,0); else - if(auto_quality) set_video_quality(sh_video,our_quality>0?our_quality:0); + if(auto_quality) mpcv_set_quality(sh_video,our_quality>0?our_quality:0); } - blit_frame=decode_video(sh_video,start,in_size,drop_param,v_pts); + blit_frame=mpcv_decode(sh_video,start,in_size,drop_param,v_pts); if(output_quality) { - if(drop_param) set_video_quality(sh_video,output_quality); + if(drop_param) mpcv_set_quality(sh_video,output_quality); } if(!blit_frame && drop_param) xp_drop_frame_cnt++; #ifdef ENABLE_DEC_AHEAD_DEBUG @@ -651,7 +651,7 @@ return 0; } -int run_xp_players(void) +int run_xp_aplayers(void) { int retval; if( xp_core.has_audio && enable_xp >= XP_VAPlay ) Modified: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/dec_ahead.h 2012-10-20 13:37:43 UTC (rev 184) @@ -127,7 +127,7 @@ extern int init_dec_ahead(sh_video_t*stream, sh_audio_t *astream); extern void uninit_dec_ahead( int force ); extern int run_dec_ahead( void ); -extern int run_xp_players( void ); +extern int run_xp_aplayers( void ); extern void dec_ahead_reset_sh_video(sh_video_t* shv); extern void sig_dec_ahead_video( void ); Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad.h 2012-10-20 13:37:43 UTC (rev 184) @@ -35,7 +35,7 @@ int (*init)(sh_audio_t *sh); void (*uninit)(sh_audio_t *sh); int (*control)(sh_audio_t *sh,int cmd,any_t* arg, ...); - unsigned (*decode_audio)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); + unsigned (*mpca_decode)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); } ad_functions_t; // NULL terminated array of all drivers Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_a52.c 2012-10-20 13:37:43 UTC (rev 184) @@ -213,7 +213,7 @@ return CONTROL_UNKNOWN; } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { sample_t level=1, bias=384; int flags=mpxp_a52_flags|A52_ADJUST_LEVEL; Modified: mplayerxp/libmpcodecs/ad_acm.c =================================================================== --- mplayerxp/libmpcodecs/ad_acm.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_acm.c 2012-10-20 13:37:43 UTC (rev 184) @@ -129,7 +129,7 @@ int init(sh_audio_t *sh_audio) { float pts; - int ret=decode_audio(sh_audio,sh_audio->a_buffer,4096,sh_audio->a_buffer_size,&pts); + int ret=mpca_decode(sh_audio,sh_audio->a_buffer,4096,sh_audio->a_buffer_size,&pts); if(ret<0){ MSG_INFO("ACM decoding error: %d\n",ret); return 0; @@ -183,7 +183,7 @@ return CONTROL_UNKNOWN; } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { ACMSTREAMHEADER ash; HRESULT hr; Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_dca.c 2012-10-20 13:37:43 UTC (rev 184) @@ -214,7 +214,7 @@ return CONTROL_UNKNOWN; } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { sample_t level=1, bias=384; unsigned i,nblocks,flags=mpxp_dca_flags|DCA_ADJUST_LEVEL; Modified: mplayerxp/libmpcodecs/ad_dmo.c =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_dmo.c 2012-10-20 13:37:43 UTC (rev 184) @@ -92,7 +92,7 @@ return CONTROL_UNKNOWN; } -static unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +static unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { dmo_priv_t* priv = sh_audio->context; unsigned len=0; Modified: mplayerxp/libmpcodecs/ad_dshow.c =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_dshow.c 2012-10-20 13:37:43 UTC (rev 184) @@ -88,7 +88,7 @@ return CONTROL_UNKNOWN; } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { dshow_priv_t* priv = sh_audio->context; unsigned len=0; Modified: mplayerxp/libmpcodecs/ad_dvdpcm.c =================================================================== --- mplayerxp/libmpcodecs/ad_dvdpcm.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_dvdpcm.c 2012-10-20 13:37:43 UTC (rev 184) @@ -92,7 +92,7 @@ return CONTROL_UNKNOWN; } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { int j; unsigned len; Modified: mplayerxp/libmpcodecs/ad_faad.c =================================================================== --- mplayerxp/libmpcodecs/ad_faad.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_faad.c 2012-10-20 13:37:43 UTC (rev 184) @@ -275,7 +275,7 @@ return CONTROL_UNKNOWN; } -static unsigned decode_audio(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +static unsigned mpca_decode(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { faad_priv_t *priv=sh->context; int j = 0; Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-20 13:37:43 UTC (rev 184) @@ -105,7 +105,7 @@ } // Decode at least 1 byte: (to get header filled) - x=decode_audio(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size,&pts); + x=mpca_decode(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size,&pts); if(x>0) sh_audio->a_buffer_len=x; sh_audio->channels=lavc_context->channels; @@ -159,7 +159,7 @@ return CONTROL_UNKNOWN; } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { unsigned char *start=NULL; int y; Modified: mplayerxp/libmpcodecs/ad_hwac3.c =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_hwac3.c 2012-10-20 13:37:43 UTC (rev 184) @@ -222,7 +222,7 @@ return CONTROL_UNKNOWN; } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { unsigned len=0; UNUSED(minlen); Modified: mplayerxp/libmpcodecs/ad_internal.h =================================================================== --- mplayerxp/libmpcodecs/ad_internal.h 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_internal.h 2012-10-20 13:37:43 UTC (rev 184) @@ -17,7 +17,7 @@ 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_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); +static unsigned mpca_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,\ @@ -26,6 +26,6 @@ init,\ uninit,\ control,\ - decode_audio\ + mpca_decode\ }; Modified: mplayerxp/libmpcodecs/ad_libdv.c =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_libdv.c 2012-10-20 13:37:43 UTC (rev 184) @@ -86,7 +86,7 @@ return CONTROL_UNKNOWN; } -static unsigned decode_audio(sh_audio_t *sh, unsigned char *buf, unsigned minlen, unsigned maxlen,float *pts) +static unsigned mpca_decode(sh_audio_t *sh, unsigned char *buf, unsigned minlen, unsigned maxlen,float *pts) { libdv_priv_t *priv = sh->context; dv_decoder_t* decoder=priv->decoder; //global_rawdv_decoder; Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_mp3.c 2012-10-20 13:37:43 UTC (rev 184) @@ -354,7 +354,7 @@ return CONTROL_UNKNOWN; } -unsigned decode_audio(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { mp3_priv_t *priv=sh->context; unsigned char *indata=NULL,*outdata=NULL; Modified: mplayerxp/libmpcodecs/ad_null.c =================================================================== --- mplayerxp/libmpcodecs/ad_null.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_null.c 2012-10-20 13:37:43 UTC (rev 184) @@ -42,7 +42,7 @@ return CONTROL_UNKNOWN; } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { UNUSED(sh_audio); UNUSED(buf); Modified: mplayerxp/libmpcodecs/ad_pcm.c =================================================================== --- mplayerxp/libmpcodecs/ad_pcm.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_pcm.c 2012-10-20 13:37:43 UTC (rev 184) @@ -87,7 +87,7 @@ return CONTROL_UNKNOWN; } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { unsigned len = sh_audio->channels*sh_audio->samplesize; len = (minlen + len - 1) / len * len; Modified: mplayerxp/libmpcodecs/ad_qtaudio.c =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_qtaudio.c 2012-10-20 13:37:43 UTC (rev 184) @@ -279,7 +279,7 @@ #endif } -static unsigned decode_audio(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts){ +static unsigned mpca_decode(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts){ int error; unsigned long FramesToGet=0; //how many frames the demuxer has to get unsigned long InputBufferSize=0; //size of the input buffer Modified: mplayerxp/libmpcodecs/ad_real.c =================================================================== --- mplayerxp/libmpcodecs/ad_real.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_real.c 2012-10-20 13:37:43 UTC (rev 184) @@ -208,7 +208,7 @@ {42,87},{43,65},{45,59},{48,79},{49,93},{51,89},{55,95},{61,76},{67,83}, {77,80} }; -static unsigned decode_audio(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts){ +static unsigned mpca_decode(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts){ real_priv_t *rpriv = sh->context; float null_pts; int result; Modified: mplayerxp/libmpcodecs/ad_twin.c =================================================================== --- mplayerxp/libmpcodecs/ad_twin.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_twin.c 2012-10-20 13:37:43 UTC (rev 184) @@ -632,7 +632,7 @@ } } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { unsigned l,len=0; float null_pts; Modified: mplayerxp/libmpcodecs/ad_vorbis.c =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-20 13:37:43 UTC (rev 184) @@ -136,7 +136,7 @@ return CONTROL_UNKNOWN; } -static unsigned decode_audio(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) +static unsigned mpca_decode(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { unsigned len = 0; int samples; Modified: mplayerxp/libmpcodecs/dec_audio.c =================================================================== --- mplayerxp/libmpcodecs/dec_audio.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/dec_audio.c 2012-10-20 13:37:43 UTC (rev 184) @@ -34,7 +34,7 @@ extern unsigned force_srate; extern char *audio_codec; -int init_audio(sh_audio_t *sh_audio) +int mpca_init(sh_audio_t *sh_audio) { unsigned i; for (i=0; mpcodecs_ad_drivers[i] != NULL; i++) @@ -99,7 +99,7 @@ if(!mpadec->init(sh_audio)){ MSG_WARN(MSGTR_CODEC_CANT_INITA); - uninit_audio(sh_audio); /* free buffers */ + mpca_uninit(sh_audio); /* free buffers */ return 0; } @@ -107,7 +107,7 @@ if(!sh_audio->channels || !sh_audio->samplerate){ MSG_WARN(MSGTR_UnknownAudio); - uninit_audio(sh_audio); /* free buffers */ + mpca_uninit(sh_audio); /* free buffers */ return 0; } @@ -136,7 +136,7 @@ return 1; } -void uninit_audio(sh_audio_t *sh_audio) +void mpca_uninit(sh_audio_t *sh_audio) { if(sh_audio->afilter){ MSG_V("Uninit audio filters...\n"); @@ -157,7 +157,7 @@ } /* Init audio filters */ -int preinit_audio_filters(sh_audio_t *sh_audio, +int mpca_preinit_filters(sh_audio_t *sh_audio, int in_samplerate, int in_channels, int in_format, int in_bps, int* out_samplerate, int* out_channels, int* out_format, int out_bps){ char strbuf[200]; @@ -204,7 +204,7 @@ } /* Init audio filters */ -int init_audio_filters(sh_audio_t *sh_audio, +int mpca_init_filters(sh_audio_t *sh_audio, int in_samplerate, int in_channels, int in_format, int in_bps, int out_samplerate, int out_channels, int out_format, int out_bps, int out_minsize, int out_maxsize){ @@ -253,7 +253,7 @@ } /* Init audio filters */ -int reinit_audio_filters(sh_audio_t *sh_audio, +int mpca_reinit_filters(sh_audio_t *sh_audio, int in_samplerate, int in_channels, int in_format, int in_bps, int out_samplerate, int out_channels, int out_format, int out_bps, int out_minsize, int out_maxsize) @@ -264,13 +264,13 @@ free(sh_audio->afilter); sh_audio->afilter=NULL; } - return init_audio_filters(sh_audio,in_samplerate,in_channels, + return mpca_init_filters(sh_audio,in_samplerate,in_channels, in_format,in_bps,out_samplerate, out_channels,out_format,out_bps, out_minsize,out_maxsize); } -unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts) +unsigned mpca_decode(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts) { unsigned len; unsigned cp_size,cp_tile; @@ -278,7 +278,7 @@ af_data_t* pafd; // filter output if(!sh_audio->inited) return 0; // no codec - MSG_DBG3("decode_audio(%p,%p,%i,%i,%i,%p)\n",sh_audio,buf,minlen,maxlen,buflen,pts); + MSG_DBG3("mpca_decode(%p,%p,%i,%i,%i,%p)\n",sh_audio,buf,minlen,maxlen,buflen,pts); if(minlen>maxlen) MSG_WARN(MSGTR_CODEC_XP_INT_ERR,minlen,maxlen); if(sh_audio->af_buffer_len) @@ -299,7 +299,7 @@ } if(sh_audio->af_bps>sh_audio->o_bps) maxlen=min(maxlen,(long long int)buflen*sh_audio->o_bps/sh_audio->af_bps); - len=mpadec->decode_audio(sh_audio,buf, minlen, maxlen,pts); + len=mpadec->mpca_decode(sh_audio,buf, minlen, maxlen,pts); if(len>buflen) MSG_WARN(MSGTR_CODEC_BUF_OVERFLOW,sh_audio->codec->driver_name,len,buflen); MSG_DBG2("decaudio: %i bytes %f pts min %i max %i buflen %i o_bps=%i f_bps=%i\n",len,*pts,minlen,maxlen,buflen,sh_audio->o_bps,sh_audio->af_bps); if(len==0 || !sh_audio->afilter) return 0; // EOF? @@ -338,7 +338,7 @@ } /* Note: it is called once after seeking, to resync. */ -void resync_audio_stream(sh_audio_t *sh_audio) +void mpca_resync_stream(sh_audio_t *sh_audio) { if(sh_audio) { sh_audio->a_in_buffer_len=0; /* workaround */ @@ -348,7 +348,7 @@ /* Note: it is called to skip (jump over) small amount (1/10 sec or 1 frame) of audio data - used to sync audio to video after seeking */ -void skip_audio_frame(sh_audio_t *sh_audio) +void mpca_skip_frame(sh_audio_t *sh_audio) { int rc=CONTROL_TRUE; if(sh_audio) Modified: mplayerxp/libmpcodecs/dec_audio.h =================================================================== --- mplayerxp/libmpcodecs/dec_audio.h 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/dec_audio.h 2012-10-20 13:37:43 UTC (rev 184) @@ -1,20 +1,20 @@ #ifndef DEC_AUDIO_H_INCLUDED #define DEC_AUDIO_H_INCLUDED 1 // dec_audio.c: -extern int init_audio(sh_audio_t *sh_audio); -extern void uninit_audio(sh_audio_t *sh_audio); -extern unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,unsigned buflen,float *pts); -extern void resync_audio_stream(sh_audio_t *sh_audio); -extern void skip_audio_frame(sh_audio_t *sh_audio); +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 init_audio_filters(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, int out_samplerate, int out_channels, int out_format, int out_bps, int out_minsize, int out_maxsize); -extern int preinit_audio_filters(sh_audio_t *sh_audio, +extern int mpca_preinit_filters(sh_audio_t *sh_audio, int in_samplerate, int in_channels, int in_format, int in_bps, int* out_samplerate, int* out_channels, int* out_format, int out_bps); -extern int reinit_audio_filters(sh_audio_t *sh_audio, +extern int mpca_reinit_filters(sh_audio_t *sh_audio, int in_samplerate, int in_channels, int in_format, int in_bps, int out_samplerate, int out_channels, int out_format, int out_bps, int out_minsize, int out_maxsize); Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-20 13:37:43 UTC (rev 184) @@ -50,7 +50,7 @@ const vd_functions_t* mpvdec=NULL; -int get_video_quality_max(sh_video_t *sh_video){ +int mpcv_get_quality_max(sh_video_t *sh_video){ if(mpvdec){ int ret=mpvdec->control(sh_video,VDCTRL_QUERY_MAX_PP_LEVEL,NULL); if(ret>=0) return ret; @@ -58,12 +58,12 @@ return 0; } -void set_video_quality(sh_video_t *sh_video,int quality){ +void mpcv_set_quality(sh_video_t *sh_video,int quality){ if(mpvdec) mpvdec->control(sh_video,VDCTRL_SET_PP_LEVEL, (any_t*)(&quality)); } -int set_video_colors(sh_video_t *sh_video,char *item,int value) +int mpcv_set_colors(sh_video_t *sh_video,char *item,int value) { vf_instance_t* vf=sh_video->vfilter; vf_equalizer_t eq; @@ -76,7 +76,7 @@ return 1; } -void uninit_video(sh_video_t *sh_video){ +void mpcv_uninit(sh_video_t *sh_video){ if(!sh_video->inited) return; MSG_V("uninit video: %s\n",sh_video->codec->driver_name); if(sh_video->vfilter && sh_video->vfilter_inited==1) vf_uninit_filter_chain(sh_video->vfilter); @@ -90,29 +90,29 @@ extern int enable_gomp; extern char *video_codec; -int init_video(sh_video_t *sh_video,const char* codecname,const char * vfm,int status){ +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("init_video(%p, %s, %s, %i)\n",sh_video,codecname,vfm,status); + MSG_DBG3("mpcv_init(%p, %s, %s, %i)\n",sh_video,codecname,vfm,status); while((sh_video->codec=find_codec(sh_video->format, 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("init_video: %s already tried and failed\n",sh_video->codec->codec_name); + MSG_DBG3("mpcv_init: %s already tried and failed\n",sh_video->codec->codec_name); continue; } if(codecname && strcmp(sh_video->codec->codec_name,codecname)) { - MSG_DBG3("init_video: %s != %s [-vc]\n",sh_video->codec->codec_name,codecname); + MSG_DBG3("mpcv_init: %s != %s [-vc]\n",sh_video->codec->codec_name,codecname); continue; } if(vfm && strcmp(sh_video->codec->driver_name,vfm)!=0) { - MSG_DBG3("init_video: vfm doesn't match %s != %s\n",vfm,sh_video->codec->driver_name); + MSG_DBG3("mpcv_init: vfm doesn't match %s != %s\n",vfm,sh_video->codec->driver_name); continue; // vfm doesn't match } if(sh_video->codec->status<status) { - MSG_DBG3("init_video: %s too unstable\n",sh_video->codec->codec_name); + MSG_DBG3("mpcv_init: %s too unstable\n",sh_video->codec->codec_name); continue; } sh_video->codec->flags|=CODECS_FLAG_SELECTED; // tagging it @@ -121,7 +121,7 @@ if(strcmp(mpcodecs_vd_drivers[i]->info->driver_name,sh_video->codec->driver_name)==0) break; mpvdec=mpcodecs_vd_drivers[i]; if(!mpvdec) continue; - else MSG_DBG3("init_video: mpcodecs_vd_drivers[%s]->mpvdec==0\n",mpcodecs_vd_drivers[i]->info->driver_name); + 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); @@ -235,7 +235,7 @@ } static void update_subtitle(sh_video_t *sh_video,float v_pts,unsigned idx); -int decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, float pts){ +int mpcv_decode(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, float pts){ vf_instance_t* vf; mp_image_t *mpi=NULL; unsigned int t; @@ -282,7 +282,7 @@ return 1; } -void resync_video_stream(sh_video_t *sh_video) +void mpcv_resync_stream(sh_video_t *sh_video) { if(sh_video) if(sh_video->inited && mpvdec) mpvdec->control(sh_video,VDCTRL_RESYNC_STREAM,NULL); Modified: mplayerxp/libmpcodecs/dec_video.h =================================================================== --- mplayerxp/libmpcodecs/dec_video.h 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpcodecs/dec_video.h 2012-10-20 13:37:43 UTC (rev 184) @@ -2,16 +2,16 @@ #define DEC_VIDEO_H_INCLUDED 1 // dec_video.c: -extern int init_video(sh_video_t *sh_video, const char *codec_name,const char *family,int status); -extern void uninit_video(sh_video_t *sh_video); +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 decode_video(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame,float pts); +extern int mpcv_decode(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame,float pts); -extern int get_video_quality_max(sh_video_t *sh_video); -extern void set_video_quality(sh_video_t *sh_video,int quality); +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 set_video_colors(sh_video_t *sh_video,char *item,int value); -extern void resync_video_stream(sh_video_t *sh_video); +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 divx_quality; Modified: mplayerxp/libmpdemux/demux_aiff.c =================================================================== --- mplayerxp/libmpdemux/demux_aiff.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_aiff.c 2012-10-20 13:37:43 UTC (rev 184) @@ -206,7 +206,7 @@ pos=base+(seeka->flags&DEMUX_SEEK_PERCENTS?(demuxer->movi_end - demuxer->movi_start):sh_audio->i_bps)*seeka->secs; pos -= (pos % (sh_audio->channels * sh_audio->samplesize) ); stream_seek(s,pos); - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); } static void aiff_close(demuxer_t* demuxer) Modified: mplayerxp/libmpdemux/demux_asf.c =================================================================== --- mplayerxp/libmpdemux/demux_asf.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_asf.c 2012-10-20 13:37:43 UTC (rev 184) @@ -702,7 +702,7 @@ if(sh_audio && !d_audio->eof){ ds_free_packs_until_pts(d_audio,d_video->pts); ds_fill_buffer(d_audio); - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); } } Modified: mplayerxp/libmpdemux/demux_audio.c =================================================================== --- mplayerxp/libmpdemux/demux_audio.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_audio.c 2012-10-20 13:37:43 UTC (rev 184) @@ -1690,7 +1690,7 @@ if(len > 0) high_res_mp3_seek(demuxer,len); sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); return; } @@ -1727,7 +1727,7 @@ if(len > 0) high_res_ac3_seek(demuxer,len); sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); return; } case RAW_DCA: { @@ -1740,7 +1740,7 @@ if(len > 0) high_res_ddca_seek(demuxer,len); sh_audio->timer = priv->last_pts - (ds_tell_pts(demuxer->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); return; } case RAW_VOC: @@ -1755,7 +1755,7 @@ stream_seek(s,pos); - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); } Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_avi.c 2012-10-20 13:37:43 UTC (rev 184) @@ -1518,7 +1518,7 @@ demux_read_data(d_audio,NULL,skip_audio_bytes); //d_audio->pts=0; // PTS is outdated because of the raw data skipping } - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); // sh_audio->timer=-skip_audio_secs; Modified: mplayerxp/libmpdemux/demux_mpg.c =================================================================== --- mplayerxp/libmpdemux/demux_mpg.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_mpg.c 2012-10-20 13:37:43 UTC (rev 184) @@ -570,7 +570,7 @@ ds_fill_buffer(d_video); if(sh_audio){ ds_fill_buffer(d_audio); - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); } while(1){ @@ -579,7 +579,7 @@ float a_pts=d_audio->pts; a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; if(d_video->pts>a_pts){ - skip_audio_frame(sh_audio); // sync audio + mpca_skip_frame(sh_audio); // sync audio continue; } } Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-20 13:37:43 UTC (rev 184) @@ -850,7 +850,7 @@ { if(verbose) MSG_V("MPXPAV64_SEEK: newpos after sync %016llX\n",stream_tell(demuxer->stream)); mpxpav64_reset_prevs(demuxer); - resync_audio_stream(demuxer->audio->sh); + mpca_resync_stream(demuxer->audio->sh); } else { Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-20 13:37:43 UTC (rev 184) @@ -1417,7 +1417,7 @@ clear_sub = -1; demux_ogg_add_packet(ds,os,ds->id,&op); if(sh_audio) - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); return; } } Modified: mplayerxp/libmpdemux/demux_rawaudio.c =================================================================== --- mplayerxp/libmpdemux/demux_rawaudio.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_rawaudio.c 2012-10-20 13:37:43 UTC (rev 184) @@ -101,7 +101,7 @@ pos=base+(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_audio->i_bps)*seeka->secs; pos -= (pos % (sh_audio->channels * sh_audio->samplesize) ); stream_seek(s,pos); - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); } static void rawaudio_close(demuxer_t* demuxer) {} Modified: mplayerxp/libmpdemux/demux_real.c =================================================================== --- mplayerxp/libmpdemux/demux_real.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_real.c 2012-10-20 13:37:43 UTC (rev 184) @@ -1589,7 +1589,7 @@ real_demux(demuxer,NULL); if (sh_audio) - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); return; } Modified: mplayerxp/libmpdemux/demux_ts.c =================================================================== --- mplayerxp/libmpdemux/demux_ts.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_ts.c 2012-10-20 13:37:43 UTC (rev 184) @@ -3021,7 +3021,7 @@ return 0; } -extern void skip_audio_frame(sh_audio_t *sh_audio); +extern void mpca_skip_frame(sh_audio_t *sh_audio); static void reset_fifos(ts_priv_t* priv, int a, int v, int s) { @@ -3139,7 +3139,7 @@ a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; if(d_video->pts > a_pts) { - skip_audio_frame(sh_audio); // sync audio + mpca_skip_frame(sh_audio); // sync audio continue; } } Modified: mplayerxp/libmpdemux/demux_ty.c =================================================================== --- mplayerxp/libmpdemux/demux_ty.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_ty.c 2012-10-20 13:37:43 UTC (rev 184) @@ -51,7 +51,7 @@ (((uint8_t*)(x))[1] << 8) | \ ((uint8_t*)(x))[2]) -extern void skip_audio_frame( sh_audio_t *sh_audio ); +extern void mpca_skip_frame( sh_audio_t *sh_audio ); int sub_justify; // 2/c0: audio data @@ -809,7 +809,7 @@ (float)sh_audio->i_bps; if( d_video->pts > a_pts ) { - skip_audio_frame( sh_audio ); // sync audio + mpca_skip_frame( sh_audio ); // sync audio continue; } } Modified: mplayerxp/libmpdemux/demux_vqf.c =================================================================== --- mplayerxp/libmpdemux/demux_vqf.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/demux_vqf.c 2012-10-20 13:37:43 UTC (rev 184) @@ -212,7 +212,7 @@ pos=base+(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_audio->i_bps)*seeka->secs; pos -= (pos % (sh_audio->channels * sh_audio->samplesize) ); stream_seek(s,pos); - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); } static void vqf_close(demuxer_t* demuxer) {} Modified: mplayerxp/libmpdemux/test.c =================================================================== --- mplayerxp/libmpdemux/test.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/libmpdemux/test.c 2012-10-20 13:37:43 UTC (rev 184) @@ -14,9 +14,9 @@ // audio stream skip/resync functions requires only for seeking. // (they should be implemented in the audio codec layer) -void skip_audio_frame(sh_audio_t *sh_audio){ +void mpca_skip_frame(sh_audio_t *sh_audio){ } -void resync_audio_stream(sh_audio_t *sh_audio){ +void mpca_resync_stream(sh_audio_t *sh_audio){ } int verbose=5; // must be global! Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-20 13:09:53 UTC (rev 183) +++ mplayerxp/mplayer.c 2012-10-20 13:37:43 UTC (rev 184) @@ -532,7 +532,7 @@ for( l = 0, l2 = len, ret = 0; l < len && l2 >= audio_buffer.sh_audio->audio_out_minsize; ) { float pts; - ret = decode_audio( audio_buffer.sh_audio, &audio_buffer.buffer[audio_buffer.head], audio_buffer.min_len, l2,blen,&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; @@ -664,7 +664,7 @@ if(mask&INITED_VCODEC){ inited_flags&=~INITED_VCODEC; pinfo[xp_id].current_module="uninit_vcodec"; - uninit_video(sh_video); + mpcv_uninit(sh_video); sh_video=NULL; } @@ -677,7 +677,7 @@ if(mask&INITED_ACODEC){ inited_flags&=~INITED_ACODEC; pinfo[xp_id].current_module="uninit_acodec"; - uninit_audio(sh_audio); + mpca_uninit(sh_audio); sh_audio=NULL; } @@ -1043,7 +1043,7 @@ //if(playsize>outburst) playsize=outburst; // Update buffer if needed - pinfo[_xp_id].current_module="decode_audio"; // Enter AUDIO decoder module + pinfo[_xp_id].current_module="mpca_decode"; // Enter AUDIO decoder module t=GetTimer(); while(sh_audio->a_buffer_len<playsize && !audio_eof){ if(enable_xp>=XP_VideoAudio) { @@ -1051,7 +1051,7 @@ playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); } else { - ret=decode_audio(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], + 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; @@ -1487,14 +1487,14 @@ if(sh_video){ pinfo[_xp_id].current_module="seek_video_reset"; - resync_video_stream(sh_video); + mpcv_resync_stream(sh_video); vo_reset(); sh_video->chapter_change=-1; } if(sh_audio){ pinfo[_xp_id].current_module="seek_audio_reset"; - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); ao_reset(); // stop audio, throwing away buffered data } @@ -1545,7 +1545,7 @@ void mpxp_resync_audio_stream(void) { - resync_audio_stream(sh_audio); + mpca_resync_stream(sh_audio); } static void __FASTCALL__ mpxp_stream_event_handler(struct stream_s *s,const stream_packet_t *sp) @@ -1958,15 +1958,15 @@ if(video_codec) { /* forced codec by name: */ MSG_INFO("Forced video codec: %s\n",video_codec); - init_video(sh_video,video_codec,NULL,-1); + mpcv_init(sh_video,video_codec,NULL,-1); } else { int status; /* try in stability order: UNTESTED, WORKING, BUGGY, BROKEN */ if(video_family) MSG_INFO(MSGTR_TryForceVideoFmt,video_family); for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status){ if(video_family) /* try first the preferred codec family:*/ - if(init_video(sh_video,NULL,video_family,status)) break; - if(init_video(sh_video,NULL,NULL,status)) break; + if(mpcv_init(sh_video,NULL,video_family,status)) break; + if(mpcv_init(sh_video,NULL,NULL,status)) break; } } if(!sh_video->inited) { @@ -2013,7 +2013,7 @@ ao_data.channels=audio_output_channels?audio_output_channels:sh_audio->channels; ao_data.format=sh_audio->sample_format; #if 1 - if(!preinit_audio_filters(sh_audio, + if(!mpca_preinit_filters(sh_audio, // input: (int)(sh_audio->samplerate), sh_audio->channels, sh_audio->sample_format, sh_audio->samplesize, @@ -2035,7 +2035,7 @@ } else { inited_flags|=INITED_AO; pinfo[xp_id].current_module="af_init"; - if(!init_audio_filters(sh_audio, + if(!mpca_init_filters(sh_audio, (int)(sh_audio->samplerate), sh_audio->channels, sh_audio->sample_format, sh_audio->samplesize, ao_data.samplerate, ao_data.channels, ao_data.format, @@ -2261,7 +2261,7 @@ else v_cont+=v; if(v_cont > 100) v_cont=100; if(v_cont < -100) v_cont = -100; - if(set_video_colors(sh_video,VO_EC_CONTRAST,v_cont)){ + if(mpcv_set_colors(sh_video,VO_EC_CONTRAST,v_cont)){ #ifdef USE_OSD if(osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -2279,7 +2279,7 @@ else v_bright+=v; if(v_bright > 100) v_bright = 100; if(v_bright < -100) v_bright = -100; - if(set_video_colors(sh_video,VO_EC_BRIGHTNESS,v_bright)){ + if(mpcv_set_colors(sh_video,VO_EC_BRIGHTNESS,v_bright)){ #ifdef USE_OSD if(osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -2297,7 +2297,7 @@ else v_hue+=v; if(v_hue > 100) v_hue = 100; if(v_hue < -100) v_hue = -100; - if(set_video_colors(sh_video,VO_EC_HUE,v_hue)){ + if(mpcv_set_colors(sh_video,VO_EC_HUE,v_hue)){ #ifdef USE_OSD if(osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -2315,7 +2315,7 @@ else v_saturation+=v; if(v_saturation > 100) v_saturation = 100; if(v_saturation < -100) v_saturation = -100; - if(set_video_colors(sh_video,VO_EC_SATURATION,v_saturation)){ + if(mpcv_set_colors(sh_video,VO_EC_SATURATION,v_saturation)){ #ifdef USE_OSD if(osd_level){ osd->visible=sh_video->fps; // 1 sec @@ -2600,7 +2600,7 @@ if(sh_audio){ MSG_V("Initializing audio codec...\n"); - if(!init_audio(sh_audio)){ + if(!mpca_init(sh_audio)){ MSG_ERR(MSGTR_CouldntInitAudioCodec); sh_audio=d_audio->sh=NULL; } else { @@ -2633,11 +2633,11 @@ if(auto_quality>0){ /* Auto quality option enabled*/ - output_quality=get_video_quality_max(sh_video); + output_quality=mpcv_get_quality_max(sh_video); if(auto_quality>output_quality) auto_quality=output_quality; else output_quality=auto_quality; MSG_V("AutoQ: setting quality to %d\n",output_quality); - set_video_quality(sh_video,output_quality); + mpcv_set_quality(sh_video,output_quality); } vf_showlist(sh_video->vfilter); @@ -2732,7 +2732,7 @@ usleep(0); }while(dae_get_decoder_outrun(xp_core.video) < xp_num_frames/2 && !xp_eof); } - if(run_xp_players()!=0) exit_player("Can't run xp players!\n"); + 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); //==================== START PLAYING ======================= @@ -2788,7 +2788,7 @@ --output_quality; else if(output_quality>0 && aq_sleep_time<-0.050f) // 50ms output_quality=0; - set_video_quality(sh_video,output_quality); + mpcv_set_quality(sh_video,output_quality); } read_input: #ifdef USE_OSD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-21 09:46:22
|
Revision: 187 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=187&view=rev Author: nickols_k Date: 2012-10-21 09:46:13 +0000 (Sun, 21 Oct 2012) Log Message: ----------- make libao2 re-enterable Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/dec_ahead.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/libao2/audio_out.h mplayerxp/libao2/audio_out_internal.h mplayerxp/mixer.c mplayerxp/mplayer.c mplayerxp/postproc/af.c mplayerxp/postproc/af_ao2.c Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-20 13:48:57 UTC (rev 186) +++ mplayerxp/cfg-mplayer.h 2012-10-21 09:46:13 UTC (rev 187) @@ -271,7 +271,6 @@ #ifdef USE_FAKE_MONO {"stereo", &fakemono, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL, "selects type of MP2/MP3 stereo output"}, #endif - {"bs", &ao_data.buffersize, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL, "specifies sound card audio buffer size in bytes. Default: measuring"}, {NULL, NULL, 0, 0, 0, 0, NULL,NULL}, }; Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-20 13:48:57 UTC (rev 186) +++ mplayerxp/dec_ahead.c 2012-10-21 09:46:13 UTC (rev 187) @@ -770,6 +770,7 @@ #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; any_t* audio_play_routine( any_t* arg ) { int xp_id; @@ -778,7 +779,7 @@ struct timespec timeout; float d; int retval; - const float MAX_AUDIO_TIME = (float)ao_get_space() / sh_audio->af_bps + ao_get_delay(); + 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; @@ -861,7 +862,7 @@ } LOCK_AUDIO_PLAY(); - d = ao_get_delay() - min_audio_time; + d = ao_get_delay(ao_data) - min_audio_time; if( !xp_core.in_lseek && d > 0 ) { gettimeofday(&now,NULL); audio_play_timeout.tv_nsec = now.tv_usec * 1000 + d*1000000000l; Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2012-10-20 13:48:57 UTC (rev 186) +++ mplayerxp/libao2/ao_alsa9.c 2012-10-21 09:46:13 UTC (rev 187) @@ -39,19 +39,15 @@ LIBAO_EXTERN(alsa) -typedef struct alsa_pric_s { +typedef struct priv_s { snd_pcm_t* handler; snd_pcm_format_t format; snd_pcm_hw_params_t*hwparams; snd_pcm_sw_params_t*swparams; size_t bytes_per_sample; - int ao_mmap; - int ao_noblock; int first; -}alsa_priv_t; +}priv_t; -static alsa_priv_t alsa = { NULL, 0, NULL, NULL, 0, 0, 0, 1 }; - #define ALSA_DEVICE_SIZE 48 #define BUFFERTIME // else SET_CHUNK_SIZE @@ -123,21 +119,22 @@ } /* to set/get/query special features/parameters */ -static int __FASTCALL__ control(int cmd, long arg) +static int __FASTCALL__ control(ao_data_t* ao,int cmd, long arg) { + priv_t*priv=ao->priv; int rval; switch(cmd) { case AOCONTROL_QUERY_FORMAT: rval=fmt2alsa(arg); - return snd_pcm_hw_params_test_format(alsa.handler, alsa.hwparams,rval)==0? + return snd_pcm_hw_params_test_format(priv->handler, priv->hwparams,rval)==0? CONTROL_TRUE:CONTROL_FALSE; case AOCONTROL_QUERY_CHANNELS: rval=arg; - return snd_pcm_hw_params_test_channels(alsa.handler, alsa.hwparams,rval)==0? + return snd_pcm_hw_params_test_channels(priv->handler, priv->hwparams,rval)==0? CONTROL_TRUE:CONTROL_FALSE; case AOCONTROL_QUERY_RATE: rval=arg; - return snd_pcm_hw_params_test_rate(alsa.handler, alsa.hwparams,rval,0)==0? + return snd_pcm_hw_params_test_rate(priv->handler, priv->hwparams,rval,0)==0? CONTROL_TRUE:CONTROL_FALSE; case AOCONTROL_GET_VOLUME: case AOCONTROL_SET_VOLUME: @@ -157,7 +154,7 @@ long get_vol, set_vol; float calc_vol, diff, f_multi; - if(ao_data.format == AFMT_AC3) return CONTROL_TRUE; + if(ao->format == AFMT_AC3) return CONTROL_TRUE; //allocate simple id snd_mixer_selem_id_alloca(&sid); @@ -297,17 +294,18 @@ snd_pcm_info_free(alsa_info); } - +static int ao_mmap; +static int ao_noblock; static mrl_config_t alsaconf[]={ - { "mmap", &alsa.ao_mmap, MRL_TYPE_BOOL, 0, 1 }, - { "noblock", &alsa.ao_noblock, MRL_TYPE_BOOL, 0, 1 }, + { "mmap", &ao_mmap, MRL_TYPE_BOOL, 0, 1 }, + { "noblock", &ao_noblock, MRL_TYPE_BOOL, 0, 1 }, { NULL, NULL, 0, 0, 0 } }; /* open & setup audio device return: 1=success 0=fail */ -static int __FASTCALL__ init(unsigned flags) +static int __FASTCALL__ init(ao_data_t* ao,unsigned flags) { int err; int cards = -1; @@ -317,8 +315,11 @@ char *alsa_port=NULL; char alsa_device[ALSA_DEVICE_SIZE]; UNUSED(flags); + ao->priv=malloc(sizeof(priv_t)); + priv_t*priv=ao->priv; + priv->first=1; - alsa.handler = NULL; + priv->handler = NULL; alsa_device[0]='\0'; MSG_V("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); @@ -350,7 +351,7 @@ } if (alsa_device[0] == '\0') { - int tmp_device, tmp_subdevice, err; + int tmp_device, tmp_subdevice; if ((err = snd_pcm_info_malloc(&alsa_info)) < 0) { MSG_ERR("alsa-init: memory allocation error: %s\n", snd_strerror(err)); @@ -377,7 +378,7 @@ MSG_WARN("alsa-init: Testing & bugs are welcome. Found %d cards, use: %s\n",cards+1,alsa_device); //setting modes for block or nonblock-mode int open_mode,block_mode; - if (alsa.ao_noblock) { + if (ao_noblock) { open_mode = SND_PCM_NONBLOCK; block_mode = 1; str_block_mode = "nonblock-mode"; @@ -387,12 +388,12 @@ str_block_mode = "block-mode"; } - if (!alsa.handler) { + if (!priv->handler) { //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC - if ((err = snd_pcm_open(&alsa.handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0) { - if (alsa.ao_noblock) { + if ((err = snd_pcm_open(&priv->handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0) { + if (ao_noblock) { MSG_ERR("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n"); - if ((err = snd_pcm_open(&alsa.handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { + if ((err = snd_pcm_open(&priv->handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { MSG_ERR("alsa-init: playback open error: %s\n", snd_strerror(err)); alsa_device[0]='\0'; return 0; @@ -407,44 +408,45 @@ } } alsa_device[0]='\0'; - if ((err = snd_pcm_nonblock(alsa.handler, block_mode)) < 0) { + if ((err = snd_pcm_nonblock(priv->handler, block_mode)) < 0) { MSG_ERR("alsa-init: error set block-mode %s\n", snd_strerror(err)); } else MSG_V("alsa-init: pcm opend in %s\n", str_block_mode); - snd_pcm_hw_params_malloc(&alsa.hwparams); - snd_pcm_sw_params_malloc(&alsa.swparams); + snd_pcm_hw_params_malloc(&priv->hwparams); + snd_pcm_sw_params_malloc(&priv->swparams); // setting hw-parameters - if ((err = snd_pcm_hw_params_any(alsa.handler, alsa.hwparams)) < 0) + if ((err = snd_pcm_hw_params_any(priv->handler, priv->hwparams)) < 0) { MSG_ERR("alsa-init: unable to get initial parameters: %s\n", snd_strerror(err)); return 0; } MSG_DBG2("snd_pcm_hw_params_any()\n"); - if (alsa.ao_mmap) { + if (ao_mmap) { snd_pcm_access_mask_t *mask = alloca(snd_pcm_access_mask_sizeof()); snd_pcm_access_mask_none(mask); snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED); snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED); snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); - err = snd_pcm_hw_params_set_access_mask(alsa.handler, alsa.hwparams, mask); + err = snd_pcm_hw_params_set_access_mask(priv->handler, priv->hwparams, mask); MSG_ERR("alsa-init: mmap set\n"); } else { - err = snd_pcm_hw_params_set_access(alsa.handler, alsa.hwparams,SND_PCM_ACCESS_RW_INTERLEAVED); + err = snd_pcm_hw_params_set_access(priv->handler, priv->hwparams,SND_PCM_ACCESS_RW_INTERLEAVED); MSG_DBG2("snd_pcm_hw_params_set_access(SND_PCM_ACCESS_RW_INTERLEAVED)\n"); } if (err < 0) { MSG_ERR("alsa-init: unable to set access type: %s\n", snd_strerror(err)); return 0; } - } // end switch alsa.handler (spdif) + } // end switch priv->handler (spdif) return 1; } // end init -static int __FASTCALL__ configure(unsigned rate_hz,unsigned channels,unsigned format) +static int __FASTCALL__ configure(ao_data_t* ao,unsigned rate_hz,unsigned channels,unsigned format) { + priv_t*priv=ao->priv; int err,i; size_t chunk_size=0,chunk_bytes,bits_per_sample,bits_per_frame; snd_pcm_uframes_t dummy; @@ -452,21 +454,21 @@ MSG_V("alsa-conf: requested format: %d Hz, %d channels, %s\n", rate_hz, channels, ao_format_name(format)); - ao_data.samplerate = rate_hz; - ao_data.bps = channels * rate_hz; - ao_data.format = format; - ao_data.channels = channels; - ao_data.outburst = OUTBURST; - //ao_data.buffersize = MAX_OUTBURST; // was 16384 + ao->samplerate = rate_hz; + ao->bps = channels * rate_hz; + ao->format = format; + ao->channels = channels; + ao->outburst = OUTBURST; + //ao->buffersize = MAX_OUTBURST; // was 16384 - alsa.format=fmt2alsa(format); + priv->format=fmt2alsa(format); - switch(alsa.format) { + switch(priv->format) { case SND_PCM_FORMAT_S16_LE: case SND_PCM_FORMAT_U16_LE: case SND_PCM_FORMAT_S16_BE: case SND_PCM_FORMAT_U16_BE: - ao_data.bps *= 2; + ao->bps *= 2; break; case SND_PCM_FORMAT_S32_LE: case SND_PCM_FORMAT_S32_BE: @@ -474,13 +476,13 @@ case SND_PCM_FORMAT_U32_BE: case SND_PCM_FORMAT_FLOAT_BE: case SND_PCM_FORMAT_FLOAT_LE: - ao_data.bps *= 4; + ao->bps *= 4; break; case SND_PCM_FORMAT_S24_LE: case SND_PCM_FORMAT_S24_BE: case SND_PCM_FORMAT_U24_LE: case SND_PCM_FORMAT_U24_BE: - ao_data.bps *= 3; + ao->bps *= 3; break; case -1: MSG_ERR("alsa-conf: invalid format (%s) requested - output disabled\n", @@ -489,44 +491,44 @@ default: break; } - alsa.bytes_per_sample = ao_data.bps / ao_data.samplerate; + priv->bytes_per_sample = ao->bps / ao->samplerate; - if ((err = snd_pcm_hw_params_set_format(alsa.handler, alsa.hwparams, - alsa.format)) < 0) { + if ((err = snd_pcm_hw_params_set_format(priv->handler, priv->hwparams, + priv->format)) < 0) { MSG_ERR("alsa-conf: unable to set format(%s): %s\n", - snd_pcm_format_name(alsa.format), + snd_pcm_format_name(priv->format), snd_strerror(err)); MSG_HINT("Please try one of: "); for(i=0;i<SND_PCM_FORMAT_LAST;i++) - if (!(snd_pcm_hw_params_test_format(alsa.handler, alsa.hwparams, i))) + if (!(snd_pcm_hw_params_test_format(priv->handler, priv->hwparams, i))) MSG_HINT("%s ",snd_pcm_format_name(i)); MSG_HINT("\n"); return 0; } - MSG_DBG2("snd_pcm_hw_params_set_format(%i)\n",alsa.format); + MSG_DBG2("snd_pcm_hw_params_set_format(%i)\n",priv->format); - if ((err = snd_pcm_hw_params_set_rate_near(alsa.handler, alsa.hwparams, &ao_data.samplerate, 0)) < 0) { + if ((err = snd_pcm_hw_params_set_rate_near(priv->handler, priv->hwparams, &ao->samplerate, 0)) < 0) { MSG_ERR("alsa-conf: unable to set samplerate %u: %s\n", - ao_data.samplerate, + ao->samplerate, snd_strerror(err)); return 0; } - MSG_DBG2("snd_pcm_hw_params_set_rate_near(%i)\n",ao_data.samplerate); + MSG_DBG2("snd_pcm_hw_params_set_rate_near(%i)\n",ao->samplerate); - if ((err = snd_pcm_hw_params_set_channels(alsa.handler, alsa.hwparams, - ao_data.channels)) < 0) { + if ((err = snd_pcm_hw_params_set_channels(priv->handler, priv->hwparams, + ao->channels)) < 0) { MSG_ERR("alsa-conf: unable to set %u channels: %s\n", - ao_data.channels, + ao->channels, snd_strerror(err)); return 0; } - MSG_DBG2("snd_pcm_hw_params_set_channels(%i)\n",ao_data.channels); + MSG_DBG2("snd_pcm_hw_params_set_channels(%i)\n",ao->channels); #ifdef BUFFERTIME { int dir; unsigned period_time,alsa_buffer_time = 500000; /* buffer time in us */ - if ((err = snd_pcm_hw_params_set_buffer_time_near(alsa.handler, alsa.hwparams, &alsa_buffer_time, &dir)) < 0) { + if ((err = snd_pcm_hw_params_set_buffer_time_near(priv->handler, priv->hwparams, &alsa_buffer_time, &dir)) < 0) { MSG_ERR("alsa-init: unable to set buffer time near: %s\n", snd_strerror(err)); return 0; @@ -534,8 +536,8 @@ MSG_DBG2("snd_pcm_hw_set_buffer_time_near(%i)\n",alsa_buffer_time); period_time = alsa_buffer_time/4; - if ((err = snd_pcm_hw_params_set_period_time_near(alsa.handler, alsa.hwparams, &period_time, &dir)) < 0) { - /* original: alsa_buffer_time/ao_data.bps */ + if ((err = snd_pcm_hw_params_set_period_time_near(priv->handler, priv->hwparams, &period_time, &dir)) < 0) { + /* original: alsa_buffer_time/ao->bps */ MSG_ERR("alsa-init: unable to set period time: %s\n", snd_strerror(err)); return 0; @@ -548,14 +550,14 @@ int dir=0; unsigned period_time=100000; /* period time in us */ snd_pcm_uframes_t size; - if ((err = snd_pcm_hw_params_set_period_time_near(alsa.handler, alsa.hwparams, &period_time, &dir)) < 0) { + if ((err = snd_pcm_hw_params_set_period_time_near(priv->handler, priv->hwparams, &period_time, &dir)) < 0) { MSG_ERR("alsa-init: unable to set period_time: %s\n", snd_strerror(err)); return 0; } MSG_DBG2("snd_pcm_hw_set_period_time(%i)\n",period_time); //get chunksize - if ((err = snd_pcm_hw_params_get_period_size(alsa.hwparams, &size, &dir)) < 0) { + if ((err = snd_pcm_hw_params_get_period_size(priv->hwparams, &size, &dir)) < 0) { MSG_ERR("alsa-init: unable to get period_size: %s\n", snd_strerror(err)); return 0; } @@ -564,15 +566,15 @@ } #endif // gets buffersize for control - if ((err = snd_pcm_hw_params_get_buffer_size(alsa.hwparams,&dummy)) < 0) { + if ((err = snd_pcm_hw_params_get_buffer_size(priv->hwparams,&dummy)) < 0) { MSG_ERR("alsa-conf: unable to get buffersize: %s\n", snd_strerror(err)); return 0; } else { - ao_data.buffersize = dummy * alsa.bytes_per_sample; - MSG_V("alsa-conf: got buffersize=%i\n", ao_data.buffersize); + ao->buffersize = dummy * priv->bytes_per_sample; + MSG_V("alsa-conf: got buffersize=%i\n", ao->buffersize); } MSG_DBG2("snd_pcm_hw_params_get_buffer_size(%i)\n",dummy); - bits_per_sample = snd_pcm_format_physical_width(alsa.format); + bits_per_sample = snd_pcm_format_physical_width(priv->format); MSG_DBG2("%i=snd_pcm_hw_format_pohysical_width()\n",bits_per_sample); bits_per_frame = bits_per_sample * channels; chunk_bytes = chunk_size * bits_per_frame / 8; @@ -580,78 +582,84 @@ MSG_V("alsa-conf: bits per sample (bps)=%i, bits per frame (bpf)=%i, chunk_bytes=%i\n",bits_per_sample,bits_per_frame,chunk_bytes); /* finally install hardware parameters */ - if ((err = snd_pcm_hw_params(alsa.handler, alsa.hwparams)) < 0) { + if ((err = snd_pcm_hw_params(priv->handler, priv->hwparams)) < 0) { MSG_ERR("alsa-conf: unable to set hw-parameters: %s\n", snd_strerror(err)); return 0; } MSG_DBG2("snd_pcm_hw_params()\n"); // setting sw-params (only avail-min) if noblocking mode was choosed - if (alsa.ao_noblock) { - if ((err = snd_pcm_sw_params_current(alsa.handler, alsa.swparams)) < 0) { + if (ao_noblock) { + if ((err = snd_pcm_sw_params_current(priv->handler, priv->swparams)) < 0) { MSG_ERR("alsa-conf: unable to get parameters: %s\n",snd_strerror(err)); return 0; } //set min available frames to consider pcm ready (4) //increased for nonblock-mode should be set dynamically later - if ((err = snd_pcm_sw_params_set_avail_min(alsa.handler, alsa.swparams, 4)) < 0) { + if ((err = snd_pcm_sw_params_set_avail_min(priv->handler, priv->swparams, 4)) < 0) { MSG_ERR("alsa-conf: unable to set avail_min %s\n",snd_strerror(err)); return 0; } - if ((err = snd_pcm_sw_params(alsa.handler, alsa.swparams)) < 0) { + if ((err = snd_pcm_sw_params(priv->handler, priv->swparams)) < 0) { MSG_ERR("alsa-conf: unable to install sw-params\n"); return 0; } }//end swparams - if ((err = snd_pcm_prepare(alsa.handler)) < 0) { + if ((err = snd_pcm_prepare(priv->handler)) < 0) { MSG_ERR("alsa-conf: pcm prepare error: %s\n", snd_strerror(err)); return 0; } // end setting hw-params MSG_V("alsa-conf: %d Hz/%d channels/%d bpf/%d bytes buffer/%s\n", - ao_data.samplerate, ao_data.channels, alsa.bytes_per_sample, ao_data.buffersize, - snd_pcm_format_description(alsa.format)); + ao->samplerate, ao->channels, priv->bytes_per_sample, ao->buffersize, + snd_pcm_format_description(priv->format)); return 1; } // end configure /* close audio device */ -static void uninit(void) +static void uninit(ao_data_t* ao) { int err; - if(!alsa.handler) { + priv_t*priv=ao->priv; + if(!priv->handler) { MSG_ERR("alsa-uninit: no handler defined!\n"); + free(priv); return; } - if (!alsa.ao_noblock) { - if ((err = snd_pcm_drain(alsa.handler)) < 0) { + if (!ao_noblock) { + if ((err = snd_pcm_drain(priv->handler)) < 0) { MSG_ERR("alsa-uninit: pcm drain error: %s\n", snd_strerror(err)); + free(priv); return; } } - if ((err = snd_pcm_close(alsa.handler)) < 0) { + if ((err = snd_pcm_close(priv->handler)) < 0) { MSG_ERR("alsa-uninit: pcm close error: %s\n", snd_strerror(err)); + free(priv); return; } else { - alsa.handler = NULL; + priv->handler = NULL; MSG_V("alsa-uninit: pcm closed\n"); } - snd_pcm_hw_params_free(alsa.hwparams); - snd_pcm_sw_params_free(alsa.swparams); + snd_pcm_hw_params_free(priv->hwparams); + snd_pcm_sw_params_free(priv->swparams); + free(priv); } -static void audio_pause(void) +static void audio_pause(ao_data_t* ao) { + priv_t*priv=ao->priv; int err; - if (!alsa.ao_noblock) { + if (!ao_noblock) { //drain causes error in nonblock-mode! - if ((err = snd_pcm_drain(alsa.handler)) < 0) { + if ((err = snd_pcm_drain(priv->handler)) < 0) { MSG_ERR("alsa-pause: pcm drain error: %s\n", snd_strerror(err)); return; } @@ -661,26 +669,28 @@ } } -static void audio_resume(void) +static void audio_resume(ao_data_t* ao) { + priv_t*priv=ao->priv; int err; - if ((err = snd_pcm_prepare(alsa.handler)) < 0) { + if ((err = snd_pcm_prepare(priv->handler)) < 0) { MSG_ERR("alsa-resume: pcm prepare error: %s\n", snd_strerror(err)); return; } } /* stop playing and empty buffers (for seeking/pause) */ -static void reset(void) +static void reset(ao_data_t* ao) { + priv_t*priv=ao->priv; int err; - if ((err = snd_pcm_drop(alsa.handler)) < 0) { + if ((err = snd_pcm_drop(priv->handler)) < 0) { MSG_ERR("alsa-reset: pcm drop error: %s\n", snd_strerror(err)); return; } - if ((err = snd_pcm_prepare(alsa.handler)) < 0) { + if ((err = snd_pcm_prepare(priv->handler)) < 0) { MSG_ERR("alsa-reset: pcm prepare error: %s\n", snd_strerror(err)); return; } @@ -714,14 +724,15 @@ #endif /* I/O error handler */ -static int __FASTCALL__ xrun(const char *str_mode) +static int __FASTCALL__ xrun(ao_data_t* ao,const char *str_mode) { + priv_t*priv=ao->priv; int err; snd_pcm_status_t *status; snd_pcm_status_alloca(&status); - if ((err = snd_pcm_status(alsa.handler, status))<0) { + if ((err = snd_pcm_status(priv->handler, status))<0) { MSG_ERR("status error: %s", snd_strerror(err)); return 0; } @@ -736,7 +747,7 @@ diff.tv_sec * 1000 + diff.tv_usec / 1000.0); } - if ((err = snd_pcm_prepare(alsa.handler))<0) { + if ((err = snd_pcm_prepare(priv->handler))<0) { MSG_ERR("xrun: prepare error: %s", snd_strerror(err)); return 0; } @@ -744,16 +755,16 @@ return 1; /* ok, data should be accepted again */ } -static unsigned __FASTCALL__ play_normal(any_t* data, unsigned len); -static unsigned __FASTCALL__ play_mmap(any_t* data, unsigned len); +static unsigned __FASTCALL__ play_normal(ao_data_t* ao,any_t* data, unsigned len); +static unsigned __FASTCALL__ play_mmap(ao_data_t* ao,any_t* data, unsigned len); -static unsigned __FASTCALL__ play(any_t* data, unsigned len, unsigned flags) +static unsigned __FASTCALL__ play(ao_data_t* ao,any_t* data, unsigned len, unsigned flags) { unsigned result; UNUSED(flags); - MSG_DBG2("[ao_alsa] %s playing %i bytes\n",alsa.ao_mmap?"mmap":"normal",len); - if (alsa.ao_mmap) result = play_mmap(data, len); - else result = play_normal(data, len); + MSG_DBG2("[ao_alsa] %s playing %i bytes\n",priv->ao_mmap?"mmap":"normal",len); + if (ao_mmap) result = play_mmap(ao,data, len); + else result = play_normal(ao,data, len); return result; } @@ -764,35 +775,36 @@ thanxs for marius <ma...@ro...> for giving us the light ;) */ -static unsigned __FASTCALL__ play_normal(any_t* data, unsigned len) +static unsigned __FASTCALL__ play_normal(ao_data_t* ao,any_t* data, unsigned len) { - //alsa.bytes_per_sample is always 4 for 2 chn S16_LE - unsigned num_frames = len / alsa.bytes_per_sample; + priv_t*priv=ao->priv; + //priv->bytes_per_sample is always 4 for 2 chn S16_LE + unsigned num_frames = len / priv->bytes_per_sample; char *output_samples = (char *)data; snd_pcm_sframes_t res = 0; //fprintf(stderr,"alsa-play: frames=%i, len=%i\n",num_frames,len); - if (!alsa.handler) { + if (!priv->handler) { MSG_ERR("alsa-play: device configuration error"); return 0; } while (num_frames > 0) { - res = snd_pcm_writei(alsa.handler, (any_t*)output_samples, num_frames); + res = snd_pcm_writei(priv->handler, (any_t*)output_samples, num_frames); if (res == -EAGAIN) { - snd_pcm_wait(alsa.handler, 1000); + snd_pcm_wait(priv->handler, 1000); } else if (res == -EPIPE) { /* underrun */ - if (xrun("play") <= 0) { + if (xrun(ao,"play") <= 0) { MSG_ERR("alsa-play: xrun reset error"); return 0; } } else if (res == -ESTRPIPE) { /* suspend */ MSG_WARN("alsa-play: pcm in suspend mode. trying to resume\n"); - while ((res = snd_pcm_resume(alsa.handler)) == -EAGAIN) sleep(1); + while ((res = snd_pcm_resume(priv->handler)) == -EAGAIN) sleep(1); } else if (res < 0) { MSG_ERR("alsa-play: unknown status, trying to reset soundcard\n"); - if ((res = snd_pcm_prepare(alsa.handler)) < 0) { + if ((res = snd_pcm_prepare(priv->handler)) < 0) { MSG_ERR("alsa-play: snd prepare error"); return 0; break; @@ -800,8 +812,8 @@ } if (res > 0) { - /* output_samples += ao_data.channels * res; */ - output_samples += res * alsa.bytes_per_sample; + /* output_samples += ao->channels * res; */ + output_samples += res * priv->bytes_per_sample; num_frames -= res; } } //end while @@ -817,8 +829,9 @@ * 'An overview of the ALSA API' http://people.debian.org/~joshua/x66.html * and some help by Paul Davis <pb...@op...> */ -static unsigned __FASTCALL__ play_mmap(any_t* data, unsigned len) +static unsigned __FASTCALL__ play_mmap(ao_data_t* ao,any_t* data, unsigned len) { + priv_t*priv=ao->priv; snd_pcm_sframes_t commitres, frames_available; snd_pcm_uframes_t frames_transmit, size, offset; const snd_pcm_channel_area_t *area; @@ -829,75 +842,75 @@ struct pollfd *ufds; int count; - count = snd_pcm_poll_descriptors_count (alsa.handler); + count = snd_pcm_poll_descriptors_count (priv->handler); ufds = malloc(sizeof(struct pollfd) * count); - snd_pcm_poll_descriptors(alsa.handler, ufds, count); + snd_pcm_poll_descriptors(priv->handler, ufds, count); //first wait_for_poll - if (err = (wait_for_poll(alsa.handler, ufds, count) < 0)) { - if (snd_pcm_state(alsa.handler) == SND_PCM_STATE_XRUN || - snd_pcm_state(alsa.handler) == SND_PCM_STATE_SUSPENDED) { + if (err = (wait_for_poll(priv->handler, ufds, count) < 0)) { + if (snd_pcm_state(priv->handler) == SND_PCM_STATE_XRUN || + snd_pcm_state(priv->handler) == SND_PCM_STATE_SUSPENDED) { xrun("play"); } } #endif - outbuffer = alloca(ao_data.buffersize); + outbuffer = alloca(ao->buffersize); //don't trust get_space() ;) - frames_available = snd_pcm_avail_update(alsa.handler) * alsa.bytes_per_sample; - if (frames_available < 0) xrun("play"); + frames_available = snd_pcm_avail_update(priv->handler) * priv->bytes_per_sample; + if (frames_available < 0) xrun(ao,"play"); if (frames_available < 4) { - if (alsa.first) { - alsa.first = 0; - snd_pcm_start(alsa.handler); + if (priv->first) { + priv->first = 0; + snd_pcm_start(priv->handler); } else { //FIXME should break and return 0? - snd_pcm_wait(alsa.handler, -1); - alsa.first = 1; + snd_pcm_wait(priv->handler, -1); + priv->first = 1; } } /* len is simply the available bufferspace got by get_space() - * but real avail_buffer in frames is ab/alsa.bytes_per_sample */ - size = len / alsa.bytes_per_sample; + * but real avail_buffer in frames is ab/priv->bytes_per_sample */ + size = len / priv->bytes_per_sample; //if (verbose) - //printf("len: %i size %i, f_avail %i, bps %i ...\n", len, size, frames_available, alsa.bytes_per_sample); + //printf("len: %i size %i, f_avail %i, bps %i ...\n", len, size, frames_available, priv->bytes_per_sample); frames_transmit = size; /* prepare areas and set sw-pointers * frames_transmit returns the real available buffer-size * sometimes != frames_available cause of ringbuffer 'emulation' */ - snd_pcm_mmap_begin(alsa.handler, &area, &offset, &frames_transmit); + snd_pcm_mmap_begin(priv->handler, &area, &offset, &frames_transmit); /* this is specific to interleaved streams (or non-interleaved * streams with only one channel) */ outbuffer = ((char *) area->addr + (area->first + area->step * offset) / 8); //8 //write data - memcpy(outbuffer, data, (frames_transmit * alsa.bytes_per_sample)); - commitres = snd_pcm_mmap_commit(alsa.handler, offset, frames_transmit); + memcpy(outbuffer, data, (frames_transmit * priv->bytes_per_sample)); + commitres = snd_pcm_mmap_commit(priv->handler, offset, frames_transmit); if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames_transmit) { - if (snd_pcm_state(alsa.handler) == SND_PCM_STATE_XRUN || - snd_pcm_state(alsa.handler) == SND_PCM_STATE_SUSPENDED) { - xrun("play"); + if (snd_pcm_state(priv->handler) == SND_PCM_STATE_XRUN || + snd_pcm_state(priv->handler) == SND_PCM_STATE_SUSPENDED) { + xrun(ao,"play"); } } //if (verbose) //printf("mmap ft: %i, cres: %i\n", frames_transmit, commitres); - /* err = snd_pcm_area_copy(&area, offset, &data, offset, len, alsa.format); */ + /* err = snd_pcm_area_copy(&area, offset, &data, offset, len, priv->format); */ /* if (err < 0) { */ /* printf("area-copy-error\n"); */ /* return 0; */ /* } */ //calculate written frames! - result = commitres * alsa.bytes_per_sample; + result = commitres * priv->bytes_per_sample; /* if (verbose) { */ @@ -926,8 +939,9 @@ GET_SPACE_UNDEFINED }space_status; /* how many byes are free in the buffer */ -static unsigned get_space(void) +static unsigned get_space(ao_data_t* ao) { + priv_t*priv=ao->priv; snd_pcm_status_t *status; int ret,st; space_status e_status=GET_SPACE_UNDEFINED; @@ -939,7 +953,7 @@ return 0; } - if ((ret = snd_pcm_status(alsa.handler, status)) < 0) { + if ((ret = snd_pcm_status(priv->handler, status)) < 0) { MSG_ERR("alsa-space: cannot get pcm status: %s\n", snd_strerror(ret)); return 0; } @@ -950,15 +964,15 @@ case SND_PCM_STATE_PREPARED: if (e_status!=GET_SPACE_OPEN) { e_status = GET_SPACE_PREPARED; - alsa.first = 1; - ret = snd_pcm_status_get_avail(status) * alsa.bytes_per_sample; + priv->first = 1; + ret = snd_pcm_status_get_avail(status) * priv->bytes_per_sample; if (ret == 0) //ugly workaround for hang in mmap-mode ret = 10; break; } case SND_PCM_STATE_RUNNING: - ret = snd_pcm_status_get_avail(status) * alsa.bytes_per_sample; - //avail_frames = snd_pcm_avail_update(alsa.handler) * alsa.bytes_per_sample; + ret = snd_pcm_status_get_avail(status) * priv->bytes_per_sample; + //avail_frames = snd_pcm_avail_update(priv->handler) * priv->bytes_per_sample; if (e_status!=GET_SPACE_OPEN && e_status!=GET_SPACE_PREPARED) e_status = GET_SPACE_RUNNING; break; @@ -968,16 +982,16 @@ ret = 0; break; case SND_PCM_STATE_XRUN: - xrun("space"); + xrun(ao,"space"); e_status = GET_SPACE_XRUN; - alsa.first = 1; + priv->first = 1; ret = 0; break; default: e_status = GET_SPACE_UNDEFINED; - ret = snd_pcm_status_get_avail(status) * alsa.bytes_per_sample; + ret = snd_pcm_status_get_avail(status) * priv->bytes_per_sample; if (ret <= 0) { - xrun("space"); + xrun(ao,"space"); } } @@ -994,9 +1008,10 @@ } /* delay in seconds between first and last sample in buffer */ -static float get_delay(void) +static float get_delay(ao_data_t* ao) { - if (alsa.handler) { + priv_t*priv=ao->priv; + if (priv->handler) { snd_pcm_status_t *status; int r; float ret; @@ -1006,7 +1021,7 @@ return 0; } - if ((ret = snd_pcm_status(alsa.handler, status)) < 0) { + if ((ret = snd_pcm_status(priv->handler, status)) < 0) { MSG_ERR("alsa-delay: cannot get pcm status: %s\n", snd_strerror(ret)); return 0; } @@ -1016,7 +1031,7 @@ case SND_PCM_STATE_PREPARED: case SND_PCM_STATE_RUNNING: r=snd_pcm_status_get_delay(status); - ret = (float)r/(float)ao_data.samplerate; + ret = (float)r/(float)ao->samplerate; break; default: ret = 0; Modified: mplayerxp/libao2/ao_arts.c =================================================================== --- mplayerxp/libao2/ao_arts.c 2012-10-20 13:48:57 UTC (rev 186) +++ mplayerxp/libao2/ao_arts.c 2012-10-21 09:46:13 UTC (rev 187) @@ -34,7 +34,6 @@ #define ARTS_PACKETS 10 /* Number of audio packets */ #define ARTS_PACKET_SIZE_LOG2 11 /* Log2 of audio packet size */ -static arts_stream_t stream; static const ao_info_t info = { @@ -46,16 +45,18 @@ LIBAO_EXTERN(arts) -static int control(int cmd, long arg) +static int control(ao_data_t* ao,int cmd, long arg) { + UNUSED(ao); UNUSED(cmd); UNUSED(arg); return CONTROL_UNKNOWN; } -static int init(unsigned flags) +static int init(ao_data_t* ao,unsigned flags) { int err; + UNUSED(ao); UNUSED(flags); if( (err=arts_init()) ) { @@ -67,8 +68,9 @@ return 1; } -static int __FASTCALL__ configure(unsigned rate,unsigned channels,unsigned format) +static int __FASTCALL__ configure(ao_data_t* ao,unsigned rate,unsigned channels,unsigned format) { + arts_stream_t stream; unsigned frag_spec,samplesize; /* * arts supports 8bit unsigned and 16bit signed sample formats @@ -106,12 +108,13 @@ break; } - ao_data.format = format; - ao_data.channels = channels; - ao_data.samplerate = rate; - ao_data.bps = rate*channels*samplesize; + ao->format = format; + ao->channels = channels; + ao->samplerate = rate; + ao->bps = rate*channels*samplesize; stream=arts_play_stream(rate, samplesize*8, channels, "MPlayerXP"); + ao->priv=stream; if(stream == NULL) { MSG_ERR("[aRts] Can't open stream\n"); @@ -124,43 +127,47 @@ arts_stream_set(stream, ARTS_P_BLOCKING, 1); frag_spec = ARTS_PACKET_SIZE_LOG2 | ARTS_PACKETS << 16; arts_stream_set(stream, ARTS_P_PACKET_SETTINGS, frag_spec); - ao_data.buffersize = arts_stream_get(stream, ARTS_P_BUFFER_SIZE); + ao->buffersize = arts_stream_get(stream, ARTS_P_BUFFER_SIZE); MSG_INFO("[aRts] Stream opened\n"); - MSG_V("[aRts] buffersize=%u\n",ao_data.buffersize); + MSG_V("[aRts] buffersize=%u\n",ao->buffersize); MSG_V("[aRts] buffersize=%u\n", arts_stream_get(stream, ARTS_P_PACKET_SIZE)); return 1; } -static void uninit(void) +static void uninit(ao_data_t* ao) { - arts_close_stream(stream); - arts_free(); + arts_stream_t stream=ao->priv; + arts_close_stream(stream); + arts_free(); } -static unsigned play(any_t* data,unsigned len,unsigned flags) +static unsigned play(ao_data_t* ao,any_t* data,unsigned len,unsigned flags) { + arts_stream_t stream=ao->priv; UNUSED(flags); return arts_write(stream, data, len); } -static void audio_pause(void) +static void audio_pause(ao_data_t* ao) { + UNUSED(ao); } -static void audio_resume(void) { } +static void audio_resume(ao_data_t* ao) { UNUSED(ao); } +static void reset(ao_data_t* ao) { UNUSED(ao); } -static void reset(void) { } - -static unsigned get_space(void) +static unsigned get_space(ao_data_t* ao) { - return arts_stream_get(stream, ARTS_P_BUFFER_SPACE); + arts_stream_t stream=ao->priv; + return arts_stream_get(stream, ARTS_P_BUFFER_SPACE); } -static float get_delay(void) +static float get_delay(ao_data_t* ao) { - return ((float) (ao_data.buffersize - arts_stream_get(stream, - ARTS_P_BUFFER_SPACE))) / ((float) ao_data.bps); + arts_stream_t stream=ao->priv; + return ((float) (ao->buffersize - arts_stream_get(stream, + ARTS_P_BUFFER_SPACE))) / ((float) ao->bps); } Modified: mplayerxp/libao2/ao_esd.c =================================================================== --- mplayerxp/libao2/ao_esd.c 2012-10-20 13:48:57 UTC (rev 186) +++ mplayerxp/libao2/ao_esd.c 2012-10-21 09:46:13 UTC (rev 187) @@ -36,6 +36,7 @@ #include <sys/time.h> #include <sys/socket.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <errno.h> @@ -77,7 +78,7 @@ LIBAO_EXTERN(esd) -typedef struct esd_priv_s { +typedef struct priv_s { int fd; int play_fd; esd_server_info_t* svinfo; @@ -86,16 +87,14 @@ unsigned long samples_written; struct timeval play_start; float audio_delay; -}esd_priv_t; +}priv_t; -static esd_priv_t esd = { -1, -1, NULL, 0, 0, 0, { 0, 0 }, 0 }; - - /* * to set/get/query special features/parameters */ -static int control(int cmd, long arg) +static int control(ao_data_t* ao,int cmd, long arg) { + priv_t*priv=ao->priv; esd_player_info_t *esd_pi; esd_info_t *esd_i; time_t now; @@ -111,7 +110,7 @@ } dprintf("esd: get vol\n"); - if ((esd_i = esd_get_all_info(esd.fd)) == NULL) + if ((esd_i = esd_get_all_info(priv->fd)) == NULL) return CONTROL_ERROR; for (esd_pi = esd_i->player_list; esd_pi != NULL; esd_pi = esd_pi->next) @@ -132,7 +131,7 @@ case AOCONTROL_SET_VOLUME: dprintf("esd: set vol\n"); - if ((esd_i = esd_get_all_info(esd.fd)) == NULL) + if ((esd_i = esd_get_all_info(priv->fd)) == NULL) return CONTROL_ERROR; for (esd_pi = esd_i->player_list; esd_pi != NULL; esd_pi = esd_pi->next) @@ -141,7 +140,7 @@ if (esd_pi != NULL) { ao_control_vol_t *vol = (ao_control_vol_t *)arg; - esd_set_stream_pan(esd.fd, esd_pi->source_id, + esd_set_stream_pan(priv->fd, esd_pi->source_id, vol->left * ESD_VOLUME_BASE / 100, vol->right * ESD_VOLUME_BASE / 100); @@ -161,13 +160,16 @@ * open & setup audio device * return: 1=success 0=fail */ -static int init(unsigned flags) +static int init(ao_data_t* ao,unsigned flags) { + ao->priv=malloc(sizeof(priv_t)); + priv_t*priv=ao->priv; + priv->fd=priv->play_fd=-1; char *server = ao_subdevice; /* NULL for localhost */ UNUSED(flags); - if (esd.fd < 0) { - esd.fd = esd_open_sound(server); - if (esd.fd < 0) { + if (priv->fd < 0) { + priv->fd = esd_open_sound(server); + if (priv->fd < 0) { MSG_ERR("ESD: Can't open sound: %s\n", strerror(errno)); return 0; } @@ -175,8 +177,9 @@ return 1; } -static int configure(unsigned rate_hz,unsigned channels,unsigned format) +static int configure(ao_data_t* ao,unsigned rate_hz,unsigned channels,unsigned format) { + priv_t*priv=ao->priv; char *server = ao_subdevice; /* NULL for localhost */ esd_format_t esd_fmt; int bytes_per_sample; @@ -185,7 +188,7 @@ struct timeval proto_start, proto_end; /* get server info, and measure network latency */ gettimeofday(&proto_start, NULL); - esd.svinfo = esd_get_server_info(esd.fd); + priv->svinfo = esd_get_server_info(priv->fd); if(server) { gettimeofday(&proto_end, NULL); lag_net = (proto_end.tv_sec - proto_start.tv_sec) + @@ -195,9 +198,9 @@ lag_net = 0.0; /* no network lag */ /* - if (esd.svinfo) { + if (priv->svinfo) { mp_msg(MSGT_AO, MSGL_INFO, "AO: [esd] server info:\n"); - esd_print_server_info(esd.svinfo); + esd_print_server_info(priv->svinfo); } */ esd_fmt = ESD_STREAM | ESD_PLAY; @@ -206,20 +209,20 @@ /* let the esd daemon convert sample rate */ #else /* let mplayer's audio filter convert the sample rate */ - if (esd.svinfo != NULL) - rate_hz = esd.svinfo->rate; + if (priv->svinfo != NULL) + rate_hz = priv->svinfo->rate; #endif - ao_data.samplerate = rate_hz; + ao->samplerate = rate_hz; /* EsounD can play mono or stereo */ switch (channels) { case 1: esd_fmt |= ESD_MONO; - ao_data.channels = bytes_per_sample = 1; + ao->channels = bytes_per_sample = 1; break; default: esd_fmt |= ESD_STEREO; - ao_data.channels = bytes_per_sample = 2; + ao->channels = bytes_per_sample = 2; break; } @@ -228,63 +231,63 @@ case AFMT_S8: case AFMT_U8: esd_fmt |= ESD_BITS8; - ao_data.format = AFMT_U8; + ao->format = AFMT_U8; break; default: esd_fmt |= ESD_BITS16; - ao_data.format = AFMT_S16_NE; + ao->format = AFMT_S16_NE; bytes_per_sample *= 2; break; } - /* modify esd.audio_delay depending on esd.latency + /* modify priv->audio_delay depending on priv->latency * latency is number of samples @ 44.1khz stereo 16 bit * adjust according to rate_hz & bytes_per_sample */ #ifdef CONFIG_ESD_LATENCY - esd.latency = esd_get_latency(esd.fd); + priv->latency = esd_get_latency(priv->fd); #else - esd.latency = ((channels == 1 ? 2 : 1) * ESD_DEFAULT_RATE * + priv->latency = ((channels == 1 ? 2 : 1) * ESD_DEFAULT_RATE * (ESD_BUF_SIZE + 64 * (4.0f / bytes_per_sample)) ) / rate_hz; - esd.latency += ESD_BUF_SIZE * 2; + priv->latency += ESD_BUF_SIZE * 2; #endif - if(esd.latency > 0) { - lag_serv = (esd.latency * 4.0f) / (bytes_per_sample * rate_hz); + if(priv->latency > 0) { + lag_serv = (priv->latency * 4.0f) / (bytes_per_sample * rate_hz); lag_seconds = lag_net + lag_serv; - esd.audio_delay += lag_seconds; + priv->audio_delay += lag_seconds; MSG_INFO("ESD: LatencyInfo: %f %f %f\n",lag_serv, lag_net, lag_seconds); } - esd.play_fd = esd_play_stream_fallback(esd_fmt, rate_hz, + priv->play_fd = esd_play_stream_fallback(esd_fmt, rate_hz, server, ESD_CLIENT_NAME); - if (esd.play_fd < 0) { + if (priv->play_fd < 0) { MSG_ERR("ESD: Can't open play stream: %s\n", strerror(errno)); return 0; } /* enable non-blocking i/o on the socket connection to the esd server */ - if ((fl = fcntl(esd.play_fd, F_GETFL)) >= 0) - fcntl(esd.play_fd, F_SETFL, O_NDELAY|fl); + if ((fl = fcntl(priv->play_fd, F_GETFL)) >= 0) + fcntl(priv->play_fd, F_SETFL, O_NDELAY|fl); #if ESD_DEBUG { int sbuf, rbuf, len; len = sizeof(sbuf); - getsockopt(esd.play_fd, SOL_SOCKET, SO_SNDBUF, &sbuf, &len); + getsockopt(priv->play_fd, SOL_SOCKET, SO_SNDBUF, &sbuf, &len); len = sizeof(rbuf); - getsockopt(esd.play_fd, SOL_SOCKET, SO_RCVBUF, &rbuf, &len); + getsockopt(priv->play_fd, SOL_SOCKET, SO_RCVBUF, &rbuf, &len); dprintf("esd: send/receive socket buffer space %d/%d bytes\n", sbuf, rbuf); } #endif - ao_data.bps = bytes_per_sample * rate_hz; - ao_data.outburst = ao_data.bps > 100000 ? 4*ESD_BUF_SIZE : 2*ESD_BUF_SIZE; + ao->bps = bytes_per_sample * rate_hz; + ao->outburst = ao->bps > 100000 ? 4*ESD_BUF_SIZE : 2*ESD_BUF_SIZE; - esd.play_start.tv_sec = 0; - esd.samples_written = 0; - esd.bytes_per_sample = bytes_per_sample; + priv->play_start.tv_sec = 0; + priv->samples_written = 0; + priv->bytes_per_sample = bytes_per_sample; return 1; } @@ -293,22 +296,24 @@ /* * close audio device */ -static void uninit(void) +static void uninit(ao_data_t* ao) { - if (esd.play_fd >= 0) { - esd_close(esd.play_fd); - esd.play_fd = -1; + priv_t*priv=ao->priv; + if (priv->play_fd >= 0) { + esd_close(priv->play_fd); + priv->play_fd = -1; } - if (esd.svinfo) { - esd_free_server_info(esd.svinfo); - esd.svinfo = NULL; + if (priv->svinfo) { + esd_free_server_info(priv->svinfo); + priv->svinfo = NULL; } - if (esd.fd >= 0) { - esd_close(esd.fd); - esd.fd = -1; + if (priv->fd >= 0) { + esd_close(priv->fd); + priv->fd = -1; } + free(priv); } @@ -317,8 +322,9 @@ * it should round it down to outburst*n * return: number of bytes played */ -static unsigned play(any_t* data, unsigned len, unsigned flags) +static unsigned play(ao_data_t* ao,any_t* data, unsigned len, unsigned flags) { + priv_t*priv=ao->priv; unsigned offs; unsigned nwritten; int nsamples; @@ -329,14 +335,14 @@ #define SINGLE_WRITE 0 #if SINGLE_WRITE - nwritten = write(esd.play_fd, data, len); + nwritten = write(priv->play_fd, data, len); #else for (offs = 0, nwritten=0; offs + ESD_BUF_SIZE <= len; offs += ESD_BUF_SIZE) { /* * note: we're writing to a non-blocking socket here. * A partial write means, that the socket buffer is full. */ - n = write(esd.play_fd, (char*)data + offs, ESD_BUF_SIZE); + n = write(priv->play_fd, (char*)data + offs, ESD_BUF_SIZE); if ( n < 0 ) { if ( errno != EAGAIN ) { dprintf("esd play: write failed: %s\n", strerror(errno)); @@ -351,14 +357,14 @@ #endif if (nwritten > 0) { - if (!esd.play_start.tv_sec) - gettimeofday(&esd.play_start, NULL); - nsamples = nwritten / esd.bytes_per_sample; - esd.samples_written += nsamples; + if (!priv->play_start.tv_sec) + gettimeofday(&priv->play_start, NULL); + nsamples = nwritten / priv->bytes_per_sample; + priv->samples_written += nsamples; - dprintf("esd play: %d %lu\n", nsamples, esd.samples_written); + dprintf("esd play: %d %lu\n", nsamples, priv->samples_written); } else { - dprintf("esd play: blocked / %lu\n", esd.samples_written); + dprintf("esd play: blocked / %lu\n", priv->samples_written); } return nwritten; @@ -368,41 +374,46 @@ /* * stop playing, keep buffers (for pause) */ -static void audio_pause(void) +static void audio_pause(ao_data_t* ao) { /* - * not possible with esd. the esd daemom will continue playing + * not possible with priv-> the esd daemom will continue playing * buffered data (not more than ESD_MAX_DELAY seconds of samples) */ + UNUSED(ao); } /* * resume playing, after audio_pause() */ -static void audio_resume(void) +static void audio_resume(ao_data_t* ao) { + priv_t*priv=ao->priv; /* - * not possible with esd. + * not possible with priv-> * * Let's hope the pause was long enough that the esd ran out of * buffered data; we restart our time based delay computation * for an audio resume. */ - esd.play_start.tv_sec = 0; - esd.samples_written = 0; + priv->play_start.tv_sec = 0; + priv->samples_written = 0; } /* * stop playing and empty buffers (for seeking/pause) */ -static void reset(void) +static void reset(ao_data_t* ao) { #ifdef __svr4__ + priv_t*priv=ao->priv; /* throw away data buffered in the esd connection */ - if (ioctl(esd.play_fd, I_FLUSH, FLUSHW)) + if (ioctl(priv->play_fd, I_FLUSH, FLUSHW)) perror("I_FLUSH"); +#else + UNUSED(ao); #endif } @@ -410,8 +421,9 @@ /* * return: how many bytes can be played without blocking */ -static unsigned get_space(void) +static unsigned get_space(ao_data_t* ao) { + priv_t*priv=ao->priv; struct timeval tmout; fd_set wfds; float current_delay; @@ -424,24 +436,24 @@ * device, and the consequence is a huge slow down for things like * esd_get_all_info(). */ - if ((current_delay = get_delay()) >= ESD_MAX_DELAY) { + if ((current_delay = get_delay(ao)) >= ESD_MAX_DELAY) { dprintf("esd get_space: too much data buffered\n"); return 0; } FD_ZERO(&wfds); - FD_SET(esd.play_fd, &wfds); + FD_SET(priv->play_fd, &wfds); tmout.tv_sec = 0; tmout.tv_usec = 0; - if (select(esd.play_fd + 1, NULL, &wfds, NULL, &tmout) != 1) + if (select(priv->play_fd + 1, NULL, &wfds, NULL, &tmout) != 1) return 0; - if (!FD_ISSET(esd.play_fd, &wfds)) + if (!FD_ISSET(priv->play_fd, &wfds)) return 0; /* try to fill 50% of the remaining "free" buffer space */ - space = (ESD_MAX_DELAY - current_delay) * ao_data.bps * 0.5f; + space = (ESD_MAX_DELAY - current_delay) * ao->bps * 0.5f; /* round up to next multiple of ESD_BUF_SIZE */ space = (space + ESD_BUF_SIZE-1) / ESD_BUF_SIZE * ESD_BUF_SIZE; @@ -454,26 +466,27 @@ /* * return: delay in seconds between first and last sample in buffer */ -static float get_delay(void) +static float get_delay(ao_data_t* ao) { + priv_t*priv=ao->priv; struct timeval now; double buffered_samples_time; double play_time; - if (!esd.play_start.tv_sec) + if (!priv->play_start.tv_sec) return 0; - buffered_samples_time = (float)esd.samples_written / ao_data.samplerate; + buffered_samples_time = (float)priv->samples_written / ao->samplerate; gettimeofday(&now, NULL); - play_time = now.tv_sec - esd.play_start.tv_sec; - play_time += (now.tv_usec - esd.play_start.tv_usec) / 1000000.; + play_time = now.tv_sec - priv->play_start.tv_sec; + play_time += (now.tv_usec - priv->play_start.tv_usec) / 1000000.; /* dprintf("esd delay: %f %f\n", play_time, buffered_samples_time); */ if (play_time > buffered_samples_time) { dprintf("esd: underflow\n"); - esd.play_start.tv_sec = 0; - esd.samples_written = 0; + priv->play_start.tv_sec = 0; + priv->samples_written = 0; return 0; } Modified: mplayerxp/libao2/ao_jack.c =================================================================== --- mplayerxp/libao2/ao_jack.c 2012-10-20 13:48:57 UTC (rev 186) +++ mplayerxp/libao2/ao_jack.c 2012-10-21 09:46:13 UTC (rev 187) @@ -50,44 +50,43 @@ //! maximum number of channels supported, avoids lots of mallocs #define MAX_CHANS 6 -typedef struct jack_priv_s { +typedef struct priv_s { jack_port_t * ports[MAX_CHANS]; unsigned num_ports; ///< Number of used ports == number of channels jack_client_t * client; float latency; int estimate; -}jack_priv_t; + volatile int paused; ///< set if paused + volatile int underrun; ///< signals if an priv->underrun occured -static jack_priv_t jack; + volatile float callback_interval; + volatile float callback_time; -static volatile int paused = 0; ///< set if paused -static volatile int underrun = 0; ///< signals if an underrun occured + CBFifoBuffer * buffer; //! buffer for audio data +}priv_t; -static volatile float callback_interval = 0; -static volatile float callback_time = 0; //! size of one chunk, if this is too small MPlayer will start to "stutter" //! after a short time of playback #define CHUNK_SIZE (16 * 1024) -//! number of "virtual" chunks the buffer consists of +//! number of "virtual" chunks the priv->buffer consists of #define NUM_CHUNKS 8 #define BUFFSIZE (NUM_CHUNKS * CHUNK_SIZE) -//! buffer for audio data -static CBFifoBuffer *buffer; /** - * \brief insert len bytes into buffer + * \brief insert len bytes into priv->buffer * \param data data to insert * \param len length of data - * \return number of bytes inserted into buffer + * \return number of bytes inserted into priv->buffer * - * If there is not enough room, the buffer is filled up + * If there is not enough room, the priv->buffer is filled up */ -static int write_buffer(unsigned char* data, int len) { - int free = cb_fifo_space(buffer); - if (len > free) len = free; - return cb_fifo_generic_write(buffer, data, len, NULL); +static int write_buffer(ao_data_t* ao,unsigned char* data, int len) { + priv_t*priv=ao->priv; + int _free = cb_fifo_space(priv->buffer); + if (len > _free) len = _free; + return cb_fifo_generic_write(priv->buffer, data, len, NULL); } static void silence(float **bufs, int cnt, int num_bufs); @@ -99,8 +98,8 @@ int pos; }; -static void deinterleave(any_t*info, any_t*src, int len) { - struct deinterleave *di = info; +static void deinterleave(any_t*_info, any_t*src, int len) { + struct deinterleave *di = _info; float *s = src; int i; len /= sizeof(float); @@ -114,42 +113,44 @@ } /** - * \brief read data from buffer and splitting it into channels - * \param bufs num_bufs float buffers, each will contain the data of one channel + * \brief read data from priv->buffer and splitting it into channels + * \param bufs num_bufs float priv->buffers, each will contain the data of one channel * \param cnt number of samples to read per channel * \param num_bufs number of channels to split the data into * \return number of samples read per channel, equals cnt unless there was too - * little data in the buffer + * little data in the priv->buffer * - * Assumes the data in the buffer is of type float, the number of bytes + * Assumes the data in the priv->buffer is of type float, the number of bytes * read is res * num_bufs * sizeof(float), where res is the return value. - * If there is not enough data in the buffer remaining parts will be filled + * If there is not enough data in the priv->buffer remaining parts will be filled * with silence. */ -static unsigned read_buffer(float **bufs, unsigned cnt, unsigned num_bufs) { +static unsigned read_buffer(ao_data_t* ao,float **bufs, unsigned cnt, unsigned num_bufs) { + priv_t*priv=ao->priv; struct deinterleave di = {bufs, num_bufs, 0, 0}; - unsigned buffered = cb_fifo_size(buffer); + unsigned buffered = cb_fifo_size(priv->buffer); if (cnt * sizeof(float) * num_bufs > buffered) { silence(bufs, cnt, num_bufs); cnt = buffered / sizeof(float) / num_bufs; } - cb_fifo_generic_read(buffer, &di, cnt * num_bufs * sizeof(float), deinterleave); + cb_fifo_generic_read(priv->buffer, &di, cnt * num_bufs * sizeof(float), deinterleave); return cnt; } -// end ring buffer stuff +// end ring priv->buffer stuff -static int control(int cmd, long arg) { +static int control(ao_data_t* ao,int cmd, long arg) { + UNUSED(ao); UNUSED(cmd); UNUSED(arg); return CONTROL_UNKNOWN; } /** - * \brief fill the buffers with silence - * \param bufs num_bufs float buffers, each will contain the data of one channel - * \param cnt number of samples in each buffer - * \param num_bufs number of buffers + * \brief fill the priv->buffers with silence + * \param bufs num_bufs float priv->buffers, each will contain the data of one channel + * \param cnt number of samples in each priv->buffer + * \param num_bufs number of priv->buffers */ static void silence(float **bufs, int cnt, int num_bufs) { int i; @@ -159,31 +160,31 @@ /** * \brief JACK Callback function - * \param nframes number of frames to fill into buffers + * \param nframes number of frames to fill into priv->buffers * \param arg unused * \return currently always 0 * - * Write silence into buffers if paused or an underrun occured + * Write silence into priv->buffers if priv->paused or an priv->underrun occured */ -static int outputaudio(jack_nframes_t nframes, any_t*arg) { +static int outputaudio(jack_nframes_t nframes, any_t* ao) { + priv_t*priv=((ao_data_t*)ao)->priv; float *bufs[MAX_CHANS]; unsigned i; - UNUSED(arg); - for (i = 0; i < jack.num_ports; i++) - bufs[i] = jack_port_get_buffer(jack.ports[i], nframes); - if (paused || underrun) - silence(bufs, nframes, jack.num_ports); + for (i = 0; i < priv->num_ports; i++) + bufs[i] = jack_port_get_buffer(priv->ports[i], nframes); + if (priv->paused || priv->underrun) + silence(bufs, nframes, priv->num_ports); else - if (read_buffer(bufs, nframes, jack.num_ports) < nframes) - underrun = 1; - if (jack.estimate) { + if (read_buffer(ao,bufs, nframes, priv->num_ports) < nframes) + priv->underrun = 1; + if (priv->estimate) { float now = (float)GetTimer() / 1000000.0; - float diff = callback_time + callback_interval - now; + float diff = priv->callback_time + priv->callback_interval - now; if ((diff > -0.002) && (diff < 0.002)) - callback_time += callback_interval; + priv->callback_time += priv->callback_interval; else - callback_time = now; - callback_interval = (float)nframes / (float)ao_data.samplerate; + priv->callback_time = now; + priv->callback_interval = (float)nframes / (float)((ao_data_t*)ao)->samplerate; } return 0; } @@ -197,22 +198,29 @@ MSG_FATAL( "\n-ao jack commandline help:\n" "Example: mplayer -ao jack:port=myout\n" - " connects MPlayer to the jack jack.ports named myout\n" + " connects MPlayer to the jack priv->ports named myout\n" "\nOptions:\n" " port=<port name>\n" - " Connects to the given jack.ports instead of the default physical ones\n" + " Connects to the given priv->ports instead of the default physical ones\n" " name=<client name>\n" - " jack.client name to pass to JACK\n" - " jack.estimate\n" - " jack.estimates the amount of data in buffers (experimental)\n" + " priv->client name to pass to JACK\n" + " priv->estimate\n" + " priv->estimates the amount of data in priv->buffers (experimental)\n" " autostart\n" " Automatically start JACK server if necessary\n" ); } #endif -static int init(unsigned flags) { UNUSED(flags); return 1; } +static int init(ao_data_t* ao,unsigned flags) { + ao->priv=malloc(sizeof(priv_t)); + priv_t*priv=ao->priv; + memset(priv,0,sizeof(priv_t)); + UNUSED(flags); + return 1; +} -static int configure(unsigned rate,unsigned channels,unsigned format) { +static int configure(ao_data_t* ao,unsigned rate,unsigned channels,unsigned format) { + priv_t*priv=ao->priv; const char **matching_ports = NULL; char *port_name = NULL; char *client_name = NULL; @@ -221,7 +229,7 @@ const opt_t subopts[] = { {"port", OPT_ARG_MSTRZ, &port_name, NULL}, {"name", OPT_ARG_MSTRZ, &client_name, NULL}, - {"jack.estimate", OPT_ARG_BOOL, &jack.estimate, NULL}, + {"priv->estimate", OPT_ARG_BOOL, &priv->estimate, NULL}, {"autostart", OPT_ARG_BOOL, &autostart, NULL}, {NULL} }; @@ -229,7 +237,7 @@ jack_options_t open_options = JackUseExactName; int port_flags = JackPortIsInput; unsigned i; - jack.estimate = 1; + priv->estimate = 1; UNUSED(format); /* if (subopt_parse(ao_subdevice, subopts) != 0) { @@ -247,58 +255,58 @@ } if (!autostart) open_options |= JackNoStartServer; - jack.client = jack_client_open(client_name, open_options, NULL); - if (!jack.client) { + priv->client = jack_client_open(client_name, open_options, NULL); + if (!priv->client) { MSG_FATAL("[JACK] cannot open server\n"); goto err_out; } - buffer = cb_fifo_alloc(BUFFSIZE); - jack_set_process_callback(jack.client, outputaudio, 0); + priv->buffer = cb_fifo_alloc(BUFFSIZE); + jack_set_process_callback(priv->client, outputaudio, ao); - // list matching jack.ports + // list matching priv->ports if (!port_name) port_flags |= JackPortIsPhysical; - matching_ports = jack_get_ports(jack.client, ao_subdevice, NULL, port_flags); + matching_ports = jack_get_ports(priv->client, ao_subdevice, NULL, port_flags); if (!matching_ports || !matching_ports[0]) { - MSG_FATAL("[JACK] no physical jack.ports available\n"); + MSG_FATAL("[JACK] no physical priv->ports available\n"); goto err_out; } i = 1; while (matching_ports[i]) i++; if (channels > i) channels = i; - jack.num_ports = channels; + priv->num_ports = channels; - // create out output jack.ports - for (i = 0; i < jack.num_ports; i++) { + // create out output priv->ports + for (i = 0; i < priv->num_ports; i++) { char pname[30]; snprintf(pname, 30, "out_%d", i); - jack.ports[i] = jack_port_register(jack.client, pname, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); - if (!jack.ports[i]) { - MSG_FATAL("[JACK] not enough jack.ports available\n"); + priv->ports[i] = jack_port_register(priv->client, pname, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); + if (!priv->ports[i]) { + MSG_FATAL("[JACK] not enough priv->ports available\n"); goto err_out; } } - if (jack_activate(jack.client)) { + if (jack_activate(priv->client)) { MSG_FATAL("[JACK] activate failed\n"); goto err_out; } - for (i = 0; i < jack.num_ports; i++) { - if (jack_connect(jack.client, jack_port_name(jack.ports[i]), matching_ports[i])) { + for (i = 0; i < priv->num_ports; i++) { + if (jack_connect(priv->client, jack_port_name(priv->ports[i]), matching_ports[i])) { MSG_FATAL( "[JACK] connecting failed\n"); goto err_out; } } - rate = jack_get_sample_rate(jack.client); - jack.latency = (float)(jack_port_get_total_latency(jack.client, jack.ports[0]) + - jack_get_buffer_size(jack.client)) / (float)rate; - callback_interval = 0; + rate = jack_get_sample_rate(priv->client); + priv->latency = (float)(jack_port_get_total_latency(priv->client, priv->ports[0]) + + jack_get_buffer_size(priv->client)) / (float)rate; + priv->callback_interval = 0; - ao_data.channels = channels; - ao_data.samplerate = rate; - ao_data.format = AFMT_FLOAT32; - ao_data.bps = channels * rate * sizeof(float); - ao_data.buffersize = CHUNK_SIZE * NUM_CHUNKS; - ao_data.outburst = CHUNK_SIZE; + ao->channels = channels; + ao->samplerate = rate; + ao->format = AFMT_FLOAT32; + 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); @@ -308,67 +316,75 @@ free(matching_ports); free(port_name); free(client_name); - if (jack.client) - jack_client_close(jack.client); - cb_fifo_free(buffer); - buffer = NULL; + if (priv->client) + jack_client_close(priv->client); + cb_fifo_free(priv->buffer); + priv->buffer = NULL; return 0; } // close audio device -static void uninit(void) { - // HACK, make sure jack doesn't loop-output dirty buffers - reset(); +static void uninit(ao_data_t* ao) { + priv_t*priv=ao->priv; + // HACK, make sure jack doesn't loop-output dirty priv->buffers + reset(ao); usec_sleep(100 * 1000); - jack_client_close(jack.client); - cb_fifo_free(buffer); - buffer = NULL; + jack_client_close(priv->client); + cb_fifo_free(priv->buffer); + priv->buffer = NULL; + free(priv); } /** - * \brief stop playing and empty buffers (for seeking/pause) + * \brief stop playing and empty priv->buffers (for seeking/pause) */ -static void reset(void) { - paused = 1; - cb_fifo_reset(buffer); - paused = 0; +static void reset(ao_data_t* ao) { + priv_t*priv=ao->priv; + priv->paused = 1; + cb_fifo_reset(priv->buffer); + priv->paused = 0; } /** - * \brief stop playing, keep buffers (for pause) + * \brief stop playing, keep priv->buffers (for pause) */ -static void audio_pause(void) { - paused = 1; +static void audio_pause(ao_data_t* ao) { ... [truncated message content] |
From: <nic...@us...> - 2012-10-22 09:38:15
|
Revision: 190 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=190&view=rev Author: nickols_k Date: 2012-10-22 09:38:04 +0000 (Mon, 22 Oct 2012) Log Message: ----------- improve libao2 re-enterability Modified Paths: -------------- mplayerxp/libao2/ao_alsa9.c mplayerxp/libao2/ao_esd.c mplayerxp/libao2/ao_jack.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/mplayer.c Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/libao2/ao_alsa9.c 2012-10-22 09:38:04 UTC (rev 190) @@ -329,11 +329,11 @@ MSG_V("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); - if (ao_subdevice) { + if (ao->subdevice) { const char *param; char *p; // example: -ao alsa:hw:0#mmap=1 - param=mrl_parse_line(ao_subdevice,NULL,NULL,&alsa_dev,&alsa_port); + param=mrl_parse_line(ao->subdevice,NULL,NULL,&alsa_dev,&alsa_port); mrl_parse_params(param,alsaconf); if(alsa_port) { p=strchr(alsa_port,','); @@ -347,7 +347,7 @@ if(alsa_port) snprintf(alsa_device,sizeof(alsa_device),"%s:%s",alsa_dev,alsa_port); else strncpy(alsa_device,alsa_dev,sizeof(alsa_device)); MSG_V("alsa-init: soundcard set to %s\n", alsa_device); - } //end parsing ao_subdevice + } //end parsing ao->subdevice } if ((err = snd_card_next(&cards)) < 0 || cards < 0) { Modified: mplayerxp/libao2/ao_esd.c =================================================================== --- mplayerxp/libao2/ao_esd.c 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/libao2/ao_esd.c 2012-10-22 09:38:04 UTC (rev 190) @@ -166,7 +166,7 @@ priv_t*priv=ao->priv; memset(priv,0,sizeof(priv_t)); priv->fd=priv->play_fd=-1; - char *server = ao_subdevice; /* NULL for localhost */ + char *server = ao->subdevice; /* NULL for localhost */ UNUSED(flags); if (priv->fd < 0) { priv->fd = esd_open_sound(server); @@ -181,7 +181,7 @@ static int configure(ao_data_t* ao,unsigned rate_hz,unsigned channels,unsigned format) { priv_t*priv=ao->priv; - char *server = ao_subdevice; /* NULL for localhost */ + char *server = ao->subdevice; /* NULL for localhost */ esd_format_t esd_fmt; int bytes_per_sample; int fl; Modified: mplayerxp/libao2/ao_jack.c =================================================================== --- mplayerxp/libao2/ao_jack.c 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/libao2/ao_jack.c 2012-10-22 09:38:04 UTC (rev 190) @@ -240,7 +240,7 @@ priv->estimate = 1; UNUSED(format); /* - if (subopt_parse(ao_subdevice, subopts) != 0) { + if (subopt_parse(ao->subdevice, subopts) != 0) { print_help(); return 0; } @@ -266,7 +266,7 @@ // list matching priv->ports if (!port_name) port_flags |= JackPortIsPhysical; - matching_ports = jack_get_ports(priv->client, ao_subdevice, NULL, port_flags); + matching_ports = jack_get_ports(priv->client, ao->subdevice, NULL, port_flags); if (!matching_ports || !matching_ports[0]) { MSG_FATAL("[JACK] no physical priv->ports available\n"); goto err_out; Modified: mplayerxp/libao2/ao_null.c =================================================================== --- mplayerxp/libao2/ao_null.c 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/libao2/ao_null.c 2012-10-22 09:38:04 UTC (rev 190) @@ -111,13 +111,13 @@ memset(priv,0,sizeof(priv_t)); char *null_dev=NULL,*mode=NULL; UNUSED(flags); - if (ao_subdevice) { - mrl_parse_line(ao_subdevice,NULL,NULL,&null_dev,&mode); + if (ao->subdevice) { + mrl_parse_line(ao->subdevice,NULL,NULL,&null_dev,&mode); priv->fd=NULL; if(null_dev) priv->fd = fopen(null_dev, "wb"); //if(priv->fd) priv->fast_mode=1; if(strcmp(mode,"wav")==0) priv->wav_mode=1; - } //end parsing ao_subdevice + } //end parsing ao->subdevice return 1; } Modified: mplayerxp/libao2/ao_openal.c =================================================================== --- mplayerxp/libao2/ao_openal.c 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/libao2/ao_openal.c 2012-10-22 09:38:04 UTC (rev 190) @@ -124,7 +124,7 @@ const opt_t subopts[] = { {NULL} }; - if (subopt_parse(ao_subdevice, subopts) != 0) { + if (subopt_parse(ao->subdevice, subopts) != 0) { print_help(); return 0; } Modified: mplayerxp/libao2/ao_oss.c =================================================================== --- mplayerxp/libao2/ao_oss.c 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/libao2/ao_oss.c 2012-10-22 09:38:04 UTC (rev 190) @@ -35,6 +35,7 @@ int mixer_channel; int fd; audio_buf_info zz; + int delay_method; }priv_t; const char *oss_mixer_device = PATH_DEV_MIXER; @@ -97,7 +98,7 @@ if(ao->format == AFMT_AC3) return CONTROL_TRUE; - + if ((fd = open(oss_mixer_device, O_RDONLY)) > 0) { ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs); @@ -188,7 +189,7 @@ if(rval & DSP_CAP_MMAP) MSG_INFO("mmap "); if(rval & DSP_CAP_MULTI) MSG_INFO("multiopen "); if(rval & DSP_CAP_BIND) MSG_INFO("bind "); - MSG_INFO("\n"); + MSG_INFO("\n"); } close(priv->fd); } @@ -203,11 +204,12 @@ priv->dsp=PATH_DEV_DSP; priv->mixer_channel=SOUND_MIXER_PCM; priv->fd=-1; - if (ao_subdevice) + priv->delay_method=2; + if (ao->subdevice) { char *p; - p=strrchr(ao_subdevice,':'); - priv->dsp = ao_subdevice; + p=strrchr(ao->subdevice,':'); + priv->dsp = ao->subdevice; if(p) { *p=0; p++; if(strcmp(p,"-1")==0) { show_caps(ao); return 0; } } } @@ -439,14 +441,12 @@ return len; } -static int audio_delay_method=2; - // return: delay in seconds between first and last sample in buffer static float get_delay(ao_data_t* ao){ priv_t*priv=ao->priv; int ierr; /* Calculate how many bytes/second is sent out */ - if(audio_delay_method==2){ + if(priv->delay_method==2){ #ifdef SNDCTL_DSP_GETODELAY int r=0; ierr=ioctl(priv->fd, SNDCTL_DSP_GETODELAY, &r); @@ -455,16 +455,16 @@ return ((float)r)/(float)ao->bps; } #endif - audio_delay_method=1; // fallback if not supported + priv->delay_method=1; // fallback if not supported } - if(audio_delay_method==1){ + if(priv->delay_method==1){ // SNDCTL_DSP_GETOSPACE ierr=ioctl(priv->fd, SNDCTL_DSP_GETOSPACE, &priv->zz); if(ierr!=-1) { return ((float)(ao->buffersize-priv->zz.bytes))/(float)ao->bps; } - audio_delay_method=0; // fallback if not supported + priv->delay_method=0; // fallback if not supported } return ((float)ao->buffersize)/(float)ao->bps; } Modified: mplayerxp/libao2/ao_sdl.c =================================================================== --- mplayerxp/libao2/ao_sdl.c 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/libao2/ao_sdl.c 2012-10-22 09:38:04 UTC (rev 190) @@ -152,8 +152,8 @@ /* Allocate ring-priv->buffer memory */ for(i=0;i<NUM_BUFS;i++) priv->buffer[i]=(unsigned char *) malloc(BUFFSIZE); - if(ao_subdevice) { - setenv("SDL_AUDIODRIVER", ao_subdevice, 1); + if(ao->subdevice) { + setenv("SDL_AUDIODRIVER", ao->subdevice, 1); } ao->priv=malloc(sizeof(priv_t)); memset(ao->priv,0,sizeof(priv_t)); Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/libao2/ao_wav.c 2012-10-22 09:38:04 UTC (rev 190) @@ -109,7 +109,7 @@ unsigned bits; char str[256]; - if(ao_subdevice) priv->out_filename = ao_subdevice; + if(ao->subdevice) priv->out_filename = ao->subdevice; else priv->out_filename = strdup("mpxp_adump.wav"); bits=8; Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/libao2/audio_out.c 2012-10-22 09:38:04 UTC (rev 190) @@ -7,9 +7,6 @@ #include "afmt.h" #include "ao_msg.h" -// there are some globals: -char *ao_subdevice = NULL; - extern const ao_functions_t audio_out_wav; extern const ao_functions_t audio_out_null; #ifdef USE_OSS_AUDIO Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/libao2/audio_out.h 2012-10-22 09:38:04 UTC (rev 190) @@ -13,6 +13,7 @@ /** 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 */ @@ -77,8 +78,6 @@ void (*resume)(ao_data_t*); } ao_functions_t; - -extern char *ao_subdevice; extern const ao_functions_t* audio_out_drivers[]; /**< NULL terminated array of all drivers */ #define CONTROL_OK 1 Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-21 10:26:52 UTC (rev 189) +++ mplayerxp/mplayer.c 2012-10-22 09:38:04 UTC (rev 190) @@ -1711,9 +1711,9 @@ if (audio_driver[i] == ':') { - ao_subdevice = malloc(i2-i); - if (ao_subdevice != NULL) - strncpy(ao_subdevice, (char *)(audio_driver+i+1), i2-i); + ao_data->subdevice = malloc(i2-i); + if (ao_data->subdevice != NULL) + strncpy(ao_data->subdevice, (char *)(audio_driver+i+1), i2-i); audio_driver[i] = '\0'; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-24 13:00:50
|
Revision: 192 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=192&view=rev Author: nickols_k Date: 2012-10-24 13:00:34 +0000 (Wed, 24 Oct 2012) Log Message: ----------- make libvo re-enterable Modified Paths: -------------- mplayerxp/cfg-mplayer.h mplayerxp/dec_ahead.c mplayerxp/find_sub.c mplayerxp/libao2/ao_alsa9.c mplayerxp/libao2/ao_nas.c mplayerxp/libao2/ao_wav.c mplayerxp/libmpcodecs/ad_vorbis.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/sub_cc.c mplayerxp/libmpdemux/sub_ty.c mplayerxp/libvo/sub.c mplayerxp/libvo/sub.h 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/libvo/vosub_vidix.h mplayerxp/libvo/x11_common.c mplayerxp/libvo/x11_common.h mplayerxp/mplayer.c mplayerxp/postproc/af.h mplayerxp/postproc/libmenu/menu.c mplayerxp/postproc/libmenu/menu_list.c mplayerxp/postproc/libmenu/menu_txt.c mplayerxp/postproc/vf.c mplayerxp/postproc/vf_expand.c mplayerxp/postproc/vf_scale.c mplayerxp/postproc/vf_vo.c mplayerxp/spudec.c mplayerxp/spudec.h mplayerxp/subreader.h Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/cfg-mplayer.h 2012-10-24 13:00:34 UTC (rev 192) @@ -110,7 +110,7 @@ {"dump", &stream_dump, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies dump type and name for the dump of stream"}, {"gomp", &enable_gomp, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables usage of OpenMP extensions"}, {"nogomp", &enable_gomp, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables usage of OpenMP extensions"}, - {"da_buffs", &vo.da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, NULL, "specifies number of buffers for decoding-ahead in XP mode"}, + {"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", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, NULL,"specifies amount of memory for precaching a file/URL"}, {"nocache", &stream_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL,"disables precaching a file/URL"}, {"autoq", &auto_quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL, "dynamically changes the level of postprocessing depending on spare CPU time available"}, @@ -184,13 +184,13 @@ }; static const config_t veq_config[]={ - {"brightness",&vo.gamma.brightness, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies brightness-level for output image"}, - {"saturation",&vo.gamma.saturation, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies saturation-level for output image"}, - {"contrast",&vo.gamma.contrast, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies contrast-level for output image"}, - {"hue",&vo.gamma.hue, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies hue of gamma-correction for output image"}, - {"red",&vo.gamma.red_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of red component for output image"}, - {"green",&vo.gamma.green_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of green component for output image"}, - {"blue",&vo.gamma.blue_intensity, CONF_TYPE_INT, CONF_RANGE, -1000, 1000, NULL, "specifies intensity of blue component for output image"}, + {"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}, }; @@ -216,8 +216,8 @@ #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)"}, - {"vsync", &vo.vsync, CONF_TYPE_FLAG, 0, 0, 1, NULL, "forces video hardware to wait VSYNC signal before frame switching"}, - {"novsync", &vo.vsync, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video hardware to wait VSYNC signal before frame switching"}, + {"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}, }; @@ -250,9 +250,9 @@ #ifdef HAVE_X11 static const config_t x11_config[]={ - {"display", &vo.mDisplayName, CONF_TYPE_STRING, 0, 0, 0, NULL, "specifies the hostname and display number of the X server"}, - {"wid", &vo.WinID, CONF_TYPE_INT, 0, 0, 0, NULL, "tells MPlayerXP to use existing X11 window (for using MPlayerXP as plugin)"}, - {"rootwin", &vo.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, 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)"}, #ifdef HAVE_XINERAMA {"xinerama", &xinerama_screen, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL, "tells MPlayerXP the display for movie playback"}, #endif @@ -277,28 +277,28 @@ static const config_t video_config[]={ {"on", &has_video, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-steam playback"}, {"off", &has_video, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video-stream playback"}, - {"width", &vo.opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to width (if driver supports)"}, - {"height", &vo.opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "scale output image to height (if driver supports)"}, - {"zoom", &vo.screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0, 4096, NULL, "scale output image by given factor"}, - {"screenw", &vo.screenwidth, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the horizontal resolution of the screen (if supported)"}, - {"screenh", &vo.screenheight, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL, "specifies the vertical resolution of the screen (if supported)"}, + {"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)"}, {"speed", &playbackspeed_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL, "sets playback speed factor"}, - {"aspect", &vo.movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL, "sets aspect-ratio of movies (autodetect)"}, - {"noaspect", &vo.movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, NULL, "unsets aspect-ratio of movies"}, - {"aspect-ratio", &vo.softzoom, CONF_TYPE_FLAG, 0, 0, 1, NULL, "keeps aspect-ratio of the movie during window resize"}, - {"noaspect-ratio", &vo.softzoom, CONF_TYPE_FLAG, 0, 1, 0, NULL, "render movie to the user-defined window's geometry"}, + {"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.vidmode, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables video-mode changing during playback"}, - {"novm", &vo.vidmode, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables video-mode changing during playback"}, - {"fs", &vo.fullscreen, CONF_TYPE_FLAG, 0, 0, 1, NULL, "fullscreen playback"}, - {"nofs", &vo.fullscreen, CONF_TYPE_FLAG, 0, 1, 0, NULL, "windowed playback"}, - {"fsmode", &vo.fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 15, NULL, "enables workaround for some fullscreen related problems"}, - {"flip", &vo.flip, CONF_TYPE_FLAG, 0, -1, 1, NULL, "flip output image upside-down"}, - {"noflip", &vo.flip, CONF_TYPE_FLAG, 0, -1, 0, NULL, "render output image as is"}, - {"bpp", &vo.dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL, "use different color depth than autodetect"}, - {"bm", &vo.use_bm, CONF_TYPE_FLAG, 0, 0, 1, NULL, "enables using of bus-mastering (if it available for given OS/videocard)"}, - {"bm2", &vo.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.use_bm, CONF_TYPE_FLAG, 0, 1, 0, NULL, "disables using of bus-mastering"}, + {"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", &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"}, Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/dec_ahead.c 2012-10-24 13:00:34 UTC (rev 192) @@ -170,6 +170,8 @@ static volatile int pthread_audio_end_of_work=0; int xp_is_bad_pts=0; + +extern vo_data_t* vo_data; /* this routine decodes video+audio but intends to be video only */ static void show_warn_cant_sync(float max_frame_delay) { @@ -182,7 +184,7 @@ "*********************************************\n" "Try increase number of buffer for decoding ahead\n" "Exist: %u, need: %u\n" - ,xp_num_frames,(unsigned)(max_frame_delay*3*vo.fps)+3); + ,xp_num_frames,(unsigned)(max_frame_delay*3*vo_data->fps)+3); prev_warn_delay=max_frame_delay; } } @@ -210,7 +212,7 @@ */ delta=v_pts-xp_screen_pts; if(max_frame_delay*3 > drop_barrier) { - if(drop_barrier < (float)(xp_num_frames-2)/vo.fps) drop_barrier += 1/vo.fps; + if(drop_barrier < (float)(xp_num_frames-2)/vo_data->fps) drop_barrier += 1/vo_data->fps; else if(verbose) show_warn_cant_sync(max_frame_delay); } @@ -287,7 +289,7 @@ dec_ahead_pth_id = pinfo[_xp_id].pth_id = pthread_self(); pinfo[_xp_id].thread_name = (xp_core.has_audio && enable_xp < XP_VAFull) ? "video+audio decoding+filtering ahead" : "video decoding+vf ahead"; - drop_barrier=(float)(xp_num_frames/2)*(1/vo.fps); + drop_barrier=(float)(xp_num_frames/2)*(1/vo_data->fps); if(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 || @@ -322,11 +324,9 @@ } #endif /*-------------------- Decode a frame: -----------------------*/ - in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,vo.fps); + in_size=video_read_frame_r(sh_video,&duration,&v_pts,&start,vo_data->fps); if(xp_core.in_lseek==Seek) { pinfo[_xp_id].current_module = "Post seek"; - /* reset counters */ - dae_reset(xp_core.video); if(xp_is_bad_pts) mpeg_timer=HUGE; xp_core.in_lseek=NoSeek; MSG_T("\nDEC_AHEAD: reset counters to (%u %u) due lseek\n",dec_ahead_locked_frame,abs_dec_ahead_locked_frame); @@ -361,7 +361,7 @@ int cur_time; cur_time = GetTimerMS(); /* Ugly solution: disable frame dropping right after seeking! */ - if(cur_time - mpxp_seek_time > (xp_num_frames/vo.fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); + if(cur_time - mpxp_seek_time > (xp_num_frames/vo_data->fps)*100) xp_n_frame_to_drop=compute_frame_dropping(v_pts,drop_barrier); } /* if( frame_dropping ) */ if(xp_core.in_lseek!=NoSeek) continue; #if 0 @@ -598,7 +598,7 @@ 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/vo.fps))+MIN_BUFFER_RESERV; + if(xp_core.has_video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_num_frames/vo_data->fps))+MIN_BUFFER_RESERV; else asize = o_bps*ao_da_buffs; /* FIXME: get better indices from asize/real_audio_packet_size */ min_reserv = sha->audio_out_minsize; @@ -693,6 +693,10 @@ /* Restart threads after seek */ void dec_ahead_restart_threads(int xp_id) { + /* reset counters */ + dae_reset(xp_core.video); + /* tempoarry 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; @@ -752,7 +756,7 @@ if(xp_core.has_video) { /* Match video buffer */ vbuf_size = dae_get_decoder_outrun(xp_core.video); - pref_buf = vbuf_size / vo.fps * sh_audio->af_bps; + pref_buf = vbuf_size / vo_data->fps * sh_audio->af_bps; pref_buf -= len; if( pref_buf > 0 ) { len = min( pref_buf, free_buf ); Modified: mplayerxp/find_sub.c =================================================================== --- mplayerxp/find_sub.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/find_sub.c 2012-10-24 13:00:34 UTC (rev 192) @@ -20,13 +20,14 @@ static unsigned long nosub_range_start=ULONG_MAX; static unsigned long nosub_range_end=ULONG_MAX; -void find_sub(subtitle* subtitles,unsigned long key){ +void find_sub(subtitle* subtitles,unsigned long key,any_t*vo_data){ int i,j; - + vo_data_t*vo=vo_data; + if ( !subtitles ) return; - - if(vo.sub){ - if(key>=vo.sub->start && key<=vo.sub->end) return; // OK! + + if(vo->sub){ + if(key>=vo->sub->start && key<=vo->sub->end) return; // OK! } else { if(key>nosub_range_start && key<nosub_range_end) return; // OK! } @@ -36,45 +37,43 @@ vo_osd_changed(OSDTYPE_SUBTITLE); if(key<=0){ - vo.sub=NULL; // no sub here + vo->sub=NULL; // no sub here return; } - - + // check next sub. if(current_sub>=0 && current_sub+1<sub_num){ if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ // no sub nosub_range_start=subtitles[current_sub].end; nosub_range_end=subtitles[current_sub+1].start; - vo.sub=NULL; + vo->sub=NULL; return; } // next sub? ++current_sub; - vo.sub=&subtitles[current_sub]; - if(key>=vo.sub->start && key<=vo.sub->end) return; // OK! + vo->sub=&subtitles[current_sub]; + if(key>=vo->sub->start && key<=vo->sub->end) return; // OK! } - // use logarithmic search: i=0;j=sub_num-1; while(j>=i){ current_sub=(i+j+1)/2; - vo.sub=&subtitles[current_sub]; - if(key<vo.sub->start) j=current_sub-1; - else if(key>vo.sub->end) i=current_sub+1; + vo->sub=&subtitles[current_sub]; + if(key<vo->sub->start) j=current_sub-1; + else if(key>vo->sub->end) i=current_sub+1; else return; // found! } -// if(key>=vo.sub->start && key<=vo.sub->end) return; // OK! - +// if(key>=vo->sub->start && key<=vo->sub->end) return; // OK! + // check where are we... - if(key<vo.sub->start){ + if(key<vo->sub->start){ if(current_sub<=0){ // before the first sub nosub_range_start=key-1; // tricky - nosub_range_end=vo.sub->start; - vo.sub=NULL; + nosub_range_end=vo->sub->start; + vo->sub=NULL; return; } --current_sub; @@ -82,31 +81,31 @@ // no sub nosub_range_start=subtitles[current_sub].end; nosub_range_end=subtitles[current_sub+1].start; - vo.sub=NULL; + vo->sub=NULL; return; } MSG_V("HEH???? "); } else { - if(key<=vo.sub->end) MSG_V("JAJJ! "); else + if(key<=vo->sub->end) MSG_V("JAJJ! "); else if(current_sub+1>=sub_num){ // at the end? - nosub_range_start=vo.sub->end; + nosub_range_start=vo->sub->end; nosub_range_end=0x7FFFFFFF; // MAXINT - vo.sub=NULL; + vo->sub=NULL; return; } else if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ // no sub nosub_range_start=subtitles[current_sub].end; nosub_range_end=subtitles[current_sub+1].start; - vo.sub=NULL; + vo->sub=NULL; return; } } - MSG_ERR("SUB ERROR: %d ? %d --- %d [%d] \n",key,(int)vo.sub->start,(int)vo.sub->end,current_sub); + MSG_ERR("SUB ERROR: %d ? %d --- %d [%d] \n",key,(int)vo->sub->start,(int)vo->sub->end,current_sub); - vo.sub=NULL; // no sub here + vo->sub=NULL; // no sub here } #endif Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libao2/ao_alsa9.c 2012-10-24 13:00:34 UTC (rev 192) @@ -767,7 +767,7 @@ { unsigned result; UNUSED(flags); - MSG_DBG2("[ao_alsa] %s playing %i bytes\n",priv->ao_mmap?"mmap":"normal",len); + MSG_DBG2("[ao_alsa] %s playing %i bytes\n",priv_conf.mmap?"mmap":"normal",len); if (priv_conf.mmap) result = play_mmap(ao,data, len); else result = play_normal(ao,data, len); return result; Modified: mplayerxp/libao2/ao_nas.c =================================================================== --- mplayerxp/libao2/ao_nas.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libao2/ao_nas.c 2012-10-24 13:00:34 UTC (rev 192) @@ -97,7 +97,7 @@ "Hardware", "Any" }; -#if 0 +#ifdef MP_DEBUG static const char* nas_reason(unsigned int reason) { if (reason > 6) reason = 6; @@ -120,6 +120,7 @@ return nas_states[state]; } #endif + static const ao_info_t info = { "NAS audio output", Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libao2/ao_wav.c 2012-10-24 13:00:34 UTC (rev 192) @@ -218,10 +218,11 @@ } // return: how many bytes can be played without blocking +extern vo_data_t* vo_data; static unsigned get_space(ao_data_t* ao){ priv_t* priv=ao->priv; - if(vo.pts) - return ao->pts < vo.pts + priv->fast * 30000 ? ao->outburst : 0; + if(vo_data->pts) + return ao->pts < vo_data->pts + priv->fast * 30000 ? ao->outburst : 0; return ao->outburst; } Modified: mplayerxp/libmpcodecs/ad_vorbis.c =================================================================== --- mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libmpcodecs/ad_vorbis.c 2012-10-24 13:00:34 UTC (rev 192) @@ -8,7 +8,9 @@ #include "libao2/afmt.h" #include "libao2/audio_out.h" -static const ad_info_t info = +extern ao_data_t* ao_data; + +static const ad_info_t info = { "Ogg/Vorbis audio decoder", "libvorbis", @@ -86,7 +88,7 @@ } // Setup the decoder - sh->channels=ov->vi.channels; + sh->channels=ov->vi.channels; sh->samplerate=ov->vi.rate; #ifdef WORDS_BIGENDIAN #define OGG_FMT32 AFMT_S32_BE @@ -99,7 +101,7 @@ #endif sh->samplesize=2; sh->sample_format=OGG_FMT16; - if(ao_control(AOCONTROL_QUERY_FORMAT,OGG_FMT32) == CONTROL_OK) + if(ao_control(ao_data,AOCONTROL_QUERY_FORMAT,OGG_FMT32) == CONTROL_OK) { sh->samplesize=4; sh->sample_format=OGG_FMT32; Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-24 13:00:34 UTC (rev 192) @@ -84,6 +84,8 @@ sh_video->inited=0; } +#include "libvo/video_out.h" +extern vo_data_t*vo_data; #define MPDEC_THREAD_COND (VF_FLAGS_THREADS|VF_FLAGS_SLICES) static unsigned smp_num_cpus=1; static unsigned use_vf_threads=0; @@ -234,6 +236,7 @@ } } +extern vo_data_t* vo_data; static void update_subtitle(sh_video_t *sh_video,float v_pts,unsigned idx); int mpcv_decode(sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame, float pts){ vf_instance_t* vf; @@ -267,7 +270,7 @@ if(drop_frame) return 0; update_subtitle(sh_video,pts,mpi->xp_idx); - vo_flush_page(dae_curr_vdecoded()); + vo_flush_page(vo_data,dae_curr_vdecoded()); t2=GetTimer()-t2; tt=t2*0.000001f; @@ -302,7 +305,7 @@ if(sub_fps==0) sub_fps=sh_video->fps; pinfo[xp_id].current_module="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)); // FIXME! frame counter... + 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; @@ -322,31 +325,31 @@ } }else #endif - if(vo.spudec){ + if(vo_data->spudec){ unsigned char* packet=NULL; int len,timestamp; pinfo[xp_id].current_module="spudec"; - spudec_now_pts(vo.spudec,90000*v_pts); - if(spudec_visible(vo.spudec)) { - vo_draw_spudec_direct(xp_idx); + spudec_now_pts(vo_data->spudec,90000*v_pts); + if(spudec_visible(vo_data->spudec)) { + vo_draw_spudec_direct(vo_data,xp_idx); } else { - spudec_heartbeat(vo.spudec,90000*v_pts); - if (vo.vobsub) { + spudec_heartbeat(vo_data->spudec,90000*v_pts); + if (vo_data->vobsub) { if (v_pts >= 0) { - while((len=vobsub_get_packet(vo.vobsub, v_pts,(any_t**)&packet, ×tamp))>0){ + while((len=vobsub_get_packet(vo_data->vobsub, v_pts,(any_t**)&packet, ×tamp))>0){ timestamp -= (v_pts - sh_video->timer)*90000; MSG_V("\rVOB sub: len=%d v_pts=%5.3f v_timer=%5.3f sub=%5.3f ts=%d \n",len,v_pts,sh_video->timer,timestamp / 90000.0,timestamp); - spudec_assemble(vo.spudec,packet,len,90000*d_dvdsub->pts); + spudec_assemble(vo_data->spudec,packet,len,90000*d_dvdsub->pts); } } } else { while((len=ds_get_packet_sub_r(d_dvdsub,&packet))>0){ MSG_V("\rDVD sub: len=%d v_pts=%5.3f s_pts=%5.3f \n",len,v_pts,d_dvdsub->pts); - spudec_assemble(vo.spudec,packet,len,90000*d_dvdsub->pts); + spudec_assemble(vo_data->spudec,packet,len,90000*d_dvdsub->pts); } } /* detect wether the sub has changed or not */ - if(spudec_changed(vo.spudec)) vo_draw_spudec_direct(xp_idx); + if(spudec_changed(vo_data->spudec)) vo_draw_spudec_direct(vo_data,xp_idx); pinfo[xp_id].current_module=NULL; } } Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libmpcodecs/vd.c 2012-10-24 13:00:34 UTC (rev 192) @@ -97,6 +97,7 @@ #include "libvo/video_out.h" +extern vo_data_t* vo_data; extern const vd_functions_t* mpvdec; // FIXME! int mpcodecs_config_vo(sh_video_t *sh, int w, int h, any_t*tune){ @@ -138,10 +139,11 @@ MSG_DBG2("vo_debug: codec[%s] query_format(%s) returned FALSE\n",mpvdec->info->driver_name,vo_format_name(out_fmt)); continue; } - j=i; vo.flags=flags; + j=i; + /*vo_data->flags=flags;*/ if(flags&VFCAP_CSP_SUPPORTED_BY_HW) break; } else - if(!palette && !(vo.flags&3) && (out_fmt==IMGFMT_RGB8||out_fmt==IMGFMT_BGR8)){ + if(!palette && !(vo_data->flags&3) && (out_fmt==IMGFMT_RGB8||out_fmt==IMGFMT_BGR8)){ sh->outfmtidx=j; // pass index to the control() function this way if(mpvdec->control(sh,VDCTRL_QUERY_FORMAT,&out_fmt)!=CONTROL_FALSE) palette=1; @@ -165,8 +167,8 @@ palette=-1; vf=vf_open_filter(vf,sh,"palette",NULL); goto csp_again; - } else - { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc + } else { + // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc vf_instance_t* voi, *vp = NULL, *ve; // Remove the scale filter if we added it ourself if(vf == sc) { @@ -182,30 +184,31 @@ sh->vfilter_inited=-1; return 0; // failed } + out_fmt=sh->codec->outfmt[j]; sh->outfmtidx=j; sh->vfilter=vf; // autodetect flipping - if(vo.flip==-1){ - vo.flip=0; + if(vo_conf.flip==0){ + VO_FLIP_UNSET(vo_data); if(sh->codec->outflags[j]&CODECS_FLAG_FLIP) if(!(sh->codec->outflags[j]&CODECS_FLAG_NOFLIP)) - vo.flip=1; + VO_FLIP_SET(vo_data); } - if(vo.flags&VFCAP_FLIPPED) vo.flip^=1; - if(vo.flip && !(vo.flags&VFCAP_FLIP)){ + if(vo_data->flags&VFCAP_FLIPPED) VO_FLIP_REVERT(vo_data); + if(VO_FLIP(vo_data) && !(vo_data->flags&VFCAP_FLIP)){ // we need to flip, but no flipping filter avail. sh->vfilter=vf=vf_open_filter(vf,sh,"mirror","x"); } // time to do aspect ratio corrections... - if(vo.movie_aspect>-1.0) sh->aspect = vo.movie_aspect; // cmdline overrides autodetect - if(vo.opt_screen_size_x||vo.opt_screen_size_y){ - screen_size_x = vo.opt_screen_size_x; - screen_size_y = vo.opt_screen_size_y; - if(!vo.vidmode){ + if(vo_conf.movie_aspect>-1.0) sh->aspect = vo_conf.movie_aspect; // cmdline overrides autodetect + if(vo_conf.opt_screen_size_x||vo_conf.opt_screen_size_y){ + screen_size_x = vo_conf.opt_screen_size_x; + screen_size_y = vo_conf.opt_screen_size_y; + if(!vo_conf.vidmode){ if(!screen_size_x) screen_size_x=1; if(!screen_size_y) screen_size_y=1; if(screen_size_x<=8) screen_size_x*=sh->disp_w; @@ -215,15 +218,15 @@ // check source format aspect, calculate prescale ::atmos screen_size_x=sh->disp_w; screen_size_y=sh->disp_h; - if(vo.screen_size_xy>=0.001){ - if(vo.screen_size_xy<=8){ + if(vo_conf.screen_size_xy>=0.001){ + if(vo_conf.screen_size_xy<=8){ // -xy means x+y scale - screen_size_x*=vo.screen_size_xy; - screen_size_y*=vo.screen_size_xy; + screen_size_x*=vo_conf.screen_size_xy; + screen_size_y*=vo_conf.screen_size_xy; } else { // -xy means forced width while keeping correct aspect - screen_size_x=vo.screen_size_xy; - screen_size_y=vo.screen_size_xy*sh->disp_h/sh->disp_w; + screen_size_x=vo_conf.screen_size_xy; + screen_size_y=vo_conf.screen_size_xy*sh->disp_h/sh->disp_w; } } if(sh->aspect>0.01){ @@ -232,7 +235,7 @@ sh->aspect); _w=(int)((float)screen_size_y*sh->aspect); _w+=_w%2; // round // we don't like horizontal downscale || user forced width: - if(_w<screen_size_x || vo.screen_size_xy>8){ + if(_w<screen_size_x || vo_conf.screen_size_xy>8){ screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect)); screen_size_y+=screen_size_y%2; // round if(screen_size_y<sh->disp_h) // Do not downscale verticaly @@ -243,16 +246,16 @@ } } - MSG_V("video_out->init(%dx%d->%dx%d,flags=%d,'%s',%s)\n", + MSG_V("vf->config(%dx%d->%dx%d,flags=0x%x,'%s',%s)\n", sh->disp_w,sh->disp_h, screen_size_x,screen_size_y, - vo.fullscreen|(vo.vidmode<<1)|(vo.softzoom<<2)|(vo.flip<<3), + vo_data->flags, "MPlayerXP",vo_format_name(out_fmt)); MSG_DBG2("vf configuring: %s\n",vf->info->name); if(vf->config(vf,sh->disp_w,sh->disp_h, screen_size_x,screen_size_y, - vo.fullscreen|(vo.vidmode<<1)|(vo.softzoom<<2)|(vo.flip<<3), + vo_data->flags, out_fmt,tune)==0){ MSG_WARN(MSGTR_CannotInitVO); sh->vfilter_inited=-1; @@ -261,7 +264,7 @@ MSG_DBG2("vf->config(%dx%d->%dx%d,flags=%d,'%s',%p)\n", sh->disp_w,sh->disp_h, screen_size_x,screen_size_y, - vo.fullscreen|(vo.vidmode<<1)|(vo.softzoom<<2)|(vo.flip<<3), + vo_data->flags, vo_format_name(out_fmt),tune); return 1; } Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-24 13:00:34 UTC (rev 192) @@ -28,6 +28,8 @@ #define FOURCC_VORBIS mmioFOURCC('v', 'r', 'b', 's') #define FOURCC_THEORA mmioFOURCC('t', 'h', 'e', 'o') +extern vo_data_t* vo_data; + /// Vorbis decoder context : we need the vorbis_info for vorbis timestamping /// Shall we put this struct def in a common header ? typedef struct ov_struct_st { @@ -291,7 +293,7 @@ #ifdef USE_ICONV subcp_recode1(&ogg_sub); #endif - vo.sub = &ogg_sub; + vo_data->sub = &ogg_sub; vo_osd_changed(OSDTYPE_SUBTITLE); } @@ -554,7 +556,7 @@ /// Clear subtitles if necessary (for broken files) if ((clear_sub > 0) && (pts >= clear_sub)) { ogg_sub.lines = 0; - vo.sub = &ogg_sub; + vo_data->sub = &ogg_sub; vo_osd_changed(OSDTYPE_SUBTITLE); clear_sub = -1; } @@ -1412,7 +1414,7 @@ } if(!precision && (is_keyframe || os->vorbis) ) { ogg_sub.lines = 0; - vo.sub = &ogg_sub; + vo_data->sub = &ogg_sub; vo_osd_changed(OSDTYPE_SUBTITLE); clear_sub = -1; demux_ogg_add_packet(ds,os,ds->id,&op); Modified: mplayerxp/libmpdemux/s_dvdnav.c =================================================================== --- mplayerxp/libmpdemux/s_dvdnav.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libmpdemux/s_dvdnav.c 2012-10-24 13:00:34 UTC (rev 192) @@ -29,6 +29,8 @@ #define max(a,b) ((a)>(b)?(a):(b)) #endif +extern vo_data_t* vo_data; + typedef struct { dvdnav_t * dvdnav; /* handle to libdvdnav stuff */ char * filename; /* path */ @@ -509,12 +511,12 @@ stream_change->physical_letterbox, stream_change->physical_pan_scan, stream_change->logical); - if (vo.spudec && dvdsub_id!=stream_change->physical_wide) { + if (vo_data->spudec && dvdsub_id!=stream_change->physical_wide) { MSG_DBG2("d_dvdsub->id change: was %d is now %d\n", d_dvdsub->id,stream_change->physical_wide); // FIXME: need a better way to change SPU id d_dvdsub->id=dvdsub_id=stream_change->physical_wide; - if (vo.spudec) spudec_reset(vo.spudec); + if (vo_data->spudec) spudec_reset(vo_data->spudec); } break; } @@ -560,7 +562,7 @@ MSG_DBG2("DVDNAV Event: Nav SPU CLUT Change\n"); if(sp->len!=64) MSG_WARN("DVDNAV Event: Nav SPU CLUT Change: %i bytes <> 64\n",sp->len); // send new palette to SPU decoder - if (vo.spudec) spudec_update_palette(vo.spudec,(const unsigned int *)(sp->buf)); + if (vo_data->spudec) spudec_update_palette(vo_data->spudec,(const unsigned int *)(sp->buf)); break; } } Modified: mplayerxp/libmpdemux/sub_cc.c =================================================================== --- mplayerxp/libmpdemux/sub_cc.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libmpdemux/sub_cc.c 2012-10-24 13:00:34 UTC (rev 192) @@ -149,17 +149,18 @@ bb=foo; } +extern vo_data_t* vo_data; static void display_buffer(const subtitle * buf) { - vo.sub=buf; + vo_data->sub=buf; vo_osd_changed(OSDTYPE_SUBTITLE); } static void cc_decode_EIA608(unsigned short int data) { - - static unsigned short int lastcode=0x0000; + + static unsigned short int lastcode=0x0000; unsigned char c1 = data & 0x7f; unsigned char c2 = (data >> 8) & 0x7f; Modified: mplayerxp/libmpdemux/sub_ty.c =================================================================== --- mplayerxp/libmpdemux/sub_ty.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libmpdemux/sub_ty.c 2012-10-24 13:00:34 UTC (rev 192) @@ -20,6 +20,8 @@ #include "../libvo/video_out.h" #include "demux_msg.h" +extern vo_data_t* vo_data; + extern int sub_justify; #define TY_TEXT_MODE ( 1 << 0 ) @@ -894,7 +896,7 @@ // { // printf( "OSD:%d:%s\n", index, ty_OSD1.text[ index ] ); // } - vo.sub = &ty_OSD1; + vo_data->sub = &ty_OSD1; vo_osd_changed( OSDTYPE_SUBTITLE ); tyOSDUpdate = 0; } Modified: mplayerxp/libvo/sub.c =================================================================== --- mplayerxp/libvo/sub.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libvo/sub.c 2012-10-24 13:00:34 UTC (rev 192) @@ -67,9 +67,9 @@ } // renders the buffer -inline static void vo_draw_text_from_buffer(unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ +static void vo_draw_text_from_buffer(any_t*vo,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ if (obj->allocated > 0) { - draw_alpha(idx, + draw_alpha(vo,idx, obj->bbox.x1,obj->bbox.y1, obj->bbox.x2-obj->bbox.x1, obj->bbox.y2-obj->bbox.y1, @@ -83,11 +83,13 @@ static void vo_update_nav (mp_osd_obj_t *obj, int dxs, int dys) { int len; + UNUSED(dxs); + UNUSED(dys); obj->bbox.x1 = obj->x = nav_hl.sx; obj->bbox.y1 = obj->y = nav_hl.sy; obj->bbox.x2 = nav_hl.ex; obj->bbox.y2 = nav_hl.ey; - + alloc_buf (obj); len = obj->stride * (obj->bbox.y2 - obj->bbox.y1); memset (obj->bitmap_buffer, OSD_NAV_BOX_ALPHA, len); @@ -98,55 +100,59 @@ } // return the real height of a char: -static inline int __FASTCALL__ get_height(int c,int h){ +inline static int __FASTCALL__ get_height(vo_data_t*vo,int c,int h){ int font; - if ((font=vo.font->font[c])>=0) - if(h<vo.font->pic_a[font]->h) h=vo.font->pic_a[font]->h; + if ((font=vo->font->font[c])>=0) + if(h<vo->font->pic_a[font]->h) h=vo->font->pic_a[font]->h; return h; } -int __FASTCALL__ get_osd_height(int c,int h) +int __FASTCALL__ get_osd_height(any_t*v,int c,int h) { - return vo.font?get_height(c,h):0; + vo_data_t* vo=(vo_data_t*)v; + return vo->font?get_height(vo,c,h):0; } -inline static void __FASTCALL__ vo_update_text_osd(mp_osd_obj_t* obj,int dxs,int dys){ - unsigned char *cp=(unsigned char *)vo.osd_text; - int x=20; - int h=0; - UNUSED(dxs); - UNUSED(dys); - obj->bbox.x1=obj->x=x; - obj->bbox.y1=obj->y=10; +static void __FASTCALL__ vo_update_text_osd(any_t*v,mp_osd_obj_t* obj,int dxs,int dys){ + vo_data_t* vo=(vo_data_t*)v; + unsigned char *cp=(unsigned char *)vo->osd_text; + int x=20; + int h=0; - while (*cp){ - int c=*cp++; - x+=vo.font->width[c]+vo.font->charspace; - h=get_height(c,h); - } - - obj->bbox.x2=x-vo.font->charspace; - obj->bbox.y2=obj->bbox.y1+h; - obj->flags|=OSDFLAG_BBOX; + UNUSED(dxs); + UNUSED(dys); + obj->bbox.x1=obj->x=x; + obj->bbox.y1=obj->y=10; + while (*cp){ + int c=*cp++; + x+=vo->font->width[c]+vo->font->charspace; + h=get_height(vo,c,h); + } + + obj->bbox.x2=x-vo->font->charspace; + obj->bbox.y2=obj->bbox.y1+h; + obj->flags|=OSDFLAG_BBOX; + } -inline static void __FASTCALL__ vo_draw_text_osd(unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ - unsigned char *cp=(unsigned char *)vo.osd_text; - int font; - int x=obj->x; +static void __FASTCALL__ vo_draw_text_osd(any_t*v,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ + vo_data_t* vo=(vo_data_t*)v; + unsigned char *cp=(unsigned char *)vo->osd_text; + int font; + int x=obj->x; while (*cp){ int c=*cp++; - if ((font=vo.font->font[c])>=0 && c != ' ') - draw_alpha( idx, + if ((font=vo->font->font[c])>=0 && c != ' ') + draw_alpha(vo, idx, x,obj->y, - vo.font->width[c], - vo.font->pic_a[font]->h, - vo.font->pic_b[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->w); - x+=vo.font->width[c]+vo.font->charspace; + vo->font->width[c], + vo->font->pic_a[font]->h, + vo->font->pic_b[font]->bmp+vo->font->start[c], + vo->font->pic_a[font]->bmp+vo->font->start[c], + vo->font->pic_a[font]->w); + x+=vo->font->width[c]+vo->font->charspace; } } @@ -158,113 +164,114 @@ // // the above schema is rescalled to n=elems bars -inline static void __FASTCALL__ vo_update_text_progbar(mp_osd_obj_t* obj,int dxs,int dys){ - +static void __FASTCALL__ vo_update_text_progbar(any_t*v,mp_osd_obj_t* obj,int dxs,int dys){ + vo_data_t* vo=(vo_data_t*)v; obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE; - if(vo.osd_progbar_type<0 || !vo.font){ + if(vo->osd_progbar_type<0 || !vo->font){ obj->flags&=~OSDFLAG_VISIBLE; return; } { int h=0; - int y=(dys-vo.font->height)/2; - int delimw=vo.font->width[OSD_PB_START] - +vo.font->width[OSD_PB_END] - +vo.font->charspace; + int y=(dys-vo->font->height)/2; + int delimw=vo->font->width[OSD_PB_START] + +vo->font->width[OSD_PB_END] + +vo->font->charspace; int width=(2*dxs-3*delimw)/3; - int charw=vo.font->width[OSD_PB_0]+vo.font->charspace; + int charw=vo->font->width[OSD_PB_0]+vo->font->charspace; int elems=width/charw; int x=(dxs-elems*charw-delimw)/2; - h=get_height(OSD_PB_START,h); - h=get_height(OSD_PB_END,h); - h=get_height(OSD_PB_0,h); - h=get_height(OSD_PB_1,h); + h=get_height(vo,OSD_PB_START,h); + h=get_height(vo,OSD_PB_END,h); + h=get_height(vo,OSD_PB_0,h); + h=get_height(vo,OSD_PB_1,h); obj->bbox.x1=obj->x=x; obj->bbox.y1=obj->y=y; obj->bbox.x2=x+width+delimw; - obj->bbox.y2=y+h; //vo.font->height; + obj->bbox.y2=y+h; //vo->font->height; obj->flags|=OSDFLAG_BBOX; obj->params.progbar.elems=elems; } } -inline static void __FASTCALL__ vo_draw_text_progbar(unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ - unsigned char *s; - unsigned char *sa; - int i,w,h,st,mark; - int x=obj->x; - int y=obj->y; - int c,font; - int charw=vo.font->width[OSD_PB_0]+vo.font->charspace; - int elems=obj->params.progbar.elems; +static void __FASTCALL__ vo_draw_text_progbar(any_t*v,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ + vo_data_t* vo=(vo_data_t*)v; + unsigned char *s; + unsigned char *sa; + int i,w,h,st,mark; + int x=obj->x; + int y=obj->y; + int c,font; + int charw=vo->font->width[OSD_PB_0]+vo->font->charspace; + int elems=obj->params.progbar.elems; - if (vo.osd_progbar_value<=0) + if (vo->osd_progbar_value<=0) mark=0; else { - int ev=vo.osd_progbar_value*elems; + int ev=vo->osd_progbar_value*elems; mark=ev>>8; if (ev & 0xFF) mark++; if (mark>elems) mark=elems; } - c=vo.osd_progbar_type; - if(vo.osd_progbar_type>0 && (font=vo.font->font[c])>=0) { - int xp=x-vo.font->width[c]-vo.font->spacewidth; - draw_alpha(idx,(xp<0?0:xp),y, - vo.font->width[c], - vo.font->pic_a[font]->h, - vo.font->pic_b[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->w); + c=vo->osd_progbar_type; + if(vo->osd_progbar_type>0 && (font=vo->font->font[c])>=0) { + int xp=x-vo->font->width[c]-vo->font->spacewidth; + draw_alpha(vo,idx,(xp<0?0:xp),y, + vo->font->width[c], + vo->font->pic_a[font]->h, + vo->font->pic_b[font]->bmp+vo->font->start[c], + vo->font->pic_a[font]->bmp+vo->font->start[c], + vo->font->pic_a[font]->w); } c=OSD_PB_START; - if ((font=vo.font->font[c])>=0) - draw_alpha(idx,x,y, - vo.font->width[c], - vo.font->pic_a[font]->h, - vo.font->pic_b[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->w); - x+=vo.font->width[c]+vo.font->charspace; + if ((font=vo->font->font[c])>=0) + draw_alpha(vo,idx,x,y, + vo->font->width[c], + vo->font->pic_a[font]->h, + vo->font->pic_b[font]->bmp+vo->font->start[c], + vo->font->pic_a[font]->bmp+vo->font->start[c], + vo->font->pic_a[font]->w); + x+=vo->font->width[c]+vo->font->charspace; c=OSD_PB_0; - if ((font=vo.font->font[c])>=0){ - w=vo.font->width[c]; - h=vo.font->pic_a[font]->h; - s=vo.font->pic_b[font]->bmp+vo.font->start[c]; - sa=vo.font->pic_a[font]->bmp+vo.font->start[c]; - st=vo.font->pic_a[font]->w; + if ((font=vo->font->font[c])>=0){ + w=vo->font->width[c]; + h=vo->font->pic_a[font]->h; + s=vo->font->pic_b[font]->bmp+vo->font->start[c]; + sa=vo->font->pic_a[font]->bmp+vo->font->start[c]; + st=vo->font->pic_a[font]->w; if ((i=mark)) do { - draw_alpha(idx,x,y,w,h,s,sa,st); + draw_alpha(vo,idx,x,y,w,h,s,sa,st); x+=charw; } while(--i); } c=OSD_PB_1; - if ((font=vo.font->font[c])>=0){ - w=vo.font->width[c]; - h=vo.font->pic_a[font]->h; - s =vo.font->pic_b[font]->bmp+vo.font->start[c]; - sa=vo.font->pic_a[font]->bmp+vo.font->start[c]; - st=vo.font->pic_a[font]->w; + if ((font=vo->font->font[c])>=0){ + w=vo->font->width[c]; + h=vo->font->pic_a[font]->h; + s =vo->font->pic_b[font]->bmp+vo->font->start[c]; + sa=vo->font->pic_a[font]->bmp+vo->font->start[c]; + st=vo->font->pic_a[font]->w; if ((i=elems-mark)) do { - draw_alpha(idx,x,y,w,h,s,sa,st); + draw_alpha(vo,idx,x,y,w,h,s,sa,st); x+=charw; } while(--i); } c=OSD_PB_END; - if ((font=vo.font->font[c])>=0) - draw_alpha(idx,x,y, - vo.font->width[c], - vo.font->pic_a[font]->h, - vo.font->pic_b[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->w); -// x+=vo.font->width[c]+vo.font->charspace; + if ((font=vo->font->font[c])>=0) + draw_alpha(vo,idx,x,y, + vo->font->width[c], + vo->font->pic_a[font]->h, + vo->font->pic_b[font]->bmp+vo->font->start[c], + vo->font->pic_a[font]->bmp+vo->font->start[c], + vo->font->pic_a[font]->w); +// x+=vo->font->width[c]+vo->font->charspace; // vo_osd_progbar_value=(vo_osd_progbar_value+1)&0xFF; @@ -273,19 +280,20 @@ // vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) -inline static void __FASTCALL__ vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ - unsigned char *t; - int c,i,j,l,font; - int len; - int k,lastk=0; - int lastStripPosition; - int xsize,lastxsize=0; - int xmin=dxs,xmax=0; - int h,lasth; +static void __FASTCALL__ vo_update_text_sub(any_t*v,mp_osd_obj_t* obj,int dxs,int dys){ + vo_data_t* vo=(vo_data_t*)v; + unsigned char *t; + int c,i,j,l,font; + int len; + int k,lastk=0; + int lastStripPosition; + int xsize,lastxsize=0; + int xmin=dxs,xmax=0; + int h,lasth; obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE; - if(!vo.sub || !vo.font){ + if(!vo->sub || !vo->font){ obj->flags&=~OSDFLAG_VISIBLE; return; } @@ -295,14 +303,14 @@ // too long lines divide into a smaller ones i=k=lasth=0; - h=vo.font->height; - xsize=-vo.font->charspace; + h=vo->font->height; + xsize=-vo->font->charspace; lastStripPosition=-1; - l=vo.sub->lines; + l=vo->sub->lines; while (l) { l--; - t=vo.sub->text[i++]; + t=vo->sub->text[i++]; len=strlen(t)-1; for (j=0;j<=len;j++){ @@ -325,27 +333,27 @@ lastk=k; lastStripPosition=j; lastxsize=xsize; - } else if ((font=vo.font->font[c])>=0){ - if (vo.font->pic_a[font]->h > h){ - h=vo.font->pic_a[font]->h; + } else if ((font=vo->font->font[c])>=0){ + if (vo->font->pic_a[font]->h > h){ + h=vo->font->pic_a[font]->h; } } obj->params.subtitle.utbl[k++]=c; - xsize+=vo.font->width[c]+vo.font->charspace; + xsize+=vo->font->width[c]+vo->font->charspace; if (dxs<xsize){ if (lastStripPosition>0){ j=lastStripPosition; xsize=lastxsize; k=lastk; } else { - xsize -=vo.font->width[c]+vo.font->charspace; // go back + xsize -=vo->font->width[c]+vo->font->charspace; // go back k--; // cut line here while (t[j] && t[j]!=' ') j++; // jump to the nearest space } } else if (j<len) continue; if (h>obj->y){ // out of the screen so end parsing - obj->y -= lasth - vo.font->height; // correct the y position + obj->y -= lasth - vo->font->height; // correct the y position l=0; break; } @@ -357,11 +365,11 @@ l=0; len=j; // end parsing } else if(l || j<len){ // not the last line or not the last char lastStripPosition=-1; - xsize=-vo.font->charspace; + xsize=-vo->font->charspace; lasth=h; - h=vo.font->height; + h=vo->font->height; } - obj->y -=h; // according to max of vo.font->pic_a[font]->h + obj->y -=h; // according to max of vo->font->pic_a[font]->h } } @@ -375,30 +383,31 @@ obj->bbox.x1=xmin; obj->bbox.x2=xmax; obj->bbox.y1=obj->y; -// obj->bbox.y2=obj->y+obj->params.subtitle.lines*vo.font->height; +// obj->bbox.y2=obj->y+obj->params.subtitle.lines*vo->font->height; obj->flags|=OSDFLAG_BBOX; } -inline static void __FASTCALL__ vo_draw_text_sub(unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ - int i,j,c,x,l,font; - int y=obj->y; +static void __FASTCALL__ vo_draw_text_sub(any_t*v,unsigned idx,mp_osd_obj_t* obj,draw_osd_f draw_alpha){ + vo_data_t* vo=(vo_data_t*)v; + int i,j,c,x,l,font; + int y=obj->y; i=j=0; if ((l=obj->params.subtitle.lines)) for (;;) { x=obj->params.subtitle.xtbl[i++]; while ((c=obj->params.subtitle.utbl[j++])){ - if ((font=vo.font->font[c])>=0) - draw_alpha(idx,x,y, - vo.font->width[c], - vo.font->pic_a[font]->h+y<obj->dys ? vo.font->pic_a[font]->h : obj->dys-y, - vo.font->pic_b[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->bmp+vo.font->start[c], - vo.font->pic_a[font]->w); - x+=vo.font->width[c]+vo.font->charspace; + if ((font=vo->font->font[c])>=0) + draw_alpha(vo,idx,x,y, + vo->font->width[c], + vo->font->pic_a[font]->h+y<obj->dys ? vo->font->pic_a[font]->h : obj->dys-y, + vo->font->pic_b[font]->bmp+vo->font->start[c], + vo->font->pic_a[font]->bmp+vo->font->start[c], + vo->font->pic_a[font]->w); + x+=vo->font->width[c]+vo->font->charspace; } if (!--l) break; - y+=vo.font->height; + y+=vo->font->height; } } @@ -421,7 +430,8 @@ vo_osd_list=NULL; } -int __FASTCALL__ vo_update_osd(int dxs,int dys){ +int __FASTCALL__ vo_update_osd(any_t*v,int dxs,int dys){ + vo_data_t* vo=(vo_data_t*)v; mp_osd_obj_t* obj=vo_osd_list; int chg=0; while(obj){ @@ -430,29 +440,29 @@ obj->flags&=~OSDFLAG_BBOX; switch(obj->type){ case OSDTYPE_SUBTITLE: - vo_update_text_sub(obj,dxs,dys); + vo_update_text_sub(vo,obj,dxs,dys); break; case OSDTYPE_PROGBAR: - vo_update_text_progbar(obj,dxs,dys); + vo_update_text_progbar(vo,obj,dxs,dys); break; case OSDTYPE_DVDNAV: vo_update_nav(obj,dxs,dys); break; case OSDTYPE_SPU: - if(vo.spudec && spudec_visible(vo.spudec)) + if(vo->spudec && spudec_visible(vo->spudec)) obj->flags|=OSDFLAG_VISIBLE|OSDFLAG_CHANGED; else obj->flags&=~OSDFLAG_VISIBLE; break; case OSDTYPE_VOBSUB: - if(vo.vobsub) + if(vo->vobsub) obj->flags|=OSDFLAG_VISIBLE|OSDFLAG_CHANGED; else obj->flags&=~OSDFLAG_VISIBLE; break; case OSDTYPE_OSD: - if(vo.font && vo.osd_text && vo.osd_text[0]){ - vo_update_text_osd(obj,dxs,dys); // update bbox + if(vo->font && vo->osd_text && vo->osd_text[0]){ + vo_update_text_osd(vo,obj,dxs,dys); // update bbox obj->flags|=OSDFLAG_VISIBLE|OSDFLAG_CHANGED; } else obj->flags&=~OSDFLAG_VISIBLE; @@ -485,7 +495,7 @@ } if(obj->flags&OSDFLAG_CHANGED){ chg|=1<<obj->type; - MSG_DBG2("OSD chg: %d V: %s pb:%d \n",obj->type,(obj->flags&OSDFLAG_VISIBLE)?"yes":"no",vo.osd_progbar_type); + MSG_DBG2("OSD chg: %d V: %s pb:%d \n",obj->type,(obj->flags&OSDFLAG_VISIBLE)?"yes":"no",vo->osd_progbar_type); } obj=obj->next; } @@ -507,18 +517,19 @@ new_osd_obj(OSDTYPE_DVDNAV); } -void __FASTCALL__ vo_remove_text(unsigned idx,int dxs,int dys,clear_osd_f f_remove){ +void __FASTCALL__ vo_remove_text(any_t*v,unsigned idx,int dxs,int dys,clear_osd_f f_remove){ + vo_data_t* vo=(vo_data_t*)v; mp_osd_obj_t* obj=vo_osd_list; - vo_update_osd(dxs,dys); + vo_update_osd(v,dxs,dys); while(obj){ - if(((obj->flags&OSDFLAG_CHANGED) || (obj->flags&OSDFLAG_VISIBLE) || - (obj->cleared_frames>=0)) && + if(((obj->flags&OSDFLAG_CHANGED) || (obj->flags&OSDFLAG_VISIBLE) || + (obj->cleared_frames>=0)) && (obj->flags&OSDFLAG_OLD_BBOX)){ int w=obj->old_bbox.x2-obj->old_bbox.x1; int h=obj->old_bbox.y2-obj->old_bbox.y1; if(w>0 && h>0){ - vo.osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack - f_remove(idx,obj->old_bbox.x1,obj->old_bbox.y1,w,h); + vo->osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack + f_remove(vo,idx,obj->old_bbox.x1,obj->old_bbox.y1,w,h); } // obj->flags&=~OSDFLAG_OLD_BBOX; if(obj->cleared_frames>=0) { @@ -531,36 +542,39 @@ } } -void __FASTCALL__ vo_draw_spudec(unsigned idx,int dxs,int dys,draw_osd_f draw_alpha){ - spudec_draw_scaled(vo.spudec, dxs, dys, draw_alpha); // FIXME +void __FASTCALL__ vo_draw_spudec(any_t*v,unsigned idx,int dxs,int dys,draw_osd_f draw_alpha){ + UNUSED(idx); + vo_data_t*vo=(vo_data_t*)v; + spudec_draw_scaled(vo->spudec, dxs, dys, draw_alpha,v); // FIXME } -void __FASTCALL__ vo_draw_text(unsigned idx,int dxs,int dys,draw_osd_f draw_alpha){ +void __FASTCALL__ vo_draw_text(any_t*v,unsigned idx,int dxs,int dys,draw_osd_f draw_alpha){ + vo_data_t* vo=(vo_data_t*)v; mp_osd_obj_t* obj=vo_osd_list; - vo_update_osd(dxs,dys); + vo_update_osd(v,dxs,dys); while(obj){ if(obj->flags&OSDFLAG_VISIBLE){ obj->cleared_frames=0; - vo.osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack + vo->osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack switch(obj->type){ case OSDTYPE_SPU: - spudec_draw_scaled(vo.spudec, dxs, dys, draw_alpha); // FIXME + spudec_draw_scaled(vo->spudec, dxs, dys, draw_alpha,v); // FIXME break; case OSDTYPE_VOBSUB: - if(vo.spudec) spudec_draw_scaled(vo.spudec, dxs, dys, draw_alpha); // FIXME + if(vo->spudec) spudec_draw_scaled(vo->spudec, dxs, dys, draw_alpha,v); // FIXME break; case OSDTYPE_OSD: - vo_draw_text_osd(idx,obj,draw_alpha); + vo_draw_text_osd(vo,idx,obj,draw_alpha); break; case OSDTYPE_SUBTITLE: - vo_draw_text_sub(idx,obj,draw_alpha); + vo_draw_text_sub(vo,idx,obj,draw_alpha); break; case OSDTYPE_PROGBAR: - vo_draw_text_progbar(idx,obj,draw_alpha); + vo_draw_text_progbar(vo,idx,obj,draw_alpha); break; case OSDTYPE_DVDNAV: - vo_draw_text_from_buffer(idx,obj,draw_alpha); + vo_draw_text_from_buffer(vo,idx,obj,draw_alpha); break; } obj->old_bbox=obj->bbox; Modified: mplayerxp/libvo/sub.h =================================================================== --- mplayerxp/libvo/sub.h 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libvo/sub.h 2012-10-24 13:00:34 UTC (rev 192) @@ -88,19 +88,19 @@ }sub_data_t; extern sub_data_t sub_data; -typedef void (* __FASTCALL__ draw_osd_f)(unsigned idx,int x0,int y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride); -typedef void (* __FASTCALL__ clear_osd_f)(unsigned idx,int x0,int y0, int w,int h); +typedef void (* __FASTCALL__ draw_osd_f)(any_t*vo,unsigned idx,int x0,int y0, int w,int h,const unsigned char* src,const unsigned char *srca, int stride); +typedef void (* __FASTCALL__ clear_osd_f)(any_t*vo,unsigned idx,int x0,int y0, int w,int h); /* for direct calll from XP-thread*/ -extern void __FASTCALL__ vo_draw_spudec(unsigned idx,int dxs,int dys,draw_osd_f draw_alpha); +extern void __FASTCALL__ vo_draw_spudec(any_t*vo,unsigned idx,int dxs,int dys,draw_osd_f draw_alpha); -extern void __FASTCALL__ vo_draw_text(unsigned idx,int dxs,int dys, draw_osd_f draw_alpha); -extern void __FASTCALL__ vo_remove_text(unsigned idx,int dxs,int dys,clear_osd_f remove); +extern void __FASTCALL__ vo_draw_text(any_t*vo,unsigned idx,int dxs,int dys, draw_osd_f draw_alpha); +extern void __FASTCALL__ vo_remove_text(any_t*vo,unsigned idx,int dxs,int dys,clear_osd_f remove); void vo_init_osd(void); -int __FASTCALL__ vo_update_osd(int dxs,int dys); +int __FASTCALL__ vo_update_osd(any_t*vo,int dxs,int dys); int __FASTCALL__ vo_osd_changed(int new_value); -int __FASTCALL__ get_osd_height(int c,int h); +int __FASTCALL__ get_osd_height(any_t* vo,int c,int h); void __FASTCALL__ osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey); #endif Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-23 06:54:26 UTC (rev 191) +++ mplayerxp/libvo/video_out.c 2012-10-24 13:00:34 UTC (rev 192) @@ -43,8 +43,7 @@ #include "sub.h" #include "vo_msg.h" -vo_priv_t vo; -static vo_format_desc vod; +vo_conf_t vo_conf; // // Externally visible list of all vo drivers @@ -127,37 +126,37 @@ uint32_t d_width,d_height; unsigned off[4]; /* offsets for y,u,v if DR on non fully fitted surface */ }dri_priv_t; -static dri_priv_t dri; -typedef struct vo_priv_data_s { +typedef struct vo_priv_s { uint32_t srcFourcc,image_format,image_width,image_height; uint32_t org_width,org_height; unsigned ps_off[4]; /* offsets for y,u,v in panscan mode */ unsigned long long int frame_counter; pthread_mutex_t surfaces_mutex; -}vo_priv_data_t; -static vo_priv_data_t vo_data; + vo_format_desc vod; + dri_priv_t dri; +}vo_priv_t; -void vo_print_help( void ) +void vo_print_help(vo_data_t*vo) { unsigned i; MSG_INFO("Available video output drivers:\n"); i=0; while (video_out_drivers[i]) { - const vo_info_t *info = video_out_drivers[i++]->get_info (); + const vo_info_t *info = video_out_drivers[i++]->get_info (vo); MSG_INFO("\t%s\t%s\n", info->short_name, info->name); } MSG_INFO("\n"); } -const vo_functions_t *vo_register(const char *driver_name) +const vo_functions_t *vo_register(vo_data_t*vo,const char *driver_name) { unsigned i; if(!driver_name) video_out=video_out_drivers[0]; else for (i=0; video_out_drivers[i] != NULL; i++){ - const vo_info_t *info = video_out_drivers[i]->get_info (); + const vo_info_t *info = video_out_drivers[i]->get_info (vo); if(strcmp(info->short_name,driver_name) == 0){ video_out = video_out_drivers[i];break; } @@ -165,34 +164,43 @@ return video_out; } -const vo_info_t* vo_get_info( void ) +const vo_info_t* vo_get_info(vo_data_t*vo) { - return video_out->get_info(); + return video_out->get_info(vo); } -void __FASTCALL__ vo_preinit_structs( void ) +vo_data_t* __FASTCALL__ vo_preinit_structs( void ) { + vo_data_t* vo; pthread_mutexattr_t attr; - memset(&dri,0,sizeof(dri_priv_t)); - dri.num_xp_frames=1; - memset(&vo,0,sizeof(vo_priv_t)); - vo.movie_aspect=-1.0; - vo.flip=-1; - vo.da_buffs=64; - vo.window = None; - vo.WinID=-1; - vo.osd_progbar_type=-1; - vo.osd_progbar_value=100; // 0..256 - memset(&vo_data,0,sizeof(vo_priv_data_t)); + + memset(&vo_conf,0,sizeof(vo_conf_t)); + vo_conf.movie_aspect=-1.0; + vo_conf.flip=-1; + vo_conf.da_buffs=64; + vo_conf.WinID=-1; + + vo=malloc(sizeof(vo_data_t)); + memset(vo,0,sizeof(vo_data_t)); + vo->window = None; + vo->osd_progbar_type=-1; + vo->osd_progbar_value=100; // 0..256 + + vo->vo_priv=malloc(sizeof(vo_priv_t)); + memset(vo->vo_priv,0,sizeof(vo_priv_t)); + vo_priv_t* priv=(vo_priv_t*)vo->vo_priv; pthread_mutexattr_init(&attr); - pthread_mutex_init(&vo_data.surfaces_mutex,&attr); + pthread_mutex_init(&priv->surfaces_mutex,&attr); + priv->dri.num_xp_frames=1; + return vo; } -int __FASTCALL__ vo_init(const char *subdevice) +int __FASTCALL__ vo_init(vo_data_t*vo,const char *subdevice) { + vo_priv_t* priv=(vo_priv_t*)vo->vo_priv; MSG_DBG3("dri_vo_dbg: vo_init(%s)\n",subdevice); - vo_data.frame_counter=0; - return video_out->preinit(subdevice); + priv->frame_counter=0; + return video_out->preinit(vo,subdevice); } int __FASTCALL__ vo_describe_fourcc(uint32_t fourcc,vo_format_desc *vd) @@ -260,137 +268,142 @@ return is_planar; } -static void __FASTCALL__ dri_config(uint32_t fourcc) +static void __FASTCALL__ dri_config(vo_data_t*vo,uint32_t fourcc) { + vo_priv_t* priv=(vo_priv_t*)vo->vo_priv; unsigned i; - dri.is_planar = vo_describe_fourcc(fourcc,&vod); - dri.bpp=vod.bpp; - if(!dri.bpp) dri.has_dri=0; /*unknown fourcc*/ - if(dri.has_dri) + priv->dri.is_planar = vo_describe_fourcc(fourcc,&priv->vod); + priv->dri.bpp=priv->vod.bpp; + if(!priv->dri.bpp) priv->dri.has_dri=0; /*unknown fourcc*/ + if(priv->dri.has_dri) { - video_out->control(VOCTRL_GET_NUM_FRAMES,&dri.num_xp_frames); - dri.num_xp_frames=min(dri.num_xp_frames,MAX_DRI_BUFFERS); - for(i=0;i<dri.num_xp_frames;i++) + video_out->control(vo,VOCTRL_GET_NUM_FRAMES,&priv->dri.num_xp_frames); + priv->dri.num_xp_frames=min(priv->dri.num_xp_frames,MAX_DRI_BUFFERS); + for(i=0;i<priv->dri.num_xp_frames;i++) { - dri.surf[i].idx=i; - video_out->control(DRI_GET_SURFACE,&... [truncated message content] |
From: <nic...@us...> - 2012-10-24 15:56:48
|
Revision: 193 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=193&view=rev Author: nickols_k Date: 2012-10-24 15:56:40 +0000 (Wed, 24 Oct 2012) Log Message: ----------- randomness makes memory exploits harder Modified Paths: -------------- mplayerxp/libao2/audio_out.c mplayerxp/libao2/audio_out.h mplayerxp/libvo/video_out.c mplayerxp/mplayer.c mplayerxp/my_malloc.c mplayerxp/my_malloc.h Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2012-10-24 13:00:34 UTC (rev 192) +++ mplayerxp/libao2/audio_out.c 2012-10-24 15:56:40 UTC (rev 193) @@ -202,12 +202,13 @@ return audio_out->info; } -ao_data_t* __FASTCALL__ ao_init(unsigned flags) +ao_data_t* __FASTCALL__ ao_init(unsigned flags,const char *subdevice) { ao_data_t* ao; int retval; ao=malloc(sizeof(ao_data_t)); memset(ao,0,sizeof(ao_data_t)); + ao->subdevice=subdevice; ao->outburst=OUTBURST; ao->buffersize=-1; retval = audio_out->init(ao,flags); Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2012-10-24 13:00:34 UTC (rev 192) +++ mplayerxp/libao2/audio_out.h 2012-10-24 15:56:40 UTC (rev 193) @@ -107,7 +107,7 @@ 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); +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); Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-24 13:00:34 UTC (rev 192) +++ mplayerxp/libvo/video_out.c 2012-10-24 15:56:40 UTC (rev 193) @@ -33,6 +33,7 @@ #include "../postproc/swscale.h" #include "../postproc/vf.h" #include "../dec_ahead.h" +#include "../my_malloc.h" #include "../mplayer.h" #include "fastmemcpy.h" #include "img_format.h" @@ -180,7 +181,7 @@ vo_conf.da_buffs=64; vo_conf.WinID=-1; - vo=malloc(sizeof(vo_data_t)); + vo=random_malloc(sizeof(vo_data_t),1000); memset(vo,0,sizeof(vo_data_t)); vo->window = None; vo->osd_progbar_type=-1; Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-24 13:00:34 UTC (rev 192) +++ mplayerxp/mplayer.c 2012-10-24 15:56:40 UTC (rev 193) @@ -1673,7 +1673,8 @@ vo_init_osd(); } -static void mpxp_init_output_subsystems(void) { +static char * mpxp_init_output_subsystems(void) { + char* rs=NULL; unsigned i; // check video_out driver name: if (video_driver) @@ -1709,9 +1710,8 @@ if (audio_driver[i] == ':') { - ao_data->subdevice = malloc(i2-i); - if (ao_data->subdevice != NULL) - strncpy(ao_data->subdevice, (char *)(audio_driver+i+1), i2-i); + rs = malloc(i2-i); + if (rs != NULL) strncpy(rs, (char *)(audio_driver+i+1), i2-i); audio_driver[i] = '\0'; } } @@ -1720,6 +1720,7 @@ MSG_FATAL(MSGTR_InvalidAOdriver,audio_driver); exit_player(MSGTR_Exit_error); } + return rs; } static int mpxp_init_vobsub(const char *filename) { @@ -2398,6 +2399,7 @@ int main(int argc,char* argv[], char *envp[]){ int stream_dump_type=0; input_state_t input_state = { 0, 0, 0 }; + char *ao_subdevice; char* filename=NULL; //"MI2-Trailer.avi"; int file_format=DEMUXER_TYPE_UNKNOWN; @@ -2499,7 +2501,7 @@ inited_flags|=INITED_GETCH2; } - mpxp_init_output_subsystems(); + ao_subdevice=mpxp_init_output_subsystems(); if(filename) MSG_OK(MSGTR_Playing, filename); forced_subs_only=mpxp_init_vobsub(filename); @@ -2597,7 +2599,7 @@ goto dump_file; } - if(!(ao_data=ao_init(0))) { + if(!(ao_data=ao_init(0,ao_subdevice))) { MSG_ERR(MSGTR_CannotInitAO); sh_audio=d_audio->sh=NULL; } Modified: mplayerxp/my_malloc.c =================================================================== --- mplayerxp/my_malloc.c 2012-10-24 13:00:34 UTC (rev 192) +++ mplayerxp/my_malloc.c 2012-10-24 15:56:40 UTC (rev 193) @@ -2,6 +2,7 @@ #include <string.h> #include <stdio.h> +#include <time.h> any_t*my_malloc(size_t __size) { @@ -100,6 +101,20 @@ { any_t*a; a = my_malloc(strlen(s)+1); - strcpy(a,s); + 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; +} Modified: mplayerxp/my_malloc.h =================================================================== --- mplayerxp/my_malloc.h 2012-10-24 13:00:34 UTC (rev 192) +++ mplayerxp/my_malloc.h 2012-10-24 15:56:40 UTC (rev 193) @@ -27,4 +27,7 @@ #define free(a) my_free(a) #endif +/* Randomizing memory objects makes memory exploits harder */ +extern any_t* random_malloc(size_t __size,unsigned upper_rnd_limit); + #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-24 16:01:15
|
Revision: 194 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=194&view=rev Author: nickols_k Date: 2012-10-24 16:01:04 +0000 (Wed, 24 Oct 2012) Log Message: ----------- memory leak-- Modified Paths: -------------- mplayerxp/libao2/audio_out.c mplayerxp/mplayer.c Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2012-10-24 15:56:40 UTC (rev 193) +++ mplayerxp/libao2/audio_out.c 2012-10-24 16:01:04 UTC (rev 194) @@ -208,7 +208,7 @@ int retval; ao=malloc(sizeof(ao_data_t)); memset(ao,0,sizeof(ao_data_t)); - ao->subdevice=subdevice; + if(subdevice) ao->subdevice=strdup(subdevice); ao->outburst=OUTBURST; ao->buffersize=-1; retval = audio_out->init(ao,flags); @@ -227,6 +227,7 @@ void ao_uninit(ao_data_t*ao) { audio_out->uninit(ao); + if(ao->subdevice) free(ao->subdevice); free(ao); ao=NULL; } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-24 15:56:40 UTC (rev 193) +++ mplayerxp/mplayer.c 2012-10-24 16:01:04 UTC (rev 194) @@ -2603,6 +2603,7 @@ MSG_ERR(MSGTR_CannotInitAO); sh_audio=d_audio->sh=NULL; } + if(ao_subdevice) free(ao_subdevice); if(sh_audio){ MSG_V("Initializing audio codec...\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-25 06:26:42
|
Revision: 197 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=197&view=rev Author: nickols_k Date: 2012-10-25 06:26:33 +0000 (Thu, 25 Oct 2012) Log Message: ----------- reorder source tree Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libmpcodecs/Makefile mplayerxp/libmpdemux/Makefile mplayerxp/libmpdemux/demux_mkv.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/s_dvdnav.c mplayerxp/libmpdemux/sub_cc.c mplayerxp/libvo/sub.c mplayerxp/libvo/video_out.h Added Paths: ----------- mplayerxp/libmpsub/ mplayerxp/libmpsub/Makefile mplayerxp/libmpsub/find_sub.c mplayerxp/libmpsub/spudec.c mplayerxp/libmpsub/spudec.h mplayerxp/libmpsub/subreader.c mplayerxp/libmpsub/subreader.h mplayerxp/libmpsub/vobsub.c mplayerxp/libmpsub/vobsub.h Removed Paths: ------------- mplayerxp/find_sub.c mplayerxp/spudec.c mplayerxp/spudec.h mplayerxp/subreader.c mplayerxp/subreader.h mplayerxp/vobsub.c mplayerxp/vobsub.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-10-24 16:30:14 UTC (rev 196) +++ mplayerxp/Makefile 2012-10-25 06:26:33 UTC (rev 197) @@ -13,7 +13,7 @@ PRG_FIBMAP = fibmap_mplayerxp PRG_CFG = codec-cfg-xp # these subdirectories required installation due binaries within them -SUBDIRS = libmpdemux libmpcodecs libao2 osdep postproc input nls libvo +SUBDIRS = libmpdemux libmpsub libmpcodecs libao2 osdep postproc input nls libvo ifeq ($(TARGET_ARCH_X86),yes) SUBDIRS+=loader endif @@ -23,8 +23,8 @@ MANDIR = ${prefix}/man LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs -SRCS_COMMON = cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c my_malloc.c spudec.c playtree.c playtreeparser.c asxparser.c mp_image.c subopt-helper.c -SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) find_sub.c subreader.c mixer.c vobsub.c mp-opt-reg.c sig_hand.c dump.c dec_ahead.c m_option.c m_property.c m_struct.c +SRCS_COMMON = cpudetect.c mp_msg.c codec-cfg.c cfgparser.c my_profile.c my_malloc.c playtree.c playtreeparser.c asxparser.c mp_image.c subopt-helper.c +SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c dec_ahead.c m_option.c m_property.c m_struct.c OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) @@ -36,6 +36,7 @@ MP_LIBS = libmpdemux/libmpdemux.a \ libmpcodecs/libmpcodecs.a \ + libmpsub/libmpsub.a \ libao2/libao2.a \ postproc/libpostproc.a \ input/libinput.a \ @@ -47,7 +48,7 @@ endif COMMON_LIBS = $(MP_LIBS) $(FF_LIBS) $(EXTRALIBS) -lm -CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Ilibvo $(EXTRA_INC) +CFLAGS = $(OPTFLAGS) -Ilibmpsub -Ilibmpdemux -Ilibvo $(EXTRA_INC) ALL_PRG = $(PRG) ifeq ($(HAVE_CSS),yes) Deleted: mplayerxp/find_sub.c =================================================================== --- mplayerxp/find_sub.c 2012-10-24 16:30:14 UTC (rev 196) +++ mplayerxp/find_sub.c 2012-10-25 06:26:33 UTC (rev 197) @@ -1,111 +0,0 @@ -//**************************************************************************// -// .SUB -//**************************************************************************// - -#include "mp_config.h" - -#ifdef USE_OSD - -#include <stdio.h> -#include <limits.h> -#include "libvo/video_out.h" -#include "libvo/sub.h" -#include "subreader.h" -#define MSGT_CLASS MSGT_FINDSUB -#include "__mp_msg.h" - -static int current_sub=0; - -//static subtitle* subtitles=NULL; -static unsigned long nosub_range_start=ULONG_MAX; -static unsigned long nosub_range_end=ULONG_MAX; - -void find_sub(subtitle* subtitles,unsigned long key,any_t*vo_data){ - int i,j; - vo_data_t*vo=vo_data; - - if ( !subtitles ) return; - - if(vo->sub){ - if(key>=vo->sub->start && key<=vo->sub->end) return; // OK! - } else { - if(key>nosub_range_start && key<nosub_range_end) return; // OK! - } - // sub changed! - - /* Tell the OSD subsystem that the OSD contents will change soon */ - vo_osd_changed(OSDTYPE_SUBTITLE); - - if(key<=0){ - vo->sub=NULL; // no sub here - return; - } - - // check next sub. - if(current_sub>=0 && current_sub+1<sub_num){ - if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ - // no sub - nosub_range_start=subtitles[current_sub].end; - nosub_range_end=subtitles[current_sub+1].start; - vo->sub=NULL; - return; - } - // next sub? - ++current_sub; - vo->sub=&subtitles[current_sub]; - if(key>=vo->sub->start && key<=vo->sub->end) return; // OK! - } - - // use logarithmic search: - i=0;j=sub_num-1; - while(j>=i){ - current_sub=(i+j+1)/2; - vo->sub=&subtitles[current_sub]; - if(key<vo->sub->start) j=current_sub-1; - else if(key>vo->sub->end) i=current_sub+1; - else return; // found! - } -// if(key>=vo->sub->start && key<=vo->sub->end) return; // OK! - - // check where are we... - if(key<vo->sub->start){ - if(current_sub<=0){ - // before the first sub - nosub_range_start=key-1; // tricky - nosub_range_end=vo->sub->start; - vo->sub=NULL; - return; - } - --current_sub; - if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ - // no sub - nosub_range_start=subtitles[current_sub].end; - nosub_range_end=subtitles[current_sub+1].start; - vo->sub=NULL; - return; - } - MSG_V("HEH???? "); - } else { - if(key<=vo->sub->end) MSG_V("JAJJ! "); else - if(current_sub+1>=sub_num){ - // at the end? - nosub_range_start=vo->sub->end; - nosub_range_end=0x7FFFFFFF; // MAXINT - vo->sub=NULL; - return; - } else - if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ - // no sub - nosub_range_start=subtitles[current_sub].end; - nosub_range_end=subtitles[current_sub+1].start; - vo->sub=NULL; - return; - } - } - - MSG_ERR("SUB ERROR: %d ? %d --- %d [%d] \n",key,(int)vo->sub->start,(int)vo->sub->end,current_sub); - - vo->sub=NULL; // no sub here -} - -#endif Modified: mplayerxp/libmpcodecs/Makefile =================================================================== --- mplayerxp/libmpcodecs/Makefile 2012-10-24 16:30:14 UTC (rev 196) +++ mplayerxp/libmpcodecs/Makefile 2012-10-25 06:26:33 UTC (rev 197) @@ -55,7 +55,7 @@ OBJS=$(SRCS:.c=.o) -CFLAGS = $(OPTFLAGS) -I. -I.. -I../libmpdemux -I../loader -Wall +CFLAGS = $(OPTFLAGS) -I. -I.. -I../libmpdemux -I../libmpsub -I../loader -Wall .SUFFIXES: .c .o Modified: mplayerxp/libmpdemux/Makefile =================================================================== --- mplayerxp/libmpdemux/Makefile 2012-10-24 16:30:14 UTC (rev 196) +++ mplayerxp/libmpdemux/Makefile 2012-10-25 06:26:33 UTC (rev 197) @@ -54,7 +54,7 @@ endif OBJS = $(SRCS:.c=.o) -INCLUDE = -I../loader +INCLUDE = -I../libmpsub -I../loader CFLAGS = $(OPTFLAGS) $(INCLUDE) -W -Wall .SUFFIXES: .c .o Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-10-24 16:30:14 UTC (rev 196) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-10-25 06:26:33 UTC (rev 197) @@ -22,8 +22,8 @@ #include <dlfcn.h> #include "../bswap.h" -#include "../vobsub.h" -#include "../subreader.h" +#include "vobsub.h" +#include "subreader.h" #include "../libvo/sub.h" #include "../libmpcodecs/codecs_ld.h" #include "../libmpcodecs/libnuppelvideo/minilzo.h" Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-24 16:30:14 UTC (rev 196) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-25 06:26:33 UTC (rev 197) @@ -17,7 +17,7 @@ #include "stheader.h" #include "loader/qtx/qtxsdk/components.h" #include "../nls/nls.h" -#include "../subreader.h" +#include "subreader.h" #include "bswap.h" #include "aviheader.h" Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-24 16:30:14 UTC (rev 196) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-25 06:26:33 UTC (rev 197) @@ -149,7 +149,7 @@ //-------- subtitle support - should be moved to decoder layer, and queue // - subtitles up in demuxer buffer... -#include "../subreader.h" +#include "subreader.h" #include "../libvo/sub.h" #define OGG_SUB_MAX_LINE 128 Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-10-24 16:30:14 UTC (rev 196) +++ mplayerxp/libmpdemux/demuxer.c 2012-10-25 06:26:33 UTC (rev 197) @@ -13,7 +13,7 @@ #include "../mp_config.h" #include "help_mp.h" #include "../mplayer.h" -#include "../subreader.h" +#include "subreader.h" #include "../cfgparser.h" #include "../nls/nls.h" Modified: mplayerxp/libmpdemux/s_dvdnav.c =================================================================== --- mplayerxp/libmpdemux/s_dvdnav.c 2012-10-24 16:30:14 UTC (rev 196) +++ mplayerxp/libmpdemux/s_dvdnav.c 2012-10-25 06:26:33 UTC (rev 197) @@ -9,7 +9,7 @@ #include "stream.h" #include "help_mp.h" #include "demuxer.h" -#include "../spudec.h" +#include "spudec.h" #include "../libvo/sub.h" #include "../input/input.h" #include "../mplayer.h" Modified: mplayerxp/libmpdemux/sub_cc.c =================================================================== --- mplayerxp/libmpdemux/sub_cc.c 2012-10-24 16:30:14 UTC (rev 196) +++ mplayerxp/libmpdemux/sub_cc.c 2012-10-25 06:26:33 UTC (rev 197) @@ -20,7 +20,7 @@ #include "../mp_config.h" #include "sub_cc.h" -#include "../subreader.h" +#include "subreader.h" #include "../libvo/video_out.h" #include "../libvo/sub.h" Added: mplayerxp/libmpsub/Makefile =================================================================== --- mplayerxp/libmpsub/Makefile (rev 0) +++ mplayerxp/libmpsub/Makefile 2012-10-25 06:26:33 UTC (rev 197) @@ -0,0 +1,49 @@ + +LIBNAME = libmpsub.a + +include ../mp_config.mak + +DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@ || exit; done +DO_ALL = @ for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit; done + +SRCS = find_sub.c spudec.c subreader.c vobsub.c + +OBJS = $(SRCS:.c=.o) +INCLUDE = -I. -I../ +CFLAGS = $(OPTFLAGS) $(INCLUDE) -W -Wall + +.SUFFIXES: .c .o + +.PHONY: $(SUBDIRS) + +all: $(LIBNAME) + +$(SUBDIRS): + $(DO_ALL) + +.c.o: + $(CC) -c $(CFLAGS) -o $@ $< + +$(LIBNAME): $(SUBDIRS) $(OBJS) + $(AR) r $(LIBNAME) $(OBJS) + +clean: + $(DO_MAKE) + rm -f *.o *.a *~ + +distclean: + $(DO_MAKE) + rm -f test Makefile.bak *.o *.a *~ .depend + +dep: depend + +depend: + $(DO_MAKE) + $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend + +# +# include dependency files if they exist +# +ifneq ($(wildcard .depend),) +include .depend +endif Property changes on: mplayerxp/libmpsub/Makefile ___________________________________________________________________ Added: svn:eol-style + native Copied: mplayerxp/libmpsub/find_sub.c (from rev 192, mplayerxp/find_sub.c) =================================================================== --- mplayerxp/libmpsub/find_sub.c (rev 0) +++ mplayerxp/libmpsub/find_sub.c 2012-10-25 06:26:33 UTC (rev 197) @@ -0,0 +1,111 @@ +//**************************************************************************// +// .SUB +//**************************************************************************// + +#include "mp_config.h" + +#ifdef USE_OSD + +#include <stdio.h> +#include <limits.h> +#include "libvo/video_out.h" +#include "libvo/sub.h" +#include "subreader.h" +#define MSGT_CLASS MSGT_FINDSUB +#include "__mp_msg.h" + +static int current_sub=0; + +//static subtitle* subtitles=NULL; +static unsigned long nosub_range_start=ULONG_MAX; +static unsigned long nosub_range_end=ULONG_MAX; + +void find_sub(subtitle* subtitles,unsigned long key,any_t*vo_data){ + int i,j; + vo_data_t*vo=vo_data; + + if ( !subtitles ) return; + + if(vo->sub){ + if(key>=vo->sub->start && key<=vo->sub->end) return; // OK! + } else { + if(key>nosub_range_start && key<nosub_range_end) return; // OK! + } + // sub changed! + + /* Tell the OSD subsystem that the OSD contents will change soon */ + vo_osd_changed(OSDTYPE_SUBTITLE); + + if(key<=0){ + vo->sub=NULL; // no sub here + return; + } + + // check next sub. + if(current_sub>=0 && current_sub+1<sub_num){ + if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ + // no sub + nosub_range_start=subtitles[current_sub].end; + nosub_range_end=subtitles[current_sub+1].start; + vo->sub=NULL; + return; + } + // next sub? + ++current_sub; + vo->sub=&subtitles[current_sub]; + if(key>=vo->sub->start && key<=vo->sub->end) return; // OK! + } + + // use logarithmic search: + i=0;j=sub_num-1; + while(j>=i){ + current_sub=(i+j+1)/2; + vo->sub=&subtitles[current_sub]; + if(key<vo->sub->start) j=current_sub-1; + else if(key>vo->sub->end) i=current_sub+1; + else return; // found! + } +// if(key>=vo->sub->start && key<=vo->sub->end) return; // OK! + + // check where are we... + if(key<vo->sub->start){ + if(current_sub<=0){ + // before the first sub + nosub_range_start=key-1; // tricky + nosub_range_end=vo->sub->start; + vo->sub=NULL; + return; + } + --current_sub; + if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ + // no sub + nosub_range_start=subtitles[current_sub].end; + nosub_range_end=subtitles[current_sub+1].start; + vo->sub=NULL; + return; + } + MSG_V("HEH???? "); + } else { + if(key<=vo->sub->end) MSG_V("JAJJ! "); else + if(current_sub+1>=sub_num){ + // at the end? + nosub_range_start=vo->sub->end; + nosub_range_end=0x7FFFFFFF; // MAXINT + vo->sub=NULL; + return; + } else + if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ + // no sub + nosub_range_start=subtitles[current_sub].end; + nosub_range_end=subtitles[current_sub+1].start; + vo->sub=NULL; + return; + } + } + + MSG_ERR("SUB ERROR: %d ? %d --- %d [%d] \n",key,(int)vo->sub->start,(int)vo->sub->end,current_sub); + + vo->sub=NULL; // no sub here +} + +#endif Copied: mplayerxp/libmpsub/spudec.c (from rev 192, mplayerxp/spudec.c) =================================================================== --- mplayerxp/libmpsub/spudec.c (rev 0) +++ mplayerxp/libmpsub/spudec.c 2012-10-25 06:26:33 UTC (rev 197) @@ -0,0 +1,1183 @@ +/* SPUdec.c + Skeleton of function spudec_process_controll() is from xine sources. + Further works: + LGB,... (yeah, try to improve it and insert your name here! ;-) + + Kim Minh Kaplan + implement fragments reassembly, RLE decoding. + read brightness from the IFO. + + For information on SPU format see <URL:http://sam.zoy.org/doc/dvd/subtitles/> + and <URL:http://members.aol.com/mpucoder/DVD/spu.html> + + */ +#include "mp_config.h" + +#include <errno.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <math.h> + +#include "dec_ahead.h" +#include "spudec.h" +#include "postproc/swscale.h" +#define MSGT_CLASS MSGT_SPUDEC +#include "__mp_msg.h" + +#ifndef MIN +#define MIN(a, b) ((a)<(b)?(a):(b)) +#endif + +/* Valid values for spu_aamode: + 0: none (fastest, most ugly) + 1: approximate + 2: full (slowest) + 3: bilinear (similiar to vobsub, fast and not too bad) + 4: uses swscaler gaussian (this is the only one that looks good) + */ + +int spu_aamode = 3; +int spu_alignment = -1; +float spu_gaussvar = 1.0; + +typedef struct packet_t packet_t; +struct packet_t { + unsigned char *packet; + unsigned int palette[4]; + unsigned int alpha[4]; + unsigned int control_start; /* index of start of control data */ + unsigned int current_nibble[2]; /* next data nibble (4 bits) to be + processed (for RLE decoding) for + even and odd lines */ + int deinterlace_oddness; /* 0 or 1, index into current_nibble */ + unsigned int start_col, end_col; + unsigned int start_row, end_row; + unsigned int width, height, stride; + unsigned int start_pts, end_pts; + packet_t *next; +}; + +typedef struct { + packet_t *queue_head; + packet_t *queue_tail; + unsigned int global_palette[16]; + unsigned int orig_frame_width, orig_frame_height; + unsigned char* packet; + size_t packet_reserve; /* size of the memory pointed to by packet */ + unsigned int packet_offset; /* end of the currently assembled fragment */ + unsigned int packet_size; /* size of the packet once all fragments are assembled */ + unsigned int packet_pts; /* PTS for this packet */ + unsigned int palette[4]; + unsigned int alpha[4]; + unsigned int cuspal[4]; + unsigned int custom; + unsigned int now_pts; + unsigned int start_pts, end_pts; + unsigned int start_col, end_col; + unsigned int start_row, end_row; + unsigned int width, height, stride; + size_t image_size; /* Size of the image buffer */ + unsigned char *image; /* Grayscale value */ + unsigned char *aimage; /* Alpha value */ + unsigned int scaled_frame_width, scaled_frame_height; + unsigned int scaled_start_col, scaled_start_row; + unsigned int scaled_width, scaled_height, scaled_stride; + size_t scaled_image_size; + unsigned char *scaled_image; + unsigned char *scaled_aimage; + int auto_palette; /* 1 if we lack a palette and must use an heuristic. */ + int font_start_level; /* Darkest value used for the computed font */ + vo_functions_t *hw_spu; + int spu_changed; + unsigned int forced_subs_only; /* flag: 0=display all subtitle, !0 display only forced subtitles */ + unsigned int is_forced_sub; /* true if current subtitle is a forced subtitle */ +} spudec_handle_t; + +static void __FASTCALL__ spudec_queue_packet(spudec_handle_t *this, packet_t *packet) +{ + if (this->queue_head == NULL) + this->queue_head = packet; + else + this->queue_tail->next = packet; + this->queue_tail = packet; +} + +static packet_t __FASTCALL__ *spudec_dequeue_packet(spudec_handle_t *this) +{ + packet_t *retval = this->queue_head; + + this->queue_head = retval->next; + if (this->queue_head == NULL) + this->queue_tail = NULL; + + return retval; +} + +static void __FASTCALL__ spudec_free_packet(packet_t *packet) +{ + if (packet->packet != NULL) + free(packet->packet); + free(packet); +} + +static inline unsigned int __FASTCALL__ get_be16(const unsigned char *p) +{ + return (p[0] << 8) + p[1]; +} + +static inline unsigned int __FASTCALL__ get_be24(const unsigned char *p) +{ + return (get_be16(p) << 8) + p[2]; +} + +static void __FASTCALL__ next_line(packet_t *packet) +{ + if (packet->current_nibble[packet->deinterlace_oddness] % 2) + packet->current_nibble[packet->deinterlace_oddness]++; + packet->deinterlace_oddness = (packet->deinterlace_oddness + 1) % 2; +} + +static inline unsigned char __FASTCALL__ get_nibble(packet_t *packet) +{ + unsigned char nib; + unsigned int *nibblep = packet->current_nibble + packet->deinterlace_oddness; + if (*nibblep / 2 >= packet->control_start) { + MSG_WARN( "SPUdec: ERROR: get_nibble past end of packet\n"); + return 0; + } + nib = packet->packet[*nibblep / 2]; + if (*nibblep % 2) + nib &= 0xf; + else + nib >>= 4; + ++*nibblep; + return nib; +} + +static inline int __FASTCALL__ mkalpha(int i) +{ + /* In mplayer's alpha planes, 0 is transparent, then 1 is nearly + opaque upto 255 which is transparent */ + switch (i) { + case 0xf: + return 1; + case 0: + return 0; + default: + return (0xf - i) << 4; + } +} + +/* Cut the sub to visible part */ +static inline void __FASTCALL__ spudec_cut_image(spudec_handle_t *this) +{ + unsigned int fy, ly; + unsigned int first_y, last_y; + unsigned char *image; + unsigned char *aimage; + + if (this->stride == 0 || this->height == 0) { + return; + } + + for (fy = 0; fy < this->image_size && !this->aimage[fy]; fy++); + for (ly = this->stride * this->height-1; ly && !this->aimage[ly]; ly--); + first_y = fy / this->stride; + last_y = ly / this->stride; + //printf("first_y: %d, last_y: %d\n", first_y, last_y); + this->start_row += first_y; + + // Some subtitles trigger this condition + if (last_y + 1 > first_y ) { + this->height = last_y - first_y +1; + } else { + this->height = 0; + this->image_size = 0; + return; + } + +// printf("new h %d new start %d (sz %d st %d)---\n\n", this->height, this->start_row, this->image_size, this->stride); + + image = malloc(2 * this->stride * this->height); + if(image){ + this->image_size = this->stride * this->height; + aimage = image + this->image_size; + memcpy(image, this->image + this->stride * first_y, this->image_size); + memcpy(aimage, this->aimage + this->stride * first_y, this->image_size); + free(this->image); + this->image = image; + this->aimage = aimage; + } else { + MSG_FATAL("Fatal: update_spu: malloc requested %d bytes\n", 2 * this->stride * this->height); + } +} + +static void __FASTCALL__ spudec_process_data(spudec_handle_t *this, packet_t *packet) +{ + unsigned int cmap[4], alpha[4]; + unsigned int i, x, y; + + this->scaled_frame_width = 0; + this->scaled_frame_height = 0; + this->start_col = packet->start_col; + this->end_col = packet->end_col; + this->start_row = packet->start_row; + this->end_row = packet->end_row; + this->height = packet->height; + this->width = packet->width; + this->stride = packet->stride; + for (i = 0; i < 4; ++i) { + alpha[i] = mkalpha(packet->alpha[i]); + if (alpha[i] == 0) + cmap[i] = 0; + else if (this->custom){ + cmap[i] = ((this->cuspal[i] >> 16) & 0xff); + if (cmap[i] + alpha[i] > 255) + cmap[i] = 256 - alpha[i]; + } + else { + cmap[i] = ((this->global_palette[packet->palette[i]] >> 16) & 0xff); + if (cmap[i] + alpha[i] > 255) + cmap[i] = 256 - alpha[i]; + } + } + + if (this->image_size < this->stride * this->height) { + if (this->image != NULL) { + free(this->image); + this->image_size = 0; + } + this->image = malloc(2 * this->stride * this->height); + if (this->image) { + this->image_size = this->stride * this->height; + this->aimage = this->image + this->image_size; + } + } + if (this->image == NULL) + return; + + /* Kludge: draw_alpha needs width multiple of 8. */ + if (this->width < this->stride) + for (y = 0; y < this->height; ++y) + memset(this->aimage + y * this->stride + this->width, 0, this->stride - this->width); + + i = packet->current_nibble[1]; + x = 0; + y = 0; + while (packet->current_nibble[0] < i + && packet->current_nibble[1] / 2 < packet->control_start + && y < this->height) { + unsigned int len, color; + unsigned int rle = 0; + rle = get_nibble(packet); + if (rle < 0x04) { + rle = (rle << 4) | get_nibble(packet); + if (rle < 0x10) { + rle = (rle << 4) | get_nibble(packet); + if (rle < 0x040) { + rle = (rle << 4) | get_nibble(packet); + if (rle < 0x0004) + rle |= ((this->width - x) << 2); + } + } + } + color = 3 - (rle & 0x3); + len = rle >> 2; + if (len > this->width - x || len == 0) + len = this->width - x; + /* FIXME have to use palette and alpha map*/ + memset(this->image + y * this->stride + x, cmap[color], len); + memset(this->aimage + y * this->stride + x, alpha[color], len); + x += len; + if (x >= this->width) { + next_line(packet); + x = 0; + ++y; + } + } + spudec_cut_image(this); +} + + +/* + This function tries to create a usable palette. + It determines how many non-transparent colors are used, and assigns different +gray scale values to each color. + I tested it with four streams and even got something readable. Half of the +times I got black characters with white around and half the reverse. +*/ +static void __FASTCALL__ compute_palette(spudec_handle_t *this, packet_t *packet) +{ + int used[16],i,cused,start,step,color; + + memset(used, 0, sizeof(used)); + for (i=0; i<4; i++) + if (packet->alpha[i]) /* !Transparent? */ + used[packet->palette[i]] = 1; + for (cused=0, i=0; i<16; i++) + if (used[i]) cused++; + if (!cused) return; + if (cused == 1) { + start = 0x80; + step = 0; + } else { + start = this->font_start_level; + step = (0xF0-this->font_start_level)/(cused-1); + } + memset(used, 0, sizeof(used)); + for (i=0; i<4; i++) { + color = packet->palette[i]; + if (packet->alpha[i] && !used[color]) { /* not assigned? */ + used[color] = 1; + this->global_palette[color] = start<<16; + start += step; + } + } +} + +static void __FASTCALL__ spudec_process_control(spudec_handle_t *this, unsigned int pts100) +{ + int a,b; /* Temporary vars */ + unsigned int date, type; + unsigned int off; + unsigned int start_off = 0; + unsigned int next_off; + unsigned int start_pts=0; + unsigned int end_pts=0; + unsigned int current_nibble[2] = { 0, 0 }; + unsigned int control_start; + unsigned int display = 0; + unsigned int start_col = 0; + unsigned int end_col = 0; + unsigned int start_row = 0; + unsigned int end_row = 0; + unsigned int width = 0; + unsigned int height = 0; + unsigned int stride = 0; + + control_start = get_be16(this->packet + 2); + next_off = control_start; + while (start_off != next_off) { + start_off = next_off; + date = get_be16(this->packet + start_off) * 1024; + next_off = get_be16(this->packet + start_off + 2); + MSG_DBG2( "date=%d\n", date); + off = start_off + 4; + for (type = this->packet[off++]; type != 0xff; type = this->packet[off++]) { + MSG_DBG2( "cmd=%d ",type); + switch(type) { + case 0x00: + /* Menu ID, 1 byte */ + MSG_DBG2("Menu ID\n"); + /* shouldn't a Menu ID type force display start? */ + start_pts = pts100 + date; + end_pts = UINT_MAX; + display = 1; + this->is_forced_sub=~0; // current subtitle is forced + break; + case 0x01: + /* Start display */ + MSG_DBG2("Start display!\n"); + start_pts = pts100 + date; + end_pts = UINT_MAX; + display = 1; + this->is_forced_sub=0; + break; + case 0x02: + /* Stop display */ + MSG_DBG2("Stop display!\n"); + end_pts = pts100 + date; + break; + case 0x03: + /* Palette */ + this->palette[0] = this->packet[off] >> 4; + this->palette[1] = this->packet[off] & 0xf; + this->palette[2] = this->packet[off + 1] >> 4; + this->palette[3] = this->packet[off + 1] & 0xf; + MSG_DBG2("Palette %d, %d, %d, %d\n", + this->palette[0], this->palette[1], this->palette[2], this->palette[3]); + off+=2; + break; + case 0x04: + /* Alpha */ + this->alpha[0] = this->packet[off] >> 4; + this->alpha[1] = this->packet[off] & 0xf; + this->alpha[2] = this->packet[off + 1] >> 4; + this->alpha[3] = this->packet[off + 1] & 0xf; + MSG_DBG2("Alpha %d, %d, %d, %d\n", + this->alpha[0], this->alpha[1], this->alpha[2], this->alpha[3]); + off+=2; + break; + case 0x05: + /* Co-ords */ + a = get_be24(this->packet + off); + b = get_be24(this->packet + off + 3); + start_col = a >> 12; + end_col = a & 0xfff; + width = (end_col < start_col) ? 0 : end_col - start_col + 1; + stride = (width + 7) & ~7; /* Kludge: draw_alpha needs width multiple of 8 */ + start_row = b >> 12; + end_row = b & 0xfff; + height = (end_row < start_row) ? 0 : end_row - start_row /* + 1 */; + MSG_DBG2("Coords col: %d - %d row: %d - %d (%dx%d)\n", + start_col, end_col, start_row, end_row, + width, height); + off+=6; + break; + case 0x06: + /* Graphic lines */ + current_nibble[0] = 2 * get_be16(this->packet + off); + current_nibble[1] = 2 * get_be16(this->packet + off + 2); + MSG_DBG2("Graphic offset 1: %d offset 2: %d\n", + current_nibble[0] / 2, current_nibble[1] / 2); + off+=4; + break; + case 0xff: + /* All done, bye-bye */ + MSG_DBG2("Done!\n"); + return; +// break; + default: + MSG_WARN("spudec: Error determining control type 0x%02x. Skipping %d bytes.\n", + type, next_off - off); + goto next_control; + } + } + next_control: + if (display) { + packet_t *packet = calloc(1, sizeof(packet_t)); + int i; + packet->start_pts = start_pts; + if (end_pts == UINT_MAX && start_off != next_off) { + start_pts = pts100 + get_be16(this->packet + next_off) * 1024; + packet->end_pts = start_pts - 1; + } else packet->end_pts = end_pts; + packet->current_nibble[0] = current_nibble[0]; + packet->current_nibble[1] = current_nibble[1]; + packet->start_row = start_row; + packet->end_row = end_row; + packet->start_col = start_col; + packet->end_col = end_col; + packet->width = width; + packet->height = height; + packet->stride = stride; + packet->control_start = control_start; + for (i=0; i<4; i++) { + packet->alpha[i] = this->alpha[i]; + packet->palette[i] = this->palette[i]; + } + packet->packet = malloc(this->packet_size); + memcpy(packet->packet, this->packet, this->packet_size); + spudec_queue_packet(this, packet); + } + } +} + +static void __FASTCALL__ spudec_decode(spudec_handle_t *this, unsigned int pts100) +{ + if(this->hw_spu) { + vo_mpegpes_t packet = { NULL, 0, 0x20, 0 }; + packet.data = this->packet; + packet.size = this->packet_size; + packet.timestamp = pts100; +// this->hw_spu->draw_frame((uint8_t**)&pkg); + } else + spudec_process_control(this, pts100); +} + +int __FASTCALL__ spudec_changed(any_t* this) +{ + spudec_handle_t * spu = (spudec_handle_t*)this; + return (spu->spu_changed || spu->now_pts > spu->end_pts); +} + +void __FASTCALL__ spudec_assemble(any_t*this, unsigned char *packet, unsigned int len, unsigned int pts100) +{ + spudec_handle_t *spu = (spudec_handle_t*)this; +// spudec_heartbeat(this, pts100); + if (len < 2) { + MSG_WARN("SPUasm: packet too short\n"); + return; + } + spu->packet_pts = pts100; + if (spu->packet_offset == 0) { + unsigned int len2 = get_be16(packet); + // Start new fragment + if (spu->packet_reserve < len2) { + if (spu->packet != NULL) + free(spu->packet); + spu->packet = malloc(len2); + spu->packet_reserve = spu->packet != NULL ? len2 : 0; + } + if (spu->packet != NULL) { + spu->packet_size = len2; + if (len > len2) { + MSG_WARN("SPUasm: invalid frag len / len2: %d / %d \n", len, len2); + return; + } + memcpy(spu->packet, packet, len); + spu->packet_offset = len; + spu->packet_pts = pts100; + } + } else { + // Continue current fragment + if (spu->packet_size < spu->packet_offset + len){ + MSG_WARN("SPUasm: invalid fragment\n"); + spu->packet_size = spu->packet_offset = 0; + return; + } else { + memcpy(spu->packet + spu->packet_offset, packet, len); + spu->packet_offset += len; + } + } +#if 1 + // check if we have a complete packet (unfortunatelly packet_size is bad + // for some disks) + // [cb] packet_size is padded to be even -> may be one byte too long + if ((spu->packet_offset == spu->packet_size) || + ((spu->packet_offset + 1) == spu->packet_size)){ + unsigned int x=0,y; + while(x+4<=spu->packet_offset){ + y=get_be16(spu->packet+x+2); // next control pointer + MSG_DBG2("SPUtest: x=%d y=%d off=%d size=%d\n",x,y,spu->packet_offset,spu->packet_size); + if(x>=4 && x==y){ // if it points to self - we're done! + // we got it! + MSG_DBG2("SPUgot: off=%d size=%d \n",spu->packet_offset,spu->packet_size); + spudec_decode(spu, pts100); + spu->packet_offset = 0; + break; + } + if(y<=x || y>=spu->packet_size){ // invalid? + MSG_WARN("SPUtest: broken packet!!!!! y=%d < x=%d\n",y,x); + spu->packet_size = spu->packet_offset = 0; + break; + } + x=y; + } + // [cb] packet is done; start new packet + spu->packet_offset = 0; + } +#else + if (spu->packet_offset == spu->packet_size) { + spudec_decode(spu, pts100); + spu->packet_offset = 0; + } +#endif +} + +void __FASTCALL__ spudec_reset(any_t*this) // called after seek +{ + spudec_handle_t *spu = (spudec_handle_t*)this; + while (spu->queue_head) + spudec_free_packet(spudec_dequeue_packet(spu)); + spu->now_pts = 0; + spu->end_pts = 0; + spu->packet_size = spu->packet_offset = 0; +} + +void __FASTCALL__ spudec_now_pts(any_t*this, unsigned int pts100) +{ + spudec_handle_t *spu = (spudec_handle_t*) this; + spu->now_pts = pts100; +} + +void __FASTCALL__ spudec_heartbeat(any_t*this, unsigned int pts100) +{ + spudec_handle_t *spu = (spudec_handle_t*) this; + spu->now_pts = pts100; + + while (spu->queue_head != NULL && pts100 >= spu->queue_head->start_pts) { + packet_t *packet = spudec_dequeue_packet(spu); + spu->start_pts = packet->start_pts; + spu->end_pts = packet->end_pts; + if (spu->auto_palette) + compute_palette(spu, packet); + spudec_process_data(spu, packet); + spudec_free_packet(packet); + spu->spu_changed = 1; + } +} + +int __FASTCALL__ spudec_visible(any_t*this){ + spudec_handle_t *spu = (spudec_handle_t *)this; + int ret=(spu->start_pts <= spu->now_pts && + spu->now_pts < spu->end_pts && + spu->height > 0); + return ret; +} + +void __FASTCALL__ spudec_set_forced_subs_only(any_t* const this, const unsigned int flag) +{ + if(this){ + ((spudec_handle_t *)this)->forced_subs_only=flag; + MSG_DBG2("SPU: Display only forced subs now %s\n", flag ? "enabled": "disabled"); + } +} + +void __FASTCALL__ spudec_draw(any_t*this, draw_osd_f draw_alpha,any_t*vo) +{ + 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, + spu->image, spu->aimage, spu->stride); + spu->spu_changed = 0; + } +} + +/* calc the bbox for spudec subs */ +void __FASTCALL__ spudec_calc_bbox(any_t*me, unsigned int dxs, unsigned int dys, unsigned int* bbox) +{ + spudec_handle_t *spu; + spu = (spudec_handle_t *)me; + if (spu->orig_frame_width == 0 || spu->orig_frame_height == 0 + || (spu->orig_frame_width == dxs && spu->orig_frame_height == dys)) { + bbox[0] = spu->start_col; + bbox[1] = spu->start_col + spu->width; + bbox[2] = spu->start_row; + bbox[3] = spu->start_row + spu->height; + } + else if (spu->scaled_frame_width != dxs || spu->scaled_frame_height != dys) { + unsigned int scalex = 0x100 * dxs / spu->orig_frame_width; + unsigned int scaley = 0x100 * dys / spu->orig_frame_height; + bbox[0] = spu->start_col * scalex / 0x100; + bbox[1] = spu->start_col * scalex / 0x100 + spu->width * scalex / 0x100; + switch (spu_alignment) { + case 0: + bbox[3] = dys*sub_data.pos/100 + spu->height * scaley / 0x100; + if (bbox[3] > dys) bbox[3] = dys; + bbox[2] = bbox[3] - spu->height * scaley / 0x100; + break; + case 1: + if (sub_data.pos < 50) { + bbox[2] = dys*sub_data.pos/100 - spu->height * scaley / 0x200; + if ((int)(bbox[2]) < 0) bbox[2] = 0; + bbox[3] = bbox[2] + spu->height; + } else { + bbox[3] = dys*sub_data.pos/100 + spu->height * scaley / 0x200; + if (bbox[3] > dys) bbox[3] = dys; + bbox[2] = bbox[3] - spu->height * scaley / 0x100; + } + break; + case 2: + bbox[2] = dys*sub_data.pos/100 - spu->height * scaley / 0x100; + if ((int)(bbox[2]) < 0) bbox[2] = 0; + bbox[3] = bbox[2] + spu->height; + break; + default: /* -1 */ + bbox[2] = spu->start_row * scaley / 0x100; + bbox[3] = spu->start_row * scaley / 0x100 + spu->height * scaley / 0x100; + break; + } + } +} + +/* transform mplayer's alpha value into an opacity value that is linear */ +static inline int __FASTCALL__ canon_alpha(int alpha) +{ + return alpha ? 256 - alpha : 0; +} + +typedef struct { + unsigned position; + unsigned left_up; + unsigned right_down; +}scale_pixel; + + +static void __FASTCALL__ scale_table(unsigned int start_src, unsigned int start_tar, unsigned int end_src, unsigned int end_tar, scale_pixel * table) +{ + unsigned int t; + unsigned int delta_src = end_src - start_src; + unsigned int delta_tar = end_tar - start_tar; + unsigned int src = 0; + unsigned int src_step; + if (delta_src == 0 || delta_tar == 0) { + return; + } + src_step = (delta_src << 16) / delta_tar >>1; + for (t = 0; t<=delta_tar; src += (src_step << 1), t++){ + table[t].position= MIN(src >> 16, end_src - 1); + table[t].right_down = src & 0xffff; + table[t].left_up = 0x10000 - table[t].right_down; + } +} + +/* bilinear scale, similar to vobsub's code */ +static void __FASTCALL__ scale_image(int x, int y, scale_pixel* table_x, scale_pixel* table_y, spudec_handle_t * spu) +{ + int alpha[4]; + int color[4]; + unsigned int scale[4]; + int base = table_y[y].position * spu->stride + table_x[x].position; + int scaled = y * spu->scaled_stride + x; + alpha[0] = canon_alpha(spu->aimage[base]); + alpha[1] = canon_alpha(spu->aimage[base + 1]); + alpha[2] = canon_alpha(spu->aimage[base + spu->stride]); + alpha[3] = canon_alpha(spu->aimage[base + spu->stride + 1]); + color[0] = spu->image[base]; + color[1] = spu->image[base + 1]; + color[2] = spu->image[base + spu->stride]; + color[3] = spu->image[base + spu->stride + 1]; + scale[0] = (table_x[x].left_up * table_y[y].left_up >> 16) * alpha[0]; + scale[1] = (table_x[x].right_down * table_y[y].left_up >>16) * alpha[1]; + scale[2] = (table_x[x].left_up * table_y[y].right_down >> 16) * alpha[2]; + scale[3] = (table_x[x].right_down * table_y[y].right_down >> 16) * alpha[3]; + spu->scaled_image[scaled] = (color[0] * scale[0] + color[1] * scale[1] + color[2] * scale[2] + color[3] * scale[3])>>24; + spu->scaled_aimage[scaled] = (scale[0] + scale[1] + scale[2] + scale[3]) >> 16; + if (spu->scaled_aimage[scaled]){ + spu->scaled_aimage[scaled] = 256 - spu->scaled_aimage[scaled]; + if(spu->scaled_aimage[scaled] + spu->scaled_image[scaled] > 255) + spu->scaled_image[scaled] = 256 - spu->scaled_aimage[scaled]; + } +} + +void __FASTCALL__ sws_spu_image(unsigned char *d1, unsigned char *d2, int dw, int dh, int ds, + unsigned char *s1, unsigned char *s2, int sw, int sh, int ss) +{ + struct SwsContext *ctx; + static SwsFilter filter; + static int firsttime = 1; + static float oldvar; + int i; + + if (!firsttime && oldvar != spu_gaussvar) sws_freeVec(filter.lumH); + if (firsttime) { + filter.lumH = filter.lumV = + filter.chrH = filter.chrV = sws_getGaussianVec(spu_gaussvar, 3.0); + sws_normalizeVec(filter.lumH, 1.0); + firsttime = 0; + oldvar = spu_gaussvar; + } + + ctx=sws_getContext(sw, sh, pixfmt_from_fourcc(IMGFMT_Y800), dw, dh, pixfmt_from_fourcc(IMGFMT_Y800), SWS_GAUSS, &filter, NULL, NULL); + sws_scale(ctx,&s1,&ss,0,sh,&d1,&ds); + for (i=ss*sh-1; i>=0; i--) if (!s2[i]) s2[i] = 255; //else s2[i] = 1; + sws_scale(ctx,&s2,&ss,0,sh,&d2,&ds); + for (i=ds*dh-1; i>=0; i--) if (d2[i]==0) d2[i] = 1; else if (d2[i]==255) d2[i] = 0; + sws_freeContext(ctx); +} + +void __FASTCALL__ spudec_draw_scaled(any_t*me, unsigned int dxs, unsigned int dys, draw_osd_f draw_alpha,any_t*vo) +{ + spudec_handle_t *spu = (spudec_handle_t *)me; + scale_pixel *table_x; + scale_pixel *table_y; + + if (spu->start_pts <= spu->now_pts && spu->now_pts < spu->end_pts) { + + // check if only forced subtitles are requested + if( (spu->forced_subs_only) && !(spu->is_forced_sub) ){ + return; + } + + if (!(spu_aamode&16) && (spu->orig_frame_width == 0 || spu->orig_frame_height == 0 + || (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, + spu->image, spu->aimage, spu->stride); + spu->spu_changed = 0; + } + } + else { + if (spu->scaled_frame_width != dxs || spu->scaled_frame_height != dys) { /* Resizing is needed */ + /* scaled_x = scalex * x / 0x100 + scaled_y = scaley * y / 0x100 + order of operations is important because of rounding. */ + unsigned int scalex = 0x100 * dxs / spu->orig_frame_width; + unsigned int scaley = 0x100 * dys / spu->orig_frame_height; + spu->scaled_start_col = spu->start_col * scalex / 0x100; + spu->scaled_start_row = spu->start_row * scaley / 0x100; + spu->scaled_width = spu->width * scalex / 0x100; + spu->scaled_height = spu->height * scaley / 0x100; + /* Kludge: draw_alpha needs width multiple of 8 */ + spu->scaled_stride = (spu->scaled_width + 7) & ~7; + if (spu->scaled_image_size < spu->scaled_stride * spu->scaled_height) { + if (spu->scaled_image) { + free(spu->scaled_image); + spu->scaled_image_size = 0; + } + spu->scaled_image = malloc(2 * spu->scaled_stride * spu->scaled_height); + if (spu->scaled_image) { + spu->scaled_image_size = spu->scaled_stride * spu->scaled_height; + spu->scaled_aimage = spu->scaled_image + spu->scaled_image_size; + } + } + if (spu->scaled_image) { + unsigned int x, y; + if (spu->scaled_width <= 1 || spu->scaled_height <= 1) { + goto nothing_to_do; + } + switch(spu_aamode&15) { + case 4: + sws_spu_image(spu->scaled_image, spu->scaled_aimage, + spu->scaled_width, spu->scaled_height, spu->scaled_stride, + spu->image, spu->aimage, spu->width, spu->height, spu->stride); + break; + case 3: + table_x = calloc(spu->scaled_width, sizeof(scale_pixel)); + table_y = calloc(spu->scaled_height, sizeof(scale_pixel)); + if (!table_x || !table_y) { + MSG_FATAL("Fatal: spudec_draw_scaled: calloc failed\n"); + } + scale_table(0, 0, spu->width - 1, spu->scaled_width - 1, table_x); + scale_table(0, 0, spu->height - 1, spu->scaled_height - 1, table_y); + for (y = 0; y < spu->scaled_height; y++) + for (x = 0; x < spu->scaled_width; x++) + scale_image(x, y, table_x, table_y, spu); + free(table_x); + free(table_y); + break; + case 0: + /* no antialiasing */ + for (y = 0; y < spu->scaled_height; ++y) { + int unscaled_y = y * 0x100 / scaley; + int strides = spu->stride * unscaled_y; + int scaled_strides = spu->scaled_stride * y; + for (x = 0; x < spu->scaled_width; ++x) { + int unscaled_x = x * 0x100 / scalex; + spu->scaled_image[scaled_strides + x] = spu->image[strides + unscaled_x]; + spu->scaled_aimage[scaled_strides + x] = spu->aimage[strides + unscaled_x]; + } + } + break; + case 1: + { + /* Intermediate antialiasing. */ + for (y = 0; y < spu->scaled_height; ++y) { + const unsigned int unscaled_top = y * spu->orig_frame_height / dys; + unsigned int unscaled_bottom = (y + 1) * spu->orig_frame_height / dys; + if (unscaled_bottom >= spu->height) + unscaled_bottom = spu->height - 1; + for (x = 0; x < spu->scaled_width; ++x) { + const unsigned int unscaled_left = x * spu->orig_frame_width / dxs; + unsigned int unscaled_right = (x + 1) * spu->orig_frame_width / dxs; + unsigned int color = 0; + unsigned int alpha = 0; + unsigned int walkx, walky; + unsigned int base, tmp; + if (unscaled_right >= spu->width) + unscaled_right = spu->width - 1; + for (walky = unscaled_top; walky <= unscaled_bottom; ++walky) + for (walkx = unscaled_left; walkx <= unscaled_right; ++walkx) { + base = walky * spu->stride + walkx; + tmp = canon_alpha(spu->aimage[base]); + alpha += tmp; + color += tmp * spu->image[base]; + } + base = y * spu->scaled_stride + x; + spu->scaled_image[base] = alpha ? color / alpha : 0; + spu->scaled_aimage[base] = + alpha * (1 + unscaled_bottom - unscaled_top) * (1 + unscaled_right - unscaled_left); + /* spu->scaled_aimage[base] = + alpha * dxs * dys / spu->orig_frame_width / spu->orig_frame_height; */ + if (spu->scaled_aimage[base]) { + spu->scaled_aimage[base] = 256 - spu->scaled_aimage[base]; + if (spu->scaled_aimage[base] + spu->scaled_image[base] > 255) + spu->scaled_image[base] = 256 - spu->scaled_aimage[base]; + } + } + } + } + break; + case 2: + { + /* Best antialiasing. Very slow. */ + /* Any pixel (x, y) represents pixels from the original + rectangular region comprised between the columns + unscaled_y and unscaled_y + 0x100 / scaley and the rows + unscaled_x and unscaled_x + 0x100 / scalex + + The original rectangular region that the scaled pixel + represents is cut in 9 rectangular areas like this: + + +---+-----------------+---+ + | 1 | 2 | 3 | + +---+-----------------+---+ + | | | | + | 4 | 5 | 6 | + | | | | + +---+-----------------+---+ + | 7 | 8 | 9 | + +---+-----------------+---+ + + The width of the left column is at most one pixel and + it is never null and its right column is at a pixel + boundary. The height of the top row is at most one + pixel it is never null and its bottom row is at a + pixel boundary. The width and height of region 5 are + integral values. The width of the right column is + what remains and is less than one pixel. The height + of the bottom row is what remains and is less than + one pixel. + + The row above 1, 2, 3 is unscaled_y. The row between + 1, 2, 3 and 4, 5, 6 is top_low_row. The row between 4, + 5, 6 and 7, 8, 9 is (unsigned int)unscaled_y_bottom. + The row beneath 7, 8, 9 is unscaled_y_bottom. + + The column left of 1, 4, 7 is unscaled_x. The column + between 1, 4, 7 and 2, 5, 8 is left_right_column. The + column between 2, 5, 8 and 3, 6, 9 is (unsigned + int)unscaled_x_right. The column right of 3, 6, 9 is + unscaled_x_right. */ + const double inv_scalex = (double) 0x100 / scalex; + const double inv_scaley = (double) 0x100 / scaley; + for (y = 0; y < spu->scaled_height; ++y) { + const double unscaled_y = y * inv_scaley; + const double unscaled_y_bottom = unscaled_y + inv_scaley; + const unsigned int top_low_row = MIN(unscaled_y_bottom, unscaled_y + 1.0); + const double top = top_low_row - unscaled_y; + const unsigned int height = unscaled_y_bottom > top_low_row + ? (unsigned int) unscaled_y_bottom - top_low_row + : 0; + const double bottom = unscaled_y_bottom > top_low_row + ? unscaled_y_bottom - floor(unscaled_y_bottom) + : 0.0; + for (x = 0; x < spu->scaled_width; ++x) { + const double unscaled_x = x * inv_scalex; + const double unscaled_x_right = unscaled_x + inv_scalex; + const unsigned int left_right_column = MIN(unscaled_x_right, unscaled_x + 1.0); + const double left = left_right_column - unscaled_x; + const unsigned int width = unscaled_x_right > left_right_column + ? (unsigned int) unscaled_x_right - left_right_column + : 0; + const double right = unscaled_x_right > left_right_column + ? unscaled_x_right - floor(unscaled_x_right) + : 0.0; + double color = 0.0; + double alpha = 0.0; + double tmp; + unsigned int base; + /* Now use these informations to compute a good alpha, + and lightness. The sum is on each of the 9 + region's surface and alpha and lightness. + + transformed alpha = sum(surface * alpha) / sum(surface) + transformed color = sum(surface * alpha * color) / sum(surface * alpha) + */ + /* 1: top left part */ + base = spu->stride * (unsigned int) unscaled_y; + tmp = left * top * canon_alpha(spu->aimage[base + (unsigned int) unscaled_x]); + alpha += tmp; + color += tmp * spu->image[base + (unsigned int) unscaled_x]; + /* 2: top center part */ + if (width > 0) { + unsigned int walkx; + for (walkx = left_right_column; walkx < (unsigned int) unscaled_x_right; ++walkx) { + base = spu->stride * (unsigned int) unscaled_y + walkx; + tmp = /* 1.0 * */ top * canon_alpha(spu->aimage[base]); + alpha += tmp; + color += tmp * spu->image[base]; + } + } + /* 3: top right part */ + if (right > 0.0) { + base = spu->stride * (unsigned int) unscaled_y + (unsigned int) unscaled_x_right; + tmp = right * top * canon_alpha(spu->aimage[base]); + alpha += tmp; + color += tmp * spu->image[base]; + } + /* 4: center left part */ + if (height > 0) { + unsigned int walky; + for (walky = top_low_row; walky < (unsigned int) unscaled_y_bottom; ++walky) { + base = spu->stride * walky + (unsigned int) unscaled_x; + tmp = left /* * 1.0 */ * canon_alpha(spu->aimage[base]); + alpha += tmp; + color += tmp * spu->image[base]; + } + } + /* 5: center part */ + if (width > 0 && height > 0) { + unsigned int walky; + for (walky = top_low_row; walky < (unsigned int) unscaled_y_bottom; ++walky) { + unsigned int walkx; + base = spu->stride * walky; + for (walkx = left_right_column; walkx < (unsigned int) unscaled_x_right; ++walkx) { + tmp = /* 1.0 * 1.0 * */ canon_alpha(spu->aimage[base + walkx]); + alpha += tmp; + color += tmp * spu->image[base + walkx]; + } + } + } + /* 6: center right part */ + if (right > 0.0 && height > 0) { + unsigned int walky; + for (walky = top_low_row; walky < (unsigned int) unscaled_y_bottom; ++walky) { + base = spu->stride * walky + (unsigned int) unscaled_x_right; + tmp = right /* * 1.0 */ * canon_alpha(spu->aimage[base]); + alpha += tmp; + color += tmp * spu->image[base]; + } + } + /* 7: bottom left part */ + if (bottom > 0.0) { + base = spu->stride * (unsigned int) unscaled_y_bottom + (unsigned int) unscaled_x; + tmp = left * bottom * canon_alpha(spu->aimage[base]); + alpha += tmp; + color += tmp * spu->image[base]; + } + /* 8: bottom center part */ + if (width > 0 && bottom > 0.0) { + unsigned int walkx; + base = spu->stride * (unsigned int) unscaled_y_bottom; + for (walkx = left_right_column; walkx < (unsigned int) unscaled_x_right; ++walkx) { + tmp = /* 1.0 * */ bottom * canon_alpha(spu->aimage[base + walkx]); + alpha += tmp; + color += tmp * spu->image[base + walkx]; + } + } + /* 9: bottom right part */ + if (right > 0.0 && bottom > 0.0) { + base = spu->stride * (unsigned int) unscaled_y_bottom + (unsigned int) unscaled_x_right; + tmp = right * bottom * canon_alpha(spu->aimage[base]); + alpha += tmp; + color += tmp * spu->image[base]; + } + /* Finally mix these transparency and brightness information suitably */ + base = spu->scaled_stride * y + x; + spu->scaled_image[base] = alpha > 0 ? color / alpha : 0; + spu->scaled_aimage[base] = alpha * scalex * scaley / 0x10000; + if (spu->scaled_aimage[base]) { + spu->scaled_aimage[base] = 256 - spu->scaled_aimage[base]; + if (spu->scaled_aimage[base] + spu->scaled_image[base] > 255) + spu->scaled_image[base] = 256 - spu->scaled_aimage[base]; + } + } + } + } + } +nothing_to_do: + /* Kludge: draw_alpha needs width multiple of 8. */ + if (spu->scaled_width < spu->scaled_stride) + for (y = 0; y < spu->scaled_height; ++y) { + memset(spu->scaled_aimage + y * spu->scaled_stride + spu->scaled_width, 0, + spu->scaled_stride - spu->scaled_width); + } + spu->scaled_frame_width = dxs; + spu->scaled_frame_height = dys; + } + } + if (spu->scaled_image){ + switch (spu_alignment) { + case 0: + spu->scaled_start_row = dys*sub_data.pos/100; + if (spu->scaled_start_row + spu->scaled_height > dys) + spu->scaled_start_row = dys - spu->scaled_height; + break; + case 1: + spu->scaled_start_row = dys*sub_data.pos/100 - spu->scaled_height/2; + if (sub_data.pos < 50) { + if ((int)(spu->scaled_start_row) < 0) spu->scaled_start_row = 0; + } else { + if (spu->scaled_start_row + spu->scaled_height > dys) + spu->scaled_start_row = dys - spu->scaled_height; + } + break; + case 2: + spu->scaled_start_row = dys*sub_data.pos/100 - spu->scaled_height; + 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, + spu->scaled_image, spu->scaled_aimage, spu->scaled_stride); + spu->spu_changed = 0; + } + } + } + else + { + MSG_DBG2("SPU not displayed: start_pts=%d end_pts=%d now_pts=%d\n", + spu->start_pts, spu->end_pts, spu->now_pts); + } +} + +void __FASTCALL__ spudec_update_palette(any_t* this,const unsigned int *palette) +{ + spudec_handle_t *spu = (spudec_handle_t *) this; + if (spu && palette) { + memcpy(spu->global_palette, palette, sizeof(spu->global_palette)); +// if(spu->hw_spu) +// spu->hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette); + } +} + +void __FASTCALL__ spudec_set_font_factor(any_t*this, double factor) +{ + spudec_handle_t *spu = (spudec_handle_t *) this; + spu->font_start_level = (int)(0xF0-(0xE0*factor)); +} + +any_t* __FASTCALL__ spudec_new_scaled(unsigned int *palette, unsigned int frame_width, unsigned int frame_height) +{ + return spudec_new_scaled_vobsub(palette, NULL, 0, frame_width, frame_height); +} + +/* get palette custom color, width, height from .idx file */ +any_t* __FASTCALL__ spudec_new_scaled_vobsub(unsigned int *palette, unsigned int *cuspal, unsigned int custom, unsigned int frame_width, unsigned int frame_height) +{ + spudec_handle_t *this = calloc(1, sizeof(spudec_handle_t)); + if (this){ + //(fprintf(stderr,"VobSub Custom Palette: %d,%d,%d,%d", this->cuspal[0], this->cuspal[1], this->cuspal[2],this->cuspal[3]); + this->packet = NULL; + this->image = NULL; + this->scaled_image = NULL; + /* XXX Although the video frame is some size, the SPU frame is + always maximum size i.e. 720 wide and 576 or 480 high */ + this->orig_frame_width = 720; + this->orig_frame_height = (frame_height == 480 || frame_height == 240) ? 480 : 576; + this->custom = custom; + // set up palette: + this->auto_palette = 1; + if (palette){ + memcpy(this->global_palette, palette, sizeof(this->global_palette)); + this->auto_palette = 0; + } + this->custom = custom; + if (custom && cuspal) { + memcpy(this->cuspal, cuspal, sizeof(this->cuspal)); + this->auto_palette = 0; + } + // forced subtitles default: show all subtitles + this->forced_subs_only=0; + this->is_forced_sub=0; + } + else + MSG_FATAL("FATAL: spudec_init: calloc"); + return this; +} + +any_t* __FASTCALL__ spudec_new(unsigned int *palette) +{ + return spudec_new_scaled(palette, 0, 0); +} + +void __FASTCALL__ spudec_free(any_t*this) +{ + spudec_handle_t *spu = (spudec_handle_t*)this; + if (spu) { + while (spu->queue_head) + spudec_free_packet(spudec_dequeue_packet(spu)); + if (spu->packet) + free(spu->packet); + if (spu->scaled_image) + free(spu->scaled_image); + if (spu->image) + free(spu->image); + free(spu); + } +} + +void __FASTCALL__ spudec_set_hw_spu(any_t*this, vo_functions_t *hw_spu) +{ + spudec_handle_t *spu = (spudec_handle_t*)this; + if (!spu) + return; + spu->hw_spu = hw_spu; +// hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette); +} Copied: mplayerxp/libmpsub/spudec.h (from rev 192, mplayerxp/spudec.h) =================================================================== --- mplayerxp/libmpsub/spudec.h (rev 0) +++ mplayerxp/libmpsub/spudec.h 2012-10-25 06:26:33 UTC (rev 197) @@ -0,0 +1,30 @@ +#ifndef _MPLAYER_SPUDEC_H +#define _MPLAYER_SPUDEC_H + +#include "libvo/video_out.h" +#include "libvo/sub.h" + +extern int spu_alignment; +extern int spu_aamode; +extern float spu_gaussvar; + +void __FASTCALL__ spudec_heartbeat(any_t*_this, unsigned int pts100); +void __FASTCALL__ spudec_now_pts(any_t*_this, unsigned int pts100); +void __FASTCALL__ spudec_assemble(any_t*_this, unsigned char *packet, unsigned int len, unsigned int pts100); +void __FASTCALL__ spudec_draw(any_t*this, draw_osd_f draw_alpha,any_t* vo); +void __FASTCALL__ spudec_draw_scaled(any_t*_this, unsigned int dxs, unsigned int dys,draw_osd_f draw_alpha,any_t* vo); +void __FASTCALL__ spudec_update_palette(any_t*_this,const unsigned int *palette); +any_t* __FASTCALL__ spudec_new_scaled(unsigned int *palette, unsigned int frame_width, unsigned int frame_height); +any_t* __FASTCALL__ spudec_new_scaled_vobsub(unsigned int *palette, unsigned int *cuspal, unsigned int custom, unsigned int frame_width, unsigned int frame_height); +any_t* __FASTCALL__ spudec_new(unsigned int *palette); +void __FASTCALL__ spudec_free(any_t*_this); +void __FASTCALL__ spudec_reset(any_t*_this); // called after seek +int __FASTCALL__ spudec_visible(any_t*_this); // check if spu is visible +void __FASTCALL__ spudec_set_font_factor(any_t*_this, double factor); // sets the equivalent to ffactor +void __FASTCALL__ spudec_set_hw_spu(any_t*_this, vo_functions_t *hw_spu); +int __FASTCALL__ spudec_changed(any_t*_this); +void __FASTCALL__ spudec_calc_bbox(any_t*me, unsigned int dxs, unsigned int dys, unsigned int* bbox); +void __FASTCALL__ spudec_set_forced_subs_only(any_t* const _this, const unsigned int flag); + +#endif + Copied: mplayerxp/libmpsub/subreader.c (from rev 184, mplayerxp/subreader.c) =================================================================== --- mplayerxp/libmpsub/subreader.c (rev 0) +++ mplayerxp/libmpsub/subreader.c 2012-10-25 06:26:33 UTC (rev 197) @@ -0,0 +1,886 @@ +/* + * Subtitle reader with format autodetection + * + * Written by laaz + * Some code cleanup & realloc() by A'rpi/ESP-team + * dunnowhat sub format by szabi + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include "mp_config.h" +#include "subreader.h" +#include "libvo/sub.h" + +#define ERR ((any_t*) -1) + +#ifdef USE_ICONV +#ifdef HAVE_GICONV +#include <giconv.h> +#else +#include <iconv.h> +#endif +#endif +#define MSGT_CLASS MSGT_SUBREADER +#include "__mp_msg.h" + +/* Maximal length of line of a subtitle */ +#define LINE_LEN 1000 + +static float mpsub_position=0; + +int sub_uses_time=0; +int sub_errs=0; +int sub_num=0; // number of subtitle structs +int sub_slacktime=2000; // 20 seconds + +/* Use the SUB_* constant defined in the header file */ +int sub_format=SUB_INVALID; + +static int __FASTCALL__ eol(char p) { + return (p=='\r' || p=='\n' || p=='\0'); +} + +/* Remove leading and trailing space */ +static void __FASTCALL__ trail_space(char *s) { + int i = 0; + while (isspace(s[i])) ++i; + if (i) strcpy(s, s + i); + i = strlen(s) - 1; + while (i > 0 && isspace(s[i])) s[i--] = '\0'; +} + + +static subtitle * __FASTCALL__ sub_read_line_sami(FILE *fd, subtitle *current) { + static char line[LINE_LEN+1]; + static char *s = NULL, *slacktime_s; + char text[LINE_LEN+1], *p=NULL, *q; + int state; + + current->lines = current->start = current->end = 0; + state = 0; + + /* read the first line */ + if (!s) + if (!(s = fgets(line, LINE_LEN, fd))) return 0; + + do { + switch (state) { + + case 0: /* find "START=" or "Slacktime:" */ + slacktime_s = strstr (s, "Slacktime:"); + if (slacktime_s) sub_slacktime = strtol (slacktime_s + 10, NULL, 0) / 10; + + s = strstr (s, "Start="); + if (s) { + current->start = strtol (s + 6, &s, 0) / 10; + state = 1; continue; + } + break; + + case 1: /* find "<P" */ + if ((s = strstr (s, "<P"))) { s += 2; state = 2; continue; } + break; + + case 2: /* find ">" */ + if ((s = strchr (s, '>'))) { s++; state = 3; p = text; continue; } + break; + + case 3: /* get all text until '<' appears */ + if (*s == '\0') break; + else if (!strncasecmp (s, "<br>",... [truncated message content] |
From: <nic...@us...> - 2012-10-25 09:12:17
|
Revision: 203 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=203&view=rev Author: nickols_k Date: 2012-10-25 09:12:05 +0000 (Thu, 25 Oct 2012) Log Message: ----------- cleanup general headers Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/dec_ahead.h mplayerxp/libmpcodecs/ad_ffmp3.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_mov.c mplayerxp/libmpdemux/demuxer.c mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/stheader.h mplayerxp/libmpdemux/video.c mplayerxp/mplayer.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-25 09:10:31 UTC (rev 202) +++ mplayerxp/dec_ahead.c 2012-10-25 09:12:05 UTC (rev 203) @@ -119,8 +119,6 @@ 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 */ -volatile float dec_ahead_seek_num_frames=0; /* frames played after seek */ -volatile int dec_ahead_seek_num_frames_decoded=0; /* frames decoded after seek */ static pthread_t pthread_id=0; static pthread_attr_t our_attr; @@ -307,12 +305,7 @@ xp_core.in_lseek=Seek; } pinfo[_xp_id].current_module = "dec_ahead 1"; - if(xp_core.in_lseek==Seek) { - /* Get info from player after a seek */ - //*((char*)0x100) = 1; // Testing crash - sh_video->num_frames = dec_ahead_seek_num_frames; - sh_video->num_frames_decoded = dec_ahead_seek_num_frames_decoded; - } + /* get it! */ #if 0 /* prevent reent access to non-reent demuxer */ @@ -410,8 +403,6 @@ 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->fra[idx].num_frames = sh_video->num_frames; - xp_core.video->fra[idx].frame_no = sh_video->num_frames_decoded; if(!xp_is_bad_pts) { int _idx = dae_prev_vdecoded(); xp_core.video->fra[_idx].duration=v_pts-xp_core.video->fra[_idx].v_pts; Modified: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2012-10-25 09:10:31 UTC (rev 202) +++ mplayerxp/dec_ahead.h 2012-10-25 09:12:05 UTC (rev 203) @@ -28,8 +28,6 @@ float duration; /* frame duration */ float v_pts; /* presentation time-stamp from input stream */ float stream_pts; /* real stream's PTS mainly for OSD */ - float num_frames; /* ??? is it really needed */ - long long int frame_no; /* total number of frame */ }frame_attr_t; typedef struct dec_ahead_engine_s { @@ -112,8 +110,6 @@ extern int xp_audio_eof; extern int xp_is_bad_pts; -extern volatile float dec_ahead_seek_num_frames; // frames played after seek -extern volatile int dec_ahead_seek_num_frames_decoded; // frames decoded after seek extern volatile int dec_ahead_can_aseek; extern int ao_da_buffs; /* Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-25 09:10:31 UTC (rev 202) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2012-10-25 09:12:05 UTC (rev 203) @@ -93,16 +93,6 @@ return 0; } MSG_V("INFO: libavcodec init OK!\n"); - if(sh_audio->format==0x3343414D){ - // MACE 3:1 - sh_audio->ds->ss_div = 2*3; // 1 samples/packet - sh_audio->ds->ss_mul = 2*sh_audio->wf->nChannels; // 1 byte*ch/packet - } else - if(sh_audio->format==0x3643414D){ - // MACE 6:1 - sh_audio->ds->ss_div = 2*6; // 1 samples/packet - sh_audio->ds->ss_mul = 2*sh_audio->wf->nChannels; // 1 byte*ch/packet - } // Decode at least 1 byte: (to get header filled) x=decode(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size,&pts); Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-10-25 09:10:31 UTC (rev 202) +++ mplayerxp/libmpdemux/demux_avi.c 2012-10-25 09:12:05 UTC (rev 203) @@ -1393,8 +1393,7 @@ int id=((AVIINDEXENTRY *)priv->idx)[i].ckid; if(avi_stream_id(id)==d_video->id) ++d_video->pack_no; } - priv->video_pack_no= - sh_video->num_frames=sh_video->num_frames_decoded=d_video->pack_no; + priv->video_pack_no=d_video->pack_no; priv->avi_video_pts=d_video->pack_no*(float)sh_video->video.dwScale/(float)sh_video->video.dwRate; d_video->pos=video_chunk_pos; Modified: mplayerxp/libmpdemux/demux_mov.c =================================================================== --- mplayerxp/libmpdemux/demux_mov.c 2012-10-25 09:10:31 UTC (rev 202) +++ mplayerxp/libmpdemux/demux_mov.c 2012-10-25 09:12:05 UTC (rev 203) @@ -290,6 +290,9 @@ mov_track_t* tracks[MOV_MAX_TRACKS]; int timescale; // movie timescale int duration; // movie duration (in movie timescale units) +/* ---- mov (!!! ALWAYS 0 !!!) ----- */ + unsigned int ss_mul; /**< compression ratio for packet descriptor */ + unsigned int ss_div; /**< compression ratio for packet descriptor */ } mov_priv_t; #define MOV_FOURCC(a,b,c,d) ((a<<24)|(b<<16)|(c<<8)|(d)) @@ -299,11 +302,11 @@ int no=0; unsigned ver; mov_priv_t* priv=malloc(sizeof(mov_priv_t)); - + MSG_V("Checking for MOV\n"); - + memset(priv,0,sizeof(mov_priv_t)); - + while(1){ int i; int skipped=8; @@ -1945,10 +1948,10 @@ // x*=char2int(trak->stdata,32); // bytes/packet x*=char2int(trak->stdata,36); // bytes/frame } else { - if(ds->ss_div && ds->ss_mul){ + if(priv->ss_div && priv->ss_mul){ // workaround for buggy files like 7up-high-traffic-areas.mov, // with missing stsd v1 header containing compression rate - x/=ds->ss_div; x*=ds->ss_mul; // compression ratio fix ! HACK ! + x/=priv->ss_div; x*=priv->ss_mul; // compression ratio fix ! HACK ! } else { x*=trak->nchannels; x*=trak->samplebytes; Modified: mplayerxp/libmpdemux/demuxer.c =================================================================== --- mplayerxp/libmpdemux/demuxer.c 2012-10-25 09:10:31 UTC (rev 202) +++ mplayerxp/libmpdemux/demuxer.c 2012-10-25 09:12:05 UTC (rev 203) @@ -110,7 +110,7 @@ int demux_aid_vid_mismatch = 0; -demux_stream_t* new_demuxer_stream(struct demuxer_st *demuxer,int id){ +demux_stream_t* new_demuxer_stream(struct demuxer_s *demuxer,int id){ demux_stream_t* ds=malloc(sizeof(demux_stream_t)); ds->buffer_pos=ds->buffer_size=0; ds->buffer=NULL; @@ -130,8 +130,6 @@ ds->asf_seq=-1; ds->asf_packet=NULL; //---------------- - ds->ss_mul=ds->ss_div=0; -//---------------- ds->sh=NULL; ds->pts_flags=0; ds->prev_pts=ds->pts_corr=0; Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-10-25 09:10:31 UTC (rev 202) +++ mplayerxp/libmpdemux/demuxer.h 2012-10-25 09:12:05 UTC (rev 203) @@ -52,46 +52,43 @@ /** Describes demuxer's packet */ typedef struct demux_packet_st { - int len; /**< length of packet's data */ - float pts; /**< Presentation Time-Stamp (PTS) of data */ - off_t pos; /**< Position in index (AVI) or file (MPG) */ - unsigned char* buffer; /**< buffer of packet's data */ - int flags; /**< 1 - indicates keyframe, 0 - regular frame */ - struct demux_packet_st* next; /**< pointer to the next packet in chain */ + int len; /**< length of packet's data */ + float pts; /**< Presentation Time-Stamp (PTS) of data */ + off_t pos; /**< Position in index (AVI) or file (MPG) */ + unsigned char* buffer; /**< buffer of packet's data */ + int flags; /**< 1 - indicates keyframe, 0 - regular frame */ + struct demux_packet_st* next; /**< pointer to the next packet in chain */ } demux_packet_t; /** Describes interface to stream associated with this demuxer */ -typedef struct { - int buffer_pos; /**< current buffer position */ - int buffer_size; /**< current buffer size */ - unsigned char* buffer; /**< current buffer */ - float pts; /**< current buffer's PTS */ - int pts_bytes; /**< number of bytes read after last pts stamp */ - int eof; /**< end of demuxed stream? (true if all buffer empty) */ - off_t pos; /**< position in the input stream (file) */ - off_t dpos; /**< position in the demuxed stream */ - int pack_no; /**< serial number of packet */ - int flags; /**< flags of current packet (keyframe etc) */ +typedef struct demux_stream_s { + int id; /**< stream ID (for multiple audio/video streams) */ + int buffer_pos; /**< current buffer position */ + int buffer_size; /**< current buffer size */ + unsigned char* buffer; /**< current buffer */ + float pts; /**< current buffer's PTS */ + int pts_bytes; /**< number of bytes read after last pts stamp */ + int eof; /**< end of demuxed stream? (true if all buffer empty) */ + off_t pos; /**< position in the input stream (file) */ + off_t dpos; /**< position in the demuxed stream */ + int pack_no; /**< serial number of packet */ + int flags; /**< flags of current packet (keyframe etc) */ /*---------------*/ - int packs; /**< number of packets in buffer */ - int bytes; /**< total bytes of packets in buffer */ - demux_packet_t *first; /**< read to current buffer from here */ - demux_packet_t *last; /**< append new packets from input stream to here */ - demux_packet_t *current; /**< needed for refcounting of the buffer */ - int id; /**< stream ID (for multiple audio/video streams) */ - struct demuxer_st *demuxer; /**< parent demuxer structure (stream handler) */ + int packs; /**< number of packets in buffer */ + int bytes; /**< total bytes of packets in buffer */ + demux_packet_t* first; /**< read to current buffer from here */ + demux_packet_t* last; /**< append new packets from input stream to here */ + demux_packet_t* current; /**< needed for refcounting of the buffer */ + struct demuxer_s* demuxer; /**< parent demuxer structure (stream handler) */ /* ---- asf ----- */ - demux_packet_t *asf_packet; /**< read asf fragments here */ - int asf_seq; /**< sequence id associated with asf_packet */ -/* ---- mov ----- */ - unsigned int ss_mul; /**< compression ratio for packet descriptor */ - unsigned int ss_div; /**< compression ratio for packet descriptor */ + demux_packet_t* asf_packet; /**< read asf fragments here */ + int asf_seq; /**< sequence id associated with asf_packet */ /*---------------*/ - any_t* sh; /**< Stream header associated with this stream (@see st_header.h for detail) */ + any_t* sh; /**< Stream header associated with this stream (@see st_header.h for detail) */ /*---------------*/ - float prev_pts; /**< PTS of previous packet (DVD's PTS correction) */ - float pts_corr; /**< PTS correction (DVD's PTS correction) */ - int pts_flags; /**< PTS flags like trigger for correction applying (DVD's PTS correction) */ + float prev_pts; /**< PTS of previous packet (DVD's PTS correction) */ + float pts_corr; /**< PTS correction (DVD's PTS correction) */ + int pts_flags; /**< PTS flags like trigger for correction applying (DVD's PTS correction) */ } demux_stream_t; extern demux_stream_t *d_audio; @@ -104,25 +101,25 @@ #define DEMUXF_SEEKABLE 0x00000001UL /** Describes demuxer (demultiplexer) of movie */ -typedef struct demuxer_st { - stream_t *stream; /**< stream for movie reading */ - demux_stream_t *audio;/**< audio buffer/demuxer */ - demux_stream_t *video;/**< video buffer/demuxer */ - demux_stream_t *sub; /**< DVD's subtitle buffer/demuxer */ - any_t* a_streams[MAX_A_STREAMS]; /**< audio streams (sh_audio_t) for multilanguage movies */ - any_t* v_streams[MAX_V_STREAMS]; /**< video streams (sh_video_t) for multipicture movies */ - char s_streams[MAX_S_STREAMS]; /**< DVD's subtitles (flag) streams for multilanguage movies */ - off_t filepos; /**< current pos. of input stream */ - off_t movi_start; /**< real start of movie within of stream */ - off_t movi_end; /**< real end of movie within of stream */ - unsigned movi_length; /**< length of movie in secs. Optional!*/ - unsigned flags; /**< set of DEMUXF_* bits */ - unsigned file_format; /**< file format: DEMUXER_TYPE_*(mpeg/avi/asf). Will be replaced with properties in the further versions */ - int synced; /**< indicates stream synchronisation. TODO: mpg->priv */ +typedef struct demuxer_s { + stream_t* stream; /**< stream for movie reading */ + demux_stream_t* audio; /**< audio buffer/demuxer */ + demux_stream_t* video; /**< video buffer/demuxer */ + demux_stream_t* sub; /**< DVD's subtitle buffer/demuxer */ + any_t* a_streams[MAX_A_STREAMS]; /**< audio streams (sh_audio_t) for multilanguage movies */ + any_t* v_streams[MAX_V_STREAMS]; /**< video streams (sh_video_t) for multipicture movies */ + char s_streams[MAX_S_STREAMS]; /**< DVD's subtitles (flag) streams for multilanguage movies */ + off_t filepos; /**< current pos. of input stream */ + off_t movi_start; /**< real start of movie within of stream */ + off_t movi_end; /**< real end of movie within of stream */ + unsigned movi_length; /**< length of movie in secs. Optional!*/ + unsigned flags; /**< set of DEMUXF_* bits */ + unsigned file_format; /**< file format: DEMUXER_TYPE_*(mpeg/avi/asf). Will be replaced with properties in the further versions */ + int synced; /**< indicates stream synchronisation. TODO: mpg->priv */ - any_t* priv; /**< private data of demuxer's driver.*/ - any_t* info; /**< human-readable info from stream/movie (like movie name,author,duration)*/ - struct demuxer_driver_s* driver; /**< driver associated with this demuxer */ + any_t* priv; /**< private data of demuxer's driver.*/ + any_t* info; /**< human-readable info from stream/movie (like movie name,author,duration)*/ + struct demuxer_driver_s* driver; /**< driver associated with this demuxer */ } demuxer_t; /* Return values for control interface */ @@ -201,7 +198,7 @@ } demux_packet_t* clone_demux_packet(demux_packet_t* pack); -demux_stream_t* new_demuxer_stream(struct demuxer_st *demuxer,int id); +demux_stream_t* new_demuxer_stream(struct demuxer_s *demuxer,int id); demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id); void free_demuxer_stream(demux_stream_t *ds); #define FREE_DEMUXER_STREAM(d) { free_demuxer_stream(d); d=NULL; } Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-10-25 09:10:31 UTC (rev 202) +++ mplayerxp/libmpdemux/stheader.h 2012-10-25 09:12:05 UTC (rev 203) @@ -9,86 +9,82 @@ #include "../mp_image.h" -typedef struct { - int aid; - demux_stream_t *ds; - unsigned int format; - struct codecs_st *codec; - int inited; - // output format: - float timer; // value of old a_frame - unsigned samplerate; - unsigned samplesize; - unsigned channels; - unsigned o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec) - unsigned i_bps; // == bitrate (compressed bytes/sec) - // in buffers: - char* a_in_buffer; - int a_in_buffer_len; - unsigned a_in_buffer_size; +typedef struct sh_audio_s { + int aid; + demux_stream_t* ds; + unsigned int format; + struct codecs_st* codec; + int inited; +// output format: + float timer; // value of old a_frame + unsigned samplerate; + unsigned samplesize; + unsigned channels; + unsigned o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec) + unsigned i_bps; // == bitrate (compressed bytes/sec) +// in buffers: + char* a_in_buffer; + int a_in_buffer_len; + unsigned a_in_buffer_size; - // out buffers: - char* a_buffer; - int a_buffer_len; - unsigned a_buffer_size; +// out buffers: + char* a_buffer; + int a_buffer_len; + unsigned a_buffer_size; - /* filter buffer */ - any_t* afilter; - int afilter_inited; - unsigned af_bps; // == samplerate*samplesize*channels (after filters bytes/sec) - char * af_buffer; - unsigned af_buffer_len; - float af_pts; +/* filter buffer */ + any_t* afilter; + int afilter_inited; + unsigned af_bps; // == samplerate*samplesize*channels (after filters bytes/sec) + char* af_buffer; + unsigned af_buffer_len; + float af_pts; - int sample_format; - float a_pts; - int a_pts_pos; - int chapter_change; - // win32 codec stuff: - AVIStreamHeader audio; - WAVEFORMATEX *wf; + int sample_format; + float a_pts; + int a_pts_pos; + int chapter_change; +// win32 codec stuff: + AVIStreamHeader audio; + WAVEFORMATEX* wf; // char wf_ext[64]; // in format - unsigned audio_in_minsize; - unsigned audio_out_minsize; - // other codecs: - any_t* context; // codec-specific stuff (usually HANDLE or struct pointer) - unsigned char *codecdata; - unsigned codecdata_len; + unsigned audio_in_minsize; + unsigned audio_out_minsize; +// other codecs: + any_t* context; // codec-specific stuff (usually HANDLE or struct pointer) + unsigned char* codecdata; + unsigned codecdata_len; } sh_audio_t; -typedef struct { - int vid; - demux_stream_t *ds; - unsigned int format; - struct codecs_st *codec; - int inited; - int is_static; /* default: 0 - means movie; 1 - means picture (.jpg ...)*/ - // output format: - float timer; // value of old v_frame - float fps; - float frametime; // 1/fps - int chapter_change; - unsigned i_bps; // == bitrate (compressed bytes/sec) - unsigned disp_w,disp_h;// display size (filled by fileformat parser) +typedef struct sh_video_s { + int vid; + demux_stream_t* ds; + unsigned int format; + struct codecs_st* codec; + int inited; + int is_static; /* default: 0 - means movie; 1 - means picture (.jpg ...)*/ +// output format: + float timer; // value of old v_frame + float fps; + float frametime; // 1/fps + int chapter_change; + unsigned i_bps; // == bitrate (compressed bytes/sec) + unsigned disp_w,disp_h;// display size (filled by fileformat parser) // int coded_w,coded_h; // coded size (filled by video codec) - float aspect; - unsigned int outfmtidx; - /* vfilter chan */ - any_t*vfilter; - int vfilter_inited; - int vf_flags; - pthread_mutex_t mutex; - unsigned active_slices; + float aspect; + unsigned int outfmtidx; +/* vfilter chan */ + any_t* vfilter; + int vfilter_inited; + int vf_flags; + unsigned active_slices; // used in dec_video+vd_ffmpeg only!!! // unsigned int bitrate; - // buffers: - float num_frames; // number of frames played - int num_frames_decoded; // number of frames decoded - mp_image_t *image; - // win32 codec stuff: - AVIStreamHeader video; - BITMAPINFOHEADER *bih; // in format - any_t* context; // codec-specific stuff (usually HANDLE or struct pointer) - any_t* ImageDesc; // for quicktime codecs + mp_image_t* image; +// win32 codec stuff: + AVIStreamHeader video; + BITMAPINFOHEADER* bih; // in format + any_t* context; // codec-specific stuff (usually HANDLE or struct pointer) + any_t* ImageDesc; // for quicktime codecs } sh_video_t; sh_audio_t* get_sh_audio(demuxer_t *demuxer,int id); @@ -104,3 +100,4 @@ int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,float *v_pts,unsigned char** start,int force_fps); #endif + Modified: mplayerxp/libmpdemux/video.c =================================================================== --- mplayerxp/libmpdemux/video.c 2012-10-25 09:10:31 UTC (rev 202) +++ mplayerxp/libmpdemux/video.c 2012-10-25 09:12:05 UTC (rev 203) @@ -534,12 +534,10 @@ } // Increase video timers: - sh_video->num_frames+=frame_time; - ++sh_video->num_frames_decoded; - frame_time*=sh_video->frametime; + /* override frame_time for variable/unknown FPS formats: */ - if(!force_fps) + if(!force_fps) switch(demuxer->file_format) { case DEMUXER_TYPE_REAL: Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-25 09:10:31 UTC (rev 202) +++ mplayerxp/mplayer.c 2012-10-25 09:12:05 UTC (rev 203) @@ -1176,11 +1176,11 @@ //================= Update OSD ==================== static void __show_status_line(float a_pts,float video_pts,float delay,float AV_delay,video_stat_t *vstat) { MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d %d [frms: [%i]]\n", - a_pts-delay,video_pts,AV_delay,c_total, - (int)sh_video->num_frames,sh_video->num_frames_decoded, - (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0, - (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0, - (sh_video->timer>0.5)?(100.0*(audio_time_usage+audio_decode_time_usage)/(double)sh_video->timer):0 + a_pts-delay,video_pts,AV_delay,c_total + ,xp_core.video->num_played_frames,xp_core.video->num_decoded_frames + ,(sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0 + ,(sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0 + ,(sh_video->timer>0.5)?(100.0*(audio_time_usage+audio_decode_time_usage)/(double)sh_video->timer):0 ,vstat->drop_frame_cnt ,output_quality ,dae_curr_vplayed() @@ -1217,7 +1217,7 @@ ,a_pts ,sh_video->timer ,a_pts-sh_video->timer,0.0 - ,(int)sh_video->num_frames,sh_video->num_frames_decoded + ,xp_core.video->num_played_frames,xp_core.video->num_decoded_frames ,(sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0 ,(sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0 ,(sh_video->timer>0.5)?(100.0*(audio_time_usage+audio_decode_time_usage)/(double)sh_video->timer):0 @@ -1227,7 +1227,7 @@ } else MSG_STATUS("V:%6.1f %3d %2d%% %2d%% %4.1f%% %d %d\r" ,v_pts - ,(int)sh_video->num_frames + ,xp_core.video->num_played_frames ,(sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0 ,(sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0 ,(sh_video->timer>0.5)?(100.0*(audio_time_usage+audio_decode_time_usage)/(double)sh_video->timer):0 @@ -1259,8 +1259,6 @@ shva=dae_played_fra(xp_core.video); - sh_video->num_frames = shva.num_frames; - sh_video->num_frames_decoded = shva.frame_no; *v_pts = shva.v_pts; /*------------------------ frame decoded. --------------------*/ @@ -1458,11 +1456,6 @@ } if(seek_rval){ mpxp_seek_time = GetTimerMS(); - if(sh_video) { - // Send back frame info to decoding thread - dec_ahead_seek_num_frames = sh_video->num_frames; - dec_ahead_seek_num_frames_decoded = sh_video->num_frames_decoded; - } // success: /* FIXME there should be real seeking for vobsub */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-25 16:38:39
|
Revision: 206 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=206&view=rev Author: nickols_k Date: 2012-10-25 16:38:33 +0000 (Thu, 25 Oct 2012) Log Message: ----------- simplify code Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/mplayer.c mplayerxp/sig_hand.c Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-25 16:13:12 UTC (rev 205) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-25 16:38:33 UTC (rev 206) @@ -335,10 +335,10 @@ spudec_heartbeat(vo_data->spudec,90000*v_pts); if (vo_data->vobsub) { if (v_pts >= 0) { - while((len=vobsub_get_packet(vo_data->vobsub, v_pts,(any_t**)&packet, ×tamp))>0){ - timestamp -= (v_pts - sh_video->timer)*90000; - MSG_V("\rVOB sub: len=%d v_pts=%5.3f v_timer=%5.3f sub=%5.3f ts=%d \n",len,v_pts,sh_video->timer,timestamp / 90000.0,timestamp); - spudec_assemble(vo_data->spudec,packet,len,90000*d_dvdsub->pts); + while((len=vobsub_get_packet(vo_data->vobsub, v_pts,(any_t**)&packet, ×tamp))>0){ + timestamp -= (v_pts - sh_video->timer)*90000; + MSG_V("\rVOB sub: len=%d v_pts=%5.3f v_timer=%5.3f sub=%5.3f ts=%d \n",len,v_pts,sh_video->timer,timestamp / 90000.0,timestamp); + spudec_assemble(vo_data->spudec,packet,len,90000*d_dvdsub->pts); } } } else { Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-25 16:13:12 UTC (rev 205) +++ mplayerxp/mplayer.c 2012-10-25 16:38:33 UTC (rev 206) @@ -1095,13 +1095,6 @@ return eof; } -typedef struct -{ - int drop_frame_cnt; - int too_slow_frame_cnt; - int too_fast_frame_cnt; -}video_stat_t; - #ifdef USE_OSD void update_osd( float v_pts ) @@ -1144,21 +1137,20 @@ #endif //================= Update OSD ==================== -static void __show_status_line(float a_pts,float video_pts,float delay,float AV_delay,video_stat_t *vstat) { - MSG_STATUS("A:%6.1f V:%6.1f A-V:%7.3f ct:%7.3f %3d/%3d %2d%% %2d%% %4.1f%% %d %d [frms: [%i]]\n", +static void __show_status_line(float a_pts,float video_pts,float delay,float AV_delay) { + 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,video_pts,AV_delay,c_total ,xp_core.video->num_played_frames,xp_core.video->num_decoded_frames ,(sh_video->timer>0.5)?(int)(100.0*time_usage.video/(double)sh_video->timer):0 ,(sh_video->timer>0.5)?(int)(100.0*time_usage.vout/(double)sh_video->timer):0 ,(sh_video->timer>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)sh_video->timer):0 - ,vstat->drop_frame_cnt ,output_quality ,dae_curr_vplayed() ); fflush(stdout); } -static void show_status_line(float v_pts,float AV_delay,video_stat_t *vstat) { +static void show_status_line(float v_pts,float AV_delay) { float a_pts=0; float delay=ao_get_delay(ao_data); float video_pts = v_pts; @@ -1177,13 +1169,13 @@ } if( !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,vstat); + __show_status_line(a_pts,video_pts,delay,AV_delay); } -static void show_status_line_no_apts(float v_pts,video_stat_t *vstat) { +static void show_status_line_no_apts(float v_pts) { if(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 %d\r" + 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 ,sh_video->timer ,a_pts-sh_video->timer,0.0 @@ -1191,17 +1183,15 @@ ,(sh_video->timer>0.5)?(int)(100.0*time_usage.video/(double)sh_video->timer):0 ,(sh_video->timer>0.5)?(int)(100.0*time_usage.vout/(double)sh_video->timer):0 ,(sh_video->timer>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)sh_video->timer):0 - ,vstat->drop_frame_cnt ,output_quality ); } else - MSG_STATUS("V:%6.1f %3d %2d%% %2d%% %4.1f%% %d %d\r" + MSG_STATUS("V:%6.1f %3d %2d%% %2d%% %4.1f%% %d\r" ,v_pts ,xp_core.video->num_played_frames ,(sh_video->timer>0.5)?(int)(100.0*time_usage.video/(double)sh_video->timer):0 ,(sh_video->timer>0.5)?(int)(100.0*time_usage.vout/(double)sh_video->timer):0 ,(sh_video->timer>0.5)?(100.0*(time_usage.audio+time_usage.audio_decode)/(double)sh_video->timer):0 - ,vstat->drop_frame_cnt ,output_quality ); fflush(stdout); @@ -1212,7 +1202,7 @@ int info_factor; }osd_args_t; -int mpxp_play_video( int rtc_fd, video_stat_t *vstat, float *aq_sleep_time, float *v_pts ) +int mpxp_play_video( int rtc_fd, float *v_pts ) { float time_frame=0; float AV_delay=0; /* average of A-V timestamp differences */ @@ -1294,7 +1284,6 @@ nosound_model: time_frame=shva_prev.duration; } - (*aq_sleep_time)=0; /* we have other way to control that */ if(mp_conf.benchmark && time_frame < 0 && time_frame < max_av_resync) max_av_resync=time_frame; 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 */ @@ -1303,7 +1292,7 @@ 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,vstat); + 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; @@ -1406,16 +1395,16 @@ if(mp_conf.xp>=XP_VAPlay) pthread_mutex_unlock(&audio_timer_mutex); c_total+=x; - if(mp_conf.benchmark && mp_conf.verbose) __show_status_line(a_pts,*v_pts,delay,AV_delay,vstat); + 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,vstat); + if(mp_conf.benchmark && mp_conf.verbose) show_status_line_no_apts(*v_pts); } return 0; } -void mpxp_seek( int _xp_id, video_stat_t *vstat, osd_args_t *osd,float v_pts,const seek_args_t* seek) +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; @@ -1481,11 +1470,6 @@ 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 time_usage.audio=0; time_usage.audio_decode=0; time_usage.video=0; time_usage.vout=0; - if(vstat) { - vstat->drop_frame_cnt=0; - vstat->too_slow_frame_cnt=0; - vstat->too_fast_frame_cnt=0; - } if(vo_data->spudec) { unsigned char* packet=NULL; while(ds_get_packet_sub_r(d_dvdsub,&packet)>0) ; // Empty stream @@ -1500,7 +1484,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,NULL,dae_played_fra(xp_core.video).v_pts,&seek); + if(sh_video) mpxp_seek(i,NULL,dae_played_fra(xp_core.video).v_pts,&seek); return; } @@ -2368,7 +2352,6 @@ // movie info: int eof=0; osd_args_t osd = { 100, 9 }; - video_stat_t vstat; int rtc_fd=-1; int i; int forced_subs_only=0; @@ -2383,7 +2366,6 @@ mplayer_pth_id= pinfo[xp_id].pth_id=pthread_self(); pinfo[xp_id].thread_name = "main"; - memset(&vstat,0,sizeof(video_stat_t)); mp_msg_init(MSGL_STATUS); MSG_INFO("%s",banner_text); @@ -2714,8 +2696,6 @@ while(!eof){ int in_pause=0; float v_pts=0; -// unsigned int aq_total_time=GetTimer(); - float aq_sleep_time=0; if(play_n_frames>=0){ --play_n_frames; @@ -2747,20 +2727,10 @@ if(vo_check_events(vo_data)) goto repaint; } else { repaint: - l_eof = mpxp_play_video(rtc_fd,&vstat,&aq_sleep_time,&v_pts); + l_eof = mpxp_play_video(rtc_fd,&v_pts); eof |= l_eof; if(eof) goto do_loop; } -/*Output quality adjustments:*/ - if(mp_conf.autoq>0) { - if(output_quality<mp_conf.autoq && aq_sleep_time>0) - ++output_quality; - else if(output_quality>1 && aq_sleep_time<0) - --output_quality; - else if(output_quality>0 && aq_sleep_time<-0.050f) // 50ms - output_quality=0; - mpcv_set_quality(sh_video,output_quality); - } read_input: #ifdef USE_OSD if((mpxp_paint_osd(&osd.visible,&in_pause))!=0) goto repaint; @@ -2810,7 +2780,7 @@ seek_args.secs -= (xp_is_bad_pts?shvad.v_pts:d_video->pts)-shvap.v_pts; } - mpxp_seek(xp_id,&vstat,&osd,v_pts,&seek_args); + mpxp_seek(xp_id,&osd,v_pts,&seek_args); audio_eof=0; seek_args.secs=0; Modified: mplayerxp/sig_hand.c =================================================================== --- mplayerxp/sig_hand.c 2012-10-25 16:13:12 UTC (rev 205) +++ mplayerxp/sig_hand.c 2012-10-25 16:38:33 UTC (rev 206) @@ -80,7 +80,7 @@ pinfo[xp_threads].current_module = NULL; pinfo[xp_threads].unlink = _unlink; xp_threads++; -#if 1 +#ifndef MP_DEBUG /*========= Catch terminate signals: ================*/ /* terminate requests:*/ signal(SIGTERM,my_callback); /* kill*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-25 17:23:54
|
Revision: 210 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=210&view=rev Author: nickols_k Date: 2012-10-25 17:23:43 +0000 (Thu, 25 Oct 2012) Log Message: ----------- remove redundant element Modified Paths: -------------- mplayerxp/libmpdemux/demux_asf.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_bmp.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_mpxp64.c mplayerxp/libmpdemux/demux_nsv.c mplayerxp/libmpdemux/demux_nuv.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_rawvideo.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_roq.c mplayerxp/libmpdemux/demux_smjpeg.c mplayerxp/libmpdemux/demux_viv.c mplayerxp/libmpdemux/demux_y4m.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libmpdemux/stheader.h mplayerxp/libmpdemux/video.c mplayerxp/mplayer.c Modified: mplayerxp/libmpdemux/demux_asf.c =================================================================== --- mplayerxp/libmpdemux/demux_asf.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_asf.c 2012-10-25 17:23:43 UTC (rev 210) @@ -367,7 +367,7 @@ } else { sh_video_t *sh_video=demuxer->video->sh; sh_video=d_video->sh;sh_video->ds=d_video; - sh_video->fps=1000.0f; sh_video->frametime=0.001f; // 1ms + sh_video->fps=1000.0f; // 1ms MSG_V("VIDEO: [%.4s] %ldx%ld %dbpp\n", (char *)&sh_video->bih->biCompression, sh_video->bih->biWidth, Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_avi.c 2012-10-25 17:23:43 UTC (rev 210) @@ -321,7 +321,6 @@ sh_video->aspect=get_avi_aspect(*(((char *)sh_video->bih)+0x28)); chunksize=0; // sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale; -// sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate; // if(demuxer->video->id==-1) demuxer->video->id=stream_id; // IdxFix: idxfix_videostream=stream_id; @@ -1249,7 +1248,6 @@ } // calc. FPS: sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale; - sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate; demuxer->movi_length=(unsigned)((float)demuxer->movi_length/sh_video->fps); // calculating video bitrate: if(priv->idx_size>0){ @@ -1295,12 +1293,12 @@ sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; } else { asize=sh_audio->audio.dwLength; - sh_audio->i_bps=(float)asize/(sh_video->frametime*priv->numberofframes); + sh_audio->i_bps=(float)asize*sh_video->fps/priv->numberofframes; } } vsize=demuxer->movi_end-demuxer->movi_start-asize-8*priv->numberofframes; MSG_V("AVI video size=%lu (%lu) audio size=%lu\n",vsize,priv->numberofframes,asize); - sh_video->i_bps=(float)vsize/(sh_video->frametime*priv->numberofframes); + sh_video->i_bps=(float)vsize*sh_video->fps/priv->numberofframes; } MSG_V("VIDEO: [%.4s] %ldx%ld %dbpp %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n", (char *)&sh_video->bih->biCompression, Modified: mplayerxp/libmpdemux/demux_bmp.c =================================================================== --- mplayerxp/libmpdemux/demux_bmp.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_bmp.c 2012-10-25 17:23:43 UTC (rev 210) @@ -182,7 +182,6 @@ sh_video->is_static = 1; // get the speed sh_video->fps = 2; - sh_video->frametime = 2 / sh_video->fps; // demuxer->priv = bmp_image; @@ -282,7 +281,6 @@ // get the speed sh_video->is_static = 1; sh_video->fps = 1; - sh_video->frametime = 1 / sh_video->fps; demuxer->priv = bmp_image; Modified: mplayerxp/libmpdemux/demux_dv.c =================================================================== --- mplayerxp/libmpdemux/demux_dv.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_dv.c 2012-10-25 17:23:43 UTC (rev 210) @@ -182,7 +182,6 @@ mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() frame_size: %d w: %d h: %d dif_seq: %d system: %d\n",dv_decoder->frame_size,dv_decoder->width, dv_decoder->height,dv_decoder->num_dif_seqs,dv_decoder->system); sh_video->fps= (dv_decoder->system==e_dv_system_525_60?29.97:25); - sh_video->frametime = 1.0/sh_video->fps; // emulate BITMAPINFOHEADER for win32 decoders: sh_video->bih=calloc(1, sizeof(BITMAPINFOHEADER)); Modified: mplayerxp/libmpdemux/demux_film.c =================================================================== --- mplayerxp/libmpdemux/demux_film.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_film.c 2012-10-25 17:23:43 UTC (rev 210) @@ -354,7 +354,6 @@ if (sh_video) { sh_video->fps = stream_read_dword(demuxer->stream); - sh_video->frametime = 1.0 / sh_video->fps; } // fetch the number of chunks Modified: mplayerxp/libmpdemux/demux_fli.c =================================================================== --- mplayerxp/libmpdemux/demux_fli.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_fli.c 2012-10-25 17:23:43 UTC (rev 210) @@ -147,9 +147,8 @@ if (speed == 0) speed = 1; if (magic_number == 0xAF11) - speed *= 1000/70; - sh_video->fps = 1000 / speed; - sh_video->frametime = 1/sh_video->fps; + speed *= 1000.0f/70.0f; + sh_video->fps = 1000.0f / speed; // build the frame index stream_seek(demuxer->stream, demuxer->movi_start); Modified: mplayerxp/libmpdemux/demux_lavf.c =================================================================== --- mplayerxp/libmpdemux/demux_lavf.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_lavf.c 2012-10-25 17:23:43 UTC (rev 210) @@ -364,7 +364,6 @@ sh_video->video.dwScale= codec->time_base.num; } sh_video->fps=av_q2d(st->r_frame_rate); - sh_video->frametime=1/av_q2d(st->r_frame_rate); sh_video->format = bih->biCompression; sh_video->aspect= codec->width * codec->sample_aspect_ratio.num / (float)(codec->height * codec->sample_aspect_ratio.den); Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-10-25 17:23:43 UTC (rev 210) @@ -2245,7 +2245,6 @@ if (track->v_frate == 0.0) track->v_frate = 25.0; sh_v->fps = track->v_frate; - sh_v->frametime = 1 / track->v_frate; sh_v->aspect = 0; if (!track->realmedia) { Modified: mplayerxp/libmpdemux/demux_mov.c =================================================================== --- mplayerxp/libmpdemux/demux_mov.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_mov.c 2012-10-25 17:23:43 UTC (rev 210) @@ -1100,7 +1100,7 @@ trak->stream_header_len = atom_len-8; trak->stream_header = (unsigned char *)malloc(trak->stream_header_len); memcpy(trak->stream_header, trak->stdata+pos+8, trak->stream_header_len); - } + } break; case MOV_FOURCC('d','2','6','3'): MSG_V("MOV: Found H.263 decoder atom %c%c%c%c (%d)!\n", trak->stdata[pos+4],trak->stdata[pos+5],trak->stdata[pos+6],trak->stdata[pos+7],atom_len); @@ -1120,7 +1120,6 @@ } sh->fps=trak->timescale/ ((trak->durmap_size>=1)?(float)trak->durmap[0].dur:1); - sh->frametime=1.0f/sh->fps; sh->disp_w=trak->stdata[25]|(trak->stdata[24]<<8); sh->disp_h=trak->stdata[27]|(trak->stdata[26]<<8); Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-25 17:23:43 UTC (rev 210) @@ -225,7 +225,6 @@ demuxer->video->sh=sh; sh->ds=demuxer->video; sh->fps=(float)(priv->sprop[id].num_packets*1000.)/(priv->sprop[id].PlayDuration-priv->sprop[id].Preroll); - sh->frametime=1/sh->fps; sh->format=sh->bih->biCompression; sh->disp_w=sh->bih->biWidth; sh->disp_h=sh->bih->biHeight; Modified: mplayerxp/libmpdemux/demux_nsv.c =================================================================== --- mplayerxp/libmpdemux/demux_nsv.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_nsv.c 2012-10-25 17:23:43 UTC (rev 210) @@ -81,8 +81,8 @@ } if (sh_video) - priv->v_pts =demuxer->video->pts= priv->video_pack_no * - (float)sh_video->frametime; + priv->v_pts =demuxer->video->pts= priv->video_pack_no / + (float)sh_video->fps; else priv->v_pts = priv->video_pack_no; @@ -302,14 +302,13 @@ break; default: sh_video->fps = (float)priv->fps; - } - sh_video->frametime = (float)1.0 / (float)sh_video->fps; + } } - } + } // seek to start of NSV header stream_seek(demuxer->stream,stream_tell(demuxer->stream)-17); - + return demuxer; } Modified: mplayerxp/libmpdemux/demux_nuv.c =================================================================== --- mplayerxp/libmpdemux/demux_nuv.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_nuv.c 2012-10-25 17:23:43 UTC (rev 210) @@ -255,7 +255,6 @@ /* Get the FPS */ sh_video->fps = rtjpeg_fileheader.fps; - sh_video->frametime = 1 / sh_video->fps; if (rtjpeg_fileheader.audioblocks != 0) { Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-25 17:23:43 UTC (rev 210) @@ -837,8 +837,6 @@ sh_v->bih->biCompression= sh_v->format = FOURCC_THEORA; sh_v->fps = ((double)inf.fps_numerator)/ (double)inf.fps_denominator; - sh_v->frametime = ((double)inf.fps_denominator)/ - (double)inf.fps_numerator; sh_v->disp_w = sh_v->bih->biWidth = inf.frame_width; sh_v->disp_h = sh_v->bih->biHeight = inf.frame_height; sh_v->bih->biBitCount = 24; @@ -882,8 +880,7 @@ sh_v->bih->biCompression= sh_v->format = mmioFOURCC(pack.packet[68],pack.packet[69], pack.packet[70],pack.packet[71]); - sh_v->frametime = get_uint64(pack.packet+164)*0.0000001; - sh_v->fps = 1/sh_v->frametime; + sh_v->fps = 1/(get_uint64(pack.packet+164)*0.0000001); sh_v->disp_w = sh_v->bih->biWidth = get_uint32(pack.packet+176); sh_v->disp_h = sh_v->bih->biHeight = get_uint32(pack.packet+180); sh_v->bih->biBitCount = get_uint16(pack.packet+182); @@ -933,8 +930,7 @@ sh_v->bih->biCompression= sh_v->format = mmioFOURCC(st->subtype[0],st->subtype[1], st->subtype[2],st->subtype[3]); - sh_v->frametime = get_uint64(&st->time_unit)*0.0000001; - sh_v->fps = 1.0/sh_v->frametime; + sh_v->fps = 1.0/(get_uint64(&st->time_unit)*0.0000001); sh_v->bih->biBitCount = get_uint16(&st->bits_per_sample); sh_v->disp_w = sh_v->bih->biWidth = get_uint32(&st->sh.video.width); sh_v->disp_h = sh_v->bih->biHeight = get_uint32(&st->sh.video.height); Modified: mplayerxp/libmpdemux/demux_rawvideo.c =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-25 17:23:43 UTC (rev 210) @@ -103,7 +103,6 @@ sh_video = new_sh_video(demuxer,0); sh_video->format=format; sh_video->fps=fps; - sh_video->frametime=1.0/fps; sh_video->disp_w=width; sh_video->disp_h=height; sh_video->i_bps=fps*imgsize; @@ -137,7 +136,7 @@ pos+=(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_video->i_bps)*seeka->secs; pos/=imgsize; stream_seek(s,pos*imgsize); - sh_video->timer=pos * sh_video->frametime; + sh_video->timer=pos / sh_video->fps; // printf("demux_rawvideo: streamtell=%d\n",(int)stream_tell(demuxer->stream)); } Modified: mplayerxp/libmpdemux/demux_real.c =================================================================== --- mplayerxp/libmpdemux/demux_real.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_real.c 2012-10-25 17:23:43 UTC (rev 210) @@ -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, float frametime, unsigned int format) +static float real_fix_timestamp(real_priv_t* priv, unsigned char* s, int timestamp, unsigned int format) { float v_pts; uint32_t buffer= (s[0]<<24) + (s[1]<<16) + (s[2]<<8) + s[3]; @@ -378,7 +378,6 @@ } #endif v_pts=kf*0.001f; -// if(v_pts<priv->v_pts || !kf) v_pts=priv->v_pts+frametime; priv->v_pts=v_pts; return v_pts; } @@ -643,7 +642,7 @@ priv->video_after_seek = 0; } else dp->pts=(dp_hdr->len<3)?0: - real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->frametime,sh_video->format); + real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->format); ds_add_packet(ds,dp); ds->asf_packet=NULL; } else { @@ -679,7 +678,7 @@ priv->video_after_seek = 0; } else dp->pts=(dp_hdr->len<3)?0: - real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->frametime,sh_video->format); + real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->format); ds_add_packet(ds,dp); ds->asf_packet=NULL; // continue parsing @@ -736,7 +735,7 @@ priv->video_after_seek = 0; } else dp->pts=(dp_hdr->len<3)?0: - real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->frametime,sh_video->format); + real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->format); ds_add_packet(ds,dp); } // while(len>0) @@ -1231,15 +1230,14 @@ sh->fps = (float) stream_read_word(demuxer->stream); if (sh->fps<=0) sh->fps=24; // we probably won't even care about fps - sh->frametime = 1.0f/sh->fps; - + stream_skip(demuxer->stream, 4); // if(sh->format==0x30335652 || sh->format==0x30325652 ) if(1) { int tmp=stream_read_word(demuxer->stream); if(tmp>0){ - sh->fps=tmp; sh->frametime = 1.0f/sh->fps; + sh->fps=tmp; } } else { int fps=stream_read_word(demuxer->stream); Modified: mplayerxp/libmpdemux/demux_roq.c =================================================================== --- mplayerxp/libmpdemux/demux_roq.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_roq.c 2012-10-25 17:23:43 UTC (rev 210) @@ -151,7 +151,6 @@ // constant frame rate sh_video->fps = fps; - sh_video->frametime = 1 / sh_video->fps; } } else if ((chunk_id == RoQ_SOUND_MONO) || Modified: mplayerxp/libmpdemux/demux_smjpeg.c =================================================================== --- mplayerxp/libmpdemux/demux_smjpeg.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_smjpeg.c 2012-10-25 17:23:43 UTC (rev 210) @@ -125,7 +125,6 @@ stream_skip(demuxer->stream, 4); /* number of frames */ // sh_video->fps = 24; -// sh_video->frametime = 1.0f/sh_video->fps; sh_video->disp_w = stream_read_word(demuxer->stream); sh_video->disp_h = stream_read_word(demuxer->stream); sh_video->format = stream_read_dword_le(demuxer->stream); Modified: mplayerxp/libmpdemux/demux_viv.c =================================================================== --- mplayerxp/libmpdemux/demux_viv.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_viv.c 2012-10-25 17:23:43 UTC (rev 210) @@ -578,7 +578,6 @@ else sh->fps=15.0f; } - sh->frametime=1.0f/sh->fps; /* XXX: FIXME: can't scale image. */ /* hotfix to disable: */ Modified: mplayerxp/libmpdemux/demux_y4m.c =================================================================== --- mplayerxp/libmpdemux/demux_y4m.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/demux_y4m.c 2012-10-25 17:23:43 UTC (rev 210) @@ -179,7 +179,6 @@ sh->fps = 25.0f; } } - sh->frametime = 1.0f/sh->fps; } else { @@ -188,14 +187,13 @@ MSG_FATAL( "error parsing YUV4MPEG header: %s\n", y4m_strerr(err)); if(!sh->fps) { - ratio = y4m_si_get_framerate(priv->si); - if (ratio.d != 0) - sh->fps=(float)ratio.n/(float)ratio.d; - else - sh->fps=15.0f; + ratio = y4m_si_get_framerate(priv->si); + if (ratio.d != 0) + sh->fps=(float)ratio.n/(float)ratio.d; + else + sh->fps=15.0f; } - sh->frametime=1.0f/sh->fps; - + ratio = y4m_si_get_sampleaspect(priv->si); if (ratio.d != 0 && ratio.n != 0) sh->aspect = (float)ratio.n/(float)ratio.d; Modified: mplayerxp/libmpdemux/s_tv.c =================================================================== --- mplayerxp/libmpdemux/s_tv.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/s_tv.c 2012-10-25 17:23:43 UTC (rev 210) @@ -269,7 +269,7 @@ // if (IMGFMT_IS_RGB(sh_video->format) || IMGFMT_IS_BGR(sh_video->format)) // sh_video->format = 0x0; - /* set FPS and FRAMETIME */ + /* set FPS */ if(!sh_video->fps) { @@ -282,10 +282,8 @@ if (tv_param_fps != -1.0f) sh_video->fps = tv_param_fps; - sh_video->frametime = 1.0f/sh_video->fps; + MSG_V("fps: %f, frametime: %f\n", sh_video->fps, 1.0f/sh_video->fps); - MSG_V("fps: %f, frametime: %f\n", sh_video->fps, sh_video->frametime); - #ifdef HAVE_TV_BSDBT848 /* If playback only mode, go to immediate mode, fail silently */ if(tv_param_immediate == 1) Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/stheader.h 2012-10-25 17:23:43 UTC (rev 210) @@ -66,7 +66,6 @@ // output format: float timer; // value of old v_frame float fps; - float frametime; // 1/fps int chapter_change; unsigned i_bps; // == bitrate (compressed bytes/sec) unsigned disp_w,disp_h;// display size (filled by fileformat parser) Modified: mplayerxp/libmpdemux/video.c =================================================================== --- mplayerxp/libmpdemux/video.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/libmpdemux/video.c 2012-10-25 17:23:43 UTC (rev 210) @@ -215,7 +215,6 @@ } if(picture.fps) { sh_video->fps=picture.fps*0.0001f; - sh_video->frametime=10000.0f/(float)picture.fps; MSG_INFO("FPS seems to be: %d/10000\n", picture.fps); } MSG_V("OK!\n"); @@ -269,7 +268,6 @@ sh_video->format=0x10000005; if(picture.fps) { sh_video->fps=picture.fps*0.0001f; - sh_video->frametime=10000.0f/(float)picture.fps; MSG_INFO("FPS seems to be: %d/10000\n", picture.fps); } break; @@ -359,11 +357,6 @@ #if 0 sh_video->fps=mpeg_framerates[picture.frame_rate_code & 0x0F]; #endif - if(!sh_video->fps){ - sh_video->frametime=0; - } else { - sh_video->frametime=1.0/sh_video->fps; - } sh_video->disp_w=picture.display_picture_width; sh_video->disp_h=picture.display_picture_height; // bitrate: @@ -464,7 +457,6 @@ if((int)(sh_video->fps*10000+0.5)!=picture.fps) if(!force_fps && !telecine){ MSG_WARN("Warning! FPS changed %5.3f -> %5.3f (%f) [%d] \n",sh_video->fps,picture.fps*0.0001,sh_video->fps-picture.fps*0.0001,picture.frame_rate_code); sh_video->fps=picture.fps*0.0001; - sh_video->frametime=10000.0f/(float)picture.fps; } #endif @@ -486,7 +478,6 @@ } else if(telecine_cnt>-0.5 && telecine_cnt<0.5 && !force_fps){ sh_video->fps=sh_video->fps*4/5; - sh_video->frametime=sh_video->frametime*5/4; MSG_INFO("Enter telecine mode\n"); telecine=1; } @@ -517,7 +508,6 @@ h264_parse_sps(&picture, &(videobuffer[pos]), videobuf_len - pos); if(picture.fps > 0) { sh_video->fps=picture.fps*0.0001f; - sh_video->frametime=10000.0f/(float)picture.fps; } i=sync_video_packet(d_video); if(!i) return -1; @@ -534,7 +524,7 @@ } // Increase video timers: - frame_time*=sh_video->frametime; + frame_time*=1.0f/sh_video->fps; /* override frame_time for variable/unknown FPS formats: */ if(!force_fps) @@ -559,7 +549,6 @@ if(d>0) if((int)sh_video->fps==1000) MSG_STATUS("\rASF framerate: %d fps \n",(int)(1.0f/d)); - sh_video->frametime=d; // 1ms sh_video->fps=1.0f/d; frame_time = d; } else { Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-25 17:08:21 UTC (rev 209) +++ mplayerxp/mplayer.c 2012-10-25 17:23:43 UTC (rev 210) @@ -1787,13 +1787,12 @@ } else { MSG_V("[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n", demuxer->file_format,sh_video->format, sh_video->disp_w,sh_video->disp_h, - sh_video->fps,sh_video->frametime + sh_video->fps,1/sh_video->fps ); vo_data->fps = 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; - sh_video->frametime=1.0f/sh_video->fps; vo_data->fps = force_fps; } @@ -2651,8 +2650,7 @@ if(force_fps && sh_video) { vo_data->fps = sh_video->fps=force_fps; - sh_video->frametime=1.0f/sh_video->fps; - MSG_INFO(MSGTR_FPSforced,sh_video->fps,sh_video->frametime); + MSG_INFO(MSGTR_FPSforced,sh_video->fps,1.0f/sh_video->fps); } /* Init timers and benchmarking */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-26 06:43:14
|
Revision: 211 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=211&view=rev Author: nickols_k Date: 2012-10-26 06:43:08 +0000 (Fri, 26 Oct 2012) Log Message: ----------- fix vobsub seeking Modified Paths: -------------- mplayerxp/libmpdemux/demuxer.h mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpdemux/demuxer_r.h mplayerxp/libmpsub/vobsub.c mplayerxp/libmpsub/vobsub.h mplayerxp/mplayer.c Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-10-25 17:23:43 UTC (rev 210) +++ mplayerxp/libmpdemux/demuxer.h 2012-10-26 06:43:08 UTC (rev 211) @@ -1,6 +1,8 @@ #ifndef __DEMUXER_H #define __DEMUXER_H 1 +#include "stream.h" + #define MAX_PACK_BYTES (0x1024*0x1024*4) #define DEMUXER_TYPE_UNKNOWN 0 Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-25 17:23:43 UTC (rev 210) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-10-26 06:43:08 UTC (rev 211) @@ -178,9 +178,9 @@ return retval; } -void vobsub_seek_r(any_t* vobhandle, float pts) { +void vobsub_seek_r(any_t* vobhandle,const seek_args_t* seeka) { LOCK_DEMUXER(); - vobsub_seek(vobhandle,pts); + vobsub_seek(vobhandle,seeka); UNLOCK_DEMUXER(); } Modified: mplayerxp/libmpdemux/demuxer_r.h =================================================================== --- mplayerxp/libmpdemux/demuxer_r.h 2012-10-25 17:23:43 UTC (rev 210) +++ mplayerxp/libmpdemux/demuxer_r.h 2012-10-26 06:43:08 UTC (rev 211) @@ -20,7 +20,7 @@ extern int ds_get_packet_sub_r(demux_stream_t *ds,unsigned char **start); extern int demux_seek_r(demuxer_t *demuxer,const seek_args_t* seeka); -extern void vobsub_seek_r(any_t* vobhandle, float pts); +extern void vobsub_seek_r(any_t* vobhandle,const seek_args_t* seeka); extern int demuxer_switch_audio_r(demuxer_t *, int id); extern int demuxer_switch_video_r(demuxer_t *, int id); Modified: mplayerxp/libmpsub/vobsub.c =================================================================== --- mplayerxp/libmpsub/vobsub.c 2012-10-25 17:23:43 UTC (rev 210) +++ mplayerxp/libmpsub/vobsub.c 2012-10-26 06:43:08 UTC (rev 211) @@ -410,12 +410,12 @@ } vobsub_t; /* Make sure that the spu stream idx exists. */ -static int __FASTCALL__ vobsub_ensure_spu_stream(vobsub_t *vob, unsigned int index) +static int __FASTCALL__ vobsub_ensure_spu_stream(vobsub_t *vob, unsigned int _index) { - if (index >= vob->spu_streams_size) { + if (_index >= vob->spu_streams_size) { /* This is a new stream */ if (vob->spu_streams) { - packet_queue_t *tmp = realloc(vob->spu_streams, (index + 1) * sizeof(packet_queue_t)); + packet_queue_t *tmp = realloc(vob->spu_streams, (_index + 1) * sizeof(packet_queue_t)); if (tmp == NULL) { MSG_ERR("vobsub_ensure_spu_stream: realloc failure"); return -1; @@ -423,13 +423,13 @@ vob->spu_streams = tmp; } else { - vob->spu_streams = malloc((index + 1) * sizeof(packet_queue_t)); + vob->spu_streams = malloc((_index + 1) * sizeof(packet_queue_t)); if (vob->spu_streams == NULL) { MSG_ERR("vobsub_ensure_spu_stream: malloc failure"); return -1; } } - while (vob->spu_streams_size <= index) { + while (vob->spu_streams_size <= _index) { packet_queue_construct(vob->spu_streams + vob->spu_streams_size); ++vob->spu_streams_size; } @@ -437,25 +437,25 @@ return 0; } -static int __FASTCALL__ vobsub_add_id(vobsub_t *vob, const char *id, size_t idlen, const unsigned int index) +static int __FASTCALL__ vobsub_add_id(vobsub_t *vob, const char *id, size_t idlen, const unsigned int _index) { - if (vobsub_ensure_spu_stream(vob, index) < 0) + if (vobsub_ensure_spu_stream(vob, _index) < 0) return -1; if (id && idlen) { - if (vob->spu_streams[index].id) - free(vob->spu_streams[index].id); - vob->spu_streams[index].id = malloc(idlen + 1); - if (vob->spu_streams[index].id == NULL) { + if (vob->spu_streams[_index].id) + free(vob->spu_streams[_index].id); + vob->spu_streams[_index].id = malloc(idlen + 1); + if (vob->spu_streams[_index].id == NULL) { MSG_ERR("vobsub_add_id: malloc failure"); return -1; } - vob->spu_streams[index].id[idlen] = 0; - memcpy(vob->spu_streams[index].id, id, idlen); + vob->spu_streams[_index].id[idlen] = 0; + memcpy(vob->spu_streams[_index].id, id, idlen); } - vob->spu_streams_current = index; + vob->spu_streams_current = _index; if (mp_conf.verbose) MSG_ERR( "[vobsub] subtitle (vobsubid): %d language %s\n", - index, vob->spu_streams[index].id); + _index, vob->spu_streams[_index].id); return 0; } @@ -986,10 +986,10 @@ } } -char * __FASTCALL__ vobsub_get_id(any_t*vobhandle, unsigned int index) +char * __FASTCALL__ vobsub_get_id(any_t*vobhandle, unsigned int _index) { vobsub_t *vob = (vobsub_t *) vobhandle; - return (index < vob->spu_streams_size) ? vob->spu_streams[index].id : NULL; + return (_index < vob->spu_streams_size) ? vob->spu_streams[_index].id : NULL; } unsigned int __FASTCALL__ vobsub_get_forced_subs_flag(void const * const vobhandle) @@ -1000,9 +1000,9 @@ return 0; } -int __FASTCALL__ vobsub_set_from_lang(any_t*vobhandle, unsigned char * lang) +int __FASTCALL__ vobsub_set_from_lang(any_t*vobhandle,const char * lang) { - int i; + unsigned i; vobsub_t *vob= (vobsub_t *) vobhandle; while(lang && strlen(lang) >= 2){ for(i=0; i < vob->spu_streams_size; i++) @@ -1018,24 +1018,29 @@ return -1; } -void __FASTCALL__ vobsub_seek(any_t* vobhandle, float pts) +void __FASTCALL__ vobsub_seek(any_t* vobhandle,const seek_args_t* seeka) { - vobsub_t * vob = (vobsub_t *)vobhandle; - packet_queue_t * queue; - int seek_pts100 = (int)pts * 90000; - - if (vob->spu_streams && 0 <= mp_conf.vobsub_id && (unsigned) mp_conf.vobsub_id < vob->spu_streams_size) { - /* do not seek if we don't know the id */ - if (vobsub_get_id(vob, mp_conf.vobsub_id) == NULL) - return; - queue = vob->spu_streams + mp_conf.vobsub_id; - queue->current_index = 0; - while (queue->current_index < queue->packets_size - && (queue->packets + queue->current_index)->pts100 < seek_pts100) - ++queue->current_index; - if (queue->current_index > 0) - --queue->current_index; - } + vobsub_t * vob = (vobsub_t *)vobhandle; + packet_queue_t * queue; + unsigned seek_pts100; + if(seeka->flags&DEMUX_SEEK_SET) seek_pts100 = (unsigned)seeka->secs * 90000; + else { + int cur_pts; + queue = vob->spu_streams + mp_conf.vobsub_id; + cur_pts=(queue->packets + queue->current_index)->pts100; + seek_pts100 = cur_pts+(unsigned)seeka->secs*90000; + } + if (vob->spu_streams && 0 <= mp_conf.vobsub_id && (unsigned) mp_conf.vobsub_id < vob->spu_streams_size) { + /* do not seek if we don't know the id */ + if (vobsub_get_id(vob, mp_conf.vobsub_id) == NULL) return; + queue = vob->spu_streams + mp_conf.vobsub_id; + queue->current_index = 0; + while (queue->current_index < queue->packets_size + && (queue->packets + queue->current_index)->pts100 < seek_pts100) + ++queue->current_index; + if (queue->current_index > 0) + --queue->current_index; + } } int __FASTCALL__ vobsub_get_packet(any_t*vobhandle, float pts,any_t** data, int* timestamp) { @@ -1053,7 +1058,7 @@ return pkt->size; } else break; else - ++queue->current_index; + ++queue->current_index; } } return -1; Modified: mplayerxp/libmpsub/vobsub.h =================================================================== --- mplayerxp/libmpsub/vobsub.h 2012-10-25 17:23:43 UTC (rev 210) +++ mplayerxp/libmpsub/vobsub.h 2012-10-26 06:43:08 UTC (rev 211) @@ -1,15 +1,17 @@ #ifndef MPLAYER_VOBSUB_H #define MPLAYER_VOBSUB_H +#include "libmpdemux/demuxer.h" // for seek_args_t + extern any_t* __FASTCALL__ vobsub_open(const char *subname, const char *const ifo, const int force, any_t** spu); extern void __FASTCALL__ vobsub_close(any_t*this); extern void __FASTCALL__ vobsub_reset(any_t*vob); extern int __FASTCALL__ vobsub_get_packet(any_t*vobhandle, float pts,any_t** data, int* timestamp); extern int __FASTCALL__ vobsub_parse_ifo(any_t* vob, const char *const name, unsigned int *palette, unsigned int *width, unsigned int *height, int force, int sid, char *langid); extern char * __FASTCALL__ vobsub_get_id(any_t* vob, unsigned int index); -extern int __FASTCALL__ vobsub_set_from_lang(any_t*vobhandle, unsigned char * lang); +extern int __FASTCALL__ vobsub_set_from_lang(any_t*vobhandle,const char * lang); extern unsigned int __FASTCALL__ vobsub_get_forced_subs_flag(void const * const vobhandle); -extern void __FASTCALL__ vobsub_seek(any_t* vob, float pts); +extern void __FASTCALL__ vobsub_seek(any_t* vob,const seek_args_t* seek); /// Convert palette value in idx file to yuv. extern unsigned int vobsub_palette_to_yuv(unsigned int pal); extern unsigned int vobsub_rgb_to_yuv(unsigned int rgb); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-25 17:23:43 UTC (rev 210) +++ mplayerxp/mplayer.c 2012-10-26 06:43:08 UTC (rev 211) @@ -1448,7 +1448,7 @@ if (vo_data->vobsub) { pinfo[_xp_id].current_module = "seek_vobsub_reset"; - vobsub_seek_r(vo_data->vobsub, seek->secs); // <-- TODO: replace with full pts + vobsub_seek_r(vo_data->vobsub, seek); } #ifdef USE_OSD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-26 07:04:32
|
Revision: 212 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=212&view=rev Author: nickols_k Date: 2012-10-26 07:04:22 +0000 (Fri, 26 Oct 2012) Log Message: ----------- remove unused element Modified Paths: -------------- mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_mpg.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_pva.c mplayerxp/libmpdemux/demux_rawvideo.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_ts.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/stheader.h mplayerxp/libmpdemux/video.c Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-26 07:04:22 UTC (rev 212) @@ -152,7 +152,7 @@ case IMGFMT_BGR32: bpp = 32; break; } o_bps=sh_video->fps*sh_video->disp_w*sh_video->disp_h*bpp/8; - MSG_OK("[VC] %s decoder: [%s] drv:%s.%s (%dx%d (aspect %g) %4.2ffps ratio %i->%i\n" + MSG_OK("[VC] %s decoder: [%s] drv:%s.%s (%dx%d (aspect %g) %4.2ffps\n" ,video_codec?"Forcing":"Selected" ,sh_video->codec->codec_name ,mpvdec->info->driver_name @@ -160,9 +160,7 @@ ,sh_video->disp_w ,sh_video->disp_h ,sh_video->aspect - ,sh_video->fps - ,sh_video->i_bps - ,o_bps); + ,sh_video->fps); // Yeah! We got it! sh_video->inited=1; sh_video->vf_flags=vf_query_flags(sh_video->vfilter); Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/demux_avi.c 2012-10-26 07:04:22 UTC (rev 212) @@ -1271,7 +1271,6 @@ } if(!priv->numberofframes) priv->numberofframes=vsamples; MSG_V("AVI video size=%lu (%lu) audio size=%lu (%lu)\n",vsize,priv->numberofframes,asize,asamples); - sh_video->i_bps=((float)vsize/(float)vsamples)*(float)sh_video->video.dwRate/(float)sh_video->video.dwScale; if(sh_audio) sh_audio->i_bps=((float)asize/(float)asamples)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale; } else { // guessing, results may be inaccurate: @@ -1298,16 +1297,13 @@ } vsize=demuxer->movi_end-demuxer->movi_start-asize-8*priv->numberofframes; MSG_V("AVI video size=%lu (%lu) audio size=%lu\n",vsize,priv->numberofframes,asize); - sh_video->i_bps=(float)vsize*sh_video->fps/priv->numberofframes; } - MSG_V("VIDEO: [%.4s] %ldx%ld %dbpp %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n", + MSG_V("VIDEO: [%.4s] %ldx%ld %dbpp %4.2f fps\n", (char *)&sh_video->bih->biCompression, sh_video->bih->biWidth, sh_video->bih->biHeight, sh_video->bih->biBitCount, - sh_video->fps, - sh_video->i_bps*0.008f, - sh_video->i_bps/1024.0f ); + sh_video->fps); { sh_audio_t* sh_a; sh_a = (sh_audio_t*)demuxer->audio->sh; Modified: mplayerxp/libmpdemux/demux_lavf.c =================================================================== --- mplayerxp/libmpdemux/demux_lavf.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/demux_lavf.c 2012-10-26 07:04:22 UTC (rev 212) @@ -367,8 +367,7 @@ sh_video->format = bih->biCompression; sh_video->aspect= codec->width * codec->sample_aspect_ratio.num / (float)(codec->height * codec->sample_aspect_ratio.den); - sh_video->i_bps= codec->bit_rate/8; - MSG_DBG2("aspect= %d*%d/(%d*%d)\n", + MSG_DBG2("aspect= %d*%d/(%d*%d)\n", codec->width, codec->sample_aspect_ratio.num, codec->height, codec->sample_aspect_ratio.den); Modified: mplayerxp/libmpdemux/demux_mpg.c =================================================================== --- mplayerxp/libmpdemux/demux_mpg.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/demux_mpg.c 2012-10-26 07:04:22 UTC (rev 212) @@ -546,13 +546,10 @@ newpos+=(demuxer->movi_end-demuxer->movi_start)*seeka->secs; } else { // time seek (secs) - if(!sh_video->i_bps) // unspecified or VBR - newpos+=2324*75*seeka->secs; // 174.3 kbyte/sec - else - newpos+=sh_video->i_bps*seeka->secs; + newpos+=2324*75*seeka->secs; // 174.3 kbyte/sec } - if(newpos<demuxer->movi_start){ + if(newpos<demuxer->movi_start){ if(!(demuxer->stream->type&STREAMTYPE_PROGRAM)) demuxer->movi_start=0; // for VCD if(newpos<demuxer->movi_start) newpos=demuxer->movi_start; } Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-26 07:04:22 UTC (rev 212) @@ -228,7 +228,6 @@ sh->format=sh->bih->biCompression; sh->disp_w=sh->bih->biWidth; sh->disp_h=sh->bih->biHeight; - sh->i_bps=priv->sprop[id].AveBitrate; MSG_V("FPS: %f\n",sh->fps); break; case mmioFOURCC('v','p','r','p'): Modified: mplayerxp/libmpdemux/demux_pva.c =================================================================== --- mplayerxp/libmpdemux/demux_pva.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/demux_pva.c 2012-10-26 07:04:22 UTC (rev 212) @@ -476,9 +476,9 @@ int total_bitrate=0; off_t dest_offset; pva_priv_t * priv=demuxer->priv; - - total_bitrate=((sh_audio_t *)demuxer->audio->sh)->i_bps + ((sh_video_t *)demuxer->video->sh)->i_bps; + total_bitrate=((sh_audio_t *)demuxer->audio->sh)->i_bps;// + ((sh_video_t *)demuxer->video->sh)->i_bps; + /* * Compute SOF offset inside the stream. Approximate total bitrate with sum of bitrates * reported by the audio and video codecs. The seek is not accurate because, just like Modified: mplayerxp/libmpdemux/demux_rawvideo.c =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-26 07:04:22 UTC (rev 212) @@ -14,37 +14,40 @@ #include "libvo/img_format.h" #include "demux_msg.h" -int use_rawvideo = 0; -static int format = IMGFMT_I420; -static int size_id = 0; -static int width = 0; -static int height = 0; -static float fps = 25; -static int imgsize=0; +typedef struct priv_s { + int use_rawvideo; + int format; + int size_id; + int width; + int height; + float fps; + int imgsize; +}priv_t; +static priv_t priv; static const config_t demux_rawvideo_opts[] = { - { "on", &use_rawvideo, CONF_TYPE_FLAG, 0,0, 1, NULL, "forces treating stream as raw-vidio" }, + { "on", &priv.use_rawvideo, CONF_TYPE_FLAG, 0,0, 1, NULL, "forces treating stream as raw-vidio" }, // size: - { "w", &width, CONF_TYPE_INT,CONF_RANGE,1,8192, NULL, "specifies image width of raw-video stream" }, - { "h", &height, CONF_TYPE_INT,CONF_RANGE,1,8192, NULL, "specifies image height of raw-video stream" }, - { "sqcif", &size_id, CONF_TYPE_FLAG,0,0,1, NULL, "sets image size to SQCIF standard" }, - { "qcif", &size_id, CONF_TYPE_FLAG,0,0,2, NULL, "sets image size to QCIF standard" }, - { "cif", &size_id, CONF_TYPE_FLAG,0,0,3, NULL, "sets image size to CIF standard" }, - { "4cif", &size_id, CONF_TYPE_FLAG,0,0,4, NULL, "sets image size to 4CIF standard" }, - { "pal", &size_id, CONF_TYPE_FLAG,0,0,5, NULL, "sets image size to PAL standard" }, - { "ntsc", &size_id, CONF_TYPE_FLAG,0,0,6, NULL, "sets image size to NTSC standard" }, - { "16cif", &size_id, CONF_TYPE_FLAG,0,0,7, NULL, "sets image size to 16CIF standard" }, - { "sif", &size_id, CONF_TYPE_FLAG,0,0,8, NULL, "sets image size to SIF standard" }, + { "w", &priv.width, CONF_TYPE_INT,CONF_RANGE,1,8192, NULL, "specifies image width of raw-video stream" }, + { "h", &priv.height, CONF_TYPE_INT,CONF_RANGE,1,8192, NULL, "specifies image height of raw-video stream" }, + { "sqcif", &priv.size_id, CONF_TYPE_FLAG,0,0,1, NULL, "sets image size to SQCIF standard" }, + { "qcif", &priv.size_id, CONF_TYPE_FLAG,0,0,2, NULL, "sets image size to QCIF standard" }, + { "cif", &priv.size_id, CONF_TYPE_FLAG,0,0,3, NULL, "sets image size to CIF standard" }, + { "4cif", &priv.size_id, CONF_TYPE_FLAG,0,0,4, NULL, "sets image size to 4CIF standard" }, + { "pal", &priv.size_id, CONF_TYPE_FLAG,0,0,5, NULL, "sets image size to PAL standard" }, + { "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", &format, CONF_TYPE_INT, 0, 0 , 0, NULL, "specifies colorspace (fourcc) in hex or string constant" }, - { "i420", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_I420, NULL, "treats raw-video as I420 fourcc" }, - { "yv12", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_YV12, NULL, "treats raw-video as YV12 fourcc" }, - { "yuy2", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_YUY2, NULL, "treats raw-video as YUY2 fourcc" }, - { "uyvy", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_UYVY, NULL, "treats raw-video as UYVY fourcc" }, - { "y8", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_Y8, NULL, "treats raw-video as Y8 fourcc" }, + { "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" }, // misc: - { "fps", &fps, CONF_TYPE_FLOAT,CONF_RANGE,0.001,1000, NULL, "specifies rate in frames per second of raw-video stream" }, - { "size", &imgsize, CONF_TYPE_INT, CONF_RANGE, 1 , 8192*8192*4, NULL, "specifies frame size in bytes" }, + { "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" }, {NULL, NULL, 0, 0, 0, 0, NULL, NULL} }; @@ -55,8 +58,8 @@ static int rawvideo_probe(demuxer_t* demuxer) { - if(demuxer->stream->type & STREAMTYPE_RAWVIDEO || use_rawvideo) - { + if(demuxer->stream->type & STREAMTYPE_RAWVIDEO || priv.use_rawvideo) { + priv.fps=25; demuxer->file_format=DEMUXER_TYPE_RAWVIDEO; return 1; } @@ -67,49 +70,48 @@ static demuxer_t* rawvideo_open(demuxer_t* demuxer) { sh_video_t* sh_video; - switch(size_id){ - case 1: width=128; height=96; break; - case 2: width=176; height=144; break; - case 3: width=352; height=288; break; - case 4: width=704; height=576; break; - case 5: width=720; height=576; break; - case 6: width=720; height=480; break; - case 7: width=1408;height=1152;break; - case 8: width=352; height=240; break; + switch(priv.size_id){ + case 1: priv.width=128; priv.height=96; break; + case 2: priv.width=176; priv.height=144; break; + case 3: priv.width=352; priv.height=288; break; + case 4: priv.width=704; priv.height=576; break; + case 5: priv.width=720; priv.height=576; break; + case 6: priv.width=720; priv.height=480; break; + case 7: priv.width=1408;priv.height=1152;break; + case 8: priv.width=352; priv.height=240; break; } - demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_WIDTH,&width); - demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_HEIGHT,&height); - demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_FORMAT,&format); - demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_FPS,&fps); + 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_FPS,&priv.fps); - if(!width || !height){ + if(!priv.width || !priv.height){ MSG_ERR("rawvideo: width or height not specified!\n"); return NULL; } - if(!imgsize) - switch(format){ - case IMGFMT_I420: - case IMGFMT_IYUV: - case IMGFMT_YV12: imgsize=width*height+2*(width>>1)*(height>>1);break; - case IMGFMT_YUY2: imgsize=width*height*2;break; - case IMGFMT_UYVY: imgsize=width*height*2;break; - case IMGFMT_Y8: imgsize=width*height;break; - default: + if(!priv.imgsize) + switch(priv.format){ + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YV12: priv.imgsize=priv.width*priv.height+2*(priv.width>>1)*(priv.height>>1);break; + case IMGFMT_YUY2: priv.imgsize=priv.width*priv.height*2;break; + 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"); return NULL; } sh_video = new_sh_video(demuxer,0); - sh_video->format=format; - sh_video->fps=fps; - sh_video->disp_w=width; - sh_video->disp_h=height; - sh_video->i_bps=fps*imgsize; + sh_video->format=priv.format; + sh_video->fps=priv.fps; + sh_video->disp_w=priv.width; + sh_video->disp_h=priv.height; demuxer->movi_start = demuxer->stream->start_pos; demuxer->movi_end = demuxer->stream->end_pos; - demuxer->movi_length = (demuxer->movi_end-demuxer->movi_start)/sh_video->i_bps; + demuxer->movi_length = (demuxer->movi_end-demuxer->movi_start)/(priv.fps*priv.imgsize); demuxer->video->sh = sh_video; sh_video->ds = demuxer->video; @@ -122,7 +124,7 @@ if(stream_eof(demuxer->stream)) return 0; if(ds!=demuxer->video) return 0; - ds_read_packet(ds,demuxer->stream,imgsize,0,stream_tell(demuxer->stream),DP_KEYFRAME); + ds_read_packet(ds,demuxer->stream,priv.imgsize,0,stream_tell(demuxer->stream),DP_KEYFRAME); return 1; } @@ -133,14 +135,14 @@ off_t pos; pos =(seeka->flags & DEMUX_SEEK_SET)?demuxer->movi_start:stream_tell(s); - pos+=(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:sh_video->i_bps)*seeka->secs; - pos/=imgsize; - stream_seek(s,pos*imgsize); + pos+=(seeka->flags&DEMUX_SEEK_PERCENTS?demuxer->movi_end-demuxer->movi_start:(priv.fps*priv.imgsize))*seeka->secs; + pos/=priv.imgsize; + stream_seek(s,pos*priv.imgsize); sh_video->timer=pos / sh_video->fps; // printf("demux_rawvideo: streamtell=%d\n",(int)stream_tell(demuxer->stream)); } -static void rawvideo_close(demuxer_t *demuxer) {} +static void rawvideo_close(demuxer_t *demuxer) { } static int rawvideo_control(demuxer_t *demuxer,int cmd,any_t*args) { Modified: mplayerxp/libmpdemux/demux_real.c =================================================================== --- mplayerxp/libmpdemux/demux_real.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/demux_real.c 2012-10-26 07:04:22 UTC (rev 212) @@ -1240,11 +1240,11 @@ sh->fps=tmp; } } else { - int fps=stream_read_word(demuxer->stream); + int fps=stream_read_word(demuxer->stream); MSG_WARN("realvid: ignoring FPS = %d\n",fps); } stream_skip(demuxer->stream, 2); - + // read codec sub-format (to make difference between low and high rate codec) ((unsigned int*)(sh->bih+1))[0]=stream_read_dword(demuxer->stream); Modified: mplayerxp/libmpdemux/demux_ts.c =================================================================== --- mplayerxp/libmpdemux/demux_ts.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/demux_ts.c 2012-10-26 07:04:22 UTC (rev 212) @@ -3085,20 +3085,15 @@ video_stats = (sh_video != NULL); - if(video_stats) - { - MSG_V("IBPS: %d, vb: %d\r\n", sh_video->i_bps, priv->vbitrate); - if(priv->vbitrate) - video_stats = priv->vbitrate; - else - video_stats = sh_video->i_bps; + if(video_stats) { + if(priv->vbitrate) video_stats = priv->vbitrate; + else video_stats = 2324*75; } newpos = (seeka->flags & DEMUX_SEEK_SET) ? demuxer->movi_start : demuxer->filepos; if(seeka->flags & DEMUX_SEEK_PERCENTS) // float seek 0..1 newpos+=(demuxer->movi_end-demuxer->movi_start)*seeka->secs; - else - { + else { // time seek (secs) if(! video_stats) // unspecified or VBR newpos += 2324*75*seeka->secs; // 174.3 kbyte/sec Modified: mplayerxp/libmpdemux/demux_ty.c =================================================================== --- mplayerxp/libmpdemux/demux_ty.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/demux_ty.c 2012-10-26 07:04:22 UTC (rev 212) @@ -768,13 +768,9 @@ if( seeka->flags & 2 ) // float seek 0..1 newpos += ( demuxer->movi_end - demuxer->movi_start ) * seeka->secs; - else - { - // time seek (secs) - if( ! sh_video->i_bps ) // unspecified or VBR - newpos += 2324 * 75 * seeka->secs; // 174.3 kbyte/sec - else - newpos += sh_video->i_bps * seeka->secs; + else { + // time seek (secs) + newpos += 2324 * 75 * seeka->secs; // 174.3 kbyte/sec } if ( newpos < demuxer->movi_start ) newpos = demuxer->movi_start; @@ -829,12 +825,7 @@ switch(cmd) { case DEMUX_CMD_GET_TIME_LENGTH: - if(!sh_video->i_bps) // unspecified or VBR return DEMUXER_CTRL_DONTKNOW; - *(double *)arg= - (double)demuxer->movi_end-demuxer->movi_start/sh_video->i_bps; - return DEMUX_OK; - case DEMUX_CMD_GET_PERCENT_POS: return DEMUX_UNKNOWN; default: Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/stheader.h 2012-10-26 07:04:22 UTC (rev 212) @@ -67,7 +67,6 @@ float timer; // value of old v_frame float fps; int chapter_change; - unsigned i_bps; // == bitrate (compressed bytes/sec) unsigned disp_w,disp_h;// display size (filled by fileformat parser) // int coded_w,coded_h; // coded size (filled by video codec) float aspect; Modified: mplayerxp/libmpdemux/video.c =================================================================== --- mplayerxp/libmpdemux/video.c 2012-10-26 06:43:08 UTC (rev 211) +++ mplayerxp/libmpdemux/video.c 2012-10-26 07:04:22 UTC (rev 212) @@ -359,9 +359,6 @@ #endif sh_video->disp_w=picture.display_picture_width; sh_video->disp_h=picture.display_picture_height; - // bitrate: - if(picture.bitrate!=0x3FFFF) // unspecified/VBR ? - sh_video->i_bps=1000*picture.bitrate/16; // info: MSG_DBG2("mpeg bitrate: %d (%X)\n",picture.bitrate,picture.bitrate); MSG_V("VIDEO: %s %dx%d (aspect %d) %4.2f fps %5.1f kbps (%4.1f kbyte/s)\n", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-26 10:04:58
|
Revision: 216 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=216&view=rev Author: nickols_k Date: 2012-10-26 10:04:44 +0000 (Fri, 26 Oct 2012) Log Message: ----------- improve readability of sources Modified Paths: -------------- mplayerxp/dump.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd_divx4.c mplayerxp/libmpcodecs/vd_dmo.c mplayerxp/libmpcodecs/vd_dshow.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpcodecs/vd_huffyuv.c mplayerxp/libmpcodecs/vd_libdv.c mplayerxp/libmpcodecs/vd_libmpeg2.c mplayerxp/libmpcodecs/vd_mpegpes.c mplayerxp/libmpcodecs/vd_nuv.c mplayerxp/libmpcodecs/vd_qtvideo.c mplayerxp/libmpcodecs/vd_raw.c mplayerxp/libmpcodecs/vd_real.c mplayerxp/libmpcodecs/vd_theora.c mplayerxp/libmpcodecs/vd_vfw.c mplayerxp/libmpcodecs/vd_xanim.c mplayerxp/libmpcodecs/vd_xvid.c mplayerxp/libmpdemux/demux_bmp.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_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_viv.c mplayerxp/libmpdemux/demux_y4m.c mplayerxp/libmpdemux/s_tv.c mplayerxp/libmpdemux/stheader.h mplayerxp/libmpdemux/video.c mplayerxp/loader/qtx/qtxsdk/components.h mplayerxp/mplayer.c mplayerxp/postproc/vf.c Modified: mplayerxp/dump.c =================================================================== --- mplayerxp/dump.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/dump.c 2012-10-26 10:04:44 UTC (rev 216) @@ -204,9 +204,9 @@ { shv->bih=malloc(sizeof(BITMAPINFOHEADER)); shv->bih->biSize=sizeof(BITMAPINFOHEADER); - shv->bih->biWidth=shv->disp_w; - shv->bih->biHeight=shv->disp_h; - shv->bih->biCompression=shv->format; + shv->bih->biWidth=shv->src_w; + shv->bih->biHeight=shv->src_h; + shv->bih->biCompression=shv->fourcc; shv->bih->biPlanes=1; shv->bih->biBitCount=24; // FIXME!!! shv->bih->biSizeImage=shv->bih->biWidth*shv->bih->biHeight*(shv->bih->biBitCount/8); Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-26 10:04:44 UTC (rev 216) @@ -95,7 +95,7 @@ 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->format, + while((sh_video->codec=find_codec(sh_video->fourcc, sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL, sh_video->codec,0) )){ // ok we found one codec @@ -151,14 +151,14 @@ case IMGFMT_RGB32: case IMGFMT_BGR32: bpp = 32; break; } - o_bps=sh_video->fps*sh_video->disp_w*sh_video->disp_h*bpp/8; + 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" ,video_codec?"Forcing":"Selected" ,sh_video->codec->codec_name ,mpvdec->info->driver_name ,sh_video->codec->dll_name - ,sh_video->disp_w - ,sh_video->disp_h + ,sh_video->src_w + ,sh_video->src_h ,sh_video->aspect ,sh_video->fps); // Yeah! We got it! Modified: mplayerxp/libmpcodecs/vd.c =================================================================== --- mplayerxp/libmpcodecs/vd.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd.c 2012-10-26 10:04:44 UTC (rev 216) @@ -108,16 +108,16 @@ vf_instance_t* vf=sh->vfilter,*sc=NULL; int palette=0; - if(!(sh->disp_w && sh->disp_h)) + if(!(sh->src_w && sh->src_h)) MSG_WARN( - "VDec: driver %s didn't set sh->disp_w and sh->disp_h, trying to workaround!\n" + "VDec: driver %s didn't set sh->src_w and sh->src_h, trying to workaround!\n" ,sh->codec->codec_name); /* XXX: HACK, if sh->disp_* aren't set, * but we have w and h, set them :: atmos */ - if(!sh->disp_w && w) - sh->disp_w=w; - if(!sh->disp_h && h) - sh->disp_h=h; + if(!sh->src_w && w) + sh->src_w=w; + if(!sh->src_h && h) + sh->src_h=h; MSG_V("VDec: vo config request - %d x %d\n", w,h); @@ -211,13 +211,13 @@ if(!vo_conf.vidmode){ if(!screen_size_x) screen_size_x=1; if(!screen_size_y) screen_size_y=1; - if(screen_size_x<=8) screen_size_x*=sh->disp_w; - if(screen_size_y<=8) screen_size_y*=sh->disp_h; + if(screen_size_x<=8) screen_size_x*=sh->src_w; + if(screen_size_y<=8) screen_size_y*=sh->src_h; } } else { // check source format aspect, calculate prescale ::atmos - screen_size_x=sh->disp_w; - screen_size_y=sh->disp_h; + screen_size_x=sh->src_w; + screen_size_y=sh->src_h; if(vo_conf.screen_size_xy>=0.001){ if(vo_conf.screen_size_xy<=8){ // -xy means x+y scale @@ -226,7 +226,7 @@ } else { // -xy means forced width while keeping correct aspect screen_size_x=vo_conf.screen_size_xy; - screen_size_y=vo_conf.screen_size_xy*sh->disp_h/sh->disp_w; + screen_size_y=vo_conf.screen_size_xy*sh->src_h/sh->src_w; } } if(sh->aspect>0.01){ @@ -238,8 +238,8 @@ if(_w<screen_size_x || vo_conf.screen_size_xy>8){ screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect)); screen_size_y+=screen_size_y%2; // round - if(screen_size_y<sh->disp_h) // Do not downscale verticaly - screen_size_y=sh->disp_h; + if(screen_size_y<sh->src_h) // Do not downscale verticaly + screen_size_y=sh->src_h; } else screen_size_x=_w; // keep new width } else { MSG_V("Movie-Aspect is undefined - no prescaling applied.\n"); @@ -247,13 +247,13 @@ } MSG_V("vf->config(%dx%d->%dx%d,flags=0x%x,'%s',%s)\n", - sh->disp_w,sh->disp_h, + sh->src_w,sh->src_h, screen_size_x,screen_size_y, vo_data->flags, "MPlayerXP",vo_format_name(out_fmt)); MSG_DBG2("vf configuring: %s\n",vf->info->name); - if(vf->config(vf,sh->disp_w,sh->disp_h, + if(vf->config(vf,sh->src_w,sh->src_h, screen_size_x,screen_size_y, vo_data->flags, out_fmt,tune)==0){ @@ -262,7 +262,7 @@ return 0; } MSG_DBG2("vf->config(%dx%d->%dx%d,flags=%d,'%s',%p)\n", - sh->disp_w,sh->disp_h, + sh->src_w,sh->src_h, screen_size_x,screen_size_y, vo_data->flags, vo_format_name(out_fmt),tune); Modified: mplayerxp/libmpcodecs/vd_divx4.c =================================================================== --- mplayerxp/libmpcodecs/vd_divx4.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_divx4.c 2012-10-26 10:04:44 UTC (rev 216) @@ -190,7 +190,7 @@ priv_t*p; int bits=12; if(!load_lib("libdivx"SLIBSUFFIX)) return 0; - if(!(mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL))) return 0; + if(!(mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL))) return 0; switch(sh->codec->outfmt[sh->outfmtidx]){ case IMGFMT_YV12: case IMGFMT_I420: @@ -202,19 +202,19 @@ if(!(p=malloc(sizeof(priv_t)))) { MSG_ERR("Out of memory\n"); return 0; } sh->context=p; memset(p,0,sizeof(priv_t)); - if(!(p->decoder=getDecore_ptr(sh->format))) { - char *p=(char *)&(sh->format); + if(!(p->decoder=getDecore_ptr(sh->fourcc))) { + char *p=(char *)&(sh->fourcc); MSG_ERR("Can't find decoder for %c%c%c%c fourcc\n",p[0],p[1],p[2],p[3]); return 0; } dinit.formatOut.fourCC=sh->codec->outfmt[sh->outfmtidx]; dinit.formatOut.bpp=bits; - dinit.formatOut.width=sh->disp_w; - dinit.formatOut.height=sh->disp_h; + dinit.formatOut.width=sh->src_w; + dinit.formatOut.height=sh->src_h; dinit.formatOut.pixelAspectX=1; dinit.formatOut.pixelAspectY=1; - dinit.formatOut.sizeMax=sh->disp_w*sh->disp_h*bits; - dinit.formatIn.fourCC=sh->format; + dinit.formatOut.sizeMax=sh->src_w*sh->src_h*bits; + dinit.formatIn.fourCC=sh->fourcc; dinit.formatIn.framePeriod=sh->fps; if(p->decoder(NULL, DEC_OPT_INIT, (any_t*) &p->pHandle, &dinit)!=DEC_OK) { char *p=(char *)&(dinit.formatOut); @@ -243,7 +243,7 @@ if(len<=0) return NULL; // skipped frame mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_PRESERVE | MP_IMGFLAG_ACCEPT_WIDTH, - sh->disp_w, sh->disp_h); + sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; decFrame.bitstream.pBuff = data; Modified: mplayerxp/libmpcodecs/vd_dmo.c =================================================================== --- mplayerxp/libmpcodecs/vd_dmo.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_dmo.c 2012-10-26 10:04:44 UTC (rev 216) @@ -53,7 +53,7 @@ "package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.tar.bz2!\n"); return 0; } - if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL)) return 0; + if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL)) return 0; out_fmt=sh->codec->outfmt[sh->outfmtidx]; switch(out_fmt){ case IMGFMT_YUY2: @@ -90,7 +90,7 @@ } mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, - sh->disp_w, sh->disp_h); + sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; if(!mpi){ // temporary! Modified: mplayerxp/libmpcodecs/vd_dshow.c =================================================================== --- mplayerxp/libmpcodecs/vd_dshow.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_dshow.c 2012-10-26 10:04:44 UTC (rev 216) @@ -68,7 +68,7 @@ MSG_HINT("package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip !\n"); return 0; } - if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL)) return 0; + if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL)) return 0; out_fmt=sh->codec->outfmt[sh->outfmtidx]; switch(out_fmt){ case IMGFMT_YUY2: @@ -106,7 +106,7 @@ } mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, - sh->disp_w, sh->disp_h); + sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; DS_VideoDecoder_DecodeInternal(sh->context, data, len, sh->ds->flags&1, mpi->planes[0]); Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-26 10:04:44 UTC (rev 216) @@ -206,10 +206,10 @@ vfi.pitch[1]= vfi.pitch[2]=16; } - sh->disp_w=w;//(w+valign)&(~valign); - sh->disp_h=(h+halign)&(~halign); + sh->src_w=w;//(w+valign)&(~valign); + sh->src_h=(h+halign)&(~halign); vdff_ctx->vo_inited=1; - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,&vfi); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,&vfi); } return 1; } @@ -246,12 +246,12 @@ #ifdef CODEC_FLAG_NOT_TRUNCATED vdff_ctx->ctx->flags|= CODEC_FLAG_NOT_TRUNCATED; #endif - vdff_ctx->ctx->width = sh->disp_w; - vdff_ctx->ctx->height= sh->disp_h; + vdff_ctx->ctx->width = sh->src_w; + vdff_ctx->ctx->height= sh->src_h; // vdff_ctx->ctx->error_recognition= lavc_param_error_resilience; vdff_ctx->ctx->error_concealment= lavc_param_error_concealment; vdff_ctx->ctx->debug= lavc_param_debug; - vdff_ctx->ctx->codec_tag= sh->format; + vdff_ctx->ctx->codec_tag= sh->fourcc; vdff_ctx->ctx->stream_codec_tag=sh->video.fccHandler; vdff_ctx->ctx->idct_algo=0; /*auto*/ #if 0 @@ -279,8 +279,8 @@ /* Pegasus MJPEG stores it also in AVI header, but it uses the common MJPG fourcc :( */ if (sh->bih && (sh->bih->biSize != sizeof(BITMAPINFOHEADER)) && - (sh->format == mmioFOURCC('A','V','R','n') || - sh->format == mmioFOURCC('M','J','P','G'))) + (sh->fourcc == mmioFOURCC('A','V','R','n') || + sh->fourcc == mmioFOURCC('M','J','P','G'))) { // vdff_ctx->ctx->flags |= CODEC_FLAG_EXTERN_HUFF; vdff_ctx->ctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); @@ -288,11 +288,11 @@ memcpy(vdff_ctx->ctx->extradata, sh->bih+sizeof(BITMAPINFOHEADER), vdff_ctx->ctx->extradata_size); } - if( sh->format == mmioFOURCC('R', 'V', '1', '0') - || sh->format == mmioFOURCC('R', 'V', '1', '3') - || sh->format == mmioFOURCC('R', 'V', '2', '0') - || sh->format == mmioFOURCC('R', 'V', '3', '0') - || sh->format == mmioFOURCC('R', 'V', '4', '0')) + if( sh->fourcc == mmioFOURCC('R', 'V', '1', '0') + || sh->fourcc == mmioFOURCC('R', 'V', '1', '3') + || sh->fourcc == mmioFOURCC('R', 'V', '2', '0') + || sh->fourcc == mmioFOURCC('R', 'V', '3', '0') + || sh->fourcc == mmioFOURCC('R', 'V', '4', '0')) { vdff_ctx->ctx->extradata_size= 8; vdff_ctx->ctx->extradata = malloc(vdff_ctx->ctx->extradata_size); @@ -300,7 +300,7 @@ /* only 1 packet per frame & sub_id from fourcc */ ((uint32_t*)vdff_ctx->ctx->extradata)[0] = 0; ((uint32_t*)vdff_ctx->ctx->extradata)[1] = - (sh->format == mmioFOURCC('R', 'V', '1', '3')) ? 0x10003001 : 0x10000000; + (sh->fourcc == mmioFOURCC('R', 'V', '1', '3')) ? 0x10003001 : 0x10000000; } else { /* has extra slice header (demux_rm or rm->avi streamcopy) */ unsigned int* extrahdr=(unsigned int*)(sh->bih+1); @@ -309,23 +309,23 @@ } } if (sh->bih && (sh->bih->biSize != sizeof(BITMAPINFOHEADER)) && - (sh->format == mmioFOURCC('M','4','S','2') || - sh->format == mmioFOURCC('M','P','4','S') || - sh->format == mmioFOURCC('H','F','Y','U') || - sh->format == mmioFOURCC('F','F','V','H') || - sh->format == mmioFOURCC('W','M','V','2') || - sh->format == mmioFOURCC('W','M','V','3') || - sh->format == mmioFOURCC('A','S','V','1') || - sh->format == mmioFOURCC('A','S','V','2') || - sh->format == mmioFOURCC('V','S','S','H') || - sh->format == mmioFOURCC('M','S','Z','H') || - sh->format == mmioFOURCC('Z','L','I','B') || - sh->format == mmioFOURCC('M','P','4','V') || - sh->format == mmioFOURCC('F','L','I','C') || - sh->format == mmioFOURCC('S','N','O','W') || - sh->format == mmioFOURCC('a','v','c','1') || - sh->format == mmioFOURCC('L','O','C','O') || - sh->format == mmioFOURCC('t','h','e','o') + (sh->fourcc == mmioFOURCC('M','4','S','2') || + sh->fourcc == mmioFOURCC('M','P','4','S') || + sh->fourcc == mmioFOURCC('H','F','Y','U') || + sh->fourcc == mmioFOURCC('F','F','V','H') || + sh->fourcc == mmioFOURCC('W','M','V','2') || + sh->fourcc == mmioFOURCC('W','M','V','3') || + sh->fourcc == mmioFOURCC('A','S','V','1') || + sh->fourcc == mmioFOURCC('A','S','V','2') || + sh->fourcc == mmioFOURCC('V','S','S','H') || + sh->fourcc == mmioFOURCC('M','S','Z','H') || + sh->fourcc == mmioFOURCC('Z','L','I','B') || + sh->fourcc == mmioFOURCC('M','P','4','V') || + sh->fourcc == mmioFOURCC('F','L','I','C') || + sh->fourcc == mmioFOURCC('S','N','O','W') || + sh->fourcc == mmioFOURCC('a','v','c','1') || + sh->fourcc == mmioFOURCC('L','O','C','O') || + sh->fourcc == mmioFOURCC('t','h','e','o') )) { vdff_ctx->ctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); @@ -333,7 +333,7 @@ memcpy(vdff_ctx->ctx->extradata, sh->bih+1, vdff_ctx->ctx->extradata_size); } if (sh->ImageDesc && - sh->format == mmioFOURCC('S','V','Q','3')){ + sh->fourcc == mmioFOURCC('S','V','Q','3')){ vdff_ctx->ctx->extradata_size = *(int*)sh->ImageDesc; vdff_ctx->ctx->extradata = malloc(vdff_ctx->ctx->extradata_size); memcpy(vdff_ctx->ctx->extradata, ((int*)sh->ImageDesc)+1, vdff_ctx->ctx->extradata_size); @@ -380,7 +380,7 @@ } MSG_V("INFO: libavcodec.so (%06X) video codec[%c%c%c%c] init OK!\n" ,avc_version - ,((char *)&sh->format)[0],((char *)&sh->format)[1],((char *)&sh->format)[2],((char *)&sh->format)[3]); + ,((char *)&sh->fourcc)[0],((char *)&sh->fourcc)[1],((char *)&sh->fourcc)[2],((char *)&sh->fourcc)[3]); if(npp_options) { pp_flags=0; @@ -408,10 +408,10 @@ } if(pp_flags) { - ppContext=pp2_get_context(sh->disp_w,sh->disp_h,pp_flags); + ppContext=pp2_get_context(sh->src_w,sh->src_h,pp_flags); } } - return ff_config_vo(sh,sh->disp_w,sh->disp_h); + return ff_config_vo(sh,sh->src_w,sh->src_h); } // uninit driver @@ -663,10 +663,10 @@ /* if codec is capable DR1 if sh->vfilter==vf_vo (DR1 is meaningless into temp buffer) - It always happens with (vidix+bus mastering), (if (disp_w%16==0)) with xv + It always happens with (vidix+bus mastering), (if (src_w%16==0)) with xv */ has_b_frames=vdff_ctx->ctx->has_b_frames|| - sh->format==0x10000001 || /* mpeg1 may have b frames */ + sh->fourcc==0x10000001 || /* mpeg1 may have b frames */ vdff_ctx->lavc_codec->id==CODEC_ID_SVQ3|| 1; mpi= mpcodecs_get_image(sh,has_b_frames?MP_IMGTYPE_IPB:MP_IMGTYPE_IP,MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE|MP_IMGFLAG_READABLE|MP_IMGFLAG_PRESERVE, @@ -680,11 +680,11 @@ vdff_ctx->use_slices=0; } if(vdff_ctx->use_slices) vdff_ctx->use_dr1=0; - if( sh->format == mmioFOURCC('R', 'V', '1', '0') - || sh->format == mmioFOURCC('R', 'V', '1', '3') - || sh->format == mmioFOURCC('R', 'V', '2', '0') - || sh->format == mmioFOURCC('R', 'V', '3', '0') - || sh->format == mmioFOURCC('R', 'V', '4', '0')) + if( sh->fourcc == mmioFOURCC('R', 'V', '1', '0') + || sh->fourcc == mmioFOURCC('R', 'V', '1', '3') + || sh->fourcc == mmioFOURCC('R', 'V', '2', '0') + || sh->fourcc == mmioFOURCC('R', 'V', '3', '0') + || sh->fourcc == mmioFOURCC('R', 'V', '4', '0')) if(sh->bih->biSize==sizeof(*sh->bih)+8){ int i; dp_hdr_t *hdr= (dp_hdr_t*)data; @@ -711,7 +711,7 @@ } if(!(flags&3) && vdff_ctx->use_slices) { - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_DIRECT,sh->disp_w, sh->disp_h); + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_DIRECT,sh->src_w, sh->src_h); vdff_ctx->mpi = mpi; vdff_ctx->frame_number++; vdff_ctx->ctx->draw_horiz_band=draw_slice; @@ -735,7 +735,7 @@ if(!got_picture) return NULL; // skipped image if(!vdff_ctx->ctx->draw_horiz_band) { - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,sh->disp_w,sh->disp_h); + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,sh->src_w,sh->src_h); if(!mpi){ // temporary! MSG_ERR("couldn't allocate image for ffmpeg codec\n"); return NULL; Modified: mplayerxp/libmpcodecs/vd_huffyuv.c =================================================================== --- mplayerxp/libmpcodecs/vd_huffyuv.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_huffyuv.c 2012-10-26 10:04:44 UTC (rev 216) @@ -317,7 +317,7 @@ switch (hc->bitmaptype) { case BMPTYPE_RGB: case BMPTYPE_YUV: - vo_ret = mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL); + vo_ret = mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL); break; case BMPTYPE_RGBA: MSG_ERR( "[HuffYUV] RGBA not supported yet.\n"); @@ -517,8 +517,8 @@ unsigned char *abovebuf = hc->abovebuf1; unsigned char *curbuf = hc->abovebuf2; unsigned char *outptr; - int width = sh->disp_w; // Real image width - int height = sh->disp_h; // Real image height + int width = sh->src_w; // Real image width + int height = sh->src_h; // Real image height int bgr32; // skipped frame @@ -527,9 +527,9 @@ /* Do not accept stride for rgb, it gives me wrong output :-( */ if (hc->bitmaptype == BMPTYPE_YUV) - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,sh->disp_w, sh->disp_h); + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,sh->src_w, sh->src_h); else - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0,sh->disp_w, sh->disp_h); + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0,sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; outptr = mpi->planes[0]; // Output image pointer Modified: mplayerxp/libmpcodecs/vd_libdv.c =================================================================== --- mplayerxp/libmpcodecs/vd_libdv.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_libdv.c 2012-10-26 10:04:44 UTC (rev 216) @@ -53,7 +53,7 @@ static int init(sh_video_t *sh) { sh->context = (any_t*)init_global_rawdv_decoder(); - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL); } // uninit driver @@ -73,7 +73,7 @@ dv_parse_header(decoder, data); - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, sh->disp_w, sh->disp_h); + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, sh->src_w, sh->src_h); if(!mpi){ // temporary! MSG_ERR("couldn't allocate image for stderr codec\n"); Modified: mplayerxp/libmpcodecs/vd_libmpeg2.c =================================================================== --- mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_libmpeg2.c 2012-10-26 10:04:44 UTC (rev 216) @@ -188,7 +188,7 @@ if(!load_lib("libmpeg2"SLIBSUFFIX)) return 0; priv=sh->context=malloc(sizeof(priv_t)); if(!(priv->mpeg2dec=mpeg2_init(mplayer_accel))) return 0; - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL); } // uninit driver Modified: mplayerxp/libmpcodecs/vd_mpegpes.c =================================================================== --- mplayerxp/libmpcodecs/vd_mpegpes.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_mpegpes.c 2012-10-26 10:04:44 UTC (rev 216) @@ -26,7 +26,7 @@ // init driver static int init(sh_video_t *sh){ - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL); } // uninit driver @@ -37,7 +37,7 @@ static mp_image_t* decode(sh_video_t *sh,any_t* data,int len,int flags){ mp_image_t* mpi; static vo_mpegpes_t packet; - mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0,sh->disp_w, sh->disp_h); + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0,sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; packet.data=data; packet.size=len-4; Modified: mplayerxp/libmpcodecs/vd_nuv.c =================================================================== --- mplayerxp/libmpcodecs/vd_nuv.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_nuv.c 2012-10-26 10:04:44 UTC (rev 216) @@ -33,7 +33,7 @@ // init driver static int init(sh_video_t *sh){ - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL); } // uninit driver @@ -46,10 +46,10 @@ if(len<=0) return NULL; // skipped frame mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0, - sh->disp_w, sh->disp_h); + sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; - decode_nuv(data, len, mpi->planes[0], sh->disp_w, sh->disp_h); + decode_nuv(data, len, mpi->planes[0], sh->src_w, sh->src_h); return mpi; } Modified: mplayerxp/libmpcodecs/vd_qtvideo.c =================================================================== --- mplayerxp/libmpcodecs/vd_qtvideo.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_qtvideo.c 2012-10-26 10:04:44 UTC (rev 216) @@ -196,7 +196,7 @@ (((unsigned char)'Q')<<8)| (((unsigned char)'3')); #else - desc.componentSubType = bswap_32(sh->format); + desc.componentSubType = bswap_32(sh->fourcc); #endif desc.componentManufacturer=0; desc.componentFlags=0; @@ -227,8 +227,8 @@ //make a yuy2 gworld OutBufferRect.top=0; OutBufferRect.left=0; - OutBufferRect.right=sh->disp_w; - OutBufferRect.bottom=sh->disp_h; + OutBufferRect.right=sh->src_w; + OutBufferRect.bottom=sh->src_h; //Fill the imagedescription for our SVQ3 frame //we can probably get this from Demuxer @@ -292,10 +292,10 @@ } MSG_V("imgfmt: %s qt_imgfmt: %.4s\n", vo_format_name(imgfmt), &qt_imgfmt); sh->context = qt_imgfmt; - if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL)) return 0; + if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL)) return 0; } #else - if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL)) return 0; + if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL)) return 0; #endif return 1; @@ -318,7 +318,7 @@ if(len<=0) return NULL; // skipped frame mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, - sh->disp_w, sh->disp_h); + sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; decpar.data = (char*)data; Modified: mplayerxp/libmpcodecs/vd_raw.c =================================================================== --- mplayerxp/libmpcodecs/vd_raw.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_raw.c 2012-10-26 10:04:44 UTC (rev 216) @@ -31,18 +31,18 @@ // init driver static int init(sh_video_t *sh){ // set format fourcc for raw RGB: - if(sh->format==0){ + if(sh->fourcc==0){ switch(sh->bih->biBitCount){ - case 8: sh->format=IMGFMT_BGR8; break; + case 8: sh->fourcc=IMGFMT_BGR8; break; case 15: - case 16: sh->format=IMGFMT_BGR15; break; - case 24: sh->format=IMGFMT_BGR24; break; - case 32: sh->format=IMGFMT_BGR32; break; + case 16: sh->fourcc=IMGFMT_BGR15; break; + case 24: sh->fourcc=IMGFMT_BGR24; break; + case 32: sh->fourcc=IMGFMT_BGR32; break; default: MSG_WARN("RAW: depth %d not supported\n",sh->bih->biBitCount); } } - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL); } // uninit driver @@ -55,7 +55,7 @@ if(len<=0) return NULL; // skipped frame mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, - sh->disp_w, sh->disp_h); + sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; if(mpi->flags&MP_IMGFLAG_PLANAR){ Modified: mplayerxp/libmpcodecs/vd_real.c =================================================================== --- mplayerxp/libmpcodecs/vd_real.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_real.c 2012-10-26 10:04:44 UTC (rev 216) @@ -152,7 +152,7 @@ // we export codec id and sub-id from demuxer in bitmapinfohdr: unsigned int* extrahdr=(unsigned int*)(sh->bih+1); struct rv_init_t init_data={ - 11, sh->disp_w, sh->disp_h,0,0,extrahdr[0], + 11, sh->src_w, sh->src_h,0,0,extrahdr[0], 1,extrahdr[1]}; // rv30 MSG_V("realvideo codec id: 0x%08X sub-id: 0x%08X\n",extrahdr[1],extrahdr[0]); @@ -161,7 +161,7 @@ return 0; } // only I420 supported - if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL)) return 0; + if(!mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL)) return 0; // init codec: sh->context=NULL; result=(*rvyuv_init)(&init_data, &sh->context); @@ -171,7 +171,7 @@ } // setup rv30 codec (codec sub-type and image dimensions): if(extrahdr[1]>=0x20200002){ - uint32_t cmsg24[4]={sh->disp_w,sh->disp_h,sh->disp_w,sh->disp_h}; + uint32_t cmsg24[4]={sh->src_w,sh->src_h,sh->src_w,sh->src_h}; /* FIXME: Broken for 64-bit pointers */ cmsg_data_t cmsg_data={0x24,1+(extrahdr[1]&7), &cmsg24[0]}; (*rvyuv_custom_message)(&cmsg_data,sh->context); @@ -209,7 +209,7 @@ if(len<=0 || flags&2) return NULL; // skipped frame || hardframedrop mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/, - sh->disp_w, sh->disp_h); + sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; result=(*rvyuv_transform)(dp_data, mpi->planes[0], &transform_in, Modified: mplayerxp/libmpcodecs/vd_theora.c =================================================================== --- mplayerxp/libmpcodecs/vd_theora.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_theora.c 2012-10-26 10:04:44 UTC (rev 216) @@ -122,7 +122,7 @@ MSG_V("INFO: Theora video init ok!\n"); - return mpcodecs_config_vo (sh,sh->disp_w,sh->disp_h,NULL); + return mpcodecs_config_vo (sh,sh->src_w,sh->src_h,NULL); } /* @@ -172,7 +172,7 @@ return 0; } - mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0,sh->disp_w, sh->disp_h); + mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0,sh->src_w, sh->src_h); mpi->planes[0]=yuv.y; mpi->stride[0]=yuv.y_stride; Modified: mplayerxp/libmpcodecs/vd_vfw.c =================================================================== --- mplayerxp/libmpcodecs/vd_vfw.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_vfw.c 2012-10-26 10:04:44 UTC (rev 216) @@ -116,7 +116,7 @@ ex = priv->ex; MSG_V("======= Win32 (VFW) VIDEO Codec init =======\n"); - priv->hic = ICOpen(IC_FCCTYPE, sh_video->format, ICMODE_DECOMPRESS); + priv->hic = ICOpen(IC_FCCTYPE, sh_video->fourcc, ICMODE_DECOMPRESS); if(!priv->hic){ MSG_ERR("ICOpen failed! unknown codec / wrong parameters?\n"); return 0; @@ -268,7 +268,7 @@ priv->ex = vfw_ex; if(!init_vfw_video_codec(sh)) return 0; MSG_V("INFO: Win32/VFW init OK!\n"); - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL); } // uninit driver @@ -290,7 +290,7 @@ mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_WIDTH, - sh->disp_w, sh->disp_h); + sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; // set stride: (trick discovered by Andreas Ackermann - thanx!) Modified: mplayerxp/libmpcodecs/vd_xanim.c =================================================================== --- mplayerxp/libmpcodecs/vd_xanim.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_xanim.c 2012-10-26 10:04:44 UTC (rev 216) @@ -393,8 +393,8 @@ codec_hdr.description = vidinfo->codec->s_info; codec_hdr.compression = bswap_32(vidinfo->bih->biCompression); codec_hdr.decoder = NULL; - codec_hdr.x = vidinfo->bih->biWidth; /* ->disp_w */ - codec_hdr.y = vidinfo->bih->biHeight; /* ->disp_h */ + codec_hdr.x = vidinfo->bih->biWidth; /* ->src_w */ + codec_hdr.y = vidinfo->bih->biHeight; /* ->src_h */ /* extra fields to store palette */ codec_hdr.avi_ctab_flag = 0; codec_hdr.avi_read_ext = NULL; @@ -908,7 +908,7 @@ // init driver static int init(sh_video_t *sh){ if(xacodec_init_video(sh,sh->codec->outfmt[sh->outfmtidx])) - return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,NULL); + return mpcodecs_config_vo(sh,sh->src_w,sh->src_h,NULL); return 0; } @@ -928,7 +928,7 @@ if(!image) return NULL; mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, - sh->disp_w, sh->disp_h); + sh->src_w, sh->src_h); if(!mpi) return NULL; mpi->planes[0]=image->planes[0]; Modified: mplayerxp/libmpcodecs/vd_xvid.c =================================================================== --- mplayerxp/libmpcodecs/vd_xvid.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpcodecs/vd_xvid.c 2012-10-26 10:04:44 UTC (rev 216) @@ -347,7 +347,7 @@ * VOL encountered (don't trust containers' width and height) */ dec_p.width = dec_p.height= 0; - dec_p.fourcc= sh->format; + dec_p.fourcc= sh->fourcc; dec_p.num_threads=xvid_gbl_info.num_threads; /* Get a decoder instance */ @@ -380,7 +380,7 @@ p->img_type = MP_IMGTYPE_TEMP; break; } - return mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, NULL); + return mpcodecs_config_vo(sh, sh->src_w, sh->src_h, NULL); } // uninit driver @@ -424,7 +424,7 @@ if(flags&3) dec.general |= XVID_DEC_DROP; dec.output.csp = p->cs; mpi = mpcodecs_get_image(sh, p->img_type, MP_IMGFLAG_ACCEPT_STRIDE, - sh->disp_w, sh->disp_h); + sh->src_w, sh->src_h); if(mpi->flags&MP_IMGFLAG_DIRECT) mpi->flags|=MP_IMGFLAG_RENDERED; if(p->cs != XVID_CSP_INTERNAL) { dec.output.plane[0] = mpi->planes[0]; Modified: mplayerxp/libmpdemux/demux_bmp.c =================================================================== --- mplayerxp/libmpdemux/demux_bmp.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_bmp.c 2012-10-26 10:04:44 UTC (rev 216) @@ -154,12 +154,12 @@ switch(img->format->BitsPerPixel) { default: - case 8: sh_video->format = npal_colors > 0 ? IMGFMT_BGR24 : + case 8: sh_video->fourcc = npal_colors > 0 ? IMGFMT_BGR24 : img->format->Bshift < img->format->Rshift ? IMGFMT_BGR8 : IMGFMT_RGB8; break; - case 15: sh_video->format = img->format->Bshift < img->format->Rshift ? IMGFMT_BGR15 : IMGFMT_RGB15; break; - case 16: sh_video->format = img->format->Bshift < img->format->Rshift ? IMGFMT_BGR16 : IMGFMT_RGB16; break; - case 24: sh_video->format = img->format->Bshift < img->format->Rshift ? IMGFMT_BGR24 : IMGFMT_RGB24; break; - case 32: sh_video->format = img->format->Bshift < img->format->Rshift ? IMGFMT_BGR32 : IMGFMT_RGB32; break; + case 15: sh_video->fourcc = img->format->Bshift < img->format->Rshift ? IMGFMT_BGR15 : IMGFMT_RGB15; break; + case 16: sh_video->fourcc = img->format->Bshift < img->format->Rshift ? IMGFMT_BGR16 : IMGFMT_RGB16; break; + case 24: sh_video->fourcc = img->format->Bshift < img->format->Rshift ? IMGFMT_BGR24 : IMGFMT_RGB24; break; + case 32: sh_video->fourcc = img->format->Bshift < img->format->Rshift ? IMGFMT_BGR32 : IMGFMT_RGB32; break; } // custom fourcc for internal MPlayer use MSG_V("demux_bmp: bpp=%u w=%u h=%u RGB_fmt(loss: %u %u %u %u shift: %u %u %u %u mask %u %u %u %u) palette=%u\n" @@ -177,8 +177,8 @@ ,img->format->Gmask ,img->format->Rmask ,npal_colors); - sh_video->disp_w = img->w; - sh_video->disp_h = img->h; + sh_video->src_w = img->w; + sh_video->src_h = img->h; sh_video->is_static = 1; // get the speed sh_video->fps = 2; @@ -273,10 +273,10 @@ bmp_image->image_offset = data_offset; // custom fourcc for internal MPlayer use - sh_video->format = sh_video->bih->biCompression; + sh_video->fourcc = sh_video->bih->biCompression; - sh_video->disp_w = sh_video->bih->biWidth; - sh_video->disp_h = sh_video->bih->biHeight; + sh_video->src_w = sh_video->bih->biWidth; + sh_video->src_h = sh_video->bih->biHeight; // get the speed sh_video->is_static = 1; Modified: mplayerxp/libmpdemux/demux_dv.c =================================================================== --- mplayerxp/libmpdemux/demux_dv.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_dv.c 2012-10-26 10:04:44 UTC (rev 216) @@ -175,10 +175,10 @@ // custom fourcc for internal MPlayer use // sh_video->format = mmioFOURCC('R', 'A', 'D', 'V'); - sh_video->format = mmioFOURCC('D', 'V', 'S', 'D'); + sh_video->fourcc = mmioFOURCC('D', 'V', 'S', 'D'); - sh_video->disp_w = dv_decoder->width; - sh_video->disp_h = dv_decoder->height; + sh_video->src_w = dv_decoder->width; + sh_video->src_h = dv_decoder->height; mp_msg(MSGT_DEMUXER,MSGL_V,"demux_open_rawdv() frame_size: %d w: %d h: %d dif_seq: %d system: %d\n",dv_decoder->frame_size,dv_decoder->width, dv_decoder->height,dv_decoder->num_dif_seqs,dv_decoder->system); sh_video->fps= (dv_decoder->system==e_dv_system_525_60?29.97:25); @@ -190,7 +190,7 @@ sh_video->bih->biHeight = dv_decoder->height; sh_video->bih->biPlanes=1; sh_video->bih->biBitCount=24; - sh_video->bih->biCompression=sh_video->format; // "DVSD" + sh_video->bih->biCompression=sh_video->fourcc; // "DVSD" sh_video->bih->biSizeImage=sh_video->bih->biWidth*sh_video->bih->biHeight*3; Modified: mplayerxp/libmpdemux/demux_film.c =================================================================== --- mplayerxp/libmpdemux/demux_film.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_film.c 2012-10-26 10:04:44 UTC (rev 216) @@ -137,7 +137,7 @@ else { // if the demuxer is dealing with CVID data, deal with it a special way - if (sh_video->format == mmioFOURCC('c', 'v', 'i', 'd')) + if (sh_video->fourcc == mmioFOURCC('c', 'v', 'i', 'd')) { if (film_data->film_version) length_fix_bytes = 2; @@ -265,12 +265,12 @@ demuxer->video->sh = sh_video; sh_video->ds = demuxer->video; - sh_video->format = video_format; - sh_video->disp_h = stream_read_dword(demuxer->stream); - sh_video->disp_w = stream_read_dword(demuxer->stream); + sh_video->fourcc= video_format; + sh_video->src_h = stream_read_dword(demuxer->stream); + sh_video->src_w = stream_read_dword(demuxer->stream); MSG_V( - " FILM video: %d x %d\n", sh_video->disp_w, - sh_video->disp_h); + " FILM video: %d x %d\n", sh_video->src_w, + sh_video->src_h); } else // skip height and width if no video Modified: mplayerxp/libmpdemux/demux_fli.c =================================================================== --- mplayerxp/libmpdemux/demux_fli.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_fli.c 2012-10-26 10:04:44 UTC (rev 216) @@ -125,19 +125,19 @@ sh_video->ds = demuxer->video; // custom fourcc for internal MPlayer use - sh_video->format = mmioFOURCC('F', 'L', 'I', 'C'); + sh_video->fourcc = mmioFOURCC('F', 'L', 'I', 'C'); - sh_video->disp_w = stream_read_word_le(demuxer->stream); - sh_video->disp_h = stream_read_word_le(demuxer->stream); + sh_video->src_w = stream_read_word_le(demuxer->stream); + sh_video->src_h = stream_read_word_le(demuxer->stream); // pass extradata to codec sh_video->bih = (BITMAPINFOHEADER*)header; sh_video->bih->biSize = sizeof(BITMAPINFOHEADER) + 128; - sh_video->bih->biCompression=sh_video->format; - sh_video->bih->biWidth=sh_video->disp_w; + sh_video->bih->biCompression=sh_video->fourcc; + sh_video->bih->biWidth=sh_video->src_w; sh_video->bih->biPlanes=0; sh_video->bih->biBitCount=0; /* depth */ - sh_video->bih->biHeight=sh_video->disp_h; + sh_video->bih->biHeight=sh_video->src_h; sh_video->bih->biSizeImage=sh_video->bih->biWidth*sh_video->bih->biHeight; // skip the video depth and flags stream_skip(demuxer->stream, 4); Modified: mplayerxp/libmpdemux/demux_lavf.c =================================================================== --- mplayerxp/libmpdemux/demux_lavf.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_lavf.c 2012-10-26 10:04:44 UTC (rev 216) @@ -354,8 +354,8 @@ bih->biSizeImage = bih->biWidth * bih->biHeight * bih->biBitCount/8; bih->biCompression= codec->codec_tag; sh_video->bih= bih; - sh_video->disp_w= codec->width; - sh_video->disp_h= codec->height; + sh_video->src_w= codec->width; + sh_video->src_h= codec->height; if (st->time_base.den) { /* if container has time_base, use that */ sh_video->video.dwRate= st->time_base.den; sh_video->video.dwScale= st->time_base.num; @@ -364,7 +364,7 @@ sh_video->video.dwScale= codec->time_base.num; } sh_video->fps=av_q2d(st->r_frame_rate); - sh_video->format = bih->biCompression; + sh_video->fourcc= bih->biCompression; sh_video->aspect= codec->width * codec->sample_aspect_ratio.num / (float)(codec->height * codec->sample_aspect_ratio.den); MSG_DBG2("aspect= %d*%d/(%d*%d)\n", Modified: mplayerxp/libmpdemux/demux_mkv.c =================================================================== --- mplayerxp/libmpdemux/demux_mkv.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_mkv.c 2012-10-26 10:04:44 UTC (rev 216) @@ -2241,27 +2241,27 @@ sh_v = new_sh_video_vid (demuxer, track->tnum, vid); sh_v->bih = bih; - sh_v->format = sh_v->bih->biCompression; + sh_v->fourcc = sh_v->bih->biCompression; if (track->v_frate == 0.0) track->v_frate = 25.0; sh_v->fps = track->v_frate; sh_v->aspect = 0; if (!track->realmedia) { - sh_v->disp_w = track->v_width; - sh_v->disp_h = track->v_height; + sh_v->src_w = track->v_width; + sh_v->src_h = track->v_height; if (track->v_dheight) sh_v->aspect = (float)track->v_dwidth / (float)track->v_dheight; } else { - // vd_realvid.c will set aspect to disp_w/disp_h and rederive - // disp_w and disp_h from the RealVideo stream contents returned + // vd_realvid.c will set aspect to src_w/src_h and rederive + // src_w and src_h from the RealVideo stream contents returned // by the Real DLLs. If DisplayWidth/DisplayHeight was not set in // the Matroska file then it has already been set to PixelWidth/Height // by check_track_information. - sh_v->disp_w=bih->biWidth; - sh_v->disp_h=bih->biHeight; + sh_v->src_w=bih->biWidth; + sh_v->src_h=bih->biHeight; } sh_v->ImageDesc = ImageDesc; MSG_V( "[mkv] Aspect: %f\n", sh_v->aspect); Modified: mplayerxp/libmpdemux/demux_mov.c =================================================================== --- mplayerxp/libmpdemux/demux_mov.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_mov.c 2012-10-26 10:04:44 UTC (rev 216) @@ -956,7 +956,7 @@ unsigned char *palette_map; sh_video_t* sh=new_sh_video(demuxer,priv->track_db); int depth; - sh->format=trak->fourcc; + sh->fourcc=trak->fourcc; /* crude video delay from editlist0 hack ::atm */ if(trak->editlist_size>=1) { @@ -1057,9 +1057,9 @@ if(esds.objectTypeId==MP4OTI_MPEG2VisualSimple || esds.objectTypeId==MP4OTI_MPEG2VisualMain || esds.objectTypeId==MP4OTI_MPEG2VisualSNR || esds.objectTypeId==MP4OTI_MPEG2VisualSpatial || esds.objectTypeId==MP4OTI_MPEG2VisualHigh || esds.objectTypeId==MP4OTI_MPEG2Visual422) - sh->format=mmioFOURCC('m', 'p', 'g', '2'); + sh->fourcc=mmioFOURCC('m', 'p', 'g', '2'); else if(esds.objectTypeId==MP4OTI_MPEG1Visual) - sh->format=mmioFOURCC('m', 'p', 'g', '1'); + sh->fourcc=mmioFOURCC('m', 'p', 'g', '1'); // dump away the codec specific configuration for the AAC decoder trak->stream_header_len = esds.decoderConfigLen; @@ -1121,13 +1121,13 @@ sh->fps=trak->timescale/ ((trak->durmap_size>=1)?(float)trak->durmap[0].dur:1); - sh->disp_w=trak->stdata[25]|(trak->stdata[24]<<8); - sh->disp_h=trak->stdata[27]|(trak->stdata[26]<<8); + sh->src_w=trak->stdata[25]|(trak->stdata[24]<<8); + sh->src_h=trak->stdata[27]|(trak->stdata[26]<<8); // if image size is zero, fallback to display size - if(!sh->disp_w && !sh->disp_h) { - sh->disp_w=trak->tkdata[77]|(trak->tkdata[76]<<8); - sh->disp_h=trak->tkdata[81]|(trak->tkdata[80]<<8); - } else if(sh->disp_w!=(trak->tkdata[77]|(trak->tkdata[76]<<8))){ + if(!sh->src_w && !sh->src_h) { + sh->src_w=trak->tkdata[77]|(trak->tkdata[76]<<8); + sh->src_h=trak->tkdata[81]|(trak->tkdata[80]<<8); + } else if(sh->src_w!=(trak->tkdata[77]|(trak->tkdata[76]<<8))){ // codec and display width differ... use display one for aspect sh->aspect=trak->tkdata[77]|(trak->tkdata[76]<<8); sh->aspect/=trak->tkdata[81]|(trak->tkdata[80]<<8); @@ -1247,14 +1247,14 @@ sh->bih->biSize=40; } } - sh->bih->biWidth=sh->disp_w; - sh->bih->biHeight=sh->disp_h; + sh->bih->biWidth=sh->src_w; + sh->bih->biHeight=sh->src_h; sh->bih->biPlanes=0; sh->bih->biBitCount=depth; sh->bih->biCompression=trak->fourcc; sh->bih->biSizeImage=sh->bih->biWidth*sh->bih->biHeight; - MSG_V( "Image size: %d x %d (%d bpp)\n",sh->disp_w,sh->disp_h,sh->bih->biBitCount); + MSG_V( "Image size: %d x %d (%d bpp)\n",sh->src_w,sh->src_h,sh->bih->biBitCount); if(trak->tkdata_len>81) MSG_V( "Display size: %d x %d\n", trak->tkdata[77]|(trak->tkdata[76]<<8), Modified: mplayerxp/libmpdemux/demux_mpg.c =================================================================== --- mplayerxp/libmpdemux/demux_mpg.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_mpg.c 2012-10-26 10:04:44 UTC (rev 216) @@ -371,7 +371,7 @@ if(priv && ds->sh) { sh_video_t *sh = (sh_video_t *)ds->sh; if(priv->es_map[id - 0x1B0]) { - sh->format = priv->es_map[id - 0x1B0]; + sh->fourcc = priv->es_map[id - 0x1B0]; MSG_DBG2("ASSIGNED TO STREAM %d CODEC %x\n", id, priv->es_map[id - 0x1B0]); } } @@ -405,7 +405,7 @@ dp->pts=pts/90000.0f; if(ds==demux->video) sh=(sh_video_t *)ds->sh; else sh=NULL; - dp->flags=sh?is_mpg_keyframe(sh->format,id,dp->buffer):DP_NONKEYFRAME; + dp->flags=sh?is_mpg_keyframe(sh->fourcc,id,dp->buffer):DP_NONKEYFRAME; dp->pos=demux->filepos; ds->asf_packet=dp; if (ds==ds->demuxer->sub) { @@ -581,13 +581,13 @@ } } i=sync_video_packet(d_video); - if(sh_video->format == VIDEO_MPEG4) { + if(sh_video->fourcc == VIDEO_MPEG4) { if(i==0x1B6) { //vop (frame) startcode int pos = videobuf_len; if(!read_video_packet(d_video)) break; // EOF if((videobuffer[pos+4] & 0x3F) == 0) break;//I-frame } - } else if(sh_video->format == VIDEO_H264){ + } else if(sh_video->fourcc == VIDEO_H264){ if((i & ~0x60) == 0x101 || (i & ~0x60) == 0x102 || (i & ~0x60) == 0x105) break; } else { //default VIDEO_MPEG1/VIDEO_MPEG2 if(i==0x1B3 || i==0x1B8) break; // found it! Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-26 10:04:44 UTC (rev 216) @@ -225,9 +225,9 @@ demuxer->video->sh=sh; sh->ds=demuxer->video; sh->fps=(float)(priv->sprop[id].num_packets*1000.)/(priv->sprop[id].PlayDuration-priv->sprop[id].Preroll); - sh->format=sh->bih->biCompression; - sh->disp_w=sh->bih->biWidth; - sh->disp_h=sh->bih->biHeight; + sh->fourcc=sh->bih->biCompression; + sh->src_w=sh->bih->biWidth; + sh->src_h=sh->bih->biHeight; MSG_V("FPS: %f\n",sh->fps); break; case mmioFOURCC('v','p','r','p'): Modified: mplayerxp/libmpdemux/demux_nsv.c =================================================================== --- mplayerxp/libmpdemux/demux_nsv.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_nsv.c 2012-10-26 10:04:44 UTC (rev 216) @@ -130,7 +130,6 @@ ++priv->video_pack_no; return 1; - } @@ -142,51 +141,50 @@ unsigned char buf[10]; sh_video_t *sh_video = NULL; sh_audio_t *sh_audio = NULL; - - + nsv_priv_t * priv = malloc(sizeof(nsv_priv_t)); demuxer->priv=priv; priv->video_pack_no=0; /* disable seeking yet to be fixed*/ demuxer->flags &= ~(DEMUXF_SEEKABLE); - + stream_read(demuxer->stream,hdr,4); if(stream_eof(demuxer->stream)) return 0; - + /*** if we detected the file to be nsv and there was neither eof nor a header **** that means that its most likely a shoutcast stream so we will need to seek **** to the first occurance of the NSVs header ****/ if(!(hdr[0]==0x4E && hdr[1]==0x53 && hdr[2]==0x56)){ - // todo: replace this with a decent string search algo + // todo: replace this with a decent string search algo while(1){ stream_read(demuxer->stream,hdr,1); if(stream_eof(demuxer->stream)) return 0; if(hdr[0]!=0x4E) continue; - + stream_read(demuxer->stream,hdr+1,1); - + if(stream_eof(demuxer->stream)) return 0; if(hdr[1]!=0x53) continue; - + stream_read(demuxer->stream,hdr+2,1); - + if(stream_eof(demuxer->stream)) return 0; if(hdr[2]!=0x56) continue; - + stream_read(demuxer->stream,hdr+3,1); - + if(stream_eof(demuxer->stream)) return 0; if(hdr[3]!=0x73) continue; - + break; } } @@ -194,7 +192,7 @@ // NSV header! if(hdr[3]==0x73){ // NSVs - stream_read(demuxer->stream,hdr+4,17-4); + stream_read(demuxer->stream,hdr+4,17-4); } if(hdr[3]==0x66){ @@ -237,13 +235,13 @@ * video_read_properties() will choke */ sh_video->ds = demuxer->video; - + // bytes 4-7 video codec fourcc - priv->v_format = sh_video->format=mmioFOURCC(hdr[4],hdr[5],hdr[6],hdr[7]); - + priv->v_format = sh_video->fourcc=mmioFOURCC(hdr[4],hdr[5],hdr[6],hdr[7]); + // new video stream! parse header - sh_video->disp_w=hdr[12]|(hdr[13]<<8); - sh_video->disp_h=hdr[14]|(hdr[15]<<8); + sh_video->src_w=hdr[12]|(hdr[13]<<8); + sh_video->src_h=hdr[14]|(hdr[15]<<8); sh_video->bih=(BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER)); sh_video->bih->biSize=sizeof(BITMAPINFOHEADER); sh_video->bih->biPlanes=1; Modified: mplayerxp/libmpdemux/demux_nuv.c =================================================================== --- mplayerxp/libmpdemux/demux_nuv.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_nuv.c 2012-10-26 10:04:44 UTC (rev 216) @@ -240,10 +240,10 @@ sh_video->ds = demuxer->video; /* Custom fourcc for internal MPlayer use */ - sh_video->format = mmioFOURCC('N', 'U', 'V', '1'); + sh_video->fourcc = mmioFOURCC('N', 'U', 'V', '1'); - sh_video->disp_w = rtjpeg_fileheader.width; - sh_video->disp_h = rtjpeg_fileheader.height; + sh_video->src_w = rtjpeg_fileheader.width; + sh_video->src_h = rtjpeg_fileheader.height; /* NuppelVideo uses pixel aspect ratio here display aspect ratio is used. Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-26 10:04:44 UTC (rev 216) @@ -537,7 +537,7 @@ // 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->video || (((sh_video_t*)ds->sh)->format != FOURCC_THEORA)))) + (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 @@ -599,7 +599,7 @@ if(demuxer->video->id >= 0) { sid = demuxer->video->id; /* demux_ogg_read_packet needs decoder context for Theora streams */ - if (((sh_video_t*)demuxer->video->sh)->format == FOURCC_THEORA) + if (((sh_video_t*)demuxer->video->sh)->fourcc == FOURCC_THEORA) context = ((sh_video_t*)demuxer->video->sh)->context; } else { @@ -768,7 +768,7 @@ if(np == 0) { int len; buf = ogg_sync_buffer(sync,BLOCK_SIZE); - len = stream_read(s,buf,BLOCK_SIZE); + len = stream_read(s,buf,BLOCK_SIZE); if(len == 0 && s->eof) { goto err_out; } @@ -834,11 +834,11 @@ sh_v->context = NULL; sh_v->bih = (BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER)); sh_v->bih->biSize=sizeof(BITMAPINFOHEADER); - sh_v->bih->biCompression= sh_v->format = FOURCC_THEORA; + sh_v->bih->biCompression= sh_v->fourcc = FOURCC_THEORA; sh_v->fps = ((double)inf.fps_numerator)/ (double)inf.fps_denominator; - sh_v->disp_w = sh_v->bih->biWidth = inf.frame_width; - sh_v->disp_h = sh_v->bih->biHeight = inf.frame_height; + sh_v->src_w = sh_v->bih->biWidth = inf.frame_width; + sh_v->src_h = sh_v->bih->biHeight = inf.frame_height; sh_v->bih->biBitCount = 24; sh_v->bih->biPlanes = 3; sh_v->bih->biSizeImage = ((sh_v->bih->biBitCount/8) * @@ -878,11 +878,11 @@ sh_v->bih = (BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER)); sh_v->bih->biSize=sizeof(BITMAPINFOHEADER); sh_v->bih->biCompression= - sh_v->format = mmioFOURCC(pack.packet[68],pack.packet[69], + sh_v->fourcc = mmioFOURCC(pack.packet[68],pack.packet[69], pack.packet[70],pack.packet[71]); sh_v->fps = 1/(get_uint64(pack.packet+164)*0.0000001); - sh_v->disp_w = sh_v->bih->biWidth = get_uint32(pack.packet+176); - sh_v->disp_h = sh_v->bih->biHeight = get_uint32(pack.packet+180); + sh_v->src_w = sh_v->bih->biWidth = get_uint32(pack.packet+176); + sh_v->src_h = sh_v->bih->biHeight = get_uint32(pack.packet+180); sh_v->bih->biBitCount = get_uint16(pack.packet+182); if(!sh_v->bih->biBitCount) sh_v->bih->biBitCount=24; // hack, FIXME sh_v->bih->biPlanes=1; @@ -928,12 +928,12 @@ sh_v->bih = (BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER)); sh_v->bih->biSize=sizeof(BITMAPINFOHEADER); sh_v->bih->biCompression= - sh_v->format = mmioFOURCC(st->subtype[0],st->subtype[1], + sh_v->fourcc = mmioFOURCC(st->subtype[0],st->subtype[1], st->subtype[2],st->subtype[3]); sh_v->fps = 1.0/(get_uint64(&st->time_unit)*0.0000001); sh_v->bih->biBitCount = get_uint16(&st->bits_per_sample); - sh_v->disp_w = sh_v->bih->biWidth = get_uint32(&st->sh.video.width); - sh_v->disp_h = sh_v->bih->biHeight = get_uint32(&st->sh.video.height); + sh_v->src_w = sh_v->bih->biWidth = get_uint32(&st->sh.video.width); + sh_v->src_h = sh_v->bih->biHeight = get_uint32(&st->sh.video.height); if(!sh_v->bih->biBitCount) sh_v->bih->biBitCount=24; // hack, FIXME sh_v->bih->biPlanes=1; sh_v->bih->biSizeImage=(sh_v->bih->biBitCount>>3)*sh_v->bih->biWidth*sh_v->bih->biHeight; @@ -1272,7 +1272,7 @@ if(demuxer->video->id >= 0) { ds = demuxer->video; /* demux_ogg_read_packet needs decoder context for Theora streams */ - if (((sh_video_t*)demuxer->video->sh)->format == FOURCC_THEORA) + if (((sh_video_t*)demuxer->video->sh)->fourcc == FOURCC_THEORA) context = ((sh_video_t*)demuxer->video->sh)->context; rate = ogg_d->subs[ds->id].samplerate; } else { Modified: mplayerxp/libmpdemux/demux_pva.c =================================================================== --- mplayerxp/libmpdemux/demux_pva.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_pva.c 2012-10-26 10:04:44 UTC (rev 216) @@ -164,7 +164,7 @@ * the used codecs. */ - sh_video->format=0x10000002; + sh_video->fourcc=0x10000002; sh_video->ds=demuxer->video; /* Modified: mplayerxp/libmpdemux/demux_rawvideo.c =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-26 10:04:44 UTC (rev 216) @@ -104,10 +104,10 @@ } sh_video = new_sh_video(demuxer,0); - sh_video->format=priv.format; + sh_video->fourcc=priv.format; sh_video->fps=priv.fps; - sh_video->disp_w=priv.width; - sh_video->disp_h=priv.height; + sh_video->src_w=priv.width; + sh_video->src_h=priv.height; demuxer->movi_start = demuxer->stream->start_pos; demuxer->movi_end = demuxer->stream->end_pos; Modified: mplayerxp/libmpdemux/demux_real.c =================================================================== --- mplayerxp/libmpdemux/demux_real.c 2012-10-26 09:25:53 UTC (rev 215) +++ mplayerxp/libmpdemux/demux_real.c 2012-10-26 10:04:44 UTC (rev 216) @@ -642,7 +642,7 @@ priv->video_after_seek = 0; } else dp->pts=(dp_hdr->len<3)?0: - real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->format); + real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->fourcc); ds_add_packet(ds,dp); ds->asf_packet=NULL; } else { @@ -666,7 +666,7 @@ if(dp_hdr->len!=vpkg_length-vpkg_offset) MSG_V("warning! assembled.len=%d frag.len=%d total.len=%d \n",dp->len,vpkg_offset,vpkg_length-vpkg_offset); stream_read(demuxer->stream, dp_data+dp_hdr->len, vpkg_offset); - if((dp_data[dp_hdr->len]&0x20) && (sh_video->format==0x30335652)) --dp_hdr->chunks; else + if((dp_data[dp_hdr->len]&0x20) && (sh_video->fourcc==0x30335652)) --dp_hdr->chunks; else dp_hdr->len+=vpkg_offset; len-=vpkg_offset; MSG_DBG2("fragment (%d bytes) appended, %d bytes left\n",vpkg_offset,len); @@ -678,7 +678,7 @@ priv->video_after_seek = 0; } else dp->pts=(dp_hdr->len<3)?0: - real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->format); + real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->fourcc); ds_add_packet(ds,dp); ds->asf_packet=NULL; // continue parsing @@ -687,8 +687,8 @@ // non-last fragment: if(dp_hdr->len!=vpkg_offset) MSG_V("warning! assembled.len=%d offset=%d frag.len=%d total.len=%d \n",dp->len,vpkg_offset,len,vpkg_length); - stream_read(demuxer->stream, dp_data+dp_hdr->len, len); - if((dp_data[dp_hdr->len]&0x20) && (sh_video->format==0x30335652)) --dp_hdr->chunks; else + stream_read(demuxer->stream, dp_data+dp_hdr->len, len); + if((dp_data[dp_hdr->len]&0x20) && (sh_video->fourcc==0x30335652)) --dp_hdr->chunks; else dp_hdr->len+=len; len=0; break; // no more fragments in this chunk! @@ -735,7 +735,7 @@ priv->video_after_seek = 0; } else dp->pts=(dp_hdr->len<3)?0: - real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->format); + real_fix_timestamp(priv,dp_data,dp_hdr->timestamp,sh_video->fourcc); ds_add_packet(ds,dp); } // while(len>0) @@ -1214,18 +1214,18 @@ /* video header */ sh_video_t *sh = new_sh_video(demuxer, stream_id); - sh->format = stream_read_dword_le(demuxer->stream); /* fourcc */ - MSG_V("video fourcc: %.4s (%x)\n", (char *)&sh->format, sh->format); + sh->fourcc = stream_read_dword_le(demuxer->stream); /* fourcc */ + MSG_V("video fourcc: %.4s (%x)\n", (char *)&sh->fourcc, sh->fourcc); /* emulate BITMAPINFOHEADER */ sh->bih = malloc(sizeof(BITMAPINFOHEADER)+16); memset(sh->bih, 0, sizeof(BITMAPINFOHEADER)+16); sh->bih->biSize = 48; - sh->disp_w = sh->bih->biWidth = stream_read_word(demuxer->stream); - sh->disp_h = sh->bih->biHeight = stream_read_word(demuxer->stream); + sh->src_w = sh->bih->biWidth = stream_read_word(demuxer->stream); + sh->src_h = sh->bih->biHeight = stream_read_word(demuxer->stream); sh->bih->biPlanes = 1; sh->bih->biBitCount = 24; - sh->bih->biCompression = sh->format; + sh->bih->biCompression = sh->fourcc; sh->bih->biSizeImage= sh->bih->biWidth*sh->bih->biHeight*3; sh->fps = (float) stream_read_word(demuxer->stream); @@ -1262,7 +1262,7 @@ case 0x10003001: /* sub id: 3 */ /* codec id: rv10 */ - sh->bih->biCompression = sh->format = mmioFOURCC('R', 'V', '1', '3'); + sh->bih->biCompression = sh->fourcc = mmioFOURCC('R', 'V', '1', '3'); break; case 0x20001000: case 0x20100001: @@ -1280,7 +1280,7 @@ MSG_V("unknown id: %x\n", tmp); } - if((sh->format<=0x30335652) && (tmp>=0x20200002)){ + if((sh->fourcc<=0x30335652) && (tmp>=0x20200002)){ // read data for the cmsg24[] (see vd_realvid.c) unsigned int cnt = codec_data_size - (stream_tell(demuxer->stream) - codec_pos); if (... [truncated message content] |
From: <nic...@us...> - 2012-10-26 10:58:37
|
Revision: 218 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=218&view=rev Author: nickols_k Date: 2012-10-26 10:58:24 +0000 (Fri, 26 Oct 2012) Log Message: ----------- Oops Modified Paths: -------------- mplayerxp/libmpdemux/asf.h mplayerxp/libmpdemux/aviheader.h mplayerxp/libmpdemux/demux_asf.c mplayerxp/libmpdemux/demux_audio.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_film.c mplayerxp/libmpdemux/demux_lavf.c mplayerxp/libmpdemux/demux_mpg.c mplayerxp/libmpdemux/demux_mpxp64.c mplayerxp/libmpdemux/demux_ogg.c mplayerxp/libmpdemux/demux_pva.c mplayerxp/libmpdemux/demux_rawvideo.c mplayerxp/libmpdemux/demux_real.c mplayerxp/libmpdemux/demux_ty.c mplayerxp/libmpdemux/demux_viv.c mplayerxp/libmpdemux/demux_y4m.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/postproc/af_format.c Modified: mplayerxp/libmpdemux/asf.h =================================================================== --- mplayerxp/libmpdemux/asf.h 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/asf.h 2012-10-26 10:58:24 UTC (rev 218) @@ -137,7 +137,7 @@ /* * Some macros to swap little endian structures read from an ASF file - * into machine endian wtag + * into machine endian format */ #ifdef WORDS_BIGENDIAN #define le2me_ASF_obj_header_t(h) { \ Modified: mplayerxp/libmpdemux/aviheader.h =================================================================== --- mplayerxp/libmpdemux/aviheader.h 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/aviheader.h 2012-10-26 10:58:24 UTC (rev 218) @@ -6,7 +6,7 @@ /* * Some macros to swap little endian structures read from an AVI file - * into machine endian wtag + * into machine endian format */ #ifdef WORDS_BIGENDIAN #define le2me_MainAVIHeader(h) { \ Modified: mplayerxp/libmpdemux/demux_asf.c =================================================================== --- mplayerxp/libmpdemux/demux_asf.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_asf.c 2012-10-26 10:58:24 UTC (rev 218) @@ -718,7 +718,7 @@ demuxer_driver_t demux_asf = { - "ASF - Advanced stream wtag v1 parser", + "ASF - Advanced stream format v1 parser", ".asf", NULL, asf_probe, Modified: mplayerxp/libmpdemux/demux_audio.c =================================================================== --- mplayerxp/libmpdemux/demux_audio.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_audio.c 2012-10-26 10:58:24 UTC (rev 218) @@ -988,14 +988,14 @@ break; } } - /* Add here some other audio wtag detection */ + /* Add here some other audio format detection */ if(step < HDR_SIZE) memmove(hdr,&hdr[step],HDR_SIZE-step); pos -= step; } if(!frmt) { - MSG_ERR("Can't detect audio wtag\n"); + MSG_ERR("Can't detect audio format\n"); return NULL; } sh_audio = new_sh_audio(demuxer,0); @@ -1561,7 +1561,7 @@ return 1; } default: - MSG_ERR("Audio demuxer : unknown wtag %d\n",priv->frmt); + MSG_ERR("Audio demuxer : unknown format %d\n",priv->frmt); } return 0; } Modified: mplayerxp/libmpdemux/demux_avi.c =================================================================== --- mplayerxp/libmpdemux/demux_avi.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_avi.c 2012-10-26 10:58:24 UTC (rev 218) @@ -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 wtag of this information + // required to produce the file. Note that the format 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 wtag depends on the hardware used). + // required to produce the file (the format 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." @@ -1167,7 +1167,7 @@ priv->idx_pos_a=0; priv->idx_pos_v=0; if(priv->idx_size>1){ - // decide index wtag: + // decide index format: #if 1 if((unsigned long)((AVIINDEXENTRY *)priv->idx)[0].dwChunkOffset<demuxer->movi_start || (unsigned long)((AVIINDEXENTRY *)priv->idx)[1].dwChunkOffset<demuxer->movi_start) Modified: mplayerxp/libmpdemux/demux_film.c =================================================================== --- mplayerxp/libmpdemux/demux_film.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_film.c 2012-10-26 10:58:24 UTC (rev 218) @@ -6,7 +6,7 @@ Sega Saturn CD-ROM games. FILM files have also been found on 3DO games. - Details of the FILM file wtag can be found at: + Details of the FILM file format can be found at: http://www.pcisys.net/~melanson/codecs/ TODO: demuxer->movi_length @@ -300,7 +300,7 @@ sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX)); - // uncompressed PCM wtag + // uncompressed PCM format sh_audio->wf->wFormatTag = 1; sh_audio->wtag = 1; sh_audio->wf->nChannels = audio_channels; @@ -331,7 +331,7 @@ sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX)); - // uncompressed PCM wtag + // uncompressed PCM format sh_audio->wf->wFormatTag = 1; sh_audio->wtag = 1; sh_audio->wf->nChannels = 1; Modified: mplayerxp/libmpdemux/demux_lavf.c =================================================================== --- mplayerxp/libmpdemux/demux_lavf.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_lavf.c 2012-10-26 10:58:24 UTC (rev 218) @@ -52,7 +52,7 @@ extern int ts_prog; const config_t lavf_opts[] = { - {"wtag", &(opt_format), CONF_TYPE_STRING, 0, 0, 0, NULL, "forces wtag of lavf demuxer"}, + {"format", &(opt_format), CONF_TYPE_STRING, 0, 0, 0, NULL, "forces format 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 wtag %s\n", opt_format); + MSG_FATAL("Unknown lavf format %s\n", opt_format); return 0; } MSG_INFO("Forced lavf %s demuxer\n", priv->avif->long_name); Modified: mplayerxp/libmpdemux/demux_mpg.c =================================================================== --- mplayerxp/libmpdemux/demux_mpg.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_mpg.c 2012-10-26 10:58:24 UTC (rev 218) @@ -750,7 +750,7 @@ MSG_ERR("MPEG: " MSGTR_MissingVideoStreamBug); else { - MSG_V("Not MPEG System Stream wtag...\n"); + MSG_V("Not MPEG System Stream format...\n"); return 0; } } Modified: mplayerxp/libmpdemux/demux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_mpxp64.c 2012-10-26 10:58:24 UTC (rev 218) @@ -1,6 +1,5 @@ /* - MPlayerXP's design. MPXPAV64 wtag. - Implements of ASF v1, AVI stream parsers. + MPlayerXP's design. MPXPAV64 format. */ #include <stdio.h> Modified: mplayerxp/libmpdemux/demux_ogg.c =================================================================== --- mplayerxp/libmpdemux/demux_ogg.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_ogg.c 2012-10-26 10:58:24 UTC (rev 218) @@ -55,7 +55,7 @@ } theora_struct_t; //// OggDS headers -// Header for the new header wtag +// Header for the new header format typedef struct stream_header_video { ogg_int32_t width; Modified: mplayerxp/libmpdemux/demux_pva.c =================================================================== --- mplayerxp/libmpdemux/demux_pva.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_pva.c 2012-10-26 10:58:24 UTC (rev 218) @@ -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 wtag has no fields to describe + * Moreover, there would be no way to do that since the PVA stream format has no fields to describe * the used codecs. */ Modified: mplayerxp/libmpdemux/demux_rawvideo.c =================================================================== --- mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_rawvideo.c 2012-10-26 10:58:24 UTC (rev 218) @@ -16,7 +16,7 @@ typedef struct priv_s { int use_rawvideo; - int wtag; + int format; 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" }, - // 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" }, + // format: + { "fourcc", &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" }, // 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.wtag); + demuxer->stream->driver->control(demuxer->stream,SCTRL_VID_GET_FORMAT,&priv.format); 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.wtag){ + switch(priv.format){ 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 wtag!\n"); + MSG_ERR("rawvideo: img size not specified and unknown format!\n"); return NULL; } sh_video = new_sh_video(demuxer,0); - sh_video->fourcc=priv.wtag; + sh_video->fourcc=priv.format; 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:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_real.c 2012-10-26 10:58:24 UTC (rev 218) @@ -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 wtag) +static float real_fix_timestamp(real_priv_t* priv, unsigned char* s, int timestamp, unsigned int format) { 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(wtag==mmioFOURCC('R','V','3','0') || wtag==mmioFOURCC('R','V','4','0')){ - if(wtag==mmioFOURCC('R','V','3','0')){ + if(format==mmioFOURCC('R','V','3','0') || format==mmioFOURCC('R','V','4','0')){ + if(format==mmioFOURCC('R','V','3','0')){ SKIP_BITS(3); pict_type= SHOW_BITS(2); SKIP_BITS(2 + 7); @@ -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 wtag\n"); + MSG_V("Unknown audio stream format\n"); } } else if (!strncmp(tmps,"video/",6)) { if (strstr(tmps,"x-pn-realvideo") || strstr(tmps,"x-pn-multirate-realvideo")) { @@ -1314,7 +1314,7 @@ } } else { - MSG_V("Unknown video stream wtag\n"); + MSG_V("Unknown video stream format\n"); } } else if (strstr(tmps,"logical-")) { if (strstr(tmps,"fileinfo")) { Modified: mplayerxp/libmpdemux/demux_ty.c =================================================================== --- mplayerxp/libmpdemux/demux_ty.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_ty.c 2012-10-26 10:58:24 UTC (rev 218) @@ -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 wtag of the TiVo streams. + * information regarding the format of the TiVo streams. * * However, no code in the following subsection is directly copied from * either author. Modified: mplayerxp/libmpdemux/demux_viv.c =================================================================== --- mplayerxp/libmpdemux/demux_viv.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_viv.c 2012-10-26 10:58:24 UTC (rev 218) @@ -439,7 +439,7 @@ static int bufptr=0; static int bitcnt=0; static unsigned char buf=0; -static int wtag, width, height; +static int format, 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 */ - wtag = get_bits(&s->gb, 3); + format = get_bits(&s->gb, 3); - if (wtag != 7) { - MSG_ERR("h263_plus = 0 wtag = %d\n",wtag); + if (format != 7) { + MSG_ERR("h263_plus = 0 format = %d\n",format); /* H.263v1 */ - width = h263_format[wtag][0]; - height = h263_format[wtag][1]; + width = h263_format[format][0]; + height = h263_format[format][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 wtag */ - MSG_ERR("custom source wtag\n"); + if (get_bits(&s->gb, 3) != 6){ /* custom source format */ + MSG_ERR("custom source format\n"); return -1; } skip_bits(&s->gb, 12); Modified: mplayerxp/libmpdemux/demux_y4m.c =================================================================== --- mplayerxp/libmpdemux/demux_y4m.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demux_y4m.c 2012-10-26 10:58:24 UTC (rev 218) @@ -48,7 +48,7 @@ if (!strncmp("YUV4MPEG ", buf, 9)) { - MSG_V( "Found older YUV4MPEG wtag (used by xawtv)\n"); + MSG_V( "Found older YUV4MPEG format (used by xawtv)\n"); priv->is_older = 1; } Modified: mplayerxp/libmpdemux/demuxer.h =================================================================== --- mplayerxp/libmpdemux/demuxer.h 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/demuxer.h 2012-10-26 10:58:24 UTC (rev 218) @@ -116,7 +116,7 @@ off_t movi_end; /**< real end of movie within of stream */ unsigned movi_length; /**< length of movie in secs. Optional!*/ unsigned flags; /**< set of DEMUXF_* bits */ - unsigned file_format; /**< file wtag: DEMUXER_TYPE_*(mpeg/avi/asf). Will be replaced with properties in the further versions */ + unsigned file_format; /**< file format: DEMUXER_TYPE_*(mpeg/avi/asf). Will be replaced with properties in the further versions */ int synced; /**< indicates stream synchronisation. TODO: mpg->priv */ any_t* priv; /**< private data of demuxer's driver.*/ Modified: mplayerxp/libmpdemux/mp3_hdr.c =================================================================== --- mplayerxp/libmpdemux/mp3_hdr.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/mp3_hdr.c 2012-10-26 10:58:24 UTC (rev 218) @@ -85,7 +85,7 @@ if(channels) *channels=nch; if(!bitrate_index){ - MSG_DBG2("mp3_hdr: Free wtag not supported.\n"); + MSG_DBG2("mp3_hdr: Free format not supported.\n"); return -1; } Modified: mplayerxp/libmpdemux/mpeg_hdr.c =================================================================== --- mplayerxp/libmpdemux/mpeg_hdr.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/mpeg_hdr.c 2012-10-26 10:58:24 UTC (rev 218) @@ -54,8 +54,8 @@ static int header_process_sequence_extension (mp_mpeg_header_t * picture, unsigned char * buffer) { - /* check chroma wtag, size extensions, marker bit */ - + /* check chroma format, size extensions, marker bit */ + if ( ((buffer[1] & 0x06) == 0x00) || ((buffer[1] & 0x01) != 0x00) || (buffer[2] & 0xe0) || ((buffer[3] & 0x01) != 0x01) ) Modified: mplayerxp/libmpdemux/mpxpav64.h =================================================================== --- mplayerxp/libmpdemux/mpxpav64.h 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/mpxpav64.h 2012-10-26 10:58:24 UTC (rev 218) @@ -1,4 +1,4 @@ -/* MPLayerXP's AudioVideo64 file wtag */ +/* MPLayerXP's AudioVideo64 file format */ #ifndef MPXPAV64_INCLUDED #define MPXPAV64_INCLUDED 1 Modified: mplayerxp/libmpdemux/mux_lavf.c =================================================================== --- mplayerxp/libmpdemux/mux_lavf.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/mux_lavf.c 2012-10-26 10:58:24 UTC (rev 218) @@ -367,9 +367,9 @@ av_register_all(); priv->oc = av_alloc_format_context(); - if(!priv->oc) + if(!priv->oc) { - MSG_FATAL("Couldn't get wtag context\n"); + MSG_FATAL("Couldn't get format context\n"); goto fail; } @@ -383,7 +383,7 @@ if(av_set_parameters(priv->oc, NULL) < 0) { - MSG_FATAL("Invalid output wtag parameters\n"); + MSG_FATAL("Invalid output format parameters\n"); goto fail; } priv->oc->packet_size= mux_packet_size; Modified: mplayerxp/libmpdemux/mux_mpxp64.c =================================================================== --- mplayerxp/libmpdemux/mux_mpxp64.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/mux_mpxp64.c 2012-10-26 10:58:24 UTC (rev 218) @@ -1,6 +1,5 @@ /* - MPlayerXP's design. MPXPAV64 wtag. - Implements of ASF v1, AVI stream writer. + MPlayerXP's design. MPXPAV64 format. */ #include <ctype.h> #include <stdio.h> Modified: mplayerxp/libmpdemux/muxer.h =================================================================== --- mplayerxp/libmpdemux/muxer.h 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/muxer.h 2012-10-26 10:58:24 UTC (rev 218) @@ -59,7 +59,7 @@ AVIStreamHeader h; // Rate/Scale and SampleSize must be filled by caller! // stream specific: WAVEFORMATEX *wf; - BITMAPINFOHEADER *bih; // in wtag + BITMAPINFOHEADER *bih; // in format any_t* ImageDesc; // for quicktime codecs float aspect; // muxer of that stream Modified: mplayerxp/libmpdemux/parse_mp4.c =================================================================== --- mplayerxp/libmpdemux/parse_mp4.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/parse_mp4.c 2012-10-26 10:58:24 UTC (rev 218) @@ -1,4 +1,4 @@ -/* parse_mp4.c - MP4 file wtag parser code +/* parse_mp4.c - MP4 file format parser code * This file is part of MPlayer, see http://mplayerhq.hu/ for info. * (c)2002 by Felix Buenemann <atmosfear at users.sourceforge.net> * File licensed under the GPL, see http://www.fsf.org/ for more info. Modified: mplayerxp/libmpdemux/parse_mp4.h =================================================================== --- mplayerxp/libmpdemux/parse_mp4.h 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/parse_mp4.h 2012-10-26 10:58:24 UTC (rev 218) @@ -1,5 +1,5 @@ -/* parse_mp4.h - Headerfile for MP4 file wtag parser code - * This file is part of MPlayer, see http://mplayerhq.hu/ for info. +/* parse_mp4.h - Headerfile for MP4 file format parser code + * This file is part of MPlayer, see http://mplayerhq.hu/ for info. * (c)2002 by Felix Buenemann <atmosfear at users.sourceforge.net> * File licensed under the GPL, see http://www.fsf.org/ for more info. */ Modified: mplayerxp/libmpdemux/pnm.c =================================================================== --- mplayerxp/libmpdemux/pnm.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/pnm.c 2012-10-26 10:58:24 UTC (rev 218) @@ -333,7 +333,7 @@ max -= 1; while(1) { - /* expecting following chunk wtag: 0x4f <chunk size> <data...> */ + /* expecting following chunk format: 0x4f <chunk size> <data...> */ if (max < 2) return -1; Modified: mplayerxp/libmpdemux/s_dvdread.c =================================================================== --- mplayerxp/libmpdemux/s_dvdread.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/s_dvdread.c 2012-10-26 10:58:24 UTC (rev 218) @@ -264,7 +264,7 @@ // 1 - stereo // 5 - 5.1 d->audio_streams[d->nr_of_channels].channels=audio->channels; - MSG_V("[open] audio stream: %d audio wtag: %s (%s) language: %s aid: %d\n", + MSG_V("[open] audio stream: %d audio format: %s (%s) language: %s aid: %d\n", d->nr_of_channels, dvd_audio_stream_types[ audio->audio_format ], dvd_audio_stream_channels[ audio->channels ], Modified: mplayerxp/libmpdemux/s_oss.c =================================================================== --- mplayerxp/libmpdemux/s_oss.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/s_oss.c 2012-10-26 10:58:24 UTC (rev 218) @@ -105,9 +105,9 @@ oss_fmt=af_format_encode(&afd); tmp=oss_fmt; if(ioctl(stream->fd, SNDCTL_DSP_SETFMT, &oss_fmt)<0) - MSG_ERR("[s_oss] Can't set wtag %s (will use %s)\n",ao_format_name(tmp),ao_format_name(oss_fmt)); + MSG_ERR("[s_oss] Can't set format %s (will use %s)\n",ao_format_name(tmp),ao_format_name(oss_fmt)); else - MSG_DBG2("[o_oss] Did set wtag to %s\n",ao_format_name(oss_fmt)); + MSG_DBG2("[o_oss] Did set format to %s\n",ao_format_name(oss_fmt)); } tmp = PCM_ENABLE_INPUT; if(ioctl(stream->fd, SNDCTL_DSP_SETTRIGGER, &tmp)<0) Modified: mplayerxp/libmpdemux/s_tv.c =================================================================== --- mplayerxp/libmpdemux/s_tv.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/s_tv.c 2012-10-26 10:58:24 UTC (rev 218) @@ -145,7 +145,7 @@ picture_format = IMGFMT_RGB15; else { - MSG_ERR( "Unknown wtag given: %s\n", tv_param_outfmt); + MSG_ERR( "Unknown format given: %s\n", tv_param_outfmt); MSG_V( "Using default: Planar YV12\n"); picture_format = IMGFMT_YV12; } Modified: mplayerxp/libmpdemux/stheader.h =================================================================== --- mplayerxp/libmpdemux/stheader.h 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/stheader.h 2012-10-26 10:58:24 UTC (rev 218) @@ -14,10 +14,10 @@ demux_stream_t* ds; struct codecs_st* codec; int inited; -// input wtag +// input format uint32_t wtag; // analogue of fourcc for sound unsigned i_bps; // == bitrate (compressed bytes/sec) -// output wtag: +// output format: float timer; // value of old a_frame unsigned samplerate; unsigned samplesize; @@ -48,7 +48,7 @@ // win32 codec stuff: AVIStreamHeader audio; WAVEFORMATEX* wf; -// char wf_ext[64]; // in wtag +// char wf_ext[64]; // in format unsigned audio_in_minsize; unsigned audio_out_minsize; // other codecs: @@ -62,10 +62,10 @@ demux_stream_t* ds; struct codecs_st* codec; int inited; -// input wtag +// input format uint32_t fourcc; int is_static; /* default: 0 - means movie; 1 - means picture (.jpg ...)*/ -// output wtag: +// output format: float fps; int chapter_change; unsigned src_w,src_h;// source picture size (filled by fileformat parser) @@ -81,7 +81,7 @@ mp_image_t* image; // win32 codec stuff: AVIStreamHeader video; - BITMAPINFOHEADER* bih; // in wtag + BITMAPINFOHEADER* bih; // in format any_t* context; // codec-specific stuff (usually HANDLE or struct pointer) any_t* ImageDesc; // for quicktime codecs } sh_video_t; Modified: mplayerxp/libmpdemux/stream.h =================================================================== --- mplayerxp/libmpdemux/stream.h 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/stream.h 2012-10-26 10:58:24 UTC (rev 218) @@ -43,7 +43,7 @@ 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 wtag (by http:// protocol for example) */ + 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 */ @@ -142,7 +142,7 @@ #define SCTRL_AUD_GET_CHANNELS 2000 /**< Returns number of channels. Accepts unsigned* as pointer to channels storage */ #define SCTRL_AUD_GET_SAMPLERATE 2001 /**< Returns rate of samples in Hz. Accepts unsigned* as pointer to storage area */ #define SCTRL_AUD_GET_SAMPLESIZE 2002 /**< Returns size fo samples in bits. Accepts unsigned* as pointer to storage area */ -#define SCTRL_AUD_GET_FORMAT 2003 /**< Returns wtag of samples. Accepts unsigned* as pointer to storage area */ +#define SCTRL_AUD_GET_FORMAT 2003 /**< Returns format of samples. Accepts unsigned* as pointer to storage area */ /* These controls extracts language specific info from stream */ #define SCTRL_LNG_GET_AID 3000 /**< Returns audio id from language. Accepts char* as input language name. Stores int* id into this pointer as output. */ Modified: mplayerxp/libmpdemux/sub_cc.c =================================================================== --- mplayerxp/libmpdemux/sub_cc.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/sub_cc.c 2012-10-26 10:58:24 UTC (rev 218) @@ -233,7 +233,7 @@ { /* The first number may denote a channel number. I don't have the * EIA-708 standard, so it is hard to say. - * From what I could figure out so far, the general wtag seems to be: + * From what I could figure out so far, the general format seems to be: * * repeat * Modified: mplayerxp/libmpdemux/sub_ty.c =================================================================== --- mplayerxp/libmpdemux/sub_ty.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/sub_ty.c 2012-10-26 10:58:24 UTC (rev 218) @@ -471,7 +471,7 @@ static int ty_XDSDisplayCount = -1; -static void ty_AddXDSToDisplay( const char *wtag, ... ) +static void ty_AddXDSToDisplay( const char *format, ... ) { char line[ 80 ]; int index; @@ -486,8 +486,8 @@ ty_XDSAddLine = 0; } - va_start( ap, wtag ); - vsnprintf( line, 80, wtag, ap ); + va_start( ap, format ); + vsnprintf( line, 80, format, ap ); va_end( ap ); MSG_V( "XDS: %s\n", line ); Modified: mplayerxp/libmpdemux/test.c =================================================================== --- mplayerxp/libmpdemux/test.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/test.c 2012-10-26 10:58:24 UTC (rev 218) @@ -44,7 +44,7 @@ exit(1); } - printf("success: wtag: %d data: 0x%X - 0x%X\n",file_format, (int)(stream->start_pos),(int)(stream->end_pos)); + printf("success: format: %d data: 0x%X - 0x%X\n",file_format, (int)(stream->start_pos),(int)(stream->end_pos)); stream_enable_cache(stream,2048*1024,0,0); Modified: mplayerxp/libmpdemux/tvi_bsdbt848.c =================================================================== --- mplayerxp/libmpdemux/tvi_bsdbt848.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/tvi_bsdbt848.c 2012-10-26 10:58:24 UTC (rev 218) @@ -593,7 +593,7 @@ return(1); } -/* that's the real start, we'got the wtag parameters (checked with control) */ +/* that's the real start, we'got the format parameters (checked with control) */ static int start(priv_t *priv) { int tmp; Modified: mplayerxp/libmpdemux/tvi_dummy.c =================================================================== --- mplayerxp/libmpdemux/tvi_dummy.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/tvi_dummy.c 2012-10-26 10:58:24 UTC (rev 218) @@ -40,7 +40,7 @@ return(1); } -/* that's the real start, we'got the wtag parameters (checked with control) */ +/* that's the real start, we'got the format parameters (checked with control) */ static int start(priv_t *priv) { return(1); Modified: mplayerxp/libmpdemux/tvi_v4l.c =================================================================== --- mplayerxp/libmpdemux/tvi_v4l.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/tvi_v4l.c 2012-10-26 10:58:24 UTC (rev 218) @@ -55,7 +55,7 @@ /* video */ struct video_picture picture; - int wtag; /* output wtag */ + int format; /* output format */ int width; int height; int bytesperline; @@ -133,9 +133,9 @@ return(-1); } -static int format2palette(int wtag) +static int format2palette(int format) { - switch(wtag) + switch(format) { case IMGFMT_RGB15: return(VIDEO_PALETTE_RGB555); @@ -300,7 +300,7 @@ MSG_V( "volume=%d bass=%d treble=%d balance=%d mode=%s\n", priv->audio[i].volume, priv->audio[i].bass, priv->audio[i].treble, priv->audio[i].balance, audio_mode2name[priv->audio[i].mode]); - MSG_V( " channels: %d, samplerate: %d, samplesize: %d, wtag: %s\n", + MSG_V( " channels: %d, samplerate: %d, samplesize: %d, format: %s\n", priv->audio_channels[i], priv->audio_samplerate[i], priv->audio_samplesize[i], ao_format_name(priv->audio_format[i])); } @@ -359,7 +359,7 @@ MSG_V("Supported formats: %x\n", ioctl_param); if (!(ioctl_param & priv->audio_format[priv->audio_id])) - MSG_WARN("notsupported wtag\n"); + MSG_WARN("notsupported format\n"); ioctl_param = priv->audio_format[priv->audio_id]; MSG_V("ioctl dsp setfmt: %d\n", @@ -545,7 +545,7 @@ output_fmt = priv->wtag; *(int *)arg = output_fmt; - MSG_V( "Output wtag: %s\n", vo_format_name(output_fmt)); + MSG_V( "Output format: %s\n", vo_format_name(output_fmt)); return(TVI_CONTROL_TRUE); } case TVI_CONTROL_VID_SET_FORMAT: Modified: mplayerxp/libmpdemux/yuv4mpeg.h =================================================================== --- mplayerxp/libmpdemux/yuv4mpeg.h 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/libmpdemux/yuv4mpeg.h 2012-10-26 10:58:24 UTC (rev 218) @@ -1,7 +1,7 @@ /* * yuv4mpeg.h: Functions for reading and writing "new" YUV4MPEG2 streams. * - * Stream wtag is described at the end of this file. + * Stream format is described at the end of this file. * * * Copyright (C) 2001 Matthew J. Marjanovic <ma...@mi...> @@ -392,7 +392,7 @@ /************************************************************************ ************************************************************************ - Description of the (new!, forever?) YUV4MPEG2 stream wtag: + Description of the (new!, forever?) YUV4MPEG2 stream format: STREAM consists of o one '\n' terminated STREAM-HEADER Modified: mplayerxp/postproc/af_format.c =================================================================== --- mplayerxp/postproc/af_format.c 2012-10-26 10:24:02 UTC (rev 217) +++ mplayerxp/postproc/af_format.c 2012-10-26 10:58:24 UTC (rev 218) @@ -240,7 +240,7 @@ { int i=0; // Print endinaness - + if(format & AF_FORMAT_SPECIAL_MASK){ unsigned short wtag; unsigned j; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-26 11:54:22
|
Revision: 220 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=220&view=rev Author: nickols_k Date: 2012-10-26 11:54:16 +0000 (Fri, 26 Oct 2012) Log Message: ----------- remove unused vars Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/dec_ahead.h mplayerxp/mplayer.c mplayerxp/sig_hand.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-26 11:45:13 UTC (rev 219) +++ mplayerxp/dec_ahead.c 2012-10-26 11:54:16 UTC (rev 220) @@ -135,9 +135,6 @@ extern int decore_audio( int xp_id ); extern int mpxp_seek_time; -pid_t dec_ahead_pid; /* Only for testing */ -pthread_t dec_ahead_pth_id; - extern void update_osd( float v_pts ); volatile int xp_eof=0; int xp_audio_eof=0; @@ -275,9 +272,7 @@ 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"; - dec_ahead_pid = pinfo[_xp_id].pid = getpid(); /* Only for testing */ - dec_ahead_pth_id = 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); Modified: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2012-10-26 11:45:13 UTC (rev 219) +++ mplayerxp/dec_ahead.h 2012-10-26 11:54:16 UTC (rev 220) @@ -117,9 +117,6 @@ astream - pointer to audio stream */ -extern int dec_ahead_pid; /* Only for testing */ -extern pthread_t dec_ahead_pth_id; - extern int init_dec_ahead(sh_video_t*stream, sh_audio_t *astream); extern void uninit_dec_ahead( int force ); extern int run_dec_ahead( void ); Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-26 11:45:13 UTC (rev 219) +++ mplayerxp/mplayer.c 2012-10-26 11:54:16 UTC (rev 220) @@ -109,7 +109,6 @@ #endif int xp_id=0; -pid_t mplayer_pid; pthread_t mplayer_pth_id; int use_pts_fix2=-1; @@ -2344,7 +2343,6 @@ vo_data=vo_preinit_structs(); - mplayer_pid= pinfo[xp_id].pid=getpid(); mplayer_pth_id= pinfo[xp_id].pth_id=pthread_self(); Modified: mplayerxp/sig_hand.c =================================================================== --- mplayerxp/sig_hand.c 2012-10-26 11:45:13 UTC (rev 219) +++ mplayerxp/sig_hand.c 2012-10-26 11:54:16 UTC (rev 220) @@ -20,10 +20,6 @@ pth_info_t pinfo[MAX_XPTHREADS]; int xp_threads = 0; -extern pid_t mplayer_pid; -extern pthread_t mplayer_pth_id; -extern pid_t dec_ahead_pid; - #ifdef HAVE_BACKTRACE #include <execinfo.h> /* Obtain a backtrace and print it to stdout. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nic...@us...> - 2012-10-26 13:01:36
|
Revision: 222 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=222&view=rev Author: nickols_k Date: 2012-10-26 13:01:26 +0000 (Fri, 26 Oct 2012) Log Message: ----------- rename dec_ahead -> xmp_core Modified Paths: -------------- mplayerxp/Makefile mplayerxp/libao2/ao_wav.c mplayerxp/libmpcodecs/dec_video.c mplayerxp/libmpcodecs/vd.c mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpdemux/demuxer_r.c mplayerxp/libmpsub/spudec.c mplayerxp/libvo/video_out.c 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/vf.c mplayerxp/sig_hand.c Added Paths: ----------- mplayerxp/xmp_core.c mplayerxp/xmp_core.h Removed Paths: ------------- mplayerxp/dec_ahead.c mplayerxp/dec_ahead.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/Makefile 2012-10-26 13:01:26 UTC (rev 222) @@ -24,7 +24,8 @@ LDFLAGS += -Wl,-rpath,${CODECDIR}/codecs SRCS_COMMON = cpudetect.c mp_msg.c my_profile.c my_malloc.c mp_image.c -SRCS_MPLAYER = mplayer.c fifo.c $(SRCS_COMMON) mixer.c mp-opt-reg.c sig_hand.c dump.c dec_ahead.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 OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o) Deleted: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/dec_ahead.c 2012-10-26 13:01:26 UTC (rev 222) @@ -1,951 +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> -#ifdef HAVE_MALLOC -#include <malloc.h> -#endif -#define DA_PREFIX "DEC_AHEAD:" -#include "dec_ahead.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 - -xp_core_t xp_core; - -void xp_core_init(void) { - memset(&xp_core,0,sizeof(xp_core_t)); - xp_core.in_lseek=NoSeek; -} - -void xp_core_uninit(void) {} - -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) -{ - it->nframes=nframes; - it->fra = malloc(sizeof(frame_attr_t)*nframes); - dae_reset(it); -} - -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) { - unsigned new_idx; - new_idx=(it->player_idx+1)%it->nframes; - if(new_idx==it->decoder_idx) { - it->num_slow_frames++; - return 0; - } - it->player_idx=new_idx; - it->num_slow_frames=0; - it->num_played_frames++; - 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; - 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; -} - -frame_attr_t dae_played_fra(const dec_ahead_engine_t* it) { - unsigned idx=it->player_idx; - return it->fra[idx]; -} -frame_attr_t dae_decoded_fra(const dec_ahead_engine_t* it) { - unsigned idx=it->decoder_idx; - return it->fra[idx]; -} - -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; - -extern volatile int xp_drop_frame; -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; - -/* 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 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; -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); -extern int read_audio_buffer(sh_audio_t *audio, unsigned char *buffer, unsigned minlen, unsigned maxlen ); -extern float get_delay_audio_buffer(void); -extern int decode_audio_buffer(unsigned len); -extern void reset_audio_buffer(void); -extern int get_len_audio_buffer(void); -extern int get_free_audio_buffer(void); - -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 */ - -static void show_warn_cant_sync(float max_frame_delay) { - static int warned=0; - static float prev_warn_delay=0; - if(!warned || max_frame_delay > prev_warn_delay) { - warned=1; - MSG_WARN("*********************************************\n" - "** Can't stabilize A-V sync!!! **\n" - "*********************************************\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); - prev_warn_delay=max_frame_delay; - } -} - -static unsigned compute_frame_dropping(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 */ - max_frame_delay = time_usage.max_video+time_usage.max_vout; - - /* - TODO: - Replace the constants with some values which are depended on - xp_num_frames 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: - - fill a full buffer (is not always reachable) - - while(video.pts < audio.pts) - video.seek_to_key_frame(video.get_next_key_frame(video.get_cur_pos())) - */ - 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; - else - if(mp_conf.verbose) show_warn_cant_sync(max_frame_delay); - } - if(delta > drop_barrier) rc=0; - else if(delta < max_frame_delay*3) rc=1; - else { - unsigned fr_skip_divisor; - /* - if(delta < drop_barrier/4) fr_skip_divisor=1; -- drop every frame is not smooth thing - else - */ - if(delta < drop_barrier/2) fr_skip_divisor=2; - else - 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; - 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); - prev_delta=delta; - return rc; -} - -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 && - fra[idx2].v_pts > fra[idx1].v_pts && - fra[idx2].v_pts < fra[idx1].v_pts+1.0 ) { - float tmp; - tmp = fra[idx1].v_pts; - 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_num_frames; - 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; - - idx0 = idx1; - idx1 = idx2; - idx2=(idx2-1)%xp_num_frames; - } -} - -any_t* Va_dec_ahead_routine( any_t* 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; - 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); - 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 = mp_conf.av_sync_pts?0:1; -while(!xp_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; - } - 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) { - MP_UNIT(_xp_id,"decode audio"); - while(2==xp_thread_decode_audio()) ; - 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) { - 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; - } - 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; - } - /* frame was decoded into current decoder_idx */ - if(xp_is_bad_pts) { - if(mpeg_timer==HUGE) mpeg_timer=v_pts; - else if( mpeg_timer-duration<v_pts ) { - mpeg_timer=v_pts; - MSG_DBG2("Sync mpeg pts %f\n", mpeg_timer); - } - else mpeg_timer+=duration; - } - /* compute frame dropping */ - xp_n_frame_to_drop=0; - 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( mp_conf.frame_dropping ) */ - if(xp_core.in_lseek!=NoSeek) continue; -#if 0 -/* - We can't seriously examine question of too slow machines - by motivation reasons -*/ -if(ada_active_frame) /* don't emulate slow systems until xp_players are not started */ -{ - int i,delay; /* sleeping 200 ms is far enough for 25 fps */ - delay=xp_n_frame_to_drop?0:20; - for(i=0;i<delay;i++) usleep(0); -} -#endif - if(xp_n_frame_to_drop) drop_param=mp_conf.frame_dropping; - else drop_param=0; - /* decode: */ - if(output_quality) { - unsigned total = xp_num_frames/2; - unsigned distance = dae_get_decoder_outrun(xp_core.video); - int our_quality; - our_quality = output_quality*distance/total; - if(drop_param) mpcv_set_quality(sh_video,0); - else - 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); - if(output_quality) { - if(drop_param) mpcv_set_quality(sh_video,output_quality); - } - if(!blit_frame && drop_param) xp_drop_frame_cnt++; - if(blit_frame) { - unsigned idx=dae_curr_vdecoded(); - if(xp_is_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_is_bad_pts) { - int _idx = dae_prev_vdecoded(); - 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) */ - - /* ------------ sleep --------------- */ - /* sleep if thread is too fast ;) */ - if(blit_frame) - 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(xp_core.has_audio && mp_conf.xp<XP_VAFull) { - MP_UNIT(_xp_id,"decode audio"); - xp_thread_decode_audio(); - MP_UNIT(_xp_id,"dec_ahead 5"); - } - usleep(1); - } -/*------------------------ frame decoded. --------------------*/ -} /* while(!xp_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"); - if(!xp_thread_decode_audio()) usleep(1); - MP_UNIT(_xp_id,NULL); - } -} - pt_exit: - MSG_T("\nDEC_AHEAD: leaving...\n"); - pthread_is_living=0; - pthread_end_of_work=0; - uninit_signal_handling(_xp_id); - return arg; /* terminate thread here !!! */ -} - -/* this routine decodes audio only */ -any_t* a_dec_ahead_routine( any_t* arg ) -{ - int xp_id; - int ret, retval; - struct timeval now; - struct timespec timeout; - float d; - - a_pthread_is_living=1; - xp_eof = 0; - xp_audio_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"; - - 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; - - dec_ahead_can_adseek=1; - - if(a_pthread_end_of_work) - break; - - MP_UNIT(xp_id,"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"); - 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(a_pthread_end_of_work) - break; - - MP_UNIT(xp_id,"seek"); - LOCK_AUDIO_DECODE(); - while( xp_core.in_lseek!=NoSeek && !a_pthread_end_of_work) { - 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"); - } - dec_ahead_can_adseek = 0; /* Not safe to seek */ - UNLOCK_AUDIO_DECODE(); - } - MP_UNIT(xp_id,"exit"); - dec_ahead_can_adseek = 1; - a_pthread_is_living=0; - a_pthread_end_of_work=0; - uninit_signal_handling(xp_id); - return arg; /* terminate thread here !!! */ -} - -void uninit_dec_ahead( 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; - } - - 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(); -} - -/* 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) -{ - 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); - } - else {/* if (mp_conf.xp >= XP_VAFull) mp_conf.xp = XP_VAPlay;*/ } - if(sha) sh_audio = sha; /* currently is unused */ - - 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_num_frames/sh_video->fps))+MIN_BUFFER_RESERV; - else asize = o_bps*ao_da_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); - } - -#if 0 - /* requires root privelegies */ - pthread_attr_setschedpolicy(&our_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; -} - -int run_xp_aplayers(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; -} - - -/* Halt threads before seek */ -void dec_ahead_halt_threads(int is_reset_vcache) -{ - xp_core.in_lseek = PreSeek; - - if(pthread_audio_is_living) { - LOCK_AUDIO_PLAY(); - while(!dec_ahead_can_aseek) - usleep(1); - UNLOCK_AUDIO_PLAY(); - } - - if(a_pthread_is_living) { - LOCK_AUDIO_DECODE(); - while(!dec_ahead_can_adseek) - usleep(1); - UNLOCK_AUDIO_DECODE(); - } - - if(pthread_is_living) { - while(xp_core.in_lseek==PreSeek) - usleep(1); - } - xp_core.in_lseek = Seek; -} - -/* Restart threads after seek */ -void dec_ahead_restart_threads(int xp_id) -{ - /* reset counters */ - dae_reset(xp_core.video); - /* tempoarry 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; - - if(mp_conf.xp && !pthread_is_living && !a_pthread_is_living) { - xp_core.in_lseek = NoSeek; /* Threads not started, do nothing */ - return; - } - if(!xp_core.has_audio) - decore_audio(xp_id); - else - xp_thread_decode_audio(); - - if(pthread_is_living) { - while(xp_core.in_lseek==Seek) usleep(1); - while(dae_curr_vdecoded() == dae_curr_vplayed() && !xp_eof) - usleep(1); /* Wait for thread to decode first frame */ - } - - xp_core.in_lseek = NoSeek; - - if(a_pthread_is_living) - __MP_SYNCHRONIZE(audio_decode_mutex,pthread_cond_signal(&audio_decode_cond)); - - if(pthread_audio_is_living) - __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); -} - -/* Audio stuff */ -volatile float dec_ahead_audio_delay; -int xp_thread_decode_audio() -{ - int free_buf, vbuf_size, pref_buf; - unsigned len=0; - - if(xp_core.in_lseek) { - xp_audio_eof = 0; - reset_audio_buffer(); - decode_audio_buffer(MAX_OUTBURST); - return 1; - } - - free_buf = get_free_audio_buffer(); - - if( free_buf == -1 ) { /* End of file */ - xp_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(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 */ - -extern ao_data_t* ao_data; -any_t* audio_play_routine( any_t* arg ) -{ - int xp_id; - 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; - - xp_id=init_signal_handling(sig_audio_play,uninit_dec_ahead); - 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) { - 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; - - MP_UNIT(xp_id,"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_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( !xp_core.in_lseek && 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(pthread_audio_end_of_work) - break; - - LOCK_AUDIO_PLAY(); - if(eof && !pthread_audio_end_of_work) { - MP_UNIT(xp_id,"wait end of work"); - pthread_cond_wait( &audio_play_cond, &audio_play_mutex ); - } - UNLOCK_AUDIO_PLAY(); - - if(pthread_audio_end_of_work) - break; - - 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 ); - } - UNLOCK_AUDIO_PLAY(); - - if(pthread_audio_end_of_work) - break; - - MP_UNIT(xp_id,"audio seek"); - LOCK_AUDIO_PLAY(); - while( xp_core.in_lseek!=NoSeek && !pthread_audio_end_of_work) { - 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"); - } - dec_ahead_can_aseek = 0; /* Not safe to seek */ - UNLOCK_AUDIO_PLAY(); - } - fflush(stdout); - MP_UNIT(xp_id,"audio exit"); - dec_ahead_can_aseek=1; - pthread_audio_is_living=0; - pthread_audio_end_of_work=0; - uninit_signal_handling(xp_id); - return arg; -} - -void dec_ahead_reset_sh_video(sh_video_t *shv) -{ - sh_video->vfilter = shv->vfilter; -} - -extern void __exit_sighandler(void); -extern void killall_threads(pthread_t pth_id); -void sig_dec_ahead_video( void ) -{ - MSG_T("sig_dec_ahead_video\n"); - mp_msg_flush(); - - xp_eof = 1; - xp_core.video->fra[dae_curr_vdecoded()].eof=1; - /* - Unlock all mutex - ( man page says it may deadlock, but what is worse deadlock here or later? ) - */ - pthread_is_living=0; - xp_core.in_lseek=NoSeek; - killall_threads(pthread_self()); - __exit_sighandler(); -} - -void sig_audio_play( void ) -{ - MSG_T("sig_audio_play\n"); - mp_msg_flush(); - - dec_ahead_can_aseek=1; - pthread_audio_is_living=0; - - UNLOCK_AUDIO_PLAY(); - - killall_threads(pthread_self()); - __exit_sighandler(); -} - -void sig_audio_decode( void ) -{ - MSG_T("sig_audio_decode\n"); - mp_msg_flush(); - - dec_ahead_can_adseek=1; - a_pthread_is_living=0; - - UNLOCK_AUDIO_DECODE(); - - killall_threads(pthread_self()); - __exit_sighandler(); -} Deleted: mplayerxp/dec_ahead.h =================================================================== --- mplayerxp/dec_ahead.h 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/dec_ahead.h 2012-10-26 13:01:26 UTC (rev 222) @@ -1,135 +0,0 @@ -/* - Decoding ahead - Licence: GPL v2 - Author: Nickols_K - Note: Threaded engine to decode frames ahead -*/ - -#ifndef __DEC_AHEAD_H -#define __DEC_AHEAD_H - -#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 seek_states { NoSeek=0, PreSeek, Seek }; - -enum xp_modes { XP_NA=0, XP_Video, XP_VideoAudio, XP_VAPlay, XP_VAFull }; - -typedef struct frame_attr_s -{ - int eof; /* indicates last frame in stream */ - 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; - -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 */ - /* 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 */ -}dec_ahead_engine_t; - - -typedef struct xp_core_s { - int has_video; - int has_audio; - dec_ahead_engine_t* video; - volatile enum seek_states in_lseek; - volatile int in_pause; - volatile int in_resize; -}xp_core_t; -extern xp_core_t xp_core; - -extern void xp_core_init(void); -extern void xp_core_uninit(void); - -extern void dae_init(dec_ahead_engine_t* it,unsigned nframes); -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_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); - -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); } - -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 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 UNLOCK_AUDIO_PLAY() { MSG_D(DA_PREFIX"UNLOCK_AUDIO_PLAY\n"); pthread_mutex_unlock(&audio_play_mutex); } - -#define LOCK_AUDIO_DECODE() { MSG_D(DA_PREFIX"LOCK_AUDIO_DECODE\n"); pthread_mutex_lock(&audio_decode_mutex); } -#define UNLOCK_AUDIO_DECODE() { MSG_D(DA_PREFIX"UNLOCK_AUDIO_DECODE\n"); pthread_mutex_unlock(&audio_decode_mutex); } - -#define __MP_ATOMIC(OP) { static pthread_mutex_t loc_mutex; pthread_mutex_lock(&loc_mutex); OP; pthread_mutex_unlock(&loc_mutex); } -#define __MP_SYNCHRONIZE(mtx,OP) { pthread_mutex_lock(&mtx); OP; pthread_mutex_unlock(&mtx); } - -extern volatile int xp_eof; -extern int xp_audio_eof; -extern int xp_is_bad_pts; - -extern volatile int dec_ahead_can_aseek; -extern int ao_da_buffs; - /* - stream - pointer to openned stream - astream - pointer to audio stream - */ - -extern int init_dec_ahead(sh_video_t*stream, sh_audio_t *astream); -extern void uninit_dec_ahead( int force ); -extern int run_dec_ahead( void ); -extern int run_xp_aplayers( void ); -extern void dec_ahead_reset_sh_video(sh_video_t* shv); - -extern void sig_dec_ahead_video( void ); - -/* Audio stuff */ -int xp_thread_decode_audio(); -extern void sig_audio_play( void ); -extern void sig_audio_decode( void ); -extern volatile float dec_ahead_audio_delay; -extern void dec_ahead_halt_threads(int is_reset_vcache); -extern void dec_ahead_restart_threads(int xp_id); -#endif Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libao2/ao_wav.c 2012-10-26 13:01:26 UTC (rev 222) @@ -23,7 +23,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "dec_ahead.h" +#include "xmp_core.h" #include "../bswap.h" #include "postproc/af_format.h" Modified: mplayerxp/libmpcodecs/dec_video.c =================================================================== --- mplayerxp/libmpcodecs/dec_video.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libmpcodecs/dec_video.c 2012-10-26 13:01:26 UTC (rev 222) @@ -29,7 +29,7 @@ #include "vd.h" -#include "dec_ahead.h" +#include "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-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libmpcodecs/vd.c 2012-10-26 13:01:26 UTC (rev 222) @@ -9,7 +9,7 @@ #include <malloc.h> #endif -#include "dec_ahead.h" +#include "xmp_core.h" #include "libmpconf/codec-cfg.h" #include "libvo/img_format.h" Modified: mplayerxp/libmpcodecs/vd_ffmpeg.c =================================================================== --- mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libmpcodecs/vd_ffmpeg.c 2012-10-26 13:01:26 UTC (rev 222) @@ -6,7 +6,7 @@ #include "mp_config.h" #include "mplayer.h" -#include "dec_ahead.h" +#include "xmp_core.h" #ifdef HAVE_GOMP #include <omp.h> #endif Modified: mplayerxp/libmpdemux/demuxer_r.c =================================================================== --- mplayerxp/libmpdemux/demuxer_r.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libmpdemux/demuxer_r.c 2012-10-26 13:01:26 UTC (rev 222) @@ -9,9 +9,10 @@ #include "demuxer_r.h" #include "libmpsub/vobsub.h" #include "osdep/timer.h" -#include "../mplayer.h" -#include "../dec_ahead.h" +#include "mplayer.h" +#include "xmp_core.h" + pthread_mutex_t demuxer_mutex=PTHREAD_MUTEX_INITIALIZER; #define LOCK_DEMUXER() { pthread_mutex_lock(&demuxer_mutex); } #define UNLOCK_DEMUXER() { pthread_mutex_unlock(&demuxer_mutex); } Modified: mplayerxp/libmpsub/spudec.c =================================================================== --- mplayerxp/libmpsub/spudec.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libmpsub/spudec.c 2012-10-26 13:01:26 UTC (rev 222) @@ -21,7 +21,7 @@ #include <unistd.h> #include <math.h> -#include "dec_ahead.h" +#include "xmp_core.h" #include "spudec.h" #include "postproc/swscale.h" #define MSGT_CLASS MSGT_SPUDEC Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libvo/video_out.c 2012-10-26 13:01:26 UTC (rev 222) @@ -29,12 +29,12 @@ #include "mp_config.h" #include "video_out.h" -#include "../osdep/shmem.h" -#include "../postproc/swscale.h" -#include "../postproc/vf.h" -#include "../dec_ahead.h" -#include "../my_malloc.h" -#include "../mplayer.h" +#include "osdep/shmem.h" +#include "postproc/swscale.h" +#include "postproc/vf.h" +#include "xmp_core.h" +#include "my_malloc.h" +#include "mplayer.h" #include "fastmemcpy.h" #include "img_format.h" #include "screenshot.h" Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libvo/vo_opengl.c 2012-10-26 13:01:26 UTC (rev 222) @@ -23,9 +23,10 @@ #include <dlfcn.h> -#include "../mp_config.h" -#include "../mplayer.h" -#include "../dec_ahead.h" +#include "mp_config.h" +#include "mplayer.h" +#include "xmp_core.h" + #include "dri_vo.h" #include "video_out.h" #include "video_out_internal.h" Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libvo/vo_sdl.c 2012-10-26 13:01:26 UTC (rev 222) @@ -107,8 +107,10 @@ #include <inttypes.h> #include <errno.h> -#include "../mp_config.h" -#include "../mplayer.h" +#include "mp_config.h" +#include "mplayer.h" +#include "xmp_core.h" + #include "video_out.h" #include "fastmemcpy.h" @@ -120,13 +122,12 @@ #include "x11_common.h" #endif -#include "../input/input.h" -#include "../input/mouse.h" -#include "../dec_ahead.h" -#include "../osdep/keycodes.h" +#include "input/input.h" +#include "input/mouse.h" +#include "osdep/keycodes.h" #include "dri_vo.h" #include "video_out_internal.h" -#include "../mp_image.h" +#include "mp_image.h" #ifdef CONFIG_VIDIX #include "vosub_vidix.h" #endif Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libvo/vo_x11.c 2012-10-26 13:01:26 UTC (rev 222) @@ -27,8 +27,8 @@ #include <errno.h> #include "mp_config.h" -#include "../mplayer.h" -#include "../dec_ahead.h" +#include "mplayer.h" +#include "xmp_core.h" #include "aspect.h" #include "video_out.h" @@ -41,10 +41,10 @@ #include "fastmemcpy.h" #include "sub.h" -#include "../postproc/swscale.h" /* for MODE_RGB(BGR) definitions */ +#include "postproc/swscale.h" /* for MODE_RGB(BGR) definitions */ #include "video_out_internal.h" #include "dri_vo.h" -#include "../mp_image.h" +#include "mp_image.h" LIBVO_EXTERN( x11 ) static vo_info_t vo_info = Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libvo/vo_xv.c 2012-10-26 13:01:26 UTC (rev 222) @@ -16,9 +16,9 @@ #include <stdlib.h> #include <string.h> -#include "../mp_config.h" -#include "../mplayer.h" -#include "../dec_ahead.h" +#include "mp_config.h" +#include "mplayer.h" +#include "xmp_core.h" #include "video_out.h" #include "video_out_internal.h" @@ -35,7 +35,7 @@ #include "sub.h" #include "aspect.h" #include "dri_vo.h" -#include "../mp_image.h" +#include "mp_image.h" #include <X11/extensions/Xv.h> #include <X11/extensions/Xvlib.h> Modified: mplayerxp/libvo/vo_xvidix.c =================================================================== --- mplayerxp/libvo/vo_xvidix.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/libvo/vo_xvidix.c 2012-10-26 13:01:26 UTC (rev 222) @@ -15,8 +15,9 @@ #include <errno.h> #include "mp_config.h" -#include "../mplayer.h" -#include "../dec_ahead.h" +#include "mplayer.h" +#include "xmp_core.h" + #include "video_out.h" #include "video_out_internal.h" Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/mplayer.c 2012-10-26 13:01:26 UTC (rev 222) @@ -91,7 +91,7 @@ /************************************************************************** Decoding ahead **************************************************************************/ -#include "dec_ahead.h" +#include "xmp_core.h" volatile unsigned xp_drop_frame_cnt=0; unsigned xp_num_frames=0; Modified: mplayerxp/postproc/vf.c =================================================================== --- mplayerxp/postproc/vf.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/postproc/vf.c 2012-10-26 13:01:26 UTC (rev 222) @@ -6,16 +6,16 @@ #ifdef HAVE_MALLOC #include <malloc.h> #endif -#include "../dec_ahead.h" -#include "../mplayer.h" -#include "../help_mp.h" +#include "xmp_core.h" +#include "mplayer.h" +#include "help_mp.h" -#include "../libvo/img_format.h" -#include "../libvo/video_out.h" +#include "libvo/img_format.h" +#include "libvo/video_out.h" #include "mp_image.h" #include "vf.h" -#include "../libvo/fastmemcpy.h" +#include "libvo/fastmemcpy.h" #include "libmpconf/codec-cfg.h" #include "pp_msg.h" Modified: mplayerxp/sig_hand.c =================================================================== --- mplayerxp/sig_hand.c 2012-10-26 12:27:16 UTC (rev 221) +++ mplayerxp/sig_hand.c 2012-10-26 13:01:26 UTC (rev 222) @@ -14,7 +14,7 @@ #include <sys/types.h> #include <unistd.h> #include <stdlib.h> -#include "dec_ahead.h" +#include "xmp_core.h" #include "mp_msg.h" pth_info_t pinfo[MAX_XPTHREADS]; Copied: mplayerxp/xmp_core.c (from rev 221, mplayerxp/dec_ahead.c) =================================================================== --- mplayerxp/xmp_core.c (rev 0) +++ mplayerxp/xmp_core.c 2012-10-26 13:01:26 UTC (rev 222) @@ -0,0 +1,951 @@ +/* + 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> +#ifdef HAVE_MALLOC +#include <malloc.h> +#endif +#define DA_PREFIX "DEC_AHEAD:" +#include "xmp_core.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 + +xp_core_t xp_core; + +void xp_core_init(void) { + memset(&xp_core,0,sizeof(xp_core_t)); + xp_core.in_lseek=NoSeek; +} + +void xp_core_uninit(void) {} + +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) +{ + it->nframes=nframes; + it->fra = malloc(sizeof(frame_attr_t)*nframes); + dae_reset(it); +} + +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) { + unsigned new_idx; + new_idx=(it->player_idx+1)%it->nframes; + if(new_idx==it->decoder_idx) { + it->num_slow_frames++; + return 0; + } + it->player_idx=new_idx; + it->num_slow_frames=0; + it->num_played_frames++; + 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; + 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; +} + +frame_attr_t dae_played_fra(const dec_ahead_engine_t* it) { + unsigned idx=it->player_idx; + return it->fra[idx]; +} +frame_attr_t dae_decoded_fra(const dec_ahead_engine_t* it) { + unsigned idx=it->decoder_idx; + return it->fra[idx]; +} + +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; + +extern volatile int xp_drop_frame; +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; + +/* 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 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; +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); +extern int read_audio_buffer(sh_audio_t *audio, unsigned char *buffer, unsigned minlen, unsigned maxlen ); +extern float get_delay_audio_buffer(void); +extern int decode_audio_buffer(unsigned len); +extern void reset_audio_buffer(void); +extern int get_len_audio_buffer(void); +extern int get_free_audio_buffer(void); + +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 */ + +static void show_warn_cant_sync(float max_frame_delay) { + static int warned=0; + static float prev_warn_delay=0; + if(!warned || max_frame_delay > prev_warn_delay) { + warned=1; + MSG_WARN("*********************************************\n" + "** Can't stabilize A-V sync!!! **\n" + "*********************************************\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); + prev_warn_delay=max_frame_delay; + } +} + +static unsigned compute_frame_dropping(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 */ + max_frame_delay = time_usage.max_video+time_usage.max_vout; + + /* + TODO: + Replace the constants with some values which are depended on + xp_num_frames 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: + - fill a full buffer (is not always reachable) + - while(video.pts < audio.pts) + video.seek_to_key_frame(video.get_next_key_frame(video.get_cur_pos())) + */ + 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; + else + if(mp_conf.verbose) show_warn_cant_sync(max_frame_delay); + } + if(delta > drop_barrier) rc=0; + else if(delta < max_frame_delay*3) rc=1; + else { + unsigned fr_skip_divisor; + /* + if(delta < drop_barrier/4) fr_skip_divisor=1; -- drop every frame is not smooth thing + else + */ + if(delta < drop_barrier/2) fr_skip_divisor=2; + else + 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; + 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); + prev_delta=delta; + return rc; +} + +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 && + fra[idx2].v_pts > fra[idx1].v_pts && + fra[idx2].v_pts < fra[idx1].v_pts+1.0 ) { + float tmp; + tmp = fra[idx1].v_pts; + 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_num_frames; + 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; + + idx0 = idx1; + idx1 = idx2; + idx2=(idx2-1)%xp_num_frames; + } +} + +any_t* Va_dec_ahead_routine( any_t* 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; + 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); + 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 = mp_conf.av_sync_pts?0:1; +while(!xp_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; + } + 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) { + MP_UNIT(_xp_id,"decode audio"); + while(2==xp_thread_decode_audio()) ; + 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) { + 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; + } + 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; + } + /* frame was decoded into current decoder_idx */ + if(xp_is_bad_pts) { + if(mpeg_timer==HUGE) mpeg_timer=v_pts; + else if( mpeg_timer-duration<v_pts ) { + mpeg_timer=v_pts; + MSG_DBG2("Sync mpeg pts %f\n", mpeg_timer); + } + else mpeg_timer+=duration; + } + /* compute frame dropping */ + xp_n_frame_to_drop=0; + 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( mp_conf.frame_dropping ) */ + if(xp_core.in_lseek!=NoSeek) continue; +#if 0 +/* + We can't seriously examine question of too slow machines + by motivation reasons +*/ +if(ada_active_frame) /* don't emulate slow systems until xp_players are not started */ +{ + int i,delay; /* sleeping 200 ms is far enough for 25 fps */ + delay=xp_n_frame_to_drop?0:20; + for(i=0;i<delay;i++) usleep(0); +} +#endif + if(xp_n_frame_to_drop) drop_param=mp_conf.frame_dropping; + else drop_param=0; + /* decode: */ + if(output_quality) { + unsigned total = xp_num_frames/2; + unsigned distance = dae_get_decoder_outrun(xp_core.video); + int our_quality; + our_quality = output_quality*distance/total; + if(drop_param) mpcv_set_quality(sh_video,0); + else + 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); + if(output_quality) { + if(drop_param) mpcv_set_quality(sh_video,output_quality); + } + if(!blit_frame && drop_param) xp_drop_frame_cnt++; + if(blit_frame) { + unsigned idx=dae_curr_vdecoded(); + if(xp_is_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_is_bad_pts) { + int _idx = dae_prev_vdecoded(); + 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) */ + + /* ------------ sleep --------------- */ + /* sleep if thread is too fast ;) */ + if(blit_frame) + 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(xp_core.has_audio && mp_conf.xp<XP_VAFull) { + MP_UNIT(_xp_id,"decode audio"); + xp_thread_decode_audio(); + MP_UNIT(_xp_id,"dec_ahead 5"); + } + usleep(1); + } +/*------------------------ frame decoded. --------------------*/ +} /* while(!xp_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"); + if(!xp_thread_decode_audio()) usleep(1); + MP_UNIT(_xp_id,NULL); + } +} + pt_exit: + MSG_T("\nDEC_AHEAD: leaving...\n"); + pthread_is_living=0; + pthread_end_of_work=0; + uninit_signal_handling(_xp_id); + return arg; /* terminate thread here !!! */ +} + +/* this routine decodes audio only */ +any_t* a_dec_ahead_routine( any_t* arg ) +{ + int xp_id; + int ret, retval; + struct timeval now; + struct timespec timeout; + float d; + + a_pthread_is_living=1; + xp_eof = 0; + xp_audio_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"; + + 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; + + dec_ahead_can_adseek=1; + + if(a_pthread_end_of_work) + break; + + MP_UNIT(xp_id,"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"); + 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-=1000... [truncated message content] |
From: <nic...@us...> - 2012-10-27 10:31:06
|
Revision: 225 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=225&view=rev Author: nickols_k Date: 2012-10-27 10:31:00 +0000 (Sat, 27 Oct 2012) Log Message: ----------- fix seeking Modified Paths: -------------- mplayerxp/mplayer.c mplayerxp/xmp_core.c mplayerxp/xmp_core.h Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-10-27 09:28:35 UTC (rev 224) +++ mplayerxp/mplayer.c 2012-10-27 10:31:00 UTC (rev 225) @@ -1248,9 +1248,8 @@ if(xp_core.eof && final_frame) return 1; can_blit=dae_try_inc_played(xp_core.video); /* <-- TRY SWITCH TO NEXT FRAME */ - shva=dae_played_fra(xp_core.video); + shva=dae_next_played_fra(xp_core.video); v_pts = shva.v_pts; - /*------------------------ frame decoded. --------------------*/ /* blit frame */ @@ -1435,6 +1434,12 @@ } } } + + if(sh_video) { + do { + usleep(0); + }while(dae_get_decoder_outrun(xp_core.video) < xp_core.num_v_buffs/2 && !xp_core.eof); + } } void mpxp_reset_vcache(void) Modified: mplayerxp/xmp_core.c =================================================================== --- mplayerxp/xmp_core.c 2012-10-27 09:28:35 UTC (rev 224) +++ mplayerxp/xmp_core.c 2012-10-27 10:31:00 UTC (rev 225) @@ -18,6 +18,7 @@ #include <malloc.h> #endif #define DA_PREFIX "DEC_AHEAD:" + #include "xmp_core.h" #include "mplayer.h" #include "libao2/audio_out.h" @@ -100,7 +101,6 @@ it->num_slow_frames++; return 0; } - it->player_idx=new_idx; it->num_slow_frames=0; it->num_played_frames++; return 1; @@ -143,6 +143,22 @@ unsigned idx=it->decoder_idx; return it->fra[idx]; } +frame_attr_t dae_next_played_fra(const dec_ahead_engine_t* it) { + unsigned idx=dae_next_played(it); + return it->fra[idx]; +} +frame_attr_t dae_next_decoded_fra(const dec_ahead_engine_t* it) { + unsigned idx=dae_next_decoded(it); + return it->fra[idx]; +} +frame_attr_t dae_prev_played_fra(const dec_ahead_engine_t* it) { + unsigned idx=dae_prev_played(it); + return it->fra[idx]; +} +frame_attr_t dae_prev_decoded_fra(const dec_ahead_engine_t* it) { + unsigned idx=dae_prev_decoded(it); + return it->fra[idx]; +} pthread_mutex_t audio_play_mutex=PTHREAD_MUTEX_INITIALIZER; pthread_cond_t audio_play_cond=PTHREAD_COND_INITIALIZER; @@ -359,6 +375,7 @@ /* Ugly solution: disable frame dropping right after seeking! */ 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(!finite(v_pts)) MSG_WARN("Bug of demuxer! Value of video pts=%f\n",v_pts); #if 0 /* We can't seriously examine question of too slow machines Modified: mplayerxp/xmp_core.h =================================================================== --- mplayerxp/xmp_core.h 2012-10-27 09:28:35 UTC (rev 224) +++ mplayerxp/xmp_core.h 2012-10-27 10:31:00 UTC (rev 225) @@ -119,8 +119,11 @@ 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 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. |