[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[181] mplayerxp
Brought to you by:
olov
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. |