1 /* Do not modify this file. */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-mpeg-pes.c */
4 /* ../../tools/asn2wrs.py -p mpeg-pes -c ./mpeg-pes.cnf -s ./packet-mpeg-pes-template -D . mpeg-pes.asn */
6 /* Input file: packet-mpeg-pes-template.c */
8 #line 1 "packet-mpeg-pes-template.c"
9 /* MPEG Packetized Elementary Stream (PES) packet decoder.
10 * Written by Shaun Jackman <sjackman@gmail.com>.
11 * Copyright 2007 Shaun Jackman
15 * Wireshark - Network traffic analyzer
16 * By Gerald Combs <gerald@wireshark.org>
17 * Copyright 1998 Gerald Combs
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version 2
22 * of the License, or (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40 #include <epan/packet.h>
41 #include <epan/asn1.h>
43 #include "packet-per.h"
46 /*--- Included file: packet-mpeg-pes-hf.c ---*/
47 #line 1 "packet-mpeg-pes-hf.c"
48 static int hf_mpeg_pes_prefix = -1; /* OCTET_STRING_SIZE_3 */
49 static int hf_mpeg_pes_stream = -1; /* T_stream */
50 static int hf_mpeg_pes_length = -1; /* INTEGER_0_65535 */
51 static int hf_mpeg_pes_must_be_one = -1; /* BOOLEAN */
52 static int hf_mpeg_pes_must_be_zero = -1; /* BOOLEAN */
53 static int hf_mpeg_pes_scrambling_control = -1; /* T_scrambling_control */
54 static int hf_mpeg_pes_priority = -1; /* BOOLEAN */
55 static int hf_mpeg_pes_data_alignment = -1; /* BOOLEAN */
56 static int hf_mpeg_pes_copyright = -1; /* BOOLEAN */
57 static int hf_mpeg_pes_original = -1; /* BOOLEAN */
58 static int hf_mpeg_pes_pts_flag = -1; /* BOOLEAN */
59 static int hf_mpeg_pes_dts_flag = -1; /* BOOLEAN */
60 static int hf_mpeg_pes_escr_flag = -1; /* BOOLEAN */
61 static int hf_mpeg_pes_es_rate_flag = -1; /* BOOLEAN */
62 static int hf_mpeg_pes_dsm_trick_mode_flag = -1; /* BOOLEAN */
63 static int hf_mpeg_pes_additional_copy_info_flag = -1; /* BOOLEAN */
64 static int hf_mpeg_pes_crc_flag = -1; /* BOOLEAN */
65 static int hf_mpeg_pes_extension_flag = -1; /* BOOLEAN */
66 static int hf_mpeg_pes_header_data_length = -1; /* INTEGER_0_255 */
67 static int hf_mpeg_pes_horizontal_size = -1; /* BIT_STRING_SIZE_12 */
68 static int hf_mpeg_pes_vertical_size = -1; /* BIT_STRING_SIZE_12 */
69 static int hf_mpeg_pes_aspect_ratio = -1; /* T_aspect_ratio */
70 static int hf_mpeg_pes_frame_rate = -1; /* T_frame_rate */
71 static int hf_mpeg_pes_bit_rate = -1; /* BIT_STRING_SIZE_18 */
72 static int hf_mpeg_pes_vbv_buffer_size = -1; /* BIT_STRING_SIZE_10 */
73 static int hf_mpeg_pes_constrained_parameters_flag = -1; /* BOOLEAN */
74 static int hf_mpeg_pes_load_intra_quantiser_matrix = -1; /* BOOLEAN */
75 static int hf_mpeg_pes_load_non_intra_quantiser_matrix = -1; /* BOOLEAN */
76 static int hf_mpeg_pes_must_be_0001 = -1; /* BIT_STRING_SIZE_4 */
77 static int hf_mpeg_pes_profile_and_level = -1; /* INTEGER_0_255 */
78 static int hf_mpeg_pes_progressive_sequence = -1; /* BOOLEAN */
79 static int hf_mpeg_pes_chroma_format = -1; /* INTEGER_0_3 */
80 static int hf_mpeg_pes_horizontal_size_extension = -1; /* INTEGER_0_3 */
81 static int hf_mpeg_pes_vertical_size_extension = -1; /* INTEGER_0_3 */
82 static int hf_mpeg_pes_bit_rate_extension = -1; /* BIT_STRING_SIZE_12 */
83 static int hf_mpeg_pes_vbv_buffer_size_extension = -1; /* INTEGER_0_255 */
84 static int hf_mpeg_pes_low_delay = -1; /* BOOLEAN */
85 static int hf_mpeg_pes_frame_rate_extension_n = -1; /* INTEGER_0_3 */
86 static int hf_mpeg_pes_frame_rate_extension_d = -1; /* INTEGER_0_3 */
87 static int hf_mpeg_pes_drop_frame_flag = -1; /* BOOLEAN */
88 static int hf_mpeg_pes_hour = -1; /* INTEGER_0_32 */
89 static int hf_mpeg_pes_minute = -1; /* INTEGER_0_64 */
90 static int hf_mpeg_pes_second = -1; /* INTEGER_0_64 */
91 static int hf_mpeg_pes_frame = -1; /* INTEGER_0_64 */
92 static int hf_mpeg_pes_closed_gop = -1; /* BOOLEAN */
93 static int hf_mpeg_pes_broken_gop = -1; /* BOOLEAN */
94 static int hf_mpeg_pes_must_be_zero_01 = -1; /* BIT_STRING_SIZE_5 */
95 static int hf_mpeg_pes_temporal_sequence_number = -1; /* BIT_STRING_SIZE_10 */
96 static int hf_mpeg_pes_frame_type = -1; /* T_frame_type */
97 static int hf_mpeg_pes_vbv_delay = -1; /* BIT_STRING_SIZE_16 */
99 /*--- End of included file: packet-mpeg-pes-hf.c ---*/
100 #line 38 "packet-mpeg-pes-template.c"
102 /*--- Included file: packet-mpeg-pes-ett.c ---*/
103 #line 1 "packet-mpeg-pes-ett.c"
104 static gint ett_mpeg_pes_PES = -1;
105 static gint ett_mpeg_pes_Stream = -1;
106 static gint ett_mpeg_pes_Sequence_header = -1;
107 static gint ett_mpeg_pes_Sequence_extension = -1;
108 static gint ett_mpeg_pes_Group_of_pictures = -1;
109 static gint ett_mpeg_pes_Picture = -1;
111 /*--- End of included file: packet-mpeg-pes-ett.c ---*/
112 #line 39 "packet-mpeg-pes-template.c"
114 /*--- Included file: packet-mpeg-pes-fn.c ---*/
115 #line 1 "packet-mpeg-pes-fn.c"
119 dissect_mpeg_pes_OCTET_STRING_SIZE_3(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
120 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
127 static const value_string mpeg_pes_T_stream_vals[] = {
129 { 179, "sequence-header" },
130 { 181, "sequence-header-extension" },
131 { 184, "group-of-pictures" },
132 { 185, "program-end" },
133 { 186, "pack-header" },
134 { 187, "system-header" },
135 { 188, "program-stream-map" },
136 { 189, "private-stream-1" },
137 { 190, "padding-stream" },
138 { 191, "private-stream-2" },
139 { 192, "audio-stream" },
140 { 224, "video-stream" },
146 dissect_mpeg_pes_T_stream(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
147 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
148 0U, 255U, NULL, FALSE);
154 static const per_sequence_t PES_sequence[] = {
155 { &hf_mpeg_pes_prefix , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_OCTET_STRING_SIZE_3 },
156 { &hf_mpeg_pes_stream , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_T_stream },
161 dissect_mpeg_pes_PES(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
162 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
163 ett_mpeg_pes_PES, PES_sequence);
171 dissect_mpeg_pes_INTEGER_0_65535(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
172 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
173 0U, 65535U, NULL, FALSE);
181 dissect_mpeg_pes_BOOLEAN(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
182 offset = dissect_per_boolean(tvb, offset, actx, tree, hf_index, NULL);
188 static const value_string mpeg_pes_T_scrambling_control_vals[] = {
189 { 0, "not-scrambled" },
195 dissect_mpeg_pes_T_scrambling_control(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
196 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
197 0U, 3U, NULL, FALSE);
205 dissect_mpeg_pes_INTEGER_0_255(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
206 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
207 0U, 255U, NULL, FALSE);
213 static const per_sequence_t Stream_sequence[] = {
214 { &hf_mpeg_pes_length , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_65535 },
215 { &hf_mpeg_pes_must_be_one, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
216 { &hf_mpeg_pes_must_be_zero, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
217 { &hf_mpeg_pes_scrambling_control, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_T_scrambling_control },
218 { &hf_mpeg_pes_priority , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
219 { &hf_mpeg_pes_data_alignment, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
220 { &hf_mpeg_pes_copyright , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
221 { &hf_mpeg_pes_original , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
222 { &hf_mpeg_pes_pts_flag , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
223 { &hf_mpeg_pes_dts_flag , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
224 { &hf_mpeg_pes_escr_flag , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
225 { &hf_mpeg_pes_es_rate_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
226 { &hf_mpeg_pes_dsm_trick_mode_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
227 { &hf_mpeg_pes_additional_copy_info_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
228 { &hf_mpeg_pes_crc_flag , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
229 { &hf_mpeg_pes_extension_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
230 { &hf_mpeg_pes_header_data_length, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_255 },
235 dissect_mpeg_pes_Stream(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
236 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
237 ett_mpeg_pes_Stream, Stream_sequence);
245 dissect_mpeg_pes_BIT_STRING_SIZE_12(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
246 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
247 12, 12, FALSE, NULL);
253 static const value_string mpeg_pes_T_aspect_ratio_vals[] = {
254 { 1, "aspect-1to1" },
255 { 2, "aspect-4to3" },
256 { 3, "aspect-16to9" },
257 { 4, "aspect-2-21to1" },
263 dissect_mpeg_pes_T_aspect_ratio(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
264 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
265 0U, 15U, NULL, FALSE);
271 static const value_string mpeg_pes_T_frame_rate_vals[] = {
284 static guint32 T_frame_rate_value_map[9+0] = {0, 23976, 24000, 25000, 29970, 30000, 50000, 59940, 60000};
287 dissect_mpeg_pes_T_frame_rate(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
288 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
289 9, NULL, FALSE, 0, T_frame_rate_value_map);
297 dissect_mpeg_pes_BIT_STRING_SIZE_18(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
298 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
299 18, 18, FALSE, NULL);
307 dissect_mpeg_pes_BIT_STRING_SIZE_10(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
308 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
309 10, 10, FALSE, NULL);
315 static const per_sequence_t Sequence_header_sequence[] = {
316 { &hf_mpeg_pes_horizontal_size, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_12 },
317 { &hf_mpeg_pes_vertical_size, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_12 },
318 { &hf_mpeg_pes_aspect_ratio, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_T_aspect_ratio },
319 { &hf_mpeg_pes_frame_rate , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_T_frame_rate },
320 { &hf_mpeg_pes_bit_rate , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_18 },
321 { &hf_mpeg_pes_must_be_one, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
322 { &hf_mpeg_pes_vbv_buffer_size, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_10 },
323 { &hf_mpeg_pes_constrained_parameters_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
324 { &hf_mpeg_pes_load_intra_quantiser_matrix, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
325 { &hf_mpeg_pes_load_non_intra_quantiser_matrix, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
330 dissect_mpeg_pes_Sequence_header(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
331 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
332 ett_mpeg_pes_Sequence_header, Sequence_header_sequence);
340 dissect_mpeg_pes_BIT_STRING_SIZE_4(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
341 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
350 dissect_mpeg_pes_INTEGER_0_3(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
351 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
352 0U, 3U, NULL, FALSE);
358 static const per_sequence_t Sequence_extension_sequence[] = {
359 { &hf_mpeg_pes_must_be_0001, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_4 },
360 { &hf_mpeg_pes_profile_and_level, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_255 },
361 { &hf_mpeg_pes_progressive_sequence, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
362 { &hf_mpeg_pes_chroma_format, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_3 },
363 { &hf_mpeg_pes_horizontal_size_extension, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_3 },
364 { &hf_mpeg_pes_vertical_size_extension, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_3 },
365 { &hf_mpeg_pes_bit_rate_extension, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_12 },
366 { &hf_mpeg_pes_must_be_one, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
367 { &hf_mpeg_pes_vbv_buffer_size_extension, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_255 },
368 { &hf_mpeg_pes_low_delay , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
369 { &hf_mpeg_pes_frame_rate_extension_n, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_3 },
370 { &hf_mpeg_pes_frame_rate_extension_d, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_3 },
375 dissect_mpeg_pes_Sequence_extension(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
376 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
377 ett_mpeg_pes_Sequence_extension, Sequence_extension_sequence);
385 dissect_mpeg_pes_INTEGER_0_32(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
386 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
387 0U, 32U, NULL, FALSE);
395 dissect_mpeg_pes_INTEGER_0_64(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
396 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
397 0U, 64U, NULL, FALSE);
405 dissect_mpeg_pes_BIT_STRING_SIZE_5(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
406 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
413 static const per_sequence_t Group_of_pictures_sequence[] = {
414 { &hf_mpeg_pes_drop_frame_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
415 { &hf_mpeg_pes_hour , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_32 },
416 { &hf_mpeg_pes_minute , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_64 },
417 { &hf_mpeg_pes_must_be_one, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
418 { &hf_mpeg_pes_second , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_64 },
419 { &hf_mpeg_pes_frame , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_64 },
420 { &hf_mpeg_pes_closed_gop , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
421 { &hf_mpeg_pes_broken_gop , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
422 { &hf_mpeg_pes_must_be_zero_01, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_5 },
427 dissect_mpeg_pes_Group_of_pictures(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
428 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
429 ett_mpeg_pes_Group_of_pictures, Group_of_pictures_sequence);
435 static const value_string mpeg_pes_T_frame_type_vals[] = {
445 dissect_mpeg_pes_T_frame_type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
446 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
447 0U, 7U, NULL, FALSE);
455 dissect_mpeg_pes_BIT_STRING_SIZE_16(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
456 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
457 16, 16, FALSE, NULL);
463 static const per_sequence_t Picture_sequence[] = {
464 { &hf_mpeg_pes_temporal_sequence_number, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_10 },
465 { &hf_mpeg_pes_frame_type , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_T_frame_type },
466 { &hf_mpeg_pes_vbv_delay , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_16 },
471 dissect_mpeg_pes_Picture(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
472 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
473 ett_mpeg_pes_Picture, Picture_sequence);
479 /*--- End of included file: packet-mpeg-pes-fn.c ---*/
480 #line 40 "packet-mpeg-pes-template.c"
482 static int proto_mpeg = -1;
483 static int proto_mpeg_pes = -1;
485 static int ett_mpeg_pes_pack_header = -1;
486 static int ett_mpeg_pes_header_data = -1;
487 static int ett_mpeg_pes_trick_mode = -1;
489 static int hf_mpeg_pes_pack_header = -1;
490 static int hf_mpeg_pes_scr = -1;
491 static int hf_mpeg_pes_program_mux_rate = -1;
492 static int hf_mpeg_pes_stuffing_length = -1;
493 static int hf_mpeg_pes_stuffing = -1;
494 static int hf_mpeg_pes_extension = -1;
495 static int hf_mpeg_pes_header_data = -1;
496 static int hf_mpeg_pes_pts = -1;
497 static int hf_mpeg_pes_dts = -1;
498 static int hf_mpeg_pes_escr = -1;
499 static int hf_mpeg_pes_es_rate = -1;
500 static int hf_mpeg_pes_dsm_trick_mode = -1;
501 static int hf_mpeg_pes_dsm_trick_mode_control = -1;
502 static int hf_mpeg_pes_dsm_trick_mode_field_id = -1;
503 static int hf_mpeg_pes_dsm_trick_mode_intra_slice_refresh = -1;
504 static int hf_mpeg_pes_dsm_trick_mode_frequency_truncation = -1;
505 static int hf_mpeg_pes_dsm_trick_mode_rep_cntrl = -1;
506 static int hf_mpeg_pes_copy_info = -1;
507 static int hf_mpeg_pes_crc = -1;
508 static int hf_mpeg_pes_extension_flags = -1;
509 static int hf_mpeg_pes_private_data = -1;
510 static int hf_mpeg_pes_pack_length = -1;
511 static int hf_mpeg_pes_sequence = -1;
512 static int hf_mpeg_pes_pstd_buffer = -1;
513 static int hf_mpeg_pes_extension2 = -1;
514 static int hf_mpeg_pes_padding = -1;
515 static int hf_mpeg_pes_data = -1;
517 static int hf_mpeg_video_sequence_header = -1;
518 static int hf_mpeg_video_sequence_extension = -1;
519 static int hf_mpeg_video_group_of_pictures = -1;
520 static int hf_mpeg_video_picture = -1;
521 static int hf_mpeg_video_quantization_matrix = -1;
522 static int hf_mpeg_video_data = -1;
524 enum { PES_PREFIX = 1 };
527 STREAM_PICTURE = 0x00,
528 STREAM_SEQUENCE = 0xb3,
529 STREAM_SEQUENCE_EXTENSION = 0xb5,
533 STREAM_SYSTEM = 0xbb,
534 STREAM_PROGRAM = 0xbc,
535 STREAM_PRIVATE1 = 0xbd,
536 STREAM_PADDING = 0xbe,
537 STREAM_PRIVATE2 = 0xbf,
547 DSM_TRICK_MODE_FLAG = 0x08,
548 COPY_INFO_FLAG = 0x04,
550 EXTENSION_FLAG = 0x01
554 PRIVATE_DATA_FLAG = 0x80,
555 PACK_LENGTH_FLAG = 0x40,
556 SEQUENCE_FLAG = 0x20,
557 PSTD_BUFFER_FLAG = 0x10,
559 EXTENSION_FLAG2 = 0x01
563 FAST_FORWARD_CONTROL = 0x00,
564 SLOW_MOTION_CONTROL = 0x01,
565 FREEZE_FRAME_CONTROL = 0x02,
566 FAST_REVERSE_CONTROL = 0x03,
567 SLOW_REVERSE_CONTROL = 0x04
570 static const value_string mpeg_pes_TrickModeControl_vals[] = {
571 { FAST_FORWARD_CONTROL, "fast-forward" },
572 { SLOW_MOTION_CONTROL, "slow-motion" },
573 { FREEZE_FRAME_CONTROL, "freeze-frame" },
574 { FAST_REVERSE_CONTROL, "fast-reverse" },
575 { SLOW_REVERSE_CONTROL, "slow-reverse" },
582 static const value_string mpeg_pes_TrickModeFieldId_vals[] = {
583 { 0, "display-from-top-field-only" },
584 { 1, "display-from-bottom-field-only" },
585 { 2, "display-complete-frame" },
590 static const value_string mpeg_pes_TrickModeIntraSliceRefresh_vals[] = {
591 { 0, "macroblocks-may-not-be-missing" },
592 { 1, "macroblocks-may-be-missing" },
596 static const value_string mpeg_pes_TrickModeFrequencyTruncation_vals[] = {
597 { 0, "only-DC-coefficients-are-non-zero" },
598 { 1, "only-the-first-three-coefficients-are-non-zero" },
599 { 2, "only-the-first-six-coefficients-are-non-zero" },
600 { 3, "all-coefficients-may-be-non-zero" },
604 static guint64 tvb_get_ntoh40(tvbuff_t *tvb, unsigned offset)
606 return (guint64)tvb_get_guint8(tvb, offset) << 32
607 | tvb_get_ntohl(tvb, offset + 1);
610 static guint64 tvb_get_ntoh48(tvbuff_t *tvb, unsigned offset)
612 return (guint64)tvb_get_ntohs(tvb, offset) << 32
613 | tvb_get_ntohl(tvb, offset + 2);
618 static guint64 decode_time_stamp(tvbuff_t *tvb, unsigned offset, nstime_t *nst)
620 guint64 bytes = tvb_get_ntoh40(tvb, offset);
622 (bytes >> 33 & 0x0007) << 30 |
623 (bytes >> 17 & 0x7fff) << 15 |
624 (bytes >> 1 & 0x7fff) << 0;
625 unsigned rem = (unsigned)(ts % TSHZ);
626 nst->secs = (time_t)(ts / TSHZ);
627 nst->nsecs = (int)(G_GINT64_CONSTANT(1000000000) * rem / TSHZ);
631 #define SCRHZ 27000000
633 static guint64 decode_clock_reference(tvbuff_t *tvb, unsigned offset,
636 guint64 bytes = tvb_get_ntoh48(tvb, offset);
638 (bytes >> 43 & 0x0007) << 30 |
639 (bytes >> 27 & 0x7fff) << 15 |
640 (bytes >> 11 & 0x7fff) << 0;
641 unsigned ext = (unsigned)((bytes >> 1) & 0x1ff);
642 guint64 cr = 300 * ts + ext;
643 unsigned rem = (unsigned)(cr % SCRHZ);
644 nst->secs = (time_t)(cr / SCRHZ);
645 nst->nsecs = (int)(G_GINT64_CONSTANT(1000000000) * rem / SCRHZ);
650 dissect_mpeg_pes_header_data(tvbuff_t *tvb, packet_info *pinfo,
651 proto_tree *root, unsigned flags)
653 proto_item *item = proto_tree_add_item(root, hf_mpeg_pes_header_data, tvb,
655 proto_tree *tree = proto_item_add_subtree(item, ett_mpeg_pes_header_data);
658 if (flags & PTS_FLAG) {
660 decode_time_stamp(tvb, offset, &nst);
661 proto_tree_add_time(tree, hf_mpeg_pes_pts, tvb,
665 if (check_col(pinfo->cinfo, COL_DEF_DST)) {
666 SET_ADDRESS(&pinfo->dst, AT_NONE, 0, NULL);
667 col_add_fstr(pinfo->cinfo, COL_DEF_DST,
669 (long) nst.secs, nst.nsecs);
672 if (flags & DTS_FLAG) {
674 decode_time_stamp(tvb, offset, &nst);
675 proto_tree_add_time(tree, hf_mpeg_pes_dts, tvb,
679 if (check_col(pinfo->cinfo, COL_DEF_SRC)) {
680 SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
681 col_add_fstr(pinfo->cinfo, COL_DEF_SRC,
683 (long) nst.secs, nst.nsecs);
686 if (flags & ESCR_FLAG) {
688 decode_clock_reference(tvb, offset, &nst);
689 proto_tree_add_time(tree, hf_mpeg_pes_escr, tvb,
693 if (flags & ES_RATE_FLAG) {
694 unsigned es_rate = (tvb_get_ntohs(tvb, offset) >> 1 & 0x3fff) * 50;
695 proto_tree_add_uint(tree, hf_mpeg_pes_es_rate, tvb,
699 if (flags & DSM_TRICK_MODE_FLAG)
701 guint8 value = tvb_get_guint8(tvb, offset);
703 proto_tree *trick_tree;
704 proto_item *trick_item;
706 trick_item = proto_tree_add_item(item,
707 hf_mpeg_pes_dsm_trick_mode, tvb,
710 trick_tree = proto_item_add_subtree(trick_item,
711 ett_mpeg_pes_trick_mode);
713 control = (value >> 5);
714 proto_tree_add_uint(trick_tree,
715 hf_mpeg_pes_dsm_trick_mode_control, tvb,
719 if (control == FAST_FORWARD_CONTROL
720 || control == FAST_REVERSE_CONTROL)
722 proto_tree_add_uint(trick_tree,
723 hf_mpeg_pes_dsm_trick_mode_field_id, tvb,
725 (value & 0x18) >> 3);
727 proto_tree_add_uint(trick_tree,
728 hf_mpeg_pes_dsm_trick_mode_intra_slice_refresh, tvb,
730 (value & 0x04) >> 2);
732 proto_tree_add_uint(trick_tree,
733 hf_mpeg_pes_dsm_trick_mode_frequency_truncation, tvb,
737 else if (control == SLOW_MOTION_CONTROL
738 || control == SLOW_REVERSE_CONTROL)
740 proto_tree_add_uint(trick_tree,
741 hf_mpeg_pes_dsm_trick_mode_rep_cntrl, tvb,
745 else if (control == FREEZE_FRAME_CONTROL)
747 proto_tree_add_uint(trick_tree,
748 hf_mpeg_pes_dsm_trick_mode_field_id, tvb,
750 (value & 0x18) >> 3);
755 if (flags & COPY_INFO_FLAG) {
756 proto_tree_add_item(tree, hf_mpeg_pes_copy_info, tvb,
760 if (flags & CRC_FLAG) {
761 proto_tree_add_item(tree, hf_mpeg_pes_crc, tvb,
766 if (flags & EXTENSION_FLAG) {
767 int flags2 = tvb_get_guint8(tvb, offset);
768 proto_tree_add_item(tree, hf_mpeg_pes_extension_flags, tvb,
772 if (flags2 & PRIVATE_DATA_FLAG) {
773 proto_tree_add_item(tree, hf_mpeg_pes_private_data, tvb,
777 if (flags2 & PACK_LENGTH_FLAG) {
778 proto_tree_add_item(tree, hf_mpeg_pes_pack_length, tvb,
782 if (flags2 & SEQUENCE_FLAG) {
783 proto_tree_add_item(tree, hf_mpeg_pes_sequence, tvb,
787 if (flags2 & PSTD_BUFFER_FLAG) {
788 unsigned pstd = tvb_get_ntohs(tvb, offset);
789 proto_tree_add_uint(tree, hf_mpeg_pes_pstd_buffer, tvb,
790 offset, 2, (pstd & 0x2000 ? 1024 : 128) * (pstd & 0x1ff));
793 if (flags2 & EXTENSION_FLAG2) {
794 proto_tree_add_item(tree, hf_mpeg_pes_extension2, tvb,
802 dissect_mpeg_pes_pack_header(tvbuff_t *tvb, unsigned offset,
803 packet_info *pinfo, proto_tree *root)
805 unsigned program_mux_rate, stuffing_length;
807 proto_item *item = proto_tree_add_item(root, hf_mpeg_pes_pack_header, tvb,
808 offset / 8, 10, FALSE);
809 proto_tree *tree = proto_item_add_subtree(item, ett_mpeg_pes_pack_header);
812 decode_clock_reference(tvb, offset / 8, &nst);
813 proto_tree_add_time(tree, hf_mpeg_pes_scr, tvb, offset / 8, 6, &nst);
816 program_mux_rate = (tvb_get_ntoh24(tvb, offset / 8) >> 2) * 50;
817 proto_tree_add_uint(tree, hf_mpeg_pes_program_mux_rate, tvb, offset / 8, 3,
821 if (check_col(pinfo->cinfo, COL_DEF_SRC)) {
822 SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
823 col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "%u B/s", program_mux_rate);
826 stuffing_length = tvb_get_guint8(tvb, offset / 8) & 0x07;
827 proto_tree_add_item(tree, hf_mpeg_pes_stuffing_length, tvb,
828 offset / 8, 1, FALSE);
831 if (stuffing_length > 0) {
832 proto_tree_add_item(tree, hf_mpeg_pes_stuffing, tvb,
833 offset / 8, stuffing_length, FALSE);
834 offset += stuffing_length * 8;
841 dissect_mpeg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
844 dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
851 if (!tvb_bytes_exist(tvb, 0, 3))
852 return FALSE; /* not enough bytes for a PES prefix */
854 prefix = tvb_get_ntoh24(tvb, 0);
855 if (prefix != PES_PREFIX)
857 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG PES");
858 col_clear(pinfo->cinfo, COL_INFO);
860 stream = tvb_get_guint8(tvb, 3);
861 if (check_col(pinfo->cinfo, COL_INFO)) {
862 const char *s = match_strval(stream, mpeg_pes_T_stream_vals);
864 col_set_str(pinfo->cinfo, COL_INFO, s);
871 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
872 offset = dissect_mpeg_pes_PES(tvb, offset, &asn1_ctx,
873 tree, proto_mpeg_pes);
875 if (stream == STREAM_PICTURE) {
878 frame_type = tvb_get_guint8(tvb, 5) >> 3 & 0x07;
879 if (check_col(pinfo->cinfo, COL_INFO)) {
880 const char *s = match_strval(frame_type,
881 mpeg_pes_T_frame_type_vals);
883 col_set_str(pinfo->cinfo, COL_INFO, s);
886 offset = dissect_mpeg_pes_Picture(tvb, offset, &asn1_ctx,
887 tree, hf_mpeg_video_picture);
888 proto_tree_add_item(tree, hf_mpeg_video_data, tvb,
889 offset / 8, -1, FALSE);
890 } else if (stream == STREAM_SEQUENCE) {
893 offset = dissect_mpeg_pes_Sequence_header(tvb, offset, &asn1_ctx,
894 tree, hf_mpeg_video_sequence_header);
896 proto_tree_add_item(tree, hf_mpeg_video_quantization_matrix, tvb,
897 offset / 8, 64, FALSE);
900 es = tvb_new_subset_remaining(tvb, offset / 8);
901 dissect_mpeg_pes(es, pinfo, tree);
902 } else if (stream == STREAM_SEQUENCE_EXTENSION) {
905 offset = dissect_mpeg_pes_Sequence_extension(tvb, offset, &asn1_ctx,
906 tree, hf_mpeg_video_sequence_extension);
908 es = tvb_new_subset_remaining(tvb, offset / 8);
909 dissect_mpeg_pes(es, pinfo, tree);
910 } else if (stream == STREAM_GOP) {
913 offset = dissect_mpeg_pes_Group_of_pictures(tvb, offset, &asn1_ctx,
914 tree, hf_mpeg_video_group_of_pictures);
916 es = tvb_new_subset_remaining(tvb, offset / 8);
917 dissect_mpeg_pes(es, pinfo, tree);
918 } else if (stream == STREAM_PACK) {
919 if (tvb_get_guint8(tvb, offset / 8) >> 6 == 1) {
920 offset = dissect_mpeg_pes_pack_header(tvb, offset, pinfo, tree);
922 proto_tree_add_item(tree, hf_mpeg_pes_data, tvb,
923 offset / 8, 8, FALSE);
926 } else if (stream == STREAM_SYSTEM || stream == STREAM_PRIVATE2) {
927 unsigned data_length = tvb_get_ntohs(tvb, offset / 8);
928 proto_tree_add_item(tree, hf_mpeg_pes_length, tvb,
929 offset / 8, 2, FALSE);
932 proto_tree_add_item(tree, hf_mpeg_pes_data, tvb,
933 offset / 8, data_length, FALSE);
934 } else if (stream == STREAM_PADDING) {
935 unsigned padding_length = tvb_get_ntohs(tvb, offset / 8);
936 proto_tree_add_item(tree, hf_mpeg_pes_length, tvb,
937 offset / 8, 2, FALSE);
940 proto_tree_add_item(tree, hf_mpeg_pes_padding, tvb,
941 offset / 8, padding_length, FALSE);
942 } else if (stream == STREAM_PRIVATE1
943 || stream >= STREAM_AUDIO) {
944 int length = tvb_get_ntohs(tvb, 4);
946 if ((tvb_get_guint8(tvb, 6) & 0xc0) == 0x80) {
950 offset = dissect_mpeg_pes_Stream(tvb, offset, &asn1_ctx,
951 tree, hf_mpeg_pes_extension);
952 /* https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2229
953 * A value of 0 indicates that the PES packet length is neither specified nor
954 * bounded and is allowed only in PES packets whose payload is a video elementary
955 * stream contained in Transport Stream packets.
956 * XXX Some one with access to the spec should check this
958 if(length !=0 && stream != STREAM_VIDEO){
962 header_length = tvb_get_guint8(tvb, 8);
963 if (header_length > 0) {
964 int flags = tvb_get_guint8(tvb, 7);
965 tvbuff_t *header_data = tvb_new_subset(tvb, offset / 8,
966 header_length, header_length);
967 dissect_mpeg_pes_header_data(header_data, pinfo, tree, flags);
968 offset += header_length * 8;
969 /* length may be zero for Video stream */
970 if(length !=0 && stream != STREAM_VIDEO){
971 length -= header_length * 8;
975 /* length may be zero for Video stream */
977 proto_tree_add_item(tree, hf_mpeg_pes_data, tvb, (offset>>3),-1, FALSE);
981 es = tvb_new_subset(tvb, offset / 8, -1, length / 8);
982 if (tvb_get_ntoh24(es, 0) == PES_PREFIX)
983 dissect_mpeg_pes(es, pinfo, tree);
984 else if (tvb_get_guint8(es, 0) == 0xff)
985 dissect_mpeg(es, pinfo, tree);
987 proto_tree_add_item(tree, hf_mpeg_pes_data, es,
990 unsigned data_length = tvb_get_ntohs(tvb, offset / 8);
991 proto_tree_add_item(tree, hf_mpeg_pes_length, tvb,
992 offset / 8, 2, FALSE);
995 proto_tree_add_item(tree, hf_mpeg_pes_data, tvb,
996 offset / 8, data_length, FALSE);
999 proto_tree_add_item(tree, hf_mpeg_pes_data, tvb,
1000 offset / 8, -1, FALSE);
1005 static heur_dissector_list_t heur_subdissector_list;
1008 dissect_mpeg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1010 if (!dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree)) {
1011 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG");
1012 col_clear(pinfo->cinfo, COL_INFO);
1014 proto_tree_add_item(tree, proto_mpeg, tvb, 0, -1, FALSE);
1019 proto_register_mpeg_pes(void)
1021 static hf_register_info hf[] = {
1023 /*--- Included file: packet-mpeg-pes-hfarr.c ---*/
1024 #line 1 "packet-mpeg-pes-hfarr.c"
1025 { &hf_mpeg_pes_prefix,
1026 { "prefix", "mpeg-pes.prefix",
1027 FT_BYTES, BASE_NONE, NULL, 0,
1028 "OCTET_STRING_SIZE_3", HFILL }},
1029 { &hf_mpeg_pes_stream,
1030 { "stream", "mpeg-pes.stream",
1031 FT_UINT8, BASE_HEX, VALS(mpeg_pes_T_stream_vals), 0,
1033 { &hf_mpeg_pes_length,
1034 { "length", "mpeg-pes.length",
1035 FT_UINT16, BASE_DEC, NULL, 0,
1036 "INTEGER_0_65535", HFILL }},
1037 { &hf_mpeg_pes_must_be_one,
1038 { "must-be-one", "mpeg-pes.must_be_one",
1039 FT_BOOLEAN, BASE_NONE, NULL, 0,
1040 "BOOLEAN", HFILL }},
1041 { &hf_mpeg_pes_must_be_zero,
1042 { "must-be-zero", "mpeg-pes.must_be_zero",
1043 FT_BOOLEAN, BASE_NONE, NULL, 0,
1044 "BOOLEAN", HFILL }},
1045 { &hf_mpeg_pes_scrambling_control,
1046 { "scrambling-control", "mpeg-pes.scrambling_control",
1047 FT_UINT32, BASE_DEC, VALS(mpeg_pes_T_scrambling_control_vals), 0,
1049 { &hf_mpeg_pes_priority,
1050 { "priority", "mpeg-pes.priority",
1051 FT_BOOLEAN, BASE_NONE, NULL, 0,
1052 "BOOLEAN", HFILL }},
1053 { &hf_mpeg_pes_data_alignment,
1054 { "data-alignment", "mpeg-pes.data_alignment",
1055 FT_BOOLEAN, BASE_NONE, NULL, 0,
1056 "BOOLEAN", HFILL }},
1057 { &hf_mpeg_pes_copyright,
1058 { "copyright", "mpeg-pes.copyright",
1059 FT_BOOLEAN, BASE_NONE, NULL, 0,
1060 "BOOLEAN", HFILL }},
1061 { &hf_mpeg_pes_original,
1062 { "original", "mpeg-pes.original",
1063 FT_BOOLEAN, BASE_NONE, NULL, 0,
1064 "BOOLEAN", HFILL }},
1065 { &hf_mpeg_pes_pts_flag,
1066 { "pts-flag", "mpeg-pes.pts_flag",
1067 FT_BOOLEAN, BASE_NONE, NULL, 0,
1068 "BOOLEAN", HFILL }},
1069 { &hf_mpeg_pes_dts_flag,
1070 { "dts-flag", "mpeg-pes.dts_flag",
1071 FT_BOOLEAN, BASE_NONE, NULL, 0,
1072 "BOOLEAN", HFILL }},
1073 { &hf_mpeg_pes_escr_flag,
1074 { "escr-flag", "mpeg-pes.escr_flag",
1075 FT_BOOLEAN, BASE_NONE, NULL, 0,
1076 "BOOLEAN", HFILL }},
1077 { &hf_mpeg_pes_es_rate_flag,
1078 { "es-rate-flag", "mpeg-pes.es_rate_flag",
1079 FT_BOOLEAN, BASE_NONE, NULL, 0,
1080 "BOOLEAN", HFILL }},
1081 { &hf_mpeg_pes_dsm_trick_mode_flag,
1082 { "dsm-trick-mode-flag", "mpeg-pes.dsm_trick_mode_flag",
1083 FT_BOOLEAN, BASE_NONE, NULL, 0,
1084 "BOOLEAN", HFILL }},
1085 { &hf_mpeg_pes_additional_copy_info_flag,
1086 { "additional-copy-info-flag", "mpeg-pes.additional_copy_info_flag",
1087 FT_BOOLEAN, BASE_NONE, NULL, 0,
1088 "BOOLEAN", HFILL }},
1089 { &hf_mpeg_pes_crc_flag,
1090 { "crc-flag", "mpeg-pes.crc_flag",
1091 FT_BOOLEAN, BASE_NONE, NULL, 0,
1092 "BOOLEAN", HFILL }},
1093 { &hf_mpeg_pes_extension_flag,
1094 { "extension-flag", "mpeg-pes.extension_flag",
1095 FT_BOOLEAN, BASE_NONE, NULL, 0,
1096 "BOOLEAN", HFILL }},
1097 { &hf_mpeg_pes_header_data_length,
1098 { "header-data-length", "mpeg-pes.header_data_length",
1099 FT_UINT32, BASE_DEC, NULL, 0,
1100 "INTEGER_0_255", HFILL }},
1101 { &hf_mpeg_pes_horizontal_size,
1102 { "horizontal-size", "mpeg-pes.horizontal_size",
1103 FT_BYTES, BASE_NONE, NULL, 0,
1104 "BIT_STRING_SIZE_12", HFILL }},
1105 { &hf_mpeg_pes_vertical_size,
1106 { "vertical-size", "mpeg-pes.vertical_size",
1107 FT_BYTES, BASE_NONE, NULL, 0,
1108 "BIT_STRING_SIZE_12", HFILL }},
1109 { &hf_mpeg_pes_aspect_ratio,
1110 { "aspect-ratio", "mpeg-pes.aspect_ratio",
1111 FT_UINT32, BASE_DEC, VALS(mpeg_pes_T_aspect_ratio_vals), 0,
1112 "T_aspect_ratio", HFILL }},
1113 { &hf_mpeg_pes_frame_rate,
1114 { "frame-rate", "mpeg-pes.frame_rate",
1115 FT_UINT32, BASE_DEC, VALS(mpeg_pes_T_frame_rate_vals), 0,
1117 { &hf_mpeg_pes_bit_rate,
1118 { "bit-rate", "mpeg-pes.bit_rate",
1119 FT_BYTES, BASE_NONE, NULL, 0,
1120 "BIT_STRING_SIZE_18", HFILL }},
1121 { &hf_mpeg_pes_vbv_buffer_size,
1122 { "vbv-buffer-size", "mpeg-pes.vbv_buffer_size",
1123 FT_BYTES, BASE_NONE, NULL, 0,
1124 "BIT_STRING_SIZE_10", HFILL }},
1125 { &hf_mpeg_pes_constrained_parameters_flag,
1126 { "constrained-parameters-flag", "mpeg-pes.constrained_parameters_flag",
1127 FT_BOOLEAN, BASE_NONE, NULL, 0,
1128 "BOOLEAN", HFILL }},
1129 { &hf_mpeg_pes_load_intra_quantiser_matrix,
1130 { "load-intra-quantiser-matrix", "mpeg-pes.load_intra_quantiser_matrix",
1131 FT_BOOLEAN, BASE_NONE, NULL, 0,
1132 "BOOLEAN", HFILL }},
1133 { &hf_mpeg_pes_load_non_intra_quantiser_matrix,
1134 { "load-non-intra-quantiser-matrix", "mpeg-pes.load_non_intra_quantiser_matrix",
1135 FT_BOOLEAN, BASE_NONE, NULL, 0,
1136 "BOOLEAN", HFILL }},
1137 { &hf_mpeg_pes_must_be_0001,
1138 { "must-be-0001", "mpeg-pes.must_be_0001",
1139 FT_BYTES, BASE_NONE, NULL, 0,
1140 "BIT_STRING_SIZE_4", HFILL }},
1141 { &hf_mpeg_pes_profile_and_level,
1142 { "profile-and-level", "mpeg-pes.profile_and_level",
1143 FT_UINT32, BASE_DEC, NULL, 0,
1144 "INTEGER_0_255", HFILL }},
1145 { &hf_mpeg_pes_progressive_sequence,
1146 { "progressive-sequence", "mpeg-pes.progressive_sequence",
1147 FT_BOOLEAN, BASE_NONE, NULL, 0,
1148 "BOOLEAN", HFILL }},
1149 { &hf_mpeg_pes_chroma_format,
1150 { "chroma-format", "mpeg-pes.chroma_format",
1151 FT_UINT32, BASE_DEC, NULL, 0,
1152 "INTEGER_0_3", HFILL }},
1153 { &hf_mpeg_pes_horizontal_size_extension,
1154 { "horizontal-size-extension", "mpeg-pes.horizontal_size_extension",
1155 FT_UINT32, BASE_DEC, NULL, 0,
1156 "INTEGER_0_3", HFILL }},
1157 { &hf_mpeg_pes_vertical_size_extension,
1158 { "vertical-size-extension", "mpeg-pes.vertical_size_extension",
1159 FT_UINT32, BASE_DEC, NULL, 0,
1160 "INTEGER_0_3", HFILL }},
1161 { &hf_mpeg_pes_bit_rate_extension,
1162 { "bit-rate-extension", "mpeg-pes.bit_rate_extension",
1163 FT_BYTES, BASE_NONE, NULL, 0,
1164 "BIT_STRING_SIZE_12", HFILL }},
1165 { &hf_mpeg_pes_vbv_buffer_size_extension,
1166 { "vbv-buffer-size-extension", "mpeg-pes.vbv_buffer_size_extension",
1167 FT_UINT32, BASE_DEC, NULL, 0,
1168 "INTEGER_0_255", HFILL }},
1169 { &hf_mpeg_pes_low_delay,
1170 { "low-delay", "mpeg-pes.low_delay",
1171 FT_BOOLEAN, BASE_NONE, NULL, 0,
1172 "BOOLEAN", HFILL }},
1173 { &hf_mpeg_pes_frame_rate_extension_n,
1174 { "frame-rate-extension-n", "mpeg-pes.frame_rate_extension_n",
1175 FT_UINT32, BASE_DEC, NULL, 0,
1176 "INTEGER_0_3", HFILL }},
1177 { &hf_mpeg_pes_frame_rate_extension_d,
1178 { "frame-rate-extension-d", "mpeg-pes.frame_rate_extension_d",
1179 FT_UINT32, BASE_DEC, NULL, 0,
1180 "INTEGER_0_3", HFILL }},
1181 { &hf_mpeg_pes_drop_frame_flag,
1182 { "drop-frame-flag", "mpeg-pes.drop_frame_flag",
1183 FT_BOOLEAN, BASE_NONE, NULL, 0,
1184 "BOOLEAN", HFILL }},
1185 { &hf_mpeg_pes_hour,
1186 { "hour", "mpeg-pes.hour",
1187 FT_UINT32, BASE_DEC, NULL, 0,
1188 "INTEGER_0_32", HFILL }},
1189 { &hf_mpeg_pes_minute,
1190 { "minute", "mpeg-pes.minute",
1191 FT_UINT32, BASE_DEC, NULL, 0,
1192 "INTEGER_0_64", HFILL }},
1193 { &hf_mpeg_pes_second,
1194 { "second", "mpeg-pes.second",
1195 FT_UINT32, BASE_DEC, NULL, 0,
1196 "INTEGER_0_64", HFILL }},
1197 { &hf_mpeg_pes_frame,
1198 { "frame", "mpeg-pes.frame",
1199 FT_UINT32, BASE_DEC, NULL, 0,
1200 "INTEGER_0_64", HFILL }},
1201 { &hf_mpeg_pes_closed_gop,
1202 { "closed-gop", "mpeg-pes.closed_gop",
1203 FT_BOOLEAN, BASE_NONE, NULL, 0,
1204 "BOOLEAN", HFILL }},
1205 { &hf_mpeg_pes_broken_gop,
1206 { "broken-gop", "mpeg-pes.broken_gop",
1207 FT_BOOLEAN, BASE_NONE, NULL, 0,
1208 "BOOLEAN", HFILL }},
1209 { &hf_mpeg_pes_must_be_zero_01,
1210 { "must-be-zero", "mpeg-pes.must_be_zero",
1211 FT_BYTES, BASE_NONE, NULL, 0,
1212 "BIT_STRING_SIZE_5", HFILL }},
1213 { &hf_mpeg_pes_temporal_sequence_number,
1214 { "temporal-sequence-number", "mpeg-pes.temporal_sequence_number",
1215 FT_BYTES, BASE_NONE, NULL, 0,
1216 "BIT_STRING_SIZE_10", HFILL }},
1217 { &hf_mpeg_pes_frame_type,
1218 { "frame-type", "mpeg-pes.frame_type",
1219 FT_UINT32, BASE_DEC, VALS(mpeg_pes_T_frame_type_vals), 0,
1221 { &hf_mpeg_pes_vbv_delay,
1222 { "vbv-delay", "mpeg-pes.vbv_delay",
1223 FT_BYTES, BASE_NONE, NULL, 0,
1224 "BIT_STRING_SIZE_16", HFILL }},
1226 /*--- End of included file: packet-mpeg-pes-hfarr.c ---*/
1227 #line 582 "packet-mpeg-pes-template.c"
1228 { &hf_mpeg_pes_pack_header,
1229 { "Pack header", "mpeg-pes.pack",
1230 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1232 { "system clock reference (SCR)", "mpeg-pes.scr",
1233 FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
1234 { &hf_mpeg_pes_program_mux_rate,
1235 { "PES program mux rate", "mpeg-pes.program-mux-rate",
1236 FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL }},
1237 { &hf_mpeg_pes_stuffing_length,
1238 { "PES stuffing length", "mpeg-pes.stuffing-length",
1239 FT_UINT8, BASE_DEC, NULL, 0x07, NULL, HFILL }},
1240 { &hf_mpeg_pes_stuffing,
1241 { "PES stuffing bytes", "mpeg-pes.stuffing",
1242 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1243 { &hf_mpeg_pes_extension,
1244 { "PES extension", "mpeg-pes.extension",
1245 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1246 { &hf_mpeg_pes_header_data,
1247 { "PES header data", "mpeg-pes.header-data",
1248 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1250 { "presentation time stamp (PTS)", "mpeg-pes.pts",
1251 FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
1253 { "decode time stamp (DTS)", "mpeg-pes.dts",
1254 FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
1255 { &hf_mpeg_pes_escr,
1256 { "elementary stream clock reference (ESCR)", "mpeg-pes.escr",
1257 FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
1258 { &hf_mpeg_pes_es_rate,
1259 { "elementary stream rate", "mpeg-pes.es-rate",
1260 FT_UINT24, BASE_DEC, NULL, 0x7ffe, NULL, HFILL }},
1261 { &hf_mpeg_pes_dsm_trick_mode,
1262 { "Trick mode", "mpeg-pes.trick-mode",
1263 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1264 { &hf_mpeg_pes_dsm_trick_mode_control,
1265 { "control", "mpeg-pes.trick-mode-control",
1266 FT_UINT8, BASE_HEX, VALS(mpeg_pes_TrickModeControl_vals), 0,
1267 "mpeg_pes trick mode control", HFILL }},
1268 { &hf_mpeg_pes_dsm_trick_mode_field_id,
1269 { "field id", "mpeg-pes.trick-mode-field-id",
1270 FT_UINT8, BASE_HEX, VALS(mpeg_pes_TrickModeFieldId_vals), 0,
1271 "mpeg_pes trick mode field id", HFILL }},
1272 { &hf_mpeg_pes_dsm_trick_mode_intra_slice_refresh,
1273 { "intra slice refresh", "mpeg-pes.trick-mode-intra-slice-refresh",
1274 FT_UINT8, BASE_HEX, VALS(mpeg_pes_TrickModeIntraSliceRefresh_vals), 0,
1275 "mpeg_pes trick mode intra slice refresh", HFILL }},
1276 { &hf_mpeg_pes_dsm_trick_mode_frequency_truncation,
1277 { "frequency truncation", "mpeg-pes.trick-mode-frequeny-truncation",
1278 FT_UINT8, BASE_HEX, VALS(mpeg_pes_TrickModeFrequencyTruncation_vals), 0,
1279 "mpeg_pes trick mode frequency truncation", HFILL }},
1280 { &hf_mpeg_pes_dsm_trick_mode_rep_cntrl,
1281 { "rep cntrl", "mpeg-pes.trick-mode-rep-cntrl",
1282 FT_UINT8, BASE_HEX, NULL, 0, "mpeg_pes trick mode rep cntrl", HFILL }},
1283 { &hf_mpeg_pes_copy_info,
1284 { "copy info", "mpeg-pes.copy-info",
1285 FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL }},
1287 { "CRC", "mpeg-pes.crc",
1288 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
1289 { &hf_mpeg_pes_extension_flags,
1290 { "extension flags", "mpeg-pes.extension-flags",
1291 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
1292 { &hf_mpeg_pes_private_data,
1293 { "private data", "mpeg-pes.private-data",
1294 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
1295 { &hf_mpeg_pes_pack_length,
1296 { "pack length", "mpeg-pes.pack-length",
1297 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
1298 { &hf_mpeg_pes_sequence,
1299 { "sequence", "mpeg-pes.sequence",
1300 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
1301 { &hf_mpeg_pes_pstd_buffer,
1302 { "P-STD buffer size", "mpeg-pes.pstd-buffer",
1303 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
1304 { &hf_mpeg_pes_extension2,
1305 { "extension2", "mpeg-pes.extension2",
1306 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
1307 { &hf_mpeg_pes_padding,
1308 { "PES padding", "mpeg-pes.padding",
1309 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1310 { &hf_mpeg_pes_data,
1311 { "PES data", "mpeg-pes.data",
1312 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1313 { &hf_mpeg_video_sequence_header,
1314 { "MPEG sequence header", "mpeg-video.sequence",
1315 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1316 { &hf_mpeg_video_sequence_extension,
1317 { "MPEG sequence extension", "mpeg-video.sequence-ext",
1318 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1319 { &hf_mpeg_video_group_of_pictures,
1320 { "MPEG group of pictures", "mpeg-video.gop",
1321 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1322 { &hf_mpeg_video_picture,
1323 { "MPEG picture", "mpeg-video.picture",
1324 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1325 { &hf_mpeg_video_quantization_matrix,
1326 { "MPEG quantization matrix", "mpeg-video.quant",
1327 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1328 { &hf_mpeg_video_data,
1329 { "MPEG picture data", "mpeg-video.data",
1330 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1333 static gint *ett[] = {
1335 /*--- Included file: packet-mpeg-pes-ettarr.c ---*/
1336 #line 1 "packet-mpeg-pes-ettarr.c"
1338 &ett_mpeg_pes_Stream,
1339 &ett_mpeg_pes_Sequence_header,
1340 &ett_mpeg_pes_Sequence_extension,
1341 &ett_mpeg_pes_Group_of_pictures,
1342 &ett_mpeg_pes_Picture,
1344 /*--- End of included file: packet-mpeg-pes-ettarr.c ---*/
1345 #line 689 "packet-mpeg-pes-template.c"
1346 &ett_mpeg_pes_pack_header,
1347 &ett_mpeg_pes_header_data,
1348 &ett_mpeg_pes_trick_mode
1351 proto_mpeg = proto_register_protocol(
1352 "Moving Picture Experts Group", "MPEG", "mpeg");
1353 register_dissector("mpeg", dissect_mpeg, proto_mpeg);
1354 register_heur_dissector_list("mpeg", &heur_subdissector_list);
1356 proto_mpeg_pes = proto_register_protocol(
1357 "Packetized Elementary Stream", "MPEG PES", "mpeg-pes");
1358 proto_register_field_array(proto_mpeg_pes, hf, array_length(hf));
1359 proto_register_subtree_array(ett, array_length(ett));
1360 new_register_dissector("mpeg-pes", dissect_mpeg_pes, proto_mpeg_pes);
1364 proto_reg_handoff_mpeg_pes(void)
1366 dissector_handle_t mpeg_handle = find_dissector("mpeg");
1368 dissector_add_uint("wtap_encap", WTAP_ENCAP_MPEG, mpeg_handle);
1369 heur_dissector_add("mpeg", dissect_mpeg_pes, proto_mpeg_pes);