2

I am implementing a DirectShow filter that does simple audio mixing between multiple input pins and delivers the merged data to singular output pin (many-to-one). I've got the audio data mixing figured out, but I'd like some opinions on what to do with non-media data stream messages. For example, given the code below taken from the DSPACK DirectShow component library I have modified and am using with my Delphi 6 app:

var
  Props: PAMSample2Properties;
  OutSample: IMediaSample;
begin
  Assert(Assigned(inputPin));

  //  Check for other streams and pass them on
  // Props := FInput.SampleProps;
  Props := inputPin.SampleProps;

  if(Props.dwStreamId <> AM_STREAM_MEDIA) then
  begin
    // ATI: Currently, any stream notices that come in that aren't
    //  regular stream media data notices are immediately passed
    //  through to the output pin.  Is this behavior OK for my multi-pin filter?
    result := FOutput.FInputPin.Receive(Sample);
    exit;
  end;

  ...

As you can see, currently I am passing on any input pin deliveries that are not stream media data messages immediately on to the output pin. This is in contrast to what I do when I receive audio data which I hold until all input pins have delivered their next audio data buffer, mixing that audio data and then making a single Receive call to my sole output pin. My questions are:

  1. What are the repercussions of batching input pin deliveries when handling audio data receipts, but immediately passing them on for the non-media data receipts? A list of such messages can be found this MSDN document:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd373500(v=vs.85).aspx

  1. Will downstream filters get confused or be corrupted by this approach? If so, what technique should I adopt to arbitrate non-stream media data receipts across the input pins currently connected to my filter that mixes audio data?
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227

0 Answers0