Mercurial > mplayer.hg
comparison libvo/vo_xvmc.c @ 28548:6951e68ddb34
Reflect the change of xvmc struct name.
author | iive |
---|---|
date | Sun, 15 Feb 2009 08:46:18 +0000 |
parents | e887c2dd6c62 |
children | 0c93265eb728 |
comparison
equal
deleted
inserted
replaced
28547:251985a9ad7e | 28548:6951e68ddb34 |
---|---|
99 static XvMCMacroBlockArray mv_blocks; | 99 static XvMCMacroBlockArray mv_blocks; |
100 | 100 |
101 #define MAX_SURFACES 8 | 101 #define MAX_SURFACES 8 |
102 static int number_of_surfaces=0; | 102 static int number_of_surfaces=0; |
103 static XvMCSurface surface_array[MAX_SURFACES]; | 103 static XvMCSurface surface_array[MAX_SURFACES]; |
104 static struct xvmc_render_state * surface_render; | 104 static struct xvmc_pixfmt_render * surface_render; |
105 | 105 |
106 static struct xvmc_render_state * p_render_surface_to_show=NULL; | 106 static struct xvmc_pixfmt_render * p_render_surface_to_show=NULL; |
107 static struct xvmc_render_state * p_render_surface_visible=NULL; | 107 static struct xvmc_pixfmt_render * p_render_surface_visible=NULL; |
108 | 108 |
109 //display queue, kinda render ahead | 109 //display queue, kinda render ahead |
110 static struct xvmc_render_state * show_queue[MAX_SURFACES]; | 110 static struct xvmc_pixfmt_render * show_queue[MAX_SURFACES]; |
111 static int free_element; | 111 static int free_element; |
112 | 112 |
113 | 113 |
114 static void (*draw_osd_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); | 114 static void (*draw_osd_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); |
115 static void (*clear_osd_fnc)(int x0,int y0, int w,int h); | 115 static void (*clear_osd_fnc)(int x0,int y0, int w,int h); |
133 }; | 133 }; |
134 | 134 |
135 static void xvmc_free(void); | 135 static void xvmc_free(void); |
136 static void xvmc_clean_surfaces(void); | 136 static void xvmc_clean_surfaces(void); |
137 static int count_free_surfaces(void); | 137 static int count_free_surfaces(void); |
138 static struct xvmc_render_state * find_free_surface(void); | 138 static struct xvmc_pixfmt_render * find_free_surface(void); |
139 | 139 |
140 static const vo_info_t info = { | 140 static const vo_info_t info = { |
141 "XVideo Motion Compensation", | 141 "XVideo Motion Compensation", |
142 "xvmc", | 142 "xvmc", |
143 "Ivan Kalvachev <iive@users.sf.net>", | 143 "Ivan Kalvachev <iive@users.sf.net>", |
361 mc_surf_list[s].surface_type_id,p,i); | 361 mc_surf_list[s].surface_type_id,p,i); |
362 return mc_surf_list[s].surface_type_id; | 362 return mc_surf_list[s].surface_type_id; |
363 } | 363 } |
364 | 364 |
365 static uint32_t xvmc_draw_image(mp_image_t *mpi){ | 365 static uint32_t xvmc_draw_image(mp_image_t *mpi){ |
366 struct xvmc_render_state * rndr; | 366 struct xvmc_pixfmt_render * rndr; |
367 | 367 |
368 assert(mpi!=NULL); | 368 assert(mpi!=NULL); |
369 assert(mpi->flags &MP_IMGFLAG_DIRECT); | 369 assert(mpi->flags &MP_IMGFLAG_DIRECT); |
370 // assert(mpi->flags &MP_IMGFLAGS_DRAWBACK); | 370 // assert(mpi->flags &MP_IMGFLAGS_DRAWBACK); |
371 | 371 |
372 rndr = (struct xvmc_render_state*)mpi->priv;//there is copy in plane[2] | 372 rndr = (struct xvmc_pixfmt_render*)mpi->priv;//there is copy in plane[2] |
373 assert( rndr != NULL ); | 373 assert( rndr != NULL ); |
374 assert( rndr->magic_id == AV_XVMC_RENDER_MAGIC ); | 374 assert( rndr->magic_id == AV_XVMC_RENDER_MAGIC ); |
375 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) | 375 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
376 printf("vo_xvmc: draw_image(show rndr=%p)\n",rndr); | 376 printf("vo_xvmc: draw_image(show rndr=%p)\n",rndr); |
377 // the surface have passed vf system without been skiped, it will be displayed | 377 // the surface have passed vf system without been skiped, it will be displayed |
519 return -1; | 519 return -1; |
520 } | 520 } |
521 printf("vo_xvmc: mv_blocks allocated\n"); | 521 printf("vo_xvmc: mv_blocks allocated\n"); |
522 | 522 |
523 if(surface_render==NULL) | 523 if(surface_render==NULL) |
524 surface_render=malloc(MAX_SURFACES*sizeof(struct xvmc_render_state));//easy mem debug | 524 surface_render=malloc(MAX_SURFACES*sizeof(struct xvmc_pixfmt_render));//easy mem debug |
525 memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_render_state)); | 525 memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_pixfmt_render)); |
526 | 526 |
527 for(i=0; i<MAX_SURFACES; i++){ | 527 for(i=0; i<MAX_SURFACES; i++){ |
528 rez=XvMCCreateSurface(mDisplay,&ctx,&surface_array[i]); | 528 rez=XvMCCreateSurface(mDisplay,&ctx,&surface_array[i]); |
529 if( rez != Success ) | 529 if( rez != Success ) |
530 break; | 530 break; |
841 assert(0); | 841 assert(0); |
842 } | 842 } |
843 } | 843 } |
844 | 844 |
845 static void draw_osd(void){ | 845 static void draw_osd(void){ |
846 struct xvmc_render_state * osd_rndr; | 846 struct xvmc_pixfmt_render * osd_rndr; |
847 int osd_has_changed; | 847 int osd_has_changed; |
848 int have_osd_to_draw; | 848 int have_osd_to_draw; |
849 int rez; | 849 int rez; |
850 | 850 |
851 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) | 851 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
935 } | 935 } |
936 | 936 |
937 XvMCSyncSurface(mDisplay, srf); | 937 XvMCSyncSurface(mDisplay, srf); |
938 } | 938 } |
939 | 939 |
940 static void put_xvmc_image(struct xvmc_render_state * p_render_surface, | 940 static void put_xvmc_image(struct xvmc_pixfmt_render * p_render_surface, |
941 int draw_ck){ | 941 int draw_ck){ |
942 int rez; | 942 int rez; |
943 struct vo_rect src_rect, dst_rect; | 943 struct vo_rect src_rect, dst_rect; |
944 int i; | 944 int i; |
945 | 945 |
1056 (p_render_surface_visible != &surface_render[i]) ) | 1056 (p_render_surface_visible != &surface_render[i]) ) |
1057 printf("vo_xvmc::uninit surface_render[%d].status=%d\n",i, | 1057 printf("vo_xvmc::uninit surface_render[%d].status=%d\n",i, |
1058 surface_render[i].state); | 1058 surface_render[i].state); |
1059 } | 1059 } |
1060 | 1060 |
1061 memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_render_state));//for debuging | 1061 memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_pixfmt_render));//for debuging |
1062 free(surface_render);surface_render=NULL; | 1062 free(surface_render);surface_render=NULL; |
1063 | 1063 |
1064 XvMCDestroyContext(mDisplay,&ctx); | 1064 XvMCDestroyContext(mDisplay,&ctx); |
1065 number_of_surfaces = 0; | 1065 number_of_surfaces = 0; |
1066 | 1066 |
1112 } | 1112 } |
1113 | 1113 |
1114 | 1114 |
1115 static int draw_slice(uint8_t *image[], int stride[], | 1115 static int draw_slice(uint8_t *image[], int stride[], |
1116 int w, int h, int x, int y){ | 1116 int w, int h, int x, int y){ |
1117 struct xvmc_render_state * rndr; | 1117 struct xvmc_pixfmt_render * rndr; |
1118 int rez; | 1118 int rez; |
1119 | 1119 |
1120 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) | 1120 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
1121 printf("vo_xvmc: draw_slice y=%d\n",y); | 1121 printf("vo_xvmc: draw_slice y=%d\n",y); |
1122 | 1122 |
1123 rndr = (struct xvmc_render_state*)image[2];//this is copy of priv-ate | 1123 rndr = (struct xvmc_pixfmt_render*)image[2];//this is copy of priv-ate |
1124 assert( rndr != NULL ); | 1124 assert( rndr != NULL ); |
1125 assert( rndr->magic_id == AV_XVMC_RENDER_MAGIC ); | 1125 assert( rndr->magic_id == AV_XVMC_RENDER_MAGIC ); |
1126 | 1126 |
1127 rez = XvMCRenderSurface(mDisplay,&ctx,rndr->picture_structure, | 1127 rez = XvMCRenderSurface(mDisplay,&ctx,rndr->picture_structure, |
1128 rndr->p_surface, | 1128 rndr->p_surface, |
1172 return VO_TRUE; | 1172 return VO_TRUE; |
1173 } | 1173 } |
1174 | 1174 |
1175 //XvMCHide hides the surface on next retrace, so | 1175 //XvMCHide hides the surface on next retrace, so |
1176 //check if the surface is not still displaying | 1176 //check if the surface is not still displaying |
1177 static void check_osd_source(struct xvmc_render_state * src_rndr){ | 1177 static void check_osd_source(struct xvmc_pixfmt_render * src_rndr){ |
1178 struct xvmc_render_state * osd_rndr; | 1178 struct xvmc_pixfmt_render * osd_rndr; |
1179 int stat; | 1179 int stat; |
1180 //If this is source surface, check does the OSD rendering is compleate | 1180 //If this is source surface, check does the OSD rendering is compleate |
1181 if(src_rndr->state & AV_XVMC_STATE_OSD_SOURCE){ | 1181 if(src_rndr->state & AV_XVMC_STATE_OSD_SOURCE){ |
1182 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) | 1182 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
1183 printf("vo_xvmc: OSD surface=%p quering\n",src_rndr); | 1183 printf("vo_xvmc: OSD surface=%p quering\n",src_rndr); |
1196 num++; | 1196 num++; |
1197 } | 1197 } |
1198 return num; | 1198 return num; |
1199 } | 1199 } |
1200 | 1200 |
1201 static struct xvmc_render_state * find_free_surface(void) { | 1201 static struct xvmc_pixfmt_render * find_free_surface(void) { |
1202 int i,t; | 1202 int i,t; |
1203 int stat; | 1203 int stat; |
1204 struct xvmc_render_state * visible_rndr; | 1204 struct xvmc_pixfmt_render * visible_rndr; |
1205 | 1205 |
1206 visible_rndr = NULL; | 1206 visible_rndr = NULL; |
1207 for(i=0; i<number_of_surfaces; i++){ | 1207 for(i=0; i<number_of_surfaces; i++){ |
1208 | 1208 |
1209 check_osd_source(&surface_render[i]); | 1209 check_osd_source(&surface_render[i]); |
1249 } | 1249 } |
1250 free_element=0;//clean up the queue | 1250 free_element=0;//clean up the queue |
1251 } | 1251 } |
1252 | 1252 |
1253 static uint32_t get_image(mp_image_t *mpi){ | 1253 static uint32_t get_image(mp_image_t *mpi){ |
1254 struct xvmc_render_state * rndr; | 1254 struct xvmc_pixfmt_render * rndr; |
1255 | 1255 |
1256 rndr = find_free_surface(); | 1256 rndr = find_free_surface(); |
1257 | 1257 |
1258 if(rndr == NULL){ | 1258 if(rndr == NULL){ |
1259 printf("vo_xvmc: get_image failed\n"); | 1259 printf("vo_xvmc: get_image failed\n"); |