spudec.c: Avoid useless malloc/frees
[mplayer/glamo.git] / libvo / old_vo_wrapper.c
blobbdbc8b83495ca2926389f325fef9fa4aa7c6d33e
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include <stdint.h>
21 #include "old_vo_wrapper.h"
22 #include "video_out.h"
23 #include "sub.h"
25 struct vo *global_vo;
26 struct osd_state *global_osd;
28 int old_vo_preinit(struct vo *vo, const char *arg)
30 global_vo = vo;
31 return vo->driver->old_functions->preinit(arg);
35 int old_vo_config(struct vo *vo, uint32_t width, uint32_t height,
36 uint32_t d_width, uint32_t d_height,
37 uint32_t flags, char *title, uint32_t format)
39 return vo->driver->old_functions->config(width, height, d_width,
40 d_height, flags, title, format);
44 int old_vo_control(struct vo *vo, uint32_t request, void *data)
46 return vo->driver->old_functions->control(request, data);
50 int old_vo_draw_frame(struct vo *vo, uint8_t *src[])
52 return vo->driver->old_functions->draw_frame(src);
56 int old_vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[],
57 int w, int h, int x, int y)
59 return vo->driver->old_functions->draw_slice(src, stride, w, h, x, y);
63 void old_vo_draw_osd(struct vo *vo, struct osd_state *osd)
65 global_osd = osd;
66 vo->driver->old_functions->draw_osd();
70 void old_vo_flip_page(struct vo *vo)
72 vo->driver->old_functions->flip_page();
76 void old_vo_check_events(struct vo *vo)
78 vo->driver->old_functions->check_events();
82 void old_vo_uninit(struct vo *vo)
84 vo->driver->old_functions->uninit();
88 static void draw_alpha_wrapper(void *ctx, int x0, int y0, int w, int h,
89 unsigned char *src, unsigned char *srca,
90 int stride)
92 void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) = ctx;
93 draw_alpha(x0, y0, w, h, src, srca, stride);
97 void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride))
99 osd_draw_text(global_osd, dxs, dys, draw_alpha_wrapper, draw_alpha);
102 void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border,
103 int right_border, int bottom_border, int orig_w, int orig_h,
104 void (*draw_alpha)(int x0, int y0, int w,int h,
105 unsigned char* src,
106 unsigned char *srca, int stride))
108 osd_draw_text_ext(global_osd, dxs, dys, left_border, top_border,
109 right_border, bottom_border, orig_w, orig_h,
110 draw_alpha_wrapper, draw_alpha);
113 int vo_update_osd(int dxs, int dys)
115 return osd_update(global_osd, dxs, dys);