Class: Id3Taginator::Header::Id3v24ExtendedHeader
- Inherits:
-
Object
- Object
- Id3Taginator::Header::Id3v24ExtendedHeader
- Defined in:
- lib/id3taginator/header/id3v24_extended_header.rb
Instance Attribute Summary collapse
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
-
#crc ⇒ String?
returns the CRC data if present.
-
#image_encoding_restrictions? ⇒ Boolean
determined if the tag is encoding restricted.
-
#image_size_restrictions? ⇒ Boolean
determined if the tag is image encoding restricted.
-
#initialize(size, flags) ⇒ Id3v24ExtendedHeader
constructor
constructor.
-
#tag_is_an_update? ⇒ Boolean
determined if the tag is an update.
-
#tag_size_restrictions? ⇒ Boolean
determined if the tag is size restricted.
-
#text_encoding_restrictions? ⇒ Boolean
determined if the tag is text encoding restricted.
-
#text_fields_size_restrictions? ⇒ Boolean
determined if the tag is fields size restricted.
Constructor Details
#initialize(size, flags) ⇒ Id3v24ExtendedHeader
constructor
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/id3taginator/header/id3v24_extended_header.rb', line 13 def initialize(size, flags) @size = size @flags = flags @tag_is_update = false @crc_data = nil @restrictions = 0b00000000 flags_stream = StringIO.new(flags) ext_flag = flags_stream.readbyte # tag is update if bit_set?(ext_flag, 0b01000000) @tag_is_update = true flags_stream.readbyte end # crc data if bit_set?(ext_flag, 0b00100000) length = ext_flag.readbyte @crc_data = flags_stream.read(length) end ext_flag.readbyte if bit_set?(ext_flag, 0b00010000) @restrictions = ext_flag.readbyte if bit_set?(ext_flag, 0b00010000) end |
Instance Attribute Details
#flags ⇒ Object
Returns the value of attribute flags.
7 8 9 |
# File 'lib/id3taginator/header/id3v24_extended_header.rb', line 7 def flags @flags end |
#size ⇒ Object
Returns the value of attribute size.
7 8 9 |
# File 'lib/id3taginator/header/id3v24_extended_header.rb', line 7 def size @size end |
Instance Method Details
#crc ⇒ String?
returns the CRC data if present
48 49 50 |
# File 'lib/id3taginator/header/id3v24_extended_header.rb', line 48 def crc @crc_data end |
#image_encoding_restrictions? ⇒ Boolean
determined if the tag is encoding restricted
76 77 78 |
# File 'lib/id3taginator/header/id3v24_extended_header.rb', line 76 def image_encoding_restrictions? (@restrictions & 0b00000100) == 0b00000100 end |
#image_size_restrictions? ⇒ Boolean
determined if the tag is image encoding restricted
83 84 85 |
# File 'lib/id3taginator/header/id3v24_extended_header.rb', line 83 def image_size_restrictions? (@restrictions & 0b00000011) == 0b00000011 end |
#tag_is_an_update? ⇒ Boolean
determined if the tag is an update
41 42 43 |
# File 'lib/id3taginator/header/id3v24_extended_header.rb', line 41 def tag_is_an_update? @tag_is_update end |
#tag_size_restrictions? ⇒ Boolean
determined if the tag is size restricted
55 56 57 |
# File 'lib/id3taginator/header/id3v24_extended_header.rb', line 55 def tag_size_restrictions? (@restrictions & 0b11000000) == 0b11000000 end |
#text_encoding_restrictions? ⇒ Boolean
determined if the tag is text encoding restricted
62 63 64 |
# File 'lib/id3taginator/header/id3v24_extended_header.rb', line 62 def text_encoding_restrictions? (@restrictions & 0b00100000) == 0b00100000 end |
#text_fields_size_restrictions? ⇒ Boolean
determined if the tag is fields size restricted
69 70 71 |
# File 'lib/id3taginator/header/id3v24_extended_header.rb', line 69 def text_fields_size_restrictions? (@restrictions & 0b00011000) == 0b00011000 end |