07-25-2011 12:23 PM
Hi,
I am trying to read an AVI in my CVI code, but it isn't working. I am able to read the same AVI fine in a VI, just not on the C side of things. Here is the code I am using:
AVISession session = 0; session = imaqOpenAVI("C://MKX.avi"); int error = imaqGetLastError(); AVIInfo *info = NULL; imaqGetAVIInfo(session, info); printf("There are %d frames at %dx%d\n", info->numFrames, info->height, info->width);
The call to imaqGetAVIInfo returns null. I made sure the path to the AVI was correct.
Any suggestions are much appreciated.
Shawn
Solved! Go to Solution.
07-25-2011 02:38 PM
Have you tried "C:\\MKX.avi" for the path? (use backslashes instead).
-Christophe
07-25-2011 04:28 PM
Whoops, that was an error in my code posting. That was left over from trying "/" instead of "\\".
imaqOpenAVI returns 1, which I think means it opened it okay. I also did a imaqGetLastError after the imaqOpenAVI and it returns 0. I also added an error check after imaqGetAVIInfo and it comes back with: -1074395269 Null pointer.
Am I just missing something obvious with my code?
Thank you for the reply.
07-26-2011 12:59 AM
@shawnhunt wrote:
Whoops, that was an error in my code posting. That was left over from trying "/" instead of "\\".
imaqOpenAVI returns 1, which I think means it opened it okay. I also did a imaqGetLastError after the imaqOpenAVI and it returns 0. I also added an error check after imaqGetAVIInfo and it comes back with: -1074395269 Null pointer.
Am I just missing something obvious with my code?
Thank you for the reply.
I haven't looked up the documentation for that function, but it looks like from the way you called the function (and also the error code) that you are passing it a NULL pointer. The function would have no way to return the info you asked for with the way you are calling it. I imagine it expected you to allocate the structure and pass it by reference.
Your code should probably be modified like this:
AVIInfo info; imaqGetAVIInfo(session, &info);
Hope this helps,
Eric
07-26-2011 04:34 AM
Ah, yes, totally my fault. I was having a total brain freeze on that one. Thank you!