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.

95 lines
3.7KB

  1. /*
  2. * This file is part of Libav.
  3. *
  4. * Libav 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. * Libav 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 Libav; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef AVFILTER_BUFFERSINK_H
  19. #define AVFILTER_BUFFERSINK_H
  20. /**
  21. * @file
  22. * memory buffer sink API
  23. */
  24. #include "avfilter.h"
  25. #if FF_API_AVFILTERBUFFER
  26. /**
  27. * Get a buffer with filtered data from sink and put it in buf.
  28. *
  29. * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
  30. * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
  31. * must be freed by the caller using avfilter_unref_buffer().
  32. * Buf may also be NULL to query whether a buffer is ready to be
  33. * output.
  34. *
  35. * @return >= 0 in case of success, a negative AVERROR code in case of
  36. * failure.
  37. */
  38. attribute_deprecated
  39. int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf);
  40. /**
  41. * Same as av_buffersink_read, but with the ability to specify the number of
  42. * samples read. This function is less efficient than av_buffersink_read(),
  43. * because it copies the data around.
  44. *
  45. * @param ctx pointer to a context of the abuffersink AVFilter.
  46. * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
  47. * must be freed by the caller using avfilter_unref_buffer(). buf
  48. * will contain exactly nb_samples audio samples, except at the end
  49. * of stream, when it can contain less than nb_samples.
  50. * Buf may also be NULL to query whether a buffer is ready to be
  51. * output.
  52. *
  53. * @warning do not mix this function with av_buffersink_read(). Use only one or
  54. * the other with a single sink, not both.
  55. */
  56. attribute_deprecated
  57. int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **buf,
  58. int nb_samples);
  59. #endif
  60. /**
  61. * Get a frame with filtered data from sink and put it in frame.
  62. *
  63. * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
  64. * @param frame pointer to an allocated frame that will be filled with data.
  65. * The data must be freed using av_frame_unref() / av_frame_free()
  66. *
  67. * @return >= 0 in case of success, a negative AVERROR code in case of
  68. * failure.
  69. */
  70. int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame);
  71. /**
  72. * Same as av_buffersink_get_frame(), but with the ability to specify the number
  73. * of samples read. This function is less efficient than
  74. * av_buffersink_get_frame(), because it copies the data around.
  75. *
  76. * @param ctx pointer to a context of the abuffersink AVFilter.
  77. * @param frame pointer to an allocated frame that will be filled with data.
  78. * The data must be freed using av_frame_unref() / av_frame_free()
  79. * frame will contain exactly nb_samples audio samples, except at
  80. * the end of stream, when it can contain less than nb_samples.
  81. *
  82. * @warning do not mix this function with av_buffersink_get_frame(). Use only one or
  83. * the other with a single sink, not both.
  84. */
  85. int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples);
  86. #endif /* AVFILTER_BUFFERSINK_H */