Beispiel #1
0
        internal override void Write(Stream output)
        {
            var contents = Encoding.UTF8.GetBytes(Value);

            using (var writer = new Mp4Writer(output))
            {
                // Write the atom header
                writer.WriteBigEndian((uint)contents.Length + 24);
#if NETSTANDARD2_0
                writer.Write(CodePagesEncodingProvider.Instance.GetEncoding(1252).GetBytes(_fourCc));
#else
                Span <byte> fourCcBuffer = stackalloc byte[4];
                CodePagesEncodingProvider.Instance.GetEncoding(1252).GetBytes(_fourCc, fourCcBuffer);
                writer.Write(fourCcBuffer);
#endif

                // Write the data atom header
                writer.WriteBigEndian((uint)contents.Length + 16);
                writer.WriteBigEndian(0x64617461); // 'data'

                // Set the type flag
                writer.WriteBigEndian(1);
                writer.WriteZeros(4);

                writer.Write(contents);
            }
        }
Beispiel #2
0
        internal override void Write(Stream output)
        {
            using (var writer = new Mp4Writer(output))
            {
                // Write the atom header
                writer.WriteBigEndian(32);
                writer.WriteBigEndian(0x74726B6E); // 'trkn'

                // Write the data atom header
                writer.WriteBigEndian(24);
                writer.WriteBigEndian(0x64617461); // 'data'

                writer.WriteZeros(11);
                writer.Write(TrackNumber);
                writer.WriteZeros(1);
                writer.Write(TrackCount);
                writer.WriteZeros(2);
            }
        }
Beispiel #3
0
        internal override void Write(Stream output)
        {
            if (_size <= 8)
            {
                return;
            }

            using (var writer = new Mp4Writer(output))
            {
                // Write the atom header
                writer.WriteBigEndian(_size);
                writer.WriteBigEndian(0x66726565);  // 'free'

                writer.WriteZeros((int)_size - 8);
            }
        }
Beispiel #4
0
        internal override void Write(Stream output)
        {
            using (var writer = new Mp4Writer(output))
            {
                // Write the atom header
                writer.WriteBigEndian((uint)Value.Data.Length + 24);
                writer.WriteBigEndian(0x636F7672); // 'covr'

                // Write the data atom header
                writer.WriteBigEndian((uint)Value.Data.Length + 16);
                writer.WriteBigEndian(0x64617461); // 'data'

                // Set the type flag to PNG or JPEG
                writer.WriteBigEndian(Value.Lossless ? 14u : 13u);
                writer.WriteZeros(4);

#if NETSTANDARD2_0
                writer.Write(Value.Data.ToArray());
#else
                writer.Write(Value.Data);
#endif
            }
        }