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.

113 lines
4.2KB

  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. * @ingroup lavfi_buffersink
  23. * memory buffer sink API
  24. */
  25. #include "avfilter.h"
  26. /**
  27. * @defgroup lavfi_buffersink Buffer sink API
  28. * @ingroup lavfi
  29. * @{
  30. */
  31. #if FF_API_AVFILTERBUFFER
  32. /**
  33. * Get a buffer with filtered data from sink and put it in buf.
  34. *
  35. * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
  36. * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
  37. * must be freed by the caller using avfilter_unref_buffer().
  38. * Buf may also be NULL to query whether a buffer is ready to be
  39. * output.
  40. *
  41. * @return >= 0 in case of success, a negative AVERROR code in case of
  42. * failure.
  43. */
  44. attribute_deprecated
  45. int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf);
  46. /**
  47. * Same as av_buffersink_read, but with the ability to specify the number of
  48. * samples read. This function is less efficient than av_buffersink_read(),
  49. * because it copies the data around.
  50. *
  51. * @param ctx pointer to a context of the abuffersink AVFilter.
  52. * @param buf pointer to the buffer will be written here if buf is non-NULL. buf
  53. * must be freed by the caller using avfilter_unref_buffer(). buf
  54. * will contain exactly nb_samples audio samples, except at the end
  55. * of stream, when it can contain less than nb_samples.
  56. * Buf may also be NULL to query whether a buffer is ready to be
  57. * output.
  58. *
  59. * @warning do not mix this function with av_buffersink_read(). Use only one or
  60. * the other with a single sink, not both.
  61. */
  62. attribute_deprecated
  63. int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **buf,
  64. int nb_samples);
  65. #endif
  66. /**
  67. * Get a frame with filtered data from sink and put it in frame.
  68. *
  69. * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
  70. * @param frame pointer to an allocated frame that will be filled with data.
  71. * The data must be freed using av_frame_unref() / av_frame_free()
  72. *
  73. * @return
  74. * - >= 0 if a frame was successfully returned.
  75. * - AVERROR(EAGAIN) if no frames are available at this point; more
  76. * input frames must be added to the filtergraph to get more output.
  77. * - AVERROR_EOF if there will be no more output frames on this sink.
  78. * - A different negative AVERROR code in other failure cases.
  79. */
  80. int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame);
  81. /**
  82. * Same as av_buffersink_get_frame(), but with the ability to specify the number
  83. * of samples read. This function is less efficient than
  84. * av_buffersink_get_frame(), because it copies the data around.
  85. *
  86. * @param ctx pointer to a context of the abuffersink AVFilter.
  87. * @param frame pointer to an allocated frame that will be filled with data.
  88. * The data must be freed using av_frame_unref() / av_frame_free()
  89. * frame will contain exactly nb_samples audio samples, except at
  90. * the end of stream, when it can contain less than nb_samples.
  91. *
  92. * @return The return codes have the same meaning as for
  93. * av_buffersink_get_samples().
  94. *
  95. * @warning do not mix this function with av_buffersink_get_frame(). Use only one or
  96. * the other with a single sink, not both.
  97. */
  98. int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples);
  99. /**
  100. * @}
  101. */
  102. #endif /* AVFILTER_BUFFERSINK_H */