ICAMERA_GetSizeList() | developer.brewmp.com ICAMERA_GetSizeList() | developer.brewmp.com

Developer

ICAMERA_GetSizeList()

Forums:

The documentation for ICAMERA_GetSizeList() is not very clear:

int ICAMERA_GetSizeList
(
ICamera * pICamera,
AEESize ** ppList,
boolean * pbRange
)

Parameters:
pICamera: [in]: Pointer to ICamera Interface.
ppList: [in]: ppList contains CAM_MODE_SNAPSHOT/CAM_MODE_MOVIE
ppList: [out]: Pointer to NULL- terminated size list
pbRange: [out]: Pointer to boolean when TRUE indicates the passed list is a NULL-terminated paired list (i.e. multiple of 2) of ranges

So how do we call ICAMERA_GetSizeList()?
ppList is supposed to be a pointer to AEESize pointers. How can we make it an int (since it's required to be set to either CAM_MODE_SNAPSHOT or CAM_MODE_MOVIE)? Just by calling it like this?

...
uint32 messedUpMixedTypeValue = CAM_MODE_SNAPSHOT;
boolean isRange=FALSE;
int error = ICAMERA_GetSizeList(myCam, (AEESize*) &messedUpMixedTypeValue, &isRange);
...then use ((AEESize**) messedUpMixedTypeValue) ?

Thanks,
Julien.

boolean bRange;
AEESize * pSizeList;
...
pSizeList = (AEESize *)CAM_MODE_SNAPSHOT;
nErr = ICAMERA_GetSizeList(pICamera, &pSizeList, &bRange);
Remember NOT to free pSizeList.

boolean bRange;
AEESize * pSizeList;
...
pSizeList = (AEESize *)CAM_MODE_SNAPSHOT;
nErr = ICAMERA_GetSizeList(pICamera, &pSizeList, &bRange);
Remember NOT to free pSizeList.

Ok, so since you pass the address of a (AEESize*) variable, how is achieved the "NULL termination" mentionned in the doc?
boolean bRange;
AEESize * pSizeList;
...
pSizeList = (AEESize*)CAM_MODE_SNAPSHOT;
nErr = ICAMERA_GetSizeList(pICamera, &pSizeList, &bRange);
/* now what? how do I loop until pSizeList is "NULL-terminated"
(AEESize do not have a "next" pointer, and pSizeList is now an
array of pointers)?
Is it a linear array of AEESize? If so, what is "NULL": AEESize.cx
equaling zero? The API doc mentions a "list" :-( */
// This doesn't work (strange values for cx and cy) :
int i=0;
while (pSizeList[i].cx > 0) {
// use pSizeList[i]
++i;

The thing that puzzles me is that the returned pointer is not a pointer on pointer but a simple pointer. How do you achieve a "list" behaviour using that thing? Who designed that ****** function?
Thanks,
Julien.

Ok, so since you pass the address of a (AEESize*) variable, how is achieved the "NULL termination" mentionned in the doc?
boolean bRange;
AEESize * pSizeList;
...
pSizeList = (AEESize*)CAM_MODE_SNAPSHOT;
nErr = ICAMERA_GetSizeList(pICamera, &pSizeList, &bRange);
/* now what? how do I loop until pSizeList is "NULL-terminated"
(AEESize do not have a "next" pointer, and pSizeList is now an
array of pointers)?
Is it a linear array of AEESize? If so, what is "NULL": AEESize.cx
equaling zero? The API doc mentions a "list" :-( */
// This doesn't work (strange values for cx and cy) :
int i=0;
while (pSizeList[i].cx > 0) {
// use pSizeList[i]
++i;

The thing that puzzles me is that the returned pointer is not a pointer on pointer but a simple pointer. How do you achieve a "list" behaviour using that thing? Who designed that ****** function?
Thanks,
Julien.

Which device are you trying your code on? Are you checking the return values from the function call?

Which device are you trying your code on? Are you checking the return values from the function call?

Ok it worked once I looped until cx and cy equal zero (which is a bit different from the "NULL" termination described in the API reference......)
Julien.

Ok it worked once I looped until cx and cy equal zero (which is a bit different from the "NULL" termination described in the API reference......)
Julien.