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.

57 lines
1.6KB

  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. #include "avfilter.h"
  22. #include "avfiltergraph.h"
  23. struct AVFilterGraph {
  24. unsigned filter_count;
  25. AVFilterContext **filters;
  26. };
  27. AVFilterGraph *avfilter_create_graph(void)
  28. {
  29. return av_mallocz(sizeof(AVFilterGraph));
  30. }
  31. static void destroy_graph_filters(AVFilterGraph *graph)
  32. {
  33. unsigned i;
  34. for(i = 0; i < graph->filter_count; i ++)
  35. avfilter_destroy(graph->filters[i]);
  36. av_freep(&graph->filters);
  37. }
  38. void avfilter_destroy_graph(AVFilterGraph *graph)
  39. {
  40. destroy_graph_filters(graph);
  41. av_free(graph);
  42. }
  43. void avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
  44. {
  45. graph->filters = av_realloc(graph->filters,
  46. sizeof(AVFilterContext*) * ++graph->filter_count);
  47. graph->filters[graph->filter_count - 1] = filter;
  48. }