Re: AVIStreamRead Fails
- From: "Kyle Katarn" <kyle.katarn@xxxxxxxxxxxxxxx>
- Date: Wed, 28 Mar 2007 19:49:36 +0200
Help !
"Kyle Katarn" <kyle.katarn@xxxxxxxxxxxxxxx> a écrit dans le message de news:
45f1c741$0$29896$426a74cc@xxxxxxxxxxxxxxx
I've reduced the problem to this small function. It calls these
successfully:
AVIFileInit();
AVIFileOpen( &aviFile, fname, OF_READ | OF_SHARE_DENY_NONE, NULL );
AVIFileGetStream( aviFile, &audioStream, streamtypeAUDIO, 0 );
Then it calls
AVIStreamRead(audioStream, 0, AVISTREAMREAD_CONVENIENT, NULL, 0, &n,
NULL);
and fails with the mysterious AVIERR_ERROR. I can play the video fine, and
other
players will play the video and audio. I'm only having problems getting
the
audio
data. I hope someone knows why AVIStreamRead() is failing.
/*******************************************************************************
tries to read the audio data from a .avi file
*******************************************************************************/
void OpenAVI2(char *fname) {
unsigned char *buf;
long n;
int status;
memset(&audioInfo, 0, sizeof(AVISTREAMINFO) );
aviFile = 0;
AVIFileInit();
status = AVIFileOpen( &aviFile, fname, OF_READ | OF_SHARE_DENY_NONE,
NULL );
assert(status==0);
status = AVIFileInfo(aviFile, &fi, sizeof(AVIFILEINFO));
assert(status==0);
status = AVIFileGetStream( aviFile, &audioStream, streamtypeAUDIO, 0 );
assert(status==0);
status = AVIStreamInfo( audioStream, &audioInfo,
sizeof(AVISTREAMINFO) );
assert(status==0);
audioStreamStart = AVIStreamStart(audioStream); // 0
audioStreamEnd = AVIStreamEnd(audioStream); // 226062
status = AVIStreamReadFormat(audioStream, audioStreamStart, NULL, &n);
// n = 30
assert(status==0);
achunk = new BYTE[n];
status = AVIStreamReadFormat(audioStream, audioStreamStart, achunk, &n);
assert(status==0);
audioFormat = (LPWAVEFORMAT)achunk;
AVIStreamFormatSize(audioStream, 0, &n); // returns n = 30
status = AVIStreamRead(audioStream, 0, AVISTREAMREAD_CONVENIENT, NULL,
0,
&n, NULL);
switch(status) {
case 0: // ok
bp = 0;
break;
case AVIERR_BUFFERTOOSMALL:
bp = 1;
break;
case AVIERR_MEMORY:
bp = 2;
break;
case AVIERR_FILEREAD:
bp = 3;
break;
case AVIERR_ERROR:
bp = 4; // <<<<<<<<<<<<<<<<<<<<<< GETS HERE
break;
default:
bp = 5;
break;
}
return;
}
.
- References:
- VfW : AVIStreamRead Fails
- From: Kyle Katarn
- VfW : AVIStreamRead Fails
- Prev by Date: Re: NTDLL issue
- Next by Date: Request: MixList.EXE reports
- Previous by thread: Re: AVIStreamRead Fails
- Next by thread: Re: multimedia message between gsm mobile phones
- Index(es):
Relevant Pages
|
Loading