frame_demo_common.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (C) 2021 Alibaba Group Holding Limited
  3. * Author: LuChongzhi <chongzhi.lcz@alibaba-inc.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #ifndef __FRAME_DEMO_COMMON_H__
  10. #define __FRAME_DEMO_COMMON_H__
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14. #include <errno.h>
  15. #include <fcntl.h>
  16. #include <unistd.h>
  17. #include <sys/stat.h>
  18. #include <sys/ioctl.h>
  19. #include <sys/mman.h>
  20. #include <sys/time.h>
  21. #include <sys/socket.h>
  22. #include <sys/un.h>
  23. #include <ion.h>
  24. #include <csi_frame.h>
  25. #include <csi_camera_frame.h>
  26. #define ION_DEVICE_NAME "/dev/ion"
  27. extern const int PAGE_SIZE;
  28. extern const char *IMG_YUV420_FILENAME;
  29. extern const int IMG_RESOLUTION_WIDTH;
  30. extern const int IMG_RESOLUTION_HEIGHT;;
  31. int fdc_get_img_file_size(long *img_size, const char *filename);
  32. int fdc_get_ion_device_fd(int *ion_fd);
  33. int fdc_alloc_ion_buf(struct ion_allocation_data *alloc_data,
  34. int ion_fd, unsigned long img_size);
  35. int fdc_mmap_dmabuf_addr(void **addr, unsigned long length, int dmabuf_fd);
  36. int fdc_store_img_to_dmabuf(void *dmabuf_addr, int img_fd, long img_size);
  37. int fdc_create_csi_frame(csi_frame_s *camera_frame,
  38. csi_img_format_t *img_format, csi_camera_meta_s **camera_meta,
  39. long img_size, int dmabuf_fd, void *dmabuf_addr);
  40. void fdc_dump_camera_meta(csi_camera_meta_s *camera_meta);
  41. void fdc_destory_csi_frame(csi_frame_s *camera_frame);
  42. void fdc_dump_msghdr(struct msghdr *msg);
  43. #endif /* __FRAME_DEMO_COMMON_H__ */