obs-ffmpeg-output.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /******************************************************************************
  2. Copyright (C) 2013 by Hugh Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include <util/c99defs.h>
  16. #include <media-io/video-io.h>
  17. #include <libavformat/avformat.h>
  18. #include <libswscale/swscale.h>
  19. struct ffmpeg_data {
  20. AVStream *video;
  21. AVStream *audio;
  22. AVCodec *acodec;
  23. AVCodec *vcodec;
  24. AVFormatContext *output;
  25. struct SwsContext *swscale;
  26. AVFrame *vframe;
  27. AVPicture src_picture;
  28. AVPicture dst_picture;
  29. AVFrame *aframe;
  30. uint8_t **samples;
  31. bool initialized;
  32. };
  33. struct ffmpeg_output {
  34. obs_output_t output;
  35. volatile bool active;
  36. struct ffmpeg_data ff_data;
  37. };
  38. EXPORT const char *ffmpeg_output_getname(const char *locale);
  39. EXPORT struct ffmpeg_output *ffmpeg_output_create(const char *settings,
  40. obs_output_t output);
  41. EXPORT void ffmpeg_output_destroy(struct ffmpeg_output *data);
  42. EXPORT void ffmpeg_output_update(struct ffmpeg_output *data,
  43. const char *settings);
  44. EXPORT bool ffmpeg_output_start(struct ffmpeg_output *data);
  45. EXPORT void ffmpeg_output_stop(struct ffmpeg_output *data);
  46. EXPORT bool ffmpeg_output_active(struct ffmpeg_output *data);