video-io.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 3 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. #ifndef VIDEO_IO_H
  15. #define VIDEO_IO_H
  16. #include "../util/c99defs.h"
  17. #include "media-io.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /*
  22. * Base video output component. Use this to create an video output track
  23. * for the media.
  24. */
  25. struct video_output;
  26. typedef struct video_output *video_t;
  27. struct video_frame {
  28. const void *data;
  29. uint32_t row_size;
  30. uint64_t timestamp;
  31. };
  32. struct video_info {
  33. const char *name;
  34. const char *format;
  35. uint32_t fps_num; /* numerator */
  36. uint32_t fps_den; /* denominator */
  37. uint32_t width;
  38. uint32_t height;
  39. };
  40. #define VIDEO_OUTPUT_SUCCESS 0
  41. #define VIDEO_OUTPUT_INVALIDPARAM -1
  42. #define VIDEO_OUTPUT_FAIL -2
  43. EXPORT int video_output_open(video_t *video, media_t media,
  44. struct video_info *info);
  45. EXPORT void video_output_frame(video_t video, struct video_frame *frame);
  46. EXPORT bool video_output_wait(video_t video);
  47. EXPORT uint64_t video_getframetime(video_t video);
  48. EXPORT uint64_t video_gettime(video_t video);
  49. EXPORT void video_output_stop(video_t video);
  50. EXPORT void video_output_close(video_t video);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif