Resampler Transform

Nov 30, 2012 at 9:43 AM

hello,
(between two business trips) I created a class ResamplerTransform(based on dmo.resamplermediaobject)
I wonder if this basis is correct

/// <summary>
	/// From wmcodecsdp.h
	/// Implements:
	/// - IMediaObject 
	/// - IMFTransform (Media foundation - we will leave this for now as there is loads of MF stuff)
	/// - IPropertyStore 
	/// - IWMResamplerProps 
	/// Can resample PCM or IEEE
	/// </summary>
	[ComImport, Guid("f447b69e-1884-4a7e-8055-346f74d6edb3")]
	class CLSID_CResamplerMediaObject
	{
		// SAME DMO ResamplerMediaObjects, but rename :-)
	}

	/// <summary>
	/// Resampler (base Dmo.ResamplerMediaObjects)
	/// </summary>
	public class ResamplerTranform : IDisposable
	{
		/*
		 * 
		 * TODO implante channelConversionMatrix
		 * TODO implante Quality properties ????
		 * 
		 */

		NAudio.Dmo.IWMResamplerProps resamplerPropsInterface;
		IMFTransform resamplerTransformInterface;

		CLSID_CResamplerMediaObject mediaComObject;


		public ResamplerTranform()
			: this(60)
		{
		}

		/// <summary>
		/// Creates a new Resampler based on the DMO Resampler
		/// </summary>
		public ResamplerTranform(int outputQuality)
		{
			
			mediaComObject = new CLSID_CResamplerMediaObject();

			resamplerPropsInterface = (NAudio.Dmo.IWMResamplerProps)mediaComObject;

			// Quality
			resamplerPropsInterface.SetHalfFilterLength(outputQuality);

			// Channels
		//	resamplerPropsInterface.SetUserChannelMtx(channelConversionMatrix);

			resamplerTransformInterface = (IMFTransform)mediaComObject;

		}

		public IMFTransform Transform
		{
			get { return resamplerTransformInterface; }
		}

		public NAudio.Dmo.IWMResamplerProps ResamplerProps
		{
			get { return resamplerPropsInterface; }
		}

		

		#region IDisposable Members

		
		public void Dispose()
		{
			if (resamplerPropsInterface != null)
			{
				Marshal.ReleaseComObject(resamplerPropsInterface);
				resamplerPropsInterface = null;
			}
			if (resamplerTransformInterface != null)
			{
				Marshal.ReleaseComObject(resamplerTransformInterface);
				resamplerTransformInterface = null;
			}
			if (mediaComObject != null)
			{
				Marshal.ReleaseComObject(mediaComObject);
				mediaComObject = null;
			}
		}

		#endregion
	}

Coordinator
Nov 30, 2012 at 10:19 AM

Yes, this is very similar to how we do it for DMO (although I didn't know there was quality property). The main challenge is learning how to use the IMediaTransform interface to efficiently pass byte arrays in and out, and also getting it to flush its buffers on a reposition.

On a different note, I got encoding to AAC from a byte array working last night, and some of your interop definitions proved very helpful so thanks very much.

Mark

Nov 30, 2012 at 10:33 AM

I still continued my example (http://code.google.com/p/bitspersampleconv2/wiki/HowToUseResamplerMFT) integrated Mediafoundationreader the moment and to learn.

I saw your approach Encoder and use of buffers, I think it will be very useful for my procedure.

 

Incidentally I found a book for you

http://books.google.fr/books?id=w4EkIF_O7F8C&pg=PT507&lpg=PT507&dq=f447b69e-1884-4a7e-8055-346f74d6edb3&source=bl&ots=pOpwYyqMGZ&sig=RYVpx1puLD0S8X9cOCE6qx8dm0M&hl=fr&sa=X&ei=RIi4UJ6pK4WRhQeqrIDYDw&ved=0CFsQ6AEwBg

can be a gift idea for Christmas;-) ok this is not funny :-)

Nov 30, 2012 at 2:46 PM
Edited Nov 30, 2012 at 2:56 PM

So, I need your help.

I created this procedure from a c + + example
I came across an error (HResult): The calledno longer accept additional input. (HR =  0xC00D35B5 )
You know of this error?

 

IMFSourceReader retSourceReader = null;
int hr = 0;

