コード例 #1
0
 public static MXFCDCIPictureEssenceDescriptor GetPictureDescriptorInHeader(this MXFFile file)
 {
     return(file
            .GetHeader()
            .Children
            .OfType <MXFCDCIPictureEssenceDescriptor>()
            .SingleOrDefault());
 }
コード例 #2
0
 public static MXFContentStorage GetContentStorage(this MXFFile file)
 {
     // TODO assuming there is only one content storage
     return(file.LogicalBase
            .Children
            .OfWrappedType <MXFContentStorage>()
            .FirstOrDefault()
            .UnWrapAs <MXFContentStorage>());
 }
コード例 #3
0
        /// <summary>
        /// Check the essence range
        /// </summary>
        /// <param name="file"></param>
        /// <param name="results"></param>
        protected void CheckUserDates(MXFFile file, List <MXFValidationResult> results)
        {
            List <MXFSystemItem> items = this.m_systemItems.OrderBy(a => a.ContinuityCount).ToList();

            if (items.Count > 1)
            {
                MXFTimeStamp ts = new MXFTimeStamp(items.First().UserDate);
                if (ts != null)
                {
                    MXFValidationResult valResult = new MXFValidationResult("System Items");
                    results.Add(valResult);                     // And directly add the results

                    MXFTimeStamp tsLast = null;
                    for (int n = 1; n < items.Count() - 1; n++)                     // Skip last one (always invalid??)
                    {
                        ts.Increase();
                        if (!items[n].UserDate.IsEmpty())
                        {
                            if (!items[n].UserDate.IsSame(ts))
                            {
                                valResult.SetError(string.Format("Invalid user date at offset {0} (was {1}, expected {2})!", items[n].Offset, items[n].UserDate, ts));
                                return;
                            }
                            tsLast = items[n].UserDate;
                        }
                    }
                    if (tsLast != null)
                    {
                        valResult.SetSuccess(string.Format("UserDates are continious from {0} to {1}, at {2} fps!", items.First().UserDate, tsLast, ts.FrameRate));
                    }
                    else
                    {
                        valResult.SetSuccess(string.Format("UserDates are continious!"));
                    }
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Check the essence range
        /// </summary>
        /// <param name="file"></param>
        /// <param name="results"></param>
        protected void CheckContinuityCounter(MXFFile file, List <MXFValidationResult> results)
        {
            MXFValidationResult valResult = new MXFValidationResult("System Items");

            results.Add(valResult);             // And directly add the results

            // Check for continous range
            int cc         = -1;
            int errorCount = 0;

            foreach (MXFSystemItem si in this.m_systemItems)
            {
                if (si.ContinuityCount - cc != 1)
                {
                    errorCount++;
                    //valResult.SetError(string.Format("Invalid continuity count for system item at offset {0}. CC should be {1} but is {2}!", si.Offset, cc + 1, si.ContinuityCount));
                    //return;
                }
                cc = si.ContinuityCount;
            }

            if (errorCount > 0)
            {
                if (errorCount >= this.m_systemItems.Count() - 1)
                {
                    valResult.SetWarning(string.Format("All continuity counter values are not set!"));
                }
                else
                {
                    valResult.SetError(string.Format("Found {0} invalid continuity counter values (total system items {1})!", errorCount, this.m_systemItems.Count()));
                }
            }
            else
            {
                valResult.SetSuccess(string.Format("Continuity counter values are correct!"));
            }
        }
コード例 #5
0
 public static bool IsFooterClosedAndComplete(this MXFFile file)
 {
     return(file.GetFooter().IsPartitionClosedAndComplete());
 }
コード例 #6
0
        public static bool AreAllPartitionsOP1a(this MXFFile file)
        {
            MXFKey op1a = new MXFKey(0x06, 0x0E, 0x2B, 0x34, 0x04, 0x01, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x01, 0x09, 0x00);

            return(file.Partitions.Select(p => p.OP).Any(s => s == op1a));
        }
コード例 #7
0
 public static bool IsKAGSizeOfAllPartitionsEqual(this MXFFile file, uint size)
 {
     return(file.Partitions.Select(p => p.KagSize).All(s => s == size));
 }
コード例 #8
0
 public static IEnumerable <MXFAES3PCMDescriptor> GetAudioEssenceDescriptorsInHeader(this MXFFile file)
 {
     return(file
            .GetHeader()
            .Children
            .OfType <MXFAES3PCMDescriptor>());
 }
コード例 #9
0
 public static IEnumerable <MXFPartition> GetBodiesContainingEssences(this MXFFile file)
 {
     return(file.GetBodies().Where(b => b.Children.OfType <MXFEssenceElement>().Any()));
 }
コード例 #10
0
 public static MXFPartition GetFooter(this MXFFile file)
 {
     return(file.Partitions.SingleOrDefault(p => p.PartitionType == PartitionType.Footer));
 }
コード例 #11
0
 public static MXFPartition GetHeader(this MXFFile file)
 {
     //TODO should we return all found elements or use single explicitly
     return(file.Partitions.SingleOrDefault(p => p.PartitionType == PartitionType.Header));
 }
コード例 #12
0
 public static bool IsDurationOfBodiesMax240Units(this MXFFile file)
 {
     return(file.GetBodiesContainingEssences().All(b => b.IsPartitionDurationBetween(1, 240)));
 }
コード例 #13
0
 public static bool ISRIPPresent(this MXFFile file)
 {
     return(file.RIP != null);
 }
コード例 #14
0
 public static bool IsHeaderStatusClosedAndComplete(this MXFFile file)
 {
     return(!(file.GetHeader().IsPartitionClosedAndComplete()));
 }
コード例 #15
0
 public static IEnumerable <MXFPartition> GetBodies(this MXFFile file)
 {
     return(file.Partitions.Where(p => p.PartitionType == PartitionType.Body));
 }
コード例 #16
0
 public static bool AreEssencesInHeader(this MXFFile file)
 {
     return(!file.GetHeader().Children.OfType <MXFEssenceElement>().Any());
 }
コード例 #17
0
 /// <summary>
 /// Initialize this test
 /// </summary>
 /// <param name="name"></param>
 /// <param name="file"></param>
 /// <param name="worker"></param>
 public void Initialize(MXFFile file, BackgroundWorker worker)
 {
     this.File   = file;
     this.Worker = worker;
 }