I am using the AVIFile Reference API(https://msdn.microsoft.com/en-us/library/windows/desktop/dd756808(v=vs.85).aspx) to, create an AVI video output file. While, adding the frames to the video file, I would like to check the size of the file, that was created till now and if it exceeds more than certain size limit (say 1GB), I would like to stop adding the frames to the file and close the AVI File and exit.
I am using the below code:
LONG lnSize=0;
PAVISTREAM ppavi=NULL;
AVIFileGetStream(pfile,&ppavi,mmioFOURCC('M', 'S', 'V', 'C'),1);
AVIStreamDataSize(ppavi,mmioFOURCC('M', 'S', 'V', 'C'),&lnSize);
The AVIFileGetStream is returning null value into ppavi pointer. Hence, it is crashing at the call to AVIStreamDataSize.
Is, my approach to retrieve the size of the AVI file correct while the AVI file is in the process of creation? If so, what I should correct in the code to get the correct size of the AVI file? Otherwise, please let me know what is the correct way to retrieve the same?
Thanks in Advance.