I made some search too before posting you that, but to me too the results were "useless"...
Quote:
Originally Posted by RafkeP I'm going to try it with a value of 0 and if it doesn't work out I will put the endtime on starttime + 60 seconds. In that way the max subtitle duration should kick in. |
Yes, this way all the problems should be handled by BSplayer :D
Another suggestion...
I tried your plugin with a 20fps movie, and the subtitles didn't appear at the right time.
I think it's pretty simple to retrieve the fps rate also in C++.
I've tried in VisualBasic and the code I wrote is this:
Code:
Private Const OF_SHARE_DENY_WRITE As Long = &H20
Private Type AVIFileInfo
dwMaxBytesPerSec As Long
dwFlags As Long
dwCaps As Long
dwStreams As Long
dwSuggestedBufferSize As Long
dwWidth As Long
dwHeight As Long
dwScale As Long
dwRate As Long
dwLength As Long
dwEditCount As Long
szFileType As String * 64
End Type
Private Declare Function AVIFileOpen Lib "avifil32" Alias "AVIFileOpenA" (ppfile As Long, ByVal szFile As String, ByVal mode As Long, pclsidHandler As Any) As Long
Private Declare Function AVIFileRelease Lib "avifil32" (ByVal pfile As Long) As Long
Private Declare Function AVIFileInfo Lib "avifil32" Alias "AVIFileInfoA" (ByVal pfile As Long, pfi As AVIFileInfo, ByVal lSize As Long) As Long
Private Declare Sub AVIFileInit Lib "avifil32" ()
Private Declare Sub AVIFileExit Lib "avifil32" ()
Private Sub Form_Load()
Dim hFile As Long
Dim AviInfo As AVIFileInfo
Dim buf As String
Dim ReturnCode As Long
'Here below you have to put the routine to retrieve the current played AVI file from BSplayer [ I know that you know how to do this :P ]
'.....
'.....
'.....
'In C++ is something like this:
'COPYDATASTRUCT cds;
'char buf[MAX_PATH];
'void *adr;
'
'adr=&buf;
'cds.dwData=BSP_GetFileName;
'cds.lpData=&adr;
'cds.cbData=4;
'SendMessage(bsp_hand,WM_COPYDATA,appHWND,(LPARAM)&cds);
'NOT NEEDED IN YOUR CODE (since you have retrieved the file name directly from BSplayer)
buf = "C:\TEST\TestFPS.avi"
'Initialize the AVIFile library
AVIFileInit
'Create a handle to the AVI file (which path and file name is stored in "buf")
ReturnCode = AVIFileOpen(hFile, buf, OF_SHARE_DENY_WRITE, ByVal 0&)
'If the AVI file has been opened correctly
If ReturnCode = 0 Then
'Retrieve the AVI information
If AVIFileInfo(hFile, AviInfo, Len(AviInfo)) = 0 Then
'Shows a Message Box with the AVI's FramePerSecond rate (rounded at the first 2 decimals)
MsgBox "AVI info: " & Round(AviInfo.dwRate / AviInfo.dwScale, 2) & "fps"
Else
MsgBox "Error while retrieving AVI information..."
End If
'Release the file handle
AVIFileRelease hFile
Else
MsgBox "Error while opening the AVI file..."
End If
'Exit the AVIFile library and decrement the reference count for the library
AVIFileExit
End Sub