Mercurial > mplayer.hg
annotate libmpcodecs/vf_vo.c @ 31927:6e0b5a97e00f
EOSD/ASS code factorization
Move some code that was partially duplicated between vf_vo and vf_ass with
subtle differences into a separate file.
author | cigaes |
---|---|
date | Mon, 23 Aug 2010 19:13:05 +0000 |
parents | 55dacfca4a43 |
children | 10327ff5eb4a |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
30065
diff
changeset
|
18 |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
19 #include <stdio.h> |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
20 #include <stdlib.h> |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
21 #include <string.h> |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
22 |
17012 | 23 #include "config.h" |
24 #include "mp_msg.h" | |
31489 | 25 #include "mpcommon.h" |
5607 | 26 #include "mp_image.h" |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
27 #include "vf.h" |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
28 |
31488
4b738166e825
Add libvo/sub.h #include instead of declaring sub_visibility extern.
diego
parents:
31238
diff
changeset
|
29 #include "libvo/sub.h" |
17012 | 30 #include "libvo/video_out.h" |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
31 |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26754
diff
changeset
|
32 #ifdef CONFIG_ASS |
19576 | 33 #include "libass/ass_mp.h" |
34 #endif | |
35 | |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
36 //===========================================================================// |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
37 |
20906 | 38 struct vf_priv_s { |
19576 | 39 double pts; |
25219
e82ecde2cbd4
Mark several uses of vo_functions_t as const to stop some of the current
reimar
parents:
23134
diff
changeset
|
40 const vo_functions_t *vo; |
19576 | 41 }; |
20906 | 42 #define video_out (vf->priv->vo) |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
43 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
44 static int query_format(struct vf_instance *vf, unsigned int fmt); /* forward declaration */ |
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
45 static void draw_slice(struct vf_instance *vf, unsigned char** src, int* stride, int w,int h, int x, int y); |
7731 | 46 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
47 static int config(struct vf_instance *vf, |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
48 int width, int height, int d_width, int d_height, |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
49 unsigned int flags, unsigned int outfmt){ |
5559 | 50 |
6197 | 51 if ((width <= 0) || (height <= 0) || (d_width <= 0) || (d_height <= 0)) |
52 { | |
53 mp_msg(MSGT_CPLAYER, MSGL_ERR, "VO: invalid dimensions!\n"); | |
54 return 0; | |
55 } | |
56 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7731
diff
changeset
|
57 if(video_out->info) |
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7731
diff
changeset
|
58 { const vo_info_t *info = video_out->info; |
5559 | 59 mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name, |
60 width, height, | |
61 d_width, d_height, | |
62 vo_format_name(outfmt), | |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
10052
diff
changeset
|
63 (flags&VOFLAG_FULLSCREEN)?" [fs]":"", |
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
10052
diff
changeset
|
64 (flags&VOFLAG_MODESWITCHING)?" [vm]":"", |
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
10052
diff
changeset
|
65 (flags&VOFLAG_SWSCALE)?" [zoom]":"", |
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
10052
diff
changeset
|
66 (flags&VOFLAG_FLIPPING)?" [flip]":""); |
5559 | 67 mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Description: %s\n",info->name); |
68 mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Author: %s\n", info->author); | |
69 if(info->comment && strlen(info->comment) > 0) | |
70 mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Comment: %s\n", info->comment); | |
71 } | |
72 | |
7687 | 73 // save vo's stride capability for the wanted colorspace: |
23134
1de2a46a0987
Add -ass-hinting option for setting font hinting method.
eugeni
parents:
22232
diff
changeset
|
74 vf->default_caps=query_format(vf,outfmt); |
28611
00c0123b6df3
Add VOCAP_NOSLICES and use it to allow vo_vdpau to not support slices for
reimar
parents:
28546
diff
changeset
|
75 vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice; |
7687 | 76 |
22232 | 77 if(config_video_out(video_out,width,height,d_width,d_height,flags,"MPlayer",outfmt)) |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
78 return 0; |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7731
diff
changeset
|
79 |
5511 | 80 ++vo_config_count; |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
81 return 1; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
82 } |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
83 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
84 static int control(struct vf_instance *vf, int request, void* data) |
6780 | 85 { |
5643 | 86 switch(request){ |
20973
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
87 case VFCTRL_GET_DEINTERLACE: |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
88 { |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
89 if(!video_out) return CONTROL_FALSE; // vo not configured? |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
90 return(video_out->control(VOCTRL_GET_DEINTERLACE, data) |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
91 == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE; |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
92 } |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
93 case VFCTRL_SET_DEINTERLACE: |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
94 { |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
95 if(!video_out) return CONTROL_FALSE; // vo not configured? |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
96 return(video_out->control(VOCTRL_SET_DEINTERLACE, data) |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
97 == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE; |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20906
diff
changeset
|
98 } |
5643 | 99 case VFCTRL_DRAW_OSD: |
6157 | 100 if(!vo_config_count) return CONTROL_FALSE; // vo not configured? |
5643 | 101 video_out->draw_osd(); |
102 return CONTROL_TRUE; | |
10052
b358b7509e1a
sort of a hack, but at least this lets the framerate-increasing
rfelker
parents:
9593
diff
changeset
|
103 case VFCTRL_FLIP_PAGE: |
b358b7509e1a
sort of a hack, but at least this lets the framerate-increasing
rfelker
parents:
9593
diff
changeset
|
104 { |
b358b7509e1a
sort of a hack, but at least this lets the framerate-increasing
rfelker
parents:
9593
diff
changeset
|
105 if(!vo_config_count) return CONTROL_FALSE; // vo not configured? |
b358b7509e1a
sort of a hack, but at least this lets the framerate-increasing
rfelker
parents:
9593
diff
changeset
|
106 video_out->flip_page(); |
b358b7509e1a
sort of a hack, but at least this lets the framerate-increasing
rfelker
parents:
9593
diff
changeset
|
107 return CONTROL_TRUE; |
b358b7509e1a
sort of a hack, but at least this lets the framerate-increasing
rfelker
parents:
9593
diff
changeset
|
108 } |
6780 | 109 case VFCTRL_SET_EQUALIZER: |
110 { | |
6832
54578e5a8050
... removed from vf's control(), sing struct for equalizer. based on patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
arpi
parents:
6786
diff
changeset
|
111 vf_equalizer_t *eq=data; |
6780 | 112 if(!vo_config_count) return CONTROL_FALSE; // vo not configured? |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
25813
diff
changeset
|
113 return (video_out->control(VOCTRL_SET_EQUALIZER, eq->item, eq->value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE; |
6780 | 114 } |
115 case VFCTRL_GET_EQUALIZER: | |
116 { | |
6832
54578e5a8050
... removed from vf's control(), sing struct for equalizer. based on patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
arpi
parents:
6786
diff
changeset
|
117 vf_equalizer_t *eq=data; |
6780 | 118 if(!vo_config_count) return CONTROL_FALSE; // vo not configured? |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
25813
diff
changeset
|
119 return (video_out->control(VOCTRL_GET_EQUALIZER, eq->item, &eq->value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE; |
6780 | 120 } |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26754
diff
changeset
|
121 #ifdef CONFIG_ASS |
19576 | 122 case VFCTRL_INIT_EOSD: |
123 { | |
20446
e8adc3778348
Split ass_configure() into several smaller functions.
eugeni
parents:
20197
diff
changeset
|
124 return CONTROL_TRUE; |
19576 | 125 } |
126 case VFCTRL_DRAW_EOSD: | |
127 { | |
31792
55dacfca4a43
Rename libass types to match upstream libass >= 0.9.7
greg
parents:
31688
diff
changeset
|
128 EOSD_ImageList images = {NULL, 2}; |
31927 | 129 mp_eosd_res_t res = {0}; |
20906 | 130 double pts = vf->priv->pts; |
31927 | 131 if (!vo_config_count) return CONTROL_FALSE; |
132 if (video_out->control(VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) | |
133 eosd_configure(&res, !!(vf->default_caps & VFCAP_EOSD_UNSCALED)); | |
134 images.imgs = eosd_render_frame(pts, &images.changed); | |
21506
8174acbf0633
Speed up ASS subtitles display by detecting changes between two consecutive
eugeni
parents:
21427
diff
changeset
|
135 return (video_out->control(VOCTRL_DRAW_EOSD, &images) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE; |
19576 | 136 } |
137 #endif | |
20906 | 138 case VFCTRL_GET_PTS: |
139 { | |
140 *(double *)data = vf->priv->pts; | |
141 return CONTROL_TRUE; | |
142 } | |
5643 | 143 } |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
144 // return video_out->control(request,data); |
5519 | 145 return CONTROL_UNKNOWN; |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
146 } |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
147 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
148 static int query_format(struct vf_instance *vf, unsigned int fmt){ |
5565
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5559
diff
changeset
|
149 int flags=video_out->control(VOCTRL_QUERY_FORMAT,&fmt); |
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5559
diff
changeset
|
150 // draw_slice() accepts stride, draw_frame() doesn't: |
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5559
diff
changeset
|
151 if(flags) |
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5559
diff
changeset
|
152 if(fmt==IMGFMT_YV12 || fmt==IMGFMT_I420 || fmt==IMGFMT_IYUV) |
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5559
diff
changeset
|
153 flags|=VFCAP_ACCEPT_STRIDE; |
0b301fec999a
capabilities support -> automatic insertion of scale, expand, pp
arpi
parents:
5559
diff
changeset
|
154 return flags; |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
155 } |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
156 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
157 static void get_image(struct vf_instance *vf, |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
158 mp_image_t *mpi){ |
28546
e887c2dd6c62
Move direct-rendering hack from vo_xvmc to vf_vo, so it does not need to
reimar
parents:
27341
diff
changeset
|
159 if(!vo_config_count) return; |
e887c2dd6c62
Move direct-rendering hack from vo_xvmc to vf_vo, so it does not need to
reimar
parents:
27341
diff
changeset
|
160 // GET_IMAGE is required for hardware-accelerated formats |
e887c2dd6c62
Move direct-rendering hack from vo_xvmc to vf_vo, so it does not need to
reimar
parents:
27341
diff
changeset
|
161 if(vo_directrendering || |
e887c2dd6c62
Move direct-rendering hack from vo_xvmc to vf_vo, so it does not need to
reimar
parents:
27341
diff
changeset
|
162 IMGFMT_IS_XVMC(mpi->imgfmt) || IMGFMT_IS_VDPAU(mpi->imgfmt)) |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
163 video_out->control(VOCTRL_GET_IMAGE,mpi); |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
164 } |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
165 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
166 static int put_image(struct vf_instance *vf, |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
167 mp_image_t *mpi, double pts){ |
7368 | 168 if(!vo_config_count) return 0; // vo not configured? |
18917
d9a75b26da6c
Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents:
17906
diff
changeset
|
169 // record pts (potentially modified by filters) for main loop |
20906 | 170 vf->priv->pts = pts; |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
171 // first check, maybe the vo/vf plugin implements draw_image using mpi: |
7368 | 172 if(video_out->control(VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return 1; // done. |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
173 // nope, fallback to old draw_frame/draw_slice: |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
174 if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))){ |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
175 // blit frame: |
7687 | 176 // if(mpi->flags&MP_IMGFLAG_PLANAR) |
177 if(vf->default_caps&VFCAP_ACCEPT_STRIDE) | |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
178 video_out->draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,mpi->x,mpi->y); |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
179 else |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
180 video_out->draw_frame(mpi->planes); |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
181 } |
7368 | 182 return 1; |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
183 } |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
184 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
185 static void start_slice(struct vf_instance *vf, |
9560
ae2ce6ebc1fa
Pass start slice to the vo it make dr + slice implemantation easier
albeu
parents:
8148
diff
changeset
|
186 mp_image_t *mpi) { |
ae2ce6ebc1fa
Pass start slice to the vo it make dr + slice implemantation easier
albeu
parents:
8148
diff
changeset
|
187 if(!vo_config_count) return; // vo not configured? |
ae2ce6ebc1fa
Pass start slice to the vo it make dr + slice implemantation easier
albeu
parents:
8148
diff
changeset
|
188 video_out->control(VOCTRL_START_SLICE,mpi); |
ae2ce6ebc1fa
Pass start slice to the vo it make dr + slice implemantation easier
albeu
parents:
8148
diff
changeset
|
189 } |
ae2ce6ebc1fa
Pass start slice to the vo it make dr + slice implemantation easier
albeu
parents:
8148
diff
changeset
|
190 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
191 static void draw_slice(struct vf_instance *vf, |
7220
e3ecccc7e505
warning fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents:
7125
diff
changeset
|
192 unsigned char** src, int* stride, int w,int h, int x, int y){ |
5511 | 193 if(!vo_config_count) return; // vo not configured? |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
194 video_out->draw_slice(src,stride,w,h,x,y); |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
195 } |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
196 |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30638
diff
changeset
|
197 static void uninit(struct vf_instance *vf) |
19576 | 198 { |
199 free(vf->priv); | |
200 } | |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
201 //===========================================================================// |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
202 |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30488
diff
changeset
|
203 static int vf_open(vf_instance_t *vf, char *args){ |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
204 vf->config=config; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
205 vf->control=control; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
206 vf->query_format=query_format; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
207 vf->get_image=get_image; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
208 vf->put_image=put_image; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
209 vf->draw_slice=draw_slice; |
9560
ae2ce6ebc1fa
Pass start slice to the vo it make dr + slice implemantation easier
albeu
parents:
8148
diff
changeset
|
210 vf->start_slice=start_slice; |
19576 | 211 vf->uninit=uninit; |
212 vf->priv=calloc(1, sizeof(struct vf_priv_s)); | |
25219
e82ecde2cbd4
Mark several uses of vo_functions_t as const to stop some of the current
reimar
parents:
23134
diff
changeset
|
213 vf->priv->vo = (const vo_functions_t *)args; |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
214 if(!video_out) return 0; // no vo ? |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
215 return 1; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
216 } |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
217 |
25221 | 218 const vf_info_t vf_info_vo = { |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
219 "libvo wrapper", |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
220 "vo", |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
221 "A'rpi", |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
222 "for internal use", |
30638
a7b908875c14
Rename open() vf initialization function to vf_open().
diego
parents:
30488
diff
changeset
|
223 vf_open, |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9560
diff
changeset
|
224 NULL |
5507
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
225 }; |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
226 |
d0d029fda134
video filter layer - written from scratch, but inspired a lot by Fredrik Kuivinen's patch
arpi
parents:
diff
changeset
|
227 //===========================================================================// |