コード例 #1
0
        void IWMStatusCallback.OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
        {
            m_LastResult = hr;

            Debug.Write(string.Format("{0} 0x{1:x} {2} {3} {4} {5} ", iStatus, hr, WMError.GetErrorText(hr), dwType, pValue.ToInt32(), pvContext.ToInt32()));

            switch (dwType)
            {
            case AttrDataType.STRING:
                Debug.WriteLine(Marshal.PtrToStringUni(pValue));
                break;

            case AttrDataType.WORD:
                Debug.WriteLine(Marshal.ReadInt16(pValue));
                break;

            case AttrDataType.DWORD:
            case AttrDataType.BOOL:
                Debug.WriteLine(Marshal.ReadInt32(pValue));
                break;

            case AttrDataType.QWORD:
                Debug.WriteLine(Marshal.ReadInt64(pValue));
                break;

            default:
                Debug.WriteLine("???");
                break;
            }
        }
コード例 #2
0
        //------------------------------------------------------------------------------
        // Name: QueryProperty()
        // Desc: Gets the specified DRM property.
        //------------------------------------------------------------------------------
        private void QueryProperty(string pwszPropertyName, out byte[] pValue, out AttrDataType Wmt)
        {
            // variables to hold the query results after QueryProperty is called
            short wValueLength;

            if (null == m_pDRMEditor)
            {
                throw new Exception("Invalid request");
            }

            pValue       = null;
            wValueLength = 0;

            m_pDRMEditor.GetDRMProperty(pwszPropertyName,
                                        out Wmt,
                                        pValue,
                                        ref wValueLength);

            pValue = new byte[wValueLength];

            m_pDRMEditor.GetDRMProperty(pwszPropertyName,
                                        out Wmt,
                                        pValue,
                                        ref wValueLength);
        }
コード例 #3
0
		//------------------------------------------------------------------------------
		// Name: QueryProperty()
		// Desc: Gets the specified DRM property.
		//------------------------------------------------------------------------------
		private void QueryProperty(string propertyName, out byte[] pValue, out AttrDataType Wmt)
		{
			// variables to hold the query results after QueryProperty is called
			short wValueLength;

			if (null == m_pDRMEditor)
			{
				throw new Exception("Invalid request");
			}

			pValue = null;
			wValueLength = 0;

			m_pDRMEditor.GetDRMProperty(propertyName,
				out Wmt,
				pValue,
				ref wValueLength);

			pValue = new byte[wValueLength];

			m_pDRMEditor.GetDRMProperty(propertyName,
				out Wmt,
				pValue,
				ref wValueLength);
		}
