2 * Routines for H.264 dissection
3 * Copyright 2007, Anders Broman <anders.broman[at]ericsson.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 * http://www.ietf.org/rfc/rfc3984.txt?number=3984
27 * http://www.itu.int/rec/T-REC-H.264/en
40 #include <epan/packet.h>
41 #include <epan/proto.h>
42 #include <epan/asn1.h>
47 /* Initialize the protocol and registered fields */
48 static int proto_h264 = -1;
49 static int hf_h264_type = -1;
50 static int hf_h264_nal_f_bit = -1;
51 static int hf_h264_nal_nri = -1;
52 static int hf_h264_profile = -1;
53 static int hf_h264_profile_idc = -1;
54 static int hf_h264_rbsp_stop_bit = -1;
55 static int hf_h264_rbsp_trailing_bits = -1;
56 static int hf_h264_constraint_set0_flag = -1;
57 static int hf_h264_constraint_set1_flag = -1;
58 static int hf_h264_constraint_set2_flag = -1;
59 static int hf_h264_constraint_set3_flag = -1;
60 static int hf_h264_reserved_zero_4bits = -1;
61 static int hf_h264_level_idc = -1;
62 static int hf_h264_nal_unit = -1;
63 static int hf_h264_forbidden_zero_bit = -1;
64 static int hf_h264_nal_ref_idc = -1;
65 static int hf_h264_nal_unit_type = -1;
66 static int hf_h264_seq_parameter_set_id = -1;
67 static int hf_h264_chroma_format_idc = -1;
68 static int hf_h264_residual_colour_transform_flag = -1;
69 static int hf_h264_bit_depth_luma_minus8 = -1;
70 static int hf_h264_bit_depth_chroma_minus8 = -1;
71 static int hf_h264_qpprime_y_zero_transform_bypass_flag = -1;
72 static int hf_h264_seq_scaling_matrix_present_flag = -1;
73 static int hf_h264_log2_max_frame_num_minus4 = -1;
74 static int hf_h264_pic_order_cnt_type = -1;
75 static int hf_h264_log2_max_pic_order_cnt_lsb_minus4 = -1;
76 static int hf_h264_delta_pic_order_always_zero_flag = -1;
77 static int hf_h264_offset_for_non_ref_pic = -1;
78 static int hf_h264_offset_for_top_to_bottom_field = -1;
79 static int hf_264_num_ref_frames_in_pic_order_cnt_cycle = -1;
80 static int hf_h264_offset_for_ref_frame = -1;
81 static int hf_h264_num_ref_frames = -1;
82 static int hf_h264_gaps_in_frame_num_value_allowed_flag = -1;
83 static int hf_h264_pic_width_in_mbs_minus1 = -1;
84 static int hf_h264_pic_height_in_map_units_minus1 = -1;
85 static int hf_h264_frame_mbs_only_flag = -1;
86 static int hf_h264_mb_adaptive_frame_field_flag = -1;
87 static int hf_h264_direct_8x8_inference_flag = -1;
88 static int hf_h264_frame_cropping_flag = -1;
89 static int hf_h264_frame_crop_left_offset = -1;
90 static int hf_h264_frame_crop_right_offset = -1;
91 static int hf_h264_frame_crop_top_offset = -1;
92 static int hf_h264_frame_crop_bottom_offset = -1;
93 static int hf_h264_vui_parameters_present_flag = -1;
94 static int hf_h264_pic_parameter_set_id = -1;
95 static int hf_h264_entropy_coding_mode_flag = -1;
96 static int hf_h264_pic_order_present_flag = -1;
97 static int hf_h264_num_slice_groups_minus1 = -1;
98 static int hf_h264_slice_group_map_type = -1;
99 static int hf_h264_num_ref_idx_l0_active_minus1 = -1;
100 static int hf_h264_num_ref_idx_l1_active_minus1 = -1;
101 static int hf_h264_weighted_pred_flag = -1;
102 static int hf_h264_weighted_bipred_idc = -1;
103 static int hf_h264_pic_init_qp_minus26 = -1;
104 static int hf_h264_pic_init_qs_minus26 = -1;
105 static int hf_h264_chroma_qp_index_offset = -1;
106 static int hf_h264_deblocking_filter_control_present_flag = -1;
107 static int hf_h264_constrained_intra_pred_flag = -1;
108 static int hf_h264_redundant_pic_cnt_present_flag = -1;
109 static int hf_h264_transform_8x8_mode_flag = -1;
110 static int hf_h264_pic_scaling_matrix_present_flag = -1;
111 static int hf_h264_second_chroma_qp_index_offset = -1;
112 static int hf_h264_par_profile = -1;
113 static int hf_h264_par_profile_b = -1;
114 static int hf_h264_par_profile_m = -1;
115 static int hf_h264_par_profile_e = -1;
116 static int hf_h264_par_profile_h = -1;
117 static int hf_h264_par_profile_h10 = -1;
118 static int hf_h264_par_profile_h4_2_2 = -1;
119 static int hf_h264_par_profile_h4_4_4 = -1;
120 static int hf_h264_par_add_mode_sup = -1;
121 static int hf_h264_par_AdditionalModesSupported = -1;
122 static int hf_h264_par_add_mode_sup_rcdo = -1;
123 static int hf_h264_par_ProfileIOP = -1;
124 static int hf_h264_par_constraint_set0_flag = -1;
125 static int hf_h264_par_constraint_set1_flag = -1;
126 static int hf_h264_par_constraint_set2_flag = -1;
129 static int hf_h264_aspect_ratio_info_present_flag = -1;
130 static int hf_h264_aspect_ratio_idc = -1;
131 static int hf_h264_sar_width = -1;
132 static int hf_h264_sar_height = -1;
133 static int hf_h264_overscan_info_present_flag = -1;
134 static int hf_h264_overscan_appropriate_flag = -1;
135 static int hf_h264_video_signal_type_present_flag = -1;
136 static int hf_h264_video_format = -1;
137 static int hf_h264_video_full_range_flag = -1;
138 static int hf_h264_colour_description_present_flag = -1;
139 static int hf_h264_colour_primaries = -1;
140 static int hf_h264_transfer_characteristics = -1;
141 static int hf_h264_matrix_coefficients = -1;
142 static int hf_h264_chroma_loc_info_present_flag = -1;
143 static int hf_h264_chroma_sample_loc_type_top_field = -1;
144 static int hf_h264_chroma_sample_loc_type_bottom_field = -1;
145 static int hf_h264_timing_info_present_flag = -1;
146 static int hf_h264_num_units_in_tick = -1;
147 static int hf_h264_time_scale = -1;
148 static int hf_h264_fixed_frame_rate_flag = -1;
149 static int hf_h264_nal_hrd_parameters_present_flag = -1;
150 static int hf_h264_vcl_hrd_parameters_present_flag = -1;
151 static int hf_h264_low_delay_hrd_flag = -1;
152 static int hf_h264_pic_struct_present_flag = -1;
153 static int hf_h264_bitstream_restriction_flag = -1;
154 static int hf_h264_motion_vectors_over_pic_boundaries_flag = -1;
155 static int hf_h264_max_bytes_per_pic_denom = -1;
156 static int hf_h264_max_bits_per_mb_denom = -1;
157 static int hf_h264_log2_max_mv_length_horizontal = -1;
158 static int hf_h264_log2_max_mv_length_vertical = -1;
159 static int hf_h264_num_reorder_frames = -1;
160 static int hf_h264_max_dec_frame_buffering = -1;
161 static int hf_h264_cpb_cnt_minus1 = -1;
162 static int hf_h264_bit_rate_scale = -1;
163 static int hf_h264_cpb_size_scale = -1;
164 static int hf_h264_bit_rate_value_minus1 = -1;
165 static int hf_h264_cpb_size_value_minus1 = -1;
166 static int hf_h264_cbr_flag = -1;
167 static int hf_h264_initial_cpb_removal_delay_length_minus1 = -1;
168 static int hf_h264_cpb_removal_delay_length_minus1 = -1;
169 static int hf_h264_dpb_output_delay_length_minus11 = -1;
170 static int hf_h264_time_offset_length = -1;
172 static int hf_h264_first_mb_in_slice = -1;
173 static int hf_h264_slice_type = -1;
174 static int hf_h264_slice_id = -1;
175 static int hf_h264_frame_num = -1;
177 /* Initialize the subtree pointers */
178 static int ett_h264 = -1;
179 static int ett_h264_profile = -1;
180 static int ett_h264_nal = -1;
181 static int ett_h264_stream = -1;
182 static int ett_h264_nal_unit = -1;
183 static int ett_h264_par_profile = -1;
184 static int ett_h264_par_AdditionalModesSupported = -1;
185 static int ett_h264_par_ProfileIOP = -1;
187 /* The dynamic payload type which will be dissected as H.264 */
189 static guint dynamic_payload_type = 0;
190 static guint temp_dynamic_payload_type = 0;
192 /* syntax tables in subclause 7.3 is equal to
193 * ue(v), me(v), se(v), or te(v).
200 } h264_golomb_descriptors;
203 static const true_false_string h264_f_bit_vals = {
204 "Bit errors or other syntax violations",
205 "No bit errors or other syntax violations"
208 #define H264_SEQ_PAR_SET 7
209 #define H264_PIC_PAR_SET 8
211 static const value_string h264_type_values[] = {
213 { 1, "NAL unit - Coded slice of a non-IDR picture" }, /* Single NAL unit packet per H.264 */
214 { 2, "NAL unit - Coded slice data partition A" },
215 { 3, "NAL unit - Coded slice data partition B" },
216 { 4, "NAL unit - Coded slice data partition C" },
217 { 5, "NAL unit - Coded slice of an IDR picture" },
218 { 6, "NAL unit - Supplemental enhancement information (SEI)" },
219 { H264_SEQ_PAR_SET, "NAL unit - Sequence parameter set" }, /* 7 */
220 { H264_PIC_PAR_SET, "NAL unit - Picture parameter set" }, /* 8 */
221 { 9, "NAL unit - Access unit delimiter" },
222 { 10, "NAL unit - End of sequence" },
223 { 11, "NAL unit - End of stream" },
224 { 12, "NAL unit - Filler data" },
225 { 13, "NAL unit - Sequence parameter set extension" },
226 { 14, "NAL unit - Reserved" },
227 { 15, "NAL unit - Reserved" },
228 { 16, "NAL unit - Reserved" },
229 { 17, "NAL unit - Reserved" },
230 { 18, "NAL unit - Reserved" },
231 { 19, "NAL unit - Coded slice of an auxiliary coded picture without partitioning" },
232 { 20, "NAL unit - Reserved" },
233 { 21, "NAL unit - Reserved" },
234 { 22, "NAL unit - Reserved" },
235 { 23, "NAL unit - Reserved" },
236 { 24, "STAP-A" }, /* Single-time aggregation packet */
237 { 25, "STAP-B" }, /* Single-time aggregation packet */
238 { 26, "MTAP16" }, /* Multi-time aggregation packet */
239 { 27, "MTAP24" }, /* Multi-time aggregation packet */
240 { 28, "FU-A" }, /* Fragmentation unit */
241 { 29, "FU-B" }, /* Fragmentation unit */
248 static const value_string h264_profile_idc_values[] = {
249 { 66, "Baseline profile" },
250 { 77, "Main profile" },
251 { 88, "Extended profile" },
252 { 100, "High profile" },
253 { 110, "High 10 profile" },
254 { 122, "High 4:2:2 profile" },
255 { 144, "High 4:4:4 profile" },
259 static const value_string h264_nal_unit_type_vals[] = {
260 { 0, "Unspecified" },
261 { 1, "Coded slice of a non-IDR picture" },
262 { 2, "Coded slice data partition A" },
263 { 3, "Coded slice data partition B" },
264 { 4, "Coded slice data partition C" },
265 { 5, "Coded slice of an IDR picture" },
266 { 6, "Supplemental enhancement information (SEI)" },
267 { 7, "Sequence parameter set" },
268 { 8, "Picture parameter set" },
269 { 9, "Access unit delimiter" },
270 { 10, "End of sequence" },
271 { 11, "End of stream" },
272 { 12, "Filler data" },
273 { 13, "Sequence parameter set extension" },
279 { 19, "Coded slice of an auxiliary coded picture without partitioning" },
284 { 24, "Unspecified" },
285 { 25, "Unspecified" },
286 { 26, "Unspecified" },
287 { 27, "Unspecified" },
288 { 28, "Unspecified" },
289 { 29, "Unspecified" },
290 { 30, "Unspecified" },
291 { 31, "Unspecified" },
295 static const value_string h264_slice_group_map_type_vals[] = {
296 { 0, "Interleaved slice groups" },
297 { 1, "Dispersed slice group mapping" },
298 { 2, "One or more foreground slice groups and a leftover slice group" },
299 { 3, "Changing slice groups" },
300 { 4, "Changing slice groups" },
301 { 5, "Changing slice groups" },
302 { 6, "Explicit assignment of a slice group to each slice group map unit" },
306 /* Table 7-6 Name association to slice_type */
307 static const value_string h264_slice_type_vals[] = {
308 { 0, "P (P slice)" },
309 { 1, "B (B slice)" },
310 { 2, "I (I slice)" },
311 { 3, "SP (SP slice)" },
312 { 4, "SI (SI slice)" },
313 { 5, "P (P slice)" },
314 { 6, "B (B slice)" },
315 { 7 , "I (I slice)" },
316 { 8, "SP (SP slice)" },
317 { 9, "SI (SI slice)" },
321 /* Expect a tvb and a bit offset into the tvb
322 * returns the valu and bit_offset
324 #define cVALS(x) (const value_string*)(x)
327 dissect_h264_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint *start_bit_offset, h264_golomb_descriptors descriptor)
328 /*(tvbuff_t *tvb, gint *start_bit_offset) */
330 gint leading_zero_bits, bit_offset;
331 guint32 codenum, mask, value, tmp;
337 header_field_info *hf_field = NULL;
340 hf_field = proto_registrar_get_nth(hf_index);
342 bit_offset = *start_bit_offset;
344 /* prepare the string */
347 for(bit=0;bit<((int)(bit_offset&0x07));bit++){
355 leading_zero_bits = -1;
356 for( b = 0; !b; leading_zero_bits++ ){
363 b = tvb_get_bits8(tvb, bit_offset, 1);
373 if(leading_zero_bits==0){
375 *start_bit_offset = bit_offset;
384 strcat(str,hf_field->name);
387 /* if the syntax element is coded as se(v),
388 * the value of the syntax element is derived by invoking the
389 * mapping process for signed Exp-Golomb codes as specified in
390 * subclause 9.1.1 with codeNum as the input.
392 if(hf_field->type==FT_INT32){
393 if (hf_field->strings) {
394 proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
397 val_to_str(codenum, cVALS(hf_field->strings), "Unknown "),
400 switch(hf_field->display){
402 proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
408 DISSECTOR_ASSERT_NOT_REACHED();
418 if(hf_field->type==FT_UINT32){
419 if (hf_field->strings) {
420 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
423 val_to_str(codenum, cVALS(hf_field->strings), "Unknown "),
426 switch(hf_field->display){
428 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
434 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
440 DISSECTOR_ASSERT_NOT_REACHED();
445 /* Only allow guint32 */
446 DISSECTOR_ASSERT_NOT_REACHED();
453 Syntax elements coded as ue(v), me(v), or se(v) are Exp-Golomb-coded. Syntax elements coded as te(v) are truncated
454 Exp-Golomb-coded. The parsing process for these syntax elements begins with reading the bits starting at the current
455 location in the bitstream up to and including the first non-zero bit, and counting the number of leading bits that are
456 equal to 0. This process is specified as follows:
457 leadingZeroBits = -1;
458 for( b = 0; !b; leadingZeroBits++ )
460 The variable codeNum is then assigned as follows:
461 codeNum = 2leadingZeroBits - 1 + read_bits( leadingZeroBits )
462 where the value returned from read_bits( leadingZeroBits ) is interpreted as a binary representation of an unsigned
463 integer with most significant bit written first.
466 codenum = codenum << leading_zero_bits;
468 value = tvb_get_bits8(tvb, bit_offset,leading_zero_bits );
469 codenum = (codenum-1) + value;
470 bit_offset = bit_offset + leading_zero_bits;
472 /* read the bits for the int */
473 for(i=0;i<leading_zero_bits;i++){
498 /* if the syntax element is coded as se(v),
499 * the value of the syntax element is derived by invoking the
500 * mapping process for signed Exp-Golomb codes as specified in
501 * subclause 9.1.1 with codeNum as the input.
505 se_value = (codenum + 1) >> 1;
506 if (!(se_value & 1)){
507 se_value = - se_value;
516 strcat(str,hf_field->name);
519 strcat(str,"(se(v))");
520 /* if the syntax element is coded as se(v),
521 * the value of the syntax element is derived by invoking the
522 * mapping process for signed Exp-Golomb codes as specified in
523 * subclause 9.1.1 with codeNum as the input.
529 if((hf_field->type==FT_UINT32)&&(descriptor==H264_UE_V)){
530 if (hf_field->strings) {
531 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
534 val_to_str(codenum, cVALS(hf_field->strings), "Unknown "),
537 switch(hf_field->display){
539 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
545 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
551 DISSECTOR_ASSERT_NOT_REACHED();
555 }else if((hf_field->type==FT_INT32)&&(descriptor==H264_SE_V)){
556 if (hf_field->strings) {
557 proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
560 val_to_str(codenum, cVALS(hf_field->strings), "Unknown "),
563 switch(hf_field->display){
565 proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
571 DISSECTOR_ASSERT_NOT_REACHED();
575 *start_bit_offset = bit_offset;
579 /* Only allow guint32 */
580 DISSECTOR_ASSERT_NOT_REACHED();
584 *start_bit_offset = bit_offset;
589 /* This funktion is adapted to parsing NAL units from SDP data where the
590 * base64 coding may add extra padding
594 more_rbsp_data(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
598 int remaining_length;
602 /* XXX might not be the best way of doing things but:
603 * Serch from the end of the tvb for the first '1' bit
604 * assuming that its's the RTBSP stop bit
607 /* Set offset to the byte we are treating */
608 offset = bit_offset>>3;
609 remaining_length = tvb_length_remaining(tvb,offset);
610 /* If there is more then 2 bytes left there *should* be more data */
611 if(remaining_length>2){
614 /* Start from last bit */
615 last_one_bit = (tvb_length(tvb) << 3);
619 b = tvb_get_bits8(tvb, last_one_bit, 1);
622 if( last_one_bit == bit_offset){
630 dissect_h264_rbsp_trailing_bits(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
634 proto_tree_add_bits_item(tree, hf_h264_rbsp_stop_bit, tvb, bit_offset, 1, FALSE);
637 remaining_bits = 8 - (bit_offset&0x7);
639 proto_tree_add_bits_item(tree, hf_h264_rbsp_trailing_bits, tvb, bit_offset, remaining_bits, FALSE);
641 return bit_offset+remaining_bits;
646 * 7.3.3 Slice header syntax
648 * XXX Just parse a few bytes
651 dissect_h264_slice_header(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
653 /* first_mb_in_slice 2 ue(v) */
654 dissect_h264_exp_golomb_code(tree, hf_h264_first_mb_in_slice, tvb, &bit_offset, H264_UE_V);
656 /* slice_type 2 ue(v) */
657 dissect_h264_exp_golomb_code(tree, hf_h264_slice_type, tvb, &bit_offset, H264_UE_V);
659 /* pic_parameter_set_id 2 ue(v) */
660 dissect_h264_exp_golomb_code(tree, hf_h264_pic_parameter_set_id, tvb, &bit_offset, H264_UE_V);
662 /* frame_num 2 u(v) */
663 /* XXXX Is frame_num allways 4 bits in the bit stream? */
664 proto_tree_add_bits_item(tree, hf_h264_frame_num, tvb, bit_offset, 4, FALSE);
670 /* 7.3.2.1.1 Scaling list syntax
672 * scaling_list( scalingList, sizeOfScalingList, useDefaultScalingMatrixFlag )
676 dissect_h264_scaling_list(proto_tree *tree, tvbuff_t *tvb, gint bit_offset, int hf_index_scalinglist,
677 guint8 sizeOfScalingList, int hf_index_usedefaultscalingmatrixflag)
680 guint8 lastScale = 8;
681 guint8 nextScale = 8:
684 for( j = 0; j < sizeOfScalingList; j++ ) {
685 if( nextScale != 0 ) {
686 / delta_scale 0 | 1 se(v) /
687 delta_scale = dissect_h264_exp_golomb_code(tree, hf_h264_delta_scale, tvb, &bit_offset);
688 nextScale = ( lastScale + delta_scale + 256 ) % 256;
689 useDefaultScalingMatrixFlag = ( j == 0 && nextScale == 0 );
691 scalingList[ j ] = ( nextScale == 0 ) ? lastScale : nextScale
692 lastScale = scalingList[ j ]
696 /* E.1.2 HRD parameters syntax */
698 dissect_h264_hrd_parameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
700 guint8 cpb_cnt_minus1;
704 /* cpb_cnt_minus1 0 ue(v) */
705 cpb_cnt_minus1 = dissect_h264_exp_golomb_code(tree, hf_h264_cpb_cnt_minus1, tvb, &bit_offset, H264_UE_V);
707 /* bit_rate_scale 0 u(4) */
708 proto_tree_add_bits_item(tree, hf_h264_bit_rate_scale, tvb, bit_offset, 4, FALSE);
709 bit_offset = bit_offset + 4;
711 /* cpb_size_scale 0 u(4) */
712 proto_tree_add_bits_item(tree, hf_h264_cpb_size_scale, tvb, bit_offset, 4, FALSE);
713 bit_offset = bit_offset + 4;
714 /* for( SchedSelIdx = 0; SchedSelIdx <= cpb_cnt_minus1; SchedSelIdx++ ) { */
715 for( SchedSelIdx = 0; SchedSelIdx <= cpb_cnt_minus1; SchedSelIdx++ ) {
717 /* bit_rate_value_minus1[ SchedSelIdx ] 0 ue(v) */
718 dissect_h264_exp_golomb_code(tree, hf_h264_bit_rate_value_minus1, tvb, &bit_offset, H264_UE_V);
720 /* cpb_size_value_minus1[ SchedSelIdx ] 0 ue(v)*/
721 dissect_h264_exp_golomb_code(tree, hf_h264_cpb_size_value_minus1, tvb, &bit_offset, H264_UE_V);
723 /* cbr_flag[ SchedSelIdx ] 0 u(1) */
724 proto_tree_add_bits_item(tree, hf_h264_cbr_flag, tvb, bit_offset, 1, FALSE);
727 /* initial_cpb_removal_delay_length_minus1 0 u(5) */
728 proto_tree_add_bits_item(tree, hf_h264_initial_cpb_removal_delay_length_minus1, tvb, bit_offset, 1, FALSE);
729 bit_offset = bit_offset + 5;
731 /* cpb_removal_delay_length_minus1 0 u(5) */
732 proto_tree_add_bits_item(tree, hf_h264_cpb_removal_delay_length_minus1, tvb, bit_offset, 1, FALSE);
733 bit_offset = bit_offset + 5;
735 /* dpb_output_delay_length_minus1 0 u(5) */
736 proto_tree_add_bits_item(tree, hf_h264_dpb_output_delay_length_minus11, tvb, bit_offset, 1, FALSE);
737 bit_offset = bit_offset + 5;
739 /* time_offset_length 0 u(5) */
740 proto_tree_add_bits_item(tree, hf_h264_time_offset_length, tvb, bit_offset, 1, FALSE);
741 bit_offset = bit_offset + 5;
746 #define EXTENDED_SAR 255
748 /* E.1.1 VUI parameters syntax */
750 dissect_h264_vui_parameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint bit_offset)
753 guint8 aspect_ratio_info_present_flag, aspect_ratio_idc, overscan_info_present_flag;
754 guint8 video_signal_type_present_flag, colour_description_present_flag, chroma_loc_info_present_flag;
755 guint8 timing_info_present_flag, nal_hrd_parameters_present_flag, vcl_hrd_parameters_present_flag;
756 guint8 bitstream_restriction_flag;
758 /* vui_parameters( ) {
759 * aspect_ratio_info_present_flag 0 u(1)
761 aspect_ratio_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
762 proto_tree_add_bits_item(tree, hf_h264_aspect_ratio_info_present_flag, tvb, bit_offset, 1, FALSE);
765 if( aspect_ratio_info_present_flag ) {
766 /* aspect_ratio_idc 0 u(8) */
767 aspect_ratio_idc = tvb_get_bits8(tvb, bit_offset, 8);
768 proto_tree_add_bits_item(tree, hf_h264_aspect_ratio_idc, tvb, bit_offset, 8, FALSE);
769 bit_offset = bit_offset + 8;
771 if( aspect_ratio_idc == EXTENDED_SAR ) {
772 /* sar_width 0 u(16) */
773 proto_tree_add_bits_item(tree, hf_h264_sar_width, tvb, bit_offset, 16, FALSE);
774 bit_offset = bit_offset + 16;
776 /* sar_height 0 u(16) */
777 proto_tree_add_bits_item(tree, hf_h264_sar_height, tvb, bit_offset, 16, FALSE);
778 bit_offset = bit_offset + 16;
781 /* overscan_info_present_flag 0 u(1) */
782 overscan_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
783 proto_tree_add_bits_item(tree, hf_h264_overscan_info_present_flag, tvb, bit_offset, 1, FALSE);
786 if( overscan_info_present_flag ){
787 /* overscan_appropriate_flag 0 u(1) */
788 proto_tree_add_bits_item(tree, hf_h264_overscan_appropriate_flag, tvb, bit_offset, 1, FALSE);
792 /* video_signal_type_present_flag 0 u(1) */
793 video_signal_type_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
794 proto_tree_add_bits_item(tree, hf_h264_video_signal_type_present_flag, tvb, bit_offset, 1, FALSE);
797 if( video_signal_type_present_flag ) {
798 /* video_format 0 u(3) > */
799 proto_tree_add_bits_item(tree, hf_h264_video_format, tvb, bit_offset, 3, FALSE);
800 bit_offset = bit_offset + 3;
802 /* video_full_range_flag 0 u(1)*/
803 proto_tree_add_bits_item(tree, hf_h264_video_full_range_flag, tvb, bit_offset, 1, FALSE);
806 /* colour_description_present_flag 0 u(1) */
807 colour_description_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
808 proto_tree_add_bits_item(tree, hf_h264_colour_description_present_flag, tvb, bit_offset, 1, FALSE);
811 if( colour_description_present_flag ) {
812 /* colour_primaries 0 u(8) */
813 proto_tree_add_bits_item(tree, hf_h264_colour_primaries, tvb, bit_offset, 8, FALSE);
814 bit_offset = bit_offset + 8;
816 /* transfer_characteristics 0 u(8) */
817 proto_tree_add_bits_item(tree, hf_h264_transfer_characteristics, tvb, bit_offset, 8, FALSE);
818 bit_offset = bit_offset + 8;
820 /* matrix_coefficients 0 u(8)*/
821 proto_tree_add_bits_item(tree, hf_h264_matrix_coefficients, tvb, bit_offset, 8, FALSE);
822 bit_offset = bit_offset + 8;
826 /* chroma_loc_info_present_flag 0 u(1) */
827 chroma_loc_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
828 proto_tree_add_bits_item(tree, hf_h264_chroma_loc_info_present_flag, tvb, bit_offset, 1, FALSE);
831 if( chroma_loc_info_present_flag ) {
832 /* chroma_sample_loc_type_top_field 0 ue(v) */
833 dissect_h264_exp_golomb_code(tree, hf_h264_chroma_sample_loc_type_top_field, tvb, &bit_offset, H264_UE_V);
835 /* chroma_sample_loc_type_bottom_field 0 ue(v) */
836 dissect_h264_exp_golomb_code(tree, hf_h264_chroma_sample_loc_type_bottom_field, tvb, &bit_offset, H264_UE_V);
839 /* timing_info_present_flag 0 u(1) */
840 timing_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
841 proto_tree_add_bits_item(tree, hf_h264_timing_info_present_flag, tvb, bit_offset, 1, FALSE);
844 if( timing_info_present_flag ) {
845 /* num_units_in_tick 0 u(32) */
846 proto_tree_add_bits_item(tree, hf_h264_num_units_in_tick, tvb, bit_offset, 32, FALSE);
847 bit_offset = bit_offset + 32;
849 /* time_scale 0 u(32) */
850 proto_tree_add_bits_item(tree, hf_h264_time_scale, tvb, bit_offset, 32, FALSE);
851 bit_offset = bit_offset + 32;
853 /* fixed_frame_rate_flag 0 u(1) */
854 proto_tree_add_bits_item(tree, hf_h264_fixed_frame_rate_flag, tvb, bit_offset, 1, FALSE);
857 /* nal_hrd_parameters_present_flag 0 u(1) */
858 nal_hrd_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
859 proto_tree_add_bits_item(tree, hf_h264_nal_hrd_parameters_present_flag, tvb, bit_offset, 1, FALSE);
862 if( nal_hrd_parameters_present_flag ){
863 /* hrd_parameters( ) */
864 bit_offset = dissect_h264_hrd_parameters(tree, tvb, pinfo, bit_offset);
867 /* vcl_hrd_parameters_present_flag 0 u(1) */
868 vcl_hrd_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
869 proto_tree_add_bits_item(tree, hf_h264_vcl_hrd_parameters_present_flag, tvb, bit_offset, 1, FALSE);
872 if( vcl_hrd_parameters_present_flag ){
873 /* hrd_parameters( ) */
874 bit_offset = dissect_h264_hrd_parameters(tree, tvb, pinfo, bit_offset);
876 if( nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag ){
877 /* low_delay_hrd_flag 0 u(1) */
878 proto_tree_add_bits_item(tree, hf_h264_low_delay_hrd_flag, tvb, bit_offset, 1, FALSE);
881 /* pic_struct_present_flag 0 u(1) */
882 proto_tree_add_bits_item(tree, hf_h264_pic_struct_present_flag, tvb, bit_offset, 1, FALSE);
885 /* bitstream_restriction_flag 0 u(1) */
886 bitstream_restriction_flag = tvb_get_bits8(tvb, bit_offset, 1);
887 proto_tree_add_bits_item(tree, hf_h264_bitstream_restriction_flag, tvb, bit_offset, 1, FALSE);
890 if( bitstream_restriction_flag ) {
891 /* motion_vectors_over_pic_boundaries_flag 0 u(1) */
892 proto_tree_add_bits_item(tree, hf_h264_motion_vectors_over_pic_boundaries_flag, tvb, bit_offset, 1, FALSE);
895 /* max_bytes_per_pic_denom 0 ue(v) */
896 dissect_h264_exp_golomb_code(tree, hf_h264_max_bytes_per_pic_denom, tvb, &bit_offset, H264_UE_V);
898 /* max_bits_per_mb_denom 0 ue(v) */
899 dissect_h264_exp_golomb_code(tree, hf_h264_max_bits_per_mb_denom, tvb, &bit_offset, H264_UE_V);
901 /* log2_max_mv_length_horizontal 0 ue(v) */
902 dissect_h264_exp_golomb_code(tree, hf_h264_log2_max_mv_length_horizontal, tvb, &bit_offset, H264_UE_V);
904 /* log2_max_mv_length_vertical 0 ue(v) */
905 dissect_h264_exp_golomb_code(tree, hf_h264_log2_max_mv_length_vertical, tvb, &bit_offset, H264_UE_V);
907 /* num_reorder_frames 0 ue(v) */
908 dissect_h264_exp_golomb_code(tree, hf_h264_num_reorder_frames, tvb, &bit_offset, H264_UE_V);
910 /* max_dec_frame_buffering 0 ue(v) */
911 dissect_h264_exp_golomb_code(tree, hf_h264_max_dec_frame_buffering, tvb, &bit_offset, H264_UE_V);
918 /* Used To dissect SDP parameter (H.264)profile */
920 dissect_h264_profile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
922 proto_item *item, *level_item;
923 proto_tree *h264_profile_tree;
925 guint8 constraint_set3_flag;
928 item = proto_tree_add_item(tree, hf_h264_profile, tvb, offset, -1, FALSE);
929 h264_profile_tree = proto_item_add_subtree(item, ett_h264_profile);
931 proto_tree_add_item(h264_profile_tree, hf_h264_profile_idc, tvb, offset, 1, FALSE);
934 constraint_set3_flag = (tvb_get_guint8(tvb,offset)&0x10)>>4;
935 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set0_flag, tvb, offset, 1, FALSE);
936 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set1_flag, tvb, offset, 1, FALSE);
937 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set2_flag, tvb, offset, 1, FALSE);
938 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set3_flag, tvb, offset, 1, FALSE);
939 proto_tree_add_item(h264_profile_tree, hf_h264_reserved_zero_4bits, tvb, offset, 1, FALSE);
942 /* A level to which the bitstream conforms shall be indicated by the syntax element level_idc as follows.
943 * - If level_idc is equal to 11 and constraint_set3_flag is equal to 1, the indicated level is level 1b.
944 * - Otherwise (level_idc is not equal to 11 or constraint_set3_flag is not equal to 1), level_idc shall
945 * be set equal to a value of ten times the level number specified in Table A-1 and constraint_set3_flag
946 * shall be set equal to 0.
949 level_idc = tvb_get_guint8(tvb,offset);
950 level_item = proto_tree_add_item(h264_profile_tree, hf_h264_level_idc, tvb, offset, 1, FALSE);
951 if((level_idc==11)&&(constraint_set3_flag==1)){
952 proto_item_append_text(level_item," [Level 1b]");
954 proto_item_append_text(level_item," [Level %.1f]",((double)level_idc/10));
960 * 7.3.2.8 Slice layer without partitioning RBSP syntax
961 * slice_layer_without_partitioning_rbsp( )
965 dissect_h264_slice_layer_without_partitioning_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset)
969 bit_offset = offset <<3;
971 /* slice_header( ) 2 */
972 bit_offset = dissect_h264_slice_header(tree, tvb, pinfo, bit_offset);
973 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
975 /* slice_data( ) * all categories of slice_data( ) syntax * 2 | 3 | 4 */
976 /* rbsp_slice_trailing_bits( ) */
981 * 7.3.2.9.1 Slice data partition A RBSP syntax
982 * slice_data_partition_a_layer_rbsp( )
985 dissect_h264_slice_data_partition_a_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
989 bit_offset = offset <<3;
991 /* slice_header( ) 2 */
992 bit_offset = dissect_h264_slice_header(tree, tvb, pinfo, bit_offset);
994 /* slice_id All ue(v) */
995 dissect_h264_exp_golomb_code(tree, hf_h264_slice_id, tvb, &bit_offset, H264_UE_V);
996 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
998 /* slice_data( ) * only category 2 parts of slice_data( ) syntax * 2*/
999 /* rbsp_slice_trailing_bits( )*/
1004 * 7.3.2.9.2 Slice data partition B RBSP syntax
1005 * slice_data_partition_b_layer_rbsp(
1008 dissect_h264_slice_data_partition_b_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1012 bit_offset = offset <<3;
1014 /* slice_id All ue(v) */
1015 dissect_h264_exp_golomb_code(tree, hf_h264_slice_id, tvb, &bit_offset, H264_UE_V);
1016 /* if( redundant_pic_cnt_present_flag ) */
1017 /* redundant_pic_cnt All ue(v) */
1018 /* slice_data( ) * only category 3 parts of slice_data( ) syntax * 3 */
1019 /* rbsp_slice_trailing_bits( ) 3 */
1020 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
1025 * 7.3.2.9.3 Slice data partition C RBSP syntax
1026 * slice_data_partition_c_layer_rbsp( )
1029 dissect_h264_slice_data_partition_c_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1033 bit_offset = offset <<3;
1035 /* slice_id All ue(v) */
1036 dissect_h264_exp_golomb_code(tree, hf_h264_slice_id, tvb, &bit_offset, H264_UE_V);
1037 /* if( redundant_pic_cnt_present_flag ) */
1038 /* redundant_pic_cnt All ue(v) */
1039 /* slice_data( ) * only category 4 parts of slice_data( ) syntax * 4 */
1040 /* rbsp_slice_trailing_bits( ) 4 */
1041 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
1045 * 7.3.2.3 Supplemental enhancement information RBSP syntax
1049 dissect_h264_sei_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1052 /* sei_message( ) 5*/
1053 /* while( more_rbsp_data( ) )*/
1054 /* rbsp_trailing_bits( ) 5 */
1055 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1059 /* Ref 7.3.2.1 Sequence parameter set RBSP syntax */
1061 dissect_h264_seq_parameter_set_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset)
1063 proto_item *level_item;
1065 guint8 constraint_set3_flag;
1069 guint8 profile_idc, chroma_format_idc, frame_mbs_only_flag, frame_cropping_flag;
1070 guint8 pic_order_cnt_type, vui_parameters_present_flag, num_ref_frames_in_pic_order_cnt_cycle;
1071 guint8 seq_scaling_matrix_present_flag; /* seq_scaling_list_present_flag */
1073 /* profile_idc 0 u(8) */
1074 profile_idc = tvb_get_guint8(tvb,offset);
1075 proto_tree_add_item(tree, hf_h264_profile_idc, tvb, offset, 1, FALSE);
1078 constraint_set3_flag = (tvb_get_guint8(tvb,offset)&0x10)>>4;
1079 /* constraint_set0_flag 0 u(1) */
1080 proto_tree_add_item(tree, hf_h264_constraint_set0_flag, tvb, offset, 1, FALSE);
1082 /* constraint_set1_flag 0 u(1) */
1083 proto_tree_add_item(tree, hf_h264_constraint_set1_flag, tvb, offset, 1, FALSE);
1085 /* constraint_set2_flag 0 u(1) */
1086 proto_tree_add_item(tree, hf_h264_constraint_set2_flag, tvb, offset, 1, FALSE);
1088 /* constraint_set3_flag 0 u(1) */
1089 proto_tree_add_item(tree, hf_h264_constraint_set3_flag, tvb, offset, 1, FALSE);
1091 /* reserved_zero_4bits equal to 0 0 u(4)*/
1092 proto_tree_add_item(tree, hf_h264_reserved_zero_4bits, tvb, offset, 1, FALSE);
1095 /* level_idc 0 u(8) */
1096 level_idc = tvb_get_guint8(tvb,offset);
1097 level_item = proto_tree_add_item(tree, hf_h264_level_idc, tvb, offset, 1, FALSE);
1098 if((level_idc==11)&&(constraint_set3_flag==1)){
1099 proto_item_append_text(level_item,"[Level 1b]");
1101 proto_item_append_text(level_item,"[Level %.1f]",((double)level_idc/10));
1104 /* seq_parameter_set_id 0 ue(v)
1105 * ue(v): unsigned integer Exp-Golomb-coded syntax element with the left bit first.
1106 * The parsing process for this descriptor is specified in subclause 9.1.
1108 bit_offset = offset<<3;
1109 dissect_h264_exp_golomb_code(tree, hf_h264_seq_parameter_set_id, tvb, &bit_offset, H264_UE_V);
1112 if( profile_idc == 100 || profile_idc == 110 ||
1113 profile_idc == 122 || profile_idc == 144 ) {
1115 /* chroma_format_idc 0 ue(v) */
1116 chroma_format_idc = dissect_h264_exp_golomb_code(tree, hf_h264_chroma_format_idc, tvb, &bit_offset, H264_UE_V);
1117 if( chroma_format_idc == 3 ){
1118 /* residual_colour_transform_flag 0 u(1) */
1119 proto_tree_add_bits_item(tree, hf_h264_residual_colour_transform_flag, tvb, bit_offset, 1, FALSE);
1123 /* bit_depth_luma_minus8 0 ue(v) */
1124 dissect_h264_exp_golomb_code(tree, hf_h264_bit_depth_luma_minus8, tvb, &bit_offset, H264_UE_V);
1126 /* bit_depth_chroma_minus8 0 ue(v) */
1127 dissect_h264_exp_golomb_code(tree, hf_h264_bit_depth_chroma_minus8, tvb, &bit_offset, H264_UE_V);
1129 /* qpprime_y_zero_transform_bypass_flag 0 u(1) */
1130 proto_tree_add_bits_item(tree, hf_h264_qpprime_y_zero_transform_bypass_flag, tvb, bit_offset, 1, FALSE);
1133 /* seq_scaling_matrix_present_flag 0 u(1) */
1134 seq_scaling_matrix_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1135 proto_tree_add_bits_item(tree, hf_h264_seq_scaling_matrix_present_flag, tvb, bit_offset, 1, FALSE);
1138 if( seq_scaling_matrix_present_flag ){
1140 for( i = 0; i < 8; i++ ) {
1141 / seq_scaling_list_present_flag[ i ] 0 u(1) /
1142 seq_scaling_list_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1144 if( seq_scaling_list_present_flag){
1146 scaling_list( ScalingList4x4[ i ], 16,UseDefaultScalingMatrix4x4Flag[ i ])0
1147 dissect_h264_scaling_list()
1149 scaling_list( ScalingList8x8[ i - 6 ], 64,UseDefaultScalingMatrix8x8Flag[ i - 6 ] )0
1153 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1159 /* log2_max_frame_num_minus4 0 ue(v) */
1160 dissect_h264_exp_golomb_code(tree, hf_h264_log2_max_frame_num_minus4, tvb, &bit_offset, H264_UE_V);
1162 /* pic_order_cnt_type 0 ue(v) */
1163 offset = bit_offset>>3;
1164 pic_order_cnt_type = dissect_h264_exp_golomb_code(tree,hf_h264_pic_order_cnt_type, tvb, &bit_offset, H264_UE_V);
1166 if(pic_order_cnt_type == 0){
1167 /* log2_max_pic_order_cnt_lsb_minus4 0 ue(v) */
1168 dissect_h264_exp_golomb_code(tree, hf_h264_log2_max_pic_order_cnt_lsb_minus4, tvb, &bit_offset, H264_UE_V);
1169 }else if(pic_order_cnt_type == 1) {
1170 /* delta_pic_order_always_zero_flag 0 u(1) */
1171 proto_tree_add_bits_item(tree, hf_h264_delta_pic_order_always_zero_flag, tvb, bit_offset, 1, FALSE);
1174 /* offset_for_non_ref_pic 0 se(v) */
1175 dissect_h264_exp_golomb_code(tree, hf_h264_offset_for_non_ref_pic, tvb, &bit_offset, H264_SE_V);
1177 /* offset_for_top_to_bottom_field 0 se(v) */
1178 dissect_h264_exp_golomb_code(tree, hf_h264_offset_for_top_to_bottom_field, tvb, &bit_offset, H264_SE_V);
1180 /* num_ref_frames_in_pic_order_cnt_cycle 0 ue(v) */
1181 num_ref_frames_in_pic_order_cnt_cycle = dissect_h264_exp_golomb_code(tree, hf_264_num_ref_frames_in_pic_order_cnt_cycle, tvb, &bit_offset, H264_UE_V);
1182 for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ ){
1183 /*offset_for_ref_frame[ i ] 0 se(v)*/
1184 dissect_h264_exp_golomb_code(tree, hf_h264_offset_for_ref_frame, tvb, &bit_offset, H264_SE_V);
1187 /* num_ref_frames 0 ue(v) */
1188 dissect_h264_exp_golomb_code(tree, hf_h264_num_ref_frames, tvb, &bit_offset, H264_UE_V);
1190 /* gaps_in_frame_num_value_allowed_flag 0 u(1) */
1191 proto_tree_add_bits_item(tree, hf_h264_gaps_in_frame_num_value_allowed_flag, tvb, bit_offset, 1, FALSE);
1194 /* pic_width_in_mbs_minus1 0 ue(v) */
1195 dissect_h264_exp_golomb_code(tree, hf_h264_pic_width_in_mbs_minus1, tvb, &bit_offset, H264_UE_V);
1197 /* pic_height_in_map_units_minus1 0 ue(v) */
1198 dissect_h264_exp_golomb_code(tree, hf_h264_pic_height_in_map_units_minus1, tvb, &bit_offset, H264_UE_V);
1200 /* frame_mbs_only_flag 0 u(1) */
1201 frame_mbs_only_flag = tvb_get_bits8(tvb, bit_offset, 1);
1202 proto_tree_add_bits_item(tree, hf_h264_frame_mbs_only_flag, tvb, bit_offset, 1, FALSE);
1204 if( !frame_mbs_only_flag ){
1205 /* mb_adaptive_frame_field_flag 0 u(1) */
1206 proto_tree_add_bits_item(tree, hf_h264_mb_adaptive_frame_field_flag, tvb, bit_offset, 1, FALSE);
1210 /* direct_8x8_inference_flag 0 u(1) */
1211 proto_tree_add_bits_item(tree, hf_h264_direct_8x8_inference_flag, tvb, bit_offset, 1, FALSE);
1214 /* frame_cropping_flag 0 u(1) */
1215 frame_cropping_flag = tvb_get_bits8(tvb, bit_offset, 1);
1216 proto_tree_add_bits_item(tree, hf_h264_frame_cropping_flag, tvb, bit_offset, 1, FALSE);
1219 if(frame_cropping_flag) {
1220 /* frame_crop_left_offset 0 ue(v) */
1221 dissect_h264_exp_golomb_code(tree, hf_h264_frame_crop_left_offset, tvb, &bit_offset, H264_UE_V);
1222 dissect_h264_exp_golomb_code(tree,hf_h264_frame_crop_right_offset, tvb, &bit_offset, H264_UE_V);
1223 dissect_h264_exp_golomb_code(tree, hf_h264_frame_crop_top_offset, tvb, &bit_offset, H264_UE_V);
1224 dissect_h264_exp_golomb_code(tree, hf_h264_frame_crop_bottom_offset, tvb, &bit_offset, H264_UE_V);
1228 /* vui_parameters_present_flag 0 u(1) */
1229 vui_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1230 proto_tree_add_bits_item(tree, hf_h264_vui_parameters_present_flag, tvb, bit_offset, 1, FALSE);
1232 if(vui_parameters_present_flag){
1233 bit_offset = dissect_h264_vui_parameters(tree, tvb, pinfo, bit_offset);
1236 /* rbsp_trailing_bits( ) 0 */
1237 bit_offset = dissect_h264_rbsp_trailing_bits(tree, tvb, pinfo, bit_offset);
1241 /* 7.3.2.2 Picture parameter set RBSP syntax */
1244 dissect_h264_pic_parameter_set_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset)
1248 guint32 num_slice_groups_minus1, slice_group_map_type, pic_scaling_matrix_present_flag;
1250 bit_offset = offset<<3;
1252 /* pic_parameter_set_id 1 ue(v) */
1253 dissect_h264_exp_golomb_code(tree, hf_h264_pic_parameter_set_id, tvb, &bit_offset, H264_UE_V);
1255 /* seq_parameter_set_id 1 ue(v) */
1256 dissect_h264_exp_golomb_code(tree, hf_h264_seq_parameter_set_id, tvb, &bit_offset, H264_UE_V);
1258 /* entropy_coding_mode_flag 1 u(1) */
1259 proto_tree_add_bits_item(tree, hf_h264_entropy_coding_mode_flag, tvb, bit_offset, 1, FALSE);
1262 /* pic_order_present_flag 1 u(1)*/
1263 proto_tree_add_bits_item(tree, hf_h264_pic_order_present_flag, tvb, bit_offset, 1, FALSE);
1266 /* num_slice_groups_minus1 1 ue(v)*/
1267 num_slice_groups_minus1 = dissect_h264_exp_golomb_code(tree, hf_h264_num_slice_groups_minus1, tvb, &bit_offset, H264_UE_V);
1268 if( num_slice_groups_minus1 > 0 ) {
1269 /* slice_group_map_type 1 ue(v)*/
1270 slice_group_map_type = dissect_h264_exp_golomb_code(tree, hf_h264_slice_group_map_type, tvb, &bit_offset, H264_UE_V);
1271 /* if( slice_group_map_type = = 0 )*/
1272 /* for( iGroup = 0; iGroup <= num_slice_groups_minus1; iGroup++ )*/
1273 /* run_length_minus1[ iGroup ] 1 ue(v)*/
1274 /* else if( slice_group_map_type == 2 )*/
1275 /* for( iGroup = 0; iGroup < num_slice_groups_minus1; iGroup++ ) {*/
1276 /* top_left[ iGroup ] 1 ue(v)*/
1277 /* bottom_right[ iGroup ] 1 ue(v)*/
1279 /* else if( slice_group_map_type == 3 ||*/
1280 /* slice_group_map_type == 4 ||*/
1281 /* slice_group_map_type == 5 ) {*/
1282 /* slice_group_change_direction_flag 1 u(1)*/
1283 /* slice_group_change_rate_minus1 1 ue(v)*/
1284 /* } else if( slice_group_map_type == 6 ) {*/
1285 /* pic_size_in_map_units_minus1 1 ue(v)*/
1286 /* for( i = 0; i <= pic_size_in_map_units_minus1; i++ )*/
1287 /* slice_group_id[ i ] 1 u(v)*/
1290 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
1293 /* num_ref_idx_l0_active_minus1 1 ue(v)*/
1294 dissect_h264_exp_golomb_code(tree, hf_h264_num_ref_idx_l0_active_minus1, tvb, &bit_offset, H264_UE_V);
1296 /* num_ref_idx_l1_active_minus1 1 ue(v)*/
1297 dissect_h264_exp_golomb_code(tree, hf_h264_num_ref_idx_l1_active_minus1, tvb, &bit_offset, H264_UE_V);
1299 /* weighted_pred_flag 1 u(1)*/
1300 proto_tree_add_bits_item(tree, hf_h264_weighted_pred_flag, tvb, bit_offset, 1, FALSE);
1303 /* weighted_bipred_idc 1 u(2)*/
1304 proto_tree_add_bits_item(tree, hf_h264_weighted_bipred_idc, tvb, bit_offset, 2, FALSE);
1305 bit_offset= bit_offset+2;
1307 /* pic_init_qp_minus26 * relative to 26 * 1 se(v)*/
1308 dissect_h264_exp_golomb_code(tree, hf_h264_pic_init_qp_minus26, tvb, &bit_offset, H264_SE_V);
1310 /* pic_init_qs_minus26 * relative to 26 * 1 se(v)*/
1311 dissect_h264_exp_golomb_code(tree, hf_h264_pic_init_qs_minus26, tvb, &bit_offset, H264_SE_V);
1313 /* chroma_qp_index_offset 1 se(v)*/
1314 dissect_h264_exp_golomb_code(tree, hf_h264_chroma_qp_index_offset, tvb, &bit_offset, H264_SE_V);
1316 /* deblocking_filter_control_present_flag 1 u(1)*/
1317 proto_tree_add_bits_item(tree, hf_h264_deblocking_filter_control_present_flag, tvb, bit_offset, 1, FALSE);
1320 /* constrained_intra_pred_flag 1 u(1)*/
1321 proto_tree_add_bits_item(tree, hf_h264_constrained_intra_pred_flag, tvb, bit_offset, 1, FALSE);
1324 /* redundant_pic_cnt_present_flag 1 u(1)*/
1325 proto_tree_add_bits_item(tree, hf_h264_redundant_pic_cnt_present_flag, tvb, bit_offset, 1, FALSE);
1328 if( more_rbsp_data(tree, tvb, pinfo, bit_offset)){
1329 /* transform_8x8_mode_flag 1 u(1)*/
1330 proto_tree_add_bits_item(tree, hf_h264_transform_8x8_mode_flag, tvb, bit_offset, 1, FALSE);
1333 /* pic_scaling_matrix_present_flag 1 u(1)*/
1334 pic_scaling_matrix_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1335 proto_tree_add_bits_item(tree, hf_h264_pic_scaling_matrix_present_flag, tvb, bit_offset, 1, FALSE);
1338 if( pic_scaling_matrix_present_flag ){
1339 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
1341 /* for( i = 0; i < 6 + 2* transform_8x8_mode_flag; i++ ) {*/
1342 /* pic_scaling_list_present_flag[ i ] 1 u(1)*/
1343 /* if( pic_scaling_list_present_flag[ i ] )*/
1345 /* scaling_list( ScalingList4x4[ i ], 16, UseDefaultScalingMatrix4x4Flag[ i ] )*/
1347 /* scaling_list( ScalingList8x8[ i - 6 ], 64, UseDefaultScalingMatrix8x8Flag[ i - 6 ] )*/
1349 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
1352 /* second_chroma_qp_index_offset 1 se(v)*/
1353 dissect_h264_exp_golomb_code(tree, hf_h264_second_chroma_qp_index_offset, tvb, &bit_offset, H264_SE_V);
1355 bit_offset = dissect_h264_rbsp_trailing_bits(tree, tvb, pinfo, bit_offset);
1360 * 7.3.2.4 Access unit delimiter RBSP syntax
1361 * access_unit_delimiter_rbsp( )
1364 dissect_h264_access_unit_delimiter_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1366 /* primary_pic_type 6 u(3) */
1367 /* rbsp_trailing_bits( ) 6 */
1368 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1373 * 7.3.2.5 End of sequence RBSP syntax
1374 * end_of_seq_rbsp( ) {}
1377 dissect_h264_end_of_seq_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1379 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1384 * 7.3.2.6 End of stream RBSP syntax
1385 * end_of_stream_rbsp( ) {}
1388 dissect_h264_end_of_stream_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1390 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1395 * 7.3.2.7 Filler data RBSP syntax
1396 * filler_data_rbsp( )
1399 dissect_h264_filler_data_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1401 /* while( next_bits( 8 ) = = 0xFF ) */
1402 /* ff_byte * equal to 0xFF * 9 f(8) */
1403 /* rbsp_trailing_bits( ) 9 */
1404 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1409 * 7.3.2.1.2 Sequence parameter set extension RBSP syntax
1410 * seq_parameter_set_extension_rbsp( )
1413 dissect_h264_seq_parameter_set_extension_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1415 /* seq_parameter_set_id 10 ue(v) */
1416 /* aux_format_idc 10 ue(v) */
1417 /* if( aux_format_idc != 0 ) { */
1418 /* bit_depth_aux_minus8 10 ue(v) */
1419 /* alpha_incr_flag 10 u(1) */
1420 /* alpha_opaque_value 10 u(v) */
1421 /* alpha_transparent_value 10 u(v) */
1423 /* additional_extension_flag 10 u(1) */
1424 /* rbsp_trailing_bits() 10 */
1425 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1430 /* Dissect NAL unit as recived in sprop-parameter-sets of SDP */
1432 dissect_h264_nal_unit(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1435 proto_tree *h264_nal_tree;
1437 guint8 nal_unit_type;
1438 item = proto_tree_add_item(tree, hf_h264_nal_unit, tvb, offset, -1, FALSE);
1439 h264_nal_tree = proto_item_add_subtree(item, ett_h264_nal_unit);
1441 /* Ref: 7.3.1 NAL unit syntax */
1442 nal_unit_type = tvb_get_guint8(tvb,offset) & 0x1f;
1444 /* forbidden_zero_bit All f(1) */
1445 proto_tree_add_item(h264_nal_tree, hf_h264_forbidden_zero_bit, tvb, offset, 1, FALSE);
1446 /* nal_ref_idc All u(2) */
1447 proto_tree_add_item(h264_nal_tree, hf_h264_nal_ref_idc, tvb, offset, 1, FALSE);
1448 /* nal_unit_type All u(5) */
1449 proto_tree_add_item(h264_nal_tree, hf_h264_nal_unit_type, tvb, offset, 1, FALSE);
1452 switch(nal_unit_type){
1453 case 0: /* Unspecified */
1454 proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Unspecified NAL unit type");
1456 case 1: /* Coded slice of a non-IDR picture */
1457 dissect_h264_slice_layer_without_partitioning_rbsp(h264_nal_tree, tvb, pinfo, offset);
1459 case 2: /* Coded slice data partition A */
1460 dissect_h264_slice_data_partition_a_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
1462 case 3: /* Coded slice data partition B */
1463 dissect_h264_slice_data_partition_b_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
1465 case 4: /* Coded slice data partition C */
1466 dissect_h264_slice_data_partition_c_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
1468 case 5: /* Coded slice of an IDR picture */
1469 dissect_h264_slice_layer_without_partitioning_rbsp(h264_nal_tree, tvb, pinfo, offset);
1471 case 6: /* Supplemental enhancement information (SEI) */
1472 dissect_h264_sei_rbsp(h264_nal_tree, tvb, pinfo, offset);
1474 case H264_SEQ_PAR_SET: /* 7 Sequence parameter set*/
1475 dissect_h264_seq_parameter_set_rbsp(h264_nal_tree, tvb, pinfo, offset);
1477 case H264_PIC_PAR_SET: /* 8 Picture parameter set */
1478 dissect_h264_pic_parameter_set_rbsp(h264_nal_tree, tvb, pinfo, offset);
1480 case 9: /* Access unit delimiter */
1481 dissect_h264_access_unit_delimiter_rbsp(h264_nal_tree, tvb, pinfo, offset);
1483 case 10: /* End of sequence */
1484 dissect_h264_end_of_seq_rbsp(h264_nal_tree, tvb, pinfo, offset);
1486 case 11: /* End of stream */
1487 dissect_h264_end_of_stream_rbsp(h264_nal_tree, tvb, pinfo, offset);
1489 case 12: /* Filler data */
1490 dissect_h264_filler_data_rbsp(h264_nal_tree, tvb, pinfo, offset);
1492 case 13: /* Sequence parameter set extension */
1493 dissect_h264_seq_parameter_set_extension_rbsp(h264_nal_tree, tvb, pinfo, offset);
1495 case 14: /* Reserved */
1496 case 15: /* Reserved */
1497 case 16: /* Reserved */
1498 case 17: /* Reserved */
1499 case 18: /* Reserved */
1500 proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Reserved NAL unit type");
1502 case 19: /* Coded slice of an auxiliary coded picture without partitioning */
1503 dissect_h264_slice_layer_without_partitioning_rbsp(tree, tvb, pinfo, offset);
1506 /* 24..31 Unspecified */
1507 proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Unspecified NAL unit type");
1512 /* Code to actually dissect the packets */
1514 dissect_h264(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1517 proto_item *item, *ti, *stream_item;
1518 proto_tree *h264_tree, *h264_nal_tree, *stream_tree;
1522 /* Make entries in Protocol column and Info column on summary display */
1523 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1524 col_set_str(pinfo->cinfo, COL_PROTOCOL, "H264");
1527 item = proto_tree_add_item(tree, proto_h264, tvb, 0, -1, FALSE);
1528 h264_tree = proto_item_add_subtree(item, ett_h264);
1530 ti = proto_tree_add_text(h264_tree, tvb, offset, 1, "NAL unit header or first byte of the payload");
1531 h264_nal_tree = proto_item_add_subtree(ti, ett_h264_nal);
1532 /* +---------------+
1540 * forbidden_zero_bit. A value of 0 indicates that the NAL unit type
1541 * octet and payload should not contain bit errors or other syntax
1542 * violations. A value of 1 indicates that the NAL unit type octet
1543 * and payload may contain bit errors or other syntax violations.
1545 proto_tree_add_item(h264_nal_tree, hf_h264_nal_f_bit, tvb, offset, 1, FALSE);
1546 proto_tree_add_item(h264_nal_tree, hf_h264_nal_nri, tvb, offset, 1, FALSE);
1547 type = tvb_get_guint8(tvb,offset)&0x1f;
1548 if (check_col(pinfo->cinfo, COL_INFO)){
1549 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
1550 val_to_str(type, h264_type_values, "Unknown Type (%u)"));
1553 proto_tree_add_item(h264_nal_tree, hf_h264_type, tvb, offset, 1, FALSE);
1555 stream_item =proto_tree_add_text(h264_tree, tvb, offset, -1, "H264 bitstream");
1556 stream_tree = proto_item_add_subtree(stream_item, ett_h264_stream);
1558 case 1: /* 1 Coded slice of a non-IDR picture */
1559 dissect_h264_slice_layer_without_partitioning_rbsp(stream_tree, tvb, pinfo, offset);
1561 case 3: /* Coded slice data partition B */
1562 dissect_h264_slice_data_partition_b_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
1564 case 4: /* Coded slice data partition C */
1565 dissect_h264_slice_data_partition_c_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
1567 case 5: /* Coded slice of an IDR picture */
1568 dissect_h264_slice_layer_without_partitioning_rbsp(stream_tree, tvb, pinfo, offset);
1570 case H264_SEQ_PAR_SET: /* 7 Sequence parameter set*/
1571 dissect_h264_seq_parameter_set_rbsp(stream_tree, tvb, pinfo, offset);
1573 case H264_PIC_PAR_SET: /* 8 Picture parameter set */
1574 dissect_h264_pic_parameter_set_rbsp(stream_tree, tvb, pinfo, offset);
1576 case 19: /* Coded slice of an auxiliary coded picture without partitioning */
1577 dissect_h264_slice_layer_without_partitioning_rbsp(stream_tree, tvb, pinfo, offset);
1589 static const int *profile_fields[] = {
1590 &hf_h264_par_profile_b,
1591 &hf_h264_par_profile_m,
1592 &hf_h264_par_profile_e,
1593 &hf_h264_par_profile_h,
1594 &hf_h264_par_profile_h10,
1595 &hf_h264_par_profile_h4_2_2,
1596 &hf_h264_par_profile_h4_4_4,
1601 dissect_h264_par_profile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1605 proto_tree_add_bitmask(tree, tvb, offset,
1606 hf_h264_par_profile, ett_h264_par_profile,
1607 profile_fields, FALSE);
1612 static const int *AdditionalModesSupported_fields[] = {
1613 &hf_h264_par_add_mode_sup_rcdo,
1617 dissect_h264_par_AdditionalModesSupported(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1621 proto_tree_add_bitmask(tree, tvb, offset,
1622 hf_h264_par_AdditionalModesSupported, ett_h264_par_AdditionalModesSupported,
1623 AdditionalModesSupported_fields, FALSE);
1629 static const int *ProfileIOP_fields[] = {
1630 &hf_h264_par_constraint_set0_flag,
1631 &hf_h264_par_constraint_set1_flag,
1632 &hf_h264_par_constraint_set2_flag,
1638 dissect_h264_ProfileIOP(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1642 proto_tree_add_bitmask(tree, tvb, offset,
1643 hf_h264_par_ProfileIOP, ett_h264_par_ProfileIOP,
1644 ProfileIOP_fields, FALSE);
1649 static const value_string h264_par_level_values[] = {
1670 dissect_h264_par_level(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_)
1674 const gchar *p = NULL;
1677 actx = get_asn1_ctx(pinfo->private_data);
1678 DISSECTOR_ASSERT(actx);
1680 lvl = tvb_get_ntohs(tvb, offset);
1681 p = match_strval(lvl, VALS(h264_par_level_values));
1683 proto_item_append_text(actx->created_item, " - Level %s", p);
1689 typedef struct _h264_capability_t {
1692 new_dissector_t content_pdu;
1693 } h264_capability_t;
1695 static h264_capability_t h264_capability_tab[] = {
1696 /* ITU-T H.241 (05/2006), 8.3 H.264 capabilities */
1697 { "GenericCapability/0.0.8.241.0.0.1", "ITU-T Rec. H.241 H.264 Video Capabilities", NULL },
1698 { "GenericCapability/0.0.8.241.0.0.1/collapsing/41", "Profile", dissect_h264_par_profile },
1699 { "GenericCapability/0.0.8.241.0.0.1/collapsing/42", "Level", dissect_h264_par_level },
1700 { "GenericCapability/0.0.8.241.0.0.1/collapsing/3" , "CustomMaxMBPS", NULL },
1701 { "GenericCapability/0.0.8.241.0.0.1/collapsing/4" , "CustomMaxFS", NULL },
1702 { "GenericCapability/0.0.8.241.0.0.1/collapsing/5" , "CustomMaxDPB", NULL },
1703 { "GenericCapability/0.0.8.241.0.0.1/collapsing/6" , "CustomMaxBRandCPB", NULL },
1704 { "GenericCapability/0.0.8.241.0.0.1/collapsing/7" , "MaxStaticMBPS", NULL },
1705 { "GenericCapability/0.0.8.241.0.0.1/collapsing/8" , "max-rcmd-nal-unit-size", NULL },
1706 { "GenericCapability/0.0.8.241.0.0.1/collapsing/9" , "max-nal-unit-size", NULL },
1707 { "GenericCapability/0.0.8.241.0.0.1/collapsing/10", "SampleAspectRatiosSupported", NULL },
1708 { "GenericCapability/0.0.8.241.0.0.1/collapsing/11", "AdditionalModesSupported", dissect_h264_par_AdditionalModesSupported },
1709 { "GenericCapability/0.0.8.241.0.0.1/collapsing/12", "AdditionalDisplayCapabilities", NULL },
1710 /* TS 26.111 H.264 */
1711 { "GenericCapability/0.0.8.241.0.0.1/collapsing/43" , "DecoderConfigurationInformation", NULL },
1712 { "GenericCapability/0.0.8.241.0.0.1/collapsing/44" , "AcceptRedundantSlices", NULL },
1713 { "GenericCapability/0.0.8.241.0.0.1/collapsing/45" , "NalAlignedMode", NULL },
1714 { "GenericCapability/0.0.8.241.0.0.1/collapsing/46" , "ProfileIOP", dissect_h264_ProfileIOP },
1715 { NULL, NULL, NULL },
1718 static h264_capability_t *find_cap(const gchar *id) {
1719 h264_capability_t *ftr = NULL;
1720 h264_capability_t *f;
1722 for (f=h264_capability_tab; f->id; f++) {
1723 if (!strcmp(id, f->id)) { ftr = f; break; }
1729 dissect_h264_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree)
1732 h264_capability_t *ftr = NULL;
1734 actx = get_asn1_ctx(pinfo->private_data);
1735 DISSECTOR_ASSERT(actx);
1737 ftr = find_cap(pinfo->match_string);
1739 proto_item_append_text(actx->created_item, " - %s", ftr->name);
1740 proto_item_append_text(proto_item_get_parent(proto_tree_get_parent(tree)), ": %s", ftr->name);
1742 proto_item_append_text(actx->created_item, " - unknown(%s)", pinfo->match_string);
1748 /* Register the protocol with Wireshark */
1749 /* If this dissector uses sub-dissector registration add a registration routine.
1750 This format is required because a script is used to find these routines and
1751 create the code that calls these routines.
1754 proto_reg_handoff_h264(void)
1756 dissector_handle_t h264_handle;
1757 dissector_handle_t h264_name_handle;
1758 h264_capability_t *ftr;
1760 static int h264_prefs_initialized = FALSE;
1762 h264_handle = create_dissector_handle(dissect_h264, proto_h264);
1764 if (!h264_prefs_initialized) {
1765 h264_prefs_initialized = TRUE;
1768 if ( dynamic_payload_type > 95 )
1769 dissector_delete("rtp.pt", dynamic_payload_type, h264_handle);
1771 dynamic_payload_type = temp_dynamic_payload_type;
1773 if ( dynamic_payload_type > 95 ){
1774 dissector_add("rtp.pt", dynamic_payload_type, h264_handle);
1776 dissector_add_string("rtp_dyn_payload_type","H264", h264_handle);
1778 h264_name_handle = create_dissector_handle(dissect_h264_name, proto_h264);
1779 for (ftr=h264_capability_tab; ftr->id; ftr++) {
1781 dissector_add_string("h245.gef.name", ftr->id, h264_name_handle);
1782 if (ftr->content_pdu)
1783 dissector_add_string("h245.gef.content", ftr->id, new_create_dissector_handle(ftr->content_pdu, proto_h264));
1788 /* this format is require because a script is used to build the C function
1789 that calls all the protocol registration.
1793 proto_register_h264(void)
1796 module_t *h264_module;
1798 /* Setup list of header fields See Section 1.6.1 for details*/
1799 static hf_register_info hf[] = {
1800 { &hf_h264_nal_f_bit,
1801 { "F bit", "h264.f",
1802 FT_BOOLEAN, 8, TFS(&h264_f_bit_vals), 0x80,
1806 { "Nal_ref_idc (NRI)", "h264.nal_nri",
1807 FT_UINT8, BASE_DEC, NULL, 0x60,
1811 { "Type", "h264.nal_unit_hdr",
1812 FT_UINT8, BASE_DEC, VALS(h264_type_values), 0x1f,
1816 { "Profile", "h264.profile",
1817 FT_BYTES, BASE_NONE, NULL, 0x0,
1820 { &hf_h264_profile_idc,
1821 { "Profile_idc", "h264.profile_idc",
1822 FT_UINT8, BASE_DEC, VALS(h264_profile_idc_values), 0xff,
1823 "Profile_idc", HFILL }
1825 { &hf_h264_rbsp_stop_bit,
1826 { "rbsp_stop_bit", "h264.rbsp_stop_bit",
1827 FT_UINT8, BASE_DEC, NULL, 0x0,
1828 "rbsp_stop_bit", HFILL }
1830 { &hf_h264_rbsp_trailing_bits,
1831 { "rbsp_trailing_bits", "h264.rbsp_trailing_bits",
1832 FT_UINT8, BASE_DEC, NULL, 0x0,
1833 "rbsp_trailing_bits", HFILL }
1835 { &hf_h264_constraint_set0_flag,
1836 { "Constraint_set0_flag", "h264.constraint_set0_flag",
1837 FT_UINT8, BASE_DEC, NULL, 0x80,
1838 "Constraint_set0_flag", HFILL }
1840 { &hf_h264_constraint_set1_flag,
1841 { "Constraint_set1_flag", "h264.constraint_set1_flag",
1842 FT_UINT8, BASE_DEC, NULL, 0x40,
1843 "Constraint_set1_flag", HFILL }
1845 { &hf_h264_constraint_set2_flag,
1846 { "Constraint_set2_flag", "h264.constraint_set2_flag",
1847 FT_UINT8, BASE_DEC, NULL, 0x20,
1850 { &hf_h264_constraint_set3_flag,
1851 { "Constraint_set3_flag", "h264.constraint_set3_flag",
1852 FT_UINT8, BASE_DEC, NULL, 0x10,
1853 "Constraint_set3_flag", HFILL }
1855 { &hf_h264_reserved_zero_4bits,
1856 { "Reserved_zero_4bits", "h264.reserved_zero_4bits",
1857 FT_UINT8, BASE_DEC, NULL, 0x0f,
1858 "Reserved_zero_4bits", HFILL }
1860 { &hf_h264_level_idc,
1861 { "Level_id", "h264.level_id",
1862 FT_UINT8, BASE_DEC, NULL, 0xff,
1865 { &hf_h264_nal_unit,
1866 { "NAL unit", "h264.nal_unit",
1867 FT_BYTES, BASE_NONE, NULL, 0x0,
1870 { &hf_h264_forbidden_zero_bit,
1871 { "Forbidden_zero_bit", "h264.forbidden_zero_bit",
1872 FT_UINT8, BASE_DEC, NULL, 0x80,
1873 "forbidden_zero_bit", HFILL }
1875 { &hf_h264_nal_ref_idc,
1876 { "Nal_ref_idc", "h264.nal_ref_idc",
1877 FT_UINT8, BASE_DEC, NULL, 0x60,
1878 "nal_ref_idc", HFILL }
1880 {&hf_h264_nal_unit_type,
1881 { "Nal_unit_type", "h264.nal_unit_type",
1882 FT_UINT8, BASE_DEC, VALS(h264_nal_unit_type_vals), 0x1f,
1883 "nal_unit_type", HFILL }
1885 { &hf_h264_seq_parameter_set_id,
1886 { "seq_parameter_set_id", "h264.seq_parameter_set_id",
1887 FT_UINT32, BASE_DEC, NULL, 0x0,
1888 "seq_parameter_set_id", HFILL }
1890 { &hf_h264_chroma_format_idc,
1891 { "chroma_format_id", "h264.chroma_format_id",
1892 FT_UINT32, BASE_DEC, NULL, 0x0,
1893 "chroma_format_id", HFILL }
1895 { &hf_h264_residual_colour_transform_flag,
1896 { "residual_colour_transform_flag", "h264.residual_colour_transform_flag",
1897 FT_UINT8, BASE_DEC, NULL, 0x0,
1898 "residual_colour_transform_flag", HFILL }
1900 { &hf_h264_bit_depth_luma_minus8,
1901 { "bit_depth_luma_minus8", "h264.bit_depth_luma_minus8",
1902 FT_UINT32, BASE_DEC, NULL, 0x0,
1903 "bit_depth_luma_minus8", HFILL }
1905 { &hf_h264_bit_depth_chroma_minus8,
1906 { "bit_depth_chroma_minus8", "h264.bit_depth_chroma_minus8",
1907 FT_UINT32, BASE_DEC, NULL, 0x0,
1908 "bit_depth_chroma_minus8", HFILL }
1910 { &hf_h264_qpprime_y_zero_transform_bypass_flag,
1911 { "qpprime_y_zero_transform_bypass_flag", "h264.qpprime_y_zero_transform_bypass_flag",
1912 FT_UINT32, BASE_DEC, NULL, 0x0,
1913 "qpprime_y_zero_transform_bypass_flag", HFILL }
1915 { &hf_h264_seq_scaling_matrix_present_flag,
1916 { "seq_scaling_matrix_present_flag", "h264.seq_scaling_matrix_present_flag",
1917 FT_UINT32, BASE_DEC, NULL, 0x0,
1918 "seq_scaling_matrix_present_flag", HFILL }
1920 { &hf_h264_log2_max_frame_num_minus4,
1921 { "log2_max_frame_num_minus4", "h264.log2_max_frame_num_minus4",
1922 FT_UINT32, BASE_DEC, NULL, 0x0,
1923 "log2_max_frame_num_minus4", HFILL }
1925 { &hf_h264_pic_order_cnt_type,
1926 { "pic_order_cnt_type", "h264.pic_order_cnt_type",
1927 FT_UINT32, BASE_DEC, NULL, 0x0,
1928 "pic_order_cnt_type", HFILL }
1930 { &hf_h264_log2_max_pic_order_cnt_lsb_minus4,
1931 { "log2_max_pic_order_cnt_lsb_minus4", "h264.log2_max_pic_order_cnt_lsb_minus4",
1932 FT_UINT32, BASE_DEC, NULL, 0x0,
1933 "log2_max_pic_order_cnt_lsb_minus4", HFILL }
1935 { &hf_h264_delta_pic_order_always_zero_flag,
1936 { "delta_pic_order_always_zero_flag", "h264.delta_pic_order_always_zero_flag",
1937 FT_UINT8, BASE_DEC, NULL, 0x0,
1938 "delta_pic_order_always_zero_flag", HFILL }
1940 { &hf_h264_offset_for_non_ref_pic,
1941 { "offset_for_non_ref_pic", "h264.offset_for_non_ref_pic",
1942 FT_INT32, BASE_DEC, NULL, 0x0,
1943 "offset_for_non_ref_pic", HFILL }
1945 { &hf_h264_offset_for_top_to_bottom_field,
1946 { "offset_for_top_to_bottom_field", "h264.offset_for_top_to_bottom_field",
1947 FT_INT32, BASE_DEC, NULL, 0x0,
1948 "offset_for_top_to_bottom_field", HFILL }
1950 { &hf_264_num_ref_frames_in_pic_order_cnt_cycle,
1951 { "num_ref_frames_in_pic_order_cnt_cycle", "h264.num_ref_frames_in_pic_order_cnt_cycle",
1952 FT_UINT32, BASE_DEC, NULL, 0x0,
1953 "num_ref_frames_in_pic_order_cnt_cycle", HFILL }
1955 { &hf_h264_offset_for_ref_frame,
1956 { "offset_for_ref_frame", "h264.offset_for_ref_frame",
1957 FT_INT32, BASE_DEC, NULL, 0x0,
1958 "offset_for_ref_frame", HFILL }
1960 { &hf_h264_num_ref_frames,
1961 { "num_ref_frames", "h264.num_ref_frames",
1962 FT_UINT32, BASE_DEC, NULL, 0x0,
1963 "num_ref_frames", HFILL }
1965 { &hf_h264_gaps_in_frame_num_value_allowed_flag,
1966 { "gaps_in_frame_num_value_allowed_flag", "h264.gaps_in_frame_num_value_allowed_flag",
1967 FT_UINT8, BASE_DEC, NULL, 0x0,
1968 "gaps_in_frame_num_value_allowed_flag", HFILL }
1970 { &hf_h264_pic_width_in_mbs_minus1,
1971 { "pic_width_in_mbs_minus1", "h264.pic_width_in_mbs_minus1",
1972 FT_UINT32, BASE_DEC, NULL, 0x0,
1973 "pic_width_in_mbs_minus1", HFILL }
1975 { &hf_h264_pic_height_in_map_units_minus1,
1976 { "pic_height_in_map_units_minus1", "h264.pic_height_in_map_units_minus1",
1977 FT_UINT32, BASE_DEC, NULL, 0x0,
1978 "pic_height_in_map_units_minus1", HFILL }
1980 { &hf_h264_frame_mbs_only_flag,
1981 { "frame_mbs_only_flag", "h264.frame_mbs_only_flag",
1982 FT_UINT8, BASE_DEC, NULL, 0x0,
1983 "frame_mbs_only_flag", HFILL }
1985 { &hf_h264_mb_adaptive_frame_field_flag,
1986 { "mb_adaptive_frame_field_flag", "h264.mb_adaptive_frame_field_flag",
1987 FT_UINT8, BASE_DEC, NULL, 0x0,
1988 "mb_adaptive_frame_field_flag", HFILL }
1990 { &hf_h264_direct_8x8_inference_flag,
1991 { "direct_8x8_inference_flag", "h264.direct_8x8_inference_flag",
1992 FT_UINT8, BASE_DEC, NULL, 0x0,
1993 "direct_8x8_inference_flag", HFILL }
1995 { &hf_h264_frame_cropping_flag,
1996 { "frame_cropping_flag", "h264.frame_cropping_flag",
1997 FT_UINT8, BASE_DEC, NULL, 0x0,
1998 "frame_cropping_flag", HFILL }
2000 { &hf_h264_frame_crop_left_offset,
2001 { "frame_crop_left_offset", "h264.frame_crop_left_offset",
2002 FT_UINT32, BASE_DEC, NULL, 0x0,
2003 "frame_crop_left_offset", HFILL }
2005 { &hf_h264_frame_crop_right_offset,
2006 { "frame_crop_left_offset", "h264.frame_crop_right_offset",
2007 FT_UINT32, BASE_DEC, NULL, 0x0,
2008 "frame_crop_right_offset", HFILL }
2010 { &hf_h264_frame_crop_top_offset,
2011 { "frame_crop_top_offset", "h264.frame_crop_top_offset",
2012 FT_UINT32, BASE_DEC, NULL, 0x0,
2013 "frame_crop_top_offset", HFILL }
2015 { &hf_h264_frame_crop_bottom_offset,
2016 { "frame_crop_bottom_offset", "h264.frame_crop_bottom_offset",
2017 FT_UINT32, BASE_DEC, NULL, 0x0,
2018 "frame_crop_bottom_offset", HFILL }
2020 { &hf_h264_vui_parameters_present_flag,
2021 { "vui_parameters_present_flag", "h264.vui_parameters_present_flag",
2022 FT_UINT8, BASE_DEC, NULL, 0x0,
2023 "vui_parameters_present_flag", HFILL }
2025 { &hf_h264_pic_parameter_set_id,
2026 { "pic_parameter_set_id", "h264.pic_parameter_set_id",
2027 FT_UINT32, BASE_DEC, NULL, 0x0,
2028 "pic_parameter_set_id", HFILL }
2030 { &hf_h264_entropy_coding_mode_flag,
2031 { "entropy_coding_mode_flag", "h264.entropy_coding_mode_flag",
2032 FT_UINT8, BASE_DEC, NULL, 0x0,
2033 "entropy_coding_mode_flag", HFILL }
2035 { &hf_h264_pic_order_present_flag,
2036 { "pic_order_present_flag", "h264.pic_order_present_flag",
2037 FT_UINT8, BASE_DEC, NULL, 0x0,
2038 "pic_order_present_flag", HFILL }
2040 { &hf_h264_num_slice_groups_minus1,
2041 { "num_slice_groups_minus1", "h264.num_slice_groups_minus1",
2042 FT_UINT32, BASE_DEC, NULL, 0x0,
2043 "num_slice_groups_minus1", HFILL }
2045 { &hf_h264_slice_group_map_type,
2046 { "slice_group_map_type", "h264.slice_group_map_type",
2047 FT_UINT32, BASE_DEC, VALS(h264_slice_group_map_type_vals), 0x0,
2048 "slice_group_map_type", HFILL }
2050 { &hf_h264_num_ref_idx_l0_active_minus1,
2051 { "num_ref_idx_l0_active_minus1", "h264.num_ref_idx_l0_active_minus1",
2052 FT_UINT32, BASE_DEC, NULL, 0x0,
2053 "num_ref_idx_l0_active_minus1", HFILL }
2055 { &hf_h264_num_ref_idx_l1_active_minus1,
2056 { "num_ref_idx_l1_active_minus1", "h264.num_ref_idx_l1_active_minus1",
2057 FT_UINT32, BASE_DEC, NULL, 0x0,
2058 "num_ref_idx_l1_active_minus1", HFILL }
2060 { &hf_h264_weighted_pred_flag,
2061 { "weighted_pred_flag", "h264.weighted_pred_flag",
2062 FT_UINT8, BASE_DEC, NULL, 0x0,
2063 "weighted_pred_flag", HFILL }
2065 { &hf_h264_weighted_bipred_idc,
2066 { "weighted_bipred_idc", "h264.weighted_bipred_idc",
2067 FT_UINT8, BASE_DEC, NULL, 0x0,
2068 "weighted_bipred_idc", HFILL }
2070 { &hf_h264_pic_init_qp_minus26,
2071 { "pic_init_qp_minus26", "h264.pic_init_qp_minus26",
2072 FT_INT32, BASE_DEC, NULL, 0x0,
2073 "pic_init_qp_minus26", HFILL }
2075 { &hf_h264_pic_init_qs_minus26,
2076 { "pic_init_qs_minus26", "h264.pic_init_qs_minus26",
2077 FT_INT32, BASE_DEC, NULL, 0x0,
2078 "pic_init_qs_minus26", HFILL }
2080 { &hf_h264_chroma_qp_index_offset,
2081 { "chroma_qp_index_offset", "h264.chroma_qp_index_offset",
2082 FT_INT32, BASE_DEC, NULL, 0x0,
2083 "chroma_qp_index_offset", HFILL }
2085 { &hf_h264_deblocking_filter_control_present_flag,
2086 { "deblocking_filter_control_present_flag", "h264.deblocking_filter_control_present_flag",
2087 FT_UINT8, BASE_DEC, NULL, 0x0,
2088 "deblocking_filter_control_present_flag", HFILL }
2090 { &hf_h264_constrained_intra_pred_flag,
2091 { "constrained_intra_pred_flag", "h264.constrained_intra_pred_flag",
2092 FT_UINT8, BASE_DEC, NULL, 0x0,
2093 "constrained_intra_pred_flag", HFILL }
2095 { &hf_h264_redundant_pic_cnt_present_flag,
2096 { "redundant_pic_cnt_present_flag", "h264.redundant_pic_cnt_present_flag",
2097 FT_UINT8, BASE_DEC, NULL, 0x0,
2098 "redundant_pic_cnt_present_flag", HFILL }
2100 { &hf_h264_transform_8x8_mode_flag,
2101 { "transform_8x8_mode_flag", "h264.transform_8x8_mode_flag",
2102 FT_UINT8, BASE_DEC, NULL, 0x0,
2103 "transform_8x8_mode_flag", HFILL }
2105 { &hf_h264_pic_scaling_matrix_present_flag,
2106 { "pic_scaling_matrix_present_flag", "h264.pic_scaling_matrix_present_flag",
2107 FT_UINT8, BASE_DEC, NULL, 0x0,
2108 "pic_scaling_matrix_present_flag", HFILL }
2110 { &hf_h264_second_chroma_qp_index_offset,
2111 { "second_chroma_qp_index_offset", "h264.second_chroma_qp_index_offset",
2112 FT_INT32, BASE_DEC, NULL, 0x0,
2113 "second_chroma_qp_index_offset", HFILL }
2116 { &hf_h264_aspect_ratio_info_present_flag,
2117 { "aspect_ratio_info_present_flag", "h264.aspect_ratio_info_present_flag",
2118 FT_UINT8, BASE_DEC, NULL, 0x0,
2119 "aspect_ratio_info_present_flag", HFILL }
2121 { &hf_h264_aspect_ratio_idc,
2122 { "aspect_ratio_idc", "h264.aspect_ratio_idc",
2123 FT_UINT8, BASE_DEC, NULL, 0x0,
2124 "aspect_ratio_idc", HFILL }
2126 { &hf_h264_sar_width,
2127 { "sar_width", "h264.sar_width",
2128 FT_UINT16, BASE_DEC, NULL, 0x0,
2129 "sar_width", HFILL }
2131 { &hf_h264_sar_height,
2132 { "sar_height", "h264.sar_height",
2133 FT_UINT16, BASE_DEC, NULL, 0x0,
2134 "sar_height", HFILL }
2136 { &hf_h264_overscan_info_present_flag,
2137 { "overscan_info_present_flag", "h264.overscan_info_present_flag",
2138 FT_UINT8, BASE_DEC, NULL, 0x0,
2139 "overscan_info_present_flag", HFILL }
2141 { &hf_h264_overscan_appropriate_flag,
2142 { "overscan_appropriate_flag", "h264.overscan_appropriate_flag",
2143 FT_UINT8, BASE_DEC, NULL, 0x0,
2144 "overscan_appropriate_flag", HFILL }
2146 { &hf_h264_video_signal_type_present_flag,
2147 { "video_signal_type_present_flag", "h264.video_signal_type_present_flag",
2148 FT_UINT8, BASE_DEC, NULL, 0x0,
2149 "video_signal_type_present_flag", HFILL }
2151 { &hf_h264_video_format,
2152 { "video_format", "h264.video_format",
2153 FT_UINT8, BASE_DEC, NULL, 0x0,
2154 "video_format", HFILL }
2156 { &hf_h264_video_full_range_flag,
2157 { "video_full_range_flag", "h264.video_full_range_flag",
2158 FT_UINT8, BASE_DEC, NULL, 0x0,
2159 "video_full_range_flag", HFILL }
2161 { &hf_h264_colour_description_present_flag,
2162 { "colour_description_present_flag", "h264.colour_description_present_flag",
2163 FT_UINT8, BASE_DEC, NULL, 0x0,
2164 "colour_description_present_flag", HFILL }
2166 { &hf_h264_colour_primaries,
2167 { "colour_primaries", "h264.colour_primaries",
2168 FT_UINT8, BASE_DEC, NULL, 0x0,
2169 "colour_primaries", HFILL }
2171 { &hf_h264_transfer_characteristics,
2172 { "transfer_characteristics", "h264.transfer_characteristics",
2173 FT_UINT8, BASE_DEC, NULL, 0x0,
2174 "transfer_characteristics", HFILL }
2176 { &hf_h264_matrix_coefficients,
2177 { "matrix_coefficients", "h264.matrix_coefficients",
2178 FT_UINT8, BASE_DEC, NULL, 0x0,
2179 "matrix_coefficients", HFILL }
2181 { &hf_h264_chroma_loc_info_present_flag,
2182 { "chroma_loc_info_present_flag", "h264.chroma_loc_info_present_flag",
2183 FT_UINT8, BASE_DEC, NULL, 0x0,
2184 "chroma_loc_info_present_flag", HFILL }
2186 { &hf_h264_chroma_sample_loc_type_top_field,
2187 { "chroma_sample_loc_type_top_field", "h264.chroma_sample_loc_type_top_field",
2188 FT_UINT32, BASE_DEC, NULL, 0x0,
2189 "chroma_sample_loc_type_top_field", HFILL }
2191 { &hf_h264_chroma_sample_loc_type_bottom_field,
2192 { "chroma_sample_loc_type_bottom_field", "h264.chroma_sample_loc_type_bottom_field",
2193 FT_UINT32, BASE_DEC, NULL, 0x0,
2194 "chroma_sample_loc_type_bottom_field", HFILL }
2196 { &hf_h264_timing_info_present_flag,
2197 { "timing_info_present_flag", "h264.timing_info_present_flag",
2198 FT_UINT8, BASE_DEC, NULL, 0x0,
2199 "timing_info_present_flag", HFILL }
2201 { &hf_h264_num_units_in_tick,
2202 { "num_units_in_tick", "h264.num_units_in_tick",
2203 FT_UINT32, BASE_DEC, NULL, 0x0,
2204 "num_units_in_tick", HFILL }
2206 { &hf_h264_time_scale,
2207 { "time_scale", "h264.time_scale",
2208 FT_UINT32, BASE_DEC, NULL, 0x0,
2209 "time_scale", HFILL }
2211 { &hf_h264_fixed_frame_rate_flag,
2212 { "fixed_frame_rate_flag", "h264.fixed_frame_rate_flag",
2213 FT_UINT8, BASE_DEC, NULL, 0x0,
2214 "fixed_frame_rate_flag", HFILL }
2216 { &hf_h264_nal_hrd_parameters_present_flag,
2217 { "nal_hrd_parameters_present_flag", "h264.nal_hrd_parameters_present_flag",
2218 FT_UINT8, BASE_DEC, NULL, 0x0,
2219 "nal_hrd_parameters_present_flag", HFILL }
2221 { &hf_h264_vcl_hrd_parameters_present_flag,
2222 { "vcl_hrd_parameters_present_flag", "h264.vcl_hrd_parameters_present_flag",
2223 FT_UINT8, BASE_DEC, NULL, 0x0,
2224 "vcl_hrd_parameters_present_flag", HFILL }
2226 { &hf_h264_low_delay_hrd_flag,
2227 { "low_delay_hrd_flag", "h264.low_delay_hrd_flag",
2228 FT_UINT8, BASE_DEC, NULL, 0x0,
2229 "low_delay_hrd_flag", HFILL }
2231 { &hf_h264_pic_struct_present_flag,
2232 { "pic_struct_present_flag", "h264.pic_struct_present_flag",
2233 FT_UINT8, BASE_DEC, NULL, 0x0,
2234 "pic_struct_present_flag", HFILL }
2236 { &hf_h264_bitstream_restriction_flag,
2237 { "bitstream_restriction_flag", "h264.bitstream_restriction_flag",
2238 FT_UINT8, BASE_DEC, NULL, 0x0,
2239 "bitstream_restriction_flag", HFILL }
2241 { &hf_h264_motion_vectors_over_pic_boundaries_flag,
2242 { "motion_vectors_over_pic_boundaries_flag", "h264.motion_vectors_over_pic_boundaries_flag",
2243 FT_UINT32, BASE_DEC, NULL, 0x0,
2244 "motion_vectors_over_pic_boundaries_flag", HFILL }
2246 { &hf_h264_max_bytes_per_pic_denom,
2247 { "max_bytes_per_pic_denom", "h264.max_bytes_per_pic_denom",
2248 FT_UINT32, BASE_DEC, NULL, 0x0,
2249 "max_bytes_per_pic_denom", HFILL }
2251 { &hf_h264_max_bits_per_mb_denom,
2252 { "max_bits_per_mb_denom", "h264.max_bits_per_mb_denom",
2253 FT_UINT32, BASE_DEC, NULL, 0x0,
2254 "max_bits_per_mb_denom", HFILL }
2256 { &hf_h264_log2_max_mv_length_horizontal,
2257 { "max_mv_length_horizontal", "h264.max_mv_length_horizontal",
2258 FT_UINT32, BASE_DEC, NULL, 0x0,
2259 "max_mv_length_horizontal", HFILL }
2261 { &hf_h264_log2_max_mv_length_vertical,
2262 { "log2_max_mv_length_vertical", "h264.log2_max_mv_length_vertical",
2263 FT_UINT32, BASE_DEC, NULL, 0x0,
2264 "log2_max_mv_length_vertical", HFILL }
2266 { &hf_h264_num_reorder_frames,
2267 { "num_reorder_frames", "h264.num_reorder_frames",
2268 FT_UINT32, BASE_DEC, NULL, 0x0,
2269 "num_reorder_frames", HFILL }
2271 { &hf_h264_max_dec_frame_buffering,
2272 { "max_dec_frame_buffering", "h264.max_dec_frame_buffering",
2273 FT_UINT32, BASE_DEC, NULL, 0x0,
2274 "max_dec_frame_buffering", HFILL }
2276 { &hf_h264_cpb_cnt_minus1,
2277 { "cpb_cnt_minus1", "h264.cpb_cnt_minus1",
2278 FT_UINT32, BASE_DEC, NULL, 0x0,
2279 "cpb_cnt_minus1", HFILL }
2281 { &hf_h264_bit_rate_scale,
2282 { "bit_rate_scale", "h264.bit_rate_scale",
2283 FT_UINT8, BASE_DEC, NULL, 0x0,
2284 "bit_rate_scale", HFILL }
2286 { &hf_h264_cpb_size_scale,
2287 { "cpb_size_scale", "h264.cpb_size_scale",
2288 FT_UINT8, BASE_DEC, NULL, 0x0,
2289 "cpb_size_scale", HFILL }
2291 { &hf_h264_bit_rate_value_minus1,
2292 { "bit_rate_value_minus1", "h264.bit_rate_value_minus1",
2293 FT_UINT32, BASE_DEC, NULL, 0x0,
2294 "bit_rate_value_minus1", HFILL }
2296 { &hf_h264_cpb_size_value_minus1,
2297 { "cpb_size_value_minus1", "h264.cpb_size_value_minus1",
2298 FT_UINT32, BASE_DEC, NULL, 0x0,
2299 "cpb_size_value_minus1", HFILL }
2301 { &hf_h264_cbr_flag,
2302 { "cbr_flag", "h264.cbr_flag",
2303 FT_UINT8, BASE_DEC, NULL, 0x0,
2306 { &hf_h264_initial_cpb_removal_delay_length_minus1,
2307 { "initial_cpb_removal_delay_length_minus1", "h264.initial_cpb_removal_delay_length_minus1",
2308 FT_UINT8, BASE_DEC, NULL, 0x0,
2309 "initial_cpb_removal_delay_length_minus1", HFILL }
2311 { &hf_h264_cpb_removal_delay_length_minus1,
2312 { "cpb_removal_delay_length_minus1", "h264.cpb_removal_delay_length_minus1",
2313 FT_UINT8, BASE_DEC, NULL, 0x0,
2314 "cpb_removal_delay_length_minus1", HFILL }
2316 { &hf_h264_dpb_output_delay_length_minus11,
2317 { "dpb_output_delay_length_minus11", "h264.dpb_output_delay_length_minus11",
2318 FT_UINT8, BASE_DEC, NULL, 0x0,
2319 "dpb_output_delay_length_minus11", HFILL }
2321 { &hf_h264_time_offset_length,
2322 { "time_offset_length", "h264.time_offset_length",
2323 FT_UINT8, BASE_DEC, NULL, 0x0,
2324 "time_offset_length", HFILL }
2326 { &hf_h264_first_mb_in_slice,
2327 { "first_mb_in_slice", "h264.first_mb_in_slice",
2328 FT_UINT32, BASE_DEC, NULL, 0x0,
2329 "first_mb_in_slice", HFILL }
2331 { &hf_h264_slice_type,
2332 { "slice_type", "h264.slice_type",
2333 FT_UINT32, BASE_DEC, VALS(h264_slice_type_vals), 0x0,
2334 "slice_type", HFILL }
2336 { &hf_h264_slice_id,
2337 { "slice_id", "h264.slice_id",
2338 FT_UINT32, BASE_DEC, NULL, 0x0,
2341 { &hf_h264_frame_num,
2342 { "frame_num", "h264.frame_num",
2343 FT_UINT8, BASE_DEC, NULL, 0x0,
2344 "frame_num", HFILL }
2347 { &hf_h264_par_profile,
2348 { "Profile", "h264.profile",
2349 FT_UINT8, BASE_HEX, NULL, 0x00,
2351 { &hf_h264_par_profile_b,
2352 { "Baseline Profile", "h264.profile.base",
2353 FT_BOOLEAN, 8, NULL, 0x40,
2355 { &hf_h264_par_profile_m,
2356 { "Main Profile", "h264.profile.main",
2357 FT_BOOLEAN, 8, NULL, 0x20,
2359 { &hf_h264_par_profile_e,
2360 { "Extended Profile.", "h264.profile.ext",
2361 FT_BOOLEAN, 8, NULL, 0x10,
2363 { &hf_h264_par_profile_h,
2364 { "High Profile", "h264.profile.high",
2365 FT_BOOLEAN, 8, NULL, 0x08,
2367 { &hf_h264_par_profile_h10,
2368 { "High 10 Profile", "h264.profile.high10",
2369 FT_BOOLEAN, 8, NULL, 0x04,
2371 { &hf_h264_par_profile_h4_2_2,
2372 { "High 4:2:2 Profile", "h264.profile.high4_2_2",
2373 FT_BOOLEAN, 8, NULL, 0x02,
2375 { &hf_h264_par_profile_h4_4_4,
2376 { "High 4:4:4 Profile", "h264.profile.high4_4_4",
2377 FT_BOOLEAN, 8, NULL, 0x01,
2379 { &hf_h264_par_AdditionalModesSupported,
2380 { "AdditionalModesSupported", "h264.AdditionalModesSupported",
2381 FT_UINT8, BASE_HEX, NULL, 0x00,
2383 { &hf_h264_par_add_mode_sup,
2384 { "Additional Modes Supported", "h264.add_mode_sup",
2385 FT_UINT8, BASE_HEX, NULL, 0x00,
2387 { &hf_h264_par_add_mode_sup_rcdo,
2388 { "Reduced Complexity Decoding Operation (RCDO) support", "h264.add_mode_sup.rcdo",
2389 FT_BOOLEAN, 8, NULL, 0x40,
2391 { &hf_h264_par_ProfileIOP,
2392 { "ProfileIOP", "h264.ProfileIOP",
2393 FT_UINT8, BASE_HEX, NULL, 0x00,
2395 { &hf_h264_par_constraint_set0_flag,
2396 { "constraint_set0_flag", "h264.par.constraint_set0_flag",
2397 FT_BOOLEAN, 8, NULL, 0x80,
2399 { &hf_h264_par_constraint_set1_flag,
2400 { "constraint_set1_flag", "h264.par.constraint_set1_flag",
2401 FT_BOOLEAN, 8, NULL, 0x40,
2403 { &hf_h264_par_constraint_set2_flag,
2404 { "constraint_set2_flag", "h264.par.constraint_set2_flag",
2405 FT_BOOLEAN, 8, NULL, 0x20,
2409 /* Setup protocol subtree array */
2410 static gint *ett[] = {
2416 &ett_h264_par_profile,
2417 &ett_h264_par_AdditionalModesSupported,
2418 &ett_h264_par_ProfileIOP,
2421 /* Register the protocol name and description */
2422 proto_h264 = proto_register_protocol("H.264","H264", "h264");
2424 /* Required function calls to register the header fields and subtrees used */
2425 proto_register_field_array(proto_h264, hf, array_length(hf));
2426 proto_register_subtree_array(ett, array_length(ett));
2427 /* Register a configuration option for port */
2430 h264_module = prefs_register_protocol(proto_h264, proto_reg_handoff_h264);
2432 prefs_register_uint_preference(h264_module, "dynamic.payload.type",
2433 "H264 dynamic payload type",
2434 "The dynamic payload type which will be interpreted as H264",
2436 &temp_dynamic_payload_type);
2439 register_dissector("h264", dissect_h264, proto_h264);