FFmpeg  1.2.12
internal.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVFILTER_INTERNAL_H
20 #define AVFILTER_INTERNAL_H
21 
27 #include "avfilter.h"
28 #include "avfiltergraph.h"
29 #include "formats.h"
30 #include "video.h"
31 
32 #define POOL_SIZE 32
33 typedef struct AVFilterPool {
35  int count;
36  int refcount;
37  int draining;
38 } AVFilterPool;
39 
40 typedef struct AVFilterCommand {
41  double time;
42  char *command;
43  char *arg;
44  int flags;
47 
52 
53 #if !FF_API_AVFILTERPAD_PUBLIC
54 
57 struct AVFilterPad {
63  const char *name;
64 
69 
77  int min_perms;
78 
88  int rej_perms;
89 
96  AVFilterBufferRef *(*get_video_buffer)(AVFilterLink *link, int perms, int w, int h);
97 
104  AVFilterBufferRef *(*get_audio_buffer)(AVFilterLink *link, int perms,
105  int nb_samples);
106 
118 
128  int (*poll_frame)(AVFilterLink *link);
129 
138 
153  int (*config_props)(AVFilterLink *link);
154 
162 };
163 #endif
164 
167 
169 int ff_fmt_is_in(int fmt, const int *fmts);
170 
175 int *ff_copy_int_list(const int * const list);
176 
181 int64_t *ff_copy_int64_list(const int64_t * const list);
182 
183 /* Functions to parse audio format arguments */
184 
193 int ff_parse_pixel_format(enum AVPixelFormat *ret, const char *arg, void *log_ctx);
194 
203 int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx);
204 
213 int ff_parse_time_base(AVRational *ret, const char *arg, void *log_ctx);
214 
223 int ff_parse_sample_format(int *ret, const char *arg, void *log_ctx);
224 
233 int ff_parse_channel_layout(int64_t *ret, const char *arg, void *log_ctx);
234 
235 void ff_update_link_current_pts(AVFilterLink *link, int64_t pts);
236 
237 void ff_free_pool(AVFilterPool *pool);
238 
240 
241 /* misc trace functions */
242 
243 /* #define FF_AVFILTER_TRACE */
244 
245 #ifdef FF_AVFILTER_TRACE
246 # define ff_tlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
247 #else
248 # define ff_tlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
249 #endif
250 
251 #define FF_TPRINTF_START(ctx, func) ff_tlog(NULL, "%-16s: ", #func)
252 
253 char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms);
254 
255 void ff_tlog_ref(void *ctx, AVFilterBufferRef *ref, int end);
256 
257 void ff_tlog_link(void *ctx, AVFilterLink *link, int end);
258 
272 void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
273  AVFilterPad **pads, AVFilterLink ***links,
274  AVFilterPad *newpad);
275 
277 static inline void ff_insert_inpad(AVFilterContext *f, unsigned index,
278  AVFilterPad *p)
279 {
280  ff_insert_pad(index, &f->nb_inputs, offsetof(AVFilterLink, dstpad),
281  &f->input_pads, &f->inputs, p);
282 #if FF_API_FOO_COUNT
283  f->input_count = f->nb_inputs;
284 #endif
285 }
286 
288 static inline void ff_insert_outpad(AVFilterContext *f, unsigned index,
289  AVFilterPad *p)
290 {
291  ff_insert_pad(index, &f->nb_outputs, offsetof(AVFilterLink, srcpad),
292  &f->output_pads, &f->outputs, p);
293 #if FF_API_FOO_COUNT
294  f->output_count = f->nb_outputs;
295 #endif
296 }
297 
305 int ff_poll_frame(AVFilterLink *link);
306 
313 int ff_request_frame(AVFilterLink *link);
314 
315 #define AVFILTER_DEFINE_CLASS(fname) \
316  static const AVClass fname##_class = { \
317  .class_name = #fname, \
318  .item_name = av_default_item_name, \
319  .option = fname##_options, \
320  .version = LIBAVUTIL_VERSION_INT, \
321  .category = AV_CLASS_CATEGORY_FILTER, \
322  }
323 
325  AVFilterBufferRef *ref);
326 
332 #define FF_INLINK_IDX(link) ((int)((link)->dstpad - (link)->dst->input_pads))
333 #define FF_OUTLINK_IDX(link) ((int)((link)->srcpad - (link)->src->output_pads))
334 
337  int nb_samples);
350 
351 #endif /* AVFILTER_INTERNAL_H */