Class: FormatParser::AACParser
- Inherits:
-
Object
- Object
- FormatParser::AACParser
show all
- Includes:
- IOUtils
- Defined in:
- lib/parsers/aac_parser.rb
Constant Summary
collapse
- AAC_MIME_TYPE =
'audio/aac'
Constants included
from IOUtils
IOUtils::INTEGER_DIRECTIVES
Instance Method Summary
collapse
Methods included from IOUtils
#read_bytes, #read_fixed_point, #read_int, #safe_read, #safe_skip, #skip_bytes
Instance Method Details
#call(raw_io) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/parsers/aac_parser.rb', line 12
def call(raw_io)
io = FormatParser::IOConstraint.new(raw_io)
= safe_read(io, 9)
= .unpack('B*').first.split('')
= FormatParser::AdtsHeaderInfo.()
return if .nil?
FormatParser::Audio.new(
title: nil,
album: nil,
artist: nil,
format: :aac,
num_audio_channels: .number_of_audio_channels,
audio_sample_rate_hz: .mpeg4_sampling_frequency,
media_duration_seconds: nil,
media_duration_frames: nil,
intrinsics: nil,
content_type: AAC_MIME_TYPE
)
end
|
#likely_match?(filename) ⇒ Boolean
8
9
10
|
# File 'lib/parsers/aac_parser.rb', line 8
def likely_match?(filename)
filename =~ /\.aac$/i
end
|