How encode image data to a descriptor, not file ? urgent!!!

Login to reply to this topic.
Wed, 2005-04-27 10:58
Joined: 2005-01-08
Forum posts: 14
Hi ,
I'm developing some AP about image manipulating .
Now some problem for your help .
I can encode image data into a file by create encoder by CImageEncoder::FileNewL(), but can't encode them into a descriptor ? Why ?
part code as following :

To a file is OK !!! ==============================================
void CImageConverterEngine::EncodeToFile( TFileName& aFileName, TUid aImageType, TUid aImageSubType)
{
delete iImageEncoder; iImageEncoder = NULL;

// create the encoder
iImageEncoder = CImageEncoder::FileNewL( iFs, aFileName,
CImageEncoder::EOptionNone, aImageType, aImageSubType );

iState = EEncoding;

iImageEncoder->Convert( &iStatus, *iBitmap );

SetActive();

}

===============================================

To a descriptor has some problem

*******************************************************
definition of some argument
//

HBufC8* iBufC8 = HBufC8::NewL(850);

//
void CImageConverterEngine::EncodeToDescriptor( HBufC8*& aBufferName, TUid aImageType, TUid aImageSubType)
{
delete iImageEncoder; iImageEncoder = NULL;

// create the encoder
iImageEncoder = CImageEncoder::DataNewL(aBufferName, CImageEncoder::EOptionNone, aImageType, aImageSubType );  // ap will exit when run here

iState = EEncoding;

TBmpImageData* imageDataBMP = new (ELeave) TBmpImageData;
imageDataBMP->iBitsPerPixel = 1;
CFrameImageData* iFrameImageDataBMP = CFrameImageData::NewL();
User::LeaveIfError(iFrameImageDataBMP->AppendImageData(imageDataBMP));

iImageEncoder->Convert( &iStatus, *iBitmap, iFrameImageDataBMP );

SetActive();

}
*********************************************************

Why my ap will exit when run at the
iImageEncoder = CImageEncoder::DataNewL(aBufferName, CImageEncoder::EOptionNone, aImageType, aImageSubType );

or maybe there is something wrong in the definition of
HBufC8* iBufC8 = HBufC8::NewL(850);

Thanks very much for your help . And looking for word to your reply deeply !!!

Howard

Wed, 2005-04-27 11:13
Joined: 2004-07-28
Forum posts: 1379
How encode image data to a descriptor, not file ? urgent!!!
Have to tried trapping the call to DataNewL to see what it's leaving with?

Maybe the output buffer isn't big enough?

didster

Wed, 2005-05-04 08:57
Joined: 2005-01-08
Forum posts: 14
To didster from howardchan about DataNewL()
Quote from: didster
Have to tried trapping the call to DataNewL to see what it's leaving with?

Maybe the output buffer isn't big enough?


Hi, didster,  thanks so much for your reply .
But as your  advice, I try to trap  the panic . But not any useful result . By the S60 SDK's Help, the API DataNewL(), it seem that it won't return any panic when certain error occur .
Could you give me some other effective advice ?
Thank you in advance .

Howard
Wed, 2005-05-04 09:30
Joined: 2004-07-28
Forum posts: 1379
How encode image data to a descriptor, not file ? urgent!!!
Panic??  You can't trap panics, only leaves.

If your app is panicing, the whats the panic code?  Does it show "Program closed, my app name"?

didster

Thu, 2005-05-05 03:46
Joined: 2005-01-08
Forum posts: 14
How encode image data to a descriptor, not file ? urgent!!!
Sorry , maybe my English isn't well. The panic I said now just means the leave I said last time .
Yes , as you said ,  my ap will leave with the notification "Progarmme closed  my ap name" .  Is this leave or panic ? Anyhow , the notification will appear and ap exit .
And I can't trap any useful data for my ap .
Really thanks deeply for your help , didster .

Howard[/url]
Fri, 2005-05-06 04:47
Joined: 2005-04-17
Forum posts: 12
That API properly working
I can surely say that The DataNewL() function propery working~

but i could not say how to solve that problem

, i just say one tip you should study base C++ about pointer

sorry, but i hope this tip and information helpful to you.
Mon, 2005-05-16 06:52
Joined: 2005-02-10
Forum posts: 27
Bitmap to Descriptor
Hey howardchan

                Even I have the same problem. I think the problem is with the buffer

                      HBufC8* iBufC8 = HBufC8::NewL(850);

  Plz let me know If you have solved this problem.

Thanks in advance
Tue, 2005-12-13 13:41
Joined: 2005-07-27
Forum posts: 8
Re: How encode image data to a descriptor, not file ? urgent!!!
Hi,
    I just meet this error today, and now I have solved it .
The error occurs the following code:
    HBufC8* iBufC8 = HBufC8::NewL(850);
   When I pay attention to the parameter HBufC8*& aBufferName of CImageEncoder::DataNewL function, it's a *& type. So the buffer will be allocated in the function of CImageEncoder::DataNewL , then assign the start address to the aBufferName, which is reference of income pointer. So, if use a pointer which is already point to memory space on the heap to the CImageEncoder::DataNewL  function, will lead to memory leak and the program will exit with panic.
    So, the solution is very simple, Just overwirte the following code:
   HBufC8* iBufC8 = HBufC8::NewL(850);
   to:
   HBufC8* iBufC8 = NULL;
   Thank OK!
Mon, 2006-09-18 04:58
Joined: 2006-02-21
Forum posts: 14
Re: How encode image data to a descriptor, not file ? urgent!!!
yeah i have the same problem too... i used the NULL pointer it's ok
but after i convert image using API function 'Convert'... the pointer is still NULL...
Fri, 2006-09-22 11:49
Joined: 2005-07-04
Forum posts: 59
Re: How encode image data to a descriptor, not file ? urgent!!!
What is the value of iStatus in RunL()?
  • Login to reply to this topic.