Re: Changing output buffer size in dsp plugin

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Jim Travis [ms] (jtravis_at_online.microsoft.com)
Date: 08/27/04


Date: Fri, 27 Aug 2004 09:54:07 -0700

ProcessOutput looks like this:

HRESULT ProcessOutput(
    DWORD dwFlags,
    DWORD cOutputBufferCount,
    DMO_OUTPUT_DATA_BUFFER* pOutputBuffers,
    DWORD* pdwStatus
);
You can change pOutputBuffers to point to whatever buffers you want. So you
should be able to allocate your own new buffer (IMediaBuffer), copy the data
into it, process it, and return the new buffer to ProcessOutput.

Refer to the DMO documentation for more info:

http://msdn.microsoft.com/library/en-us/dmo/htm/imediaobjectprocessoutput.asp

-- 
Jim Travis
Microsoft Corp.
Windows Media Player SDK
Download:
http://msdn.microsoft.com/library/default.asp?url=/downloads/list/winmedia.asp
Latest online:
http://msdn.microsoft.com/library/en-us/wmplay10/mmp_sdk/windowsmediaplayer10sdk.asp
Please do not send email directly to this alias as this alias is for
newsgroup purposes only. This posting is provided "AS IS" with no
warranties, and confers no rights. You assume all risk for your use. © 2004
Microsoft Corporation. All rights reserved.
"languy" <jn@online.stofanet.dk> wrote in message
news:OnpBQ00iEHA.1712@TK2MSFTNGP09.phx.gbl...
> Hi There,
>
> I have created a plugin which is able both to increase and decrease the
> speed of an audio sample. In addition to this it will have influenze of
the
> length of the buffer. I.e. if the speed is increased, then the stream will
> be shorter and opposite if the the speed is decreased the length of stream
> will be longer. If the speed is slowed down it will unfortunately have the
> side effect that the output buffer is overwritten - a buffer overrun -
> therefore I need to find a way to realloc this output stream so it matches
> the actual length of the stream.
>
> From the MSDN: "The Player allocates both an input buffer and an output
> buffer and gives the plug-in access to both buffers."
>
> What I can understand so far is that both buffers are allocated by the
> player before they reach the plugin, which makes it much more complicated
to
> perform a realloc on them because the plugin doesn't have full control of
> all pointers pointing to the buffers. I have already tried a couple of
ways
> but unfortunately not with a good result. I.e.:
>
> 1) performing the realloc in the DoProcessOutput
> 1.1) both by increasing the existing allocation (realloc) and
> destroying/freeing the old and allocating with the new larger size
> 2) deallocating and allocating in the AllocateStreamingResources
> 2.1) both by increasing the existing allocation (realloc) and
> destroying/freeing the old and allocating with the new larger size
> 2.2) when allocating, coping all properties from the old buffer into the
new
> allocated object
>
> Does any one know a way around this, so it is possible to realloc the
> buffers and prevent such a buffer overrun?
>
> Thanks in regards,
> Jess
>
>


Relevant Pages

  • Changing output buffer size in dsp plugin
    ... I have created a plugin which is able both to increase and decrease the ... length of the buffer. ... therefore I need to find a way to realloc this output stream so it matches ... deallocating and allocating in the AllocateStreamingResources ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Buffer or Realloc?
    ... better to allocate memory and realloc it for the size of the what is ... between deciding to use a fixed size buffer or allocating memory ...
    (comp.lang.c)
  • Re: [PATCHSET] printk: implement printk_header() and merging printk, take #3
    ... result TF isn't available and thus res printout is ... require allocating yest another temp buf and separating out res printing ... needed to allocate the buffer elsewhere than stack. ...
    (Linux-Kernel)
  • Re: String data input and storage
    ... As you can probably tell I dont have much coding practice, but I am trying to get there. ... saving some by not allocating memory that you will not be using. ... stdin kernel buffer into your process's buffer, ...
    (comp.lang.c)
  • Re: Interfacing with Comm32 Component
    ... and that may just lead into problems where it just keeps on reading along past the actual point of valid data. ... initial size of the buffer to the comm32 functions, report it as 1 less in size. ... It's important for Andy to realize that if he's going to try the technique below, it's _required_ that he be in charge of allocating the buffer. ... If you want to avoid the arithmetic, the type cast to an unrelated type, and the pointer-dereference, you could write it like this instead: ...
    (alt.comp.lang.borland-delphi)