liyujie
2025-08-28 d9927380ed7c8366f762049be9f3fee225860833
android/hardware/aw/camera/3_4/common.cpp
....@@ -57,6 +57,39 @@
5757 }
5858 }
5959
60
+bool saveBuffers(const char *path,
61
+ void *y_addr,
62
+ void *cr_addr,
63
+ unsigned int y_size,
64
+ unsigned int cr_size,
65
+ bool is_oneframe) {
66
+ int fd;
67
+ HAL_LOGD("Debug to save a frame!");
68
+ if((access(path, 0) != -1) && (is_oneframe)) {
69
+ HAL_LOGD("File %s is exists!!!\n", path);
70
+ }
71
+ if(is_oneframe)
72
+ fd = open(path, O_CREAT|O_RDWR|O_TRUNC, 0777); //save one frame data
73
+ else
74
+ fd = open(path, O_CREAT|O_RDWR|O_APPEND, 0777); //save more frames
75
+ if(!fd) {
76
+ HAL_LOGE("Open file error");
77
+ return false;
78
+ }
79
+ if(write(fd, y_addr, y_size)){
80
+ HAL_LOGD("Write Y data successfully");
81
+ if(write(fd, cr_addr, cr_size)){
82
+ HAL_LOGD("Write U data successfully");
83
+ close(fd);
84
+ return true;
85
+ }
86
+ }
87
+ HAL_LOGE("Write file fail");
88
+ close(fd);
89
+ return false;
90
+}
91
+
92
+
6093 bool saveSizes(int width, int height) {
6194 int fd;
6295 char buf[128];