~ubuntu-branches/debian/sid/hipo/sid

« back to all changes in this revision

Viewing changes to taglib-sharp/TagLib/Mpeg4/Boxes/IsoChunkLargeOffsetBox.cs

  • Committer: Bazaar Package Importer
  • Author(s): Arthur Loiret
  • Date: 2008-04-02 15:37:34 UTC
  • mfrom: (1.1.3 upstream) (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080402153734-hnz2ia2tj3zox4z8
Tags: 0.6.1-2
* 0001-Remove-deprecated-Encoding-field-from-hipo.desktop.i.patch: Add,
  taken from Ubuntu.
* Let's hope Ubuntu maintainer Miguel Ruiz will send its patches back to
  Debian next time.
* debian/copyright: Rewrite.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
namespace TagLib.Mpeg4
2
 
{
3
 
   public class IsoChunkLargeOffsetBox : FullBox
4
 
   {
5
 
      #region Private Properties
6
 
      private ulong [] offsets;
7
 
      #endregion
8
 
      
9
 
      #region Constructors
10
 
      public IsoChunkLargeOffsetBox (BoxHeader header, File file, Box handler) : base (header, file, handler)
11
 
      {
12
 
         ByteVector box_data = LoadData (file);
13
 
         
14
 
         offsets = new ulong [(int) box_data.Mid (0, 4).ToUInt ()];
15
 
         
16
 
         for (int i = 0; i < offsets.Length; i ++)
17
 
           offsets [i] = (ulong) box_data.Mid (4 + i * 8, 8).ToLong ();
18
 
      }
19
 
      #endregion
20
 
      
21
 
      #region Public Methods
22
 
      public void Overwrite (File file, long size_difference, long after)
23
 
      {
24
 
         if (Header.Position < 0)
25
 
            throw new System.Exception ("Cannot overwrite headers created from ByteVectors.");
26
 
         
27
 
         file.Insert (Render (size_difference, after), Header.Position, Size);
28
 
      }
29
 
      
30
 
      public ByteVector Render (long size_difference, long after)
31
 
      {
32
 
        ByteVector output = ByteVector.FromUInt ((uint) offsets.Length);
33
 
         for (int i = 0; i < offsets.Length; i ++)
34
 
         {
35
 
            if (offsets [i] >= (ulong) after)
36
 
               offsets [i] = (ulong) ((long)offsets [i] + size_difference);
37
 
            output.Add (ByteVector.FromLong ((long) offsets [i]));
38
 
         }
39
 
         
40
 
         return Render (output);
41
 
      }
42
 
      
43
 
      public override ByteVector Render ()
44
 
      {
45
 
         return Render (0, 0);
46
 
      }
47
 
      #endregion
48
 
      
49
 
      #region Public Properties
50
 
      public          ulong [] Offsets {get {return offsets;}}
51
 
      #endregion
52
 
   }
53
 
}