video-io.h 2.1 KB

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