mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 11:07:52 +02:00
Add audio dissector
This commit is contained in:
parent
227bd1487e
commit
a932a50922
5 changed files with 365 additions and 309 deletions
|
@ -293,6 +293,12 @@ function p_hfudt.dissector(buf, pinfo, tree)
|
|||
if packet_type_text == "EntityEdit" then
|
||||
Dissector.get("hf-entity"):call(buf(i):tvb(), pinfo, tree)
|
||||
end
|
||||
|
||||
if packet_types[packet_type] == "MicrophoneAudioNoEcho" or
|
||||
packet_types[packet_type] == "MicrophoneAudioWithEcho" or
|
||||
packet_types[packet_type] == "SilentAudioFrame" then
|
||||
Dissector.get("hf-audio"):call(buf(i):tvb(), pinfo, tree)
|
||||
end
|
||||
end
|
||||
|
||||
-- return the size of the header
|
46
tools/dissectors/2-hf-audio.lua
Normal file
46
tools/dissectors/2-hf-audio.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
print("Loading hf-audio")
|
||||
|
||||
-- create the audio protocol
|
||||
p_hf_audio = Proto("hf-audio", "HF Audio Protocol")
|
||||
|
||||
-- audio packet fields
|
||||
local f_audio_sequence_number = ProtoField.uint16("hf_audio.sequence_number", "Sequence Number")
|
||||
local f_audio_codec_size = ProtoField.uint32("hf_audio.codec_size", "Codec Size")
|
||||
local f_audio_codec = ProtoField.string("hf_audio.codec", "Codec")
|
||||
local f_audio_is_stereo = ProtoField.bool("hf_audio.is_stereo", "Is Stereo")
|
||||
local f_audio_num_silent_samples = ProtoField.uint16("hf_audio.num_silent_samples", "Num Silent Samples")
|
||||
|
||||
p_hf_audio.fields = {
|
||||
f_audio_sequence_number, f_audio_codec_size, f_audio_codec,
|
||||
f_audio_is_stereo, f_audio_num_silent_samples
|
||||
}
|
||||
|
||||
local packet_type_extractor = Field.new('hfudt.type_text')
|
||||
|
||||
function p_hf_audio.dissector(buf, pinfo, tree)
|
||||
pinfo.cols.protocol = p_hf_audio.name
|
||||
|
||||
audio_subtree = tree:add(p_hf_audio, buf())
|
||||
|
||||
local i = 0
|
||||
|
||||
audio_subtree:add_le(f_audio_sequence_number, buf(i, 2))
|
||||
i = i + 2
|
||||
|
||||
-- figure out the number of bytes the codec name takes
|
||||
local codec_name_bytes = buf(i, 4):le_uint()
|
||||
audio_subtree:add_le(f_audio_codec_size, buf(i, 4))
|
||||
i = i + 4
|
||||
|
||||
audio_subtree:add(f_audio_codec, buf(i, codec_name_bytes))
|
||||
i = i + codec_name_bytes
|
||||
|
||||
local packet_type = packet_type_extractor().value
|
||||
if packet_type == "SilentAudioFrame" then
|
||||
audio_subtree:add_le(f_audio_num_silent_samples, buf(i, 2))
|
||||
i = i + 2
|
||||
else
|
||||
audio_subtree:add_le(f_audio_is_stereo, buf(i, 1))
|
||||
i = i + 1
|
||||
end
|
||||
end
|
|
@ -1,3 +1,5 @@
|
|||
print("Loading hf-avatar")
|
||||
|
||||
-- create the avatar protocol
|
||||
p_hf_avatar = Proto("hf-avatar", "HF Avatar Protocol")
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
print("Loading hf-entity")
|
||||
|
||||
-- create the entity protocol
|
||||
p_hf_entity = Proto("hf-entity", "HF Entity Protocol")
|
||||
|
Loading…
Reference in a new issue