Commit 1a981692 authored by François Cartegnie's avatar François Cartegnie 🤞

codec: hxxx_helper: refactor using codec

parent 6406ad5a
......@@ -687,26 +687,50 @@ h264_helper_get_current_sps(const struct hxxx_helper *hh)
}
int
h264_helper_get_current_picture_size(const struct hxxx_helper *hh,
hxxx_helper_get_current_picture_size(const struct hxxx_helper *hh,
unsigned *p_w, unsigned *p_h,
unsigned *p_vw, unsigned *p_vh)
{
const struct hxxx_helper_nal *hsps = h264_helper_get_current_sps(hh);
if (hsps == NULL)
return VLC_EGENERIC;
return h264_get_picture_size(hsps->h264_sps, p_w, p_h, p_vw, p_vh) ?
VLC_SUCCESS : VLC_EGENERIC;
if(hh->i_codec == VLC_CODEC_H264)
{
const struct hxxx_helper_nal *hsps = h264_helper_get_current_sps(hh);
if (hsps && h264_get_picture_size(hsps->h264_sps, p_w, p_h, p_vw, p_vh))
return VLC_SUCCESS;
}
else if(hh->i_codec == VLC_CODEC_HEVC)
{
const struct hxxx_helper_nal *hsps = &hh->hevc.sps_list[hh->hevc.i_current_sps];
if(hsps && hevc_get_picture_size(hsps->hevc_sps, p_w, p_h, p_vw, p_vh))
return VLC_SUCCESS;
}
return VLC_EGENERIC;
}
int
h264_helper_get_current_sar(const struct hxxx_helper *hh, int *p_num, int *p_den)
hxxx_helper_get_current_sar(const struct hxxx_helper *hh, int *p_num, int *p_den)
{
const struct hxxx_helper_nal *hsps = h264_helper_get_current_sps(hh);
if (hsps == NULL)
return VLC_EGENERIC;
*p_num = hsps->h264_sps->vui.i_sar_num;
*p_den = hsps->h264_sps->vui.i_sar_den;
return VLC_SUCCESS;
if(hh->i_codec == VLC_CODEC_H264)
{
const struct hxxx_helper_nal *hsps = h264_helper_get_current_sps(hh);
if (hsps)
{
*p_num = hsps->h264_sps->vui.i_sar_num;
*p_den = hsps->h264_sps->vui.i_sar_den;
return VLC_SUCCESS;
}
}
else if(hh->i_codec == VLC_CODEC_HEVC)
{
const struct hxxx_helper_nal *hsps = &hh->hevc.sps_list[hh->hevc.i_current_sps];
unsigned num, den;
if(hsps && hevc_get_aspect_ratio(hsps->hevc_sps, &num, &den))
{
*p_num = num;
*p_den = den;
return VLC_SUCCESS;
}
}
return VLC_EGENERIC;
}
int
......@@ -721,15 +745,27 @@ h264_helper_get_current_dpb_values(const struct hxxx_helper *hh,
}
int
h264_helper_get_current_profile_level(const struct hxxx_helper *hh,
hxxx_helper_get_current_profile_level(const struct hxxx_helper *hh,
uint8_t *p_profile, uint8_t *p_level)
{
const struct hxxx_helper_nal *hsps = h264_helper_get_current_sps(hh);
if (hsps == NULL)
return VLC_EGENERIC;
*p_profile = hsps->h264_sps->i_profile;
*p_level = hsps->h264_sps->i_level;
return VLC_SUCCESS;
if(hh->i_codec == VLC_CODEC_H264)
{
const struct hxxx_helper_nal *hsps = h264_helper_get_current_sps(hh);
if (hsps)
{
*p_profile = hsps->h264_sps->i_profile;
*p_level = hsps->h264_sps->i_level;
return VLC_SUCCESS;
}
}
else if(hh->i_codec == VLC_CODEC_HEVC)
{
const struct hxxx_helper_nal *hsps = &hh->hevc.sps_list[hh->hevc.i_current_sps];
if (hsps &&
hevc_get_sps_profile_tier_level(hsps->hevc_sps, p_profile, p_level))
return VLC_SUCCESS;
}
return VLC_EGENERIC;
}
int
......
......@@ -89,16 +89,16 @@ block_t *h264_helper_get_annexb_config(const struct hxxx_helper *hh);
block_t *h264_helper_get_avcc_config(const struct hxxx_helper *hh);
int h264_helper_get_current_picture_size(const struct hxxx_helper *hh,
int hxxx_helper_get_current_picture_size(const struct hxxx_helper *hh,
unsigned *p_w, unsigned *p_h,
unsigned *p_vw, unsigned *p_vh);
int h264_helper_get_current_sar(const struct hxxx_helper *hh, int *p_num, int *p_den);
int hxxx_helper_get_current_sar(const struct hxxx_helper *hh, int *p_num, int *p_den);
int h264_helper_get_current_dpb_values(const struct hxxx_helper *hh,
uint8_t *p_depth, unsigned *pi_delay);
int h264_helper_get_current_profile_level(const struct hxxx_helper *hh,
int hxxx_helper_get_current_profile_level(const struct hxxx_helper *hh,
uint8_t *p_profile, uint8_t *p_level);
int hxxx_helper_get_colorimetry(const struct hxxx_helper *hh,
......
......@@ -258,7 +258,7 @@ static int H264SetCSD(decoder_t *p_dec, bool *p_size_changed)
CSDInit(p_dec, p_spspps_blocks, 2);
unsigned i_w, i_h, i_vw, i_vh;
h264_helper_get_current_picture_size(hh, &i_w, &i_h, &i_vw, &i_vh);
hxxx_helper_get_current_picture_size(hh, &i_w, &i_h, &i_vw, &i_vh);
if (p_size_changed)
*p_size_changed = (i_w != p_dec->fmt_out.video.i_width
......
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