// ADD Constant
Guid  MF_MT_ALL_SAMPLES_INDEPENDENT = new Guid("c9173739-5e56-461c-b713-46fb995cb95f");

// see MFErreur
const int MF_E_TRANSFORM_NEED_MORE_INPUT = unchecked((int)0xC00D6D72);

// FOR TEST HERE :: Audio Format Output (todo properties)
WaveFormat wfOutput = new WaveFormat(44100, 2);
			
	/* 1 Initialization */
			
MediaFoundationInterop.MFStartup(MediaFoundationInterop.MF_VERSION);

	/* 2. Create Resampler MFT Object
		CComPtr<IUnknown> spTransformUnk;
		IMFTransform *pTransform = NULL; //< this is Resampler MFT

		hr = CoCreateInstance(CLSID_CResamplerMediaObject, NULL, CLSCTX_INPROC_SERVER,
							IID_IUnknown, (void**)&spTransformUnk);

			
			*/
			
CLSID_CResamplerMediaObject mediaComObject;
mediaComObject = new CLSID_CResamplerMediaObject();

//hr = spTransformUnk->QueryInterface(IID_PPV_ARGS(&pTransform));
IMFTransform pTransform = null;
pTransform = (IMFTransform)mediaComObject; //rsampler.Transform;


	/* 3. Specify input/output PCM format to Resampler MFT */

IMFMediaType mediaType = null;

// Create MediaType
MediaFoundationInterop.MFCreateMediaType(out mediaType);

// hr = pMediaType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio));
mediaType.SetGUID(MediaFoundationAttributes.MF_MT_MAJOR_TYPE, NAudio.MediaFoundation.MediaTypes.MFMediaType_Audio);

// hr = pMediaType->SetGUID(MF_MT_SUBTYPE,   (fmt.sampleFormat == MyBitFormatInt) ? MFAudioFormat_PCM : MFAudioFormat_Float);
if (wfOutput.Encoding == WaveFormatEncoding.Pcm)
	mediaType.SetGUID(MediaFoundationAttributes.MF_MT_SUBTYPE, AudioSubtypes.MFAudioFormat_PCM);
else
	mediaType.SetGUID(MediaFoundationAttributes.MF_MT_SUBTYPE, AudioSubtypes.MFAudioFormat_Float);

// hr = pMediaType->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS,         fmt.nChannels);
mediaType.SetUINT32(MediaFoundationAttributes.MF_MT_AUDIO_NUM_CHANNELS, wfOutput.Channels);

// hr = pMediaType->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND,   fmt.sampleRate);
mediaType.SetUINT32(MediaFoundationAttributes.MF_MT_AUDIO_SAMPLES_PER_SECOND, wfOutput.SampleRate);

// hr = pMediaType->SetUINT32(MF_MT_AUDIO_BLOCK_ALIGNMENT,      fmt.FrameBytes());
mediaType.SetUINT32(MediaFoundationAttributes.MF_MT_AUDIO_BLOCK_ALIGNMENT, wfOutput.BlockAlign);

// hr = pMediaType->SetUINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, fmt.BytesPerSec());
mediaType.SetUINT32(MediaFoundationAttributes.MF_MT_AUDIO_AVG_BYTES_PER_SECOND, wfOutput.AverageBytesPerSecond);

// hr = pMediaType->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE,      fmt.bits);
//mediaType.SetUINT32(MediaFoundationInterop.MF_MT_AUDIO_BITS_PER_SAMPLE, wfOutput.BitsPerSample);

// hr = pMediaType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT,    TRUE);
mediaType.SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, -1);

/* 
* if (0 != fmt.dwChannelMask) {
* hr = pMediaType->SetUINT32(MF_MT_AUDIO_CHANNEL_MASK, fmt.dwChannelMask);
* }
*/

if (wfOutput.Encoding == WaveFormatEncoding.Pcm)
{
	/*	if (fmt.bits != fmt.validBitsPerSample) {
		hr = pMediaType->SetUINT32(MF_MT_AUDIO_VALID_BITS_PER_SAMPLE, fmt.validBitsPerSample);
		}
	 */
	mediaType.SetUINT32(MediaFoundationAttributes.MF_MT_AUDIO_BITS_PER_SAMPLE, wfOutput.BitsPerSample);

}

// pTransform->SetInputType(0, spOutputType, 0);
pTransform.SetInputType(0, mediaType, 0);

		

	/* 4. Send stream start message to Resampler MFT */

