Miam-Player  0.8.0
A nice music player
avfilter.h
Go to the documentation of this file.
1 /*
2  * filter layer
3  * Copyright (c) 2007 Bobby Bingham
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVFILTER_AVFILTER_H
23 #define AVFILTER_AVFILTER_H
24 
38 #include <stddef.h>
39 
40 #include "libavutil/attributes.h"
41 #include "libavutil/avutil.h"
42 #include "libavutil/buffer.h"
43 #include "libavutil/dict.h"
44 #include "libavutil/frame.h"
45 #include "libavutil/log.h"
46 #include "libavutil/samplefmt.h"
47 #include "libavutil/pixfmt.h"
48 #include "libavutil/rational.h"
49 
50 #include "libavfilter/version.h"
51 
55 unsigned avfilter_version(void);
56 
60 const char *avfilter_configuration(void);
61 
65 const char *avfilter_license(void);
66 
68 typedef struct AVFilterLink AVFilterLink;
69 typedef struct AVFilterPad AVFilterPad;
71 
76 int avfilter_pad_count(const AVFilterPad *pads);
77 
87 const char *avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx);
88 
98 enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx);
99 
105 #define AVFILTER_FLAG_DYNAMIC_INPUTS (1 << 0)
106 
111 #define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1)
112 
116 #define AVFILTER_FLAG_SLICE_THREADS (1 << 2)
117 
125 #define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC (1 << 16)
126 
133 #define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL (1 << 17)
134 
138 #define AVFILTER_FLAG_SUPPORT_TIMELINE (AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL)
139 
144 typedef struct AVFilter {
148  const char *name;
149 
155  const char *description;
156 
173 
183 
187  int flags;
188 
189  /*****************************************************************
190  * All fields below this line are not part of the public API. They
191  * may not be used outside of libavfilter and can be changed and
192  * removed at will.
193  * New public fields should be added right above.
194  *****************************************************************
195  */
196 
218  int (*init)(AVFilterContext *ctx);
219 
231  int (*init_dict)(AVFilterContext *ctx, AVDictionary **options);
232 
243  void (*uninit)(AVFilterContext *ctx);
244 
268 
269  int priv_size;
270 
275  struct AVFilter *next;
276 
289  int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags);
290 
296  int (*init_opaque)(AVFilterContext *ctx, void *opaque);
297 } AVFilter;
298 
302 #define AVFILTER_THREAD_SLICE (1 << 0)
303 
305 
308  const AVClass *av_class;
309 
310  const AVFilter *filter;
311 
312  char *name;
313 
316  unsigned nb_inputs;
317 
320  unsigned nb_outputs;
321 
322  void *priv;
323 
325 
343 
347  AVFilterInternal *internal;
348 
349  struct AVFilterCommand *command_queue;
350 
351  char *enable_str;
352  void *enable;
353  double *var_values;
355 
364 
371 };
372 
380 struct AVFilterLink {
383 
386 
387  enum AVMediaType type;
388 
389  /* These parameters apply only to video */
390  int w;
391  int h;
393  /* These parameters apply only to audio */
394  uint64_t channel_layout;
396 
397  int format;
398 
407 
408  /*****************************************************************
409  * All fields below this line are not part of the public API. They
410  * may not be used outside of libavfilter and can be changed and
411  * removed at will.
412  * New public fields should be added right above.
413  *****************************************************************
414  */
424 
431  struct AVFilterChannelLayouts *in_channel_layouts;
432  struct AVFilterChannelLayouts *out_channel_layouts;
433 
442 
444  enum {
445  AVLINK_UNINIT = 0,
447  AVLINK_INIT
448  } init_state;
449 
454 
459  int64_t current_pts;
460 
465  int64_t current_pts_us;
466 
471 
484 
489 
495 
504 
510 
521  int status;
522 
526  int channels;
527 
531  unsigned flags;
532 
536  int64_t frame_count;
537 
542 
549 
556 
562 };
563 
573 int avfilter_link(AVFilterContext *src, unsigned srcpad,
574  AVFilterContext *dst, unsigned dstpad);
575 
579 void avfilter_link_free(AVFilterLink **link);
580 
585 
592 void avfilter_link_set_closed(AVFilterLink *link, int closed);
593 
601 
602 #define AVFILTER_CMD_FLAG_ONE 1
603 #define AVFILTER_CMD_FLAG_FAST 2
604 
605 
609 int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags);
610 
612 void avfilter_register_all(void);
613 
614 #if FF_API_OLD_FILTER_REGISTER
615 
617 void avfilter_uninit(void);
618 #endif
619 
630 int avfilter_register(AVFilter *filter);
631 
639 #if !FF_API_NOCONST_GET_NAME
640 const
641 #endif
642 AVFilter *avfilter_get_by_name(const char *name);
643 
649 const AVFilter *avfilter_next(const AVFilter *prev);
650 
651 #if FF_API_OLD_FILTER_REGISTER
652 
660 AVFilter **av_filter_next(AVFilter **filter);
661 #endif
662 
663 #if FF_API_AVFILTER_OPEN
664 
675 int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
676 #endif
677 
678 
679 #if FF_API_AVFILTER_INIT_FILTER
680 
691 int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);
692 #endif
693 
704 int avfilter_init_str(AVFilterContext *ctx, const char *args);
705 
726 int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options);
727 
734 void avfilter_free(AVFilterContext *filter);
735 
746  unsigned filt_srcpad_idx, unsigned filt_dstpad_idx);
747 
753 const AVClass *avfilter_get_class(void);
754 
756 
769 typedef int (avfilter_action_func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
770 
784  void *arg, int *ret, int nb_jobs);
785 
786 typedef struct AVFilterGraph {
789  unsigned nb_filters;
790 
793 
807 
814 
819 
825  void *opaque;
826 
840 
842 
852 
854 } AVFilterGraph;
855 
862 
878  const AVFilter *filter,
879  const char *name);
880 
890 
891 #if FF_API_AVFILTER_OPEN
892 
902 int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter);
903 #endif
904 
918 int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt,
919  const char *name, const char *args, void *opaque,
920  AVFilterGraph *graph_ctx);
921 
931 
932 enum {
935 };
936 
944 int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx);
945 
950 void avfilter_graph_free(AVFilterGraph **graph);
951 
961 typedef struct AVFilterInOut {
963  char *name;
964 
967 
969  int pad_idx;
970 
973 } AVFilterInOut;
974 
981 
986 void avfilter_inout_free(AVFilterInOut **inout);
987 
1006 int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
1008  void *log_ctx);
1009 
1027 int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters,
1029  void *log_ctx);
1030 
1053 int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters,
1056 
1072 int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags);
1073 
1089 int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts);
1090 
1091 
1100 char *avfilter_graph_dump(AVFilterGraph *graph, const char *options);
1101 
1121 
1126 #endif /* AVFILTER_AVFILTER_H */
void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags)
char * resample_lavr_opts
libavresample options to use for the auto-inserted resample filters
Definition: avfilter.h:792
const char * description
Definition: avfilter.h:155
struct AVFilterInternal AVFilterInternal
Definition: avfilter.h:304
Definition: avfilter.h:786
Definition: avfilter.h:933
int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts)
void avfilter_free(AVFilterContext *filter)
AVFilterGraph * avfilter_graph_alloc(void)
int(* process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags)
Definition: avfilter.h:289
AVFilterContext ** filters
Definition: avfilter.h:788
const AVFilter * filter
the AVFilter of which this is an instance
Definition: avfilter.h:310
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
Definition: avfilter.h:791
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
void avfilter_inout_free(AVFilterInOut **inout)
Definition: avfilter.h:961
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
struct AVFilterCommand * command_queue
Definition: avfilter.h:349
void avfilter_graph_free(AVFilterGraph **graph)
unsigned nb_inputs
number of input pads
Definition: avfilter.h:316
Definition: buffer.h:81
const AVClass * av_class
needed for av_log() and filters common options
Definition: avfilter.h:308
Definition: frame.h:184
int flags
Definition: avfilter.h:187
int priv_size
size of private data to allocate for the filter
Definition: avfilter.h:269
char * name
Definition: avfilter.h:963
unsigned nb_outputs
number of output pads
Definition: avfilter.h:320
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
const char * avfilter_license(void)
int( avfilter_execute_func)(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: avfilter.h:783
int(* init_dict)(AVFilterContext *ctx, AVDictionary **options)
Definition: avfilter.h:231
int thread_type
Definition: avfilter.h:342
void avfilter_register_all(void)
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
int avfilter_config_links(AVFilterContext *filter)
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:315
const AVFilter * avfilter_next(const AVFilter *prev)
AVFilterContext * avfilter_graph_get_filter(AVFilterGraph *graph, const char *name)
struct AVFilterInOut * next
Definition: avfilter.h:972
int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs)
void * priv
private data for use by the filter
Definition: avfilter.h:322
AVFilterLink ** sink_links
Definition: avfilter.h:850
char * enable_str
enable expression string
Definition: avfilter.h:351
int avfilter_link_get_channels(AVFilterLink *link)
unsigned avfilter_version(void)
struct AVFilterInOut AVFilterInOut
struct AVDictionary AVDictionary
Definition: dict.h:90
int pad_idx
Definition: avfilter.h:969
Definition: avfilter.h:144
AVFilterPad * output_pads
array of output pads
Definition: avfilter.h:318
int nb_threads
Definition: avfilter.h:813
int(* init_opaque)(AVFilterContext *ctx, void *opaque)
Definition: avfilter.h:296
void(* uninit)(AVFilterContext *ctx)
Definition: avfilter.h:243
const AVClass * av_class
Definition: avfilter.h:787
double * var_values
variable values for the enable expression
Definition: avfilter.h:353
const AVFilter * avfilter_get_by_name(const char *name)
int is_disabled
the enabled state from the last expression evaluation
Definition: avfilter.h:354
attribute_deprecated void avfilter_link_set_closed(AVFilterLink *link, int closed)
AVFilterPad * input_pads
array of input pads
Definition: avfilter.h:314
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:319
Definition: log.h:67
char * aresample_swr_opts
swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions ...
Definition: avfilter.h:841
struct AVFilterGraph * graph
filtergraph this filter belongs to
Definition: avfilter.h:324
struct AVFilterGraph AVFilterGraph
int(* init)(AVFilterContext *ctx)
Definition: avfilter.h:218
unsigned disable_auto_convert
Definition: avfilter.h:853
int( avfilter_action_func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: avfilter.h:769
int avfilter_init_str(AVFilterContext *ctx, const char *args)
struct AVFilter AVFilter
const AVClass * avfilter_get_class(void)
int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, unsigned filt_srcpad_idx, unsigned filt_dstpad_idx)
Definition: avfilter.h:934
int avfilter_graph_request_oldest(AVFilterGraph *graph)
int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
const AVFilterPad * inputs
Definition: avfilter.h:164
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut *inputs, AVFilterInOut *outputs, void *log_ctx)
int(* query_formats)(AVFilterContext *)
Definition: avfilter.h:267
int nb_threads
Definition: avfilter.h:370
AVMediaType
Definition: avutil.h:193
const char * avfilter_configuration(void)
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Definition: rational.h:58
#define attribute_deprecated
Definition: attributes.h:98
int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
int thread_type
Definition: avfilter.h:806
AVFilterInOut * avfilter_inout_alloc(void)
char * name
name of this filter instance
Definition: avfilter.h:312
Definition: avfilter.h:307
void * enable
parsed expression (AVExpr*)
Definition: avfilter.h:352
int sink_links_count
Definition: avfilter.h:851
struct AVFilter * next
Definition: avfilter.h:275
char * avfilter_graph_dump(AVFilterGraph *graph, const char *options)
int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags)
struct AVFilterPad AVFilterPad
Definition: avfilter.h:69
int avfilter_register(AVFilter *filter)
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
AVBufferRef * hw_device_ctx
Definition: avfilter.h:363
avfilter_execute_func * execute
Definition: avfilter.h:839
struct AVFilterGraphInternal AVFilterGraphInternal
Definition: avfilter.h:755
unsigned nb_filters
Definition: avfilter.h:789
int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx)
int avfilter_pad_count(const AVFilterPad *pads)
const AVClass * priv_class
Definition: avfilter.h:182
const AVFilterPad * outputs
Definition: avfilter.h:172
AVFilterContext * filter_ctx
Definition: avfilter.h:966
void avfilter_link_free(AVFilterLink **link)
const char * name
Definition: avfilter.h:148
struct AVFilterFormats AVFilterFormats
Definition: avfilter.h:70
void * opaque
Definition: avfilter.h:825