summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorBenoit Fouet <benoit.fouet@free.fr>2016-06-21 14:17:13 +0200
committerBenoit Fouet <benoit.fouet@free.fr>2016-06-30 09:24:39 +0200
commit879330c561f4214bd81c35f46f31dd7fe906a59a (patch)
tree1ddb7b6e5264d8950b120fb15919435b79325829 /libavcodec
parent4cc1ce4a91788a71670ea43fa0026b5a969e9e9e (diff)
h264: make H264ParamSets sps const
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.h3
-rw-r--r--libavcodec/h264_parser.c2
-rw-r--r--libavcodec/h264_ps.c4
-rw-r--r--libavcodec/h264_sei.c4
-rw-r--r--libavcodec/h264_slice.c4
5 files changed, 8 insertions, 9 deletions
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 3512aaae5a..f0e4573e7a 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -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;
/**
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index ce4bab225e..7af2a8dddc 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -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;
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 76ac9f1b3d..1e1e793380 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -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",
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 0bbd7e5a04..3bdbaa0097 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -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) {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 6babd669e0..a63c9b9b4c 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -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);