You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
4.0KB

  1. /*
  2. * Filter graphs
  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. #ifndef FFMPEG_AVFILTERGRAPH_H
  22. #define FFMPEG_AVFILTERGRAPH_H
  23. #include "avfilter.h"
  24. /** Linked-list of filters to create for an AVFilterGraphDesc */
  25. typedef struct AVFilterGraphDescFilter
  26. {
  27. int index; ///< filter instance index
  28. char *filter; ///< name of filter type
  29. char *args; ///< filter parameters
  30. struct AVFilterGraphDescFilter *next;
  31. } AVFilterGraphDescFilter;
  32. /** Linked-list of links between filters */
  33. typedef struct AVFilterGraphDescLink
  34. {
  35. /* TODO: allow referencing pads by name, not just by index */
  36. int src; ///< index of the source filter
  37. unsigned srcpad; ///< index of the output pad on the source filter
  38. int dst; ///< index of the dest filter
  39. unsigned dstpad; ///< index of the input pad on the dest filter
  40. struct AVFilterGraphDescLink *next;
  41. } AVFilterGraphDescLink;
  42. /** Linked-list of filter pads to be exported from the graph */
  43. typedef struct AVFilterGraphDescExport
  44. {
  45. /* TODO: allow referencing pads by name, not just by index */
  46. char *name; ///< name of the exported pad
  47. int filter; ///< index of the filter
  48. unsigned pad; ///< index of the pad to be exported
  49. struct AVFilterGraphDescExport *next;
  50. } AVFilterGraphDescExport;
  51. /** Description of a graph to be loaded from a file, etc */
  52. typedef struct
  53. {
  54. AVFilterGraphDescFilter *filters; ///< filters in the graph
  55. AVFilterGraphDescLink *links; ///< links between the filters
  56. AVFilterGraphDescExport *inputs; ///< inputs to export
  57. AVFilterGraphDescExport *outputs; ///< outputs to export
  58. } AVFilterGraphDesc;
  59. typedef struct AVFilterGraph {
  60. unsigned filter_count;
  61. AVFilterContext **filters;
  62. } AVFilterGraph;
  63. /**
  64. * Add to a graph a graph described by a string.
  65. * @param graph the filter graph where to link the parsed graph context
  66. * @param filters string to be parsed
  67. * @param in input to the graph to be parsed (TODO: allow several)
  68. * @param inpad pad index of the input
  69. * @param in output to the graph to be parsed (TODO: allow several)
  70. * @param inpad pad index of the output
  71. * @return zero on success, -1 on error
  72. */
  73. int avfilter_graph_parse_chain(AVFilterGraph *graph, const char *filters, AVFilterContext *in, int inpad, AVFilterContext *out, int outpad);
  74. /**
  75. * Free a filter graph description.
  76. * @param desc The graph description to free
  77. */
  78. void avfilter_graph_free_desc(AVFilterGraphDesc *desc);
  79. /**
  80. * Add an existing filter instance to a filter graph.
  81. * @param graph The filter graph
  82. * @param filter The filter to be added
  83. */
  84. void avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter);
  85. /**
  86. * Configure the formats of all the links in the graph.
  87. */
  88. int avfilter_graph_config_formats(AVFilterGraph *graphctx);
  89. /**
  90. * Configure the parameters (resolution, etc) of all links in the graph.
  91. */
  92. int avfilter_graph_config_links(AVFilterGraph *graphctx);
  93. int graph_load_from_desc3(AVFilterGraph *ctx, AVFilterGraphDesc *desc,
  94. AVFilterContext *in, int inpad,
  95. AVFilterContext *out, int outpad);
  96. #endif /* FFMPEG_AVFILTERGRAPH_H */