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>
46 /* Initialize the protocol and registered fields */
47 static int proto_h264 = -1;
48 static int hf_h264_type = -1;
49 static int hf_h264_nal_f_bit = -1;
50 static int hf_h264_nal_nri = -1;
51 static int hf_h264_profile = -1;
52 static int hf_h264_profile_idc = -1;
53 static int hf_h264_rbsp_stop_bit = -1;
54 static int hf_h264_rbsp_trailing_bits = -1;
55 static int hf_h264_constraint_set0_flag = -1;
56 static int hf_h264_constraint_set1_flag = -1;
57 static int hf_h264_constraint_set2_flag = -1;
58 static int hf_h264_constraint_set3_flag = -1;
59 static int hf_h264_reserved_zero_4bits = -1;
60 static int hf_h264_level_idc = -1;
61 static int hf_h264_nal_unit = -1;
62 static int hf_h264_forbidden_zero_bit = -1;
63 static int hf_h264_nal_ref_idc = -1;
64 static int hf_h264_nal_unit_type = -1;
65 static int hf_h264_seq_parameter_set_id = -1;
66 static int hf_h264_chroma_format_idc = -1;
67 static int hf_h264_residual_colour_transform_flag = -1;
68 static int hf_h264_bit_depth_luma_minus8 = -1;
69 static int hf_h264_bit_depth_chroma_minus8 = -1;
70 static int hf_h264_qpprime_y_zero_transform_bypass_flag = -1;
71 static int hf_h264_seq_scaling_matrix_present_flag = -1;
72 static int hf_h264_log2_max_frame_num_minus4 = -1;
73 static int hf_h264_pic_order_cnt_type = -1;
74 static int hf_h264_log2_max_pic_order_cnt_lsb_minus4 = -1;
75 static int hf_h264_delta_pic_order_always_zero_flag = -1;
76 static int hf_h264_offset_for_non_ref_pic = -1;
77 static int hf_h264_offset_for_top_to_bottom_field = -1;
78 static int hf_h264_num_ref_frames = -1;
79 static int hf_h264_gaps_in_frame_num_value_allowed_flag = -1;
80 static int hf_h264_pic_width_in_mbs_minus1 = -1;
81 static int hf_h264_pic_height_in_map_units_minus1 = -1;
82 static int hf_h264_frame_mbs_only_flag = -1;
83 static int hf_h264_mb_adaptive_frame_field_flag = -1;
84 static int hf_h264_direct_8x8_inference_flag = -1;
85 static int hf_h264_frame_cropping_flag = -1;
86 static int hf_h264_frame_crop_left_offset = -1;
87 static int hf_h264_frame_crop_right_offset = -1;
88 static int hf_h264_frame_crop_top_offset = -1;
89 static int hf_h264_frame_crop_bottom_offset = -1;
90 static int hf_h264_vui_parameters_present_flag = -1;
91 static int hf_h264_pic_parameter_set_id = -1;
92 static int hf_h264_entropy_coding_mode_flag = -1;
93 static int hf_h264_pic_order_present_flag = -1;
94 static int hf_h264_num_slice_groups_minus1 = -1;
95 static int hf_h264_slice_group_map_type = -1;
96 static int hf_h264_num_ref_idx_l0_active_minus1 = -1;
97 static int hf_h264_num_ref_idx_l1_active_minus1 = -1;
98 static int hf_h264_weighted_pred_flag = -1;
99 static int hf_h264_weighted_bipred_idc = -1;
100 static int hf_h264_pic_init_qp_minus26 = -1;
101 static int hf_h264_chroma_qp_index_offset = -1;
102 static int hf_h264_deblocking_filter_control_present_flag = -1;
103 static int hf_h264_constrained_intra_pred_flag = -1;
104 static int hf_h264_redundant_pic_cnt_present_flag = -1;
106 /* Initialize the subtree pointers */
107 static int ett_h264 = -1;
108 static int ett_h264_profile = -1;
109 static int ett_h264_nal = -1;
110 static int ett_h264_stream = -1;
111 static int ett_h264_nal_unit = -1;
113 /* The dynamic payload type which will be dissected as H.264 */
115 static guint dynamic_payload_type = 0;
116 static guint temp_dynamic_payload_type = 0;
118 static const true_false_string h264_f_bit_vals = {
119 "Bit errors or other syntax violations",
120 "No bit errors or other syntax violations"
123 #define SEQ_PAR_SET 7
124 #define PIC_PAR_SET 8
125 static const value_string h264_type_values[] = {
127 { 1, "NAL unit- Coded slice of a non-IDR picture" }, /* Single NAL unit packet per H.264 */
128 { 2, "NAL unit - Coded slice data partition A" },
129 { 3, "NAL unit - Coded slice data partition B" },
130 { 4, "NAL unit - Coded slice data partition C" },
131 { 5, "NAL unit - Coded slice of an IDR picture" },
132 { 6, "NAL unit - Supplemental enhancement information (SEI)" },
133 { SEQ_PAR_SET, "NAL unit - Sequence parameter set" }, /* 7 */
134 { PIC_PAR_SET, "NAL unit - Picture parameter set" }, /* 8 */
135 { 9, "NAL unit - Access unit delimiter" },
136 { 10, "NAL unit - End of sequence" },
137 { 11, "NAL unit - End of stream" },
138 { 12, "NAL unit - Filler data" },
139 { 13, "NAL unit - Sequence parameter set extension" },
140 { 14, "NAL unit - Reserved" },
141 { 15, "NAL unit - Reserved" },
142 { 16, "NAL unit - Reserved" },
143 { 17, "NAL unit - Reserved" },
144 { 18, "NAL unit - Reserved" },
145 { 19, "NAL unit - Coded slice of an auxiliary coded picture without partitioning" },
146 { 20, "NAL unit - Reserved" },
147 { 21, "NAL unit - Reserved" },
148 { 22, "NAL unit - Reserved" },
149 { 23, "NAL unit - Reserved" },
150 { 24, "STAP-A" }, /* Single-time aggregation packet */
151 { 25, "STAP-B" }, /* Single-time aggregation packet */
152 { 26, "MTAP16" }, /* Multi-time aggregation packet */
153 { 27, "MTAP24" }, /* Multi-time aggregation packet */
154 { 28, "FU-A" }, /* Fragmentation unit */
155 { 29, "FU-B" }, /* Fragmentation unit */
162 static const value_string h264_profile_idc_values[] = {
163 { 66, "Baseline profile" },
164 { 77, "Main profile" },
165 { 88, "Extended profile" },
166 { 100, "High profile" },
167 { 110, "High 10 profile" },
168 { 122, "High 4:2:2 profile" },
169 { 144, "High 4:4:4 profile" },
173 static const value_string h264_nal_unit_type_vals[] = {
174 { 0, "Unspecified" },
175 { 1, "Coded slice of a non-IDR picture" },
176 { 2, "Coded slice data partition A" },
177 { 3, "Coded slice data partition B" },
178 { 4, "Coded slice data partition C" },
179 { 5, "Coded slice of an IDR picture" },
180 { 6, "Supplemental enhancement information (SEI)" },
181 { 7, "Sequence parameter set" },
182 { 8, "Picture parameter set" },
183 { 9, "Access unit delimiter" },
184 { 10, "End of sequence" },
185 { 11, "End of stream" },
186 { 12, "Filler data" },
187 { 13, "Sequence parameter set extension" },
193 { 19, "Coded slice of an auxiliary coded picture without partitioning" },
198 { 24, "Unspecified" },
199 { 25, "Unspecified" },
200 { 26, "Unspecified" },
201 { 27, "Unspecified" },
202 { 28, "Unspecified" },
203 { 29, "Unspecified" },
204 { 30, "Unspecified" },
205 { 31, "Unspecified" },
209 /* Expect a tvb and a bit offset into the tvb
210 * returns the valu and bit_offset
214 dissect_h264_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint *start_bit_offset)
215 /*(tvbuff_t *tvb, gint *start_bit_offset) */
217 gint leading_zero_bits, bit_offset;
218 guint32 codenum, mask, value, tmp;
223 header_field_info *hf_field = NULL;
226 hf_field = proto_registrar_get_nth(hf_index);
228 bit_offset = *start_bit_offset;
230 /* prepare the string */
233 for(bit=0;bit<((int)(bit_offset&0x07));bit++){
241 leading_zero_bits = -1;
242 for( b = 0; !b; leading_zero_bits++ ){
249 b = tvb_get_bits8(tvb, bit_offset, 1);
259 if(leading_zero_bits==0){
269 strcat(str,hf_field->name);
270 if(hf_field->type==FT_UINT32){
271 switch(hf_field->display){
273 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
279 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
285 DISSECTOR_ASSERT_NOT_REACHED();
289 /* Only allow guint32 */
290 DISSECTOR_ASSERT_NOT_REACHED();
294 *start_bit_offset = bit_offset;
299 Syntax elements coded as ue(v), me(v), or se(v) are Exp-Golomb-coded. Syntax elements coded as te(v) are truncated
300 Exp-Golomb-coded. The parsing process for these syntax elements begins with reading the bits starting at the current
301 location in the bitstream up to and including the first non-zero bit, and counting the number of leading bits that are
302 equal to 0. This process is specified as follows:
303 leadingZeroBits = -1;
304 for( b = 0; !b; leadingZeroBits++ )
306 The variable codeNum is then assigned as follows:
307 codeNum = 2leadingZeroBits
\96 1 + read_bits( leadingZeroBits )
308 where the value returned from read_bits( leadingZeroBits ) is interpreted as a binary representation of an unsigned
309 integer with most significant bit written first.
312 codenum = codenum << leading_zero_bits;
314 value = tvb_get_bits8(tvb, bit_offset,leading_zero_bits );
315 codenum = (codenum-1) + value;
316 bit_offset = bit_offset + leading_zero_bits;
318 /* read the bits for the int */
319 for(i=0;i<leading_zero_bits;i++){
344 strcat(str,hf_field->name);
345 if(hf_field->type==FT_UINT32){
346 switch(hf_field->display){
348 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
354 proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum,
360 DISSECTOR_ASSERT_NOT_REACHED();
364 /* Only allow guint32 */
365 DISSECTOR_ASSERT_NOT_REACHED();
369 *start_bit_offset = bit_offset;
374 /* This funktion is adapted to parsing NAL units from SDP data where the
375 * base64 coding may add extra padding
379 more_rbsp_data(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
383 int remaining_length;
387 /* XXX might not be the best way of doing things but:
388 * Serch from the end of the tvb for the first '1' bit
389 * assuming that its's the RTBSP stop bit
392 /* Set offset to the byte we are treating */
393 offset = bit_offset>>3;
394 remaining_length = tvb_length_remaining(tvb,offset);
395 /* If there is more then 2 bytes left there *should* be more data */
396 if(remaining_length>2){
399 /* Start from last bit */
400 last_one_bit = (tvb_length(tvb) << 3);
404 b = tvb_get_bits8(tvb, last_one_bit, 1);
407 if( last_one_bit == bit_offset){
415 dissect_h264_rbsp_trailing_bits(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
419 proto_tree_add_bits_item(tree, hf_h264_rbsp_stop_bit, tvb, bit_offset, 1, FALSE);
422 remaining_bits = 8 - (bit_offset&0x7);
424 proto_tree_add_bits_item(tree, hf_h264_rbsp_trailing_bits, tvb, bit_offset, remaining_bits, FALSE);
426 return bit_offset+remaining_bits;
430 /* E.1.1 VUI parameters syntax */
432 dissect_h264_vui_parameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint bit_offset)
435 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
439 /* Used To dissect SDP parameter (H.264)profile */
441 dissect_h264_profile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
443 proto_item *item, *level_item;
444 proto_tree *h264_profile_tree;
446 guint8 constraint_set3_flag;
449 item = proto_tree_add_item(tree, hf_h264_profile, tvb, offset, -1, FALSE);
450 h264_profile_tree = proto_item_add_subtree(item, ett_h264_profile);
452 proto_tree_add_item(h264_profile_tree, hf_h264_profile_idc, tvb, offset, 1, FALSE);
455 constraint_set3_flag = (tvb_get_guint8(tvb,offset)&0x10)>>4;
456 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set0_flag, tvb, offset, 1, FALSE);
457 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set1_flag, tvb, offset, 1, FALSE);
458 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set2_flag, tvb, offset, 1, FALSE);
459 proto_tree_add_item(h264_profile_tree, hf_h264_constraint_set3_flag, tvb, offset, 1, FALSE);
460 proto_tree_add_item(h264_profile_tree, hf_h264_reserved_zero_4bits, tvb, offset, 1, FALSE);
463 /* A level to which the bitstream conforms shall be indicated by the syntax element level_idc as follows.
464 * - If level_idc is equal to 11 and constraint_set3_flag is equal to 1, the indicated level is level 1b.
465 * - Otherwise (level_idc is not equal to 11 or constraint_set3_flag is not equal to 1), level_idc shall
466 * be set equal to a value of ten times the level number specified in Table A-1 and constraint_set3_flag
467 * shall be set equal to 0.
470 level_idc = tvb_get_guint8(tvb,offset);
471 level_item = proto_tree_add_item(h264_profile_tree, hf_h264_level_idc, tvb, offset, 1, FALSE);
472 if((level_idc==11)&&(constraint_set3_flag==1)){
473 proto_item_append_text(level_item,"[Level 1b]");
475 proto_item_append_text(level_item,"[Level %.1f]",((double)level_idc/10));
482 dissect_h264_slice_layer_without_partitioning_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
484 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
489 dissect_h264_slice_data_partition_a_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
491 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
496 dissect_h264_slice_data_partition_b_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
498 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
503 dissect_h264_slice_data_partition_c_layer_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
505 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
511 dissect_h264_sei_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
513 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
517 /* Ref 7.3.2.1 Sequence parameter set RBSP syntax */
519 dissect_h264_seq_parameter_set_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset)
521 proto_item *level_item;
523 guint8 constraint_set3_flag;
527 guint8 profile_idc, chroma_format_idc, frame_mbs_only_flag, frame_cropping_flag;
528 guint8 pic_order_cnt_type, vui_parameters_present_flag, num_ref_frames_in_pic_order_cnt_cycle;
529 guint8 seq_scaling_matrix_present_flag;
531 /* profile_idc 0 u(8) */
532 profile_idc = tvb_get_guint8(tvb,offset);
533 proto_tree_add_item(tree, hf_h264_profile_idc, tvb, offset, 1, FALSE);
536 constraint_set3_flag = (tvb_get_guint8(tvb,offset)&0x10)>>4;
537 /* constraint_set0_flag 0 u(1) */
538 proto_tree_add_item(tree, hf_h264_constraint_set0_flag, tvb, offset, 1, FALSE);
540 /* constraint_set1_flag 0 u(1) */
541 proto_tree_add_item(tree, hf_h264_constraint_set1_flag, tvb, offset, 1, FALSE);
543 /* constraint_set2_flag 0 u(1) */
544 proto_tree_add_item(tree, hf_h264_constraint_set2_flag, tvb, offset, 1, FALSE);
546 /* constraint_set3_flag 0 u(1) */
547 proto_tree_add_item(tree, hf_h264_constraint_set3_flag, tvb, offset, 1, FALSE);
549 /* reserved_zero_4bits equal to 0 0 u(4)*/
550 proto_tree_add_item(tree, hf_h264_reserved_zero_4bits, tvb, offset, 1, FALSE);
553 /* level_idc 0 u(8) */
554 level_idc = tvb_get_guint8(tvb,offset);
555 level_item = proto_tree_add_item(tree, hf_h264_level_idc, tvb, offset, 1, FALSE);
556 if((level_idc==11)&&(constraint_set3_flag==1)){
557 proto_item_append_text(level_item,"[Level 1b]");
559 proto_item_append_text(level_item,"[Level %.1f]",((double)level_idc/10));
562 /* seq_parameter_set_id 0 ue(v)
563 * ue(v): unsigned integer Exp-Golomb-coded syntax element with the left bit first.
564 * The parsing process for this descriptor is specified in subclause 9.1.
566 bit_offset = offset<<3;
567 dissect_h264_exp_golomb_code(tree, hf_h264_seq_parameter_set_id, tvb, &bit_offset);
570 if( profile_idc == 100 || profile_idc == 110 ||
571 profile_idc == 122 || profile_idc == 144 ) {
573 /* chroma_format_idc 0 ue(v) */
574 chroma_format_idc = dissect_h264_exp_golomb_code(tree, hf_h264_chroma_format_idc, tvb, &bit_offset);
575 if( chroma_format_idc == 3 ){
576 /* residual_colour_transform_flag 0 u(1) */
577 proto_tree_add_bits_item(tree, hf_h264_residual_colour_transform_flag, tvb, bit_offset, 1, FALSE);
581 /* bit_depth_luma_minus8 0 ue(v) */
582 dissect_h264_exp_golomb_code(tree, hf_h264_bit_depth_luma_minus8, tvb, &bit_offset);
584 /* bit_depth_chroma_minus8 0 ue(v) */
585 dissect_h264_exp_golomb_code(tree, hf_h264_bit_depth_chroma_minus8, tvb, &bit_offset);
587 /* qpprime_y_zero_transform_bypass_flag 0 u(1) */
588 dissect_h264_exp_golomb_code(tree, hf_h264_qpprime_y_zero_transform_bypass_flag, tvb, &bit_offset);
590 /* seq_scaling_matrix_present_flag 0 u(1) */
591 seq_scaling_matrix_present_flag = dissect_h264_exp_golomb_code(tree, hf_h264_seq_scaling_matrix_present_flag, tvb, &bit_offset);
593 if( seq_scaling_matrix_present_flag )
594 for( i = 0; i < 8; i++ ) {
595 seq_scaling_list_present_flag[ i ] 0 u(1)
596 if( seq_scaling_list_present_flag[ i ] )
598 scaling_list( ScalingList4x4[ i ], 16,UseDefaultScalingMatrix4x4Flag[ i ])0
600 scaling_list( ScalingList8x8[ i
\96 6 ], 64,UseDefaultScalingMatrix8x8Flag[ i
\96 6 ] )0
604 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
608 /* log2_max_frame_num_minus4 0 ue(v) */
609 dissect_h264_exp_golomb_code(tree, hf_h264_log2_max_frame_num_minus4, tvb, &bit_offset);
611 /* pic_order_cnt_type 0 ue(v) */
612 offset = bit_offset>>3;
613 pic_order_cnt_type = dissect_h264_exp_golomb_code(tree,hf_h264_pic_order_cnt_type, tvb, &bit_offset);
615 if(pic_order_cnt_type == 0){
616 /* log2_max_pic_order_cnt_lsb_minus4 0 ue(v) */
617 dissect_h264_exp_golomb_code(tree, hf_h264_log2_max_pic_order_cnt_lsb_minus4, tvb, &bit_offset);
618 }else if(pic_order_cnt_type == 1) {
619 /* delta_pic_order_always_zero_flag 0 u(1) */
620 proto_tree_add_bits_item(tree, hf_h264_delta_pic_order_always_zero_flag, tvb, bit_offset, 1, FALSE);
622 /* offset_for_non_ref_pic 0 se(v) */
623 dissect_h264_exp_golomb_code(tree, hf_h264_offset_for_non_ref_pic, tvb, &bit_offset);
624 /* offset_for_top_to_bottom_field 0 se(v) */
625 dissect_h264_exp_golomb_code(tree, hf_h264_offset_for_top_to_bottom_field, tvb, &bit_offset);
626 /* num_ref_frames_in_pic_order_cnt_cycle 0 ue(v) */
627 num_ref_frames_in_pic_order_cnt_cycle = dissect_h264_exp_golomb_code(tree, -1, tvb, &bit_offset);
628 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
631 for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ )
633 /*offset_for_ref_frame[ i ] 0 se(v)*/
635 /* num_ref_frames 0 ue(v) */
636 dissect_h264_exp_golomb_code(tree, hf_h264_num_ref_frames, tvb, &bit_offset);
638 /* gaps_in_frame_num_value_allowed_flag 0 u(1) */
639 proto_tree_add_bits_item(tree, hf_h264_gaps_in_frame_num_value_allowed_flag, tvb, bit_offset, 1, FALSE);
642 /* pic_width_in_mbs_minus1 0 ue(v) */
643 dissect_h264_exp_golomb_code(tree, hf_h264_pic_width_in_mbs_minus1, tvb, &bit_offset);
645 /* pic_height_in_map_units_minus1 0 ue(v) */
646 dissect_h264_exp_golomb_code(tree, hf_h264_pic_height_in_map_units_minus1, tvb, &bit_offset);
648 /* frame_mbs_only_flag 0 u(1) */
649 frame_mbs_only_flag = tvb_get_bits8(tvb, bit_offset, 1);
650 proto_tree_add_bits_item(tree, hf_h264_frame_mbs_only_flag, tvb, bit_offset, 1, FALSE);
652 if( !frame_mbs_only_flag ){
653 /* mb_adaptive_frame_field_flag 0 u(1) */
654 proto_tree_add_bits_item(tree, hf_h264_mb_adaptive_frame_field_flag, tvb, bit_offset, 1, FALSE);
658 /* direct_8x8_inference_flag 0 u(1) */
659 proto_tree_add_bits_item(tree, hf_h264_direct_8x8_inference_flag, tvb, bit_offset, 1, FALSE);
662 /* frame_cropping_flag 0 u(1) */
663 frame_cropping_flag = tvb_get_bits8(tvb, bit_offset, 1);
664 proto_tree_add_bits_item(tree, hf_h264_frame_cropping_flag, tvb, bit_offset, 1, FALSE);
667 if(frame_cropping_flag) {
668 /* frame_crop_left_offset 0 ue(v) */
669 dissect_h264_exp_golomb_code(tree, hf_h264_frame_crop_left_offset, tvb, &bit_offset);
670 dissect_h264_exp_golomb_code(tree,hf_h264_frame_crop_right_offset, tvb, &bit_offset);
671 dissect_h264_exp_golomb_code(tree, hf_h264_frame_crop_top_offset, tvb, &bit_offset);
672 dissect_h264_exp_golomb_code(tree, hf_h264_frame_crop_bottom_offset, tvb, &bit_offset);
676 /* vui_parameters_present_flag 0 u(1) */
677 vui_parameters_present_flag = tvb_get_bits8(tvb, bit_offset, 1);
678 proto_tree_add_bits_item(tree, hf_h264_vui_parameters_present_flag, tvb, bit_offset>>3, 1, FALSE);
680 if(vui_parameters_present_flag){
681 dissect_h264_vui_parameters(tree, tvb, pinfo, bit_offset);
682 return; /* dissect_h264_vui_parameters No dissection yet */
685 /* rbsp_trailing_bits( ) 0 */
686 bit_offset = dissect_h264_rbsp_trailing_bits(tree, tvb, pinfo, bit_offset);
690 /* 7.3.2.2 Picture parameter set RBSP syntax */
693 dissect_h264_pic_parameter_set_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset)
697 guint32 num_slice_groups_minus1, slice_group_map_type;
699 bit_offset = offset<<3;
701 /* pic_parameter_set_id 1 ue(v) */
702 dissect_h264_exp_golomb_code(tree, hf_h264_pic_parameter_set_id, tvb, &bit_offset);
704 /* seq_parameter_set_id 1 ue(v) */
705 dissect_h264_exp_golomb_code(tree, hf_h264_seq_parameter_set_id, tvb, &bit_offset);
707 /* entropy_coding_mode_flag 1 u(1) */
708 proto_tree_add_bits_item(tree, hf_h264_entropy_coding_mode_flag, tvb, bit_offset, 1, FALSE);
711 /* pic_order_present_flag 1 u(1)*/
712 proto_tree_add_bits_item(tree, hf_h264_pic_order_present_flag, tvb, bit_offset, 1, FALSE);
715 /* num_slice_groups_minus1 1 ue(v)*/
716 num_slice_groups_minus1 = dissect_h264_exp_golomb_code(tree, hf_h264_num_slice_groups_minus1, tvb, &bit_offset);
717 if( num_slice_groups_minus1 > 0 ) {
718 /* slice_group_map_type 1 ue(v)*/
719 slice_group_map_type = dissect_h264_exp_golomb_code(tree, hf_h264_slice_group_map_type, tvb, &bit_offset);
720 /* if( slice_group_map_type = = 0 )*/
721 /* for( iGroup = 0; iGroup <= num_slice_groups_minus1; iGroup++ )*/
722 /* run_length_minus1[ iGroup ] 1 ue(v)*/
723 /* else if( slice_group_map_type = = 2 )*/
724 /* for( iGroup = 0; iGroup < num_slice_groups_minus1; iGroup++ ) {*/
725 /* top_left[ iGroup ] 1 ue(v)*/
726 /* bottom_right[ iGroup ] 1 ue(v)*/
728 /* else if( slice_group_map_type = = 3 ||*/
729 /* slice_group_map_type = = 4 ||*/
730 /* slice_group_map_type = = 5 ) {*/
731 /* slice_group_change_direction_flag 1 u(1)*/
732 /* slice_group_change_rate_minus1 1 ue(v)*/
733 /* } else if( slice_group_map_type = = 6 ) {*/
734 /* pic_size_in_map_units_minus1 1 ue(v)*/
735 /* for( i = 0; i <= pic_size_in_map_units_minus1; i++ )*/
736 /* slice_group_id[ i ] 1 u(v)*/
739 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
742 /* num_ref_idx_l0_active_minus1 1 ue(v)*/
743 dissect_h264_exp_golomb_code(tree, hf_h264_num_ref_idx_l0_active_minus1, tvb, &bit_offset);
745 /* num_ref_idx_l1_active_minus1 1 ue(v)*/
746 dissect_h264_exp_golomb_code(tree, hf_h264_num_ref_idx_l1_active_minus1, tvb, &bit_offset);
748 /* weighted_pred_flag 1 u(1)*/
749 proto_tree_add_bits_item(tree, hf_h264_weighted_pred_flag, tvb, bit_offset, 1, FALSE);
752 /* weighted_bipred_idc 1 u(2)*/
753 proto_tree_add_bits_item(tree, hf_h264_weighted_bipred_idc, tvb, bit_offset, 2, FALSE);
754 bit_offset= bit_offset+2;
756 /* pic_init_qp_minus26 * relative to 26 * 1 se(v)*/
757 dissect_h264_exp_golomb_code(tree, hf_h264_pic_init_qp_minus26, tvb, &bit_offset);
759 /* pic_init_qs_minus26 * relative to 26 * 1 se(v)*/
760 dissect_h264_exp_golomb_code(tree, hf_h264_pic_init_qp_minus26, tvb, &bit_offset);
762 /* chroma_qp_index_offset 1 se(v)*/
763 dissect_h264_exp_golomb_code(tree, hf_h264_chroma_qp_index_offset, tvb, &bit_offset);
765 /* deblocking_filter_control_present_flag 1 u(1)*/
766 proto_tree_add_bits_item(tree, hf_h264_deblocking_filter_control_present_flag, tvb, bit_offset, 1, FALSE);
769 /* constrained_intra_pred_flag 1 u(1)*/
770 proto_tree_add_bits_item(tree, hf_h264_constrained_intra_pred_flag, tvb, bit_offset, 1, FALSE);
773 /* redundant_pic_cnt_present_flag 1 u(1)*/
774 proto_tree_add_bits_item(tree, hf_h264_redundant_pic_cnt_present_flag, tvb, bit_offset, 1, FALSE);
777 if( more_rbsp_data(tree, tvb, pinfo, bit_offset)){
778 /* transform_8x8_mode_flag 1 u(1)*/
779 /* pic_scaling_matrix_present_flag 1 u(1)*/
780 /* if( pic_scaling_matrix_present_flag )*/
781 /* for( i = 0; i < 6 + 2* transform_8x8_mode_flag; i++ ) {*/
782 /* pic_scaling_list_present_flag[ i ] 1 u(1)*/
783 /* if( pic_scaling_list_present_flag[ i ] )*/
785 /* scaling_list( ScalingList4x4[ i ], 16,*/
786 /* UseDefaultScalingMatrix4x4Flag[ i ] )*/
789 /* scaling_list( ScalingList8x8[ i
\96 6 ], 64,*/
790 /* UseDefaultScalingMatrix8x8Flag[ i
\96 6 ] )*/
793 /* second_chroma_qp_index_offset 1 se(v)*/
794 proto_tree_add_text(tree, tvb, bit_offset>>3, -1, "[Not decoded yet]");
797 bit_offset = dissect_h264_rbsp_trailing_bits(tree, tvb, pinfo, bit_offset);
802 dissect_h264_access_unit_delimiter_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
804 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
809 dissect_h264_end_of_seq_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
811 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
816 dissect_h264_end_of_stream_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
818 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
823 dissect_h264_filler_data_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
825 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
830 dissect_h264_seq_parameter_set_extension_rbsp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
832 proto_tree_add_text(tree, tvb, offset, -1, "[Not decoded yet]");
837 /* Dissect NAL unit as recived in sprop-parameter-sets of SDP */
839 dissect_h264_nal_unit(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
842 proto_tree *h264_nal_tree;
844 guint8 nal_unit_type;
845 item = proto_tree_add_item(tree, hf_h264_nal_unit, tvb, offset, -1, FALSE);
846 h264_nal_tree = proto_item_add_subtree(item, ett_h264_nal_unit);
848 /* Ref: 7.3.1 NAL unit syntax */
849 nal_unit_type = tvb_get_guint8(tvb,offset) & 0x1f;
851 /* forbidden_zero_bit All f(1) */
852 proto_tree_add_item(h264_nal_tree, hf_h264_forbidden_zero_bit, tvb, offset, 1, FALSE);
853 /* nal_ref_idc All u(2) */
854 proto_tree_add_item(h264_nal_tree, hf_h264_nal_ref_idc, tvb, offset, 1, FALSE);
855 /* nal_unit_type All u(5) */
856 proto_tree_add_item(h264_nal_tree, hf_h264_nal_unit_type, tvb, offset, 1, FALSE);
859 switch(nal_unit_type){
860 case 0: /* Unspecified */
861 proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Unspecified NAL unit type");
863 case 1: /* Coded slice of a non-IDR picture */
864 dissect_h264_slice_layer_without_partitioning_rbsp(h264_nal_tree, tvb, pinfo, offset);
866 case 2: /* Coded slice data partition A */
867 dissect_h264_slice_data_partition_a_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
869 case 3: /* Coded slice data partition B */
870 dissect_h264_slice_data_partition_b_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
872 case 4: /* Coded slice data partition C */
873 dissect_h264_slice_data_partition_c_layer_rbsp(h264_nal_tree, tvb, pinfo, offset);
875 case 5: /* Coded slice of an IDR picture */
876 dissect_h264_slice_layer_without_partitioning_rbsp(h264_nal_tree, tvb, pinfo, offset);
878 case 6: /* Supplemental enhancement information (SEI) */
879 dissect_h264_sei_rbsp(h264_nal_tree, tvb, pinfo, offset);
881 case SEQ_PAR_SET: /* 7 Sequence parameter set*/
882 dissect_h264_seq_parameter_set_rbsp(h264_nal_tree, tvb, pinfo, offset);
884 case PIC_PAR_SET: /* 8 Picture parameter set */
885 dissect_h264_pic_parameter_set_rbsp(h264_nal_tree, tvb, pinfo, offset);
887 case 9: /* Access unit delimiter */
888 dissect_h264_access_unit_delimiter_rbsp(h264_nal_tree, tvb, pinfo, offset);
890 case 10: /* End of sequence */
891 dissect_h264_end_of_seq_rbsp(h264_nal_tree, tvb, pinfo, offset);
893 case 11: /* End of stream */
894 dissect_h264_end_of_stream_rbsp(h264_nal_tree, tvb, pinfo, offset);
896 case 12: /* Filler data */
897 dissect_h264_filler_data_rbsp(h264_nal_tree, tvb, pinfo, offset);
899 case 13: /* Sequence parameter set extension */
900 dissect_h264_seq_parameter_set_extension_rbsp(h264_nal_tree, tvb, pinfo, offset);
902 case 14: /* Reserved */
903 case 15: /* Reserved */
904 case 16: /* Reserved */
905 case 17: /* Reserved */
906 case 18: /* Reserved */
907 proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Reserved NAL unit type");
909 case 19: /* Coded slice of an auxiliary coded picture without partitioning */
910 dissect_h264_slice_layer_without_partitioning_rbsp(tree, tvb, pinfo, offset);
913 /* 24..31 Unspecified */
914 proto_tree_add_text(h264_nal_tree, tvb, offset, -1, "Unspecified NAL unit type");
919 /* Code to actually dissect the packets */
921 dissect_h264(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
924 proto_item *item, *ti, *stream_item;
925 proto_tree *h264_tree, *h264_nal_tree, *stream_tree;
929 /* Make entries in Protocol column and Info column on summary display */
930 if (check_col(pinfo->cinfo, COL_PROTOCOL))
931 col_set_str(pinfo->cinfo, COL_PROTOCOL, "H264");
934 item = proto_tree_add_item(tree, proto_h264, tvb, 0, -1, FALSE);
935 h264_tree = proto_item_add_subtree(item, ett_h264);
937 ti = proto_tree_add_text(h264_tree, tvb, offset, 1, "NAL unit header or first byte of the payload");
938 h264_nal_tree = proto_item_add_subtree(ti, ett_h264_nal);
947 * forbidden_zero_bit. A value of 0 indicates that the NAL unit type
948 * octet and payload should not contain bit errors or other syntax
949 * violations. A value of 1 indicates that the NAL unit type octet
950 * and payload may contain bit errors or other syntax violations.
952 proto_tree_add_item(h264_nal_tree, hf_h264_nal_f_bit, tvb, offset, 1, FALSE);
953 proto_tree_add_item(h264_nal_tree, hf_h264_nal_nri, tvb, offset, 1, FALSE);
954 type = tvb_get_guint8(tvb,offset)&0x1f;
955 proto_tree_add_item(h264_nal_tree, hf_h264_type, tvb, offset, 1, FALSE);
957 stream_item =proto_tree_add_text(h264_tree, tvb, offset, -1, "H264 bitstream");
958 stream_tree = proto_item_add_subtree(stream_item, ett_h264_stream);
960 case SEQ_PAR_SET: /* 7 Sequence parameter set*/
961 dissect_h264_seq_parameter_set_rbsp(stream_tree, tvb, pinfo, offset);
963 case PIC_PAR_SET: /* 8 Picture parameter set */
964 dissect_h264_pic_parameter_set_rbsp(h264_nal_tree, tvb, pinfo, offset);
974 /* Register the protocol with Wireshark */
975 /* If this dissector uses sub-dissector registration add a registration routine.
976 This format is required because a script is used to find these routines and
977 create the code that calls these routines.
980 proto_reg_handoff_h264(void)
982 dissector_handle_t h264_handle;
983 static int h264_prefs_initialized = FALSE;
985 h264_handle = create_dissector_handle(dissect_h264, proto_h264);
987 if (!h264_prefs_initialized) {
988 h264_prefs_initialized = TRUE;
991 if ( dynamic_payload_type > 95 )
992 dissector_delete("rtp.pt", dynamic_payload_type, h264_handle);
994 dynamic_payload_type = temp_dynamic_payload_type;
996 if ( dynamic_payload_type > 95 ){
997 dissector_add("rtp.pt", dynamic_payload_type, h264_handle);
999 dissector_add_string("rtp_dyn_payload_type","H264", h264_handle);
1003 /* this format is require because a script is used to build the C function
1004 that calls all the protocol registration.
1008 proto_register_h264(void)
1011 module_t *h264_module;
1013 /* Setup list of header fields See Section 1.6.1 for details*/
1014 static hf_register_info hf[] = {
1015 { &hf_h264_nal_f_bit,
1016 { "F bit", "h264.f",
1017 FT_BOOLEAN, 8, TFS(&h264_f_bit_vals), 0x80,
1021 { "Nal_ref_idc (NRI)", "h264.nal_nri",
1022 FT_UINT8, BASE_DEC, NULL, 0x60,
1026 { "Type", "h264.nal_unit_hdr",
1027 FT_UINT8, BASE_DEC, VALS(h264_type_values), 0x1f,
1031 { "Profile", "h264.profile",
1032 FT_BYTES, BASE_NONE, NULL, 0x0,
1035 { &hf_h264_profile_idc,
1036 { "Profile_idc", "h264.profile_idc",
1037 FT_UINT8, BASE_DEC, VALS(h264_profile_idc_values), 0xff,
1038 "Profile_idc", HFILL }
1040 { &hf_h264_rbsp_stop_bit,
1041 { "rbsp_stop_bit", "h264.rbsp_stop_bit",
1042 FT_UINT8, BASE_DEC, NULL, 0x0,
1043 "rbsp_stop_bit", HFILL }
1045 { &hf_h264_rbsp_trailing_bits,
1046 { "rbsp_trailing_bits", "h264.rbsp_trailing_bits",
1047 FT_UINT8, BASE_DEC, NULL, 0x0,
1048 "rbsp_trailing_bits", HFILL }
1050 { &hf_h264_constraint_set0_flag,
1051 { "Constraint_set0_flag", "h264.constraint_set0_flag",
1052 FT_UINT8, BASE_DEC, NULL, 0x80,
1053 "Constraint_set0_flag", HFILL }
1055 { &hf_h264_constraint_set1_flag,
1056 { "Constraint_set1_flag", "h264.constraint_set1_flag",
1057 FT_UINT8, BASE_DEC, NULL, 0x40,
1058 "Constraint_set1_flag", HFILL }
1060 { &hf_h264_constraint_set2_flag,
1061 { "Constraint_set1_flag", "h264.constraint_set2_flag",
1062 FT_UINT8, BASE_DEC, NULL, 0x20,
1065 { &hf_h264_constraint_set3_flag,
1066 { "Constraint_set3_flag", "h264.constraint_set3_flag",
1067 FT_UINT8, BASE_DEC, NULL, 0x10,
1068 "Constraint_set3_flag", HFILL }
1070 { &hf_h264_reserved_zero_4bits,
1071 { "Reserved_zero_4bits", "h264.reserved_zero_4bits",
1072 FT_UINT8, BASE_DEC, NULL, 0x0f,
1073 "Reserved_zero_4bits", HFILL }
1075 { &hf_h264_level_idc,
1076 { "Level_id", "h264.level_id",
1077 FT_UINT8, BASE_DEC, NULL, 0xff,
1080 { &hf_h264_nal_unit,
1081 { "NAL unit", "h264.nal_unit",
1082 FT_BYTES, BASE_NONE, NULL, 0x0,
1085 { &hf_h264_forbidden_zero_bit,
1086 { "Forbidden_zero_bit", "h264.forbidden_zero_bit",
1087 FT_UINT8, BASE_DEC, NULL, 0x80,
1088 "forbidden_zero_bit", HFILL }
1090 { &hf_h264_nal_ref_idc,
1091 { "Nal_ref_idc", "h264.nal_ref_idc",
1092 FT_UINT8, BASE_DEC, NULL, 0x60,
1093 "nal_ref_idc", HFILL }
1095 {&hf_h264_nal_unit_type,
1096 { "Nal_unit_type", "h264.nal_unit_type",
1097 FT_UINT8, BASE_DEC, VALS(h264_nal_unit_type_vals), 0x1f,
1098 "nal_unit_type", HFILL }
1100 { &hf_h264_seq_parameter_set_id,
1101 { "seq_parameter_set_id", "h264.seq_parameter_set_id",
1102 FT_UINT32, BASE_DEC, NULL, 0x0,
1103 "seq_parameter_set_id", HFILL }
1105 { &hf_h264_chroma_format_idc,
1106 { "chroma_format_id", "h264.chroma_format_id",
1107 FT_UINT32, BASE_DEC, NULL, 0x0,
1108 "chroma_format_id", HFILL }
1110 { &hf_h264_residual_colour_transform_flag,
1111 { "residual_colour_transform_flag", "h264.residual_colour_transform_flag",
1112 FT_UINT8, BASE_DEC, NULL, 0x0,
1113 "residual_colour_transform_flag", HFILL }
1115 { &hf_h264_bit_depth_luma_minus8,
1116 { "bit_depth_luma_minus8", "h264.bit_depth_luma_minus8",
1117 FT_UINT32, BASE_DEC, NULL, 0x0,
1118 "bit_depth_luma_minus8", HFILL }
1120 { &hf_h264_bit_depth_chroma_minus8,
1121 { "bit_depth_chroma_minus8", "h264.bit_depth_chroma_minus8",
1122 FT_UINT32, BASE_DEC, NULL, 0x0,
1123 "bit_depth_chroma_minus8", HFILL }
1125 { &hf_h264_qpprime_y_zero_transform_bypass_flag,
1126 { "qpprime_y_zero_transform_bypass_flag", "h264.qpprime_y_zero_transform_bypass_flag",
1127 FT_UINT32, BASE_DEC, NULL, 0x0,
1128 "qpprime_y_zero_transform_bypass_flag", HFILL }
1130 { &hf_h264_seq_scaling_matrix_present_flag,
1131 { "seq_scaling_matrix_present_flag", "h264.seq_scaling_matrix_present_flag",
1132 FT_UINT32, BASE_DEC, NULL, 0x0,
1133 "seq_scaling_matrix_present_flag", HFILL }
1135 { &hf_h264_log2_max_frame_num_minus4,
1136 { "log2_max_frame_num_minus4", "h264.log2_max_frame_num_minus4",
1137 FT_UINT32, BASE_DEC, NULL, 0x0,
1138 "log2_max_frame_num_minus4", HFILL }
1140 { &hf_h264_pic_order_cnt_type,
1141 { "pic_order_cnt_type", "h264.pic_order_cnt_type",
1142 FT_UINT32, BASE_DEC, NULL, 0x0,
1143 "pic_order_cnt_type", HFILL }
1145 { &hf_h264_log2_max_pic_order_cnt_lsb_minus4,
1146 { "log2_max_pic_order_cnt_lsb_minus4", "h264.log2_max_pic_order_cnt_lsb_minus4",
1147 FT_UINT32, BASE_DEC, NULL, 0x0,
1148 "log2_max_pic_order_cnt_lsb_minus4", HFILL }
1150 { &hf_h264_delta_pic_order_always_zero_flag,
1151 { "delta_pic_order_always_zero_flag", "h264.delta_pic_order_always_zero_flag",
1152 FT_UINT8, BASE_DEC, NULL, 0x0,
1153 "delta_pic_order_always_zero_flag", HFILL }
1155 { &hf_h264_offset_for_non_ref_pic,
1156 { "offset_for_non_ref_pic", "h264.offset_for_non_ref_pic",
1157 FT_UINT32, BASE_DEC, NULL, 0x0,
1158 "offset_for_non_ref_pic", HFILL }
1160 { &hf_h264_offset_for_top_to_bottom_field,
1161 { "offset_for_top_to_bottom_field", "h264.offset_for_top_to_bottom_field",
1162 FT_UINT32, BASE_DEC, NULL, 0x0,
1163 "offset_for_top_to_bottom_field", HFILL }
1165 { &hf_h264_num_ref_frames,
1166 { "num_ref_frames", "h264.num_ref_frames",
1167 FT_UINT32, BASE_DEC, NULL, 0x0,
1168 "num_ref_frames", HFILL }
1170 { &hf_h264_gaps_in_frame_num_value_allowed_flag,
1171 { "gaps_in_frame_num_value_allowed_flag", "h264.gaps_in_frame_num_value_allowed_flag",
1172 FT_UINT8, BASE_DEC, NULL, 0x0,
1173 "gaps_in_frame_num_value_allowed_flag", HFILL }
1175 { &hf_h264_pic_width_in_mbs_minus1,
1176 { "pic_width_in_mbs_minus1", "h264.pic_width_in_mbs_minus1",
1177 FT_UINT32, BASE_DEC, NULL, 0x0,
1178 "pic_width_in_mbs_minus1", HFILL }
1180 { &hf_h264_pic_height_in_map_units_minus1,
1181 { "pic_height_in_map_units_minus1", "h264.pic_height_in_map_units_minus1",
1182 FT_UINT32, BASE_DEC, NULL, 0x0,
1183 "pic_height_in_map_units_minus1", HFILL }
1185 { &hf_h264_frame_mbs_only_flag,
1186 { "frame_mbs_only_flag", "h264.frame_mbs_only_flag",
1187 FT_UINT8, BASE_DEC, NULL, 0x0,
1188 "frame_mbs_only_flag", HFILL }
1190 { &hf_h264_mb_adaptive_frame_field_flag,
1191 { "mb_adaptive_frame_field_flag", "h264.mb_adaptive_frame_field_flag",
1192 FT_UINT8, BASE_DEC, NULL, 0x0,
1193 "mb_adaptive_frame_field_flag", HFILL }
1195 { &hf_h264_direct_8x8_inference_flag,
1196 { "direct_8x8_inference_flag", "h264.direct_8x8_inference_flag",
1197 FT_UINT8, BASE_DEC, NULL, 0x0,
1198 "direct_8x8_inference_flag", HFILL }
1200 { &hf_h264_frame_cropping_flag,
1201 { "frame_cropping_flag", "h264.frame_cropping_flag",
1202 FT_UINT8, BASE_DEC, NULL, 0x0,
1203 "frame_cropping_flag", HFILL }
1205 { &hf_h264_frame_crop_left_offset,
1206 { "frame_crop_left_offset", "h264.frame_crop_left_offset",
1207 FT_UINT32, BASE_DEC, NULL, 0x0,
1208 "frame_crop_left_offset", HFILL }
1210 { &hf_h264_frame_crop_right_offset,
1211 { "frame_crop_left_offset", "h264.frame_crop_right_offset",
1212 FT_UINT32, BASE_DEC, NULL, 0x0,
1213 "frame_crop_right_offset", HFILL }
1215 { &hf_h264_frame_crop_top_offset,
1216 { "frame_crop_top_offset", "h264.frame_crop_top_offset",
1217 FT_UINT32, BASE_DEC, NULL, 0x0,
1218 "frame_crop_top_offset", HFILL }
1220 { &hf_h264_frame_crop_bottom_offset,
1221 { "frame_crop_bottom_offset", "h264.frame_crop_bottom_offset",
1222 FT_UINT32, BASE_DEC, NULL, 0x0,
1223 "frame_crop_bottom_offset", HFILL }
1225 { &hf_h264_vui_parameters_present_flag,
1226 { "vui_parameters_present_flag", "h264.vui_parameters_present_flag",
1227 FT_UINT8, BASE_DEC, NULL, 0x0,
1228 "vui_parameters_present_flag", HFILL }
1230 { &hf_h264_pic_parameter_set_id,
1231 { "pic_parameter_set_id", "h264.pic_parameter_set_id",
1232 FT_UINT32, BASE_DEC, NULL, 0x0,
1233 "pic_parameter_set_id", HFILL }
1235 { &hf_h264_entropy_coding_mode_flag,
1236 { "entropy_coding_mode_flag", "h264.entropy_coding_mode_flag",
1237 FT_UINT8, BASE_DEC, NULL, 0x0,
1238 "entropy_coding_mode_flag", HFILL }
1240 { &hf_h264_pic_order_present_flag,
1241 { "pic_order_present_flag", "h264.pic_order_present_flag",
1242 FT_UINT8, BASE_DEC, NULL, 0x0,
1243 "pic_order_present_flag", HFILL }
1245 { &hf_h264_num_slice_groups_minus1,
1246 { "num_slice_groups_minus1", "h264.num_slice_groups_minus1",
1247 FT_UINT32, BASE_DEC, NULL, 0x0,
1248 "num_slice_groups_minus1", HFILL }
1250 { &hf_h264_slice_group_map_type,
1251 { "slice_group_map_type", "h264.slice_group_map_type",
1252 FT_UINT32, BASE_DEC, NULL, 0x0,
1253 "slice_group_map_type", HFILL }
1255 { &hf_h264_num_ref_idx_l0_active_minus1,
1256 { "num_ref_idx_l0_active_minus1", "h264.num_ref_idx_l0_active_minus1",
1257 FT_UINT32, BASE_DEC, NULL, 0x0,
1258 "num_ref_idx_l0_active_minus1", HFILL }
1260 { &hf_h264_num_ref_idx_l1_active_minus1,
1261 { "num_ref_idx_l1_active_minus1", "h264.num_ref_idx_l1_active_minus1",
1262 FT_UINT32, BASE_DEC, NULL, 0x0,
1263 "num_ref_idx_l1_active_minus1", HFILL }
1265 { &hf_h264_weighted_pred_flag,
1266 { "weighted_pred_flag", "h264.weighted_pred_flag",
1267 FT_UINT8, BASE_DEC, NULL, 0x0,
1268 "weighted_pred_flag", HFILL }
1270 { &hf_h264_weighted_bipred_idc,
1271 { "weighted_bipred_idc", "h264.weighted_bipred_idc",
1272 FT_UINT8, BASE_DEC, NULL, 0x0,
1273 "weighted_bipred_idc", HFILL }
1275 { &hf_h264_pic_init_qp_minus26,
1276 { "pic_init_qp_minus26", "h264.pic_init_qp_minus26",
1277 FT_UINT32, BASE_DEC, NULL, 0x0,
1278 "pic_init_qp_minus26", HFILL }
1280 { &hf_h264_chroma_qp_index_offset,
1281 { "chroma_qp_index_offset", "h264.chroma_qp_index_offset",
1282 FT_UINT32, BASE_DEC, NULL, 0x0,
1283 "chroma_qp_index_offset", HFILL }
1285 { &hf_h264_deblocking_filter_control_present_flag,
1286 { "deblocking_filter_control_present_flag", "h264.deblocking_filter_control_present_flag",
1287 FT_UINT8, BASE_DEC, NULL, 0x0,
1288 "deblocking_filter_control_present_flag", HFILL }
1290 { &hf_h264_constrained_intra_pred_flag,
1291 { "constrained_intra_pred_flag", "h264.constrained_intra_pred_flag",
1292 FT_UINT8, BASE_DEC, NULL, 0x0,
1293 "constrained_intra_pred_flag", HFILL }
1295 { &hf_h264_redundant_pic_cnt_present_flag,
1296 { "redundant_pic_cnt_present_flag", "h264.redundant_pic_cnt_present_flag",
1297 FT_UINT8, BASE_DEC, NULL, 0x0,
1298 "redundant_pic_cnt_present_flag", HFILL }
1302 /* Setup protocol subtree array */
1303 static gint *ett[] = {
1311 /* Register the protocol name and description */
1312 proto_h264 = proto_register_protocol("H.264","H264", "h264");
1314 /* Required function calls to register the header fields and subtrees used */
1315 proto_register_field_array(proto_h264, hf, array_length(hf));
1316 proto_register_subtree_array(ett, array_length(ett));
1317 /* Register a configuration option for port */
1320 h264_module = prefs_register_protocol(proto_h264, proto_reg_handoff_h264);
1322 prefs_register_uint_preference(h264_module, "dynamic.payload.type",
1323 "H264 dynamic payload type",
1324 "The dynamic payload type which will be interpreted as H264",
1326 &temp_dynamic_payload_type);
1329 register_dissector("h264", dissect_h264, proto_h264);