buffersink.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. /**
  32. * Get a frame with filtered data from sink and put it in frame.
  33. *
  34. * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
  35. * @param frame pointer to an allocated frame that will be filled with data.
  36. * The data must be freed using av_frame_unref() / av_frame_free()
  37. *
  38. * @return
  39. * - >= 0 if a frame was successfully returned.
  40. * - AVERROR(EAGAIN) if no frames are available at this point; more
  41. * input frames must be added to the filtergraph to get more output.
  42. * - AVERROR_EOF if there will be no more output frames on this sink.
  43. * - A different negative AVERROR code in other failure cases.
  44. */
  45. int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame);
  46. /**
  47. * Same as av_buffersink_get_frame(), but with the ability to specify the number
  48. * of samples read. This function is less efficient than
  49. * av_buffersink_get_frame(), because it copies the data around.
  50. *
  51. * @param ctx pointer to a context of the abuffersink AVFilter.
  52. * @param frame pointer to an allocated frame that will be filled with data.
  53. * The data must be freed using av_frame_unref() / av_frame_free()
  54. * frame will contain exactly nb_samples audio samples, except at
  55. * the end of stream, when it can contain less than nb_samples.
  56. *
  57. * @return The return codes have the same meaning as for
  58. * av_buffersink_get_samples().
  59. *
  60. * @warning do not mix this function with av_buffersink_get_frame(). Use only one or
  61. * the other with a single sink, not both.
  62. */
  63. int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples);
  64. /**
  65. * @}
  66. */
  67. #endif /* AVFILTER_BUFFERSINK_H */