From: Antonio Ospite Date: Thu, 1 Mar 2012 20:52:06 +0000 (+0100) Subject: am7xxx: introduce a new am7xxx_device_info type X-Git-Tag: v0.1.0~1^2~25 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/a09eb6616f4c6c67d4de4c8b72d9072f787ad2de?hp=--cc am7xxx: introduce a new am7xxx_device_info type This is in order to abstract the properties of an am7xxx device, for now only native_width and native_height are supported. --- a09eb6616f4c6c67d4de4c8b72d9072f787ad2de diff --git a/src/am7xxx.c b/src/am7xxx.c index 4ed7cf9..48704de 100644 --- a/src/am7xxx.c +++ b/src/am7xxx.c @@ -652,10 +652,7 @@ int am7xxx_close_device(am7xxx_device *dev) } int am7xxx_get_device_info(am7xxx_device *dev, - unsigned int *native_width, - unsigned int *native_height, - unsigned int *unknown0, - unsigned int *unknown1) + am7xxx_device_info *device_info) { int ret; struct am7xxx_header h = { @@ -682,10 +679,13 @@ int am7xxx_get_device_info(am7xxx_device *dev, if (ret < 0) return ret; - *native_width = h.header_data.devinfo.native_width; - *native_height = h.header_data.devinfo.native_height; - *unknown0 = h.header_data.devinfo.unknown0; - *unknown1 = h.header_data.devinfo.unknown1; + device_info->native_width = h.header_data.devinfo.native_width; + device_info->native_height = h.header_data.devinfo.native_height; +#if 0 + /* No reason to expose these in the public API until we know what they mean */ + device_info->unknown0 = h.header_data.devinfo.unknown0; + device_info->unknown1 = h.header_data.devinfo.unknown1; +#endif return 0; } diff --git a/src/am7xxx.h b/src/am7xxx.h index 13cb83d..7d821d6 100644 --- a/src/am7xxx.h +++ b/src/am7xxx.h @@ -30,6 +30,11 @@ typedef struct _am7xxx_context am7xxx_context; struct _am7xxx_device; typedef struct _am7xxx_device am7xxx_device; +typedef struct { + unsigned int native_width; + unsigned int native_height; +} am7xxx_device_info; + typedef enum { AM7XXX_LOG_FATAL = 0, AM7XXX_LOG_ERROR = 1, @@ -65,10 +70,7 @@ int am7xxx_open_device(am7xxx_context *ctx, int am7xxx_close_device(am7xxx_device *dev); int am7xxx_get_device_info(am7xxx_device *dev, - unsigned int *native_width, - unsigned int *native_height, - unsigned int *unknown0, - unsigned int *unknown1); + am7xxx_device_info *device_info); int am7xxx_send_image(am7xxx_device *dev, am7xxx_image_format format, diff --git a/src/picoproj.c b/src/picoproj.c index ec7bbb6..c3b199c 100644 --- a/src/picoproj.c +++ b/src/picoproj.c @@ -59,10 +59,7 @@ int main(int argc, char *argv[]) int height = 480; unsigned char *image; unsigned int size; - unsigned int native_width; - unsigned int native_height; - unsigned int unknown0; - unsigned int unknown1; + am7xxx_device_info device_info; while ((opt = getopt(argc, argv, "f:F:l:W:H:h")) != -1) { switch (opt) { @@ -171,15 +168,14 @@ int main(int argc, char *argv[]) goto cleanup; } - ret = am7xxx_get_device_info(dev, &native_width, &native_height, &unknown0, &unknown1); + ret = am7xxx_get_device_info(dev, &device_info); if (ret < 0) { perror("am7xxx_get_info"); exit_code = EXIT_FAILURE; goto cleanup; } - printf("Native resolution: %dx%d\n", native_width, native_height); - printf("Unknown0: %d\n", unknown0); - printf("Unknown1: %d\n", unknown1); + printf("Native resolution: %dx%d\n", + device_info.native_width, device_info.native_height); ret = am7xxx_set_power_mode(dev, AM7XXX_POWER_LOW); if (ret < 0) {