summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/camera_test.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/camera_test.c b/test/camera_test.c
index 33e731d..f92cdfa 100644
--- a/test/camera_test.c
+++ b/test/camera_test.c
@@ -88,6 +88,7 @@ GTimeVal result_time;
| LOCAL #defines: |
-----------------------------------------------------------------------*/
#define DEFAULT_FILE_PATH "/home/owner/media"
+#define PREVIEW_CB_DUMP_FILE_NAME "preview.data"
#define MAX_FILE_NAME_LENGTH 256
#define MAX_FILE_PATH_LENGTH (MAX_FILE_NAME_LENGTH - 20)
@@ -461,9 +462,14 @@ static void _camera_interrupt_started_cb(camera_policy_e policy, camera_state_e
void _camera_preview_cb(camera_preview_data_s *frame, void *user_data)
{
#if 1
- FILE *fp = fopen(DEFAULT_FILE_PATH"/test.raw", "a");
+ char preview_dump[MAX_FILE_NAME_LENGTH] = {'\0',};
+ FILE *fp = NULL;
+
+ snprintf(preview_dump, MAX_FILE_NAME_LENGTH, "%s/%s", DEFAULT_FILE_PATH, PREVIEW_CB_DUMP_FILE_NAME);
+
+ fp = fopen(preview_dump, "a");
if (fp == NULL) {
- g_print("\n==== file[%s] open failed ====\n", DEFAULT_FILE_PATH"/test.raw");
+ g_print("\n==== file[%s] open failed ====\n", preview_dump);
return;
}
@@ -472,6 +478,8 @@ void _camera_preview_cb(camera_preview_data_s *frame, void *user_data)
fwrite(frame->data.rgb_plane.data, 1, frame->data.rgb_plane.size, fp);
} else if (frame->format == CAMERA_PIXEL_FORMAT_INVZ) {
fwrite(frame->data.depth_plane.data, 1, frame->data.depth_plane.size, fp);
+ } else if (frame->format == CAMERA_PIXEL_FORMAT_MJPEG) {
+ fwrite(frame->data.encoded_plane.data, 1, frame->data.encoded_plane.size, fp);
} else {
switch (frame->num_of_planes) {
case 1:
@@ -491,7 +499,7 @@ void _camera_preview_cb(camera_preview_data_s *frame, void *user_data)
}
}
- g_print("==== file[%s] write done ====\n", DEFAULT_FILE_PATH"/test.raw");
+ g_print("==== file[%s] write done ====\n", preview_dump);
fclose(fp);
fp = NULL;