Пример #1
0
        // 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);
            }
        }
Пример #2
0
        private void Config()
        {
#if ALLOW_UNTESTED_INTERFACES
            int hr = 0;

            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 !!!");

            IDVB_SDT sdt = null;
            hr = parser.GetSDT(0x42, null, out sdt);
            DsError.ThrowExceptionForHR(hr);

            int recordCount = 0;

            hr = sdt.GetCountOfRecords(out recordCount);
            DsError.ThrowExceptionForHR(hr);

            for (int i = 0; i < recordCount; i++)
            {
                short serviceId = 0;
                hr = sdt.GetRecordServiceId(i, out serviceId);
                DsError.ThrowExceptionForHR(hr);

                hr = parser.GetEIT(0x4e, serviceId, out eit);
                if (eit != null)
                {
                    break;
                }
            }

            Marshal.ReleaseComObject(sdt);

            Debug.Assert(eit != null, "Can't get a SDT object");
#endif
        }