annotate libmpcodecs/vf_delogo.c @ 33459:cb7fa62d2fdf

Add Italian Comment entry to desktop file. Translation by Giorgio Vazzana, mywing81 gmail com.
author ib
date Fri, 03 Jun 2011 14:15:25 +0000
parents f055dbc340f6
children 0543235d2e21
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
1 /*
26727
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
2 * Copyright (C) 2002 Jindrich Makovicka <makovick@gmail.com>
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
3 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
4 * This file is part of MPlayer.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
5 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
7 * it under the terms of the GNU General Public License as published by
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
9 * (at your option) any later version.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
10 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
14 * GNU General Public License for more details.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
15 *
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
16 * You should have received a copy of the GNU General Public License along
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
82601a38e2a7 Use standard license headers.
diego
parents: 25221
diff changeset
19 */
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
20
304c94c89359 simple logo remover
henry
parents:
diff changeset
21 /* A very simple tv station logo remover */
304c94c89359 simple logo remover
henry
parents:
diff changeset
22
304c94c89359 simple logo remover
henry
parents:
diff changeset
23 #include <stdio.h>
304c94c89359 simple logo remover
henry
parents:
diff changeset
24 #include <stdlib.h>
304c94c89359 simple logo remover
henry
parents:
diff changeset
25 #include <string.h>
304c94c89359 simple logo remover
henry
parents:
diff changeset
26 #include <inttypes.h>
33400
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
27 #include <limits.h>
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
28 #include <errno.h>
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
29 #include <math.h>
304c94c89359 simple logo remover
henry
parents:
diff changeset
30
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 11029
diff changeset
31 #include "mp_msg.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 11029
diff changeset
32 #include "cpudetect.h"
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
33 #include "img_format.h"
304c94c89359 simple logo remover
henry
parents:
diff changeset
34 #include "mp_image.h"
304c94c89359 simple logo remover
henry
parents:
diff changeset
35 #include "vf.h"
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 11029
diff changeset
36 #include "libvo/fastmemcpy.h"
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
37
10816
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
38 #include "m_option.h"
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
39 #include "m_struct.h"
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
40
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
41 //===========================================================================//
304c94c89359 simple logo remover
henry
parents:
diff changeset
42
10816
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
43 static struct vf_priv_s {
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
44 unsigned int outfmt;
304c94c89359 simple logo remover
henry
parents:
diff changeset
45 int xoff, yoff, lw, lh, band, show;
33400
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
46 const char *file;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
47 struct timed_rectangle {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
48 int ts, x, y, w, h, b;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
49 } *timed_rect;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
50 int n_timed_rect;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
51 int cur_timed_rect;
22027
0b262e00bc99 Mark m_struct_t defaults as const
reimar
parents: 20646
diff changeset
52 } const vf_priv_dflt = {
10816
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
53 0,
33400
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
54 0, 0, 0, 0, 0, 0,
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
55 NULL, NULL, 0, 0,
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
56 };
304c94c89359 simple logo remover
henry
parents:
diff changeset
57
304c94c89359 simple logo remover
henry
parents:
diff changeset
58 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
304c94c89359 simple logo remover
henry
parents:
diff changeset
59 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
304c94c89359 simple logo remover
henry
parents:
diff changeset
60
33400
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
61 /**
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
62 * Adjust the coordinates to suit the band width
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
63 * Also print a notice in verbose mode
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
64 */
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
65 static void fix_band(struct vf_priv_s *p)
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
66 {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
67 p->show = 0;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
68 if (p->band < 0) {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
69 p->band = 4;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
70 p->show = 1;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
71 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
72 p->lw += p->band*2;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
73 p->lh += p->band*2;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
74 p->xoff -= p->band;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
75 p->yoff -= p->band;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
76 mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d x %d, %d x %d, band = %d\n",
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
77 p->xoff, p->yoff, p->lw, p->lh, p->band);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
78 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
79
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
80 static void update_sub(struct vf_priv_s *p, double pts)
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
81 {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
82 int ipts = pts * 1000;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
83 int tr = p->cur_timed_rect;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
84 while (tr < p->n_timed_rect - 1 && ipts >= p->timed_rect[tr + 1].ts)
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
85 tr++;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
86 while (tr >= 0 && ipts < p->timed_rect[tr].ts)
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
87 tr--;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
88 if (tr == p->cur_timed_rect)
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
89 return;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
90 p->cur_timed_rect = tr;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
91 if (tr >= 0) {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
92 p->xoff = p->timed_rect[tr].x;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
93 p->yoff = p->timed_rect[tr].y;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
94 p->lw = p->timed_rect[tr].w;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
95 p->lh = p->timed_rect[tr].h;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
96 p->band = p->timed_rect[tr].b;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
97 } else {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
98 p->xoff = p->yoff = p->lw = p->lh = p->band = 0;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
99 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
100 fix_band(p);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
101 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
102
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
103 static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int width, int height,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
104 int logo_x, int logo_y, int logo_w, int logo_h, int band, int show, int direct) {
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
105 int y, x;
304c94c89359 simple logo remover
henry
parents:
diff changeset
106 int interp, dist;
304c94c89359 simple logo remover
henry
parents:
diff changeset
107 uint8_t *xdst, *xsrc;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
108
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
109 uint8_t *topleft, *botleft, *topright;
304c94c89359 simple logo remover
henry
parents:
diff changeset
110 int xclipl, xclipr, yclipt, yclipb;
10811
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
111 int logo_x1, logo_x2, logo_y1, logo_y2;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
112
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
113 xclipl = MAX(-logo_x, 0);
304c94c89359 simple logo remover
henry
parents:
diff changeset
114 xclipr = MAX(logo_x+logo_w-width, 0);
304c94c89359 simple logo remover
henry
parents:
diff changeset
115 yclipt = MAX(-logo_y, 0);
304c94c89359 simple logo remover
henry
parents:
diff changeset
116 yclipb = MAX(logo_y+logo_h-height, 0);
304c94c89359 simple logo remover
henry
parents:
diff changeset
117
10811
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
118 logo_x1 = logo_x + xclipl;
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
119 logo_x2 = logo_x + logo_w - xclipr;
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
120 logo_y1 = logo_y + yclipt;
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
121 logo_y2 = logo_y + logo_h - yclipb;
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
122
10811
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
123 topleft = src+logo_y1*srcStride+logo_x1;
11029
bdf37ec99325 bug found by Alexander Stege
nexus
parents: 10816
diff changeset
124 topright = src+logo_y1*srcStride+logo_x2-1;
10811
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
125 botleft = src+(logo_y2-1)*srcStride+logo_x1;
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
126
10816
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
127 if (!direct) memcpy_pic(dst, src, width, height, dstStride, srcStride);
10811
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
128
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
129 dst += (logo_y1+1)*dstStride;
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
130 src += (logo_y1+1)*srcStride;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29087
diff changeset
131
10811
a69221e84948 DR, 10l fixes
henry
parents: 10809
diff changeset
132 for(y = logo_y1+1; y < logo_y2-1; y++)
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
133 {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
134 for (x = logo_x1+1, xdst = dst+logo_x1+1, xsrc = src+logo_x1+1; x < logo_x2-1; x++, xdst++, xsrc++) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
135 interp = ((topleft[srcStride*(y-logo_y-yclipt)]
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
136 + topleft[srcStride*(y-logo_y-1-yclipt)]
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
137 + topleft[srcStride*(y-logo_y+1-yclipt)])*(logo_w-(x-logo_x))/logo_w
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
138 + (topright[srcStride*(y-logo_y-yclipt)]
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
139 + topright[srcStride*(y-logo_y-1-yclipt)]
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
140 + topright[srcStride*(y-logo_y+1-yclipt)])*(x-logo_x)/logo_w
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
141 + (topleft[x-logo_x-xclipl]
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
142 + topleft[x-logo_x-1-xclipl]
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
143 + topleft[x-logo_x+1-xclipl])*(logo_h-(y-logo_y))/logo_h
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
144 + (botleft[x-logo_x-xclipl]
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
145 + botleft[x-logo_x-1-xclipl]
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
146 + botleft[x-logo_x+1-xclipl])*(y-logo_y)/logo_h
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
147 )/6;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
148 /* interp = (topleft[srcStride*(y-logo_y)]*(logo_w-(x-logo_x))/logo_w
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
149 + topright[srcStride*(y-logo_y)]*(x-logo_x)/logo_w
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
150 + topleft[x-logo_x]*(logo_h-(y-logo_y))/logo_h
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
151 + botleft[x-logo_x]*(y-logo_y)/logo_h
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
152 )/2;*/
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
153 if (y >= logo_y+band && y < logo_y+logo_h-band && x >= logo_x+band && x < logo_x+logo_w-band) {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
154 *xdst = interp;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
155 } else {
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
156 dist = 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
157 if (x < logo_x+band) dist = MAX(dist, logo_x-x+band);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
158 else if (x >= logo_x+logo_w-band) dist = MAX(dist, x-(logo_x+logo_w-1-band));
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
159 if (y < logo_y+band) dist = MAX(dist, logo_y-y+band);
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
160 else if (y >= logo_y+logo_h-band) dist = MAX(dist, y-(logo_y+logo_h-1-band));
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
161 *xdst = (*xsrc*dist + interp*(band-dist))/band;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
162 if (show && (dist == band-1)) *xdst = 0;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
163 }
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
164 }
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
165
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
166 dst+= dstStride;
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
167 src+= srcStride;
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
168 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
169 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
170
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
171 static int config(struct vf_instance *vf,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
172 int width, int height, int d_width, int d_height,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
173 unsigned int flags, unsigned int outfmt){
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
174
304c94c89359 simple logo remover
henry
parents:
diff changeset
175 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
304c94c89359 simple logo remover
henry
parents:
diff changeset
176 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
177
304c94c89359 simple logo remover
henry
parents:
diff changeset
178
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
179 static void get_image(struct vf_instance *vf, mp_image_t *mpi){
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
180 if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
304c94c89359 simple logo remover
henry
parents:
diff changeset
181 if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ
304c94c89359 simple logo remover
henry
parents:
diff changeset
182 // ok, we can do pp in-place (or pp disabled):
304c94c89359 simple logo remover
henry
parents:
diff changeset
183 vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
184 mpi->type, mpi->flags, mpi->w, mpi->h);
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
185 mpi->planes[0]=vf->dmpi->planes[0];
304c94c89359 simple logo remover
henry
parents:
diff changeset
186 mpi->stride[0]=vf->dmpi->stride[0];
304c94c89359 simple logo remover
henry
parents:
diff changeset
187 mpi->width=vf->dmpi->width;
304c94c89359 simple logo remover
henry
parents:
diff changeset
188 if(mpi->flags&MP_IMGFLAG_PLANAR){
304c94c89359 simple logo remover
henry
parents:
diff changeset
189 mpi->planes[1]=vf->dmpi->planes[1];
304c94c89359 simple logo remover
henry
parents:
diff changeset
190 mpi->planes[2]=vf->dmpi->planes[2];
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
191 mpi->stride[1]=vf->dmpi->stride[1];
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
192 mpi->stride[2]=vf->dmpi->stride[2];
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
193 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
194 mpi->flags|=MP_IMGFLAG_DIRECT;
304c94c89359 simple logo remover
henry
parents:
diff changeset
195 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
196
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
197 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
198 mp_image_t *dmpi;
304c94c89359 simple logo remover
henry
parents:
diff changeset
199
304c94c89359 simple logo remover
henry
parents:
diff changeset
200 if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
201 // no DR, so get a new image! hope we'll get DR buffer:
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
202 vf->dmpi=vf_get_image(vf->next,vf->priv->outfmt,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
203 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
204 mpi->w,mpi->h);
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
205 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
206 dmpi= vf->dmpi;
304c94c89359 simple logo remover
henry
parents:
diff changeset
207
33400
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
208 if (vf->priv->timed_rect)
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
209 update_sub(vf->priv, pts);
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
210 delogo(dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
211 vf->priv->xoff, vf->priv->yoff, vf->priv->lw, vf->priv->lh, vf->priv->band, vf->priv->show,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
212 mpi->flags&MP_IMGFLAG_DIRECT);
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
213 delogo(dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
214 vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
215 mpi->flags&MP_IMGFLAG_DIRECT);
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
216 delogo(dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w/2, mpi->h/2,
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
217 vf->priv->xoff/2, vf->priv->yoff/2, vf->priv->lw/2, vf->priv->lh/2, vf->priv->band/2, vf->priv->show,
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
218 mpi->flags&MP_IMGFLAG_DIRECT);
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
219
304c94c89359 simple logo remover
henry
parents:
diff changeset
220 vf_clone_mpi_attributes(dmpi, mpi);
304c94c89359 simple logo remover
henry
parents:
diff changeset
221
17906
20aca9baf5d8 passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents: 17367
diff changeset
222 return vf_next_put_image(vf,dmpi, pts);
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
223 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
224
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
225 static void uninit(struct vf_instance *vf){
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
226 if(!vf->priv) return;
304c94c89359 simple logo remover
henry
parents:
diff changeset
227
304c94c89359 simple logo remover
henry
parents:
diff changeset
228 free(vf->priv);
304c94c89359 simple logo remover
henry
parents:
diff changeset
229 vf->priv=NULL;
304c94c89359 simple logo remover
henry
parents:
diff changeset
230 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
231
304c94c89359 simple logo remover
henry
parents:
diff changeset
232 //===========================================================================//
304c94c89359 simple logo remover
henry
parents:
diff changeset
233
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
234 static int query_format(struct vf_instance *vf, unsigned int fmt){
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
235 switch(fmt)
304c94c89359 simple logo remover
henry
parents:
diff changeset
236 {
304c94c89359 simple logo remover
henry
parents:
diff changeset
237 case IMGFMT_YV12:
304c94c89359 simple logo remover
henry
parents:
diff changeset
238 case IMGFMT_I420:
304c94c89359 simple logo remover
henry
parents:
diff changeset
239 case IMGFMT_IYUV:
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
240 return vf_next_query_format(vf,vf->priv->outfmt);
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
241 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
242 return 0;
304c94c89359 simple logo remover
henry
parents:
diff changeset
243 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
244
30708
8a96d56b01f0 Mark all fmt_list arrays as const.
diego
parents: 30707
diff changeset
245 static const unsigned int fmt_list[]={
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
246 IMGFMT_YV12,
304c94c89359 simple logo remover
henry
parents:
diff changeset
247 IMGFMT_I420,
304c94c89359 simple logo remover
henry
parents:
diff changeset
248 IMGFMT_IYUV,
304c94c89359 simple logo remover
henry
parents:
diff changeset
249 0
304c94c89359 simple logo remover
henry
parents:
diff changeset
250 };
304c94c89359 simple logo remover
henry
parents:
diff changeset
251
33400
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
252 static int load_timed_rectangles(struct vf_priv_s *delogo)
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
253 {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
254 FILE *f;
33410
f055dbc340f6 LINE_MAX seems to be missing from mingw32.
cigaes
parents: 33400
diff changeset
255 char line[2048];
33400
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
256 int lineno = 0, p;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
257 double ts, last_ts = 0;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
258 struct timed_rectangle *rect = NULL, *nr;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
259 int n_rect = 0, alloc_rect = 0;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
260
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
261 f = fopen(delogo->file, "r");
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
262 if (!f) {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
263 mp_msg(MSGT_VFILTER, MSGL_ERR, "delogo: unable to load %s: %s\n",
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
264 delogo->file, strerror(errno));
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
265 return -1;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
266 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
267 while (fgets(line, sizeof(line), f)) {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
268 lineno++;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
269 if (*line == '#' || *line == '\n')
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
270 continue;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
271 if (n_rect == alloc_rect) {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
272 if (alloc_rect > INT_MAX / 2 / (int)sizeof(*rect)) {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
273 mp_msg(MSGT_VFILTER, MSGL_WARN,
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
274 "delogo: too many rectangles\n");
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
275 goto load_error;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
276 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
277 alloc_rect = alloc_rect ? 2 * alloc_rect : 256;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
278 nr = realloc(rect, alloc_rect * sizeof(*rect));
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
279 if (!nr) {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
280 mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: out of memory\n");
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
281 goto load_error;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
282 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
283 rect = nr;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
284 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
285 nr = rect + n_rect;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
286 memset(nr, 0, sizeof(*nr));
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
287 p = sscanf(line, "%lf %d:%d:%d:%d:%d",
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
288 &ts, &nr->x, &nr->y, &nr->w, &nr->h, &nr->b);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
289 if ((p == 2 && !nr->x) || p == 5 || p == 6) {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
290 if (ts <= last_ts)
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
291 mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: %s:%d: wrong time\n",
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
292 delogo->file, lineno);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
293 nr->ts = 1000 * ts + 0.5;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
294 n_rect++;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
295 } else {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
296 mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: %s:%d: syntax error\n",
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
297 delogo->file, lineno);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
298 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
299 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
300 fclose(f);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
301 if (!n_rect) {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
302 mp_msg(MSGT_VFILTER, MSGL_ERR, "delogo: %s: no rectangles found\n",
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
303 delogo->file);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
304 free(rect);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
305 return -1;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
306 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
307 nr = realloc(rect, n_rect * sizeof(*rect));
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
308 if (nr)
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
309 rect = nr;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
310 delogo->timed_rect = rect;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
311 delogo->n_timed_rect = n_rect;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
312 return 0;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
313
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
314 load_error:
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
315 free(rect);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
316 fclose(f);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
317 return -1;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
318 }
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
319
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 29915
diff changeset
320 static int vf_open(vf_instance_t *vf, char *args){
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
321 vf->config=config;
304c94c89359 simple logo remover
henry
parents:
diff changeset
322 vf->put_image=put_image;
304c94c89359 simple logo remover
henry
parents:
diff changeset
323 vf->get_image=get_image;
304c94c89359 simple logo remover
henry
parents:
diff changeset
324 vf->query_format=query_format;
304c94c89359 simple logo remover
henry
parents:
diff changeset
325 vf->uninit=uninit;
304c94c89359 simple logo remover
henry
parents:
diff changeset
326
33400
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
327 if (vf->priv->file) {
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
328 if (load_timed_rectangles(vf->priv))
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
329 return 0;
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
330 mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d from %s\n",
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
331 vf->priv->n_timed_rect, vf->priv->file);
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
332 vf->priv->cur_timed_rect = -1;
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
333 }
33400
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
334 fix_band(vf->priv);
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
335
304c94c89359 simple logo remover
henry
parents:
diff changeset
336 // check csp:
304c94c89359 simple logo remover
henry
parents:
diff changeset
337 vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12);
304c94c89359 simple logo remover
henry
parents:
diff changeset
338 if(!vf->priv->outfmt)
304c94c89359 simple logo remover
henry
parents:
diff changeset
339 {
32702
7af3e6f901fd Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
cehoyos
parents: 30708
diff changeset
340 uninit(vf);
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
341 return 0; // no csp match :(
304c94c89359 simple logo remover
henry
parents:
diff changeset
342 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
343
304c94c89359 simple logo remover
henry
parents:
diff changeset
344 return 1;
304c94c89359 simple logo remover
henry
parents:
diff changeset
345 }
304c94c89359 simple logo remover
henry
parents:
diff changeset
346
10816
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
347 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
30707
4d15378da04a Mark vf_opts/vf_opts_fields structures as const.
diego
parents: 30642
diff changeset
348 static const m_option_t vf_opts_fields[] = {
10816
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
349 { "x", ST_OFF(xoff), CONF_TYPE_INT, 0, 0, 0, NULL },
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
350 { "y", ST_OFF(yoff), CONF_TYPE_INT, 0, 0, 0, NULL },
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
351 { "w", ST_OFF(lw), CONF_TYPE_INT, 0, 0, 0, NULL },
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
352 { "h", ST_OFF(lh), CONF_TYPE_INT, 0, 0, 0, NULL },
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
353 { "t", ST_OFF(band), CONF_TYPE_INT, 0, 0, 0, NULL },
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
354 { "band", ST_OFF(band), CONF_TYPE_INT, 0, 0, 0, NULL }, // alias
33400
f18abad8054c vf_delogo: allow to change the rectangle based on the time
cigaes
parents: 32702
diff changeset
355 { "file", ST_OFF(file), CONF_TYPE_STRING, 0, 0, 0, NULL },
10816
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
356 { NULL, NULL, 0, 0, 0, 0, NULL }
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
357 };
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
358
30707
4d15378da04a Mark vf_opts/vf_opts_fields structures as const.
diego
parents: 30642
diff changeset
359 static const m_struct_t vf_opts = {
10816
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
360 "delogo",
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
361 sizeof(struct vf_priv_s),
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
362 &vf_priv_dflt,
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
363 vf_opts_fields
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
364 };
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
365
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 22027
diff changeset
366 const vf_info_t vf_info_delogo = {
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
367 "simple logo remover",
304c94c89359 simple logo remover
henry
parents:
diff changeset
368 "delogo",
10816
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
369 "Jindrich Makovicka, Alex Beregszaszi",
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
370 "",
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 29915
diff changeset
371 vf_open,
10816
e9dc9b0b16fa added new config system support and fixed some bugs (altought sanity checks are needed in delogo as it segfaults easily with w/h out of range)
alex
parents: 10811
diff changeset
372 &vf_opts
10809
304c94c89359 simple logo remover
henry
parents:
diff changeset
373 };
304c94c89359 simple logo remover
henry
parents:
diff changeset
374
304c94c89359 simple logo remover
henry
parents:
diff changeset
375 //===========================================================================//