예제 #1
0
        /// <summary>
        /// Gets the <see cref="uint" /> from the <see cref="TagLib.Mpeg4.AppleTag" /> using the specified type.
        /// </summary>
        /// <param name="appleTag">The apple tag.</param>
        /// <param name="type">The type.</param>
        /// <returns>The value.</returns>
        public static uint GetUInt32(this TagLib.Mpeg4.AppleTag appleTag, TagLib.ReadOnlyByteVector type)
        {
            foreach (var item in appleTag.DataBoxes(type))
            {
                if (item.Data.Count == 4)
                {
                    byte[] data;
                    if (System.BitConverter.IsLittleEndian)
                    {
                        data = new byte[item.Data.Count];
                        data[0] = item.Data.Data[3];
                        data[1] = item.Data.Data[2];
                        data[2] = item.Data.Data[1];
                        data[3] = item.Data.Data[0];
                    }
                    else
                    {
                        data = item.Data.Data;
                    }

                    return System.BitConverter.ToUInt32(data);
                }
            }

            return 0u;
        }
예제 #2
0
        /// <summary>
        /// Gets a value indicating whether this <see cref="TagLib.Mpeg4.AppleTag" /> represents a TV show.
        /// </summary>
        /// <param name="appleTag">The apple tag.</param>
        /// <returns><see langword="true" /> if <paramref name="appleTag"/> represents a TV show.</returns>
        public static bool IsTvShow(this TagLib.Mpeg4.AppleTag appleTag)
        {
            foreach (var item in appleTag.DataBoxes(StikAtom))
            {
                if (item.Data.Count == 1)
                {
                    return item.Data.Data[0] == 10;
                }
            }

            return false;
        }
예제 #3
0
 /// <summary>
 /// Returns whether the <see cref="TagLib.Mpeg4.AppleTag"/> represents a movie.
 /// </summary>
 /// <param name="appleTag">The apple tag.</param>
 /// <returns><see langword="true"/> if <paramref name="appleTag"/> is a movie; otherwise <see langword="false"/>.</returns>
 public static bool IsMovie(this TagLib.Mpeg4.AppleTag appleTag) => appleTag.DataBoxes(StikAtom).FirstOrDefault(item => item.Data.Count == 1) is TagLib.Mpeg4.AppleDataBox stikAtom && stikAtom.Data.Data[0] == 9;