Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

what's diffirence between IMediaBuffer and INSSBuffer

18 views
Skip to first unread message

Dream sdk

unread,
Oct 28, 2009, 2:28:14 AM10/28/09
to
use Windows Media Format SDK ,I can read a wmv file
in OnSample method get INSSBuffer data

windows media player dsp plug in,wmp open same wmv file

in ProcessInput I get a IMediaBuffer data

but the data pwszType is diffirence when i use
pSample->GetBufferAndLength( (BYTE **)&pwszType,
&dwBufferLength );

why?
how can i translate they each other?

Alessandro Angeli

unread,
Oct 29, 2009, 1:15:35 PM10/29/09
to
From: "Dream sdk"

INSSBuffer and IMediaBuffer are 2 different objects to
(mostly) accomplish the same task, the first one used by WMF
and the latter by DMOs (WMP plugins are DMOs). If you use
DirectShow or MediaFoundation, you'll discover that DS has
IMediaSample and MF has IMFSample.

Unless you are the one allocating the bufferes (and you are
not), there is no "translating" between one buffer object to
the other. Simply copy the contents of the buffer from one
to the other.


INSSBuffer* pSource;
IMediaBuffer* pTarget;
LPBYTE pbSource, pbTarget;
DWORD cbSource, cbTarget;

pSource->GetBufferAndLength(&pbSource,&cbSource);
/// You MUST call SetLength() BEFORE performing CopyMemory()
/// because SetLength() will check if cbSource fits
/// in the target buffer and return an error otherwise
pTarget->SetLength(cbSource);
pTarget->GetBufferAndLength(&pbTarget,NULL);
CopyMemory(pbTarget,pbSource,cbSource);

You should of course check the errors returned by each
method or you might end up crashing the application if, for
example, SetLength() fails and you ignore it.


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


Dream sdk

unread,
Oct 30, 2009, 11:17:37 PM10/30/09
to
Thank you for your reply!

the pbTarget and pbSource is same After CopyMemory
(pbTarget,pbSource,cbSource);

I create a application like the wmsdk sample wmcopy.exe and a wmp dsp
plugin
My question is why the data is difference in wmcopy.exe
IWMReaderCallback OnSample(INSSBuffer * pSample) and the dsp plugin
ProcessInput(MediaBuffer *pBuffer) when they open same .wmv file?

Can I encrypt the .wmv data in wmcopy onsample and decrypt in dsp
plugin ProcessInput ?

Alessandro Angeli

unread,
Oct 31, 2009, 10:36:20 PM10/31/09
to
From: "Dream sdk"

> I create a application like the wmsdk sample wmcopy.exe
> and a wmp dsp plugin
> My question is why the data is difference in wmcopy.exe
> IWMReaderCallback OnSample(INSSBuffer * pSample) and the
> dsp plugin ProcessInput(MediaBuffer *pBuffer) when they
> open same .wmv file?

Are you comparing the exact same audio or video frame?

Is the WMReader's output media type the same as the DSP's
input media type?

What is this media type?

Notice that most decoders can choose to perform less
postprocessing dynamically, which results in slightly
different outputs.

> Can I encrypt the .wmv data in wmcopy onsample and
> decrypt in dsp plugin ProcessInput ?

Not in the general case.

0 new messages