//	hr = pTransform->ProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, NULL);
pTransform.ProcessMessage(MFT_MESSAGE_TYPE.MFT_MESSAGE_COMMAND_FLUSH, IntPtr.Zero);

//	hr = pTransform->ProcessMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, NULL);
// Erreur ????????????
//pTransform.ProcessMessage(MFT_MESSAGE_TYPE.MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, IntPtr.Zero);

//	hr = pTransform->ProcessMessage(MFT_MESSAGE_NOTIFY_START_OF_STREAM, NULL);
pTransform.ProcessMessage(MFT_MESSAGE_TYPE.MFT_MESSAGE_NOTIFY_START_OF_STREAM, IntPtr.Zero);

	/* 5. Create IMFSample from uncompressed PCM input data */

/*
BYTE  *data = ...; //< input PCM data 
DWORD bytes = ...; //< bytes need to be smaller than approx. 1Mbytes

IMFMediaBuffer *pBuffer = NULL;
hr = MFCreateMemoryBuffer(bytes , &pBuffer);
*/
			
// IMFMediaBuffer *pBuffer = NULL;
IMFMediaBuffer pBuffer = null;

// hr = MFCreateMemoryBuffer(bytes , &pBuffer); 
MFCreateMemoryBuffer(wfOutput.AverageBytesPerSecond*4, out pBuffer);

// BYTE  *pByteBufferTo = NULL;
// hr = pBuffer->Lock(&pByteBufferTo, NULL, NULL);
IntPtr pByteBufferTo;
int maxLength;
int currentLength;
pBuffer.Lock(out pByteBufferTo, out maxLength, out currentLength);

//memcpy(pByteBufferTo, data, bytes);
byte[] data = new byte[maxLength];


Marshal.Copy(pByteBufferTo,data,0,  maxLength);

//	pBuffer->Unlock();
pBuffer.Unlock();

// pByteBufferTo = NULL;
pByteBufferTo = IntPtr.Zero;
						
//hr = pBuffer->SetCurrentLength(bytes);
pBuffer.SetCurrentLength(maxLength);					

//IMFSample *pSample = NULL;
IMFSample pSample = null;

//hr = MFCreateSample(&pSample);
MediaFoundationInterop.MFCreateSample(out pSample);
			
//hr = pSample->AddBuffer(pBuffer);
pSample.AddBuffer(pBuffer);

// SafeRelease(&pBuffer);
Marshal.ReleaseComObject(pBuffer);
			

	/* 6. Set input data to Resampler MFT */

// hr = pTransform->ProcessInput(0, pSample, 0);
	
hr = pTransform.ProcessInput(0, pSample, 0);     // <- ERREUR !!!!!
MFError.ThrowExceptionForHR(hr);

 

Coordinator
Nov 30, 2012 at 3:00 PM
you probably need to send the stream start message. Also, don't realease the buffer until you've processed the sample.


On 30 November 2012 14:47, ManuN <notifications@codeplex.com> wrote:

From: ManuN

So, I need your help.

I created this procedure from a c + + example
I came across an error (HResult): The called 0xC00D35B5 no longer accept additional input.
You know of this error?

IMFSourceReader retSourceReader = null;
int hr = 0;

// ADD Constant
Guid  MF_MT_ALL_SAMPLES_INDEPENDENT = new Guid("c9173739-5e56-461c-b713-46fb995cb95f");

// see MFErreur
const int MF_E_TRANSFORM_NEED_MORE_INPUT = unchecked((int)0xC00D6D72);

// FOR TEST HERE :: Audio Format Output (todo properties)
WaveFormat wfOutput = new WaveFormat(44100, 2);
			
	/* 1 Initialization */
			
MediaFoundationInterop.MFStartup(MediaFoundationInterop.MF_VERSION);

	/* 2. Create Resampler MFT Object
		CComPtr<IUnknown> spTransformUnk;
		IMFTransform *pTransform = NULL; //< this is Resampler MFT

		hr = CoCreateInstance(CLSID_CResamplerMediaObject, NULL, CLSCTX_INPROC_SERVER,
							IID_IUnknown, (void**)&spTransformUnk);

			
			*/
			
CLSID_CResamplerMediaObject mediaComObject;
mediaComObject = new CLSID_CResamplerMediaObject();

