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>
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version 2
21 * of the License, or (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
42 #include <epan/packet.h>
43 #include <epan/asn1.h>
45 #include "packet-per.h"
48 /*--- Included file: packet-mpeg-pes-hf.c ---*/
49 #line 1 "packet-mpeg-pes-hf.c"
50 static int hf_mpeg_pes_prefix = -1; /* OCTET_STRING_SIZE_3 */
51 static int hf_mpeg_pes_stream = -1; /* T_stream */
52 static int hf_mpeg_pes_length = -1; /* INTEGER_0_65535 */
53 static int hf_mpeg_pes_must_be_one = -1; /* BOOLEAN */
54 static int hf_mpeg_pes_must_be_zero = -1; /* BOOLEAN */
55 static int hf_mpeg_pes_scrambling_control = -1; /* T_scrambling_control */
56 static int hf_mpeg_pes_priority = -1; /* BOOLEAN */
57 static int hf_mpeg_pes_data_alignment = -1; /* BOOLEAN */
58 static int hf_mpeg_pes_copyright = -1; /* BOOLEAN */
59 static int hf_mpeg_pes_original = -1; /* BOOLEAN */
60 static int hf_mpeg_pes_pts_flag = -1; /* BOOLEAN */
61 static int hf_mpeg_pes_dts_flag = -1; /* BOOLEAN */
62 static int hf_mpeg_pes_escr_flag = -1; /* BOOLEAN */
63 static int hf_mpeg_pes_es_rate_flag = -1; /* BOOLEAN */
64 static int hf_mpeg_pes_dsm_trick_mode_flag = -1; /* BOOLEAN */
65 static int hf_mpeg_pes_additional_copy_info_flag = -1; /* BOOLEAN */
66 static int hf_mpeg_pes_crc_flag = -1; /* BOOLEAN */
67 static int hf_mpeg_pes_extension_flag = -1; /* BOOLEAN */
68 static int hf_mpeg_pes_header_data_length = -1; /* INTEGER_0_255 */
69 static int hf_mpeg_pes_horizontal_size = -1; /* BIT_STRING_SIZE_12 */
70 static int hf_mpeg_pes_vertical_size = -1; /* BIT_STRING_SIZE_12 */
71 static int hf_mpeg_pes_aspect_ratio = -1; /* T_aspect_ratio */
72 static int hf_mpeg_pes_frame_rate = -1; /* T_frame_rate */
73 static int hf_mpeg_pes_bit_rate = -1; /* BIT_STRING_SIZE_18 */
74 static int hf_mpeg_pes_vbv_buffer_size = -1; /* BIT_STRING_SIZE_10 */
75 static int hf_mpeg_pes_constrained_parameters_flag = -1; /* BOOLEAN */
76 static int hf_mpeg_pes_load_intra_quantiser_matrix = -1; /* BOOLEAN */
77 static int hf_mpeg_pes_load_non_intra_quantiser_matrix = -1; /* BOOLEAN */
78 static int hf_mpeg_pes_must_be_0001 = -1; /* BIT_STRING_SIZE_4 */
79 static int hf_mpeg_pes_profile_and_level = -1; /* INTEGER_0_255 */
80 static int hf_mpeg_pes_progressive_sequence = -1; /* BOOLEAN */
81 static int hf_mpeg_pes_chroma_format = -1; /* INTEGER_0_3 */
82 static int hf_mpeg_pes_horizontal_size_extension = -1; /* INTEGER_0_3 */
83 static int hf_mpeg_pes_vertical_size_extension = -1; /* INTEGER_0_3 */
84 static int hf_mpeg_pes_bit_rate_extension = -1; /* BIT_STRING_SIZE_12 */
85 static int hf_mpeg_pes_vbv_buffer_size_extension = -1; /* INTEGER_0_255 */
86 static int hf_mpeg_pes_low_delay = -1; /* BOOLEAN */
87 static int hf_mpeg_pes_frame_rate_extension_n = -1; /* INTEGER_0_3 */
88 static int hf_mpeg_pes_frame_rate_extension_d = -1; /* INTEGER_0_3 */
89 static int hf_mpeg_pes_drop_frame_flag = -1; /* BOOLEAN */
90 static int hf_mpeg_pes_hour = -1; /* INTEGER_0_32 */
91 static int hf_mpeg_pes_minute = -1; /* INTEGER_0_64 */
92 static int hf_mpeg_pes_second = -1; /* INTEGER_0_64 */
93 static int hf_mpeg_pes_frame = -1; /* INTEGER_0_64 */
94 static int hf_mpeg_pes_closed_gop = -1; /* BOOLEAN */
95 static int hf_mpeg_pes_broken_gop = -1; /* BOOLEAN */
96 static int hf_mpeg_pes_must_be_zero_01 = -1; /* BIT_STRING_SIZE_5 */
97 static int hf_mpeg_pes_temporal_sequence_number = -1; /* BIT_STRING_SIZE_10 */
98 static int hf_mpeg_pes_frame_type = -1; /* T_frame_type */
99 static int hf_mpeg_pes_vbv_delay = -1; /* BIT_STRING_SIZE_16 */
101 /*--- End of included file: packet-mpeg-pes-hf.c ---*/
102 #line 40 "packet-mpeg-pes-template.c"
104 /*--- Included file: packet-mpeg-pes-ett.c ---*/
105 #line 1 "packet-mpeg-pes-ett.c"
106 static gint ett_mpeg_pes_PES = -1;
107 static gint ett_mpeg_pes_Stream = -1;
108 static gint ett_mpeg_pes_Sequence_header = -1;
109 static gint ett_mpeg_pes_Sequence_extension = -1;
110 static gint ett_mpeg_pes_Group_of_pictures = -1;
111 static gint ett_mpeg_pes_Picture = -1;
113 /*--- End of included file: packet-mpeg-pes-ett.c ---*/
114 #line 41 "packet-mpeg-pes-template.c"
116 /*--- Included file: packet-mpeg-pes-fn.c ---*/
117 #line 1 "packet-mpeg-pes-fn.c"
121 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_) {
122 offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
129 static const value_string mpeg_pes_T_stream_vals[] = {
131 { 179, "sequence-header" },
132 { 181, "sequence-header-extension" },
133 { 184, "group-of-pictures" },
134 { 185, "program-end" },
135 { 186, "pack-header" },
136 { 187, "system-header" },
137 { 188, "program-stream-map" },
138 { 189, "private-stream-1" },
139 { 190, "padding-stream" },
140 { 191, "private-stream-2" },
141 { 192, "audio-stream" },
142 { 224, "video-stream" },
148 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_) {
149 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
150 0U, 255U, NULL, FALSE);
156 static const per_sequence_t PES_sequence[] = {
157 { &hf_mpeg_pes_prefix , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_OCTET_STRING_SIZE_3 },
158 { &hf_mpeg_pes_stream , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_T_stream },
163 dissect_mpeg_pes_PES(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
164 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
165 ett_mpeg_pes_PES, PES_sequence);
173 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_) {
174 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
175 0U, 65535U, NULL, FALSE);
183 dissect_mpeg_pes_BOOLEAN(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
184 offset = dissect_per_boolean(tvb, offset, actx, tree, hf_index, NULL);
190 static const value_string mpeg_pes_T_scrambling_control_vals[] = {
191 { 0, "not-scrambled" },
197 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_) {
198 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
199 0U, 3U, NULL, FALSE);
207 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_) {
208 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
209 0U, 255U, NULL, FALSE);
215 static const per_sequence_t Stream_sequence[] = {
216 { &hf_mpeg_pes_length , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_65535 },
217 { &hf_mpeg_pes_must_be_one, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
218 { &hf_mpeg_pes_must_be_zero, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
219 { &hf_mpeg_pes_scrambling_control, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_T_scrambling_control },
220 { &hf_mpeg_pes_priority , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
221 { &hf_mpeg_pes_data_alignment, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
222 { &hf_mpeg_pes_copyright , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
223 { &hf_mpeg_pes_original , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
224 { &hf_mpeg_pes_pts_flag , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
225 { &hf_mpeg_pes_dts_flag , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
226 { &hf_mpeg_pes_escr_flag , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
227 { &hf_mpeg_pes_es_rate_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
228 { &hf_mpeg_pes_dsm_trick_mode_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
229 { &hf_mpeg_pes_additional_copy_info_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
230 { &hf_mpeg_pes_crc_flag , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
231 { &hf_mpeg_pes_extension_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
232 { &hf_mpeg_pes_header_data_length, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_255 },
237 dissect_mpeg_pes_Stream(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
238 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
239 ett_mpeg_pes_Stream, Stream_sequence);
247 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_) {
248 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
249 12, 12, FALSE, NULL);
255 static const value_string mpeg_pes_T_aspect_ratio_vals[] = {
256 { 1, "aspect-1to1" },
257 { 2, "aspect-4to3" },
258 { 3, "aspect-16to9" },
259 { 4, "aspect-2-21to1" },
265 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_) {
266 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
267 0U, 15U, NULL, FALSE);
273 static const value_string mpeg_pes_T_frame_rate_vals[] = {
286 static guint32 T_frame_rate_value_map[9+0] = {0, 23976, 24000, 25000, 29970, 30000, 50000, 59940, 60000};
289 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_) {
290 offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index,
291 9, NULL, FALSE, 0, T_frame_rate_value_map);
299 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_) {
300 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
301 18, 18, FALSE, NULL);
309 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_) {
310 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
311 10, 10, FALSE, NULL);
317 static const per_sequence_t Sequence_header_sequence[] = {
318 { &hf_mpeg_pes_horizontal_size, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_12 },
319 { &hf_mpeg_pes_vertical_size, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_12 },
320 { &hf_mpeg_pes_aspect_ratio, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_T_aspect_ratio },
321 { &hf_mpeg_pes_frame_rate , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_T_frame_rate },
322 { &hf_mpeg_pes_bit_rate , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_18 },
323 { &hf_mpeg_pes_must_be_one, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
324 { &hf_mpeg_pes_vbv_buffer_size, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_10 },
325 { &hf_mpeg_pes_constrained_parameters_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
326 { &hf_mpeg_pes_load_intra_quantiser_matrix, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
327 { &hf_mpeg_pes_load_non_intra_quantiser_matrix, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
332 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_) {
333 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
334 ett_mpeg_pes_Sequence_header, Sequence_header_sequence);
342 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_) {
343 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
352 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_) {
353 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
354 0U, 3U, NULL, FALSE);
360 static const per_sequence_t Sequence_extension_sequence[] = {
361 { &hf_mpeg_pes_must_be_0001, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_4 },
362 { &hf_mpeg_pes_profile_and_level, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_255 },
363 { &hf_mpeg_pes_progressive_sequence, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
364 { &hf_mpeg_pes_chroma_format, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_3 },
365 { &hf_mpeg_pes_horizontal_size_extension, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_3 },
366 { &hf_mpeg_pes_vertical_size_extension, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_3 },
367 { &hf_mpeg_pes_bit_rate_extension, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_12 },
368 { &hf_mpeg_pes_must_be_one, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
369 { &hf_mpeg_pes_vbv_buffer_size_extension, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_255 },
370 { &hf_mpeg_pes_low_delay , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
371 { &hf_mpeg_pes_frame_rate_extension_n, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_3 },
372 { &hf_mpeg_pes_frame_rate_extension_d, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_3 },
377 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_) {
378 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
379 ett_mpeg_pes_Sequence_extension, Sequence_extension_sequence);
387 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_) {
388 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
389 0U, 32U, NULL, FALSE);
397 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_) {
398 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
399 0U, 64U, NULL, FALSE);
407 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_) {
408 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
415 static const per_sequence_t Group_of_pictures_sequence[] = {
416 { &hf_mpeg_pes_drop_frame_flag, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
417 { &hf_mpeg_pes_hour , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_32 },
418 { &hf_mpeg_pes_minute , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_64 },
419 { &hf_mpeg_pes_must_be_one, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
420 { &hf_mpeg_pes_second , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_64 },
421 { &hf_mpeg_pes_frame , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_INTEGER_0_64 },
422 { &hf_mpeg_pes_closed_gop , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
423 { &hf_mpeg_pes_broken_gop , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BOOLEAN },
424 { &hf_mpeg_pes_must_be_zero_01, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_5 },
429 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_) {
430 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
431 ett_mpeg_pes_Group_of_pictures, Group_of_pictures_sequence);
437 static const value_string mpeg_pes_T_frame_type_vals[] = {
447 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_) {
448 offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
449 0U, 7U, NULL, FALSE);
457 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_) {
458 offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
459 16, 16, FALSE, NULL);
465 static const per_sequence_t Picture_sequence[] = {
466 { &hf_mpeg_pes_temporal_sequence_number, ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_10 },
467 { &hf_mpeg_pes_frame_type , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_T_frame_type },
468 { &hf_mpeg_pes_vbv_delay , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_mpeg_pes_BIT_STRING_SIZE_16 },
473 dissect_mpeg_pes_Picture(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
474 offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
475 ett_mpeg_pes_Picture, Picture_sequence);
481 /*--- End of included file: packet-mpeg-pes-fn.c ---*/
482 #line 42 "packet-mpeg-pes-template.c"
484 static int proto_mpeg = -1;
485 static int proto_mpeg_pes = -1;
487 static int ett_mpeg_pes_pack_header = -1;
488 static int ett_mpeg_pes_header_data = -1;
490 static int hf_mpeg_pes_pack_header = -1;
491 static int hf_mpeg_pes_scr = -1;
492 static int hf_mpeg_pes_program_mux_rate = -1;
493 static int hf_mpeg_pes_stuffing_length = -1;
494 static int hf_mpeg_pes_stuffing = -1;
495 static int hf_mpeg_pes_extension = -1;
496 static int hf_mpeg_pes_header_data = -1;
497 static int hf_mpeg_pes_pts = -1;
498 static int hf_mpeg_pes_dts = -1;
499 static int hf_mpeg_pes_escr = -1;
500 static int hf_mpeg_pes_es_rate = -1;
501 static int hf_mpeg_pes_copy_info = -1;
502 static int hf_mpeg_pes_crc = -1;
503 static int hf_mpeg_pes_extension_flags = -1;
504 static int hf_mpeg_pes_private_data = -1;
505 static int hf_mpeg_pes_pack_length = -1;
506 static int hf_mpeg_pes_sequence = -1;
507 static int hf_mpeg_pes_pstd_buffer = -1;
508 static int hf_mpeg_pes_extension2 = -1;
509 static int hf_mpeg_pes_padding = -1;
510 static int hf_mpeg_pes_data = -1;
512 static int hf_mpeg_video_sequence_header = -1;
513 static int hf_mpeg_video_sequence_extension = -1;
514 static int hf_mpeg_video_group_of_pictures = -1;
515 static int hf_mpeg_video_picture = -1;
516 static int hf_mpeg_video_quantization_matrix = -1;
517 static int hf_mpeg_video_data = -1;
519 enum { PES_PREFIX = 1 };
522 STREAM_PICTURE = 0x00,
523 STREAM_SEQUENCE = 0xb3,
524 STREAM_SEQUENCE_EXTENSION = 0xb5,
528 STREAM_SYSTEM = 0xbb,
529 STREAM_PROGRAM = 0xbc,
530 STREAM_PRIVATE1 = 0xbd,
531 STREAM_PADDING = 0xbe,
532 STREAM_PRIVATE2 = 0xbf,
542 DSM_TRICK_MODE_FLAG = 0x08,
543 COPY_INFO_FLAG = 0x04,
545 EXTENSION_FLAG = 0x01
549 PRIVATE_DATA_FLAG = 0x80,
550 PACK_LENGTH_FLAG = 0x40,
551 SEQUENCE_FLAG = 0x20,
552 PSTD_BUFFER_FLAG = 0x10,
554 EXTENSION_FLAG2 = 0x01
557 static guint64 tvb_get_ntoh40(tvbuff_t *tvb, unsigned offset)
559 return (guint64)tvb_get_guint8(tvb, offset) << 32
560 | tvb_get_ntohl(tvb, offset + 1);
563 static guint64 tvb_get_ntoh48(tvbuff_t *tvb, unsigned offset)
565 return (guint64)tvb_get_ntohs(tvb, offset) << 32
566 | tvb_get_ntohl(tvb, offset + 2);
571 static guint64 decode_time_stamp(tvbuff_t *tvb, unsigned offset, nstime_t *nst)
573 guint64 bytes = tvb_get_ntoh40(tvb, offset);
575 (bytes >> 33 & 0x0007) << 30 |
576 (bytes >> 17 & 0x7fff) << 15 |
577 (bytes >> 1 & 0x7fff) << 0;
578 unsigned rem = (unsigned)(ts % TSHZ);
579 nst->secs = (time_t)(ts / TSHZ);
580 nst->nsecs = (int)(G_GINT64_CONSTANT(1000000000) * rem / TSHZ);
584 #define SCRHZ 27000000
586 static guint64 decode_clock_reference(tvbuff_t *tvb, unsigned offset,
589 guint64 bytes = tvb_get_ntoh48(tvb, offset);
591 (bytes >> 43 & 0x0007) << 30 |
592 (bytes >> 27 & 0x7fff) << 15 |
593 (bytes >> 11 & 0x7fff) << 0;
594 unsigned ext = (unsigned)((bytes >> 1) & 0x1ff);
595 guint64 cr = 300 * ts + ext;
596 unsigned rem = (unsigned)(cr % SCRHZ);
597 nst->secs = (time_t)(cr / SCRHZ);
598 nst->nsecs = (int)(G_GINT64_CONSTANT(1000000000) * rem / SCRHZ);
603 dissect_mpeg_pes_header_data(tvbuff_t *tvb, packet_info *pinfo,
604 proto_tree *root, unsigned flags)
606 proto_item *item = proto_tree_add_item(root, hf_mpeg_pes_header_data, tvb,
608 proto_tree *tree = proto_item_add_subtree(item, ett_mpeg_pes_header_data);
611 if (flags & PTS_FLAG) {
613 decode_time_stamp(tvb, offset, &nst);
614 proto_tree_add_time(tree, hf_mpeg_pes_pts, tvb,
618 if (check_col(pinfo->cinfo, COL_DEF_DST)) {
619 SET_ADDRESS(&pinfo->dst, AT_NONE, 0, NULL);
620 col_add_fstr(pinfo->cinfo, COL_DEF_DST,
622 (long) nst.secs, nst.nsecs);
625 if (flags & DTS_FLAG) {
627 decode_time_stamp(tvb, offset, &nst);
628 proto_tree_add_time(tree, hf_mpeg_pes_dts, tvb,
632 if (check_col(pinfo->cinfo, COL_DEF_SRC)) {
633 SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
634 col_add_fstr(pinfo->cinfo, COL_DEF_SRC,
636 (long) nst.secs, nst.nsecs);
639 if (flags & ESCR_FLAG) {
641 decode_clock_reference(tvb, offset, &nst);
642 proto_tree_add_time(tree, hf_mpeg_pes_escr, tvb,
646 if (flags & ES_RATE_FLAG) {
647 unsigned es_rate = (tvb_get_ntohs(tvb, offset) >> 1 & 0x3fff) * 50;
648 proto_tree_add_uint(tree, hf_mpeg_pes_es_rate, tvb,
652 if (flags & COPY_INFO_FLAG) {
653 proto_tree_add_item(tree, hf_mpeg_pes_copy_info, tvb,
657 if (flags & CRC_FLAG) {
658 proto_tree_add_item(tree, hf_mpeg_pes_crc, tvb,
663 if (flags & EXTENSION_FLAG) {
664 int flags2 = tvb_get_guint8(tvb, offset);
665 proto_tree_add_item(tree, hf_mpeg_pes_extension_flags, tvb,
669 if (flags2 & PRIVATE_DATA_FLAG) {
670 proto_tree_add_item(tree, hf_mpeg_pes_private_data, tvb,
674 if (flags2 & PACK_LENGTH_FLAG) {
675 proto_tree_add_item(tree, hf_mpeg_pes_pack_length, tvb,
679 if (flags2 & SEQUENCE_FLAG) {
680 proto_tree_add_item(tree, hf_mpeg_pes_sequence, tvb,
684 if (flags2 & PSTD_BUFFER_FLAG) {
685 unsigned pstd = tvb_get_ntohs(tvb, offset);
686 proto_tree_add_uint(tree, hf_mpeg_pes_pstd_buffer, tvb,
687 offset, 2, (pstd & 0x2000 ? 1024 : 128) * (pstd & 0x1ff));
690 if (flags2 & EXTENSION_FLAG2) {
691 proto_tree_add_item(tree, hf_mpeg_pes_extension2, tvb,
699 dissect_mpeg_pes_pack_header(tvbuff_t *tvb, unsigned offset,
700 packet_info *pinfo, proto_tree *root)
702 unsigned program_mux_rate, stuffing_length;
704 proto_item *item = proto_tree_add_item(root, hf_mpeg_pes_pack_header, tvb,
705 offset / 8, 10, FALSE);
706 proto_tree *tree = proto_item_add_subtree(item, ett_mpeg_pes_pack_header);
709 decode_clock_reference(tvb, offset / 8, &nst);
710 proto_tree_add_time(tree, hf_mpeg_pes_scr, tvb, offset / 8, 6, &nst);
713 program_mux_rate = (tvb_get_ntoh24(tvb, offset / 8) >> 2) * 50;
714 proto_tree_add_uint(tree, hf_mpeg_pes_program_mux_rate, tvb, offset / 8, 3,
718 if (check_col(pinfo->cinfo, COL_DEF_SRC)) {
719 SET_ADDRESS(&pinfo->src, AT_NONE, 0, NULL);
720 col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "%u B/s", program_mux_rate);
723 stuffing_length = tvb_get_guint8(tvb, offset / 8) & 0x07;
724 proto_tree_add_item(tree, hf_mpeg_pes_stuffing_length, tvb,
725 offset / 8, 1, FALSE);
728 if (stuffing_length > 0) {
729 proto_tree_add_item(tree, hf_mpeg_pes_stuffing, tvb,
730 offset / 8, stuffing_length, FALSE);
731 offset += stuffing_length * 8;
738 dissect_mpeg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
741 dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
748 if (!tvb_bytes_exist(tvb, 0, 3))
749 return FALSE; /* not enough bytes for a PES prefix */
751 prefix = tvb_get_ntoh24(tvb, 0);
752 if (prefix != PES_PREFIX)
754 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG PES");
755 col_clear(pinfo->cinfo, COL_INFO);
757 stream = tvb_get_guint8(tvb, 3);
758 if (check_col(pinfo->cinfo, COL_INFO)) {
759 const char *s = match_strval(stream, mpeg_pes_T_stream_vals);
761 col_set_str(pinfo->cinfo, COL_INFO, s);
768 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
769 offset = dissect_mpeg_pes_PES(tvb, offset, &asn1_ctx,
770 tree, proto_mpeg_pes);
772 if (stream == STREAM_PICTURE) {
775 frame_type = tvb_get_guint8(tvb, 5) >> 3 & 0x07;
776 if (check_col(pinfo->cinfo, COL_INFO)) {
777 const char *s = match_strval(frame_type,
778 mpeg_pes_T_frame_type_vals);
780 col_set_str(pinfo->cinfo, COL_INFO, s);
783 offset = dissect_mpeg_pes_Picture(tvb, offset, &asn1_ctx,
784 tree, hf_mpeg_video_picture);
785 proto_tree_add_item(tree, hf_mpeg_video_data, tvb,
786 offset / 8, -1, FALSE);
787 } else if (stream == STREAM_SEQUENCE) {
790 offset = dissect_mpeg_pes_Sequence_header(tvb, offset, &asn1_ctx,
791 tree, hf_mpeg_video_sequence_header);
793 proto_tree_add_item(tree, hf_mpeg_video_quantization_matrix, tvb,
794 offset / 8, 64, FALSE);
797 es = tvb_new_subset_remaining(tvb, offset / 8);
798 dissect_mpeg_pes(es, pinfo, tree);
799 } else if (stream == STREAM_SEQUENCE_EXTENSION) {
802 offset = dissect_mpeg_pes_Sequence_extension(tvb, offset, &asn1_ctx,
803 tree, hf_mpeg_video_sequence_extension);
805 es = tvb_new_subset_remaining(tvb, offset / 8);
806 dissect_mpeg_pes(es, pinfo, tree);
807 } else if (stream == STREAM_GOP) {
810 offset = dissect_mpeg_pes_Group_of_pictures(tvb, offset, &asn1_ctx,
811 tree, hf_mpeg_video_group_of_pictures);
813 es = tvb_new_subset_remaining(tvb, offset / 8);
814 dissect_mpeg_pes(es, pinfo, tree);
815 } else if (stream == STREAM_PACK) {
816 if (tvb_get_guint8(tvb, offset / 8) >> 6 == 1) {
817 offset = dissect_mpeg_pes_pack_header(tvb, offset, pinfo, tree);
819 proto_tree_add_item(tree, hf_mpeg_pes_data, tvb,
820 offset / 8, 8, FALSE);
823 } else if (stream == STREAM_SYSTEM || stream == STREAM_PRIVATE2) {
824 unsigned data_length = tvb_get_ntohs(tvb, offset / 8);
825 proto_tree_add_item(tree, hf_mpeg_pes_length, tvb,
826 offset / 8, 2, FALSE);
829 proto_tree_add_item(tree, hf_mpeg_pes_data, tvb,
830 offset / 8, data_length, FALSE);
831 } else if (stream == STREAM_PADDING) {
832 unsigned padding_length = tvb_get_ntohs(tvb, offset / 8);
833 proto_tree_add_item(tree, hf_mpeg_pes_length, tvb,
834 offset / 8, 2, FALSE);
837 proto_tree_add_item(tree, hf_mpeg_pes_padding, tvb,
838 offset / 8, padding_length, FALSE);
839 } else if (stream == STREAM_PRIVATE1
840 || stream >= STREAM_AUDIO) {
841 int length = tvb_get_ntohs(tvb, 4);
843 if ((tvb_get_guint8(tvb, 6) & 0xc0) == 0x80) {
847 offset = dissect_mpeg_pes_Stream(tvb, offset, &asn1_ctx,
848 tree, hf_mpeg_pes_extension);
849 /* https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2229
850 * A value of 0 indicates that the PES packet length is neither specified nor
851 * bounded and is allowed only in PES packets whose payload is a video elementary
852 * stream contained in Transport Stream packets.
853 * XXX Some one with access to the spec should check this
855 if(length !=0 && stream != STREAM_VIDEO){
859 header_length = tvb_get_guint8(tvb, 8);
860 if (header_length > 0) {
861 int flags = tvb_get_guint8(tvb, 7);
862 tvbuff_t *header_data = tvb_new_subset(tvb, offset / 8,
863 header_length, header_length);
864 dissect_mpeg_pes_header_data(header_data, pinfo, tree, flags);
865 offset += header_length * 8;
866 /* lenght may be zero for Video stream */
867 if(length !=0 && stream != STREAM_VIDEO){
868 length -= header_length * 8;
872 /* lenght may be zero for Video stream */
874 proto_tree_add_item(tree, hf_mpeg_pes_data, tvb, (offset>>3),-1, FALSE);
878 es = tvb_new_subset(tvb, offset / 8, -1, length / 8);
879 if (tvb_get_ntoh24(es, 0) == PES_PREFIX)
880 dissect_mpeg_pes(es, pinfo, tree);
881 else if (tvb_get_guint8(es, 0) == 0xff)
882 dissect_mpeg(es, pinfo, tree);
884 proto_tree_add_item(tree, hf_mpeg_pes_data, es,
887 unsigned data_length = tvb_get_ntohs(tvb, offset / 8);
888 proto_tree_add_item(tree, hf_mpeg_pes_length, tvb,
889 offset / 8, 2, FALSE);
892 proto_tree_add_item(tree, hf_mpeg_pes_data, tvb,
893 offset / 8, data_length, FALSE);
896 proto_tree_add_item(tree, hf_mpeg_pes_data, tvb,
897 offset / 8, -1, FALSE);
902 static heur_dissector_list_t heur_subdissector_list;
905 dissect_mpeg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
907 if (!dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree)) {
908 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG");
909 col_clear(pinfo->cinfo, COL_INFO);
911 proto_tree_add_item(tree, proto_mpeg, tvb, 0, -1, FALSE);
916 proto_register_mpeg_pes(void)
918 static hf_register_info hf[] = {
920 /*--- Included file: packet-mpeg-pes-hfarr.c ---*/
921 #line 1 "packet-mpeg-pes-hfarr.c"
922 { &hf_mpeg_pes_prefix,
923 { "prefix", "mpeg-pes.prefix",
924 FT_BYTES, BASE_NONE, NULL, 0,
925 "mpeg_pes.OCTET_STRING_SIZE_3", HFILL }},
926 { &hf_mpeg_pes_stream,
927 { "stream", "mpeg-pes.stream",
928 FT_UINT8, BASE_HEX, VALS(mpeg_pes_T_stream_vals), 0,
929 "mpeg_pes.T_stream", HFILL }},
930 { &hf_mpeg_pes_length,
931 { "length", "mpeg-pes.length",
932 FT_UINT16, BASE_DEC, NULL, 0,
933 "mpeg_pes.INTEGER_0_65535", HFILL }},
934 { &hf_mpeg_pes_must_be_one,
935 { "must-be-one", "mpeg-pes.must_be_one",
936 FT_BOOLEAN, BASE_NONE, NULL, 0,
937 "mpeg_pes.BOOLEAN", HFILL }},
938 { &hf_mpeg_pes_must_be_zero,
939 { "must-be-zero", "mpeg-pes.must_be_zero",
940 FT_BOOLEAN, BASE_NONE, NULL, 0,
941 "mpeg_pes.BOOLEAN", HFILL }},
942 { &hf_mpeg_pes_scrambling_control,
943 { "scrambling-control", "mpeg-pes.scrambling_control",
944 FT_UINT32, BASE_DEC, VALS(mpeg_pes_T_scrambling_control_vals), 0,
945 "mpeg_pes.T_scrambling_control", HFILL }},
946 { &hf_mpeg_pes_priority,
947 { "priority", "mpeg-pes.priority",
948 FT_BOOLEAN, BASE_NONE, NULL, 0,
949 "mpeg_pes.BOOLEAN", HFILL }},
950 { &hf_mpeg_pes_data_alignment,
951 { "data-alignment", "mpeg-pes.data_alignment",
952 FT_BOOLEAN, BASE_NONE, NULL, 0,
953 "mpeg_pes.BOOLEAN", HFILL }},
954 { &hf_mpeg_pes_copyright,
955 { "copyright", "mpeg-pes.copyright",
956 FT_BOOLEAN, BASE_NONE, NULL, 0,
957 "mpeg_pes.BOOLEAN", HFILL }},
958 { &hf_mpeg_pes_original,
959 { "original", "mpeg-pes.original",
960 FT_BOOLEAN, BASE_NONE, NULL, 0,
961 "mpeg_pes.BOOLEAN", HFILL }},
962 { &hf_mpeg_pes_pts_flag,
963 { "pts-flag", "mpeg-pes.pts_flag",
964 FT_BOOLEAN, BASE_NONE, NULL, 0,
965 "mpeg_pes.BOOLEAN", HFILL }},
966 { &hf_mpeg_pes_dts_flag,
967 { "dts-flag", "mpeg-pes.dts_flag",
968 FT_BOOLEAN, BASE_NONE, NULL, 0,
969 "mpeg_pes.BOOLEAN", HFILL }},
970 { &hf_mpeg_pes_escr_flag,
971 { "escr-flag", "mpeg-pes.escr_flag",
972 FT_BOOLEAN, BASE_NONE, NULL, 0,
973 "mpeg_pes.BOOLEAN", HFILL }},
974 { &hf_mpeg_pes_es_rate_flag,
975 { "es-rate-flag", "mpeg-pes.es_rate_flag",
976 FT_BOOLEAN, BASE_NONE, NULL, 0,
977 "mpeg_pes.BOOLEAN", HFILL }},
978 { &hf_mpeg_pes_dsm_trick_mode_flag,
979 { "dsm-trick-mode-flag", "mpeg-pes.dsm_trick_mode_flag",
980 FT_BOOLEAN, BASE_NONE, NULL, 0,
981 "mpeg_pes.BOOLEAN", HFILL }},
982 { &hf_mpeg_pes_additional_copy_info_flag,
983 { "additional-copy-info-flag", "mpeg-pes.additional_copy_info_flag",
984 FT_BOOLEAN, BASE_NONE, NULL, 0,
985 "mpeg_pes.BOOLEAN", HFILL }},
986 { &hf_mpeg_pes_crc_flag,
987 { "crc-flag", "mpeg-pes.crc_flag",
988 FT_BOOLEAN, BASE_NONE, NULL, 0,
989 "mpeg_pes.BOOLEAN", HFILL }},
990 { &hf_mpeg_pes_extension_flag,
991 { "extension-flag", "mpeg-pes.extension_flag",
992 FT_BOOLEAN, BASE_NONE, NULL, 0,
993 "mpeg_pes.BOOLEAN", HFILL }},
994 { &hf_mpeg_pes_header_data_length,
995 { "header-data-length", "mpeg-pes.header_data_length",
996 FT_UINT32, BASE_DEC, NULL, 0,
997 "mpeg_pes.INTEGER_0_255", HFILL }},
998 { &hf_mpeg_pes_horizontal_size,
999 { "horizontal-size", "mpeg-pes.horizontal_size",
1000 FT_BYTES, BASE_NONE, NULL, 0,
1001 "mpeg_pes.BIT_STRING_SIZE_12", HFILL }},
1002 { &hf_mpeg_pes_vertical_size,
1003 { "vertical-size", "mpeg-pes.vertical_size",
1004 FT_BYTES, BASE_NONE, NULL, 0,
1005 "mpeg_pes.BIT_STRING_SIZE_12", HFILL }},
1006 { &hf_mpeg_pes_aspect_ratio,
1007 { "aspect-ratio", "mpeg-pes.aspect_ratio",
1008 FT_UINT32, BASE_DEC, VALS(mpeg_pes_T_aspect_ratio_vals), 0,
1009 "mpeg_pes.T_aspect_ratio", HFILL }},
1010 { &hf_mpeg_pes_frame_rate,
1011 { "frame-rate", "mpeg-pes.frame_rate",
1012 FT_UINT32, BASE_DEC, VALS(mpeg_pes_T_frame_rate_vals), 0,
1013 "mpeg_pes.T_frame_rate", HFILL }},
1014 { &hf_mpeg_pes_bit_rate,
1015 { "bit-rate", "mpeg-pes.bit_rate",
1016 FT_BYTES, BASE_NONE, NULL, 0,
1017 "mpeg_pes.BIT_STRING_SIZE_18", HFILL }},
1018 { &hf_mpeg_pes_vbv_buffer_size,
1019 { "vbv-buffer-size", "mpeg-pes.vbv_buffer_size",
1020 FT_BYTES, BASE_NONE, NULL, 0,
1021 "mpeg_pes.BIT_STRING_SIZE_10", HFILL }},
1022 { &hf_mpeg_pes_constrained_parameters_flag,
1023 { "constrained-parameters-flag", "mpeg-pes.constrained_parameters_flag",
1024 FT_BOOLEAN, BASE_NONE, NULL, 0,
1025 "mpeg_pes.BOOLEAN", HFILL }},
1026 { &hf_mpeg_pes_load_intra_quantiser_matrix,
1027 { "load-intra-quantiser-matrix", "mpeg-pes.load_intra_quantiser_matrix",
1028 FT_BOOLEAN, BASE_NONE, NULL, 0,
1029 "mpeg_pes.BOOLEAN", HFILL }},
1030 { &hf_mpeg_pes_load_non_intra_quantiser_matrix,
1031 { "load-non-intra-quantiser-matrix", "mpeg-pes.load_non_intra_quantiser_matrix",
1032 FT_BOOLEAN, BASE_NONE, NULL, 0,
1033 "mpeg_pes.BOOLEAN", HFILL }},
1034 { &hf_mpeg_pes_must_be_0001,
1035 { "must-be-0001", "mpeg-pes.must_be_0001",
1036 FT_BYTES, BASE_NONE, NULL, 0,
1037 "mpeg_pes.BIT_STRING_SIZE_4", HFILL }},
1038 { &hf_mpeg_pes_profile_and_level,
1039 { "profile-and-level", "mpeg-pes.profile_and_level",
1040 FT_UINT32, BASE_DEC, NULL, 0,
1041 "mpeg_pes.INTEGER_0_255", HFILL }},
1042 { &hf_mpeg_pes_progressive_sequence,
1043 { "progressive-sequence", "mpeg-pes.progressive_sequence",
1044 FT_BOOLEAN, BASE_NONE, NULL, 0,
1045 "mpeg_pes.BOOLEAN", HFILL }},
1046 { &hf_mpeg_pes_chroma_format,
1047 { "chroma-format", "mpeg-pes.chroma_format",
1048 FT_UINT32, BASE_DEC, NULL, 0,
1049 "mpeg_pes.INTEGER_0_3", HFILL }},
1050 { &hf_mpeg_pes_horizontal_size_extension,
1051 { "horizontal-size-extension", "mpeg-pes.horizontal_size_extension",
1052 FT_UINT32, BASE_DEC, NULL, 0,
1053 "mpeg_pes.INTEGER_0_3", HFILL }},
1054 { &hf_mpeg_pes_vertical_size_extension,
1055 { "vertical-size-extension", "mpeg-pes.vertical_size_extension",
1056 FT_UINT32, BASE_DEC, NULL, 0,
1057 "mpeg_pes.INTEGER_0_3", HFILL }},
1058 { &hf_mpeg_pes_bit_rate_extension,
1059 { "bit-rate-extension", "mpeg-pes.bit_rate_extension",
1060 FT_BYTES, BASE_NONE, NULL, 0,
1061 "mpeg_pes.BIT_STRING_SIZE_12", HFILL }},
1062 { &hf_mpeg_pes_vbv_buffer_size_extension,
1063 { "vbv-buffer-size-extension", "mpeg-pes.vbv_buffer_size_extension",
1064 FT_UINT32, BASE_DEC, NULL, 0,
1065 "mpeg_pes.INTEGER_0_255", HFILL }},
1066 { &hf_mpeg_pes_low_delay,
1067 { "low-delay", "mpeg-pes.low_delay",
1068 FT_BOOLEAN, BASE_NONE, NULL, 0,
1069 "mpeg_pes.BOOLEAN", HFILL }},
1070 { &hf_mpeg_pes_frame_rate_extension_n,
1071 { "frame-rate-extension-n", "mpeg-pes.frame_rate_extension_n",
1072 FT_UINT32, BASE_DEC, NULL, 0,
1073 "mpeg_pes.INTEGER_0_3", HFILL }},
1074 { &hf_mpeg_pes_frame_rate_extension_d,
1075 { "frame-rate-extension-d", "mpeg-pes.frame_rate_extension_d",
1076 FT_UINT32, BASE_DEC, NULL, 0,
1077 "mpeg_pes.INTEGER_0_3", HFILL }},
1078 { &hf_mpeg_pes_drop_frame_flag,
1079 { "drop-frame-flag", "mpeg-pes.drop_frame_flag",
1080 FT_BOOLEAN, BASE_NONE, NULL, 0,
1081 "mpeg_pes.BOOLEAN", HFILL }},
1082 { &hf_mpeg_pes_hour,
1083 { "hour", "mpeg-pes.hour",
1084 FT_UINT32, BASE_DEC, NULL, 0,
1085 "mpeg_pes.INTEGER_0_32", HFILL }},
1086 { &hf_mpeg_pes_minute,
1087 { "minute", "mpeg-pes.minute",
1088 FT_UINT32, BASE_DEC, NULL, 0,
1089 "mpeg_pes.INTEGER_0_64", HFILL }},
1090 { &hf_mpeg_pes_second,
1091 { "second", "mpeg-pes.second",
1092 FT_UINT32, BASE_DEC, NULL, 0,
1093 "mpeg_pes.INTEGER_0_64", HFILL }},
1094 { &hf_mpeg_pes_frame,
1095 { "frame", "mpeg-pes.frame",
1096 FT_UINT32, BASE_DEC, NULL, 0,
1097 "mpeg_pes.INTEGER_0_64", HFILL }},
1098 { &hf_mpeg_pes_closed_gop,
1099 { "closed-gop", "mpeg-pes.closed_gop",
1100 FT_BOOLEAN, BASE_NONE, NULL, 0,
1101 "mpeg_pes.BOOLEAN", HFILL }},
1102 { &hf_mpeg_pes_broken_gop,
1103 { "broken-gop", "mpeg-pes.broken_gop",
1104 FT_BOOLEAN, BASE_NONE, NULL, 0,
1105 "mpeg_pes.BOOLEAN", HFILL }},
1106 { &hf_mpeg_pes_must_be_zero_01,
1107 { "must-be-zero", "mpeg-pes.must_be_zero",
1108 FT_BYTES, BASE_NONE, NULL, 0,
1109 "mpeg_pes.BIT_STRING_SIZE_5", HFILL }},
1110 { &hf_mpeg_pes_temporal_sequence_number,
1111 { "temporal-sequence-number", "mpeg-pes.temporal_sequence_number",
1112 FT_BYTES, BASE_NONE, NULL, 0,
1113 "mpeg_pes.BIT_STRING_SIZE_10", HFILL }},
1114 { &hf_mpeg_pes_frame_type,
1115 { "frame-type", "mpeg-pes.frame_type",
1116 FT_UINT32, BASE_DEC, VALS(mpeg_pes_T_frame_type_vals), 0,
1117 "mpeg_pes.T_frame_type", HFILL }},
1118 { &hf_mpeg_pes_vbv_delay,
1119 { "vbv-delay", "mpeg-pes.vbv_delay",
1120 FT_BYTES, BASE_NONE, NULL, 0,
1121 "mpeg_pes.BIT_STRING_SIZE_16", HFILL }},
1123 /*--- End of included file: packet-mpeg-pes-hfarr.c ---*/
1124 #line 483 "packet-mpeg-pes-template.c"
1125 { &hf_mpeg_pes_pack_header,
1126 { "Pack header", "mpeg-pes.pack",
1127 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1129 { "system clock reference (SCR)", "mpeg-pes.scr",
1130 FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
1131 { &hf_mpeg_pes_program_mux_rate,
1132 { "PES program mux rate", "mpeg-pes.program-mux-rate",
1133 FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL }},
1134 { &hf_mpeg_pes_stuffing_length,
1135 { "PES stuffing length", "mpeg-pes.stuffing-length",
1136 FT_UINT8, BASE_DEC, NULL, 0x07, NULL, HFILL }},
1137 { &hf_mpeg_pes_stuffing,
1138 { "PES stuffing bytes", "mpeg-pes.stuffing",
1139 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1140 { &hf_mpeg_pes_extension,
1141 { "PES extension", "mpeg-pes.extension",
1142 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1143 { &hf_mpeg_pes_header_data,
1144 { "PES header data", "mpeg-pes.header-data",
1145 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1147 { "presentation time stamp (PTS)", "mpeg-pes.pts",
1148 FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
1150 { "decode time stamp (DTS)", "mpeg-pes.dts",
1151 FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
1152 { &hf_mpeg_pes_escr,
1153 { "elementary stream clock reference (ESCR)", "mpeg-pes.escr",
1154 FT_RELATIVE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
1155 { &hf_mpeg_pes_es_rate,
1156 { "elementary stream rate", "mpeg-pes.es-rate",
1157 FT_UINT24, BASE_DEC, NULL, 0x7ffe, NULL, HFILL }},
1158 { &hf_mpeg_pes_copy_info,
1159 { "copy info", "mpeg-pes.copy-info",
1160 FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL }},
1162 { "CRC", "mpeg-pes.crc",
1163 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
1164 { &hf_mpeg_pes_extension_flags,
1165 { "extension flags", "mpeg-pes.extension-flags",
1166 FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }},
1167 { &hf_mpeg_pes_private_data,
1168 { "private data", "mpeg-pes.private-data",
1169 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
1170 { &hf_mpeg_pes_pack_length,
1171 { "pack length", "mpeg-pes.pack-length",
1172 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
1173 { &hf_mpeg_pes_sequence,
1174 { "sequence", "mpeg-pes.sequence",
1175 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
1176 { &hf_mpeg_pes_pstd_buffer,
1177 { "P-STD buffer size", "mpeg-pes.pstd-buffer",
1178 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
1179 { &hf_mpeg_pes_extension2,
1180 { "extension2", "mpeg-pes.extension2",
1181 FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
1182 { &hf_mpeg_pes_padding,
1183 { "PES padding", "mpeg-pes.padding",
1184 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1185 { &hf_mpeg_pes_data,
1186 { "PES data", "mpeg-pes.data",
1187 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1188 { &hf_mpeg_video_sequence_header,
1189 { "MPEG sequence header", "mpeg-video.sequence",
1190 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1191 { &hf_mpeg_video_sequence_extension,
1192 { "MPEG sequence extension", "mpeg-video.sequence-ext",
1193 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1194 { &hf_mpeg_video_group_of_pictures,
1195 { "MPEG group of pictures", "mpeg-video.gop",
1196 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1197 { &hf_mpeg_video_picture,
1198 { "MPEG picture", "mpeg-video.picture",
1199 FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1200 { &hf_mpeg_video_quantization_matrix,
1201 { "MPEG quantization matrix", "mpeg-video.quant",
1202 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1203 { &hf_mpeg_video_data,
1204 { "MPEG picture data", "mpeg-video.data",
1205 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1208 static gint *ett[] = {
1210 /*--- Included file: packet-mpeg-pes-ettarr.c ---*/
1211 #line 1 "packet-mpeg-pes-ettarr.c"
1213 &ett_mpeg_pes_Stream,
1214 &ett_mpeg_pes_Sequence_header,
1215 &ett_mpeg_pes_Sequence_extension,
1216 &ett_mpeg_pes_Group_of_pictures,
1217 &ett_mpeg_pes_Picture,
1219 /*--- End of included file: packet-mpeg-pes-ettarr.c ---*/
1220 #line 568 "packet-mpeg-pes-template.c"
1221 &ett_mpeg_pes_pack_header,
1222 &ett_mpeg_pes_header_data,
1225 proto_mpeg = proto_register_protocol(
1226 "Moving Picture Experts Group", "MPEG", "mpeg");
1227 register_dissector("mpeg", dissect_mpeg, proto_mpeg);
1228 register_heur_dissector_list("mpeg", &heur_subdissector_list);
1230 proto_mpeg_pes = proto_register_protocol(
1231 "Packetized Elementary Stream", "MPEG PES", "mpeg-pes");
1232 proto_register_field_array(proto_mpeg_pes, hf, array_length(hf));
1233 proto_register_subtree_array(ett, array_length(ett));
1234 new_register_dissector("mpeg-pes", dissect_mpeg_pes, proto_mpeg_pes);
1238 proto_reg_handoff_mpeg_pes(void)
1240 dissector_handle_t mpeg_handle = find_dissector("mpeg");
1242 dissector_add("wtap_encap", WTAP_ENCAP_MPEG, mpeg_handle);
1243 heur_dissector_add("mpeg", dissect_mpeg_pes, proto_mpeg_pes);