Help with CAmrToPcmDecoder
| Wed, 2003-12-17 18:57 | |
|
Hi! I´m trying to use the "CAmrToPcmDecoder" class to convert an AMR stream into a PCM stream, for a audio streaming solution I am implementing. I read the amr, skip the first 6 bytes of the header. The data seems to be ok ( a call to FrameInfo returns data that seems to be ok in the TAmrFrameInfo parameter ). But... When I call the CAmrToPcmDecoder::Decode funtion, although the return value is 0 ( so, no error then?) , the aSrcUsed parameter ( the 2nd one ), returns with 0 or 1 , and the aDstLen with 320. The source pointer is more that 1KB ( in one test , it was almost 5 ), and the destbuffer, up to 50KB, so I guess it should have enough room for the data. Any help ? I´m getting a bit desperate, specially for the HUGE lack of documentation in this matter. Thanks a lot in advance, londo PS: eric, thank A LOT for your web page, it is really brilliant! -------------------------------------------------- |
|






Forum posts: 14
I am also trying to use CAmrToPcmDecoder to decode from voice from AMR to PCM format. But I am not able to hear anything after decoding the voice. There is also no proper documentation on this. Could anyone please help.
Thanks in advance,
Karen
// Use at own risk etc
// This API isn't well documented - I might have made a mistake in typing the below,
// made a mistake in working out what the parameters should have been or be barking
// up the wrong tree entirely. If your house falls down because of using this code
// don't blame me! However, I have had similar code working - so I think you should
// be okay ;)
// Need to link with amrdll.lib BTW
#include <amrcodec.h>
// PCM data (has to be 8000Hz, 16 Bit, mono)
byte *inputBuffer=blah;
// Length of data in input buffer
int inputBufferSize;
// Output buffer (AMR encoded)
byte *dest=User::Alloc(blah);
// Length of data written to output buffer
int outputBufferSize;
// Encoding parameters ...
TAmrEncParams encodeParams;
// Use defaults otherwise set the values below
// encodeParams.iMode=
// encodeParams.iDTX=
// Construct the encoder
CPcmToAmrEncoder *encoder=CPcmToAmrEncoder::NewL(encodeParams);
// Reset it (just in case we need to) - it not using default TAmrEncParams then
Reset(encodeParams)
encoder->Reset();
int inputUsed;
int outputUsed;
int inputOffset=0;
int outputOffset=0;
while(inputBufferSize>0) {
inputUsed=inputBufferSize;
outputUsed=outputBufferSize;
encoder->Encoder(inputBuffer+inputOffset,inputUsed,outputBuffer+outputOf
fset,outputUsed);
inputOffset+=inputUsed;
outputOffset+=outputUsed;
inputBufferSize-=inputUsed;
outputBufferSize-=outputUsed;
}
And the header for the file I was talking about before - it should be #!AMR\n (any unix hackers out there will now go "hey - cool". For non unix people out there - these menas that if your AMR playing program is in your path and called AMR then you can execute a AMR file and it will be automatically loaded into your player and played). The header for wide band AMR is #!AMR-WB\n
Forum posts: 3
I was looking for the amrcodec.h header on the uiq2.1 sdk, but it does not appear. Is it that it only works on series60 sdk or that the header was never supposed to be there in the s60 in the first place ?
So, s it possible, somehow, to have access to that class with uiq?
Help, please?
londo
--------------------------------------------------
"You will be assimilated.Resistance is futile"
However - I don't think it supported AMR in symbian 6.X - so Nokia put amrdll.dll in with series60. This is what you are currently using. This is available on 7650, 3650 and N-Gage.
Symbian 7, Series60v2 phones (like the Nokia 6600) don't have it - but they do have additional codecs in the MMF to support AMR
UIQv2.0 is Symbian 7 based - so you need to look at the MMF. Once you work out what's going on - it's not *that* much of a bloated waste of resources.
Forum posts: 26
I need to do PCM -> AMR converting and I use the Series60v2.
Does anyone know which classes I should use?
I found some examples on this forum but they use some classes that doesn't exist in Series60v2.
Thanks in advance,
Sasa
It is always nice to help out people that need help.
http://www.vegaitsourcing.rs
http://www.codeplex.com/aspnetlibrary
Forum posts: 2
Any help will be greatly appreciated. Whenever I figure this out I am going to post it here because *way too many people* seem to have gone through this, with very little help from the Nokia folks. I can't believe they don't have someone in here helping more. Pretty frustrating.
Thanks,
Edison Thomaz
Forum posts: 10