Author Topic: Solving the Blitters Problems with AVI Recording in FBA [WIP]  (Read 4971 times)

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Solving the Blitters Problems with AVI Recording in FBA [WIP]
« on: January 27, 2007, 02:56:35 AM »
Hi all! ^^ I was trying to make a solution for the strange blitter problem when Recording AVI with FBA Plus! build...

My fix to the Recording not being activated for some strange reason is...

* When the user click Record AVI :
- Check if the Blitter is not the Basic
- If is not then change it to Basic Blitter, Init Video and Redraw Video
- Now go to the AviStart() function stuff that brings the Codecs Dialog and continue Recording / Playing with the Basic Blitter without a problem

- If the Blitter is the Basic nothing special is gonna happen just gonna jump to the AviStart() function and continue Recording

I did some research in the MSDN about the AVIFileOpen() function found in the 'avi.cpp'... and i did some editing that fixed some issues when creating/opening the avi file (crashing a lot X__X), and I commented some file pointer stuff...

here is the new 'avi.cpp' code that i edited...

Code: [Select]
// Code not needed to truncate the file to zero because AVIFileOpen have OF_PARSE for this
/*
{
FILE *pFile = NULL;
pFile = fopen(szFilePath, "wb");
if (pFile) {
fclose(pFile);
}
pFile = NULL;
}
*/

// Use AVIFileOpen() instead of AVIFileOpenA()
hRet = AVIFileOpen(
&FBAvi.pFile, // returned file pointer
szFilePath, // file path
OF_CREATE | OF_READWRITE | OF_PARSE /*| OF_SHARE_EXCLUSIVE*/, // mode
NULL); // use handler determined from file extension

thats it... and the code im using for the 'scrn.cpp' is this...

Code: [Select]
case MENU_AVISTART:

// If the Basic Blitter is not active then...
if (nVidSelect != 0)
{
VidSelect(0); // ...change it to Basic Blitter...
VidInit();
VidRedraw();

// ...start the Avi Record function...
if ( AviStart() ) {
AviStop();
}

}
else
{
// Normal Avi capture with Basic Blitter (Seems to have no problem)
if ( AviStart() ) {
AviStop();
}
POST_INITIALISE_MESSAGE;
}
VidSNewShortMsg(FBALoadStringEx(hAppInst, IDS_REC_AVI, true), 0x0000FF);
break;

sorry if im not explaining much but i will do a 'How To..' later in the Tips and Tricks Topic if i solve some other new problems...

I need help with this other code that unlike the other this one remember if you was using a Blitter like DX9 Experimental and sets it back when recording AVI was succesfully started, ...but FBA crash T___T (dont know why)...

Code: [Select]
int tmpVidSelect; // temporary global variable for use later
Code: [Select]
case MENU_AVISTART:

// If the Basic Blitter is not active then...
if (nVidSelect != 0)
{
tmpVidSelect = nVidSelect; // Remember my current Blitter

VidSelect(0); // ...change it to Basic Blitter...
VidInit();
VidRedraw();

// ...start the Avi Record function...
if ( AviStart() ) {
AviStop();
}

VidSelect(tmpVidSelect); // Get my Blitter back now that im recording
nVidSelect = tmpVidSelect; // Set this back to how it was too
tmpVidSelect = NULL; // Clean the temporary global variable
VidInit();
VidRedraw();
}
else
{
// Normal Avi capture with Basic Blitter (Seems to have no problem)
if ( AviStart() ) {
AviStop();
}
POST_INITIALISE_MESSAGE;
}
VidSNewShortMsg(FBALoadStringEx(hAppInst, IDS_REC_AVI, true), 0x0000FF);
break;

If something cant be understood please tell me so i explain it on other way ^^U hehe

ThanX in advance for the help with this stuff   :wink:

SeeYaa!!
 :biggrin: