Re: ACM Convert - acmStreamOpen return 512
- From: "esselte" <vincent.vdb@xxxxxxxxx>
- Date: 6 Apr 2007 08:51:33 -0700
There are other easy ways of having the struct populated for you such as
using acmFormatSuggest(). Pass in the PCM struct and it will give you a
GSM struct out (with the appropriate flags and parameters of course).
The problem in this case however is probably your source PCM format. The
sample rate and BitsPerSample is likely invalid for conversion. I use
BitsPerSample = 16 and nSamplePerSec of 8000 and it works ok. The source
sample rate usually has to match the output sample rate, otherwise you can
do sample rate conversion first using the PCM ACM codec.
--http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
Thanks for your help.
I modified the code and just add acmMetrics(to calculate the size of
the new format no?) and acmFormatSuggest functions and change the PCM
struct.
'init dest for acmFormatSuggest
Dim gslDst As gsm610waveformat_tag
gslDst = New gsm610waveformat_tag
gslDst.wfx = New WAVEFORMATEX2
gslDst.wfx.wFormatTag = Wave.WAVEHDR.WAVE_FORMAT_GSM610
Dim retourMetrics As Integer
Dim ret As Integer = acmMetrics(0,
ACM_METRIC_MAX_SIZE_FORMAT, retourMetrics)
ret = acmFormatSuggest(hwnd, m_wfmt, gslDst.wfx,
retourMetrics, ACM_FORMATSUGGESTF_WFORMATTAG)
ret = acmStreamOpen(0, IntPtr.Zero, m_wfmt, gsm610.wfx,
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ACM_STREAMOPENF_QUERY) ...
....
<DllImport("coredll.dll")> _
Protected Shared Function acmFormatSuggest(ByRef has As
IntPtr, ByVal pwfxSrc As Wave.WAVEFORMATEX, ByVal pwfxDst As
WAVEFORMATEX, ByVal cbwfxDst As Integer, ByVal fdwSuggest As Integer)
As MMSYSERR
End Function
<DllImport("coredll.dll")> _
Protected Shared Function acmMetrics(ByRef hao As IntPtr,
ByVal uMetric As Integer, ByRef pMetric As Integer) As MMSYSERR
End Function
....
Is there something wrong? the function "acmMetrics" turns over a value
of 5. I think it's not normal... This value doesn't change after. I
saw that it's a INVALHANDLE error. But for "acmMetrics" I don't use
any handle.No?
I am lost...
.
- Follow-Ups:
- Re: ACM Convert - acmStreamOpen return 512
- From: Chris P.
- Re: ACM Convert - acmStreamOpen return 512
- References:
- Re: ACM Convert - acmStreamOpen return 512
- From: esselte
- Re: ACM Convert - acmStreamOpen return 512
- From: Chris P.
- Re: ACM Convert - acmStreamOpen return 512
- Prev by Date: Re: ACM Convert - acmStreamOpen return 512
- Next by Date: Re: ACM Convert - acmStreamOpen return 512
- Previous by thread: Re: ACM Convert - acmStreamOpen return 512
- Next by thread: Re: ACM Convert - acmStreamOpen return 512
- Index(es):
Relevant Pages
|