Size limits on IWMWriter::WriteSample ?
- From: Dan <Dan@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 23 Jun 2005 15:20:01 -0700
Hi,
I am writting an application that encodes PCM wavedata into WMA using the
Windows Media Series 9 SDK.
I have created a Writer object, a Profile (using the ProfileManager, and
building a profile from the stream information from the codec that mostly
closely matches the format of my input wavefile), set up the input, and
created a WriterFileSink.
So far so good ... however, when I use the following code ...
where m_SampleInfo.ulByteLength is the length in bytes of the PCM data and
pSampleData points to the sample data.
if (SUCCEEDED(g_pWriter->BeginWriting()))
{
INSSBuffer *pBuffer = NULL;
if (SUCCEEDED(g_pWriter->AllocateSample(m_SampleInfo.ulByteLength,
&pBuffer)))
{
BYTE *pData = NULL;
if (SUCCEEDED(pBuffer->GetBuffer(&pData)))
{
if (pData)
{
memcpy(pData, pSampleData, m_SampleInfo.ulByteLength);
if (SUCCEEDED(pBuffer->SetLength(m_SampleInfo.ulByteLength)))
{
if (SUCCEEDED(g_pWriter->WriteSample(0, 0, 0, pBuffer)))
{
HRESULT hr;
if (FAILED(hr = g_pWriter->EndWriting()))
printf("Failed to EndWriting (%X)\n", hr);
}
}
}
}
}
}
EndWriting always fails (with 0xC00D0BC3 which is NS_E_AUDIO_CODEC_ERROR).
The sample I'm using is 573300 bytes in length, it is 16bit mono 22KHz and
I'm using the "20kbps, 22Khz, Mono CBR" codec format. If I change
m_SampleInfo.ulByteLength to 500000 I don't get any errors - just a WMA file
that is missing the end of the sample data.
So, are there limits of how much data should be passed to WriteSample in one
call? If so, how can I determine what the limit is ? Is this specific to
the codec, the codec format, the output format, the input format, or
something else ?
Thanks for any help you can give me.
Dan
.
- Follow-Ups:
- Re: Size limits on IWMWriter::WriteSample ?
- From: sasha
- Re: Size limits on IWMWriter::WriteSample ?
- Prev by Date: How to Add Script stream to WM File, Please HELP
- Next by Date: Re: Size limits on IWMWriter::WriteSample ?
- Previous by thread: How to Add Script stream to WM File, Please HELP
- Next by thread: Re: Size limits on IWMWriter::WriteSample ?
- Index(es):
Relevant Pages
|