/src/wireshark/epan/dissectors/packet-btavdtp.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* packet-btavdtp.c |
2 | | * Routines for Bluetooth AVDTP dissection |
3 | | * |
4 | | * Copyright 2012, Michal Labedzki for Tieto Corporation |
5 | | * |
6 | | * Wireshark - Network traffic analyzer |
7 | | * By Gerald Combs <gerald@wireshark.org> |
8 | | * Copyright 1998 Gerald Combs |
9 | | * |
10 | | * SPDX-License-Identifier: GPL-2.0-or-later |
11 | | */ |
12 | | |
13 | | #include "config.h" |
14 | | |
15 | | #include <epan/packet.h> |
16 | | #include <epan/expert.h> |
17 | | #include <epan/prefs.h> |
18 | | #include <epan/unit_strings.h> |
19 | | |
20 | | #include "packet-bluetooth.h" |
21 | | #include "packet-btl2cap.h" |
22 | | #include "packet-btavdtp.h" |
23 | | #include "packet-btavrcp.h" |
24 | | #include "packet-rtp.h" |
25 | | |
26 | 14 | #define AVDTP_MESSAGE_TYPE_MASK 0x03 |
27 | 14 | #define AVDTP_PACKET_TYPE_MASK 0x0C |
28 | 14 | #define AVDTP_TRANSACTION_MASK 0xF0 |
29 | 14 | #define AVDTP_SIGNAL_ID_MASK 0x3F |
30 | 14 | #define AVDTP_RFA0_MASK 0xC0 |
31 | | |
32 | 0 | #define MESSAGE_TYPE_COMMAND 0x00 |
33 | 0 | #define MESSAGE_TYPE_GENERAL_REJECT 0x01 |
34 | 0 | #define MESSAGE_TYPE_ACCEPT 0x02 |
35 | 0 | #define MESSAGE_TYPE_REJECT 0x03 |
36 | | |
37 | | #define PACKET_TYPE_SINGLE 0x00 |
38 | 0 | #define PACKET_TYPE_START 0x01 |
39 | 0 | #define PACKET_TYPE_CONTINUE 0x02 |
40 | 0 | #define PACKET_TYPE_END 0x03 |
41 | | |
42 | 0 | #define SIGNAL_ID_DISCOVER 0x01 |
43 | 0 | #define SIGNAL_ID_GET_CAPABILITIES 0x02 |
44 | 0 | #define SIGNAL_ID_SET_CONFIGURATION 0x03 |
45 | 0 | #define SIGNAL_ID_GET_CONFIGURATION 0x04 |
46 | 0 | #define SIGNAL_ID_RECONFIGURE 0x05 |
47 | 0 | #define SIGNAL_ID_OPEN 0x06 |
48 | 0 | #define SIGNAL_ID_START 0x07 |
49 | 0 | #define SIGNAL_ID_CLOSE 0x08 |
50 | 0 | #define SIGNAL_ID_SUSPEND 0x09 |
51 | 0 | #define SIGNAL_ID_ABORT 0x0A |
52 | 0 | #define SIGNAL_ID_SECURITY_CONTROL 0x0B |
53 | 0 | #define SIGNAL_ID_GET_ALL_CAPABILITIES 0x0C |
54 | 0 | #define SIGNAL_ID_DELAY_REPORT 0x0D |
55 | | |
56 | 0 | #define SERVICE_CATEGORY_MEDIA_TRANSPORT 0x01 |
57 | 0 | #define SERVICE_CATEGORY_REPORTING 0x02 |
58 | 0 | #define SERVICE_CATEGORY_RECOVERY 0x03 |
59 | 0 | #define SERVICE_CATEGORY_CONTENT_PROTECTION 0x04 |
60 | 0 | #define SERVICE_CATEGORY_HEADER_COMPRESSION 0x05 |
61 | 0 | #define SERVICE_CATEGORY_MULTIPLEXING 0x06 |
62 | 0 | #define SERVICE_CATEGORY_MEDIA_CODEC 0x07 |
63 | 0 | #define SERVICE_CATEGORY_DELAY_REPORTING 0x08 |
64 | | |
65 | 0 | #define MEDIA_TYPE_AUDIO 0x00 |
66 | 0 | #define MEDIA_TYPE_VIDEO 0x01 |
67 | | |
68 | 0 | #define SEID_ACP 0x00 |
69 | 0 | #define SEID_INT 0x01 |
70 | | |
71 | | #define STREAM_TYPE_MEDIA 0x00 |
72 | | #define STREAM_TYPE_SIGNAL 0x01 |
73 | | |
74 | 12 | #define CODEC_DEFAULT 0xFFFF |
75 | 24 | #define CODEC_SBC 0x00 |
76 | 0 | #define CODEC_MPEG12_AUDIO 0x01 |
77 | 0 | #define CODEC_MPEG24_AAC 0x02 |
78 | 0 | #define CODEC_ATRAC 0x04 |
79 | 0 | #define CODEC_APT_X 0xFF01 |
80 | 0 | #define CODEC_APT_X_HD 0xFF24 |
81 | 0 | #define CODEC_LDAC 0xFFAA |
82 | | |
83 | 0 | #define VENDOR_APT_CODEC_ID_APT_X 0x0001 |
84 | 0 | #define VENDOR_APT_CODEC_ID_APT_X_HD 0x0024 |
85 | 0 | #define VENDOR_SONY_CODEC_ID_LDAC 0x00AA |
86 | 0 | #define VENDOR_GOOGLE_CODEC_ID_OPUS 0x0001 |
87 | | |
88 | 0 | #define CODEC_H263_BASELINE 0x01 |
89 | 0 | #define CODEC_MPEG4_VSP 0x02 |
90 | 0 | #define CODEC_H263_PROFILE_3 0x03 |
91 | 0 | #define CODEC_H263_PROFILE_8 0x04 |
92 | | |
93 | 0 | #define CODEC_VENDOR 0xFF |
94 | | |
95 | | #define HEADER_SIZE 2 |
96 | | #define SEP_MAX 64 |
97 | | #define SEP_SIZE 2 |
98 | | |
99 | | /* ========================================================== */ |
100 | | /* Story: RTP Player, conversation (probably reassemble too) use address:port as |
101 | | "key" to separate devices/streams. In Bluetooth World it is not enough to |
102 | | separate devices/streams. Example key: |
103 | | uint32_t interface_id (aka frame.interface_id) |
104 | | uint32_t adapter_id (interface like "bluetooth-monitor" or USB provide |
105 | | more than one device over interface, so we must |
106 | | separate information provided by each one) |
107 | | uint16_t hci_chandle (aka "connection handle" use to separate connections to devices) |
108 | | uint16_t l2cap_psm (like hci_chandle but over l2cap layer, need hci_chandle info because |
109 | | the same PSM can be used over chandles) |
110 | | uint8_t rfcomm_channel (like l2cap_psm, but over RFCOMM layer...) |
111 | | etc. like |
112 | | uint8_t stram_endpoint_number |
113 | | uint32_t stream_number (to separate multiple streams for RTP Player) |
114 | | |
115 | | So keys can be various (length or type) and "ports" are not enough to sore |
116 | | all needed information. If one day that changed then all RTP_PLAYER_WORKAROUND |
117 | | block can be removed. This workaround use global number of streams (aka stream ID) |
118 | | to be used as port number in RTP Player to separate streams. |
119 | | */ |
120 | | #define RTP_PLAYER_WORKAROUND true |
121 | | |
122 | | #if RTP_PLAYER_WORKAROUND == true |
123 | | wmem_tree_t *file_scope_stream_number = NULL; |
124 | | #endif |
125 | | /* ========================================================== */ |
126 | | |
127 | | static int proto_btavdtp; |
128 | | |
129 | | static int hf_btavdtp_data; |
130 | | static int hf_btavdtp_message_type; |
131 | | static int hf_btavdtp_packet_type; |
132 | | static int hf_btavdtp_transaction; |
133 | | static int hf_btavdtp_signal; |
134 | | static int hf_btavdtp_signal_id; |
135 | | static int hf_btavdtp_rfa0; |
136 | | static int hf_btavdtp_number_of_signal_packets; |
137 | | static int hf_btavdtp_sep_seid; |
138 | | static int hf_btavdtp_sep_inuse; |
139 | | static int hf_btavdtp_sep_rfa0; |
140 | | static int hf_btavdtp_sep_media_type; |
141 | | static int hf_btavdtp_sep_type; |
142 | | static int hf_btavdtp_sep_rfa1; |
143 | | static int hf_btavdtp_error_code; |
144 | | static int hf_btavdtp_acp_sep; |
145 | | static int hf_btavdtp_acp_seid_item; |
146 | | static int hf_btavdtp_int_seid_item; |
147 | | static int hf_btavdtp_acp_seid; |
148 | | static int hf_btavdtp_int_seid; |
149 | | static int hf_btavdtp_service_category; |
150 | | static int hf_btavdtp_rfa_seid; |
151 | | static int hf_btavdtp_delay; |
152 | | static int hf_btavdtp_length_of_service_category; |
153 | | static int hf_btavdtp_recovery_type; |
154 | | static int hf_btavdtp_maximum_recovery_window_size; |
155 | | static int hf_btavdtp_maximum_number_of_media_packet_in_parity_code; |
156 | | static int hf_btavdtp_multiplexing_fragmentation; |
157 | | static int hf_btavdtp_multiplexing_rfa; |
158 | | static int hf_btavdtp_multiplexing_tsid; |
159 | | static int hf_btavdtp_multiplexing_tcid; |
160 | | static int hf_btavdtp_multiplexing_entry_rfa; |
161 | | static int hf_btavdtp_header_compression_backch; |
162 | | static int hf_btavdtp_header_compression_media; |
163 | | static int hf_btavdtp_header_compression_recovery; |
164 | | static int hf_btavdtp_header_compression_rfa; |
165 | | static int hf_btavdtp_content_protection_type; |
166 | | static int hf_btavdtp_media_codec_media_type; |
167 | | static int hf_btavdtp_media_codec_rfa; |
168 | | static int hf_btavdtp_media_codec_unknown_type; |
169 | | static int hf_btavdtp_media_codec_audio_type; |
170 | | static int hf_btavdtp_media_codec_video_type; |
171 | | static int hf_btavdtp_sbc_sampling_frequency_16000; |
172 | | static int hf_btavdtp_sbc_sampling_frequency_32000; |
173 | | static int hf_btavdtp_sbc_sampling_frequency_44100; |
174 | | static int hf_btavdtp_sbc_sampling_frequency_48000; |
175 | | static int hf_btavdtp_sbc_channel_mode_mono; |
176 | | static int hf_btavdtp_sbc_channel_mode_dual_channel; |
177 | | static int hf_btavdtp_sbc_channel_mode_stereo; |
178 | | static int hf_btavdtp_sbc_channel_mode_joint_stereo; |
179 | | static int hf_btavdtp_sbc_block_4; |
180 | | static int hf_btavdtp_sbc_block_8; |
181 | | static int hf_btavdtp_sbc_block_12; |
182 | | static int hf_btavdtp_sbc_block_16; |
183 | | static int hf_btavdtp_sbc_subbands_4; |
184 | | static int hf_btavdtp_sbc_subbands_8; |
185 | | static int hf_btavdtp_sbc_allocation_method_snr; |
186 | | static int hf_btavdtp_sbc_allocation_method_loudness; |
187 | | static int hf_btavdtp_sbc_min_bitpool; |
188 | | static int hf_btavdtp_sbc_max_bitpool; |
189 | | static int hf_btavdtp_mpeg12_layer_1; |
190 | | static int hf_btavdtp_mpeg12_layer_2; |
191 | | static int hf_btavdtp_mpeg12_layer_3; |
192 | | static int hf_btavdtp_mpeg12_crc_protection; |
193 | | static int hf_btavdtp_mpeg12_channel_mode_mono; |
194 | | static int hf_btavdtp_mpeg12_channel_mode_dual_channel; |
195 | | static int hf_btavdtp_mpeg12_channel_mode_stereo; |
196 | | static int hf_btavdtp_mpeg12_channel_mode_joint_stereo; |
197 | | static int hf_btavdtp_mpeg12_rfa; |
198 | | static int hf_btavdtp_mpeg12_mpf_2; |
199 | | static int hf_btavdtp_mpeg12_sampling_frequency_16000; |
200 | | static int hf_btavdtp_mpeg12_sampling_frequency_22050; |
201 | | static int hf_btavdtp_mpeg12_sampling_frequency_24000; |
202 | | static int hf_btavdtp_mpeg12_sampling_frequency_32000; |
203 | | static int hf_btavdtp_mpeg12_sampling_frequency_44100; |
204 | | static int hf_btavdtp_mpeg12_sampling_frequency_48000; |
205 | | static int hf_btavdtp_mpeg12_vbr_supported; |
206 | | static int hf_btavdtp_mpeg12_bit_rate; |
207 | | static int hf_btavdtp_mpeg24_object_type_mpeg2_aac_lc; |
208 | | static int hf_btavdtp_mpeg24_object_type_mpeg4_aac_lc; |
209 | | static int hf_btavdtp_mpeg24_object_type_mpeg4_aac_ltp; |
210 | | static int hf_btavdtp_mpeg24_object_type_mpeg4_aac_scalable; |
211 | | static int hf_btavdtp_mpeg24_object_type_rfa; |
212 | | static int hf_btavdtp_mpeg24_sampling_frequency_8000; |
213 | | static int hf_btavdtp_mpeg24_sampling_frequency_11025; |
214 | | static int hf_btavdtp_mpeg24_sampling_frequency_12000; |
215 | | static int hf_btavdtp_mpeg24_sampling_frequency_16000; |
216 | | static int hf_btavdtp_mpeg24_sampling_frequency_22050; |
217 | | static int hf_btavdtp_mpeg24_sampling_frequency_24000; |
218 | | static int hf_btavdtp_mpeg24_sampling_frequency_32000; |
219 | | static int hf_btavdtp_mpeg24_sampling_frequency_44100; |
220 | | static int hf_btavdtp_mpeg24_sampling_frequency_48000; |
221 | | static int hf_btavdtp_mpeg24_sampling_frequency_64000; |
222 | | static int hf_btavdtp_mpeg24_sampling_frequency_88200; |
223 | | static int hf_btavdtp_mpeg24_sampling_frequency_96000; |
224 | | static int hf_btavdtp_mpeg24_channels_1; |
225 | | static int hf_btavdtp_mpeg24_channels_2; |
226 | | static int hf_btavdtp_mpeg24_rfa; |
227 | | static int hf_btavdtp_mpeg24_vbr_supported; |
228 | | static int hf_btavdtp_mpeg24_bit_rate; |
229 | | static int hf_btavdtp_atrac_version; |
230 | | static int hf_btavdtp_atrac_channel_mode_single_channel; |
231 | | static int hf_btavdtp_atrac_channel_mode_dual_channel; |
232 | | static int hf_btavdtp_atrac_channel_mode_joint_stereo; |
233 | | static int hf_btavdtp_atrac_rfa1; |
234 | | static int hf_btavdtp_atrac_rfa2; |
235 | | static int hf_btavdtp_atrac_sampling_frequency_44100; |
236 | | static int hf_btavdtp_atrac_sampling_frequency_48000; |
237 | | static int hf_btavdtp_atrac_vbr_supported; |
238 | | static int hf_btavdtp_atrac_bit_rate; |
239 | | static int hf_btavdtp_atrac_maximum_sul; |
240 | | static int hf_btavdtp_atrac_rfa3; |
241 | | static int hf_btavdtp_vendor_specific_aptx_sampling_frequency_16000; |
242 | | static int hf_btavdtp_vendor_specific_aptx_sampling_frequency_32000; |
243 | | static int hf_btavdtp_vendor_specific_aptx_sampling_frequency_44100; |
244 | | static int hf_btavdtp_vendor_specific_aptx_sampling_frequency_48000; |
245 | | static int hf_btavdtp_vendor_specific_aptx_channel_mode_mono; |
246 | | static int hf_btavdtp_vendor_specific_aptx_channel_mode_dual_channel; |
247 | | static int hf_btavdtp_vendor_specific_aptx_channel_mode_stereo; |
248 | | static int hf_btavdtp_vendor_specific_aptx_channel_mode_joint_stereo; |
249 | | static int hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_16000; |
250 | | static int hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_32000; |
251 | | static int hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_44100; |
252 | | static int hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_48000; |
253 | | static int hf_btavdtp_vendor_specific_aptxhd_channel_mode_mono; |
254 | | static int hf_btavdtp_vendor_specific_aptxhd_channel_mode_dual_channel; |
255 | | static int hf_btavdtp_vendor_specific_aptxhd_channel_mode_stereo; |
256 | | static int hf_btavdtp_vendor_specific_aptxhd_channel_mode_joint_stereo; |
257 | | static int hf_btavdtp_vendor_specific_aptxhd_rfa; |
258 | | static int hf_btavdtp_vendor_specific_ldac_rfa1; |
259 | | static int hf_btavdtp_vendor_specific_ldac_sampling_frequency_44100; |
260 | | static int hf_btavdtp_vendor_specific_ldac_sampling_frequency_48000; |
261 | | static int hf_btavdtp_vendor_specific_ldac_sampling_frequency_88200; |
262 | | static int hf_btavdtp_vendor_specific_ldac_sampling_frequency_96000; |
263 | | static int hf_btavdtp_vendor_specific_ldac_sampling_frequency_176400; |
264 | | static int hf_btavdtp_vendor_specific_ldac_sampling_frequency_192000; |
265 | | static int hf_btavdtp_vendor_specific_ldac_rfa2; |
266 | | static int hf_btavdtp_vendor_specific_ldac_channel_mode_mono; |
267 | | static int hf_btavdtp_vendor_specific_ldac_channel_mode_dual_channel; |
268 | | static int hf_btavdtp_vendor_specific_ldac_channel_mode_stereo; |
269 | | static int hf_btavdtp_vendor_specific_opus_sampling_frequency_48000; |
270 | | static int hf_btavdtp_vendor_specific_opus_rfa; |
271 | | static int hf_btavdtp_vendor_specific_opus_frame_duration_20; |
272 | | static int hf_btavdtp_vendor_specific_opus_frame_duration_10; |
273 | | static int hf_btavdtp_vendor_specific_opus_channel_mode_dual; |
274 | | static int hf_btavdtp_vendor_specific_opus_channel_mode_stereo; |
275 | | static int hf_btavdtp_vendor_specific_opus_channel_mode_mono; |
276 | | static int hf_btavdtp_h263_level_10; |
277 | | static int hf_btavdtp_h263_level_20; |
278 | | static int hf_btavdtp_h263_level_30; |
279 | | static int hf_btavdtp_h263_level_rfa; |
280 | | static int hf_btavdtp_mpeg4_level_0; |
281 | | static int hf_btavdtp_mpeg4_level_1; |
282 | | static int hf_btavdtp_mpeg4_level_2; |
283 | | static int hf_btavdtp_mpeg4_level_3; |
284 | | static int hf_btavdtp_mpeg4_level_rfa; |
285 | | static int hf_btavdtp_vendor_id; |
286 | | static int hf_btavdtp_vendor_specific_codec_id; |
287 | | static int hf_btavdtp_vendor_specific_value; |
288 | | static int hf_btavdtp_vendor_apt_codec_id; |
289 | | static int hf_btavdtp_vendor_sony_codec_id; |
290 | | static int hf_btavdtp_vendor_google_codec_id; |
291 | | static int hf_btavdtp_capabilities; |
292 | | static int hf_btavdtp_service; |
293 | | static int hf_btavdtp_service_multiplexing_entry; |
294 | | |
295 | | static int ett_btavdtp; |
296 | | static int ett_btavdtp_sep; |
297 | | static int ett_btavdtp_capabilities; |
298 | | static int ett_btavdtp_service; |
299 | | |
300 | | static expert_field ei_btavdtp_sbc_min_bitpool_out_of_range; |
301 | | static expert_field ei_btavdtp_sbc_max_bitpool_out_of_range; |
302 | | static expert_field ei_btavdtp_unexpected_losc_data; |
303 | | |
304 | | static dissector_handle_t btavdtp_handle; |
305 | | static dissector_handle_t bta2dp_handle; |
306 | | static dissector_handle_t btvdp_handle; |
307 | | static dissector_handle_t rtp_handle; |
308 | | |
309 | | static wmem_tree_t *channels; |
310 | | static wmem_tree_t *sep_list; |
311 | | static wmem_tree_t *sep_open; |
312 | | static wmem_tree_t *media_packet_times; |
313 | | |
314 | | /* A2DP declarations */ |
315 | | static int proto_bta2dp; |
316 | | static int ett_bta2dp; |
317 | | static int proto_bta2dp_cph_scms_t; |
318 | | static int ett_bta2dp_cph_scms_t; |
319 | | |
320 | | static int hf_bta2dp_acp_seid; |
321 | | static int hf_bta2dp_int_seid; |
322 | | static int hf_bta2dp_codec; |
323 | | static int hf_bta2dp_vendor_id; |
324 | | static int hf_bta2dp_vendor_codec_id; |
325 | | static int hf_bta2dp_content_protection; |
326 | | static int hf_bta2dp_stream_start_in_frame; |
327 | | static int hf_bta2dp_stream_end_in_frame; |
328 | | static int hf_bta2dp_stream_number; |
329 | | static int hf_bta2dp_l_bit; |
330 | | static int hf_bta2dp_cp_bit; |
331 | | static int hf_bta2dp_reserved; |
332 | | |
333 | | static dissector_handle_t sbc_handle; |
334 | | static dissector_handle_t mp2t_handle; |
335 | | static dissector_handle_t mpeg_audio_handle; |
336 | | static dissector_handle_t atrac_handle; |
337 | | |
338 | | static bool force_a2dp_scms_t; |
339 | | static int force_a2dp_codec = CODEC_DEFAULT; |
340 | | |
341 | | static const enum_val_t pref_a2dp_codec[] = { |
342 | | { "default", "Default", CODEC_DEFAULT }, |
343 | | { "sbc", "SBC", CODEC_SBC }, |
344 | | { "mp2t", "MPEG12 AUDIO", CODEC_MPEG12_AUDIO }, |
345 | | { "mpeg-audio", "MPEG24 AAC", CODEC_MPEG24_AAC }, |
346 | | /* XXX: Not supported in Wireshark yet { "atrac", "ATRAC", CODEC_ATRAC },*/ |
347 | | { "aptx", "aptX", CODEC_APT_X }, |
348 | | { "aptx-hd", "aptX HD", CODEC_APT_X_HD }, |
349 | | { "ldac", "LDAC", CODEC_LDAC }, |
350 | | { NULL, NULL, 0 } |
351 | | }; |
352 | | |
353 | | |
354 | | /* VDP declarations */ |
355 | | static int proto_btvdp; |
356 | | static int ett_btvdp; |
357 | | static int proto_btvdp_cph_scms_t; |
358 | | static int ett_btvdp_cph_scms_t; |
359 | | |
360 | | static int hf_btvdp_acp_seid; |
361 | | static int hf_btvdp_int_seid; |
362 | | static int hf_btvdp_codec; |
363 | | static int hf_btvdp_vendor_id; |
364 | | static int hf_btvdp_vendor_codec_id; |
365 | | static int hf_btvdp_content_protection; |
366 | | static int hf_btvdp_stream_start_in_frame; |
367 | | static int hf_btvdp_stream_end_in_frame; |
368 | | static int hf_btvdp_stream_number; |
369 | | static int hf_btvdp_l_bit; |
370 | | static int hf_btvdp_cp_bit; |
371 | | static int hf_btvdp_reserved; |
372 | | |
373 | | static dissector_handle_t h263_handle; |
374 | | static dissector_handle_t mp4v_es_handle; |
375 | | |
376 | | static bool force_vdp_scms_t; |
377 | | static int force_vdp_codec = CODEC_H263_BASELINE; |
378 | | |
379 | | static const enum_val_t pref_vdp_codec[] = { |
380 | | { "h263", "H263", CODEC_H263_BASELINE }, |
381 | | { "mp4v-es", "MPEG4 VSP", CODEC_MPEG4_VSP }, |
382 | | { NULL, NULL, 0 } |
383 | | }; |
384 | | |
385 | | /* APT-X Codec */ |
386 | | static int proto_aptx; |
387 | | static int hf_aptx_data; |
388 | | static int hf_aptx_cumulative_frame_duration; |
389 | | static int hf_aptx_delta_time; |
390 | | static int hf_aptx_avrcp_song_position; |
391 | | static int hf_aptx_delta_time_from_the_beginning; |
392 | | static int hf_aptx_cumulative_duration; |
393 | | static int hf_aptx_diff; |
394 | | static int ett_aptx; |
395 | | static dissector_handle_t aptx_handle; |
396 | | |
397 | | /* LDAC Codec */ |
398 | | static int proto_ldac; |
399 | | static int hf_ldac_fragmented; |
400 | | static int hf_ldac_starting_packet; |
401 | | static int hf_ldac_last_packet; |
402 | | static int hf_ldac_rfa; |
403 | | static int hf_ldac_number_of_frames; |
404 | | |
405 | | static int hf_ldac_syncword; |
406 | | static int hf_ldac_sampling_frequency; |
407 | | static int hf_ldac_channel_config_index; |
408 | | static int hf_ldac_frame_length_h; |
409 | | static int hf_ldac_frame_length_l; |
410 | | static int hf_ldac_frame_status; |
411 | | |
412 | | static int hf_ldac_expected_data_speed; |
413 | | |
414 | | static int hf_ldac_data; |
415 | | static int ett_ldac; |
416 | | static int ett_ldac_list; |
417 | | static expert_field ei_ldac_syncword; |
418 | | static expert_field ei_ldac_truncated_or_bad_length; |
419 | | static dissector_handle_t ldac_handle; |
420 | 0 | #define LDAC_CCI_MONO 0x0 |
421 | | #define LDAC_CCI_DUAL 0x1 |
422 | | #define LDAC_CCI_STEREO 0x2 |
423 | | static const value_string ldac_channel_config_index_vals[] = { |
424 | | { LDAC_CCI_MONO, "Mono"}, |
425 | | { LDAC_CCI_DUAL, "Dual Channel"}, |
426 | | { LDAC_CCI_STEREO, "Stereo"}, |
427 | | { 0, NULL } |
428 | | }; |
429 | | |
430 | 0 | #define LDAC_FSID_044 0x0 |
431 | 0 | #define LDAC_FSID_048 0x1 |
432 | 0 | #define LDAC_FSID_088 0x2 |
433 | 0 | #define LDAC_FSID_096 0x3 |
434 | 0 | #define LDAC_FSID_176 0x4 |
435 | 0 | #define LDAC_FSID_192 0x5 |
436 | | |
437 | | static const value_string ldac_sampling_frequency_vals[] = { |
438 | | { LDAC_FSID_044, "44.1 kHz"}, |
439 | | { LDAC_FSID_048, "48.0 kHz"}, |
440 | | { LDAC_FSID_088, "88.2 kHz"}, |
441 | | { LDAC_FSID_096, "96.0 kHz"}, |
442 | | { LDAC_FSID_176, "176.4 kHz"}, |
443 | | { LDAC_FSID_192, "192.0 kHz"}, |
444 | | { 0, NULL } |
445 | | }; |
446 | | |
447 | | |
448 | | static const value_string message_type_vals[] = { |
449 | | { 0x00, "Command" }, |
450 | | { 0x01, "GeneralReject" }, |
451 | | { 0x02, "ResponseAccept" }, |
452 | | { 0x03, "ResponseReject" }, |
453 | | { 0, NULL } |
454 | | }; |
455 | | |
456 | | static const value_string packet_type_vals[] = { |
457 | | { 0x00, "Single" }, |
458 | | { 0x01, "Start" }, |
459 | | { 0x02, "Continue" }, |
460 | | { 0x03, "End" }, |
461 | | { 0, NULL } |
462 | | }; |
463 | | |
464 | | static const value_string signal_id_vals[] = { |
465 | | { 0x00, "Reserved" }, |
466 | | { 0x01, "Discover" }, |
467 | | { 0x02, "GetCapabilities" }, |
468 | | { 0x03, "SetConfiguration" }, |
469 | | { 0x04, "GetConfiguration" }, |
470 | | { 0x05, "Reconfigure" }, |
471 | | { 0x06, "Open" }, |
472 | | { 0x07, "Start" }, |
473 | | { 0x08, "Close" }, |
474 | | { 0x09, "Suspend" }, |
475 | | { 0x0A, "Abort" }, |
476 | | { 0x0B, "SecurityControl" }, |
477 | | { 0x0C, "GetAllCapabilities" }, |
478 | | { 0x0D, "DelayReport" }, |
479 | | { 0, NULL } |
480 | | }; |
481 | | |
482 | | static const value_string media_type_vals[] = { |
483 | | { 0x00, "Audio" }, |
484 | | { 0x01, "Video" }, |
485 | | { 0x02, "Multimedia" }, |
486 | | { 0, NULL } |
487 | | }; |
488 | | |
489 | | static const value_string sep_type_vals[] = { |
490 | | { 0x00, "Source" }, |
491 | | { 0x01, "Sink" }, |
492 | | { 0, NULL } |
493 | | }; |
494 | | |
495 | | static const value_string true_false[] = { |
496 | | { 0x00, "False" }, |
497 | | { 0x01, "True" }, |
498 | | { 0, NULL } |
499 | | }; |
500 | | |
501 | | static const value_string error_code_vals[] = { |
502 | | /* ACP to INT, Signal Response Header Error Codes */ |
503 | | { 0x01, "Bad Header Format" }, |
504 | | /* ACP to INT, Signal Response Payload Format Error Codes */ |
505 | | { 0x11, "Bad Length" }, |
506 | | { 0x12, "Bad ACP SEID" }, |
507 | | { 0x13, "SEP In Use" }, |
508 | | { 0x14, "SEP Not In Use" }, |
509 | | { 0x17, "Bad Service Category" }, |
510 | | { 0x18, "Bad Payload Format" }, |
511 | | { 0x19, "Not Supported Command" }, |
512 | | { 0x1A, "Invalid Capabilities" }, |
513 | | /* ACP to INT, Signal Response Transport Service Capabilities Error Codes */ |
514 | | { 0x22, "Bad Recovery Type" }, |
515 | | { 0x23, "Bad Media Transport Format" }, |
516 | | { 0x25, "Bad Recovery Format" }, |
517 | | { 0x26, "Bad Header Compression Format" }, |
518 | | { 0x27, "Bad Content Protection Format" }, |
519 | | { 0x28, "Bad Multiplexing Format" }, |
520 | | { 0x29, "Unsupported Configuration" }, |
521 | | /* ACP to INT, Procedure Error Codes */ |
522 | | { 0x31, "Bad State" }, |
523 | | /* GAVDTP */ |
524 | | { 0x80, "The Service Category Stated is Invalid" }, |
525 | | { 0x81, "Lack of Resource New Stream Context" }, |
526 | | /* A2DP */ |
527 | | { 0xC1, "Invalid Codec Type" }, |
528 | | { 0xC2, "Not Supported Codec Type" }, |
529 | | { 0xC3, "Invalid Sampling Frequency" }, |
530 | | { 0xC4, "Not Supported Sampling Frequency" }, |
531 | | { 0xC5, "Invalid Channel Mode" }, |
532 | | { 0xC6, "Not Supported Channel Mode" }, |
533 | | { 0xC7, "Invalid Subbands" }, |
534 | | { 0xC8, "Not Supported Subbands" }, |
535 | | { 0xC9, "Invalid Allocation Method" }, |
536 | | { 0xCA, "Not Supported Allocation Method" }, |
537 | | { 0xCB, "Invalid Minimum Bitpool Value" }, |
538 | | { 0xCC, "Not Supported Minimum Bitpool Value" }, |
539 | | { 0xCD, "Invalid Maximum Bitpool Value" }, |
540 | | { 0xCE, "Not Supported Maximum Bitpool Value" }, |
541 | | { 0xCF, "Invalid Layer" }, |
542 | | { 0xD0, "Not Supported Layer" }, |
543 | | { 0xD1, "Not Supported CRC" }, |
544 | | { 0xD2, "Not Supported MPF" }, |
545 | | { 0xD3, "Not Supported VBR" }, |
546 | | { 0xD4, "Invalid Bit Rate" }, |
547 | | { 0xD5, "Not Supported Bit Rate" }, |
548 | | { 0xD6, "Invalid Object Type" }, |
549 | | { 0xD7, "Not Supported Object Type" }, |
550 | | { 0xD8, "Invalid Channels" }, |
551 | | { 0xD9, "Not Supported Channels" }, |
552 | | { 0xDA, "Invalid Version" }, |
553 | | { 0xDB, "Not Supported Version" }, |
554 | | { 0xDC, "Not Supported Maximum SUL" }, |
555 | | { 0xDD, "Invalid Block Length" }, |
556 | | { 0xE0, "Invalid Content Protection Type" }, |
557 | | { 0xE1, "Invalid Content Protection Format" }, |
558 | | { 0xE2, "Invalid Coded Parameter" }, |
559 | | { 0xE3, "Not Supported Codec Parameter" }, |
560 | | { 0, NULL } |
561 | | }; |
562 | | |
563 | | static const value_string service_category_vals[] = { |
564 | | { 0x01, "Media Transport" }, |
565 | | { 0x02, "Reporting" }, |
566 | | { 0x03, "Recovery" }, |
567 | | { 0x04, "Content Protection" }, |
568 | | { 0x05, "Header Compression" }, |
569 | | { 0x06, "Multiplexing" }, |
570 | | { 0x07, "Media Codec" }, |
571 | | { 0x08, "Delay Reporting" }, |
572 | | { 0, NULL } |
573 | | }; |
574 | | |
575 | | static const value_string recovery_type_vals[] = { |
576 | | { 0x00, "Forbidden" }, |
577 | | { 0x01, "RFC2733" }, |
578 | | { 0, NULL } |
579 | | }; |
580 | | |
581 | | static const value_string multiplexing_tsid_vals[] = { |
582 | | { 0x00, "Used for TSID query" }, |
583 | | { 0x1F, "RFD" }, |
584 | | { 0, NULL } |
585 | | }; |
586 | | |
587 | | static const value_string multiplexing_tcid_vals[] = { |
588 | | { 0x00, "Used for TCID query" }, |
589 | | { 0x1F, "RFD" }, |
590 | | { 0, NULL } |
591 | | }; |
592 | | |
593 | | static const value_string media_codec_audio_type_vals[] = { |
594 | | { 0x00, "SBC" }, |
595 | | { 0x01, "MPEG-1,2 Audio" }, |
596 | | { 0x02, "MPEG-2,4 AAC" }, |
597 | | { 0x04, "ATRAC family" }, |
598 | | { 0xFF, "non-A2DP" }, |
599 | | { 0, NULL } |
600 | | }; |
601 | | |
602 | | static const value_string media_codec_video_type_vals[] = { |
603 | | { 0x01, "H.263 baseline" }, |
604 | | { 0x02, "MPEG-4 Visual Simple Profile" }, |
605 | | { 0x03, "H.263 profile 3" }, |
606 | | { 0x04, "H.263 profile 8" }, |
607 | | { 0xFF, "non-VDP" }, |
608 | | { 0, NULL } |
609 | | }; |
610 | | |
611 | | static const value_string content_protection_type_vals[] = { |
612 | | { 0x01, "DTCP" }, |
613 | | { 0x02, "SCMS-T" }, |
614 | | { 0, NULL } |
615 | | }; |
616 | | |
617 | | static const value_string vendor_apt_codec_vals[] = { |
618 | | { VENDOR_APT_CODEC_ID_APT_X, "aptX" }, |
619 | | { VENDOR_APT_CODEC_ID_APT_X_HD, "aptX HD" }, |
620 | | { 0, NULL } |
621 | | }; |
622 | | |
623 | | static const value_string vendor_sony_codec_vals[] = { |
624 | | { VENDOR_SONY_CODEC_ID_LDAC, "LDAC" }, |
625 | | { 0, NULL } |
626 | | }; |
627 | | |
628 | | static const value_string vendor_google_codec_vals[] = { |
629 | | { VENDOR_GOOGLE_CODEC_ID_OPUS, "Opus" }, |
630 | | { 0, NULL } |
631 | | }; |
632 | | |
633 | | enum sep_state { |
634 | | SEP_STATE_FREE, |
635 | | SEP_STATE_OPEN, |
636 | | SEP_STATE_IN_USE |
637 | | }; |
638 | | |
639 | | typedef struct _sep_entry_t { |
640 | | uint8_t seid; |
641 | | uint8_t type; |
642 | | uint8_t media_type; |
643 | | uint8_t int_seid; |
644 | | int codec; |
645 | | uint32_t vendor_id; |
646 | | uint16_t vendor_codec; |
647 | | uint8_t configuration_length; |
648 | | uint8_t *configuration; |
649 | | int content_protection_type; |
650 | | |
651 | | enum sep_state state; |
652 | | } sep_entry_t; |
653 | | |
654 | | typedef struct _sep_data_t { |
655 | | int codec; |
656 | | uint32_t vendor_id; |
657 | | uint16_t vendor_codec; |
658 | | uint8_t configuration_length; |
659 | | uint8_t *configuration; |
660 | | uint8_t acp_seid; |
661 | | uint8_t int_seid; |
662 | | int content_protection_type; |
663 | | uint32_t stream_start_in_frame; |
664 | | uint32_t stream_end_in_frame; |
665 | | uint32_t stream_number; |
666 | | media_packet_info_t *previous_media_packet_info; |
667 | | media_packet_info_t *current_media_packet_info; |
668 | | } sep_data_t; |
669 | | |
670 | | typedef struct _media_stream_number_value_t { |
671 | | uint32_t stream_start_in_frame; |
672 | | uint32_t stream_end_in_frame; |
673 | | uint32_t stream_number; |
674 | | } media_stream_number_value_t; |
675 | | |
676 | | typedef struct _channels_info_t { |
677 | | uint32_t control_local_cid; |
678 | | uint32_t control_remote_cid; |
679 | | uint32_t media_local_cid; |
680 | | uint32_t media_remote_cid; |
681 | | wmem_tree_t *stream_numbers; |
682 | | uint32_t disconnect_in_frame; |
683 | | uint32_t *l2cap_disconnect_in_frame; |
684 | | uint32_t *hci_disconnect_in_frame; |
685 | | uint32_t *adapter_disconnect_in_frame; |
686 | | sep_entry_t *sep; |
687 | | } channels_info_t; |
688 | | |
689 | | |
690 | | void proto_register_btavdtp(void); |
691 | | void proto_reg_handoff_btavdtp(void); |
692 | | void proto_register_bta2dp(void); |
693 | | void proto_reg_handoff_bta2dp(void); |
694 | | void proto_register_bta2dp_content_protection_header_scms_t(void); |
695 | | void proto_register_btvdp(void); |
696 | | void proto_reg_handoff_btvdp(void); |
697 | | void proto_register_btvdp_content_protection_header_scms_t(void); |
698 | | void proto_register_aptx(void); |
699 | | void proto_register_ldac(void); |
700 | | |
701 | | |
702 | | static const char * |
703 | | get_sep_type(uint32_t interface_id, |
704 | | uint32_t adapter_id, uint32_t chandle, uint32_t direction, uint32_t seid, uint32_t frame_number) |
705 | 0 | { |
706 | 0 | wmem_tree_key_t key[6]; |
707 | 0 | wmem_tree_t *subtree; |
708 | 0 | sep_entry_t *sep; |
709 | |
|
710 | 0 | key[0].length = 1; |
711 | 0 | key[0].key = &interface_id; |
712 | 0 | key[1].length = 1; |
713 | 0 | key[1].key = &adapter_id; |
714 | 0 | key[2].length = 1; |
715 | 0 | key[2].key = &chandle; |
716 | 0 | key[3].length = 1; |
717 | 0 | key[3].key = &direction; |
718 | 0 | key[4].length = 1; |
719 | 0 | key[4].key = &seid; |
720 | 0 | key[5].length = 0; |
721 | 0 | key[5].key = NULL; |
722 | |
|
723 | 0 | subtree = (wmem_tree_t *) wmem_tree_lookup32_array(sep_list, key); |
724 | 0 | sep = (subtree) ? (sep_entry_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL; |
725 | 0 | if (sep) { |
726 | 0 | return val_to_str_const(sep->type, sep_type_vals, "unknown"); |
727 | 0 | } |
728 | | |
729 | 0 | return "unknown"; |
730 | 0 | } |
731 | | |
732 | | static const char * |
733 | | get_sep_media_type(uint32_t interface_id, |
734 | | uint32_t adapter_id, uint32_t chandle, uint32_t direction, uint32_t seid, uint32_t frame_number) |
735 | 0 | { |
736 | 0 | wmem_tree_key_t key[6]; |
737 | 0 | wmem_tree_t *subtree; |
738 | 0 | sep_entry_t *sep; |
739 | |
|
740 | 0 | key[0].length = 1; |
741 | 0 | key[0].key = &interface_id; |
742 | 0 | key[1].length = 1; |
743 | 0 | key[1].key = &adapter_id; |
744 | 0 | key[2].length = 1; |
745 | 0 | key[2].key = &chandle; |
746 | 0 | key[3].length = 1; |
747 | 0 | key[3].key = &direction; |
748 | 0 | key[4].length = 1; |
749 | 0 | key[4].key = &seid; |
750 | 0 | key[5].length = 0; |
751 | 0 | key[5].key = NULL; |
752 | |
|
753 | 0 | subtree = (wmem_tree_t *) wmem_tree_lookup32_array(sep_list, key); |
754 | 0 | sep = (subtree) ? (sep_entry_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL; |
755 | 0 | if (sep) { |
756 | 0 | return val_to_str_const(sep->media_type, media_type_vals, "unknown"); |
757 | 0 | } |
758 | | |
759 | 0 | return "unknown"; |
760 | 0 | } |
761 | | |
762 | | |
763 | | static int |
764 | | dissect_sep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, |
765 | | uint32_t interface_id, uint32_t adapter_id, uint32_t chandle) |
766 | 0 | { |
767 | 0 | proto_tree *sep_tree; |
768 | 0 | proto_item *sep_item; |
769 | 0 | unsigned i_sep = 1; |
770 | 0 | unsigned media_type; |
771 | 0 | unsigned type; |
772 | 0 | unsigned seid; |
773 | 0 | unsigned in_use; |
774 | 0 | unsigned items; |
775 | 0 | uint32_t direction; |
776 | | |
777 | | /* Reverse direction to avoid mass reversing it, because this is only case |
778 | | when SEP is provided in ACP role, otherwise INT frequently asking for it |
779 | | */ |
780 | 0 | direction = (pinfo->p2p_dir == P2P_DIR_SENT) ? P2P_DIR_RECV : P2P_DIR_SENT; |
781 | 0 | items = tvb_reported_length_remaining(tvb, offset) / 2; |
782 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
783 | 0 | seid = tvb_get_uint8(tvb, offset); |
784 | 0 | in_use = seid & 0x02; |
785 | 0 | seid = seid >> 2; |
786 | 0 | media_type = tvb_get_uint8(tvb, offset + 1) >> 4; |
787 | 0 | type = (tvb_get_uint8(tvb, offset + 1) & 0x08) >> 3; |
788 | 0 | sep_item = proto_tree_add_none_format(tree, hf_btavdtp_acp_sep, tvb, offset, 2, "ACP SEP [%u - %s %s] item %u/%u", |
789 | 0 | seid, val_to_str_const(media_type, media_type_vals, "unknown"), |
790 | 0 | val_to_str_const(type, sep_type_vals, "unknown"), i_sep, items); |
791 | 0 | sep_tree = proto_item_add_subtree(sep_item, ett_btavdtp_sep); |
792 | |
|
793 | 0 | proto_tree_add_item(sep_tree, hf_btavdtp_sep_seid , tvb, offset, 1, ENC_NA); |
794 | 0 | proto_tree_add_item(sep_tree, hf_btavdtp_sep_inuse, tvb, offset, 1, ENC_NA); |
795 | 0 | proto_tree_add_item(sep_tree, hf_btavdtp_sep_rfa0 , tvb, offset, 1, ENC_NA); |
796 | 0 | offset+=1; |
797 | |
|
798 | 0 | proto_tree_add_item(sep_tree, hf_btavdtp_sep_media_type, tvb, offset, 1, ENC_NA); |
799 | 0 | proto_tree_add_item(sep_tree, hf_btavdtp_sep_type , tvb, offset, 1, ENC_NA); |
800 | 0 | proto_tree_add_item(sep_tree, hf_btavdtp_sep_rfa1 , tvb, offset, 1, ENC_NA); |
801 | |
|
802 | 0 | if (!pinfo->fd->visited) { |
803 | 0 | sep_entry_t *sep_data; |
804 | 0 | wmem_tree_key_t key[7]; |
805 | 0 | uint32_t frame_number = pinfo->num; |
806 | |
|
807 | 0 | key[0].length = 1; |
808 | 0 | key[0].key = &interface_id; |
809 | 0 | key[1].length = 1; |
810 | 0 | key[1].key = &adapter_id; |
811 | 0 | key[2].length = 1; |
812 | 0 | key[2].key = &chandle; |
813 | 0 | key[3].length = 1; |
814 | 0 | key[3].key = &direction; |
815 | 0 | key[4].length = 1; |
816 | 0 | key[4].key = &seid; |
817 | 0 | key[5].length = 1; |
818 | 0 | key[5].key = &frame_number; |
819 | 0 | key[6].length = 0; |
820 | 0 | key[6].key = NULL; |
821 | |
|
822 | 0 | sep_data = wmem_new0(wmem_file_scope(), sep_entry_t); |
823 | 0 | sep_data->seid = seid; |
824 | 0 | sep_data->type = type; |
825 | 0 | sep_data->media_type = media_type; |
826 | 0 | sep_data->codec = -1; |
827 | 0 | if (in_use) { |
828 | 0 | sep_data->state = SEP_STATE_IN_USE; |
829 | 0 | } else { |
830 | 0 | sep_data->state = SEP_STATE_FREE; |
831 | 0 | } |
832 | |
|
833 | 0 | wmem_tree_insert32_array(sep_list, key, sep_data); |
834 | 0 | } |
835 | |
|
836 | 0 | offset += 1; |
837 | 0 | i_sep += 1; |
838 | 0 | } |
839 | |
|
840 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " - items: %u", items); |
841 | 0 | return offset; |
842 | 0 | } |
843 | | |
844 | | |
845 | | static int |
846 | | dissect_codec(tvbuff_t *tvb, packet_info *pinfo, proto_item *service_item, proto_tree *tree, int offset, |
847 | | unsigned losc, int media_type, int media_codec_type, uint32_t *vendor_id, uint16_t *vendor_codec) |
848 | 0 | { |
849 | 0 | proto_item *pitem; |
850 | 0 | uint32_t vendor_codec_id; |
851 | 0 | uint32_t value; |
852 | 0 | uint8_t *value8 = (uint8_t *) &value; |
853 | |
|
854 | 0 | switch(media_type) { |
855 | 0 | case MEDIA_TYPE_AUDIO: |
856 | 0 | switch(media_codec_type) { |
857 | 0 | case CODEC_SBC: |
858 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_sampling_frequency_16000, tvb, offset, 1, ENC_NA); |
859 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_sampling_frequency_32000, tvb, offset, 1, ENC_NA); |
860 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_sampling_frequency_44100, tvb, offset, 1, ENC_NA); |
861 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_sampling_frequency_48000, tvb, offset, 1, ENC_NA); |
862 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_channel_mode_mono, tvb, offset, 1, ENC_NA); |
863 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_channel_mode_dual_channel, tvb, offset, 1, ENC_NA); |
864 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_channel_mode_stereo, tvb, offset, 1, ENC_NA); |
865 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_channel_mode_joint_stereo, tvb, offset, 1, ENC_NA); |
866 | |
|
867 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_block_4, tvb, offset + 1, 1, ENC_NA); |
868 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_block_8, tvb, offset + 1, 1, ENC_NA); |
869 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_block_12, tvb, offset + 1, 1, ENC_NA); |
870 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_block_16, tvb, offset + 1, 1, ENC_NA); |
871 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_subbands_4, tvb, offset + 1, 1, ENC_NA); |
872 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_subbands_8, tvb, offset + 1, 1, ENC_NA); |
873 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_allocation_method_snr, tvb, offset + 1, 1, ENC_NA); |
874 | 0 | proto_tree_add_item(tree, hf_btavdtp_sbc_allocation_method_loudness, tvb, offset + 1, 1, ENC_NA); |
875 | |
|
876 | 0 | pitem = proto_tree_add_item(tree, hf_btavdtp_sbc_min_bitpool, tvb, offset + 2, 1, ENC_NA); |
877 | 0 | value = tvb_get_uint8(tvb, offset + 2); |
878 | 0 | if (value < 2 || value > 250) { |
879 | 0 | expert_add_info(pinfo, pitem, &ei_btavdtp_sbc_min_bitpool_out_of_range); |
880 | 0 | } |
881 | |
|
882 | 0 | pitem = proto_tree_add_item(tree, hf_btavdtp_sbc_max_bitpool, tvb, offset + 3, 1, ENC_NA); |
883 | 0 | value = tvb_get_uint8(tvb, offset + 3); |
884 | 0 | if (value < 2 || value > 250) { |
885 | 0 | expert_add_info(pinfo, pitem, &ei_btavdtp_sbc_max_bitpool_out_of_range); |
886 | 0 | } |
887 | |
|
888 | 0 | value = tvb_get_h_uint32(tvb, offset); |
889 | 0 | if (value) { |
890 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " (%s%s%s%s%s| %s%s%s%s%s| block: %s%s%s%s%s| subbands: %s%s%s| allocation: %s%s%s| bitpool: %u..%u)", |
891 | 0 | (value8[0] & 0x80) ? "16000 " : "", |
892 | 0 | (value8[0] & 0x40) ? "32000 " : "", |
893 | 0 | (value8[0] & 0x20) ? "44100 " : "", |
894 | 0 | (value8[0] & 0x10) ? "48000 " : "", |
895 | 0 | (value8[0] & 0xF0) ? "" : "not set ", |
896 | 0 | (value8[0] & 0x08) ? "Mono " : "", |
897 | 0 | (value8[0] & 0x04) ? "DualChannel " : "", |
898 | 0 | (value8[0] & 0x02) ? "Stereo " : "", |
899 | 0 | (value8[0] & 0x01) ? "JointStereo " : "", |
900 | 0 | (value8[0] & 0x0F) ? "" : "not set ", |
901 | 0 | (value8[1] & 0x80) ? "4 " : "", |
902 | 0 | (value8[1] & 0x40) ? "8 " : "", |
903 | 0 | (value8[1] & 0x20) ? "12 " : "", |
904 | 0 | (value8[1] & 0x10) ? "16 " : "", |
905 | 0 | (value8[1] & 0xF0) ? "" : "not set ", |
906 | 0 | (value8[1] & 0x08) ? "4 " : "", |
907 | 0 | (value8[1] & 0x04) ? "8 " : "", |
908 | 0 | (value8[1] & 0x0C) ? "" : "not set ", |
909 | 0 | (value8[1] & 0x02) ? "SNR " : "", |
910 | 0 | (value8[1] & 0x01) ? "Loudness " : "", |
911 | 0 | (value8[1] & 0x03) ? "" : "not set ", |
912 | 0 | value8[2], |
913 | 0 | value8[3]); |
914 | |
|
915 | 0 | proto_item_append_text(service_item, " (%s%s%s%s%s| %s%s%s%s%s| block: %s%s%s%s%s| subbands: %s%s%s| allocation: %s%s%s| bitpool: %u..%u)", |
916 | 0 | (value8[0] & 0x80) ? "16000 " : "", |
917 | 0 | (value8[0] & 0x40) ? "32000 " : "", |
918 | 0 | (value8[0] & 0x20) ? "44100 " : "", |
919 | 0 | (value8[0] & 0x10) ? "48000 " : "", |
920 | 0 | (value8[0] & 0xF0) ? "" : "not set ", |
921 | 0 | (value8[0] & 0x08) ? "Mono " : "", |
922 | 0 | (value8[0] & 0x04) ? "DualChannel " : "", |
923 | 0 | (value8[0] & 0x02) ? "Stereo " : "", |
924 | 0 | (value8[0] & 0x01) ? "JointStereo " : "", |
925 | 0 | (value8[0] & 0x0F) ? "" : "not set ", |
926 | 0 | (value8[1] & 0x80) ? "4 " : "", |
927 | 0 | (value8[1] & 0x40) ? "8 " : "", |
928 | 0 | (value8[1] & 0x20) ? "12 " : "", |
929 | 0 | (value8[1] & 0x10) ? "16 " : "", |
930 | 0 | (value8[1] & 0xF0) ? "" : "not set ", |
931 | 0 | (value8[1] & 0x08) ? "4 " : "", |
932 | 0 | (value8[1] & 0x04) ? "8 " : "", |
933 | 0 | (value8[1] & 0x0C) ? "" : "not set ", |
934 | 0 | (value8[1] & 0x02) ? "SNR " : "", |
935 | 0 | (value8[1] & 0x01) ? "Loudness " : "", |
936 | 0 | (value8[1] & 0x03) ? "" : "not set ", |
937 | 0 | value8[2], |
938 | 0 | value8[3]); |
939 | 0 | } else { |
940 | 0 | col_append_str(pinfo->cinfo, COL_INFO, " (none)"); |
941 | 0 | proto_item_append_text(service_item, " (none)"); |
942 | 0 | } |
943 | |
|
944 | 0 | break; |
945 | 0 | case CODEC_MPEG12_AUDIO: |
946 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_layer_1, tvb, offset, 1, ENC_NA); |
947 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_layer_2, tvb, offset, 1, ENC_NA); |
948 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_layer_3, tvb, offset, 1, ENC_NA); |
949 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_crc_protection, tvb, offset, 1, ENC_NA); |
950 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_channel_mode_mono, tvb, offset, 1, ENC_NA); |
951 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_channel_mode_dual_channel, tvb, offset, 1, ENC_NA); |
952 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_channel_mode_stereo, tvb, offset, 1, ENC_NA); |
953 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_channel_mode_joint_stereo, tvb, offset, 1, ENC_NA); |
954 | |
|
955 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_rfa, tvb, offset + 1, 1, ENC_NA); |
956 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_mpf_2, tvb, offset + 1, 1, ENC_NA); |
957 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_sampling_frequency_16000, tvb, offset + 1, 1, ENC_NA); |
958 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_sampling_frequency_22050, tvb, offset + 1, 1, ENC_NA); |
959 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_sampling_frequency_24000, tvb, offset + 1, 1, ENC_NA); |
960 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_sampling_frequency_32000, tvb, offset + 1, 1, ENC_NA); |
961 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_sampling_frequency_44100, tvb, offset + 1, 1, ENC_NA); |
962 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_sampling_frequency_48000, tvb, offset + 1, 1, ENC_NA); |
963 | |
|
964 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_vbr_supported, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
965 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg12_bit_rate, tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
966 | 0 | break; |
967 | 0 | case CODEC_MPEG24_AAC: |
968 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_object_type_mpeg2_aac_lc, tvb, offset, 1, ENC_NA); |
969 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_object_type_mpeg4_aac_lc, tvb, offset, 1, ENC_NA); |
970 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_object_type_mpeg4_aac_ltp, tvb, offset, 1, ENC_NA); |
971 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_object_type_mpeg4_aac_scalable, tvb, offset, 1, ENC_NA); |
972 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_object_type_rfa, tvb, offset, 1, ENC_NA); |
973 | |
|
974 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_8000, tvb, offset + 1, 1, ENC_NA); |
975 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_11025, tvb, offset + 1, 1, ENC_NA); |
976 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_12000, tvb, offset + 1, 1, ENC_NA); |
977 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_16000, tvb, offset + 1, 1, ENC_NA); |
978 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_22050, tvb, offset + 1, 1, ENC_NA); |
979 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_24000, tvb, offset + 1, 1, ENC_NA); |
980 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_32000, tvb, offset + 1, 1, ENC_NA); |
981 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_44100, tvb, offset + 1, 1, ENC_NA); |
982 | |
|
983 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_48000, tvb, offset + 2, 1, ENC_NA); |
984 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_64000, tvb, offset + 2, 1, ENC_NA); |
985 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_88200, tvb, offset + 2, 1, ENC_NA); |
986 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_sampling_frequency_96000, tvb, offset + 2, 1, ENC_NA); |
987 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_channels_1, tvb, offset + 2, 1, ENC_NA); |
988 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_channels_2, tvb, offset + 2, 1, ENC_NA); |
989 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_rfa, tvb, offset + 2, 1, ENC_NA); |
990 | |
|
991 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_vbr_supported, tvb, offset + 3, 3, ENC_BIG_ENDIAN); |
992 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg24_bit_rate, tvb, offset + 3, 3, ENC_BIG_ENDIAN); |
993 | 0 | break; |
994 | 0 | case CODEC_ATRAC: |
995 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_version, tvb, offset, 1, ENC_NA); |
996 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_channel_mode_single_channel, tvb, offset, 1, ENC_NA); |
997 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_channel_mode_dual_channel, tvb, offset, 1, ENC_NA); |
998 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_channel_mode_joint_stereo, tvb, offset, 1, ENC_NA); |
999 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_rfa1, tvb, offset, 1, ENC_NA); |
1000 | |
|
1001 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_rfa2, tvb, offset + 1, 3, ENC_BIG_ENDIAN); |
1002 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_sampling_frequency_44100, tvb, offset + 1, 3, ENC_BIG_ENDIAN); |
1003 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_sampling_frequency_48000, tvb, offset + 1, 3, ENC_BIG_ENDIAN); |
1004 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_vbr_supported, tvb, offset + 3, 3, ENC_BIG_ENDIAN); |
1005 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_bit_rate, tvb, offset + 3, 3, ENC_BIG_ENDIAN); |
1006 | |
|
1007 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_maximum_sul, tvb, offset + 4, 2, ENC_BIG_ENDIAN); |
1008 | |
|
1009 | 0 | proto_tree_add_item(tree, hf_btavdtp_atrac_rfa3, tvb, offset + 6, 1, ENC_NA); |
1010 | 0 | break; |
1011 | 0 | case CODEC_VENDOR: /* non-A2DP */ |
1012 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
1013 | |
|
1014 | 0 | if (vendor_id) |
1015 | 0 | *vendor_id = tvb_get_letohl(tvb, offset); |
1016 | |
|
1017 | 0 | if (vendor_codec) |
1018 | 0 | *vendor_codec = tvb_get_letohs(tvb, offset + 4); |
1019 | |
|
1020 | 0 | switch (tvb_get_letohl(tvb, offset)) { |
1021 | 0 | case 0x004F: /* APT Licensing Ltd. */ |
1022 | 0 | case 0x00D7: /* Qualcomm Technologies, Inc. */ |
1023 | 0 | proto_tree_add_item_ret_uint(tree, hf_btavdtp_vendor_apt_codec_id, tvb, offset + 4, 2, ENC_LITTLE_ENDIAN, &vendor_codec_id); |
1024 | 0 | switch (vendor_codec_id) { |
1025 | 0 | case VENDOR_APT_CODEC_ID_APT_X: |
1026 | 0 | case VENDOR_APT_CODEC_ID_APT_X_HD: |
1027 | |
|
1028 | 0 | if (vendor_codec_id == VENDOR_APT_CODEC_ID_APT_X) { |
1029 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptx_sampling_frequency_16000, tvb, offset + 6, 1, ENC_NA); |
1030 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptx_sampling_frequency_32000, tvb, offset + 6, 1, ENC_NA); |
1031 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptx_sampling_frequency_44100, tvb, offset + 6, 1, ENC_NA); |
1032 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptx_sampling_frequency_48000, tvb, offset + 6, 1, ENC_NA); |
1033 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptx_channel_mode_mono, tvb, offset + 6, 1, ENC_NA); |
1034 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptx_channel_mode_dual_channel, tvb, offset + 6, 1, ENC_NA); |
1035 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptx_channel_mode_stereo, tvb, offset + 6, 1, ENC_NA); |
1036 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptx_channel_mode_joint_stereo, tvb, offset + 6, 1, ENC_NA); |
1037 | 0 | } else { |
1038 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_16000, tvb, offset + 6, 1, ENC_NA); |
1039 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_32000, tvb, offset + 6, 1, ENC_NA); |
1040 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_44100, tvb, offset + 6, 1, ENC_NA); |
1041 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_48000, tvb, offset + 6, 1, ENC_NA); |
1042 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptxhd_channel_mode_mono, tvb, offset + 6, 1, ENC_NA); |
1043 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptxhd_channel_mode_dual_channel, tvb, offset + 6, 1, ENC_NA); |
1044 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptxhd_channel_mode_stereo, tvb, offset + 6, 1, ENC_NA); |
1045 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptxhd_channel_mode_joint_stereo, tvb, offset + 6, 1, ENC_NA); |
1046 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_aptxhd_rfa, tvb, offset + 7, 4, ENC_NA); |
1047 | 0 | } |
1048 | |
|
1049 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " (%s -", |
1050 | 0 | val_to_str_const(vendor_codec_id, vendor_apt_codec_vals, "unknown codec")); |
1051 | 0 | proto_item_append_text(service_item, " (%s -", |
1052 | 0 | val_to_str_const(vendor_codec_id, vendor_apt_codec_vals, "unknown codec")); |
1053 | |
|
1054 | 0 | value = tvb_get_uint8(tvb, offset + 6); |
1055 | 0 | if (value) { |
1056 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s%s%s%s%s,%s%s%s%s%s)", |
1057 | 0 | (value & 0x80) ? " 16000" : "", |
1058 | 0 | (value & 0x40) ? " 32000" : "", |
1059 | 0 | (value & 0x20) ? " 44100" : "", |
1060 | 0 | (value & 0x10) ? " 48000" : "", |
1061 | 0 | (value & 0xF0) ? "" : " not set", |
1062 | 0 | (value & 0x08) ? " Mono" : "", |
1063 | 0 | (value & 0x04) ? " DualChannel" : "", |
1064 | 0 | (value & 0x02) ? " Stereo" : "", |
1065 | 0 | (value & 0x01) ? " JointStereo" : "", |
1066 | 0 | (value & 0x0F) ? "" : " not set"); |
1067 | |
|
1068 | 0 | proto_item_append_text(service_item, "%s%s%s%s%s,%s%s%s%s%s)", |
1069 | 0 | (value & 0x80) ? " 16000" : "", |
1070 | 0 | (value & 0x40) ? " 32000" : "", |
1071 | 0 | (value & 0x20) ? " 44100" : "", |
1072 | 0 | (value & 0x10) ? " 48000" : "", |
1073 | 0 | (value & 0xF0) ? "" : " not set", |
1074 | 0 | (value & 0x08) ? " Mono" : "", |
1075 | 0 | (value & 0x04) ? " DualChannel" : "", |
1076 | 0 | (value & 0x02) ? " Stereo" : "", |
1077 | 0 | (value & 0x01) ? " JointStereo" : "", |
1078 | 0 | (value & 0x0F) ? "" : " not set"); |
1079 | 0 | } else { |
1080 | 0 | col_append_str(pinfo->cinfo, COL_INFO, " none)"); |
1081 | 0 | proto_item_append_text(service_item, " none)"); |
1082 | 0 | } |
1083 | 0 | break; |
1084 | 0 | default: |
1085 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_value, tvb, offset + 6, losc - 6, ENC_NA); |
1086 | 0 | } |
1087 | 0 | break; |
1088 | 0 | case 0x012D: /* Sony Corporation */ |
1089 | 0 | proto_tree_add_item_ret_uint(tree, hf_btavdtp_vendor_sony_codec_id, tvb, offset + 4, 2, ENC_LITTLE_ENDIAN, &vendor_codec_id); |
1090 | 0 | switch (vendor_codec_id) { |
1091 | 0 | case VENDOR_SONY_CODEC_ID_LDAC: |
1092 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_rfa1, tvb, offset + 6, 1, ENC_NA); |
1093 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_sampling_frequency_44100, tvb, offset + 6, 1, ENC_NA); |
1094 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_sampling_frequency_48000, tvb, offset + 6, 1, ENC_NA); |
1095 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_sampling_frequency_88200, tvb, offset + 6, 1, ENC_NA); |
1096 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_sampling_frequency_96000, tvb, offset + 6, 1, ENC_NA); |
1097 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_sampling_frequency_176400, tvb, offset + 6, 1, ENC_NA); |
1098 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_sampling_frequency_192000, tvb, offset + 6, 1, ENC_NA); |
1099 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_rfa2, tvb, offset + 7, 1, ENC_NA); |
1100 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_channel_mode_mono, tvb, offset + 7, 1, ENC_NA); |
1101 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_channel_mode_dual_channel, tvb, offset + 7, 1, ENC_NA); |
1102 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_ldac_channel_mode_stereo, tvb, offset + 7, 1, ENC_NA); |
1103 | |
|
1104 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " (%s -", |
1105 | 0 | val_to_str_const(vendor_codec_id, vendor_sony_codec_vals, "unknown codec")); |
1106 | 0 | proto_item_append_text(service_item, " (%s -", |
1107 | 0 | val_to_str_const(vendor_codec_id, vendor_sony_codec_vals, "unknown codec")); |
1108 | |
|
1109 | 0 | value = tvb_get_h_uint16(tvb, offset + 6); |
1110 | 0 | if (value != 0) { |
1111 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s%s%s%s%s%s%s,%s%s%s%s)", |
1112 | 0 | (value8[0] & 0x20) ? " 44100" : "", |
1113 | 0 | (value8[0] & 0x10) ? " 48000" : "", |
1114 | 0 | (value8[0] & 0x08) ? " 88200" : "", |
1115 | 0 | (value8[0] & 0x04) ? " 96000" : "", |
1116 | 0 | (value8[0] & 0x02) ? " 176400" : "", |
1117 | 0 | (value8[0] & 0x01) ? " 192000" : "", |
1118 | 0 | (value8[0] & 0x3F) ? "" : " not set", |
1119 | 0 | (value8[1] & 0x04) ? " Mono" : "", |
1120 | 0 | (value8[1] & 0x02) ? " DualChannel" : "", |
1121 | 0 | (value8[1] & 0x01) ? " Stereo" : "", |
1122 | 0 | (value8[1] & 0x07) ? "" : " not set"); |
1123 | |
|
1124 | 0 | proto_item_append_text(service_item, "%s%s%s%s%s%s%s,%s%s%s%s)", |
1125 | 0 | (value8[0] & 0x20) ? " 44100" : "", |
1126 | 0 | (value8[0] & 0x10) ? " 48000" : "", |
1127 | 0 | (value8[0] & 0x08) ? " 88200" : "", |
1128 | 0 | (value8[0] & 0x04) ? " 96000" : "", |
1129 | 0 | (value8[0] & 0x02) ? " 176400" : "", |
1130 | 0 | (value8[0] & 0x01) ? " 192000" : "", |
1131 | 0 | (value8[0] & 0x3F) ? "" : " not set", |
1132 | 0 | (value8[1] & 0x04) ? " Mono" : "", |
1133 | 0 | (value8[1] & 0x02) ? " DualChannel" : "", |
1134 | 0 | (value8[1] & 0x01) ? " Stereo" : "", |
1135 | 0 | (value8[1] & 0x07) ? "" : " not set"); |
1136 | 0 | } else { |
1137 | 0 | col_append_str(pinfo->cinfo, COL_INFO, " none)"); |
1138 | 0 | proto_item_append_text(service_item, " none)"); |
1139 | 0 | } |
1140 | 0 | break; |
1141 | 0 | default: |
1142 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_value, tvb, offset + 6, losc - 6, ENC_NA); |
1143 | 0 | } |
1144 | 0 | break; |
1145 | 0 | case 0x00E0: /* Google */ |
1146 | 0 | proto_tree_add_item_ret_uint(tree, hf_btavdtp_vendor_google_codec_id, tvb, offset + 4, 2, ENC_LITTLE_ENDIAN, &vendor_codec_id); |
1147 | 0 | switch (vendor_codec_id) { |
1148 | 0 | case VENDOR_GOOGLE_CODEC_ID_OPUS: |
1149 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_opus_sampling_frequency_48000, tvb, offset + 6, 1, ENC_NA); |
1150 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_opus_rfa, tvb, offset + 6, 1, ENC_NA); |
1151 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_opus_frame_duration_20, tvb, offset + 6, 1, ENC_NA); |
1152 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_opus_frame_duration_10, tvb, offset + 6, 1, ENC_NA); |
1153 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_opus_channel_mode_dual, tvb, offset + 6, 1, ENC_NA); |
1154 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_opus_channel_mode_stereo, tvb, offset + 6, 1, ENC_NA); |
1155 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_opus_channel_mode_mono, tvb, offset + 6, 1, ENC_NA); |
1156 | |
|
1157 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " (%s -", |
1158 | 0 | val_to_str_const(vendor_codec_id, vendor_google_codec_vals, "unknown codec")); |
1159 | 0 | proto_item_append_text(service_item, " (%s -", |
1160 | 0 | val_to_str_const(vendor_codec_id, vendor_google_codec_vals, "unknown codec")); |
1161 | |
|
1162 | 0 | value = tvb_get_uint8(tvb, offset + 6); |
1163 | 0 | if (value) { |
1164 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s%s,%s%s%s%s)", |
1165 | 0 | (value & 0x80) ? " 48000" : "", |
1166 | 0 | (value & 0x80) ? "" : " not set", |
1167 | 0 | (value & 0x04) ? " Dual" : "", |
1168 | 0 | (value & 0x02) ? " Stereo" : "", |
1169 | 0 | (value & 0x01) ? " Mono" : "", |
1170 | 0 | (value & 0x07) ? "" : " not set"); |
1171 | |
|
1172 | 0 | proto_item_append_text(service_item, "%s%s,%s%s%s%s)", |
1173 | 0 | (value & 0x80) ? " 48000" : "", |
1174 | 0 | (value & 0x80) ? "" : " not set", |
1175 | 0 | (value & 0x04) ? " Dual" : "", |
1176 | 0 | (value & 0x02) ? " Stereo" : "", |
1177 | 0 | (value & 0x01) ? " Mono" : "", |
1178 | 0 | (value & 0x07) ? "" : " not set"); |
1179 | 0 | } else { |
1180 | 0 | col_append_str(pinfo->cinfo, COL_INFO, " none)"); |
1181 | 0 | proto_item_append_text(service_item, " none)"); |
1182 | 0 | } |
1183 | 0 | break; |
1184 | 0 | default: |
1185 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_value, tvb, offset + 6, losc - 6, ENC_NA); |
1186 | 0 | } |
1187 | 0 | break; |
1188 | 0 | default: |
1189 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_codec_id, tvb, offset + 4, 2, ENC_LITTLE_ENDIAN); |
1190 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_value, tvb, offset + 6, losc - 6, ENC_NA); |
1191 | 0 | } |
1192 | | |
1193 | 0 | break; |
1194 | 0 | default: |
1195 | 0 | proto_tree_add_item(tree, hf_btavdtp_data, tvb, offset, losc, ENC_NA); |
1196 | 0 | } |
1197 | 0 | break; |
1198 | 0 | case MEDIA_TYPE_VIDEO: |
1199 | 0 | switch(media_codec_type) { |
1200 | 0 | case CODEC_H263_BASELINE: |
1201 | 0 | case CODEC_H263_PROFILE_3: |
1202 | 0 | case CODEC_H263_PROFILE_8: |
1203 | 0 | proto_tree_add_item(tree, hf_btavdtp_h263_level_10, tvb, offset, 1, ENC_NA); |
1204 | 0 | proto_tree_add_item(tree, hf_btavdtp_h263_level_20, tvb, offset, 1, ENC_NA); |
1205 | 0 | proto_tree_add_item(tree, hf_btavdtp_h263_level_30, tvb, offset, 1, ENC_NA); |
1206 | 0 | proto_tree_add_item(tree, hf_btavdtp_h263_level_rfa, tvb, offset, 1, ENC_NA); |
1207 | 0 | break; |
1208 | 0 | case CODEC_MPEG4_VSP: |
1209 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg4_level_0, tvb, offset, 1, ENC_NA); |
1210 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg4_level_1, tvb, offset, 1, ENC_NA); |
1211 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg4_level_2, tvb, offset, 1, ENC_NA); |
1212 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg4_level_3, tvb, offset, 1, ENC_NA); |
1213 | 0 | proto_tree_add_item(tree, hf_btavdtp_mpeg4_level_rfa, tvb, offset, 1, ENC_NA); |
1214 | 0 | break; |
1215 | 0 | case CODEC_VENDOR: /* non-VDP */ |
1216 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); |
1217 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_codec_id, tvb, offset + 4, 2, ENC_LITTLE_ENDIAN); |
1218 | 0 | proto_tree_add_item(tree, hf_btavdtp_vendor_specific_value, tvb, offset + 6, losc - 6, ENC_NA); |
1219 | 0 | break; |
1220 | 0 | default: |
1221 | 0 | proto_tree_add_item(tree, hf_btavdtp_data, tvb, offset, losc, ENC_NA); |
1222 | 0 | } |
1223 | 0 | break; |
1224 | 0 | default: |
1225 | 0 | proto_tree_add_item(tree, hf_btavdtp_data, tvb, offset, losc, ENC_NA); |
1226 | 0 | } |
1227 | | |
1228 | 0 | offset += losc; |
1229 | |
|
1230 | 0 | return offset; |
1231 | 0 | } |
1232 | | |
1233 | | |
1234 | | static int |
1235 | | dissect_capabilities(tvbuff_t *tvb, packet_info *pinfo, |
1236 | | proto_tree *tree, int offset, int *codec, |
1237 | | int *content_protection_type, uint32_t *vendor_id, |
1238 | | uint16_t *vendor_codec, uint32_t *configuration_offset, |
1239 | | uint8_t *configuration_length) |
1240 | 0 | { |
1241 | 0 | proto_item *pitem = NULL; |
1242 | 0 | proto_item *ptree = NULL; |
1243 | 0 | proto_tree *capabilities_tree; |
1244 | 0 | proto_item *capabilities_item; |
1245 | 0 | proto_tree *service_tree = NULL; |
1246 | 0 | proto_item *service_item = NULL; |
1247 | 0 | int service_category = 0; |
1248 | 0 | int losc = 0; |
1249 | 0 | int recovery_type = 0; |
1250 | 0 | int maximum_recovery_window_size = 0; |
1251 | 0 | int maximum_number_of_media_packet_in_parity_code = 0; |
1252 | 0 | int media_type = 0; |
1253 | 0 | int media_codec_type = 0; |
1254 | |
|
1255 | 0 | capabilities_item = proto_tree_add_item(tree, hf_btavdtp_capabilities, tvb, offset, tvb_reported_length(tvb) - offset, ENC_NA); |
1256 | 0 | capabilities_tree = proto_item_add_subtree(capabilities_item, ett_btavdtp_capabilities); |
1257 | |
|
1258 | 0 | if (codec) |
1259 | 0 | *codec = -1; |
1260 | |
|
1261 | 0 | if (vendor_id) |
1262 | 0 | *vendor_id = 0x003F; /* Bluetooth SIG */ |
1263 | |
|
1264 | 0 | if (vendor_codec) |
1265 | 0 | *vendor_codec = 0; |
1266 | |
|
1267 | 0 | if (configuration_length) |
1268 | 0 | *configuration_length = 0; |
1269 | |
|
1270 | 0 | if (configuration_offset) |
1271 | 0 | *configuration_offset = 0; |
1272 | |
|
1273 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
1274 | 0 | service_category = tvb_get_uint8(tvb, offset); |
1275 | 0 | losc = tvb_get_uint8(tvb, offset + 1); |
1276 | 0 | service_item = proto_tree_add_none_format(capabilities_tree, hf_btavdtp_service, tvb, offset, 2 + losc, "Service: %s", val_to_str_const(service_category, service_category_vals, "RFD")); |
1277 | 0 | service_tree = proto_item_add_subtree(service_item, ett_btavdtp_service); |
1278 | |
|
1279 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_service_category, tvb, offset, 1, ENC_NA); |
1280 | 0 | offset += 1; |
1281 | |
|
1282 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_length_of_service_category, tvb, offset, 1, ENC_NA); |
1283 | 0 | offset += 1; |
1284 | |
|
1285 | 0 | switch (service_category) { |
1286 | 0 | case SERVICE_CATEGORY_MEDIA_TRANSPORT: |
1287 | 0 | case SERVICE_CATEGORY_REPORTING: |
1288 | 0 | case SERVICE_CATEGORY_DELAY_REPORTING: |
1289 | | /* losc should be 0 */ |
1290 | 0 | break; |
1291 | 0 | case SERVICE_CATEGORY_RECOVERY: |
1292 | 0 | recovery_type = tvb_get_uint8(tvb, offset); |
1293 | 0 | pitem = proto_tree_add_item(service_tree, hf_btavdtp_recovery_type, tvb, offset, 1, ENC_NA); |
1294 | 0 | proto_item_append_text(pitem, " (%s)", val_to_str_const(recovery_type, recovery_type_vals, "RFD")); |
1295 | 0 | offset += 1; |
1296 | 0 | losc -= 1; |
1297 | |
|
1298 | 0 | maximum_recovery_window_size = tvb_get_uint8(tvb, offset); |
1299 | 0 | pitem = proto_tree_add_item(service_tree, hf_btavdtp_maximum_recovery_window_size, tvb, offset, 1, ENC_NA); |
1300 | 0 | if (maximum_recovery_window_size == 0x00) { |
1301 | 0 | proto_item_append_text(pitem, " (Forbidden)"); |
1302 | 0 | } else if (maximum_recovery_window_size >= 0x18) { |
1303 | 0 | proto_item_append_text(pitem, " (Undocumented)"); |
1304 | 0 | } |
1305 | 0 | offset += 1; |
1306 | 0 | losc -= 1; |
1307 | |
|
1308 | 0 | maximum_number_of_media_packet_in_parity_code = tvb_get_uint8(tvb, offset); |
1309 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_maximum_number_of_media_packet_in_parity_code, tvb, offset, 1, ENC_NA); |
1310 | 0 | pitem = proto_tree_add_item(service_tree, hf_btavdtp_maximum_recovery_window_size, tvb, offset, 1, ENC_NA); |
1311 | 0 | if (maximum_number_of_media_packet_in_parity_code == 0x00) { |
1312 | 0 | proto_item_append_text(pitem, " (Forbidden)"); |
1313 | 0 | } else if (maximum_number_of_media_packet_in_parity_code >= 0x18) { |
1314 | 0 | proto_item_append_text(pitem, " (Undocumented)"); |
1315 | 0 | } |
1316 | 0 | offset += 1; |
1317 | 0 | losc -= 1; |
1318 | 0 | break; |
1319 | 0 | case SERVICE_CATEGORY_MEDIA_CODEC: |
1320 | 0 | if (configuration_length) |
1321 | 0 | *configuration_length = losc; |
1322 | 0 | if (configuration_offset) |
1323 | 0 | *configuration_offset = offset; |
1324 | |
|
1325 | 0 | media_type = tvb_get_uint8(tvb, offset) >> 4; |
1326 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_media_codec_media_type, tvb, offset, 1, ENC_NA); |
1327 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_media_codec_rfa , tvb, offset, 1, ENC_NA); |
1328 | 0 | offset += 1; |
1329 | 0 | losc -= 1; |
1330 | |
|
1331 | 0 | media_codec_type = tvb_get_uint8(tvb, offset); |
1332 | 0 | if (codec) { |
1333 | 0 | *codec = media_codec_type; |
1334 | 0 | } |
1335 | |
|
1336 | 0 | if (media_type == MEDIA_TYPE_AUDIO) { |
1337 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_media_codec_audio_type, tvb, offset, 1, ENC_NA); |
1338 | 0 | proto_item_append_text(service_item, " - Audio %s", |
1339 | 0 | val_to_str_const(media_codec_type, media_codec_audio_type_vals, "unknown codec")); |
1340 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " - Audio %s", |
1341 | 0 | val_to_str_const(media_codec_type, media_codec_audio_type_vals, "unknown codec")); |
1342 | 0 | } else if (media_type == MEDIA_TYPE_VIDEO) { |
1343 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_media_codec_video_type, tvb, offset, 1, ENC_NA); |
1344 | 0 | proto_item_append_text(service_item, " - Video %s", |
1345 | 0 | val_to_str_const(media_codec_type, media_codec_video_type_vals, "unknown codec")); |
1346 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " - Video %s", |
1347 | 0 | val_to_str_const(media_codec_type, media_codec_video_type_vals, "unknown codec")); |
1348 | 0 | } else { |
1349 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_media_codec_unknown_type, tvb, offset, 1, ENC_NA); |
1350 | 0 | proto_item_append_text(service_item, " - Unknown 0x%02x", media_codec_type); |
1351 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " - Unknown 0x%02x", media_codec_type); |
1352 | 0 | } |
1353 | 0 | offset += 1; |
1354 | 0 | losc -= 1; |
1355 | |
|
1356 | 0 | offset = dissect_codec(tvb, pinfo, service_item, service_tree, |
1357 | 0 | offset, losc, media_type, media_codec_type, |
1358 | 0 | vendor_id, vendor_codec); |
1359 | 0 | losc = 0; |
1360 | 0 | break; |
1361 | 0 | case SERVICE_CATEGORY_CONTENT_PROTECTION: |
1362 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_content_protection_type, tvb, offset, 2, ENC_LITTLE_ENDIAN); |
1363 | 0 | if (content_protection_type) { |
1364 | 0 | *content_protection_type = tvb_get_letohs(tvb, offset); |
1365 | 0 | } |
1366 | 0 | proto_item_append_text(service_item, " - %s", |
1367 | 0 | val_to_str_const(tvb_get_letohs(tvb, offset), content_protection_type_vals, "unknown")); |
1368 | |
|
1369 | 0 | offset += 2; |
1370 | 0 | losc -= 2; |
1371 | |
|
1372 | 0 | if (losc > 0) { |
1373 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_data, tvb, offset, losc, ENC_NA); |
1374 | 0 | offset += losc; |
1375 | 0 | losc = 0; |
1376 | 0 | } |
1377 | 0 | break; |
1378 | 0 | case SERVICE_CATEGORY_HEADER_COMPRESSION: |
1379 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_header_compression_backch, tvb, offset, 1, ENC_NA); |
1380 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_header_compression_media, tvb, offset, 1, ENC_NA); |
1381 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_header_compression_recovery, tvb, offset, 1, ENC_NA); |
1382 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_header_compression_rfa, tvb, offset, 1, ENC_NA); |
1383 | 0 | offset += 1; |
1384 | 0 | losc -= 1; |
1385 | 0 | break; |
1386 | 0 | case SERVICE_CATEGORY_MULTIPLEXING: |
1387 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_multiplexing_fragmentation, tvb, offset, 1, ENC_NA); |
1388 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_multiplexing_rfa, tvb, offset, 1, ENC_NA); |
1389 | 0 | offset += 1; |
1390 | 0 | losc -= 1; |
1391 | |
|
1392 | 0 | if (losc >= 2) { |
1393 | 0 | pitem = proto_tree_add_none_format(service_tree, hf_btavdtp_service_multiplexing_entry, tvb, offset, 1 + losc, "Entry: Media Transport Session"); |
1394 | 0 | ptree = proto_item_add_subtree(pitem, ett_btavdtp_service); |
1395 | |
|
1396 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_tsid, tvb, offset, 1, ENC_NA); |
1397 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_entry_rfa, tvb, offset, 1, ENC_NA); |
1398 | 0 | offset += 1; |
1399 | 0 | losc -= 1; |
1400 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_tcid, tvb, offset, 1, ENC_NA); |
1401 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_entry_rfa, tvb, offset, 1, ENC_NA); |
1402 | 0 | offset += 1; |
1403 | 0 | losc -= 1; |
1404 | 0 | } |
1405 | |
|
1406 | 0 | if (losc >= 2) { |
1407 | 0 | pitem = proto_tree_add_none_format(service_tree, hf_btavdtp_service_multiplexing_entry, tvb, offset, 1 + losc, "Entry: Reporting Transport Session"); |
1408 | 0 | ptree = proto_item_add_subtree(pitem, ett_btavdtp_service); |
1409 | |
|
1410 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_tsid, tvb, offset, 1, ENC_NA); |
1411 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_entry_rfa, tvb, offset, 1, ENC_NA); |
1412 | 0 | offset += 1; |
1413 | 0 | losc -= 1; |
1414 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_tcid, tvb, offset, 1, ENC_NA); |
1415 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_entry_rfa, tvb, offset, 1, ENC_NA); |
1416 | 0 | offset += 1; |
1417 | 0 | losc -= 1; |
1418 | 0 | } |
1419 | |
|
1420 | 0 | if (losc >= 2) { |
1421 | 0 | pitem = proto_tree_add_none_format(service_tree, hf_btavdtp_service_multiplexing_entry, tvb, offset, 1 + losc, "Entry: Recovery Transport Session"); |
1422 | 0 | ptree = proto_item_add_subtree(pitem, ett_btavdtp_service); |
1423 | |
|
1424 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_tsid, tvb, offset, 1, ENC_NA); |
1425 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_entry_rfa, tvb, offset, 1, ENC_NA); |
1426 | 0 | offset += 1; |
1427 | 0 | losc -= 1; |
1428 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_tcid, tvb, offset, 1, ENC_NA); |
1429 | 0 | proto_tree_add_item(ptree, hf_btavdtp_multiplexing_entry_rfa, tvb, offset, 1, ENC_NA); |
1430 | 0 | offset += 1; |
1431 | 0 | losc -= 1; |
1432 | 0 | } |
1433 | 0 | break; |
1434 | 0 | default: |
1435 | 0 | proto_tree_add_item(service_tree, hf_btavdtp_data, tvb, offset, losc, ENC_NA); |
1436 | 0 | offset += losc; |
1437 | 0 | losc = 0; |
1438 | 0 | } |
1439 | | |
1440 | 0 | if (losc > 0) { |
1441 | 0 | pitem = proto_tree_add_item(service_tree, hf_btavdtp_data, tvb, offset, losc, ENC_NA); |
1442 | 0 | offset += losc; |
1443 | |
|
1444 | 0 | expert_add_info(pinfo, pitem, &ei_btavdtp_unexpected_losc_data); |
1445 | 0 | } |
1446 | 0 | } |
1447 | | |
1448 | 0 | return offset; |
1449 | 0 | } |
1450 | | |
1451 | | static int |
1452 | | dissect_seid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, |
1453 | | int seid_side, int i_item, uint32_t *sep_seid, |
1454 | | uint32_t interface_id, uint32_t adapter_id, uint32_t chandle, |
1455 | | uint32_t frame_number) |
1456 | 0 | { |
1457 | 0 | uint32_t seid; |
1458 | 0 | proto_tree *seid_tree = NULL; |
1459 | 0 | proto_item *seid_item = NULL; |
1460 | 0 | uint32_t direction; |
1461 | |
|
1462 | 0 | seid = tvb_get_uint8(tvb, offset) >> 2; |
1463 | 0 | if (sep_seid) { |
1464 | 0 | *sep_seid = seid; |
1465 | 0 | } |
1466 | |
|
1467 | 0 | if (seid_side == SEID_ACP) { |
1468 | 0 | direction = pinfo->p2p_dir; |
1469 | 0 | seid_item = proto_tree_add_none_format(tree, hf_btavdtp_acp_seid_item, tvb, offset, 1, |
1470 | 0 | "ACP SEID [%u - %s %s]", seid, |
1471 | 0 | get_sep_media_type(interface_id, adapter_id, chandle, direction, seid, frame_number), |
1472 | 0 | get_sep_type(interface_id, adapter_id, chandle, direction, seid, frame_number)); |
1473 | 0 | seid_tree = proto_item_add_subtree(seid_item, ett_btavdtp_sep); |
1474 | 0 | proto_tree_add_item(seid_tree, hf_btavdtp_acp_seid, tvb, offset, 1, ENC_NA); |
1475 | 0 | if (i_item > 0) proto_item_append_text(seid_item, " item %u", i_item); |
1476 | |
|
1477 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " - ACP SEID [%u - %s %s]", |
1478 | 0 | seid, get_sep_media_type(interface_id, adapter_id, chandle, direction, seid, frame_number), |
1479 | 0 | get_sep_type(interface_id, adapter_id, chandle, direction, seid, frame_number)); |
1480 | 0 | } else { |
1481 | 0 | direction = (pinfo->p2p_dir == P2P_DIR_SENT) ? P2P_DIR_RECV : P2P_DIR_SENT; |
1482 | 0 | seid_item = proto_tree_add_none_format(tree, hf_btavdtp_int_seid_item, tvb, offset, 1, |
1483 | 0 | "INT SEID [%u - %s %s]", seid, |
1484 | 0 | get_sep_media_type(interface_id, adapter_id, chandle, direction, seid, frame_number), |
1485 | 0 | get_sep_type(interface_id, adapter_id, chandle, direction, seid, frame_number)); |
1486 | 0 | seid_tree = proto_item_add_subtree(seid_item, ett_btavdtp_sep); |
1487 | 0 | proto_tree_add_item(seid_tree, hf_btavdtp_int_seid, tvb, offset, 1, ENC_NA); |
1488 | 0 | if (i_item > 0) proto_item_append_text(seid_item, " item %u", i_item); |
1489 | |
|
1490 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " - INT SEID [%u - %s %s]", |
1491 | 0 | seid, get_sep_media_type(interface_id, adapter_id, chandle, direction, seid, frame_number), |
1492 | 0 | get_sep_type(interface_id, adapter_id, chandle, direction, seid, frame_number)); |
1493 | 0 | } |
1494 | |
|
1495 | 0 | proto_tree_add_item(seid_tree, hf_btavdtp_rfa_seid, tvb, offset, 1, ENC_NA); |
1496 | 0 | offset += 1; |
1497 | |
|
1498 | 0 | return offset; |
1499 | 0 | } |
1500 | | |
1501 | | |
1502 | | static int |
1503 | | dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
1504 | 0 | { |
1505 | 0 | proto_item *ti; |
1506 | 0 | proto_tree *btavdtp_tree = NULL; |
1507 | 0 | proto_tree *signal_tree = NULL; |
1508 | 0 | proto_item *signal_item = NULL; |
1509 | 0 | btl2cap_data_t *l2cap_data; |
1510 | 0 | int offset = 0; |
1511 | 0 | int i_sep = 1; |
1512 | 0 | int packet_type = 0; |
1513 | 0 | int message_type = 0; |
1514 | 0 | int signal_id = 0; |
1515 | 0 | unsigned delay; |
1516 | 0 | wmem_tree_t *subtree; |
1517 | 0 | wmem_tree_key_t key[8]; |
1518 | 0 | channels_info_t *channels_info; |
1519 | 0 | uint32_t interface_id; |
1520 | 0 | uint32_t adapter_id; |
1521 | 0 | uint32_t chandle; |
1522 | 0 | uint32_t psm; |
1523 | 0 | uint32_t direction; |
1524 | 0 | uint32_t cid; |
1525 | 0 | uint32_t frame_number; |
1526 | 0 | sep_entry_t *sep; |
1527 | 0 | tvbuff_t *next_tvb; |
1528 | 0 | uint32_t seid; |
1529 | 0 | int codec = -1; |
1530 | 0 | int content_protection_type = 0; |
1531 | 0 | uint32_t configuration_offset; |
1532 | 0 | uint8_t configuration_length; |
1533 | |
|
1534 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "AVDTP"); |
1535 | |
|
1536 | 0 | direction = pinfo->p2p_dir; |
1537 | 0 | switch (direction) { |
1538 | 0 | case P2P_DIR_SENT: |
1539 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Sent "); |
1540 | 0 | break; |
1541 | | |
1542 | 0 | case P2P_DIR_RECV: |
1543 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Rcvd "); |
1544 | 0 | break; |
1545 | 0 | default: |
1546 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "UnknownDirection "); |
1547 | 0 | goto LABEL_data; |
1548 | 0 | } |
1549 | | |
1550 | 0 | l2cap_data = (btl2cap_data_t *) data; |
1551 | 0 | DISSECTOR_ASSERT(l2cap_data); |
1552 | |
|
1553 | 0 | interface_id = l2cap_data->interface_id; |
1554 | 0 | adapter_id = l2cap_data->adapter_id; |
1555 | 0 | chandle = l2cap_data->chandle; |
1556 | 0 | psm = l2cap_data->psm; |
1557 | 0 | cid = l2cap_data->cid; |
1558 | 0 | frame_number = pinfo->num; |
1559 | |
|
1560 | 0 | key[0].length = 1; |
1561 | 0 | key[0].key = &interface_id; |
1562 | 0 | key[1].length = 1; |
1563 | 0 | key[1].key = &adapter_id; |
1564 | 0 | key[2].length = 1; |
1565 | 0 | key[2].key = &chandle; |
1566 | 0 | key[3].length = 1; |
1567 | 0 | key[3].key = &psm; |
1568 | 0 | key[4].length = 0; |
1569 | 0 | key[4].key = NULL; |
1570 | |
|
1571 | 0 | subtree = (wmem_tree_t *) wmem_tree_lookup32_array(channels, key); |
1572 | 0 | channels_info = (subtree) ? (channels_info_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL; |
1573 | 0 | if (!(channels_info && |
1574 | 0 | ((*channels_info->adapter_disconnect_in_frame >= pinfo->num && |
1575 | 0 | *channels_info->hci_disconnect_in_frame >= pinfo->num && |
1576 | 0 | *channels_info->l2cap_disconnect_in_frame >= pinfo->num && |
1577 | 0 | channels_info->disconnect_in_frame >= pinfo->num) || |
1578 | 0 | (*channels_info->adapter_disconnect_in_frame == 0 || |
1579 | 0 | *channels_info->hci_disconnect_in_frame == 0 || |
1580 | 0 | *channels_info->l2cap_disconnect_in_frame == 0 || |
1581 | 0 | channels_info->disconnect_in_frame == 0)))) { |
1582 | |
|
1583 | 0 | channels_info = (channels_info_t *) wmem_new (wmem_file_scope(), channels_info_t); |
1584 | 0 | channels_info->control_local_cid = l2cap_data->local_cid; |
1585 | 0 | channels_info->control_remote_cid = l2cap_data->remote_cid; |
1586 | 0 | channels_info->media_local_cid = BTL2CAP_UNKNOWN_CID; |
1587 | 0 | channels_info->media_remote_cid = BTL2CAP_UNKNOWN_CID; |
1588 | 0 | channels_info->disconnect_in_frame = bluetooth_max_disconnect_in_frame; |
1589 | 0 | channels_info->l2cap_disconnect_in_frame = l2cap_data->disconnect_in_frame; |
1590 | 0 | channels_info->hci_disconnect_in_frame = l2cap_data->hci_disconnect_in_frame; |
1591 | 0 | channels_info->adapter_disconnect_in_frame = l2cap_data->adapter_disconnect_in_frame; |
1592 | 0 | channels_info->sep = NULL; |
1593 | |
|
1594 | 0 | if (!pinfo->fd->visited || ( |
1595 | 0 | *channels_info->adapter_disconnect_in_frame == 0 || |
1596 | 0 | *channels_info->hci_disconnect_in_frame == 0 || |
1597 | 0 | *channels_info->l2cap_disconnect_in_frame == 0 || |
1598 | 0 | channels_info->disconnect_in_frame == 0)) { |
1599 | 0 | key[4].length = 1; |
1600 | 0 | key[4].key = &frame_number; |
1601 | 0 | key[5].length = 0; |
1602 | 0 | key[5].key = NULL; |
1603 | |
|
1604 | 0 | channels_info->stream_numbers = wmem_tree_new(wmem_file_scope()); |
1605 | |
|
1606 | 0 | if (*channels_info->adapter_disconnect_in_frame > 0 && |
1607 | 0 | *channels_info->hci_disconnect_in_frame > 0 && |
1608 | 0 | *channels_info->l2cap_disconnect_in_frame > 0 && |
1609 | 0 | channels_info->disconnect_in_frame > 0) { |
1610 | 0 | wmem_tree_insert32_array(channels, key, channels_info); |
1611 | 0 | } |
1612 | 0 | } else { |
1613 | 0 | channels_info->stream_numbers = NULL; |
1614 | 0 | } |
1615 | 0 | } |
1616 | |
|
1617 | 0 | if (!(l2cap_data->local_cid == channels_info->control_local_cid && |
1618 | 0 | l2cap_data->remote_cid == channels_info->control_remote_cid) && |
1619 | 0 | (channels_info->media_local_cid == BTL2CAP_UNKNOWN_CID || |
1620 | 0 | (l2cap_data->local_cid == channels_info->media_local_cid && |
1621 | 0 | l2cap_data->remote_cid == channels_info->media_remote_cid))) { |
1622 | |
|
1623 | 0 | if (!pinfo->fd->visited && channels_info->media_local_cid == BTL2CAP_UNKNOWN_CID) { |
1624 | 0 | channels_info->media_local_cid = l2cap_data->local_cid; |
1625 | 0 | channels_info->media_remote_cid = l2cap_data->remote_cid; |
1626 | 0 | } |
1627 | | /* Media Channel */ |
1628 | |
|
1629 | 0 | if (!channels_info->sep) { |
1630 | 0 | ti = proto_tree_add_item(tree, proto_btavdtp, tvb, offset, -1, ENC_NA); |
1631 | 0 | btavdtp_tree = proto_item_add_subtree(ti, ett_btavdtp); |
1632 | |
|
1633 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "Media stream on cid=0x%04x", l2cap_data->cid); |
1634 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA); |
1635 | 0 | } else { |
1636 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "Media stream ACP SEID [%u - %s %s]", |
1637 | 0 | channels_info->sep->seid, get_sep_media_type( |
1638 | 0 | interface_id, adapter_id, chandle, direction, |
1639 | 0 | channels_info->sep->seid, |
1640 | 0 | frame_number), |
1641 | 0 | get_sep_type(interface_id, adapter_id, chandle, direction, |
1642 | 0 | channels_info->sep->seid, |
1643 | 0 | frame_number)); |
1644 | |
|
1645 | 0 | if (channels_info->sep->media_type == MEDIA_TYPE_AUDIO) { |
1646 | 0 | sep_data_t sep_data; |
1647 | 0 | media_stream_number_value_t *media_stream_number_value; |
1648 | 0 | media_packet_info_t *previous_media_packet_info; |
1649 | 0 | media_packet_info_t *current_media_packet_info; |
1650 | 0 | nstime_t first_abs_ts; |
1651 | 0 | double cumulative_frame_duration; |
1652 | 0 | double avrcp_song_position = -1.0; |
1653 | 0 | btavrcp_song_position_data_t *song_position_data; |
1654 | |
|
1655 | 0 | sep_data.codec = channels_info->sep->codec; |
1656 | 0 | sep_data.vendor_id = channels_info->sep->vendor_id; |
1657 | 0 | sep_data.vendor_codec = channels_info->sep->vendor_codec; |
1658 | 0 | sep_data.acp_seid = channels_info->sep->seid; |
1659 | 0 | sep_data.int_seid = channels_info->sep->int_seid; |
1660 | 0 | sep_data.content_protection_type = channels_info->sep->content_protection_type; |
1661 | 0 | sep_data.stream_start_in_frame = 0; |
1662 | 0 | sep_data.stream_end_in_frame = 0; |
1663 | 0 | sep_data.configuration_length = channels_info->sep->configuration_length; |
1664 | 0 | sep_data.configuration = channels_info->sep->configuration; |
1665 | |
|
1666 | 0 | media_stream_number_value = (media_stream_number_value_t *) wmem_tree_lookup32_le(channels_info->stream_numbers, frame_number - 1); |
1667 | 0 | if (media_stream_number_value) { |
1668 | 0 | sep_data.stream_number = media_stream_number_value->stream_number; |
1669 | 0 | if (media_stream_number_value->stream_start_in_frame == 0) |
1670 | 0 | media_stream_number_value->stream_start_in_frame = pinfo->num; |
1671 | |
|
1672 | 0 | if (!pinfo->fd->visited) |
1673 | 0 | media_stream_number_value->stream_end_in_frame = pinfo->num; |
1674 | |
|
1675 | 0 | sep_data.stream_start_in_frame = media_stream_number_value->stream_start_in_frame; |
1676 | 0 | sep_data.stream_end_in_frame = media_stream_number_value->stream_end_in_frame; |
1677 | 0 | } else { |
1678 | 0 | sep_data.stream_number = 1; |
1679 | 0 | } |
1680 | |
|
1681 | 0 | key[0].length = 1; |
1682 | 0 | key[0].key = &interface_id; |
1683 | 0 | key[1].length = 1; |
1684 | 0 | key[1].key = &adapter_id; |
1685 | 0 | key[3].length = 1; |
1686 | 0 | key[3].key = &cid; |
1687 | 0 | key[4].length = 1; |
1688 | 0 | key[4].key = &direction; |
1689 | 0 | key[5].length = 0; |
1690 | 0 | key[5].key = NULL; |
1691 | |
|
1692 | 0 | key[2].length = 0; |
1693 | 0 | key[2].key = NULL; |
1694 | |
|
1695 | 0 | subtree = (wmem_tree_t *) wmem_tree_lookup32_array(btavrcp_song_positions, key); |
1696 | 0 | song_position_data = (subtree) ? (btavrcp_song_position_data_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL; |
1697 | 0 | if (song_position_data && (song_position_data->used_in_frame == 0 || |
1698 | 0 | song_position_data->used_in_frame == frame_number)) { |
1699 | 0 | avrcp_song_position = song_position_data->song_position; |
1700 | 0 | if (!pinfo->fd->visited) |
1701 | 0 | song_position_data->used_in_frame = frame_number; |
1702 | 0 | } |
1703 | |
|
1704 | 0 | key[2].length = 1; |
1705 | 0 | key[2].key = &chandle; |
1706 | |
|
1707 | 0 | subtree = (wmem_tree_t *) wmem_tree_lookup32_array(media_packet_times, key); |
1708 | 0 | previous_media_packet_info = (subtree) ? (media_packet_info_t *) wmem_tree_lookup32_le(subtree, frame_number - 1) : NULL; |
1709 | 0 | if (previous_media_packet_info && previous_media_packet_info->stream_number == sep_data.stream_number ) { |
1710 | 0 | sep_data.previous_media_packet_info = previous_media_packet_info; |
1711 | 0 | first_abs_ts = previous_media_packet_info->first_abs_ts; |
1712 | 0 | cumulative_frame_duration = previous_media_packet_info->cumulative_frame_duration; |
1713 | 0 | if (avrcp_song_position == -1.0) |
1714 | 0 | avrcp_song_position = previous_media_packet_info->avrcp_song_position; |
1715 | 0 | else |
1716 | 0 | previous_media_packet_info->avrcp_song_position = avrcp_song_position; |
1717 | 0 | } else { |
1718 | 0 | if (avrcp_song_position == -1.0) |
1719 | 0 | avrcp_song_position = 0.0; |
1720 | 0 | first_abs_ts = pinfo->abs_ts; |
1721 | 0 | cumulative_frame_duration = 0.0; |
1722 | 0 | sep_data.previous_media_packet_info = (media_packet_info_t *) wmem_new(wmem_epan_scope(), media_packet_info_t); |
1723 | 0 | sep_data.previous_media_packet_info->abs_ts = pinfo->abs_ts; |
1724 | 0 | sep_data.previous_media_packet_info->first_abs_ts = first_abs_ts; |
1725 | 0 | sep_data.previous_media_packet_info->cumulative_frame_duration = cumulative_frame_duration; |
1726 | 0 | sep_data.previous_media_packet_info->avrcp_song_position = avrcp_song_position; |
1727 | 0 | sep_data.previous_media_packet_info->stream_number = sep_data.stream_number; |
1728 | 0 | } |
1729 | |
|
1730 | 0 | if (!pinfo->fd->visited) { |
1731 | 0 | key[5].length = 1; |
1732 | 0 | key[5].key = &frame_number; |
1733 | 0 | key[6].length = 0; |
1734 | 0 | key[6].key = NULL; |
1735 | |
|
1736 | 0 | if (avrcp_song_position == -1.0) |
1737 | 0 | avrcp_song_position = 0.0; |
1738 | |
|
1739 | 0 | current_media_packet_info = wmem_new(wmem_file_scope(), media_packet_info_t); |
1740 | 0 | current_media_packet_info->abs_ts = pinfo->abs_ts; |
1741 | 0 | current_media_packet_info->first_abs_ts = first_abs_ts; |
1742 | 0 | current_media_packet_info->cumulative_frame_duration = cumulative_frame_duration; |
1743 | 0 | current_media_packet_info->avrcp_song_position = avrcp_song_position; |
1744 | 0 | current_media_packet_info->stream_number = sep_data.stream_number; |
1745 | |
|
1746 | 0 | wmem_tree_insert32_array(media_packet_times, key, current_media_packet_info); |
1747 | 0 | } |
1748 | |
|
1749 | 0 | key[5].length = 0; |
1750 | 0 | key[5].key = NULL; |
1751 | |
|
1752 | 0 | subtree = (wmem_tree_t *) wmem_tree_lookup32_array(media_packet_times, key); |
1753 | 0 | current_media_packet_info = (subtree) ? (media_packet_info_t *) wmem_tree_lookup32(subtree, frame_number) : NULL; |
1754 | 0 | if (current_media_packet_info) |
1755 | 0 | sep_data.current_media_packet_info = current_media_packet_info; |
1756 | 0 | else |
1757 | 0 | sep_data.current_media_packet_info = NULL; |
1758 | |
|
1759 | 0 | next_tvb = tvb_new_subset_remaining(tvb, offset); |
1760 | 0 | call_dissector_with_data(bta2dp_handle, next_tvb, pinfo, tree, &sep_data); |
1761 | 0 | } else if (channels_info->sep->media_type == MEDIA_TYPE_VIDEO) { |
1762 | 0 | sep_data_t sep_data; |
1763 | 0 | media_stream_number_value_t *media_stream_number_value; |
1764 | |
|
1765 | 0 | sep_data.codec = channels_info->sep->codec; |
1766 | 0 | sep_data.vendor_id = channels_info->sep->vendor_id; |
1767 | 0 | sep_data.vendor_codec = channels_info->sep->vendor_codec; |
1768 | 0 | sep_data.acp_seid = channels_info->sep->seid; |
1769 | 0 | sep_data.int_seid = channels_info->sep->int_seid; |
1770 | 0 | sep_data.content_protection_type = channels_info->sep->content_protection_type; |
1771 | 0 | sep_data.stream_start_in_frame = 0; |
1772 | 0 | sep_data.stream_end_in_frame = 0; |
1773 | 0 | sep_data.configuration_length = channels_info->sep->configuration_length; |
1774 | 0 | sep_data.configuration = channels_info->sep->configuration; |
1775 | |
|
1776 | 0 | media_stream_number_value = (media_stream_number_value_t *) wmem_tree_lookup32_le(channels_info->stream_numbers, frame_number - 1); |
1777 | 0 | if (media_stream_number_value) { |
1778 | 0 | sep_data.stream_number = media_stream_number_value->stream_number; |
1779 | 0 | } else { |
1780 | 0 | sep_data.stream_number = 1; |
1781 | 0 | } |
1782 | |
|
1783 | 0 | next_tvb = tvb_new_subset_remaining(tvb, offset); |
1784 | 0 | call_dissector_with_data(btvdp_handle, next_tvb, pinfo, tree, &sep_data); |
1785 | 0 | } else { |
1786 | 0 | ti = proto_tree_add_item(tree, proto_btavdtp, tvb, offset, -1, ENC_NA); |
1787 | 0 | btavdtp_tree = proto_item_add_subtree(ti, ett_btavdtp); |
1788 | |
|
1789 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "Media stream on cid=0x%04x", l2cap_data->cid); |
1790 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA); |
1791 | 0 | } |
1792 | 0 | } |
1793 | |
|
1794 | 0 | return tvb_reported_length(tvb); |
1795 | 0 | } else if (!(l2cap_data->local_cid == channels_info->control_local_cid && |
1796 | 0 | l2cap_data->remote_cid == channels_info->control_remote_cid)) { |
1797 | | /* Unknown Stream Channel */ |
1798 | 0 | ti = proto_tree_add_item(tree, proto_btavdtp, tvb, offset, -1, ENC_NA); |
1799 | 0 | btavdtp_tree = proto_item_add_subtree(ti, ett_btavdtp); |
1800 | |
|
1801 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "Unknown channel stream on cid=0x%04x", l2cap_data->cid); |
1802 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA); |
1803 | 0 | return tvb_reported_length(tvb); |
1804 | 0 | } |
1805 | | |
1806 | | /* Signaling Channel */ |
1807 | 0 | ti = proto_tree_add_item(tree, proto_btavdtp, tvb, offset, -1, ENC_NA); |
1808 | 0 | btavdtp_tree = proto_item_add_subtree(ti, ett_btavdtp); |
1809 | | |
1810 | | /* AVDTP signaling*/ |
1811 | 0 | message_type = (tvb_get_uint8(tvb, offset) & AVDTP_MESSAGE_TYPE_MASK); |
1812 | 0 | packet_type = (tvb_get_uint8(tvb, offset) & AVDTP_PACKET_TYPE_MASK) >> 2; |
1813 | |
|
1814 | 0 | signal_item = proto_tree_add_item(btavdtp_tree, hf_btavdtp_signal, tvb, offset, |
1815 | 0 | (packet_type == PACKET_TYPE_START) ? 3 : 2, ENC_NA); |
1816 | 0 | signal_tree = proto_item_add_subtree(signal_item, ett_btavdtp_sep); |
1817 | |
|
1818 | 0 | proto_tree_add_item(signal_tree, hf_btavdtp_transaction, tvb, offset, 1, ENC_NA); |
1819 | 0 | proto_tree_add_item(signal_tree, hf_btavdtp_packet_type, tvb, offset, 1, ENC_NA); |
1820 | 0 | proto_tree_add_item(signal_tree, hf_btavdtp_message_type, tvb, offset, 1, ENC_NA); |
1821 | |
|
1822 | 0 | if (packet_type == PACKET_TYPE_START) { |
1823 | 0 | offset += 1; |
1824 | 0 | proto_tree_add_item(signal_tree, hf_btavdtp_number_of_signal_packets, tvb, offset, 1, ENC_NA); |
1825 | 0 | } |
1826 | |
|
1827 | 0 | if (packet_type == PACKET_TYPE_CONTINUE || packet_type == PACKET_TYPE_END) goto LABEL_data; |
1828 | | |
1829 | 0 | offset += 1; |
1830 | 0 | proto_tree_add_item(signal_tree, hf_btavdtp_rfa0, tvb, offset, 1, ENC_NA); |
1831 | 0 | proto_tree_add_item(signal_tree, hf_btavdtp_signal_id, tvb, offset, 1, ENC_NA); |
1832 | |
|
1833 | 0 | signal_id = tvb_get_uint8(tvb, offset) & AVDTP_SIGNAL_ID_MASK; |
1834 | 0 | proto_item_append_text(signal_item, ": %s (%s)", |
1835 | 0 | val_to_str_const(signal_id, signal_id_vals, "Unknown signal"), |
1836 | 0 | val_to_str_const(message_type, message_type_vals, "Unknown message type")); |
1837 | |
|
1838 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s - %s", |
1839 | 0 | val_to_str_const(message_type, message_type_vals, "Unknown message type"), |
1840 | 0 | val_to_str_const(signal_id, signal_id_vals, "Unknown signal")); |
1841 | |
|
1842 | 0 | offset += 1; |
1843 | 0 | if (message_type != MESSAGE_TYPE_GENERAL_REJECT) switch (signal_id) { |
1844 | 0 | case SIGNAL_ID_DISCOVER: |
1845 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) break; |
1846 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
1847 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
1848 | 0 | offset += 1; |
1849 | 0 | break; |
1850 | 0 | } |
1851 | 0 | offset = dissect_sep(tvb, pinfo, btavdtp_tree, offset, |
1852 | 0 | interface_id, adapter_id, chandle); |
1853 | 0 | break; |
1854 | 0 | case SIGNAL_ID_GET_CAPABILITIES: |
1855 | 0 | case SIGNAL_ID_GET_ALL_CAPABILITIES: |
1856 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
1857 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
1858 | 0 | SEID_ACP, 0, NULL, interface_id, |
1859 | 0 | adapter_id, chandle, frame_number); |
1860 | 0 | break; |
1861 | 0 | } |
1862 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
1863 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
1864 | 0 | offset += 1; |
1865 | 0 | break; |
1866 | 0 | } |
1867 | 0 | offset = dissect_capabilities(tvb, pinfo, btavdtp_tree, offset, NULL, NULL, NULL, NULL, NULL, NULL); |
1868 | 0 | break; |
1869 | 0 | case SIGNAL_ID_SET_CONFIGURATION: |
1870 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
1871 | 0 | uint32_t int_seid; |
1872 | 0 | uint32_t vendor_id; |
1873 | 0 | uint16_t vendor_codec; |
1874 | 0 | uint32_t reverse_direction; |
1875 | |
|
1876 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
1877 | 0 | SEID_ACP, 0, &seid, interface_id, |
1878 | 0 | adapter_id, chandle, frame_number); |
1879 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
1880 | 0 | SEID_INT, 0, &int_seid, interface_id, |
1881 | 0 | adapter_id, chandle, frame_number); |
1882 | 0 | offset = dissect_capabilities(tvb, pinfo, btavdtp_tree, offset, |
1883 | 0 | &codec, &content_protection_type, &vendor_id, |
1884 | 0 | &vendor_codec, &configuration_offset, &configuration_length); |
1885 | |
|
1886 | 0 | if (!pinfo->fd->visited) { |
1887 | 0 | key[0].length = 1; |
1888 | 0 | key[0].key = &interface_id; |
1889 | 0 | key[1].length = 1; |
1890 | 0 | key[1].key = &adapter_id; |
1891 | 0 | key[2].length = 1; |
1892 | 0 | key[2].key = &chandle; |
1893 | 0 | key[3].length = 1; |
1894 | 0 | key[3].key = &direction; |
1895 | 0 | key[4].length = 1; |
1896 | 0 | key[4].key = &seid; |
1897 | 0 | key[5].length = 0; |
1898 | 0 | key[5].key = NULL; |
1899 | |
|
1900 | 0 | subtree = (wmem_tree_t *) wmem_tree_lookup32_array(sep_list, key); |
1901 | 0 | sep = (subtree) ? (sep_entry_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL; |
1902 | 0 | if (sep) { |
1903 | 0 | sep->codec = codec; |
1904 | 0 | sep->vendor_id = vendor_id; |
1905 | 0 | sep->vendor_codec = vendor_codec; |
1906 | 0 | sep->content_protection_type = content_protection_type; |
1907 | 0 | sep->int_seid = int_seid; |
1908 | 0 | if (configuration_length > 0) { |
1909 | 0 | sep->configuration_length = configuration_length; |
1910 | 0 | sep->configuration = (uint8_t *) tvb_memdup(wmem_file_scope(), |
1911 | 0 | tvb, configuration_offset, configuration_length); |
1912 | 0 | } |
1913 | |
|
1914 | 0 | if (direction == P2P_DIR_SENT) |
1915 | 0 | reverse_direction = P2P_DIR_RECV; |
1916 | 0 | else if (direction == P2P_DIR_RECV) |
1917 | 0 | reverse_direction = P2P_DIR_SENT; |
1918 | 0 | else |
1919 | 0 | reverse_direction = P2P_DIR_UNKNOWN; |
1920 | |
|
1921 | 0 | key[3].length = 1; |
1922 | 0 | key[3].key = &reverse_direction; |
1923 | 0 | key[4].length = 1; |
1924 | 0 | key[4].key = &int_seid; |
1925 | 0 | key[5].length = 1; |
1926 | 0 | key[5].key = &frame_number; |
1927 | 0 | key[6].length = 0; |
1928 | 0 | key[6].key = NULL; |
1929 | |
|
1930 | 0 | wmem_tree_insert32_array(sep_list, key, sep); |
1931 | 0 | } |
1932 | |
|
1933 | 0 | } |
1934 | |
|
1935 | 0 | break; |
1936 | 0 | } |
1937 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
1938 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_service_category, tvb, offset, 1, ENC_NA); |
1939 | 0 | offset += 1; |
1940 | |
|
1941 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
1942 | 0 | offset += 1; |
1943 | 0 | break; |
1944 | 0 | } |
1945 | 0 | break; |
1946 | 0 | case SIGNAL_ID_GET_CONFIGURATION: |
1947 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
1948 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
1949 | 0 | SEID_ACP, 0, NULL, interface_id, |
1950 | 0 | adapter_id, chandle, frame_number); |
1951 | 0 | break; |
1952 | 0 | } |
1953 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
1954 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
1955 | 0 | offset += 1; |
1956 | 0 | break; |
1957 | 0 | } |
1958 | 0 | offset = dissect_capabilities(tvb, pinfo, btavdtp_tree, offset, NULL, NULL, NULL, NULL, NULL, NULL); |
1959 | 0 | break; |
1960 | 0 | case SIGNAL_ID_RECONFIGURE: |
1961 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
1962 | 0 | uint32_t vendor_id; |
1963 | 0 | uint16_t vendor_codec; |
1964 | |
|
1965 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
1966 | 0 | SEID_ACP, 0, &seid, interface_id, |
1967 | 0 | adapter_id, chandle, frame_number); |
1968 | 0 | offset = dissect_capabilities(tvb, pinfo, btavdtp_tree, offset, |
1969 | 0 | &codec, &content_protection_type, &vendor_id, |
1970 | 0 | &vendor_codec, &configuration_offset, &configuration_length); |
1971 | |
|
1972 | 0 | if (!pinfo->fd->visited) { |
1973 | 0 | key[0].length = 1; |
1974 | 0 | key[0].key = &interface_id; |
1975 | 0 | key[1].length = 1; |
1976 | 0 | key[1].key = &adapter_id; |
1977 | 0 | key[2].length = 1; |
1978 | 0 | key[2].key = &chandle; |
1979 | 0 | key[3].length = 1; |
1980 | 0 | key[3].key = &direction; |
1981 | 0 | key[4].length = 1; |
1982 | 0 | key[4].key = &seid; |
1983 | 0 | key[5].length = 0; |
1984 | 0 | key[5].key = NULL; |
1985 | |
|
1986 | 0 | subtree = (wmem_tree_t *) wmem_tree_lookup32_array(sep_list, key); |
1987 | 0 | sep = (subtree) ? (sep_entry_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL; |
1988 | 0 | if (sep) { |
1989 | 0 | sep->codec = codec; |
1990 | 0 | sep->vendor_id = vendor_id; |
1991 | 0 | sep->vendor_codec = vendor_codec; |
1992 | 0 | sep->content_protection_type = content_protection_type; |
1993 | 0 | if (configuration_length > 0) { |
1994 | 0 | sep->configuration_length = configuration_length; |
1995 | 0 | sep->configuration = (uint8_t *) tvb_memdup(wmem_file_scope(), |
1996 | 0 | tvb, configuration_offset, configuration_length); |
1997 | 0 | } |
1998 | 0 | } |
1999 | 0 | } |
2000 | |
|
2001 | 0 | break; |
2002 | 0 | } |
2003 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
2004 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_service_category, tvb, offset, 1, ENC_NA); |
2005 | 0 | offset += 1; |
2006 | |
|
2007 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
2008 | 0 | offset += 1; |
2009 | 0 | break; |
2010 | 0 | } |
2011 | 0 | break; |
2012 | 0 | case SIGNAL_ID_OPEN: |
2013 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
2014 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
2015 | 0 | SEID_ACP, 0, &seid, interface_id, |
2016 | 0 | adapter_id, chandle, frame_number); |
2017 | |
|
2018 | 0 | if (!pinfo->fd->visited) { |
2019 | 0 | key[0].length = 1; |
2020 | 0 | key[0].key = &interface_id; |
2021 | 0 | key[1].length = 1; |
2022 | 0 | key[1].key = &adapter_id; |
2023 | 0 | key[2].length = 1; |
2024 | 0 | key[2].key = &chandle; |
2025 | 0 | key[3].length = 1; |
2026 | 0 | key[3].key = &direction; |
2027 | 0 | key[4].length = 1; |
2028 | 0 | key[4].key = &seid; |
2029 | 0 | key[5].length = 0; |
2030 | 0 | key[5].key = NULL; |
2031 | |
|
2032 | 0 | subtree = (wmem_tree_t *) wmem_tree_lookup32_array(sep_list, key); |
2033 | 0 | sep = (subtree) ? (sep_entry_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL; |
2034 | 0 | if (sep) { |
2035 | 0 | sep->state = SEP_STATE_OPEN; |
2036 | |
|
2037 | 0 | key[3].length = 1; |
2038 | 0 | key[3].key = &frame_number; |
2039 | 0 | key[4].length = 0; |
2040 | 0 | key[4].key = NULL; |
2041 | |
|
2042 | 0 | wmem_tree_insert32_array(sep_open, key, sep); |
2043 | 0 | } |
2044 | 0 | } |
2045 | 0 | break; |
2046 | 0 | } |
2047 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
2048 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
2049 | 0 | offset += 1; |
2050 | 0 | break; |
2051 | 0 | } |
2052 | 0 | if (message_type == MESSAGE_TYPE_ACCEPT && !pinfo->fd->visited) { |
2053 | |
|
2054 | 0 | key[0].length = 1; |
2055 | 0 | key[0].key = &interface_id; |
2056 | 0 | key[1].length = 1; |
2057 | 0 | key[1].key = &adapter_id; |
2058 | 0 | key[2].length = 1; |
2059 | 0 | key[2].key = &chandle; |
2060 | 0 | key[3].length = 0; |
2061 | 0 | key[3].key = NULL; |
2062 | |
|
2063 | 0 | subtree = (wmem_tree_t *) wmem_tree_lookup32_array(sep_open, key); |
2064 | 0 | sep = (subtree) ? (sep_entry_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL; |
2065 | 0 | if (sep && sep->state == SEP_STATE_OPEN) { |
2066 | 0 | sep->state = SEP_STATE_IN_USE; |
2067 | 0 | channels_info->sep = sep; |
2068 | 0 | } |
2069 | 0 | } |
2070 | 0 | break; |
2071 | 0 | case SIGNAL_ID_START: |
2072 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
2073 | 0 | i_sep = 1; |
2074 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
2075 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
2076 | 0 | SEID_ACP, i_sep, NULL, |
2077 | 0 | interface_id, adapter_id, chandle, frame_number); |
2078 | 0 | i_sep += 1; |
2079 | 0 | } |
2080 | 0 | break; |
2081 | 0 | } |
2082 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
2083 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
2084 | 0 | SEID_ACP, 0, NULL, |
2085 | 0 | interface_id, adapter_id, chandle, frame_number); |
2086 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
2087 | 0 | offset += 1; |
2088 | 0 | break; |
2089 | 0 | } |
2090 | | |
2091 | 0 | if (message_type == MESSAGE_TYPE_ACCEPT && !pinfo->fd->visited) { |
2092 | 0 | media_stream_number_value_t *media_stream_number_value; |
2093 | 0 | uint32_t stream_number = 0; |
2094 | |
|
2095 | 0 | media_stream_number_value = (media_stream_number_value_t *) wmem_tree_lookup32_le(channels_info->stream_numbers, frame_number - 1); |
2096 | 0 | #if RTP_PLAYER_WORKAROUND == true |
2097 | 0 | { |
2098 | 0 | media_stream_number_value_t *file_scope_stream_number_value; |
2099 | |
|
2100 | 0 | if (media_stream_number_value) { |
2101 | 0 | stream_number = media_stream_number_value->stream_number; |
2102 | 0 | } else { |
2103 | 0 | file_scope_stream_number_value = (media_stream_number_value_t *) wmem_tree_lookup32_le(file_scope_stream_number, frame_number - 1); |
2104 | 0 | if (file_scope_stream_number_value) |
2105 | 0 | stream_number = file_scope_stream_number_value->stream_number + 1; |
2106 | 0 | else |
2107 | 0 | stream_number = 0; |
2108 | 0 | } |
2109 | |
|
2110 | 0 | file_scope_stream_number_value = wmem_new(wmem_file_scope(), media_stream_number_value_t); |
2111 | 0 | file_scope_stream_number_value->stream_number = stream_number; |
2112 | 0 | wmem_tree_insert32(file_scope_stream_number, frame_number, file_scope_stream_number_value); |
2113 | 0 | } |
2114 | | #else |
2115 | | if (media_stream_number_value) |
2116 | | stream_number = media_stream_number_value->stream_number; |
2117 | | else |
2118 | | stream_number = 0; |
2119 | | #endif |
2120 | |
|
2121 | 0 | media_stream_number_value = wmem_new(wmem_file_scope(), media_stream_number_value_t); |
2122 | 0 | media_stream_number_value->stream_number = stream_number + 1; |
2123 | 0 | media_stream_number_value->stream_start_in_frame = 0; |
2124 | 0 | media_stream_number_value->stream_end_in_frame = 0; |
2125 | |
|
2126 | 0 | wmem_tree_insert32(channels_info->stream_numbers, frame_number, media_stream_number_value); |
2127 | 0 | } |
2128 | 0 | break; |
2129 | 0 | case SIGNAL_ID_CLOSE: |
2130 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
2131 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
2132 | 0 | SEID_ACP, 0, NULL, interface_id, |
2133 | 0 | adapter_id, chandle, frame_number); |
2134 | 0 | break; |
2135 | 0 | } |
2136 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
2137 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
2138 | 0 | offset += 1; |
2139 | 0 | break; |
2140 | 0 | } |
2141 | 0 | if (!pinfo->fd->visited && message_type == MESSAGE_TYPE_ACCEPT && |
2142 | 0 | channels_info->disconnect_in_frame > pinfo->num) { |
2143 | 0 | channels_info->disconnect_in_frame = pinfo->num; |
2144 | 0 | } |
2145 | 0 | break; |
2146 | 0 | case SIGNAL_ID_SUSPEND: |
2147 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
2148 | 0 | i_sep = 1; |
2149 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
2150 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
2151 | 0 | SEID_ACP, i_sep, NULL, |
2152 | 0 | interface_id, adapter_id, chandle, frame_number); |
2153 | 0 | i_sep += 1; |
2154 | 0 | } |
2155 | 0 | break; |
2156 | 0 | } |
2157 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
2158 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
2159 | 0 | SEID_ACP, 0, NULL, interface_id, |
2160 | 0 | adapter_id, chandle, frame_number); |
2161 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
2162 | 0 | offset += 1; |
2163 | 0 | break; |
2164 | 0 | } |
2165 | 0 | break; |
2166 | 0 | case SIGNAL_ID_ABORT: |
2167 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
2168 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
2169 | 0 | SEID_ACP, 0, NULL, interface_id, |
2170 | 0 | adapter_id, chandle, frame_number); |
2171 | 0 | break; |
2172 | 0 | } |
2173 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
2174 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
2175 | 0 | offset += 1; |
2176 | 0 | break; |
2177 | 0 | } |
2178 | 0 | if (!pinfo->fd->visited && message_type == MESSAGE_TYPE_ACCEPT && |
2179 | 0 | channels_info->disconnect_in_frame > pinfo->num) { |
2180 | 0 | channels_info->disconnect_in_frame = pinfo->num; |
2181 | 0 | } |
2182 | 0 | break; |
2183 | 0 | case SIGNAL_ID_SECURITY_CONTROL: |
2184 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
2185 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
2186 | 0 | SEID_ACP, 0, NULL, interface_id, |
2187 | 0 | adapter_id, chandle, frame_number); |
2188 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA); |
2189 | 0 | offset += tvb_reported_length_remaining(tvb, offset); |
2190 | 0 | break; |
2191 | 0 | } |
2192 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
2193 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
2194 | 0 | offset += 1; |
2195 | 0 | break; |
2196 | 0 | } |
2197 | | |
2198 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA); |
2199 | 0 | offset += tvb_reported_length_remaining(tvb, offset); |
2200 | 0 | break; |
2201 | 0 | case SIGNAL_ID_DELAY_REPORT: |
2202 | 0 | if (message_type == MESSAGE_TYPE_COMMAND) { |
2203 | 0 | proto_item *pitem; |
2204 | 0 | delay = tvb_get_ntohs(tvb, offset + 1); |
2205 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "(%u.%u ms)", delay/10, delay%10); |
2206 | 0 | offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset, |
2207 | 0 | SEID_ACP, 0, NULL, |
2208 | 0 | interface_id, adapter_id, chandle, frame_number); |
2209 | 0 | pitem = proto_tree_add_item(btavdtp_tree, hf_btavdtp_delay, tvb, offset, 2, ENC_BIG_ENDIAN); |
2210 | 0 | proto_item_append_text(pitem, " (1/10 ms)"); |
2211 | 0 | offset += 2; |
2212 | 0 | break; |
2213 | 0 | } |
2214 | 0 | if (message_type == MESSAGE_TYPE_REJECT) { |
2215 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_error_code, tvb, offset, 1, ENC_NA); |
2216 | 0 | offset += 1; |
2217 | 0 | break; |
2218 | 0 | } |
2219 | 0 | break; |
2220 | 0 | } |
2221 | | |
2222 | 0 | LABEL_data: |
2223 | |
|
2224 | 0 | if (tvb_reported_length_remaining(tvb, offset) > 0) { |
2225 | 0 | proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA); |
2226 | 0 | } |
2227 | |
|
2228 | 0 | return offset; |
2229 | 0 | } |
2230 | | |
2231 | | |
2232 | | void |
2233 | | proto_register_btavdtp(void) |
2234 | 14 | { |
2235 | 14 | module_t *module; |
2236 | | |
2237 | 14 | static hf_register_info hf[] = { |
2238 | 14 | { &hf_btavdtp_signal, |
2239 | 14 | { "Signal", "btavdtp.signal", |
2240 | 14 | FT_NONE, BASE_NONE, NULL, 0x00, |
2241 | 14 | NULL, HFILL } |
2242 | 14 | }, |
2243 | 14 | { &hf_btavdtp_message_type, |
2244 | 14 | { "Message Type", "btavdtp.message_type", |
2245 | 14 | FT_UINT8, BASE_HEX, VALS(message_type_vals), AVDTP_MESSAGE_TYPE_MASK, |
2246 | 14 | NULL, HFILL } |
2247 | 14 | }, |
2248 | 14 | { &hf_btavdtp_packet_type, |
2249 | 14 | { "Packet Type", "btavdtp.packet_type", |
2250 | 14 | FT_UINT8, BASE_HEX, VALS(packet_type_vals), AVDTP_PACKET_TYPE_MASK, |
2251 | 14 | NULL, HFILL } |
2252 | 14 | }, |
2253 | 14 | { &hf_btavdtp_transaction, |
2254 | 14 | { "Transaction", "btavdtp.transaction", |
2255 | 14 | FT_UINT8, BASE_HEX, NULL, AVDTP_TRANSACTION_MASK, |
2256 | 14 | NULL, HFILL } |
2257 | 14 | }, |
2258 | 14 | { &hf_btavdtp_signal_id, |
2259 | 14 | { "Signal", "btavdtp.signal_id", |
2260 | 14 | FT_UINT8, BASE_HEX, VALS(signal_id_vals), AVDTP_SIGNAL_ID_MASK, |
2261 | 14 | NULL, HFILL } |
2262 | 14 | }, |
2263 | 14 | { &hf_btavdtp_rfa0, |
2264 | 14 | { "RFA", "btavdtp.rfa0", |
2265 | 14 | FT_UINT8, BASE_HEX, NULL, AVDTP_RFA0_MASK, |
2266 | 14 | NULL, HFILL } |
2267 | 14 | }, |
2268 | 14 | { &hf_btavdtp_number_of_signal_packets, |
2269 | 14 | { "Number of signal packets", "btavdtp.num_signal_packets", |
2270 | 14 | FT_UINT8, BASE_DEC, NULL, 0, |
2271 | 14 | NULL, HFILL } |
2272 | 14 | }, |
2273 | 14 | { &hf_btavdtp_error_code, |
2274 | 14 | { "Error Code", "btavdtp.error_code", |
2275 | 14 | FT_UINT8, BASE_HEX, VALS(error_code_vals), 0x00, |
2276 | 14 | NULL, HFILL } |
2277 | 14 | }, |
2278 | 14 | { &hf_btavdtp_sep_seid, |
2279 | 14 | { "SEID", "btavdtp.sep_seid", |
2280 | 14 | FT_UINT8, BASE_DEC, NULL, 0xFC, |
2281 | 14 | NULL, HFILL } |
2282 | 14 | }, |
2283 | 14 | { &hf_btavdtp_sep_inuse, |
2284 | 14 | { "In Use", "btavdtp.sep_inuse", |
2285 | 14 | FT_UINT8, BASE_HEX, VALS(true_false), 0x02, |
2286 | 14 | NULL, HFILL } |
2287 | 14 | }, |
2288 | 14 | { &hf_btavdtp_sep_rfa0, |
2289 | 14 | { "RFA0", "btavdtp.sep_rfa0", |
2290 | 14 | FT_UINT8, BASE_HEX, NULL, 0x01, |
2291 | 14 | NULL, HFILL } |
2292 | 14 | }, |
2293 | 14 | { &hf_btavdtp_sep_media_type, |
2294 | 14 | { "Media Type", "btavdtp.sep_media_type", |
2295 | 14 | FT_UINT8, BASE_HEX, VALS(media_type_vals), 0xF0, |
2296 | 14 | NULL, HFILL } |
2297 | 14 | }, |
2298 | 14 | { &hf_btavdtp_sep_type, |
2299 | 14 | { "Type", "btavdtp.sep_type", |
2300 | 14 | FT_UINT8, BASE_HEX, VALS(sep_type_vals), 0x08, |
2301 | 14 | NULL, HFILL } |
2302 | 14 | }, |
2303 | 14 | { &hf_btavdtp_sep_rfa1, |
2304 | 14 | { "RFA1", "btavdtp.sep_rfa1", |
2305 | 14 | FT_UINT8, BASE_HEX, NULL, 0x07, |
2306 | 14 | NULL, HFILL } |
2307 | 14 | }, |
2308 | 14 | { &hf_btavdtp_acp_sep, |
2309 | 14 | { "ACP SEP", "btavdtp.acp_sep", |
2310 | 14 | FT_NONE, BASE_NONE, NULL, 0x00, |
2311 | 14 | NULL, HFILL } |
2312 | 14 | }, |
2313 | 14 | { &hf_btavdtp_acp_seid_item, |
2314 | 14 | { "ACP SEID", "btavdtp.acp_seid_item", |
2315 | 14 | FT_NONE, BASE_NONE, NULL, 0x00, |
2316 | 14 | NULL, HFILL } |
2317 | 14 | }, |
2318 | 14 | { &hf_btavdtp_int_seid_item, |
2319 | 14 | { "INT SEID", "btavdtp.int_seid_item", |
2320 | 14 | FT_NONE, BASE_NONE, NULL, 0x00, |
2321 | 14 | NULL, HFILL } |
2322 | 14 | }, |
2323 | 14 | { &hf_btavdtp_acp_seid, |
2324 | 14 | { "ACP SEID", "btavdtp.acp_seid", |
2325 | 14 | FT_UINT8, BASE_DEC, NULL, 0xFC, |
2326 | 14 | NULL, HFILL } |
2327 | 14 | }, |
2328 | 14 | { &hf_btavdtp_int_seid, |
2329 | 14 | { "INT SEID", "btavdtp.int_seid", |
2330 | 14 | FT_UINT8, BASE_DEC, NULL, 0xFC, |
2331 | 14 | NULL, HFILL } |
2332 | 14 | }, |
2333 | 14 | { &hf_btavdtp_rfa_seid, |
2334 | 14 | { "RFA", "btavdtp.rfa_seid", |
2335 | 14 | FT_UINT8, BASE_HEX, NULL, 0x03, |
2336 | 14 | NULL, HFILL } |
2337 | 14 | }, |
2338 | 14 | { &hf_btavdtp_service_category, |
2339 | 14 | { "Service Category", "btavdtp.service_category", |
2340 | 14 | FT_UINT8, BASE_HEX, VALS(service_category_vals), 0x00, |
2341 | 14 | NULL, HFILL } |
2342 | 14 | }, |
2343 | 14 | { &hf_btavdtp_length_of_service_category, |
2344 | 14 | { "Length of Service Category", "btavdtp.length_of_service_category", |
2345 | 14 | FT_UINT8, BASE_HEX, NULL, 0x00, |
2346 | 14 | NULL, HFILL } |
2347 | 14 | }, |
2348 | 14 | { &hf_btavdtp_delay, |
2349 | 14 | { "Delay", "btavdtp.delay", |
2350 | 14 | FT_UINT16, BASE_DEC, NULL, 0x00, |
2351 | 14 | NULL, HFILL } |
2352 | 14 | }, |
2353 | 14 | { &hf_btavdtp_recovery_type, |
2354 | 14 | { "Service Category", "btavdtp.recovery_type", |
2355 | 14 | FT_UINT8, BASE_HEX, VALS(recovery_type_vals), 0x00, |
2356 | 14 | NULL, HFILL } |
2357 | 14 | }, |
2358 | 14 | { &hf_btavdtp_maximum_recovery_window_size, |
2359 | 14 | { "Service Category", "btavdtp.maximum_recovery_window_size", |
2360 | 14 | FT_UINT8, BASE_HEX, NULL, 0x00, |
2361 | 14 | NULL, HFILL } |
2362 | 14 | }, |
2363 | 14 | { &hf_btavdtp_maximum_number_of_media_packet_in_parity_code, |
2364 | 14 | { "Service Category", "btavdtp.maximum_number_of_media_packet_in_parity_code", |
2365 | 14 | FT_UINT8, BASE_HEX, NULL, 0x00, |
2366 | 14 | NULL, HFILL } |
2367 | 14 | }, |
2368 | 14 | { &hf_btavdtp_multiplexing_fragmentation, |
2369 | 14 | { "Fragmentation", "btavdtp.multiplexing_fragmentation", |
2370 | 14 | FT_UINT8, BASE_HEX, VALS(true_false), 0x80, |
2371 | 14 | NULL, HFILL } |
2372 | 14 | }, |
2373 | 14 | { &hf_btavdtp_multiplexing_rfa, |
2374 | 14 | { "RFA", "btavdtp.multiplexing_rfa", |
2375 | 14 | FT_UINT8, BASE_HEX, NULL, 0x7F, |
2376 | 14 | NULL, HFILL } |
2377 | 14 | }, |
2378 | 14 | { &hf_btavdtp_multiplexing_tsid, |
2379 | 14 | { "TSID", "btavdtp.multiplexing_tsid", |
2380 | 14 | FT_UINT8, BASE_HEX, VALS(multiplexing_tsid_vals), 0xF8, |
2381 | 14 | NULL, HFILL } |
2382 | 14 | }, |
2383 | 14 | { &hf_btavdtp_multiplexing_tcid, |
2384 | 14 | { "TCID", "btavdtp.multiplexing_tcid", |
2385 | 14 | FT_UINT8, BASE_HEX, VALS(multiplexing_tcid_vals), 0xF8, |
2386 | 14 | NULL, HFILL } |
2387 | 14 | }, |
2388 | 14 | { &hf_btavdtp_multiplexing_entry_rfa, |
2389 | 14 | { "RFA", "btavdtp.multiplexing_entry_rfa", |
2390 | 14 | FT_UINT8, BASE_HEX, NULL, 0x07, |
2391 | 14 | NULL, HFILL } |
2392 | 14 | }, |
2393 | 14 | { &hf_btavdtp_header_compression_backch, |
2394 | 14 | { "BackCh", "btavdtp.header_compression_backch", |
2395 | 14 | FT_UINT8, BASE_HEX, VALS(true_false), 0x80, |
2396 | 14 | NULL, HFILL } |
2397 | 14 | }, |
2398 | 14 | { &hf_btavdtp_header_compression_media, |
2399 | 14 | { "Media", "btavdtp.header_compression_media", |
2400 | 14 | FT_UINT8, BASE_HEX, VALS(true_false), 0x40, |
2401 | 14 | NULL, HFILL } |
2402 | 14 | }, |
2403 | 14 | { &hf_btavdtp_header_compression_recovery, |
2404 | 14 | { "Recovery", "btavdtp.header_compression_recovery", |
2405 | 14 | FT_UINT8, BASE_HEX, VALS(true_false), 0x20, |
2406 | 14 | NULL, HFILL } |
2407 | 14 | }, |
2408 | 14 | { &hf_btavdtp_header_compression_rfa, |
2409 | 14 | { "RFA", "btavdtp.header_compression_rfa", |
2410 | 14 | FT_UINT8, BASE_HEX, NULL, 0x1f, |
2411 | 14 | NULL, HFILL } |
2412 | 14 | }, |
2413 | 14 | { &hf_btavdtp_content_protection_type, |
2414 | 14 | { "Type", "btavdtp.content_protection_type", |
2415 | 14 | FT_UINT16, BASE_HEX, VALS(content_protection_type_vals), 0x0, |
2416 | 14 | NULL, HFILL } |
2417 | 14 | }, |
2418 | 14 | { &hf_btavdtp_media_codec_media_type, |
2419 | 14 | { "Media Type", "btavdtp.media_codec_media_type", |
2420 | 14 | FT_UINT8, BASE_HEX, VALS(media_type_vals), 0xF0, |
2421 | 14 | NULL, HFILL } |
2422 | 14 | }, |
2423 | 14 | { &hf_btavdtp_media_codec_rfa, |
2424 | 14 | { "RFA", "btavdtp.media_codec_rfa", |
2425 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0F, |
2426 | 14 | NULL, HFILL } |
2427 | 14 | }, |
2428 | 14 | { &hf_btavdtp_media_codec_audio_type, |
2429 | 14 | { "Media Codec Audio Type", "btavdtp.media_codec_audio_type", |
2430 | 14 | FT_UINT8, BASE_HEX, VALS(media_codec_audio_type_vals), 0x00, |
2431 | 14 | NULL, HFILL } |
2432 | 14 | }, |
2433 | 14 | { &hf_btavdtp_media_codec_video_type, |
2434 | 14 | { "Media Codec Video Type", "btavdtp.media_codec_video_type", |
2435 | 14 | FT_UINT8, BASE_HEX, VALS(media_codec_video_type_vals), 0x00, |
2436 | 14 | NULL, HFILL } |
2437 | 14 | }, |
2438 | 14 | { &hf_btavdtp_media_codec_unknown_type, |
2439 | 14 | { "Media Codec Unknown Type", "btavdtp.media_codec_unknown_type", |
2440 | 14 | FT_UINT8, BASE_HEX, NULL, 0x00, |
2441 | 14 | NULL, HFILL } |
2442 | 14 | }, |
2443 | 14 | { &hf_btavdtp_sbc_sampling_frequency_16000, |
2444 | 14 | { "Sampling Frequency 16000 Hz", "btavdtp.codec.sbc.sampling_frequency.16000", |
2445 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2446 | 14 | NULL, HFILL } |
2447 | 14 | }, |
2448 | 14 | { &hf_btavdtp_sbc_sampling_frequency_32000, |
2449 | 14 | { "Sampling Frequency 32000 Hz", "btavdtp.codec.sbc.sampling_frequency.32000", |
2450 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2451 | 14 | NULL, HFILL } |
2452 | 14 | }, |
2453 | 14 | { &hf_btavdtp_sbc_sampling_frequency_44100, |
2454 | 14 | { "Sampling Frequency 44100 Hz", "btavdtp.codec.sbc.sampling_frequency.44100", |
2455 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2456 | 14 | NULL, HFILL } |
2457 | 14 | }, |
2458 | 14 | { &hf_btavdtp_sbc_sampling_frequency_48000, |
2459 | 14 | { "Sampling Frequency 48000 Hz", "btavdtp.codec.sbc.sampling_frequency.48000", |
2460 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2461 | 14 | NULL, HFILL } |
2462 | 14 | }, |
2463 | 14 | { &hf_btavdtp_sbc_channel_mode_mono, |
2464 | 14 | { "Channel Mode Mono", "btavdtp.codec.sbc.channel_mode.mono", |
2465 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
2466 | 14 | NULL, HFILL } |
2467 | 14 | }, |
2468 | 14 | { &hf_btavdtp_sbc_channel_mode_dual_channel, |
2469 | 14 | { "Channel Mode Dual Channel", "btavdtp.codec.sbc.channel_mode.dual_channel", |
2470 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2471 | 14 | NULL, HFILL } |
2472 | 14 | }, |
2473 | 14 | { &hf_btavdtp_sbc_channel_mode_stereo, |
2474 | 14 | { "Channel Mode Stereo", "btavdtp.codec.sbc.channel_mode.stereo", |
2475 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
2476 | 14 | NULL, HFILL } |
2477 | 14 | }, |
2478 | 14 | { &hf_btavdtp_sbc_channel_mode_joint_stereo, |
2479 | 14 | { "Channel Mode Joint Stereo", "btavdtp.codec.sbc.channel_mode.joint_stereo", |
2480 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
2481 | 14 | NULL, HFILL } |
2482 | 14 | }, |
2483 | 14 | { &hf_btavdtp_sbc_block_4, |
2484 | 14 | { "Block Length 4", "btavdtp.codec.sbc.block.4", |
2485 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2486 | 14 | NULL, HFILL } |
2487 | 14 | }, |
2488 | 14 | { &hf_btavdtp_sbc_block_8, |
2489 | 14 | { "Block Length 8", "btavdtp.codec.sbc.block.8", |
2490 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2491 | 14 | NULL, HFILL } |
2492 | 14 | }, |
2493 | 14 | { &hf_btavdtp_sbc_block_12, |
2494 | 14 | { "Block Length 12", "btavdtp.codec.sbc.block.12", |
2495 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2496 | 14 | NULL, HFILL } |
2497 | 14 | }, |
2498 | 14 | { &hf_btavdtp_sbc_block_16, |
2499 | 14 | { "Block Length 16", "btavdtp.codec.sbc.block.16", |
2500 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2501 | 14 | NULL, HFILL } |
2502 | 14 | }, |
2503 | 14 | { &hf_btavdtp_sbc_subbands_4, |
2504 | 14 | { "Subbands 4", "btavdtp.codec.sbc.subbands.4", |
2505 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
2506 | 14 | NULL, HFILL } |
2507 | 14 | }, |
2508 | 14 | { &hf_btavdtp_sbc_subbands_8, |
2509 | 14 | { "Subbands 8", "btavdtp.codec.sbc.subbands.8", |
2510 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2511 | 14 | NULL, HFILL } |
2512 | 14 | }, |
2513 | 14 | { &hf_btavdtp_sbc_allocation_method_snr, |
2514 | 14 | { "Allocation Method SNR", "btavdtp.codec.sbc.allocation_method.snr", |
2515 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
2516 | 14 | NULL, HFILL } |
2517 | 14 | }, |
2518 | 14 | { &hf_btavdtp_sbc_allocation_method_loudness, |
2519 | 14 | { "Allocation Method Loudness", "btavdtp.codec.sbc.allocation_method.loudness", |
2520 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
2521 | 14 | NULL, HFILL } |
2522 | 14 | }, |
2523 | 14 | { &hf_btavdtp_sbc_min_bitpool, |
2524 | 14 | { "Minimum Bitpool", "btavdtp.codec.sbc.minimum_bitpool", |
2525 | 14 | FT_UINT8, BASE_DEC, NULL, 0x00, |
2526 | 14 | NULL, HFILL } |
2527 | 14 | }, |
2528 | 14 | { &hf_btavdtp_sbc_max_bitpool, |
2529 | 14 | { "Maximum Bitpool", "btavdtp.codec.sbc.maximum_bitpool", |
2530 | 14 | FT_UINT8, BASE_DEC, NULL, 0x00, |
2531 | 14 | NULL, HFILL } |
2532 | 14 | }, |
2533 | 14 | { &hf_btavdtp_mpeg12_layer_1, |
2534 | 14 | { "MP1", "btavdtp.codec.mpeg12.layer_1", |
2535 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2536 | 14 | "MPEG Layer 1", HFILL } |
2537 | 14 | }, |
2538 | 14 | { &hf_btavdtp_mpeg12_layer_2, |
2539 | 14 | { "MP2", "btavdtp.codec.mpeg12.layer_2", |
2540 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2541 | 14 | "MPEG Layer 2", HFILL } |
2542 | 14 | }, |
2543 | 14 | { &hf_btavdtp_mpeg12_layer_3, |
2544 | 14 | { "MP3", "btavdtp.codec.mpeg12.layer_3", |
2545 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2546 | 14 | "MPEG Layer 3", HFILL } |
2547 | 14 | }, |
2548 | 14 | { &hf_btavdtp_mpeg12_crc_protection, |
2549 | 14 | { "CRC Protection", "btavdtp.codec.mpeg12.crc_protection", |
2550 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2551 | 14 | NULL, HFILL } |
2552 | 14 | }, |
2553 | 14 | { &hf_btavdtp_mpeg12_channel_mode_mono, |
2554 | 14 | { "Channel Mode Mono", "btavdtp.codec.mpeg12.channel_mode.mono", |
2555 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
2556 | 14 | NULL, HFILL } |
2557 | 14 | }, |
2558 | 14 | { &hf_btavdtp_mpeg12_channel_mode_dual_channel, |
2559 | 14 | { "Channel Mode Dual Channel", "btavdtp.codec.mpeg12.channel_mode.dual_channel", |
2560 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2561 | 14 | NULL, HFILL } |
2562 | 14 | }, |
2563 | 14 | { &hf_btavdtp_mpeg12_channel_mode_stereo, |
2564 | 14 | { "Channel Mode Stereo", "btavdtp.codec.mpeg12.channel_mode.stereo", |
2565 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
2566 | 14 | NULL, HFILL } |
2567 | 14 | }, |
2568 | 14 | { &hf_btavdtp_mpeg12_channel_mode_joint_stereo, |
2569 | 14 | { "Channel Mode Joint Stereo", "btavdtp.codec.mpeg12.channel_mode.joint_stereo", |
2570 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
2571 | 14 | NULL, HFILL } |
2572 | 14 | }, |
2573 | 14 | { &hf_btavdtp_mpeg12_rfa, |
2574 | 14 | { "RFA", "btavdtp.codec.mpeg12.rfa", |
2575 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2576 | 14 | NULL, HFILL } |
2577 | 14 | }, |
2578 | 14 | { &hf_btavdtp_mpeg12_mpf_2, |
2579 | 14 | { "Media Payload Format 2", "btavdtp.codec.mpeg12.mpf_2", |
2580 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2581 | 14 | NULL, HFILL } |
2582 | 14 | }, |
2583 | 14 | { &hf_btavdtp_mpeg12_sampling_frequency_16000, |
2584 | 14 | { "Sampling Frequency 16000 Hz", "btavdtp.codec.sbc.sampling_frequency.16000", |
2585 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2586 | 14 | NULL, HFILL } |
2587 | 14 | }, |
2588 | 14 | { &hf_btavdtp_mpeg12_sampling_frequency_22050, |
2589 | 14 | { "Sampling Frequency 22050 Hz", "btavdtp.codec.sbc.sampling_frequency.22050", |
2590 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2591 | 14 | NULL, HFILL } |
2592 | 14 | }, |
2593 | 14 | { &hf_btavdtp_mpeg12_sampling_frequency_24000, |
2594 | 14 | { "Sampling Frequency 24000 Hz", "btavdtp.codec.sbc.sampling_frequency.24000", |
2595 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
2596 | 14 | NULL, HFILL } |
2597 | 14 | }, |
2598 | 14 | { &hf_btavdtp_mpeg12_sampling_frequency_32000, |
2599 | 14 | { "Sampling Frequency 32000 Hz", "btavdtp.codec.sbc.sampling_frequency.32000", |
2600 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2601 | 14 | NULL, HFILL } |
2602 | 14 | }, |
2603 | 14 | { &hf_btavdtp_mpeg12_sampling_frequency_44100, |
2604 | 14 | { "Sampling Frequency 44100 Hz", "btavdtp.codec.sbc.sampling_frequency.44100", |
2605 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
2606 | 14 | NULL, HFILL } |
2607 | 14 | }, |
2608 | 14 | { &hf_btavdtp_mpeg12_sampling_frequency_48000, |
2609 | 14 | { "Sampling Frequency 48000 Hz", "btavdtp.codec.sbc.sampling_frequency.48000", |
2610 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
2611 | 14 | NULL, HFILL } |
2612 | 14 | }, |
2613 | 14 | { &hf_btavdtp_mpeg12_vbr_supported, |
2614 | 14 | { "VBR Supported", "btavdtp.codec.mpeg12.vbr", |
2615 | 14 | FT_BOOLEAN, 16, NULL, 0x8000, |
2616 | 14 | NULL, HFILL } |
2617 | 14 | }, |
2618 | 14 | { &hf_btavdtp_mpeg12_bit_rate, |
2619 | 14 | { "Bit Rate", "btavdtp.codec.mpeg12.bit_rate", |
2620 | 14 | FT_UINT16, BASE_HEX, NULL, 0x7FFF, |
2621 | 14 | NULL, HFILL } |
2622 | 14 | }, |
2623 | 14 | { &hf_btavdtp_mpeg24_object_type_mpeg2_aac_lc, |
2624 | 14 | { "MPEG2 AAC LC", "btavdtp.codec.mpeg24.object_type.mpeg2_aac_lc", |
2625 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2626 | 14 | NULL, HFILL } |
2627 | 14 | }, |
2628 | 14 | { &hf_btavdtp_mpeg24_object_type_mpeg4_aac_lc, |
2629 | 14 | { "MPEG4 AAC LC", "btavdtp.codec.mpeg24.object_type.mpeg4_aac_lc", |
2630 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2631 | 14 | NULL, HFILL } |
2632 | 14 | }, |
2633 | 14 | { &hf_btavdtp_mpeg24_object_type_mpeg4_aac_ltp, |
2634 | 14 | { "MPEG4 AAC LTP", "btavdtp.codec.mpeg24.object_type.mpeg4_aac_ltp", |
2635 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2636 | 14 | NULL, HFILL } |
2637 | 14 | }, |
2638 | 14 | { &hf_btavdtp_mpeg24_object_type_mpeg4_aac_scalable, |
2639 | 14 | { "MPEG4 AAC Scalable", "btavdtp.codec.mpeg24.object_type.mpeg4_aac_scalable", |
2640 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2641 | 14 | NULL, HFILL } |
2642 | 14 | }, |
2643 | 14 | { &hf_btavdtp_mpeg24_object_type_rfa, |
2644 | 14 | { "RFA", "btavdtp.codec.mpeg24.object_type.rfa", |
2645 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0F, |
2646 | 14 | NULL, HFILL } |
2647 | 14 | }, |
2648 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_8000, |
2649 | 14 | { "Sampling Frequency 8000 Hz", "btavdtp.codec.mpeg24.sampling_frequency.8000", |
2650 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2651 | 14 | NULL, HFILL } |
2652 | 14 | }, |
2653 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_11025, |
2654 | 14 | { "Sampling Frequency 11025 Hz", "btavdtp.codec.mpeg24.sampling_frequency.11025", |
2655 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2656 | 14 | NULL, HFILL } |
2657 | 14 | }, |
2658 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_12000, |
2659 | 14 | { "Sampling Frequency 12000 Hz", "btavdtp.codec.mpeg24.sampling_frequency.12000", |
2660 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2661 | 14 | NULL, HFILL } |
2662 | 14 | }, |
2663 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_16000, |
2664 | 14 | { "Sampling Frequency 16000 Hz", "btavdtp.codec.mpeg24.sampling_frequency.16000", |
2665 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2666 | 14 | NULL, HFILL } |
2667 | 14 | }, |
2668 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_22050, |
2669 | 14 | { "Sampling Frequency 22050 Hz", "btavdtp.codec.mpeg24.sampling_frequency.22050", |
2670 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
2671 | 14 | NULL, HFILL } |
2672 | 14 | }, |
2673 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_24000, |
2674 | 14 | { "Sampling Frequency 24000 Hz", "btavdtp.codec.mpeg24.sampling_frequency.24000", |
2675 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2676 | 14 | NULL, HFILL } |
2677 | 14 | }, |
2678 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_32000, |
2679 | 14 | { "Sampling Frequency 32000 Hz", "btavdtp.codec.mpeg24.sampling_frequency.32000", |
2680 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
2681 | 14 | NULL, HFILL } |
2682 | 14 | }, |
2683 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_44100, |
2684 | 14 | { "Sampling Frequency 44100 Hz", "btavdtp.codec.mpeg24.sampling_frequency.44100", |
2685 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
2686 | 14 | NULL, HFILL } |
2687 | 14 | }, |
2688 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_48000, |
2689 | 14 | { "Sampling Frequency 48000 Hz", "btavdtp.codec.mpeg24.sampling_frequency.48000", |
2690 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2691 | 14 | NULL, HFILL } |
2692 | 14 | }, |
2693 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_64000, |
2694 | 14 | { "Sampling Frequency 64000 Hz", "btavdtp.codec.mpeg24.sampling_frequency.64000", |
2695 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2696 | 14 | NULL, HFILL } |
2697 | 14 | }, |
2698 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_88200, |
2699 | 14 | { "Sampling Frequency 88200 Hz", "btavdtp.codec.mpeg24.sampling_frequency.88200", |
2700 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2701 | 14 | NULL, HFILL } |
2702 | 14 | }, |
2703 | 14 | { &hf_btavdtp_mpeg24_sampling_frequency_96000, |
2704 | 14 | { "Sampling Frequency 96000 Hz", "btavdtp.codec.mpeg24.sampling_frequency.96000", |
2705 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2706 | 14 | NULL, HFILL } |
2707 | 14 | }, |
2708 | 14 | { &hf_btavdtp_mpeg24_channels_1, |
2709 | 14 | { "Channels 1", "btavdtp.codec.mpeg24.channels.1", |
2710 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
2711 | 14 | NULL, HFILL } |
2712 | 14 | }, |
2713 | 14 | { &hf_btavdtp_mpeg24_channels_2, |
2714 | 14 | { "Channels 2", "btavdtp.codec.mpeg24.channels.2", |
2715 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2716 | 14 | NULL, HFILL } |
2717 | 14 | }, |
2718 | 14 | { &hf_btavdtp_mpeg24_rfa, |
2719 | 14 | { "RFA", "btavdtp.codec.mpeg24.rfa", |
2720 | 14 | FT_UINT8, BASE_HEX, NULL, 0x03, |
2721 | 14 | NULL, HFILL } |
2722 | 14 | }, |
2723 | 14 | { &hf_btavdtp_mpeg24_vbr_supported, |
2724 | 14 | { "VBR Supported", "btavdtp.codec.mpeg24.vbr", |
2725 | 14 | FT_BOOLEAN, 24, NULL, 0x800000, |
2726 | 14 | NULL, HFILL } |
2727 | 14 | }, |
2728 | 14 | { &hf_btavdtp_mpeg24_bit_rate, |
2729 | 14 | { "Bit Rate", "btavdtp.codec.mpeg24.bit_rate", |
2730 | 14 | FT_UINT24, BASE_HEX, NULL, 0x7FFFFF, |
2731 | 14 | NULL, HFILL } |
2732 | 14 | }, |
2733 | 14 | { &hf_btavdtp_atrac_version, |
2734 | 14 | { "Version", "btavdtp.codec.atrac.version", |
2735 | 14 | FT_UINT8, BASE_DEC, NULL, 0xE0, |
2736 | 14 | NULL, HFILL } |
2737 | 14 | }, |
2738 | 14 | { &hf_btavdtp_atrac_channel_mode_single_channel, |
2739 | 14 | { "Channel Mode Single Channel", "btavdtp.codec.atrac.channel_mode.single_channel", |
2740 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2741 | 14 | NULL, HFILL } |
2742 | 14 | }, |
2743 | 14 | { &hf_btavdtp_atrac_channel_mode_dual_channel, |
2744 | 14 | { "Channel Mode Dual Channel", "btavdtp.codec.atrac.channel_mode.dual_channel", |
2745 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
2746 | 14 | NULL, HFILL } |
2747 | 14 | }, |
2748 | 14 | { &hf_btavdtp_atrac_channel_mode_joint_stereo, |
2749 | 14 | { "Channel Mode Joint Stereo", "btavdtp.codec.atrac.channel_mode.joint_stereo", |
2750 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2751 | 14 | NULL, HFILL } |
2752 | 14 | }, |
2753 | 14 | { &hf_btavdtp_atrac_rfa1, |
2754 | 14 | { "RFA", "btavdtp.codec.atrac.rfa1", |
2755 | 14 | FT_UINT8, BASE_HEX, NULL, 0x03, |
2756 | 14 | NULL, HFILL } |
2757 | 14 | }, |
2758 | 14 | { &hf_btavdtp_atrac_rfa2, |
2759 | 14 | { "RFA", "btavdtp.codec.atrac.rfa2", |
2760 | 14 | FT_UINT24, BASE_HEX, NULL, 0xC00000, |
2761 | 14 | NULL, HFILL } |
2762 | 14 | }, |
2763 | 14 | { &hf_btavdtp_atrac_sampling_frequency_44100, |
2764 | 14 | { "Sampling Frequency 44100 Hz", "btavdtp.codec.sbc.sampling_frequency.44100", |
2765 | 14 | FT_BOOLEAN, 24, NULL, 0x200000, |
2766 | 14 | NULL, HFILL } |
2767 | 14 | }, |
2768 | 14 | { &hf_btavdtp_atrac_sampling_frequency_48000, |
2769 | 14 | { "Sampling Frequency 48000 Hz", "btavdtp.codec.sbc.sampling_frequency.48000", |
2770 | 14 | FT_BOOLEAN, 24, NULL, 0x100000, |
2771 | 14 | NULL, HFILL } |
2772 | 14 | }, |
2773 | 14 | { &hf_btavdtp_atrac_vbr_supported, |
2774 | 14 | { "VBR Supported", "btavdtp.codec.atrac.vbr", |
2775 | 14 | FT_BOOLEAN, 24, NULL, 0x080000, |
2776 | 14 | NULL, HFILL } |
2777 | 14 | }, |
2778 | 14 | { &hf_btavdtp_atrac_bit_rate, |
2779 | 14 | { "Bit Rate", "btavdtp.codec.atrac.bit_rate", |
2780 | 14 | FT_UINT24, BASE_HEX, NULL, 0x07FFFF, |
2781 | 14 | NULL, HFILL } |
2782 | 14 | }, |
2783 | 14 | { &hf_btavdtp_atrac_maximum_sul, |
2784 | 14 | { "Maximum SUL", "btavdtp.codec.atrac.maximum_sul", |
2785 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
2786 | 14 | "Sound Unit Length (SUL) is one of the parameters that determine bit rate of the audio stream.", HFILL } |
2787 | 14 | }, |
2788 | 14 | { &hf_btavdtp_atrac_rfa3, |
2789 | 14 | { "RFA", "btavdtp.codec.atrac.rfa3", |
2790 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
2791 | 14 | NULL, HFILL } |
2792 | 14 | }, |
2793 | 14 | { &hf_btavdtp_h263_level_10, |
2794 | 14 | { "H264 Level 10", "btavdtp.codec.h264.level.10", |
2795 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2796 | 14 | NULL, HFILL } |
2797 | 14 | }, |
2798 | 14 | { &hf_btavdtp_h263_level_20, |
2799 | 14 | { "H264 Level 20", "btavdtp.codec.h264.level.20", |
2800 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2801 | 14 | NULL, HFILL } |
2802 | 14 | }, |
2803 | 14 | { &hf_btavdtp_h263_level_30, |
2804 | 14 | { "H264 Level 30", "btavdtp.codec.h264.level.30", |
2805 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2806 | 14 | NULL, HFILL } |
2807 | 14 | }, |
2808 | 14 | { &hf_btavdtp_h263_level_rfa, |
2809 | 14 | { "H264 Level RFA", "btavdtp.codec.h264.level.rfa", |
2810 | 14 | FT_UINT8, BASE_HEX, NULL, 0x1F, |
2811 | 14 | NULL, HFILL } |
2812 | 14 | }, |
2813 | 14 | { &hf_btavdtp_mpeg4_level_0, |
2814 | 14 | { "MPEG Level 0", "btavdtp.codec.mpeg4.level.0", |
2815 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2816 | 14 | NULL, HFILL } |
2817 | 14 | }, |
2818 | 14 | { &hf_btavdtp_mpeg4_level_1, |
2819 | 14 | { "MPEG Level 1", "btavdtp.codec.mpeg4.level.1", |
2820 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2821 | 14 | NULL, HFILL } |
2822 | 14 | }, |
2823 | 14 | { &hf_btavdtp_mpeg4_level_2, |
2824 | 14 | { "MPEG Level 2", "btavdtp.codec.mpeg4.level.2", |
2825 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2826 | 14 | NULL, HFILL } |
2827 | 14 | }, |
2828 | 14 | { &hf_btavdtp_mpeg4_level_3, |
2829 | 14 | { "MPEG4 Level 3", "btavdtp.codec.mpeg4.level.3", |
2830 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2831 | 14 | NULL, HFILL } |
2832 | 14 | }, |
2833 | 14 | { &hf_btavdtp_mpeg4_level_rfa, |
2834 | 14 | { "MPEG4 Level RFA", "btavdtp.codec.mpeg4.level.rfa", |
2835 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0F, |
2836 | 14 | NULL, HFILL } |
2837 | 14 | }, |
2838 | 14 | { &hf_btavdtp_vendor_id, |
2839 | 14 | { "Vendor ID", "btavdtp.codec.vendor.vendor_id", |
2840 | 14 | FT_UINT32, BASE_HEX|BASE_EXT_STRING, &bluetooth_company_id_vals_ext, 0x00, |
2841 | 14 | NULL, HFILL } |
2842 | 14 | }, |
2843 | 14 | { &hf_btavdtp_vendor_specific_codec_id, |
2844 | 14 | { "Codec", "btavdtp.codec.vendor.codec_id", |
2845 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
2846 | 14 | NULL, HFILL } |
2847 | 14 | }, |
2848 | 14 | { &hf_btavdtp_vendor_specific_value, |
2849 | 14 | { "Value", "btavdtp.codec.vendor.value", |
2850 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
2851 | 14 | NULL, HFILL } |
2852 | 14 | }, |
2853 | 14 | { &hf_btavdtp_vendor_apt_codec_id, |
2854 | 14 | { "Codec", "btavdtp.codec.vendor.codec_id", |
2855 | 14 | FT_UINT16, BASE_HEX, VALS(vendor_apt_codec_vals), 0x0, |
2856 | 14 | NULL, HFILL } |
2857 | 14 | }, |
2858 | 14 | { &hf_btavdtp_vendor_specific_aptx_sampling_frequency_16000, |
2859 | 14 | { "Sampling Frequency 16000 Hz", "btavdtp.codec.aptx.sampling_frequency.16000", |
2860 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2861 | 14 | NULL, HFILL } |
2862 | 14 | }, |
2863 | 14 | { &hf_btavdtp_vendor_specific_aptx_sampling_frequency_32000, |
2864 | 14 | { "Sampling Frequency 32000 Hz", "btavdtp.codec.aptx.sampling_frequency.32000", |
2865 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2866 | 14 | NULL, HFILL } |
2867 | 14 | }, |
2868 | 14 | { &hf_btavdtp_vendor_specific_aptx_sampling_frequency_44100, |
2869 | 14 | { "Sampling Frequency 44100 Hz", "btavdtp.codec.aptx.sampling_frequency.44100", |
2870 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2871 | 14 | NULL, HFILL } |
2872 | 14 | }, |
2873 | 14 | { &hf_btavdtp_vendor_specific_aptx_sampling_frequency_48000, |
2874 | 14 | { "Sampling Frequency 48000 Hz", "btavdtp.codec.aptx.sampling_frequency.48000", |
2875 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2876 | 14 | NULL, HFILL } |
2877 | 14 | }, |
2878 | 14 | { &hf_btavdtp_vendor_specific_aptx_channel_mode_mono, |
2879 | 14 | { "Channel Mode Mono", "btavdtp.codec.aptx.channel_mode.mono", |
2880 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
2881 | 14 | NULL, HFILL } |
2882 | 14 | }, |
2883 | 14 | { &hf_btavdtp_vendor_specific_aptx_channel_mode_dual_channel, |
2884 | 14 | { "Channel Mode Dual Channel", "btavdtp.codec.aptx.channel_mode.dual_channel", |
2885 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2886 | 14 | NULL, HFILL } |
2887 | 14 | }, |
2888 | 14 | { &hf_btavdtp_vendor_specific_aptx_channel_mode_stereo, |
2889 | 14 | { "Channel Mode Stereo", "btavdtp.codec.aptx.channel_mode.stereo", |
2890 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
2891 | 14 | NULL, HFILL } |
2892 | 14 | }, |
2893 | 14 | { &hf_btavdtp_vendor_specific_aptx_channel_mode_joint_stereo, |
2894 | 14 | { "Channel Mode Joint Stereo", "btavdtp.codec.aptx.channel_mode.joint_stereo", |
2895 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
2896 | 14 | NULL, HFILL } |
2897 | 14 | }, |
2898 | 14 | { &hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_16000, |
2899 | 14 | { "Sampling Frequency 16000 Hz", "btavdtp.codec.aptxhd.sampling_frequency.16000", |
2900 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
2901 | 14 | NULL, HFILL } |
2902 | 14 | }, |
2903 | 14 | { &hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_32000, |
2904 | 14 | { "Sampling Frequency 32000 Hz", "btavdtp.codec.aptxhd.sampling_frequency.32000", |
2905 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
2906 | 14 | NULL, HFILL } |
2907 | 14 | }, |
2908 | 14 | { &hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_44100, |
2909 | 14 | { "Sampling Frequency 44100 Hz", "btavdtp.codec.aptxhd.sampling_frequency.44100", |
2910 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2911 | 14 | NULL, HFILL } |
2912 | 14 | }, |
2913 | 14 | { &hf_btavdtp_vendor_specific_aptxhd_sampling_frequency_48000, |
2914 | 14 | { "Sampling Frequency 48000 Hz", "btavdtp.codec.aptxhd.sampling_frequency.48000", |
2915 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2916 | 14 | NULL, HFILL } |
2917 | 14 | }, |
2918 | 14 | { &hf_btavdtp_vendor_specific_aptxhd_channel_mode_mono, |
2919 | 14 | { "Channel Mode Mono", "btavdtp.codec.aptxhd.channel_mode.mono", |
2920 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
2921 | 14 | NULL, HFILL } |
2922 | 14 | }, |
2923 | 14 | { &hf_btavdtp_vendor_specific_aptxhd_channel_mode_dual_channel, |
2924 | 14 | { "Channel Mode Dual Channel", "btavdtp.codec.aptxhd.channel_mode.dual_channel", |
2925 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2926 | 14 | NULL, HFILL } |
2927 | 14 | }, |
2928 | 14 | { &hf_btavdtp_vendor_specific_aptxhd_channel_mode_stereo, |
2929 | 14 | { "Channel Mode Stereo", "btavdtp.codec.aptxhd.channel_mode.stereo", |
2930 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
2931 | 14 | NULL, HFILL } |
2932 | 14 | }, |
2933 | 14 | { &hf_btavdtp_vendor_specific_aptxhd_channel_mode_joint_stereo, |
2934 | 14 | { "Channel Mode Joint Stereo", "btavdtp.codec.aptxhd.channel_mode.joint_stereo", |
2935 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
2936 | 14 | NULL, HFILL } |
2937 | 14 | }, |
2938 | 14 | { &hf_btavdtp_vendor_specific_aptxhd_rfa, |
2939 | 14 | { "RFA", "btavdtp.codec.aptxhd.rfa", |
2940 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
2941 | 14 | NULL, HFILL } |
2942 | 14 | }, |
2943 | 14 | { &hf_btavdtp_vendor_sony_codec_id, |
2944 | 14 | { "Codec", "btavdtp.codec.vendor.codec_id", |
2945 | 14 | FT_UINT16, BASE_HEX, VALS(vendor_sony_codec_vals), 0x00, |
2946 | 14 | NULL, HFILL } |
2947 | 14 | }, |
2948 | 14 | { &hf_btavdtp_vendor_specific_ldac_rfa1, |
2949 | 14 | { "RFA1", "btavdtp.codec.ldac.rfa1", |
2950 | 14 | FT_UINT8, BASE_HEX, NULL, 0xC0, |
2951 | 14 | NULL, HFILL } |
2952 | 14 | }, |
2953 | 14 | { &hf_btavdtp_vendor_specific_ldac_sampling_frequency_44100, |
2954 | 14 | { "Sampling Frequency 44100 Hz", "btavdtp.codec.ldac.sampling_frequency.44100", |
2955 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
2956 | 14 | NULL, HFILL } |
2957 | 14 | }, |
2958 | 14 | { &hf_btavdtp_vendor_specific_ldac_sampling_frequency_48000, |
2959 | 14 | { "Sampling Frequency 48000 Hz", "btavdtp.codec.ldac.sampling_frequency.48000", |
2960 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
2961 | 14 | NULL, HFILL } |
2962 | 14 | }, |
2963 | 14 | { &hf_btavdtp_vendor_specific_ldac_sampling_frequency_88200, |
2964 | 14 | { "Sampling Frequency 88200 Hz", "btavdtp.codec.ldac.sampling_frequency.88200", |
2965 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
2966 | 14 | NULL, HFILL } |
2967 | 14 | }, |
2968 | 14 | { &hf_btavdtp_vendor_specific_ldac_sampling_frequency_96000, |
2969 | 14 | { "Sampling Frequency 96000 Hz", "btavdtp.codec.ldac.sampling_frequency.96000", |
2970 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2971 | 14 | NULL, HFILL } |
2972 | 14 | }, |
2973 | 14 | { &hf_btavdtp_vendor_specific_ldac_sampling_frequency_176400, |
2974 | 14 | { "Sampling Frequency 176400 Hz", "btavdtp.codec.ldac.sampling_frequency.176400", |
2975 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
2976 | 14 | NULL, HFILL } |
2977 | 14 | }, |
2978 | 14 | { &hf_btavdtp_vendor_specific_ldac_sampling_frequency_192000, |
2979 | 14 | { "Sampling Frequency 192000 Hz", "btavdtp.codec.ldac.sampling_frequency.192000", |
2980 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
2981 | 14 | NULL, HFILL } |
2982 | 14 | }, |
2983 | 14 | { &hf_btavdtp_vendor_specific_ldac_rfa2, |
2984 | 14 | { "RFA2", "btavdtp.codec.ldac.rfa2", |
2985 | 14 | FT_UINT8, BASE_HEX, NULL, 0xF8, |
2986 | 14 | NULL, HFILL } |
2987 | 14 | }, |
2988 | 14 | { &hf_btavdtp_vendor_specific_ldac_channel_mode_mono, |
2989 | 14 | { "Channel Mode Mono", "btavdtp.codec.ldac.channel_mode.mono", |
2990 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
2991 | 14 | NULL, HFILL } |
2992 | 14 | }, |
2993 | 14 | { &hf_btavdtp_vendor_specific_ldac_channel_mode_dual_channel, |
2994 | 14 | { "Channel Mode Dual Channel", "btavdtp.codec.ldac.channel_mode.dual_channel", |
2995 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
2996 | 14 | NULL, HFILL } |
2997 | 14 | }, |
2998 | 14 | { &hf_btavdtp_vendor_specific_ldac_channel_mode_stereo, |
2999 | 14 | { "Channel Mode Stereo", "btavdtp.codec.ldac.channel_mode.stereo", |
3000 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
3001 | 14 | NULL, HFILL } |
3002 | 14 | }, |
3003 | 14 | { &hf_btavdtp_vendor_google_codec_id, |
3004 | 14 | { "Codec", "btavdtp.codec.vendor.codec_id", |
3005 | 14 | FT_UINT16, BASE_HEX, VALS(vendor_google_codec_vals), 0x00, |
3006 | 14 | NULL, HFILL } |
3007 | 14 | }, |
3008 | 14 | { &hf_btavdtp_vendor_specific_opus_sampling_frequency_48000, |
3009 | 14 | { "Sampling Frequency 48000 Hz", "btavdtp.codec.opus.sampling_frequency.48000", |
3010 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
3011 | 14 | NULL, HFILL } |
3012 | 14 | }, |
3013 | 14 | { &hf_btavdtp_vendor_specific_opus_rfa, |
3014 | 14 | { "RFA", "btavdtp.codec.opus.rfa1", |
3015 | 14 | FT_UINT8, BASE_HEX, NULL, 0x60, |
3016 | 14 | NULL, HFILL } |
3017 | 14 | }, |
3018 | 14 | { &hf_btavdtp_vendor_specific_opus_frame_duration_20, |
3019 | 14 | { "Frame Duration 20 ms", "btavdtp.codec.opus.frame_duration.20", |
3020 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
3021 | 14 | NULL, HFILL } |
3022 | 14 | }, |
3023 | 14 | { &hf_btavdtp_vendor_specific_opus_frame_duration_10, |
3024 | 14 | { "Frame Duration 10 ms", "btavdtp.codec.opus.frame_duration.10", |
3025 | 14 | FT_BOOLEAN, 8, NULL, 0x08, |
3026 | 14 | NULL, HFILL } |
3027 | 14 | }, |
3028 | 14 | { &hf_btavdtp_vendor_specific_opus_channel_mode_dual, |
3029 | 14 | { "Channel Mode Dual", "btavdtp.codec.opus.channel_mode.dual", |
3030 | 14 | FT_BOOLEAN, 8, NULL, 0x04, |
3031 | 14 | NULL, HFILL } |
3032 | 14 | }, |
3033 | 14 | { &hf_btavdtp_vendor_specific_opus_channel_mode_stereo, |
3034 | 14 | { "Channel Mode Stereo", "btavdtp.codec.opus.channel_mode.stereo", |
3035 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
3036 | 14 | NULL, HFILL } |
3037 | 14 | }, |
3038 | 14 | { &hf_btavdtp_vendor_specific_opus_channel_mode_mono, |
3039 | 14 | { "Channel Mode Mono", "btavdtp.codec.opus.channel_mode.mono", |
3040 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
3041 | 14 | NULL, HFILL } |
3042 | 14 | }, |
3043 | 14 | { &hf_btavdtp_capabilities, |
3044 | 14 | { "Capabilities", "btavdtp.capabilities", |
3045 | 14 | FT_NONE, BASE_NONE, NULL, 0x0, |
3046 | 14 | NULL, HFILL } |
3047 | 14 | }, |
3048 | 14 | { &hf_btavdtp_service, |
3049 | 14 | { "Service", "btavdtp.service", |
3050 | 14 | FT_NONE, BASE_NONE, NULL, 0x0, |
3051 | 14 | NULL, HFILL } |
3052 | 14 | }, |
3053 | 14 | { &hf_btavdtp_service_multiplexing_entry, |
3054 | 14 | { "Entry", "btavdtp.service_multiplexing_entry", |
3055 | 14 | FT_NONE, BASE_NONE, NULL, 0x0, |
3056 | 14 | NULL, HFILL } |
3057 | 14 | }, |
3058 | 14 | { &hf_btavdtp_data, |
3059 | 14 | { "Data", "btavdtp.data", |
3060 | 14 | FT_NONE, BASE_NONE, NULL, 0x0, |
3061 | 14 | NULL, HFILL } |
3062 | 14 | } |
3063 | 14 | }; |
3064 | | |
3065 | 14 | static int *ett[] = { |
3066 | 14 | &ett_btavdtp, |
3067 | 14 | &ett_btavdtp_sep, |
3068 | 14 | &ett_btavdtp_capabilities, |
3069 | 14 | &ett_btavdtp_service, |
3070 | 14 | }; |
3071 | | |
3072 | 14 | proto_btavdtp = proto_register_protocol("Bluetooth AVDTP Protocol", "BT AVDTP", "btavdtp"); |
3073 | 14 | btavdtp_handle = register_dissector("btavdtp", dissect_btavdtp, proto_btavdtp); |
3074 | | |
3075 | 14 | proto_register_field_array(proto_btavdtp, hf, array_length(hf)); |
3076 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
3077 | | |
3078 | 14 | module = prefs_register_protocol_subtree("Bluetooth", proto_btavdtp, NULL); |
3079 | 14 | prefs_register_static_text_preference(module, "avdtp.version", |
3080 | 14 | "Bluetooth Protocol AVDTP version: 1.3", |
3081 | 14 | "Version of protocol supported by this dissector."); |
3082 | | |
3083 | 14 | channels = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); |
3084 | 14 | sep_list = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); |
3085 | 14 | sep_open = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); |
3086 | 14 | media_packet_times = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); |
3087 | 14 | #if RTP_PLAYER_WORKAROUND == true |
3088 | 14 | file_scope_stream_number = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); |
3089 | 14 | #endif |
3090 | 14 | } |
3091 | | |
3092 | | void |
3093 | | proto_reg_handoff_btavdtp(void) |
3094 | 14 | { |
3095 | 14 | dissector_add_string("bluetooth.uuid", "19", btavdtp_handle); |
3096 | | |
3097 | 14 | dissector_add_uint("btl2cap.psm", BTL2CAP_PSM_AVDTP, btavdtp_handle); |
3098 | | |
3099 | 14 | dissector_add_for_decode_as("btl2cap.cid", btavdtp_handle); |
3100 | 14 | } |
3101 | | |
3102 | | |
3103 | | static int |
3104 | | dissect_aptx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
3105 | 0 | { |
3106 | 0 | proto_item *aptx_item; |
3107 | 0 | proto_tree *aptx_tree; |
3108 | 0 | proto_item *pitem; |
3109 | 0 | bta2dp_codec_info_t *info; |
3110 | 0 | double cumulative_frame_duration = 0; |
3111 | |
|
3112 | 0 | info = (bta2dp_codec_info_t *) data; |
3113 | |
|
3114 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "aptX"); |
3115 | |
|
3116 | 0 | switch (pinfo->p2p_dir) { |
3117 | | |
3118 | 0 | case P2P_DIR_SENT: |
3119 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Sent "); |
3120 | 0 | break; |
3121 | | |
3122 | 0 | case P2P_DIR_RECV: |
3123 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Rcvd "); |
3124 | 0 | break; |
3125 | | |
3126 | 0 | case P2P_DIR_UNKNOWN: |
3127 | 0 | col_clear(pinfo->cinfo, COL_INFO); |
3128 | 0 | break; |
3129 | | |
3130 | 0 | default: |
3131 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ", |
3132 | 0 | pinfo->p2p_dir); |
3133 | 0 | break; |
3134 | 0 | } |
3135 | | |
3136 | 0 | col_append_str(pinfo->cinfo, COL_INFO, "aptX"); |
3137 | |
|
3138 | 0 | aptx_item = proto_tree_add_item(tree, proto_aptx, tvb, 0, -1, ENC_NA); |
3139 | 0 | aptx_tree = proto_item_add_subtree(aptx_item, ett_aptx); |
3140 | |
|
3141 | 0 | proto_tree_add_item(aptx_tree, hf_aptx_data, tvb, 0, -1, ENC_NA); |
3142 | |
|
3143 | 0 | if (info && info->configuration && info->configuration_length >= 9) { |
3144 | 0 | bool fail = false; |
3145 | 0 | double expected_speed_data; |
3146 | 0 | double frame_duration; |
3147 | 0 | double frame_length = 2 * 2 * 4; |
3148 | 0 | int number_of_channels; |
3149 | 0 | int frequency; |
3150 | 0 | int sample_bits; |
3151 | |
|
3152 | 0 | switch (info->configuration[8] >> 4) { |
3153 | 0 | case 0x01: |
3154 | 0 | frequency = 48000; |
3155 | 0 | break; |
3156 | 0 | case 0x02: |
3157 | 0 | frequency = 44100; |
3158 | 0 | break; |
3159 | 0 | case 0x04: |
3160 | 0 | frequency = 32000; |
3161 | 0 | break; |
3162 | 0 | case 0x08: |
3163 | 0 | frequency = 16000; |
3164 | 0 | break; |
3165 | 0 | default: |
3166 | 0 | fail = true; |
3167 | 0 | } |
3168 | | |
3169 | 0 | if (fail) |
3170 | 0 | return tvb_reported_length(tvb); |
3171 | | |
3172 | 0 | switch (info->configuration[8] & 0x0F) { |
3173 | 0 | case 0x01: |
3174 | 0 | case 0x02: |
3175 | 0 | case 0x04: |
3176 | 0 | number_of_channels = 2; |
3177 | 0 | break; |
3178 | 0 | case 0x08: |
3179 | 0 | number_of_channels = 1; |
3180 | 0 | break; |
3181 | 0 | default: |
3182 | 0 | fail = true; |
3183 | 0 | } |
3184 | | |
3185 | 0 | if (fail) |
3186 | 0 | return tvb_reported_length(tvb); |
3187 | | |
3188 | 0 | sample_bits = 16; |
3189 | |
|
3190 | 0 | expected_speed_data = frequency * (sample_bits / 8.0) * number_of_channels; |
3191 | 0 | frame_duration = (((double) frame_length / (double) expected_speed_data) * 1000.0); |
3192 | |
|
3193 | 0 | cumulative_frame_duration = (tvb_reported_length(tvb) / 4.0) * frame_duration; |
3194 | |
|
3195 | 0 | pitem = proto_tree_add_double(aptx_tree, hf_aptx_cumulative_frame_duration, tvb, 0, 0, cumulative_frame_duration); |
3196 | 0 | proto_item_set_generated(pitem); |
3197 | |
|
3198 | 0 | if (info && info->previous_media_packet_info && info->current_media_packet_info) { |
3199 | 0 | nstime_t delta; |
3200 | |
|
3201 | 0 | nstime_delta(&delta, &pinfo->abs_ts, &info->previous_media_packet_info->abs_ts); |
3202 | 0 | pitem = proto_tree_add_double(aptx_tree, hf_aptx_delta_time, tvb, 0, 0, nstime_to_msec(&delta)); |
3203 | 0 | proto_item_set_generated(pitem); |
3204 | |
|
3205 | 0 | pitem = proto_tree_add_double(aptx_tree, hf_aptx_avrcp_song_position, tvb, 0, 0, info->previous_media_packet_info->avrcp_song_position); |
3206 | 0 | proto_item_set_generated(pitem); |
3207 | |
|
3208 | 0 | nstime_delta(&delta, &pinfo->abs_ts, &info->previous_media_packet_info->first_abs_ts); |
3209 | 0 | pitem = proto_tree_add_double(aptx_tree, hf_aptx_delta_time_from_the_beginning, tvb, 0, 0, nstime_to_msec(&delta)); |
3210 | 0 | proto_item_set_generated(pitem); |
3211 | |
|
3212 | 0 | if (!pinfo->fd->visited) |
3213 | 0 | info->current_media_packet_info->cumulative_frame_duration += cumulative_frame_duration; |
3214 | |
|
3215 | 0 | pitem = proto_tree_add_double(aptx_tree, hf_aptx_cumulative_duration, tvb, 0, 0, info->previous_media_packet_info->cumulative_frame_duration); |
3216 | 0 | proto_item_set_generated(pitem); |
3217 | |
|
3218 | 0 | pitem = proto_tree_add_double(aptx_tree, hf_aptx_diff, tvb, 0, 0, info->previous_media_packet_info->cumulative_frame_duration - nstime_to_msec(&delta)); |
3219 | 0 | proto_item_set_generated(pitem); |
3220 | 0 | } |
3221 | 0 | } |
3222 | | |
3223 | 0 | return tvb_reported_length(tvb); |
3224 | 0 | } |
3225 | | |
3226 | | void |
3227 | | proto_register_aptx(void) |
3228 | 14 | { |
3229 | 14 | static hf_register_info hf[] = { |
3230 | 14 | { &hf_aptx_data, |
3231 | 14 | { "Data", "aptx.data", |
3232 | 14 | FT_BYTES, BASE_NONE, NULL, 0x00, |
3233 | 14 | NULL, HFILL } |
3234 | 14 | }, |
3235 | 14 | { &hf_aptx_cumulative_frame_duration, |
3236 | 14 | { "Cumulative Frame Duration", "aptx.cumulative_frame_duration", |
3237 | 14 | FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x00, |
3238 | 14 | NULL, HFILL } |
3239 | 14 | }, |
3240 | 14 | { &hf_aptx_delta_time, |
3241 | 14 | { "Delta time", "aptx.delta_time", |
3242 | 14 | FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x00, |
3243 | 14 | NULL, HFILL } |
3244 | 14 | }, |
3245 | 14 | { &hf_aptx_avrcp_song_position, |
3246 | 14 | { "AVRCP Song Position", "aptx.avrcp_song_position", |
3247 | 14 | FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x00, |
3248 | 14 | NULL, HFILL } |
3249 | 14 | }, |
3250 | 14 | { &hf_aptx_delta_time_from_the_beginning, |
3251 | 14 | { "Delta time from the beginning", "aptx.delta_time_from_the_beginning", |
3252 | 14 | FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x00, |
3253 | 14 | NULL, HFILL } |
3254 | 14 | }, |
3255 | 14 | { &hf_aptx_cumulative_duration, |
3256 | 14 | { "Cumulative Music Duration", "aptx.cumulative_music_duration", |
3257 | 14 | FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x00, |
3258 | 14 | NULL, HFILL } |
3259 | 14 | }, |
3260 | 14 | { &hf_aptx_diff, |
3261 | 14 | { "Diff", "aptx.diff", |
3262 | 14 | FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x00, |
3263 | 14 | NULL, HFILL } |
3264 | 14 | }, |
3265 | 14 | }; |
3266 | | |
3267 | 14 | static int *ett[] = { |
3268 | 14 | &ett_aptx |
3269 | 14 | }; |
3270 | | |
3271 | 14 | proto_aptx = proto_register_protocol("aptX Codec", "aptX", "aptx"); |
3272 | 14 | proto_register_field_array(proto_aptx, hf, array_length(hf)); |
3273 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
3274 | | |
3275 | 14 | aptx_handle = register_dissector("aptx", dissect_aptx, proto_aptx); |
3276 | 14 | } |
3277 | | |
3278 | | static int |
3279 | | dissect_ldac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) |
3280 | 0 | { |
3281 | 0 | proto_item *ti; |
3282 | 0 | proto_tree *ldac_tree; |
3283 | 0 | proto_item *pitem; |
3284 | 0 | proto_tree *rtree; |
3285 | 0 | int offset = 0; |
3286 | 0 | uint8_t number_of_frames; |
3287 | 0 | uint8_t syncword; |
3288 | 0 | uint8_t byte; |
3289 | 0 | uint8_t cci; |
3290 | 0 | unsigned frequency; |
3291 | 0 | int available; |
3292 | 0 | int ldac_channels; |
3293 | 0 | int counter = 1; |
3294 | 0 | int frame_length; |
3295 | 0 | int frame_sample_size; |
3296 | 0 | int expected_speed_data; |
3297 | |
|
3298 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "LDAC"); |
3299 | |
|
3300 | 0 | ti = proto_tree_add_item(tree, proto_ldac, tvb, offset, -1, ENC_NA); |
3301 | 0 | ldac_tree = proto_item_add_subtree(ti, ett_ldac); |
3302 | |
|
3303 | 0 | proto_tree_add_item(ldac_tree, hf_ldac_fragmented, tvb, offset, 1, ENC_BIG_ENDIAN); |
3304 | 0 | proto_tree_add_item(ldac_tree, hf_ldac_starting_packet, tvb, offset, 1, ENC_BIG_ENDIAN); |
3305 | 0 | proto_tree_add_item(ldac_tree, hf_ldac_last_packet, tvb, offset, 1, ENC_BIG_ENDIAN); |
3306 | 0 | proto_tree_add_item(ldac_tree, hf_ldac_rfa, tvb, offset, 1, ENC_BIG_ENDIAN); |
3307 | 0 | proto_tree_add_item(ldac_tree, hf_ldac_number_of_frames, tvb, offset, 1, ENC_BIG_ENDIAN); |
3308 | 0 | number_of_frames = tvb_get_uint8(tvb, offset) & 0x0F; |
3309 | 0 | offset += 1; |
3310 | |
|
3311 | 0 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
3312 | 0 | available = tvb_reported_length_remaining(tvb, offset); |
3313 | |
|
3314 | 0 | syncword = tvb_get_uint8(tvb, offset); |
3315 | 0 | if (syncword != 0xAA) { |
3316 | 0 | rtree = proto_tree_add_subtree_format(ldac_tree, tvb, offset, 1, |
3317 | 0 | ett_ldac_list, NULL, "Frame: %3u/%3u", counter, number_of_frames); |
3318 | 0 | pitem = proto_tree_add_item(rtree, hf_ldac_syncword, tvb, offset, 1, ENC_BIG_ENDIAN); |
3319 | 0 | offset += 1; |
3320 | 0 | expert_add_info(pinfo, pitem, &ei_ldac_syncword); |
3321 | 0 | break; |
3322 | 0 | } |
3323 | | |
3324 | 0 | if (available > 1) { |
3325 | 0 | byte = tvb_get_uint8(tvb, offset + 1); |
3326 | 0 | frequency = (byte & 0xE0) >> 5; |
3327 | 0 | cci = (byte & 0x18)>> 3; |
3328 | 0 | frame_length = byte & 0x07; |
3329 | 0 | frame_length <<= 6; |
3330 | 0 | } else { |
3331 | 0 | frequency = 0; |
3332 | 0 | cci = 0; |
3333 | 0 | } |
3334 | |
|
3335 | 0 | if (available > 2) { |
3336 | 0 | byte = tvb_get_uint8(tvb, offset + 2); |
3337 | 0 | frame_length |= (byte & 0xFC) >> 2; |
3338 | 0 | frame_length +=1; |
3339 | 0 | } else { |
3340 | 0 | frame_length = 0; |
3341 | 0 | } |
3342 | |
|
3343 | 0 | rtree = proto_tree_add_subtree_format(ldac_tree, tvb, offset, |
3344 | 0 | 3 + frame_length > available ? available : 3 + frame_length, |
3345 | 0 | ett_ldac_list, NULL, "Frame: %3u/%3u", counter, number_of_frames); |
3346 | |
|
3347 | 0 | if (3 + frame_length > available) { |
3348 | 0 | expert_add_info(pinfo, rtree, &ei_ldac_truncated_or_bad_length); |
3349 | 0 | } |
3350 | |
|
3351 | 0 | proto_tree_add_item(rtree, hf_ldac_syncword, tvb, offset, 1, ENC_BIG_ENDIAN); |
3352 | 0 | offset += 1; |
3353 | |
|
3354 | 0 | if (cci == LDAC_CCI_MONO) |
3355 | 0 | ldac_channels = 1; |
3356 | 0 | else |
3357 | 0 | ldac_channels = 2; |
3358 | |
|
3359 | 0 | switch (frequency) { |
3360 | 0 | case LDAC_FSID_044: |
3361 | 0 | frequency = 44100; |
3362 | 0 | frame_sample_size = 128; |
3363 | 0 | break; |
3364 | 0 | case LDAC_FSID_048: |
3365 | 0 | frequency = 48000; |
3366 | 0 | frame_sample_size = 128; |
3367 | 0 | break; |
3368 | 0 | case LDAC_FSID_088: |
3369 | 0 | frequency = 88200; |
3370 | 0 | frame_sample_size = 256; |
3371 | 0 | break; |
3372 | 0 | case LDAC_FSID_096: |
3373 | 0 | frequency = 96000; |
3374 | 0 | frame_sample_size = 256; |
3375 | 0 | break; |
3376 | 0 | case LDAC_FSID_176: |
3377 | 0 | frequency = 176400; |
3378 | 0 | frame_sample_size = 512; |
3379 | 0 | break; |
3380 | 0 | case LDAC_FSID_192: |
3381 | 0 | frequency = 192000; |
3382 | 0 | frame_sample_size = 512; |
3383 | 0 | break; |
3384 | 0 | default: |
3385 | 0 | frequency = 0; |
3386 | 0 | frame_sample_size = 1; |
3387 | 0 | } |
3388 | | |
3389 | 0 | proto_tree_add_item(rtree, hf_ldac_sampling_frequency, tvb, offset, 1, ENC_BIG_ENDIAN); |
3390 | 0 | pitem = proto_tree_add_item(rtree, hf_ldac_channel_config_index, tvb, offset, 1, ENC_BIG_ENDIAN); |
3391 | 0 | proto_item_append_text(pitem, ", Number of channels : %d", ldac_channels); |
3392 | 0 | proto_tree_add_item(rtree, hf_ldac_frame_length_h, tvb, offset, 1, ENC_BIG_ENDIAN); |
3393 | 0 | offset += 1; |
3394 | 0 | proto_tree_add_item(rtree, hf_ldac_frame_length_l, tvb, offset, 1, ENC_BIG_ENDIAN); |
3395 | 0 | proto_tree_add_item(rtree, hf_ldac_frame_status, tvb, offset, 1, ENC_BIG_ENDIAN); |
3396 | 0 | offset += 1; |
3397 | |
|
3398 | 0 | proto_tree_add_item(rtree, hf_ldac_data, tvb, offset, frame_length, ENC_NA); |
3399 | 0 | offset += frame_length; |
3400 | |
|
3401 | 0 | expected_speed_data = (8*(frame_length+3) * frequency) / (frame_sample_size*1000); |
3402 | 0 | pitem = proto_tree_add_uint(rtree, hf_ldac_expected_data_speed, tvb, offset, 0, expected_speed_data); |
3403 | 0 | proto_item_append_text(pitem, " kbits/sec"); |
3404 | 0 | proto_item_set_generated(pitem); |
3405 | 0 | counter += 1; |
3406 | 0 | } |
3407 | | |
3408 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " Frames=%u", number_of_frames); |
3409 | |
|
3410 | 0 | return offset; |
3411 | 0 | } |
3412 | | void |
3413 | | proto_register_ldac(void) |
3414 | 14 | { |
3415 | 14 | expert_module_t* expert_ldac; |
3416 | | |
3417 | 14 | static hf_register_info hf[] = { |
3418 | 14 | { &hf_ldac_fragmented, |
3419 | 14 | { "Fragmented", "ldac.fragmented", |
3420 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
3421 | 14 | NULL, HFILL } |
3422 | 14 | }, |
3423 | 14 | { &hf_ldac_starting_packet, |
3424 | 14 | { "Starting Packet", "ldac.starting_packet", |
3425 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
3426 | 14 | NULL, HFILL } |
3427 | 14 | }, |
3428 | 14 | { &hf_ldac_last_packet, |
3429 | 14 | { "Last Packet", "ldac.last_packet", |
3430 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
3431 | 14 | NULL, HFILL } |
3432 | 14 | }, |
3433 | 14 | { &hf_ldac_rfa, |
3434 | 14 | { "RFA", "ldac.rfa", |
3435 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
3436 | 14 | NULL, HFILL } |
3437 | 14 | }, |
3438 | 14 | { &hf_ldac_number_of_frames, |
3439 | 14 | { "Number of Frames", "ldac.number_of_frames", |
3440 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0F, |
3441 | 14 | NULL, HFILL } |
3442 | 14 | }, |
3443 | 14 | { &hf_ldac_syncword, |
3444 | 14 | { "Sync Word", "ldac.syncword", |
3445 | 14 | FT_UINT8, BASE_HEX, NULL, 0x00, |
3446 | 14 | NULL, HFILL } |
3447 | 14 | }, |
3448 | 14 | { &hf_ldac_sampling_frequency, |
3449 | 14 | { "Sampling Frequency", "ldac.sampling_frequency", |
3450 | 14 | FT_UINT8, BASE_HEX, VALS(ldac_sampling_frequency_vals), 0xE0, |
3451 | 14 | NULL, HFILL } |
3452 | 14 | }, |
3453 | 14 | { &hf_ldac_channel_config_index, |
3454 | 14 | { "Channel Config Index", "ldac.channel_config_index", |
3455 | 14 | FT_UINT8, BASE_HEX, VALS(ldac_channel_config_index_vals), 0x18, |
3456 | 14 | NULL, HFILL } |
3457 | 14 | }, |
3458 | 14 | { &hf_ldac_frame_length_h, |
3459 | 14 | { "Frame Length Index(H)", "ldac.frame_length_index_H", |
3460 | 14 | FT_UINT8, BASE_HEX, NULL, 0x07, |
3461 | 14 | NULL, HFILL } |
3462 | 14 | }, |
3463 | 14 | { &hf_ldac_frame_length_l, |
3464 | 14 | { "Frame Length Index(L)", "ldac.frame_length_index_L", |
3465 | 14 | FT_UINT8, BASE_HEX, NULL, 0xFC, |
3466 | 14 | NULL, HFILL } |
3467 | 14 | }, |
3468 | 14 | { &hf_ldac_frame_status, |
3469 | 14 | { "Frame Status", "ldac.frame_status", |
3470 | 14 | FT_UINT8, BASE_DEC, NULL, 0x03, |
3471 | 14 | NULL, HFILL } |
3472 | 14 | }, |
3473 | 14 | { &hf_ldac_expected_data_speed, |
3474 | 14 | { "Bitrate", "ldac.expected_speed_data", |
3475 | 14 | FT_UINT32, BASE_DEC, NULL, 0x00, |
3476 | 14 | NULL, HFILL } |
3477 | 14 | }, |
3478 | 14 | { &hf_ldac_data, |
3479 | 14 | { "Frame Data", "ldac.data", |
3480 | 14 | FT_NONE, BASE_NONE, NULL, 0x00, |
3481 | 14 | NULL, HFILL } |
3482 | 14 | }, |
3483 | 14 | }; |
3484 | | |
3485 | 14 | static int *ett[] = { |
3486 | 14 | &ett_ldac, |
3487 | 14 | &ett_ldac_list, |
3488 | 14 | }; |
3489 | | |
3490 | 14 | static ei_register_info ei[] = { |
3491 | 14 | { &ei_ldac_syncword, { "ldac.syncword.unexpected", PI_PROTOCOL, PI_WARN, "Unexpected syncword", EXPFILL }}, |
3492 | 14 | { &ei_ldac_truncated_or_bad_length, { "ldac.data.truncated", PI_PROTOCOL, PI_WARN, "Either bad frame length or data truncated", EXPFILL }}, |
3493 | 14 | }; |
3494 | | |
3495 | 14 | proto_ldac = proto_register_protocol("LDAC Codec", "LDAC", "ldac"); |
3496 | | |
3497 | 14 | proto_register_field_array(proto_ldac, hf, array_length(hf)); |
3498 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
3499 | 14 | expert_ldac = expert_register_protocol(proto_ldac); |
3500 | 14 | expert_register_field_array(expert_ldac, ei, array_length(ei)); |
3501 | | |
3502 | 14 | ldac_handle = register_dissector("ldac", dissect_ldac, proto_ldac); |
3503 | | |
3504 | 14 | } |
3505 | | |
3506 | | static int |
3507 | | dissect_bta2dp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
3508 | 12 | { |
3509 | 12 | proto_item *ti; |
3510 | 12 | proto_tree *bta2dp_tree; |
3511 | 12 | proto_item *pitem; |
3512 | 12 | int offset = 0; |
3513 | 12 | dissector_handle_t codec_dissector = NULL; |
3514 | 12 | bta2dp_codec_info_t bta2dp_codec_info; |
3515 | 12 | sep_data_t sep_data; |
3516 | 12 | bool no_avdtp_session; |
3517 | | |
3518 | 12 | no_avdtp_session = (proto_btavdtp != (int) GPOINTER_TO_UINT(wmem_list_frame_data( |
3519 | 12 | wmem_list_frame_prev(wmem_list_tail(pinfo->layers))))); |
3520 | | |
3521 | 12 | sep_data.codec = CODEC_SBC; |
3522 | 12 | sep_data.content_protection_type = 0; |
3523 | 12 | sep_data.acp_seid = 0; |
3524 | 12 | sep_data.int_seid = 0; |
3525 | 12 | sep_data.previous_media_packet_info = NULL; |
3526 | 12 | sep_data.current_media_packet_info = NULL; |
3527 | 12 | sep_data.stream_start_in_frame = 0; |
3528 | 12 | sep_data.stream_end_in_frame = 0; |
3529 | 12 | sep_data.stream_number = 1; |
3530 | 12 | sep_data.vendor_id = 0; |
3531 | 12 | sep_data.vendor_codec = 0; |
3532 | 12 | sep_data.configuration_length = 0; |
3533 | 12 | sep_data.configuration = NULL; |
3534 | | |
3535 | 12 | if (force_a2dp_scms_t || force_a2dp_codec != CODEC_DEFAULT) { |
3536 | 0 | if (force_a2dp_scms_t) |
3537 | 0 | sep_data.content_protection_type = 2; |
3538 | 0 | else if (data && !no_avdtp_session) |
3539 | 0 | sep_data.content_protection_type = ((sep_data_t *) data)->content_protection_type; |
3540 | |
|
3541 | 0 | if (force_a2dp_codec != CODEC_DEFAULT) |
3542 | 0 | sep_data.codec = force_a2dp_codec; |
3543 | 0 | else if (data && !no_avdtp_session) |
3544 | 0 | sep_data.codec = ((sep_data_t *) data)->codec; |
3545 | 12 | } else { |
3546 | 12 | if (data && !no_avdtp_session) |
3547 | 0 | sep_data = *((sep_data_t *) data); |
3548 | 12 | } |
3549 | | |
3550 | 12 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "A2DP"); |
3551 | | |
3552 | 12 | switch (pinfo->p2p_dir) { |
3553 | | |
3554 | 0 | case P2P_DIR_SENT: |
3555 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Sent "); |
3556 | 0 | break; |
3557 | | |
3558 | 0 | case P2P_DIR_RECV: |
3559 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Rcvd "); |
3560 | 0 | break; |
3561 | | |
3562 | 12 | case P2P_DIR_UNKNOWN: |
3563 | 12 | col_clear(pinfo->cinfo, COL_INFO); |
3564 | 12 | break; |
3565 | | |
3566 | 0 | default: |
3567 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ", |
3568 | 0 | pinfo->p2p_dir); |
3569 | 0 | break; |
3570 | 12 | } |
3571 | | |
3572 | 12 | ti = proto_tree_add_item(tree, proto_bta2dp, tvb, offset, -1, ENC_NA); |
3573 | 12 | col_append_fstr(pinfo->cinfo, COL_INFO, "Audio stream - %s", |
3574 | 12 | val_to_str_const(sep_data.codec, media_codec_audio_type_vals, "unknown codec")); |
3575 | | |
3576 | 12 | bta2dp_tree = proto_item_add_subtree(ti, ett_bta2dp); |
3577 | | |
3578 | 12 | pitem = proto_tree_add_uint(bta2dp_tree, hf_bta2dp_acp_seid, tvb, 0, 0, sep_data.acp_seid); |
3579 | 12 | proto_item_set_generated(pitem); |
3580 | | |
3581 | 12 | pitem = proto_tree_add_uint(bta2dp_tree, hf_bta2dp_int_seid, tvb, 0, 0, sep_data.int_seid); |
3582 | 12 | proto_item_set_generated(pitem); |
3583 | | |
3584 | 12 | pitem = proto_tree_add_uint(bta2dp_tree, hf_bta2dp_codec, tvb, 0, 0, sep_data.codec); |
3585 | 12 | proto_item_set_generated(pitem); |
3586 | | |
3587 | 12 | if (sep_data.codec == 0xFF) { /* Vendor Specific Codec */ |
3588 | 0 | pitem = proto_tree_add_uint(bta2dp_tree, hf_bta2dp_vendor_id, tvb, 0, 0, sep_data.vendor_id); |
3589 | 0 | proto_item_set_generated(pitem); |
3590 | |
|
3591 | 0 | pitem = proto_tree_add_uint(bta2dp_tree, hf_bta2dp_vendor_codec_id, tvb, 0, 0, sep_data.vendor_codec); |
3592 | 0 | proto_item_set_generated(pitem); |
3593 | |
|
3594 | 0 | if ((sep_data.vendor_id == 0x004F && sep_data.vendor_codec == VENDOR_APT_CODEC_ID_APT_X) || |
3595 | 0 | (sep_data.vendor_id == 0x00D7 && sep_data.vendor_codec == VENDOR_APT_CODEC_ID_APT_X_HD)) |
3596 | 0 | codec_dissector = aptx_handle; |
3597 | |
|
3598 | 0 | if (sep_data.vendor_id == 0x012D && sep_data.vendor_codec == VENDOR_SONY_CODEC_ID_LDAC) |
3599 | 0 | codec_dissector = ldac_handle; |
3600 | 0 | } |
3601 | | |
3602 | 12 | if (sep_data.content_protection_type > 0) { |
3603 | 0 | pitem = proto_tree_add_uint(bta2dp_tree, hf_bta2dp_content_protection, tvb, 0, 0, sep_data.content_protection_type); |
3604 | 0 | proto_item_set_generated(pitem); |
3605 | 0 | } |
3606 | | |
3607 | 12 | if (sep_data.stream_start_in_frame > 0) { |
3608 | 0 | pitem = proto_tree_add_uint(bta2dp_tree, hf_bta2dp_stream_start_in_frame, tvb, 0, 0, sep_data.stream_start_in_frame); |
3609 | 0 | proto_item_set_generated(pitem); |
3610 | 0 | } |
3611 | | |
3612 | 12 | if (sep_data.stream_end_in_frame > 0) { |
3613 | 0 | pitem = proto_tree_add_uint(bta2dp_tree, hf_bta2dp_stream_end_in_frame, tvb, 0, 0, sep_data.stream_end_in_frame); |
3614 | 0 | proto_item_set_generated(pitem); |
3615 | 0 | } |
3616 | | |
3617 | 12 | pitem = proto_tree_add_uint(bta2dp_tree, hf_bta2dp_stream_number, tvb, 0, 0, sep_data.stream_number); |
3618 | 12 | proto_item_set_generated(pitem); |
3619 | | |
3620 | 12 | switch (sep_data.codec) { |
3621 | 12 | case CODEC_SBC: |
3622 | 12 | codec_dissector = sbc_handle; |
3623 | 12 | break; |
3624 | 0 | case CODEC_MPEG12_AUDIO: |
3625 | 0 | codec_dissector = mp2t_handle; |
3626 | 0 | break; |
3627 | 0 | case CODEC_MPEG24_AAC: |
3628 | 0 | codec_dissector = mpeg_audio_handle; |
3629 | 0 | break; |
3630 | 0 | case CODEC_ATRAC: |
3631 | 0 | codec_dissector = atrac_handle; |
3632 | 0 | break; |
3633 | 0 | case CODEC_APT_X: |
3634 | 0 | case CODEC_APT_X_HD: |
3635 | 0 | codec_dissector = aptx_handle; |
3636 | 0 | break; |
3637 | 0 | case CODEC_LDAC: |
3638 | 0 | codec_dissector = ldac_handle; |
3639 | 0 | break; |
3640 | 12 | } |
3641 | | |
3642 | 12 | bta2dp_codec_info.codec_dissector = codec_dissector; |
3643 | 12 | bta2dp_codec_info.configuration_length = sep_data.configuration_length; |
3644 | 12 | bta2dp_codec_info.configuration = sep_data.configuration; |
3645 | 12 | bta2dp_codec_info.content_protection_type = sep_data.content_protection_type; |
3646 | 12 | bta2dp_codec_info.previous_media_packet_info = sep_data.previous_media_packet_info; |
3647 | 12 | bta2dp_codec_info.current_media_packet_info = sep_data.current_media_packet_info; |
3648 | | |
3649 | 12 | #if RTP_PLAYER_WORKAROUND == true |
3650 | | /* XXX: Workaround to get multiple RTP streams, because conversations are too |
3651 | | weak to recognize Bluetooth streams (key is: uint32_t interface_id, uint32_t adapter_id, uint32_t chandle, uint32_t cid, uint32_t direction -> uint32_t stream_number) */ |
3652 | 12 | pinfo->srcport = sep_data.stream_number; |
3653 | 12 | pinfo->destport = sep_data.stream_number; |
3654 | 12 | #endif |
3655 | | |
3656 | 12 | if (bta2dp_codec_info.content_protection_type == 0 && codec_dissector == aptx_handle) { |
3657 | 0 | call_dissector_with_data(aptx_handle, tvb, pinfo, tree, &bta2dp_codec_info); |
3658 | 12 | } else { |
3659 | 12 | bluetooth_add_address(pinfo, &pinfo->net_dst, sep_data.stream_number, "BT A2DP", pinfo->num, RTP_MEDIA_AUDIO, &bta2dp_codec_info); |
3660 | 12 | call_dissector(rtp_handle, tvb, pinfo, tree); |
3661 | 12 | } |
3662 | 12 | offset += tvb_reported_length_remaining(tvb, offset); |
3663 | | |
3664 | 12 | return offset; |
3665 | 12 | } |
3666 | | |
3667 | | void |
3668 | | proto_register_bta2dp(void) |
3669 | 14 | { |
3670 | 14 | module_t *module; |
3671 | | |
3672 | 14 | static hf_register_info hf[] = { |
3673 | 14 | { &hf_bta2dp_acp_seid, |
3674 | 14 | { "ACP SEID", "bta2dp.acp_seid", |
3675 | 14 | FT_UINT8, BASE_DEC, NULL, 0x00, |
3676 | 14 | NULL, HFILL } |
3677 | 14 | }, |
3678 | 14 | { &hf_bta2dp_int_seid, |
3679 | 14 | { "INT SEID", "bta2dp.int_seid", |
3680 | 14 | FT_UINT8, BASE_DEC, NULL, 0x00, |
3681 | 14 | NULL, HFILL } |
3682 | 14 | }, |
3683 | 14 | { &hf_bta2dp_codec, |
3684 | 14 | { "Codec", "bta2dp.codec", |
3685 | 14 | FT_UINT8, BASE_HEX, VALS(media_codec_audio_type_vals), 0x00, |
3686 | 14 | NULL, HFILL } |
3687 | 14 | }, |
3688 | 14 | { &hf_bta2dp_vendor_id, |
3689 | 14 | { "Vendor ID", "bta2dp.codec.vendor.vendor_id", |
3690 | 14 | FT_UINT32, BASE_HEX|BASE_EXT_STRING, &bluetooth_company_id_vals_ext, 0x00, |
3691 | 14 | NULL, HFILL } |
3692 | 14 | }, |
3693 | 14 | { &hf_bta2dp_vendor_codec_id, |
3694 | 14 | { "Vendor Codec", "bta2dp.codec.vendor.codec_id", |
3695 | 14 | FT_UINT16, BASE_HEX, NULL, 0x00, |
3696 | 14 | NULL, HFILL } |
3697 | 14 | }, |
3698 | 14 | { &hf_bta2dp_content_protection, |
3699 | 14 | { "Content Protection", "bta2dp.content_protection", |
3700 | 14 | FT_UINT16, BASE_HEX, VALS(content_protection_type_vals), 0x0, |
3701 | 14 | NULL, HFILL } |
3702 | 14 | }, |
3703 | 14 | { &hf_bta2dp_stream_start_in_frame, |
3704 | 14 | { "Stream Start in Frame", "bta2dp.stream_start_in_frame", |
3705 | 14 | FT_FRAMENUM, BASE_NONE, NULL, 0x00, |
3706 | 14 | NULL, HFILL } |
3707 | 14 | }, |
3708 | 14 | { &hf_bta2dp_stream_end_in_frame, |
3709 | 14 | { "Stream End in Frame", "bta2dp.stream_end_in_frame", |
3710 | 14 | FT_FRAMENUM, BASE_NONE, NULL, 0x00, |
3711 | 14 | NULL, HFILL } |
3712 | 14 | }, |
3713 | 14 | { &hf_bta2dp_stream_number, |
3714 | 14 | { "Stream Number", "bta2dp.stream_number", |
3715 | 14 | FT_UINT32, BASE_DEC, NULL, 0x00, |
3716 | 14 | NULL, HFILL } |
3717 | 14 | } |
3718 | 14 | }; |
3719 | | |
3720 | 14 | static int *ett[] = { |
3721 | 14 | &ett_bta2dp |
3722 | 14 | }; |
3723 | | |
3724 | 14 | proto_bta2dp = proto_register_protocol("Bluetooth A2DP Profile", "BT A2DP", "bta2dp"); |
3725 | 14 | proto_register_field_array(proto_bta2dp, hf, array_length(hf)); |
3726 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
3727 | | |
3728 | 14 | bta2dp_handle = register_dissector("bta2dp", dissect_bta2dp, proto_bta2dp); |
3729 | | |
3730 | 14 | module = prefs_register_protocol_subtree("Bluetooth", proto_bta2dp, NULL); |
3731 | 14 | prefs_register_static_text_preference(module, "a2dp.version", |
3732 | 14 | "Bluetooth Profile A2DP version: 1.3", |
3733 | 14 | "Version of profile supported by this dissector."); |
3734 | | |
3735 | 14 | prefs_register_bool_preference(module, "a2dp.content_protection.scms_t", |
3736 | 14 | "Force SCMS-T decoding", |
3737 | 14 | "Force decoding stream as A2DP with Content Protection SCMS-T ", |
3738 | 14 | &force_a2dp_scms_t); |
3739 | | |
3740 | 14 | prefs_register_enum_preference(module, "a2dp.codec", |
3741 | 14 | "Force codec", |
3742 | 14 | "Force decoding stream as A2DP with specified codec", |
3743 | 14 | &force_a2dp_codec, pref_a2dp_codec, false); |
3744 | 14 | } |
3745 | | |
3746 | | void |
3747 | | proto_reg_handoff_bta2dp(void) |
3748 | 14 | { |
3749 | 14 | sbc_handle = find_dissector_add_dependency("sbc", proto_bta2dp); |
3750 | 14 | mp2t_handle = find_dissector_add_dependency("mp2t", proto_bta2dp); |
3751 | 14 | mpeg_audio_handle = find_dissector_add_dependency("mpeg-audio", proto_bta2dp); |
3752 | | /* TODO: ATRAC dissector does not exist yet */ |
3753 | 14 | atrac_handle = find_dissector_add_dependency("atrac", proto_bta2dp); |
3754 | | |
3755 | 14 | rtp_handle = find_dissector_add_dependency("rtp", proto_bta2dp); |
3756 | | |
3757 | 14 | dissector_add_string("bluetooth.uuid", "110a", bta2dp_handle); |
3758 | 14 | dissector_add_string("bluetooth.uuid", "110b", bta2dp_handle); |
3759 | 14 | dissector_add_string("bluetooth.uuid", "110d", bta2dp_handle); |
3760 | | |
3761 | 14 | dissector_add_for_decode_as("btl2cap.cid", bta2dp_handle); |
3762 | 14 | } |
3763 | | |
3764 | | static int |
3765 | | dissect_btvdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
3766 | 0 | { |
3767 | 0 | proto_item *ti; |
3768 | 0 | proto_tree *btvdp_tree; |
3769 | 0 | proto_item *pitem; |
3770 | 0 | int offset = 0; |
3771 | 0 | dissector_handle_t codec_dissector = NULL; |
3772 | 0 | btvdp_codec_info_t btvdp_codec_info; |
3773 | 0 | sep_data_t sep_data; |
3774 | 0 | bool no_avdtp_session; |
3775 | |
|
3776 | 0 | no_avdtp_session = (proto_btavdtp != (int) GPOINTER_TO_UINT(wmem_list_frame_data( |
3777 | 0 | wmem_list_frame_prev(wmem_list_tail(pinfo->layers))))); |
3778 | |
|
3779 | 0 | sep_data.codec = CODEC_H263_BASELINE; |
3780 | 0 | sep_data.content_protection_type = 0; |
3781 | 0 | sep_data.acp_seid = 0; |
3782 | 0 | sep_data.int_seid = 0; |
3783 | 0 | sep_data.previous_media_packet_info = NULL; |
3784 | 0 | sep_data.current_media_packet_info = NULL; |
3785 | 0 | sep_data.stream_start_in_frame = 0; |
3786 | 0 | sep_data.stream_end_in_frame = 0; |
3787 | 0 | sep_data.stream_number = 1; |
3788 | 0 | sep_data.vendor_id = 0; |
3789 | 0 | sep_data.vendor_codec = 0; |
3790 | 0 | sep_data.configuration_length = 0; |
3791 | 0 | sep_data.configuration = NULL; |
3792 | |
|
3793 | 0 | if (force_vdp_scms_t || force_vdp_codec) { |
3794 | 0 | if (force_vdp_scms_t) |
3795 | 0 | sep_data.content_protection_type = 2; |
3796 | 0 | else if (data && !no_avdtp_session) |
3797 | 0 | sep_data.content_protection_type = ((sep_data_t *) data)->content_protection_type; |
3798 | |
|
3799 | 0 | if (force_vdp_codec) |
3800 | 0 | sep_data.codec = force_vdp_codec; |
3801 | 0 | else if (data && !no_avdtp_session) |
3802 | 0 | sep_data.codec = ((sep_data_t *) data)->codec; |
3803 | 0 | } else { |
3804 | 0 | if (data && !no_avdtp_session) |
3805 | 0 | sep_data = *((sep_data_t *) data); |
3806 | 0 | } |
3807 | |
|
3808 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "VDP"); |
3809 | |
|
3810 | 0 | switch (pinfo->p2p_dir) { |
3811 | | |
3812 | 0 | case P2P_DIR_SENT: |
3813 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Sent "); |
3814 | 0 | break; |
3815 | | |
3816 | 0 | case P2P_DIR_RECV: |
3817 | 0 | col_set_str(pinfo->cinfo, COL_INFO, "Rcvd "); |
3818 | 0 | break; |
3819 | | |
3820 | 0 | case P2P_DIR_UNKNOWN: |
3821 | 0 | col_clear(pinfo->cinfo, COL_INFO); |
3822 | 0 | break; |
3823 | | |
3824 | 0 | default: |
3825 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ", |
3826 | 0 | pinfo->p2p_dir); |
3827 | 0 | break; |
3828 | 0 | } |
3829 | | |
3830 | 0 | ti = proto_tree_add_item(tree, proto_btvdp, tvb, offset, -1, ENC_NA); |
3831 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, "Video stream - %s", |
3832 | 0 | val_to_str_const(sep_data.codec, media_codec_video_type_vals, "unknown codec")); |
3833 | |
|
3834 | 0 | btvdp_tree = proto_item_add_subtree(ti, ett_btvdp); |
3835 | |
|
3836 | 0 | pitem = proto_tree_add_uint(btvdp_tree, hf_btvdp_acp_seid, tvb, 0, 0, sep_data.acp_seid); |
3837 | 0 | proto_item_set_generated(pitem); |
3838 | |
|
3839 | 0 | pitem = proto_tree_add_uint(btvdp_tree, hf_btvdp_int_seid, tvb, 0, 0, sep_data.int_seid); |
3840 | 0 | proto_item_set_generated(pitem); |
3841 | |
|
3842 | 0 | pitem = proto_tree_add_uint(btvdp_tree, hf_btvdp_codec, tvb, 0, 0, sep_data.codec); |
3843 | 0 | proto_item_set_generated(pitem); |
3844 | |
|
3845 | 0 | if (sep_data.codec == 0xFF) { /* Vendor Specific Codec */ |
3846 | 0 | pitem = proto_tree_add_uint(btvdp_tree, hf_btvdp_vendor_id, tvb, 0, 0, sep_data.vendor_id); |
3847 | 0 | proto_item_set_generated(pitem); |
3848 | |
|
3849 | 0 | pitem = proto_tree_add_uint(btvdp_tree, hf_btvdp_vendor_codec_id, tvb, 0, 0, sep_data.vendor_codec); |
3850 | 0 | proto_item_set_generated(pitem); |
3851 | 0 | } |
3852 | |
|
3853 | 0 | if (sep_data.content_protection_type > 0) { |
3854 | 0 | pitem = proto_tree_add_uint(btvdp_tree, hf_btvdp_content_protection, tvb, 0, 0, sep_data.content_protection_type); |
3855 | 0 | proto_item_set_generated(pitem); |
3856 | 0 | } |
3857 | |
|
3858 | 0 | if (sep_data.stream_start_in_frame > 0) { |
3859 | 0 | pitem = proto_tree_add_uint(btvdp_tree, hf_btvdp_stream_start_in_frame, tvb, 0, 0, sep_data.stream_start_in_frame); |
3860 | 0 | proto_item_set_generated(pitem); |
3861 | 0 | } |
3862 | |
|
3863 | 0 | if (sep_data.stream_end_in_frame > 0) { |
3864 | 0 | pitem = proto_tree_add_uint(btvdp_tree, hf_btvdp_stream_end_in_frame, tvb, 0, 0, sep_data.stream_end_in_frame); |
3865 | 0 | proto_item_set_generated(pitem); |
3866 | 0 | } |
3867 | |
|
3868 | 0 | pitem = proto_tree_add_uint(btvdp_tree, hf_btvdp_stream_number, tvb, 0, 0, sep_data.stream_number); |
3869 | 0 | proto_item_set_generated(pitem); |
3870 | |
|
3871 | 0 | switch (sep_data.codec) { |
3872 | 0 | case CODEC_H263_BASELINE: |
3873 | 0 | case CODEC_H263_PROFILE_3: |
3874 | 0 | case CODEC_H263_PROFILE_8: |
3875 | 0 | codec_dissector = h263_handle; |
3876 | 0 | break; |
3877 | 0 | case CODEC_MPEG4_VSP: |
3878 | 0 | codec_dissector = mp4v_es_handle; |
3879 | 0 | break; |
3880 | 0 | } |
3881 | | |
3882 | 0 | btvdp_codec_info.codec_dissector = codec_dissector; |
3883 | 0 | btvdp_codec_info.content_protection_type = sep_data.content_protection_type; |
3884 | |
|
3885 | 0 | #if RTP_PLAYER_WORKAROUND == true |
3886 | | /* XXX: Workaround to get multiple RTP streams, because conversations are too |
3887 | | weak to recognize Bluetooth streams (key is: uint32_t interface_id, uint32_t adapter_id, uint32_t chandle, uint32_t cid, uint32_t direction -> uint32_t stream_number) */ |
3888 | 0 | pinfo->srcport = sep_data.stream_number; |
3889 | 0 | pinfo->destport = sep_data.stream_number; |
3890 | 0 | #endif |
3891 | |
|
3892 | 0 | bluetooth_add_address(pinfo, &pinfo->net_dst, 0, "BT VDP", pinfo->num, RTP_MEDIA_VIDEO, &btvdp_codec_info); |
3893 | 0 | call_dissector(rtp_handle, tvb, pinfo, tree); |
3894 | 0 | offset += tvb_reported_length_remaining(tvb, offset); |
3895 | |
|
3896 | 0 | return offset; |
3897 | 0 | } |
3898 | | |
3899 | | void |
3900 | | proto_register_btvdp(void) |
3901 | 14 | { |
3902 | 14 | module_t *module; |
3903 | 14 | expert_module_t* expert_btavdtp; |
3904 | | |
3905 | 14 | static hf_register_info hf[] = { |
3906 | 14 | { &hf_btvdp_acp_seid, |
3907 | 14 | { "ACP SEID", "btvdp.acp_seid", |
3908 | 14 | FT_UINT8, BASE_DEC, NULL, 0x00, |
3909 | 14 | NULL, HFILL } |
3910 | 14 | }, |
3911 | 14 | { &hf_btvdp_int_seid, |
3912 | 14 | { "INT SEID", "btvdp.int_seid", |
3913 | 14 | FT_UINT8, BASE_DEC, NULL, 0x00, |
3914 | 14 | NULL, HFILL } |
3915 | 14 | }, |
3916 | 14 | { &hf_btvdp_codec, |
3917 | 14 | { "Codec", "btvdp.codec", |
3918 | 14 | FT_UINT8, BASE_HEX, VALS(media_codec_video_type_vals), 0x00, |
3919 | 14 | NULL, HFILL } |
3920 | 14 | }, |
3921 | 14 | { &hf_btvdp_vendor_id, |
3922 | 14 | { "Vendor ID", "btvdp.codec.vendor.vendor_id", |
3923 | 14 | FT_UINT32, BASE_HEX|BASE_EXT_STRING, &bluetooth_company_id_vals_ext, 0x00, |
3924 | 14 | NULL, HFILL } |
3925 | 14 | }, |
3926 | 14 | { &hf_btvdp_vendor_codec_id, |
3927 | 14 | { "Vendor Codec", "btvdp.codec.vendor.codec_id", |
3928 | 14 | FT_UINT16, BASE_HEX, NULL, 0x00, |
3929 | 14 | NULL, HFILL } |
3930 | 14 | }, |
3931 | 14 | { &hf_btvdp_content_protection, |
3932 | 14 | { "Content Protection", "btvdp.content_protection", |
3933 | 14 | FT_UINT16, BASE_HEX, VALS(content_protection_type_vals), 0x0, |
3934 | 14 | NULL, HFILL } |
3935 | 14 | }, |
3936 | 14 | { &hf_btvdp_stream_start_in_frame, |
3937 | 14 | { "Stream Start in Frame", "btvdp.stream_start_in_frame", |
3938 | 14 | FT_FRAMENUM, BASE_NONE, NULL, 0x00, |
3939 | 14 | NULL, HFILL } |
3940 | 14 | }, |
3941 | 14 | { &hf_btvdp_stream_end_in_frame, |
3942 | 14 | { "Stream End in Frame", "btvdp.stream_end_in_frame", |
3943 | 14 | FT_FRAMENUM, BASE_NONE, NULL, 0x00, |
3944 | 14 | NULL, HFILL } |
3945 | 14 | }, |
3946 | 14 | { &hf_btvdp_stream_number, |
3947 | 14 | { "Stream Number", "btvdp.stream_number", |
3948 | 14 | FT_UINT32, BASE_DEC, NULL, 0x00, |
3949 | 14 | NULL, HFILL } |
3950 | 14 | }, |
3951 | 14 | }; |
3952 | | |
3953 | 14 | static int *ett[] = { |
3954 | 14 | &ett_btvdp |
3955 | 14 | }; |
3956 | | |
3957 | 14 | static ei_register_info ei[] = { |
3958 | 14 | { &ei_btavdtp_sbc_min_bitpool_out_of_range, { "btavdtp.codec.sbc.minimum_bitpool.out_of_range", PI_PROTOCOL, PI_WARN, "Bitpool is out of range. Should be 2..250.", EXPFILL }}, |
3959 | 14 | { &ei_btavdtp_sbc_max_bitpool_out_of_range, { "btavdtp.codec.sbc.maximum_bitpool.out_of_range", PI_PROTOCOL, PI_WARN, "Bitpool is out of range. Should be 2..250.", EXPFILL }}, |
3960 | 14 | { &ei_btavdtp_unexpected_losc_data, { "btavdtp.unexpected_losc_data", PI_PROTOCOL, PI_WARN, "Unexpected losc data", EXPFILL }}, |
3961 | 14 | }; |
3962 | | |
3963 | 14 | proto_btvdp = proto_register_protocol("Bluetooth VDP Profile", "BT VDP", "btvdp"); |
3964 | 14 | btvdp_handle = register_dissector("btvdp", dissect_btvdp, proto_btvdp); |
3965 | 14 | proto_register_field_array(proto_btvdp, hf, array_length(hf)); |
3966 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
3967 | 14 | expert_btavdtp = expert_register_protocol(proto_btvdp); |
3968 | 14 | expert_register_field_array(expert_btavdtp, ei, array_length(ei)); |
3969 | | |
3970 | 14 | module = prefs_register_protocol_subtree("Bluetooth", proto_btvdp, NULL); |
3971 | 14 | prefs_register_static_text_preference(module, "vdp.version", |
3972 | 14 | "Bluetooth Profile VDP version: 1.1", |
3973 | 14 | "Version of profile supported by this dissector."); |
3974 | | |
3975 | 14 | prefs_register_bool_preference(module, "vdp.content_protection.scms_t", |
3976 | 14 | "Force SCMS-T decoding", |
3977 | 14 | "Force decoding stream as VDP with Content Protection SCMS-T ", |
3978 | 14 | &force_vdp_scms_t); |
3979 | | |
3980 | 14 | prefs_register_enum_preference(module, "vdp.codec", |
3981 | 14 | "Force codec", |
3982 | 14 | "Force decoding stream as VDP with specified codec", |
3983 | 14 | &force_vdp_codec, pref_vdp_codec, false); |
3984 | 14 | } |
3985 | | |
3986 | | void |
3987 | | proto_reg_handoff_btvdp(void) |
3988 | 14 | { |
3989 | 14 | h263_handle = find_dissector_add_dependency("h263", proto_btvdp); |
3990 | 14 | mp4v_es_handle = find_dissector_add_dependency("mp4v-es", proto_btvdp); |
3991 | | |
3992 | 14 | rtp_handle = find_dissector_add_dependency("rtp", proto_btvdp); |
3993 | | |
3994 | 14 | dissector_add_string("bluetooth.uuid", "1303", btvdp_handle); |
3995 | 14 | dissector_add_string("bluetooth.uuid", "1304", btvdp_handle); |
3996 | 14 | dissector_add_string("bluetooth.uuid", "1305", btvdp_handle); |
3997 | | |
3998 | 14 | dissector_add_for_decode_as("btl2cap.cid", btvdp_handle); |
3999 | 14 | } |
4000 | | |
4001 | | |
4002 | | |
4003 | | static int |
4004 | | dissect_a2dp_cp_scms_t(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_) |
4005 | 0 | { |
4006 | 0 | proto_item *main_item; |
4007 | 0 | proto_tree *main_tree; |
4008 | 0 | int offset = 0; |
4009 | |
|
4010 | 0 | main_item = proto_tree_add_item(tree, proto_bta2dp_cph_scms_t, tvb, offset, 1, ENC_NA); |
4011 | 0 | main_tree = proto_item_add_subtree(main_item, ett_bta2dp_cph_scms_t); |
4012 | |
|
4013 | 0 | proto_tree_add_item(main_tree, hf_bta2dp_reserved , tvb, offset, 1, ENC_NA); |
4014 | 0 | proto_tree_add_item(main_tree, hf_bta2dp_cp_bit, tvb, offset, 1, ENC_NA); |
4015 | 0 | proto_tree_add_item(main_tree, hf_bta2dp_l_bit , tvb, offset, 1, ENC_NA); |
4016 | 0 | offset += 1; |
4017 | |
|
4018 | 0 | return offset; |
4019 | 0 | } |
4020 | | |
4021 | | void |
4022 | | proto_register_bta2dp_content_protection_header_scms_t(void) |
4023 | 14 | { |
4024 | 14 | static hf_register_info hf[] = { |
4025 | 14 | { &hf_bta2dp_l_bit, |
4026 | 14 | { "L-bit", "bta2dp.content_protection_header.scms_t.l_bit", |
4027 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
4028 | 14 | NULL, HFILL } |
4029 | 14 | }, |
4030 | 14 | { &hf_bta2dp_cp_bit, |
4031 | 14 | { "Cp-bit", "bta2dp.content_protection_header.scms_t.cp_bit", |
4032 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
4033 | 14 | NULL, HFILL } |
4034 | 14 | }, |
4035 | 14 | { &hf_bta2dp_reserved, |
4036 | 14 | { "Reserved", "bta2dp.content_protection_header.scms_t.reserved", |
4037 | 14 | FT_BOOLEAN, 8, NULL, 0xFC, |
4038 | 14 | NULL, HFILL } |
4039 | 14 | } |
4040 | 14 | }; |
4041 | | |
4042 | 14 | static int *ett[] = { |
4043 | 14 | &ett_bta2dp_cph_scms_t |
4044 | 14 | }; |
4045 | | |
4046 | 14 | proto_bta2dp_cph_scms_t = proto_register_protocol("Bluetooth A2DP Content Protection Header SCMS-T", "BT A2DP Content Protection Header SCMS-T", "bta2dp_content_protection_header_scms_t"); |
4047 | 14 | proto_register_field_array(proto_bta2dp_cph_scms_t, hf, array_length(hf)); |
4048 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
4049 | | |
4050 | 14 | register_dissector("bta2dp_content_protection_header_scms_t", dissect_a2dp_cp_scms_t, proto_bta2dp_cph_scms_t); |
4051 | 14 | } |
4052 | | |
4053 | | static int |
4054 | | dissect_vdp_cp_scms_t(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_) |
4055 | 0 | { |
4056 | 0 | proto_item *main_item; |
4057 | 0 | proto_tree *main_tree; |
4058 | 0 | int offset = 0; |
4059 | |
|
4060 | 0 | main_item = proto_tree_add_item(tree, proto_btvdp_cph_scms_t, tvb, offset, 1, ENC_NA); |
4061 | 0 | main_tree = proto_item_add_subtree(main_item, ett_btvdp_cph_scms_t); |
4062 | |
|
4063 | 0 | proto_tree_add_item(main_tree, hf_btvdp_reserved , tvb, offset, 1, ENC_NA); |
4064 | 0 | proto_tree_add_item(main_tree, hf_btvdp_cp_bit, tvb, offset, 1, ENC_NA); |
4065 | 0 | proto_tree_add_item(main_tree, hf_btvdp_l_bit , tvb, offset, 1, ENC_NA); |
4066 | 0 | offset += 1; |
4067 | |
|
4068 | 0 | return offset; |
4069 | 0 | } |
4070 | | |
4071 | | void |
4072 | | proto_register_btvdp_content_protection_header_scms_t(void) |
4073 | 14 | { |
4074 | 14 | static hf_register_info hf[] = { |
4075 | 14 | { &hf_btvdp_l_bit, |
4076 | 14 | { "L-bit", "btvdp.content_protection_header.scms_t.l_bit", |
4077 | 14 | FT_BOOLEAN, 8, NULL, 0x01, |
4078 | 14 | NULL, HFILL } |
4079 | 14 | }, |
4080 | 14 | { &hf_btvdp_cp_bit, |
4081 | 14 | { "Cp-bit", "btvdp.content_protection_header.scms_t.cp_bit", |
4082 | 14 | FT_BOOLEAN, 8, NULL, 0x02, |
4083 | 14 | NULL, HFILL } |
4084 | 14 | }, |
4085 | 14 | { &hf_btvdp_reserved, |
4086 | 14 | { "Reserved", "btvdp.content_protection_header.scms_t.reserved", |
4087 | 14 | FT_BOOLEAN, 8, NULL, 0xFC, |
4088 | 14 | NULL, HFILL } |
4089 | 14 | } |
4090 | 14 | }; |
4091 | | |
4092 | 14 | static int *ett[] = { |
4093 | 14 | &ett_btvdp_cph_scms_t |
4094 | 14 | }; |
4095 | | |
4096 | 14 | proto_btvdp_cph_scms_t = proto_register_protocol("Bluetooth VDP Content Protection Header SCMS-T", "BT VDP Content Protection Header SCMS-T", "btvdp_content_protection_header_scms_t"); |
4097 | 14 | proto_register_field_array(proto_btvdp_cph_scms_t, hf, array_length(hf)); |
4098 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
4099 | | |
4100 | 14 | register_dissector("btvdp_content_protection_header_scms_t", dissect_vdp_cp_scms_t, proto_btvdp_cph_scms_t); |
4101 | 14 | } |
4102 | | |
4103 | | /* |
4104 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
4105 | | * |
4106 | | * Local variables: |
4107 | | * c-basic-offset: 4 |
4108 | | * tab-width: 8 |
4109 | | * indent-tabs-mode: nil |
4110 | | * End: |
4111 | | * |
4112 | | * vi: set shiftwidth=4 tabstop=8 expandtab: |
4113 | | * :indentSize=4:tabSize=8:noTabs=true: |
4114 | | */ |