Mercurial > mplayer.hg
comparison libmpcodecs/vf_vo.c @ 5507:d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
author | arpi |
---|---|
date | Sat, 06 Apr 2002 22:05:01 +0000 |
parents | |
children | 53ce50ac2ce2 |
comparison
equal
deleted
inserted
replaced
5506:b8b6fcb5062a | 5507:d0d029fda134 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 | |
5 #include "../config.h" | |
6 #include "../mp_msg.h" | |
7 | |
8 #include "../mp_image.h" | |
9 #include "vf.h" | |
10 | |
11 #include "../libvo/video_out.h" | |
12 | |
13 //===========================================================================// | |
14 | |
15 #define video_out ((vo_functions_t*)(vf->priv)) | |
16 | |
17 static int config(struct vf_instance_s* vf, | |
18 int width, int height, int d_width, int d_height, | |
19 unsigned int flags, unsigned int outfmt){ | |
20 if(video_out->config(width,height,d_width,d_height,flags,"MPlayer",outfmt,NULL)) | |
21 return 0; | |
22 return 1; | |
23 } | |
24 | |
25 static int control(struct vf_instance_s* vf, | |
26 int request, void* data){ | |
27 // return video_out->control(request,data); | |
28 return -3; | |
29 } | |
30 | |
31 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | |
32 return video_out->control(VOCTRL_QUERY_FORMAT,&fmt); | |
33 } | |
34 | |
35 static void get_image(struct vf_instance_s* vf, | |
36 mp_image_t *mpi){ | |
37 if(vo_directrendering) | |
38 video_out->control(VOCTRL_GET_IMAGE,mpi); | |
39 } | |
40 | |
41 static void put_image(struct vf_instance_s* vf, | |
42 mp_image_t *mpi){ | |
43 // first check, maybe the vo/vf plugin implements draw_image using mpi: | |
44 if(video_out->control(VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return; // done. | |
45 // nope, fallback to old draw_frame/draw_slice: | |
46 if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))){ | |
47 // blit frame: | |
48 if(mpi->flags&MP_IMGFLAG_PLANAR) | |
49 video_out->draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,mpi->x,mpi->y); | |
50 else | |
51 video_out->draw_frame(mpi->planes); | |
52 } | |
53 } | |
54 | |
55 static void draw_slice(struct vf_instance_s* vf, | |
56 unsigned char* src, int* stride, int w,int h, int x, int y){ | |
57 video_out->draw_slice(src,stride,w,h,x,y); | |
58 } | |
59 | |
60 static void uninit(struct vf_instance_s* vf){ | |
61 // video_out->uninit(); | |
62 } | |
63 | |
64 //===========================================================================// | |
65 | |
66 static int open(vf_instance_t *vf, char* args){ | |
67 vf->config=config; | |
68 vf->control=control; | |
69 vf->query_format=query_format; | |
70 vf->get_image=get_image; | |
71 vf->put_image=put_image; | |
72 vf->draw_slice=draw_slice; | |
73 vf->uninit=uninit; | |
74 vf->priv=(void*)args; // video_out | |
75 if(!video_out) return 0; // no vo ? | |
76 // if(video_out->preinit(args)) return 0; // preinit failed | |
77 return 1; | |
78 } | |
79 | |
80 vf_info_t vf_info_vo = { | |
81 "libvo wrapper", | |
82 "vo", | |
83 "A'rpi", | |
84 "for internal use", | |
85 open | |
86 }; | |
87 | |
88 //===========================================================================// |