public void OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext) { Debug.Write(string.Format("{0} 0x{1:x} {2} {3} {4} {5} ", iStatus, hr, WMError.GetErrorText(hr), dwType, pValue.ToInt32(), pvContext.ToInt32())); if ((iStatus == Status.Timer) && (dwType == AttrDataType.DWORD) && (Marshal.ReadInt32(pValue) == m_CheckTimer) && (pvContext.ToInt32() == 345)) { m_Triggered = true; } 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; } }
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; } }
public void OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext) { if (hr != 0) { string s = WMError.GetErrorText(hr); } if (iStatus == Status.Opened || iStatus == Status.BufferingStart) { lock (m_openLock) { Monitor.PulseAll(m_openLock); } } }
private void ShowError(Exception e) { int hr = Marshal.GetHRForException(e); string s = WMError.GetErrorText(hr); if (s == null) { s = e.Message; } else { s = string.Format("{0} ({1})", s, e.Message); } System.Windows.Forms.MessageBox.Show(string.Format("0x{0:x}: {1}", hr, s), "Exception", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); }
public void OnStatus(Status iStatus, int hr, AttrDataType dwType, IntPtr pValue, IntPtr pvContext) { Debug.Write(string.Format("Status: {0} 0x{1:x} {2} {3} {4} {5} ", iStatus, hr, WMError.GetErrorText(hr), dwType, pValue.ToInt32(), pvContext.ToInt32())); if (iStatus == Status.Opened) { m_Opened = true; } 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: int i = Marshal.ReadInt32(pValue); Debug.WriteLine(i); break; case AttrDataType.QWORD: Debug.WriteLine(Marshal.ReadInt64(pValue)); break; default: Debug.WriteLine("???"); break; } }
static void Main(string[] args) { try { //INSNetSourceCreatorTest t1 = new INSNetSourceCreatorTest(); //t1.DoTests(); //INSSBufferTest t2 = new INSSBufferTest(); //t2.DoTests(); //INSSBuffer2Test t3 = new INSSBuffer2Test(); //t3.DoTests(); //INSSBuffer3Test t4 = new INSSBuffer3Test(); //t4.DoTests(); //INSSBuffer4Test t5 = new INSSBuffer4Test(); //t5.DoTests(); //IWMAddressAccessTest t7 = new IWMAddressAccessTest(); //t7.DoTests(); //IWMAddressAccess2Test t8 = new IWMAddressAccess2Test(); //t8.DoTests(); //IWMBackupRestorePropsTest t9 = new IWMBackupRestorePropsTest(); //t9.DoTests(); //IWMBandwidthSharingTest t10 = new IWMBandwidthSharingTest(); //t10.DoTests(); //IWMClientConnectionsTest t11 = new IWMClientConnectionsTest(); //t11.DoTests(); //IWMClientConnections2Test t12 = new IWMClientConnections2Test(); //t12.DoTests(); //IWMCodecAMVideoAcceleratorTest t13 = new IWMCodecAMVideoAcceleratorTest(); //t13.DoTests(); //IWMCodecInfoTest t14 = new IWMCodecInfoTest(); //t14.DoTests(); //IWMCodecInfo2Test t15 = new IWMCodecInfo2Test(); //t15.DoTests(); //IWMCodecInfo3Test t16 = new IWMCodecInfo3Test(); //t16.DoTests(); //IWMCodecVideoAcceleratorTest t17 = new IWMCodecVideoAcceleratorTest(); //t17.DoTests(); //IWMCredentialCallbackTest t18 = new IWMCredentialCallbackTest(); //t18.DoTests(); //IWMDRMEditorTest t19 = new IWMDRMEditorTest(); //t19.DoTests(); //IWMDRMReaderTest t20 = new IWMDRMReaderTest(); //t20.DoTests(); //IWMDRMWriterTest t21 = new IWMDRMWriterTest(); //t21.DoTests(); //IWMHeaderInfoTest t22 = new IWMHeaderInfoTest(); //t22.DoTests(); //IWMHeaderInfo2Test t23 = new IWMHeaderInfo2Test(); //t23.DoTests(); //IWMHeaderInfo3Test t24 = new IWMHeaderInfo3Test(); //t24.DoTests(); //IWMImageInfoTest t25 = new IWMImageInfoTest(); //t25.DoTests(); //IWMIndexerTest t26 = new IWMIndexerTest(); //t26.DoTests(); //IWMIndexer2Test t27 = new IWMIndexer2Test(); //t27.DoTests(); //IWMInputMediaPropsTest t28 = new IWMInputMediaPropsTest(); //t28.DoTests(); //IWMIStreamPropsTest t29 = new IWMIStreamPropsTest(); //t29.DoTests(); //IWMLanguageListTest t30 = new IWMLanguageListTest(); //t30.DoTests(); //IWMLicenseBackupTest t31 = new IWMLicenseBackupTest(); //t31.DoTests(); //IWMLicenseRestoreTest t32 = new IWMLicenseRestoreTest(); //t32.DoTests(); //IWMMediaPropsTest t33 = new IWMMediaPropsTest(); //t33.DoTests(); //IWMMetadataEditorTest t34 = new IWMMetadataEditorTest(); //t34.DoTests(); //IWMMetadataEditor2Test t35 = new IWMMetadataEditor2Test(); //t35.DoTests(); //IWMMutualExclusionTest t36 = new IWMMutualExclusionTest(); //t36.DoTests(); //IWMMutualExclusion2Test t37 = new IWMMutualExclusion2Test(); //t37.DoTests(); //IWMOutputMediaPropsTest t38 = new IWMOutputMediaPropsTest(); //t38.DoTests(); //IWMPacketSizeTest t39 = new IWMPacketSizeTest(); //t39.DoTests(); //IWMPacketSize2Test t40 = new IWMPacketSize2Test(); //t40.DoTests(); //IWMPlayerTimestampHookTest t41 = new IWMPlayerTimestampHookTest(); //t41.DoTests(); //IWMProfileTest t42 = new IWMProfileTest(); //t42.DoTests(); //IWMProfile2Test t43 = new IWMProfile2Test(); //t43.DoTests(); //IWMProfile3Test t44 = new IWMProfile3Test(); //t44.DoTests(); //IWMProfileManagerTest t45 = new IWMProfileManagerTest(); //t45.DoTests(); //IWMProfileManager2Test t46 = new IWMProfileManager2Test(); //t46.DoTests(); //IWMProfileManagerLanguageTest t47 = new IWMProfileManagerLanguageTest(); //t47.DoTests(); //IWMPropertyVaultTest t48 = new IWMPropertyVaultTest(); //t48.DoTests(); //IWMReaderTest t49 = new IWMReaderTest(); //t49.DoTests(); //IWMReaderAcceleratorTest t50 = new IWMReaderAcceleratorTest(); //t50.DoTests(); //IWMReaderAdvancedTest t51 = new IWMReaderAdvancedTest(); //t51.DoTests(); //IWMReaderAdvanced2Test t52 = new IWMReaderAdvanced2Test(); //t52.DoTests(); //IWMReaderAdvanced3Test t53 = new IWMReaderAdvanced3Test(); //t53.DoTests(); //IWMReaderAdvanced4Test t54 = new IWMReaderAdvanced4Test(); //t54.DoTests(); //IWMReaderAllocatorExTest t55 = new IWMReaderAllocatorExTest(); //t55.DoTests(); //IWMReaderCallbackTest t56 = new IWMReaderCallbackTest(); //t56.DoTests(); //IWMReaderCallbackAdvancedTest t57 = new IWMReaderCallbackAdvancedTest(); //t57.DoTests(); //IWMReaderNetworkConfigTest t58 = new IWMReaderNetworkConfigTest(); //t58.DoTests(); //IWMReaderNetworkConfig2Test t59 = new IWMReaderNetworkConfig2Test(); //t59.DoTests(); //IWMReaderStreamClockTest t60 = new IWMReaderStreamClockTest(); //t60.DoTests(); //IWMReaderTimecodeTest t61 = new IWMReaderTimecodeTest(); //t61.DoTests(); //IWMReaderTypeNegotiationTest t62 = new IWMReaderTypeNegotiationTest(); //t62.DoTests(); //IWMRegisterCallbackTest t63 = new IWMRegisterCallbackTest(); //t63.DoTests(); //IWMSBufferAllocatorTest t64 = new IWMSBufferAllocatorTest(); //t64.DoTests(); //IWMSInternalAdminNetSourceTest t65 = new IWMSInternalAdminNetSourceTest(); //t65.DoTests(); //IWMSInternalAdminNetSource2Test t66 = new IWMSInternalAdminNetSource2Test(); //t66.DoTests(); //IWMSInternalAdminNetSource3Test t67 = new IWMSInternalAdminNetSource3Test(); //t67.DoTests(); //IWMStatusCallbackTest t68 = new IWMStatusCallbackTest(); //t68.DoTests(); //IWMStreamConfigTest t69 = new IWMStreamConfigTest(); //t69.DoTests(); //IWMStreamConfig2Test t70 = new IWMStreamConfig2Test(); //t70.DoTests(); //IWMStreamConfig3Test t71 = new IWMStreamConfig3Test(); //t71.DoTests(); //IWMStreamListTest t72 = new IWMStreamListTest(); //t72.DoTests(); //IWMStreamPrioritizationTest t73 = new IWMStreamPrioritizationTest(); //t73.DoTests(); //IWMSyncReaderTest t74 = new IWMSyncReaderTest(); //t74.DoTests(); //IWMSyncReader2Test t75 = new IWMSyncReader2Test(); //t75.DoTests(); //IWMVideoMediaPropsTest t76 = new IWMVideoMediaPropsTest(); //t76.DoTests(); //IWMWatermarkInfoTest t77 = new IWMWatermarkInfoTest(); //t77.DoTests(); //IWMWriterTest t78 = new IWMWriterTest(); //t78.DoTests(); //IWMWriterAdvancedTest t79 = new IWMWriterAdvancedTest(); //t79.DoTests(); //IWMWriterAdvanced2Test t80 = new IWMWriterAdvanced2Test(); //t80.DoTests(); //IWMWriterAdvanced3Test t81 = new IWMWriterAdvanced3Test(); //t81.DoTests(); //IWMWriterFileSinkTest t82 = new IWMWriterFileSinkTest(); //t82.DoTests(); //IWMWriterFileSink2Test t83 = new IWMWriterFileSink2Test(); //t83.DoTests(); //IWMWriterFileSink3Test t84 = new IWMWriterFileSink3Test(); //t84.DoTests(); //IWMWriterNetworkSinkTest t85 = new IWMWriterNetworkSinkTest(); //t85.DoTests(); //IWMWriterPostViewTest t86 = new IWMWriterPostViewTest(); //t86.DoTests(); //IWMWriterPostViewCallbackTest t87 = new IWMWriterPostViewCallbackTest(); //t87.DoTests(); //IWMWriterPreprocessTest t88 = new IWMWriterPreprocessTest(); //t88.DoTests(); //IWMWriterPushSinkTest t89 = new IWMWriterPushSinkTest(); //t89.DoTests(); //IWMWriterSinkTest t90 = new IWMWriterSinkTest(); //t90.DoTests(); //IWMReaderAdvanced5Test t91 = new IWMReaderAdvanced5Test(); //t91.DoTests(); //IWMReaderAdvanced6Test t92 = new IWMReaderAdvanced6Test(); //t92.DoTests(); //ExternTest t93 = new ExternTest(); //t93.DoTests(); //IWMReaderPlaylistBurnTest t94 = new IWMReaderPlaylistBurnTest(); //t94.DoTests(); //TestMMIO t95 = new TestMMIO(); //t95.DoTests(); } catch (Exception e) { int hr = Marshal.GetHRForException(e); string s = WMError.GetErrorText(hr); if (s == null) { s = e.Message; } else { s = string.Format("{0} ({1})", s, e.Message); } System.Windows.Forms.MessageBox.Show(string.Format("0x{0:x}: {1}", hr, s), "Exception", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
//------------------------------------------------------------------------------ // Name: PrintProperties() // Desc: Displays all DRM properties //------------------------------------------------------------------------------ static void PrintProperties(string pwszFileName, string pwszPropertyName) { string[] g_DRMProperties = { Constants.g_wszWMDRM_IsDRM, Constants.g_wszWMDRM_IsDRMCached, Constants.g_wszWMDRM_BaseLicenseAcqURL, Constants.g_wszWMDRM_Rights, Constants.g_wszWMDRM_LicenseID, Constants.g_wszWMDRM_ActionAllowed_Playback, //= L\"ActionAllowed.Play\" Constants.g_wszWMDRM_ActionAllowed_CopyToCD, //= L\"ActionAllowed.Print.redbook\" Constants.g_wszWMDRM_ActionAllowed_CopyToSDMIDevice, //= L\"ActionAllowed.Transfer.SDMI\" Constants.g_wszWMDRM_ActionAllowed_CopyToNonSDMIDevice, //= L\"ActionAllowed.Transfer.NONSDMI\" Constants.g_wszWMDRM_ActionAllowed_Backup, //= L\"ActionAllowed.Backup\" Constants.g_wszWMDRM_DRMHeader, //= L\"DRMHeader.\" Constants.g_wszWMDRM_DRMHeader_KeyID, //= L\"DRMHeader.KID\" Constants.g_wszWMDRM_DRMHeader_LicenseAcqURL, //= L\"DRMHeader.LAINFO\" Constants.g_wszWMDRM_DRMHeader_ContentID, //= L\"DRMHeader.CID\" Constants.g_wszWMDRM_DRMHeader_IndividualizedVersion, //= L\"DRMHeader.SECURITYVERSION\" Constants.g_wszWMDRM_DRMHeader_ContentDistributor, //= L\"DRMHeader.ContentDistributor\" Constants.g_wszWMDRM_DRMHeader_SubscriptionContentID, //= L\"DRMHeader.SubscriptionContentID\" Constants.g_wszWMDRM_LicenseState_Playback, Constants.g_wszWMDRM_LicenseState_CopyToCD, Constants.g_wszWMDRM_LicenseState_CopyToSDMIDevice, Constants.g_wszWMDRM_LicenseState_CopyToNonSDMIDevice, Constants.g_wszWMDRM_LicenseState_Copy, Constants.g_wszWMDRM_LicenseState_PlaylistBurn, Constants.g_wszWMDRM_LicenseState_CreateThumbnailImage, Constants.g_wszWMDRM_LicenseState_Backup, Constants.g_wszWMDRM_LicenseState_CollaborativePlay }; CDrmHeaderQuery drmHQ = new CDrmHeaderQuery(); try { drmHQ.Open(pwszFileName); } catch (Exception e) { int hr = Marshal.GetHRForException(e); Console.WriteLine(string.Format("Failed to open file, HR = 0x{0}", hr)); return; } try { if (null != pwszPropertyName) { try { string s = drmHQ.GetPropertyAsString(pwszPropertyName); Console.WriteLine(string.Format("{0} :\t{1}", pwszPropertyName, s)); } catch (Exception e) { int hr = Marshal.GetHRForException(e); Console.WriteLine(string.Format("Failed to query for the given property. HR = 0x{0}", hr)); } } else { foreach (string sProp in g_DRMProperties) { try { string s = drmHQ.GetPropertyAsString(sProp); Console.WriteLine(string.Format("{0} :\t{1}", sProp, s)); } catch { } } } } catch (Exception e) { int hr = Marshal.GetHRForException(e); string s = WMError.GetErrorText(hr); if (s == null) { s = e.Message; } else { s = string.Format("{0} ({1})", s, e.Message); } Console.WriteLine(string.Format("0x{0:x}: {1}", hr, s)); } }