videoclock.h 1.8 KB

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