AVI 동영상을 만드는 Delphi 6 응용 프로그램이 있습니다. 압축되지 않은 비디오 프레임이있는 AVI 파일을 쓸 수 있다는 점에 이르렀습니다.AVIStreamSetFormat() 호출 중에 AVIERR_MEMORY 오류가 발생합니다.
hr := AVIStreamSetFormat(
FAvi_.thePsCompressed,
0,
@dsBmih,
dsBmih.biSize + dsBmih.biClrUsed * sizeof(RGBQUAD));
가 왜이 오류가 무엇입니까 나는 그것을 해결하기 위해 무엇을 할 수 : I 압축 된 비디오 스트림을 만들려고 할 때 나는 AVIStreamSetFormat()를 호출 할 때 나는 AVIERR_MEMORY 오류가? I 반경 압축기로 된 Cinepak 코드를 선택한 후
여기 AVISaveOptions 호출을 사용하여 압축 옵션 데이터 구조의 내용이다(). 나는 다른 압축기를 선택하면 난 아직도 오류 얻을 , 참고 : AVIStreamSetFormat에 대한 호출을 포함하는 방법 여기
biSize: 40
biWidth: 320
biHeight: -240
biPlanes: 1
biBitcount: 32
biCompression: 0
biSizeImage: 307200
biXPelsPerMeter: 0
biYPelsPerMeter: 0
biClrUsed: 0
biClrImportant: 0
됩니다 : 여기
fccType: 0
fccHandler: 1684633187
dwKeyFrameEvery: 0
dwQuality: 8800
dwBytesPerSecond: 0
dwFlags: 8
lpFormat: nil
cbFormat: 0
lpParms: nil
cbParms: 4
dwInterleaveEvery: 0
하면 TBitmapHeaderInfo 데이터 구조의 내용입니다() :
function TAviWriterWithCompression.compressionDirect(
opts: PAVICOMPRESSOPTIONS;
bShowDialog: boolean;
hparent: HWND;
dsBmih: TBitmapInfoHeader;
sizeImage: integer;
DIBValues: Pointer;
framesPerSecond: integer): HRESULT;
var
lastErr: string;
hr: HRESULT;
myopts: TAVICOMPRESSOPTIONS;
aopts: array[0..0] of PAVICOMPRESSOPTIONS;
res: Bool;
begin
if not FIsVirginFile then
begin
// The output file already has at least one audio or video frame so
// setting or changing the compression format is not allowed.
Result := LongInt(AVIERR_ERROR);
// =========================== EXIT POINT ==============
exit;
end; // if not Assigned(FAvi_) then
if not Assigned(FAvi_) then
begin
Result := LongInt(AVIERR_BADHANDLE);
// =========================== EXIT POINT ==============
exit;
end; // if not Assigned(FAvi_) then
// Check the utility object for an error.
if (FAvi_.iserr) then
begin
Result := LongInt(AVIERR_ERROR);
// =========================== EXIT POINT ==============
exit;
end; // if (FAvi_.iserr) then
// Make sure the compressor has not already been selected.
if Assigned(FAvi_.thePsCompressed) then
begin
Result := LongInt(AVIERR_COMPRESSOR);
// =========================== EXIT POINT ==============
exit;
end; // if (FAvi_.iserr) then
// create the stream, if it wasn't there before
if not Assigned(FAvi_.thePs) then
begin
hr := createVideoStream(dsBmih, framesPerSecond);
if hr <> AVIERR_OK then
begin
Result := hr;
// Set the error flag in our utility object.
FAvi_.iserr := true;
// =========================== EXIT POINT ==============
exit;
end; // if hr <> AVIERR_OK then
end; // if not Assigned(FAvi_.thePs) then
// set the compression, prompting dialog if necessary
if not Assigned(FAvi_.thePsCompressed) then
begin
ZeroMemory(@myopts, sizeof(myopts));
if Assigned(opts) then
// Use the provided compressor options
aopts[0] := opts
else
// Use our initialized (empty) variable.
aopts[0] := @myopts;
// Does the caller want to show the compressor dialog box?
if (bShowDialog) then
begin
res := AVISaveOptions(hparent, 0, 1, FAvi_.thePs, aopts[0]);
if not res then
begin
AVISaveOptionsFree(1, aopts[0]);
// Set the error flag.
FAvi_.iserr := true;
Result := LongInt(AVIERR_USERABORT);
// =========================== EXIT POINT ==============
exit;
end; // if res = 0 then
end; // if (bShowDialog) then
hr := AVIMakeCompressedStream(FAvi_.thePsCompressed, FAvi_.thePs, aopts[0], nil);
if hr <> AVIERR_OK then
begin
Result := hr;
// Set the error flag in our utility object.
FAvi_.iserr := true;
// =========================== EXIT POINT ==============
exit;
end; // if hr <> AVIERR_OK then
AVISaveOptionsFree(1, aopts[0]);
postDiagMsg('Avi::compression after AVISaveOptionsFree()');
// >>>> This is where I get the AVIERR_MEMORY error.
hr := AVIStreamSetFormat(FAvi_.thePsCompressed, 0, @dsBmih, dsBmih.biSize + dsBmih.biClrUsed * sizeof(RGBQUAD));
if hr <> AVIERR_OK then
begin
Result := hr;
// Set the error flag in our utility object.
FAvi_.iserr := true;
// =========================== EXIT POINT ==============
exit;
end; // if hr <> AVIERR_OK then
end; // if not Assigned(FAvi_.thePsCompressed) then
Result := AVIERR_OK;
end;