formats.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #ifndef AVFILTER_FORMATS_H
  19. #define AVFILTER_FORMATS_H
  20. #include "avfilter.h"
  21. typedef struct AVFilterChannelLayouts {
  22. uint64_t *channel_layouts; ///< list of channel layouts
  23. int nb_channel_layouts; ///< number of channel layouts
  24. unsigned refcount; ///< number of references to this list
  25. struct AVFilterChannelLayouts ***refs; ///< references to this list
  26. } AVFilterChannelLayouts;
  27. /**
  28. * Return a channel layouts/samplerates list which contains the intersection of
  29. * the layouts/samplerates of a and b. Also, all the references of a, all the
  30. * references of b, and a and b themselves will be deallocated.
  31. *
  32. * If a and b do not share any common elements, neither is modified, and NULL
  33. * is returned.
  34. */
  35. AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a,
  36. AVFilterChannelLayouts *b);
  37. AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
  38. AVFilterFormats *b);
  39. /**
  40. * Construct an empty AVFilterChannelLayouts/AVFilterFormats struct --
  41. * representing any channel layout/sample rate.
  42. */
  43. AVFilterChannelLayouts *ff_all_channel_layouts(void);
  44. AVFilterFormats *ff_all_samplerates(void);
  45. AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts);
  46. /**
  47. * A helper for query_formats() which sets all links to the same list of channel
  48. * layouts/sample rates. If there are no links hooked to this filter, the list
  49. * is freed.
  50. */
  51. void ff_set_common_channel_layouts(AVFilterContext *ctx,
  52. AVFilterChannelLayouts *layouts);
  53. void ff_set_common_samplerates(AVFilterContext *ctx,
  54. AVFilterFormats *samplerates);
  55. int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);
  56. /**
  57. * Add *ref as a new reference to f.
  58. */
  59. void ff_channel_layouts_ref(AVFilterChannelLayouts *f,
  60. AVFilterChannelLayouts **ref);
  61. /**
  62. * Remove a reference to a channel layouts list.
  63. */
  64. void ff_channel_layouts_unref(AVFilterChannelLayouts **ref);
  65. void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
  66. AVFilterChannelLayouts **newref);
  67. int ff_default_query_formats(AVFilterContext *ctx);
  68. #endif // AVFILTER_FORMATS_H