Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
CSS
When i use the MediaStreamSource to playback a h264 file, is required that the MediaStreamSource reports to MediaElement that my stream it is ready to start to be send. So, to make it, i need to pass the information about SPS and PPS units of h264 file to CodecPrivateData atribute. However, how can i use it the correct form? How can i convert my decimal data to hex data, with filling this field of correct way?

Microsoft describes that:

CodecPrivateData Example: 0x00000001 SequenceParameterSet 0x00000001 PictureParameterSet
for example: "00000001674D401E965201405FF2E020100000000168EF3880"

And below have the SPS and PPS infos:

==================== NAL ====================

 forbidden_zero_bit : 0

 nal_ref_idc : 3

 nal_unit_type : 7 ( Sequence parameter set )

======= SPS =======

 profile_idc : 77

 constraint_set0_flag : 0

 constraint_set1_flag : 1

 constraint_set2_flag : 0

 constraint_set3_flag : 0

 constraint_set4_flag : 0

 constraint_set5_flag : 0

 reserved_zero_2bits : 0

 level_idc : 51

 seq_parameter_set_id : 0

 chroma_format_idc : 1

 residual_colour_transform_flag : 0

 bit_depth_luma_minus8 : 0

 bit_depth_chroma_minus8 : 0

 qpprime_y_zero_transform_bypass_flag : 0

 seq_scaling_matrix_present_flag : 0

 log2_max_frame_num_minus4 : 3

 pic_order_cnt_type : 0

   log2_max_pic_order_cnt_lsb_minus4 : 4

   delta_pic_order_always_zero_flag : 0

   offset_for_non_ref_pic : 0

   offset_for_top_to_bottom_field : 0

   num_ref_frames_in_pic_order_cnt_cycle : 0

 num_ref_frames : 1

 gaps_in_frame_num_value_allowed_flag : 0

 pic_width_in_mbs_minus1 : 23

 pic_height_in_map_units_minus1 : 17

 frame_mbs_only_flag : 1

 mb_adaptive_frame_field_flag : 0

 direct_8x8_inference_flag : 1

 frame_cropping_flag : 0

   frame_crop_left_offset : 0

   frame_crop_right_offset : 0

   frame_crop_top_offset : 0

   frame_crop_bottom_offset : 0

 vui_parameters_present_flag : 1


-----------------------------------------------------------------------------------------------------


==================== NAL ====================

 forbidden_zero_bit : 0

 nal_ref_idc : 3

 nal_unit_type : 8 ( Picture parameter set )

======= PPS =======

 pic_parameter_set_id : 0

 seq_parameter_set_id : 0

 entropy_coding_mode_flag : 1

 pic_order_present_flag : 0

 num_slice_groups_minus1 : 0

 slice_group_map_type : 0

 num_ref_idx_l0_active_minus1 : 0

 num_ref_idx_l1_active_minus1 : 0

 weighted_pred_flag : 0

 weighted_bipred_idc : 0

 pic_init_qp_minus26 : 0

 pic_init_qs_minus26 : 0

 chroma_qp_index_offset : 0

 deblocking_filter_control_present_flag : 1

 constrained_intra_pred_flag : 0

 redundant_pic_cnt_present_flag : 0

 transform_8x8_mode_flag : 0

 pic_scaling_matrix_present_flag : 0

 second_chroma_qp_index_offset : 0




How can i pass this data to the form that microsoft describes?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900