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>
43 #include <epan/strutil.h>
48 /* Initialize the protocol and registered fields */
49 static int proto_h264 = -1;
50 static int hf_h264_type = -1;
51 static int hf_h264_nal_f_bit = -1;
52 static int hf_h264_nal_nri = -1;
53 static int hf_h264_start_bit = -1;
54 static int hf_h264_forbidden_bit = -1;
55 static int hf_h264_end_bit = -1;
56 static int hf_h264_profile = -1;
57 static int hf_h264_profile_idc = -1;
58 static int hf_h264_rbsp_stop_bit = -1;
59 static int hf_h264_rbsp_trailing_bits = -1;
60 static int hf_h264_constraint_set0_flag = -1;
61 static int hf_h264_constraint_set1_flag = -1;
62 static int hf_h264_constraint_set2_flag = -1;
63 static int hf_h264_constraint_set3_flag = -1;
64 static int hf_h264_reserved_zero_4bits = -1;
65 static int hf_h264_level_idc = -1;
66 static int hf_h264_nal_unit = -1;
67 static int hf_h264_forbidden_zero_bit = -1;
68 static int hf_h264_nal_ref_idc = -1;
69 static int hf_h264_nal_unit_type = -1;
70 static int hf_h264_seq_parameter_set_id = -1;
71 static int hf_h264_chroma_format_idc = -1;
72 static int hf_h264_residual_colour_transform_flag = -1;
73 static int hf_h264_bit_depth_luma_minus8 = -1;
74 static int hf_h264_bit_depth_chroma_minus8 = -1;
75 static int hf_h264_qpprime_y_zero_transform_bypass_flag = -1;
76 static int hf_h264_seq_scaling_matrix_present_flag = -1;
77 static int hf_h264_log2_max_frame_num_minus4 = -1;
78 static int hf_h264_pic_order_cnt_type = -1;
79 static int hf_h264_log2_max_pic_order_cnt_lsb_minus4 = -1;
80 static int hf_h264_delta_pic_order_always_zero_flag = -1;
81 static int hf_h264_offset_for_non_ref_pic = -1;
82 static int hf_h264_offset_for_top_to_bottom_field = -1;
83 static int hf_h264_num_ref_frames_in_pic_order_cnt_cycle = -1;
84 static int hf_h264_offset_for_ref_frame = -1;
85 static int hf_h264_num_ref_frames = -1;
86 static int hf_h264_gaps_in_frame_num_value_allowed_flag = -1;
87 static int hf_h264_pic_width_in_mbs_minus1 = -1;
88 static int hf_h264_pic_height_in_map_units_minus1 = -1;
89 static int hf_h264_frame_mbs_only_flag = -1;
90 static int hf_h264_mb_adaptive_frame_field_flag = -1;
91 static int hf_h264_direct_8x8_inference_flag = -1;
92 static int hf_h264_frame_cropping_flag = -1;
93 static int hf_h264_frame_crop_left_offset = -1;
94 static int hf_h264_frame_crop_right_offset = -1;
95 static int hf_h264_frame_crop_top_offset = -1;
96 static int hf_h264_frame_crop_bottom_offset = -1;
97 static int hf_h264_vui_parameters_present_flag = -1;
98 static int hf_h264_pic_parameter_set_id = -1;
99 static int hf_h264_entropy_coding_mode_flag = -1;
100 static int hf_h264_pic_order_present_flag = -1;
101 static int hf_h264_num_slice_groups_minus1 = -1;
102 static int hf_h264_slice_group_map_type = -1;
103 static int hf_h264_num_ref_idx_l0_active_minus1 = -1;
104 static int hf_h264_num_ref_idx_l1_active_minus1 = -1;
105 static int hf_h264_weighted_pred_flag = -1;
106 static int hf_h264_weighted_bipred_idc = -1;
107 static int hf_h264_pic_init_qp_minus26 = -1;
108 static int hf_h264_pic_init_qs_minus26 = -1;
109 static int hf_h264_chroma_qp_index_offset = -1;
110 static int hf_h264_deblocking_filter_control_present_flag = -1;
111 static int hf_h264_constrained_intra_pred_flag = -1;
112 static int hf_h264_redundant_pic_cnt_present_flag = -1;
113 static int hf_h264_transform_8x8_mode_flag = -1;
114 static int hf_h264_pic_scaling_matrix_present_flag = -1;
115 static int hf_h264_second_chroma_qp_index_offset = -1;
116 static int hf_h264_par_profile = -1;
117 static int hf_h264_par_profile_b = -1;
118 static int hf_h264_par_profile_m = -1;
119 static int hf_h264_par_profile_e = -1;
120 static int hf_h264_par_profile_h = -1;
121 static int hf_h264_par_profile_h10 = -1;
122 static int hf_h264_par_profile_h4_2_2 = -1;
123 static int hf_h264_par_profile_h4_4_4 = -1;
124 static int hf_h264_par_add_mode_sup = -1;
125 static int hf_h264_par_AdditionalModesSupported = -1;
126 static int hf_h264_par_add_mode_sup_rcdo = -1;
127 static int hf_h264_par_ProfileIOP = -1;
128 static int hf_h264_par_constraint_set0_flag = -1;
129 static int hf_h264_par_constraint_set1_flag = -1;
130 static int hf_h264_par_constraint_set2_flag = -1;
133 static int hf_h264_aspect_ratio_info_present_flag = -1;
134 static int hf_h264_aspect_ratio_idc = -1;
135 static int hf_h264_sar_width = -1;
136 static int hf_h264_sar_height = -1;
137 static int hf_h264_overscan_info_present_flag = -1;
138 static int hf_h264_overscan_appropriate_flag = -1;
139 static int hf_h264_video_signal_type_present_flag = -1;
140 static int hf_h264_video_format = -1;
141 static int hf_h264_video_full_range_flag = -1;
142 static int hf_h264_colour_description_present_flag = -1;
143 static int hf_h264_colour_primaries = -1;
144 static int hf_h264_transfer_characteristics = -1;
145 static int hf_h264_matrix_coefficients = -1;
146 static int hf_h264_chroma_loc_info_present_flag = -1;
147 static int hf_h264_chroma_sample_loc_type_top_field = -1;
148 static int hf_h264_chroma_sample_loc_type_bottom_field = -1;
149 static int hf_h264_timing_info_present_flag = -1;
150 static int hf_h264_num_units_in_tick = -1;
151 static int hf_h264_time_scale = -1;
152 static int hf_h264_fixed_frame_rate_flag = -1;
153 static int hf_h264_nal_hrd_parameters_present_flag = -1;
154 static int hf_h264_vcl_hrd_parameters_present_flag = -1;
155 static int hf_h264_low_delay_hrd_flag = -1;
156 static int hf_h264_pic_struct_present_flag = -1;
157 static int hf_h264_bitstream_restriction_flag = -1;
158 static int hf_h264_motion_vectors_over_pic_boundaries_flag = -1;
159 static int hf_h264_max_bytes_per_pic_denom = -1;
160 static int hf_h264_max_bits_per_mb_denom = -1;
161 static int hf_h264_log2_max_mv_length_horizontal = -1;
162 static int hf_h264_log2_max_mv_length_vertical = -1;
163 static int hf_h264_num_reorder_frames = -1;
164 static int hf_h264_max_dec_frame_buffering = -1;
165 static int hf_h264_cpb_cnt_minus1 = -1;
166 static int hf_h264_bit_rate_scale = -1;
167 static int hf_h264_cpb_size_scale = -1;
168 static int hf_h264_bit_rate_value_minus1 = -1;
169 static int hf_h264_cpb_size_value_minus1 = -1;
170 static int hf_h264_cbr_flag = -1;
171 static int hf_h264_initial_cpb_removal_delay_length_minus1 = -1;
172 static int hf_h264_cpb_removal_delay_length_minus1 = -1;
173 static int hf_h264_dpb_output_delay_length_minus11 = -1;
174 static int hf_h264_time_offset_length = -1;
176 static int hf_h264_first_mb_in_slice = -1;
177 static int hf_h264_slice_type = -1;
178 static int hf_h264_slice_id = -1;
179 static int hf_h264_frame_num = -1;
181 /* Initialize the subtree pointers */
182 static int ett_h264 = -1;
183 static int ett_h264_profile = -1;
184 static int ett_h264_nal = -1;
185 static int ett_h264_fua = -1;
186 static int ett_h264_stream = -1;
187 static int ett_h264_nal_unit = -1;
188 static int ett_h264_par_profile = -1;
189 static int ett_h264_par_AdditionalModesSupported = -1;
190 static int ett_h264_par_ProfileIOP = -1;
192 /* The dynamic payload type which will be dissected as H.264 */
194 static guint temp_dynamic_payload_type = 0;
196 /* syntax tables in subclause 7.3 is equal to
197 * ue(v), me(v), se(v), or te(v).
204 } h264_golomb_descriptors;
207 static const true_false_string h264_f_bit_vals = {
208 "Bit errors or other syntax violations",
209 "No bit errors or other syntax violations"
211 static const true_false_string h264_start_bit_vals = {
212 "the first packet of FU-A picture",
213 "Not the first packet of FU-A picture"
215 static const true_false_string h264_end_bit_vals = {
216 "the last packet of FU-A picture",
217 "Not the last packet of FU-A picture"
219 static const true_false_string h264_forbidden_bit_vals = {
220 "Forbidden Bit of FU-A",
221 "Not Forbidden Bit of FU-A"
224 #define H264_SEQ_PAR_SET 7
225 #define H264_PIC_PAR_SET 8
227 static const value_string h264_type_values[] = {
229 { 1, "NAL unit - Coded slice of a non-IDR picture" }, /* Single NAL unit packet per H.264 */
230 { 2, "NAL unit - Coded slice data partition A" },
231 { 3, "NAL unit - Coded slice data partition B" },
232 { 4, "NAL unit - Coded slice data partition C" },
233 { 5, "NAL unit - Coded slice of an IDR picture" },
234 { 6, "NAL unit - Supplemental enhancement information (SEI)" },
235 { H264_SEQ_PAR_SET, "NAL unit - Sequence parameter set" }, /* 7 */
236 { H264_PIC_PAR_SET, "NAL unit - Picture parameter set" }, /* 8 */
237 { 9, "NAL unit - Access unit delimiter" },
238 { 10, "NAL unit - End of sequence" },
239 { 11, "NAL unit - End of stream" },
240 { 12, "NAL unit - Filler data" },
241 { 13, "NAL unit - Sequence parameter set extension" },
242 { 14, "NAL unit - Reserved" },
243 { 15, "NAL unit - Reserved" },
244 { 16, "NAL unit - Reserved" },
245 { 17, "NAL unit - Reserved" },
246 { 18, "NAL unit - Reserved" },
247 { 19, "NAL unit - Coded slice of an auxiliary coded picture without partitioning" },
248 { 20, "NAL unit - Reserved" },
249 { 21, "NAL unit - Reserved" },
250 { 22, "NAL unit - Reserved" },
251 { 23, "NAL unit - Reserved" },
252 { 24, "STAP-A" }, /* Single-time aggregation packet */
253 { 25, "STAP-B" }, /* Single-time aggregation packet */
254 { 26, "MTAP16" }, /* Multi-time aggregation packet */
255 { 27, "MTAP24" }, /* Multi-time aggregation packet */
256 { 28, "FU-A" }, /* Fragmentation unit */
257 { 29, "FU-B" }, /* Fragmentation unit */
264 static const value_string h264_profile_idc_values[] = {
265 { 66, "Baseline profile" },
266 { 77, "Main profile" },
267 { 88, "Extended profile" },
268 { 100, "High profile" },
269 { 110, "High 10 profile" },
270 { 122, "High 4:2:2 profile" },
271 { 144, "High 4:4:4 profile" },
275 static const value_string h264_nal_unit_type_vals[] = {
276 { 0, "Unspecified" },
277 { 1, "Coded slice of a non-IDR picture" },
278 { 2, "Coded slice data partition A" },
279 { 3, "Coded slice data partition B" },
280 { 4, "Coded slice data partition C" },
281 { 5, "Coded slice of an IDR picture" },
282 { 6, "Supplemental enhancement information (SEI)" },
283 { 7, "Sequence parameter set" },
284 { 8, "Picture parameter set" },
285 { 9, "Access unit delimiter" },
286 { 10, "End of sequence" },
287 { 11, "End of stream" },
288 { 12, "Filler data" },
289 { 13, "Sequence parameter set extension" },
295 { 19, "Coded slice of an auxiliary coded picture without partitioning" },
300 { 24, "Unspecified" },
301 { 25, "Unspecified" },
302 { 26, "Unspecified" },
303 { 27, "Unspecified" },
305 { 29, "Unspecified" },
306 { 30, "Unspecified" },
307 { 31, "Unspecified" },
311 static const value_string h264_slice_group_map_type_vals[] = {
312 { 0, "Interleaved slice groups" },
313 { 1, "Dispersed slice group mapping" },
314 { 2, "One or more foreground slice groups and a leftover slice group" },
315 { 3, "Changing slice groups" },
316 { 4, "Changing slice groups" },
317 { 5, "Changing slice groups" },
318 { 6, "Explicit assignment of a slice group to each slice group map unit" },
322 /* Table 7-6 Name association to slice_type */
323 static const value_string h264_slice_type_vals[] = {
324 { 0, "P (P slice)" },
325 { 1, "B (B slice)" },
326 { 2, "I (I slice)" },
327 { 3, "SP (SP slice)" },
328 { 4, "SI (SI slice)" },
329 { 5, "P (P slice)" },
330 { 6, "B (B slice)" },
331 { 7, "I (I slice)" },
332 { 8, "SP (SP slice)" },
333 { 9, "SI (SI slice)" },
337 /* Expect a tvb and a bit offset into the tvb
338 * returns the valu and bit_offset
340 #define cVALS(x) (const value_string*)(x)
343 dissect_h264_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint *start_bit_offset, h264_golomb_descriptors descriptor)
344 /*(tvbuff_t *tvb, gint *start_bit_offset) */
346 gint leading_zero_bits, bit_offset;
347 guint32 codenum, mask, value, tmp;
353 header_field_info *hf_field = NULL;
356 hf_field = proto_registrar_get_nth(hf_index);
358 bit_offset = *start_bit_offset;
360 /* prepare the string */
363 for(bit=0;bit<((int)(bit_offset&0x07));bit++){
365 g_strlcat(str, " ", 256);
367 g_strlcat(str,".", 256);
371 leading_zero_bits = -1;
372 for( b = 0; !b; leading_zero_bits++ ){
374 g_strlcat(str, " ", 256);
377 g_strlcat(str, " ", 256);
379 b = tvb_get_bits8(tvb, bit_offset, 1);
381 g_strlcat(str, "1", 256);
383 g_strlcat(str, "0", 256);
389 if(leading_zero_bits==0){
391 *start_bit_offset = bit_offset;
394 g_strlcat(str, " ", 256);
396 g_strlcat(str,".", 256);
399 g_strlcat(str," = ", 256);
400 g_strlcat(str,hf_field->name, 256);
403 /* if the syntax element is coded as se(v),
404 * the value of the syntax element is derived by invoking the
405 * mapping process for signed Exp-Golomb codes as specified in
406 * subclause 9.1.1 with codeNum as the input.
408 if(hf_field->type==FT_INT32){
409 if (hf_field->strings) {
410 proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
413 val_to_str(codenum, cVALS(hf_field->strings), "Unknown "),
416 switch(hf_field->display){
418 proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
424 DISSECTOR_ASSERT_NOT_REACHED();
433 if(hf_field->type==FT_UINT32){
434 if (hf_field->strings) {
435 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
438 val_to_str(codenum, cVALS(hf_field->strings), "Unknown "),
441 switch(hf_field->display){
443 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
449 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
455 DISSECTOR_ASSERT_NOT_REACHED();
460 /* Only allow guint32 */
461 DISSECTOR_ASSERT_NOT_REACHED();
468 Syntax elements coded as ue(v), me(v), or se(v) are Exp-Golomb-coded. Syntax elements coded as te(v) are truncated
469 Exp-Golomb-coded. The parsing process for these syntax elements begins with reading the bits starting at the current
470 location in the bitstream up to and including the first non-zero bit, and counting the number of leading bits that are
471 equal to 0. This process is specified as follows:
472 leadingZeroBits = -1;
473 for( b = 0; !b; leadingZeroBits++ )
475 The variable codeNum is then assigned as follows:
476 codeNum = 2leadingZeroBits - 1 + read_bits( leadingZeroBits )
477 where the value returned from read_bits( leadingZeroBits ) is interpreted as a binary representation of an unsigned
478 integer with most significant bit written first.
481 codenum = codenum << leading_zero_bits;
483 if (leading_zero_bits > 8)
484 value = tvb_get_bits16(tvb, bit_offset,leading_zero_bits, FALSE);
486 value = tvb_get_bits8(tvb, bit_offset,leading_zero_bits );
487 codenum = (codenum-1) + value;
488 bit_offset = bit_offset + leading_zero_bits;
490 /* read the bits for the int */
491 for(i=0;i<leading_zero_bits;i++){
493 g_strlcat(str, " ", 256);
496 g_strlcat(str, " ", 256);
501 g_strlcat(str, "1", 256);
503 g_strlcat(str, "0", 256);
509 g_strlcat(str, " ", 256);
511 g_strlcat(str,".", 256);
516 /* if the syntax element is coded as se(v),
517 * the value of the syntax element is derived by invoking the
518 * mapping process for signed Exp-Golomb codes as specified in
519 * subclause 9.1.1 with codeNum as the input.
523 se_value = (codenum + 1) >> 1;
524 if (!(se_value & 1)){
525 se_value = - se_value;
533 g_strlcat(str," = ", 256);
534 g_strlcat(str,hf_field->name, 256);
537 g_strlcat(str,"(se(v))", 256);
538 /* if the syntax element is coded as se(v),
539 * the value of the syntax element is derived by invoking the
540 * mapping process for signed Exp-Golomb codes as specified in
541 * subclause 9.1.1 with codeNum as the input.
547 if((hf_field->type==FT_UINT32)&&(descriptor==H264_UE_V)){
548 if (hf_field->strings) {
549 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
552 val_to_str(codenum, cVALS(hf_field->strings), "Unknown "),
555 switch(hf_field->display){
557 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
563 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
569 DISSECTOR_ASSERT_NOT_REACHED();
573 }else if((hf_field->type==FT_INT32)&&(descriptor==H264_SE_V)){
574 if (hf_field->strings) {
575 proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
578 val_to_str(codenum, cVALS(hf_field->strings), "Unknown "),
581 switch(hf_field->display){
583 proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
589 DISSECTOR_ASSERT_NOT_REACHED();
593 *start_bit_offset = bit_offset;
597 /* Only allow guint32 */
598 DISSECTOR_ASSERT_NOT_REACHED();
602 *start_bit_offset = bit_offset;
607 /* This funktion is adapted to parsing NAL units from SDP data where the
608 * base64 coding may add extra padding
612 more_rbsp_data(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
616 int remaining_length;
620 /* XXX might not be the best way of doing things but:
621 * Serch from the end of the tvb for the first '1' bit
622 * assuming that its's the RTBSP stop bit
625 /* Set offset to the byte we are treating */
626 offset = bit_offset>>3;
627 remaining_length = tvb_length_remaining(tvb,offset);
628 /* If there is more then 2 bytes left there *should* be more data */
629 if(remaining_length>2){
632 /* Start from last bit */
633 last_one_bit = (tvb_length(tvb) << 3);
637 b = tvb_get_bits8(tvb, last_one_bit, 1);
640 if( last_one_bit == bit_offset){
648 dissect_h264_rbsp_trailing_bits(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
650 gint remaining_bits=0;
652 proto_tree_add_bits_item(tree, hf_h264_rbsp_stop_bit, tvb, bit_offset, 1, FALSE);
655 if((bit_offset&0x7)!=0){
656 remaining_bits = 8 - (bit_offset&0x7);
657 proto_tree_add_bits_item(tree, hf_h264_rbsp_trailing_bits, tvb, bit_offset, remaining_bits, FALSE);
660 return bit_offset+remaining_bits;
664 * 7.3.3 Slice header syntax
666 * XXX Just parse a few bytes
669 dissect_h264_slice_header(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
671 /* first_mb_in_slice 2 ue(v) */
672 dissect_h264_exp_golomb_code(tree, hf_h264_first_mb_in_slice, tvb, &bit_offset, H264_UE_V);
674 /* slice_type 2 ue(v) */
675 dissect_h264_exp_golomb_code(tree, hf_h264_slice_type, tvb, &bit_offset, H264_UE_V);
677 /* pic_parameter_set_id 2 ue(v) */
678 dissect_h264_exp_golomb_code(tree, hf_h264_pic_parameter_set_id, tvb, &bit_offset, H264_UE_V);
680 /* frame_num 2 u(v) */
682 * represented by log2_max_frame_num_minus4 + 4 bits in
684 * proto_tree_add_bits_item(tree, hf_h264_frame_num, tvb, bit_offset, 4, FALSE);
692 /* 7.3.2.1.1 Scaling list syntax
694 * scaling_list( scalingList, sizeOfScalingList, useDefaultScalingMatrixFlag )
698 dissect_h264_scaling_list(proto_tree *tree, tvbuff_t *tvb, gint bit_offset, int hf_index_scalinglist,
699 guint8 sizeOfScalingList, int hf_index_usedefaultscalingmatrixflag)
702 guint8 lastScale = 8;
703 guint8 nextScale = 8:
706 for( j = 0; j < sizeOfScalingList; j++ ) {
707 if( nextScale != 0 ) {
708 / delta_scale 0 | 1 se(v) /
709 delta_scale = dissect_h264_exp_golomb_code(tree, hf_h264_delta_scale, tvb, &bit_offset);
710 nextScale = ( lastScale + delta_scale + 256 ) % 256;
711 useDefaultScalingMatrixFlag = ( j == 0 && nextScale == 0 );
713 scalingList[ j ] = ( nextScale == 0 ) ? lastScale : nextScale
714 lastScale = scalingList[ j ]
718 /* E.1.2 HRD parameters syntax */
720 dissect_h264_hrd_parameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
722 guint8 cpb_cnt_minus1;
726 /* cpb_cnt_minus1 0 ue(v) */
727 cpb_cnt_minus1 = dissect_h264_exp_golomb_code(tree, hf_h264_cpb_cnt_minus1, tvb, &bit_offset, H264_UE_V);
729 /* bit_rate_scale 0 u(4) */
730 proto_tree_add_bits_item(tree, hf_h264_bit_rate_scale, tvb, bit_offset, 4, FALSE);
731 bit_offset = bit_offset + 4;
733 /* cpb_size_scale 0 u(4) */
734 proto_tree_add_bits_item(tree, hf_h264_cpb_size_scale, tvb, bit_offset, 4, FALSE);
735 bit_offset = bit_offset + 4;
736 /* for( SchedSelIdx = 0; SchedSelIdx <= cpb_cnt_minus1; SchedSelIdx++ ) { */
737 for( SchedSelIdx = 0; SchedSelIdx <= cpb_cnt_minus1; SchedSelIdx++ ) {
739 /* bit_rate_value_minus1[ SchedSelIdx ] 0 ue(v) */
740 dissect_h264_exp_golomb_code(tree, hf_h264_bit_rate_value_minus1, tvb, &bit_offset, H264_UE_V);
742 /* cpb_size_value_minus1[ SchedSelIdx ] 0 ue(v)*/
743 dissect_h264_exp_golomb_code(tree, hf_h264_cpb_size_value_minus1, tvb, &bit_offset, H264_UE_V);
745 /* cbr_flag[ SchedSelIdx ] 0 u(1) */
746 proto_tree_add_bits_item(tree, hf_h264_cbr_flag, tvb, bit_offset, 1, FALSE);
749 /* initial_cpb_removal_delay_length_minus1 0 u(5) */
750 proto_tree_add_bits_item(tree, hf_h264_initial_cpb_removal_delay_length_minus1, tvb, bit_offset, 5, FALSE);
751 bit_offset = bit_offset + 5;
753 /* cpb_removal_delay_length_minus1 0 u(5) */
754 proto_tree_add_bits_item(tree, hf_h264_cpb_removal_delay_length_minus1, tvb, bit_offset, 5, FALSE);
755 bit_offset = bit_offset + 5;
757 /* dpb_output_delay_length_minus1 0 u(5) */
758 proto_tree_add_bits_item(tree, hf_h264_dpb_output_delay_length_minus11, tvb, bit_offset, 5, FALSE);
759 bit_offset = bit_offset + 5;
761 /* time_offset_length 0 u(5) */
762 proto_tree_add_bits_item(tree, hf_h264_time_offset_length, tvb, bit_offset, 5, FALSE);
763 bit_offset = bit_offset + 5;
768 #define EXTENDED_SAR 255
770 /* E.1.1 VUI parameters syntax */
772 dissect_h264_vui_parameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint bit_offset)
775 guint8 aspect_ratio_info_present_flag, aspect_ratio_idc, overscan_info_present_flag;
776 guint8 video_signal_type_present_flag, colour_description_present_flag, chroma_loc_info_present_flag;
777 guint8 timing_info_present_flag, nal_hrd_parameters_present_flag, vcl_hrd_parameters_present_flag;
778 guint8 bitstream_restriction_flag;
780 /* vui_parameters( ) {
781 * aspect_ratio_info_present_flag 0 u(1)
783 aspect_ratio_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
784 proto_tree_add_bits_item(tree, hf_h264_aspect_ratio_info_present_flag, tvb, bit_offset, 1, FALSE);
787 if( aspect_ratio_info_present_flag ) {
788 /* aspect_ratio_idc 0 u(8) */
789 aspect_ratio_idc = tvb_get_bits8(tvb, bit_offset, 8);
790 proto_tree_add_bits_item(tree, hf_h264_aspect_ratio_idc, tvb, bit_offset, 8, FALSE);
791 bit_offset = bit_offset + 8;
793 if( aspect_ratio_idc == EXTENDED_SAR ) {
794 /* sar_width 0 u(16) */
795 proto_tree_add_bits_item(tree, hf_h264_sar_width, tvb, bit_offset, 16, FALSE);
796 bit_offset = bit_offset + 16;
798 /* sar_height 0 u(16) */
799 proto_tree_add_bits_item(tree, hf_h264_sar_height, tvb, bit_offset, 16, FALSE);
800 bit_offset = bit_offset + 16;
803 /* overscan_info_present_flag 0 u(1) */
804 overscan_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
805 proto_tree_add_bits_item(tree, hf_h264_overscan_info_present_flag, tvb, bit_offset, 1, FALSE);
808 if( overscan_info_present_flag ){
809 /* overscan_appropriate_flag 0 u(1) */
810 proto_tree_add_bits_item(tree, hf_h264_overscan_appropriate_flag, tvb, bit_offset, 1, FALSE);
814 /* video_signal_type_present_flag 0 u(1) */
815 video_signal_type_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
816 proto_tree_add_bits_item(tree, hf_h264_video_signal_type_present_flag, tvb, bit_offset, 1, FALSE);
819 if( video_signal_type_present_flag ) {
820 /* video_format 0 u(3) > */
821 proto_tree_add_bits_item(tree, hf_h264_video_format, tvb, bit_offset, 3, FALSE);
822 bit_offset = bit_offset + 3;
824 /* video_full_range_flag 0 u(1)*/
825 proto_tree_add_bits_item(tree, hf_h264_video_full_range_flag, tvb, bit_offset, 1, FALSE);
828 /* colour_description_present_flag 0 u(1) */
829 colour_description_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
830 proto_tree_add_bits_item(tree, hf_h264_colour_description_present_flag, tvb, bit_offset, 1, FALSE);
833 if( colour_description_present_flag ) {
834 /* colour_primaries 0 u(8) */
835 proto_tree_add_bits_item(tree, hf_h264_colour_primaries, tvb, bit_offset, 8, FALSE);
836 bit_offset = bit_offset + 8;
838 /* transfer_characteristics 0 u(8) */
839 proto_tree_add_bits_item(tree, hf_h264_transfer_characteristics, tvb, bit_offset, 8, FALSE);
840 bit_offset = bit_offset + 8;
842 /* matrix_coefficients 0 u(8)*/
843 proto_tree_add_bits_item(tree, hf_h264_matrix_coefficients, tvb, bit_offset, 8, FALSE);
844 bit_offset = bit_offset + 8;
848 /* chroma_loc_info_present_flag 0 u(1) */
849 chroma_loc_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
850 proto_tree_add_bits_item(tree, hf_h264_chroma_loc_info_present_flag, tvb, bit_offset, 1, FALSE);
853 if( chroma_loc_info_present_flag ) {
854 /* chroma_sample_loc_type_top_field 0 ue(v) */
855 dissect_h264_exp_golomb_code(tree, hf_h264_chroma_sample_loc_type_top_field, tvb, &bit_offset, H264_UE_V);
857 /* chroma_sample_loc_type_bottom_field 0 ue(v) */
858 dissect_h264_exp_golomb_code(tree, hf_h264_chroma_sample_loc_type_bottom_field, tvb, &bit_offset, H264_UE_V);
861 /* timing_info_present_flag 0 u(1) */
862 timing_info_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
863 proto_tree_add_bits_item(tree, hf_h264_timing_info_present_flag, tvb, bit_offset, 1, FALSE);
866 if( timing_info_present_flag ) {
867 /* num_units_in_tick 0 u(32) */
868 proto_tree_add_bits_item(tree, hf_h264_num_units_in_tick, tvb, bit_offset, 32, FALSE);
869 bit_offset = bit_offset + 32;
871 /* time_scale 0 u(32) */
872 proto_tree_add_bits_item(tree, hf_h264_time_scale, tvb, bit_offset, 32, FALSE);
873 bit_offset = bit_offset + 32;
875 /* fixed_frame_rate_flag 0 u(1) */
876 proto_tree_add_bits_item(tree, hf_h264_fixed_frame_rate_flag, tvb, bit_offset, 1, FALSE);
879 /* nal_hrd_parameters_present_flag 0 u(1) */
880 nal_hrd_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
881 proto_tree_add_bits_item(tree, hf_h264_nal_hrd_parameters_present_flag, tvb, bit_offset, 1, FALSE);
884 if( nal_hrd_parameters_present_flag ){
885 /* hrd_parameters( ) */
886 bit_offset = dissect_h264_hrd_parameters(tree, tvb, pinfo, bit_offset);
889 /* vcl_hrd_parameters_present_flag 0 u(1) */
890 vcl_hrd_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
891 proto_tree_add_bits_item(tree, hf_h264_vcl_hrd_parameters_present_flag, tvb, bit_offset, 1, FALSE);
894 if( vcl_hrd_parameters_present_flag ){
895 /* hrd_parameters( ) */
896 bit_offset = dissect_h264_hrd_parameters(tree, tvb, pinfo, bit_offset);
898 if( nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag ){
899 /* low_delay_hrd_flag 0 u(1) */
900 proto_tree_add_bits_item(tree, hf_h264_low_delay_hrd_flag, tvb, bit_offset, 1, FALSE);
903 /* pic_struct_present_flag 0 u(1) */
904 proto_tree_add_bits_item(tree, hf_h264_pic_struct_present_flag, tvb, bit_offset, 1, FALSE);
907 /* bitstream_restriction_flag 0 u(1) */
908 bitstream_restriction_flag = tvb_get_bits8(tvb, bit_offset, 1);
909 proto_tree_add_bits_item(tree, hf_h264_bitstream_restriction_flag, tvb, bit_offset, 1, FALSE);
912 if( bitstream_restriction_flag ) {
913 /* motion_vectors_over_pic_boundaries_flag 0 u(1) */
914 proto_tree_add_bits_item(tree, hf_h264_motion_vectors_over_pic_boundaries_flag, tvb, bit_offset, 1, FALSE);
917 /* max_bytes_per_pic_denom 0 ue(v) */
918 dissect_h264_exp_golomb_code(tree, hf_h264_max_bytes_per_pic_denom, tvb, &bit_offset, H264_UE_V);
920 /* max_bits_per_mb_denom 0 ue(v) */
921 dissect_h264_exp_golomb_code(tree, hf_h264_max_bits_per_mb_denom, tvb, &bit_offset, H264_UE_V);
923 /* log2_max_mv_length_horizontal 0 ue(v) */
924 dissect_h264_exp_golomb_code(tree, hf_h264_log2_max_mv_length_horizontal, tvb, &bit_offset, H264_UE_V);
926 /* log2_max_mv_length_vertical 0 ue(v) */
927 dissect_h264_exp_golomb_code(tree, hf_h264_log2_max_mv_length_vertical, tvb, &bit_offset, H264_UE_V);
929 /* num_reorder_frames 0 ue(v) */
930 dissect_h264_exp_golomb_code(tree, hf_h264_num_reorder_frames, tvb, &bit_offset, H264_UE_V);
932 /* max_dec_frame_buffering 0 ue(v) */
933 dissect_h264_exp_golomb_code(tree, hf_h264_max_dec_frame_buffering, tvb, &bit_offset, H264_UE_V);
940 /* Used To dissect SDP parameter (H.264)profile */
942 dissect_h264_profile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
944 proto_item *item, *level_item;
945 proto_tree *h264_profile_tree;
947 guint8 constraint_set3_flag;
950 item = proto_tree_add_item(tree, hf_h264_profile, tvb, offset, -1, FALSE);
951 h264_profile_tree = proto_item_add_subtree(item, ett_h264_profile);
953 proto_tree_add_item(h264_profile_tree, hf_h264_profile_idc, tvb, offset, 1, FALSE);
956 constraint_set3_flag = (tvb_get_guint8(tvb,offset)&0x10)>>4;
957 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set0_flag, tvb, offset, 1, FALSE);
958 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set1_flag, tvb, offset, 1, FALSE);
959 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set2_flag, tvb, offset, 1, FALSE);
960 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set3_flag, tvb, offset, 1, FALSE);
961 proto_tree_add_item(h264_profile_tree, hf_h264_reserved_zero_4bits, tvb, offset, 1, FALSE);
964 /* A level to which the bitstream conforms shall be indicated by the syntax element level_idc as follows.
965 * - If level_idc is equal to 11 and constraint_set3_flag is equal to 1, the indicated level is level 1b.
966 * - Otherwise (level_idc is not equal to 11 or constraint_set3_flag is not equal to 1), level_idc shall
967 * be set equal to a value of ten times the level number specified in Table A-1 and constraint_set3_flag
968 * shall be set equal to 0.
971 level_idc = tvb_get_guint8(tvb,offset);
972 level_item = proto_tree_add_item(h264_profile_tree, hf_h264_level_idc, tvb, offset, 1, FALSE);
973 if((level_idc==11)&&(constraint_set3_flag==1)){
974 proto_item_append_text(level_item," [Level 1b]");
976 proto_item_append_text(level_item," [Level %.1f]",((double)level_idc/10));
982 * 7.3.2.8 Slice layer without partitioning RBSP syntax
983 * slice_layer_without_partitioning_rbsp( )
987 dissect_h264_slice_layer_without_partitioning_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset)
991 bit_offset = offset <<3;
993 /* slice_header( ) 2 */
994 bit_offset = dissect_h264_slice_header(tree, tvb, pinfo, bit_offset);
995 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
997 /* slice_data( ) * all categories of slice_data( ) syntax * 2 | 3 | 4 */
998 /* rbsp_slice_trailing_bits( ) */
1003 * 7.3.2.9.1 Slice data partition A RBSP syntax
1004 * slice_data_partition_a_layer_rbsp( )
1007 dissect_h264_slice_data_partition_a_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1011 bit_offset = offset <<3;
1013 /* slice_header( ) 2 */
1014 bit_offset = dissect_h264_slice_header(tree, tvb, pinfo, bit_offset);
1016 /* slice_id All ue(v) */
1017 dissect_h264_exp_golomb_code(tree, hf_h264_slice_id, tvb, &bit_offset, H264_UE_V);
1018 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
1020 /* slice_data( ) * only category 2 parts of slice_data( ) syntax * 2*/
1021 /* rbsp_slice_trailing_bits( )*/
1026 * 7.3.2.9.2 Slice data partition B RBSP syntax
1027 * slice_data_partition_b_layer_rbsp(
1030 dissect_h264_slice_data_partition_b_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1034 bit_offset = offset <<3;
1036 /* slice_id All ue(v) */
1037 dissect_h264_exp_golomb_code(tree, hf_h264_slice_id, tvb, &bit_offset, H264_UE_V);
1038 /* if( redundant_pic_cnt_present_flag ) */
1039 /* redundant_pic_cnt All ue(v) */
1040 /* slice_data( ) * only category 3 parts of slice_data( ) syntax * 3 */
1041 /* rbsp_slice_trailing_bits( ) 3 */
1042 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
1047 * 7.3.2.9.3 Slice data partition C RBSP syntax
1048 * slice_data_partition_c_layer_rbsp( )
1051 dissect_h264_slice_data_partition_c_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1055 bit_offset = offset <<3;
1057 /* slice_id All ue(v) */
1058 dissect_h264_exp_golomb_code(tree, hf_h264_slice_id, tvb, &bit_offset, H264_UE_V);
1059 /* if( redundant_pic_cnt_present_flag ) */
1060 /* redundant_pic_cnt All ue(v) */
1061 /* slice_data( ) * only category 4 parts of slice_data( ) syntax * 4 */
1062 /* rbsp_slice_trailing_bits( ) 4 */
1063 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
1067 * 7.3.2.3 Supplemental enhancement information RBSP syntax
1071 dissect_h264_sei_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1074 /* sei_message( ) 5*/
1075 /* while( more_rbsp_data( ) )*/
1076 /* rbsp_trailing_bits( ) 5 */
1077 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1081 /* Ref 7.3.2.1 Sequence parameter set RBSP syntax */
1083 dissect_h264_seq_parameter_set_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset)
1085 proto_item *level_item;
1087 guint8 constraint_set3_flag;
1091 guint8 profile_idc, chroma_format_idc, frame_mbs_only_flag, frame_cropping_flag;
1092 guint8 pic_order_cnt_type, vui_parameters_present_flag, num_ref_frames_in_pic_order_cnt_cycle;
1093 guint8 seq_scaling_matrix_present_flag; /* seq_scaling_list_present_flag */
1095 /* profile_idc 0 u(8) */
1096 profile_idc = tvb_get_guint8(tvb,offset);
1097 proto_tree_add_item(tree, hf_h264_profile_idc, tvb, offset, 1, FALSE);
1100 constraint_set3_flag = (tvb_get_guint8(tvb,offset)&0x10)>>4;
1101 /* constraint_set0_flag 0 u(1) */
1102 proto_tree_add_item(tree, hf_h264_constraint_set0_flag, tvb, offset, 1, FALSE);
1104 /* constraint_set1_flag 0 u(1) */
1105 proto_tree_add_item(tree, hf_h264_constraint_set1_flag, tvb, offset, 1, FALSE);
1107 /* constraint_set2_flag 0 u(1) */
1108 proto_tree_add_item(tree, hf_h264_constraint_set2_flag, tvb, offset, 1, FALSE);
1110 /* constraint_set3_flag 0 u(1) */
1111 proto_tree_add_item(tree, hf_h264_constraint_set3_flag, tvb, offset, 1, FALSE);
1113 /* reserved_zero_4bits equal to 0 0 u(4)*/
1114 proto_tree_add_item(tree, hf_h264_reserved_zero_4bits, tvb, offset, 1, FALSE);
1117 /* level_idc 0 u(8) */
1118 level_idc = tvb_get_guint8(tvb,offset);
1119 level_item = proto_tree_add_item(tree, hf_h264_level_idc, tvb, offset, 1, FALSE);
1120 if((level_idc==11)&&(constraint_set3_flag==1)){
1121 proto_item_append_text(level_item,"[Level 1b]");
1123 proto_item_append_text(level_item,"[Level %.1f]",((double)level_idc/10));
1126 /* seq_parameter_set_id 0 ue(v)
1127 * ue(v): unsigned integer Exp-Golomb-coded syntax element with the left bit first.
1128 * The parsing process for this descriptor is specified in subclause 9.1.
1130 bit_offset = offset<<3;
1131 dissect_h264_exp_golomb_code(tree, hf_h264_seq_parameter_set_id, tvb, &bit_offset, H264_UE_V);
1134 if( profile_idc == 100 || profile_idc == 110 ||
1135 profile_idc == 122 || profile_idc == 144 ) {
1137 /* chroma_format_idc 0 ue(v) */
1138 chroma_format_idc = dissect_h264_exp_golomb_code(tree, hf_h264_chroma_format_idc, tvb, &bit_offset, H264_UE_V);
1139 if( chroma_format_idc == 3 ){
1140 /* residual_colour_transform_flag 0 u(1) */
1141 proto_tree_add_bits_item(tree, hf_h264_residual_colour_transform_flag, tvb, bit_offset, 1, FALSE);
1145 /* bit_depth_luma_minus8 0 ue(v) */
1146 dissect_h264_exp_golomb_code(tree, hf_h264_bit_depth_luma_minus8, tvb, &bit_offset, H264_UE_V);
1148 /* bit_depth_chroma_minus8 0 ue(v) */
1149 dissect_h264_exp_golomb_code(tree, hf_h264_bit_depth_chroma_minus8, tvb, &bit_offset, H264_UE_V);
1151 /* qpprime_y_zero_transform_bypass_flag 0 u(1) */
1152 proto_tree_add_bits_item(tree, hf_h264_qpprime_y_zero_transform_bypass_flag, tvb, bit_offset, 1, FALSE);
1155 /* seq_scaling_matrix_present_flag 0 u(1) */
1156 seq_scaling_matrix_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1157 proto_tree_add_bits_item(tree, hf_h264_seq_scaling_matrix_present_flag, tvb, bit_offset, 1, FALSE);
1160 if( seq_scaling_matrix_present_flag ){
1162 for( i = 0; i < 8; i++ ) {
1163 / seq_scaling_list_present_flag[ i ] 0 u(1) /
1164 seq_scaling_list_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1166 if( seq_scaling_list_present_flag){
1168 scaling_list( ScalingList4x4[ i ], 16,UseDefaultScalingMatrix4x4Flag[ i ])0
1169 dissect_h264_scaling_list()
1171 scaling_list( ScalingList8x8[ i - 6 ], 64,UseDefaultScalingMatrix8x8Flag[ i - 6 ] )0
1175 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1181 /* log2_max_frame_num_minus4 0 ue(v) */
1182 dissect_h264_exp_golomb_code(tree, hf_h264_log2_max_frame_num_minus4, tvb, &bit_offset, H264_UE_V);
1184 /* pic_order_cnt_type 0 ue(v) */
1185 offset = bit_offset>>3;
1186 pic_order_cnt_type = dissect_h264_exp_golomb_code(tree,hf_h264_pic_order_cnt_type, tvb, &bit_offset, H264_UE_V);
1188 if(pic_order_cnt_type == 0){
1189 /* log2_max_pic_order_cnt_lsb_minus4 0 ue(v) */
1190 dissect_h264_exp_golomb_code(tree, hf_h264_log2_max_pic_order_cnt_lsb_minus4, tvb, &bit_offset, H264_UE_V);
1191 }else if(pic_order_cnt_type == 1) {
1192 /* delta_pic_order_always_zero_flag 0 u(1) */
1193 proto_tree_add_bits_item(tree, hf_h264_delta_pic_order_always_zero_flag, tvb, bit_offset, 1, FALSE);
1196 /* offset_for_non_ref_pic 0 se(v) */
1197 dissect_h264_exp_golomb_code(tree, hf_h264_offset_for_non_ref_pic, tvb, &bit_offset, H264_SE_V);
1199 /* offset_for_top_to_bottom_field 0 se(v) */
1200 dissect_h264_exp_golomb_code(tree, hf_h264_offset_for_top_to_bottom_field, tvb, &bit_offset, H264_SE_V);
1202 /* num_ref_frames_in_pic_order_cnt_cycle 0 ue(v) */
1203 num_ref_frames_in_pic_order_cnt_cycle = dissect_h264_exp_golomb_code(tree, hf_h264_num_ref_frames_in_pic_order_cnt_cycle, tvb, &bit_offset, H264_UE_V);
1204 for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ ){
1205 /*offset_for_ref_frame[ i ] 0 se(v)*/
1206 dissect_h264_exp_golomb_code(tree, hf_h264_offset_for_ref_frame, tvb, &bit_offset, H264_SE_V);
1209 /* num_ref_frames 0 ue(v) */
1210 dissect_h264_exp_golomb_code(tree, hf_h264_num_ref_frames, tvb, &bit_offset, H264_UE_V);
1212 /* gaps_in_frame_num_value_allowed_flag 0 u(1) */
1213 proto_tree_add_bits_item(tree, hf_h264_gaps_in_frame_num_value_allowed_flag, tvb, bit_offset, 1, FALSE);
1216 /* pic_width_in_mbs_minus1 0 ue(v) */
1217 dissect_h264_exp_golomb_code(tree, hf_h264_pic_width_in_mbs_minus1, tvb, &bit_offset, H264_UE_V);
1219 /* pic_height_in_map_units_minus1 0 ue(v) */
1220 dissect_h264_exp_golomb_code(tree, hf_h264_pic_height_in_map_units_minus1, tvb, &bit_offset, H264_UE_V);
1222 /* frame_mbs_only_flag 0 u(1) */
1223 frame_mbs_only_flag = tvb_get_bits8(tvb, bit_offset, 1);
1224 proto_tree_add_bits_item(tree, hf_h264_frame_mbs_only_flag, tvb, bit_offset, 1, FALSE);
1226 if( !frame_mbs_only_flag ){
1227 /* mb_adaptive_frame_field_flag 0 u(1) */
1228 proto_tree_add_bits_item(tree, hf_h264_mb_adaptive_frame_field_flag, tvb, bit_offset, 1, FALSE);
1232 /* direct_8x8_inference_flag 0 u(1) */
1233 proto_tree_add_bits_item(tree, hf_h264_direct_8x8_inference_flag, tvb, bit_offset, 1, FALSE);
1236 /* frame_cropping_flag 0 u(1) */
1237 frame_cropping_flag = tvb_get_bits8(tvb, bit_offset, 1);
1238 proto_tree_add_bits_item(tree, hf_h264_frame_cropping_flag, tvb, bit_offset, 1, FALSE);
1241 if(frame_cropping_flag) {
1242 /* frame_crop_left_offset 0 ue(v) */
1243 dissect_h264_exp_golomb_code(tree, hf_h264_frame_crop_left_offset, tvb, &bit_offset, H264_UE_V);
1244 dissect_h264_exp_golomb_code(tree,hf_h264_frame_crop_right_offset, tvb, &bit_offset, H264_UE_V);
1245 dissect_h264_exp_golomb_code(tree, hf_h264_frame_crop_top_offset, tvb, &bit_offset, H264_UE_V);
1246 dissect_h264_exp_golomb_code(tree, hf_h264_frame_crop_bottom_offset, tvb, &bit_offset, H264_UE_V);
1250 /* vui_parameters_present_flag 0 u(1) */
1251 vui_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1252 proto_tree_add_bits_item(tree, hf_h264_vui_parameters_present_flag, tvb, bit_offset, 1, FALSE);
1254 if(vui_parameters_present_flag){
1255 bit_offset = dissect_h264_vui_parameters(tree, tvb, pinfo, bit_offset);
1258 /* rbsp_trailing_bits( ) 0 */
1259 bit_offset = dissect_h264_rbsp_trailing_bits(tree, tvb, pinfo, bit_offset);
1263 /* 7.3.2.2 Picture parameter set RBSP syntax */
1266 dissect_h264_pic_parameter_set_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset)
1270 guint32 num_slice_groups_minus1, slice_group_map_type, pic_scaling_matrix_present_flag;
1272 bit_offset = offset<<3;
1274 /* pic_parameter_set_id 1 ue(v) */
1275 dissect_h264_exp_golomb_code(tree, hf_h264_pic_parameter_set_id, tvb, &bit_offset, H264_UE_V);
1277 /* seq_parameter_set_id 1 ue(v) */
1278 dissect_h264_exp_golomb_code(tree, hf_h264_seq_parameter_set_id, tvb, &bit_offset, H264_UE_V);
1280 /* entropy_coding_mode_flag 1 u(1) */
1281 proto_tree_add_bits_item(tree, hf_h264_entropy_coding_mode_flag, tvb, bit_offset, 1, FALSE);
1284 /* pic_order_present_flag 1 u(1)*/
1285 proto_tree_add_bits_item(tree, hf_h264_pic_order_present_flag, tvb, bit_offset, 1, FALSE);
1288 /* num_slice_groups_minus1 1 ue(v)*/
1289 num_slice_groups_minus1 = dissect_h264_exp_golomb_code(tree, hf_h264_num_slice_groups_minus1, tvb, &bit_offset, H264_UE_V);
1290 if( num_slice_groups_minus1 > 0 ) {
1291 /* slice_group_map_type 1 ue(v)*/
1292 slice_group_map_type = dissect_h264_exp_golomb_code(tree, hf_h264_slice_group_map_type, tvb, &bit_offset, H264_UE_V);
1293 /* if( slice_group_map_type = = 0 )*/
1294 /* for( iGroup = 0; iGroup <= num_slice_groups_minus1; iGroup++ )*/
1295 /* run_length_minus1[ iGroup ] 1 ue(v)*/
1296 /* else if( slice_group_map_type == 2 )*/
1297 /* for( iGroup = 0; iGroup < num_slice_groups_minus1; iGroup++ ) {*/
1298 /* top_left[ iGroup ] 1 ue(v)*/
1299 /* bottom_right[ iGroup ] 1 ue(v)*/
1301 /* else if( slice_group_map_type == 3 ||*/
1302 /* slice_group_map_type == 4 ||*/
1303 /* slice_group_map_type == 5 ) {*/
1304 /* slice_group_change_direction_flag 1 u(1)*/
1305 /* slice_group_change_rate_minus1 1 ue(v)*/
1306 /* } else if( slice_group_map_type == 6 ) {*/
1307 /* pic_size_in_map_units_minus1 1 ue(v)*/
1308 /* for( i = 0; i <= pic_size_in_map_units_minus1; i++ )*/
1309 /* slice_group_id[ i ] 1 u(v)*/
1312 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
1315 /* num_ref_idx_l0_active_minus1 1 ue(v)*/
1316 dissect_h264_exp_golomb_code(tree, hf_h264_num_ref_idx_l0_active_minus1, tvb, &bit_offset, H264_UE_V);
1318 /* num_ref_idx_l1_active_minus1 1 ue(v)*/
1319 dissect_h264_exp_golomb_code(tree, hf_h264_num_ref_idx_l1_active_minus1, tvb, &bit_offset, H264_UE_V);
1321 /* weighted_pred_flag 1 u(1)*/
1322 proto_tree_add_bits_item(tree, hf_h264_weighted_pred_flag, tvb, bit_offset, 1, FALSE);
1325 /* weighted_bipred_idc 1 u(2)*/
1326 proto_tree_add_bits_item(tree, hf_h264_weighted_bipred_idc, tvb, bit_offset, 2, FALSE);
1327 bit_offset= bit_offset+2;
1329 /* pic_init_qp_minus26 * relative to 26 * 1 se(v)*/
1330 dissect_h264_exp_golomb_code(tree, hf_h264_pic_init_qp_minus26, tvb, &bit_offset, H264_SE_V);
1332 /* pic_init_qs_minus26 * relative to 26 * 1 se(v)*/
1333 dissect_h264_exp_golomb_code(tree, hf_h264_pic_init_qs_minus26, tvb, &bit_offset, H264_SE_V);
1335 /* chroma_qp_index_offset 1 se(v)*/
1336 dissect_h264_exp_golomb_code(tree, hf_h264_chroma_qp_index_offset, tvb, &bit_offset, H264_SE_V);
1338 /* deblocking_filter_control_present_flag 1 u(1)*/
1339 proto_tree_add_bits_item(tree, hf_h264_deblocking_filter_control_present_flag, tvb, bit_offset, 1, FALSE);
1342 /* constrained_intra_pred_flag 1 u(1)*/
1343 proto_tree_add_bits_item(tree, hf_h264_constrained_intra_pred_flag, tvb, bit_offset, 1, FALSE);
1346 /* redundant_pic_cnt_present_flag 1 u(1)*/
1347 proto_tree_add_bits_item(tree, hf_h264_redundant_pic_cnt_present_flag, tvb, bit_offset, 1, FALSE);
1350 if( more_rbsp_data(tree, tvb, pinfo, bit_offset)){
1351 /* transform_8x8_mode_flag 1 u(1)*/
1352 proto_tree_add_bits_item(tree, hf_h264_transform_8x8_mode_flag, tvb, bit_offset, 1, FALSE);
1355 /* pic_scaling_matrix_present_flag 1 u(1)*/
1356 pic_scaling_matrix_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
1357 proto_tree_add_bits_item(tree, hf_h264_pic_scaling_matrix_present_flag, tvb, bit_offset, 1, FALSE);
1360 if( pic_scaling_matrix_present_flag ){
1361 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
1363 /* for( i = 0; i < 6 + 2* transform_8x8_mode_flag; i++ ) {*/
1364 /* pic_scaling_list_present_flag[ i ] 1 u(1)*/
1365 /* if( pic_scaling_list_present_flag[ i ] )*/
1367 /* scaling_list( ScalingList4x4[ i ], 16, UseDefaultScalingMatrix4x4Flag[ i ] )*/
1369 /* scaling_list( ScalingList8x8[ i - 6 ], 64, UseDefaultScalingMatrix8x8Flag[ i - 6 ] )*/
1373 /* second_chroma_qp_index_offset 1 se(v)*/
1374 dissect_h264_exp_golomb_code(tree, hf_h264_second_chroma_qp_index_offset, tvb, &bit_offset, H264_SE_V);
1376 bit_offset = dissect_h264_rbsp_trailing_bits(tree, tvb, pinfo, bit_offset);
1381 * 7.3.2.4 Access unit delimiter RBSP syntax
1382 * access_unit_delimiter_rbsp( )
1385 dissect_h264_access_unit_delimiter_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1387 /* primary_pic_type 6 u(3) */
1388 /* rbsp_trailing_bits( ) 6 */
1389 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1394 * 7.3.2.5 End of sequence RBSP syntax
1395 * end_of_seq_rbsp( ) {}
1398 dissect_h264_end_of_seq_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1400 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1405 * 7.3.2.6 End of stream RBSP syntax
1406 * end_of_stream_rbsp( ) {}
1409 dissect_h264_end_of_stream_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1411 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1416 * 7.3.2.7 Filler data RBSP syntax
1417 * filler_data_rbsp( )
1420 dissect_h264_filler_data_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1422 /* while( next_bits( 8 ) = = 0xFF ) */
1423 /* ff_byte * equal to 0xFF * 9 f(8) */
1424 /* rbsp_trailing_bits( ) 9 */
1425 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1430 * 7.3.2.1.2 Sequence parameter set extension RBSP syntax
1431 * seq_parameter_set_extension_rbsp( )
1434 dissect_h264_seq_parameter_set_extension_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
1436 /* seq_parameter_set_id 10 ue(v) */
1437 /* aux_format_idc 10 ue(v) */
1438 /* if( aux_format_idc != 0 ) { */
1439 /* bit_depth_aux_minus8 10 ue(v) */
1440 /* alpha_incr_flag 10 u(1) */
1441 /* alpha_opaque_value 10 u(v) */
1442 /* alpha_transparent_value 10 u(v) */
1444 /* additional_extension_flag 10 u(1) */
1445 /* rbsp_trailing_bits() 10 */
1446 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
1451 /* Dissect NAL unit as recived in sprop-parameter-sets of SDP */
1453 dissect_h264_nal_unit(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1456 proto_tree *h264_nal_tree;
1458 guint8 nal_unit_type;
1459 item = proto_tree_add_item(tree, hf_h264_nal_unit, tvb, offset, -1, FALSE);
1460 h264_nal_tree = proto_item_add_subtree(item, ett_h264_nal_unit);
1462 /* Ref: 7.3.1 NAL unit syntax */
1463 nal_unit_type = tvb_get_guint8(tvb,offset) & 0x1f;
1465 /* forbidden_zero_bit All f(1) */
1466 proto_tree_add_item(h264_nal_tree, hf_h264_forbidden_zero_bit, tvb, offset, 1, FALSE);
1467 /* nal_ref_idc All u(2) */
1468 proto_tree_add_item(h264_nal_tree, hf_h264_nal_ref_idc, tvb, offset, 1, FALSE);
1469 /* nal_unit_type All u(5) */
1470 proto_tree_add_item(h264_nal_tree, hf_h264_nal_unit_type, tvb, offset, 1, FALSE);
1473 switch(nal_unit_type){
1474 case 0: /* Unspecified */
1475 proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Unspecified NAL unit type");
1477 case 1: /* Coded slice of a non-IDR picture */
1478 dissect_h264_slice_layer_without_partitioning_rbsp(h264_nal_tree, tvb, pinfo, offset);
1480 case 2: /* Coded slice data partition A */
1481 dissect_h264_slice_data_partition_a_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
1483 case 3: /* Coded slice data partition B */
1484 dissect_h264_slice_data_partition_b_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
1486 case 4: /* Coded slice data partition C */
1487 dissect_h264_slice_data_partition_c_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
1489 case 5: /* Coded slice of an IDR picture */
1490 dissect_h264_slice_layer_without_partitioning_rbsp(h264_nal_tree, tvb, pinfo, offset);
1492 case 6: /* Supplemental enhancement information (SEI) */
1493 dissect_h264_sei_rbsp(h264_nal_tree, tvb, pinfo, offset);
1495 case H264_SEQ_PAR_SET: /* 7 Sequence parameter set*/
1496 dissect_h264_seq_parameter_set_rbsp(h264_nal_tree, tvb, pinfo, offset);
1498 case H264_PIC_PAR_SET: /* 8 Picture parameter set */
1499 dissect_h264_pic_parameter_set_rbsp(h264_nal_tree, tvb, pinfo, offset);
1501 case 9: /* Access unit delimiter */
1502 dissect_h264_access_unit_delimiter_rbsp(h264_nal_tree, tvb, pinfo, offset);
1504 case 10: /* End of sequence */
1505 dissect_h264_end_of_seq_rbsp(h264_nal_tree, tvb, pinfo, offset);
1507 case 11: /* End of stream */
1508 dissect_h264_end_of_stream_rbsp(h264_nal_tree, tvb, pinfo, offset);
1510 case 12: /* Filler data */
1511 dissect_h264_filler_data_rbsp(h264_nal_tree, tvb, pinfo, offset);
1513 case 13: /* Sequence parameter set extension */
1514 dissect_h264_seq_parameter_set_extension_rbsp(h264_nal_tree, tvb, pinfo, offset);
1516 case 14: /* Reserved */
1517 case 15: /* Reserved */
1518 case 16: /* Reserved */
1519 case 17: /* Reserved */
1520 case 18: /* Reserved */
1521 proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Reserved NAL unit type");
1523 case 19: /* Coded slice of an auxiliary coded picture without partitioning */
1524 dissect_h264_slice_layer_without_partitioning_rbsp(tree, tvb, pinfo, offset);
1527 dissect_h264_slice_layer_without_partitioning_rbsp(tree, tvb, pinfo, offset);
1530 /* 24..31 Unspecified */
1531 proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Unspecified NAL unit type");
1536 /* Code to actually dissect the packets */
1538 dissect_h264(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1541 proto_item *item, *ti, *stream_item, *fua_item;
1542 proto_tree *h264_tree, *h264_nal_tree, *stream_tree, *fua_tree;
1546 /* Make entries in Protocol column and Info column on summary display */
1547 if (check_col(pinfo->cinfo, COL_PROTOCOL))
1548 col_set_str(pinfo->cinfo, COL_PROTOCOL, "H264");
1551 item = proto_tree_add_item(tree, proto_h264, tvb, 0, -1, FALSE);
1552 h264_tree = proto_item_add_subtree(item, ett_h264);
1554 type = tvb_get_guint8(tvb,offset)&0x1f;
1555 /* if the type is 28, it would be draw another title */
1557 ti = proto_tree_add_text(h264_tree, tvb, offset, 1, "FU identifier");
1559 ti = proto_tree_add_text(h264_tree, tvb, offset, 1, "NAL unit header or first byte of the payload");
1560 h264_nal_tree = proto_item_add_subtree(ti, ett_h264_nal);
1562 /* +---------------+
1570 * forbidden_zero_bit. A value of 0 indicates that the NAL unit type
1571 * octet and payload should not contain bit errors or other syntax
1572 * violations. A value of 1 indicates that the NAL unit type octet
1573 * and payload may contain bit errors or other syntax violations.
1575 proto_tree_add_item(h264_nal_tree, hf_h264_nal_f_bit, tvb, offset, 1, FALSE);
1576 proto_tree_add_item(h264_nal_tree, hf_h264_nal_nri, tvb, offset, 1, FALSE);
1577 if (check_col(pinfo->cinfo, COL_INFO)){
1578 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
1579 val_to_str(type, h264_type_values, "Unknown Type (%u)"));
1582 proto_tree_add_item(h264_nal_tree, hf_h264_type, tvb, offset, 1, FALSE);
1585 fua_item = proto_tree_add_text(h264_tree, tvb, offset, 1, "FU Header");
1586 fua_tree = proto_item_add_subtree(fua_item, ett_h264_fua);
1587 proto_tree_add_item(fua_tree, hf_h264_start_bit, tvb, offset, 1, FALSE);
1588 proto_tree_add_item(fua_tree, hf_h264_end_bit, tvb, offset, 1, FALSE);
1589 proto_tree_add_item(fua_tree, hf_h264_forbidden_bit, tvb, offset, 1, FALSE);
1590 proto_tree_add_item(fua_tree, hf_h264_nal_unit_type, tvb, offset, 1, FALSE);
1591 if ( (tvb_get_guint8(tvb,offset)&0x80) == 0x80 ){
1592 type = tvb_get_guint8(tvb,offset)&0x1f;
1598 stream_item =proto_tree_add_text(h264_tree, tvb, offset, -1, "H264 bitstream");
1599 stream_tree = proto_item_add_subtree(stream_item, ett_h264_stream);
1601 case 1: /* 1 Coded slice of a non-IDR picture */
1602 dissect_h264_slice_layer_without_partitioning_rbsp(stream_tree, tvb, pinfo, offset);
1604 case 3: /* Coded slice data partition B */
1605 dissect_h264_slice_data_partition_b_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
1607 case 4: /* Coded slice data partition C */
1608 dissect_h264_slice_data_partition_c_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
1610 case 5: /* Coded slice of an IDR picture */
1611 dissect_h264_slice_layer_without_partitioning_rbsp(stream_tree, tvb, pinfo, offset);
1613 case H264_SEQ_PAR_SET: /* 7 Sequence parameter set*/
1614 dissect_h264_seq_parameter_set_rbsp(stream_tree, tvb, pinfo, offset);
1616 case H264_PIC_PAR_SET: /* 8 Picture parameter set */
1617 dissect_h264_pic_parameter_set_rbsp(stream_tree, tvb, pinfo, offset);
1619 case 19: /* Coded slice of an auxiliary coded picture without partitioning */
1620 dissect_h264_slice_layer_without_partitioning_rbsp(stream_tree, tvb, pinfo, offset);
1632 static const int *profile_fields[] = {
1633 &hf_h264_par_profile_b,
1634 &hf_h264_par_profile_m,
1635 &hf_h264_par_profile_e,
1636 &hf_h264_par_profile_h,
1637 &hf_h264_par_profile_h10,
1638 &hf_h264_par_profile_h4_2_2,
1639 &hf_h264_par_profile_h4_4_4,
1644 dissect_h264_par_profile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1648 proto_tree_add_bitmask(tree, tvb, offset,
1649 hf_h264_par_profile, ett_h264_par_profile,
1650 profile_fields, FALSE);
1655 static const int *AdditionalModesSupported_fields[] = {
1656 &hf_h264_par_add_mode_sup_rcdo,
1660 dissect_h264_par_AdditionalModesSupported(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1664 proto_tree_add_bitmask(tree, tvb, offset,
1665 hf_h264_par_AdditionalModesSupported, ett_h264_par_AdditionalModesSupported,
1666 AdditionalModesSupported_fields, FALSE);
1672 static const int *ProfileIOP_fields[] = {
1673 &hf_h264_par_constraint_set0_flag,
1674 &hf_h264_par_constraint_set1_flag,
1675 &hf_h264_par_constraint_set2_flag,
1681 dissect_h264_ProfileIOP(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1685 proto_tree_add_bitmask(tree, tvb, offset,
1686 hf_h264_par_ProfileIOP, ett_h264_par_ProfileIOP,
1687 ProfileIOP_fields, FALSE);
1692 static const value_string h264_par_level_values[] = {
1713 dissect_h264_par_level(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_)
1717 const gchar *p = NULL;
1720 actx = get_asn1_ctx(pinfo->private_data);
1721 DISSECTOR_ASSERT(actx);
1723 lvl = tvb_get_ntohs(tvb, offset);
1724 p = match_strval(lvl, VALS(h264_par_level_values));
1726 proto_item_append_text(actx->created_item, " - Level %s", p);
1732 typedef struct _h264_capability_t {
1735 new_dissector_t content_pdu;
1736 } h264_capability_t;
1738 static h264_capability_t h264_capability_tab[] = {
1739 /* ITU-T H.241 (05/2006), 8.3 H.264 capabilities */
1740 { "GenericCapability/0.0.8.241.0.0.1", "ITU-T Rec. H.241 H.264 Video Capabilities", NULL },
1741 { "GenericCapability/0.0.8.241.0.0.1/collapsing/41", "Profile", dissect_h264_par_profile },
1742 { "GenericCapability/0.0.8.241.0.0.1/collapsing/42", "Level", dissect_h264_par_level },
1743 { "GenericCapability/0.0.8.241.0.0.1/collapsing/3" , "CustomMaxMBPS", NULL },
1744 { "GenericCapability/0.0.8.241.0.0.1/collapsing/4" , "CustomMaxFS", NULL },
1745 { "GenericCapability/0.0.8.241.0.0.1/collapsing/5" , "CustomMaxDPB", NULL },
1746 { "GenericCapability/0.0.8.241.0.0.1/collapsing/6" , "CustomMaxBRandCPB", NULL },
1747 { "GenericCapability/0.0.8.241.0.0.1/collapsing/7" , "MaxStaticMBPS", NULL },
1748 { "GenericCapability/0.0.8.241.0.0.1/collapsing/8" , "max-rcmd-nal-unit-size", NULL },
1749 { "GenericCapability/0.0.8.241.0.0.1/collapsing/9" , "max-nal-unit-size", NULL },
1750 { "GenericCapability/0.0.8.241.0.0.1/collapsing/10", "SampleAspectRatiosSupported", NULL },
1751 { "GenericCapability/0.0.8.241.0.0.1/collapsing/11", "AdditionalModesSupported", dissect_h264_par_AdditionalModesSupported },
1752 { "GenericCapability/0.0.8.241.0.0.1/collapsing/12", "AdditionalDisplayCapabilities", NULL },
1753 /* TS 26.111 H.264 */
1754 { "GenericCapability/0.0.8.241.0.0.1/collapsing/43" , "DecoderConfigurationInformation", NULL },
1755 { "GenericCapability/0.0.8.241.0.0.1/collapsing/44" , "AcceptRedundantSlices", NULL },
1756 { "GenericCapability/0.0.8.241.0.0.1/collapsing/45" , "NalAlignedMode", NULL },
1757 { "GenericCapability/0.0.8.241.0.0.1/collapsing/46" , "ProfileIOP", dissect_h264_ProfileIOP },
1758 { NULL, NULL, NULL },
1761 static h264_capability_t *find_cap(const gchar *id) {
1762 h264_capability_t *ftr = NULL;
1763 h264_capability_t *f;
1765 for (f=h264_capability_tab; f->id; f++) {
1766 if (!strcmp(id, f->id)) { ftr = f; break; }
1772 dissect_h264_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree)
1775 h264_capability_t *ftr = NULL;
1777 actx = get_asn1_ctx(pinfo->private_data);
1778 DISSECTOR_ASSERT(actx);
1780 ftr = find_cap(pinfo->match_string);
1782 proto_item_append_text(actx->created_item, " - %s", ftr->name);
1783 proto_item_append_text(proto_item_get_parent(proto_tree_get_parent(tree)), ": %s", ftr->name);
1785 proto_item_append_text(actx->created_item, " - unknown(%s)", pinfo->match_string);
1791 /* Register the protocol with Wireshark */
1792 /* If this dissector uses sub-dissector registration add a registration routine.
1793 This format is required because a script is used to find these routines and
1794 create the code that calls these routines.
1797 proto_reg_handoff_h264(void)
1799 static dissector_handle_t h264_handle;
1800 static guint dynamic_payload_type;
1801 static int h264_prefs_initialized = FALSE;
1803 if (!h264_prefs_initialized) {
1804 dissector_handle_t h264_name_handle;
1805 h264_capability_t *ftr;
1807 h264_handle = find_dissector("h264");
1808 dissector_add_string("rtp_dyn_payload_type","H264", h264_handle);
1810 h264_name_handle = create_dissector_handle(dissect_h264_name, proto_h264);
1811 for (ftr=h264_capability_tab; ftr->id; ftr++) {
1813 dissector_add_string("h245.gef.name", ftr->id, h264_name_handle);
1814 if (ftr->content_pdu)
1815 dissector_add_string("h245.gef.content", ftr->id, new_create_dissector_handle(ftr->content_pdu, proto_h264));
1817 h264_prefs_initialized = TRUE;
1819 if ( dynamic_payload_type > 95 )
1820 dissector_delete("rtp.pt", dynamic_payload_type, h264_handle);
1823 dynamic_payload_type = temp_dynamic_payload_type;
1824 if ( dynamic_payload_type > 95 ){
1825 dissector_add("rtp.pt", dynamic_payload_type, h264_handle);
1829 /* this format is require because a script is used to build the C function
1830 that calls all the protocol registration.
1834 proto_register_h264(void)
1837 module_t *h264_module;
1839 /* Setup list of header fields See Section 1.6.1 for details*/
1840 static hf_register_info hf[] = {
1841 { &hf_h264_nal_f_bit,
1842 { "F bit", "h264.f",
1843 FT_BOOLEAN, 8, TFS(&h264_f_bit_vals), 0x80,
1847 { "Nal_ref_idc (NRI)", "h264.nal_nri",
1848 FT_UINT8, BASE_DEC, NULL, 0x60,
1852 { "Type", "h264.nal_unit_hdr",
1853 FT_UINT8, BASE_DEC, VALS(h264_type_values), 0x1f,
1856 { &hf_h264_start_bit,
1857 { "Start bit", "h264.start.bit",
1858 FT_BOOLEAN, 8, TFS(&h264_start_bit_vals), 0x80,
1859 "Start bit", HFILL }
1862 { "End bit", "h264.end.bit",
1863 FT_BOOLEAN, 8, TFS(&h264_end_bit_vals), 0x40,
1866 { &hf_h264_forbidden_bit,
1867 { "Forbidden bit", "h264.forbidden.bit",
1868 FT_UINT8, BASE_DEC, NULL, 0x20,
1869 "Forbidden bit", HFILL }
1872 { "Profile", "h264.profile",
1873 FT_BYTES, BASE_NONE, NULL, 0x0,
1876 { &hf_h264_profile_idc,
1877 { "Profile_idc", "h264.profile_idc",
1878 FT_UINT8, BASE_DEC, VALS(h264_profile_idc_values), 0xff,
1879 "Profile_idc", HFILL }
1881 { &hf_h264_rbsp_stop_bit,
1882 { "rbsp_stop_bit", "h264.rbsp_stop_bit",
1883 FT_UINT8, BASE_DEC, NULL, 0x0,
1884 "rbsp_stop_bit", HFILL }
1886 { &hf_h264_rbsp_trailing_bits,
1887 { "rbsp_trailing_bits", "h264.rbsp_trailing_bits",
1888 FT_UINT8, BASE_DEC, NULL, 0x0,
1889 "rbsp_trailing_bits", HFILL }
1891 { &hf_h264_constraint_set0_flag,
1892 { "Constraint_set0_flag", "h264.constraint_set0_flag",
1893 FT_UINT8, BASE_DEC, NULL, 0x80,
1894 "Constraint_set0_flag", HFILL }
1896 { &hf_h264_constraint_set1_flag,
1897 { "Constraint_set1_flag", "h264.constraint_set1_flag",
1898 FT_UINT8, BASE_DEC, NULL, 0x40,
1899 "Constraint_set1_flag", HFILL }
1901 { &hf_h264_constraint_set2_flag,
1902 { "Constraint_set2_flag", "h264.constraint_set2_flag",
1903 FT_UINT8, BASE_DEC, NULL, 0x20,
1906 { &hf_h264_constraint_set3_flag,
1907 { "Constraint_set3_flag", "h264.constraint_set3_flag",
1908 FT_UINT8, BASE_DEC, NULL, 0x10,
1909 "Constraint_set3_flag", HFILL }
1911 { &hf_h264_reserved_zero_4bits,
1912 { "Reserved_zero_4bits", "h264.reserved_zero_4bits",
1913 FT_UINT8, BASE_DEC, NULL, 0x0f,
1914 "Reserved_zero_4bits", HFILL }
1916 { &hf_h264_level_idc,
1917 { "Level_id", "h264.level_id",
1918 FT_UINT8, BASE_DEC, NULL, 0xff,
1921 { &hf_h264_nal_unit,
1922 { "NAL unit", "h264.nal_unit",
1923 FT_BYTES, BASE_NONE, NULL, 0x0,
1926 { &hf_h264_forbidden_zero_bit,
1927 { "Forbidden_zero_bit", "h264.forbidden_zero_bit",
1928 FT_UINT8, BASE_DEC, NULL, 0x80,
1929 "forbidden_zero_bit", HFILL }
1931 { &hf_h264_nal_ref_idc,
1932 { "Nal_ref_idc", "h264.nal_ref_idc",
1933 FT_UINT8, BASE_DEC, NULL, 0x60,
1934 "nal_ref_idc", HFILL }
1936 {&hf_h264_nal_unit_type,
1937 { "Nal_unit_type", "h264.nal_unit_type",
1938 FT_UINT8, BASE_DEC, VALS(h264_nal_unit_type_vals), 0x1f,
1939 "nal_unit_type", HFILL }
1941 { &hf_h264_seq_parameter_set_id,
1942 { "seq_parameter_set_id", "h264.seq_parameter_set_id",
1943 FT_UINT32, BASE_DEC, NULL, 0x0,
1944 "seq_parameter_set_id", HFILL }
1946 { &hf_h264_chroma_format_idc,
1947 { "chroma_format_id", "h264.chroma_format_id",
1948 FT_UINT32, BASE_DEC, NULL, 0x0,
1949 "chroma_format_id", HFILL }
1951 { &hf_h264_residual_colour_transform_flag,
1952 { "residual_colour_transform_flag", "h264.residual_colour_transform_flag",
1953 FT_UINT8, BASE_DEC, NULL, 0x0,
1954 "residual_colour_transform_flag", HFILL }
1956 { &hf_h264_bit_depth_luma_minus8,
1957 { "bit_depth_luma_minus8", "h264.bit_depth_luma_minus8",
1958 FT_UINT32, BASE_DEC, NULL, 0x0,
1959 "bit_depth_luma_minus8", HFILL }
1961 { &hf_h264_bit_depth_chroma_minus8,
1962 { "bit_depth_chroma_minus8", "h264.bit_depth_chroma_minus8",
1963 FT_UINT32, BASE_DEC, NULL, 0x0,
1964 "bit_depth_chroma_minus8", HFILL }
1966 { &hf_h264_qpprime_y_zero_transform_bypass_flag,
1967 { "qpprime_y_zero_transform_bypass_flag", "h264.qpprime_y_zero_transform_bypass_flag",
1968 FT_UINT32, BASE_DEC, NULL, 0x0,
1969 "qpprime_y_zero_transform_bypass_flag", HFILL }
1971 { &hf_h264_seq_scaling_matrix_present_flag,
1972 { "seq_scaling_matrix_present_flag", "h264.seq_scaling_matrix_present_flag",
1973 FT_UINT32, BASE_DEC, NULL, 0x0,
1974 "seq_scaling_matrix_present_flag", HFILL }
1976 { &hf_h264_log2_max_frame_num_minus4,
1977 { "log2_max_frame_num_minus4", "h264.log2_max_frame_num_minus4",
1978 FT_UINT32, BASE_DEC, NULL, 0x0,
1979 "log2_max_frame_num_minus4", HFILL }
1981 { &hf_h264_pic_order_cnt_type,
1982 { "pic_order_cnt_type", "h264.pic_order_cnt_type",
1983 FT_UINT32, BASE_DEC, NULL, 0x0,
1984 "pic_order_cnt_type", HFILL }
1986 { &hf_h264_log2_max_pic_order_cnt_lsb_minus4,
1987 { "log2_max_pic_order_cnt_lsb_minus4", "h264.log2_max_pic_order_cnt_lsb_minus4",
1988 FT_UINT32, BASE_DEC, NULL, 0x0,
1989 "log2_max_pic_order_cnt_lsb_minus4", HFILL }
1991 { &hf_h264_delta_pic_order_always_zero_flag,
1992 { "delta_pic_order_always_zero_flag", "h264.delta_pic_order_always_zero_flag",
1993 FT_UINT8, BASE_DEC, NULL, 0x0,
1994 "delta_pic_order_always_zero_flag", HFILL }
1996 { &hf_h264_offset_for_non_ref_pic,
1997 { "offset_for_non_ref_pic", "h264.offset_for_non_ref_pic",
1998 FT_INT32, BASE_DEC, NULL, 0x0,
1999 "offset_for_non_ref_pic", HFILL }
2001 { &hf_h264_offset_for_top_to_bottom_field,
2002 { "offset_for_top_to_bottom_field", "h264.offset_for_top_to_bottom_field",
2003 FT_INT32, BASE_DEC, NULL, 0x0,
2004 "offset_for_top_to_bottom_field", HFILL }
2006 { &hf_h264_num_ref_frames_in_pic_order_cnt_cycle,
2007 { "num_ref_frames_in_pic_order_cnt_cycle", "h264.num_ref_frames_in_pic_order_cnt_cycle",
2008 FT_UINT32, BASE_DEC, NULL, 0x0,
2009 "num_ref_frames_in_pic_order_cnt_cycle", HFILL }
2011 { &hf_h264_offset_for_ref_frame,
2012 { "offset_for_ref_frame", "h264.offset_for_ref_frame",
2013 FT_INT32, BASE_DEC, NULL, 0x0,
2014 "offset_for_ref_frame", HFILL }
2016 { &hf_h264_num_ref_frames,
2017 { "num_ref_frames", "h264.num_ref_frames",
2018 FT_UINT32, BASE_DEC, NULL, 0x0,
2019 "num_ref_frames", HFILL }
2021 { &hf_h264_gaps_in_frame_num_value_allowed_flag,
2022 { "gaps_in_frame_num_value_allowed_flag", "h264.gaps_in_frame_num_value_allowed_flag",
2023 FT_UINT8, BASE_DEC, NULL, 0x0,
2024 "gaps_in_frame_num_value_allowed_flag", HFILL }
2026 { &hf_h264_pic_width_in_mbs_minus1,
2027 { "pic_width_in_mbs_minus1", "h264.pic_width_in_mbs_minus1",
2028 FT_UINT32, BASE_DEC, NULL, 0x0,
2029 "pic_width_in_mbs_minus1", HFILL }
2031 { &hf_h264_pic_height_in_map_units_minus1,
2032 { "pic_height_in_map_units_minus1", "h264.pic_height_in_map_units_minus1",
2033 FT_UINT32, BASE_DEC, NULL, 0x0,
2034 "pic_height_in_map_units_minus1", HFILL }
2036 { &hf_h264_frame_mbs_only_flag,
2037 { "frame_mbs_only_flag", "h264.frame_mbs_only_flag",
2038 FT_UINT8, BASE_DEC, NULL, 0x0,
2039 "frame_mbs_only_flag", HFILL }
2041 { &hf_h264_mb_adaptive_frame_field_flag,
2042 { "mb_adaptive_frame_field_flag", "h264.mb_adaptive_frame_field_flag",
2043 FT_UINT8, BASE_DEC, NULL, 0x0,
2044 "mb_adaptive_frame_field_flag", HFILL }
2046 { &hf_h264_direct_8x8_inference_flag,
2047 { "direct_8x8_inference_flag", "h264.direct_8x8_inference_flag",
2048 FT_UINT8, BASE_DEC, NULL, 0x0,
2049 "direct_8x8_inference_flag", HFILL }
2051 { &hf_h264_frame_cropping_flag,
2052 { "frame_cropping_flag", "h264.frame_cropping_flag",
2053 FT_UINT8, BASE_DEC, NULL, 0x0,
2054 "frame_cropping_flag", HFILL }
2056 { &hf_h264_frame_crop_left_offset,
2057 { "frame_crop_left_offset", "h264.frame_crop_left_offset",
2058 FT_UINT32, BASE_DEC, NULL, 0x0,
2059 "frame_crop_left_offset", HFILL }
2061 { &hf_h264_frame_crop_right_offset,
2062 { "frame_crop_left_offset", "h264.frame_crop_right_offset",
2063 FT_UINT32, BASE_DEC, NULL, 0x0,
2064 "frame_crop_right_offset", HFILL }
2066 { &hf_h264_frame_crop_top_offset,
2067 { "frame_crop_top_offset", "h264.frame_crop_top_offset",
2068 FT_UINT32, BASE_DEC, NULL, 0x0,
2069 "frame_crop_top_offset", HFILL }
2071 { &hf_h264_frame_crop_bottom_offset,
2072 { "frame_crop_bottom_offset", "h264.frame_crop_bottom_offset",
2073 FT_UINT32, BASE_DEC, NULL, 0x0,
2074 "frame_crop_bottom_offset", HFILL }
2076 { &hf_h264_vui_parameters_present_flag,
2077 { "vui_parameters_present_flag", "h264.vui_parameters_present_flag",
2078 FT_UINT8, BASE_DEC, NULL, 0x0,
2079 "vui_parameters_present_flag", HFILL }
2081 { &hf_h264_pic_parameter_set_id,
2082 { "pic_parameter_set_id", "h264.pic_parameter_set_id",
2083 FT_UINT32, BASE_DEC, NULL, 0x0,
2084 "pic_parameter_set_id", HFILL }
2086 { &hf_h264_entropy_coding_mode_flag,
2087 { "entropy_coding_mode_flag", "h264.entropy_coding_mode_flag",
2088 FT_UINT8, BASE_DEC, NULL, 0x0,
2089 "entropy_coding_mode_flag", HFILL }
2091 { &hf_h264_pic_order_present_flag,
2092 { "pic_order_present_flag", "h264.pic_order_present_flag",
2093 FT_UINT8, BASE_DEC, NULL, 0x0,
2094 "pic_order_present_flag", HFILL }
2096 { &hf_h264_num_slice_groups_minus1,
2097 { "num_slice_groups_minus1", "h264.num_slice_groups_minus1",
2098 FT_UINT32, BASE_DEC, NULL, 0x0,
2099 "num_slice_groups_minus1", HFILL }
2101 { &hf_h264_slice_group_map_type,
2102 { "slice_group_map_type", "h264.slice_group_map_type",
2103 FT_UINT32, BASE_DEC, VALS(h264_slice_group_map_type_vals), 0x0,
2104 "slice_group_map_type", HFILL }
2106 { &hf_h264_num_ref_idx_l0_active_minus1,
2107 { "num_ref_idx_l0_active_minus1", "h264.num_ref_idx_l0_active_minus1",
2108 FT_UINT32, BASE_DEC, NULL, 0x0,
2109 "num_ref_idx_l0_active_minus1", HFILL }
2111 { &hf_h264_num_ref_idx_l1_active_minus1,
2112 { "num_ref_idx_l1_active_minus1", "h264.num_ref_idx_l1_active_minus1",
2113 FT_UINT32, BASE_DEC, NULL, 0x0,
2114 "num_ref_idx_l1_active_minus1", HFILL }
2116 { &hf_h264_weighted_pred_flag,
2117 { "weighted_pred_flag", "h264.weighted_pred_flag",
2118 FT_UINT8, BASE_DEC, NULL, 0x0,
2119 "weighted_pred_flag", HFILL }
2121 { &hf_h264_weighted_bipred_idc,
2122 { "weighted_bipred_idc", "h264.weighted_bipred_idc",
2123 FT_UINT8, BASE_DEC, NULL, 0x0,
2124 "weighted_bipred_idc", HFILL }
2126 { &hf_h264_pic_init_qp_minus26,
2127 { "pic_init_qp_minus26", "h264.pic_init_qp_minus26",
2128 FT_INT32, BASE_DEC, NULL, 0x0,
2129 "pic_init_qp_minus26", HFILL }
2131 { &hf_h264_pic_init_qs_minus26,
2132 { "pic_init_qs_minus26", "h264.pic_init_qs_minus26",
2133 FT_INT32, BASE_DEC, NULL, 0x0,
2134 "pic_init_qs_minus26", HFILL }
2136 { &hf_h264_chroma_qp_index_offset,
2137 { "chroma_qp_index_offset", "h264.chroma_qp_index_offset",
2138 FT_INT32, BASE_DEC, NULL, 0x0,
2139 "chroma_qp_index_offset", HFILL }
2141 { &hf_h264_deblocking_filter_control_present_flag,
2142 { "deblocking_filter_control_present_flag", "h264.deblocking_filter_control_present_flag",
2143 FT_UINT8, BASE_DEC, NULL, 0x0,
2144 "deblocking_filter_control_present_flag", HFILL }
2146 { &hf_h264_constrained_intra_pred_flag,
2147 { "constrained_intra_pred_flag", "h264.constrained_intra_pred_flag",
2148 FT_UINT8, BASE_DEC, NULL, 0x0,
2149 "constrained_intra_pred_flag", HFILL }
2151 { &hf_h264_redundant_pic_cnt_present_flag,
2152 { "redundant_pic_cnt_present_flag", "h264.redundant_pic_cnt_present_flag",
2153 FT_UINT8, BASE_DEC, NULL, 0x0,
2154 "redundant_pic_cnt_present_flag", HFILL }
2156 { &hf_h264_transform_8x8_mode_flag,
2157 { "transform_8x8_mode_flag", "h264.transform_8x8_mode_flag",
2158 FT_UINT8, BASE_DEC, NULL, 0x0,
2159 "transform_8x8_mode_flag", HFILL }
2161 { &hf_h264_pic_scaling_matrix_present_flag,
2162 { "pic_scaling_matrix_present_flag", "h264.pic_scaling_matrix_present_flag",
2163 FT_UINT8, BASE_DEC, NULL, 0x0,
2164 "pic_scaling_matrix_present_flag", HFILL }
2166 { &hf_h264_second_chroma_qp_index_offset,
2167 { "second_chroma_qp_index_offset", "h264.second_chroma_qp_index_offset",
2168 FT_INT32, BASE_DEC, NULL, 0x0,
2169 "second_chroma_qp_index_offset", HFILL }
2172 { &hf_h264_aspect_ratio_info_present_flag,
2173 { "aspect_ratio_info_present_flag", "h264.aspect_ratio_info_present_flag",
2174 FT_UINT8, BASE_DEC, NULL, 0x0,
2175 "aspect_ratio_info_present_flag", HFILL }
2177 { &hf_h264_aspect_ratio_idc,
2178 { "aspect_ratio_idc", "h264.aspect_ratio_idc",
2179 FT_UINT8, BASE_DEC, NULL, 0x0,
2180 "aspect_ratio_idc", HFILL }
2182 { &hf_h264_sar_width,
2183 { "sar_width", "h264.sar_width",
2184 FT_UINT16, BASE_DEC, NULL, 0x0,
2185 "sar_width", HFILL }
2187 { &hf_h264_sar_height,
2188 { "sar_height", "h264.sar_height",
2189 FT_UINT16, BASE_DEC, NULL, 0x0,
2190 "sar_height", HFILL }
2192 { &hf_h264_overscan_info_present_flag,
2193 { "overscan_info_present_flag", "h264.overscan_info_present_flag",
2194 FT_UINT8, BASE_DEC, NULL, 0x0,
2195 "overscan_info_present_flag", HFILL }
2197 { &hf_h264_overscan_appropriate_flag,
2198 { "overscan_appropriate_flag", "h264.overscan_appropriate_flag",
2199 FT_UINT8, BASE_DEC, NULL, 0x0,
2200 "overscan_appropriate_flag", HFILL }
2202 { &hf_h264_video_signal_type_present_flag,
2203 { "video_signal_type_present_flag", "h264.video_signal_type_present_flag",
2204 FT_UINT8, BASE_DEC, NULL, 0x0,
2205 "video_signal_type_present_flag", HFILL }
2207 { &hf_h264_video_format,
2208 { "video_format", "h264.video_format",
2209 FT_UINT8, BASE_DEC, NULL, 0x0,
2210 "video_format", HFILL }
2212 { &hf_h264_video_full_range_flag,
2213 { "video_full_range_flag", "h264.video_full_range_flag",
2214 FT_UINT8, BASE_DEC, NULL, 0x0,
2215 "video_full_range_flag", HFILL }
2217 { &hf_h264_colour_description_present_flag,
2218 { "colour_description_present_flag", "h264.colour_description_present_flag",
2219 FT_UINT8, BASE_DEC, NULL, 0x0,
2220 "colour_description_present_flag", HFILL }
2222 { &hf_h264_colour_primaries,
2223 { "colour_primaries", "h264.colour_primaries",
2224 FT_UINT8, BASE_DEC, NULL, 0x0,
2225 "colour_primaries", HFILL }
2227 { &hf_h264_transfer_characteristics,
2228 { "transfer_characteristics", "h264.transfer_characteristics",
2229 FT_UINT8, BASE_DEC, NULL, 0x0,
2230 "transfer_characteristics", HFILL }
2232 { &hf_h264_matrix_coefficients,
2233 { "matrix_coefficients", "h264.matrix_coefficients",
2234 FT_UINT8, BASE_DEC, NULL, 0x0,
2235 "matrix_coefficients", HFILL }
2237 { &hf_h264_chroma_loc_info_present_flag,
2238 { "chroma_loc_info_present_flag", "h264.chroma_loc_info_present_flag",
2239 FT_UINT8, BASE_DEC, NULL, 0x0,
2240 "chroma_loc_info_present_flag", HFILL }
2242 { &hf_h264_chroma_sample_loc_type_top_field,
2243 { "chroma_sample_loc_type_top_field", "h264.chroma_sample_loc_type_top_field",
2244 FT_UINT32, BASE_DEC, NULL, 0x0,
2245 "chroma_sample_loc_type_top_field", HFILL }
2247 { &hf_h264_chroma_sample_loc_type_bottom_field,
2248 { "chroma_sample_loc_type_bottom_field", "h264.chroma_sample_loc_type_bottom_field",
2249 FT_UINT32, BASE_DEC, NULL, 0x0,
2250 "chroma_sample_loc_type_bottom_field", HFILL }
2252 { &hf_h264_timing_info_present_flag,
2253 { "timing_info_present_flag", "h264.timing_info_present_flag",
2254 FT_UINT8, BASE_DEC, NULL, 0x0,
2255 "timing_info_present_flag", HFILL }
2257 { &hf_h264_num_units_in_tick,
2258 { "num_units_in_tick", "h264.num_units_in_tick",
2259 FT_UINT32, BASE_DEC, NULL, 0x0,
2260 "num_units_in_tick", HFILL }
2262 { &hf_h264_time_scale,
2263 { "time_scale", "h264.time_scale",
2264 FT_UINT32, BASE_DEC, NULL, 0x0,
2265 "time_scale", HFILL }
2267 { &hf_h264_fixed_frame_rate_flag,
2268 { "fixed_frame_rate_flag", "h264.fixed_frame_rate_flag",
2269 FT_UINT8, BASE_DEC, NULL, 0x0,
2270 "fixed_frame_rate_flag", HFILL }
2272 { &hf_h264_nal_hrd_parameters_present_flag,
2273 { "nal_hrd_parameters_present_flag", "h264.nal_hrd_parameters_present_flag",
2274 FT_UINT8, BASE_DEC, NULL, 0x0,
2275 "nal_hrd_parameters_present_flag", HFILL }
2277 { &hf_h264_vcl_hrd_parameters_present_flag,
2278 { "vcl_hrd_parameters_present_flag", "h264.vcl_hrd_parameters_present_flag",
2279 FT_UINT8, BASE_DEC, NULL, 0x0,
2280 "vcl_hrd_parameters_present_flag", HFILL }
2282 { &hf_h264_low_delay_hrd_flag,
2283 { "low_delay_hrd_flag", "h264.low_delay_hrd_flag",
2284 FT_UINT8, BASE_DEC, NULL, 0x0,
2285 "low_delay_hrd_flag", HFILL }
2287 { &hf_h264_pic_struct_present_flag,
2288 { "pic_struct_present_flag", "h264.pic_struct_present_flag",
2289 FT_UINT8, BASE_DEC, NULL, 0x0,
2290 "pic_struct_present_flag", HFILL }
2292 { &hf_h264_bitstream_restriction_flag,
2293 { "bitstream_restriction_flag", "h264.bitstream_restriction_flag",
2294 FT_UINT8, BASE_DEC, NULL, 0x0,
2295 "bitstream_restriction_flag", HFILL }
2297 { &hf_h264_motion_vectors_over_pic_boundaries_flag,
2298 { "motion_vectors_over_pic_boundaries_flag", "h264.motion_vectors_over_pic_boundaries_flag",
2299 FT_UINT32, BASE_DEC, NULL, 0x0,
2300 "motion_vectors_over_pic_boundaries_flag", HFILL }
2302 { &hf_h264_max_bytes_per_pic_denom,
2303 { "max_bytes_per_pic_denom", "h264.max_bytes_per_pic_denom",
2304 FT_UINT32, BASE_DEC, NULL, 0x0,
2305 "max_bytes_per_pic_denom", HFILL }
2307 { &hf_h264_max_bits_per_mb_denom,
2308 { "max_bits_per_mb_denom", "h264.max_bits_per_mb_denom",
2309 FT_UINT32, BASE_DEC, NULL, 0x0,
2310 "max_bits_per_mb_denom", HFILL }
2312 { &hf_h264_log2_max_mv_length_horizontal,
2313 { "max_mv_length_horizontal", "h264.max_mv_length_horizontal",
2314 FT_UINT32, BASE_DEC, NULL, 0x0,
2315 "max_mv_length_horizontal", HFILL }
2317 { &hf_h264_log2_max_mv_length_vertical,
2318 { "log2_max_mv_length_vertical", "h264.log2_max_mv_length_vertical",
2319 FT_UINT32, BASE_DEC, NULL, 0x0,
2320 "log2_max_mv_length_vertical", HFILL }
2322 { &hf_h264_num_reorder_frames,
2323 { "num_reorder_frames", "h264.num_reorder_frames",
2324 FT_UINT32, BASE_DEC, NULL, 0x0,
2325 "num_reorder_frames", HFILL }
2327 { &hf_h264_max_dec_frame_buffering,
2328 { "max_dec_frame_buffering", "h264.max_dec_frame_buffering",
2329 FT_UINT32, BASE_DEC, NULL, 0x0,
2330 "max_dec_frame_buffering", HFILL }
2332 { &hf_h264_cpb_cnt_minus1,
2333 { "cpb_cnt_minus1", "h264.cpb_cnt_minus1",
2334 FT_UINT32, BASE_DEC, NULL, 0x0,
2335 "cpb_cnt_minus1", HFILL }
2337 { &hf_h264_bit_rate_scale,
2338 { "bit_rate_scale", "h264.bit_rate_scale",
2339 FT_UINT8, BASE_DEC, NULL, 0x0,
2340 "bit_rate_scale", HFILL }
2342 { &hf_h264_cpb_size_scale,
2343 { "cpb_size_scale", "h264.cpb_size_scale",
2344 FT_UINT8, BASE_DEC, NULL, 0x0,
2345 "cpb_size_scale", HFILL }
2347 { &hf_h264_bit_rate_value_minus1,
2348 { "bit_rate_value_minus1", "h264.bit_rate_value_minus1",
2349 FT_UINT32, BASE_DEC, NULL, 0x0,
2350 "bit_rate_value_minus1", HFILL }
2352 { &hf_h264_cpb_size_value_minus1,
2353 { "cpb_size_value_minus1", "h264.cpb_size_value_minus1",
2354 FT_UINT32, BASE_DEC, NULL, 0x0,
2355 "cpb_size_value_minus1", HFILL }
2357 { &hf_h264_cbr_flag,
2358 { "cbr_flag", "h264.cbr_flag",
2359 FT_UINT8, BASE_DEC, NULL, 0x0,
2362 { &hf_h264_initial_cpb_removal_delay_length_minus1,
2363 { "initial_cpb_removal_delay_length_minus1", "h264.initial_cpb_removal_delay_length_minus1",
2364 FT_UINT8, BASE_DEC, NULL, 0x0,
2365 "initial_cpb_removal_delay_length_minus1", HFILL }
2367 { &hf_h264_cpb_removal_delay_length_minus1,
2368 { "cpb_removal_delay_length_minus1", "h264.cpb_removal_delay_length_minus1",
2369 FT_UINT8, BASE_DEC, NULL, 0x0,
2370 "cpb_removal_delay_length_minus1", HFILL }
2372 { &hf_h264_dpb_output_delay_length_minus11,
2373 { "dpb_output_delay_length_minus11", "h264.dpb_output_delay_length_minus11",
2374 FT_UINT8, BASE_DEC, NULL, 0x0,
2375 "dpb_output_delay_length_minus11", HFILL }
2377 { &hf_h264_time_offset_length,
2378 { "time_offset_length", "h264.time_offset_length",
2379 FT_UINT8, BASE_DEC, NULL, 0x0,
2380 "time_offset_length", HFILL }
2382 { &hf_h264_first_mb_in_slice,
2383 { "first_mb_in_slice", "h264.first_mb_in_slice",
2384 FT_UINT32, BASE_DEC, NULL, 0x0,
2385 "first_mb_in_slice", HFILL }
2387 { &hf_h264_slice_type,
2388 { "slice_type", "h264.slice_type",
2389 FT_UINT32, BASE_DEC, VALS(h264_slice_type_vals), 0x0,
2390 "slice_type", HFILL }
2392 { &hf_h264_slice_id,
2393 { "slice_id", "h264.slice_id",
2394 FT_UINT32, BASE_DEC, NULL, 0x0,
2397 { &hf_h264_frame_num,
2398 { "frame_num", "h264.frame_num",
2399 FT_UINT8, BASE_DEC, NULL, 0x0,
2400 "frame_num", HFILL }
2402 { &hf_h264_par_profile,
2403 { "Profile", "h264.profile",
2404 FT_UINT8, BASE_HEX, NULL, 0x00,
2406 { &hf_h264_par_profile_b,
2407 { "Baseline Profile", "h264.profile.base",
2408 FT_BOOLEAN, 8, NULL, 0x40,
2410 { &hf_h264_par_profile_m,
2411 { "Main Profile", "h264.profile.main",
2412 FT_BOOLEAN, 8, NULL, 0x20,
2414 { &hf_h264_par_profile_e,
2415 { "Extended Profile.", "h264.profile.ext",
2416 FT_BOOLEAN, 8, NULL, 0x10,
2418 { &hf_h264_par_profile_h,
2419 { "High Profile", "h264.profile.high",
2420 FT_BOOLEAN, 8, NULL, 0x08,
2422 { &hf_h264_par_profile_h10,
2423 { "High 10 Profile", "h264.profile.high10",
2424 FT_BOOLEAN, 8, NULL, 0x04,
2426 { &hf_h264_par_profile_h4_2_2,
2427 { "High 4:2:2 Profile", "h264.profile.high4_2_2",
2428 FT_BOOLEAN, 8, NULL, 0x02,
2430 { &hf_h264_par_profile_h4_4_4,
2431 { "High 4:4:4 Profile", "h264.profile.high4_4_4",
2432 FT_BOOLEAN, 8, NULL, 0x01,
2434 { &hf_h264_par_AdditionalModesSupported,
2435 { "AdditionalModesSupported", "h264.AdditionalModesSupported",
2436 FT_UINT8, BASE_HEX, NULL, 0x00,
2438 { &hf_h264_par_add_mode_sup,
2439 { "Additional Modes Supported", "h264.add_mode_sup",
2440 FT_UINT8, BASE_HEX, NULL, 0x00,
2442 { &hf_h264_par_add_mode_sup_rcdo,
2443 { "Reduced Complexity Decoding Operation (RCDO) support", "h264.add_mode_sup.rcdo",
2444 FT_BOOLEAN, 8, NULL, 0x40,
2446 { &hf_h264_par_ProfileIOP,
2447 { "ProfileIOP", "h264.ProfileIOP",
2448 FT_UINT8, BASE_HEX, NULL, 0x00,
2450 { &hf_h264_par_constraint_set0_flag,
2451 { "constraint_set0_flag", "h264.par.constraint_set0_flag",
2452 FT_BOOLEAN, 8, NULL, 0x80,
2454 { &hf_h264_par_constraint_set1_flag,
2455 { "constraint_set1_flag", "h264.par.constraint_set1_flag",
2456 FT_BOOLEAN, 8, NULL, 0x40,
2458 { &hf_h264_par_constraint_set2_flag,
2459 { "constraint_set2_flag", "h264.par.constraint_set2_flag",
2460 FT_BOOLEAN, 8, NULL, 0x20,
2464 /* Setup protocol subtree array */
2465 static gint *ett[] = {
2472 &ett_h264_par_profile,
2473 &ett_h264_par_AdditionalModesSupported,
2474 &ett_h264_par_ProfileIOP,
2477 /* Register the protocol name and description */
2478 proto_h264 = proto_register_protocol("H.264","H264", "h264");
2480 /* Required function calls to register the header fields and subtrees used */
2481 proto_register_field_array(proto_h264, hf, array_length(hf));
2482 proto_register_subtree_array(ett, array_length(ett));
2483 /* Register a configuration option for port */
2486 h264_module = prefs_register_protocol(proto_h264, proto_reg_handoff_h264);
2488 prefs_register_uint_preference(h264_module, "dynamic.payload.type",
2489 "H264 dynamic payload type",
2490 "The dynamic payload type which will be interpreted as H264"
2491 "; The value must be greater than 95",
2493 &temp_dynamic_payload_type);
2496 register_dissector("h264", dissect_h264, proto_h264);