コード例 #4
0
 public void OnStatus(Status Status, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
 {
     Debug.WriteLine(Status);
     if (Status == Status.Closed)
     {
         m_IndexComplete = true;
     }
 }
コード例 #5
0
ファイル: Reader.cs プロジェクト: gchudov/WindowsMediaLib
        public void OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
        {
            Debug.WriteLine(string.Format("Status: {0}", iStatus));

            switch (iStatus)
            {
            case Status.Opened:
                m_hrAsync = hr;
                m_hEvent.Set();
                Debug.WriteLine("Opened the file ...");
                break;

            case Status.Started:
                m_hrAsync = hr;
                m_hEvent.Set();

                if (hr >= 0)
                {
                    Debug.WriteLine("Started ...");

                    try
                    {
                        // Ask for all data
                        m_pReader2.DeliverTime(-1);
                    }
                    catch (Exception e)
                    {
                        int lhr = Marshal.GetHRForException(e);
                        m_hrAsync = hr;
                        m_hEvent.Set();
                    }
                }
                break;

            case Status.Stopped:
                m_hrAsync = hr;
                m_hEvent.Set();
                Debug.WriteLine("Stopped ...");
                break;

            case Status.Closed:
                m_hrAsync = hr;
                m_hEvent.Set();
                Debug.WriteLine("Closed the file ...");
                break;

            case Status.EOF:
                m_EOF     = true;
                m_hrAsync = hr;
                m_hEvent.Set();
                Debug.WriteLine("End of file ...");
                for (int x = 0; x < m_SampleCount.Length; x++)
                {
                    Debug.WriteLine(string.Format("{0}: {1}", x, m_SampleCount[x]));
                }
                break;
            }
        }
コード例 #6
0
 public void OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
 {
     if (iStatus == Status.InitPlaylistBurn)
     {
         lock (m_resultLock)
         {
             Monitor.PulseAll(m_resultLock);
         }
     }
 }
コード例 #7
0
        public AttrFieldInfo(int index, string title, AttrDataType typeCode, bool isKey = false, bool isIndex = false, bool isFullTextSearch = false)
        {
            this.Index            = index;
            this.IsFullTextSearch = isFullTextSearch;
            this.IsIndex          = IsIndex;
            this.IsKey            = IsKey;
            this.Title            = title;
            this.TypeCode         = typeCode;

            switch (typeCode)
            {
            case AttrDataType.INT_ARRAY:
                TypeName = "int[]";
                break;

            case AttrDataType.INT:
            case AttrDataType.INT_DATE:
            case AttrDataType.INT_TIME:
                TypeName = "int";
                break;

            case AttrDataType.STRING_ARRAY:
            case AttrDataType.STRING_ARRAY_IMAGES:
                TypeName = "string[]";
                break;

            case AttrDataType.STRING:
            case AttrDataType.STRING_IMAGE:
                TypeName = "string";
                break;

            case AttrDataType.LONG_ARRAY:
                TypeName = "long[]";
                break;

            case AttrDataType.LONG:
            case AttrDataType.LONG_DATETIME:
                TypeName = "long";
                break;

            case AttrDataType.ENTITY_ARRAY:
                TypeName = "object[]";
                break;

            case AttrDataType.ENTITY:
                TypeName = "object";
                break;


            default:
                TypeName = "object";
                break;
            }
        }
コード例 #8
0
        void IWMReaderCallback.OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
        {
            switch (iStatus)
            {
                case Status.Opened:
                    {
                        m_hOpenEvent.Set();
                        break;
                    }

                case Status.Closed:
                    {
                        m_hCloseEvent.Set();
                        break;
                    }
            }
        }
コード例 #9
0
        public void GetProperty(StringBuilder pszName, out AttrDataType pType, IntPtr pValue, ref int pdwSize)
        {
            Debug.WriteLine(pszName);
            m_Called = true;

            if (pszName.ToString() == Constants.g_wszReloadIndexOnSeek)
            {
                pType = AttrDataType.BOOL;
                Marshal.WriteInt32(pValue, 1);
            }
            else if (pszName.ToString() == Constants.g_wszStreamNumIndexObjects)
            {
                pType = AttrDataType.DWORD;
                Marshal.WriteInt32(pValue, 1);
            }
            else if (pszName.ToString() == Constants.g_wszFailSeekOnError)
            {
                pType = AttrDataType.BOOL;
                Marshal.WriteInt32(pValue, 1);
            }
            else if (pszName.ToString() == Constants.g_wszPermitSeeksBeyondEndOfStream)
            {
                pType = AttrDataType.BOOL;
                Marshal.WriteInt32(pValue, 1);
            }
            else if (pszName.ToString() == Constants.g_wszUsePacketAtSeekPoint)
            {
                pType = AttrDataType.BOOL;
                Marshal.WriteInt32(pValue, 1);
            }
            else if (pszName.ToString() == Constants.g_wszSourceBufferTime)
            {
                pType = AttrDataType.DWORD;
                Marshal.WriteInt32(pValue, 1);
            }
            else if (pszName.ToString() == Constants.g_wszSourceMaxBytesAtOnce)
            {
                pType = AttrDataType.DWORD;
                Marshal.WriteInt32(pValue, 10000);
            }
            else
            {
                throw new COMException("Unrecognized type passed to IWMIStreamProps", E_Fail);
            }
        }
コード例 #10
0
        public void OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
        {
            Debug.WriteLine(string.Format("{0} {1} {2} {3}", iStatus, hr, dwType, Marshal.ReadInt32(pValue)));
            switch (iStatus)
            {
            case Status.Closed:
            {
                m_IndexComplete = true;
                break;
            }

            case Status.Error:
            {
                m_IndexError = hr;
                break;
            }

            case Status.IndexProgress:
                m_MaxIndex = Marshal.ReadInt32(pValue);
                break;
            }
        }
コード例 #11
0
        public void OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
        {
            if (pvContext == new IntPtr(3))
            {
                m_bPassed = true;
            }

            Debug.WriteLine(string.Format("{0} {1} {2} {3}", iStatus, hr, dwType, Marshal.ReadInt32(pValue)));
            switch (iStatus)
            {
            case Status.Closed:
            {
                break;
            }

            case Status.Error:
            {
                break;
            }

            case Status.IndexProgress:
                break;
            }
        }
コード例 #12
0
 public void OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #13
0
 void IWMHeaderInfo.SetAttribute(short wStreamNum, string pszName, AttrDataType Type, byte[] pValue, short cbLength)
 {
     throw new NotImplementedException();
 }
コード例 #14
0
 void IWMHeaderInfo.GetAttributeByIndex(short wIndex, ref short pwStreamNum, StringBuilder pwszName, ref short pcchNameLen, out AttrDataType pType, byte[] pValue, ref short pcbLength)
 {
     throw new NotImplementedException();
 }
コード例 #15
0
 void IWMHeaderInfo.GetAttributeByName(ref short pwStreamNum, string pszName, out AttrDataType pType, byte[] pValue, ref short pcbLength)
 {
     throw new NotImplementedException();
 }
コード例 #16
0
 public void ModifyAttribute(short wStreamNum, short wIndex, AttrDataType Type, short wLangIndex, byte[] pValue, int dwLength)
 {
     throw new NotImplementedException();
 }
コード例 #17
0
 public void GetAttributeByIndexEx(short wStreamNum, short wIndex, StringBuilder pwszName, ref short pwNameLen, out AttrDataType pType, out short pwLangIndex, byte[] pValue, ref int pdwDataLength)
 {
     throw new NotImplementedException();
 }
コード例 #18
0
 public void AddAttribute(short wStreamNum, string pszName, out short pwIndex, AttrDataType Type, short wLangIndex, byte[] pValue, int dwLength)
 {
     throw new NotImplementedException();
 }
コード例 #19
0
ファイル: WMVCopy.cs プロジェクト: gchudov/WindowsMediaLib
        //------------------------------------------------------------------------------
        // Name: CWMVCopy::OnStatus()
        // Desc: Implementation of IWMStatusCallback::OnStatus.
        //------------------------------------------------------------------------------
        public void OnStatus(
            Status Status,
            int hr,
            AttrDataType dwType,
            IntPtr pValue,
            IntPtr pvContext)
        {
            //
            // If an error code already exists, just set the event and return.
            //
            if (m_hr < 0)
            {
                m_hEvent.Set();
                return;
            }

            //
            // If an error occurred in the reader, save this error code and set the event.
            //
            if (hr < 0)
            {
                m_hr = hr;
                m_hEvent.Set();
            }

            switch (Status)
            {
            case Status.Opened:
                Console.WriteLine("Reader Callback: File is opened.");
                m_hr = S_Ok;
                m_hEvent.Set();

                break;

            case Status.Started:
                //
                // Ask for 1 second of the stream to be delivered
                //
                m_qwReaderTime = 10000000;

                try
                {
                    m_pReaderAdvanced.DeliverTime(m_qwReaderTime);
                }
                catch (Exception e)
                {
                    int lhr = Marshal.GetHRForException(e);
                    m_hr = hr;
                    m_hEvent.Set();
                }

                break;

            case Status.EOF:
                m_hr   = S_Ok;
                m_fEOF = true;
                m_hEvent.Set();

                break;
            }
        }
コード例 #20
0
 void IWMStatusCallback.OnStatus(Status Status, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #21
0
 public virtual void OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
 {
     AppLogger.Message("ASFNetSink -- OnStatus : " + iStatus.ToString());
 }
コード例 #22
0
 void IWMStatusCallback.OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext)
 {
 }