diff options
Diffstat (limited to 'epan')
-rw-r--r-- | epan/CMakeLists.txt | 3 | ||||
-rw-r--r-- | epan/dissectors/Makefile.common | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-mpeg-ca.c | 155 | ||||
-rw-r--r-- | epan/dissectors/packet-mpeg-descriptor.c | 2556 | ||||
-rw-r--r-- | epan/dissectors/packet-mpeg-descriptor.h | 35 | ||||
-rw-r--r-- | epan/dissectors/packet-mpeg-pmt.c | 306 |
6 files changed, 3059 insertions, 0 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt index 232152de69..d9cf9815e3 100644 --- a/epan/CMakeLists.txt +++ b/epan/CMakeLists.txt @@ -811,7 +811,10 @@ set(DISSECTOR_SRC dissectors/packet-mount.c dissectors/packet-mp2t.c dissectors/packet-mp4ves.c + dissectors/packet-mpeg-ca.c + dissectors/packet-mpeg-descriptor.c dissectors/packet-mpeg-pat.c + dissectors/packet-mpeg-pmt.c dissectors/packet-mpeg-sect.c dissectors/packet-mpeg1.c dissectors/packet-mpls.c diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 78b500fae9..1695a1242b 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -730,7 +730,10 @@ DISSECTOR_SRC = \ packet-mount.c \ packet-mp2t.c \ packet-mp4ves.c \ + packet-mpeg-ca.c \ + packet-mpeg-descriptor.c \ packet-mpeg-pat.c \ + packet-mpeg-pmt.c \ packet-mpeg-sect.c \ packet-mpeg1.c \ packet-mpls.c \ @@ -1300,6 +1303,7 @@ DISSECTOR_INCLUDES = \ packet-mms.h \ packet-mount.h \ packet-mp4ves.h \ + packet-mpeg-descriptor..h \ packet-mpeg-sect.h \ packet-mpls.h \ packet-mq.h \ diff --git a/epan/dissectors/packet-mpeg-ca.c b/epan/dissectors/packet-mpeg-ca.c new file mode 100644 index 0000000000..a9f36e3db3 --- /dev/null +++ b/epan/dissectors/packet-mpeg-ca.c @@ -0,0 +1,155 @@ +/* packet-mpeg-ca.c + * Routines for MPEG2 (ISO/ISO 13818-1) Conditional Access Table (CA) dissection + * Copyright 2012, Guy Martin <gmsoft@tuxicoman.be> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> + +#include <epan/packet.h> +#include <epan/dissectors/packet-mpeg-sect.h> + +#include "packet-mpeg-descriptor.h" + +static int proto_mpeg_ca = -1; +static int hf_mpeg_ca_reserved = -1; +static int hf_mpeg_ca_version_number = -1; +static int hf_mpeg_ca_current_next_indicator = -1; +static int hf_mpeg_ca_section_number = -1; +static int hf_mpeg_ca_last_section_number = -1; + +static gint ett_mpeg_ca = -1; + +#define MPEG_CA_TID 0x01 + +#define MPEG_CA_RESERVED_MASK 0xFFFFC0 +#define MPEG_CA_VERSION_NUMBER_MASK 0x00003E +#define MPEG_CA_CURRENT_NEXT_INDICATOR_MASK 0x000001 + +static const value_string mpeg_ca_cur_next_vals[] = { + + { 0x0, "Not yet applicable" }, + { 0x1, "Currently applicable" }, + { 0x0, NULL }, + +}; + +void +dissect_mpeg_ca(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + + guint offset = 0, length = 0; + + proto_item *ti = NULL; + proto_tree *mpeg_ca_tree = NULL; + + /* The TVB should start right after the section_length in the Section packet */ + + col_clear(pinfo->cinfo, COL_INFO); + col_set_str(pinfo->cinfo, COL_INFO, "Conditional Access Table (CA)"); + + if (!tree) + + return; + + ti = proto_tree_add_item(tree, proto_mpeg_ca, tvb, offset, -1, ENC_NA); + mpeg_ca_tree = proto_item_add_subtree(ti, ett_mpeg_ca); + + offset += packet_mpeg_sect_header(tvb, offset, mpeg_ca_tree, &length, NULL); + length -= 4; + + proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_reserved, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_version_number, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_current_next_indicator, tvb, offset, 3, ENC_BIG_ENDIAN); + offset += 3; + + proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_section_number, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(mpeg_ca_tree, hf_mpeg_ca_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + /* Parse all the programs */ + while (offset < length) + offset += proto_mpeg_descriptor_dissect(tvb, offset, mpeg_ca_tree); + + packet_mpeg_sect_crc(tvb, pinfo, mpeg_ca_tree, 0, offset); + +} + + +void +proto_register_mpeg_ca(void) +{ + + static hf_register_info hf[] = { + + { &hf_mpeg_ca_reserved, { + "Reserved", "mpeg_ca.reserved", + FT_UINT24, BASE_HEX, NULL, MPEG_CA_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_ca_version_number, { + "Version Number", "mpeg_ca.version", + FT_UINT24, BASE_HEX, NULL, MPEG_CA_VERSION_NUMBER_MASK, NULL, HFILL + } }, + + { &hf_mpeg_ca_current_next_indicator, { + "Current/Next Indicator", "mpeg_ca.cur_next_ind", + FT_UINT24, BASE_HEX, VALS(mpeg_ca_cur_next_vals), MPEG_CA_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL + } }, + + { &hf_mpeg_ca_section_number, { + "Section Number", "mpeg_ca.sect_num", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_ca_last_section_number, { + "Last Section Number", "mpeg_ca.last_sect_num", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + }; + + static gint *ett[] = { + &ett_mpeg_ca, + }; + + proto_mpeg_ca = proto_register_protocol("MPEG2 Conditional Access Table", "MPEG CA", "mpeg_ca"); + + proto_register_field_array(proto_mpeg_ca, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + +} + + +void proto_reg_handoff_mpeg_ca(void) +{ + dissector_handle_t mpeg_ca_handle; + + mpeg_ca_handle = create_dissector_handle(dissect_mpeg_ca, proto_mpeg_ca); + dissector_add_uint("mpeg_sect.tid", MPEG_CA_TID, mpeg_ca_handle); +} diff --git a/epan/dissectors/packet-mpeg-descriptor.c b/epan/dissectors/packet-mpeg-descriptor.c new file mode 100644 index 0000000000..0daafc07c4 --- /dev/null +++ b/epan/dissectors/packet-mpeg-descriptor.c @@ -0,0 +1,2556 @@ +/* packet-mpeg-descriptor.c + * Routines for MPEG2 (ISO/ISO 13818-1 and co) descriptors + * Copyright 2012, Guy Martin <gmsoft@tuxicoman.be> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> +#include <epan/packet.h> + +static int proto_mpeg_descriptor = -1; +static int hf_mpeg_descriptor_tag = -1; +static int hf_mpeg_descriptor_length = -1; +static int hf_mpeg_descriptor_data = -1; +static gint ett_mpeg_descriptor = -1; + +static const value_string mpeg_descriptor_tag_vals[] = { + /* From ISO/IEC 13818-1 */ + { 0x00, "Reserved" }, + { 0x01, "Reserved" }, + { 0x02, "Video Stream Descriptor" }, + { 0x03, "Audio Stream Descriptor" }, + { 0x04, "Hierarchy Descriptor" }, + { 0x05, "Registration Descriptor" }, + { 0x06, "Data Stream Alignment Descriptor" }, + { 0x07, "Target Background Grid Descriptor" }, + { 0x08, "Video Window Descriptor" }, + { 0x09, "CA Descriptor" }, + { 0x0A, "ISO 639 Language Descriptor" }, + { 0x0B, "System Clock Descriptor" }, + { 0x0C, "Multiplex Buffer Utilization Descriptor" }, + { 0x0D, "Copyright Descriptor" }, + { 0x0E, "Maximum Bitrate Descriptor" }, + { 0x0F, "Private Data Indicator Descriptor" }, + { 0x10, "Smoothing Buffer Descriptor" }, + { 0x11, "STD Descriptor" }, + { 0x12, "IBP Descriptor" }, + { 0x1B, "MPEG 4 Video Descriptor" }, + { 0x1C, "MPEG 4 Audio Descriptor" }, + { 0x1D, "IOD Descriptor" }, + { 0x1E, "SL Descriptor" }, + { 0x1F, "FMC Descriptor" }, + { 0x20, "External ES ID Descriptor" }, + { 0x21, "MuxCode Descriptor" }, + { 0x22, "FmxBufferSize Descriptor" }, + { 0x23, "MultiplexBuffer Descriptor" }, + { 0x24, "Content Labeling Descriptor" }, + { 0x25, "Metadata Pointer Descriptor" }, + { 0x26, "Metadata Descriptor" }, + { 0x27, "Metadata STD Descriptor" }, + { 0x28, "AVC Video Descriptor" }, + { 0x29, "IPMP Descriptor" }, + { 0x2A, "AVC Timing and HRD Descriptor" }, + { 0x2B, "MPEG2 AAC Descriptor" }, + { 0x2C, "FlexMuxTiming Descriptor" }, + + /* From ETSI TR 101 202 */ + { 0x13, "Carousel Identifier Descriptor" }, + { 0x14, "Association Tag Descriptor" }, + { 0x15, "Deferred Association Tag Descriptor" }, + + /* From ETSI EN 300 468 */ + { 0x40, "Network Name Descriptor" }, + { 0x41, "Service List Descriptor" }, + { 0x42, "Stuffing Descriptor" }, + { 0x43, "Satellite Delivery System Descriptor" }, + { 0x44, "Cable Delivery System Descriptor" }, + { 0x45, "VBI Data Descriptor" }, + { 0x46, "VBI Teletext Descriptor" }, + { 0x47, "Bouquet Name Descriptor" }, + { 0x48, "Service Descriptor" }, + { 0x49, "Country Availability Descriptor" }, + { 0x4A, "Linkage Descriptor" }, + { 0x4B, "NVOD Reference Descriptor" }, + { 0x4C, "Time Shifted Service Descriptor" }, + { 0x4D, "Short Event Descriptor" }, + { 0x4E, "Extended Event Descriptor" }, + { 0x4F, "Time Shifted Event Descriptor" }, + { 0x50, "Component Descriptor" }, + { 0x51, "Mosaic Descriptor" }, + { 0x52, "Stream Identifier Descriptor" }, + { 0x53, "CA Identifier Descriptor" }, + { 0x54, "Content Descriptor" }, + { 0x55, "Parent Rating Descriptor" }, + { 0x56, "Teletext Descriptor" }, + { 0x57, "Telephone Descriptor" }, + { 0x58, "Local Time Offset Descriptor" }, + { 0x59, "Subtitling Descriptor" }, + { 0x5A, "Terrestrial Delivery System Descriptor" }, + { 0x5B, "Multilingual Network Name Descriptor" }, + { 0x5C, "Multilingual Bouquet Name Descriptor" }, + { 0x5D, "Multilingual Service Name Descriptor" }, + { 0x5E, "Multilingual Component Descriptor" }, + { 0x5F, "Private Data Specifier Descriptor" }, + { 0x60, "Service Move Descriptor" }, + { 0x61, "Short Smoothing Buffer Descriptor" }, + { 0x62, "Frequency List Descriptor" }, + { 0x63, "Partial Transport Stream Descriptor" }, + { 0x64, "Data Broadcast Descriptor" }, + { 0x65, "Scrambling Descriptor" }, + { 0x66, "Data Broadcast ID Descriptor" }, + { 0x67, "Transport Stream Descriptor" }, + { 0x68, "DSNG Descriptor" }, + { 0x69, "PDC Descriptor" }, + { 0x6A, "AC-3 Descriptor" }, + { 0x6B, "Ancillary Data Descriptor" }, + { 0x6C, "Cell List Descriptor" }, + { 0x6D, "Cell Frequency Link Descriptor" }, + { 0x6E, "Announcement Support Descriptor" }, + { 0x6F, "Application Signalling Descriptor" }, + { 0x70, "Adaptation Field Data Descriptor" }, + { 0x71, "Service Identifier Descriptor" }, + { 0x72, "Service Availability Descriptor" }, + { 0x73, "Default Authority Descriptor" }, + { 0x74, "Related Content Descriptor" }, + { 0x75, "TVA ID Descriptor" }, + { 0x76, "Content Identifier Descriptor" }, + { 0x77, "Time Slice FEC Identifier Descriptor" }, + { 0x78, "ECM Repetition Rate Descriptor" }, + { 0x79, "S2 Satellite Delivery System Descriptor" }, + { 0x7A, "Enhanced AC-3 Descriptor" }, + { 0x7B, "DTS Descriptor" }, + { 0x7C, "AAC Descriptor" }, + { 0x7D, "XAIT Content Location Descriptor" }, + { 0x7E, "FTA Content Management Descriptor" }, + { 0x7F, "Extension Descriptor" }, + + /* From ETSI EN 301 790 */ + { 0xA0, "Network Layer Info Descriptor" }, + { 0xA1, "Correction Message Descriptor" }, + { 0xA2, "Logon Initialize Descriptor" }, + { 0xA3, "ACQ Assign Descriptor" }, + { 0xA4, "SYNC Assign Descriptor" }, + { 0xA5, "Encrypted Logon ID Descriptor" }, + { 0xA6, "Echo Value Descriptor" }, + { 0xA7, "RCS Content Descriptor" }, + { 0xA8, "Satellite Forward Link Descriptor" }, + { 0xA9, "Satellite Return Link Descriptor" }, + { 0xAA, "Table Update Descriptor" }, + { 0xAB, "Contention Control Descriptor" }, + { 0xAC, "Correction Control Descriptor" }, + { 0xAD, "Forward Interaction Path Descriptor" }, + { 0xAE, "Return Interaction Path Descriptor" }, + { 0xAf, "Connection Control Descriptor" }, + { 0xB0, "Mobility Control Descriptor" }, + { 0xB1, "Correction Message Extension Descriptor" }, + { 0xB2, "Return Transmission Modes Descriptor" }, + { 0xB3, "Mesh Logon Initialize Descriptor" }, + { 0xB5, "Implementation Type Descriptor" }, + { 0xB6, "LL FEC Identifier Descriptor" }, + + { 0x00, NULL} +}; + +/* 0x02 Video Stream Descriptor */ +static int hf_mpeg_descr_video_stream_multiple_frame_rate_flag = -1; +static int hf_mpeg_descr_video_stream_frame_rate_code = -1; +static int hf_mpeg_descr_video_stream_mpeg1_only_flag = -1; +static int hf_mpeg_descr_video_stream_constrained_parameter_flag = -1; +static int hf_mpeg_descr_video_stream_still_picture_flag = -1; +static int hf_mpeg_descr_video_stream_profile_and_level_indication = -1; +static int hf_mpeg_descr_video_stream_chroma_format = -1; +static int hf_mpeg_descr_video_stream_frame_rate_extension_flag = -1; +static int hf_mpeg_descr_video_stream_reserved = -1; + +#define MPEG_DESCR_VIDEO_STREAM_MULTIPLE_FRAME_RATE_FLAG_MASK 0x80 +#define MPEG_DESCR_VIDEO_STREAM_FRAME_RATE_CODE_MASK 0x78 +#define MPEG_DESCR_VIDEO_STREAM_MPEG1_ONLY_FLAG_MASK 0x04 +#define MPEG_DESCR_VIDEO_STREAM_CONSTRAINED_PARAMETER_FLAG_MASK 0x02 +#define MPEG_DESCR_VIDEO_STREAM_STILL_PICTURE_FLAG_MASK 0x01 +#define MPEG_DESCR_VIDEO_STREAM_CHROMA_FORMAT_MASK 0xC0 +#define MPEG_DESCR_VIDEO_STREAM_FRAME_RATE_EXTENSION_FLAG_MASK 0x20 +#define MPEG_DESCR_VIDEO_STREAM_RESERVED_MASK 0x1F + +static const value_string mpeg_descr_video_stream_multiple_frame_rate_flag_vals[] = { + { 0x00, "Single frame rate present" }, + { 0x01, "Multiple frame rate present" }, + + { 0x00, NULL } +}; + +void +proto_mpeg_descriptor_dissect_video_stream(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + + guint8 mpeg1_only_flag = 0; + + mpeg1_only_flag = tvb_get_guint8(tvb, offset) & MPEG_DESCR_VIDEO_STREAM_MPEG1_ONLY_FLAG_MASK; + proto_tree_add_item(tree, hf_mpeg_descr_video_stream_multiple_frame_rate_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_video_stream_frame_rate_code, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_video_stream_mpeg1_only_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_video_stream_constrained_parameter_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_video_stream_still_picture_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + + offset++; + + if (mpeg1_only_flag) { + + proto_tree_add_item(tree, hf_mpeg_descr_video_stream_profile_and_level_indication, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_video_stream_chroma_format, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_video_stream_frame_rate_extension_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_video_stream_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); + } +} + +/* 0x03 Audio Stream Descriptor */ +static int hf_mpeg_descr_audio_stream_free_format_flag = -1; +static int hf_mpeg_descr_audio_stream_id = -1; +static int hf_mpeg_descr_audio_stream_layer = -1; +static int hf_mpeg_descr_audio_stream_variable_rate_audio_indicator = -1; +static int hf_mpeg_descr_audio_stream_reserved = -1; + +#define MPEG_DESCR_AUDIO_STREAM_FREE_FORMAT_FLAG_MASK 0x80 +#define MPEG_DESCR_AUDIO_STREAM_ID_MASK 0x40 +#define MPEG_DESCR_AUDIO_STREAM_LAYER_MASK 0x30 +#define MPEG_DESCR_AUDIO_STREAM_VARIABLE_RATE_AUDIO_INDICATOR_MASK 0x08 +#define MPEG_DESCR_AUDIO_STREAM_RESERVED_MASK 0x07 + +static const value_string mpeg_descr_audio_stream_free_format_flag_vals[] = { + { 0x00, "bitrate_index is not 0" }, + { 0x01, "One more more audio frame has bitrate_index = 0" }, + + { 0x00, NULL } +}; + +static const value_string mpeg_descr_audio_stream_id_vals[] = { + { 0x00, "ID not set to 1 in all the frames" }, + { 0x01, "ID set to 1 in all the frames" }, + + { 0x00, NULL }, +}; + +static const value_string mpeg_descr_audio_stream_variable_rate_audio_indicator_vals[] = { + { 0x00, "Constant bitrate" }, + { 0x01, "Variable bitrate" }, + + { 0x00, NULL } + +}; + +void +proto_mpeg_descriptor_dissect_audio_stream(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + proto_tree_add_item(tree, hf_mpeg_descr_audio_stream_free_format_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_audio_stream_id, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_audio_stream_layer, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_audio_stream_variable_rate_audio_indicator, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_audio_stream_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); +} + +/* 0x06 Data Stream Alignment Descriptor */ +static int hf_mpeg_descr_data_stream_alignment = -1; + +static const value_string mpeg_descr_data_stream_alignment_vals[] = { + { 0x00, "Reserved" }, + { 0x01, "Slice, or video access unit" }, + { 0x02, "Video access unit" }, + { 0x03, "GOP, or SEQ" }, + { 0x04, "SEQ" }, + + { 0x00, NULL } +}; + +void +proto_mpeg_descriptor_dissect_data_stream_alignment(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + proto_tree_add_item(tree, hf_mpeg_descr_data_stream_alignment, tvb, offset, 1, ENC_BIG_ENDIAN); +} + +/* 0x09 CA Descriptor */ +static int hf_mpeg_descr_ca_system_id = -1; +static int hf_mpeg_descr_ca_reserved = -1; +static int hf_mpeg_descr_ca_pid = -1; +static int hf_mpeg_descr_ca_private = -1; + +#define MPEG_DESCR_CA_RESERVED_MASK 0xE000 +#define MPEG_DESCR_CA_PID_MASK 0x1FFF + +void +proto_mpeg_descriptor_dissect_ca(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + proto_tree_add_item(tree, hf_mpeg_descr_ca_system_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(tree, hf_mpeg_descr_ca_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_ca_pid, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + if (len > 4) + proto_tree_add_item(tree, hf_mpeg_descr_ca_private, tvb, offset, len - 4, ENC_BIG_ENDIAN); +} + + +/* 0x0A ISO 639 Language Descriptor */ +static int hf_mpeg_descr_iso639_lang = -1; +static int hf_mpeg_descr_iso639_type = -1; + +static const value_string mpeg_descr_iso639_type_vals[] = { + { 0x00, "Undefined" }, + { 0x01, "Clean Effects" }, + { 0x02, "Hearing Impaired" }, + { 0x03, "Visual Impaired Comentary" }, + + { 0x00, NULL }, +}; + +void +proto_mpeg_descriptor_dissect_iso639(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + if (len > 1) + proto_tree_add_item(tree, hf_mpeg_descr_iso639_lang, tvb, offset, len - 1, ENC_NA); + offset += len - 1; + proto_tree_add_item(tree, hf_mpeg_descr_iso639_type, tvb, offset, 1, ENC_BIG_ENDIAN); +} + +/* 0x0B System Clock Descriptor */ +static int hf_mpeg_descr_system_clock_external_clock_reference_indicator = -1; +static int hf_mpeg_descr_system_clock_reserved1 = -1; +static int hf_mpeg_descr_system_clock_accuracy_integer = -1; +static int hf_mpeg_descr_system_clock_accuracy_exponent = -1; +static int hf_mpeg_descr_system_clock_reserved2 = -1; + +#define MPEG_DESCR_SYSTEM_CLOCK_EXTERNAL_CLOCK_REFERENCE_INDICATOR_MASK 0x80 +#define MPEG_DESCR_SYSTEM_CLOCK_RESERVED1_MASK 0x40 +#define MPEG_DESCR_SYSTEM_CLOCK_ACCURACY_INTEGER_MASK 0x3F +#define MPEG_DESCR_SYSTEM_CLOCK_ACCURACY_EXPONENT_MASK 0xE0 +#define MPEG_DESCR_SYSTEM_CLOCK_RESERVED2_MASK 0x1F + +void +proto_mpeg_descriptor_dissect_system_clock(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + proto_tree_add_item(tree, hf_mpeg_descr_system_clock_external_clock_reference_indicator, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_system_clock_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_system_clock_accuracy_integer, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_system_clock_accuracy_exponent, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_system_clock_reserved2, tvb, offset, 1, ENC_BIG_ENDIAN); +} + +/* 0x0E Maximum Bitrate Descriptor */ +static int hf_mpeg_descr_max_bitrate_reserved = -1; +static int hf_mpeg_descr_max_bitrate = -1; + +#define MPEG_DESCR_MAX_BITRATE_RESERVED_MASK 0xC00000 +#define MPEG_DESCR_MAX_BITRATE_MASK 0x3FFFFF + +void +proto_mpeg_descriptor_dissect_max_bitrate(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + proto_item *rate_item = NULL; + guint32 rate = 0; + + proto_tree_add_item(tree, hf_mpeg_descr_max_bitrate_reserved, tvb, offset, 3, ENC_BIG_ENDIAN); + rate = tvb_get_ntoh24(tvb, offset) & MPEG_DESCR_MAX_BITRATE_MASK; + rate_item = proto_tree_add_item(tree, hf_mpeg_descr_max_bitrate, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_item_append_text(rate_item, " (%u bytes/sec)", rate * 50); +} + +/* 0x10 Smoothing Buffer Descriptor */ +static int hf_mpeg_descr_smoothing_buffer_reserved1 = -1; +static int hf_mpeg_descr_smoothing_buffer_leak_rate = -1; +static int hf_mpeg_descr_smoothing_buffer_reserved2 = -1; +static int hf_mpeg_descr_smoothing_buffer_size = -1; + +#define MPEG_DESCR_SMOOTHING_BUFFER_RESERVED1_MASK 0xC00000 +#define MPEG_DESCR_SMOOTHING_BUFFER_LEAK_RATE_MASK 0x3FFFFF +#define MPEG_DESCR_SMOOTHING_BUFFER_RESERVED2_MASK 0xC00000 +#define MPEG_DESCR_SMOOTHING_BUFFER_SIZE_MASK 0x3FFFFF + +void +proto_mpeg_descriptor_dissect_smoothing_buffer(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + proto_item *leak_rate_item = NULL; + guint32 leak_rate = 0; + + proto_tree_add_item(tree, hf_mpeg_descr_smoothing_buffer_reserved1, tvb, offset, 3, ENC_BIG_ENDIAN); + leak_rate = tvb_get_ntoh24(tvb, offset) & MPEG_DESCR_SMOOTHING_BUFFER_LEAK_RATE_MASK; + leak_rate_item = proto_tree_add_item(tree, hf_mpeg_descr_smoothing_buffer_leak_rate, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_item_append_text(leak_rate_item, " (%u bytes/sec)", leak_rate * 400 / 8); + offset += 3; + + proto_tree_add_item(tree, hf_mpeg_descr_smoothing_buffer_reserved2, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_smoothing_buffer_size, tvb, offset, 3, ENC_BIG_ENDIAN); + +} + +/* 0x11 STD Descriptor */ +static int hf_mpeg_descr_std_reserved = -1; +static int hf_mpeg_descr_std_leak_valid = -1; + +#define MPEG_DESCR_STD_RESERVED_MASK 0xFE +#define MPEG_DESCR_STD_LEAK_VALID_MASK 0x01 + +void +proto_mpeg_descriptor_dissect_std(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + proto_tree_add_item(tree, hf_mpeg_descr_std_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_std_leak_valid, tvb, offset, 1, ENC_BIG_ENDIAN); +} + +/* 0x13 Carousel Identifier Descriptor */ +static int hf_mpeg_descr_carousel_identifier_id = -1; +static int hf_mpeg_descr_carousel_identifier_format_id = -1; +static int hf_mpeg_descr_carousel_identifier_module_version = -1; +static int hf_mpeg_descr_carousel_identifier_module_id = -1; +static int hf_mpeg_descr_carousel_identifier_block_size = -1; +static int hf_mpeg_descr_carousel_identifier_module_size = -1; +static int hf_mpeg_descr_carousel_identifier_compression_method = -1; +static int hf_mpeg_descr_carousel_identifier_original_size = -1; +static int hf_mpeg_descr_carousel_identifier_timeout = -1; +static int hf_mpeg_descr_carousel_identifier_object_key_len = -1; +static int hf_mpeg_descr_carousel_identifier_object_key_data = -1; +static int hf_mpeg_descr_carousel_identifier_private = -1; + +static const value_string mpeg_descr_carousel_identifier_format_id_vals[] = { + { 0x00, "No Format Specifier" }, + { 0x01, "Format Specifier" }, + + { 0, NULL } +}; + +void +proto_mpeg_descriptor_dissect_carousel_identifier(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + guint8 key_len = 0, format_id = 0; + guint private_len = 0; + + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_id, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; + + format_id = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_format_id, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + if (format_id == 0x01) { + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_module_version, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_module_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_block_size, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_module_size, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; + + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_compression_method, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_original_size, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; + + key_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_timeout, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_object_key_data, tvb, offset, key_len, ENC_BIG_ENDIAN); + offset += key_len; + + if (len > 20 + key_len) + private_len = len - 20 - key_len; + + } else { + if (len > 5) + private_len = len - 5; + } + + if (private_len) + proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_private, tvb, offset, private_len, ENC_BIG_ENDIAN); + +} + +/* 0x14 Association Tag Descriptor */ +static int hf_mpeg_descr_association_tag = -1; +static int hf_mpeg_descr_association_tag_use = -1; +static int hf_mpeg_descr_association_tag_selector_len = -1; +static int hf_mpeg_descr_association_tag_transaction_id = -1; +static int hf_mpeg_descr_association_tag_timeout = -1; +static int hf_mpeg_descr_association_tag_selector_bytes = -1; +static int hf_mpeg_descr_association_tag_private_bytes = -1; + +void +proto_mpeg_descriptor_dissect_association_tag(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + guint end = offset + len; + guint16 use = 0; + guint8 selector_len = 0; + + proto_tree_add_item(tree, hf_mpeg_descr_association_tag, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + use = tvb_get_ntohs(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_association_tag_use, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + selector_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_association_tag_selector_len, tvb, offset, 1, ENC_BIG_ENDIAN); + offset ++; + + if (use == 0x00) { + if (selector_len != 8) + return; + proto_tree_add_item(tree, hf_mpeg_descr_association_tag_transaction_id, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; + + proto_tree_add_item(tree, hf_mpeg_descr_association_tag_timeout, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; + + } else { + proto_tree_add_item(tree, hf_mpeg_descr_association_tag_selector_bytes, tvb, offset, selector_len, ENC_BIG_ENDIAN); + offset += selector_len; + } + + if (offset < end) + proto_tree_add_item(tree, hf_mpeg_descr_association_tag_private_bytes, tvb, offset, end - offset, ENC_BIG_ENDIAN); +} + +/* 0x28 AVC Video Descriptor */ +static int hf_mpeg_descr_avc_vid_profile_idc = -1; +static int hf_mpeg_descr_avc_vid_constraint_set0_flag = -1; +static int hf_mpeg_descr_avc_vid_constraint_set1_flag = -1; +static int hf_mpeg_descr_avc_vid_constraint_set2_flag = -1; +static int hf_mpeg_descr_avc_vid_compatible_flags = -1; +static int hf_mpeg_descr_avc_vid_level_idc = -1; +static int hf_mpeg_descr_avc_vid_still_present = -1; +static int hf_mpeg_descr_avc_vid_24h_picture_flag = -1; +static int hf_mpeg_descr_avc_vid_reserved = -1; + +#define MPEG_DESCR_AVC_VID_CONSTRAINT_SET0_FLAG_MASK 0x80 +#define MPEG_DESCR_AVC_VID_CONSTRAINT_SET1_FLAG_MASK 0x40 +#define MPEG_DESCR_AVC_VID_CONSTRAINT_SET2_FLAG_MASK 0x20 +#define MPEG_DESCR_AVC_VID_COMPATIBLE_FLAGS_MASK 0x1F +#define MPEG_DESCR_AVC_VID_STILL_PRESENT_MASK 0x80 +#define MPEG_DESCR_AVC_VID_24H_PICTURE_FLAG_MASK 0x40 +#define MPEG_DESCR_AVC_VID_RESERVED_MASK 0x3F + +void +proto_mpeg_descriptor_dissect_avc_vid(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_profile_idc, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_constraint_set0_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_constraint_set1_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_constraint_set2_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_compatible_flags, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_level_idc, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_still_present, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_24h_picture_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); +} + +/* 0x45 VBI Data Descriptor */ +static int hf_mpeg_descr_vbi_data_service_id = -1; +static int hf_mpeg_descr_vbi_data_descr_len = -1; +static int hf_mpeg_descr_vbi_data_reserved1 = -1; +static int hf_mpeg_descr_vbi_data_field_parity = -1; +static int hf_mpeg_descr_vbi_data_line_offset = -1; +static int hf_mpeg_descr_vbi_data_reserved2 = -1; + +#define MPEG_DESCR_VBI_DATA_RESERVED1_MASK 0xC0 +#define MPEG_DESCR_VBI_DATA_FIELD_PARITY_MASK 0x20 +#define MPEG_DESCR_VBI_DATA_LINE_OFFSET_MASK 0x1F + +static gint ett_mpeg_descriptor_vbi_data_service = -1; + +static const value_string mpeg_descr_vbi_data_service_id_vals[] = { + + { 0x00, "Reserved" }, + { 0x01, "EBU Teletext" }, + { 0x02, "Inverted Teletext" }, + { 0x03, "Reserved" }, + { 0x04, "VPS" }, + { 0x05, "WSS" }, + { 0x06, "Closed Captioning" }, + { 0x07, "Monochrome 4:2:2 samples" }, + + { 0, NULL } +}; + +static const value_string mpeg_descr_vbi_data_field_parity_vals[] = { + { 0x00, "Second (even) field of frame" }, + { 0x01, "First (odd) field of frame" }, + + { 0, NULL } +}; + +void +proto_mpeg_descriptor_dissect_vbi_data(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) { + + guint8 svc_id = 0, svc_len = 0; + guint end = offset + len, svc_end = 0; + proto_item *si = NULL; + proto_tree *svc_tree = NULL; + + while (offset < end) { + svc_id = tvb_get_guint8(tvb, offset); + svc_len = tvb_get_guint8(tvb, offset + 1); + si = proto_tree_add_text(tree, tvb, offset, svc_len + 2, "Service 0x%02x", svc_id); + svc_tree = proto_item_add_subtree(si, ett_mpeg_descriptor_vbi_data_service); + + proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_service_id, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_descr_len, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + switch (svc_id) { + case 0x01: + case 0x02: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + svc_end = offset + svc_len; + while (offset < svc_end) { + proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_field_parity, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_line_offset, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + } + break; + default: + proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_reserved2, tvb, offset, svc_len, ENC_BIG_ENDIAN); + offset += svc_len; + break; + } + + } +} + +/* 0x48 Service Descriptor */ +static int hf_mpeg_descr_service_type = -1; +static int hf_mpeg_descr_service_provider_name_length = -1; +static int hf_mpeg_descr_service_provider = -1; +static int hf_mpeg_descr_service_name_length = -1; +static int hf_mpeg_descr_service_name = -1; + +static const value_string mpeg_descr_service_type_vals[] = { + + { 0x00, "reserved" }, + { 0x01, "digital television service" }, + { 0x02, "digital radio sound service" }, + { 0x03, "Teletext service" }, + { 0x04, "NVOD reference service" }, + { 0x05, "NVOD time-shifted service" }, + { 0x06, "mosaic service" }, + { 0x07, "FM radio service" }, + { 0x08, "DVB SRM service" }, + { 0x09, "reserved" }, + { 0x0A, "advanced codec digital radio sound service" }, + { 0x0B, "advanced codec mosaic service" }, + { 0x0C, "data broadcast service" }, + { 0x0D, "reserved for Common Interface Usage (EN 50221)" }, + { 0x0E, "RCS Map (see EN 301 790)" }, + { 0x0F, "RCS FLS (see EN 301 790)" }, + { 0x10, "DVB MHP service" }, + { 0x11, "MPEG-2 HD digital television service" }, + { 0x16, "advanced codec SD digital television service" }, + { 0x17, "advanced codec SD NVOD time-shifted service" }, + { 0x18, "advanced codec SD NVOD reference service" }, + { 0x19, "advanced codec HD digital television service" }, + { 0x1A, "advanced codec HD NVOD time-shifted service" }, + + { 0x00, NULL } + +}; + +void +proto_mpeg_descriptor_dissect_service(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + guint8 descr_len = 0, name_len = 0; + + proto_tree_add_item(tree, hf_mpeg_descr_service_type, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + descr_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_service_provider_name_length, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_service_provider, tvb, offset, descr_len, ENC_NA); + offset += descr_len; + + name_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_service_name_length, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_service_name, tvb, offset, name_len, ENC_NA); + +} + +/* 0x4D Short Event Descriptor */ +static int hf_mpeg_descr_short_event_lang_code = -1; +static int hf_mpeg_descr_short_event_name_length = -1; +static int hf_mpeg_descr_short_event_name = -1; +static int hf_mpeg_descr_short_event_text_length = -1; +static int hf_mpeg_descr_short_event_text = -1; + +void +proto_mpeg_descriptor_dissect_short_event(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + guint8 name_len = 0, text_len = 0; + + proto_tree_add_item(tree, hf_mpeg_descr_short_event_lang_code, tvb, offset, 3, ENC_NA); + offset += 3; + + name_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_short_event_name_length, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_short_event_name, tvb, offset, name_len, ENC_NA); + offset += name_len; + + text_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_short_event_text_length, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_short_event_text, tvb, offset, text_len, ENC_NA); + +} + +/* 0x4E Extended Event Descriptor */ +static int hf_mpeg_descr_extended_event_descriptor_number = -1; +static int hf_mpeg_descr_extended_event_last_descriptor_number = -1; +static int hf_mpeg_descr_extended_event_lang_code = -1; +static int hf_mpeg_descr_extended_event_length_of_items = -1; +static int hf_mpeg_descr_extended_event_item_description_length = -1; +static int hf_mpeg_descr_extended_event_item_description_char = -1; +static int hf_mpeg_descr_extended_event_item_length = -1; +static int hf_mpeg_descr_extended_event_item_char = -1; +static int hf_mpeg_descr_extended_event_text_length = -1; +static int hf_mpeg_descr_extended_event_text_char = -1; + +#define MPEG_DESCR_EXTENDED_EVENT_DESCRIPTOR_NUMBER_MASK 0xF0 +#define MPEG_DESCR_EXTENDED_EVENT_LAST_DESCRIPTOR_NUMBER_MASK 0x0F + +static gint ett_mpeg_descriptor_extended_event_item = -1; + +void +proto_mpeg_descriptor_dissect_extended_event(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + + guint8 items_len = 0, item_descr_len = 0, item_len = 0, text_len = 0; + guint items_end = 0; + proto_item *ii = NULL; + proto_tree *item_tree = NULL; + + proto_tree_add_item(tree, hf_mpeg_descr_extended_event_descriptor_number, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_extended_event_last_descriptor_number, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_extended_event_lang_code, tvb, offset, 3, ENC_NA); + offset += 3; + + items_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_extended_event_length_of_items, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + items_end = offset + items_len; + + while (offset < items_end) { + ii = proto_tree_add_text(tree, tvb, offset, 0, "Item"); + item_tree = proto_item_add_subtree(ii, ett_mpeg_descriptor_extended_event_item); + + item_descr_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(item_tree, hf_mpeg_descr_extended_event_item_description_length, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(item_tree, hf_mpeg_descr_extended_event_item_description_char, tvb, offset, item_descr_len, ENC_NA); + offset += item_descr_len; + + item_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(item_tree, hf_mpeg_descr_extended_event_item_length, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(item_tree, hf_mpeg_descr_extended_event_item_char, tvb, offset, item_len, ENC_NA); + offset += item_len; + } + + text_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_extended_event_text_length, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_extended_event_text_char, tvb, offset, text_len, ENC_NA); + +} + +/* 0x50 Component Descriptor */ +static int hf_mpeg_descr_component_reserved = -1; +static int hf_mpeg_descr_component_stream_content = -1; +static int hf_mpeg_descr_component_type = -1; +static int hf_mpeg_descr_component_content_type = -1; +static int hf_mpeg_descr_component_tag = -1; +static int hf_mpeg_descr_component_lang_code = -1; +static int hf_mpeg_descr_component_text = -1; + +#define MPEG_DESCR_COMPONENT_RESERVED_MASK 0xF0 +#define MPEG_DESCR_COMPONENT_STREAM_CONTENT_MASK 0x0F +#define MPEG_DESCR_COMPONENT_CONTENT_TYPE_MASK 0x0FFF + +static gint ett_mpeg_descriptor_component_content_type = -1; + +static const value_string mpeg_descr_component_stream_content_vals[] = { + + { 0x01, "Video (MPEG-2)" }, + { 0x02, "Audio (MPEG-1 Layer 2)" }, + { 0x03, "EBU Data (Teletext, Subtitle, ...)" }, + { 0x04, "Audio (AC-3)" }, + { 0x05, "Video (H.264/AVC)" }, + { 0x06, "Audio (HE-AAC)" }, + { 0x07, "Audio (DTS)" }, + +}; + +static const value_string mpeg_descr_component_content_type_vals[] = { + + { 0x0101, "MPEG-2 video, 4:3 aspect ratio, 25 Hz" }, + { 0x0102, "MPEG-2 video, 16:9 aspect ratio with pan vectors, 25 Hz" }, + { 0x0103, "MPEG-2 video, 16:9 aspect ratio without pan vectors, 25 Hz" }, + { 0x0104, "MPEG-2 video, > 16:9 aspect ratio, 25 Hz" }, + { 0x0105, "MPEG-2 video, 4:3 aspect ratio, 30 Hz" }, + { 0x0106, "MPEG-2 video, 16:9 aspect ratio with pan vectors, 30 Hz" }, + { 0x0107, "MPEG-2 video, 16:9 aspect ratio without pan vectors, 30 Hz" }, + { 0x0108, "MPEG-2 video, > 16:9 aspect ratio, 30 Hz" }, + { 0x0109, "MPEG-2 high definition video, 4:3 aspect ratio, 25 Hz" }, + { 0x010A, "MPEG-2 high definition video, 16:9 aspect ratio with pan vectors, 25 Hz" }, + { 0x010B, "MPEG-2 high definition video, 16:9 aspect ratio without pan vectors, 25 Hz" }, + { 0x010C, "MPEG-2 high definition video, > 16:9 aspect ratio, 25 Hz" }, + { 0x010D, "MPEG-2 high definition video, 4:3 aspect ratio, 30 Hz" }, + { 0x010E, "MPEG-2 high definition video, 16:9 aspect ratio with pan vectors, 30 Hz" }, + { 0x010F, "MPEG-2 high definition video, 16:9 aspect ratio without pan vectors, 30 Hz" }, + { 0x0110, "MPEG-2 high definition video, > 16:9 aspect ratio, 30 Hz" }, + { 0x0201, "MPEG-1 Layer 2 audio, single mono channel" }, + { 0x0202, "MPEG-1 Layer 2 audio, dual mono channel" }, + { 0x0203, "MPEG-1 Layer 2 audio, stereo" }, + { 0x0204, "MPEG-1 Layer 2 audio, multi-lingual, multi-channel" }, + { 0x0205, "MPEG-1 Layer 2 audio, surround sound" }, + { 0x0240, "MPEG-1 Layer 2 audio description for the visually impaired" }, + { 0x0241, "MPEG-1 Layer 2 audio for the hard of hearing" }, + { 0x0242, "receiver-mixed supplementary audio as per annex E of TS 101 154 [9]" }, + { 0x0247, "MPEG-1 Layer 2 audio, receiver mix audio description as per annex E of TS 101 154 [9]" }, + { 0x0248, "MPEG-1 Layer 2 audio, broadcaster mix audio description" }, + { 0x0301, "EBU Teletext subtitles" }, + { 0x0302, "associated EBU Teletext" }, + { 0x0303, "VBI data" }, + { 0x0310, "DVB subtitles (normal) with no monitor aspect ratio criticality" }, + { 0x0311, "DVB subtitles (normal) for display on 4:3 aspect ratio monitor" }, + { 0x0312, "DVB subtitles (normal) for display on 16:9 aspect ratio monitor" }, + { 0x0313, "DVB subtitles (normal) for display on 2.21:1 aspect ratio monitor" }, + { 0x0314, "DVB subtitles (normal) for display on a high definition monitor" }, + { 0x0320, "DVB subtitles (for the hard of hearing) with no monitor aspect ratio criticality" }, + { 0x0321, "DVB subtitles (for the hard of hearing) for display on 4:3 aspect ratio monitor" }, + { 0x0322, "DVB subtitles (for the hard of hearing) for display on 16:9 aspect ratio monitor" }, + { 0x0323, "DVB subtitles (for the hard of hearing) for display on 2.21:1 aspect ratio monitor" }, + { 0x0324, "DVB subtitles (for the hard of hearing) for display on a high definition monitor" }, + { 0x0330, "Open (in-vision) sign language interpretation for the deaf" }, + { 0x0331, "Closed sign language interpretation for the deaf" }, + { 0x0340, "video up-sampled from standard definition source material" }, + { 0x0501, "H.264/AVC standard definition video, 4:3 aspect ratio, 25 Hz" }, + { 0x0503, "H.264/AVC standard definition video, 16:9 aspect ratio, 25 Hz" }, + { 0x0504, "H.264/AVC standard definition video, > 16:9 aspect ratio, 25 Hz" }, + { 0x0505, "H.264/AVC standard definition video, 4:3 aspect ratio, 30 Hz" }, + { 0x0507, "H.264/AVC standard definition video, 16:9 aspect ratio, 30 Hz" }, + { 0x0508, "H.264/AVC standard definition video, > 16:9 aspect ratio, 30 Hz" }, + { 0x050B, "H.264/AVC high definition video, 16:9 aspect ratio, 25 Hz" }, + { 0x050C, "H.264/AVC high definition video, > 16:9 aspect ratio, 25 Hz" }, + { 0x050F, "H.264/AVC high definition video, 16:9 aspect ratio, 30 Hz" }, + { 0x0510, "H.264/AVC high definition video, > 16:9 aspect ratio, 30 Hz" }, + { 0x0601, "HE-AAC audio, single mono channel" }, + { 0x0603, "HE-AAC audio, stereo" }, + { 0x0605, "HE-AAC audio, surround sound" }, + { 0x0640, "HE-AAC audio description for the visually impaired" }, + { 0x0641, "HE-AAC audio for the hard of hearing" }, + { 0x0642, "HE-AAC receiver-mixed supplementary audio as per annex E of TS 101 154 [9]" }, + { 0x0643, "HE-AAC v2 audio, stereo" }, + { 0x0644, "HE-AAC v2 audio description for the visually impaired" }, + { 0x0645, "HE-AAC v2 audio for the hard of hearing" }, + { 0x0646, "HE-AAC v2 receiver-mixed supplementary audio as per annex E of TS 101 154 [9]" }, + { 0x0647, "HE-AAC receiver mix audio description for the visually impaired" }, + { 0x0648, "HE-AAC broadcaster mix audio description for the visually impaired" }, + { 0x0649, "HE-AAC v2 receiver mix audio description for the visually impaired" }, + { 0x064A, "HE-AAC v2 broadcaster mix audio description for the visually impaired" }, + { 0x0801, "DVB SRM data" }, + + { 0x0, NULL } +}; + + +void +proto_mpeg_descriptor_dissect_component(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + + proto_item *cti = NULL; + proto_tree *content_type_tree = NULL; + + proto_tree_add_item(tree, hf_mpeg_descr_component_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); + + cti = proto_tree_add_item(tree, hf_mpeg_descr_component_content_type, tvb, offset, 2, ENC_BIG_ENDIAN); + content_type_tree = proto_item_add_subtree(cti, ett_mpeg_descriptor_component_content_type); + + proto_tree_add_item(content_type_tree, hf_mpeg_descr_component_stream_content, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(content_type_tree, hf_mpeg_descr_component_type, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_component_tag, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_component_lang_code, tvb, offset, 3, ENC_NA); + offset += 3; + + if (offset < len) + proto_tree_add_item(tree, hf_mpeg_descr_component_text, tvb, offset, len - offset, ENC_NA); +} + +/* 0x52 Stream Identifier Descriptor */ +static int hf_mpeg_descr_stream_identifier_component_tag = -1; + +void +proto_mpeg_descriptor_dissect_stream_identifier(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + proto_tree_add_item(tree, hf_mpeg_descr_stream_identifier_component_tag, tvb, offset, 1, ENC_BIG_ENDIAN); +} + +/* 0x53 CA Identifier Descriptor */ +static int hf_mpeg_descr_ca_identifier_system_id = -1; + +void +proto_mpeg_descriptor_dissect_ca_identifier(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + guint end = offset + len; + + while (offset < end) { + proto_tree_add_item(tree, hf_mpeg_descr_ca_identifier_system_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + } + +} + +/* 0x54 Content Descriptor */ +static int hf_mpeg_descr_content_nibble = -1; +static int hf_mpeg_descr_content_nibble_level_1 = -1; +static int hf_mpeg_descr_content_nibble_level_2 = -1; +static int hf_mpeg_descr_content_user_byte = -1; + +#define MPEG_DESCR_CONTENT_NIBBLE_LEVEL_1_MASK 0xF0 +#define MPEG_DESCR_CONTENT_NIBBLE_LEVEL_2_MASK 0x0F + +static gint ett_mpeg_descriptor_content_nibble = -1; + +static const value_string mpeg_descr_content_nibble_vals[] = { + + { 0x10, "movie/drama (general)" }, + { 0x11, "detective/thriller" }, + { 0x12, "adventure/western/war" }, + { 0x13, "science fiction/fantasy/horror" }, + { 0x14, "comedy" }, + { 0x15, "soap/melodrama/folkloric" }, + { 0x16, "romance" }, + { 0x17, "serious/classical/religious/historical movie/drama" }, + { 0x18, "adult movie/drama" }, + { 0x1F, "user defined (movie/drama)" }, + + { 0x20, "news/current affairs (general)" }, + { 0x21, "news/weather report" }, + { 0x22, "news magazine" }, + { 0x23, "documentary" }, + { 0x24, "discussion/interview/debate" }, + { 0x2F, "user defined (news/current affairs)" }, + + { 0x30, "show/game show (general)" }, + { 0x31, "game show/quiz/contest" }, + { 0x32, "variety show" }, + { 0x33, "talk show" }, + { 0x3F, "user defined (show/game show)" }, + + { 0x40, "sports (general)" }, + { 0x41, "special events (Olympic Games, World Cup, etc.)" }, + { 0x42, "sports magazines" }, + { 0x43, "football/soccer" }, + { 0x44, "tennis/squash" }, + { 0x45, "team sports (excluding football)" }, + { 0x46, "athletics" }, + { 0x47, "motor sport" }, + { 0x48, "water sport" }, + { 0x49, "winter sports" }, + { 0x4A, "equestrian" }, + { 0x4B, "martial sports" }, + { 0x4F, "user defined (sports)" }, + + { 0x50, "children's/youth programmes (general)" }, + { 0x51, "pre-school children's programmes" }, + { 0x52, "entertainment programmes for 6 to14" }, + { 0x53, "entertainment programmes for 10 to 16" }, + { 0x54, "informational/educational/school programmes" }, + { 0x55, "cartoons/puppets" }, + { 0x5F, "user defined (children's/youth programmes)" }, + + { 0x60, "music/ballet/dance (general)" }, + { 0x61, "rock/pop" }, + { 0x62, "serious music/classical music" }, + { 0x63, "folk/traditional music" }, + { 0x64, "jazz" }, + { 0x65, "musical/opera" }, + { 0x66, "ballet" }, + { 0x6F, "user defined (music/ballet/dance)" }, + + { 0x70, "arts/culture (without music, general)" }, + { 0x71, "performing arts" }, + { 0x72, "fine arts" }, + { 0x73, "religion" }, + { 0x74, "popular culture/traditional arts" }, + { 0x75, "literature" }, + { 0x76, "film/cinema" }, + { 0x77, "experimental film/video" }, + { 0x78, "broadcasting/press" }, + { 0x79, "new media" }, + { 0x7A, "arts/culture magazines" }, + { 0x7B, "fashion" }, + { 0x7F, "user defined (arts/culture)" }, + + { 0x80, "social/political issues/economics (general)" }, + { 0x81, "magazines/reports/documentary" }, + { 0x82, "economics/social advisory" }, + { 0x83, "remarkable people" }, + { 0x8F, "user defined (social/political issues/economics)" }, + + { 0x90, "education/science/factual topics (general)" }, + { 0x91, "nature/animals/environment" }, + { 0x92, "technology/natural sciences" }, + { 0x93, "medicine/physiology/psychology" }, + { 0x94, "foreign countries/expeditions" }, + { 0x95, "social/spiritual sciences" }, + { 0x96, "further education" }, + { 0x97, "languages" }, + { 0x9F, "user defined (education/science/factual topics)" }, + + { 0xA0, "leisure hobbies (general)" }, + { 0xA1, "tourism/travel" }, + { 0xA2, "handicraft" }, + { 0xA3, "motoring" }, + { 0xA4, "fitness and health" }, + { 0xA5, "cooking" }, + { 0xA6, "advertisement/shopping" }, + { 0xA7, "gardening" }, + { 0xAF, "user defined (leisure hobbies)" }, + + { 0xB0, "original language" }, + { 0xB1, "black and white" }, + { 0xB2, "unpublished" }, + { 0xB3, "live broadcast" }, + { 0xBF, "user defined (special charateristics)" }, + + { 0x00, NULL } + +}; + +static const value_string mpeg_descr_content_nibble_level_1_vals[] = { + + { 0x1, "Movie/Drama" }, + { 0x2, "News/Current affairs" }, + { 0x3, "Show/Game show" }, + { 0x4, "Sports" }, + { 0x5, "Children's/Youth programmes" }, + { 0x6, "Music/Ballet/Dance" }, + { 0x7, "Arts/Culture (without music)" }, + { 0x8, "Social/Political issues/Economics" }, + { 0x9, "Education/Science/Factual topics" }, + { 0xA, "Leisure hobbies" }, + { 0xB, "Special characteristics" }, + + { 0x00, NULL } +}; + +void +proto_mpeg_descriptor_dissect_content(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + proto_item *ni = NULL; + proto_tree *nibble_tree = NULL; + guint end = offset + len; + + while (offset < end) { + ni = proto_tree_add_item(tree, hf_mpeg_descr_content_nibble, tvb, offset, 1, ENC_BIG_ENDIAN); + nibble_tree = proto_item_add_subtree(ni, ett_mpeg_descriptor_content_nibble); + + proto_tree_add_item(nibble_tree, hf_mpeg_descr_content_nibble_level_1, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(nibble_tree, hf_mpeg_descr_content_nibble_level_2, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_content_user_byte, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + } + +} + +/* 0x55 Parental Rating Descriptor */ +static int hf_mpeg_descr_parental_rating_country_code = -1; +static int hf_mpeg_descr_parental_rating_rating = -1; + +static const value_string mpeg_descr_parental_rating_vals[] = { + { 0x00, "Undefined" }, + { 0x01, "Minimum 4 year old" }, + { 0x02, "Minimum 5 year old" }, + { 0x03, "Minimum 6 year old" }, + { 0x04, "Minimum 7 year old" }, + { 0x05, "Minimum 8 year old" }, + { 0x06, "Minimum 9 year old" }, + { 0x07, "Minimum 10 year old" }, + { 0x08, "Minimum 11 year old" }, + { 0x09, "Minimum 12 year old" }, + { 0x0A, "Minimum 13 year old" }, + { 0x0B, "Minimum 14 year old" }, + { 0x0C, "Minimum 15 year old" }, + { 0x0D, "Minimum 16 year old" }, + { 0x0E, "Minimum 17 year old" }, + { 0x0F, "Minimum 18 year old" }, + + { 0x00, NULL }, +}; + +void +proto_mpeg_descriptor_dissect_parental_rating(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + guint8 rating = 0; + + proto_tree_add_item(tree, hf_mpeg_descr_parental_rating_country_code, tvb, offset, 3, ENC_NA); + offset += 3; + + rating = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_parental_rating_rating, tvb, offset, 1, ENC_NA); +} + +/* 0x56 Teletext Descriptor */ +static int hf_mpeg_descr_teletext_lang_code = -1; +static int hf_mpeg_descr_teletext_type = -1; +static int hf_mpeg_descr_teletext_magazine_number = -1; +static int hf_mpeg_descr_teletext_page_number = -1; + +#define MPEG_DESCR_TELETEXT_TYPE_MASK 0xF8 +#define MPEG_DESCR_TELETEXT_MAGAZINE_NUMBER_MASK 0x07 + +static const value_string mpeg_descr_teletext_type_vals[] = { + { 0x00, "Reserved" }, + { 0x01, "Initial Teletext Page" }, + { 0x02, "Teletext Subtitle Page" }, + { 0x03, "Additional Information Page" }, + { 0x04, "Programme Schedule Page" }, + { 0x05, "Teletext Subtitle Page for hearing impaired people" }, + + { 0, NULL } + +}; + +void +proto_mpeg_descriptor_dissect_teletext(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + guint end = offset + len; + + while (offset < end) { + proto_tree_add_item(tree, hf_mpeg_descr_teletext_lang_code, tvb, offset, 3, ENC_NA); + offset += 3; + + proto_tree_add_item(tree, hf_mpeg_descr_teletext_type, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_teletext_magazine_number, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_teletext_page_number, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + } +} + +/* 0x59 Subtitling Descriptor */ +static int hf_mpeg_descr_subtitling_lang_code = -1; +static int hf_mpeg_descr_subtitling_type = -1; +static int hf_mpeg_descr_subtitling_composition_page_id = -1; +static int hf_mpeg_descr_subtitling_ancillary_page_id = -1; + + +static const value_string mpeg_descr_subtitling_type_vals[] = { + { 0x01, "EBU Teletext subtitles" }, + { 0x02, "associated EBU Teletext" }, + { 0x03, "VBI data" }, + { 0x10, "DVB subtitles (normal) with no monitor aspect ratio criticality" }, + { 0x11, "DVB subtitles (normal) for display on 4:3 aspect ratio monitor" }, + { 0x12, "DVB subtitles (normal) for display on 16:9 aspect ratio monitor" }, + { 0x13, "DVB subtitles (normal) for display on 2.21:1 aspect ratio monitor" }, + { 0x14, "DVB subtitles (normal) for display on a high definition monitor" }, + { 0x20, "DVB subtitles (for the hard of hearing) with no monitor aspect ratio criticality" }, + { 0x21, "DVB subtitles (for the hard of hearing) for display on 4:3 aspect ratio monitor" }, + { 0x22, "DVB subtitles (for the hard of hearing) for display on 16:9 aspect ratio monitor" }, + { 0x23, "DVB subtitles (for the hard of hearing) for display on 2.21:1 aspect ratio monitor" }, + { 0x24, "DVB subtitles (for the hard of hearing) for display on a high definition monitor" }, + { 0x30, "Open (in-vision) sign language interpretation for the deaf" }, + { 0x31, "Closed sign language interpretation for the deaf" }, + { 0x40, "video up-sampled from standard definition source material" }, + + { 0, NULL } +}; +void +proto_mpeg_descriptor_dissect_subtitling(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + guint end = offset + len; + + while (offset < end) { + proto_tree_add_item(tree, hf_mpeg_descr_subtitling_lang_code, tvb, offset, 3, ENC_NA); + offset += 3; + + proto_tree_add_item(tree, hf_mpeg_descr_subtitling_type, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_subtitling_composition_page_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(tree, hf_mpeg_descr_subtitling_ancillary_page_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + } +} + +/* 0x5F Private Data Specifier */ +static int hf_mpeg_descr_private_data_specifier_id = -1; + +void +proto_mpeg_descriptor_dissect_private_data_specifier(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + proto_tree_add_item(tree, hf_mpeg_descr_private_data_specifier_id, tvb, offset, 4, ENC_BIG_ENDIAN); +} + +/* 0x64 Data Broadcast Descriptor */ +static int hf_mpeg_descr_data_bcast_bcast_id = -1; +static int hf_mpeg_descr_data_bcast_component_tag = -1; +static int hf_mpeg_descr_data_bcast_selector_len = -1; +static int hf_mpeg_descr_data_bcast_selector_bytes = -1; +static int hf_mpeg_descr_data_bcast_lang_code = -1; +static int hf_mpeg_descr_data_bcast_text_len = -1; +static int hf_mpeg_descr_data_bcast_text = -1; + +static const value_string mpeg_descr_data_bcast_id_vals[] = { + + { 0x0001, "Data pipe" }, + { 0x0002, "Asynchronous data stream" }, + { 0x0003, "Synchronous data stream" }, + { 0x0004, "Synchronised data stream" }, + { 0x0005, "Multi protocol encapsulation" }, + { 0x0006, "Data Carousel" }, + { 0x0007, "Object Carousel" }, + { 0x0008, "DVB ATM streams" }, + { 0x0009, "Higher Protocols based on asynchronous data streams" }, + { 0x000A, "System Software Update service" }, + { 0x000B, "IP/MAC Notification service" }, + { 0x00F0, "MHP Object Carousel" }, + { 0x00F1, "MHP Multiprotocol Encapsulation" }, + /* See dvbservices.com for complete and current list */ + + { 0, NULL } +}; + +void +proto_mpeg_descriptor_dissect_data_bcast(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + + guint8 selector_len = 0, text_len = 0; + + proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_bcast_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_component_tag, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + selector_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_selector_len, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + if (selector_len > 0) { + proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_selector_bytes, tvb, offset, selector_len, ENC_BIG_ENDIAN); + offset += selector_len; + } + + proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_lang_code, tvb, offset, 3, ENC_NA); + offset += 3; + + text_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_text_len, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + if (text_len > 0) + proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_text, tvb, offset, text_len, ENC_NA); +} + +/* 0x66 Data Broadcast ID Descriptor */ +static int hf_mpeg_descr_data_bcast_id_bcast_id = -1; +static int hf_mpeg_descr_data_bcast_id_id_selector_bytes = -1; + +void +proto_mpeg_descriptor_dissect_data_bcast_id(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_id_bcast_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + if (len > 2) + proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_id_id_selector_bytes, tvb, offset, len - 2, ENC_NA); +} + +/* 0xA2 Logon Initialize Descriptor */ + + +/* 0x73 Default Authority Descriptor */ +static int hf_mpeg_descr_default_authority_name = -1; + +void +proto_mpeg_descriptor_dissect_default_authority(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + proto_tree_add_item(tree, hf_mpeg_descr_default_authority_name, tvb, offset, len, ENC_BIG_ENDIAN); +} + +/* 0x76 Content Identifier Descriptor */ +static int hf_mpeg_descr_content_identifier_crid_type = -1; +static int hf_mpeg_descr_content_identifier_crid_location = -1; +static int hf_mpeg_descr_content_identifier_crid_length = -1; +static int hf_mpeg_descr_content_identifier_crid_bytes = -1; +static int hf_mpeg_descr_content_identifier_cird_ref = -1; + +#define MPEG_DESCR_CONTENT_IDENTIFIER_CRID_TYPE_MASK 0xFC +#define MPEG_DESCR_CONTENT_IDENTIFIER_CRID_LOCATION_MASK 0x03 + +static gint ett_mpeg_descriptor_content_identifier_crid = -1; + +static const value_string mpeg_descr_content_identifier_crid_type_vals[] = { + { 0x00, "No type defined" }, + { 0x01, "CRID references the item of content that this event is an instance of" }, + { 0x02, "CRID references a series that this event belongs to" }, + { 0x03, "CRID references a recommendation" }, + + { 0, NULL } +}; + +static const value_string mpeg_descr_content_identifier_crid_location_vals[] = { + { 0x00, "Carried explicitly within descriptor" }, + { 0x01, "Carried in Content Identifier Table (CIT)" }, + + { 0, NULL } +}; + +void +proto_mpeg_descriptor_dissect_content_identifier(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + guint end = offset + len, crid_len = 0; + guint8 crid = 0, crid_location = 0, crid_type = 0; + + proto_item *ci; + proto_tree *crid_tree; + + while (offset < end) { + crid = tvb_get_guint8(tvb, offset); + crid_type = (crid & MPEG_DESCR_CONTENT_IDENTIFIER_CRID_LOCATION_MASK) >> 2; + crid_location = crid & MPEG_DESCR_CONTENT_IDENTIFIER_CRID_LOCATION_MASK; + + if (crid_location == 0) { + crid_len = 2 + tvb_get_guint8(tvb, offset + 1); + } else if (crid_location == 1) { + crid_len = 3; + } else { + crid_len = 1; + } + + ci = proto_tree_add_text(tree, tvb, offset, crid_len, "CRID type=0%02x", crid_type); + crid_tree = proto_item_add_subtree(ci, ett_mpeg_descriptor_content_identifier_crid); + + proto_tree_add_item(crid_tree, hf_mpeg_descr_content_identifier_crid_type, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(crid_tree, hf_mpeg_descr_content_identifier_crid_location, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + if (crid_location == 0x00) { + crid_len = tvb_get_guint8(tvb, offset); + proto_tree_add_item(crid_tree, hf_mpeg_descr_content_identifier_crid_length, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(crid_tree, hf_mpeg_descr_content_identifier_crid_bytes, tvb, offset, crid_len, ENC_NA); + offset += crid_len; + } else if (crid_location == 0x01) { + proto_tree_add_item(crid_tree, hf_mpeg_descr_content_identifier_cird_ref, tvb, offset, 2, ENC_BIG_ENDIAN); + } + + } + + +} + +/* A2 Logon Initialize Descriptor */ +static int hf_mpeg_descr_logon_initialize_group_id = -1; +static int hf_mpeg_descr_logon_initialize_logon_id = -1; +static int hf_mpeg_descr_logon_initialize_continuous_carrier_reserved = -1; +static int hf_mpeg_descr_logon_initialize_continuous_carrier = -1; +static int hf_mpeg_descr_logon_initialize_security_handshake_required = -1; +static int hf_mpeg_descr_logon_initialize_prefix_flag = -1; +static int hf_mpeg_descr_logon_initialize_data_unit_labelling_flag = -1; +static int hf_mpeg_descr_logon_initialize_mini_slot_flag = -1; +static int hf_mpeg_descr_logon_initialize_contention_based_mini_slot_flag = -1; +static int hf_mpeg_descr_logon_initialize_capacity_type_flag_reserved = -1; +static int hf_mpeg_descr_logon_initialize_capacity_type_flag = -1; +static int hf_mpeg_descr_logon_initialize_traffic_burst_type = -1; +static int hf_mpeg_descr_logon_initialize_connectivity = -1; +static int hf_mpeg_descr_logon_initialize_return_vpi_reserved = -1; +static int hf_mpeg_descr_logon_initialize_return_vpi = -1; +static int hf_mpeg_descr_logon_initialize_return_vci = -1; +static int hf_mpeg_descr_logon_initialize_return_signalling_vpi_reserved = -1; +static int hf_mpeg_descr_logon_initialize_return_signalling_vpi = -1; +static int hf_mpeg_descr_logon_initialize_return_signalling_vci = -1; +static int hf_mpeg_descr_logon_initialize_forward_signalling_vpi_reserved = -1; +static int hf_mpeg_descr_logon_initialize_forward_signalling_vpi = -1; +static int hf_mpeg_descr_logon_initialize_forward_signalling_vci = -1; + +static int hf_mpeg_descr_logon_initialize_return_trf_pid = -1; +static int hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid_reserved = -1; +static int hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid = -1; + +static int hf_mpeg_descr_logon_initialize_cra_level = -1; +static int hf_mpeg_descr_logon_initialize_vbdc_max_reserved = -1; +static int hf_mpeg_descr_logon_initialize_vbdc_max = -1; +static int hf_mpeg_descr_logon_initialize_rbdc_max = -1; +static int hf_mpeg_descr_logon_initialize_rbdc_timeout = -1; + + +#define MPEG_DESCR_LOGON_INITIALIZE_CONTINUOUS_CARRIER_RESERVED_MASK 0xC0 +#define MPEG_DESCR_LOGON_INITIALIZE_CONTINUOUS_CARRIER_MASK 0x20 +#define MPEG_DESCR_LOGON_INITIALIZE_SECURITY_HANDSHAKE_REQUIRED_MASK 0x10 +#define MPEG_DESCR_LOGON_INITIALIZE_PREFIX_FLAG_MASK 0x08 +#define MPEG_DESCR_LOGON_INITIALIZE_DATA_UNIT_LABELLING_FLAG_MASK 0x04 +#define MPEG_DESCR_LOGON_INITIALIZE_MINI_SLOT_FLAG_MASK 0x02 +#define MPEG_DESCR_LOGON_INITIALIZE_CONTENTION_BASED_MINI_SLOT_FLAG_MASK 0x01 + +#define MPEG_DESCR_LOGON_INITIALIZE_CAPACITY_TYPE_FLAG_RESERVED_MASK 0x80 +#define MPEG_DESCR_LOGON_INITIALIZE_CAPACITY_TYPE_FLAG_MASK 0x40 +#define MPEG_DESCR_LOGON_INITIALIZE_TRAFFIC_BURST_TYPE_MASK 0x20 + +#define MPEG_DESCR_LOGON_INITIALIZE_RETURN_TRF_PID_MASK 0x1FFF +#define MPEG_DESCR_LOGON_INITIALIZE_RETURN_CTRL_MNGM_PID_RESERVED_MASK 0xE000 +#define MPEG_DESCR_LOGON_INITIALIZE_RETURN_CTRL_MNGM_PID_MASK 0x1FFF + +#define MPEG_DESCR_LOGON_INITIALIZE_CONNECTIVITY_MASK 0x1000 +#define MPEG_DESCR_LOGON_INITIALIZE_RETURN_VPI_RESERVED_MASK 0x0F00 +#define MPEG_DESCR_LOGON_INITIALIZE_RETURN_VPI_MASK 0x00FF + +#define MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_RESERVED_MASK 0x0F00 +#define MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_MASK 0x00FF +#define MPEG_DESCR_LOGON_INITIALIZE_FORWARD_SIGNALLING_VPI_RESERVED_MASK 0xFF00 +#define MPEG_DESCR_LOGON_INITIALIZE_FORWARD_SIGNALLING_VPI_MASK 0x00FF + +#define MPEG_DESCR_LOGON_INITIALIZE_VDBC_MAX_RESERVED_MASK 0xF800 +#define MPEG_DESCR_LOGON_INITIALIZE_VDBC_MAX_MASK 0x0700 + + +void +proto_mpeg_descriptor_dissect_logon_initialize(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + + guint end = offset + len; + guint8 flags = 0; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_group_id, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_logon_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_continuous_carrier_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_continuous_carrier, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_security_handshake_required, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_prefix_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_data_unit_labelling_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_mini_slot_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_contention_based_mini_slot_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + flags = tvb_get_guint8(tvb, offset); + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_capacity_type_flag_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_capacity_type_flag, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_traffic_burst_type, tvb, offset, 1, ENC_BIG_ENDIAN); + if (flags & MPEG_DESCR_LOGON_INITIALIZE_TRAFFIC_BURST_TYPE_MASK) { + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_connectivity, tvb, offset, 2, ENC_BIG_ENDIAN); + if (flags & MPEG_DESCR_LOGON_INITIALIZE_CONNECTIVITY_MASK) { + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_signalling_vpi_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_signalling_vpi, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_signalling_vci, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_forward_signalling_vpi_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_forward_signalling_vpi, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_forward_signalling_vci, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + } else { + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_vpi_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_vpi, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_vci, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + } + } else { + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_trf_pid, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + } + + if (offset < end && (flags & MPEG_DESCR_LOGON_INITIALIZE_CONNECTIVITY_MASK)) { + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_cra_level, tvb, offset, 3, ENC_BIG_ENDIAN); + offset += 3; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_vbdc_max_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_vbdc_max, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_rbdc_max, tvb, offset, 3, ENC_BIG_ENDIAN); + offset += 3; + + proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_rbdc_timeout, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + } +} + +/* 0xA7 RCS Content Descriptor */ +static int hf_mpeg_descr_rcs_content_table_id = -1; + +void +proto_mpeg_descriptor_dissect_rcs_content(tvbuff_t *tvb, guint offset, guint8 len, proto_tree *tree) +{ + guint end = offset + len; + + while (offset < end) { + proto_tree_add_item(tree, hf_mpeg_descr_rcs_content_table_id, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + } +} + +/* Common dissector */ + +guint +proto_mpeg_descriptor_dissect(tvbuff_t *tvb, guint offset, proto_tree *tree) +{ + guint8 tag = 0, len = 0; + + proto_item *di = NULL; + proto_tree *descriptor_tree = NULL; + + tag = tvb_get_guint8(tvb, offset); + len = tvb_get_guint8(tvb, offset + 1); + + + di = proto_tree_add_text(tree, tvb, offset, len + 2, "Descriptor Tag=0x%02hhx", tag); + descriptor_tree = proto_item_add_subtree(di, ett_mpeg_descriptor); + + proto_tree_add_item(descriptor_tree, hf_mpeg_descriptor_tag, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(descriptor_tree, hf_mpeg_descriptor_length, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + switch (tag) { + case 0x02: /* Video Stream Descriptor */ + proto_mpeg_descriptor_dissect_video_stream(tvb, offset, descriptor_tree); + break; + case 0x03: /* Audio Stream Descriptor */ + proto_mpeg_descriptor_dissect_audio_stream(tvb, offset, descriptor_tree); + break; + case 0x06: /* Data Stream Alignment Descriptor */ + proto_mpeg_descriptor_dissect_data_stream_alignment(tvb, offset, descriptor_tree); + break; + case 0x09: /* CA Descriptor */ + proto_mpeg_descriptor_dissect_ca(tvb, offset, len, descriptor_tree); + break; + case 0x0A: /* ISO 639 Language Descriptor */ + proto_mpeg_descriptor_dissect_iso639(tvb, offset, len, descriptor_tree); + break; + case 0x0B: /* System Clock Descriptor */ + proto_mpeg_descriptor_dissect_system_clock(tvb, offset, descriptor_tree); + break; + case 0x0E: /* Maximum Bitrate Descriptor */ + proto_mpeg_descriptor_dissect_max_bitrate(tvb, offset, descriptor_tree); + break; + case 0x10: /* Smoothing Buffer Descriptor */ + proto_mpeg_descriptor_dissect_smoothing_buffer(tvb, offset, descriptor_tree); + break; + case 0x11: /* STD Descriptor */ + proto_mpeg_descriptor_dissect_std(tvb, offset, descriptor_tree); + break; + case 0x13: /* Carousel Identifier Descriptor */ + proto_mpeg_descriptor_dissect_carousel_identifier(tvb, offset, len, descriptor_tree); + break; + case 0x14: /* Association Tag Descriptor */ + proto_mpeg_descriptor_dissect_association_tag(tvb, offset, len, descriptor_tree); + break; + case 0x28: /* AVC Video Descriptor */ + proto_mpeg_descriptor_dissect_avc_vid(tvb, offset, descriptor_tree); + break; + case 0x45: /* VBI Data Descriptor */ + proto_mpeg_descriptor_dissect_vbi_data(tvb, offset, len, descriptor_tree); + break; + case 0x48: /* Service Descriptor */ + proto_mpeg_descriptor_dissect_service(tvb, offset, descriptor_tree); + break; + case 0x4D: /* Short Event Descriptor */ + proto_mpeg_descriptor_dissect_short_event(tvb, offset, descriptor_tree); + break; + case 0x4E: /* Extended Event Descriptor */ + proto_mpeg_descriptor_dissect_extended_event(tvb, offset, descriptor_tree); + break; + case 0x50: /* Component Descriptor */ + proto_mpeg_descriptor_dissect_component(tvb, offset, len, descriptor_tree); + break; + case 0x52: /* Stream Identifier Descriptor */ + proto_mpeg_descriptor_dissect_stream_identifier(tvb, offset, descriptor_tree); + break; + case 0x53: /* CA Identifier Descriptor */ + proto_mpeg_descriptor_dissect_ca_identifier(tvb, offset, len, descriptor_tree); + break; + case 0x54: /* Content Descriptor */ + proto_mpeg_descriptor_dissect_content(tvb, offset, len, descriptor_tree); + break; + case 0x55: /* Parental Rating Descriptor */ + proto_mpeg_descriptor_dissect_parental_rating(tvb, offset, descriptor_tree); + break; + case 0x56: /* Teletext Descriptor */ + proto_mpeg_descriptor_dissect_teletext(tvb, offset, len, descriptor_tree); + break; + case 0x59: /* Subtitling Descriptor */ + proto_mpeg_descriptor_dissect_subtitling(tvb, offset, len, descriptor_tree); + break; + case 0x5F: /* Private Data Specifier Descriptor */ + proto_mpeg_descriptor_dissect_private_data_specifier(tvb, offset, descriptor_tree); + break; + case 0x64: /* Data Broadcast Descriptor */ + proto_mpeg_descriptor_dissect_data_bcast(tvb, offset, descriptor_tree); + break; + case 0x66: /* Data Broadcast ID Descriptor */ + proto_mpeg_descriptor_dissect_data_bcast_id(tvb, offset, len, descriptor_tree); + break; + case 0x73: /* Default Authority Descriptor */ + proto_mpeg_descriptor_dissect_default_authority(tvb, offset, len, descriptor_tree); + break; + case 0x76: /* Content Identifier Descriptor */ + proto_mpeg_descriptor_dissect_content_identifier(tvb, offset, len, descriptor_tree); + break; + case 0xA2: /* Logon Initialize Descriptor */ + proto_mpeg_descriptor_dissect_logon_initialize(tvb, offset, len, descriptor_tree); + break; + case 0xA7: /* RCS Content Descriptor */ + proto_mpeg_descriptor_dissect_rcs_content(tvb, offset, len, descriptor_tree); + break; + default: + proto_tree_add_item(descriptor_tree, hf_mpeg_descriptor_data, tvb, offset, len, ENC_BIG_ENDIAN); + break; + } + + + return len + 2; +} + + +void +proto_register_mpeg_descriptor(void) +{ + + static hf_register_info hf[] = { + { &hf_mpeg_descriptor_tag, { + "Descriptor Tag", "mpeg_descr.tag", + FT_UINT8, BASE_HEX, VALS(mpeg_descriptor_tag_vals), 0, NULL, HFILL + } }, + + { &hf_mpeg_descriptor_length, { + "Descriptor Length", "mpeg_descr.len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descriptor_data, { + "Descriptor Data", "mpeg_descr.data", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x02 Video Stream Descriptor */ + { &hf_mpeg_descr_video_stream_multiple_frame_rate_flag, { + "Multiple Frame Rate Flag", "mpeg_descr.video_stream.multiple_frame_rate_flag", + FT_UINT8, BASE_DEC, VALS(mpeg_descr_video_stream_multiple_frame_rate_flag_vals), MPEG_DESCR_VIDEO_STREAM_MULTIPLE_FRAME_RATE_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_video_stream_frame_rate_code, { + "Frame Rate Code", "mpeg_descr.video_stream.frame_rate_code", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_VIDEO_STREAM_FRAME_RATE_CODE_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_video_stream_mpeg1_only_flag, { + "MPEG1 Only Flag", "mpeg_descr.video_stream.mpeg1_only_flag", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_VIDEO_STREAM_MPEG1_ONLY_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_video_stream_constrained_parameter_flag, { + "Constrained Parameter Flag", "mpeg_descr.video_stream.constrained_parameter_flag", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_VIDEO_STREAM_CONSTRAINED_PARAMETER_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_video_stream_still_picture_flag, { + "Still Picture Flag", "mpeg_descr.video_stream.still_picture_flag", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_VIDEO_STREAM_STILL_PICTURE_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_video_stream_profile_and_level_indication, { + "Profile and Level Indication", "mpeg_descr.video_stream.profile_level_ind", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_video_stream_chroma_format, { + "Chroma Format", "mpeg_descr.video_stream.chroma_format", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_video_stream_frame_rate_extension_flag, { + "Frame Rate Extension Flag", "mpeg_descr.video_stream.frame_rate_extension_flag", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_VIDEO_STREAM_FRAME_RATE_EXTENSION_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_video_stream_reserved, { + "Reserved", "mpeg_descr.video_stream.reserved", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_VIDEO_STREAM_RESERVED_MASK, NULL, HFILL + } }, + + /* 0x03 Audio Stream Descriptor */ + { &hf_mpeg_descr_audio_stream_free_format_flag, { + "Free Format Flag", "mpeg_descr.audio_stream.free_format_flag", + FT_UINT8, BASE_DEC, VALS(mpeg_descr_audio_stream_free_format_flag_vals), MPEG_DESCR_AUDIO_STREAM_FREE_FORMAT_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_audio_stream_id, { + "ID", "mpeg_descr.audio_stream.id", + FT_UINT8, BASE_DEC, VALS(mpeg_descr_audio_stream_id_vals), MPEG_DESCR_AUDIO_STREAM_ID_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_audio_stream_layer, { + "Layer", "mpeg_descr.audio_stream.layer", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AUDIO_STREAM_LAYER_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_audio_stream_variable_rate_audio_indicator, { + "Variable Rate Audio Indicator", "mpeg_descr.audio_stream.vbr_indicator", + FT_UINT8, BASE_DEC, VALS(mpeg_descr_audio_stream_variable_rate_audio_indicator_vals), MPEG_DESCR_AUDIO_STREAM_VARIABLE_RATE_AUDIO_INDICATOR_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_audio_stream_reserved, { + "Reserved", "mpeg_descr.audio_stream.reserved", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_AUDIO_STREAM_RESERVED_MASK, NULL, HFILL + } }, + + /* 0x06 Data Stream Alignment Descriptor */ + { &hf_mpeg_descr_data_stream_alignment, { + "Data Stream Alignment", "mpeg_descr.data_stream_alignment.alignment", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_data_stream_alignment_vals), 0, NULL, HFILL + } }, + + /* 0x09 CA Descriptor */ + { &hf_mpeg_descr_ca_system_id, { + "System ID", "mpeg_descr.ca.sys_id", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_ca_reserved, { + "Reserved", "mpeg_descr.ca.reserved", + FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_CA_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_ca_pid, { + "CA PID", "mpeg_descr.ca.pid", + FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_CA_PID_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_ca_private, { + "Private bytes", "mpeg_descr.ca.private", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x0A ISO 639 Language Descriptor */ + { &hf_mpeg_descr_iso639_lang, { + "ISO 639 Language Code", "mpeg_descr.lang.code", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_iso639_type, { + "ISO 639 Language Code", "mpeg_descr.lang.type", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_iso639_type_vals), 0, NULL, HFILL + } }, + + /* 0x0B System Clock Descriptor */ + { &hf_mpeg_descr_system_clock_external_clock_reference_indicator, { + "External Clock Reference Indicator", "mpeg_descr.sys_clk.external_clk_ref_ind", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_SYSTEM_CLOCK_EXTERNAL_CLOCK_REFERENCE_INDICATOR_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_system_clock_reserved1, { + "Reserved", "mpeg_descr.sys_clk.reserved1", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_SYSTEM_CLOCK_RESERVED1_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_system_clock_accuracy_integer, { + "Accuracy Integer", "mpeg_descr.sys_clk.accuracy_integer", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_SYSTEM_CLOCK_ACCURACY_INTEGER_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_system_clock_accuracy_exponent, { + "Accuracy Exponent", "mpeg_descr.sys_clk.accuracy_exponent", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_SYSTEM_CLOCK_ACCURACY_EXPONENT_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_system_clock_reserved2, { + "Reserved", "mpeg_descr.sys_clk.reserved2", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_SYSTEM_CLOCK_RESERVED2_MASK, NULL, HFILL + } }, + + /* 0x0E Maximum Bitrate Descriptor */ + { &hf_mpeg_descr_max_bitrate_reserved, { + "Maximum Bitrate Reserved", "mpeg_descr.max_bitrate.reserved", + FT_UINT24, BASE_HEX, NULL, MPEG_DESCR_MAX_BITRATE_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_max_bitrate, { + "Maximum Bitrate", "mpeg_descr.max_bitrate.rate", + FT_UINT24, BASE_DEC, NULL, MPEG_DESCR_MAX_BITRATE_MASK, NULL, HFILL + } }, + + /* 0x10 Smoothing Buffer Descriptor */ + { &hf_mpeg_descr_smoothing_buffer_reserved1, { + "Reserved", "mpeg_descr.smoothing_buf.reserved1", + FT_UINT24, BASE_HEX, NULL, MPEG_DESCR_SMOOTHING_BUFFER_RESERVED1_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_smoothing_buffer_leak_rate, { + "Leak Rate", "mpeg_descr.smoothing_buf.leak_rate", + FT_UINT24, BASE_DEC, NULL, MPEG_DESCR_SMOOTHING_BUFFER_LEAK_RATE_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_smoothing_buffer_reserved2, { + "Reserved", "mpeg_descr.smoothing_buf.reserved2", + FT_UINT24, BASE_HEX, NULL, MPEG_DESCR_SMOOTHING_BUFFER_RESERVED2_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_smoothing_buffer_size, { + "Buffer Size", "mpeg_descr.smoothing_buf.size", + FT_UINT24, BASE_DEC, NULL, MPEG_DESCR_SMOOTHING_BUFFER_SIZE_MASK, NULL, HFILL + } }, + + /* 0x11 STD Descriptor */ + { &hf_mpeg_descr_std_reserved, { + "Reserved", "mpeg_descr.std.reserved", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_STD_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_std_leak_valid, { + "Leak Valid", "mpeg_descr.std.leak_valid", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_STD_LEAK_VALID_MASK, NULL, HFILL + } }, + + /* 0x13 Carousel Identifier Descriptor */ + { &hf_mpeg_descr_carousel_identifier_id, { + "Carousel ID", "mpeg_descr.carousel_identifier.id", + FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_format_id, { + "Format ID", "mpeg_descr.carousel_identifier.format_id", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_carousel_identifier_format_id_vals), 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_module_version, { + "Module Version", "mpeg_descr.carousel_identifier.module_version", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_module_id, { + "Module ID", "mpeg_descr.carousel_identifier.module_id", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_block_size, { + "Block Size", "mpeg_descr.carousel_identifier.block_size", + FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_module_size, { + "Module Size", "mpeg_descr.carousel_identifier.module_size", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_compression_method, { + "Compression Method", "mpeg_descr.carousel_identifier.comp_method", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_original_size, { + "Original Size", "mpeg_descr.carousel_identifier.orig_size", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_timeout, { + "Timeout", "mpeg_descr.carousel_identifier.timeout", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_object_key_len, { + "Object Key Length", "mpeg_descr.carousel_identifier.key_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_object_key_data, { + "Object Key Data", "mpeg_descr.carousel_identifier.key_data", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_carousel_identifier_private, { + "Private Bytes", "mpeg_descr.carousel_identifier.private", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x14 Association Tag Descriptor */ + { &hf_mpeg_descr_association_tag, { + "Association Tag", "mpeg_descr.assoc_tag.tag", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_association_tag_use, { + "Use", "mpeg_descr.assoc_tag.use", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_association_tag_selector_len, { + "Selector Length", "mpeg_descr.assoc_tag.selector_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_association_tag_transaction_id, { + "Transaction ID", "mpeg_descr.assoc_tag.transaction_id", + FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_association_tag_timeout, { + "Timeout", "mpeg_descr.assoc_tag.timeout", + FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_association_tag_selector_bytes, { + "Selector Bytes", "mpeg_descr.assoc_tag.selector_bytes", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_association_tag_private_bytes, { + "Private Bytes", "mpeg_descr.assoc_tag.private_bytes", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + + /* 0x28 AVC Video Descriptor */ + { &hf_mpeg_descr_avc_vid_profile_idc, { + "Profile IDC", "mpeg_descr.avc_vid.profile_idc", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_avc_vid_constraint_set0_flag, { + "Constraint Set0 Flag", "mpeg_descr.avc_vid.contraint_set0", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AVC_VID_CONSTRAINT_SET0_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_avc_vid_constraint_set1_flag, { + "Constraint Set1 Flag", "mpeg_descr.avc_vid.contraint_set1", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AVC_VID_CONSTRAINT_SET1_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_avc_vid_constraint_set2_flag, { + "Constraint Set2 Flag", "mpeg_descr.avc_vid.contraint_set2", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AVC_VID_CONSTRAINT_SET2_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_avc_vid_compatible_flags, { + "Constraint Compatible Flags", "mpeg_descr.avc_vid.compatible_flags", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_AVC_VID_COMPATIBLE_FLAGS_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_avc_vid_level_idc, { + "Level IDC", "mpeg_descr.avc_vid.level_idc", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_avc_vid_still_present, { + "AVC Still Present", "mpeg_descr.avc_vid.still_present", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AVC_VID_STILL_PRESENT_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_avc_vid_24h_picture_flag, { + "AVC 24 Hour Picture Flag", "mpeg_descr.avc_vid.24h_picture_flag", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AVC_VID_24H_PICTURE_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_avc_vid_reserved, { + "Reserved", "mpeg_descr.avc_vid.reserved", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_AVC_VID_RESERVED_MASK, NULL, HFILL + } }, + + /* 0x45 VBI Data Descriptor */ + { &hf_mpeg_descr_vbi_data_service_id, { + "Data Service ID", "mpeg_descr.vbi_data.svc_id", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_vbi_data_service_id_vals), 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_vbi_data_descr_len, { + "Data Descriptor Length", "mpeg_descr.vbi_data.decr_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_vbi_data_reserved1, { + "Reserved", "mpeg_descr.vbi_data.reserved1", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_VBI_DATA_RESERVED1_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_vbi_data_field_parity, { + "Field Parity", "mpeg_descr.vbi_data.field_parity", + FT_UINT8, BASE_DEC, VALS(mpeg_descr_vbi_data_field_parity_vals), MPEG_DESCR_VBI_DATA_FIELD_PARITY_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_vbi_data_line_offset, { + "Line offset", "mpeg_descr.vbi_data.line_offset", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_vbi_data_reserved2, { + "Reserved", "mpeg_descr.vbi_data.reserved2", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x48 Service Descriptor */ + { &hf_mpeg_descr_service_type, { + "Service Type", "mpeg_descr.svc.type", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_service_type_vals), 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_service_provider_name_length, { + "Provider Name Length", "mpeg_descr.svc.provider_name_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_service_provider, { + "Service Provided Name", "mpeg_descr.svc.provider_name", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_service_name_length, { + "Service Name Length", "mpeg_descr.svc.svc_name_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_service_name, { + "Service Name", "mpeg_descr.svc.svc_name", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x4D Short Event Descriptor */ + { &hf_mpeg_descr_short_event_lang_code, { + "Language Code", "mpeg_descr.short_evt.lang_code", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_short_event_name_length, { + "Event Name Length", "mpeg_descr.short_evt.name_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_short_event_name, { + "Event Name", "mpeg_descr.short_evt.name", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_short_event_text_length, { + "Event Text Length", "mpeg_descr.short_evt.txt_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_short_event_text, { + "Event Text", "mpeg_descr.short_evt.txt", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x4E Extended Event Descriptor */ + { &hf_mpeg_descr_extended_event_descriptor_number, { + "Descriptor Number", "mpeg_descr.ext_evt.descr_num", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_EXTENDED_EVENT_DESCRIPTOR_NUMBER_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_extended_event_last_descriptor_number, { + "Last Descriptor Number", "mpeg_descr.ext_evt.last_descr_num", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_EXTENDED_EVENT_LAST_DESCRIPTOR_NUMBER_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_extended_event_lang_code, { + "Language Code", "mpeg_descr.ext_evt.lang_code", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_extended_event_length_of_items, { + "Length of items", "mpeg_descr.ext_evt.items_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_extended_event_item_description_length, { + "Item Description Length", "mpeg_descr.ext_evt.item_descr_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_extended_event_item_description_char, { + "Item Description", "mpeg_descr.ext_evt.item_descr", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_extended_event_item_length, { + "Item Length", "mpeg_descr.ext_evt.item_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_extended_event_item_char, { + "Item", "mpeg_descr.ext_evt.item", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_extended_event_text_length, { + "Text Length", "mpeg_descr.ext_evt.txt_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_extended_event_text_char, { + "Text", "mpeg_descr.ext_evt.txt", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x50 Component Descriptor */ + { &hf_mpeg_descr_component_reserved, { + "Reserved", "mpeg_descr.component.reserved", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_COMPONENT_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_component_stream_content, { + "Stream Content", "mpeg_descr.component.stream_content", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_component_stream_content_vals), MPEG_DESCR_COMPONENT_STREAM_CONTENT_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_component_type, { + "Component Type", "mpeg_descr.component.type", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_component_content_type, { + "Stream Content and Component Type", "mpeg_descr.component.content_type", + FT_UINT16, BASE_HEX, VALS(mpeg_descr_component_content_type_vals), MPEG_DESCR_COMPONENT_CONTENT_TYPE_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_component_tag, { + "Component Tag", "mpeg_descr.component.tag", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_component_lang_code, { + "Language Code", "mpeg_descr.component.lang_code", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_component_text, { + "Text", "mpeg_descr.component.text", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x52 Stream Identifier Descriptor */ + { &hf_mpeg_descr_stream_identifier_component_tag, { + "Component Tag", "mpeg_descr.stream_id.component_tag", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + /* 0x53 CA Identifier Descriptor */ + { &hf_mpeg_descr_ca_identifier_system_id, { + "CA System ID", "mpeg_descr.ca_id.sys_id", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + /* 0x54 Content Descriptor */ + { &hf_mpeg_descr_content_nibble, { + "Nibble Level 1 and 2", "mpeg_descr.content.nibble_1_2", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_content_nibble_vals), 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_content_nibble_level_1, { + "Nibble Level 1", "mpeg_descr.content.nibble_lvl_1", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_content_nibble_level_1_vals), MPEG_DESCR_CONTENT_NIBBLE_LEVEL_1_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_content_nibble_level_2, { + "Nibble Level 2", "mpeg_descr.content.nibble_lvl_2", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_CONTENT_NIBBLE_LEVEL_2_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_content_user_byte, { + "User Byte", "mpeg_descr.content.user", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + /* 0x56 Teletext Descriptor */ + { &hf_mpeg_descr_teletext_lang_code, { + "Language Code", "mpeg_descr.teletext.lang_code", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_teletext_type, { + "Teletext Type", "mpeg_descr.teletext.type", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_teletext_type_vals), MPEG_DESCR_TELETEXT_TYPE_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_teletext_magazine_number, { + "Magazine Number", "mpeg_descr.teletext.magazine_num", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_TELETEXT_MAGAZINE_NUMBER_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_teletext_page_number, { + "Page Number", "mpeg_descr.teletext.page_num", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + + /* 0x55 Parental Rating Descriptor */ + { &hf_mpeg_descr_parental_rating_country_code, { + "Country Code", "mpeg_descr.parental_rating.country_code", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_parental_rating_rating, { + "Rating", "mpeg_descr.parental_rating.rating", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_parental_rating_vals), 0, NULL, HFILL + } }, + + /* 0x59 Subtitling Descriptor */ + { &hf_mpeg_descr_subtitling_lang_code, { + "Language Code", "mpeg_descr.subtitling.lang_code", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_subtitling_type, { + "Subtitling Type", "mpeg_descr.subtitling.type", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_subtitling_type_vals), 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_subtitling_composition_page_id, { + "Composition Page ID", "mpeg_descr.subtitling.composition_page_id", + FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_subtitling_ancillary_page_id, { + "Ancillary Page ID", "mpeg_descr.subtitling.ancillary_page_id", + FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + /* 0x5F Private Data Specifier */ + { &hf_mpeg_descr_private_data_specifier_id, { + "Private Data Specifier", "mpeg_descr.private_data_specifier.id", + FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + /* 0x64 Data Broadcast Descriptor */ + { &hf_mpeg_descr_data_bcast_bcast_id, { + "Data Broadcast ID", "mpeg_descr.data_bcast.id", + FT_UINT16, BASE_HEX, VALS(mpeg_descr_data_bcast_id_vals), 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_data_bcast_component_tag, { + "Component Tag", "mpeg_descr.data_bcast.component_tag", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_data_bcast_selector_len, { + "Selector Length", "mpeg_descr.data_bcast.selector_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_data_bcast_selector_bytes, { + "Selector Bytes", "mpeg_descr.data_bcast.selector_bytes", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_data_bcast_lang_code, { + "Language Code", "mpeg_descr.data_bcast.lang_code", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_data_bcast_text_len, { + "Text Length", "mpeg_descr.data_bcast.text_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_data_bcast_text, { + "Text", "mpeg_descr.data_bcast.text", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x66 Data Broadcast ID Descriptor */ + { &hf_mpeg_descr_data_bcast_id_bcast_id, { + "Data Broadcast ID", "mpeg_descr.data_bcast_id.id", + FT_UINT16, BASE_HEX, VALS(mpeg_descr_data_bcast_id_vals), 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_data_bcast_id_id_selector_bytes, { + "ID Selector Bytes", "mpeg_descr.data_bcast_id.id_selector_bytes", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x73 Default Authority Descriptor */ + { &hf_mpeg_descr_default_authority_name, { + "Default Authority Name", "mpeg_descr.default_authority.name", + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + /* 0x77 Content Identifier Descriptor */ + { &hf_mpeg_descr_content_identifier_crid_type, { + "CRID Type", "mpeg_descr.content_identifier.crid_type", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_content_identifier_crid_type_vals), MPEG_DESCR_CONTENT_IDENTIFIER_CRID_TYPE_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_content_identifier_crid_location, { + "CRID Location", "mpeg_descr.content_identifier.crid_location", + FT_UINT8, BASE_HEX, VALS(mpeg_descr_content_identifier_crid_location_vals), MPEG_DESCR_CONTENT_IDENTIFIER_CRID_LOCATION_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_content_identifier_crid_length, { + "CRID Length", "mpeg_descr.content_identifier.crid_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_content_identifier_crid_bytes, { + "CRID Bytes", "mpeg_descr.content_identifier.crid_bytes", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_content_identifier_cird_ref, { + "CRID Reference", "mpeg_descr.content_identifier.crid_ref", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + /* 0xA2 Logon Initialize Descriptor */ + { &hf_mpeg_descr_logon_initialize_group_id, { + "Group ID", "mpeg_descr.logon_init.group_id", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_logon_id, { + "Logon ID", "mpeg_descr.logon_init.logon_id", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_continuous_carrier_reserved, { + "Continuous Carrier Reserved", "mpeg_descr.logon_init.continuous_carrier_reserved", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_CONTINUOUS_CARRIER_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_continuous_carrier, { + "Continuous Carrier", "mpeg_descr.logon_init.continuous_carrier", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_CONTINUOUS_CARRIER_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_security_handshake_required, { + "Security Handshake Required", "mpeg_descr.logon_init.security_handshake_required", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_SECURITY_HANDSHAKE_REQUIRED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_prefix_flag, { + "Prefix Flag", "mpeg_descr.logon_init.prefix_flag", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_PREFIX_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_data_unit_labelling_flag, { + "Unit Labelling Flag", "mpeg_descr.logon_init.data_unit_labelling_flag", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_DATA_UNIT_LABELLING_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_mini_slot_flag, { + "Mini Slot Flag", "mpeg_descr.logon_init.mini_slot_flag", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_MINI_SLOT_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_contention_based_mini_slot_flag, { + "Contention Based Mini Slot Flag", "mpeg_descr.logon_init.contention_based_mini_slot_flag", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_CONTENTION_BASED_MINI_SLOT_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_capacity_type_flag_reserved, { + "Capacity Type Flag Reserved", "mpeg_descr.logon_init.capactity_type_flag_reserved", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_CAPACITY_TYPE_FLAG_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_capacity_type_flag, { + "Capacity Type Flag", "mpeg_descr.logon_init.capactity_type_flag", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_CAPACITY_TYPE_FLAG_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_traffic_burst_type, { + "Traffic Burst Type", "mpeg_descr.logon_init.traffic_burst_type", + FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_TRAFFIC_BURST_TYPE_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_return_trf_pid, { + "Return TRF PID", "mpeg_descr.logon_init.return_trf_pid", + FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_TRF_PID_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid_reserved, { + "Return CTRL MNGM PID Reserved", "mpeg_descr.logon_init.return_mngm_pid_reserved", + FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_CTRL_MNGM_PID_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid, { + "Return CTRL MNGM PID", "mpeg_descr.logon_init.return_mngm_pid", + FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_CTRL_MNGM_PID_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_connectivity, { + "Connectivity", "mpeg_descr.logon_init.connectivity", + FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_CONNECTIVITY_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_return_vpi_reserved, { + "Return VPI Reserved", "mpeg_descr.logon_init.return_vpi_reserved", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_VPI_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_return_vpi, { + "Return VPI", "mpeg_descr.logon_init.return_vpi", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_VPI_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_return_vci, { + "Return VCI", "mpeg_descr.logon_init.return_vci", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_return_signalling_vpi_reserved, { + "Return Signalling VPI Reserved", "mpeg_descr.logon_init.return_signalling_vpi_reserved", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_return_signalling_vpi, { + "Return Signalling VPI", "mpeg_descr.logon_init.return_signalling_vpi", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_return_signalling_vci, { + "Return Signalling VCI", "mpeg_descr.logon_init.return_signalling_vci", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_forward_signalling_vpi_reserved, { + "Forward Signalling VPI Reserved", "mpeg_descr.logon_init.forward_signalling_vpi_reserved", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_forward_signalling_vpi, { + "Forward Signalling VPI", "mpeg_descr.logon_init.forward_signalling_vpi", + FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_forward_signalling_vci, { + "Forward Signalling VCI", "mpeg_descr.logon_init.forward_signalling_vci", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_cra_level, { + "CRA Level", "mpeg_descr.logon_init.cra_level", + FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_vbdc_max_reserved, { + "VDBC Max Reserved", "mpeg_descr.logon_init.vdbc_max_reserved", + FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_VDBC_MAX_RESERVED_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_vbdc_max, { + "VDBC Max", "mpeg_descr.logon_init.vdbc_max", + FT_UINT16, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_VDBC_MAX_MASK, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_rbdc_max, { + "RDBC Max", "mpeg_descr.logon_init.rdbc_max", + FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_descr_logon_initialize_rbdc_timeout, { + "RDBC Timeout", "mpeg_descr.logon_init.rdbc_timeout", + FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + /* 0xA7 RCS Content Descriptor */ + { &hf_mpeg_descr_rcs_content_table_id, { + "Table ID", "mpeg_descr.rcs_content.tid", + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL + } }, + }; + + static gint *ett[] = { + &ett_mpeg_descriptor, + &ett_mpeg_descriptor_extended_event_item, + &ett_mpeg_descriptor_component_content_type, + &ett_mpeg_descriptor_content_nibble, + &ett_mpeg_descriptor_vbi_data_service, + &ett_mpeg_descriptor_content_identifier_crid + }; + + proto_mpeg_descriptor = proto_register_protocol("MPEG2 Descriptors", "MPEG Descriptor", "mpeg_descr"); + proto_register_field_array(proto_mpeg_descriptor, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + +} diff --git a/epan/dissectors/packet-mpeg-descriptor.h b/epan/dissectors/packet-mpeg-descriptor.h new file mode 100644 index 0000000000..5b4c2becdb --- /dev/null +++ b/epan/dissectors/packet-mpeg-descriptor.h @@ -0,0 +1,35 @@ +/* packet-mpeg-descriptor.c + * Routines for MPEG2 (ISO/ISO 13818-1) dissectors + * Copyright 2012, Guy Martin <gmsoft@tuxicoman.be> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + + +#ifndef __PACKET_MPEG_DESCRIPTOR_H_ +#define __PACKET_MPEG_DESCRIPTOR_H_ + +#include <glib.h> +#include <epan/packet.h> + +guint proto_mpeg_descriptor_dissect(tvbuff_t *tvb, guint offset, proto_tree *tree); + +#endif diff --git a/epan/dissectors/packet-mpeg-pmt.c b/epan/dissectors/packet-mpeg-pmt.c new file mode 100644 index 0000000000..408a9e1ba0 --- /dev/null +++ b/epan/dissectors/packet-mpeg-pmt.c @@ -0,0 +1,306 @@ +/* packet-mpeg-pmt.c + * Routines for MPEG2 (ISO/ISO 13818-1) Program Map Table (PMT) dissection + * Copyright 2012, Guy Martin <gmsoft@tuxicoman.be> + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> + +#include <epan/packet.h> +#include <epan/dissectors/packet-mpeg-sect.h> + +#include "packet-mpeg-descriptor.h" + +static int proto_mpeg_pmt = -1; +static int hf_mpeg_pmt_program_number = -1; +static int hf_mpeg_pmt_reserved1 = -1; +static int hf_mpeg_pmt_version_number = -1; +static int hf_mpeg_pmt_current_next_indicator = -1; +static int hf_mpeg_pmt_section_number = -1; +static int hf_mpeg_pmt_last_section_number = -1; +static int hf_mpeg_pmt_reserved2 = -1; +static int hf_mpeg_pmt_pcr_pid = -1; +static int hf_mpeg_pmt_reserved3 = -1; +static int hf_mpeg_pmt_program_info_length = -1; + + +static int hf_mpeg_pmt_stream_type = -1; +static int hf_mpeg_pmt_stream_reserved1 = -1; +static int hf_mpeg_pmt_stream_elementary_pid = -1; +static int hf_mpeg_pmt_stream_reserved2 = -1; +static int hf_mpeg_pmt_stream_es_info_length = -1; + +static gint ett_mpeg_pmt = -1; +static gint ett_mpeg_pmt_stream = -1; + +#define MPEG_PMT_TID 0x02 + +#define MPEG_PMT_RESERVED1_MASK 0xC0 +#define MPEG_PMT_VERSION_NUMBER_MASK 0x3E +#define MPEG_PMT_CURRENT_NEXT_INDICATOR_MASK 0x01 + +#define MPEG_PMT_RESERVED2_MASK 0xE000 +#define MPEG_PMT_PCR_PID_MASK 0x1FFF +#define MPEG_PMT_RESERVED3_MASK 0xF000 +#define MPEG_PMT_PROGRAM_INFO_LENGTH_MASK 0x0FFF + +#define MPEG_PMT_STREAM_RESERVED1_MASK 0xE000 +#define MPEG_PMT_STREAM_ELEMENTARY_PID_MASK 0x1FFF + +#define MPEG_PMT_STREAM_RESERVED2_MASK 0xF000 +#define MPEG_PMT_STREAM_ES_INFO_LENGTH_MASK 0x0FFF + + +static const value_string mpeg_pmt_cur_next_vals[] = { + + { 0x0, "Not yet applicable" }, + { 0x1, "Currently applicable" }, + + { 0x0, NULL } + +}; + +static const value_string mpeg_pmt_stream_type_vals[] = { + { 0x00, "ITU-T | ISO/IEC Reserved" }, + { 0x01, "ISO/IEC 11172 Video" }, + { 0x02, "ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream" }, + { 0x03, "ISO/IEC 11172 Audio" }, + { 0x04, "ISO/IEC 13818-3 Audio" }, + { 0x05, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections" }, + { 0x06, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data" }, + { 0x07, "ISO/IEC 13522 MHEG" }, + { 0x08, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A DSM-CC" }, + { 0x09, "ITU-T Rec. H.222.1" }, + { 0x0A, "ISO/IEC 13818-6 type A" }, + { 0x0B, "ISO/IEC 13818-6 type B" }, + { 0x0C, "ISO/IEC 13818-6 type C" }, + { 0x0D, "ISO/IEC 13818-6 type D" }, + { 0x0E, "ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary" }, + { 0x0F, "ISO/IEC 13818-7 Audio with ADTS transport syntax" }, + { 0x10, "ISO/IEC 14496-2 Visual" }, + { 0x11, "ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1" }, + { 0x12, "ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets" }, + { 0x13, "ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections" }, + { 0x14, "ISO/IEC 13818-6 Synchronized Download Protocol" }, + { 0x15, "Metadata carried in PES packets" }, + { 0x16, "Metadata carried in metadata sections" }, + { 0x17, "Metadata carried in ISO/IEC 13818-6 Data Carousel" }, + { 0x18, "Metadata carried in ISO/IEC 13818-6 Object Carousel" }, + { 0x19, "Metadata carried in ISO/IEC 13818-6 Synchronized Download Protocol" }, + { 0x1A, "IPMP stream (defined in ISO/IEC 13818-11, MPEG-2 IPMP)" }, + { 0x1B, "AVC video stream as defined in ITU-T Rec. H.264 | ISO/IEC 14496-10 Video" }, + { 0x7F, "IPMP stream" }, + { 0x00, NULL }, + +}; + +void +dissect_mpeg_pmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + + guint offset = 0, length = 0, descriptor_end = 0; + guint16 prog_info_len = 0, es_info_len = 0, pid = 0; + + proto_item *ti = NULL; + proto_tree *mpeg_pmt_tree = NULL; + proto_item *si = NULL; + proto_tree *mpeg_pmt_stream_tree = NULL; + + /* The TVB should start right after the section_length in the Section packet */ + + col_clear(pinfo->cinfo, COL_INFO); + col_set_str(pinfo->cinfo, COL_INFO, "Program Map Table (PMT)"); + + if (!tree) + return; + + ti = proto_tree_add_item(tree, proto_mpeg_pmt, tvb, offset, -1, ENC_NA); + mpeg_pmt_tree = proto_item_add_subtree(ti, ett_mpeg_pmt); + + offset += packet_mpeg_sect_header(tvb, offset, mpeg_pmt_tree, &length, NULL); + length -= 4; + + proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_program_number, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_version_number, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_current_next_indicator, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_section_number, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_pcr_pid, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + prog_info_len = tvb_get_ntohs(tvb, offset) & MPEG_PMT_PROGRAM_INFO_LENGTH_MASK; + proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_reserved3, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mpeg_pmt_tree, hf_mpeg_pmt_program_info_length, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + descriptor_end = offset + prog_info_len; + while (offset < descriptor_end) + offset += proto_mpeg_descriptor_dissect(tvb, offset, mpeg_pmt_tree); + + while (offset < length) { + + pid = tvb_get_ntohs(tvb, offset + 1) & MPEG_PMT_STREAM_ELEMENTARY_PID_MASK; + es_info_len = tvb_get_ntohs(tvb, offset + 3) & MPEG_PMT_STREAM_ES_INFO_LENGTH_MASK; + + si = proto_tree_add_text(mpeg_pmt_tree, tvb, offset, 5 + es_info_len, "Stream PID=0x%04hx", pid); + mpeg_pmt_stream_tree = proto_item_add_subtree(si, ett_mpeg_pmt_stream); + + proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_type, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_reserved1, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_elementary_pid, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(mpeg_pmt_stream_tree, hf_mpeg_pmt_stream_es_info_length, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + descriptor_end = offset + es_info_len; + while (offset < descriptor_end) + offset += proto_mpeg_descriptor_dissect(tvb, offset, mpeg_pmt_stream_tree); + + } + + packet_mpeg_sect_crc(tvb, pinfo, mpeg_pmt_tree, 0, offset); +} + + +void +proto_register_mpeg_pmt(void) +{ + + static hf_register_info hf[] = { + + { &hf_mpeg_pmt_program_number, { + "Program Number", "mpeg_pmt.pg_num", + FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_pmt_reserved1, { + "Reserved", "mpeg_pmt.reserved1", + FT_UINT8, BASE_HEX, NULL, MPEG_PMT_RESERVED1_MASK, NULL, HFILL + } }, + + { &hf_mpeg_pmt_version_number, { + "Version Number", "mpeg_pmt.version", + FT_UINT8, BASE_HEX, NULL, MPEG_PMT_VERSION_NUMBER_MASK, NULL, HFILL + } }, + + { &hf_mpeg_pmt_current_next_indicator, { + "Current/Next Indicator", "mpeg_pmt.cur_next_ind", + FT_UINT8, BASE_HEX, VALS(mpeg_pmt_cur_next_vals), MPEG_PMT_CURRENT_NEXT_INDICATOR_MASK, NULL, HFILL + } }, + + { &hf_mpeg_pmt_section_number, { + "Section Number", "mpeg_pmt.sect_num", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_pmt_last_section_number, { + "Last Section Number", "mpeg_pmt.last_sect_num", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL + } }, + + { &hf_mpeg_pmt_reserved2, { + "Reserved", "mpeg_pmt.reserved2", + FT_UINT16, BASE_HEX, NULL, MPEG_PMT_RESERVED2_MASK, NULL, HFILL + } }, + + { &hf_mpeg_pmt_pcr_pid, { + "PCR PID", "mpeg_pmt.pcr_pid", + FT_UINT16, BASE_HEX, NULL, MPEG_PMT_PCR_PID_MASK, NULL, HFILL + } }, + + { &hf_mpeg_pmt_reserved3, { + "Reserved", "mpeg_pmt.reserved3", + FT_UINT16, BASE_HEX, NULL, MPEG_PMT_RESERVED3_MASK, NULL, HFILL + } }, + + { &hf_mpeg_pmt_program_info_length, { + "Program Info Length", "mpeg_pmt.prog_info_len", + FT_UINT16, BASE_HEX, NULL, MPEG_PMT_PROGRAM_INFO_LENGTH_MASK, NULL, HFILL + } }, + + + { &hf_mpeg_pmt_stream_type, { + "Stream type", "mpeg_pmt.stream.type", + FT_UINT8, BASE_HEX, VALS(mpeg_pmt_stream_type_vals), 0, NULL, HFILL + } }, + + { &hf_mpeg_pmt_stream_reserved1, { + "Reserved", "mpeg_pmt.stream.reserved1", + FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_RESERVED1_MASK, NULL, HFILL + } }, + + { &hf_mpeg_pmt_stream_elementary_pid, { + "Elementary PID", "mpeg_pmt.stream.elementary_pid", + FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_ELEMENTARY_PID_MASK, NULL, HFILL + } }, + + { &hf_mpeg_pmt_stream_reserved2, { + "Reserved", "mpeg_pmt.stream.reserved2", + FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_RESERVED2_MASK, NULL, HFILL + } }, + + { &hf_mpeg_pmt_stream_es_info_length, { + "ES Info Length", "mpeg_pmt.stream.es_info_len", + FT_UINT16, BASE_HEX, NULL, MPEG_PMT_STREAM_ES_INFO_LENGTH_MASK, NULL, HFILL + } }, + + }; + + static gint *ett[] = { + &ett_mpeg_pmt, + &ett_mpeg_pmt_stream, + }; + + proto_mpeg_pmt = proto_register_protocol("MPEG2 Program Map Table", "MPEG PMT", "mpeg_pmt"); + + proto_register_field_array(proto_mpeg_pmt, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + +} + + +void +proto_reg_handoff_mpeg_pmt(void) +{ + dissector_handle_t mpeg_pmt_handle; + + mpeg_pmt_handle = create_dissector_handle(dissect_mpeg_pmt, proto_mpeg_pmt); + dissector_add_uint("mpeg_sect.tid", MPEG_PMT_TID, mpeg_pmt_handle); +} |