1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0031501: Foundation Classes, Message_Printer - remove theToPutEndl argument -- use shortcuts

Message::DefaultMessenger()->Send() have been replaced by shortcuts Message::Send().
This commit is contained in:
kgv
2020-05-08 14:40:39 +03:00
committed by bugmaster
parent fa8a462827
commit a87b1b3738
33 changed files with 241 additions and 290 deletions

View File

@@ -548,8 +548,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
}
if ((aFIF == FIF_UNKNOWN) || !FreeImage_FIFSupportsReading (aFIF))
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image '") + theImagePath + "' has unsupported file format.",
Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image '") + theImagePath + "' has unsupported file format");
if (aFiMem != NULL)
{
FreeImage_CloseMemory (aFiMem);
@@ -586,10 +585,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
}
if (anImage == NULL)
{
TCollection_AsciiString aMessage = "Error: image file '";
aMessage.AssignCat (theImagePath);
aMessage.AssignCat ("' is missing or invalid.");
::Message::DefaultMessenger()->Send (aMessage, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image file '") + theImagePath + "' is missing or invalid");
return false;
}
@@ -620,8 +616,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
}
if (aFormat == Image_Format_UNKNOWN)
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image '") + theImagePath + "' has unsupported pixel format.",
Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image '") + theImagePath + "' has unsupported pixel format");
return false;
}
@@ -650,8 +645,7 @@ bool Image_AlienPixMap::Load (std::istream& theStream,
}
if ((aFIF == FIF_UNKNOWN) || !FreeImage_FIFSupportsReading (aFIF))
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image stream '") + theFileName + "' has unsupported file format.",
Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image stream '") + theFileName + "' has unsupported file format");
return false;
}
@@ -670,8 +664,7 @@ bool Image_AlienPixMap::Load (std::istream& theStream,
FIBITMAP* anImage = FreeImage_LoadFromHandle (aFIF, &aFiIO, &aStream, aLoadFlags);
if (anImage == NULL)
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image stream '") + theFileName + "' is missing or invalid.",
Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image stream '") + theFileName + "' is missing or invalid");
return false;
}
@@ -680,8 +673,7 @@ bool Image_AlienPixMap::Load (std::istream& theStream,
FreeImage_GetBPP (anImage));
if (aFormat == Image_Format_UNKNOWN)
{
::Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: image stream '") + theFileName + "' has unsupported pixel format.",
Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: image stream '") + theFileName + "' has unsupported pixel format");
return false;
}
@@ -705,7 +697,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
CoInitializeEx (NULL, COINIT_MULTITHREADED);
if (CoCreateInstance (CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&aWicImgFactory.ChangePtr())) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot initialize WIC Imaging Factory", Message_Fail);
Message::SendFail ("Error: cannot initialize WIC Imaging Factory");
return false;
}
@@ -716,12 +708,12 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
if (aWicImgFactory->CreateStream (&aWicStream.ChangePtr()) != S_OK
|| aWicStream->InitializeFromMemory ((BYTE* )theData, (DWORD )theLength) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot initialize WIC Stream", Message_Fail);
Message::SendFail ("Error: cannot initialize WIC Stream");
return false;
}
if (aWicImgFactory->CreateDecoderFromStream (aWicStream.get(), NULL, WICDecodeMetadataCacheOnDemand, &aWicDecoder.ChangePtr()) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot create WIC Image Decoder", Message_Fail);
Message::SendFail ("Error: cannot create WIC Image Decoder");
return false;
}
}
@@ -730,7 +722,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
const TCollection_ExtendedString aFileNameW (theFileName);
if (aWicImgFactory->CreateDecoderFromFilename (aFileNameW.ToWideString(), NULL, GENERIC_READ, WICDecodeMetadataCacheOnDemand, &aWicDecoder.ChangePtr()) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot create WIC Image Decoder", Message_Fail);
Message::SendFail ("Error: cannot create WIC Image Decoder");
return false;
}
}
@@ -744,7 +736,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
|| aWicFrameDecode->GetSize (&aFrameSizeX, &aFrameSizeY) != S_OK
|| aWicFrameDecode->GetPixelFormat (&aWicPixelFormat))
{
Message::DefaultMessenger()->Send ("Error: cannot get WIC Image Frame", Message_Fail);
Message::SendFail ("Error: cannot get WIC Image Frame");
return false;
}
@@ -756,7 +748,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
if (aWicImgFactory->CreateFormatConverter (&aWicConvertedFrame.ChangePtr()) != S_OK
|| aWicConvertedFrame->Initialize (aWicFrameDecode.get(), convertToWicFormat (aPixelFormat), WICBitmapDitherTypeNone, NULL, 0.0f, WICBitmapPaletteTypeCustom) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot convert WIC Image Frame to RGB format", Message_Fail);
Message::SendFail ("Error: cannot convert WIC Image Frame to RGB format");
return false;
}
aWicFrameDecode.Nullify();
@@ -764,7 +756,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
if (!Image_PixMap::InitTrash (aPixelFormat, aFrameSizeX, aFrameSizeY))
{
Message::DefaultMessenger()->Send ("Error: cannot initialize memory for image", Message_Fail);
Message::SendFail ("Error: cannot initialize memory for image");
return false;
}
@@ -775,7 +767,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
}
if (aWicSrc->CopyPixels (NULL, (UINT )SizeRowBytes(), (UINT )SizeBytes(), ChangeData()) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot copy pixels from WIC Image", Message_Fail);
Message::SendFail ("Error: cannot copy pixels from WIC Image");
return false;
}
SetTopDown (true);
@@ -793,14 +785,14 @@ bool Image_AlienPixMap::Load (std::istream& theStream,
theStream.seekg (aStart);
if (aLen <= 0)
{
Message::DefaultMessenger()->Send ("Error: empty stream", Message_Fail);
Message::SendFail ("Error: empty stream");
return false;
}
NCollection_Array1<Standard_Byte> aBuff (1, aLen);
if (!theStream.read ((char* )&aBuff.ChangeFirst(), aBuff.Size()))
{
Message::DefaultMessenger()->Send ("Error: unable to read stream", Message_Fail);
Message::SendFail ("Error: unable to read stream");
return false;
}
@@ -811,7 +803,7 @@ bool Image_AlienPixMap::Load (std::istream& ,
const TCollection_AsciiString& )
{
Clear();
Message::DefaultMessenger()->Send ("Error: no image library available", Message_Fail);
Message::SendFail ("Error: no image library available");
return false;
}
bool Image_AlienPixMap::Load (const Standard_Byte* ,
@@ -819,7 +811,7 @@ bool Image_AlienPixMap::Load (const Standard_Byte* ,
const TCollection_AsciiString& )
{
Clear();
Message::DefaultMessenger()->Send ("Error: no image library available", Message_Fail);
Message::SendFail ("Error: no image library available");
return false;
}
#endif
@@ -1059,7 +1051,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
if (aFileFormat == getNullGuid())
{
Message::DefaultMessenger()->Send ("Error: unsupported image format", Message_Fail);
Message::SendFail ("Error: unsupported image format");
return false;
}
@@ -1067,7 +1059,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
CoInitializeEx (NULL, COINIT_MULTITHREADED);
if (CoCreateInstance (CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&aWicImgFactory.ChangePtr())) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot initialize WIC Imaging Factory", Message_Fail);
Message::SendFail ("Error: cannot initialize WIC Imaging Factory");
return false;
}
@@ -1077,20 +1069,20 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
if (aWicImgFactory->CreateStream (&aWicFileStream.ChangePtr()) != S_OK
|| aWicFileStream->InitializeFromFilename (aFileNameW.ToWideString(), GENERIC_WRITE) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot create WIC File Stream", Message_Fail);
Message::SendFail ("Error: cannot create WIC File Stream");
return false;
}
if (aWicImgFactory->CreateEncoder (aFileFormat, NULL, &aWicEncoder.ChangePtr()) != S_OK
|| aWicEncoder->Initialize (aWicFileStream.get(), WICBitmapEncoderNoCache) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot create WIC Encoder", Message_Fail);
Message::SendFail ("Error: cannot create WIC Encoder");
return false;
}
const WICPixelFormatGUID aWicPixelFormat = convertToWicFormat (myImgFormat);
if (aWicPixelFormat == getNullGuid())
{
Message::DefaultMessenger()->Send ("Error: unsupported pixel format", Message_Fail);
Message::SendFail ("Error: unsupported pixel format");
return false;
}
@@ -1101,13 +1093,13 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
|| aWicFrameEncode->SetSize ((UINT )SizeX(), (UINT )SizeY()) != S_OK
|| aWicFrameEncode->SetPixelFormat (&aWicPixelFormatRes) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot create WIC Frame", Message_Fail);
Message::SendFail ("Error: cannot create WIC Frame");
return false;
}
if (aWicPixelFormatRes != aWicPixelFormat)
{
Message::DefaultMessenger()->Send ("Error: pixel format is unsupported by image format", Message_Fail);
Message::SendFail ("Error: pixel format is unsupported by image format");
return false;
}
@@ -1115,7 +1107,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
{
if (aWicFrameEncode->WritePixels ((UINT )SizeY(), (UINT )SizeRowBytes(), (UINT )SizeBytes(), (BYTE* )Data()) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot write pixels to WIC Frame", Message_Fail);
Message::SendFail ("Error: cannot write pixels to WIC Frame");
return false;
}
}
@@ -1125,7 +1117,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
{
if (aWicFrameEncode->WritePixels (1, (UINT )SizeRowBytes(), (UINT )SizeRowBytes(), (BYTE* )Row (aRow)) != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot write pixels to WIC Frame", Message_Fail);
Message::SendFail ("Error: cannot write pixels to WIC Frame");
return false;
}
}
@@ -1134,12 +1126,12 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
if (aWicFrameEncode->Commit() != S_OK
|| aWicEncoder->Commit() != S_OK)
{
Message::DefaultMessenger()->Send ("Error: cannot commit data to WIC Frame", Message_Fail);
Message::SendFail ("Error: cannot commit data to WIC Frame");
return false;
}
if (aWicFileStream->Commit (STGC_DEFAULT) != S_OK)
{
//Message::DefaultMessenger()->Send ("Error: cannot commit data to WIC File Stream", Message_Fail);
//Message::Send ("Error: cannot commit data to WIC File Stream", Message_Fail);
//return false;
}
return true;
@@ -1150,9 +1142,7 @@ bool Image_AlienPixMap::Save (const TCollection_AsciiString& theFileName)
{
return savePPM (theFileName);
}
#ifdef OCCT_DEBUG
std::cerr << "Image_PixMap, no image library available! Image saved in PPM format.\n";
#endif
Message::SendTrace ("Image_PixMap, no image library available! Image saved in PPM format");
return savePPM (theFileName);
#endif
}

