1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-mpeg-audio.c */
4 /* asn2wrs.py -q -L -p mpeg-audio -c ./mpeg-audio.cnf -s ./packet-mpeg-audio-template -D . -O ../.. mpeg-audio.asn */
6 /* MPEG audio packet decoder.
7 * Written by Shaun Jackman <sjackman@gmail.com>.
8 * Copyright 2007 Shaun Jackman
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
13 * SPDX-License-Identifier: GPL-2.0-or-later
18 #include <epan/packet.h>
19 #include <epan/asn1.h>
21 #include <wsutil/mpeg-audio.h>
22 #include <wsutil/array.h>
24 #include "packet-per.h"
26 static int hf_mpeg_audio_sync
; /* BIT_STRING_SIZE_11 */
27 static int hf_mpeg_audio_version
; /* T_version */
28 static int hf_mpeg_audio_layer
; /* T_layer */
29 static int hf_mpeg_audio_protection
; /* T_protection */
30 static int hf_mpeg_audio_bitrate
; /* INTEGER_0_15 */
31 static int hf_mpeg_audio_frequency
; /* INTEGER_0_3 */
32 static int hf_mpeg_audio_padding
; /* BOOLEAN */
33 static int hf_mpeg_audio_private
; /* BOOLEAN */
34 static int hf_mpeg_audio_channel_mode
; /* T_channel_mode */
35 static int hf_mpeg_audio_mode_extension
; /* INTEGER_0_3 */
36 static int hf_mpeg_audio_copyright
; /* BOOLEAN */
37 static int hf_mpeg_audio_original
; /* BOOLEAN */
38 static int hf_mpeg_audio_emphasis
; /* T_emphasis */
39 static int hf_mpeg_audio_tag
; /* OCTET_STRING_SIZE_3 */
40 static int hf_mpeg_audio_title
; /* OCTET_STRING_SIZE_30 */
41 static int hf_mpeg_audio_artist
; /* OCTET_STRING_SIZE_30 */
42 static int hf_mpeg_audio_album
; /* OCTET_STRING_SIZE_30 */
43 static int hf_mpeg_audio_year
; /* OCTET_STRING_SIZE_4 */
44 static int hf_mpeg_audio_comment
; /* OCTET_STRING_SIZE_28 */
45 static int hf_mpeg_audio_must_be_zero
; /* INTEGER_0_255 */
46 static int hf_mpeg_audio_track
; /* INTEGER_0_255 */
47 static int hf_mpeg_audio_genre
; /* T_genre */
48 static int ett_mpeg_audio_Audio
;
49 static int ett_mpeg_audio_ID3v1
;
53 dissect_mpeg_audio_BIT_STRING_SIZE_11(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
54 offset
= dissect_per_bit_string(tvb
, offset
, actx
, tree
, hf_index
,
55 11, 11, false, NULL
, 0, NULL
, NULL
);
61 static const value_string mpeg_audio_T_version_vals
[] = {
71 dissect_mpeg_audio_T_version(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
72 offset
= dissect_per_enumerated(tvb
, offset
, actx
, tree
, hf_index
,
73 4, NULL
, false, 0, NULL
);
79 static const value_string mpeg_audio_T_layer_vals
[] = {
89 dissect_mpeg_audio_T_layer(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
90 offset
= dissect_per_enumerated(tvb
, offset
, actx
, tree
, hf_index
,
91 4, NULL
, false, 0, NULL
);
97 static const value_string mpeg_audio_T_protection_vals
[] = {
105 dissect_mpeg_audio_T_protection(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
106 offset
= dissect_per_enumerated(tvb
, offset
, actx
, tree
, hf_index
,
107 2, NULL
, false, 0, NULL
);
115 dissect_mpeg_audio_INTEGER_0_15(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
116 offset
= dissect_per_constrained_integer(tvb
, offset
, actx
, tree
, hf_index
,
117 0U, 15U, NULL
, false);
125 dissect_mpeg_audio_INTEGER_0_3(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
126 offset
= dissect_per_constrained_integer(tvb
, offset
, actx
, tree
, hf_index
,
127 0U, 3U, NULL
, false);
135 dissect_mpeg_audio_BOOLEAN(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
136 offset
= dissect_per_boolean(tvb
, offset
, actx
, tree
, hf_index
, NULL
);
142 static const value_string mpeg_audio_T_channel_mode_vals
[] = {
144 { 1, "joint-stereo" },
145 { 2, "dual-channel" },
146 { 3, "single-channel" },
152 dissect_mpeg_audio_T_channel_mode(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
153 offset
= dissect_per_enumerated(tvb
, offset
, actx
, tree
, hf_index
,
154 4, NULL
, false, 0, NULL
);
160 static const value_string mpeg_audio_T_emphasis_vals
[] = {
162 { 1, "em-50-15-ms" },
170 dissect_mpeg_audio_T_emphasis(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
171 offset
= dissect_per_enumerated(tvb
, offset
, actx
, tree
, hf_index
,
172 4, NULL
, false, 0, NULL
);
178 static const per_sequence_t Audio_sequence
[] = {
179 { &hf_mpeg_audio_sync
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_BIT_STRING_SIZE_11
},
180 { &hf_mpeg_audio_version
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_T_version
},
181 { &hf_mpeg_audio_layer
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_T_layer
},
182 { &hf_mpeg_audio_protection
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_T_protection
},
183 { &hf_mpeg_audio_bitrate
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_INTEGER_0_15
},
184 { &hf_mpeg_audio_frequency
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_INTEGER_0_3
},
185 { &hf_mpeg_audio_padding
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_BOOLEAN
},
186 { &hf_mpeg_audio_private
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_BOOLEAN
},
187 { &hf_mpeg_audio_channel_mode
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_T_channel_mode
},
188 { &hf_mpeg_audio_mode_extension
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_INTEGER_0_3
},
189 { &hf_mpeg_audio_copyright
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_BOOLEAN
},
190 { &hf_mpeg_audio_original
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_BOOLEAN
},
191 { &hf_mpeg_audio_emphasis
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_T_emphasis
},
196 dissect_mpeg_audio_Audio(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
197 offset
= dissect_per_sequence(tvb
, offset
, actx
, tree
, hf_index
,
198 ett_mpeg_audio_Audio
, Audio_sequence
);
206 dissect_mpeg_audio_OCTET_STRING_SIZE_3(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
207 offset
= dissect_per_octet_string(tvb
, offset
, actx
, tree
, hf_index
,
216 dissect_mpeg_audio_OCTET_STRING_SIZE_30(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
217 offset
= dissect_per_octet_string(tvb
, offset
, actx
, tree
, hf_index
,
218 30, 30, false, NULL
);
226 dissect_mpeg_audio_OCTET_STRING_SIZE_4(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
227 offset
= dissect_per_octet_string(tvb
, offset
, actx
, tree
, hf_index
,
236 dissect_mpeg_audio_OCTET_STRING_SIZE_28(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
237 offset
= dissect_per_octet_string(tvb
, offset
, actx
, tree
, hf_index
,
238 28, 28, false, NULL
);
246 dissect_mpeg_audio_INTEGER_0_255(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
247 offset
= dissect_per_constrained_integer(tvb
, offset
, actx
, tree
, hf_index
,
248 0U, 255U, NULL
, false);
254 static const value_string mpeg_audio_T_genre_vals
[] = {
256 { 1, "classic-rock" },
274 { 19, "industrial" },
275 { 20, "alternative" },
277 { 22, "death-metal" },
279 { 24, "soundtrack" },
280 { 25, "euro-techno" },
284 { 29, "jazz-and-funk" },
288 { 33, "instrumental" },
292 { 37, "sound-clip" },
295 { 40, "alternative-rock" },
300 { 45, "meditative" },
301 { 46, "instrumental-pop" },
302 { 47, "instrumental-rock" },
306 { 51, "techno-industrial" },
307 { 52, "electronic" },
311 { 56, "southern-rock" },
316 { 61, "christian-rap" },
319 { 64, "native-american" },
322 { 67, "psychedelic" },
333 { 78, "rock-and-roll" },
337 { 82, "national-folk" },
339 { 84, "fast-fusion" },
345 { 90, "avantgarde" },
346 { 91, "gothic-rock" },
347 { 92, "progressive-rock" },
348 { 93, "psychedelic-rock" },
349 { 94, "symphonic-rock" },
353 { 98, "easy-listening" },
359 { 104, "chamber-music" },
362 { 107, "booty-bass" },
364 { 109, "porn-groove" },
372 { 117, "power-ballad" },
373 { 118, "rhythmic-soul" },
374 { 119, "freestyle" },
376 { 121, "punk-rock" },
377 { 122, "drum-solo" },
378 { 123, "a-cappella" },
379 { 124, "euro-house" },
380 { 125, "dance-hall" },
386 dissect_mpeg_audio_T_genre(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
387 offset
= dissect_per_constrained_integer(tvb
, offset
, actx
, tree
, hf_index
,
388 0U, 255U, NULL
, false);
394 static const per_sequence_t ID3v1_sequence
[] = {
395 { &hf_mpeg_audio_tag
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_OCTET_STRING_SIZE_3
},
396 { &hf_mpeg_audio_title
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_OCTET_STRING_SIZE_30
},
397 { &hf_mpeg_audio_artist
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_OCTET_STRING_SIZE_30
},
398 { &hf_mpeg_audio_album
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_OCTET_STRING_SIZE_30
},
399 { &hf_mpeg_audio_year
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_OCTET_STRING_SIZE_4
},
400 { &hf_mpeg_audio_comment
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_OCTET_STRING_SIZE_28
},
401 { &hf_mpeg_audio_must_be_zero
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_INTEGER_0_255
},
402 { &hf_mpeg_audio_track
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_INTEGER_0_255
},
403 { &hf_mpeg_audio_genre
, ASN1_NO_EXTENSIONS
, ASN1_NOT_OPTIONAL
, dissect_mpeg_audio_T_genre
},
408 dissect_mpeg_audio_ID3v1(tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
409 offset
= dissect_per_sequence(tvb
, offset
, actx
, tree
, hf_index
,
410 ett_mpeg_audio_ID3v1
, ID3v1_sequence
);
416 void proto_register_mpeg_audio(void);
417 void proto_reg_handoff_mpeg_audio(void);
419 dissector_handle_t mpeg_audio_handle
;
421 static int proto_mpeg_audio
;
422 static dissector_handle_t id3v2_handle
;
424 static int hf_mpeg_audio_header
;
425 static int hf_mpeg_audio_data
;
426 static int hf_mpeg_audio_padbytes
;
429 static int ett_mpeg_audio
;
432 test_mpeg_audio(tvbuff_t
*tvb
, int offset
)
437 if (!tvb_bytes_exist(tvb
, offset
, 4))
439 if (tvb_strneql(tvb
, offset
, "TAG", 3) == 0)
441 if (tvb_strneql(tvb
, offset
, "ID3", 3) == 0)
444 hdr
= tvb_get_uint32(tvb
, offset
, ENC_BIG_ENDIAN
);
445 MPA_UNMARSHAL(&mpa
, hdr
);
446 return MPA_VALID(&mpa
);
450 mpeg_resync(tvbuff_t
*tvb
, int offset
)
455 /* This only looks to resync on another frame; it doesn't
456 * look for an ID3 tag.
458 offset
= tvb_find_uint8(tvb
, offset
, -1, '\xff');
459 while (offset
!= -1 && tvb_bytes_exist(tvb
, offset
, 4)) {
460 hdr
= tvb_get_uint32(tvb
, offset
, ENC_BIG_ENDIAN
);
461 MPA_UNMARSHAL(&mpa
, hdr
);
462 if (MPA_VALID(&mpa
)) {
465 offset
= tvb_find_uint8(tvb
, offset
+ 1, -1, '\xff');
467 return tvb_reported_length(tvb
);
471 dissect_mpeg_audio_frame(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
478 static const char *version_names
[] = { "1", "2", "2.5" };
480 if (!tvb_bytes_exist(tvb
, 0, 4))
483 h
= tvb_get_ntohl(tvb
, 0);
484 MPA_UNMARSHAL(&mpa
, h
);
485 if (!MPA_SYNC_VALID(&mpa
) || !MPA_VERSION_VALID(&mpa
) || !MPA_LAYER_VALID(&mpa
)) {
489 col_add_fstr(pinfo
->cinfo
, COL_PROTOCOL
,
490 "MPEG-%s", version_names
[mpa_version(&mpa
)]);
491 col_add_fstr(pinfo
->cinfo
, COL_INFO
,
492 "Audio Layer %d", mpa_layer(&mpa
) + 1);
493 if (MPA_BITRATE_VALID(&mpa
) && MPA_FREQUENCY_VALID(&mpa
)) {
494 data_size
= (int)(MPA_DATA_BYTES(&mpa
) - sizeof mpa
);
495 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
497 mpa_bitrate(&mpa
) / 1000,
498 mpa_frequency(&mpa
) / (float)1000);
501 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_PER
, true, pinfo
);
502 offset
= dissect_mpeg_audio_Audio(tvb
, offset
, &asn1_ctx
,
503 tree
, hf_mpeg_audio_header
);
505 unsigned int padding
;
507 proto_tree_add_item(tree
, hf_mpeg_audio_data
, tvb
,
508 offset
/ 8, data_size
, ENC_NA
);
509 offset
+= data_size
* 8;
510 padding
= mpa_padding(&mpa
);
512 proto_tree_add_item(tree
, hf_mpeg_audio_padbytes
, tvb
,
513 offset
/ 8, padding
, ENC_NA
);
514 offset
+= padding
* 8;
521 dissect_id3v1(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
525 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "ID3v1");
526 col_clear(pinfo
->cinfo
, COL_INFO
);
527 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_PER
, true, pinfo
);
528 return dissect_mpeg_audio_ID3v1(tvb
, 0, &asn1_ctx
,
533 dissect_mpeg_audio(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
536 proto_tree
*mpeg_audio_tree
;
538 int magic
, offset
= 0;
542 ti
= proto_tree_add_item(tree
, proto_mpeg_audio
, tvb
, offset
, -1, ENC_NA
);
543 mpeg_audio_tree
= proto_item_add_subtree(ti
, ett_mpeg_audio
);
544 while (tvb_reported_length_remaining(tvb
, offset
) >= 4) {
545 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
546 magic
= tvb_get_ntoh24(next_tvb
, 0);
548 case 0x544147: /* TAG */
549 offset
+= dissect_id3v1(next_tvb
, pinfo
, mpeg_audio_tree
);
551 case 0x494433: /* ID3 */
552 offset
+= call_dissector(id3v2_handle
, tvb
, pinfo
, mpeg_audio_tree
);
555 frame_len
= dissect_mpeg_audio_frame(next_tvb
, pinfo
, mpeg_audio_tree
);
556 if (frame_len
== 0) {
557 frame_len
= mpeg_resync(next_tvb
, 0);
562 return tvb_reported_length(tvb
);
566 dissect_mpeg_audio_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
568 if (!test_mpeg_audio(tvb
, 0)) {
571 dissect_mpeg_audio(tvb
, pinfo
, tree
, data
);
576 proto_register_mpeg_audio(void)
578 static hf_register_info hf
[] = {
579 { &hf_mpeg_audio_sync
,
580 { "sync", "mpeg-audio.sync",
581 FT_BYTES
, BASE_NONE
, NULL
, 0,
582 "BIT_STRING_SIZE_11", HFILL
}},
583 { &hf_mpeg_audio_version
,
584 { "version", "mpeg-audio.version",
585 FT_UINT32
, BASE_DEC
, VALS(mpeg_audio_T_version_vals
), 0,
587 { &hf_mpeg_audio_layer
,
588 { "layer", "mpeg-audio.layer",
589 FT_UINT32
, BASE_DEC
, VALS(mpeg_audio_T_layer_vals
), 0,
591 { &hf_mpeg_audio_protection
,
592 { "protection", "mpeg-audio.protection",
593 FT_UINT32
, BASE_DEC
, VALS(mpeg_audio_T_protection_vals
), 0,
595 { &hf_mpeg_audio_bitrate
,
596 { "bitrate", "mpeg-audio.bitrate",
597 FT_UINT32
, BASE_DEC
, NULL
, 0,
598 "INTEGER_0_15", HFILL
}},
599 { &hf_mpeg_audio_frequency
,
600 { "frequency", "mpeg-audio.frequency",
601 FT_UINT32
, BASE_DEC
, NULL
, 0,
602 "INTEGER_0_3", HFILL
}},
603 { &hf_mpeg_audio_padding
,
604 { "padding", "mpeg-audio.padding",
605 FT_BOOLEAN
, BASE_NONE
, NULL
, 0,
607 { &hf_mpeg_audio_private
,
608 { "private", "mpeg-audio.private",
609 FT_BOOLEAN
, BASE_NONE
, NULL
, 0,
611 { &hf_mpeg_audio_channel_mode
,
612 { "channel-mode", "mpeg-audio.channel_mode",
613 FT_UINT32
, BASE_DEC
, VALS(mpeg_audio_T_channel_mode_vals
), 0,
615 { &hf_mpeg_audio_mode_extension
,
616 { "mode-extension", "mpeg-audio.mode_extension",
617 FT_UINT32
, BASE_DEC
, NULL
, 0,
618 "INTEGER_0_3", HFILL
}},
619 { &hf_mpeg_audio_copyright
,
620 { "copyright", "mpeg-audio.copyright",
621 FT_BOOLEAN
, BASE_NONE
, NULL
, 0,
623 { &hf_mpeg_audio_original
,
624 { "original", "mpeg-audio.original",
625 FT_BOOLEAN
, BASE_NONE
, NULL
, 0,
627 { &hf_mpeg_audio_emphasis
,
628 { "emphasis", "mpeg-audio.emphasis",
629 FT_UINT32
, BASE_DEC
, VALS(mpeg_audio_T_emphasis_vals
), 0,
631 { &hf_mpeg_audio_tag
,
632 { "tag", "mpeg-audio.tag",
633 FT_STRING
, BASE_NONE
, NULL
, 0,
634 "OCTET_STRING_SIZE_3", HFILL
}},
635 { &hf_mpeg_audio_title
,
636 { "title", "mpeg-audio.title",
637 FT_STRING
, BASE_NONE
, NULL
, 0,
638 "OCTET_STRING_SIZE_30", HFILL
}},
639 { &hf_mpeg_audio_artist
,
640 { "artist", "mpeg-audio.artist",
641 FT_STRING
, BASE_NONE
, NULL
, 0,
642 "OCTET_STRING_SIZE_30", HFILL
}},
643 { &hf_mpeg_audio_album
,
644 { "album", "mpeg-audio.album",
645 FT_STRING
, BASE_NONE
, NULL
, 0,
646 "OCTET_STRING_SIZE_30", HFILL
}},
647 { &hf_mpeg_audio_year
,
648 { "year", "mpeg-audio.year",
649 FT_STRING
, BASE_NONE
, NULL
, 0,
650 "OCTET_STRING_SIZE_4", HFILL
}},
651 { &hf_mpeg_audio_comment
,
652 { "comment", "mpeg-audio.comment",
653 FT_STRING
, BASE_NONE
, NULL
, 0,
654 "OCTET_STRING_SIZE_28", HFILL
}},
655 { &hf_mpeg_audio_must_be_zero
,
656 { "must-be-zero", "mpeg-audio.must_be_zero",
657 FT_UINT32
, BASE_DEC
, NULL
, 0,
658 "INTEGER_0_255", HFILL
}},
659 { &hf_mpeg_audio_track
,
660 { "track", "mpeg-audio.track",
661 FT_UINT32
, BASE_DEC
, NULL
, 0,
662 "INTEGER_0_255", HFILL
}},
663 { &hf_mpeg_audio_genre
,
664 { "genre", "mpeg-audio.genre",
665 FT_UINT32
, BASE_DEC
, VALS(mpeg_audio_T_genre_vals
), 0,
667 { &hf_mpeg_audio_header
,
668 { "Frame Header", "mpeg-audio.header",
669 FT_NONE
, BASE_NONE
, NULL
, 0, NULL
, HFILL
}},
670 { &hf_mpeg_audio_data
,
671 { "Data", "mpeg-audio.data",
672 FT_BYTES
, BASE_NONE
, NULL
, 0, NULL
, HFILL
}},
673 { &hf_mpeg_audio_padbytes
,
674 { "Padding", "mpeg-audio.padbytes",
675 FT_BYTES
, BASE_NONE
, NULL
, 0, NULL
, HFILL
}},
678 { "ID3v1", "mpeg-audio.id3v1",
679 FT_NONE
, BASE_NONE
, NULL
, 0, NULL
, HFILL
}},
682 static int *ett
[] = {
684 &ett_mpeg_audio_Audio
,
685 &ett_mpeg_audio_ID3v1
,
688 proto_mpeg_audio
= proto_register_protocol("Moving Picture Experts Group Audio", "MPEG Audio", "mpeg-audio");
689 proto_register_field_array(proto_mpeg_audio
, hf
, array_length(hf
));
690 proto_register_subtree_array(ett
, array_length(ett
));
692 mpeg_audio_handle
= register_dissector("mpeg-audio", dissect_mpeg_audio
, proto_mpeg_audio
);
696 proto_reg_handoff_mpeg_audio(void)
698 dissector_add_string("media_type", "audio/mpeg", mpeg_audio_handle
);
699 /* "audio/mp3" used by Chrome before 2020 */
700 /* https://chromium.googlesource.com/chromium/src/+/842f46a95f49e24534ad35c7a71e5c425d426550 */
701 dissector_add_string("media_type", "audio/mp3", mpeg_audio_handle
);
703 heur_dissector_add("mpeg", dissect_mpeg_audio_heur
, "MPEG Audio", "mpeg_audio", proto_mpeg_audio
, HEURISTIC_ENABLE
);
705 id3v2_handle
= find_dissector("id3v2");