Size limits on IWMWriter::WriteSample ?



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

.



Relevant Pages

  • Re: Splitting and comparing file names
    ... with the general format would really be much preferred... ... sample data would be nice. ... You have a case of premature declaration. ...
    (perl.beginners)
  • Re: Cant read PapaJohns PRX file
    ... I expected to see a big difference between the MM2 default profile which has ... reading I thought the DV-AVI format was going to knock my socks off. ... fact that they look similar in Media Player 10 because it displays in the ...
    (microsoft.public.windowsxp.moviemaker)
  • Re: hash key not found .. WHY NOT?
    ... filea.csv format: ... Where file1.csv is using BK=AK to lookup A3 and A4. ... Not a word of this makes sense nor matches your sample data. ... Please show REAL sample input and REAL sample output. ...
    (perl.beginners)
  • RE: Nobody can answer! Problem with commas and dots
    ... cases of your sample data. ... running my code on string format numbers still works. ... The Replacefunction can change commas to dots, ...
    (microsoft.public.excel.programming)
  • *.dat, pro, sig, rd2, prf, sdf Dateien gesucht
    ... diese Software testen, habe aber keine Dateien, die das Programm ... Dateiformate unterstützt werden: ... Ambios Technologies 2D Profile: *.dat ... Digital Surf Profile Format: *.pro ...
    (de.sci.misc)