1 /*
2 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <stdlib.h>
22
25
29
31 "n", /// packet index, starting from zero
32 "tb", /// timebase
33 "pts", /// packet presentation timestamp
34 "dts", /// packet decoding timestamp
35 "nopts", /// AV_NOPTS_VALUE
36 "startpts", /// first seen non-AV_NOPTS_VALUE packet timestamp
37 "startdts", /// first seen non-AV_NOPTS_VALUE packet timestamp
38 "duration", "d", /// packet duration
39 "pos", /// original position of packet in its source
40 "size", /// packet size
41 "key" , /// packet keyframe flag
42 "state", /// random-ish state
44 };
45
60 };
61
64
68
71
73
77
79 {
82
87 }
88
94 }
95
96 if (
s->drop_str &&
s->dropamount) {
98 s->drop_str,
s->dropamount);
100 }
101
108 }
109 }
110
116
117 return 0;
118 }
119
121 {
123 int i,
ret, amount, drop = 0;
124 double res;
125
129
130 s->var_values[
VAR_N] =
s->pkt_idx++;
138
141
144
146
148 amount = 0;
149 else if (res < 0)
150 amount = (
s->state % 10001 + 1);
151 else
153
156
158 drop = 0;
159 else if (res < 0)
160 drop = !(
s->state %
FFABS((
int)res));
161 else
162 drop = !!res;
163 }
164
166 drop = !(
s->state %
s->dropamount);
167 }
168
171
172 if (drop) {
176 }
177
178 if (amount) {
183 }
184 }
185
188 if (amount &&
s->state % amount == 0)
190 }
191
193
194 return 0;
195 }
196
198 {
200
203 s->amount_pexpr =
s->drop_pexpr =
NULL;
204 }
205
206 #define OFFSET(x) offsetof(NoiseContext, x)
207 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_BSF_PARAM)
213 };
214
220 };
221
229 };