File: IsoHandlerBox.cs

package info (click to toggle)
banshee 0.11.2%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 11,976 kB
  • ctags: 9,958
  • sloc: cs: 54,529; xml: 21,240; sh: 8,835; ansic: 2,040; makefile: 1,248
file content (64 lines) | stat: -rw-r--r-- 2,124 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
namespace TagLib.Mpeg4
{
   public class IsoHandlerBox : FullBox
   {
      //////////////////////////////////////////////////////////////////////////
      // private properties
      //////////////////////////////////////////////////////////////////////////
      private ByteVector handler_type;
      private string name;
      
      
      //////////////////////////////////////////////////////////////////////////
      // public methods
      //////////////////////////////////////////////////////////////////////////
      public IsoHandlerBox (BoxHeader header, Box parent) : base (header, parent)
      {
         // Reserved
         File.Seek (base.DataPosition + 4);
         
         // Read the handler type.
         handler_type = File.ReadBlock (4);
         
         // Reserved
         File.Seek (base.DataPosition + 20);
         
         // Find the terminating byte and read a string from the data before it.
         long end = File.Find ((byte) 0, File.Tell);
         name = File.ReadBlock ((int) (end - File.Tell)).ToString ();
      }
      
      // We can make our own handler.
      public IsoHandlerBox (ByteVector handler_type, string name, Box parent) : base ("hdlr", 0, parent)
      {
         this.handler_type = handler_type.Mid (0,4);
         this.name = name;
      }
      
      // Render everything.
      public override ByteVector Render ()
      {
         ByteVector output = new ByteVector (4);
         output += handler_type;
         output += new ByteVector (12);
         output += ByteVector.FromString (name);
         output += new ByteVector (2);
         return Render (output);
      }
      
      
      //////////////////////////////////////////////////////////////////////////
      // public properties
      //////////////////////////////////////////////////////////////////////////
      public ByteVector HandlerType {get {return handler_type;}}
      
      public string Name {get {return name;}}
      
      // This box has no readable data.
      public override ByteVector Data
      {
         get {return null;}
         set {}
      }
   }
}