Commit f362c828 authored by François Grisez's avatar François Grisez

Renames update_picture_size_with_sps() into ms_h264_sps_get_video_size()

parent a84142e0
......@@ -55,7 +55,7 @@ typedef struct _DecData {
static int dec_init_mediacodec(DecData *d) {
AMediaFormat *format;
media_status_t status = 0;
MSVideoSize initial_size={0};
if (d->codec == NULL){
d->codec = AMediaCodec_createDecoderByType("video/avc");
if (d->codec == NULL){
......@@ -68,7 +68,7 @@ static int dec_init_mediacodec(DecData *d) {
AMediaFormat_setString(format, "mime", "video/avc");
//Size mandatory for decoder configuration
if(d->sps) {
update_picture_size_with_sps(d->sps, &initial_size);
MSVideoSize initial_size = ms_h264_sps_get_video_size(d->sps);
AMediaFormat_setInt32(format, "width", initial_size.width);
AMediaFormat_setInt32(format, "height", initial_size.height);
}
......
......@@ -122,8 +122,8 @@ void ms_h264_stream_to_nalus(const uint8_t *frame, size_t size, MSQueue *nalus,
}
}
void update_picture_size_with_sps(const mblk_t* sps, MSVideoSize *video_size) {
MSVideoSize ms_h264_sps_get_video_size(const mblk_t* sps) {
MSVideoSize video_size;
MSBitsReader reader;
unsigned int profile_idc;
unsigned int pic_order_cnt_type;
......@@ -191,23 +191,23 @@ void update_picture_size_with_sps(const mblk_t* sps, MSVideoSize *video_size) {
ms_bits_reader_n_bits(&reader, 1, &frame_cropping_flag, "frame_cropping_flag");
if (frame_cropping_flag) {
unsigned int frame_crop_left_offset;
unsigned int frame_crop_right_offset;
unsigned int frame_crop_top_offset;
unsigned int frame_crop_bottom_offset;
ms_bits_reader_ue(&reader, &frame_crop_left_offset, "frame_crop_left_offset");
ms_bits_reader_ue(&reader, &frame_crop_right_offset, "frame_crop_right_offset");
video_size->width = ((pic_width_in_mbs_minus1+1)*16)-frame_crop_left_offset*2-frame_crop_right_offset*2;
video_size.width = ((pic_width_in_mbs_minus1+1)*16)-frame_crop_left_offset*2-frame_crop_right_offset*2;
ms_bits_reader_ue(&reader, &frame_crop_top_offset, "frame_crop_top_offset");
ms_bits_reader_ue(&reader, &frame_crop_bottom_offset, "frame_crop_bottom_offset");
video_size->height = ((2-frame_mbs_only_flag)*(pic_height_in_map_units_minus1+1)*16)-(frame_crop_top_offset*2)-(frame_crop_bottom_offset*2);
video_size.height = ((2-frame_mbs_only_flag)*(pic_height_in_map_units_minus1+1)*16)-(frame_crop_top_offset*2)-(frame_crop_bottom_offset*2);
}
else {
video_size->width = (pic_width_in_mbs_minus1+1)*16;
video_size->height = (2-frame_mbs_only_flag)*(pic_height_in_map_units_minus1+1)*16;
video_size.width = (pic_width_in_mbs_minus1+1)*16;
video_size.height = (2-frame_mbs_only_flag)*(pic_height_in_map_units_minus1+1)*16;
}
ms_bits_reader_n_bits(&reader, 1, NULL, "vui_parameters_present_flag");
return video_size;
}
......@@ -76,8 +76,10 @@ void ms_h264_bitstream_to_nalus(const uint8_t *bitstream, size_t size, MSQueue *
void ms_h264_stream_to_nalus(const uint8_t *frame, size_t size, MSQueue *nalus, int *idr_count);
/**
* Set the video size from sps
* @param sps The sps unit to read
* @brief Extract video size from a SPS NALu.
* @param sps A mblk_t holding the SPS.
* @return The video size.
*/
void update_picture_size_with_sps(const mblk_t* sps, MSVideoSize *video_size);
MSVideoSize ms_h264_sps_get_video_size(const mblk_t* sps);
#endif /* defined(H264_UTILS_H) */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment