コード例 #1
0
        public HResult PlaceMarker(MFStreamSinkMarkerType eMarkerType, ConstPropVariant pvarMarkerValue, ConstPropVariant pvarContextValue)
        {
            Debug.WriteLine("StreamSink:PlaceMarker");

            HResult hr;

            lock (this)
            {
                hr = CheckShutdown();
                if (Failed(hr))
                {
                    return(hr);
                }

                PropVariant markerValue  = new PropVariant();
                PropVariant contextValue = new PropVariant();
                pvarMarkerValue?.Copy(markerValue);
                pvarContextValue?.Copy(contextValue);
                Marker m = new Marker(eMarkerType, markerValue, contextValue);

                hr = ProcessSampleInternal(m);
                if (Failed(hr))
                {
                    return(hr);
                }
            }
            return(hr);
        }
コード例 #2
0
ファイル: Externs.cs プロジェクト: gitter-badger/GS
 public static extern void MFCreateMediaEvent(
     MediaEventType met,
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid guidExtendedType,
     int hrStatus,
     [In, MarshalAs(UnmanagedType.LPStruct)] ConstPropVariant pvValue,
     out IMFMediaEvent ppEvent
     );
コード例 #3
0
ファイル: MetaDataContainer.cs プロジェクト: git-thinh/mp4
    public HResult SetProperty(string pwszName, ConstPropVariant ppvValue)
    {
        lock (m_MetaValues)
        {
            m_MetaValues[pwszName] = ppvValue.GetString();
        }

        return(HResult.S_OK);
    }
コード例 #4
0
        /// <summary>
        /// Convert a PropVariant to a managed object
        /// </summary>
        /// <param name="variant">The PropVariant to convert.</param>
        /// <returns>A managed object corresponding to the given PropVariant or null if the PropVariant type is unsupported.</returns>
        public static object GetObject(this ConstPropVariant variant)
        {
            if (variant == null)
            {
                throw new ArgumentNullException("variant");
            }

            switch (variant.GetVariantType())
            {
            case ConstPropVariant.VariantType.None:
                return(null);

            case ConstPropVariant.VariantType.Short:
                return(variant.GetShort());

            case ConstPropVariant.VariantType.Int32:
                return(variant.GetInt());

            case ConstPropVariant.VariantType.Float:
                return(variant.GetFloat());

            case ConstPropVariant.VariantType.Double:
                return(variant.GetDouble());

            case ConstPropVariant.VariantType.IUnknown:
                return(variant.GetIUnknown());

            case ConstPropVariant.VariantType.UByte:
                return(variant.GetUByte());

            case ConstPropVariant.VariantType.UShort:
                return(variant.GetUShort());

            case ConstPropVariant.VariantType.UInt32:
                return(variant.GetUInt());

            case ConstPropVariant.VariantType.UInt64:
                return(variant.GetULong());

            case ConstPropVariant.VariantType.String:
                return(variant.GetString());

            case ConstPropVariant.VariantType.Guid:
                return(variant.GetGuid());

            case ConstPropVariant.VariantType.Blob:
                return(variant.GetBlob());

            case ConstPropVariant.VariantType.StringArray:
                return(variant.GetStringArray());
            }

            return(null);
        }
コード例 #5
0
    public HResult QueueEvent(MediaEventType met,
                              Guid guidExtendedType, HResult hrStatus, ConstPropVariant pvValue)
    {
        IMFMediaEvent pEvent;
        HResult       hr;

        hr = MFExtern.MFCreateMediaEvent(met,
                                         Guid.Empty, HResult.S_OK, null, out pEvent);

        if (MFError.Succeeded(hr))
        {
            hr = m_events.QueueEvent(pEvent);
        }

        return(hr);
    }
コード例 #6
0
        public HResult QueueEvent(MediaEventType met, Guid guidExtendedType, HResult hrStatus, ConstPropVariant pvValue)
        {
            Debug.WriteLine("StreamSink:QueueEvent");

            HResult hr;

            lock (this)
            {
                hr = CheckShutdown();
                if (Failed(hr))
                {
                    return(hr);
                }

                GenEventQueue();
                hr = EventQueue.QueueEventParamVar(met, guidExtendedType, hrStatus, pvValue);
                LogIfFailed(hr);
            }
            return(hr);
        }
コード例 #7
0
 public HResult CompareItem(Guid guidKey,
                            ConstPropVariant Value,
                            out bool pbResult)
 {
     return(m_Attribs.CompareItem(guidKey, Value, out pbResult));
 }
コード例 #8
0
 public HResult SetItem(Guid guidKey, ConstPropVariant Value)
 {
     return(m_Attribs.SetItem(guidKey, Value));
 }
コード例 #9
0
ファイル: MediaStream.cs プロジェクト: azdjdgh/VideoChat
        public HResult QueueEvent(MediaEventType met, Guid guidExtendedType, HResult hrStatus, ConstPropVariant pvValue)
        {
            HResult hr = HResult.S_OK;

            lock (_spSource)
            {
                hr = CheckShutdown();

                if (MFError.Succeeded(hr))
                {
                    hr = _spEventQueue.QueueEventParamVar(met, guidExtendedType, hrStatus, pvValue);
                }

                return(hr);
            }
        }
コード例 #10
0
ファイル: NetworkSource.cs プロジェクト: azdjdgh/VideoChat
        public HResult Start(IMFPresentationDescriptor pPresentationDescriptor, Guid pguidTimeFormat, ConstPropVariant pvarStartPos)
        {
            HResult hr = HResult.S_OK;

            // Check parameters.

            // Start position and presentation descriptor cannot be NULL.
            if (pvarStartPos == null || pPresentationDescriptor == null)
            {
                return(HResult.E_INVALIDARG);
            }

            // Check the time format.
            if ((pguidTimeFormat != null) && (pguidTimeFormat != Guid.Empty))
            {
                // Unrecognized time format GUID.
                return(HResult.MF_E_UNSUPPORTED_TIME_FORMAT);
            }

            // Check the data type of the start position.
            if (pvarStartPos.GetVariantType() != VariantType.None && pvarStartPos.GetVariantType() != VariantType.Int64)
            {
                return(HResult.MF_E_UNSUPPORTED_TIME_FORMAT);
            }

            if (_eSourceState != SourceState.SourceState_Stopped && _eSourceState != SourceState.SourceState_Started)
            {
                hr = HResult.MF_E_INVALIDREQUEST;
            }

            if (MFError.Succeeded(hr))
            {
                // Check if the presentation description is valid.
                hr = ValidatePresentationDescriptor(pPresentationDescriptor);
            }

            if (MFError.Succeeded(hr))
            {
                CSourceOperation op = new CSourceOperation
                {
                    Type = SourceOperationType.Operation_Start,
                    PresentationDescriptor = pPresentationDescriptor,
                    Data = pvarStartPos
                };
                doStart(op);
            }
            return(hr);
        }