//hr = spTransformUnk->QueryInterface(IID_PPV_ARGS(&pTransform));
IMFTransform pTransform = null;
pTransform = (IMFTransform)mediaComObject; //rsampler.Transform;


	/* 3. Specify input/output PCM format to Resampler MFT */

IMFMediaType mediaType = null;

// Create MediaType
MediaFoundationInterop.MFCreateMediaType(out mediaType);

// hr = pMediaType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio));
mediaType.SetGUID(MediaFoundationAttributes.MF_MT_MAJOR_TYPE, NAudio.MediaFoundation.MediaTypes.MFMediaType_Audio);

// hr = pMediaType->SetGUID(MF_MT_SUBTYPE,   (fmt.sampleFormat == MyBitFormatInt) ? MFAudioFormat_PCM : MFAudioFormat_Float);
if (wfOutput.Encoding == WaveFormatEncoding.Pcm)
	mediaType.SetGUID(MediaFoundationAttributes.MF_MT_SUBTYPE, AudioSubtypes.MFAudioFormat_PCM);
else
	mediaType.SetGUID(MediaFoundationAttributes.MF_MT_SUBTYPE, AudioSubtypes.MFAudioFormat_Float);

// hr = pMediaType->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS,         fmt.nChannels);
mediaType.SetUINT32(MediaFoundationAttributes.MF_MT_AUDIO_NUM_CHANNELS, wfOutput.Channels);

// hr = pMediaType->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND,   fmt.sampleRate);
mediaType.SetUINT32(MediaFoundationAttributes.MF_MT_AUDIO_SAMPLES_PER_SECOND, wfOutput.SampleRate);

// hr = pMediaType->SetUINT32(MF_MT_AUDIO_BLOCK_ALIGNMENT,      fmt.FrameBytes());
mediaType.SetUINT32(MediaFoundationAttributes.MF_MT_AUDIO_BLOCK_ALIGNMENT, wfOutput.BlockAlign);

// hr = pMediaType->SetUINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, fmt.BytesPerSec());
mediaType.SetUINT32(MediaFoundationAttributes.MF_MT_AUDIO_AVG_BYTES_PER_SECOND, wfOutput.AverageBytesPerSecond);

// hr = pMediaType->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE,      fmt.bits);
//mediaType.SetUINT32(MediaFoundationInterop.MF_MT_AUDIO_BITS_PER_SAMPLE, wfOutput.BitsPerSample);

// hr = pMediaType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT,    TRUE);
mediaType.SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, -1);

/* 
* if (0 != fmt.dwChannelMask) {
* hr = pMediaType->SetUINT32(MF_MT_AUDIO_CHANNEL_MASK, fmt.dwChannelMask);
* }
*/

if (wfOutput.Encoding == WaveFormatEncoding.Pcm)
{
	/*	if (fmt.bits != fmt.validBitsPerSample) {
		hr = pMediaType->SetUINT32(MF_MT_AUDIO_VALID_BITS_PER_SAMPLE, fmt.validBitsPerSample);
		}
	 */
	mediaType.SetUINT32(MediaFoundationAttributes.MF_MT_AUDIO_BITS_PER_SAMPLE, wfOutput.BitsPerSample);

}

// pTransform->SetInputType(0, spOutputType, 0);
pTransform.SetInputType(0, mediaType, 0);

		

	/* 4. Send stream start message to Resampler MFT */

//	hr = pTransform->ProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, NULL);
pTransform.ProcessMessage(MFT_MESSAGE_TYPE.MFT_MESSAGE_COMMAND_FLUSH, IntPtr.Zero);

//	hr = pTransform->ProcessMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, NULL);
// Erreur ????????????
//pTransform.ProcessMessage(MFT_MESSAGE_TYPE.MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, IntPtr.Zero);

//	hr = pTransform->ProcessMessage(MFT_MESSAGE_NOTIFY_START_OF_STREAM, NULL);
pTransform.ProcessMessage(MFT_MESSAGE_TYPE.MFT_MESSAGE_NOTIFY_START_OF_STREAM, IntPtr.Zero);

	/* 5. Create IMFSample from uncompressed PCM input data */

