mirror of https://git.ffmpeg.org/ffmpeg.git
h264: make H264ParamSets sps const
This commit is contained in:
parent
4cc1ce4a91
commit
879330c561
|
@ -234,8 +234,7 @@ typedef struct H264ParamSets {
|
|||
AVBufferRef *sps_ref;
|
||||
/* currently active parameters sets */
|
||||
const PPS *pps;
|
||||
// FIXME this should properly be const
|
||||
SPS *sps;
|
||||
const SPS *sps;
|
||||
} H264ParamSets;
|
||||
|
||||
/**
|
||||
|
|
|
@ -373,7 +373,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
|
|||
"non-existing SPS %u referenced\n", p->ps.pps->sps_id);
|
||||
goto fail;
|
||||
}
|
||||
p->ps.sps = (SPS*)p->ps.sps_list[p->ps.pps->sps_id]->data;
|
||||
p->ps.sps = (const SPS*)p->ps.sps_list[p->ps.pps->sps_id]->data;
|
||||
|
||||
sps = p->ps.sps;
|
||||
|
||||
|
|
|
@ -712,7 +712,7 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
|
|||
H264ParamSets *ps, int bit_length)
|
||||
{
|
||||
AVBufferRef *pps_buf;
|
||||
SPS *sps;
|
||||
const SPS *sps;
|
||||
unsigned int pps_id = get_ue_golomb(gb);
|
||||
PPS *pps;
|
||||
int qp_bd_offset;
|
||||
|
@ -743,7 +743,7 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct
|
|||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
sps = (SPS*)ps->sps_list[pps->sps_id]->data;
|
||||
sps = (const SPS*)ps->sps_list[pps->sps_id]->data;
|
||||
if (sps->bit_depth_luma > 14) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Invalid luma bit depth=%d\n",
|
||||
|
|
|
@ -278,7 +278,7 @@ static int decode_buffering_period(H264SEIBufferingPeriod *h, GetBitContext *gb,
|
|||
{
|
||||
unsigned int sps_id;
|
||||
int sched_sel_idx;
|
||||
SPS *sps;
|
||||
const SPS *sps;
|
||||
|
||||
sps_id = get_ue_golomb_31(gb);
|
||||
if (sps_id > 31 || !ps->sps_list[sps_id]) {
|
||||
|
@ -286,7 +286,7 @@ static int decode_buffering_period(H264SEIBufferingPeriod *h, GetBitContext *gb,
|
|||
"non-existing SPS %d referenced in buffering period\n", sps_id);
|
||||
return sps_id > 31 ? AVERROR_INVALIDDATA : AVERROR_PS_NOT_FOUND;
|
||||
}
|
||||
sps = (SPS*)ps->sps_list[sps_id]->data;
|
||||
sps = (const SPS*)ps->sps_list[sps_id]->data;
|
||||
|
||||
// NOTE: This is really so duplicated in the standard... See H.264, D.1.1
|
||||
if (sps->nal_hrd_parameters_present_flag) {
|
||||
|
|
|
@ -356,7 +356,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
|
|||
h->ps.sps_ref = av_buffer_ref(h1->ps.sps_ref);
|
||||
if (!h->ps.sps_ref)
|
||||
return AVERROR(ENOMEM);
|
||||
h->ps.sps = (SPS*)h->ps.sps_ref->data;
|
||||
h->ps.sps = (const SPS*)h->ps.sps_ref->data;
|
||||
}
|
||||
|
||||
if (need_reinit || !inited) {
|
||||
|
@ -873,7 +873,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
|
|||
/* export coded and cropped frame dimensions to AVCodecContext */
|
||||
static int init_dimensions(H264Context *h)
|
||||
{
|
||||
SPS *sps = h->ps.sps;
|
||||
const SPS *sps = (const SPS*)h->ps.sps;
|
||||
int width = h->width - (sps->crop_right + sps->crop_left);
|
||||
int height = h->height - (sps->crop_top + sps->crop_bottom);
|
||||
av_assert0(sps->crop_right + sps->crop_left < (unsigned)h->width);
|
||||
|
|
Loading…
Reference in New Issue