Logo Search packages:      
Sourcecode: f-spot version File versions  Download package

ByteVector TagLib::Jpeg::File::RenderCOMSegment (  )  [inline, private]

Creates a ByteVector for the comment segment of this file.

A ByteVector with the whole comment segment, if a comment tag exists, otherwise null.

Definition at line 632 of file File.cs.

References TagLib::ByteVector::Add(), TagLib::ByteVector::Count, TagLib::File::GetTag(), and TagLib::Jpeg::JpegCommentTag::Value.

                  // check, if Comment is contained
                  JpegCommentTag com_tag = GetTag (TagTypes.JpegComment) as JpegCommentTag;
                  if (com_tag == null)
                        return null;

                  // create comment data
                  ByteVector com_data =
                        ByteVector.FromString (com_tag.Value + "\0", StringType.Latin1);

                  uint segment_size = (uint) (2 + com_data.Count);

                  // do not render data segments, which cannot fit into the possible segment size
                  if (segment_size > ushort.MaxValue)
                        throw new Exception ("Comment Segment is too big to render");

                  // create segment
                  ByteVector data = new ByteVector (new byte [] { 0xFF, (byte) Marker.COM });
                  data.Add (ByteVector.FromUShort ((ushort) segment_size));

                  data.Add (com_data);

                  return data;

Generated by  Doxygen 1.6.0   Back to index