/*
BYTE  *data = ...; //< input PCM data 
DWORD bytes = ...; //< bytes need to be smaller than approx. 1Mbytes

IMFMediaBuffer *pBuffer = NULL;
hr = MFCreateMemoryBuffer(bytes , &pBuffer);
*/
			
// IMFMediaBuffer *pBuffer = NULL;
IMFMediaBuffer pBuffer = null;

// hr = MFCreateMemoryBuffer(bytes , &pBuffer); 
MFCreateMemoryBuffer(wfOutput.AverageBytesPerSecond*4, out pBuffer);

// BYTE  *pByteBufferTo = NULL;
// hr = pBuffer->Lock(&pByteBufferTo, NULL, NULL);
IntPtr pByteBufferTo;
int maxLength;
int currentLength;
pBuffer.Lock(out pByteBufferTo, out maxLength, out currentLength);

//memcpy(pByteBufferTo, data, bytes);
byte[] data = new byte[maxLength];


Marshal.Copy(pByteBufferTo,data,0,  maxLength);

//	pBuffer->Unlock();
pBuffer.Unlock();

// pByteBufferTo = NULL;
pByteBufferTo = IntPtr.Zero;
						
//hr = pBuffer->SetCurrentLength(bytes);
pBuffer.SetCurrentLength(maxLength);					

//IMFSample *pSample = NULL;
IMFSample pSample = null;

//hr = MFCreateSample(&pSample);
MediaFoundationInterop.MFCreateSample(out pSample);
			
//hr = pSample->AddBuffer(pBuffer);
pSample.AddBuffer(pBuffer);

// SafeRelease(&pBuffer);
Marshal.ReleaseComObject(pBuffer);
			

	/* 6. Set input data to Resampler MFT */

// hr = pTransform->ProcessInput(0, pSample, 0);
	
hr = pTransform.ProcessInput(0, pSample, 0);     // <- ERREUR !!!!!
MFError.ThrowExceptionForHR(hr);

Read the full discussion online.

To add a post to this discussion, reply to this email (naudio@discussions.codeplex.com)

To start a new discussion for this project, email naudio@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Nov 30, 2012 at 3:03 PM

 

I deleted the Marshal.ReleaseComObject (pBuffer) but it is always the same

Nov 30, 2012 at 3:10 PM

the message MFT_MESSAGE_START_OF_STREAM is already performing. (see Part 4)

Coordinator
Nov 30, 2012 at 3:24 PM
I think you need to work out why it isn't accepting the MFT_MESSAGE_NOTIFY_BEGIN_STREAMING message



On 30 November 2012 15:10, ManuN <notifications@codeplex.com> wrote:

From: ManuN

the message MFT_MESSAGE_START_OF_STREAM is already performing. (see Part 4)

Read the full discussion online.

To add a post to this discussion, reply to this email (naudio@discussions.codeplex.com)

To start a new discussion for this project, email naudio@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Nov 30, 2012 at 3:28 PM

MFT_MESSAGE_NOTIFY_BEGIN_STREAMING

Error :: A valid type was not specified for this data stream or stream on which it depends

Coordinator
Nov 30, 2012 at 3:33 PM
probably it doesn't like your input type. I've been doing WMA encoding today and it is very fussy about the exact input type as well.

On 30 November 2012 15:28, ManuN <notifications@codeplex.com> wrote:

m: ManuN

MFT_MESSAGE_NOTIFY_BEGIN_STREAMING

Error :: A valid type was not specified for this data stream or stream on which it depends


Nov 30, 2012 at 3:34 PM

I probably need to follow this procedure

Get Stream Identifiers

An MFT has one or more streams. Input streams receive input data, and output streams generate output data. Streams are not represented as distinct objects. Instead, various MFT methods take stream identifiers as parameters.

Some MFTs allow the client to add or remove input streams. During streaming, an MFT can add or remove output streams. (The client cannot add or remove output streams.)

  1. (Optional.) Call IMFTransform::GetStreamLimits to get the minimum and maximum number of streams that the MFT can support. If the minimum and maximum are the same, the MFT has a fixed number of streams.
  2. Call IMFTransform::GetStreamCount to get the initial number of streams.
  3. Call IMFTransform::GetStreamIDs to get the stream identifiers. If this method returns E_NOTIMPL, it means the MFT has a fixed number of streams, and the stream identifiers are consecutive starting from zero.
  4. (Optional.) If the MFT does not have a fixed number of streams, call IMFTransform::AddInputStreams to add more input streams, or IMFTransform::DeleteInputStream to remove input streams. (You cannot add or remove output streams.)

 

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

