// Methods tested : GetCountOfTableDescriptors, GetTableDescriptorByIndex // GetTableDescriptorByTag private void TestBatch2() { int hr = 0; int descriptorCount = 0; hr = tsdt.GetCountOfTableDescriptors(out descriptorCount); Debug.Assert((hr == 0) && (descriptorCount > 0), "ITSDT.GetCountOfTableDescriptors failed"); IGenericDescriptor descriptor = null; byte tag = 0; for (int i = 0; i < descriptorCount; i++) { hr = tsdt.GetTableDescriptorByIndex(i, out descriptor); Debug.Assert((hr == 0) && (descriptor != null), "ITSDT.GetTableDescriptorByIndex failed"); hr = descriptor.GetTag(out tag); DsError.ThrowExceptionForHR(hr); Marshal.ReleaseComObject(descriptor); } hr = tsdt.GetTableDescriptorByTag(tag, null, out descriptor); Debug.Assert((hr == 0) && (descriptor != null), "ITSDT.GetTableDescriptorByTag failed"); Marshal.ReleaseComObject(descriptor); }
// Methods tested : GetCountOfTableDescriptors, GetTableDescriptorByIndex // GetTableDescriptorByTag public void TestBatch3() { int hr = 0; int tableDescriptorsCount = 0; hr = nit.GetCountOfTableDescriptors(out tableDescriptorsCount); Debug.Assert((hr == 0) && (tableDescriptorsCount != 0), "IDVB_NIT.GetCountOfTableDescriptors failed"); IGenericDescriptor descriptor = null; byte tag = 0; for (int i = 0; i < tableDescriptorsCount; i++) { hr = nit.GetTableDescriptorByIndex(i, out descriptor); Debug.Assert((hr == 0) && (descriptor != null), "IDVB_NIT.GetTableDescriptorByIndex failed"); // save it for later... hr = descriptor.GetTag(out tag); DsError.ThrowExceptionForHR(hr); Marshal.ReleaseComObject(descriptor); } hr = nit.GetTableDescriptorByTag(tag, null, out descriptor); Debug.Assert((hr == 0) && (descriptor != null), "IDVB_NIT.GetTableDescriptorByTag failed"); Marshal.ReleaseComObject(descriptor); }
// Methods tested : GetCountOfRecords, GetRecordEITPresentFollowingFlag // GetRecordEITScheduleFlag, GetRecordFreeCAMode, // GetRecordRunningStatus, GetRecordServiceId, // GetRecordCountOfDescriptors, GetRecordDescriptorByIndex // GetRecordDescriptorByTag public void TestBatch2() { int hr = 0; int recordCount = 0; hr = sdt.GetCountOfRecords(out recordCount); Debug.Assert((hr == 0) && (recordCount != 0), "IDVB_SDT.GetCountOfRecords failed"); for (int i = 0; i < recordCount; i++) { // The results depend on too many things to test the returned values bool EITPresentFollowingFlag = false; hr = sdt.GetRecordEITPresentFollowingFlag(i, out EITPresentFollowingFlag); Debug.Assert((hr == 0), "IDVB_SDT.GetRecordEITPresentFollowingFlag failed"); bool EIITScheduleFlag = false; hr = sdt.GetRecordEITScheduleFlag(i, out EIITScheduleFlag); Debug.Assert((hr == 0), "IDVB_SDT.GetRecordEITScheduleFlag failed"); bool FreeCAMode = false; hr = sdt.GetRecordFreeCAMode(i, out FreeCAMode); Debug.Assert((hr == 0), "IDVB_SDT.GetRecordFreeCAMode failed"); RunningStatus runningStatus = 0; hr = sdt.GetRecordRunningStatus(i, out runningStatus); Debug.Assert((hr == 0), "IDVB_SDT.GetRecordRunningStatus failed"); short serviceId = 0; hr = sdt.GetRecordServiceId(i, out serviceId); Debug.Assert((hr == 0), "IDVB_SDT.GetRecordServiceId failed"); int descriptorCount = 0; hr = sdt.GetRecordCountOfDescriptors(i, out descriptorCount); Debug.Assert((hr == 0) && (descriptorCount != 0), "IDVB_SDT.GetRecordServiceId failed"); IGenericDescriptor descriptor = null; byte tag = 0; for (int j = 0; j < descriptorCount; j++) { hr = sdt.GetRecordDescriptorByIndex(i, j, out descriptor); Debug.Assert((hr == 0) && (descriptor != null), "IDVB_SDT.GetRecordDescriptorByIndex failed"); // save it for later hr = descriptor.GetTag(out tag); DsError.ThrowExceptionForHR(hr); Marshal.ReleaseComObject(descriptor); } hr = sdt.GetRecordDescriptorByTag(i, tag, null, out descriptor); Debug.Assert((hr == 0) && (descriptor != null), "IDVB_SDT.GetRecordDescriptorByTag failed"); Marshal.ReleaseComObject(descriptor); } }
// Methods tested : GetCountOfRecords, GetRecordDuration, GetRecordEventId // GetRecordFreeCAMode, GetRecordRunningStatus, // GetRecordStartTime, GetSegmentLastSectionNumber // GetRecordCountOfDescriptors, GetRecordDescriptorByIndex // GetRecordDescriptorByTag public void TestBatch2() { int hr = 0; int recordCount = 0; hr = eit.GetCountOfRecords(out recordCount); Debug.Assert((hr == 0) && (recordCount != 0), "IDVB_EIT.GetCountOfRecords failed"); for (int i = 0; i < recordCount; i++) { // the results are dependent to the multiplex MpegDuration duration = new MpegDuration(); hr = eit.GetRecordDuration(i, out duration); Debug.Assert((hr == 0) && (duration.ToTimeSpan() > TimeSpan.Zero), "IDVB_EIT.GetRecordDuration failed"); short eventId = 0; hr = eit.GetRecordEventId(i, out eventId); Debug.Assert((hr == 0) && (eventId != 0), "IDVB_EIT.GetRecordEventId failed"); bool freeCAMode = true; hr = eit.GetRecordFreeCAMode(i, out freeCAMode); Debug.Assert((hr == 0), "IDVB_EIT.GetRecordFreeCAMode failed"); RunningStatus runningStatus = 0; hr = eit.GetRecordRunningStatus(i, out runningStatus); Debug.Assert((hr == 0 && (runningStatus != 0)), "IDVB_EIT.GetRecordRunningStatus failed"); MpegDateAndTime dateAndTime = new MpegDateAndTime(); hr = eit.GetRecordStartTime(i, out dateAndTime); Debug.Assert((hr == 0) && (dateAndTime.ToDateTime() > DateTime.MinValue), "IDVB_EIT.GetRecordStartTime failed"); int descriptorCount = 0; hr = eit.GetRecordCountOfDescriptors(i, out descriptorCount); Debug.Assert((hr == 0 && (descriptorCount != 0)), "IDVB_EIT.GetRecordCountOfDescriptors failed"); IGenericDescriptor descriptor = null; byte tag = 0; for (int j = 0; j < descriptorCount; j++) { hr = eit.GetRecordDescriptorByIndex(i, j, out descriptor); Debug.Assert((hr == 0 && (descriptor != null)), "IDVB_EIT.GetRecordDescriptorByIndex failed"); hr = descriptor.GetTag(out tag); DsError.ThrowExceptionForHR(hr); Marshal.ReleaseComObject(descriptor); } hr = eit.GetRecordDescriptorByTag(i, tag, null, out descriptor); Debug.Assert((hr == 0 && (descriptor != null)), "IDVB_EIT.GetRecordDescriptorByTag failed"); Marshal.ReleaseComObject(descriptor); } }
private void Config() { #if ALLOW_UNTESTED_INTERFACES int hr = 0; IDVB_NIT nit; IGenericDescriptor descriptor = null; parser = (IDvbSiParser) new DvbSiParser(); graph = new BdaGraph(); graph.InitializeGraph(); graph.MakeTuneRequest(); graph.RunGraph(); hr = parser.Initialize(graph.bdaSecTab as IMpeg2Data); Debug.Assert(hr == 0, "Initialize failed !!!"); for (int j = 0; j < 10; j++) { hr = parser.GetNIT(0x40, null, out nit); Debug.Assert(nit != null, "Can't get a NIT object"); int recordCount = 0; hr = nit.GetCountOfRecords(out recordCount); descriptor = null; for (int i = 0; i < recordCount; i++) { // see the doc for the meaning of the 0x43 hr = nit.GetRecordDescriptorByTag(i, 0x43, null, out descriptor); if (descriptor != null) { break; } } Marshal.ReleaseComObject(nit); if (descriptor != null) { break; } } dsdsDescriptor = descriptor as IDvbSatelliteDeliverySystemDescriptor; Debug.Assert(dsdsDescriptor != null, "Can't get a IDvbSatelliteDeliverySystemDescriptor object"); #endif }
// Methods tested : GetCountOfRecords, GetRecordOriginalNetworkId, // GetRecordTransportStreamId, GetRecordCountOfDescriptors // GetRecordDescriptorByIndex, GetRecordDescriptorByTag public void TestBatch2() { int hr = 0; int recordCount = 0; hr = nit.GetCountOfRecords(out recordCount); Debug.Assert((hr == 0) && (recordCount != 0), "IDVB_NIT.GetCountOfRecords failed"); for (int i = 0; i < recordCount; i++) { short originalNetworkId = 0; hr = nit.GetRecordOriginalNetworkId(i, out originalNetworkId); Debug.Assert((hr == 0) && (originalNetworkId != 0), "IDVB_NIT.GetRecordOriginalNetworkId failed"); short transportStreamId = 0; hr = nit.GetRecordTransportStreamId(i, out transportStreamId); Debug.Assert((hr == 0) && (transportStreamId != 0), "IDVB_NIT.GetRecordTransportStreamId failed"); int descriptorCount = 0; hr = nit.GetRecordCountOfDescriptors(i, out descriptorCount); Debug.Assert((hr == 0) && (descriptorCount != 0), "IDVB_NIT.GetRecordCountOfDescriptors failed"); IGenericDescriptor descriptor = null; byte tag = 0; for (int j = 0; j < descriptorCount; j++) { hr = nit.GetRecordDescriptorByIndex(i, j, out descriptor); Debug.Assert((hr == 0) && (descriptor != null), "IDVB_NIT.GetRecordDescriptorByIndex failed"); // save it for later... hr = descriptor.GetTag(out tag); DsError.ThrowExceptionForHR(hr); Marshal.ReleaseComObject(descriptor); } hr = nit.GetRecordDescriptorByTag(i, tag, null, out descriptor); Debug.Assert((hr == 0) && (descriptor != null), "IDVB_NIT.GetRecordDescriptorByTag failed"); Marshal.ReleaseComObject(descriptor); } }