HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-mpeg-audio.c
blob72ee8c8a4742af93fee99b724248224db4dace29
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 /* ../../tools/asn2wrs.py -p mpeg-audio -c ./mpeg-audio.cnf -s ./packet-mpeg-audio-template -D . -O ../../epan/dissectors mpeg-audio.asn */
6 /* Input file: packet-mpeg-audio-template.c */
8 #line 1 "../../asn1/mpeg-audio/packet-mpeg-audio-template.c"
9 /* MPEG audio packet decoder.
10 * Written by Shaun Jackman <sjackman@gmail.com>.
11 * Copyright 2007 Shaun Jackman
13 * $Id$
15 * Wireshark - Network traffic analyzer
16 * By Gerald Combs <gerald@wireshark.org>
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version 2
21 * of the License, or (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 #include "config.h"
35 #include <glib.h>
37 #include <epan/packet.h>
38 #include <epan/asn1.h>
40 #include <wsutil/mpeg-audio.h>
42 #include "packet-per.h"
45 /*--- Included file: packet-mpeg-audio-hf.c ---*/
46 #line 1 "../../asn1/mpeg-audio/packet-mpeg-audio-hf.c"
47 static int hf_mpeg_audio_sync = -1; /* BIT_STRING_SIZE_11 */
48 static int hf_mpeg_audio_version = -1; /* T_version */
49 static int hf_mpeg_audio_layer = -1; /* T_layer */
50 static int hf_mpeg_audio_protection = -1; /* T_protection */
51 static int hf_mpeg_audio_bitrate = -1; /* INTEGER_0_15 */
52 static int hf_mpeg_audio_frequency = -1; /* INTEGER_0_3 */
53 static int hf_mpeg_audio_padding = -1; /* BOOLEAN */
54 static int hf_mpeg_audio_private = -1; /* BOOLEAN */
55 static int hf_mpeg_audio_channel_mode = -1; /* T_channel_mode */
56 static int hf_mpeg_audio_mode_extension = -1; /* INTEGER_0_3 */
57 static int hf_mpeg_audio_copyright = -1; /* BOOLEAN */
58 static int hf_mpeg_audio_original = -1; /* BOOLEAN */
59 static int hf_mpeg_audio_emphasis = -1; /* T_emphasis */
60 static int hf_mpeg_audio_tag = -1; /* OCTET_STRING_SIZE_3 */
61 static int hf_mpeg_audio_title = -1; /* OCTET_STRING_SIZE_30 */
62 static int hf_mpeg_audio_artist = -1; /* OCTET_STRING_SIZE_30 */
63 static int hf_mpeg_audio_album = -1; /* OCTET_STRING_SIZE_30 */
64 static int hf_mpeg_audio_year = -1; /* OCTET_STRING_SIZE_4 */
65 static int hf_mpeg_audio_comment = -1; /* OCTET_STRING_SIZE_28 */
66 static int hf_mpeg_audio_must_be_zero = -1; /* INTEGER_0_255 */
67 static int hf_mpeg_audio_track = -1; /* INTEGER_0_255 */
68 static int hf_mpeg_audio_genre = -1; /* T_genre */
70 /*--- End of included file: packet-mpeg-audio-hf.c ---*/
71 #line 37 "../../asn1/mpeg-audio/packet-mpeg-audio-template.c"
73 /*--- Included file: packet-mpeg-audio-ett.c ---*/
74 #line 1 "../../asn1/mpeg-audio/packet-mpeg-audio-ett.c"
75 static gint ett_mpeg_audio_Audio = -1;
76 static gint ett_mpeg_audio_ID3v1 = -1;
78 /*--- End of included file: packet-mpeg-audio-ett.c ---*/
79 #line 38 "../../asn1/mpeg-audio/packet-mpeg-audio-template.c"
81 /*--- Included file: packet-mpeg-audio-fn.c ---*/
82 #line 1 "../../asn1/mpeg-audio/packet-mpeg-audio-fn.c"
85 static int
86 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_) {
87 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
88 11, 11, FALSE, NULL);
90 return offset;
94 static const value_string mpeg_audio_T_version_vals[] = {
95 { 0, "mpeg-2-5" },
96 { 1, "reserved" },
97 { 2, "mpeg-2" },
98 { 3, "mpeg-1" },
99 { 0, NULL }
103 static int
104 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_) {
105 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
106 4, NULL, FALSE, 0, NULL);
108 return offset;
112 static const value_string mpeg_audio_T_layer_vals[] = {
113 { 0, "reserved" },
114 { 1, "layer-3" },
115 { 2, "layer-2" },
116 { 3, "layer-1" },
117 { 0, NULL }
121 static int
122 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_) {
123 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
124 4, NULL, FALSE, 0, NULL);
126 return offset;
130 static const value_string mpeg_audio_T_protection_vals[] = {
131 { 0, "crc" },
132 { 1, "none" },
133 { 0, NULL }
137 static int
138 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_) {
139 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
140 2, NULL, FALSE, 0, NULL);
142 return offset;
147 static int
148 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_) {
149 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
150 0U, 15U, NULL, FALSE);
152 return offset;
157 static int
158 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_) {
159 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
160 0U, 3U, NULL, FALSE);
162 return offset;
167 static int
168 dissect_mpeg_audio_BOOLEAN(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
169 offset = dissect_per_boolean(tvb, offset, actx, tree, hf_index, NULL);
171 return offset;
175 static const value_string mpeg_audio_T_channel_mode_vals[] = {
176 { 0, "stereo" },
177 { 1, "joint-stereo" },
178 { 2, "dual-channel" },
179 { 3, "single-channel" },
180 { 0, NULL }
184 static int
185 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_) {
186 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
187 4, NULL, FALSE, 0, NULL);
189 return offset;
193 static const value_string mpeg_audio_T_emphasis_vals[] = {
194 { 0, "none" },
195 { 1, "em-50-15-ms" },
196 { 2, "reserved" },
197 { 3, "ccit-j-17" },
198 { 0, NULL }
202 static int
203 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_) {
204 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
205 4, NULL, FALSE, 0, NULL);
207 return offset;
211 static const per_sequence_t Audio_sequence[] = {
212 { &hf_mpeg_audio_sync , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_BIT_STRING_SIZE_11 },
213 { &hf_mpeg_audio_version , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_T_version },
214 { &hf_mpeg_audio_layer , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_T_layer },
215 { &hf_mpeg_audio_protection, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_T_protection },
216 { &hf_mpeg_audio_bitrate , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_INTEGER_0_15 },
217 { &hf_mpeg_audio_frequency, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_INTEGER_0_3 },
218 { &hf_mpeg_audio_padding , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_BOOLEAN },
219 { &hf_mpeg_audio_private , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_BOOLEAN },
220 { &hf_mpeg_audio_channel_mode, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_T_channel_mode },
221 { &hf_mpeg_audio_mode_extension, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_INTEGER_0_3 },
222 { &hf_mpeg_audio_copyright, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_BOOLEAN },
223 { &hf_mpeg_audio_original , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_BOOLEAN },
224 { &hf_mpeg_audio_emphasis , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_T_emphasis },
225 { NULL, 0, 0, NULL }
228 static int
229 dissect_mpeg_audio_Audio(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
230 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
231 ett_mpeg_audio_Audio, Audio_sequence);
233 return offset;
238 static int
239 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_) {
240 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
241 3, 3, FALSE, NULL);
243 return offset;
248 static int
249 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_) {
250 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
251 30, 30, FALSE, NULL);
253 return offset;
258 static int
259 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_) {
260 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
261 4, 4, FALSE, NULL);
263 return offset;
268 static int
269 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_) {
270 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
271 28, 28, FALSE, NULL);
273 return offset;
278 static int
279 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_) {
280 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
281 0U, 255U, NULL, FALSE);
283 return offset;
287 static const value_string mpeg_audio_T_genre_vals[] = {
288 { 0, "blues" },
289 { 1, "classic-rock" },
290 { 2, "country" },
291 { 3, "dance" },
292 { 4, "disco" },
293 { 5, "funk" },
294 { 6, "grunge" },
295 { 7, "hip-hop" },
296 { 8, "jazz" },
297 { 9, "metal" },
298 { 10, "new-age" },
299 { 11, "oldies" },
300 { 12, "other" },
301 { 13, "pop" },
302 { 14, "r-and-b" },
303 { 15, "rap" },
304 { 16, "reggae" },
305 { 17, "rock" },
306 { 18, "techno" },
307 { 19, "industrial" },
308 { 20, "alternative" },
309 { 21, "ska" },
310 { 22, "death-metal" },
311 { 23, "pranks" },
312 { 24, "soundtrack" },
313 { 25, "euro-techno" },
314 { 26, "ambient" },
315 { 27, "trip-hop" },
316 { 28, "vocal" },
317 { 29, "jazz-and-funk" },
318 { 30, "fusion" },
319 { 31, "trance" },
320 { 32, "classical" },
321 { 33, "instrumental" },
322 { 34, "acid" },
323 { 35, "house" },
324 { 36, "game" },
325 { 37, "sound-clip" },
326 { 38, "gospel" },
327 { 39, "noise" },
328 { 40, "alternative-rock" },
329 { 41, "bass" },
330 { 42, "soul" },
331 { 43, "punk" },
332 { 44, "space" },
333 { 45, "meditative" },
334 { 46, "instrumental-pop" },
335 { 47, "instrumental-rock" },
336 { 48, "ethnic" },
337 { 49, "gothic" },
338 { 50, "darkwave" },
339 { 51, "techno-industrial" },
340 { 52, "electronic" },
341 { 53, "pop-folk" },
342 { 54, "eurodance" },
343 { 55, "dream" },
344 { 56, "southern-rock" },
345 { 57, "comedy" },
346 { 58, "cult" },
347 { 59, "gangsta" },
348 { 60, "top-40" },
349 { 61, "christian-rap" },
350 { 62, "pop-funk" },
351 { 63, "jungle" },
352 { 64, "native-american" },
353 { 65, "cabaret" },
354 { 66, "new-wave" },
355 { 67, "psychadelic" },
356 { 68, "rave" },
357 { 69, "showtunes" },
358 { 70, "trailer" },
359 { 71, "lo-fi" },
360 { 72, "tribal" },
361 { 73, "acid-punk" },
362 { 74, "acid-jazz" },
363 { 75, "polka" },
364 { 76, "retro" },
365 { 77, "musical" },
366 { 78, "rock-and-roll" },
367 { 79, "hard-rock" },
368 { 80, "folk" },
369 { 81, "folk-rock" },
370 { 82, "national-folk" },
371 { 83, "swing" },
372 { 84, "fast-fusion" },
373 { 85, "bebob" },
374 { 86, "latin" },
375 { 87, "revival" },
376 { 88, "celtic" },
377 { 89, "bluegrass" },
378 { 90, "avantgarde" },
379 { 91, "gothic-rock" },
380 { 92, "progressive-rock" },
381 { 93, "psychedelic-rock" },
382 { 94, "symphonic-rock" },
383 { 95, "slow-rock" },
384 { 96, "big-band" },
385 { 97, "chorus" },
386 { 98, "easy-listening" },
387 { 99, "acoustic" },
388 { 100, "humour" },
389 { 101, "speech" },
390 { 102, "chanson" },
391 { 103, "opera" },
392 { 104, "chamber-music" },
393 { 105, "sonata" },
394 { 106, "symphony" },
395 { 107, "booty-bass" },
396 { 108, "primus" },
397 { 109, "porn-groove" },
398 { 110, "satire" },
399 { 111, "slow-jam" },
400 { 112, "club" },
401 { 113, "tango" },
402 { 114, "samba" },
403 { 115, "folklore" },
404 { 116, "ballad" },
405 { 117, "power-ballad" },
406 { 118, "rhythmic-soul" },
407 { 119, "freestyle" },
408 { 120, "duet" },
409 { 121, "punk-rock" },
410 { 122, "drum-solo" },
411 { 123, "a-cappella" },
412 { 124, "euro-house" },
413 { 125, "dance-hall" },
414 { 0, NULL }
418 static int
419 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_) {
420 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
421 0U, 255U, NULL, FALSE);
423 return offset;
427 static const per_sequence_t ID3v1_sequence[] = {
428 { &hf_mpeg_audio_tag , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_OCTET_STRING_SIZE_3 },
429 { &hf_mpeg_audio_title , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_OCTET_STRING_SIZE_30 },
430 { &hf_mpeg_audio_artist , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_OCTET_STRING_SIZE_30 },
431 { &hf_mpeg_audio_album , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_OCTET_STRING_SIZE_30 },
432 { &hf_mpeg_audio_year , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_OCTET_STRING_SIZE_4 },
433 { &hf_mpeg_audio_comment , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_OCTET_STRING_SIZE_28 },
434 { &hf_mpeg_audio_must_be_zero, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_INTEGER_0_255 },
435 { &hf_mpeg_audio_track , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_INTEGER_0_255 },
436 { &hf_mpeg_audio_genre , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_audio_T_genre },
437 { NULL, 0, 0, NULL }
440 static int
441 dissect_mpeg_audio_ID3v1(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
442 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
443 ett_mpeg_audio_ID3v1, ID3v1_sequence);
445 return offset;
449 /*--- End of included file: packet-mpeg-audio-fn.c ---*/
450 #line 39 "../../asn1/mpeg-audio/packet-mpeg-audio-template.c"
452 static int proto_mpeg_audio = -1;
454 static int hf_mpeg_audio_data = -1;
455 static int hf_mpeg_audio_padbytes = -1;
456 static int hf_id3v1 = -1;
457 static int hf_id3v2 = -1;
459 static gboolean
460 dissect_mpeg_audio_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
462 guint32 h;
463 struct mpa mpa;
464 int data_size = 0;
465 asn1_ctx_t asn1_ctx;
466 int offset = 0;
467 static const char *version_names[] = { "1", "2", "2.5" };
469 if (!tvb_bytes_exist(tvb, 0, 4))
470 return FALSE; /* not enough data for an MPEG audio frame */
472 h = tvb_get_ntohl(tvb, 0);
473 MPA_UNMARSHAL(&mpa, h);
474 if (!MPA_SYNC_VALID(&mpa))
475 return FALSE;
476 if (!MPA_VERSION_VALID(&mpa))
477 return FALSE;
478 if (!MPA_LAYER_VALID(&mpa))
479 return FALSE;
481 col_add_fstr(pinfo->cinfo, COL_PROTOCOL,
482 "MPEG-%s", version_names[mpa_version(&mpa)]);
483 col_add_fstr(pinfo->cinfo, COL_INFO,
484 "Audio Layer %d", mpa_layer(&mpa) + 1);
485 if (MPA_BITRATE_VALID(&mpa) && MPA_FREQUENCY_VALID(&mpa)) {
486 data_size = (int)(MPA_DATA_BYTES(&mpa) - sizeof mpa);
487 SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
488 col_add_fstr(pinfo->cinfo, COL_DEF_SRC,
489 "%d kb/s", mpa_bitrate(&mpa) / 1000);
490 SET_ADDRESS(&pinfo->dst, AT_NONE, 0, NULL);
491 col_add_fstr(pinfo->cinfo, COL_DEF_DST,
492 "%g kHz", mpa_frequency(&mpa) / (float)1000);
495 if (tree == NULL)
496 return TRUE;
498 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
499 offset = dissect_mpeg_audio_Audio(tvb, offset, &asn1_ctx,
500 tree, proto_mpeg_audio);
501 if (data_size > 0) {
502 unsigned int padding;
504 proto_tree_add_item(tree, hf_mpeg_audio_data, tvb,
505 offset / 8, data_size, ENC_NA);
506 offset += data_size * 8;
507 padding = mpa_padding(&mpa);
508 if (padding > 0) {
509 proto_tree_add_item(tree, hf_mpeg_audio_padbytes, tvb,
510 offset / 8, padding, ENC_NA);
513 return TRUE;
516 static void
517 dissect_id3v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
519 asn1_ctx_t asn1_ctx;
521 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ID3v1");
522 col_clear(pinfo->cinfo, COL_INFO);
523 if (tree == NULL)
524 return;
525 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
526 dissect_mpeg_audio_ID3v1(tvb, 0, &asn1_ctx,
527 tree, hf_id3v1);
530 static void
531 dissect_id3v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
533 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ID3v2");
534 col_clear(pinfo->cinfo, COL_INFO);
535 proto_tree_add_item(tree, hf_id3v2, tvb,
536 0, -1, ENC_NA);
539 static gboolean
540 dissect_mpeg_audio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
542 int magic;
544 if (!tvb_bytes_exist(tvb, 0, 3))
545 return FALSE; /* not enough data for an ID tag or audio frame */
546 magic = tvb_get_ntoh24(tvb, 0);
547 switch (magic) {
548 case 0x544147: /* TAG */
549 dissect_id3v1(tvb, pinfo, tree);
550 return TRUE;
551 case 0x494433: /* ID3 */
552 dissect_id3v2(tvb, pinfo, tree);
553 return TRUE;
554 default:
555 return dissect_mpeg_audio_frame(tvb, pinfo, tree);
559 void
560 proto_register_mpeg_audio(void)
562 static hf_register_info hf[] = {
564 /*--- Included file: packet-mpeg-audio-hfarr.c ---*/
565 #line 1 "../../asn1/mpeg-audio/packet-mpeg-audio-hfarr.c"
566 { &hf_mpeg_audio_sync,
567 { "sync", "mpeg-audio.sync",
568 FT_BYTES, BASE_NONE, NULL, 0,
569 "BIT_STRING_SIZE_11", HFILL }},
570 { &hf_mpeg_audio_version,
571 { "version", "mpeg-audio.version",
572 FT_UINT32, BASE_DEC, VALS(mpeg_audio_T_version_vals), 0,
573 NULL, HFILL }},
574 { &hf_mpeg_audio_layer,
575 { "layer", "mpeg-audio.layer",
576 FT_UINT32, BASE_DEC, VALS(mpeg_audio_T_layer_vals), 0,
577 NULL, HFILL }},
578 { &hf_mpeg_audio_protection,
579 { "protection", "mpeg-audio.protection",
580 FT_UINT32, BASE_DEC, VALS(mpeg_audio_T_protection_vals), 0,
581 NULL, HFILL }},
582 { &hf_mpeg_audio_bitrate,
583 { "bitrate", "mpeg-audio.bitrate",
584 FT_UINT32, BASE_DEC, NULL, 0,
585 "INTEGER_0_15", HFILL }},
586 { &hf_mpeg_audio_frequency,
587 { "frequency", "mpeg-audio.frequency",
588 FT_UINT32, BASE_DEC, NULL, 0,
589 "INTEGER_0_3", HFILL }},
590 { &hf_mpeg_audio_padding,
591 { "padding", "mpeg-audio.padding",
592 FT_BOOLEAN, BASE_NONE, NULL, 0,
593 "BOOLEAN", HFILL }},
594 { &hf_mpeg_audio_private,
595 { "private", "mpeg-audio.private",
596 FT_BOOLEAN, BASE_NONE, NULL, 0,
597 "BOOLEAN", HFILL }},
598 { &hf_mpeg_audio_channel_mode,
599 { "channel-mode", "mpeg-audio.channel_mode",
600 FT_UINT32, BASE_DEC, VALS(mpeg_audio_T_channel_mode_vals), 0,
601 NULL, HFILL }},
602 { &hf_mpeg_audio_mode_extension,
603 { "mode-extension", "mpeg-audio.mode_extension",
604 FT_UINT32, BASE_DEC, NULL, 0,
605 "INTEGER_0_3", HFILL }},
606 { &hf_mpeg_audio_copyright,
607 { "copyright", "mpeg-audio.copyright",
608 FT_BOOLEAN, BASE_NONE, NULL, 0,
609 "BOOLEAN", HFILL }},
610 { &hf_mpeg_audio_original,
611 { "original", "mpeg-audio.original",
612 FT_BOOLEAN, BASE_NONE, NULL, 0,
613 "BOOLEAN", HFILL }},
614 { &hf_mpeg_audio_emphasis,
615 { "emphasis", "mpeg-audio.emphasis",
616 FT_UINT32, BASE_DEC, VALS(mpeg_audio_T_emphasis_vals), 0,
617 NULL, HFILL }},
618 { &hf_mpeg_audio_tag,
619 { "tag", "mpeg-audio.tag",
620 FT_STRING, BASE_NONE, NULL, 0,
621 "OCTET_STRING_SIZE_3", HFILL }},
622 { &hf_mpeg_audio_title,
623 { "title", "mpeg-audio.title",
624 FT_STRING, BASE_NONE, NULL, 0,
625 "OCTET_STRING_SIZE_30", HFILL }},
626 { &hf_mpeg_audio_artist,
627 { "artist", "mpeg-audio.artist",
628 FT_STRING, BASE_NONE, NULL, 0,
629 "OCTET_STRING_SIZE_30", HFILL }},
630 { &hf_mpeg_audio_album,
631 { "album", "mpeg-audio.album",
632 FT_STRING, BASE_NONE, NULL, 0,
633 "OCTET_STRING_SIZE_30", HFILL }},
634 { &hf_mpeg_audio_year,
635 { "year", "mpeg-audio.year",
636 FT_STRING, BASE_NONE, NULL, 0,
637 "OCTET_STRING_SIZE_4", HFILL }},
638 { &hf_mpeg_audio_comment,
639 { "comment", "mpeg-audio.comment",
640 FT_STRING, BASE_NONE, NULL, 0,
641 "OCTET_STRING_SIZE_28", HFILL }},
642 { &hf_mpeg_audio_must_be_zero,
643 { "must-be-zero", "mpeg-audio.must_be_zero",
644 FT_UINT32, BASE_DEC, NULL, 0,
645 "INTEGER_0_255", HFILL }},
646 { &hf_mpeg_audio_track,
647 { "track", "mpeg-audio.track",
648 FT_UINT32, BASE_DEC, NULL, 0,
649 "INTEGER_0_255", HFILL }},
650 { &hf_mpeg_audio_genre,
651 { "genre", "mpeg-audio.genre",
652 FT_UINT32, BASE_DEC, VALS(mpeg_audio_T_genre_vals), 0,
653 NULL, HFILL }},
655 /*--- End of included file: packet-mpeg-audio-hfarr.c ---*/
656 #line 152 "../../asn1/mpeg-audio/packet-mpeg-audio-template.c"
657 { &hf_mpeg_audio_data,
658 { "Data", "mpeg-audio.data",
659 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
660 { &hf_mpeg_audio_padbytes,
661 { "Padding", "mpeg-audio.padbytes",
662 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
664 { &hf_id3v1,
665 { "ID3v1", "mpeg-audio.id3v1",
666 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
667 { &hf_id3v2,
668 { "ID3v2", "mpeg-audio.id3v2",
669 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
672 static gint *ett[] = {
674 /*--- Included file: packet-mpeg-audio-ettarr.c ---*/
675 #line 1 "../../asn1/mpeg-audio/packet-mpeg-audio-ettarr.c"
676 &ett_mpeg_audio_Audio,
677 &ett_mpeg_audio_ID3v1,
679 /*--- End of included file: packet-mpeg-audio-ettarr.c ---*/
680 #line 169 "../../asn1/mpeg-audio/packet-mpeg-audio-template.c"
683 proto_mpeg_audio = proto_register_protocol(
684 "Moving Picture Experts Group Audio", "MPEG Audio", "mpeg-audio");
685 proto_register_field_array(proto_mpeg_audio, hf, array_length(hf));
686 proto_register_subtree_array(ett, array_length(ett));
689 void
690 proto_reg_handoff_mpeg_audio(void)
692 heur_dissector_add("mpeg", dissect_mpeg_audio, proto_mpeg_audio);