Esempio n. 1
0
        private void TestLive()
        {
            bool b;

            m_Writer.IsRealTime(out b);

            Debug.Assert(b == false);

            m_Writer.SetLiveSource(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Get and configure the IWMWriterAdvanced
        /// </summary>
        /// <param name="asfWriter">IBaseFilter from which to get the IWMWriterAdvanced</param>
        void DoAnet(IBaseFilter asfWriter)
        {
            int hr;
            int dwPortNum = PortNum;

            // Get the IWMWriterAdvanced
            IWMWriterAdvanced pWriterAdvanced = GetWriterAdvanced(asfWriter);

            try
            {
                // Remove all the sinks from the writer
                RemoveAllSinks(pWriterAdvanced);

                // Say we are using live data
                hr = pWriterAdvanced.SetLiveSource(true);
                WMError.ThrowExceptionForHR(hr);

                // Create a network sink
                hr = WMUtils.WMCreateWriterNetworkSink(out m_pNetSink);
                WMError.ThrowExceptionForHR(hr);

                // Configure the network sink
                hr = m_pNetSink.SetNetworkProtocol(NetProtocol.HTTP);
                WMError.ThrowExceptionForHR(hr);

                // Configure the network sink
                hr = m_pNetSink.SetMaximumClients(MaxClients);
                WMError.ThrowExceptionForHR(hr);

                // Done configuring the network sink, open it
                hr = m_pNetSink.Open(ref dwPortNum);
                WMError.ThrowExceptionForHR(hr);

                // Add the network sink to the IWMWriterAdvanced
                hr = pWriterAdvanced.AddSink(m_pNetSink as IWMWriterSink);
                WMError.ThrowExceptionForHR(hr);
            }
            finally
            {
                if (pWriterAdvanced != null)
                {
                    Marshal.ReleaseComObject(pWriterAdvanced);
                    pWriterAdvanced = null;
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Create the basic WM writer objects.
 /// </summary>
 /// <returns></returns>
 public bool Init()
 {
     try
     {
         uint hr = WMFSDKFunctions.WMCreateWriter(null, out writer);
         writerAdvanced = (IWMWriterAdvanced)writer;
         writerAdvanced.SetLiveSource(1);
         hr = WMFSDKFunctions.WMCreateWriterNetworkSink(out netSink);
     }
     catch (Exception e)
     {
         Debug.WriteLine("Failed to create IWMWriter: " + e.ToString());
         eventLog.WriteEntry("Failed to create IWMWriter: " + e.ToString(), EventLogEntryType.Error, 1000);
         return(false);
     }
     return(true);
 }
Esempio n. 4
0
        /// <summary>
        /// Configures the WM ASF Writer filter. (populates member variables as well)
        /// </summary>
        protected void ConfigureWriterFilter()
        {
            IWMProfile profile = GetWMProfile(CurrentProfile);

            WindowsMediaLib.IConfigAsfWriter configAsf = (WindowsMediaLib.IConfigAsfWriter)_asfFilter;
            configAsf.ConfigureFilterUsingProfile(profile);

            //Retreive the IWMWriter* objects from the WM ASF Writer filter.
            _writerAdvanced = GetWriterAdvanced();
            _writer         = (IWMWriter)_writerAdvanced;

            //The WM ASF Writer comes with a File-Writer-Sink, which we need to remove.
            RemoveAllSinks(_writerAdvanced);

            //set SourceConfig settings
            _writerAdvanced.SetSyncTolerance(SourceConfig.SyncToleranceMilliseconds);

            _writerAdvanced.SetLiveSource(SourceConfig.LiveSource);
        }