- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi gents.
I'm working on a problem and it costs me several hours without getting an idea how to solv it. I have the following problem.
I want to create a avi, therefore I use the vfw32.lib. Unfortunately the whole interface stuff is missing, so I took a look at the vfw.h file andrebuiltthe nesseccary functions and typesby myself. I made it so far that I can open a file, choose a compressor and its settings, but I'm not able to Set these settings. I played a little bit around and come to the point, where I think that I figured out the problem. I used the following functions from the MSDN library
FORTRAN SOURCE CODE:
************************************************************
// OPEN THE FILE - THIS WORKS FINE
iret = AVIFileOpen(loc(m_pAVIFile), loc('d:TEST.avi' // char(0)), OF_READ, NULL)
// retrieve the information about the file - THIS CAUSES THE PROGRAM TO CRASH
iret = AVIFileInfo(m_pAVIFile, loc(STavifileinfo),sizeof(STavifileinfo))
****************************************************************
C++ SOURCE CODE:
*************************************************************
hr = AVIFileOpen(&m_pAVIFile,"D:\Test.avi",OF_READ,NULL);
hr = AVIFileInfo(m_pAVIFile,&filHdr,sizeof(filHdr));
*************************************************************
The C++ Code works fine. I think my problem is, that refering to the MSDN library m_pAVIFile is a
"Pointer to a buffer that receives the new IAVIFile interface pointer"
And if you take a deeper look at IAVIFile interface:
"The IAVIFile interface supports opening and manipulating files and file headers, and creating and obtaining stream interfaces. Uses IUnknown::QueryInterface, IUnknown::AddRef, and IUnknown::Release in addition to the following custom methods:
Method | Description |
CreateStream | Creates a stream for writing. |
EndRecord | Writes the "REC" chunk in a tightly interleaved AVI file. |
GetStream | Opens a stream by accessing it in a file. |
Info | Fills and returns an AVIFileInfo structure with information about a file. |
Open | Initializes a file handler. |
ReadData | Reads file headers data, format data, or nonaudio and nonvideo data. |
WriteData | Writes file headers data, format data, or nonaudio and nonvideo data. " |
I think that the Function AVIFileInfo somehow tries to call the Info function of this IAVIFile interface, But due to the fact that Fortan has no information about the further methods of this "virtual class", it causes the code to crash if I try to access one of these methods.
Now finally my question.
Has anybody an Idea how I can solve this problem. Like is there a possibility to create classes in FORTRAN?
How can I access the functions of the interface directly?
Or is there an easier way to create an AVI?
Many thanks,
Christian
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I am struggling with the same question as Christian i.e. I want to access the AVIfunction from vfw32.lib. Realizing that there do not seem to be an fortran interface to vfw32.lib I tried to create one myself using the vfw.h file and samples that demonstrate how this was accomplished in e.g. VB. However I am not able to make a doable interface, and get an "access violation" when trying to use AVIFILEOPEN.
My code so far is:
interface AVIFileOpen
function AVIFileOpen_G(ppfile, szFile, uMode, lpHandler)
USE DFWINTY
integer :: AVIFileOpen_G !STDAPI
!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'AVIFileOpen' :: AVIFileOpen_G
integer(POINTER_LEN) ppfile !PAVIFILE * ppfile (Should this be a pointer?)
character*(*) szFile !LPCTSTR szFile
integer(UINT) uMode !UINT umode
!DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: lpHandler
integer(POINTER_LEN) lpHandler !CLSID * pclsidHandler (Should this be a pointer?)
end function
end interface
...
and the calling sequence that produce the error
fOk = AVIFileOpen(loc(avifile), 'c:test.avi'C, OF_CREATE,NULL)
can anybody offer any help?
Regards
Lars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you - my application now makes avi files :)
Regards
Lars

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page