View File

@@ -111,13 +111,13 @@ Standard_Boolean Image_Diff::Init (const Handle(Image_PixMap)& theImageRef,
|| theImageRef->SizeY() != theImageNew->SizeY()
|| theImageRef->Format() != theImageNew->Format())
{
Message::DefaultMessenger()->Send ("Error: Images have different format or dimensions", Message_Fail);
Message::SendFail ("Error: Images have different format or dimensions");
return Standard_False;
}
else if (theImageRef->SizeX() >= 0xFFFF
|| theImageRef->SizeY() >= 0xFFFF)
{
Message::DefaultMessenger()->Send ("Error: Images are too large", Message_Fail);
Message::SendFail ("Error: Images are too large");
return Standard_False;
}
@@ -144,7 +144,7 @@ Standard_Boolean Image_Diff::Init (const TCollection_AsciiString& theImgPathRef,
if (!anImgRef->Load (theImgPathRef)
|| !anImgNew->Load (theImgPathNew))
{
Message::DefaultMessenger()->Send ("Error: Failed to load image(s) file(s)", Message_Fail);
Message::SendFail ("Error: Failed to load image(s) file(s)");
return Standard_False;
}
return Init (anImgRef, anImgNew, theToBlackWhite);

View File

@@ -127,7 +127,7 @@ Handle(Image_PixMap) Image_Texture::loadImageBuffer (const Handle(NCollection_Bu
}
else if (theBuffer->Size() > (Standard_Size )IntegerLast())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image file size is too big '") + theId + "'.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image file size is too big '") + theId + "'");
return Handle(Image_PixMap)();
}
@@ -149,7 +149,7 @@ Handle(Image_PixMap) Image_Texture::loadImageOffset (const TCollection_AsciiStri
{
if (theLength > IntegerLast())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image file size is too big '") + thePath + "'.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image file size is too big '") + thePath + "'");
return Handle(Image_PixMap)();
}
@@ -157,13 +157,13 @@ Handle(Image_PixMap) Image_Texture::loadImageOffset (const TCollection_AsciiStri
OSD_OpenStream (aFile, thePath.ToCString(), std::ios::in | std::ios::binary);
if (!aFile)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image file '") + thePath + "' cannot be opened.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image file '") + thePath + "' cannot be opened");
return Handle(Image_PixMap)();
}
aFile.seekg ((std::streamoff )theOffset, std::ios_base::beg);
if (!aFile.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + thePath + "'.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + thePath + "'");
return Handle(Image_PixMap)();
}
@@ -193,7 +193,7 @@ TCollection_AsciiString Image_Texture::ProbeImageFileFormat() const
OSD_OpenStream (aFileIn, myImagePath.ToCString(), std::ios::in | std::ios::binary);
if (!aFileIn)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Unable to open file ") + myImagePath + "!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Unable to open file '") + myImagePath + "'");
return false;
}
if (myOffset >= 0)
@@ -201,14 +201,14 @@ TCollection_AsciiString Image_Texture::ProbeImageFileFormat() const
aFileIn.seekg ((std::streamoff )myOffset, std::ios_base::beg);
if (!aFileIn.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + myImagePath + "'.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + myImagePath + "'");
return false;
}
}
if (!aFileIn.read (aBuffer, THE_PROBE_SIZE))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: unable to read image file '") + myImagePath + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: unable to read image file '") + myImagePath + "'");
return false;
}
}
@@ -256,7 +256,7 @@ Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFi
OSD_OpenStream (aFileIn, myImagePath.ToCString(), std::ios::in | std::ios::binary);
if (!aFileIn)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Unable to open file ") + myImagePath + "!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Unable to open file ") + myImagePath + "!");
return Standard_False;
}
@@ -266,7 +266,7 @@ Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFi
aFileIn.seekg ((std::streamoff )myOffset, std::ios_base::beg);
if (!aFileIn.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + myImagePath + "'.", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Image is defined with invalid file offset '") + myImagePath + "'");
return Standard_False;
}
}
@@ -280,7 +280,7 @@ Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFi
aBuffer = new NCollection_Buffer (NCollection_BaseAllocator::CommonBaseAllocator(), aLen);
if (!aFileIn.read ((char* )aBuffer->ChangeData(), aBuffer->Size()))
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: unable to read image file '") + myImagePath + "'", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: unable to read image file '") + myImagePath + "'");
return Standard_False;
}
}
@@ -289,7 +289,7 @@ Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFi
OSD_OpenStream (aFileOut, theFile.ToCString(), std::ios::out | std::ios::binary | std::ios::trunc);
if (!aFileOut)
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Unable to create file ") + theFile + "!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Unable to create file '") + theFile + "'");
return Standard_False;
}
@@ -297,7 +297,7 @@ Standard_Boolean Image_Texture::WriteImage (const TCollection_AsciiString& theFi
aFileOut.close();
if (!aFileOut.good())
{
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: Unable to write file ") + theFile + "!", Message_Fail);
Message::SendFail (TCollection_AsciiString ("Error: Unable to write file '") + theFile + "'");
return Standard_False;
}
return Standard_True;

View File

@@ -178,7 +178,7 @@ Standard_Boolean Image_VideoRecorder::Open (const char* theFileName,
avformat_alloc_output_context2 (&myAVContext, NULL, theParams.Format.IsEmpty() ? NULL : theParams.Format.ToCString(), theFileName);
if (myAVContext == NULL)
{
::Message::DefaultMessenger()->Send ("ViewerTest_VideoRecorder, could not deduce output format from file extension", Message_Fail);
::Message::SendFail ("ViewerTest_VideoRecorder, could not deduce output format from file extension");
return Standard_False;
}
@@ -206,8 +206,7 @@ Standard_Boolean Image_VideoRecorder::Open (const char* theFileName,
const int aResAv = avio_open (&myAVContext->pb, theFileName, AVIO_FLAG_WRITE);
if (aResAv < 0)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: could not open '") + theFileName + "', " + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: could not open '") + theFileName + "', " + formatAvError (aResAv));
Close();
return Standard_False;
}
@@ -217,8 +216,7 @@ Standard_Boolean Image_VideoRecorder::Open (const char* theFileName,
const int aResAv = avformat_write_header (myAVContext, NULL);
if (aResAv < 0)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not open output file '") + theFileName + "', " + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not open output file '") + theFileName + "', " + formatAvError (aResAv));
Close();
return Standard_False;
}
@@ -254,8 +252,7 @@ Standard_Boolean Image_VideoRecorder::addVideoStream (const Image_VideoParams& t
}
if (myVideoCodec == NULL)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not find encoder for ") + aCodecName;
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not find encoder for ") + aCodecName);
return Standard_False;
}
@@ -263,8 +260,7 @@ Standard_Boolean Image_VideoRecorder::addVideoStream (const Image_VideoParams& t
myVideoStream = avformat_new_stream (myAVContext, myVideoCodec);
if (myVideoStream == NULL)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not allocate stream!");
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail ("Error: can not allocate stream");
return Standard_False;
}
myVideoStream->id = myAVContext->nb_streams - 1;
@@ -357,8 +353,7 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
const AVPixelFormat aPixFormat = av_get_pix_fmt (theParams.PixelFormat.ToCString());
if (aPixFormat == AV_PIX_FMT_NONE)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: unknown pixel format has been specified '") + theParams.PixelFormat + "'";
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: unknown pixel format has been specified '") + theParams.PixelFormat + "'");
return Standard_False;
}
@@ -378,8 +373,7 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
}
if (aResAv < 0)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not open video codec, ") + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not open video codec, ") + formatAvError (aResAv));
return Standard_False;
}
@@ -387,8 +381,7 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
myFrame = av_frame_alloc();
if (myFrame == NULL)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not allocate video frame!");
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail ("Error: can not allocate video frame");
return Standard_False;
}
@@ -399,9 +392,8 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
{
memset (myFrame->data, 0, sizeof(myFrame->data));
memset (myFrame->linesize, 0, sizeof(myFrame->linesize));
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not allocate picture ")
+ aCodecCtx->width+ "x" + aCodecCtx->height + ", " + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not allocate picture ")
+ aCodecCtx->width+ "x" + aCodecCtx->height + ", " + formatAvError (aResAv));
return Standard_False;
}
// copy data and linesize picture pointers to frame
@@ -412,9 +404,8 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
const Standard_Size aStride = aCodecCtx->width + 16 - (aCodecCtx->width % 16);
if (!myImgSrcRgba.InitZero (Image_PixMap::ImgRGBA, aCodecCtx->width, aCodecCtx->height, aStride))
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not allocate RGBA32 picture ")
+ aCodecCtx->width+ "x" + aCodecCtx->height;
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not allocate RGBA32 picture ")
+ aCodecCtx->width+ "x" + aCodecCtx->height);
return Standard_False;
}
@@ -423,8 +414,7 @@ Standard_Boolean Image_VideoRecorder::openVideoCodec (const Image_VideoParams& t
SWS_BICUBIC, NULL, NULL, NULL);
if (myScaleCtx == NULL)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not initialize the conversion context!");
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail ("Error: can not initialize the conversion context");
return Standard_False;
}
return Standard_True;
@@ -463,8 +453,7 @@ Standard_Boolean Image_VideoRecorder::writeVideoFrame (const Standard_Boolean th
aResAv = avcodec_encode_video2 (aCodecCtx, &aPacket, theToFlush ? NULL : myFrame, &isGotPacket);
if (aResAv < 0)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not encode video frame, ") + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not encode video frame, ") + formatAvError (aResAv));
return Standard_False;
}
@@ -490,8 +479,7 @@ Standard_Boolean Image_VideoRecorder::writeVideoFrame (const Standard_Boolean th
if (aResAv < 0)
{
const TCollection_AsciiString aMsg = TCollection_AsciiString ("Error: can not write video frame, ") + formatAvError (aResAv);
::Message::DefaultMessenger()->Send (aMsg, Message_Fail);
::Message::SendFail (TCollection_AsciiString ("Error: can not write video frame, ") + formatAvError (aResAv));
return Standard_False;
}