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.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#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.
45 46 47 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 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 45 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) elsif @tag.version >= ID3V2_3_0 && @tag.version < ID3V2_4_0 header = ID3v230FrameHeaderFormat.read(io) @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 elsif @tag.version >= ID3V2_4_0 header = ID3v240FrameHeaderFormat.read(io) end rescue BinData::ValidityError => ve raise InvalidID3v2TagError, ve. end @frame_id = header.frame_id @size = BitPaddedInt.unpad_number(header.frame_size) end |
Instance Attribute Details
#compressed ⇒ Object (readonly)
Returns the value of attribute compressed.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 def compressed @compressed end |
#data_length ⇒ Object (readonly)
Returns the value of attribute data_length.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 def data_length @data_length end |
#encrypted ⇒ Object (readonly)
Returns the value of attribute encrypted.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 def encrypted @encrypted end |
#encryption_type ⇒ Object (readonly)
Returns the value of attribute encryption_type.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 def encryption_type @encryption_type end |
#frame_id ⇒ Object (readonly)
Returns the value of attribute frame_id.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 def frame_id @frame_id end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 def group @group end |
#preserve_on_altered_file ⇒ Object (readonly)
Returns the value of attribute preserve_on_altered_file.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 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.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 def preserve_on_altered_tag @preserve_on_altered_tag end |
#read_only ⇒ Object (readonly)
Returns the value of attribute read_only.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 def read_only @read_only end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 def size @size end |
#unsynchronized ⇒ Object (readonly)
Returns the value of attribute unsynchronized.
40 41 42 |
# File 'lib/mp3file/id3v2/frame_header.rb', line 40 def unsynchronized @unsynchronized end |