/// <summary>
        /// Gets the atom attributes for the given <paramref name="atomName"/>
        /// using the information from the given <paramref name="attribute"/>.
        /// This adds the atom to the list of container atoms if-and-only-if the
        /// atom is a container atom.
        /// </summary>
        /// <param name="atomName">the atom name</param>
        /// <param name="attribute">the attribute for the given atom name</param>
        /// <param name="allContainerAtoms">the list of all container atoms</param>
        /// <returns>the atom attributes</returns>
        private static AtomAttributes GetAtomAttributes(AtomName atomName, AtomAttribute attribute, ICollection <AtomName> allContainerAtoms)
        {
            // Retrieve list of atom types (4CC)
            List <uint> atomTypes = new List <uint>();

            if (attribute.AtomType != null)
            {
                foreach (string atomType in attribute.AtomType.Split("|".ToCharArray()))
                {
                    atomTypes.Add(atomType.To4CC());
                }
            }

            // Retrieve suitable parents, all container atoms if empty list
            ICollection <AtomName> suitableParents = attribute.SuitableParents;

            if (suitableParents.Count == 0)
            {
                suitableParents = allContainerAtoms;
            }

            // Update list of all container atoms
            if ((attribute.AtomFlags & AtomFlags.Container) == AtomFlags.Container)
            {
                allContainerAtoms.Add(atomName);
            }
            return(new AtomAttributes(atomTypes.AsReadOnly(), attribute.AtomFlags, suitableParents));
        }
Esempio n. 2
0
            private T GetRequiredAtom <T>(QtAtom parent, AtomName atomName, bool recursive) where T : QtAtom
            {
                T atom = (parent == null) ? null : parent.FindChild(atomName, recursive) as T;

                if (atom == null)
                {
                    _requiredAtomsMissing = true;
                }
                return(atom);
            }
Esempio n. 3
0
 private static QtAtom FindParentAtom(IResultNode atom, AtomName atomName)
 {
     for (var parent = atom.Parent as QtAtom; !parent.IsRoot; parent = parent.Parent as QtAtom)
     {
         if (parent.HeaderName == atomName)
         {
             return(parent);
         }
     }
     return(null);
 }
 public VideoSampleDescription(QtAtom previousHeader, AtomName atomName)
     : base(previousHeader, atomName)
 {
 }
 protected SampleEntry(QtAtom previousHeader, AtomName atomName)
     : base(previousHeader, atomName)
 {
 }
Esempio n. 6
0
 protected SampleGroupDescriptionEntry(QtAtom previousHeader, AtomName atomName)
     : base(previousHeader, atomName)
 {
 }
 public TrackReferenceType(QtAtom previousHeader, AtomName atomName)
     : base(previousHeader, atomName)
 {
 }
Esempio n. 8
0
 public UserDataListEntry(QtAtom previousHeader, AtomName atomName)
     : base(previousHeader, atomName)
 {
 }
 public QtSampleDescriptionAtom(QtAtom previousHeader, AtomName atomName)
     : base(previousHeader, atomName)
 {
     Debug.Assert(atomName.IsFlagSet(AtomFlags.SizeAndType) && !atomName.IsFlagSet(AtomFlags.VersionAndFlags));
 }
 /// <summary>
 /// Returns whether the given <paramref name="atomFlag"/> is set for
 /// the given <paramref name="atomName"/>.
 /// </summary>
 /// <param name="atomName">the atom name</param>
 /// <param name="atomFlag">the flag to test</param>
 /// <returns>true if the flag is set, false otherwise</returns>
 public static bool IsFlagSet(this AtomName atomName, AtomFlags atomFlag)
 {
     return((atomName.GetAtomFlags() & atomFlag) == atomFlag);
 }
        /// <summary>
        /// Returns whether the given <paramref name="atomName"/> is a top-level atom type.
        /// Top-level atoms are only allowed in the root. For example, the Movie atom.
        /// </summary>
        /// <param name="atomName">the atom name</param>
        /// <returns>true if it is a top-level atom type, false otherwise</returns>
        public static bool IsTopLevel(this AtomName atomName)
        {
            ICollection <AtomName> suitableParents = atomName.GetSuitableParents();

            return(suitableParents.Count == 1 && suitableParents.Contains(AtomName.Root));
        }
 /// <summary>
 /// Gets the suitable parents for the given <paramref name="atomName"/>.
 /// </summary>
 /// <param name="atomName">the atom name</param>
 /// <returns>the suitable parents</returns>
 public static ICollection <AtomName> GetSuitableParents(this AtomName atomName)
 {
     return(AtomAttributesForAtomName[atomName].SuitableParents);
 }
        /*
         * /// <summary>
         * /// Gets the atom types field for the given <paramref name="atomName"/>.
         * /// This returns an empty list if the atom name refers to <code>Root</code>
         * /// or <code>Unknown</code> atoms.
         * /// </summary>
         * /// <param name="atomName">the atom name</param>
         * /// <returns>the atom types field</returns>
         * public static ICollection<uint> GetAtomTypes(this AtomName atomName)
         * {
         *      return AtomAttributesForAtomName[atomName].AtomTypes;
         * }
         */

        /// <summary>
        /// Gets the atom type flags for the given <paramref name="atomName"/>.
        /// </summary>
        /// <param name="atomName">the atom name</param>
        /// <returns>the atom flags</returns>
        public static AtomFlags GetAtomFlags(this AtomName atomName)
        {
            return(AtomAttributesForAtomName[atomName].AtomFlags);
        }
 public QtUserDataAtom(QtAtom previousHeader, AtomName atomName)
     : base(previousHeader, atomName)
 {
 }
Esempio n. 15
0
 private T GetRequiredAtom <T>(QtAtom parent, AtomName atomName) where T : QtAtom
 {
     return(GetRequiredAtom <T>(parent, atomName, false));
 }
 protected VisualSampleGroupEntry(QtAtom previousHeader, AtomName atomName)
     : base(previousHeader, atomName)
 {
 }