[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[287] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-11-03 11:36:21
|
Revision: 287 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=287&view=rev Author: nickols_k Date: 2012-11-03 11:36:13 +0000 (Sat, 03 Nov 2012) Log Message: ----------- change -core.xp behaviour. Note: seeking works only when -core.xp>=3 Modified Paths: -------------- DOCS/mplayerxp.1 ffmpeg/doc/examples/pc-uninstalled/libavcodec.pc ffmpeg/doc/examples/pc-uninstalled/libavformat.pc ffmpeg/doc/examples/pc-uninstalled/libavutil.pc ffmpeg/doc/examples/pc-uninstalled/libpostproc.pc ffmpeg/doc/examples/pc-uninstalled/libswscale.pc mplayerxp/cfg-mplayer.h mplayerxp/libvo/video_out.c mplayerxp/libvo/video_out.h mplayerxp/libvo/vo_dga.c mplayerxp/libvo/vo_fbdev.c mplayerxp/libvo/vo_null.c mplayerxp/libvo/vo_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 mplayerxp/xmpcore/xmp_aplayer.c mplayerxp/xmpcore/xmp_core.c mplayerxp/xmpcore/xmp_core.h mplayerxp/xmpcore/xmp_vdecoder.c mplayerxp/xmpcore/xmp_vplayer.c Modified: DOCS/mplayerxp.1 =================================================================== --- DOCS/mplayerxp.1 2012-11-02 17:31:28 UTC (rev 286) +++ DOCS/mplayerxp.1 2012-11-03 11:36:13 UTC (rev 287) @@ -39,20 +39,19 @@ .LP .SH "XP OPTIONS" .TP -.B \-core.xp\ <0-4> -start MPlayerXP in XP mode. You should get smoothness (fixed FPS on the screen) -with UP systems and decoding speedup with SMP. - 0 : XP mode off - 1 : Decode video in separate thread - 2 : Decode audio and video in the same separate thread - 3 : As 2 plus audio playing in separate thread -.B [default] - 4 : Decode video and audio and play audio in three different threads +.B \-core.xp\ +Specifies number cpus to use for playback. + 0 : not playback possible. (Immediate exit) + 1 : build multi-thread model for Uni-Processor systems + 2 : build multi-thread model for Dual-Processors systems + 3 : build multi-thread model for Tripple-Processors systems + 4+: build multi-thread model for Multi-Processors systems +By default this value is autodetected depends on number CPU, but you +may force prefered multi-thread model. .TP -.B \-core.da_buffs +.B \-core.xp_buffs Allows you specify number of buffers for decoding ahead. -You can set it from 5 upto 64. 64 is default. (I recommend to use -10 buffers as minimum to avoid screen juddering and other negative factors). +You can set it from 3 upto 1024. 64 is default. .I NOTE: .B (For both - UP and SMP) drivers which provide direct BES access will change it automatically Modified: ffmpeg/doc/examples/pc-uninstalled/libavcodec.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libavcodec.pc 2012-11-02 17:31:28 UTC (rev 286) +++ ffmpeg/doc/examples/pc-uninstalled/libavcodec.pc 2012-11-03 11:36:13 UTC (rev 287) @@ -8,5 +8,5 @@ Version: 54.59.100 Requires: libavutil = 51.73.101 Conflicts: -Libs: -L${libdir} -lavcodec -ljack -lasound -Wl,-rpath,/usr/X11/lib64 -L/usr/X11/lib64 -lSDL -lpthread -lm -pthread -lbz2 -lz -lrt +Libs: -L${libdir} -lavcodec64 -ljack -lasound -Wl,-rpath,/usr/X11/lib64 -L/usr/X11/lib64 -lSDL -lpthread -lm -pthread -lbz2 -lz -lrt Cflags: -I${includedir} Modified: ffmpeg/doc/examples/pc-uninstalled/libavformat.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libavformat.pc 2012-11-02 17:31:28 UTC (rev 286) +++ ffmpeg/doc/examples/pc-uninstalled/libavformat.pc 2012-11-03 11:36:13 UTC (rev 287) @@ -8,5 +8,5 @@ Version: 54.29.104 Requires: libavcodec = 54.59.100 Conflicts: -Libs: -L${libdir} -lavformat -ljack -lasound -Wl,-rpath,/usr/X11/lib64 -L/usr/X11/lib64 -lSDL -lpthread -lm -pthread -lbz2 -lz -lrt +Libs: -L${libdir} -lavformat64 -ljack -lasound -Wl,-rpath,/usr/X11/lib64 -L/usr/X11/lib64 -lSDL -lpthread -lm -pthread -lbz2 -lz -lrt Cflags: -I${includedir} Modified: ffmpeg/doc/examples/pc-uninstalled/libavutil.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libavutil.pc 2012-11-02 17:31:28 UTC (rev 286) +++ ffmpeg/doc/examples/pc-uninstalled/libavutil.pc 2012-11-03 11:36:13 UTC (rev 287) @@ -8,5 +8,5 @@ Version: 51.73.101 Requires: Conflicts: -Libs: -L${libdir} -lavutil -lm +Libs: -L${libdir} -lavutil64 -lm Cflags: -I${includedir} Modified: ffmpeg/doc/examples/pc-uninstalled/libpostproc.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libpostproc.pc 2012-11-02 17:31:28 UTC (rev 286) +++ ffmpeg/doc/examples/pc-uninstalled/libpostproc.pc 2012-11-03 11:36:13 UTC (rev 287) @@ -8,5 +8,5 @@ Version: 52.0.100 Requires: libavutil = 51.73.101 Conflicts: -Libs: -L${libdir} -lpostproc +Libs: -L${libdir} -lpostproc64 Cflags: -I${includedir} Modified: ffmpeg/doc/examples/pc-uninstalled/libswscale.pc =================================================================== --- ffmpeg/doc/examples/pc-uninstalled/libswscale.pc 2012-11-02 17:31:28 UTC (rev 286) +++ ffmpeg/doc/examples/pc-uninstalled/libswscale.pc 2012-11-03 11:36:13 UTC (rev 287) @@ -8,5 +8,5 @@ Version: 2.1.101 Requires: libavutil = 51.73.101 Conflicts: -Libs: -L${libdir} -lswscale -lm +Libs: -L${libdir} -lswscale64 -lm Cflags: -I${includedir} Modified: mplayerxp/cfg-mplayer.h =================================================================== --- mplayerxp/cfg-mplayer.h 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/cfg-mplayer.h 2012-11-03 11:36:13 UTC (rev 287) @@ -37,11 +37,11 @@ */ static const config_t xpcore_config[]={ - {"xp", &mp_conf.xp, CONF_TYPE_INT, CONF_RANGE, 0, 4, "starts MPlayerXP in multi-thread and multi-buffer XP mode"}, + {"xp", &mp_conf.xp, CONF_TYPE_INT, CONF_RANGE, 0, UINT_MAX, "specifies number cpus to use for playback"}, {"dump", &mp_conf.stream_dump, CONF_TYPE_STRING, 0, 0, 0, "specifies dump type and name for the dump of stream"}, {"gomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 0, 1, "enables usage of OpenMP extensions"}, {"nogomp", &mp_conf.gomp, CONF_TYPE_FLAG, 0, 1, 0, "disables usage of OpenMP extensions"}, - {"da_buffs", &vo_conf.da_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, "specifies number of buffers for decoding-ahead in XP mode"}, + {"xp_buffs", &vo_conf.xp_buffs, CONF_TYPE_INT, CONF_RANGE, 4, 1024, "specifies number of buffers for decoding-ahead in XP mode"}, {"cache", &mp_conf.s_cache_size, CONF_TYPE_INT, CONF_RANGE, 4, 65536, "specifies amount of memory for precaching a file/URL"}, {"nocache", &mp_conf.s_cache_size, CONF_TYPE_FLAG, 0, 1, 0, "disables precaching a file/URL"}, {"autoq", &mp_conf.autoq, CONF_TYPE_INT, CONF_RANGE, 0, 100, "dynamically changes the level of postprocessing depending on spare CPU time available"}, Modified: mplayerxp/libvo/video_out.c =================================================================== --- mplayerxp/libvo/video_out.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/video_out.c 2012-11-03 11:36:13 UTC (rev 287) @@ -178,7 +178,7 @@ 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.xp_buffs=64; vo_conf.WinID=-1; vo=mp_mallocz(sizeof(vo_data_t)); Modified: mplayerxp/libvo/video_out.h =================================================================== --- mplayerxp/libvo/video_out.h 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/video_out.h 2012-11-03 11:36:13 UTC (rev 287) @@ -132,7 +132,7 @@ int WinID; /* output window id */ int vsync; - unsigned da_buffs; /**< contains number of buffers for decoding ahead */ + unsigned xp_buffs; /**< contains number of buffers for decoding ahead */ unsigned use_bm; /**< indicates user's agreement for using busmastering */ vo_gamma_t gamma; Modified: mplayerxp/libvo/vo_dga.c =================================================================== --- mplayerxp/libvo/vo_dga.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_dga.c 2012-11-03 11:36:13 UTC (rev 287) @@ -724,7 +724,7 @@ dest_frame_size = priv->width*HW_MODE.vdm_bytespp*priv->vp_height; priv->num_buffers = (ram_size*1024)/dest_frame_size; - if(priv->num_buffers > vo_conf.da_buffs) priv->num_buffers = vo_conf.da_buffs; + if(priv->num_buffers > vo_conf.xp_buffs) priv->num_buffers = vo_conf.xp_buffs; if(priv->num_buffers > MAX_DRI_BUFFERS) priv->num_buffers = MAX_DRI_BUFFERS; for(freq=1;freq<priv->num_buffers;freq++) { Modified: mplayerxp/libvo/vo_fbdev.c =================================================================== --- mplayerxp/libvo/vo_fbdev.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_fbdev.c 2012-11-03 11:36:13 UTC (rev 287) @@ -1025,7 +1025,7 @@ MSG_DBG2(FBDEV "priv->L123123875 @ %p\n", priv->L123123875); MSG_V(FBDEV "pixel per priv->line: %d\n", priv->line_len / priv->pixel_size); - priv->total_fr=vo_conf.da_buffs; + priv->total_fr=vo_conf.xp_buffs; for(i=0;i<priv->total_fr;i++) if (!(priv->next_frame[i] = (uint8_t *) mp_malloc(priv->out_width * priv->out_height * priv->pixel_size))) { MSG_ERR(FBDEV "Can't mp_malloc priv->next_frame: %s\n", strerror(errno)); Modified: mplayerxp/libvo/vo_null.c =================================================================== --- mplayerxp/libvo/vo_null.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_null.c 2012-11-03 11:36:13 UTC (rev 287) @@ -69,7 +69,7 @@ size_t i; priv->image_width = width; priv->image_height = height; - priv->num_frames = vo_conf.da_buffs; + priv->num_frames = vo_conf.xp_buffs; priv->fourcc=format; UNUSED(d_width); UNUSED(d_height); Modified: mplayerxp/libvo/vo_opengl.c =================================================================== --- mplayerxp/libvo/vo_opengl.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_opengl.c 2012-11-03 11:36:13 UTC (rev 287) @@ -174,7 +174,7 @@ if ( vo_FS(vo) ) { vo->dest.w=d_width; vo->dest.h=d_height; } - priv->num_buffers=vo_conf.da_buffs; + priv->num_buffers=vo_conf.xp_buffs; aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); aspect(&d_width,&d_height,vo_ZOOM(vo)?A_ZOOM:A_NOZOOM); Modified: mplayerxp/libvo/vo_sdl.c =================================================================== --- mplayerxp/libvo/vo_sdl.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_sdl.c 2012-11-03 11:36:13 UTC (rev 287) @@ -734,7 +734,7 @@ { priv_t *priv = vo->priv; unsigned i,retval; - priv->num_buffs=vo_conf.da_buffs; + priv->num_buffs=vo_conf.xp_buffs; #ifdef CONFIG_VIDIX if(!vidix_name) { #endif Modified: mplayerxp/libvo/vo_vesa.c =================================================================== --- mplayerxp/libvo/vo_vesa.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_vesa.c 2012-11-03 11:36:13 UTC (rev 287) @@ -52,8 +52,6 @@ #define min(a,b) ((a)<(b)?(a):(b)) #endif -#define UNUSED(x) ((void)(x)) /**< Removes warning about unused arguments */ - static vo_info_t vo_info = { "VESA VBE 2.0 video output" @@ -602,7 +600,7 @@ ,vsize); MSG_V(" at %08lXh",(unsigned long)lfb); MSG_V("\n"); - if(!(priv->multi_size = fillMultiBuffer(vo,vsize,vo_conf.da_buffs))) return -1; + if(!(priv->multi_size = fillMultiBuffer(vo,vsize,vo_conf.xp_buffs))) return -1; 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); } Modified: mplayerxp/libvo/vo_x11.c =================================================================== --- mplayerxp/libvo/vo_x11.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_x11.c 2012-11-03 11:36:13 UTC (rev 287) @@ -126,7 +126,7 @@ UNUSED(info); - priv->num_buffers=vo_conf.da_buffs; + priv->num_buffers=vo_conf.xp_buffs; if (!title) title = mp_strdup("MPlayerXP X11 (XImage/Shm) render"); Modified: mplayerxp/libvo/vo_xv.c =================================================================== --- mplayerxp/libvo/vo_xv.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vo_xv.c 2012-11-03 11:36:13 UTC (rev 287) @@ -285,7 +285,7 @@ if ( vo_FS(vo) ) { vo->dest.w=d_width; vo->dest.h=d_height; } - priv->num_buffers=vo_conf.da_buffs; + priv->num_buffers=vo_conf.xp_buffs; aspect_save_screenres(vo_conf.screenwidth,vo_conf.screenheight); Modified: mplayerxp/libvo/vosub_vidix.c =================================================================== --- mplayerxp/libvo/vosub_vidix.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/libvo/vosub_vidix.c 2012-11-03 11:36:13 UTC (rev 287) @@ -140,7 +140,7 @@ vidix_stop(vo); vdlClose(priv->handler); if(vo_conf.use_bm) { - for(i=0;i<vo_conf.da_buffs;i++) { + for(i=0;i<vo_conf.xp_buffs;i++) { if(priv->bm_locked) munlock(priv->bm_buffs[i],priv->play->frame_size); mp_free(priv->bm_buffs[i]); priv->bm_buffs[i]=NULL; @@ -405,7 +405,7 @@ priv->play->dest.w = dst_width; priv->play->dest.h = dst_height; priv->play->num_frames=(vo_conf.use_bm!=1)?NUM_FRAMES-1:1; - if(priv->play->num_frames > vo_conf.da_buffs) priv->play->num_frames = vo_conf.da_buffs; + if(priv->play->num_frames > vo_conf.xp_buffs) priv->play->num_frames = vo_conf.xp_buffs; priv->play->src.pitch.y = priv->play->src.pitch.u = priv->play->src.pitch.v = 0; if(info) { switch(((const vo_tune_info_t *)info)->pitch[0]) { @@ -456,7 +456,7 @@ if(priv->cap->flags & FLAG_DMA) { int psize = getpagesize(); priv->bm_locked=1; - for(i=0;i<vo_conf.da_buffs;i++) { + for(i=0;i<vo_conf.xp_buffs;i++) { if(!priv->bm_buffs[i]) priv->bm_buffs[i] = mp_memalign(psize, priv->play->frame_size); if(!(priv->bm_buffs[i])) { MSG_ERR("Can't allocate memory for busmastering\n"); @@ -592,7 +592,7 @@ if(priv->inited) return (*server_control)(vo,request,data); break; case VOCTRL_GET_NUM_FRAMES: - *(uint32_t *)data = (vo_conf.use_bm == 1) ? vo_conf.da_buffs : priv->play->num_frames; + *(uint32_t *)data = (vo_conf.use_bm == 1) ? vo_conf.xp_buffs : priv->play->num_frames; return CONTROL_TRUE; case DRI_GET_SURFACE_CAPS: vidix_dri_get_surface_caps(vo,data); @@ -624,7 +624,7 @@ if(vdlGetVersion() != VIDIX_VERSION) { MSG_FATAL("You have wrong version of VIDIX library\n"); mp_free(priv); - return NULL; + return -1; } priv->handler = vdlOpen(VIDIX_PATH, drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, @@ -633,12 +633,12 @@ if(priv->handler == NULL) { MSG_FATAL("Couldn't find working VIDIX driver\n"); mp_free(priv); - return NULL; + return -1; } if((err=vdlGetCapability(priv->handler,priv->cap)) != 0) { MSG_FATAL("Couldn't get capability: %s\n",strerror(err)); mp_free(priv); - return NULL; + return -1; } else MSG_V("Driver capability: %X\n",priv->cap->flags); MSG_V("Using: %s by %s\n",priv->cap->name,priv->cap->author); @@ -651,5 +651,5 @@ } priv->vo_server = server; priv->inited=1; - return priv; + return 0; } Modified: mplayerxp/mplayer.c =================================================================== --- mplayerxp/mplayer.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/mplayer.c 2012-11-03 11:36:13 UTC (rev 287) @@ -188,6 +188,16 @@ return rc; } +unsigned xp_num_cpu; +static unsigned get_number_cpu(void) { +#ifdef _OPENMP + return omp_get_num_procs(); +#else + /* TODO ? */ + return 1; +#endif +} + static void mpxp_init_structs(void) { mp_data=mp_mallocz(sizeof(mp_data_t)); mp_data->seek_time=-1; @@ -201,7 +211,7 @@ memset(&x86,-1,sizeof(x86_features_t)); #endif memset(&mp_conf,0,sizeof(mp_conf_t)); - mp_conf.xp=XP_VAPlay; + mp_conf.xp=get_number_cpu(); mp_conf.audio_id=-1; mp_conf.video_id=-1; mp_conf.dvdsub_id=-1; @@ -463,17 +473,6 @@ return eof; } -unsigned xp_num_cpu; -static unsigned get_number_cpu(void) { -#ifdef _OPENMP - return omp_get_num_procs(); -#else - /* TODO ? */ - return 1; -#endif -} - - #if defined( ARCH_X86 ) || defined(ARCH_X86_64) static void get_mmx_optimizations( void ) { @@ -803,7 +802,7 @@ { priv_t*priv=mp_data->priv; sh_audio_t* sh_audio=priv->demuxer->audio->sh; - if( mp_conf.xp <= XP_Video ) + if(xmp_test_model(XMP_Run_AudioPlayback)) MSG_STATUS("A:%6.1f %4.1f%%\r" ,sh_audio->timer-ao_get_delay(ao_data) ,(sh_audio->timer>0.5)?100.0*(mp_data->bench->audio+mp_data->bench->audio_decode)/(double)sh_audio->timer:0 @@ -1354,7 +1353,7 @@ } if (priv->ao_inited && sh_audio) { - if( mp_conf.xp >= XP_VAPlay ) { + if(xmp_test_model(XMP_Run_AudioPlayer)) { xp_core->in_pause=1; while( !dec_ahead_can_aseek ) usleep(0); } @@ -1374,7 +1373,7 @@ if(priv->osd_function==OSD_PAUSE) priv->osd_function=OSD_PLAY; if (priv->ao_inited && sh_audio) { ao_resume(ao_data); // resume audio - if( mp_conf.xp >= XP_VAPlay ) { + if(xmp_test_model(XMP_Run_AudioPlayer)) { xp_core->in_pause=0; __MP_SYNCHRONIZE(audio_play_mutex,pthread_cond_signal(&audio_play_cond)); } @@ -1712,7 +1711,7 @@ } } - xp_core->num_a_buffs = vo_conf.da_buffs; + xp_core->num_a_buffs = vo_conf.xp_buffs; init_player(); @@ -2002,6 +2001,7 @@ ,xp_core->mpxp_threads[idx]->name ,xp_core->mpxp_threads[idx]->pid ,xp_core->mpxp_threads[idx]->pth_id); + //==================== START PLAYING ======================= MSG_OK(MSGTR_StartPlaying);fflush(stdout); @@ -2018,34 +2018,20 @@ eof |= xp_core->audio->eof; /*========================== UPDATE TIMERS ============================*/ MP_UNIT("Update timers"); + if(sh_video && input_state.need_repaint) goto repaint; + if(sh_audio) eof = xp_core->audio->eof; + if(sh_video) eof|=dae_played_eof(xp_core->video); if(!sh_video) { if(mp_conf.benchmark && mp_conf.verbose) show_benchmark_status(); else mpxp_print_audio_status(); - - if(mp_conf.xp >= XP_VAPlay) { usleep(100000); eof = xp_core->audio->eof; } - goto read_input; - } else { - int l_eof; - -/*========================== PLAY VIDEO ============================*/ - if(input_state.need_repaint) goto repaint; - if((sh_video->is_static ||(stream->type&STREAMTYPE_MENU)==STREAMTYPE_MENU) && xp_core->video->num_played_frames) { - /* don't decode if it's picture */ - usleep(0); - } else { + } + usleep(250000); +//read_input: + vo_check_events(vo_data); repaint: - usleep(100000); - l_eof = dae_played_eof(xp_core->video); - //mpxp_play_video(rtc_fd); - eof |= l_eof; - if(eof) goto do_loop; - } - vo_check_events(vo_data); -read_input: #ifdef USE_OSD - if((mpxp_paint_osd(&osd.visible,&in_pause))!=0) goto repaint; + if((mpxp_paint_osd(&osd.visible,&in_pause))!=0) goto repaint; #endif - } /* else if(!sh_video) */ //================= Keyboard events, SEEKing ==================== @@ -2064,7 +2050,6 @@ seek_args.secs += d; mp_conf.seek_to_sec = NULL; } -do_loop: /* Looping. */ if(eof && mp_conf.loop_times>=0) { MSG_V("loop_times = %d, eof = %d\n", mp_conf.loop_times,eof); Modified: mplayerxp/xmpcore/xmp_aplayer.c =================================================================== --- mplayerxp/xmpcore/xmp_aplayer.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/xmpcore/xmp_aplayer.c 2012-11-03 11:36:13 UTC (rev 287) @@ -26,7 +26,7 @@ extern ao_data_t*ao_data; -static int decore_audio(demux_stream_t *d_audio,sh_audio_t* sh_audio,sh_video_t*sh_video,unsigned _xp_id ) +static int decore_audio(demux_stream_t *d_audio,sh_audio_t* sh_audio,sh_video_t*sh_video) { int eof = 0; /*========================== PLAY AUDIO ============================*/ @@ -54,11 +54,10 @@ MP_UNIT("mpca_decode"); // Enter AUDIO decoder module t=GetTimer(); while(sh_audio->a_buffer_len<playsize && !xp_core->audio->eof){ - if(mp_conf.xp>=XP_VideoAudio) { + if(!xmp_test_model(XMP_Run_AudioPlayback)) { ret=read_audio_buffer(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); - } else - { + } else { ret=mpca_decode(sh_audio,&sh_audio->a_buffer[sh_audio->a_buffer_len], playsize-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,sh_audio->a_buffer_size-sh_audio->a_buffer_len,&pts); } @@ -81,14 +80,14 @@ } if(playsize>sh_audio->a_buffer_len) playsize=sh_audio->a_buffer_len; - if(mp_conf.xp>=XP_VAPlay) dec_ahead_audio_delay=ao_get_delay(ao_data); + if(xmp_test_model(XMP_Run_AudioPlayer)) dec_ahead_audio_delay=ao_get_delay(ao_data); playsize=ao_play(ao_data,sh_audio->a_buffer,playsize,0); if(playsize>0){ sh_audio->a_buffer_len-=playsize; memcpy(sh_audio->a_buffer,&sh_audio->a_buffer[playsize],sh_audio->a_buffer_len); - if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) + if(!mp_conf.av_sync_pts && xmp_test_model(XMP_Run_AudioPlayer)) pthread_mutex_lock(&audio_timer_mutex); if(mp_data->use_pts_fix2) { if(sh_audio->a_pts != HUGE) { @@ -116,7 +115,7 @@ sh_audio->timer=pts+(ret-sh_audio->a_buffer_len)/(float)(sh_audio->af_bps); else sh_audio->timer+=playsize/(float)(sh_audio->af_bps); - if(!mp_conf.av_sync_pts && mp_conf.xp>=XP_VAPlay) + if(!mp_conf.av_sync_pts && xmp_test_model(XMP_Run_AudioPlayer)) pthread_mutex_unlock(&audio_timer_mutex); } @@ -161,6 +160,8 @@ priv->pid = getpid(); __MP_UNIT(priv->p_idx,"audio_play_routine"); priv->state=Pth_Run; + if(xmp_test_model(XMP_Run_AudioPlayback)) + priv->name = "audio decoder+player"; dec_ahead_can_aseek=0; while(priv->state!=Pth_Canceling) { @@ -171,7 +172,7 @@ } __MP_UNIT(priv->p_idx,"audio decore_audio"); dec_ahead_audio_delay = NOTHING_PLAYED; - eof = decore_audio(d_audio,sh_audio,sh_video,priv->p_idx); + eof = decore_audio(d_audio,sh_audio,sh_video); if(priv->state==Pth_Canceling) break; Modified: mplayerxp/xmpcore/xmp_core.c =================================================================== --- mplayerxp/xmpcore/xmp_core.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/xmpcore/xmp_core.c 2012-11-03 11:36:13 UTC (rev 287) @@ -209,24 +209,53 @@ /* Min audio buffer to keep mp_free, used to tell differ between full and empty buffer */ #define MIN_BUFFER_RESERV 8 +static unsigned xmp_engine_compute_model(sh_video_t *shv, sh_audio_t *sha) { + unsigned rc; + rc=0; + if(!shv && sha) { + switch(mp_conf.xp) { + case XP_UniCore: rc=XMP_Run_AudioPlayback; break; + default: rc=XMP_Run_AudioPlayer|XMP_Run_AudioDecoder; break; + } + } else if(shv && !sha) { + switch(mp_conf.xp) { + default: + case XP_UniCore: rc=XMP_Run_VideoPlayer|XMP_Run_VideoDecoder; break; + } + } else { /* both shv and sha */ + switch(mp_conf.xp) { + case XP_UniCore: + rc=XMP_Run_VideoPlayer|XMP_Run_VA_Decoder|XMP_Run_AudioPlayer; break; + case XP_DualCore: + rc=XMP_Run_VideoPlayer|XMP_Run_VideoDecoder|XMP_Run_AudioPlayback; break; + default: /* TripleCore */ + rc=XMP_Run_VideoPlayer|XMP_Run_VideoDecoder|XMP_Run_AudioPlayer|XMP_Run_AudioDecoder; break; + } + } + return rc; +} + int xmp_init_engine(sh_video_t *shv, sh_audio_t *sha) { + xp_core->flags=xmp_engine_compute_model(shv,sha); if(shv) { xp_core->video=mp_mallocz(sizeof(dec_ahead_engine_t)); dae_init(xp_core->video,xp_core->num_v_buffs,shv); } - if(mp_conf.xp>=XP_VideoAudio && sha) { - int asize; - unsigned o_bps; - unsigned min_reserv; - o_bps=sha->afilter_inited?sha->af_bps:sha->o_bps; - if(xp_core->video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_core->num_v_buffs/shv->fps))+MIN_BUFFER_RESERV; - else asize = o_bps*xp_core->num_a_buffs; - /* FIXME: get better indices from asize/real_audio_packet_size */ - min_reserv = sha->audio_out_minsize; - if (o_bps > sha->o_bps) - min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; - init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); + if(sha) { + if(xmp_test_model(XMP_Run_AudioPlayer)) { + int asize; + unsigned o_bps; + unsigned min_reserv; + o_bps=sha->afilter_inited?sha->af_bps:sha->o_bps; + if(xp_core->video) asize = max(3*sha->audio_out_minsize,max(3*MAX_OUTBURST,o_bps*xp_core->num_v_buffs/shv->fps))+MIN_BUFFER_RESERV; + else asize = o_bps*xp_core->num_a_buffs; + /* FIXME: get better indices from asize/real_audio_packet_size */ + min_reserv = sha->audio_out_minsize; + if (o_bps > sha->o_bps) + min_reserv = (float)min_reserv * (float)o_bps / (float)sha->o_bps; + init_audio_buffer(asize+min_reserv,min_reserv+MIN_BUFFER_RESERV,asize/(sha->audio_out_minsize<10000?sha->audio_out_minsize:4000)+100,sha); + } xp_core->audio=mp_mallocz(sizeof(dec_ahead_engine_t)); dae_init(xp_core->audio,xp_core->num_a_buffs,sha); } @@ -284,12 +313,12 @@ int xmp_run_decoders( void ) { unsigned rc; - if((xp_core->audio && mp_conf.xp >= XP_VAFull) || !xp_core->video) { - if((rc=xmp_register_thread(xp_core->audio,sig_audio_decode,a_dec_ahead_routine,"audio decoder+af"))==UINT_MAX) return rc; + if(xp_core->audio && xmp_test_model(XMP_Run_AudioDecoder)) { + if((rc=xmp_register_thread(xp_core->audio,sig_audio_decode,a_dec_ahead_routine,"audio decoder"))==UINT_MAX) return rc; while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } - if(xp_core->video) { - if((rc=xmp_register_thread(xp_core->video,sig_video_decode,xmp_video_decoder,"video+audio decoders+filters"))==UINT_MAX) return rc; + if(xp_core->video && xmp_test_model(XMP_Run_VideoDecoder|XMP_Run_VA_Decoder)) { + if((rc=xmp_register_thread(xp_core->video,sig_video_decode,xmp_video_decoder,"video+audio decoders"))==UINT_MAX) return rc; while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } return 0; @@ -298,11 +327,11 @@ int xmp_run_players(void) { unsigned rc; - if( xp_core->audio && mp_conf.xp >= XP_VAPlay ) { + if(xp_core->audio && xmp_test_model(XMP_Run_AudioPlayer|XMP_Run_AudioPlayback)) { if((rc=xmp_register_thread(xp_core->audio,sig_audio_play,audio_play_routine,"audio player"))==UINT_MAX) return rc; while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } - if( xp_core->video ) { + if(xp_core->video && xmp_test_model(XMP_Run_VideoPlayer)) { if((rc=xmp_register_thread(xp_core->video,sig_video_play,xmp_video_player,"video player"))==UINT_MAX) return rc; while(xp_core->mpxp_threads[rc]->state!=Pth_Run) usleep(0); } Modified: mplayerxp/xmpcore/xmp_core.h =================================================================== --- mplayerxp/xmpcore/xmp_core.h 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/xmpcore/xmp_core.h 2012-11-03 11:36:13 UTC (rev 287) @@ -15,10 +15,8 @@ #include "libmpdemux/demuxer_r.h" #include "libvo/video_out.h" -//#define ENABLE_DEC_AHEAD_DEBUG 1 +enum xp_modes { XP_NA=0, XP_UniCore, XP_DualCore, XP_TripleCore, XP_MultiCore }; -enum xp_modes { XP_NA=0, XP_Video, XP_VideoAudio, XP_VAPlay, XP_VAFull }; - typedef struct xmp_frame_s { float v_pts; /* presentation time-stamp from input stream @@ -56,6 +54,15 @@ typedef any_t*(*mpxp_routine_t)(any_t*); typedef void (*sig_handler_t)(void); +typedef enum xmp_model { + XMP_Run_AudioPlayer =0x00000001, + XMP_Run_AudioPlayback =0x00000002, /* audio player+decoder together */ + XMP_Run_VideoPlayer =0x00000004, + XMP_Run_VA_Decoder =0x00000008, /* audio+video decoders together */ + XMP_Run_AudioDecoder =0x00000010, + XMP_Run_VideoDecoder =0x00000020 +}xmp_model_e; + typedef struct mpxp_thread_s { unsigned p_idx; const char* name; @@ -76,6 +83,7 @@ }initial_audio_pts_correction_t; typedef struct xp_core_s { + xmp_model_e flags; dec_ahead_engine_t* video; dec_ahead_engine_t* audio; volatile int in_pause; @@ -93,6 +101,8 @@ }xp_core_t; extern xp_core_t *xp_core; +static inline int xmp_test_model(unsigned value) { return (xp_core->flags&value)!=0; } + extern void xmp_init(void); extern void xmp_uninit(void); Modified: mplayerxp/xmpcore/xmp_vdecoder.c =================================================================== --- mplayerxp/xmpcore/xmp_vdecoder.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/xmpcore/xmp_vdecoder.c 2012-11-03 11:36:13 UTC (rev 287) @@ -129,8 +129,8 @@ MSG_T("\nDEC_AHEAD: entering...\n"); __MP_UNIT(priv->p_idx,"dec_ahead"); priv->pid = getpid(); - if(!(xp_core->audio && mp_conf.xp < XP_VAFull)) - priv->name = "video decoder+vf"; + if(!xmp_test_model(XMP_Run_VA_Decoder) && xp_core->audio) + priv->name = "video decoder"; drop_barrier=(float)(xp_core->num_v_buffs/2)*(1/sh_video->fps); if(mp_conf.av_sync_pts == -1 && !mp_data->use_pts_fix2) xp_core->bad_pts = d_video->demuxer->file_format == DEMUXER_TYPE_MPEG_ES || @@ -152,7 +152,6 @@ continue; } __MP_UNIT(priv->p_idx,"dec_ahead 1"); - /* get it! */ #if 0 /* prevent reent access to non-reent demuxer */ @@ -243,7 +242,7 @@ ,dae_curr_vplayed(),dae_curr_vdecoded()); if(priv->state==Pth_Canceling) goto pt_exit; if(priv->state==Pth_Sleep) goto pt_sleep; - if(xp_core->audio && mp_conf.xp<XP_VAFull) { + if(xp_core->audio && xmp_test_model(XMP_Run_VA_Decoder)) { __MP_UNIT(priv->p_idx,"decode audio"); xp_thread_decode_audio(d_audio); __MP_UNIT(priv->p_idx,"dec_ahead 5"); @@ -253,7 +252,7 @@ /*------------------------ frame decoded. --------------------*/ } /* while(!priv->dae->eof)*/ -if(xp_core->audio && mp_conf.xp<XP_VAFull) { +if(xp_core->audio && xmp_test_model(XMP_Run_VA_Decoder)) { while(!xp_core->audio->eof && priv->state!=Pth_Canceling && priv->state!=Pth_Sleep) { __MP_UNIT(priv->p_idx,"decode audio"); if(!xp_thread_decode_audio(d_audio)) usleep(1); Modified: mplayerxp/xmpcore/xmp_vplayer.c =================================================================== --- mplayerxp/xmpcore/xmp_vplayer.c 2012-11-02 17:31:28 UTC (rev 286) +++ mplayerxp/xmpcore/xmp_vplayer.c 2012-11-03 11:36:13 UTC (rev 287) @@ -118,7 +118,7 @@ if(sh_audio && (!xp_core->audio->eof || ao_get_delay(ao_data)) && sleep_time>XP_MAX_TIMESLICE) { float t; - if( mp_conf.xp < XP_VAPlay ) { + if(xmp_test_model(XMP_Run_AudioPlayback)) { t=ao_get_delay(ao_data)-XP_MIN_AUDIOBUFF; if(t>XP_MAX_TIMESLICE) t=XP_MAX_TIMESLICE; @@ -127,7 +127,7 @@ usleep(t*1000000); sleep_time-=GetRelativeTime(); - if(mp_conf.xp >= XP_VAPlay || t<XP_MAX_TIMESLICE || sleep_time>XP_MAX_TIMESLICE) { + if(xmp_test_model(XMP_Run_AudioPlayer) || t<XP_MAX_TIMESLICE || sleep_time>XP_MAX_TIMESLICE) { // exit due no sound in soundcard return 0; } @@ -237,7 +237,7 @@ // unplayed bytes in our and soundcard/dma buffer: float delay=ao_get_delay(ao_data)+(float)sh_audio->a_buffer_len/(float)sh_audio->af_bps; - if(mp_conf.xp>=XP_VideoAudio) + if(xmp_test_model(XMP_Run_AudioPlayer)) delay += get_delay_audio_buffer(); if(pts_from_bps){ @@ -264,10 +264,10 @@ if(x<-max_pts_correction) x=-max_pts_correction; else if(x> max_pts_correction) x= max_pts_correction; max_pts_correction=shva.duration*0.10; // +-10% of time - if(mp_conf.xp>=XP_VAPlay) + if(xmp_test_model(XMP_Run_AudioPlayer)) pthread_mutex_lock(&audio_timer_mutex); sh_audio->timer+=x; - if(mp_conf.xp>=XP_VAPlay) + if(xmp_test_model(XMP_Run_AudioPlayer)) pthread_mutex_unlock(&audio_timer_mutex); if(mp_conf.benchmark && mp_conf.verbose) __show_status_line(a_pts,v_pts,delay,AV_delay); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |