/// <summary> /// (Virtual) Controls information about how input buffers are formatted /// </summary> /// <param name="dwInputStreamIndex">Input stream number</param> /// <param name="pdwFlags">Flags specifying how input buffers need to be formatted</param> /// <returns>S_OK for successful completion</returns> /// <remarks> /// Allows the implementor to specify flags controlling the format of input buffers. The default /// implementation return FixedSampleSize | SingleSamplePerBuffer | WholeSamples /// </remarks> protected virtual int InternalGetInputStreamInfo(int dwInputStreamIndex, out DMOInputStreamInfo pdwFlags) { pdwFlags = DMOInputStreamInfo.FixedSampleSize | DMOInputStreamInfo.SingleSamplePerBuffer | DMOInputStreamInfo.WholeSamples; return S_OK; }
/// <summary> /// COM entry point for IMediaObject.GetInputStreamInfo /// </summary> /// <remarks> /// There should be no need to modify or override this method. It will call the /// abstract and virtual methods to perform its work. /// </remarks> public int GetInputStreamInfo(int ulStreamIndex, out DMOInputStreamInfo pdwFlags) { int hr; try { // Avoid multi-threaded access issues lock(this) { pdwFlags = 0; m_Log.Write("GetInputStreamInfo"); // Validate the stream number if (ulStreamIndex < m_NumInputs && ulStreamIndex >= 0) { // Call the internal function to get the value hr = InternalGetInputStreamInfo(ulStreamIndex, out pdwFlags); // Validate the value returned by the internal function Debug.Assert(0 == (pdwFlags & ~(DMOInputStreamInfo.WholeSamples | DMOInputStreamInfo.SingleSamplePerBuffer | DMOInputStreamInfo.FixedSampleSize | DMOInputStreamInfo.HoldsBuffers))); } else { hr = DMOResults.E_InvalidStreamIndex; } m_Log.WriteNoTS(string.Format(": {0}\r\n", hr)); } } catch (Exception e) { // Generic handling of all exceptions. While .NET will turn exceptions into // HRESULTS "automatically", I prefer to have some place I can set a breakpoint. hr = CatFail(e); // Have to have this to make the compiler happy. pdwFlags = 0; } return hr; }
/// <summary> /// COM entry point for IMediaObject.GetInputStreamInfo /// </summary> /// <param name="streamIndex">The index of the stream.</param> /// <param name="pflags">A <see cref="DMOInputStreamInfo"/> /// with the stream flags.</param> /// <returns>A HRESULT value.</returns> /// <remarks> /// There should be no need to modify or override this method. It will call the /// abstract and virtual methods to perform its work. /// </remarks> public int GetInputStreamInfo(int streamIndex, out DMOInputStreamInfo pflags) { int hr; try { // Avoid multi-threaded access issues lock (this) { pflags = 0; // Validate the stream number if (streamIndex < this.numInputs && streamIndex >= 0) { // Call the internal function to get the value hr = this.InternalGetInputStreamInfo(streamIndex, out pflags); // Validate the value returned by the internal function Debug.Assert( 0 == (pflags & ~(DMOInputStreamInfo.WholeSamples | DMOInputStreamInfo.SingleSamplePerBuffer | DMOInputStreamInfo.FixedSampleSize | DMOInputStreamInfo.HoldsBuffers)), "Wrong value"); } else { hr = DMOResults.E_InvalidStreamIndex; } } } catch (Exception e) { // Generic handling of all exceptions. While .NET will turn exceptions into // HRESULTS "automatically", I prefer to have some place I can set a breakpoint. hr = this.CatFail(e); // Have to have this to make the compiler happy. pflags = 0; } return hr; }