videoclock.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif
  5. #include "videoutil.h"
  6. #include <stdarg.h>
  7. /**
  8. * video clock engine handler
  9. */
  10. typedef struct videoclock* videoclock_t;
  11. typedef void (*get_frame_cb)(void *get_user_data, video_frame *frame);
  12. typedef void (*put_frame_cb)(void *put_user_data, video_frame *frame);
  13. typedef void (*clockdbg_cb)(void* user_data, const char* fmt, va_list arg);
  14. /**
  15. * create a clock engine
  16. * @param fps_num frame per second number, use with fps_den
  17. * @param fps_den the actual frame per second is fps_num/fps_den
  18. * @param video_width the width of the video
  19. * @param video_height the height of the video
  20. * @param frame_format the pixel format of the video
  21. * @param put callback funtion that video clock used to push video frame
  22. * @param put_user_data user specify data pass to put_frame_cb
  23. * @param get callback funtion that video clock used to get a video frame
  24. * @param get_usre_data user specify data pass to get_user_data
  25. * @param p_clock return the created clock engine
  26. */
  27. int videoclock_create(int fps_num,
  28. int fps_den,
  29. int video_width,
  30. int video_height,
  31. int frame_format,
  32. put_frame_cb put,
  33. void *put_user_data,
  34. get_frame_cb get,
  35. void *get_user_data,
  36. videoclock_t *p_clock,
  37. volatile int*nFps,
  38. clockdbg_cb dbgfunc);
  39. /**
  40. * destroy the clock
  41. */
  42. void videoclock_destroy(videoclock_t vc);
  43. /**
  44. * start work, create a inner thread
  45. */
  46. int videoclock_start(videoclock_t vc);
  47. /**
  48. * stop work, destroy the inner thread
  49. */
  50. int videoclock_stop(videoclock_t vc);
  51. #ifdef __cplusplus
  52. }//extern "C" {
  53. #endif