Class: Mp3file::ID3v2::FrameHeader
- Inherits:
-
Object
- Object
- Mp3file::ID3v2::FrameHeader
- Defined in:
- lib/mp3file/id3v2/frame_header.rb
Defined Under Namespace
Classes: ID3v220FrameHeaderFormat, ID3v230FrameHeaderFormat, ID3v240FrameHeaderFormat
Instance Attribute Summary collapse
-
#compressed ⇒ Object
readonly
Returns the value of attribute compressed.
-
#data_length ⇒ Object
readonly
Returns the value of attribute data_length.
-
#encrypted ⇒ Object
readonly
Returns the value of attribute encrypted.
-
#encryption_type ⇒ Object
readonly
Returns the value of attribute encryption_type.
-
#frame_id ⇒ Object
readonly
Returns the value of attribute frame_id.
-
#frame_size ⇒ Object
readonly
Returns the value of attribute frame_size.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#header_size ⇒ Object
readonly
Returns the value of attribute header_size.
-
#preserve_on_altered_file ⇒ Object
readonly
Returns the value of attribute preserve_on_altered_file.
-
#preserve_on_altered_tag ⇒ Object
readonly
Returns the value of attribute preserve_on_altered_tag.
-
#read_only ⇒ Object
readonly
Returns the value of attribute read_only.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#unsynchronized ⇒ Object
readonly
Returns the value of attribute unsynchronized.
Instance Method Summary collapse
-
#initialize(io, tag) ⇒ FrameHeader
constructor
A new instance of FrameHeader.
Constructor Details
#initialize(io, tag) ⇒ FrameHeader
Returns a new instance of FrameHeader.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 48 def initialize(io, tag) @tag = tag header = nil @preserve_on_altered_tag = false @preserve_on_altered_file = false @read_only = false @compressed = false @encrypted = false @group = nil @unsynchronized = false @data_length = 0 begin if @tag.version >= ID3V2_2_0 && @tag.version < ID3V2_3_0 header = ID3v220FrameHeaderFormat.read(io) @header_size = 6 @frame_size = header.frame_size elsif @tag.version >= ID3V2_3_0 && @tag.version < ID3V2_4_0 header = ID3v230FrameHeaderFormat.read(io) @header_size = 10 @preserve_on_altered_tag = header.tag_alter_preserve == 1 @preserve_on_altered_file = header.file_alter_preserve == 1 @read_only = header.read_only == 1 @compressed = header.compression == 1 if header.encryption == 1 @encrypted = true @encryption_type = header.encryption_type end if header.has_group == 1 @group = header.group_id end @frame_size = header.frame_size elsif @tag.version >= ID3V2_4_0 header = ID3v240FrameHeaderFormat.read(io) @header_size = 10 @frame_size = BitPaddedInt.unpad_number(header.frame_size) end rescue BinData::ValidityError => ve raise InvalidID3v2TagError, ve. end @frame_id = header.frame_id @size = @header_size + @frame_size end |
Instance Attribute Details
#compressed ⇒ Object (readonly)
Returns the value of attribute compressed.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def compressed @compressed end |
#data_length ⇒ Object (readonly)
Returns the value of attribute data_length.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def data_length @data_length end |
#encrypted ⇒ Object (readonly)
Returns the value of attribute encrypted.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def encrypted @encrypted end |
#encryption_type ⇒ Object (readonly)
Returns the value of attribute encryption_type.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def encryption_type @encryption_type end |
#frame_id ⇒ Object (readonly)
Returns the value of attribute frame_id.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def frame_id @frame_id end |
#frame_size ⇒ Object (readonly)
Returns the value of attribute frame_size.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def frame_size @frame_size end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def group @group end |
#header_size ⇒ Object (readonly)
Returns the value of attribute header_size.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def header_size @header_size end |
#preserve_on_altered_file ⇒ Object (readonly)
Returns the value of attribute preserve_on_altered_file.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def preserve_on_altered_file @preserve_on_altered_file end |
#preserve_on_altered_tag ⇒ Object (readonly)
Returns the value of attribute preserve_on_altered_tag.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def preserve_on_altered_tag @preserve_on_altered_tag end |
#read_only ⇒ Object (readonly)
Returns the value of attribute read_only.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def read_only @read_only end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def size @size end |
#unsynchronized ⇒ Object (readonly)
Returns the value of attribute unsynchronized.
43 44 45 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 43 def unsynchronized @unsynchronized end |