Nov 30, 2012 at 3:56 PM

yes obviously

After searching the label of the error

hr = pTransform.ProcessInput(0, pSample, 0);     // <- ERREUR == MF_E_NOTACCEPTING

Not accepting, not accepting , pffffff :-(
Dec 1, 2012 at 8:03 AM
Edited Dec 1, 2012 at 8:07 AM

Hello,I continue my investigations.

But obviously there are some errors in interface Transform

 

 /// <summary>
        /// Gets the buffer requirements and other information for an input stream on this Media Foundation transform (MFT). 
        /// </summary>
        /// <remarks>
        /// virtual HRESULT STDMETHODCALLTYPE GetInputStreamInfo( 
        ///     DWORD dwInputStreamID,
        ///     /* [out] */ __RPC__out MFT_INPUT_STREAM_INFO *pStreamInfo) = 0;
        /// </remarks>
        void GetInputStreamInfo([In] int dwInputStreamID, [In, Out] MFT_INPUT_STREAM_INFO pStreamInfo);

Modify to 
void GetInputStreamInfo([In] int dwInputStreamID, out MFT_INPUT_STREAM_INFO pStreamInfo);

Same erreur in GetOutputStreamInfo

Exact ?????
Coordinator
Dec 1, 2012 at 8:09 AM
that is a strange one. The MSDN documentation says [out] but it is only a single level of indirection. I would expect a **ppStreamInfo for a genuine out parameter, which is why I made it [In,Out] (I assumed the caller creates the struct and it is filled in by the user). I'll see what is in the header file

On 1 December 2012 08:03, ManuN <notifications@codeplex.com> wrote:
GetInputStreamInfo

Coordinator
Dec 1, 2012 at 8:17 AM
From what I can see, the user is supposed to allocate the memory. To use the out keyword, I would need to turn MFT_INPUT_STREAM_INFO into a struct instead of a class (I use class normally as it allows us to pass nulls if needed). Have you tried it with your alternative method signature?


On 1 December 2012 08:09, Mark Heath <mark.heath@gmail.com> wrote:
that is a strange one. The MSDN documentation says [out] but it is only a single level of indirection. I would expect a **ppStreamInfo for a genuine out parameter, which is why I made it [In,Out] (I assumed the caller creates the struct and it is filled in by the user). I'll see what is in the header file

On 1 December 2012 08:03, ManuN <notifications@codeplex.com> wrote:
GetInputStreamInfo


Dec 1, 2012 at 8:27 AM

Not yet, but I have a piece of code that retrieves the StreamInfo, so I think rather in Out (I checked also in my own library)

But I must get to that level of code (Run) to check.

Dec 1, 2012 at 8:27 AM

 

//	HRG(pTransform->GetOutputStreamInfo(0, &StreamInfo));
			pTransform.GetInputStreamInfo(0,out StreamInfo);

			//	if (cbOutBytes < StreamInfo.cbSize) {
			//		cbOutBytes = StreamInfo.cbSize;
			//	}
			if (cbOutBytes < StreamInfo.cbSize)
			{
				cbOutBytes = StreamInfo.cbSize;
			}
Dec 1, 2012 at 8:29 AM

I watched a doc   http://msdn.microsoft.com/en-us/library/windows/desktop/ms693880 (v = VS.85). aspx
And apparently it is out
To be continued ....

Dec 1, 2012 at 10:02 AM

Change class MFT_INPUT_STREAM_INFO  to struct

Ok

Dec 1, 2012 at 10:17 AM
Edited Dec 1, 2012 at 10:28 AM

Well I overcome my initial problem of this discussion. :-)

Obviously must be in this order ::


1) Create MediaType

2) SetInputType, SetOutputType

3) SampleIn -> MediaBuffer + Edit SetSampleDuration & SetSampleTime

4) ProcessMessage

5) ProcessInput

6) ProcessOuput

7) Read SampleOut


I have a routine that works (well there is no error)I need to check a few points.

Dec 1, 2012 at 11:46 AM

OuffffffI managed to make a routine that works IMFTransform

Remains to the integrated

(For the moment the routine generates a 1KHz sine 1Second and save to a file Resampler)