Adjust proto_tree_add_[float|double]_format_value calls to use unit string
[metze/wireshark/wip.git] / epan / dissectors / packet-mpeg-descriptor.c
1 /* packet-mpeg-descriptor.c
2  * Routines for MPEG2 (ISO/ISO 13818-1 and co) descriptors
3  * Copyright 2012, Guy Martin <gmsoft@tuxicoman.be>
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23
24 #include "config.h"
25
26 #include <epan/packet.h>
27 #include <epan/dvb_chartbl.h>
28 #include "packet-mpeg-sect.h"
29 #include "packet-mpeg-descriptor.h"
30
31 void proto_register_mpeg_descriptor(void);
32
33 static int proto_mpeg_descriptor = -1;
34 static int hf_mpeg_descriptor_tag = -1;
35 static int hf_mpeg_descriptor_length = -1;
36 static int hf_mpeg_descriptor_data = -1;
37
38 static gint ett_mpeg_descriptor = -1;
39
40 static const value_string mpeg_descriptor_tag_vals[] = {
41     /* From ISO/IEC 13818-1 */
42     { 0x00, "Reserved" },
43     { 0x01, "Reserved" },
44     { 0x02, "Video Stream Descriptor" },
45     { 0x03, "Audio Stream Descriptor" },
46     { 0x04, "Hierarchy Descriptor" },
47     { 0x05, "Registration Descriptor" },
48     { 0x06, "Data Stream Alignment Descriptor" },
49     { 0x07, "Target Background Grid Descriptor" },
50     { 0x08, "Video Window Descriptor" },
51     { 0x09, "CA Descriptor" },
52     { 0x0A, "ISO 639 Language Descriptor" },
53     { 0x0B, "System Clock Descriptor" },
54     { 0x0C, "Multiplex Buffer Utilization Descriptor" },
55     { 0x0D, "Copyright Descriptor" },
56     { 0x0E, "Maximum Bitrate Descriptor" },
57     { 0x0F, "Private Data Indicator Descriptor" },
58     { 0x10, "Smoothing Buffer Descriptor" },
59     { 0x11, "STD Descriptor" },
60     { 0x12, "IBP Descriptor" },
61
62     /* From ETSI TR 101 202 */
63     { 0x13, "Carousel Identifier Descriptor" },
64     { 0x14, "Association Tag Descriptor" },
65     { 0x15, "Deferred Association Tag Descriptor" },
66
67     /* From ISO/IEC 13818-1 */
68     { 0x1B, "MPEG 4 Video Descriptor" },
69     { 0x1C, "MPEG 4 Audio Descriptor" },
70     { 0x1D, "IOD Descriptor" },
71     { 0x1E, "SL Descriptor" },
72     { 0x1F, "FMC Descriptor" },
73     { 0x20, "External ES ID Descriptor" },
74     { 0x21, "MuxCode Descriptor" },
75     { 0x22, "FmxBufferSize Descriptor" },
76     { 0x23, "MultiplexBuffer Descriptor" },
77     { 0x24, "Content Labeling Descriptor" },
78     { 0x25, "Metadata Pointer Descriptor" },
79     { 0x26, "Metadata Descriptor" },
80     { 0x27, "Metadata STD Descriptor" },
81     { 0x28, "AVC Video Descriptor" },
82     { 0x29, "IPMP Descriptor" },
83     { 0x2A, "AVC Timing and HRD Descriptor" },
84     { 0x2B, "MPEG2 AAC Descriptor" },
85     { 0x2C, "FlexMuxTiming Descriptor" },
86
87     /* From ETSI EN 300 468 */
88     { 0x40, "Network Name Descriptor" },
89     { 0x41, "Service List Descriptor" },
90     { 0x42, "Stuffing Descriptor" },
91     { 0x43, "Satellite Delivery System Descriptor" },
92     { 0x44, "Cable Delivery System Descriptor" },
93     { 0x45, "VBI Data Descriptor" },
94     { 0x46, "VBI Teletext Descriptor" },
95     { 0x47, "Bouquet Name Descriptor" },
96     { 0x48, "Service Descriptor" },
97     { 0x49, "Country Availability Descriptor" },
98     { 0x4A, "Linkage Descriptor" },
99     { 0x4B, "NVOD Reference Descriptor" },
100     { 0x4C, "Time Shifted Service Descriptor" },
101     { 0x4D, "Short Event Descriptor" },
102     { 0x4E, "Extended Event Descriptor" },
103     { 0x4F, "Time Shifted Event Descriptor" },
104     { 0x50, "Component Descriptor" },
105     { 0x51, "Mosaic Descriptor" },
106     { 0x52, "Stream Identifier Descriptor" },
107     { 0x53, "CA Identifier Descriptor" },
108     { 0x54, "Content Descriptor" },
109     { 0x55, "Parent Rating Descriptor" },
110     { 0x56, "Teletext Descriptor" },
111     { 0x57, "Telephone Descriptor" },
112     { 0x58, "Local Time Offset Descriptor" },
113     { 0x59, "Subtitling Descriptor" },
114     { 0x5A, "Terrestrial Delivery System Descriptor" },
115     { 0x5B, "Multilingual Network Name Descriptor" },
116     { 0x5C, "Multilingual Bouquet Name Descriptor" },
117     { 0x5D, "Multilingual Service Name Descriptor" },
118     { 0x5E, "Multilingual Component Descriptor" },
119     { 0x5F, "Private Data Specifier Descriptor" },
120     { 0x60, "Service Move Descriptor" },
121     { 0x61, "Short Smoothing Buffer Descriptor" },
122     { 0x62, "Frequency List Descriptor" },
123     { 0x63, "Partial Transport Stream Descriptor" },
124     { 0x64, "Data Broadcast Descriptor" },
125     { 0x65, "Scrambling Descriptor" },
126     { 0x66, "Data Broadcast ID Descriptor" },
127     { 0x67, "Transport Stream Descriptor" },
128     { 0x68, "DSNG Descriptor" },
129     { 0x69, "PDC Descriptor" },
130     { 0x6A, "AC-3 Descriptor" },
131     { 0x6B, "Ancillary Data Descriptor" },
132     { 0x6C, "Cell List Descriptor" },
133     { 0x6D, "Cell Frequency Link Descriptor" },
134     { 0x6E, "Announcement Support Descriptor" },
135     { 0x6F, "Application Signalling Descriptor" },
136     { 0x70, "Adaptation Field Data Descriptor" },
137     { 0x71, "Service Identifier Descriptor" },
138     { 0x72, "Service Availability Descriptor" },
139     { 0x73, "Default Authority Descriptor" },
140     { 0x74, "Related Content Descriptor" },
141     { 0x75, "TVA ID Descriptor" },
142     { 0x76, "Content Identifier Descriptor" },
143     { 0x77, "Time Slice FEC Identifier Descriptor" },
144     { 0x78, "ECM Repetition Rate Descriptor" },
145     { 0x79, "S2 Satellite Delivery System Descriptor" },
146     { 0x7A, "Enhanced AC-3 Descriptor" },
147     { 0x7B, "DTS Descriptor" },
148     { 0x7C, "AAC Descriptor" },
149     { 0x7D, "XAIT Content Location Descriptor" },
150     { 0x7E, "FTA Content Management Descriptor" },
151     { 0x7F, "Extension Descriptor" },
152
153     /* From ATSC A/52 */
154     { 0x81, "ATSC A/52 AC-3 Audio Descriptor" },
155
156     /* From ETSI EN 301 790 */
157     { 0xA0, "Network Layer Info Descriptor" },
158     { 0xA1, "Correction Message Descriptor" },
159     { 0xA2, "Logon Initialize Descriptor" },
160     { 0xA3, "ACQ Assign Descriptor" },
161     { 0xA4, "SYNC Assign Descriptor" },
162     { 0xA5, "Encrypted Logon ID Descriptor" },
163     { 0xA6, "Echo Value Descriptor" },
164     { 0xA7, "RCS Content Descriptor" },
165     { 0xA8, "Satellite Forward Link Descriptor" },
166     { 0xA9, "Satellite Return Link Descriptor" },
167     { 0xAA, "Table Update Descriptor" },
168     { 0xAB, "Contention Control Descriptor" },
169     { 0xAC, "Correction Control Descriptor" },
170     { 0xAD, "Forward Interaction Path Descriptor" },
171     { 0xAE, "Return Interaction Path Descriptor" },
172     { 0xAf, "Connection Control Descriptor" },
173     { 0xB0, "Mobility Control Descriptor" },
174     { 0xB1, "Correction Message Extension Descriptor" },
175     { 0xB2, "Return Transmission Modes Descriptor" },
176     { 0xB3, "Mesh Logon Initialize Descriptor" },
177     { 0xB5, "Implementation Type Descriptor" },
178     { 0xB6, "LL FEC Identifier Descriptor" },
179
180     { 0x00, NULL}
181 };
182 static value_string_ext mpeg_descriptor_tag_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descriptor_tag_vals);
183
184 /* 0x02 Video Stream Descriptor */
185 static int hf_mpeg_descr_video_stream_multiple_frame_rate_flag = -1;
186 static int hf_mpeg_descr_video_stream_frame_rate_code = -1;
187 static int hf_mpeg_descr_video_stream_mpeg1_only_flag = -1;
188 static int hf_mpeg_descr_video_stream_constrained_parameter_flag = -1;
189 static int hf_mpeg_descr_video_stream_still_picture_flag = -1;
190 static int hf_mpeg_descr_video_stream_profile_and_level_indication = -1;
191 static int hf_mpeg_descr_video_stream_chroma_format = -1;
192 static int hf_mpeg_descr_video_stream_frame_rate_extension_flag = -1;
193 static int hf_mpeg_descr_video_stream_reserved = -1;
194
195 #define MPEG_DESCR_VIDEO_STREAM_MULTIPLE_FRAME_RATE_FLAG_MASK   0x80
196 #define MPEG_DESCR_VIDEO_STREAM_FRAME_RATE_CODE_MASK            0x78
197 #define MPEG_DESCR_VIDEO_STREAM_MPEG1_ONLY_FLAG_MASK            0x04
198 #define MPEG_DESCR_VIDEO_STREAM_CONSTRAINED_PARAMETER_FLAG_MASK 0x02
199 #define MPEG_DESCR_VIDEO_STREAM_STILL_PICTURE_FLAG_MASK         0x01
200 #define MPEG_DESCR_VIDEO_STREAM_CHROMA_FORMAT_MASK              0xC0
201 #define MPEG_DESCR_VIDEO_STREAM_FRAME_RATE_EXTENSION_FLAG_MASK  0x20
202 #define MPEG_DESCR_VIDEO_STREAM_RESERVED_MASK                   0x1F
203
204 static const value_string mpeg_descr_video_stream_multiple_frame_rate_flag_vals[] = {
205     { 0x00, "Single frame rate present" },
206     { 0x01, "Multiple frame rate present" },
207
208     { 0x00, NULL }
209 };
210
211 static void
212 proto_mpeg_descriptor_dissect_video_stream(tvbuff_t *tvb, guint offset, proto_tree *tree)
213 {
214
215     guint8 mpeg1_only_flag;
216
217     mpeg1_only_flag = tvb_get_guint8(tvb, offset) & MPEG_DESCR_VIDEO_STREAM_MPEG1_ONLY_FLAG_MASK;
218     proto_tree_add_item(tree, hf_mpeg_descr_video_stream_multiple_frame_rate_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
219     proto_tree_add_item(tree, hf_mpeg_descr_video_stream_frame_rate_code, tvb, offset, 1, ENC_BIG_ENDIAN);
220     proto_tree_add_item(tree, hf_mpeg_descr_video_stream_mpeg1_only_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
221     proto_tree_add_item(tree, hf_mpeg_descr_video_stream_constrained_parameter_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
222     proto_tree_add_item(tree, hf_mpeg_descr_video_stream_still_picture_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
223
224     offset += 1;
225
226     if (mpeg1_only_flag == 0) {
227
228         proto_tree_add_item(tree, hf_mpeg_descr_video_stream_profile_and_level_indication, tvb, offset, 1, ENC_BIG_ENDIAN);
229         offset += 1;
230
231         proto_tree_add_item(tree, hf_mpeg_descr_video_stream_chroma_format, tvb, offset, 1, ENC_BIG_ENDIAN);
232         proto_tree_add_item(tree, hf_mpeg_descr_video_stream_frame_rate_extension_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
233         proto_tree_add_item(tree, hf_mpeg_descr_video_stream_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
234     }
235 }
236
237 /* 0x03 Audio Stream Descriptor */
238 static int hf_mpeg_descr_audio_stream_free_format_flag = -1;
239 static int hf_mpeg_descr_audio_stream_id = -1;
240 static int hf_mpeg_descr_audio_stream_layer = -1;
241 static int hf_mpeg_descr_audio_stream_variable_rate_audio_indicator = -1;
242 static int hf_mpeg_descr_audio_stream_reserved = -1;
243
244 #define MPEG_DESCR_AUDIO_STREAM_FREE_FORMAT_FLAG_MASK                   0x80
245 #define MPEG_DESCR_AUDIO_STREAM_ID_MASK                                 0x40
246 #define MPEG_DESCR_AUDIO_STREAM_LAYER_MASK                              0x30
247 #define MPEG_DESCR_AUDIO_STREAM_VARIABLE_RATE_AUDIO_INDICATOR_MASK      0x08
248 #define MPEG_DESCR_AUDIO_STREAM_RESERVED_MASK                           0x07
249
250 static const value_string mpeg_descr_audio_stream_free_format_flag_vals[] = {
251     { 0x00, "bitrate_index is not 0" },
252     { 0x01, "One more more audio frame has bitrate_index = 0" },
253
254     { 0x00, NULL }
255 };
256
257 static const value_string mpeg_descr_audio_stream_id_vals[] = {
258     { 0x00, "ID not set to 1 in all the frames" },
259     { 0x01, "ID set to 1 in all the frames" },
260
261     { 0x00, NULL }
262 };
263
264 static const value_string mpeg_descr_audio_stream_variable_rate_audio_indicator_vals[] = {
265     { 0x00, "Constant bitrate" },
266     { 0x01, "Variable bitrate" },
267
268     { 0x00, NULL }
269
270 };
271
272 static void
273 proto_mpeg_descriptor_dissect_audio_stream(tvbuff_t *tvb, guint offset, proto_tree *tree)
274 {
275     proto_tree_add_item(tree, hf_mpeg_descr_audio_stream_free_format_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
276     proto_tree_add_item(tree, hf_mpeg_descr_audio_stream_id, tvb, offset, 1, ENC_BIG_ENDIAN);
277     proto_tree_add_item(tree, hf_mpeg_descr_audio_stream_layer, tvb, offset, 1, ENC_BIG_ENDIAN);
278     proto_tree_add_item(tree, hf_mpeg_descr_audio_stream_variable_rate_audio_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
279     proto_tree_add_item(tree, hf_mpeg_descr_audio_stream_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
280 }
281
282 /* 0x05 Registration Descriptor */
283 static int hf_mpeg_descr_reg_form_id = -1;
284 static int hf_mpeg_descr_reg_add_id_inf = -1;
285
286 static void
287 proto_mpeg_descriptor_dissect_registration(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
288 {
289     guint  offset_start;
290
291     offset_start = offset;
292     proto_tree_add_item(tree, hf_mpeg_descr_reg_form_id, tvb, offset, 4, ENC_BIG_ENDIAN);
293     offset += 4;
294
295     while (offset-offset_start<len) {
296         proto_tree_add_item(tree, hf_mpeg_descr_reg_add_id_inf, tvb, offset, 1, ENC_BIG_ENDIAN);
297         offset++;
298     }
299 }
300
301 /* 0x06 Data Stream Alignment Descriptor */
302 static int hf_mpeg_descr_data_stream_alignment = -1;
303
304 static const value_string mpeg_descr_data_stream_alignment_vals[] = {
305     { 0x00, "Reserved" },
306     { 0x01, "Slice, or video access unit" },
307     { 0x02, "Video access unit" },
308     { 0x03, "GOP, or SEQ" },
309     { 0x04, "SEQ" },
310
311     { 0x00, NULL }
312 };
313
314 static void
315 proto_mpeg_descriptor_dissect_data_stream_alignment(tvbuff_t *tvb, guint offset, proto_tree *tree)
316 {
317     proto_tree_add_item(tree, hf_mpeg_descr_data_stream_alignment, tvb, offset, 1, ENC_BIG_ENDIAN);
318 }
319
320 /* 0x09 CA Descriptor */
321 static int hf_mpeg_descr_ca_system_id = -1;
322 static int hf_mpeg_descr_ca_reserved = -1;
323 static int hf_mpeg_descr_ca_pid = -1;
324 static int hf_mpeg_descr_ca_private = -1;
325
326 #define MPEG_DESCR_CA_RESERVED_MASK 0xE000
327 #define MPEG_DESCR_CA_PID_MASK      0x1FFF
328
329 static void
330 proto_mpeg_descriptor_dissect_ca(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
331 {
332     proto_tree_add_item(tree, hf_mpeg_descr_ca_system_id, tvb, offset, 2, ENC_BIG_ENDIAN);
333     offset += 2;
334
335     proto_tree_add_item(tree, hf_mpeg_descr_ca_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
336     proto_tree_add_item(tree, hf_mpeg_descr_ca_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
337     offset += 2;
338
339     if (len > 4)
340         proto_tree_add_item(tree, hf_mpeg_descr_ca_private, tvb, offset, len - 4, ENC_NA);
341 }
342
343
344 /* 0x0A ISO 639 Language Descriptor */
345 static int hf_mpeg_descr_iso639_lang = -1;
346 static int hf_mpeg_descr_iso639_type = -1;
347
348 static const value_string mpeg_descr_iso639_type_vals[] = {
349     { 0x00, "Undefined" },
350     { 0x01, "Clean Effects" },
351     { 0x02, "Hearing Impaired" },
352     { 0x03, "Visual Impaired Commentary" },
353
354     { 0x00, NULL }
355 };
356
357 static void
358 proto_mpeg_descriptor_dissect_iso639(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
359 {
360     if (len > 1)
361         proto_tree_add_item(tree, hf_mpeg_descr_iso639_lang, tvb, offset, len - 1, ENC_ASCII|ENC_NA);
362     offset += len - 1;
363     proto_tree_add_item(tree, hf_mpeg_descr_iso639_type, tvb, offset, 1, ENC_BIG_ENDIAN);
364 }
365
366 /* 0x0B System Clock Descriptor */
367 static int hf_mpeg_descr_system_clock_external_clock_reference_indicator = -1;
368 static int hf_mpeg_descr_system_clock_reserved1 = -1;
369 static int hf_mpeg_descr_system_clock_accuracy_integer = -1;
370 static int hf_mpeg_descr_system_clock_accuracy_exponent = -1;
371 static int hf_mpeg_descr_system_clock_reserved2 = -1;
372
373 #define MPEG_DESCR_SYSTEM_CLOCK_EXTERNAL_CLOCK_REFERENCE_INDICATOR_MASK 0x80
374 #define MPEG_DESCR_SYSTEM_CLOCK_RESERVED1_MASK                          0x40
375 #define MPEG_DESCR_SYSTEM_CLOCK_ACCURACY_INTEGER_MASK                   0x3F
376 #define MPEG_DESCR_SYSTEM_CLOCK_ACCURACY_EXPONENT_MASK                  0xE0
377 #define MPEG_DESCR_SYSTEM_CLOCK_RESERVED2_MASK                          0x1F
378
379 static void
380 proto_mpeg_descriptor_dissect_system_clock(tvbuff_t *tvb, guint offset, proto_tree *tree)
381 {
382     proto_tree_add_item(tree, hf_mpeg_descr_system_clock_external_clock_reference_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
383     proto_tree_add_item(tree, hf_mpeg_descr_system_clock_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
384     proto_tree_add_item(tree, hf_mpeg_descr_system_clock_accuracy_integer, tvb, offset, 1, ENC_BIG_ENDIAN);
385     offset += 1;
386
387     proto_tree_add_item(tree, hf_mpeg_descr_system_clock_accuracy_exponent, tvb, offset, 1, ENC_BIG_ENDIAN);
388     proto_tree_add_item(tree, hf_mpeg_descr_system_clock_reserved2, tvb, offset, 1, ENC_BIG_ENDIAN);
389 }
390
391 /* 0x0E Maximum Bitrate Descriptor */
392 static int hf_mpeg_descr_max_bitrate_reserved = -1;
393 static int hf_mpeg_descr_max_bitrate = -1;
394
395 #define MPEG_DESCR_MAX_BITRATE_RESERVED_MASK    0xC00000
396 #define MPEG_DESCR_MAX_BITRATE_MASK     0x3FFFFF
397
398 static void
399 proto_mpeg_descriptor_dissect_max_bitrate(tvbuff_t *tvb, guint offset, proto_tree *tree)
400 {
401     proto_item *rate_item;
402
403     guint32 rate;
404
405     proto_tree_add_item(tree, hf_mpeg_descr_max_bitrate_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
406     rate = tvb_get_ntoh24(tvb, offset) & MPEG_DESCR_MAX_BITRATE_MASK;
407     rate_item = proto_tree_add_item(tree, hf_mpeg_descr_max_bitrate, tvb, offset, 3, ENC_BIG_ENDIAN);
408     proto_item_append_text(rate_item, " (%u bytes/sec)", rate * 50);
409 }
410
411 /* 0x10 Smoothing Buffer Descriptor */
412 static int hf_mpeg_descr_smoothing_buffer_reserved1 = -1;
413 static int hf_mpeg_descr_smoothing_buffer_leak_rate = -1;
414 static int hf_mpeg_descr_smoothing_buffer_reserved2 = -1;
415 static int hf_mpeg_descr_smoothing_buffer_size = -1;
416
417 #define MPEG_DESCR_SMOOTHING_BUFFER_RESERVED1_MASK  0xC00000
418 #define MPEG_DESCR_SMOOTHING_BUFFER_LEAK_RATE_MASK  0x3FFFFF
419 #define MPEG_DESCR_SMOOTHING_BUFFER_RESERVED2_MASK  0xC00000
420 #define MPEG_DESCR_SMOOTHING_BUFFER_SIZE_MASK       0x3FFFFF
421
422 static void
423 proto_mpeg_descriptor_dissect_smoothing_buffer(tvbuff_t *tvb, guint offset, proto_tree *tree)
424 {
425     proto_item *leak_rate_item;
426
427     guint32 leak_rate;
428
429     proto_tree_add_item(tree, hf_mpeg_descr_smoothing_buffer_reserved1, tvb, offset, 3, ENC_BIG_ENDIAN);
430     leak_rate = tvb_get_ntoh24(tvb, offset) & MPEG_DESCR_SMOOTHING_BUFFER_LEAK_RATE_MASK;
431     leak_rate_item = proto_tree_add_item(tree, hf_mpeg_descr_smoothing_buffer_leak_rate, tvb, offset, 3, ENC_BIG_ENDIAN);
432     proto_item_append_text(leak_rate_item, " (%u bytes/sec)", leak_rate * 400 / 8);
433     offset += 3;
434
435     proto_tree_add_item(tree, hf_mpeg_descr_smoothing_buffer_reserved2, tvb, offset, 3, ENC_BIG_ENDIAN);
436     proto_tree_add_item(tree, hf_mpeg_descr_smoothing_buffer_size, tvb, offset, 3, ENC_BIG_ENDIAN);
437
438 }
439
440 /* 0x11 STD Descriptor */
441 static int hf_mpeg_descr_std_reserved = -1;
442 static int hf_mpeg_descr_std_leak_valid = -1;
443
444 #define MPEG_DESCR_STD_RESERVED_MASK    0xFE
445 #define MPEG_DESCR_STD_LEAK_VALID_MASK  0x01
446
447 static void
448 proto_mpeg_descriptor_dissect_std(tvbuff_t *tvb, guint offset, proto_tree *tree)
449 {
450     proto_tree_add_item(tree, hf_mpeg_descr_std_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
451     proto_tree_add_item(tree, hf_mpeg_descr_std_leak_valid, tvb, offset, 1, ENC_BIG_ENDIAN);
452 }
453
454 /* 0x13 Carousel Identifier Descriptor */
455 static int hf_mpeg_descr_carousel_identifier_id = -1;
456 static int hf_mpeg_descr_carousel_identifier_format_id = -1;
457 static int hf_mpeg_descr_carousel_identifier_module_version = -1;
458 static int hf_mpeg_descr_carousel_identifier_module_id = -1;
459 static int hf_mpeg_descr_carousel_identifier_block_size = -1;
460 static int hf_mpeg_descr_carousel_identifier_module_size = -1;
461 static int hf_mpeg_descr_carousel_identifier_compression_method = -1;
462 static int hf_mpeg_descr_carousel_identifier_original_size = -1;
463 static int hf_mpeg_descr_carousel_identifier_timeout = -1;
464 static int hf_mpeg_descr_carousel_identifier_object_key_len = -1;
465 static int hf_mpeg_descr_carousel_identifier_object_key_data = -1;
466 static int hf_mpeg_descr_carousel_identifier_private = -1;
467
468 static const value_string mpeg_descr_carousel_identifier_format_id_vals[] = {
469     { 0x00, "No Format Specifier" },
470     { 0x01, "Format Specifier" },
471
472     { 0, NULL }
473 };
474
475 static void
476 proto_mpeg_descriptor_dissect_carousel_identifier(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
477 {
478     guint  key_len;
479     guint8 format_id;
480     guint  private_len = 0;
481
482     proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_id, tvb, offset, 4, ENC_BIG_ENDIAN);
483     offset += 4;
484
485     format_id = tvb_get_guint8(tvb, offset);
486     proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_format_id, tvb, offset, 1, ENC_BIG_ENDIAN);
487     offset += 1;
488
489     if (format_id == 0x01) {
490         proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_module_version, tvb, offset, 1, ENC_BIG_ENDIAN);
491         offset += 1;
492
493         proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_module_id, tvb, offset, 2, ENC_BIG_ENDIAN);
494         offset += 2;
495
496         proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_block_size, tvb, offset, 2, ENC_BIG_ENDIAN);
497         offset += 2;
498
499         proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_module_size, tvb, offset, 4, ENC_BIG_ENDIAN);
500         offset += 4;
501
502         proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_compression_method, tvb, offset, 1, ENC_BIG_ENDIAN);
503         offset += 1;
504
505         proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_original_size, tvb, offset, 4, ENC_BIG_ENDIAN);
506         offset += 4;
507
508         proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_timeout, tvb, offset, 1, ENC_BIG_ENDIAN);
509         offset += 1;
510
511         key_len = tvb_get_guint8(tvb, offset);
512         proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_object_key_len, tvb, offset, 1, ENC_BIG_ENDIAN);
513         offset += 1;
514
515         proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_object_key_data, tvb, offset, key_len, ENC_NA);
516         offset += key_len;
517
518         if (len > (key_len + 20))
519             private_len = len - 20 - key_len;
520
521     } else {
522         if (len > 5)
523             private_len = len - 5;
524     }
525
526     if (private_len)
527         proto_tree_add_item(tree, hf_mpeg_descr_carousel_identifier_private, tvb, offset, private_len, ENC_NA);
528
529 }
530
531 /* 0x14 Association Tag Descriptor */
532 static int hf_mpeg_descr_association_tag = -1;
533 static int hf_mpeg_descr_association_tag_use = -1;
534 static int hf_mpeg_descr_association_tag_selector_len = -1;
535 static int hf_mpeg_descr_association_tag_transaction_id = -1;
536 static int hf_mpeg_descr_association_tag_timeout = -1;
537 static int hf_mpeg_descr_association_tag_selector_bytes = -1;
538 static int hf_mpeg_descr_association_tag_private_bytes = -1;
539
540 static void
541 proto_mpeg_descriptor_dissect_association_tag(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
542 {
543     guint   end = offset + len;
544     guint16 use;
545     guint8  selector_len;
546
547     proto_tree_add_item(tree, hf_mpeg_descr_association_tag, tvb, offset, 2, ENC_BIG_ENDIAN);
548     offset += 2;
549
550     use = tvb_get_ntohs(tvb, offset);
551     proto_tree_add_item(tree, hf_mpeg_descr_association_tag_use, tvb, offset, 2, ENC_BIG_ENDIAN);
552     offset += 2;
553
554     selector_len = tvb_get_guint8(tvb, offset);
555     proto_tree_add_item(tree, hf_mpeg_descr_association_tag_selector_len, tvb, offset, 1, ENC_BIG_ENDIAN);
556     offset ++;
557
558     if (use == 0x00) {
559         if (selector_len != 8)
560             return;
561         proto_tree_add_item(tree, hf_mpeg_descr_association_tag_transaction_id, tvb, offset, 4, ENC_BIG_ENDIAN);
562         offset += 4;
563
564         proto_tree_add_item(tree, hf_mpeg_descr_association_tag_timeout, tvb, offset, 4, ENC_BIG_ENDIAN);
565         offset += 4;
566
567     } else {
568         proto_tree_add_item(tree, hf_mpeg_descr_association_tag_selector_bytes, tvb, offset, selector_len, ENC_NA);
569         offset += selector_len;
570     }
571
572     if (offset < end)
573         proto_tree_add_item(tree, hf_mpeg_descr_association_tag_private_bytes, tvb, offset, end - offset, ENC_NA);
574 }
575
576 /* 0x28 AVC Video Descriptor */
577 static int hf_mpeg_descr_avc_vid_profile_idc = -1;
578 static int hf_mpeg_descr_avc_vid_constraint_set0_flag = -1;
579 static int hf_mpeg_descr_avc_vid_constraint_set1_flag = -1;
580 static int hf_mpeg_descr_avc_vid_constraint_set2_flag = -1;
581 static int hf_mpeg_descr_avc_vid_compatible_flags = -1;
582 static int hf_mpeg_descr_avc_vid_level_idc = -1;
583 static int hf_mpeg_descr_avc_vid_still_present = -1;
584 static int hf_mpeg_descr_avc_vid_24h_picture_flag = -1;
585 static int hf_mpeg_descr_avc_vid_reserved = -1;
586
587 #define MPEG_DESCR_AVC_VID_CONSTRAINT_SET0_FLAG_MASK    0x80
588 #define MPEG_DESCR_AVC_VID_CONSTRAINT_SET1_FLAG_MASK    0x40
589 #define MPEG_DESCR_AVC_VID_CONSTRAINT_SET2_FLAG_MASK    0x20
590 #define MPEG_DESCR_AVC_VID_COMPATIBLE_FLAGS_MASK        0x1F
591 #define MPEG_DESCR_AVC_VID_STILL_PRESENT_MASK           0x80
592 #define MPEG_DESCR_AVC_VID_24H_PICTURE_FLAG_MASK        0x40
593 #define MPEG_DESCR_AVC_VID_RESERVED_MASK                0x3F
594
595 static void
596 proto_mpeg_descriptor_dissect_avc_vid(tvbuff_t *tvb, guint offset, proto_tree *tree)
597 {
598     proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_profile_idc, tvb, offset, 1, ENC_BIG_ENDIAN);
599     offset += 1;
600
601     proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_constraint_set0_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
602     proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_constraint_set1_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
603     proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_constraint_set2_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
604     proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_compatible_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
605     offset += 1;
606
607     proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_level_idc, tvb, offset, 1, ENC_BIG_ENDIAN);
608     offset += 1;
609
610     proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_still_present, tvb, offset, 1, ENC_BIG_ENDIAN);
611     proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_24h_picture_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
612     proto_tree_add_item(tree, hf_mpeg_descr_avc_vid_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
613 }
614
615 /* 0x40 Network Name Descriptor */
616 static int hf_mpeg_descr_network_name_descriptor = -1;
617
618 static void
619 proto_mpeg_descriptor_dissect_network_name(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
620 {
621     proto_tree_add_item(tree, hf_mpeg_descr_network_name_descriptor, tvb, offset, len, ENC_ASCII|ENC_NA);
622 }
623
624 /* 0x41 Service List Descriptor */
625 static int hf_mpeg_descr_service_list_id = -1;
626 static int hf_mpeg_descr_service_list_type = -1;
627
628 static gint ett_mpeg_descriptor_service_list = -1;
629
630 static void
631 proto_mpeg_descriptor_dissect_service_list(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
632 {
633     guint   end = offset + len;
634     guint16 svc_id;
635
636     proto_tree *svc_tree;
637
638
639     while (offset < end) {
640         svc_id = tvb_get_ntohs(tvb, offset);
641
642         svc_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3,
643                     ett_mpeg_descriptor_service_list, NULL, "Service 0x%02x", svc_id);
644
645         proto_tree_add_item(svc_tree, hf_mpeg_descr_service_list_id, tvb, offset, 2, ENC_BIG_ENDIAN);
646         offset += 2;
647
648         proto_tree_add_item(svc_tree, hf_mpeg_descr_service_list_type, tvb, offset, 1, ENC_BIG_ENDIAN);
649         offset += 1;
650     }
651 }
652
653 /* 0x42 Stuffing Descriptor */
654 static int hf_mpeg_descr_stuffing = -1;
655
656 static void
657 proto_mpeg_descriptor_stuffing(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
658 {
659     proto_tree_add_item(tree, hf_mpeg_descr_stuffing, tvb, offset, len, ENC_NA);
660 }
661
662 /* 0x43 Satellite Delivery System Descriptor */
663 static int hf_mpeg_descr_satellite_delivery_frequency = -1;
664 static int hf_mpeg_descr_satellite_delivery_orbital_position = -1;
665 static int hf_mpeg_descr_satellite_delivery_west_east_flag = -1;
666 static int hf_mpeg_descr_satellite_delivery_polarization = -1;
667 static int hf_mpeg_descr_satellite_delivery_roll_off = -1;
668 static int hf_mpeg_descr_satellite_delivery_zero = -1;
669 static int hf_mpeg_descr_satellite_delivery_modulation_system = -1;
670 static int hf_mpeg_descr_satellite_delivery_modulation_type = -1;
671 static int hf_mpeg_descr_satellite_delivery_symbol_rate = -1;
672 static int hf_mpeg_descr_satellite_delivery_fec_inner = -1;
673
674 #define MPEG_DESCR_SATELLITE_DELIVERY_WEST_EAST_FLAG_MASK       0x80
675 #define MPEG_DESCR_SATELLITE_DELIVERY_POLARIZATION_MASK         0x60
676 #define MPEG_DESCR_SATELLITE_DELIVERY_ROLL_OFF_MASK             0x18
677 #define MPEG_DESCR_SATELLITE_DELIVERY_ZERO_MASK                 0x18
678 #define MPEG_DESCR_SATELLITE_DELIVERY_MODULATION_SYSTEM_MASK    0x04
679 #define MPEG_DESCR_SATELLITE_DELIVERY_MODULATION_TYPE_MASK      0x03
680 #define MPEG_DESCR_SATELLITE_DELIVERY_FEC_INNER_MASK            0x0F
681
682 static const value_string mpeg_descr_satellite_delivery_west_east_flag_vals[] = {
683     { 0x0, "West" },
684     { 0x1, "East" },
685
686     { 0x0, NULL }
687 };
688
689 static const value_string mpeg_descr_satellite_delivery_polarization_vals[] = {
690     { 0x0, "Linear - Horizontal" },
691     { 0x1, "Linear - Vertical" },
692     { 0x2, "Circular - Left" },
693     { 0x3, "Circular - Right" },
694
695     { 0x0, NULL }
696 };
697
698 static const value_string mpeg_descr_satellite_delivery_roll_off_vals[] = {
699     { 0x0, "alpha = 0,35" },
700     { 0x1, "alpha = 0,25" },
701     { 0x2, "alpha = 0,20" },
702
703     { 0x0, NULL }
704 };
705
706 static const value_string mpeg_descr_satellite_delivery_modulation_system_vals[] = {
707     { 0x0, "DVB-S" },
708     { 0x1, "DVB-S2" },
709
710     { 0x0, NULL }
711 };
712
713 static const value_string mpeg_descr_satellite_delivery_modulation_type_vals[] = {
714     { 0x0, "Auto" },
715     { 0x1, "QPSK" },
716     { 0x2, "8PSK" },
717     { 0x3, "16-QAM (n/a for DVB-S2)" },
718
719     { 0x0, NULL }
720 };
721
722 static const value_string mpeg_descr_satellite_delivery_fec_inner_vals[] = {
723     { 0x0, "Not defined" },
724     { 0x1, "1/2 convolutional code rate" },
725     { 0x2, "2/3 convolutional code rate" },
726     { 0x3, "3/4 convolutional code rate" },
727     { 0x4, "5/6 convolutional code rate" },
728     { 0x5, "7/8 convolutional code rate" },
729     { 0x6, "8/9 convolutional code rate" },
730     { 0x7, "3/5 convolutional code rate" },
731     { 0x8, "4/5 convolutional code rate" },
732     { 0x9, "9/10 convolutional code rate" },
733     { 0xF, "No convolutional coding" },
734
735     { 0x0, NULL }
736 };
737 static value_string_ext mpeg_descr_satellite_delivery_fec_inner_vals_ext =
738     VALUE_STRING_EXT_INIT(mpeg_descr_satellite_delivery_fec_inner_vals);
739
740 static void
741 proto_mpeg_descriptor_dissect_satellite_delivery(tvbuff_t *tvb, guint offset, proto_tree *tree)
742 {
743
744     double frequency, symbol_rate;
745     float orbital_position;
746     guint8  modulation_system;
747
748     frequency = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset)) * 10.0 +
749                 MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+1)) / 10.0 +
750                 MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+2)) / 1000.0 +
751                 MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+3)) / 100000.0;
752     proto_tree_add_double(tree, hf_mpeg_descr_satellite_delivery_frequency,
753             tvb, offset, 4, frequency);
754     offset += 4;
755
756     orbital_position = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset)) * 10.0f +
757                        MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+1)) / 10.0f;
758     proto_tree_add_float(tree, hf_mpeg_descr_satellite_delivery_orbital_position,
759             tvb, offset, 2, orbital_position);
760     offset += 2;
761
762     modulation_system = tvb_get_guint8(tvb, offset) & MPEG_DESCR_SATELLITE_DELIVERY_MODULATION_SYSTEM_MASK;
763
764     proto_tree_add_item(tree, hf_mpeg_descr_satellite_delivery_west_east_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
765     proto_tree_add_item(tree, hf_mpeg_descr_satellite_delivery_polarization, tvb, offset, 1, ENC_BIG_ENDIAN);
766     if (modulation_system)
767         proto_tree_add_item(tree, hf_mpeg_descr_satellite_delivery_roll_off, tvb, offset, 1, ENC_BIG_ENDIAN);
768     else
769         proto_tree_add_item(tree, hf_mpeg_descr_satellite_delivery_zero, tvb, offset, 1, ENC_BIG_ENDIAN);
770     proto_tree_add_item(tree, hf_mpeg_descr_satellite_delivery_modulation_system, tvb, offset, 1, ENC_BIG_ENDIAN);
771     proto_tree_add_item(tree, hf_mpeg_descr_satellite_delivery_modulation_type, tvb, offset, 1, ENC_BIG_ENDIAN);
772     offset += 1;
773
774     symbol_rate = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset)) * 10.0 +
775                   MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+1)) / 10.0 +
776                   MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+2)) / 1000.0 +
777                   /* symbol rate is 28 bits, only the upper 4 bits of this byte are used */
778                   MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+3)>>4) / 10000.0;
779     proto_tree_add_double_format_value(tree, hf_mpeg_descr_satellite_delivery_symbol_rate,
780             tvb, offset, 4, symbol_rate, "%3.4f MSym/s", symbol_rate);
781     offset += 3;
782
783     proto_tree_add_item(tree, hf_mpeg_descr_satellite_delivery_fec_inner, tvb, offset, 1, ENC_BIG_ENDIAN);
784
785 }
786
787 /* 0x44 Cable Delivery System Descriptor */
788 static int hf_mpeg_descr_cable_delivery_frequency = -1;
789 static int hf_mpeg_descr_cable_delivery_reserved = -1;
790 static int hf_mpeg_descr_cable_delivery_fec_outer = -1;
791 static int hf_mpeg_descr_cable_delivery_modulation = -1;
792 static int hf_mpeg_descr_cable_delivery_symbol_rate = -1;
793 static int hf_mpeg_descr_cable_delivery_fec_inner = -1;
794
795 #define MPEG_DESCR_CABLE_DELIVERY_RESERVED_MASK     0xFFF0
796 #define MPEG_DESCR_CABLE_DELIVERY_FEC_OUTER_MASK    0x000F
797 #define MPEG_DESCR_CABLE_DELIVERY_FEC_INNER_MASK    0x0F
798
799 static const value_string mpeg_descr_cable_delivery_fec_outer_vals[] = {
800     { 0x0, "Not defined" },
801     { 0x1, "No outer FEC coding" },
802     { 0x2, "RS(204/188)" },
803
804     { 0x0, NULL }
805 };
806
807 static const value_string mpeg_descr_cable_delivery_modulation_vals[] = {
808     { 0x00, "Not defined" },
809     { 0x01, "16-QAM" },
810     { 0x02, "32-QAM" },
811     { 0x03, "64-QAM" },
812     { 0x04, "128-QAM" },
813     { 0x05, "256-QAM" },
814
815     { 0x0, NULL }
816 };
817
818 static const value_string mpeg_descr_cable_delivery_fec_inner_vals[] = {
819     { 0x0, "Not defined" },
820     { 0x1, "1/2 convolutional code rate" },
821     { 0x2, "2/3 convolutional code rate" },
822     { 0x3, "3/4 convolutional code rate" },
823     { 0x4, "5/6 convolutional code rate" },
824     { 0x5, "7/8 convolutional code rate" },
825     { 0x6, "8/9 convolutional code rate" },
826     { 0x7, "3/5 convolutional code rate" },
827     { 0x8, "4/5 convolutional code rate" },
828     { 0x9, "9/10 convolutional code rate" },
829     { 0xF, "No convolutional coding" },
830
831     { 0x0, NULL }
832 };
833 static value_string_ext mpeg_descr_cable_delivery_fec_inner_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descr_cable_delivery_fec_inner_vals);
834
835 static void
836 proto_mpeg_descriptor_dissect_cable_delivery(tvbuff_t *tvb, guint offset, proto_tree *tree) {
837
838     double frequency, symbol_rate;
839
840     frequency = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset)) * 100.0 +
841                 MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+1)) +
842                 MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+2)) / 100.0 +
843                 MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+3)) / 10000.0;
844     proto_tree_add_double_format_value(tree, hf_mpeg_descr_cable_delivery_frequency,
845             tvb, offset, 4, frequency, "%4.4f MHz", frequency);
846     offset += 4;
847
848     proto_tree_add_item(tree, hf_mpeg_descr_cable_delivery_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
849     proto_tree_add_item(tree, hf_mpeg_descr_cable_delivery_fec_outer, tvb, offset, 2, ENC_BIG_ENDIAN);
850     offset += 2;
851
852     proto_tree_add_item(tree, hf_mpeg_descr_cable_delivery_modulation, tvb, offset, 1, ENC_BIG_ENDIAN);
853     offset += 1;
854
855     symbol_rate = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset)) * 10.0 +
856                   MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+1)) / 10.0 +
857                   MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+2)) / 1000.0 +
858                   /* symbol rate is 28 bits, only the upper 4 bits of this byte are used */
859                   MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+3)>>4) / 10000.0;
860     proto_tree_add_double_format_value(tree, hf_mpeg_descr_cable_delivery_symbol_rate,
861             tvb, offset, 4, symbol_rate, "%3.4f MSymbol/s", symbol_rate);
862     offset += 3;
863     proto_tree_add_item(tree, hf_mpeg_descr_cable_delivery_fec_inner, tvb, offset, 1, ENC_BIG_ENDIAN);
864
865
866 }
867
868 /* 0x45 VBI Data Descriptor */
869 static int hf_mpeg_descr_vbi_data_service_id = -1;
870 static int hf_mpeg_descr_vbi_data_descr_len = -1;
871 static int hf_mpeg_descr_vbi_data_reserved1 = -1;
872 static int hf_mpeg_descr_vbi_data_field_parity = -1;
873 static int hf_mpeg_descr_vbi_data_line_offset = -1;
874 static int hf_mpeg_descr_vbi_data_reserved2 = -1;
875
876 #define MPEG_DESCR_VBI_DATA_RESERVED1_MASK  0xC0
877 #define MPEG_DESCR_VBI_DATA_FIELD_PARITY_MASK   0x20
878 #define MPEG_DESCR_VBI_DATA_LINE_OFFSET_MASK    0x1F
879
880 static gint ett_mpeg_descriptor_vbi_data_service = -1;
881
882 static const value_string mpeg_descr_vbi_data_service_id_vals[] = {
883
884     { 0x00, "Reserved" },
885     { 0x01, "EBU Teletext" },
886     { 0x02, "Inverted Teletext" },
887     { 0x03, "Reserved" },
888     { 0x04, "VPS" },
889     { 0x05, "WSS" },
890     { 0x06, "Closed Captioning" },
891     { 0x07, "Monochrome 4:2:2 samples" },
892
893     { 0, NULL }
894 };
895
896 static const value_string mpeg_descr_vbi_data_field_parity_vals[] = {
897     { 0x00, "Second (even) field of frame" },
898     { 0x01, "First (odd) field of frame" },
899
900     { 0, NULL }
901 };
902
903 static void
904 proto_mpeg_descriptor_dissect_vbi_data(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
905 {
906
907     guint8 svc_id, svc_len;
908     guint  end = offset + len, svc_end;
909
910     proto_tree *svc_tree;
911
912     while (offset < end) {
913         svc_id  = tvb_get_guint8(tvb, offset);
914         svc_len = tvb_get_guint8(tvb, offset + 1);
915         svc_tree = proto_tree_add_subtree_format(tree, tvb, offset, svc_len + 2,
916                     ett_mpeg_descriptor_vbi_data_service, NULL, "Service 0x%02x", svc_id);
917
918         proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_service_id, tvb, offset, 1, ENC_BIG_ENDIAN);
919         offset += 1;
920
921         proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_descr_len, tvb, offset, 1, ENC_BIG_ENDIAN);
922         offset += 1;
923
924         switch (svc_id) {
925             case 0x01:
926             case 0x02:
927             case 0x04:
928             case 0x05:
929             case 0x06:
930             case 0x07:
931                 svc_end = offset + svc_len;
932                 while (offset < svc_end) {
933                     proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
934                     proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_field_parity, tvb, offset, 1, ENC_BIG_ENDIAN);
935                     proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_line_offset, tvb, offset, 1, ENC_BIG_ENDIAN);
936                     offset += 1;
937                 }
938                 break;
939             default:
940                 proto_tree_add_item(svc_tree, hf_mpeg_descr_vbi_data_reserved2, tvb, offset, svc_len, ENC_NA);
941                 offset += svc_len;
942                 break;
943         }
944
945     }
946 }
947
948 /* 0x47 Bouquet Name Descriptor */
949 static int hf_mpeg_descr_bouquet_name = -1;
950
951 static void
952 proto_mpeg_descriptor_dissect_bouquet_name(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
953 {
954     proto_tree_add_item(tree, hf_mpeg_descr_bouquet_name, tvb, offset, len, ENC_ASCII|ENC_NA);
955 }
956
957 /* 0x48 Service Descriptor */
958 static int hf_mpeg_descr_service_type = -1;
959 static int hf_mpeg_descr_service_provider_name_length = -1;
960 static int hf_mpeg_descr_service_provider_name_encoding = -1;
961 static int hf_mpeg_descr_service_provider = -1;
962 static int hf_mpeg_descr_service_name_length = -1;
963 static int hf_mpeg_descr_service_name_encoding = -1;
964 static int hf_mpeg_descr_service_name = -1;
965
966 static const value_string mpeg_descr_service_type_vals[] = {
967
968     { 0x00, "reserved" },
969     { 0x01, "digital television service" },
970     { 0x02, "digital radio sound service" },
971     { 0x03, "Teletext service" },
972     { 0x04, "NVOD reference service" },
973     { 0x05, "NVOD time-shifted service" },
974     { 0x06, "mosaic service" },
975     { 0x07, "FM radio service" },
976     { 0x08, "DVB SRM service" },
977     { 0x09, "reserved" },
978     { 0x0A, "advanced codec digital radio sound service" },
979     { 0x0B, "advanced codec mosaic service" },
980     { 0x0C, "data broadcast service" },
981     { 0x0D, "reserved for Common Interface Usage (EN 50221)" },
982     { 0x0E, "RCS Map (see EN 301 790)" },
983     { 0x0F, "RCS FLS (see EN 301 790)" },
984     { 0x10, "DVB MHP service" },
985     { 0x11, "MPEG-2 HD digital television service" },
986     { 0x16, "advanced codec SD digital television service" },
987     { 0x17, "advanced codec SD NVOD time-shifted service" },
988     { 0x18, "advanced codec SD NVOD reference service" },
989     { 0x19, "advanced codec HD digital television service" },
990     { 0x1A, "advanced codec HD NVOD time-shifted service" },
991     { 0x1F, "HEVC digital television service" },
992
993     { 0x00, NULL }
994 };
995 /* global variable that's shared e.g. with DVB-CI */
996 value_string_ext mpeg_descr_service_type_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descr_service_type_vals);
997
998 static void
999 proto_mpeg_descriptor_dissect_service(tvbuff_t *tvb, guint offset, proto_tree *tree)
1000 {
1001     guint8          prov_len, name_len;
1002     guint           enc_len;
1003     dvb_encoding_e  encoding;
1004
1005     proto_tree_add_item(tree, hf_mpeg_descr_service_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1006     offset += 1;
1007
1008     prov_len = tvb_get_guint8(tvb, offset);
1009     proto_tree_add_item(tree, hf_mpeg_descr_service_provider_name_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1010     offset += 1;
1011
1012     if (prov_len>0) {
1013         enc_len = dvb_analyze_string_charset(tvb, offset, prov_len, &encoding);
1014         dvb_add_chartbl(tree, hf_mpeg_descr_service_provider_name_encoding, tvb, offset, enc_len, encoding);
1015
1016         proto_tree_add_item(tree, hf_mpeg_descr_service_provider,
1017                 tvb, offset+enc_len, prov_len-enc_len, dvb_enc_to_item_enc(encoding));
1018     }
1019     offset += prov_len;
1020
1021     name_len = tvb_get_guint8(tvb, offset);
1022     proto_tree_add_item(tree, hf_mpeg_descr_service_name_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1023     offset += 1;
1024
1025     if (name_len>0) {
1026         enc_len = dvb_analyze_string_charset(tvb, offset, name_len, &encoding);
1027         dvb_add_chartbl(tree, hf_mpeg_descr_service_name_encoding, tvb, offset, enc_len, encoding);
1028
1029         proto_tree_add_item(tree, hf_mpeg_descr_service_name,
1030                 tvb, offset+enc_len, name_len-enc_len, dvb_enc_to_item_enc(encoding));
1031     }
1032
1033 }
1034
1035 /* 0x4A Linkage Descriptor */
1036 static int hf_mpeg_descr_linkage_transport_stream_id = -1;
1037 static int hf_mpeg_descr_linkage_original_network_id = -1;
1038 static int hf_mpeg_descr_linkage_service_id = -1;
1039 static int hf_mpeg_descr_linkage_linkage_type = -1;
1040
1041 static int hf_mpeg_descr_linkage_hand_over_type = -1;
1042 static int hf_mpeg_descr_linkage_reserved1 = -1;
1043 static int hf_mpeg_descr_linkage_origin_type = -1;
1044 static int hf_mpeg_descr_linkage_network_id = -1;
1045 static int hf_mpeg_descr_linkage_initial_service_id = -1;
1046
1047 static int hf_mpeg_descr_linkage_target_event_id = -1;
1048 static int hf_mpeg_descr_linkage_target_listed = -1;
1049 static int hf_mpeg_descr_linkage_event_simulcast = -1;
1050 static int hf_mpeg_descr_linkage_reserved2 = -1;
1051
1052 static int hf_mpeg_descr_linkage_interactive_network_id = -1;
1053 static int hf_mpeg_descr_linkage_population_id_loop_count = -1;
1054 static int hf_mpeg_descr_linkage_population_id = -1;
1055 static int hf_mpeg_descr_linkage_population_id_base = -1;
1056 static int hf_mpeg_descr_linkage_population_id_mask = -1;
1057
1058 static int hf_mpeg_descr_linkage_private_data_byte = -1;
1059
1060 static gint ett_mpeg_descriptor_linkage_population_id = -1;
1061
1062 #define MPEG_DESCR_LINKAGE_HAND_OVER_TYPE_MASK  0xF0
1063 #define MPEG_DESCR_LINKAGE_HAND_OVER_TYPE_SHIFT 0x04
1064 #define MPEG_DESCR_LINKAGE_RESERVED1_MASK   0x0E
1065 #define MPEG_DESCR_LINKAGE_ORIGIN_TYPE_MASK 0x01
1066
1067 #define MPEG_DESCR_LINKAGE_TARGET_LISTED_MASK   0x80
1068 #define MPEG_DESCR_LINKAGE_EVENT_SIMULCAST_MASK 0x40
1069 #define MPEG_DESCR_LINKAGE_RESERVED2_MASK   0x3F
1070
1071 static const value_string mpeg_descr_linkage_linkage_type_vals[] = {
1072     { 0x01, "Information service" },
1073     { 0x02, "EPG service" },
1074     { 0x03, "CA replacement service" },
1075     { 0x04, "TS containing complete Network/Bouquet SI" },
1076     { 0x05, "Service replacement service" },
1077     { 0x06, "Data broadcast service" },
1078     { 0x07, "RCS Map" },
1079     { 0x08, "Mobile hand-over" },
1080     { 0x09, "System Software Update Service" },
1081     { 0x0A, "TS containing SSU BAT or NIT" },
1082     { 0x0B, "IP/MAC Notification Service" },
1083     { 0x0C, "TS containing INT BAT or NIT" },
1084     { 0x0D, "Event linkage" },
1085     { 0x81, "RCS FLS" },
1086
1087     { 0x00, NULL }
1088 };
1089 static value_string_ext mpeg_descr_linkage_linkage_type_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descr_linkage_linkage_type_vals);
1090
1091 #if 0
1092 static const value_string mpeg_descr_linkage_hand_over_type_vals[] = {
1093     { 0x01, "DVB hand-over to an identical service in a neighbouring country" },
1094     { 0x02, "DVB hand-over to a local variation of the same service" },
1095     { 0x03, "DVB hand-over to an associated service" },
1096
1097     { 0x00, NULL }
1098 };
1099 #endif
1100
1101 static const value_string mpeg_descr_linkage_origin_type_vals[] = {
1102     { 0x0, "NIT" },
1103     { 0x1, "SDT" },
1104
1105     { 0x0, NULL }
1106 };
1107
1108 static const value_string mpeg_descr_linkage_target_listed_vals[] = {
1109     { 0x0, "Service may not be included in SDT" },
1110     { 0x1, "Service should be included in SDT" },
1111
1112     { 0x0, NULL}
1113 };
1114
1115 static const value_string mpeg_descr_linkage_event_simulcast_vals[] = {
1116     { 0x0, "Events are offset in time" },
1117     { 0x1, "Target and source events are being simulcast" },
1118
1119     { 0x0, NULL }
1120 };
1121
1122 static void
1123 proto_mpeg_descriptor_dissect_linkage(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
1124 {
1125
1126     guint8  linkage_type, hand_over_type, origin_type;
1127     guint   end = offset + len;
1128     guint   population_id_loop_count;
1129     guint16 population_id_base, population_id_mask;
1130
1131     proto_item *pi;
1132     proto_tree *population_tree;
1133
1134     proto_tree_add_item(tree, hf_mpeg_descr_linkage_transport_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1135     offset += 2;
1136
1137     proto_tree_add_item(tree, hf_mpeg_descr_linkage_original_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1138     offset += 2;
1139
1140     proto_tree_add_item(tree, hf_mpeg_descr_linkage_service_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1141     offset += 2;
1142
1143     proto_tree_add_item(tree, hf_mpeg_descr_linkage_linkage_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1144     linkage_type = tvb_get_guint8(tvb, offset);
1145     offset += 1;
1146
1147     if (linkage_type == 0x08) {
1148         proto_tree_add_item(tree, hf_mpeg_descr_linkage_hand_over_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1149         proto_tree_add_item(tree, hf_mpeg_descr_linkage_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
1150         proto_tree_add_item(tree, hf_mpeg_descr_linkage_origin_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1151         hand_over_type = (tvb_get_guint8(tvb, offset) & MPEG_DESCR_LINKAGE_HAND_OVER_TYPE_MASK) >> MPEG_DESCR_LINKAGE_HAND_OVER_TYPE_SHIFT;
1152         origin_type = tvb_get_guint8(tvb, offset) & MPEG_DESCR_LINKAGE_ORIGIN_TYPE_MASK;
1153         offset += 1;
1154
1155         if ((hand_over_type == 1) || (hand_over_type == 2) || (hand_over_type == 3)) {
1156             proto_tree_add_item(tree, hf_mpeg_descr_linkage_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1157             offset += 2;
1158         }
1159
1160         if (origin_type) {
1161             proto_tree_add_item(tree, hf_mpeg_descr_linkage_initial_service_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1162             offset += 2;
1163         }
1164
1165     } else if (linkage_type == 0x0D) {
1166         proto_tree_add_item(tree, hf_mpeg_descr_linkage_target_event_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1167         offset += 2;
1168
1169         proto_tree_add_item(tree, hf_mpeg_descr_linkage_target_listed, tvb, offset, 1, ENC_BIG_ENDIAN);
1170         proto_tree_add_item(tree, hf_mpeg_descr_linkage_event_simulcast, tvb, offset, 1, ENC_BIG_ENDIAN);
1171         proto_tree_add_item(tree, hf_mpeg_descr_linkage_reserved2, tvb, offset, 1, ENC_BIG_ENDIAN);
1172     } else if (linkage_type == 0x81) {
1173         /* linkage type 0x81 is "user defined" in the DVB-SI spec (EN 300468)
1174            it is defined in the interaction channel spec (EN 301790)
1175            it seems that in practice, 0x81 is also used for other purposes than interaction channel
1176            if the following data really belongs to interaction channel, we need at least another 7 bytes */
1177         if (offset+7>end)
1178             return;
1179
1180         proto_tree_add_item(tree, hf_mpeg_descr_linkage_interactive_network_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1181         offset += 2;
1182
1183         population_id_loop_count = tvb_get_guint8(tvb, offset) + 1;
1184         proto_tree_add_item(tree, hf_mpeg_descr_linkage_population_id_loop_count, tvb, offset, 1, ENC_BIG_ENDIAN);
1185         offset += 1;
1186
1187         while (population_id_loop_count--) {
1188             population_id_base = tvb_get_ntohs(tvb, offset);
1189             population_id_mask = tvb_get_ntohs(tvb, offset + 2);
1190             pi = proto_tree_add_uint_format_value(tree, hf_mpeg_descr_linkage_population_id, tvb, offset, 4,
1191                     population_id_base<<16|population_id_mask,
1192                     "0x%04x / 0x%04x", population_id_base, population_id_mask);
1193             population_tree = proto_item_add_subtree(pi, ett_mpeg_descriptor_linkage_population_id);
1194
1195             proto_tree_add_item(population_tree, hf_mpeg_descr_linkage_population_id_base, tvb, offset, 2, ENC_BIG_ENDIAN);
1196             offset += 2;
1197
1198             proto_tree_add_item(population_tree, hf_mpeg_descr_linkage_population_id_mask, tvb, offset, 2, ENC_BIG_ENDIAN);
1199             offset += 2;
1200         }
1201
1202     }
1203
1204     if (end - offset > 0)
1205         proto_tree_add_item(tree, hf_mpeg_descr_linkage_private_data_byte, tvb, offset, end - offset, ENC_NA);
1206 }
1207
1208 /* 0x4D Short Event Descriptor */
1209 static int hf_mpeg_descr_short_event_lang_code = -1;
1210 static int hf_mpeg_descr_short_event_name_length = -1;
1211 static int hf_mpeg_descr_short_event_name_encoding = -1;
1212 static int hf_mpeg_descr_short_event_name = -1;
1213 static int hf_mpeg_descr_short_event_text_length = -1;
1214 static int hf_mpeg_descr_short_event_text_encoding = -1;
1215 static int hf_mpeg_descr_short_event_text = -1;
1216
1217 static void
1218 proto_mpeg_descriptor_dissect_short_event(tvbuff_t *tvb, guint offset, proto_tree *tree)
1219 {
1220     guint8          name_len, text_len;
1221     guint           enc_len;
1222     dvb_encoding_e  encoding;
1223
1224     proto_tree_add_item(tree, hf_mpeg_descr_short_event_lang_code, tvb, offset, 3, ENC_ASCII|ENC_NA);
1225     offset += 3;
1226
1227     name_len = tvb_get_guint8(tvb, offset);
1228     proto_tree_add_item(tree, hf_mpeg_descr_short_event_name_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1229     offset += 1;
1230
1231     if (name_len>0) {
1232         enc_len = dvb_analyze_string_charset(tvb, offset, name_len, &encoding);
1233         dvb_add_chartbl(tree, hf_mpeg_descr_short_event_name_encoding, tvb, offset, enc_len, encoding);
1234         proto_tree_add_item(tree, hf_mpeg_descr_short_event_name,
1235                 tvb, offset+enc_len, name_len-enc_len, dvb_enc_to_item_enc(encoding));
1236     }
1237     offset += name_len;
1238
1239     text_len = tvb_get_guint8(tvb, offset);
1240     proto_tree_add_item(tree, hf_mpeg_descr_short_event_text_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1241     offset += 1;
1242
1243     if (text_len>0) {
1244         enc_len = dvb_analyze_string_charset(tvb, offset, text_len, &encoding);
1245         dvb_add_chartbl(tree, hf_mpeg_descr_short_event_text_encoding, tvb, offset, enc_len, encoding);
1246         proto_tree_add_item(tree, hf_mpeg_descr_short_event_text,
1247                 tvb, offset+enc_len, text_len-enc_len, dvb_enc_to_item_enc(encoding));
1248     }
1249 }
1250
1251 /* 0x4E Extended Event Descriptor */
1252 static int hf_mpeg_descr_extended_event_descriptor_number = -1;
1253 static int hf_mpeg_descr_extended_event_last_descriptor_number = -1;
1254 static int hf_mpeg_descr_extended_event_lang_code = -1;
1255 static int hf_mpeg_descr_extended_event_length_of_items = -1;
1256 static int hf_mpeg_descr_extended_event_item_description_length = -1;
1257 static int hf_mpeg_descr_extended_event_item_description_char = -1;
1258 static int hf_mpeg_descr_extended_event_item_length = -1;
1259 static int hf_mpeg_descr_extended_event_item_char = -1;
1260 static int hf_mpeg_descr_extended_event_text_length = -1;
1261 static int hf_mpeg_descr_extended_event_text_encoding = -1;
1262 static int hf_mpeg_descr_extended_event_text = -1;
1263
1264 #define MPEG_DESCR_EXTENDED_EVENT_DESCRIPTOR_NUMBER_MASK    0xF0
1265 #define MPEG_DESCR_EXTENDED_EVENT_LAST_DESCRIPTOR_NUMBER_MASK   0x0F
1266
1267 static gint ett_mpeg_descriptor_extended_event_item = -1;
1268
1269 static void
1270 proto_mpeg_descriptor_dissect_extended_event(tvbuff_t *tvb, guint offset, proto_tree *tree)
1271 {
1272
1273     guint8          items_len, item_descr_len, item_len, text_len;
1274     guint           items_end;
1275     proto_tree     *item_tree;
1276     guint           enc_len;
1277     dvb_encoding_e  encoding;
1278
1279     proto_tree_add_item(tree, hf_mpeg_descr_extended_event_descriptor_number, tvb, offset, 1, ENC_BIG_ENDIAN);
1280     proto_tree_add_item(tree, hf_mpeg_descr_extended_event_last_descriptor_number, tvb, offset, 1, ENC_BIG_ENDIAN);
1281     offset += 1;
1282
1283     proto_tree_add_item(tree, hf_mpeg_descr_extended_event_lang_code, tvb, offset, 3, ENC_ASCII|ENC_NA);
1284     offset += 3;
1285
1286     items_len = tvb_get_guint8(tvb, offset);
1287     proto_tree_add_item(tree, hf_mpeg_descr_extended_event_length_of_items, tvb, offset, 1, ENC_BIG_ENDIAN);
1288     offset += 1;
1289
1290     items_end = offset + items_len;
1291
1292     while (offset < items_end) {
1293         item_tree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_mpeg_descriptor_extended_event_item, NULL, "Item");
1294
1295         item_descr_len = tvb_get_guint8(tvb, offset);
1296         proto_tree_add_item(item_tree, hf_mpeg_descr_extended_event_item_description_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1297         offset += 1;
1298
1299         proto_tree_add_item(item_tree, hf_mpeg_descr_extended_event_item_description_char, tvb, offset, item_descr_len, ENC_ASCII|ENC_NA);
1300         offset += item_descr_len;
1301
1302         item_len = tvb_get_guint8(tvb, offset);
1303         proto_tree_add_item(item_tree, hf_mpeg_descr_extended_event_item_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1304         offset += 1;
1305
1306         proto_tree_add_item(item_tree, hf_mpeg_descr_extended_event_item_char, tvb, offset, item_len, ENC_ASCII|ENC_NA);
1307         offset += item_len;
1308     }
1309
1310     text_len = tvb_get_guint8(tvb, offset);
1311     proto_tree_add_item(tree, hf_mpeg_descr_extended_event_text_length, tvb, offset, 1, ENC_BIG_ENDIAN);
1312     offset += 1;
1313
1314     if (text_len>0) {
1315         enc_len = dvb_analyze_string_charset(tvb, offset, text_len, &encoding);
1316         dvb_add_chartbl(tree, hf_mpeg_descr_extended_event_text_encoding, tvb, offset, enc_len, encoding);
1317         proto_tree_add_item(tree, hf_mpeg_descr_extended_event_text,
1318                 tvb, offset+enc_len, text_len-enc_len, dvb_enc_to_item_enc(encoding));
1319     }
1320
1321 }
1322
1323 /* 0x50 Component Descriptor */
1324 static int hf_mpeg_descr_component_reserved = -1;
1325 static int hf_mpeg_descr_component_stream_content = -1;
1326 static int hf_mpeg_descr_component_type = -1;
1327 static int hf_mpeg_descr_component_content_type = -1;
1328 static int hf_mpeg_descr_component_tag = -1;
1329 static int hf_mpeg_descr_component_lang_code = -1;
1330 static int hf_mpeg_descr_component_text = -1;
1331
1332 #define MPEG_DESCR_COMPONENT_RESERVED_MASK      0xF0
1333 #define MPEG_DESCR_COMPONENT_STREAM_CONTENT_MASK    0x0F
1334 #define MPEG_DESCR_COMPONENT_CONTENT_TYPE_MASK      0x0FFF
1335
1336 static gint ett_mpeg_descriptor_component_content_type = -1;
1337
1338 static const value_string mpeg_descr_component_stream_content_vals[] = {
1339
1340     { 0x01, "Video (MPEG-2)" },
1341     { 0x02, "Audio (MPEG-1 Layer 2)" },
1342     { 0x03, "EBU Data (Teletext, Subtitle, ...)" },
1343     { 0x04, "Audio (AC-3)" },
1344     { 0x05, "Video (H.264/AVC)" },
1345     { 0x06, "Audio (HE-AAC)" },
1346     { 0x07, "Audio (DTS)" },
1347     { 0x09, "HEVC" },
1348
1349     { 0x0, NULL }
1350 };
1351
1352 static const value_string mpeg_descr_component_content_type_vals[] = {
1353
1354     { 0x0101, "MPEG-2 video, 4:3 aspect ratio, 25 Hz" },
1355     { 0x0102, "MPEG-2 video, 16:9 aspect ratio with pan vectors, 25 Hz" },
1356     { 0x0103, "MPEG-2 video, 16:9 aspect ratio without pan vectors, 25 Hz" },
1357     { 0x0104, "MPEG-2 video, > 16:9 aspect ratio, 25 Hz" },
1358     { 0x0105, "MPEG-2 video, 4:3 aspect ratio, 30 Hz" },
1359     { 0x0106, "MPEG-2 video, 16:9 aspect ratio with pan vectors, 30 Hz" },
1360     { 0x0107, "MPEG-2 video, 16:9 aspect ratio without pan vectors, 30 Hz" },
1361     { 0x0108, "MPEG-2 video, > 16:9 aspect ratio, 30 Hz" },
1362     { 0x0109, "MPEG-2 high definition video, 4:3 aspect ratio, 25 Hz" },
1363     { 0x010A, "MPEG-2 high definition video, 16:9 aspect ratio with pan vectors, 25 Hz" },
1364     { 0x010B, "MPEG-2 high definition video, 16:9 aspect ratio without pan vectors, 25 Hz" },
1365     { 0x010C, "MPEG-2 high definition video, > 16:9 aspect ratio, 25 Hz" },
1366     { 0x010D, "MPEG-2 high definition video, 4:3 aspect ratio, 30 Hz" },
1367     { 0x010E, "MPEG-2 high definition video, 16:9 aspect ratio with pan vectors, 30 Hz" },
1368     { 0x010F, "MPEG-2 high definition video, 16:9 aspect ratio without pan vectors, 30 Hz" },
1369     { 0x0110, "MPEG-2 high definition video, > 16:9 aspect ratio, 30 Hz" },
1370     { 0x0201, "MPEG-1 Layer 2 audio, single mono channel" },
1371     { 0x0202, "MPEG-1 Layer 2 audio, dual mono channel" },
1372     { 0x0203, "MPEG-1 Layer 2 audio, stereo" },
1373     { 0x0204, "MPEG-1 Layer 2 audio, multi-lingual, multi-channel" },
1374     { 0x0205, "MPEG-1 Layer 2 audio, surround sound" },
1375     { 0x0240, "MPEG-1 Layer 2 audio description for the visually impaired" },
1376     { 0x0241, "MPEG-1 Layer 2 audio for the hard of hearing" },
1377     { 0x0242, "receiver-mixed supplementary audio as per annex E of TS 101 154 [9]" },
1378     { 0x0247, "MPEG-1 Layer 2 audio, receiver mix audio description as per annex E of TS 101 154 [9]" },
1379     { 0x0248, "MPEG-1 Layer 2 audio, broadcaster mix audio description" },
1380     { 0x0301, "EBU Teletext subtitles" },
1381     { 0x0302, "associated EBU Teletext" },
1382     { 0x0303, "VBI data" },
1383     { 0x0310, "DVB subtitles (normal) with no monitor aspect ratio criticality" },
1384     { 0x0311, "DVB subtitles (normal) for display on 4:3 aspect ratio monitor" },
1385     { 0x0312, "DVB subtitles (normal) for display on 16:9 aspect ratio monitor" },
1386     { 0x0313, "DVB subtitles (normal) for display on 2.21:1 aspect ratio monitor" },
1387     { 0x0314, "DVB subtitles (normal) for display on a high definition monitor" },
1388     { 0x0320, "DVB subtitles (for the hard of hearing) with no monitor aspect ratio criticality" },
1389     { 0x0321, "DVB subtitles (for the hard of hearing) for display on 4:3 aspect ratio monitor" },
1390     { 0x0322, "DVB subtitles (for the hard of hearing) for display on 16:9 aspect ratio monitor" },
1391     { 0x0323, "DVB subtitles (for the hard of hearing) for display on 2.21:1 aspect ratio monitor" },
1392     { 0x0324, "DVB subtitles (for the hard of hearing) for display on a high definition monitor" },
1393     { 0x0330, "Open (in-vision) sign language interpretation for the deaf" },
1394     { 0x0331, "Closed sign language interpretation for the deaf" },
1395     { 0x0340, "video up-sampled from standard definition source material" },
1396     { 0x0501, "H.264/AVC standard definition video, 4:3 aspect ratio, 25 Hz" },
1397     { 0x0503, "H.264/AVC standard definition video, 16:9 aspect ratio, 25 Hz" },
1398     { 0x0504, "H.264/AVC standard definition video, > 16:9 aspect ratio, 25 Hz" },
1399     { 0x0505, "H.264/AVC standard definition video, 4:3 aspect ratio, 30 Hz" },
1400     { 0x0507, "H.264/AVC standard definition video, 16:9 aspect ratio, 30 Hz" },
1401     { 0x0508, "H.264/AVC standard definition video, > 16:9 aspect ratio, 30 Hz" },
1402     { 0x050B, "H.264/AVC high definition video, 16:9 aspect ratio, 25 Hz" },
1403     { 0x050C, "H.264/AVC high definition video, > 16:9 aspect ratio, 25 Hz" },
1404     { 0x050F, "H.264/AVC high definition video, 16:9 aspect ratio, 30 Hz" },
1405     { 0x0510, "H.264/AVC high definition video, > 16:9 aspect ratio, 30 Hz" },
1406     { 0x0601, "HE-AAC audio, single mono channel" },
1407     { 0x0603, "HE-AAC audio, stereo" },
1408     { 0x0605, "HE-AAC audio, surround sound" },
1409     { 0x0640, "HE-AAC audio description for the visually impaired" },
1410     { 0x0641, "HE-AAC audio for the hard of hearing" },
1411     { 0x0642, "HE-AAC receiver-mixed supplementary audio as per annex E of TS 101 154 [9]" },
1412     { 0x0643, "HE-AAC v2 audio, stereo" },
1413     { 0x0644, "HE-AAC v2 audio description for the visually impaired" },
1414     { 0x0645, "HE-AAC v2 audio for the hard of hearing" },
1415     { 0x0646, "HE-AAC v2 receiver-mixed supplementary audio as per annex E of TS 101 154 [9]" },
1416     { 0x0647, "HE-AAC receiver mix audio description for the visually impaired" },
1417     { 0x0648, "HE-AAC broadcaster mix audio description for the visually impaired" },
1418     { 0x0649, "HE-AAC v2 receiver mix audio description for the visually impaired" },
1419     { 0x064A, "HE-AAC v2 broadcaster mix audio description for the visually impaired" },
1420     { 0x0801, "DVB SRM data" },
1421     { 0x0900, "HEVC Main Profile high definition video, 50 Hz" },
1422     { 0x0901, "HEVC Main 10 Profile high definition video, 50 Hz" },
1423     { 0x0902, "HEVC Main Profile high definition video, 60 Hz" },
1424     { 0x0903, "HEVC Main 10 Profile high definition video, 60 Hz" },
1425     { 0x0904, "HEVC ultra high definition video" },
1426
1427     { 0x0, NULL }
1428 };
1429 static value_string_ext mpeg_descr_component_content_type_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descr_component_content_type_vals);
1430
1431 static void
1432 proto_mpeg_descriptor_dissect_component(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
1433 {
1434
1435     proto_item *cti;
1436     proto_tree *content_type_tree;
1437
1438     proto_tree_add_item(tree, hf_mpeg_descr_component_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1439
1440     cti = proto_tree_add_item(tree, hf_mpeg_descr_component_content_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1441     content_type_tree = proto_item_add_subtree(cti, ett_mpeg_descriptor_component_content_type);
1442
1443     proto_tree_add_item(content_type_tree, hf_mpeg_descr_component_stream_content, tvb, offset, 1, ENC_BIG_ENDIAN);
1444     offset += 1;
1445
1446     proto_tree_add_item(content_type_tree, hf_mpeg_descr_component_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1447     offset += 1;
1448
1449     proto_tree_add_item(tree, hf_mpeg_descr_component_tag, tvb, offset, 1, ENC_BIG_ENDIAN);
1450     offset += 1;
1451
1452     proto_tree_add_item(tree, hf_mpeg_descr_component_lang_code, tvb, offset, 3, ENC_ASCII|ENC_NA);
1453     offset += 3;
1454
1455     if (offset < len)
1456         proto_tree_add_item(tree, hf_mpeg_descr_component_text, tvb, offset, len - offset, ENC_ASCII|ENC_NA);
1457 }
1458
1459 /* 0x52 Stream Identifier Descriptor */
1460 static int hf_mpeg_descr_stream_identifier_component_tag = -1;
1461
1462 static void
1463 proto_mpeg_descriptor_dissect_stream_identifier(tvbuff_t *tvb, guint offset, proto_tree *tree)
1464 {
1465     proto_tree_add_item(tree, hf_mpeg_descr_stream_identifier_component_tag, tvb, offset, 1, ENC_BIG_ENDIAN);
1466 }
1467
1468 /* 0x53 CA Identifier Descriptor */
1469 static int hf_mpeg_descr_ca_identifier_system_id = -1;
1470
1471 static void
1472 proto_mpeg_descriptor_dissect_ca_identifier(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
1473 {
1474     guint end = offset + len;
1475
1476     while (offset < end) {
1477         proto_tree_add_item(tree, hf_mpeg_descr_ca_identifier_system_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1478         offset += 2;
1479     }
1480
1481 }
1482
1483 /* 0x54 Content Descriptor */
1484 static int hf_mpeg_descr_content_nibble = -1;
1485 static int hf_mpeg_descr_content_nibble_level_1 = -1;
1486 static int hf_mpeg_descr_content_nibble_level_2 = -1;
1487 static int hf_mpeg_descr_content_user_byte = -1;
1488
1489 #define MPEG_DESCR_CONTENT_NIBBLE_LEVEL_1_MASK  0xF0
1490 #define MPEG_DESCR_CONTENT_NIBBLE_LEVEL_2_MASK  0x0F
1491
1492 static gint ett_mpeg_descriptor_content_nibble = -1;
1493
1494 static const value_string mpeg_descr_content_nibble_vals[] = {
1495
1496     { 0x10, "movie/drama (general)" },
1497     { 0x11, "detective/thriller" },
1498     { 0x12, "adventure/western/war" },
1499     { 0x13, "science fiction/fantasy/horror" },
1500     { 0x14, "comedy" },
1501     { 0x15, "soap/melodrama/folkloric" },
1502     { 0x16, "romance" },
1503     { 0x17, "serious/classical/religious/historical movie/drama" },
1504     { 0x18, "adult movie/drama" },
1505     { 0x1F, "user defined (movie/drama)" },
1506
1507     { 0x20, "news/current affairs (general)" },
1508     { 0x21, "news/weather report" },
1509     { 0x22, "news magazine" },
1510     { 0x23, "documentary" },
1511     { 0x24, "discussion/interview/debate" },
1512     { 0x2F, "user defined (news/current affairs)" },
1513
1514     { 0x30, "show/game show (general)" },
1515     { 0x31, "game show/quiz/contest" },
1516     { 0x32, "variety show" },
1517     { 0x33, "talk show" },
1518     { 0x3F, "user defined (show/game show)" },
1519
1520     { 0x40, "sports (general)" },
1521     { 0x41, "special events (Olympic Games, World Cup, etc.)" },
1522     { 0x42, "sports magazines" },
1523     { 0x43, "football/soccer" },
1524     { 0x44, "tennis/squash" },
1525     { 0x45, "team sports (excluding football)" },
1526     { 0x46, "athletics" },
1527     { 0x47, "motor sport" },
1528     { 0x48, "water sport" },
1529     { 0x49, "winter sports" },
1530     { 0x4A, "equestrian" },
1531     { 0x4B, "martial sports" },
1532     { 0x4F, "user defined (sports)" },
1533
1534     { 0x50, "children's/youth programmes (general)" },
1535     { 0x51, "pre-school children's programmes" },
1536     { 0x52, "entertainment programmes for 6 to14" },
1537     { 0x53, "entertainment programmes for 10 to 16" },
1538     { 0x54, "informational/educational/school programmes" },
1539     { 0x55, "cartoons/puppets" },
1540     { 0x5F, "user defined (children's/youth programmes)" },
1541
1542     { 0x60, "music/ballet/dance (general)" },
1543     { 0x61, "rock/pop" },
1544     { 0x62, "serious music/classical music" },
1545     { 0x63, "folk/traditional music" },
1546     { 0x64, "jazz" },
1547     { 0x65, "musical/opera" },
1548     { 0x66, "ballet" },
1549     { 0x6F, "user defined (music/ballet/dance)" },
1550
1551     { 0x70, "arts/culture (without music, general)" },
1552     { 0x71, "performing arts" },
1553     { 0x72, "fine arts" },
1554     { 0x73, "religion" },
1555     { 0x74, "popular culture/traditional arts" },
1556     { 0x75, "literature" },
1557     { 0x76, "film/cinema" },
1558     { 0x77, "experimental film/video" },
1559     { 0x78, "broadcasting/press" },
1560     { 0x79, "new media" },
1561     { 0x7A, "arts/culture magazines" },
1562     { 0x7B, "fashion" },
1563     { 0x7F, "user defined (arts/culture)" },
1564
1565     { 0x80, "social/political issues/economics (general)" },
1566     { 0x81, "magazines/reports/documentary" },
1567     { 0x82, "economics/social advisory" },
1568     { 0x83, "remarkable people" },
1569     { 0x8F, "user defined (social/political issues/economics)" },
1570
1571     { 0x90, "education/science/factual topics (general)" },
1572     { 0x91, "nature/animals/environment" },
1573     { 0x92, "technology/natural sciences" },
1574     { 0x93, "medicine/physiology/psychology" },
1575     { 0x94, "foreign countries/expeditions" },
1576     { 0x95, "social/spiritual sciences" },
1577     { 0x96, "further education" },
1578     { 0x97, "languages" },
1579     { 0x9F, "user defined (education/science/factual topics)" },
1580
1581     { 0xA0, "leisure hobbies (general)" },
1582     { 0xA1, "tourism/travel" },
1583     { 0xA2, "handicraft" },
1584     { 0xA3, "motoring" },
1585     { 0xA4, "fitness and health" },
1586     { 0xA5, "cooking" },
1587     { 0xA6, "advertisement/shopping" },
1588     { 0xA7, "gardening" },
1589     { 0xAF, "user defined (leisure hobbies)" },
1590
1591     { 0xB0, "original language" },
1592     { 0xB1, "black and white" },
1593     { 0xB2, "unpublished" },
1594     { 0xB3, "live broadcast" },
1595     { 0xBF, "user defined (special characteristics)" },
1596
1597     { 0x00, NULL }
1598 };
1599 static value_string_ext mpeg_descr_content_nibble_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descr_content_nibble_vals);
1600
1601 static const value_string mpeg_descr_content_nibble_level_1_vals[] = {
1602
1603     { 0x1, "Movie/Drama" },
1604     { 0x2, "News/Current affairs" },
1605     { 0x3, "Show/Game show" },
1606     { 0x4, "Sports" },
1607     { 0x5, "Children's/Youth programmes" },
1608     { 0x6, "Music/Ballet/Dance" },
1609     { 0x7, "Arts/Culture (without music)" },
1610     { 0x8, "Social/Political issues/Economics" },
1611     { 0x9, "Education/Science/Factual topics" },
1612     { 0xA, "Leisure hobbies" },
1613     { 0xB, "Special characteristics" },
1614
1615     { 0x00, NULL }
1616 };
1617 static value_string_ext mpeg_descr_content_nibble_level_1_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descr_content_nibble_level_1_vals);
1618
1619 static void
1620 proto_mpeg_descriptor_dissect_content(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
1621 {
1622     proto_item *ni;
1623     proto_tree *nibble_tree;
1624
1625     guint end = offset + len;
1626
1627     while (offset < end) {
1628         ni = proto_tree_add_item(tree, hf_mpeg_descr_content_nibble, tvb, offset, 1, ENC_BIG_ENDIAN);
1629         nibble_tree = proto_item_add_subtree(ni, ett_mpeg_descriptor_content_nibble);
1630
1631         proto_tree_add_item(nibble_tree, hf_mpeg_descr_content_nibble_level_1, tvb, offset, 1, ENC_BIG_ENDIAN);
1632         proto_tree_add_item(nibble_tree, hf_mpeg_descr_content_nibble_level_2, tvb, offset, 1, ENC_BIG_ENDIAN);
1633         offset += 1;
1634
1635         proto_tree_add_item(tree, hf_mpeg_descr_content_user_byte, tvb, offset, 1, ENC_BIG_ENDIAN);
1636         offset += 1;
1637     }
1638
1639 }
1640
1641 /* 0x55 Parental Rating Descriptor */
1642 static int hf_mpeg_descr_parental_rating_country_code = -1;
1643 static int hf_mpeg_descr_parental_rating_rating = -1;
1644
1645 static const value_string mpeg_descr_parental_rating_vals[] = {
1646     { 0x00, "Undefined" },
1647     { 0x01, "Minimum 4 year old" },
1648     { 0x02, "Minimum 5 year old" },
1649     { 0x03, "Minimum 6 year old" },
1650     { 0x04, "Minimum 7 year old" },
1651     { 0x05, "Minimum 8 year old" },
1652     { 0x06, "Minimum 9 year old" },
1653     { 0x07, "Minimum 10 year old" },
1654     { 0x08, "Minimum 11 year old" },
1655     { 0x09, "Minimum 12 year old" },
1656     { 0x0A, "Minimum 13 year old" },
1657     { 0x0B, "Minimum 14 year old" },
1658     { 0x0C, "Minimum 15 year old" },
1659     { 0x0D, "Minimum 16 year old" },
1660     { 0x0E, "Minimum 17 year old" },
1661     { 0x0F, "Minimum 18 year old" },
1662
1663     { 0x00, NULL }
1664 };
1665 static value_string_ext mpeg_descr_parental_rating_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descr_parental_rating_vals);
1666
1667
1668 static void
1669 proto_mpeg_descriptor_dissect_parental_rating(tvbuff_t *tvb, guint offset, proto_tree *tree)
1670 {
1671     proto_tree_add_item(tree, hf_mpeg_descr_parental_rating_country_code, tvb, offset, 3, ENC_ASCII|ENC_NA);
1672     offset += 3;
1673
1674     proto_tree_add_item(tree, hf_mpeg_descr_parental_rating_rating, tvb, offset, 1, ENC_BIG_ENDIAN);
1675 }
1676
1677 /* 0x56 Teletext Descriptor */
1678 static int hf_mpeg_descr_teletext_lang_code = -1;
1679 static int hf_mpeg_descr_teletext_type = -1;
1680 static int hf_mpeg_descr_teletext_magazine_number = -1;
1681 static int hf_mpeg_descr_teletext_page_number = -1;
1682
1683 #define MPEG_DESCR_TELETEXT_TYPE_MASK           0xF8
1684 #define MPEG_DESCR_TELETEXT_MAGAZINE_NUMBER_MASK    0x07
1685
1686 static const value_string mpeg_descr_teletext_type_vals[] = {
1687     { 0x00, "Reserved" },
1688     { 0x01, "Initial Teletext Page" },
1689     { 0x02, "Teletext Subtitle Page" },
1690     { 0x03, "Additional Information Page" },
1691     { 0x04, "Programme Schedule Page" },
1692     { 0x05, "Teletext Subtitle Page for hearing impaired people" },
1693
1694     { 0, NULL }
1695
1696 };
1697
1698 static void
1699 proto_mpeg_descriptor_dissect_teletext(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
1700 {
1701     guint end = offset + len;
1702
1703     while (offset < end) {
1704         proto_tree_add_item(tree, hf_mpeg_descr_teletext_lang_code, tvb, offset, 3, ENC_ASCII|ENC_NA);
1705         offset += 3;
1706
1707         proto_tree_add_item(tree, hf_mpeg_descr_teletext_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1708         proto_tree_add_item(tree, hf_mpeg_descr_teletext_magazine_number, tvb, offset, 1, ENC_BIG_ENDIAN);
1709         offset += 1;
1710
1711         proto_tree_add_item(tree, hf_mpeg_descr_teletext_page_number, tvb, offset, 1, ENC_BIG_ENDIAN);
1712         offset += 1;
1713     }
1714 }
1715
1716 /* 0x58 Local Time Offset Descriptor */
1717 static int hf_mpeg_descr_local_time_offset_country_code = -1;
1718 static int hf_mpeg_descr_local_time_offset_region_id = -1;
1719 static int hf_mpeg_descr_local_time_offset_reserved = -1;
1720 static int hf_mpeg_descr_local_time_offset_polarity = -1;
1721 static int hf_mpeg_descr_local_time_offset_offset = -1;
1722 static int hf_mpeg_descr_local_time_offset_time_of_change = -1;
1723 static int hf_mpeg_descr_local_time_offset_next_time_offset = -1;
1724
1725 #define MPEG_DESCR_LOCAL_TIME_OFFSET_COUNTRY_REGION_ID_MASK 0xFC
1726 #define MPEG_DESCR_LOCAL_TIME_OFFSET_RESERVED_MASK      0x02
1727 #define MPEG_DESCR_LOCAL_TIME_OFFSET_POLARITY           0x01
1728
1729 static const value_string mpeg_descr_local_time_offset_polarity_vals[] = {
1730     { 0x0, "Positive (local time ahead of UTC)" },
1731     { 0x1, "Negative (local time behind UTC)" },
1732
1733     { 0x0, NULL }
1734 };
1735
1736 static void
1737 proto_mpeg_descriptor_dissect_local_time_offset(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
1738 {
1739     guint    end = offset + len;
1740     guint8   hour, min;
1741     nstime_t local_time_offset, time_of_change, next_time_offset;
1742
1743     while (offset < end) {
1744         proto_tree_add_item(tree, hf_mpeg_descr_local_time_offset_country_code, tvb, offset, 3, ENC_ASCII|ENC_NA);
1745         offset += 3;
1746
1747         proto_tree_add_item(tree, hf_mpeg_descr_local_time_offset_region_id, tvb, offset, 1, ENC_BIG_ENDIAN);
1748         proto_tree_add_item(tree, hf_mpeg_descr_local_time_offset_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1749         proto_tree_add_item(tree, hf_mpeg_descr_local_time_offset_polarity, tvb, offset, 1, ENC_BIG_ENDIAN);
1750         offset += 1;
1751
1752         hour = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset));
1753         min = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+1));
1754         nstime_set_zero(&local_time_offset);
1755         local_time_offset.secs = hour*60*60 + min*60;
1756         proto_tree_add_time_format_value(tree, hf_mpeg_descr_local_time_offset_offset,
1757                 tvb, offset, 2, &local_time_offset, "%02d:%02d", hour, min);
1758         offset += 2;
1759
1760
1761         if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &time_of_change) < 0) {
1762             proto_tree_add_time_format_value(tree, hf_mpeg_descr_local_time_offset_time_of_change, tvb, offset, 5, &time_of_change, "Unparseable time");
1763         } else {
1764             proto_tree_add_time(tree, hf_mpeg_descr_local_time_offset_time_of_change, tvb, offset, 5, &time_of_change);
1765         }
1766         offset += 5;
1767
1768         hour = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset));
1769         min = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, offset+1));
1770         nstime_set_zero(&next_time_offset);
1771         next_time_offset.secs = hour*60*60 + min*60;
1772         proto_tree_add_time_format_value(tree, hf_mpeg_descr_local_time_offset_next_time_offset,
1773                 tvb, offset, 2, &next_time_offset, "%02d:%02d", hour, min);
1774         offset += 2;
1775     }
1776 }
1777
1778 /* 0x59 Subtitling Descriptor */
1779 static int hf_mpeg_descr_subtitling_lang_code = -1;
1780 static int hf_mpeg_descr_subtitling_type = -1;
1781 static int hf_mpeg_descr_subtitling_composition_page_id = -1;
1782 static int hf_mpeg_descr_subtitling_ancillary_page_id = -1;
1783
1784
1785 static const value_string mpeg_descr_subtitling_type_vals[] = {
1786     { 0x01, "EBU Teletext subtitles" },
1787     { 0x02, "associated EBU Teletext" },
1788     { 0x03, "VBI data" },
1789     { 0x10, "DVB subtitles (normal) with no monitor aspect ratio criticality" },
1790     { 0x11, "DVB subtitles (normal) for display on 4:3 aspect ratio monitor" },
1791     { 0x12, "DVB subtitles (normal) for display on 16:9 aspect ratio monitor" },
1792     { 0x13, "DVB subtitles (normal) for display on 2.21:1 aspect ratio monitor" },
1793     { 0x14, "DVB subtitles (normal) for display on a high definition monitor" },
1794     { 0x20, "DVB subtitles (for the hard of hearing) with no monitor aspect ratio criticality" },
1795     { 0x21, "DVB subtitles (for the hard of hearing) for display on 4:3 aspect ratio monitor" },
1796     { 0x22, "DVB subtitles (for the hard of hearing) for display on 16:9 aspect ratio monitor" },
1797     { 0x23, "DVB subtitles (for the hard of hearing) for display on 2.21:1 aspect ratio monitor" },
1798     { 0x24, "DVB subtitles (for the hard of hearing) for display on a high definition monitor" },
1799     { 0x30, "Open (in-vision) sign language interpretation for the deaf" },
1800     { 0x31, "Closed sign language interpretation for the deaf" },
1801     { 0x40, "video up-sampled from standard definition source material" },
1802
1803     { 0, NULL }
1804 };
1805 static value_string_ext mpeg_descr_subtitling_type_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descr_subtitling_type_vals);
1806
1807 static void
1808 proto_mpeg_descriptor_dissect_subtitling(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
1809 {
1810     guint end = offset + len;
1811
1812     while (offset < end) {
1813         proto_tree_add_item(tree, hf_mpeg_descr_subtitling_lang_code, tvb, offset, 3, ENC_ASCII|ENC_NA);
1814         offset += 3;
1815
1816         proto_tree_add_item(tree, hf_mpeg_descr_subtitling_type, tvb, offset, 1, ENC_BIG_ENDIAN);
1817         offset += 1;
1818
1819         proto_tree_add_item(tree, hf_mpeg_descr_subtitling_composition_page_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1820         offset += 2;
1821
1822         proto_tree_add_item(tree, hf_mpeg_descr_subtitling_ancillary_page_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1823         offset += 2;
1824
1825     }
1826 }
1827
1828 /* 0x5A Terrestrial Delivery System Descriptor */
1829 static int hf_mpeg_descr_terrestrial_delivery_centre_frequency = -1;
1830 static int hf_mpeg_descr_terrestrial_delivery_bandwidth = -1;
1831 static int hf_mpeg_descr_terrestrial_delivery_priority = -1;
1832 static int hf_mpeg_descr_terrestrial_delivery_time_slicing_indicator = -1;
1833 static int hf_mpeg_descr_terrestrial_delivery_mpe_fec_indicator = -1;
1834 static int hf_mpeg_descr_terrestrial_delivery_reserved1 = -1;
1835 static int hf_mpeg_descr_terrestrial_delivery_constellation = -1;
1836 static int hf_mpeg_descr_terrestrial_delivery_hierarchy_information = -1;
1837 static int hf_mpeg_descr_terrestrial_delivery_code_rate_hp_stream = -1;
1838 static int hf_mpeg_descr_terrestrial_delivery_code_rate_lp_stream = -1;
1839 static int hf_mpeg_descr_terrestrial_delivery_guard_interval = -1;
1840 static int hf_mpeg_descr_terrestrial_delivery_transmission_mode = -1;
1841 static int hf_mpeg_descr_terrestrial_delivery_other_frequency_flag = -1;
1842 static int hf_mpeg_descr_terrestrial_delivery_reserved2 = -1;
1843
1844 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_BANDWIDTH_MASK          0xE0
1845 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_PRIORITY_MASK           0x10
1846 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_TIME_SLICING_INDICATOR_MASK 0x08
1847 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_MPE_FEC_INDICATOR_MASK      0x04
1848 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_RESERVED1_MASK          0x03
1849 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_CONSTELLATION_MASK      0xC0
1850 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_HIERARCHY_INFORMATION_MASK  0x38
1851 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_CODE_RATE_HP_STREAM_MASK    0x07
1852 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_CODE_RATE_LP_STREAM_MASK    0xE0
1853 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_GUARD_INTERVAL_MASK     0x18
1854 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_TRANSMISSION_MODE_MASK      0x06
1855 #define MPEG_DESCR_TERRESTRIAL_DELIVERY_OTHER_FREQUENCY_FLAG_MASK   0x01
1856
1857 static const value_string mpeg_descr_terrestrial_delivery_bandwidth_vals[] = {
1858     { 0x0, "8 MHz" },
1859     { 0x1, "7 MHz" },
1860     { 0x2, "6 MHz" },
1861     { 0x3, "5 Mhz" },
1862
1863     { 0x0, NULL }
1864 };
1865
1866 static const value_string mpeg_descr_terrestrial_delivery_priority_vals[] = {
1867     { 0x0, "Low Priority" },
1868     { 0x1, "High Priority (or N/A if not hierarchical stream)" },
1869
1870     { 0x0, NULL }
1871 };
1872
1873 static const value_string mpeg_descr_terrestrial_delivery_time_slicing_indicator_vals[] = {
1874     { 0x0, "At least one elementary stream uses Time Slicing" },
1875     { 0x1, "Time Slicing not used" },
1876
1877     { 0x0, NULL }
1878 };
1879
1880 static const value_string mpeg_descr_terrestrial_delivery_mpe_fec_indicator_vals[] = {
1881     { 0x0, "At least one elementary stream uses MPE-FEC" },
1882     { 0x1, "MPE-FEC not used" },
1883
1884     { 0x0, NULL }
1885 };
1886
1887 static const value_string mpeg_descr_terrestrial_delivery_constellation_vals[] = {
1888     { 0x0, "QPSK" },
1889     { 0x1, "16-QAM" },
1890     { 0x2, "64-QAM" },
1891
1892     { 0x0, NULL }
1893 };
1894
1895 static const value_string mpeg_descr_terrestrial_delivery_hierarchy_information_vals[] = {
1896     { 0x0, "Non-hierarchical, native interleaver" },
1897     { 0x1, "alpha = 1, native interleaver" },
1898     { 0x2, "alpha = 2, native interleaver" },
1899     { 0x3, "alpha = 4, native interleaver" },
1900     { 0x4, "Non-hierarchical, in-depth interleaver" },
1901     { 0x5, "alpha = 1, in-depth interleaver" },
1902     { 0x6, "alpha = 2, in-depth interleaver" },
1903     { 0x7, "alpha = 4, in-depth interleaver" },
1904
1905     { 0x0, NULL }
1906 };
1907
1908 static const value_string mpeg_descr_terrestrial_delivery_code_rate_vals[] = {
1909     { 0x0, "1/2 convolutional code rate" },
1910     { 0x1, "2/3 convolutional code rate" },
1911     { 0x2, "3/4 convolutional code rate" },
1912     { 0x3, "5/6 convolutional code rate" },
1913     { 0x4, "7/8 convolutional code rate" },
1914
1915     { 0x0, NULL }
1916 };
1917
1918 static const value_string mpeg_descr_terrestrial_delivery_guard_interval_vals[] = {
1919     { 0x0, "1/32" },
1920     { 0x1, "1/16" },
1921     { 0x2, "1/8" },
1922     { 0x3, "1/4" },
1923
1924     { 0x0, NULL }
1925 };
1926
1927 static const value_string mpeg_descr_terrestrial_delivery_other_frequency_flag_vals[] = {
1928     { 0x0, "No other frequency is in use" },
1929     { 0x1, "One or more frequencies are in use" },
1930
1931     { 0x0, NULL }
1932 };
1933
1934 static const value_string mpeg_descr_terrestrial_delivery_transmission_mode_vals[] = {
1935     { 0x0, "2k mode" },
1936     { 0x1, "8k mode" },
1937     { 0x2, "4k mode" },
1938
1939     { 0x0, NULL }
1940 };
1941
1942 static void
1943 proto_mpeg_descriptor_dissect_terrestrial_delivery(tvbuff_t *tvb, guint offset, proto_tree *tree)
1944 {
1945     guint64 centre_freq;
1946
1947     /* the descriptor stores the centre frequency in units of 10Hz (so
1948        that they can get away with 32bits), we're using Hz here */
1949     centre_freq = tvb_get_ntohl(tvb, offset) * 10;
1950
1951     proto_tree_add_uint64_format_value(tree, hf_mpeg_descr_terrestrial_delivery_centre_frequency, tvb, offset, 4,
1952         centre_freq, "%d.%06d MHz", (guint)centre_freq/(1000*1000), (guint)centre_freq%(1000*1000));
1953     offset += 4;
1954
1955     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_bandwidth, tvb, offset, 1, ENC_BIG_ENDIAN);
1956     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_priority, tvb, offset, 1, ENC_BIG_ENDIAN);
1957     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_time_slicing_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
1958     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_mpe_fec_indicator, tvb, offset, 1, ENC_BIG_ENDIAN);
1959     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
1960     offset += 1;
1961
1962     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_constellation, tvb, offset, 1, ENC_BIG_ENDIAN);
1963     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_hierarchy_information, tvb, offset, 1, ENC_BIG_ENDIAN);
1964     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_code_rate_hp_stream, tvb, offset, 1, ENC_BIG_ENDIAN);
1965     offset += 1;
1966
1967     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_code_rate_lp_stream, tvb, offset, 1, ENC_BIG_ENDIAN);
1968     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_guard_interval, tvb, offset, 1, ENC_BIG_ENDIAN);
1969     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_transmission_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
1970     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_other_frequency_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
1971     offset += 1;
1972
1973     proto_tree_add_item(tree, hf_mpeg_descr_terrestrial_delivery_reserved2, tvb, offset, 4, ENC_BIG_ENDIAN);
1974
1975 }
1976
1977
1978 /* 0x5F Private Data Specifier */
1979 static int hf_mpeg_descr_private_data_specifier_id = -1;
1980
1981 #define PRIVATE_DATA_SPECIFIER_RESERVED    0x00000000
1982 #define PRIVATE_DATA_SPECIFIER_NORDIG      0x00000029
1983 #define PRIVATE_DATA_SPECIFIER_CIPLUS_LLP  0x00000040
1984 #define PRIVATE_DATA_SPECIFIER_EUTELSAT_SA 0x0000055F
1985
1986 static const value_string mpeg_descr_data_specifier_id_vals[] = {
1987     { PRIVATE_DATA_SPECIFIER_RESERVED,   "reserved" },
1988     { PRIVATE_DATA_SPECIFIER_NORDIG,     "NorDig" },
1989     { PRIVATE_DATA_SPECIFIER_CIPLUS_LLP, "CI+ LLP" },
1990     { PRIVATE_DATA_SPECIFIER_EUTELSAT_SA, "Eutelsat S.A." },
1991     /* See dvbservices.com for complete and current list */
1992
1993     { 0, NULL }
1994 };
1995
1996 static void
1997 proto_mpeg_descriptor_dissect_private_data_specifier(tvbuff_t *tvb, guint offset, proto_tree *tree)
1998 {
1999     proto_tree_add_item(tree, hf_mpeg_descr_private_data_specifier_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2000 }
2001
2002 /* 0x64 Data Broadcast Descriptor */
2003 static int hf_mpeg_descr_data_bcast_bcast_id = -1;
2004 static int hf_mpeg_descr_data_bcast_component_tag = -1;
2005 static int hf_mpeg_descr_data_bcast_selector_len = -1;
2006 static int hf_mpeg_descr_data_bcast_selector_bytes = -1;
2007 static int hf_mpeg_descr_data_bcast_lang_code = -1;
2008 static int hf_mpeg_descr_data_bcast_text_len = -1;
2009 static int hf_mpeg_descr_data_bcast_text = -1;
2010
2011 static const value_string mpeg_descr_data_bcast_id_vals[] = {
2012
2013     { 0x0001, "Data pipe" },
2014     { 0x0002, "Asynchronous data stream" },
2015     { 0x0003, "Synchronous data stream" },
2016     { 0x0004, "Synchronised data stream" },
2017     { 0x0005, "Multi protocol encapsulation" },
2018     { 0x0006, "Data Carousel" },
2019     { 0x0007, "Object Carousel" },
2020     { 0x0008, "DVB ATM streams" },
2021     { 0x0009, "Higher Protocols based on asynchronous data streams" },
2022     { 0x000A, "System Software Update service" },
2023     { 0x000B, "IP/MAC Notification service" },
2024     { 0x00F0, "MHP Object Carousel" },
2025     { 0x00F1, "MHP Multiprotocol Encapsulation" },
2026     { 0x0122, "CI+ Data Carousel" },
2027     { 0x0123, "HbbTV Carousel" },
2028     /* See dvbservices.com for complete and current list */
2029
2030     { 0, NULL }
2031 };
2032 /* global variable that's shared e.g. with DVB-CI */
2033 value_string_ext mpeg_descr_data_bcast_id_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descr_data_bcast_id_vals);
2034
2035 static void
2036 proto_mpeg_descriptor_dissect_data_bcast(tvbuff_t *tvb, guint offset, proto_tree *tree)
2037 {
2038
2039     guint8 selector_len, text_len;
2040
2041     proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_bcast_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2042     offset += 2;
2043
2044     proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_component_tag, tvb, offset, 1, ENC_BIG_ENDIAN);
2045     offset += 1;
2046
2047     selector_len = tvb_get_guint8(tvb, offset);
2048     proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_selector_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2049     offset += 1;
2050
2051     if (selector_len > 0) {
2052         proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_selector_bytes, tvb, offset, selector_len, ENC_NA);
2053         offset += selector_len;
2054     }
2055
2056     proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_lang_code, tvb, offset, 3, ENC_ASCII|ENC_NA);
2057     offset += 3;
2058
2059     text_len = tvb_get_guint8(tvb, offset);
2060     proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_text_len, tvb, offset, 1, ENC_BIG_ENDIAN);
2061     offset += 1;
2062
2063     if (text_len > 0)
2064         proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_text, tvb, offset, text_len, ENC_ASCII|ENC_NA);
2065 }
2066
2067 /* 0x66 Data Broadcast ID Descriptor */
2068 static int hf_mpeg_descr_data_bcast_id_bcast_id = -1;
2069 static int hf_mpeg_descr_data_bcast_id_id_selector_bytes = -1;
2070
2071 static void
2072 proto_mpeg_descriptor_dissect_data_bcast_id(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
2073 {
2074     proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_id_bcast_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2075     offset += 2;
2076
2077     if (len > 2)
2078         proto_tree_add_item(tree, hf_mpeg_descr_data_bcast_id_id_selector_bytes, tvb, offset, len - 2, ENC_NA);
2079 }
2080
2081 /* 0x6A AC-3 Descriptor */
2082 static int hf_mpeg_descr_ac3_component_type_flag = -1;
2083 static int hf_mpeg_descr_ac3_bsid_flag = -1;
2084 static int hf_mpeg_descr_ac3_mainid_flag = -1;
2085 static int hf_mpeg_descr_ac3_asvc_flag = -1;
2086 static int hf_mpeg_descr_ac3_reserved = -1;
2087 static int hf_mpeg_descr_ac3_component_type_reserved_flag = -1;
2088 static int hf_mpeg_descr_ac3_component_type_full_service_flag = -1;
2089 static int hf_mpeg_descr_ac3_component_type_service_type_flags = -1;
2090 static int hf_mpeg_descr_ac3_component_type_number_of_channels_flags = -1;
2091 static int hf_mpeg_descr_ac3_bsid = -1;
2092 static int hf_mpeg_descr_ac3_mainid = -1;
2093 static int hf_mpeg_descr_ac3_asvc = -1;
2094 static int hf_mpeg_descr_ac3_additional_info = -1;
2095
2096 static gint ett_mpeg_descriptor_ac3_component_type = -1;
2097
2098 #define MPEG_DESCR_AC3_COMPONENT_TYPE_FLAG_MASK 0x80
2099 #define MPEG_DESCR_AC3_BSID_FLAG_MASK           0x40
2100 #define MPEG_DESCR_AC3_MAINID_FLAG_MASK         0x20
2101 #define MPEG_DESCR_AC3_ASVC_FLAG_MASK           0x10
2102 #define MPEG_DESCR_AC3_RESERVED_MASK            0x0F
2103
2104 #define MPEG_DESCR_AC3_COMPONENT_TYPE_RESERVED_FLAG_MASK        0x80
2105 #define MPEG_DESCR_AC3_COMPONENT_TYPE_FULL_SERVICE_FLAG_MASK    0x40
2106 #define MPEG_DESCR_AC3_COMPONENT_TYPE_SERVICE_TYPE_FLAGS_MASK   0x38
2107 #define MPEG_DESCR_AC3_COMPONENT_TYPE_NUMBER_OF_CHANNELS_FLAGS  0x07
2108
2109 static const value_string mpeg_descr_ac3_component_type_flag_vals[] = {
2110     { 0x0, "Component type field not included" },
2111     { 0x1, "Component type field included" },
2112
2113     { 0x0, NULL }
2114 };
2115
2116 static const value_string mpeg_descr_ac3_bsid_flag_vals[] = {
2117     { 0x0, "BSID field not included" },
2118     { 0x1, "BSID field included" },
2119
2120     { 0x0, NULL }
2121 };
2122
2123 static const value_string mpeg_descr_ac3_mainid_flag_vals[] = {
2124     { 0x0, "Main ID field not included" },
2125     { 0x1, "Main ID field included" },
2126
2127     { 0x0, NULL }
2128 };
2129
2130 static const value_string mpeg_descr_ac3_asvc_flag_vals[] = {
2131     { 0x0, "ASVC field not included" },
2132     { 0x1, "ASVC field included" },
2133
2134     { 0x0, NULL }
2135 };
2136
2137 static const value_string mpeg_descr_ac3_component_type_full_service_flag_vals[] = {
2138     { 0x0, "Decoded audio stream is intended to be combined with another decoded audio stream" },
2139     { 0x1, "Decoded audio stream is a full service" },
2140
2141     { 0x0, NULL}
2142 };
2143
2144 static const value_string mpeg_descr_ac3_component_type_service_type_flags_vals[] = {
2145     { 0x0, "Complete Main (CM)" },
2146     { 0x1, "Music and effects (ME)" },
2147     { 0x2, "Visually impaired (VI)" },
2148     { 0x3, "Hearing impaired (HI)" },
2149     { 0x4, "Dialogue (D)" },
2150     { 0x5, "Commentary (C)" },
2151     { 0x6, "Emergency (E)" },
2152     { 0x7, "Voiceover (VO) if Full Service Flag is 0, else Karaoke" },
2153
2154     { 0x0, NULL }
2155 };
2156
2157 static const value_string mpeg_descr_ac3_component_type_number_of_channels_flags_vals[] = {
2158     { 0x0, "Mono" },
2159     { 0x1, "1+1 Mode" },
2160     { 0x2, "2 Channel (stereo)" },
2161     { 0x3, "2 Channel Dolby surround encoded (stereo)" },
2162     { 0x4, "Multichannel audio (> 2 channels)" },
2163
2164     { 0x0, NULL }
2165 };
2166
2167 static void
2168 proto_mpeg_descriptor_dissect_ac3(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
2169 {
2170     guint  end = offset + len;
2171     guint8 flags, component_type;
2172
2173     proto_tree *component_type_tree;
2174
2175     flags = tvb_get_guint8(tvb, offset);
2176     proto_tree_add_item(tree, hf_mpeg_descr_ac3_component_type_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2177     proto_tree_add_item(tree, hf_mpeg_descr_ac3_bsid_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2178     proto_tree_add_item(tree, hf_mpeg_descr_ac3_mainid_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2179     proto_tree_add_item(tree, hf_mpeg_descr_ac3_asvc_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2180     proto_tree_add_item(tree, hf_mpeg_descr_ac3_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2181     offset += 1;
2182
2183     if (flags & MPEG_DESCR_AC3_COMPONENT_TYPE_FLAG_MASK) {
2184         component_type = tvb_get_guint8(tvb, offset);
2185         component_type_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3,
2186                     ett_mpeg_descriptor_ac3_component_type, NULL, "Component Type 0x%02x", component_type);
2187         proto_tree_add_item(component_type_tree, hf_mpeg_descr_ac3_component_type_reserved_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2188         proto_tree_add_item(component_type_tree, hf_mpeg_descr_ac3_component_type_full_service_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2189         proto_tree_add_item(component_type_tree, hf_mpeg_descr_ac3_component_type_service_type_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
2190         proto_tree_add_item(component_type_tree, hf_mpeg_descr_ac3_component_type_number_of_channels_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
2191         offset += 1;
2192     }
2193
2194     if (flags & MPEG_DESCR_AC3_BSID_FLAG_MASK) {
2195         proto_tree_add_item(tree, hf_mpeg_descr_ac3_bsid, tvb, offset, 1, ENC_BIG_ENDIAN);
2196         offset += 1;
2197     }
2198
2199     if (flags & MPEG_DESCR_AC3_MAINID_FLAG_MASK) {
2200         proto_tree_add_item(tree, hf_mpeg_descr_ac3_mainid, tvb, offset, 1, ENC_BIG_ENDIAN);
2201         offset += 1;
2202     }
2203
2204     if (flags & MPEG_DESCR_AC3_ASVC_FLAG_MASK) {
2205         proto_tree_add_item(tree, hf_mpeg_descr_ac3_asvc, tvb, offset, 1, ENC_BIG_ENDIAN);
2206         offset += 1;
2207     }
2208
2209     if (offset < end)
2210         proto_tree_add_item(tree, hf_mpeg_descr_ac3_additional_info, tvb, offset, end - offset, ENC_NA);
2211 }
2212
2213 /* 0x6F Application Signalling Descriptor */
2214 static int hf_mpeg_descr_app_sig_app_type = -1;
2215 static int hf_mpeg_descr_app_sig_ait_ver = -1;
2216
2217 static void
2218 proto_mpeg_descriptor_dissect_app_sig(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
2219 {
2220     guint  offset_start;
2221
2222     offset_start = offset;
2223     while ((offset - offset_start) < len) {
2224         proto_tree_add_item(tree, hf_mpeg_descr_app_sig_app_type, tvb, offset, 2, ENC_BIG_ENDIAN);
2225         offset += 2;
2226         proto_tree_add_item(tree, hf_mpeg_descr_app_sig_ait_ver, tvb, offset, 2, ENC_BIG_ENDIAN);
2227         offset += 1;
2228     }
2229 }
2230
2231 /* 0x73 Default Authority Descriptor */
2232 static int hf_mpeg_descr_default_authority_name = -1;
2233
2234 static void
2235 proto_mpeg_descriptor_dissect_default_authority(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
2236 {
2237     proto_tree_add_item(tree, hf_mpeg_descr_default_authority_name, tvb, offset, len, ENC_ASCII|ENC_NA);
2238 }
2239
2240 /* 0x76 Content Identifier Descriptor */
2241 static int hf_mpeg_descr_content_identifier_crid_type = -1;
2242 static int hf_mpeg_descr_content_identifier_crid_location = -1;
2243 static int hf_mpeg_descr_content_identifier_crid_length = -1;
2244 static int hf_mpeg_descr_content_identifier_crid_bytes = -1;
2245 static int hf_mpeg_descr_content_identifier_cird_ref = -1;
2246
2247 #define MPEG_DESCR_CONTENT_IDENTIFIER_CRID_TYPE_MASK        0xFC
2248 #define MPEG_DESCR_CONTENT_IDENTIFIER_CRID_LOCATION_MASK    0x03
2249
2250 static gint ett_mpeg_descriptor_content_identifier_crid = -1;
2251
2252 static const value_string mpeg_descr_content_identifier_crid_type_vals[] = {
2253     { 0x00, "No type defined" },
2254     { 0x01, "CRID references the item of content that this event is an instance of" },
2255     { 0x02, "CRID references a series that this event belongs to" },
2256     { 0x03, "CRID references a recommendation" },
2257
2258     { 0, NULL }
2259 };
2260
2261 static const value_string mpeg_descr_content_identifier_crid_location_vals[] = {
2262     { 0x00, "Carried explicitly within descriptor" },
2263     { 0x01, "Carried in Content Identifier Table (CIT)" },
2264
2265     { 0, NULL }
2266 };
2267
2268 static void
2269 proto_mpeg_descriptor_dissect_content_identifier(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
2270 {
2271     guint  end = offset + len, crid_len;
2272     guint8 crid, crid_location, crid_type;
2273
2274     proto_tree *crid_tree;
2275
2276     while (offset < end) {
2277         crid = tvb_get_guint8(tvb, offset);
2278         crid_type = (crid & MPEG_DESCR_CONTENT_IDENTIFIER_CRID_TYPE_MASK) >> 2;
2279         crid_location = crid & MPEG_DESCR_CONTENT_IDENTIFIER_CRID_LOCATION_MASK;
2280
2281         if (crid_location == 0) {
2282             crid_len = 2 + tvb_get_guint8(tvb, offset + 1);
2283         } else if (crid_location == 1) {
2284             crid_len = 3;
2285         } else {
2286             crid_len = 1;
2287         }
2288
2289         crid_tree = proto_tree_add_subtree_format(tree, tvb, offset, crid_len,
2290                 ett_mpeg_descriptor_content_identifier_crid, NULL, "CRID type=0%02x", crid_type);
2291
2292         proto_tree_add_item(crid_tree, hf_mpeg_descr_content_identifier_crid_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2293         proto_tree_add_item(crid_tree, hf_mpeg_descr_content_identifier_crid_location, tvb, offset, 1, ENC_BIG_ENDIAN);
2294         offset += 1;
2295
2296         if (crid_location == 0x00) {
2297             crid_len = tvb_get_guint8(tvb, offset);
2298             proto_tree_add_item(crid_tree, hf_mpeg_descr_content_identifier_crid_length, tvb, offset, 1, ENC_BIG_ENDIAN);
2299             offset += 1;
2300
2301             proto_tree_add_item(crid_tree, hf_mpeg_descr_content_identifier_crid_bytes, tvb, offset, crid_len, ENC_NA);
2302             offset += crid_len;
2303         } else if (crid_location == 0x01) {
2304             proto_tree_add_item(crid_tree, hf_mpeg_descr_content_identifier_cird_ref, tvb, offset, 2, ENC_BIG_ENDIAN);
2305         }
2306
2307     }
2308
2309
2310 }
2311
2312 /* 0x7F Extension Descriptor */
2313 static int hf_mpeg_descr_extension_tag_extension = -1;
2314 static int hf_mpeg_descr_extension_data = -1;
2315 /* Supplementary Audio (Sub-)Descriptor */
2316 static int hf_mpeg_descr_extension_supp_audio_mix_type = -1;
2317 static int hf_mpeg_descr_extension_supp_audio_ed_cla = -1;
2318 static int hf_mpeg_descr_extension_supp_audio_lang_code_present = -1;
2319 static int hf_mpeg_descr_extension_supp_audio_lang_code = -1;
2320
2321 static int hf_mpeg_descr_private_data = -1;
2322
2323 #define EXT_TAG_IMG_ICON      0x00
2324 #define EXT_TAG_CPCM_DLV      0x01
2325 #define EXT_TAG_CP            0x02
2326 #define EXT_TAG_CP_ID         0x03
2327 #define EXT_TAG_T2            0x04
2328 #define EXT_TAG_SH            0x05
2329 #define EXT_TAG_SUPP_AUDIO    0x06
2330 #define EXT_TAG_NW_CHANGE     0x07
2331 #define EXT_TAG_MSG           0x08
2332 #define EXT_TAG_TRGT_REG      0x09
2333 #define EXT_TAG_TRGT_REG_NAME 0x0A
2334 #define EXT_TAG_SVC_RELOC     0x0B
2335
2336 static const value_string mpeg_descr_extension_tag_extension_vals[] = {
2337     { EXT_TAG_IMG_ICON,      "Image Icon Descriptor" },
2338     { EXT_TAG_CPCM_DLV,      "CPCM Delivery Signalling Descriptor" },
2339     { EXT_TAG_CP,            "CP Descriptor" },
2340     { EXT_TAG_CP_ID,         "CP Identifier Descriptor" },
2341     { EXT_TAG_T2,            "T2 Delivery System Descriptor" },
2342     { EXT_TAG_SH,            "SH Delivery System Descriptor" },
2343     { EXT_TAG_SUPP_AUDIO,    "Supplementary Audio Descriptor" },
2344     { EXT_TAG_NW_CHANGE,     "Network Change Notify Descriptor" },
2345     { EXT_TAG_MSG,           "Message Descriptor" },
2346     { EXT_TAG_TRGT_REG,      "Target Region Descriptor" },
2347     { EXT_TAG_TRGT_REG_NAME, "Target Region Name Descriptor" },
2348     { EXT_TAG_SVC_RELOC,     "Service Relocated Descriptor" },
2349     { 0x0, NULL }
2350 };
2351 static value_string_ext mpeg_descr_extension_tag_extension_vals_ext = VALUE_STRING_EXT_INIT(mpeg_descr_extension_tag_extension_vals);
2352
2353 static const value_string supp_audio_mix_type_vals[] = {
2354     { 0x00, "Audio stream is a supplementary stream" },
2355     { 0x01, "Audio stream is a complete and independent stream" },
2356     { 0x0, NULL }
2357 };
2358
2359 /* if we wanted to distinguish between reserved and user defined,
2360    we'd have to convert this into a range string */
2361 static const value_string supp_audio_ed_cla[] = {
2362     { 0x00, "Main audio" },
2363     { 0x01, "Audio description for the visually impaired" },
2364     { 0x02, "Clean audio for the hearing impaired" },
2365     { 0x03, "Spoken subtitles for the visually impaired" },
2366     { 0x0, NULL }
2367 };
2368
2369
2370 static void
2371 proto_mpeg_descriptor_dissect_extension(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
2372 {
2373     guint     offset_start;
2374     guint8    tag_ext;
2375     gboolean  lang_code_present;
2376     guint     already_dissected;
2377
2378     offset_start = offset;
2379
2380     tag_ext = tvb_get_guint8(tvb, offset);
2381     proto_tree_add_item(tree, hf_mpeg_descr_extension_tag_extension, tvb, offset, 1, ENC_BIG_ENDIAN);
2382     offset += 1;
2383
2384     switch (tag_ext) {
2385         case EXT_TAG_SUPP_AUDIO:
2386             proto_tree_add_item(tree, hf_mpeg_descr_extension_supp_audio_mix_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2387             proto_tree_add_item(tree, hf_mpeg_descr_extension_supp_audio_ed_cla, tvb, offset, 1, ENC_BIG_ENDIAN);
2388             lang_code_present = ((tvb_get_guint8(tvb, offset) & 0x01) == 0x01);
2389             proto_tree_add_item(tree, hf_mpeg_descr_extension_supp_audio_lang_code_present, tvb, offset, 1, ENC_BIG_ENDIAN);
2390             offset += 1;
2391             if (lang_code_present) {
2392                 proto_tree_add_item(tree, hf_mpeg_descr_extension_supp_audio_lang_code, tvb, offset, 3, ENC_ASCII|ENC_NA);
2393                 offset += 3;
2394             }
2395             already_dissected = offset-offset_start;
2396             if (already_dissected<len)
2397                 proto_tree_add_item(tree, hf_mpeg_descr_private_data, tvb, offset, len-already_dissected, ENC_NA);
2398             break;
2399         default:
2400             already_dissected = offset-offset_start;
2401             if (already_dissected<len)
2402                 proto_tree_add_item(tree, hf_mpeg_descr_extension_data, tvb, offset, len-already_dissected, ENC_NA);
2403             break;
2404     }
2405
2406 }
2407
2408 #define MPEG_DESCR_AC3_SYSA_SRATE_MASK 0xe0
2409 #define MPEG_DESCR_AC3_SYSA_BSID_MASK 0x1f
2410 #define MPEG_DESCR_AC3_SYSA_BITRATE_CODE_LIMIT_MASK 0x80
2411 #define MPEG_DESCR_AC3_SYSA_BITRATE_CODE_MASK 0x7c
2412 #define MPEG_DESCR_AC3_SYSA_SURROUND_MODE_MASK 0x03
2413 #define MPEG_DESCR_AC3_SYSA_BSMOD_MASK 0xe0
2414 #define MPEG_DESCR_AC3_SYSA_NUM_CHANNELS_MASK 0x1e
2415 #define MPEG_DESCR_AC3_SYSA_FULL_SVC_MASK 0x01
2416 #define MPEG_DESCR_AC3_SYSA_MAINID_MASK 0xe0
2417 #define MPEG_DESCR_AC3_SYSA_PRIORITY_MASK 0x18
2418 #define MPEG_DESCR_AC3_SYSA_RESERVED_MASK 0x07
2419 #define MPEG_DESCR_AC3_SYSA_TEXTLEN_MASK 0xfe
2420 #define MPEG_DESCR_AC3_SYSA_TEXTCODE_MASK 0x01
2421 #define MPEG_DESCR_AC3_SYSA_LANG1_MASK 0x80
2422 #define MPEG_DESCR_AC3_SYSA_LANG2_MASK 0x40
2423
2424 static int hf_mpeg_descr_ac3_sysa_srate = -1;
2425 static int hf_mpeg_descr_ac3_sysa_bsid = -1;
2426 static int hf_mpeg_descr_ac3_sysa_bitrate = -1;
2427 static int hf_mpeg_descr_ac3_sysa_bitrate_limit = -1;
2428 static int hf_mpeg_descr_ac3_sysa_surround = -1;
2429 static int hf_mpeg_descr_ac3_sysa_bsmod = -1;
2430 static int hf_mpeg_descr_ac3_sysa_num_channels = -1;
2431 static int hf_mpeg_descr_ac3_sysa_full_svc = -1;
2432 static int hf_mpeg_descr_ac3_sysa_langcode = -1;
2433 static int hf_mpeg_descr_ac3_sysa_langcode2 = -1;
2434 static int hf_mpeg_descr_ac3_sysa_mainid = -1;
2435 static int hf_mpeg_descr_ac3_sysa_priority = -1;
2436 static int hf_mpeg_descr_ac3_sysa_reserved = -1;
2437 static int hf_mpeg_descr_ac3_sysa_asvcflags = -1;
2438 static int hf_mpeg_descr_ac3_sysa_textlen = -1;
2439 static int hf_mpeg_descr_ac3_sysa_textcode = -1;
2440 static int hf_mpeg_descr_ac3_sysa_lang1 = -1;
2441 static int hf_mpeg_descr_ac3_sysa_lang2 = -1;
2442 static int hf_mpeg_descr_ac3_sysa_lang1_bytes = -1;
2443 static int hf_mpeg_descr_ac3_sysa_lang2_bytes = -1;
2444
2445 /* ATSC A/52 Annex A Table A4.2*/
2446 static const value_string mpeg_descr_ac3_sysa_srate_flag_vals[] = {
2447     { 0x0, "48 KHz" },
2448     { 0x1, "44.1 KHz" },
2449     { 0x2, "32 KHz" },
2450     { 0x3, "Reserved" },
2451     { 0x4, "48 or 44.1 KHz" },
2452     { 0x5, "48 or 32 KHz" },
2453     { 0x6, "44.1 or 32 KHz" },
2454     { 0x7, "48, 44.1 or 32 KHz" },
2455     { 0x0, NULL }
2456 };
2457
2458 /* ATSC A/52 Annex A Table A4.3 */
2459 static const value_string mpeg_descr_ac3_sysa_bitrate_code_limit_vals[] = {
2460     { 0, "Exact bitrate" },
2461     { 1, "Upper limit bitrate" },
2462     { 0x0, NULL }
2463 };
2464
2465 static const value_string mpeg_descr_ac3_sysa_bitrate_code_vals[] = {
2466     { 0, "32 KHz" },
2467     { 1, "40 KHz" },
2468     { 2, "48 KHz" },
2469     { 3, "56 KHz" },
2470     { 4, "64 KHz" },
2471     { 5, "80 KHz" },
2472     { 6, "96 KHz" },
2473     { 7, "112 KHz" },
2474     { 8, "128 KHz" },
2475     { 9, "160 KHz" },
2476     { 10, "192 KHz" },
2477     { 11, "224 KHz" },
2478     { 12, "256 KHz" },
2479     { 13, "320 KHz" },
2480     { 14, "384 KHz" },
2481     { 15, "448 KHz" },
2482     { 16, "512 KHz" },
2483     { 17, "576 KHz" },
2484     { 18, "640 KHz" },
2485     { 0x0, NULL }
2486 };
2487
2488 /* ATSC A/52 Annex A Table A4.4 */
2489 static const value_string mpeg_descr_ac3_sysa_surround_mode_vals[] = {
2490     { 0x0, "Not indicated" },
2491     { 0x1, "NOT Dolby Surround Sound" },
2492     { 0x2, "Dolby Surround Sound" },
2493     { 0x3, "Reserved" },
2494     { 0x0, NULL }
2495 };
2496
2497 /* ATSC A/52 Annex A Table A4.5*/
2498 static const value_string mpeg_descr_ac3_sysa_num_channels_vals[] = {
2499     { 0x0, "1 + 1 channels" },
2500     { 0x1, "1/0 channels" },
2501     { 0x2, "2/0 channels" },
2502     { 0x3, "3/0 channels" },
2503     { 0x4, "2/1 channels" },
2504     { 0x5, "3/1 channels" },
2505     { 0x6, "2/2 channels" },
2506     { 0x7, "3/2 channels" },
2507     { 0x8, "1 channel" },
2508     { 0x9, "<= 2 channels" },
2509     { 0xa, "<= 3 channels" },
2510     { 0xb, "<= 4 channels" },
2511     { 0xc, "<= 5 channels" },
2512     { 0xd, "<= 6 channels" },
2513     { 0xe, "Reserved" },
2514     { 0xf, "Reserved" },
2515     { 0x0, NULL }
2516 };
2517
2518 /* ATSC A/52 Annex A Table A4.6 */
2519 static const value_string mpeg_descr_ac3_sysa_priority_vals[] = {
2520     { 0x0, "Reserved" },
2521     { 0x1, "Primary Audio" },
2522     { 0x2, "Other Audio" },
2523     { 0x3, "Not specified" },
2524     { 0x0, NULL }
2525 };
2526
2527 /* According to ATSC A/52, Annex A, there are two separate ATSC descriptors.  "System A" is used
2528    by ATSC, and "System B" is used by DVB.  See A/52 Sec A.4.1 for the System A definition */
2529 static void
2530 proto_mpeg_descriptor_dissect_ac3_system_a(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
2531 {
2532     guint  end = offset + len;
2533     guint8 bsmod_chans_fullsvc, bsmod, num_channels, textlen, lang;
2534
2535     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_srate, tvb, offset, 1, ENC_BIG_ENDIAN);
2536     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_bsid, tvb, offset, 1, ENC_BIG_ENDIAN);
2537     offset += 1;
2538
2539     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_bitrate_limit, tvb, offset, 1, ENC_BIG_ENDIAN);
2540     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_bitrate, tvb, offset, 1, ENC_BIG_ENDIAN);
2541     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_surround, tvb, offset, 1, ENC_BIG_ENDIAN);
2542     offset += 1;
2543
2544     bsmod_chans_fullsvc = tvb_get_guint8(tvb, offset);
2545     bsmod = (bsmod_chans_fullsvc & 0xe0) >> 5;
2546     num_channels = (bsmod_chans_fullsvc & 0x1e) >> 1;
2547     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_bsmod, tvb, offset, 1, ENC_BIG_ENDIAN);
2548     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_num_channels, tvb, offset, 1, ENC_BIG_ENDIAN);
2549     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_full_svc, tvb, offset, 1, ENC_BIG_ENDIAN);
2550     offset += 1;
2551
2552     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_langcode, tvb, offset, 1, ENC_BIG_ENDIAN);
2553     offset += 1;
2554
2555     if (num_channels == 0) {
2556         /* 1+1 mode, so there is the possibility the second mono is in a different language */
2557         proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_langcode2, tvb, offset, 1, ENC_BIG_ENDIAN);
2558         offset += 1;
2559     }
2560
2561     if (bsmod < 2) {
2562         proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_mainid, tvb, offset, 1, ENC_BIG_ENDIAN);
2563         proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_priority, tvb, offset, 1, ENC_BIG_ENDIAN);
2564         proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2565     } else {
2566         proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_asvcflags, tvb, offset, 1, ENC_BIG_ENDIAN);
2567     }
2568     offset += 1;
2569
2570     textlen = tvb_get_guint8(tvb, offset) >> 1;
2571     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_textlen, tvb, offset, 1, ENC_BIG_ENDIAN);
2572     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_textcode, tvb, offset, 1, ENC_BIG_ENDIAN);
2573     offset += 1;
2574     offset += textlen;
2575
2576     lang = tvb_get_guint8(tvb, offset);
2577     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_lang1, tvb, offset, 1, ENC_BIG_ENDIAN);
2578     proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_lang2, tvb, offset, 1, ENC_BIG_ENDIAN);
2579     offset += 1;
2580
2581     if (lang & 0x80) {
2582         proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_lang1_bytes, tvb, offset, 3, ENC_ASCII|ENC_NA);
2583         offset += 3;
2584     }
2585
2586     if (lang & 0x40) {
2587         proto_tree_add_item(tree, hf_mpeg_descr_ac3_sysa_lang2_bytes, tvb, offset, 3, ENC_ASCII|ENC_NA);
2588         offset += 3;
2589     }
2590
2591     if (offset < end)
2592         proto_tree_add_item(tree, hf_mpeg_descr_ac3_additional_info, tvb, offset, end - offset, ENC_NA);
2593 }
2594
2595 /* 0xA2 Logon Initialize Descriptor */
2596 static int hf_mpeg_descr_logon_initialize_group_id = -1;
2597 static int hf_mpeg_descr_logon_initialize_logon_id = -1;
2598 static int hf_mpeg_descr_logon_initialize_continuous_carrier_reserved = -1;
2599 static int hf_mpeg_descr_logon_initialize_continuous_carrier = -1;
2600 static int hf_mpeg_descr_logon_initialize_security_handshake_required = -1;
2601 static int hf_mpeg_descr_logon_initialize_prefix_flag = -1;
2602 static int hf_mpeg_descr_logon_initialize_data_unit_labelling_flag = -1;
2603 static int hf_mpeg_descr_logon_initialize_mini_slot_flag = -1;
2604 static int hf_mpeg_descr_logon_initialize_contention_based_mini_slot_flag = -1;
2605 static int hf_mpeg_descr_logon_initialize_capacity_type_flag_reserved = -1;
2606 static int hf_mpeg_descr_logon_initialize_capacity_type_flag = -1;
2607 static int hf_mpeg_descr_logon_initialize_traffic_burst_type = -1;
2608 static int hf_mpeg_descr_logon_initialize_connectivity = -1;
2609 static int hf_mpeg_descr_logon_initialize_return_vpi_reserved = -1;
2610 static int hf_mpeg_descr_logon_initialize_return_vpi = -1;
2611 static int hf_mpeg_descr_logon_initialize_return_vci = -1;
2612 static int hf_mpeg_descr_logon_initialize_return_signalling_vpi_reserved = -1;
2613 static int hf_mpeg_descr_logon_initialize_return_signalling_vpi = -1;
2614 static int hf_mpeg_descr_logon_initialize_return_signalling_vci = -1;
2615 static int hf_mpeg_descr_logon_initialize_forward_signalling_vpi_reserved = -1;
2616 static int hf_mpeg_descr_logon_initialize_forward_signalling_vpi = -1;
2617 static int hf_mpeg_descr_logon_initialize_forward_signalling_vci = -1;
2618
2619 static int hf_mpeg_descr_logon_initialize_return_trf_pid = -1;
2620 static int hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid_reserved = -1;
2621 static int hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid = -1;
2622
2623 static int hf_mpeg_descr_logon_initialize_cra_level = -1;
2624 static int hf_mpeg_descr_logon_initialize_vbdc_max_reserved = -1;
2625 static int hf_mpeg_descr_logon_initialize_vbdc_max = -1;
2626 static int hf_mpeg_descr_logon_initialize_rbdc_max = -1;
2627 static int hf_mpeg_descr_logon_initialize_rbdc_timeout = -1;
2628
2629
2630 #define MPEG_DESCR_LOGON_INITIALIZE_CONTINUOUS_CARRIER_RESERVED_MASK              0xC0
2631 #define MPEG_DESCR_LOGON_INITIALIZE_CONTINUOUS_CARRIER_MASK                       0x20
2632 #define MPEG_DESCR_LOGON_INITIALIZE_SECURITY_HANDSHAKE_REQUIRED_MASK              0x10
2633 #define MPEG_DESCR_LOGON_INITIALIZE_PREFIX_FLAG_MASK                              0x08
2634 #define MPEG_DESCR_LOGON_INITIALIZE_DATA_UNIT_LABELLING_FLAG_MASK                 0x04
2635 #define MPEG_DESCR_LOGON_INITIALIZE_MINI_SLOT_FLAG_MASK                           0x02
2636 #define MPEG_DESCR_LOGON_INITIALIZE_CONTENTION_BASED_MINI_SLOT_FLAG_MASK          0x01
2637
2638 #define MPEG_DESCR_LOGON_INITIALIZE_CAPACITY_TYPE_FLAG_RESERVED_MASK              0x80
2639 #define MPEG_DESCR_LOGON_INITIALIZE_CAPACITY_TYPE_FLAG_MASK                       0x40
2640 #define MPEG_DESCR_LOGON_INITIALIZE_TRAFFIC_BURST_TYPE_MASK                       0x20
2641
2642 #define MPEG_DESCR_LOGON_INITIALIZE_RETURN_TRF_PID_MASK                         0x1FFF
2643 #define MPEG_DESCR_LOGON_INITIALIZE_RETURN_CTRL_MNGM_PID_RESERVED_MASK          0xE000
2644 #define MPEG_DESCR_LOGON_INITIALIZE_RETURN_CTRL_MNGM_PID_MASK                   0x1FFF
2645
2646 #define MPEG_DESCR_LOGON_INITIALIZE_CONNECTIVITY_MASK                           0x1000
2647 #define MPEG_DESCR_LOGON_INITIALIZE_RETURN_VPI_RESERVED_MASK                    0x0F00
2648 #define MPEG_DESCR_LOGON_INITIALIZE_RETURN_VPI_MASK                             0x00FF
2649
2650 #define MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_RESERVED_MASK         0x0F00
2651 #define MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_MASK                  0x00FF
2652 #define MPEG_DESCR_LOGON_INITIALIZE_FORWARD_SIGNALLING_VPI_RESERVED_MASK        0xFF00
2653 #define MPEG_DESCR_LOGON_INITIALIZE_FORWARD_SIGNALLING_VPI_MASK                 0x00FF
2654
2655 #define MPEG_DESCR_LOGON_INITIALIZE_VDBC_MAX_RESERVED_MASK                      0xF800
2656 #define MPEG_DESCR_LOGON_INITIALIZE_VDBC_MAX_MASK                               0x0700
2657
2658
2659 static void
2660 proto_mpeg_descriptor_dissect_logon_initialize(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
2661 {
2662
2663     guint   end    = offset + len;
2664     guint8  flags;
2665     guint16 flags2;
2666
2667     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_group_id,                        tvb, offset, 1, ENC_BIG_ENDIAN);
2668     offset += 1;
2669
2670     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_logon_id,                        tvb, offset, 2, ENC_BIG_ENDIAN);
2671     offset += 2;
2672
2673     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_continuous_carrier_reserved,     tvb, offset, 1, ENC_BIG_ENDIAN);
2674     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_continuous_carrier,              tvb, offset, 1, ENC_BIG_ENDIAN);
2675     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_security_handshake_required,     tvb, offset, 1, ENC_BIG_ENDIAN);
2676     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_prefix_flag,                     tvb, offset, 1, ENC_BIG_ENDIAN);
2677     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_data_unit_labelling_flag,        tvb, offset, 1, ENC_BIG_ENDIAN);
2678     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_mini_slot_flag,                  tvb, offset, 1, ENC_BIG_ENDIAN);
2679     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_contention_based_mini_slot_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2680     offset += 1;
2681
2682     flags = tvb_get_guint8(tvb, offset);
2683
2684     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_capacity_type_flag_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2685     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_capacity_type_flag,          tvb, offset, 1, ENC_BIG_ENDIAN);
2686     proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_traffic_burst_type,          tvb, offset, 1, ENC_BIG_ENDIAN);
2687     if (flags & MPEG_DESCR_LOGON_INITIALIZE_TRAFFIC_BURST_TYPE_MASK) {
2688         proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_connectivity, tvb, offset, 2, ENC_BIG_ENDIAN);
2689         flags2 = tvb_get_ntohs(tvb, offset);
2690         if (flags2 & MPEG_DESCR_LOGON_INITIALIZE_CONNECTIVITY_MASK) {
2691             proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_signalling_vpi_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2692             proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_signalling_vpi, tvb, offset, 1, ENC_BIG_ENDIAN);
2693             offset += 1;
2694
2695             proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_signalling_vci, tvb, offset, 2, ENC_BIG_ENDIAN);
2696             offset += 2;
2697
2698             proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_forward_signalling_vpi_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2699             proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_forward_signalling_vpi, tvb, offset, 1, ENC_BIG_ENDIAN);
2700             offset += 1;
2701
2702             proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_forward_signalling_vci, tvb, offset, 2, ENC_BIG_ENDIAN);
2703             offset += 2;
2704         } else {
2705             proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_vpi_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2706             proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_vpi, tvb, offset, 1, ENC_BIG_ENDIAN);
2707             offset += 1;
2708
2709             proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_vci, tvb, offset, 2, ENC_BIG_ENDIAN);
2710             offset += 2;
2711
2712         }
2713     } else {
2714         proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_trf_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
2715         offset += 2;
2716
2717         proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2718         proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid, tvb, offset, 2, ENC_BIG_ENDIAN);
2719         offset += 2;
2720     }
2721
2722     if ((offset < end) && (flags & MPEG_DESCR_LOGON_INITIALIZE_CAPACITY_TYPE_FLAG_MASK)) {
2723
2724         proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_cra_level,         tvb, offset, 3, ENC_BIG_ENDIAN);
2725         offset += 3;
2726
2727         proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_vbdc_max_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2728         proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_vbdc_max,          tvb, offset, 2, ENC_BIG_ENDIAN);
2729         offset += 2;
2730
2731         proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_rbdc_max,          tvb, offset, 3, ENC_BIG_ENDIAN);
2732         offset += 3;
2733
2734         proto_tree_add_item(tree, hf_mpeg_descr_logon_initialize_rbdc_timeout,      tvb, offset, 2, ENC_BIG_ENDIAN);
2735         /*offset += 2;*/
2736     }
2737 }
2738
2739 /* 0xA7 RCS Content Descriptor */
2740 static int hf_mpeg_descr_rcs_content_table_id = -1;
2741
2742 static void
2743 proto_mpeg_descriptor_dissect_rcs_content(tvbuff_t *tvb, guint offset, guint len, proto_tree *tree)
2744 {
2745     guint end = offset + len;
2746
2747     while (offset < end) {
2748         proto_tree_add_item(tree, hf_mpeg_descr_rcs_content_table_id, tvb, offset, 1, ENC_BIG_ENDIAN);
2749         offset += 1;
2750     }
2751 }
2752
2753 /* Private descriptors
2754    these functions replace proto_mpeg_descriptor_dissect(), they get to see the whole descriptor */
2755
2756 #define CIPLUS_DESC_TAG_CNT_LBL 0xCB
2757 #define CIPLUS_DESC_TAG_SVC     0xCC
2758 #define CIPLUS_DESC_TAG_PROT    0xCE
2759
2760 static const value_string mpeg_descriptor_ciplus_tag_vals[] = {
2761     /* From CI+ 1.3.1 */
2762     { CIPLUS_DESC_TAG_CNT_LBL, "CI+ Content Label Descriptor" },
2763     { CIPLUS_DESC_TAG_SVC,     "CI+ Service Descriptor" },
2764     { CIPLUS_DESC_TAG_PROT,    "CI+ Protection Descriptor" },
2765     { 0x00, NULL}
2766 };
2767
2768 /* 0xCB CI+ Content Label Descriptor */
2769 static int hf_mpeg_descr_ciplus_cl_cb_min = -1;
2770 static int hf_mpeg_descr_ciplus_cl_cb_max = -1;
2771 static int hf_mpeg_descr_ciplus_cl_lang = -1;
2772 static int hf_mpeg_descr_ciplus_cl_label = -1;
2773
2774 /* 0xCC CI+ Service Descriptor */
2775 static int hf_mpeg_descr_ciplus_svc_id = -1;
2776 static int hf_mpeg_descr_ciplus_svc_type = -1;
2777 static int hf_mpeg_descr_ciplus_svc_visible = -1;
2778 static int hf_mpeg_descr_ciplus_svc_selectable = -1;
2779 static int hf_mpeg_descr_ciplus_svc_lcn = -1;
2780 static int hf_mpeg_descr_ciplus_svc_prov_name = -1;
2781 static int hf_mpeg_descr_ciplus_svc_name = -1;
2782
2783 /* 0xCE CI+ Protection Descriptor */
2784 static int hf_mpeg_descr_ciplus_prot_free_ci_mode = -1;
2785 static int hf_mpeg_descr_ciplus_prot_match_brand_flag = -1;
2786 static int hf_mpeg_descr_ciplus_prot_num_entries = -1;
2787 static int hf_mpeg_descr_ciplus_prot_brand_id = -1;
2788
2789 static const true_false_string tfs_prot_noprot = { "CI+ protection required", "CI+ protection not required" };
2790
2791
2792 static guint
2793 proto_mpeg_descriptor_dissect_private_ciplus(tvbuff_t *tvb, guint offset, proto_tree *tree)
2794 {
2795     guint        offset_start;
2796     guint8       tag, len;
2797     const gchar *tag_str;
2798     proto_item  *di;
2799     proto_tree  *descriptor_tree;
2800
2801     offset_start=offset;
2802
2803     tag = tvb_get_guint8(tvb, offset);
2804     tag_str = try_val_to_str(tag, mpeg_descriptor_ciplus_tag_vals);
2805     if (!tag_str)
2806         return 0;
2807
2808     descriptor_tree = proto_tree_add_subtree_format(tree, tvb, offset_start, -1,
2809                 ett_mpeg_descriptor, &di, "CI+ private descriptor Tag=0x%02x", tag);
2810
2811     proto_tree_add_uint_format(descriptor_tree, hf_mpeg_descriptor_tag,
2812             tvb, offset, 1, tag, "Descriptor Tag: %s (0x%02x)", tag_str, tag);
2813     offset += 1;
2814
2815     len = tvb_get_guint8(tvb, offset);
2816     proto_tree_add_item(descriptor_tree, hf_mpeg_descriptor_length, tvb, offset, 1, ENC_BIG_ENDIAN);
2817     offset += 1;
2818
2819     if (tag==CIPLUS_DESC_TAG_CNT_LBL) {
2820         proto_tree_add_item(tree, hf_mpeg_descr_ciplus_cl_cb_min, tvb, offset, 1, ENC_BIG_ENDIAN);
2821         offset += 1;
2822
2823         proto_tree_add_item(tree, hf_mpeg_descr_ciplus_cl_cb_max, tvb, offset, 1, ENC_BIG_ENDIAN);
2824         offset += 1;
2825
2826         proto_tree_add_item(tree, hf_mpeg_descr_ciplus_cl_lang, tvb, offset, 3, ENC_ASCII|ENC_NA);
2827         offset += 3;
2828
2829         proto_tree_add_item(tree, hf_mpeg_descr_ciplus_cl_label, tvb, offset, len-offset, ENC_ASCII|ENC_NA);
2830         offset += len-offset;
2831     }
2832     else if (tag==CIPLUS_DESC_TAG_SVC) {
2833         guint8  str_len_byte;
2834
2835         proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_svc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2836         offset += 2;
2837
2838         proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_svc_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2839         offset += 1;
2840
2841         proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_svc_visible, tvb, offset, 2, ENC_BIG_ENDIAN);
2842         proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_svc_selectable, tvb, offset, 2, ENC_BIG_ENDIAN);
2843         proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_svc_lcn, tvb, offset, 2, ENC_BIG_ENDIAN);
2844         offset += 2;
2845
2846         str_len_byte = tvb_get_guint8(tvb, offset);
2847         proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_svc_prov_name, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
2848         offset += 1+str_len_byte;
2849
2850         str_len_byte = tvb_get_guint8(tvb, offset);
2851         proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_svc_name, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
2852         offset += 1+str_len_byte;
2853     }
2854     else if (tag==CIPLUS_DESC_TAG_PROT) {
2855         gboolean  match_brand_flag;
2856         guint8    num_brands, i;
2857         guint     remaining;
2858
2859         proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_prot_free_ci_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
2860         match_brand_flag = ((tvb_get_guint8(tvb, offset) & 0x40) == 0x40);
2861         proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_prot_match_brand_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
2862         offset++;
2863
2864         if (match_brand_flag) {
2865             num_brands = tvb_get_guint8(tvb, offset);
2866             proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_prot_num_entries, tvb, offset, 1, ENC_BIG_ENDIAN);
2867             offset++;
2868             for (i=0; i<num_brands; i++) {
2869                 proto_tree_add_item(descriptor_tree, hf_mpeg_descr_ciplus_prot_brand_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2870                 offset += 2;
2871             }
2872         }
2873
2874         remaining = offset_start+2+len - offset;
2875         if (remaining > 0) {
2876             proto_tree_add_item(descriptor_tree, hf_mpeg_descr_private_data, tvb, offset, remaining, ENC_NA);
2877             offset += remaining;
2878         }
2879     }
2880
2881     proto_item_set_len(di, offset-offset_start);
2882     return offset-offset_start;
2883 }
2884
2885
2886 /* Common dissector */
2887
2888 guint
2889 proto_mpeg_descriptor_dissect(tvbuff_t *tvb, guint offset, proto_tree *tree)
2890 {
2891     guint       tag, len;
2892
2893     proto_tree *descriptor_tree;
2894
2895     tag = tvb_get_guint8(tvb, offset);
2896     len = tvb_get_guint8(tvb, offset + 1);
2897
2898     descriptor_tree = proto_tree_add_subtree_format(tree, tvb, offset, len + 2,
2899                         ett_mpeg_descriptor, NULL, "Descriptor Tag=0x%02x", tag);
2900
2901     proto_tree_add_item(descriptor_tree, hf_mpeg_descriptor_tag,    tvb, offset, 1, ENC_BIG_ENDIAN);
2902     offset += 1;
2903
2904     proto_tree_add_item(descriptor_tree, hf_mpeg_descriptor_length, tvb, offset, 1, ENC_BIG_ENDIAN);
2905     offset += 1;
2906
2907     if (len == 0)
2908         return 2;
2909
2910     switch (tag) {
2911         case 0x02: /* Video Stream Descriptor */
2912             proto_mpeg_descriptor_dissect_video_stream(tvb, offset, descriptor_tree);
2913             break;
2914         case 0x03: /* Audio Stream Descriptor */
2915             proto_mpeg_descriptor_dissect_audio_stream(tvb, offset, descriptor_tree);
2916             break;
2917         case 0x05: /* Registration Descriptor */
2918             proto_mpeg_descriptor_dissect_registration(tvb, offset, len, descriptor_tree);
2919             break;
2920         case 0x06: /* Data Stream Alignment Descriptor */
2921             proto_mpeg_descriptor_dissect_data_stream_alignment(tvb, offset, descriptor_tree);
2922             break;
2923         case 0x09: /* CA Descriptor */
2924             proto_mpeg_descriptor_dissect_ca(tvb, offset, len, descriptor_tree);
2925             break;
2926         case 0x0A: /* ISO 639 Language Descriptor */
2927             proto_mpeg_descriptor_dissect_iso639(tvb, offset, len, descriptor_tree);
2928             break;
2929         case 0x0B: /* System Clock Descriptor */
2930             proto_mpeg_descriptor_dissect_system_clock(tvb, offset, descriptor_tree);
2931             break;
2932         case 0x0E: /* Maximum Bitrate Descriptor */
2933             proto_mpeg_descriptor_dissect_max_bitrate(tvb, offset, descriptor_tree);
2934             break;
2935         case 0x10: /* Smoothing Buffer Descriptor */
2936             proto_mpeg_descriptor_dissect_smoothing_buffer(tvb, offset, descriptor_tree);
2937             break;
2938         case 0x11: /* STD Descriptor */
2939             proto_mpeg_descriptor_dissect_std(tvb, offset, descriptor_tree);
2940             break;
2941         case 0x13: /* Carousel Identifier Descriptor */
2942             proto_mpeg_descriptor_dissect_carousel_identifier(tvb, offset, len, descriptor_tree);
2943             break;
2944         case 0x14: /* Association Tag Descriptor */
2945             proto_mpeg_descriptor_dissect_association_tag(tvb, offset, len, descriptor_tree);
2946             break;
2947         case 0x28: /* AVC Video Descriptor */
2948             proto_mpeg_descriptor_dissect_avc_vid(tvb, offset, descriptor_tree);
2949             break;
2950         case 0x40: /* Network Name Descriptor */
2951             proto_mpeg_descriptor_dissect_network_name(tvb, offset, len, descriptor_tree);
2952             break;
2953         case 0x41: /* Service List Descriptor */
2954             proto_mpeg_descriptor_dissect_service_list(tvb, offset, len, descriptor_tree);
2955             break;
2956         case 0x42: /* Stuffing Descriptor */
2957             proto_mpeg_descriptor_stuffing(tvb, offset, len, descriptor_tree);
2958             break;
2959         case 0x43: /* Satellite Delivery System Descriptor */
2960             proto_mpeg_descriptor_dissect_satellite_delivery(tvb, offset, descriptor_tree);
2961             break;
2962         case 0x44: /* Cable Delivery System Descriptor */
2963             proto_mpeg_descriptor_dissect_cable_delivery(tvb, offset, descriptor_tree);
2964             break;
2965         case 0x45: /* VBI Data Descriptor */
2966             proto_mpeg_descriptor_dissect_vbi_data(tvb, offset, len, descriptor_tree);
2967             break;
2968         case 0x47: /* Bouquet Name Descriptor */
2969             proto_mpeg_descriptor_dissect_bouquet_name(tvb, offset, len, descriptor_tree);
2970             break;
2971         case 0x48: /* Service Descriptor */
2972             proto_mpeg_descriptor_dissect_service(tvb, offset, descriptor_tree);
2973             break;
2974         case 0x4A: /* Linkage Descriptor */
2975             proto_mpeg_descriptor_dissect_linkage(tvb, offset, len, descriptor_tree);
2976             break;
2977         case 0x4D: /* Short Event Descriptor */
2978             proto_mpeg_descriptor_dissect_short_event(tvb, offset, descriptor_tree);
2979             break;
2980         case 0x4E: /* Extended Event Descriptor */
2981             proto_mpeg_descriptor_dissect_extended_event(tvb, offset, descriptor_tree);
2982             break;
2983         case 0x50: /* Component Descriptor */
2984             proto_mpeg_descriptor_dissect_component(tvb, offset, len, descriptor_tree);
2985             break;
2986         case 0x52: /* Stream Identifier Descriptor */
2987             proto_mpeg_descriptor_dissect_stream_identifier(tvb, offset, descriptor_tree);
2988             break;
2989         case 0x53: /* CA Identifier Descriptor */
2990             proto_mpeg_descriptor_dissect_ca_identifier(tvb, offset, len, descriptor_tree);
2991             break;
2992         case 0x54: /* Content Descriptor */
2993             proto_mpeg_descriptor_dissect_content(tvb, offset, len, descriptor_tree);
2994             break;
2995         case 0x55: /* Parental Rating Descriptor */
2996             proto_mpeg_descriptor_dissect_parental_rating(tvb, offset, descriptor_tree);
2997             break;
2998         case 0x56: /* Teletext Descriptor */
2999             proto_mpeg_descriptor_dissect_teletext(tvb, offset, len, descriptor_tree);
3000             break;
3001         case 0x58: /* Local Time Offset Descriptor */
3002             proto_mpeg_descriptor_dissect_local_time_offset(tvb, offset, len, descriptor_tree);
3003             break;
3004         case 0x59: /* Subtitling Descriptor */
3005             proto_mpeg_descriptor_dissect_subtitling(tvb, offset, len, descriptor_tree);
3006             break;
3007         case 0x5A: /* Terrestrial Delivery System Descriptor */
3008             proto_mpeg_descriptor_dissect_terrestrial_delivery(tvb, offset, descriptor_tree);
3009             break;
3010         case 0x5F: /* Private Data Specifier Descriptor */
3011             proto_mpeg_descriptor_dissect_private_data_specifier(tvb, offset, descriptor_tree);
3012             break;
3013         case 0x64: /* Data Broadcast Descriptor */
3014             proto_mpeg_descriptor_dissect_data_bcast(tvb, offset, descriptor_tree);
3015             break;
3016         case 0x66: /* Data Broadcast ID Descriptor */
3017             proto_mpeg_descriptor_dissect_data_bcast_id(tvb, offset, len, descriptor_tree);
3018             break;
3019         case 0x6A: /* AC-3 Descriptor */
3020             proto_mpeg_descriptor_dissect_ac3(tvb, offset, len, descriptor_tree);
3021             break;
3022         case 0x6F: /* Application Signalling Descriptor */
3023             proto_mpeg_descriptor_dissect_app_sig(tvb, offset, len, descriptor_tree);
3024             break;
3025         case 0x73: /* Default Authority Descriptor */
3026             proto_mpeg_descriptor_dissect_default_authority(tvb, offset, len, descriptor_tree);
3027             break;
3028         case 0x76: /* Content Identifier Descriptor */
3029             proto_mpeg_descriptor_dissect_content_identifier(tvb, offset, len, descriptor_tree);
3030             break;
3031         case 0x7F: /* Extension Descriptor */
3032             proto_mpeg_descriptor_dissect_extension(tvb, offset, len, descriptor_tree);
3033             break;
3034         case 0x81: /* ATSC A/52 AC-3 Audio Descriptor */
3035             proto_mpeg_descriptor_dissect_ac3_system_a(tvb, offset, len, descriptor_tree);
3036             break;
3037         case 0xA2: /* Logon Initialize Descriptor */
3038             proto_mpeg_descriptor_dissect_logon_initialize(tvb, offset, len, descriptor_tree);
3039             break;
3040         case 0xA7: /* RCS Content Descriptor */
3041             proto_mpeg_descriptor_dissect_rcs_content(tvb, offset, len, descriptor_tree);
3042             break;
3043         default:
3044             proto_tree_add_item(descriptor_tree, hf_mpeg_descriptor_data, tvb, offset, len, ENC_NA);
3045             break;
3046     }
3047
3048     return len + 2;
3049 }
3050
3051
3052 /* dissect a descriptor loop consisting of one or more descriptors
3053    take into account the contexts defined a private data specifier descriptors */
3054 guint
3055 proto_mpeg_descriptor_loop_dissect(tvbuff_t *tvb, guint offset, guint loop_len, proto_tree *tree)
3056 {
3057     /* we use the reserved value to indicate that no private context is active */
3058     guint32 private_data_specifier = PRIVATE_DATA_SPECIFIER_RESERVED;
3059     guint   offset_start;
3060     guint   desc_len;
3061     guint8  tag;
3062
3063     offset_start = offset;
3064
3065     while ((offset - offset_start) < loop_len) {
3066         /* don't increment offset in our pre-checks */
3067         tag = tvb_get_guint8(tvb, offset);
3068         if (tag == 0x5F) {
3069             /* we have a private data specifier descriptor: get the private data specifier */
3070             /* offset+1 is length byte, offset+2 is start of payload */
3071             private_data_specifier = tvb_get_ntohl(tvb, offset+2);
3072         }
3073
3074          /* the default descriptor function takes precedence
3075             however, if it does not know the current descriptor, we search for a context-specific subfunction
3076             this subfunction gets to see the entire descriptor, including tag and len */
3077         if (try_val_to_str(tag, mpeg_descriptor_tag_vals)) {
3078             desc_len = proto_mpeg_descriptor_dissect(tvb, offset, tree);
3079         }
3080         else {
3081             switch (private_data_specifier) {
3082                 case PRIVATE_DATA_SPECIFIER_CIPLUS_LLP:
3083                     desc_len = proto_mpeg_descriptor_dissect_private_ciplus(tvb, offset, tree);
3084                     break;
3085                 default:
3086                     desc_len = 0;
3087                     break;
3088             }
3089             if (desc_len == 0) {
3090                 /* either there was no subfunction or it could not handle the descriptor
3091                    fall back to the default (which will dissect it as unknown) */
3092                 desc_len = proto_mpeg_descriptor_dissect(tvb, offset, tree);
3093             }
3094         }
3095
3096         offset += desc_len;
3097     }
3098
3099     return offset-offset_start;
3100 }
3101
3102
3103 void
3104 proto_register_mpeg_descriptor(void)
3105 {
3106
3107     static hf_register_info hf[] = {
3108         { &hf_mpeg_descriptor_tag, {
3109             "Descriptor Tag", "mpeg_descr.tag",
3110             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descriptor_tag_vals_ext, 0, NULL, HFILL
3111         } },
3112
3113         { &hf_mpeg_descriptor_length, {
3114             "Descriptor Length", "mpeg_descr.len",
3115             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3116         } },
3117
3118         { &hf_mpeg_descriptor_data, {
3119             "Descriptor Data", "mpeg_descr.data",
3120             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3121         } },
3122
3123         /* 0x02 Video Stream Descriptor */
3124         { &hf_mpeg_descr_video_stream_multiple_frame_rate_flag, {
3125             "Multiple Frame Rate Flag", "mpeg_descr.video_stream.multiple_frame_rate_flag",
3126             FT_UINT8, BASE_DEC, VALS(mpeg_descr_video_stream_multiple_frame_rate_flag_vals),
3127             MPEG_DESCR_VIDEO_STREAM_MULTIPLE_FRAME_RATE_FLAG_MASK, NULL, HFILL
3128         } },
3129
3130         { &hf_mpeg_descr_video_stream_frame_rate_code, {
3131             "Frame Rate Code", "mpeg_descr.video_stream.frame_rate_code",
3132             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_VIDEO_STREAM_FRAME_RATE_CODE_MASK, NULL, HFILL
3133         } },
3134
3135         { &hf_mpeg_descr_video_stream_mpeg1_only_flag, {
3136             "MPEG1 Only Flag", "mpeg_descr.video_stream.mpeg1_only_flag",
3137             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_VIDEO_STREAM_MPEG1_ONLY_FLAG_MASK, NULL, HFILL
3138         } },
3139
3140         { &hf_mpeg_descr_video_stream_constrained_parameter_flag, {
3141             "Constrained Parameter Flag", "mpeg_descr.video_stream.constrained_parameter_flag",
3142             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_VIDEO_STREAM_CONSTRAINED_PARAMETER_FLAG_MASK, NULL, HFILL
3143         } },
3144
3145         { &hf_mpeg_descr_video_stream_still_picture_flag, {
3146             "Still Picture Flag", "mpeg_descr.video_stream.still_picture_flag",
3147             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_VIDEO_STREAM_STILL_PICTURE_FLAG_MASK, NULL, HFILL
3148         } },
3149
3150         { &hf_mpeg_descr_video_stream_profile_and_level_indication, {
3151             "Profile and Level Indication", "mpeg_descr.video_stream.profile_level_ind",
3152             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3153         } },
3154
3155         { &hf_mpeg_descr_video_stream_chroma_format, {
3156             "Chroma Format", "mpeg_descr.video_stream.chroma_format",
3157             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
3158         } },
3159
3160         { &hf_mpeg_descr_video_stream_frame_rate_extension_flag, {
3161             "Frame Rate Extension Flag", "mpeg_descr.video_stream.frame_rate_extension_flag",
3162             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_VIDEO_STREAM_FRAME_RATE_EXTENSION_FLAG_MASK, NULL, HFILL
3163         } },
3164
3165         { &hf_mpeg_descr_video_stream_reserved, {
3166             "Reserved", "mpeg_descr.video_stream.reserved",
3167             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_VIDEO_STREAM_RESERVED_MASK, NULL, HFILL
3168         } },
3169
3170         /* 0x03 Audio Stream Descriptor */
3171         { &hf_mpeg_descr_audio_stream_free_format_flag, {
3172             "Free Format Flag", "mpeg_descr.audio_stream.free_format_flag",
3173             FT_UINT8, BASE_DEC, VALS(mpeg_descr_audio_stream_free_format_flag_vals), MPEG_DESCR_AUDIO_STREAM_FREE_FORMAT_FLAG_MASK, NULL, HFILL
3174         } },
3175
3176         { &hf_mpeg_descr_audio_stream_id, {
3177             "ID", "mpeg_descr.audio_stream.id",
3178             FT_UINT8, BASE_DEC, VALS(mpeg_descr_audio_stream_id_vals), MPEG_DESCR_AUDIO_STREAM_ID_MASK, NULL, HFILL
3179         } },
3180
3181         { &hf_mpeg_descr_audio_stream_layer, {
3182             "Layer", "mpeg_descr.audio_stream.layer",
3183             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AUDIO_STREAM_LAYER_MASK, NULL, HFILL
3184         } },
3185
3186         { &hf_mpeg_descr_audio_stream_variable_rate_audio_indicator, {
3187             "Variable Rate Audio Indicator", "mpeg_descr.audio_stream.vbr_indicator",
3188             FT_UINT8, BASE_DEC, VALS(mpeg_descr_audio_stream_variable_rate_audio_indicator_vals),
3189             MPEG_DESCR_AUDIO_STREAM_VARIABLE_RATE_AUDIO_INDICATOR_MASK, NULL, HFILL
3190         } },
3191
3192         { &hf_mpeg_descr_audio_stream_reserved, {
3193             "Reserved", "mpeg_descr.audio_stream.reserved",
3194             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_AUDIO_STREAM_RESERVED_MASK, NULL, HFILL
3195         } },
3196
3197         /* 0x05 Registration Descriptor */
3198         { &hf_mpeg_descr_reg_form_id, {
3199             "Format identifier", "mpeg_descr.registration.format_identifier",
3200             FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL
3201         } },
3202
3203         { &hf_mpeg_descr_reg_add_id_inf, {
3204             "Additional identification info", "mpeg_descr.registration.add_id_info",
3205             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
3206         } },
3207
3208         /* 0x06 Data Stream Alignment Descriptor */
3209         { &hf_mpeg_descr_data_stream_alignment, {
3210             "Data Stream Alignment", "mpeg_descr.data_stream_alignment.alignment",
3211             FT_UINT8, BASE_HEX, VALS(mpeg_descr_data_stream_alignment_vals), 0, NULL, HFILL
3212         } },
3213
3214         /* 0x09 CA Descriptor */
3215         { &hf_mpeg_descr_ca_system_id, {
3216             "System ID", "mpeg_descr.ca.sys_id",
3217             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3218         } },
3219
3220         { &hf_mpeg_descr_ca_reserved, {
3221             "Reserved", "mpeg_descr.ca.reserved",
3222             FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_CA_RESERVED_MASK, NULL, HFILL
3223         } },
3224
3225         { &hf_mpeg_descr_ca_pid, {
3226             "CA PID", "mpeg_descr.ca.pid",
3227             FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_CA_PID_MASK, NULL, HFILL
3228         } },
3229
3230         { &hf_mpeg_descr_ca_private, {
3231             "Private bytes", "mpeg_descr.ca.private",
3232             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3233         } },
3234
3235         /* 0x0A ISO 639 Language Descriptor */
3236         { &hf_mpeg_descr_iso639_lang, {
3237             "ISO 639 Language Code", "mpeg_descr.lang.code",
3238             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3239         } },
3240
3241         { &hf_mpeg_descr_iso639_type, {
3242             "ISO 639 Language Type", "mpeg_descr.lang.type",
3243             FT_UINT8, BASE_HEX, VALS(mpeg_descr_iso639_type_vals), 0, NULL, HFILL
3244         } },
3245
3246         /* 0x0B System Clock Descriptor */
3247         { &hf_mpeg_descr_system_clock_external_clock_reference_indicator, {
3248             "External Clock Reference Indicator", "mpeg_descr.sys_clk.external_clk_ref_ind",
3249             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_SYSTEM_CLOCK_EXTERNAL_CLOCK_REFERENCE_INDICATOR_MASK, NULL, HFILL
3250         } },
3251
3252         { &hf_mpeg_descr_system_clock_reserved1, {
3253             "Reserved", "mpeg_descr.sys_clk.reserved1",
3254             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_SYSTEM_CLOCK_RESERVED1_MASK, NULL, HFILL
3255         } },
3256
3257         { &hf_mpeg_descr_system_clock_accuracy_integer, {
3258             "Accuracy Integer", "mpeg_descr.sys_clk.accuracy_integer",
3259             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_SYSTEM_CLOCK_ACCURACY_INTEGER_MASK, NULL, HFILL
3260         } },
3261
3262         { &hf_mpeg_descr_system_clock_accuracy_exponent, {
3263             "Accuracy Exponent", "mpeg_descr.sys_clk.accuracy_exponent",
3264             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_SYSTEM_CLOCK_ACCURACY_EXPONENT_MASK, NULL, HFILL
3265         } },
3266
3267         { &hf_mpeg_descr_system_clock_reserved2, {
3268             "Reserved", "mpeg_descr.sys_clk.reserved2",
3269             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_SYSTEM_CLOCK_RESERVED2_MASK, NULL, HFILL
3270         } },
3271
3272         /* 0x0E Maximum Bitrate Descriptor */
3273         { &hf_mpeg_descr_max_bitrate_reserved, {
3274             "Maximum Bitrate Reserved", "mpeg_descr.max_bitrate.reserved",
3275             FT_UINT24, BASE_HEX, NULL, MPEG_DESCR_MAX_BITRATE_RESERVED_MASK, NULL, HFILL
3276         } },
3277
3278         { &hf_mpeg_descr_max_bitrate, {
3279             "Maximum Bitrate", "mpeg_descr.max_bitrate.rate",
3280             FT_UINT24, BASE_DEC, NULL, MPEG_DESCR_MAX_BITRATE_MASK, NULL, HFILL
3281         } },
3282
3283         /* 0x10 Smoothing Buffer Descriptor */
3284         { &hf_mpeg_descr_smoothing_buffer_reserved1, {
3285             "Reserved", "mpeg_descr.smoothing_buf.reserved1",
3286             FT_UINT24, BASE_HEX, NULL, MPEG_DESCR_SMOOTHING_BUFFER_RESERVED1_MASK, NULL, HFILL
3287         } },
3288
3289         { &hf_mpeg_descr_smoothing_buffer_leak_rate, {
3290             "Leak Rate", "mpeg_descr.smoothing_buf.leak_rate",
3291             FT_UINT24, BASE_DEC, NULL, MPEG_DESCR_SMOOTHING_BUFFER_LEAK_RATE_MASK, NULL, HFILL
3292         } },
3293
3294         { &hf_mpeg_descr_smoothing_buffer_reserved2, {
3295             "Reserved", "mpeg_descr.smoothing_buf.reserved2",
3296             FT_UINT24, BASE_HEX, NULL, MPEG_DESCR_SMOOTHING_BUFFER_RESERVED2_MASK, NULL, HFILL
3297         } },
3298
3299         { &hf_mpeg_descr_smoothing_buffer_size, {
3300             "Buffer Size", "mpeg_descr.smoothing_buf.size",
3301             FT_UINT24, BASE_DEC, NULL, MPEG_DESCR_SMOOTHING_BUFFER_SIZE_MASK, NULL, HFILL
3302         } },
3303
3304         /* 0x11 STD Descriptor */
3305         { &hf_mpeg_descr_std_reserved, {
3306             "Reserved", "mpeg_descr.std.reserved",
3307             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_STD_RESERVED_MASK, NULL, HFILL
3308         } },
3309
3310         { &hf_mpeg_descr_std_leak_valid, {
3311             "Leak Valid", "mpeg_descr.std.leak_valid",
3312             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_STD_LEAK_VALID_MASK, NULL, HFILL
3313         } },
3314
3315         /* 0x13 Carousel Identifier Descriptor */
3316         { &hf_mpeg_descr_carousel_identifier_id, {
3317             "Carousel ID", "mpeg_descr.carousel_identifier.id",
3318             FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL
3319         } },
3320
3321         { &hf_mpeg_descr_carousel_identifier_format_id, {
3322             "Format ID", "mpeg_descr.carousel_identifier.format_id",
3323             FT_UINT8, BASE_HEX, VALS(mpeg_descr_carousel_identifier_format_id_vals), 0, NULL, HFILL
3324         } },
3325
3326         { &hf_mpeg_descr_carousel_identifier_module_version, {
3327             "Module Version", "mpeg_descr.carousel_identifier.module_version",
3328             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
3329         } },
3330
3331         { &hf_mpeg_descr_carousel_identifier_module_id, {
3332             "Module ID", "mpeg_descr.carousel_identifier.module_id",
3333             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3334         } },
3335
3336         { &hf_mpeg_descr_carousel_identifier_block_size, {
3337             "Block Size", "mpeg_descr.carousel_identifier.block_size",
3338             FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL
3339         } },
3340
3341         { &hf_mpeg_descr_carousel_identifier_module_size, {
3342             "Module Size", "mpeg_descr.carousel_identifier.module_size",
3343             FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL
3344         } },
3345
3346         { &hf_mpeg_descr_carousel_identifier_compression_method, {
3347             "Compression Method", "mpeg_descr.carousel_identifier.comp_method",
3348             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
3349         } },
3350
3351         { &hf_mpeg_descr_carousel_identifier_original_size, {
3352             "Original Size", "mpeg_descr.carousel_identifier.orig_size",
3353             FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL
3354         } },
3355
3356         { &hf_mpeg_descr_carousel_identifier_timeout, {
3357             "Timeout", "mpeg_descr.carousel_identifier.timeout",
3358             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3359         } },
3360
3361         { &hf_mpeg_descr_carousel_identifier_object_key_len, {
3362             "Object Key Length", "mpeg_descr.carousel_identifier.key_len",
3363             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3364         } },
3365
3366         { &hf_mpeg_descr_carousel_identifier_object_key_data, {
3367             "Object Key Data", "mpeg_descr.carousel_identifier.key_data",
3368             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3369         } },
3370
3371         { &hf_mpeg_descr_carousel_identifier_private, {
3372             "Private Bytes", "mpeg_descr.carousel_identifier.private",
3373             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3374         } },
3375
3376         /* 0x14 Association Tag Descriptor */
3377         { &hf_mpeg_descr_association_tag, {
3378             "Association Tag", "mpeg_descr.assoc_tag.tag",
3379             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3380         } },
3381
3382         { &hf_mpeg_descr_association_tag_use, {
3383             "Use", "mpeg_descr.assoc_tag.use",
3384             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3385         } },
3386
3387         { &hf_mpeg_descr_association_tag_selector_len, {
3388             "Selector Length", "mpeg_descr.assoc_tag.selector_len",
3389             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3390         } },
3391
3392         { &hf_mpeg_descr_association_tag_transaction_id, {
3393             "Transaction ID", "mpeg_descr.assoc_tag.transaction_id",
3394             FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL
3395         } },
3396
3397         { &hf_mpeg_descr_association_tag_timeout, {
3398             "Timeout", "mpeg_descr.assoc_tag.timeout",
3399             FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL
3400         } },
3401
3402         { &hf_mpeg_descr_association_tag_selector_bytes, {
3403             "Selector Bytes", "mpeg_descr.assoc_tag.selector_bytes",
3404             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3405         } },
3406
3407         { &hf_mpeg_descr_association_tag_private_bytes, {
3408             "Private Bytes", "mpeg_descr.assoc_tag.private_bytes",
3409             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3410         } },
3411
3412         /* 0x28 AVC Video Descriptor */
3413         { &hf_mpeg_descr_avc_vid_profile_idc, {
3414             "Profile IDC", "mpeg_descr.avc_vid.profile_idc",
3415             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
3416         } },
3417
3418         { &hf_mpeg_descr_avc_vid_constraint_set0_flag, {
3419             "Constraint Set0 Flag", "mpeg_descr.avc_vid.contraint_set0",
3420             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AVC_VID_CONSTRAINT_SET0_FLAG_MASK, NULL, HFILL
3421         } },
3422
3423         { &hf_mpeg_descr_avc_vid_constraint_set1_flag, {
3424             "Constraint Set1 Flag", "mpeg_descr.avc_vid.contraint_set1",
3425             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AVC_VID_CONSTRAINT_SET1_FLAG_MASK, NULL, HFILL
3426         } },
3427
3428         { &hf_mpeg_descr_avc_vid_constraint_set2_flag, {
3429             "Constraint Set2 Flag", "mpeg_descr.avc_vid.contraint_set2",
3430             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AVC_VID_CONSTRAINT_SET2_FLAG_MASK, NULL, HFILL
3431         } },
3432
3433         { &hf_mpeg_descr_avc_vid_compatible_flags, {
3434             "Constraint Compatible Flags", "mpeg_descr.avc_vid.compatible_flags",
3435             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_AVC_VID_COMPATIBLE_FLAGS_MASK, NULL, HFILL
3436         } },
3437
3438         { &hf_mpeg_descr_avc_vid_level_idc, {
3439             "Level IDC", "mpeg_descr.avc_vid.level_idc",
3440             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
3441         } },
3442
3443         { &hf_mpeg_descr_avc_vid_still_present, {
3444             "AVC Still Present", "mpeg_descr.avc_vid.still_present",
3445             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AVC_VID_STILL_PRESENT_MASK, NULL, HFILL
3446         } },
3447
3448         { &hf_mpeg_descr_avc_vid_24h_picture_flag, {
3449             "AVC 24 Hour Picture Flag", "mpeg_descr.avc_vid.24h_picture_flag",
3450             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_AVC_VID_24H_PICTURE_FLAG_MASK, NULL, HFILL
3451         } },
3452
3453         { &hf_mpeg_descr_avc_vid_reserved, {
3454             "Reserved", "mpeg_descr.avc_vid.reserved",
3455             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_AVC_VID_RESERVED_MASK, NULL, HFILL
3456         } },
3457
3458         /* 0x40 Network Name Descriptor */
3459         { &hf_mpeg_descr_network_name_descriptor, {
3460             "Network Name", "mpeg_descr.net_name.name",
3461             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3462         } },
3463
3464         /* 0x41 Service List Descriptor */
3465         { &hf_mpeg_descr_service_list_id, {
3466             "Service ID", "mpeg_descr.svc_list.id",
3467             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3468         } },
3469
3470         { &hf_mpeg_descr_service_list_type, {
3471             "Service Type", "mpeg_descr.svc_list.type",
3472             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_service_type_vals_ext, 0, NULL, HFILL
3473         } },
3474
3475         /* 0x42 Stuffing Descriptor */
3476         { &hf_mpeg_descr_stuffing, {
3477             "Stuffing", "mpeg_descr.stuffing",
3478             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3479         } },
3480
3481         /* 0x43 Satellite Delivery System Descriptor */
3482         { &hf_mpeg_descr_satellite_delivery_frequency, {
3483             "Frequency", "mpeg_descr.sat_delivery.freq",
3484             FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_ghz, 0, NULL, HFILL
3485         } },
3486
3487         { &hf_mpeg_descr_satellite_delivery_orbital_position, {
3488             "Orbital Position", "mpeg_descr.sat_delivery.orbital_pos",
3489             FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_degree_degrees, 0, NULL, HFILL
3490         } },
3491
3492         { &hf_mpeg_descr_satellite_delivery_west_east_flag, {
3493             "West East Flag", "mpeg_descr.sat_delivery.west_east_flag",
3494             FT_UINT8, BASE_HEX, VALS(mpeg_descr_satellite_delivery_west_east_flag_vals),
3495             MPEG_DESCR_SATELLITE_DELIVERY_WEST_EAST_FLAG_MASK, NULL, HFILL
3496         } },
3497
3498         { &hf_mpeg_descr_satellite_delivery_polarization, {
3499             "Polarization", "mpeg_descr.sat_delivery.polarization",
3500             FT_UINT8, BASE_HEX, VALS(mpeg_descr_satellite_delivery_polarization_vals),
3501             MPEG_DESCR_SATELLITE_DELIVERY_POLARIZATION_MASK, NULL, HFILL
3502         } },
3503
3504         { &hf_mpeg_descr_satellite_delivery_roll_off, {
3505             "Roll Off", "mpeg_descr.sat_delivery.roll_off",
3506             FT_UINT8, BASE_HEX, VALS(mpeg_descr_satellite_delivery_roll_off_vals),
3507             MPEG_DESCR_SATELLITE_DELIVERY_ROLL_OFF_MASK, NULL, HFILL
3508         } },
3509
3510         { &hf_mpeg_descr_satellite_delivery_zero, {
3511             "Zero", "mpeg_descr.sat_delivery.zero",
3512             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_SATELLITE_DELIVERY_ZERO_MASK, NULL, HFILL
3513         } },
3514
3515         { &hf_mpeg_descr_satellite_delivery_modulation_system, {
3516             "Modulation System", "mpeg_descr.sat_delivery.modulation_system",
3517             FT_UINT8, BASE_HEX, VALS(mpeg_descr_satellite_delivery_modulation_system_vals),
3518             MPEG_DESCR_SATELLITE_DELIVERY_MODULATION_SYSTEM_MASK, NULL, HFILL
3519         } },
3520
3521         { &hf_mpeg_descr_satellite_delivery_modulation_type, {
3522             "Modulation Type", "mpeg_descr.sat_delivery.modulation_type",
3523             FT_UINT8, BASE_HEX, VALS(mpeg_descr_satellite_delivery_modulation_type_vals),
3524             MPEG_DESCR_SATELLITE_DELIVERY_MODULATION_TYPE_MASK, NULL, HFILL
3525         } },
3526
3527         { &hf_mpeg_descr_satellite_delivery_symbol_rate, {
3528             "Symbol Rate", "mpeg_descr.sat_delivery.symbol_rate",
3529             FT_DOUBLE, BASE_NONE, NULL, 0, NULL, HFILL
3530         } },
3531
3532         { &hf_mpeg_descr_satellite_delivery_fec_inner, {
3533             "FEC Inner", "mpeg_descr.sat_delivery.fec_inner",
3534             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_satellite_delivery_fec_inner_vals_ext,
3535             MPEG_DESCR_SATELLITE_DELIVERY_FEC_INNER_MASK, NULL, HFILL
3536         } },
3537
3538         /* 0x44 Cable Delivery System Descriptor */
3539         { &hf_mpeg_descr_cable_delivery_frequency, {
3540             "Frequency", "mpeg_descr.cable_delivery.freq",
3541             FT_DOUBLE, BASE_NONE, NULL, 0, NULL, HFILL
3542         } },
3543
3544         { &hf_mpeg_descr_cable_delivery_reserved, {
3545             "Reserved", "mpeg_descr.cable_delivery.reserved",
3546             FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_CABLE_DELIVERY_RESERVED_MASK, NULL, HFILL
3547         } },
3548
3549         { &hf_mpeg_descr_cable_delivery_fec_outer, {
3550             "FEC Outer", "mpeg_descr.cable_delivery.fec_outer",
3551             FT_UINT16, BASE_HEX, VALS(mpeg_descr_cable_delivery_fec_outer_vals),
3552             MPEG_DESCR_CABLE_DELIVERY_FEC_OUTER_MASK, NULL, HFILL
3553         } },
3554
3555         { &hf_mpeg_descr_cable_delivery_modulation, {
3556             "Modulation", "mpeg_descr.cable_delivery.modulation",
3557             FT_UINT8, BASE_HEX, VALS(mpeg_descr_cable_delivery_modulation_vals), 0, NULL, HFILL
3558         } },
3559
3560         { &hf_mpeg_descr_cable_delivery_symbol_rate, {
3561             "Symbol Rate", "mpeg_descr.cable_delivery.sym_rate",
3562             FT_DOUBLE, BASE_NONE, NULL, 0, NULL, HFILL
3563         } },
3564
3565         { &hf_mpeg_descr_cable_delivery_fec_inner, {
3566             "FEC Inner", "mpeg_descr.cable_delivery.fec_inner",
3567             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_cable_delivery_fec_inner_vals_ext,
3568             MPEG_DESCR_CABLE_DELIVERY_FEC_INNER_MASK, NULL, HFILL
3569         } },
3570
3571         /* 0x45 VBI Data Descriptor */
3572         { &hf_mpeg_descr_vbi_data_service_id, {
3573             "Data Service ID", "mpeg_descr.vbi_data.svc_id",
3574             FT_UINT8, BASE_HEX, VALS(mpeg_descr_vbi_data_service_id_vals), 0, NULL, HFILL
3575         } },
3576
3577         { &hf_mpeg_descr_vbi_data_descr_len, {
3578             "Data Descriptor Length", "mpeg_descr.vbi_data.decr_len",
3579             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3580         } },
3581
3582         { &hf_mpeg_descr_vbi_data_reserved1, {
3583             "Reserved", "mpeg_descr.vbi_data.reserved1",
3584             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_VBI_DATA_RESERVED1_MASK, NULL, HFILL
3585         } },
3586
3587         { &hf_mpeg_descr_vbi_data_field_parity, {
3588             "Field Parity", "mpeg_descr.vbi_data.field_parity",
3589             FT_UINT8, BASE_DEC, VALS(mpeg_descr_vbi_data_field_parity_vals),
3590             MPEG_DESCR_VBI_DATA_FIELD_PARITY_MASK, NULL, HFILL
3591         } },
3592
3593         { &hf_mpeg_descr_vbi_data_line_offset, {
3594             "Line offset", "mpeg_descr.vbi_data.line_offset",
3595             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3596         } },
3597
3598         { &hf_mpeg_descr_vbi_data_reserved2, {
3599             "Reserved", "mpeg_descr.vbi_data.reserved2",
3600             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3601         } },
3602
3603         /* 0x47 Bouquet Name Descriptor */
3604         { &hf_mpeg_descr_bouquet_name, {
3605             "Bouquet Name Descriptor", "mpeg_descr.bouquet_name.name",
3606             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3607         } },
3608
3609         /* 0x48 Service Descriptor */
3610         { &hf_mpeg_descr_service_type, {
3611             "Service Type", "mpeg_descr.svc.type",
3612             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_service_type_vals_ext, 0, NULL, HFILL
3613         } },
3614
3615         { &hf_mpeg_descr_service_provider_name_length, {
3616             "Provider Name Length", "mpeg_descr.svc.provider_name_len",
3617             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3618         } },
3619
3620         { &hf_mpeg_descr_service_provider_name_encoding, {
3621             "Provider Name Encoding", "mpeg_descr.svc.provider_name_enc",
3622             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3623         } },
3624
3625         { &hf_mpeg_descr_service_provider, {
3626             "Service Provider Name", "mpeg_descr.svc.provider_name",
3627             FT_STRING, STR_UNICODE, NULL, 0, NULL, HFILL
3628         } },
3629
3630         { &hf_mpeg_descr_service_name_length, {
3631             "Service Name Length", "mpeg_descr.svc.svc_name_len",
3632             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3633         } },
3634
3635         { &hf_mpeg_descr_service_name_encoding, {
3636             "Service Name Encoding", "mpeg_descr.svc.svn_name_enc",
3637             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3638         } },
3639
3640         { &hf_mpeg_descr_service_name, {
3641             "Service Name", "mpeg_descr.svc.svc_name",
3642             FT_STRING, STR_UNICODE, NULL, 0, NULL, HFILL
3643         } },
3644
3645         /* 0x4A Linkage Descriptor */
3646         { &hf_mpeg_descr_linkage_transport_stream_id, {
3647             "Transport Stream ID", "mpeg_descr.linkage.tsid",
3648             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3649         } },
3650
3651         { &hf_mpeg_descr_linkage_original_network_id, {
3652             "Original Network ID", "mpeg_descr.linkage.original_nid",
3653             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3654         } },
3655
3656         { &hf_mpeg_descr_linkage_service_id, {
3657             "Service ID", "mpeg_descr.linkage.svc_id",
3658             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3659         } },
3660
3661         { &hf_mpeg_descr_linkage_linkage_type, {
3662             "Linkage Type", "mpeg_descr.linkage.type",
3663             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_linkage_linkage_type_vals_ext, 0, NULL, HFILL
3664         } },
3665
3666         { &hf_mpeg_descr_linkage_hand_over_type, {
3667             "Hand-Over Type", "mpeg_descr.linkage.hand_over_type",
3668             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LINKAGE_HAND_OVER_TYPE_MASK, NULL, HFILL
3669         } },
3670
3671         { &hf_mpeg_descr_linkage_reserved1, {
3672             "Reserved", "mpeg_descr.linkage.reserved1",
3673             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LINKAGE_RESERVED1_MASK, NULL, HFILL
3674         } },
3675
3676         { &hf_mpeg_descr_linkage_origin_type, {
3677             "Origin Type", "mpeg_descr.linkage.origin_type",
3678             FT_UINT8, BASE_HEX, VALS(mpeg_descr_linkage_origin_type_vals), 0, NULL, HFILL
3679         } },
3680
3681         { &hf_mpeg_descr_linkage_network_id, {
3682             "Network ID", "mpeg_descr.linkage.network_id",
3683             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3684         } },
3685
3686         { &hf_mpeg_descr_linkage_initial_service_id, {
3687             "Initial Service ID", "mpeg_descr.linkage.initial_svc_id",
3688             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3689         } },
3690
3691         { &hf_mpeg_descr_linkage_target_event_id, {
3692             "Target Event ID", "mpeg_descr.linkage.target_evt_id",
3693             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3694         } },
3695
3696         { &hf_mpeg_descr_linkage_target_listed, {
3697             "Target Listed", "mpeg_descr.linkage.target_listed",
3698             FT_UINT8, BASE_DEC, VALS(mpeg_descr_linkage_target_listed_vals),
3699             MPEG_DESCR_LINKAGE_TARGET_LISTED_MASK, NULL, HFILL
3700         } },
3701
3702         { &hf_mpeg_descr_linkage_event_simulcast, {
3703             "Event Simulcast", "mpeg_descr.linkage.evt_simulcast",
3704             FT_UINT8, BASE_DEC, VALS(mpeg_descr_linkage_event_simulcast_vals),
3705             MPEG_DESCR_LINKAGE_EVENT_SIMULCAST_MASK, NULL, HFILL
3706         } },
3707
3708         { &hf_mpeg_descr_linkage_reserved2, {
3709             "Reserved", "mpeg_descr.linkage.reserved2",
3710             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LINKAGE_RESERVED2_MASK, NULL, HFILL
3711         } },
3712
3713         { &hf_mpeg_descr_linkage_private_data_byte, {
3714             "Private Data", "mpeg_descr.linkage.private_data",
3715             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3716         } },
3717
3718         { &hf_mpeg_descr_linkage_interactive_network_id, {
3719             "Interactive Network ID", "mpeg_descr.interactive_network_id",
3720             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3721         } },
3722
3723         { &hf_mpeg_descr_linkage_population_id_loop_count, {
3724             "Population ID loop count", "mpeg_descr.population_id_loop_count",
3725             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3726         } },
3727
3728         { &hf_mpeg_descr_linkage_population_id, {
3729             "Population ID", "mpeg_descr.population_id",
3730             FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL
3731         } },
3732
3733         { &hf_mpeg_descr_linkage_population_id_base, {
3734             "Population ID Base", "mpeg_descr.population_id_base",
3735             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3736         } },
3737
3738         { &hf_mpeg_descr_linkage_population_id_mask, {
3739             "Population ID Mask", "mpeg_descr.population_id_mask",
3740             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3741         } },
3742
3743         /* 0x4D Short Event Descriptor */
3744         { &hf_mpeg_descr_short_event_lang_code, {
3745             "Language Code", "mpeg_descr.short_evt.lang_code",
3746             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3747         } },
3748
3749         { &hf_mpeg_descr_short_event_name_length, {
3750             "Event Name Length", "mpeg_descr.short_evt.name_len",
3751             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3752         } },
3753
3754         { &hf_mpeg_descr_short_event_name_encoding, {
3755             "Event Name Encoding", "mpeg_descr.short_evt.name_enc",
3756             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3757         } },
3758
3759         { &hf_mpeg_descr_short_event_name, {
3760             "Event Name", "mpeg_descr.short_evt.name",
3761             FT_STRING, STR_UNICODE, NULL, 0, NULL, HFILL
3762         } },
3763
3764         { &hf_mpeg_descr_short_event_text_length, {
3765             "Event Text Length", "mpeg_descr.short_evt.txt_len",
3766             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3767         } },
3768
3769         { &hf_mpeg_descr_short_event_text_encoding, {
3770             "Event Text Encoding", "mpeg_descr.short_evt.txt_enc",
3771             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3772         } },
3773
3774         { &hf_mpeg_descr_short_event_text, {
3775             "Event Text", "mpeg_descr.short_evt.txt",
3776             FT_STRING, STR_UNICODE, NULL, 0, NULL, HFILL
3777         } },
3778
3779         /* 0x4E Extended Event Descriptor */
3780         { &hf_mpeg_descr_extended_event_descriptor_number, {
3781             "Descriptor Number", "mpeg_descr.ext_evt.descr_num",
3782             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_EXTENDED_EVENT_DESCRIPTOR_NUMBER_MASK, NULL, HFILL
3783         } },
3784
3785         { &hf_mpeg_descr_extended_event_last_descriptor_number, {
3786             "Last Descriptor Number", "mpeg_descr.ext_evt.last_descr_num",
3787             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_EXTENDED_EVENT_LAST_DESCRIPTOR_NUMBER_MASK, NULL, HFILL
3788         } },
3789
3790         { &hf_mpeg_descr_extended_event_lang_code, {
3791             "Language Code", "mpeg_descr.ext_evt.lang_code",
3792             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3793         } },
3794
3795         { &hf_mpeg_descr_extended_event_length_of_items, {
3796             "Length of items", "mpeg_descr.ext_evt.items_len",
3797             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3798         } },
3799
3800         { &hf_mpeg_descr_extended_event_item_description_length, {
3801             "Item Description Length", "mpeg_descr.ext_evt.item_descr_len",
3802             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3803         } },
3804
3805         { &hf_mpeg_descr_extended_event_item_description_char, {
3806             "Item Description", "mpeg_descr.ext_evt.item_descr",
3807             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3808         } },
3809
3810         { &hf_mpeg_descr_extended_event_item_length, {
3811             "Item Length", "mpeg_descr.ext_evt.item_len",
3812             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3813         } },
3814
3815         { &hf_mpeg_descr_extended_event_item_char, {
3816             "Item", "mpeg_descr.ext_evt.item",
3817             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3818         } },
3819
3820         { &hf_mpeg_descr_extended_event_text_length, {
3821             "Text Length", "mpeg_descr.ext_evt.txt_len",
3822             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3823         } },
3824
3825         { &hf_mpeg_descr_extended_event_text_encoding, {
3826             "Text Encoding", "mpeg_descr.ext_evt.txt_enc",
3827             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
3828         } },
3829
3830         { &hf_mpeg_descr_extended_event_text, {
3831             "Text", "mpeg_descr.ext_evt.txt",
3832             FT_STRING, STR_UNICODE, NULL, 0, NULL, HFILL
3833         } },
3834
3835         /* 0x50 Component Descriptor */
3836         { &hf_mpeg_descr_component_reserved, {
3837             "Reserved", "mpeg_descr.component.reserved",
3838             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_COMPONENT_RESERVED_MASK, NULL, HFILL
3839         } },
3840
3841         { &hf_mpeg_descr_component_stream_content, {
3842             "Stream Content", "mpeg_descr.component.stream_content",
3843             FT_UINT8, BASE_HEX, VALS(mpeg_descr_component_stream_content_vals),
3844             MPEG_DESCR_COMPONENT_STREAM_CONTENT_MASK, NULL, HFILL
3845         } },
3846
3847         { &hf_mpeg_descr_component_type, {
3848             "Component Type", "mpeg_descr.component.type",
3849             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
3850         } },
3851
3852         { &hf_mpeg_descr_component_content_type, {
3853             "Stream Content and Component Type", "mpeg_descr.component.content_type",
3854             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_component_content_type_vals_ext,
3855             MPEG_DESCR_COMPONENT_CONTENT_TYPE_MASK, NULL, HFILL
3856         } },
3857
3858         { &hf_mpeg_descr_component_tag, {
3859             "Component Tag", "mpeg_descr.component.tag",
3860             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
3861         } },
3862
3863         { &hf_mpeg_descr_component_lang_code, {
3864             "Language Code", "mpeg_descr.component.lang_code",
3865             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3866         } },
3867
3868         { &hf_mpeg_descr_component_text, {
3869             "Text", "mpeg_descr.component.text",
3870             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3871         } },
3872
3873         /* 0x52 Stream Identifier Descriptor */
3874         { &hf_mpeg_descr_stream_identifier_component_tag, {
3875             "Component Tag", "mpeg_descr.stream_id.component_tag",
3876             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
3877         } },
3878
3879         /* 0x53 CA Identifier Descriptor */
3880         { &hf_mpeg_descr_ca_identifier_system_id, {
3881             "CA System ID", "mpeg_descr.ca_id.sys_id",
3882             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
3883         } },
3884
3885         /* 0x54 Content Descriptor */
3886         { &hf_mpeg_descr_content_nibble, {
3887             "Nibble Level 1 and 2", "mpeg_descr.content.nibble_1_2",
3888             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_content_nibble_vals_ext, 0, NULL, HFILL
3889         } },
3890
3891         { &hf_mpeg_descr_content_nibble_level_1, {
3892             "Nibble Level 1", "mpeg_descr.content.nibble_lvl_1",
3893             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_content_nibble_level_1_vals_ext,
3894             MPEG_DESCR_CONTENT_NIBBLE_LEVEL_1_MASK, NULL, HFILL
3895         } },
3896
3897         { &hf_mpeg_descr_content_nibble_level_2, {
3898             "Nibble Level 2", "mpeg_descr.content.nibble_lvl_2",
3899             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_CONTENT_NIBBLE_LEVEL_2_MASK, NULL, HFILL
3900         } },
3901
3902         { &hf_mpeg_descr_content_user_byte, {
3903             "User Byte", "mpeg_descr.content.user",
3904             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
3905         } },
3906
3907         /* 0x56 Teletext Descriptor */
3908         { &hf_mpeg_descr_teletext_lang_code, {
3909             "Language Code", "mpeg_descr.teletext.lang_code",
3910             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3911         } },
3912
3913         { &hf_mpeg_descr_teletext_type, {
3914             "Teletext Type", "mpeg_descr.teletext.type",
3915             FT_UINT8, BASE_HEX, VALS(mpeg_descr_teletext_type_vals),
3916             MPEG_DESCR_TELETEXT_TYPE_MASK, NULL, HFILL
3917         } },
3918
3919         { &hf_mpeg_descr_teletext_magazine_number, {
3920             "Magazine Number", "mpeg_descr.teletext.magazine_num",
3921             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_TELETEXT_MAGAZINE_NUMBER_MASK, NULL, HFILL
3922         } },
3923
3924         { &hf_mpeg_descr_teletext_page_number, {
3925             "Page Number", "mpeg_descr.teletext.page_num",
3926             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
3927         } },
3928
3929         /* 0x55 Parental Rating Descriptor */
3930         { &hf_mpeg_descr_parental_rating_country_code, {
3931             "Country Code", "mpeg_descr.parental_rating.country_code",
3932             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3933         } },
3934
3935         { &hf_mpeg_descr_parental_rating_rating, {
3936             "Rating", "mpeg_descr.parental_rating.rating",
3937             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_parental_rating_vals_ext, 0, NULL, HFILL
3938         } },
3939
3940         /* 0x58 Local Time Offset Descriptor */
3941         { &hf_mpeg_descr_local_time_offset_country_code, {
3942             "Country Code", "mpeg_descr.local_time_offset.country_code",
3943             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3944         } },
3945
3946         { &hf_mpeg_descr_local_time_offset_region_id, {
3947             "Region ID", "mpeg_descr.local_time_offset.region_id",
3948             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOCAL_TIME_OFFSET_COUNTRY_REGION_ID_MASK, NULL, HFILL
3949         } },
3950
3951         { &hf_mpeg_descr_local_time_offset_reserved, {
3952             "Reserved", "mpeg_descr.local_time_offset.reserved",
3953             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOCAL_TIME_OFFSET_RESERVED_MASK, NULL, HFILL
3954         } },
3955
3956         { &hf_mpeg_descr_local_time_offset_polarity, {
3957             "Time Offset Polarity", "mpeg_descr.local_time_offset.polarity",
3958             FT_UINT8, BASE_HEX, VALS(mpeg_descr_local_time_offset_polarity_vals),
3959             MPEG_DESCR_LOCAL_TIME_OFFSET_POLARITY, NULL, HFILL
3960         } },
3961
3962         { &hf_mpeg_descr_local_time_offset_offset, {
3963             "Local Time Offset", "mpeg_descr.local_time_offset.offset",
3964             FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL
3965         } },
3966
3967         { &hf_mpeg_descr_local_time_offset_time_of_change, {
3968             "Time of Change", "mpeg_descr.local_time_offset.time_of_change",
3969             FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0, NULL, HFILL
3970         } },
3971
3972         { &hf_mpeg_descr_local_time_offset_next_time_offset, {
3973             "Next Time Offset", "mpeg_descr.local_time_offset.next_time_offset",
3974             FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL
3975         } },
3976
3977         /* 0x59 Subtitling Descriptor */
3978         { &hf_mpeg_descr_subtitling_lang_code, {
3979             "Language Code", "mpeg_descr.subtitling.lang_code",
3980             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
3981         } },
3982
3983         { &hf_mpeg_descr_subtitling_type, {
3984             "Subtitling Type", "mpeg_descr.subtitling.type",
3985             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_subtitling_type_vals_ext, 0, NULL, HFILL
3986         } },
3987
3988         { &hf_mpeg_descr_subtitling_composition_page_id, {
3989             "Composition Page ID", "mpeg_descr.subtitling.composition_page_id",
3990             FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL
3991         } },
3992
3993         { &hf_mpeg_descr_subtitling_ancillary_page_id, {
3994             "Ancillary Page ID", "mpeg_descr.subtitling.ancillary_page_id",
3995             FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL
3996         } },
3997
3998         /* 0x5A Terrestrial Delivery System Descriptor */
3999         { &hf_mpeg_descr_terrestrial_delivery_centre_frequency, {
4000             "Centre Frequency", "mpeg_descr.terr_delivery.centre_freq",
4001             FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL
4002         } },
4003
4004         { &hf_mpeg_descr_terrestrial_delivery_bandwidth, {
4005             "Bandwidth", "mpeg_descr.terr_delivery.bandwidth",
4006             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_bandwidth_vals),
4007             MPEG_DESCR_TERRESTRIAL_DELIVERY_BANDWIDTH_MASK, NULL, HFILL
4008         } },
4009
4010         { &hf_mpeg_descr_terrestrial_delivery_priority, {
4011             "Priority", "mpeg_descr.terr_delivery.priority",
4012             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_priority_vals),
4013             MPEG_DESCR_TERRESTRIAL_DELIVERY_PRIORITY_MASK, NULL, HFILL
4014         } },
4015
4016         { &hf_mpeg_descr_terrestrial_delivery_time_slicing_indicator, {
4017             "Time Slicing Indicator", "mpeg_descr.terr_delivery.time_slicing_ind",
4018             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_time_slicing_indicator_vals),
4019             MPEG_DESCR_TERRESTRIAL_DELIVERY_TIME_SLICING_INDICATOR_MASK, NULL, HFILL
4020         } },
4021
4022         { &hf_mpeg_descr_terrestrial_delivery_mpe_fec_indicator, {
4023             "MPE-FEC Indicator", "mpeg_descr.terr_delivery.mpe_fec_ind",
4024             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_mpe_fec_indicator_vals),
4025             MPEG_DESCR_TERRESTRIAL_DELIVERY_MPE_FEC_INDICATOR_MASK, NULL, HFILL
4026         } },
4027
4028         { &hf_mpeg_descr_terrestrial_delivery_reserved1, {
4029             "Reserved", "mpeg_descr.terr_delivery.reserved1",
4030             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_TERRESTRIAL_DELIVERY_RESERVED1_MASK, NULL, HFILL
4031         } },
4032
4033         { &hf_mpeg_descr_terrestrial_delivery_constellation, {
4034             "Constellation", "mpeg_descr.terr_delivery.constellation",
4035             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_constellation_vals),
4036             MPEG_DESCR_TERRESTRIAL_DELIVERY_CONSTELLATION_MASK, NULL, HFILL
4037         } },
4038
4039         { &hf_mpeg_descr_terrestrial_delivery_hierarchy_information, {
4040             "Hierarchy Information", "mpeg_descr.terr_delivery.hierarchy_information",
4041             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_hierarchy_information_vals),
4042             MPEG_DESCR_TERRESTRIAL_DELIVERY_HIERARCHY_INFORMATION_MASK, NULL, HFILL
4043         } },
4044
4045         { &hf_mpeg_descr_terrestrial_delivery_code_rate_hp_stream, {
4046             "Code Rate High Priority Stream", "mpeg_descr.terr_delivery.code_rate_hp_stream",
4047             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_code_rate_vals),
4048             MPEG_DESCR_TERRESTRIAL_DELIVERY_CODE_RATE_HP_STREAM_MASK, NULL, HFILL
4049         } },
4050
4051         { &hf_mpeg_descr_terrestrial_delivery_code_rate_lp_stream, {
4052             "Code Rate Low Priority Stream", "mpeg_descr.terr_delivery.code_rate_lp_stream",
4053             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_code_rate_vals),
4054             MPEG_DESCR_TERRESTRIAL_DELIVERY_CODE_RATE_LP_STREAM_MASK, NULL, HFILL
4055         } },
4056
4057         { &hf_mpeg_descr_terrestrial_delivery_guard_interval, {
4058             "Guard Interval", "mpeg_descr.terr_delivery.guard_interval",
4059             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_guard_interval_vals),
4060             MPEG_DESCR_TERRESTRIAL_DELIVERY_GUARD_INTERVAL_MASK, NULL, HFILL
4061         } },
4062
4063         { &hf_mpeg_descr_terrestrial_delivery_transmission_mode, {
4064             "Transmission Mode", "mpeg_descr.terr_delivery.transmission_mode",
4065             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_transmission_mode_vals),
4066             MPEG_DESCR_TERRESTRIAL_DELIVERY_TRANSMISSION_MODE_MASK, NULL, HFILL
4067         } },
4068
4069         { &hf_mpeg_descr_terrestrial_delivery_other_frequency_flag, {
4070             "Other Frequency Flag", "mpeg_descr.terr_delivery.other_freq_flag",
4071             FT_UINT8, BASE_HEX, VALS(mpeg_descr_terrestrial_delivery_other_frequency_flag_vals),
4072             MPEG_DESCR_TERRESTRIAL_DELIVERY_OTHER_FREQUENCY_FLAG_MASK, NULL, HFILL
4073         } },
4074
4075         { &hf_mpeg_descr_terrestrial_delivery_reserved2, {
4076             "Reserved", "mpeg_descr.terr_delivery.reserved2",
4077             FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL
4078         } },
4079
4080
4081         /* 0x5F Private Data Specifier */
4082         { &hf_mpeg_descr_private_data_specifier_id, {
4083             "Private Data Specifier", "mpeg_descr.private_data_specifier.id",
4084             FT_UINT32, BASE_HEX, VALS(mpeg_descr_data_specifier_id_vals), 0, NULL, HFILL
4085         } },
4086
4087         /* 0x64 Data Broadcast Descriptor */
4088         { &hf_mpeg_descr_data_bcast_bcast_id, {
4089             "Data Broadcast ID", "mpeg_descr.data_bcast.id",
4090             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_data_bcast_id_vals_ext, 0, NULL, HFILL
4091         } },
4092
4093         { &hf_mpeg_descr_data_bcast_component_tag, {
4094             "Component Tag", "mpeg_descr.data_bcast.component_tag",
4095             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
4096         } },
4097
4098         { &hf_mpeg_descr_data_bcast_selector_len, {
4099             "Selector Length", "mpeg_descr.data_bcast.selector_len",
4100             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
4101         } },
4102
4103         { &hf_mpeg_descr_data_bcast_selector_bytes, {
4104             "Selector Bytes", "mpeg_descr.data_bcast.selector_bytes",
4105             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
4106         } },
4107
4108         { &hf_mpeg_descr_data_bcast_lang_code, {
4109             "Language Code", "mpeg_descr.data_bcast.lang_code",
4110             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
4111         } },
4112
4113         { &hf_mpeg_descr_data_bcast_text_len, {
4114             "Text Length", "mpeg_descr.data_bcast.text_len",
4115             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
4116         } },
4117
4118         { &hf_mpeg_descr_data_bcast_text, {
4119             "Text", "mpeg_descr.data_bcast.text",
4120             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
4121         } },
4122
4123         /* 0x66 Data Broadcast ID Descriptor */
4124         { &hf_mpeg_descr_data_bcast_id_bcast_id, {
4125             "Data Broadcast ID", "mpeg_descr.data_bcast_id.id",
4126             FT_UINT16, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_data_bcast_id_vals_ext, 0, NULL, HFILL
4127         } },
4128
4129         { &hf_mpeg_descr_data_bcast_id_id_selector_bytes, {
4130             "ID Selector Bytes", "mpeg_descr.data_bcast_id.id_selector_bytes",
4131             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
4132         } },
4133
4134         /* 0x6A AC-3 Descriptor */
4135         { &hf_mpeg_descr_ac3_component_type_flag, {
4136             "Component Type Flag", "mpeg_descr.ac3.component_type_flag",
4137             FT_UINT8, BASE_DEC, VALS(mpeg_descr_ac3_component_type_flag_vals),
4138             MPEG_DESCR_AC3_COMPONENT_TYPE_FLAG_MASK, NULL, HFILL
4139         } },
4140
4141         { &hf_mpeg_descr_ac3_bsid_flag, {
4142             "BSID Flag", "mpeg_descr.ac3.bsid_flag",
4143             FT_UINT8, BASE_DEC, VALS(mpeg_descr_ac3_bsid_flag_vals),
4144             MPEG_DESCR_AC3_BSID_FLAG_MASK, NULL, HFILL
4145         } },
4146
4147         { &hf_mpeg_descr_ac3_mainid_flag, {
4148             "Main ID Flag", "mpeg_descr.ac3_main_id_flag",
4149             FT_UINT8, BASE_DEC, VALS(mpeg_descr_ac3_mainid_flag_vals),
4150             MPEG_DESCR_AC3_MAINID_FLAG_MASK, NULL, HFILL
4151         } },
4152
4153         { &hf_mpeg_descr_ac3_asvc_flag, {
4154             "ASVC Flag", "mpeg_descr.ac3.asvc_flag",
4155             FT_UINT8, BASE_DEC, VALS(mpeg_descr_ac3_asvc_flag_vals),
4156             MPEG_DESCR_AC3_ASVC_FLAG_MASK, NULL, HFILL
4157         } },
4158
4159         { &hf_mpeg_descr_ac3_reserved, {
4160             "Reserved", "mpeg_descr.ac3.reserved",
4161             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_AC3_RESERVED_MASK, NULL, HFILL
4162         } },
4163
4164         { &hf_mpeg_descr_ac3_component_type_reserved_flag, {
4165             "Type Reserved Flag", "mpeg_descr.ac3.component_type.reserved_flag",
4166             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_AC3_COMPONENT_TYPE_RESERVED_FLAG_MASK, NULL, HFILL
4167         } },
4168
4169         { &hf_mpeg_descr_ac3_component_type_full_service_flag, {
4170             "Full Service Flag", "mpeg_descr.ac3.component_type.full_service_flag",
4171             FT_UINT8, BASE_HEX, VALS(mpeg_descr_ac3_component_type_full_service_flag_vals),
4172             MPEG_DESCR_AC3_COMPONENT_TYPE_FULL_SERVICE_FLAG_MASK, NULL, HFILL
4173         } },
4174
4175         { &hf_mpeg_descr_ac3_component_type_service_type_flags, {
4176             "Service Type Flags", "mpeg_descr.ac3.component_type.service_type_flags",
4177             FT_UINT8, BASE_HEX, VALS(mpeg_descr_ac3_component_type_service_type_flags_vals),
4178             MPEG_DESCR_AC3_COMPONENT_TYPE_SERVICE_TYPE_FLAGS_MASK, NULL, HFILL
4179         } },
4180
4181         { &hf_mpeg_descr_ac3_component_type_number_of_channels_flags, {
4182             "Number of Channels Flags", "mpeg_descr.ac3.component_type.number_chan_flags",
4183             FT_UINT8, BASE_HEX, VALS(mpeg_descr_ac3_component_type_number_of_channels_flags_vals),
4184             MPEG_DESCR_AC3_COMPONENT_TYPE_NUMBER_OF_CHANNELS_FLAGS, NULL, HFILL
4185         } },
4186
4187         { &hf_mpeg_descr_ac3_bsid, {
4188             "BSID", "mpeg_descr.ac3.bsid",
4189             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
4190         } },
4191
4192         { &hf_mpeg_descr_ac3_mainid, {
4193             "Main ID", "mpeg_descr.ac3.mainid",
4194             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
4195         } },
4196
4197         { &hf_mpeg_descr_ac3_asvc, {
4198             "ASVC", "mpeg_descr.ac3.asvc",
4199             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
4200         } },
4201
4202         { &hf_mpeg_descr_ac3_additional_info, {
4203             "Additional Info", "mpeg_descr.ac3.additional_info",
4204             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
4205         } },
4206
4207         /* 0x6F Application Signalling Descriptor */
4208         { &hf_mpeg_descr_app_sig_app_type, {
4209             "Application type", "mpeg_descr.app_sig.app_type",
4210             FT_UINT16, BASE_HEX, NULL, 0x7FFF, NULL, HFILL
4211         } },
4212
4213         { &hf_mpeg_descr_app_sig_ait_ver, {
4214             "AIT version", "mpeg_descr.app_sig.ait_ver",
4215             FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL
4216         } },
4217
4218         /* 0x73 Default Authority Descriptor */
4219         { &hf_mpeg_descr_default_authority_name, {
4220             "Default Authority Name", "mpeg_descr.default_authority.name",
4221             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
4222         } },
4223
4224         /* 0x77 Content Identifier Descriptor */
4225         { &hf_mpeg_descr_content_identifier_crid_type, {
4226             "CRID Type", "mpeg_descr.content_identifier.crid_type",
4227             FT_UINT8, BASE_HEX, VALS(mpeg_descr_content_identifier_crid_type_vals),
4228             MPEG_DESCR_CONTENT_IDENTIFIER_CRID_TYPE_MASK, NULL, HFILL
4229         } },
4230
4231         { &hf_mpeg_descr_content_identifier_crid_location, {
4232             "CRID Location", "mpeg_descr.content_identifier.crid_location",
4233             FT_UINT8, BASE_HEX, VALS(mpeg_descr_content_identifier_crid_location_vals),
4234             MPEG_DESCR_CONTENT_IDENTIFIER_CRID_LOCATION_MASK, NULL, HFILL
4235         } },
4236
4237         { &hf_mpeg_descr_content_identifier_crid_length, {
4238             "CRID Length", "mpeg_descr.content_identifier.crid_len",
4239             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
4240         } },
4241
4242         { &hf_mpeg_descr_content_identifier_crid_bytes, {
4243             "CRID Bytes", "mpeg_descr.content_identifier.crid_bytes",
4244             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
4245         } },
4246
4247         { &hf_mpeg_descr_content_identifier_cird_ref, {
4248             "CRID Reference", "mpeg_descr.content_identifier.crid_ref",
4249             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
4250         } },
4251
4252         /* 0x7F Extension Descriptor */
4253         { &hf_mpeg_descr_extension_tag_extension, {
4254             "Descriptor Tag Extension", "mpeg_descr.ext.tag",
4255             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_extension_tag_extension_vals_ext, 0, NULL, HFILL
4256         } },
4257
4258         { &hf_mpeg_descr_extension_data, {
4259             "Descriptor Extension Data", "mpeg_descr.ext.data",
4260             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
4261         } },
4262
4263         /* Supplementary Audio Descriptor (part of Extension Descriptor) */
4264         { &hf_mpeg_descr_extension_supp_audio_mix_type, {
4265             "Mix type", "mpeg_descr.ext.supp_audio.mix_type",
4266             FT_UINT8, BASE_HEX, VALS(supp_audio_mix_type_vals), 0x80, NULL, HFILL
4267         } },
4268
4269         { &hf_mpeg_descr_extension_supp_audio_ed_cla, {
4270             "Editorial classification", "mpeg_descr.ext.supp_audio.ed_cla",
4271             FT_UINT8, BASE_HEX, VALS(supp_audio_ed_cla), 0x7C, NULL, HFILL
4272         } },
4273
4274         { &hf_mpeg_descr_extension_supp_audio_lang_code_present, {
4275             "Language code present", "mpeg_descr.ext.supp_audio.lang_code_present",
4276             FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL
4277         } },
4278
4279         { &hf_mpeg_descr_extension_supp_audio_lang_code, {
4280             "ISO 639 language code", "mpeg_descr.ext.supp_audio.lang_code",
4281             FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
4282         } },
4283
4284         { &hf_mpeg_descr_private_data, {
4285             "Private data", "mpeg_descr.private_data",
4286             FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
4287         } },
4288
4289         /* 0x81 ATSC A/52 AC-3 Descriptor */
4290         { &hf_mpeg_descr_ac3_sysa_srate, {
4291             "Sample Rate", "mpeg_descr.ac3.sysa_sample_rate",
4292             FT_UINT8, BASE_HEX, VALS(mpeg_descr_ac3_sysa_srate_flag_vals),
4293             MPEG_DESCR_AC3_SYSA_SRATE_MASK, NULL, HFILL
4294         } },
4295
4296         { &hf_mpeg_descr_ac3_sysa_bsid, {
4297             "bsid", "mpeg_descr.ac3.sysa_bsid",
4298             FT_UINT8, BASE_HEX, NULL,  MPEG_DESCR_AC3_SYSA_BSID_MASK, NULL, HFILL
4299         } },
4300
4301         { &hf_mpeg_descr_ac3_sysa_bitrate_limit, {
4302             "Bitrate Code limit type", "mpeg_descr.ac3.sysa_bitrate_code_limit",
4303             FT_UINT8, BASE_HEX, VALS(mpeg_descr_ac3_sysa_bitrate_code_limit_vals),
4304             MPEG_DESCR_AC3_SYSA_BITRATE_CODE_LIMIT_MASK, NULL, HFILL
4305         } },
4306
4307         { &hf_mpeg_descr_ac3_sysa_bitrate, {
4308             "Bitrate Code", "mpeg_descr.ac3.sysa_bitrate_code",
4309             FT_UINT8, BASE_HEX, VALS(mpeg_descr_ac3_sysa_bitrate_code_vals),
4310             MPEG_DESCR_AC3_SYSA_BITRATE_CODE_MASK, NULL, HFILL
4311         } },
4312
4313         { &hf_mpeg_descr_ac3_sysa_surround, {
4314             "Surround Mode", "mpeg_descr.ac3.sysa_surround_mode",
4315             FT_UINT8, BASE_HEX, VALS(mpeg_descr_ac3_sysa_surround_mode_vals),
4316             MPEG_DESCR_AC3_SYSA_SURROUND_MODE_MASK, NULL, HFILL
4317         } },
4318
4319         { &hf_mpeg_descr_ac3_sysa_bsmod, {
4320             "Bsmod", "mpeg_descr.ac3.sysa_bsmod",
4321             FT_UINT8, BASE_HEX, NULL,  MPEG_DESCR_AC3_SYSA_BSMOD_MASK, NULL, HFILL
4322         } },
4323
4324         { &hf_mpeg_descr_ac3_sysa_num_channels, {
4325             "Number of Channels", "mpeg_descr.ac3.sysa_num_channels",
4326             FT_UINT8, BASE_HEX, VALS(mpeg_descr_ac3_sysa_num_channels_vals),
4327             MPEG_DESCR_AC3_SYSA_NUM_CHANNELS_MASK, NULL, HFILL
4328         } },
4329
4330         { &hf_mpeg_descr_ac3_sysa_full_svc, {
4331             "Full Service", "mpeg_descr.ac3.sysa_full_svc",
4332             FT_UINT8, BASE_HEX, NULL,  MPEG_DESCR_AC3_SYSA_FULL_SVC_MASK, NULL, HFILL
4333         } },
4334
4335         { &hf_mpeg_descr_ac3_sysa_langcode, {
4336             "Language Code (Deprecated)", "mpeg_descr.ac3.sysa_langcode",
4337             FT_UINT8, BASE_HEX, NULL,  0xff, NULL, HFILL
4338         } },
4339
4340         { &hf_mpeg_descr_ac3_sysa_langcode2, {
4341             "Language Code 2 (Deprecated)", "mpeg_descr.ac3.sysa_langcode2",
4342             FT_UINT8, BASE_HEX, NULL,  0xff, NULL, HFILL
4343         } },
4344
4345         { &hf_mpeg_descr_ac3_sysa_mainid, {
4346             "Main ID", "mpeg_descr.ac3.sysa_mainid",
4347             FT_UINT8, BASE_HEX, NULL,  MPEG_DESCR_AC3_SYSA_MAINID_MASK, NULL, HFILL
4348         } },
4349
4350         { &hf_mpeg_descr_ac3_sysa_priority, {
4351             "Priority", "mpeg_descr.ac3.sysa_priority",
4352             FT_UINT8, BASE_HEX, VALS(mpeg_descr_ac3_sysa_priority_vals),
4353             MPEG_DESCR_AC3_SYSA_PRIORITY_MASK, NULL, HFILL
4354         } },
4355
4356         { &hf_mpeg_descr_ac3_sysa_reserved, {
4357             "Reserved", "mpeg_descr.ac3.sysa_reserved",
4358             FT_UINT8, BASE_HEX, NULL,  MPEG_DESCR_AC3_SYSA_RESERVED_MASK, NULL, HFILL
4359         } },
4360
4361         { &hf_mpeg_descr_ac3_sysa_asvcflags, {
4362             "Associated Service Flags", "mpeg_descr.ac3.sysa_asvcflags",
4363             FT_UINT8, BASE_HEX, NULL,  0xff, NULL, HFILL
4364         } },
4365
4366         { &hf_mpeg_descr_ac3_sysa_textlen, {
4367             "Text length", "mpeg_descr.ac3.sysa_textlen",
4368             FT_UINT8, BASE_HEX, NULL,  MPEG_DESCR_AC3_SYSA_TEXTLEN_MASK, NULL, HFILL
4369         } },
4370
4371         { &hf_mpeg_descr_ac3_sysa_textcode, {
4372             "Text Code", "mpeg_descr.ac3.sysa_textcode",
4373             FT_UINT8, BASE_HEX, NULL,  MPEG_DESCR_AC3_SYSA_TEXTCODE_MASK, NULL, HFILL
4374         } },
4375
4376         { &hf_mpeg_descr_ac3_sysa_lang1, {
4377             "Language 1 Present", "mpeg_descr.ac3.sysa_lang1",
4378             FT_UINT8, BASE_HEX, NULL,  MPEG_DESCR_AC3_SYSA_LANG1_MASK, NULL, HFILL
4379         } },
4380
4381         { &hf_mpeg_descr_ac3_sysa_lang2, {
4382             "Language 2 Present", "mpeg_descr.ac3.sysa_lang2",
4383             FT_UINT8, BASE_HEX, NULL,  MPEG_DESCR_AC3_SYSA_LANG2_MASK, NULL, HFILL
4384         } },
4385
4386         { &hf_mpeg_descr_ac3_sysa_lang1_bytes, {
4387             "Language 1 ISO 639 language code", "mpeg_descr.ac3.sysa_lang1_bytes",
4388             FT_STRING, BASE_NONE, NULL,  0, NULL, HFILL
4389         } },
4390
4391         { &hf_mpeg_descr_ac3_sysa_lang2_bytes, {
4392             "Language 2 ISO 639 language code", "mpeg_descr.ac3.sysa_lang2_bytes",
4393             FT_STRING, BASE_NONE, NULL,  0, NULL, HFILL
4394         } },
4395
4396         /* 0xA2 Logon Initialize Descriptor */
4397         { &hf_mpeg_descr_logon_initialize_group_id, {
4398             "Group ID", "mpeg_descr.logon_init.group_id",
4399             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
4400         } },
4401
4402         { &hf_mpeg_descr_logon_initialize_logon_id, {
4403             "Logon ID", "mpeg_descr.logon_init.logon_id",
4404             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
4405         } },
4406
4407         { &hf_mpeg_descr_logon_initialize_continuous_carrier_reserved, {
4408             "Continuous Carrier Reserved", "mpeg_descr.logon_init.continuous_carrier_reserved",
4409             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_CONTINUOUS_CARRIER_RESERVED_MASK, NULL, HFILL
4410         } },
4411
4412         { &hf_mpeg_descr_logon_initialize_continuous_carrier, {
4413             "Continuous Carrier", "mpeg_descr.logon_init.continuous_carrier",
4414             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_CONTINUOUS_CARRIER_MASK, NULL, HFILL
4415         } },
4416
4417         { &hf_mpeg_descr_logon_initialize_security_handshake_required, {
4418             "Security Handshake Required", "mpeg_descr.logon_init.security_handshake_required",
4419             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_SECURITY_HANDSHAKE_REQUIRED_MASK, NULL, HFILL
4420         } },
4421
4422         { &hf_mpeg_descr_logon_initialize_prefix_flag, {
4423             "Prefix Flag", "mpeg_descr.logon_init.prefix_flag",
4424             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_PREFIX_FLAG_MASK, NULL, HFILL
4425         } },
4426
4427         { &hf_mpeg_descr_logon_initialize_data_unit_labelling_flag, {
4428             "Unit Labelling Flag", "mpeg_descr.logon_init.data_unit_labelling_flag",
4429             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_DATA_UNIT_LABELLING_FLAG_MASK, NULL, HFILL
4430         } },
4431
4432         { &hf_mpeg_descr_logon_initialize_mini_slot_flag, {
4433             "Mini Slot Flag", "mpeg_descr.logon_init.mini_slot_flag",
4434             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_MINI_SLOT_FLAG_MASK, NULL, HFILL
4435         } },
4436
4437         { &hf_mpeg_descr_logon_initialize_contention_based_mini_slot_flag, {
4438             "Contention Based Mini Slot Flag", "mpeg_descr.logon_init.contention_based_mini_slot_flag",
4439             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_CONTENTION_BASED_MINI_SLOT_FLAG_MASK, NULL, HFILL
4440         } },
4441
4442         { &hf_mpeg_descr_logon_initialize_capacity_type_flag_reserved, {
4443             "Capacity Type Flag Reserved", "mpeg_descr.logon_init.capactity_type_flag_reserved",
4444             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_CAPACITY_TYPE_FLAG_RESERVED_MASK, NULL, HFILL
4445         } },
4446
4447         { &hf_mpeg_descr_logon_initialize_capacity_type_flag, {
4448             "Capacity Type Flag", "mpeg_descr.logon_init.capactity_type_flag",
4449             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_CAPACITY_TYPE_FLAG_MASK, NULL, HFILL
4450         } },
4451
4452         { &hf_mpeg_descr_logon_initialize_traffic_burst_type, {
4453             "Traffic Burst Type", "mpeg_descr.logon_init.traffic_burst_type",
4454             FT_UINT8, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_TRAFFIC_BURST_TYPE_MASK, NULL, HFILL
4455         } },
4456
4457         { &hf_mpeg_descr_logon_initialize_return_trf_pid, {
4458             "Return TRF PID", "mpeg_descr.logon_init.return_trf_pid",
4459             FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_TRF_PID_MASK, NULL, HFILL
4460         } },
4461
4462         { &hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid_reserved, {
4463             "Return CTRL MNGM PID Reserved", "mpeg_descr.logon_init.return_mngm_pid_reserved",
4464             FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_CTRL_MNGM_PID_RESERVED_MASK, NULL, HFILL
4465         } },
4466
4467         { &hf_mpeg_descr_logon_initialize_return_ctrl_mngm_pid, {
4468             "Return CTRL MNGM PID", "mpeg_descr.logon_init.return_mngm_pid",
4469             FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_CTRL_MNGM_PID_MASK, NULL, HFILL
4470         } },
4471
4472         { &hf_mpeg_descr_logon_initialize_connectivity, {
4473             "Connectivity", "mpeg_descr.logon_init.connectivity",
4474             FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_CONNECTIVITY_MASK, NULL, HFILL
4475         } },
4476
4477         { &hf_mpeg_descr_logon_initialize_return_vpi_reserved, {
4478             "Return VPI Reserved", "mpeg_descr.logon_init.return_vpi_reserved",
4479             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_VPI_RESERVED_MASK, NULL, HFILL
4480         } },
4481
4482         { &hf_mpeg_descr_logon_initialize_return_vpi, {
4483             "Return VPI", "mpeg_descr.logon_init.return_vpi",
4484             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_VPI_MASK, NULL, HFILL
4485         } },
4486
4487         { &hf_mpeg_descr_logon_initialize_return_vci, {
4488             "Return VCI", "mpeg_descr.logon_init.return_vci",
4489             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
4490         } },
4491
4492         { &hf_mpeg_descr_logon_initialize_return_signalling_vpi_reserved, {
4493             "Return Signalling VPI Reserved", "mpeg_descr.logon_init.return_signalling_vpi_reserved",
4494             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_RESERVED_MASK, NULL, HFILL
4495         } },
4496
4497         { &hf_mpeg_descr_logon_initialize_return_signalling_vpi, {
4498             "Return Signalling VPI", "mpeg_descr.logon_init.return_signalling_vpi",
4499             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_MASK, NULL, HFILL
4500         } },
4501
4502         { &hf_mpeg_descr_logon_initialize_return_signalling_vci, {
4503             "Return Signalling VCI", "mpeg_descr.logon_init.return_signalling_vci",
4504             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
4505         } },
4506
4507         { &hf_mpeg_descr_logon_initialize_forward_signalling_vpi_reserved, {
4508             "Forward Signalling VPI Reserved", "mpeg_descr.logon_init.forward_signalling_vpi_reserved",
4509             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_RESERVED_MASK, NULL, HFILL
4510         } },
4511
4512         { &hf_mpeg_descr_logon_initialize_forward_signalling_vpi, {
4513             "Forward Signalling VPI", "mpeg_descr.logon_init.forward_signalling_vpi",
4514             FT_UINT8, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_RETURN_SIGNALLING_VPI_MASK, NULL, HFILL
4515         } },
4516
4517         { &hf_mpeg_descr_logon_initialize_forward_signalling_vci, {
4518             "Forward Signalling VCI", "mpeg_descr.logon_init.forward_signalling_vci",
4519             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
4520         } },
4521
4522         { &hf_mpeg_descr_logon_initialize_cra_level, {
4523             "CRA Level", "mpeg_descr.logon_init.cra_level",
4524             FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL
4525         } },
4526
4527         { &hf_mpeg_descr_logon_initialize_vbdc_max_reserved, {
4528             "VDBC Max Reserved", "mpeg_descr.logon_init.vdbc_max_reserved",
4529             FT_UINT16, BASE_HEX, NULL, MPEG_DESCR_LOGON_INITIALIZE_VDBC_MAX_RESERVED_MASK, NULL, HFILL
4530         } },
4531
4532         { &hf_mpeg_descr_logon_initialize_vbdc_max, {
4533             "VDBC Max", "mpeg_descr.logon_init.vdbc_max",
4534             FT_UINT16, BASE_DEC, NULL, MPEG_DESCR_LOGON_INITIALIZE_VDBC_MAX_MASK, NULL, HFILL
4535         } },
4536
4537         { &hf_mpeg_descr_logon_initialize_rbdc_max, {
4538             "RDBC Max", "mpeg_descr.logon_init.rdbc_max",
4539             FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL
4540         } },
4541
4542         { &hf_mpeg_descr_logon_initialize_rbdc_timeout, {
4543             "RDBC Timeout", "mpeg_descr.logon_init.rdbc_timeout",
4544             FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL
4545         } },
4546
4547         /* 0xA7 RCS Content Descriptor */
4548         { &hf_mpeg_descr_rcs_content_table_id, {
4549             "Table ID", "mpeg_descr.rcs_content.tid",
4550             FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
4551         } },
4552
4553         /* 0xCB CI+ Content Label Descriptor */
4554         { &hf_mpeg_descr_ciplus_cl_cb_min, {
4555            "Content byte minimum value", "mpeg_descr.ciplus_content_label.content_byte_min",
4556            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
4557         } },
4558
4559         { &hf_mpeg_descr_ciplus_cl_cb_max, {
4560            "Content byte maximum value", "mpeg_descr.ciplus_content_label.content_byte_max",
4561            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL
4562         } },
4563
4564         { &hf_mpeg_descr_ciplus_cl_lang, {
4565          "ISO 639 language code", "mpeg_descr.ciplus_content_label.lang_code",
4566          FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
4567         } },
4568
4569         { &hf_mpeg_descr_ciplus_cl_label, {
4570           "Content label", "mpeg_descr.ciplus_content_label.label",
4571           FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
4572         } },
4573
4574         /* 0xCC CI+ Service Descriptor */
4575         { &hf_mpeg_descr_ciplus_svc_id, {
4576             "Service ID", "mpeg_descr.ciplus_svc.id",
4577             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
4578         } },
4579
4580         { &hf_mpeg_descr_ciplus_svc_type, {
4581             "Service type", "mpeg_descr.ciplus_svc.type",
4582             FT_UINT8, BASE_HEX | BASE_EXT_STRING, &mpeg_descr_service_type_vals_ext, 0, NULL, HFILL
4583         } },
4584
4585         { &hf_mpeg_descr_ciplus_svc_visible, {
4586             "Visible Service Flag", "mpeg_descr.ciplus_svc.visible",
4587             FT_UINT16, BASE_HEX, NULL, 0x8000, NULL, HFILL
4588         } },
4589
4590         { &hf_mpeg_descr_ciplus_svc_selectable, {
4591             "Selectable Service Flag", "mpeg_descr.ciplus_svc.selectable",
4592             FT_UINT16, BASE_HEX, NULL, 0x4000, NULL, HFILL
4593         } },
4594
4595         { &hf_mpeg_descr_ciplus_svc_lcn, {
4596             "Logical Channel Number", "mpeg_descr.ciplus_svc.lcn",
4597             FT_UINT16, BASE_DEC, NULL, 0x3FFF, NULL, HFILL
4598         } },
4599
4600         { &hf_mpeg_descr_ciplus_svc_prov_name, {
4601             "Service Provider Name", "mpeg_descr.ciplus_svc.provider_name",
4602             FT_UINT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
4603         } },
4604
4605         { &hf_mpeg_descr_ciplus_svc_name, {
4606             "Service Name", "mpeg_descr.ciplus_svc.name",
4607             FT_UINT_STRING, BASE_NONE, NULL, 0, NULL, HFILL
4608         } },
4609
4610         { &hf_mpeg_descr_ciplus_prot_free_ci_mode, {
4611             "Free CI mode", "mpeg_descr.ciplus_prot.free_ci_mode",
4612             FT_BOOLEAN, 8, TFS(&tfs_prot_noprot), 0x80, NULL, HFILL
4613         } },
4614
4615         { &hf_mpeg_descr_ciplus_prot_match_brand_flag, {
4616             "Match brand flag", "mpeg_descr.ciplus_prot.match_brand_flag",
4617             FT_BOOLEAN, 8, TFS(&tfs_enabled_disabled), 0x40, NULL, HFILL
4618         } },
4619
4620         { &hf_mpeg_descr_ciplus_prot_num_entries, {
4621             "Number of entries", "mpeg_descr.ciplus_prot.num_entries",
4622             FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL
4623         } },
4624
4625         { &hf_mpeg_descr_ciplus_prot_brand_id, {
4626             "CICAM brand identifier", "mpeg_descr.ciplus_prot.brand_id",
4627             FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL
4628         } }
4629     };
4630
4631     static gint *ett[] = {
4632         &ett_mpeg_descriptor,
4633         &ett_mpeg_descriptor_extended_event_item,
4634         &ett_mpeg_descriptor_component_content_type,
4635         &ett_mpeg_descriptor_content_nibble,
4636         &ett_mpeg_descriptor_vbi_data_service,
4637         &ett_mpeg_descriptor_content_identifier_crid,
4638         &ett_mpeg_descriptor_service_list,
4639         &ett_mpeg_descriptor_ac3_component_type,
4640         &ett_mpeg_descriptor_linkage_population_id
4641     };
4642
4643     proto_mpeg_descriptor = proto_register_protocol("MPEG2 Descriptors", "MPEG Descriptor", "mpeg_descr");
4644     proto_register_field_array(proto_mpeg_descriptor, hf, array_length(hf));
4645     proto_register_subtree_array(ett, array_length(ett));
4646
4647 }
4648
4649 /*
4650  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
4651  *
4652  * Local variables:
4653  * c-basic-offset: 4
4654  * tab-width: 8
4655  * indent-tabs-mode: nil
4656  * End:
4657  *
4658  * vi: set shiftwidth=4 tabstop=8 expandtab:
4659  * :indentSize=4:tabSize=8:noTabs=true:
4660  */