Mercurial > mplayer.hg
comparison libvo/vo_vdpau.c @ 32391:b4c3659d16b1
Use a dynamic list for the sources of EOSD elements.
author | cigaes |
---|---|
date | Sun, 10 Oct 2010 09:27:11 +0000 |
parents | ef21cbba62ee |
children | d80bbc5868de |
comparison
equal
deleted
inserted
replaced
32390:b33aed46ecda | 32391:b4c3659d16b1 |
---|---|
41 #include "video_out_internal.h" | 41 #include "video_out_internal.h" |
42 #include "x11_common.h" | 42 #include "x11_common.h" |
43 #include "aspect.h" | 43 #include "aspect.h" |
44 #include "font_load.h" | 44 #include "font_load.h" |
45 #include "sub.h" | 45 #include "sub.h" |
46 #include "eosd.h" | |
46 #include "subopt-helper.h" | 47 #include "subopt-helper.h" |
47 | 48 |
48 #include "libavcodec/vdpau.h" | 49 #include "libavcodec/vdpau.h" |
49 | 50 |
50 #include "libavutil/common.h" | 51 #include "libavutil/common.h" |
852 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); | 853 VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); |
853 CHECK_ST_WARNING("EOSD: Error when rendering") | 854 CHECK_ST_WARNING("EOSD: Error when rendering") |
854 } | 855 } |
855 } | 856 } |
856 | 857 |
857 static void generate_eosd(EOSD_ImageList *imgs) | 858 static void generate_eosd(struct mp_eosd_image_list *imgs) |
858 { | 859 { |
859 VdpStatus vdp_st; | 860 VdpStatus vdp_st; |
860 VdpRect destRect; | 861 VdpRect destRect; |
861 int j, found; | 862 int j, found; |
862 ASS_Image *img = imgs->imgs; | 863 struct mp_eosd_image *img = eosd_image_first(imgs); |
863 ASS_Image *i; | 864 struct mp_eosd_image *i; |
864 | 865 |
865 // Nothing changed, no need to redraw | 866 // Nothing changed, no need to redraw |
866 if (imgs->changed == 0) | 867 if (imgs->changed == 0) |
867 return; | 868 return; |
868 eosd_render_count = 0; | 869 eosd_render_count = 0; |
874 goto eosd_skip_upload; | 875 goto eosd_skip_upload; |
875 | 876 |
876 for (j = 0; j < eosd_surface_count; j++) | 877 for (j = 0; j < eosd_surface_count; j++) |
877 eosd_surfaces[j].in_use = 0; | 878 eosd_surfaces[j].in_use = 0; |
878 | 879 |
879 for (i = img; i; i = i->next) { | 880 for (i = img; i; i = eosd_image_next(imgs)) { |
880 // Try to reuse a suitable surface | 881 // Try to reuse a suitable surface |
881 found = -1; | 882 found = -1; |
882 for (j = 0; j < eosd_surface_count; j++) { | 883 for (j = 0; j < eosd_surface_count; j++) { |
883 if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE && !eosd_surfaces[j].in_use && | 884 if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE && !eosd_surfaces[j].in_use && |
884 eosd_surfaces[j].w >= i->w && eosd_surfaces[j].h >= i->h) { | 885 eosd_surfaces[j].w >= i->w && eosd_surfaces[j].h >= i->h) { |
925 eosd_render_count++; | 926 eosd_render_count++; |
926 } | 927 } |
927 | 928 |
928 eosd_skip_upload: | 929 eosd_skip_upload: |
929 eosd_render_count = 0; | 930 eosd_render_count = 0; |
930 for (i = img; i; i = i->next) { | 931 for (i = eosd_image_first(imgs); i; i = eosd_image_next(imgs)) { |
931 // Render dest, color, etc. | 932 // Render dest, color, etc. |
932 eosd_targets[eosd_render_count].color.alpha = 1.0 - ((i->color >> 0) & 0xff) / 255.0; | 933 eosd_targets[eosd_render_count].color.alpha = 1.0 - ((i->color >> 0) & 0xff) / 255.0; |
933 eosd_targets[eosd_render_count].color.blue = ((i->color >> 8) & 0xff) / 255.0; | 934 eosd_targets[eosd_render_count].color.blue = ((i->color >> 8) & 0xff) / 255.0; |
934 eosd_targets[eosd_render_count].color.green = ((i->color >> 16) & 0xff) / 255.0; | 935 eosd_targets[eosd_render_count].color.green = ((i->color >> 16) & 0xff) / 255.0; |
935 eosd_targets[eosd_render_count].color.red = ((i->color >> 24) & 0xff) / 255.0; | 936 eosd_targets[eosd_render_count].color.red = ((i->color >> 24) & 0xff) / 255.0; |
1398 return VO_FALSE; | 1399 return VO_FALSE; |
1399 generate_eosd(data); | 1400 generate_eosd(data); |
1400 draw_eosd(); | 1401 draw_eosd(); |
1401 return VO_TRUE; | 1402 return VO_TRUE; |
1402 case VOCTRL_GET_EOSD_RES: { | 1403 case VOCTRL_GET_EOSD_RES: { |
1403 mp_eosd_res_t *r = data; | 1404 struct mp_eosd_settings *r = data; |
1404 r->mt = r->mb = r->ml = r->mr = 0; | 1405 r->mt = r->mb = r->ml = r->mr = 0; |
1405 r->srcw = vid_width; r->srch = vid_height; | 1406 r->srcw = vid_width; r->srch = vid_height; |
1406 if (vo_fs) { | 1407 if (vo_fs) { |
1407 r->w = vo_screenwidth; | 1408 r->w = vo_screenwidth; |
1408 r->h = vo_screenheight; | 1409 r->h = vo_screenheight; |