[FFmpeg-cvslog] h264: make H264ParamSets sps const
Benoit Fouet
git at videolan.org
Thu Jun 30 09:45:08 CEST 2016
ffmpeg | branch: master | Benoit Fouet <benoit.fouet at free.fr> | Tue Jun 21 14:17:13 2016 +0200| [879330c561f4214bd81c35f46f31dd7fe906a59a] | committer: Benoit Fouet
h264: make H264ParamSets sps const
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=879330c561f4214bd81c35f46f31dd7fe906a59a
---
libavcodec/h264.h | 3 +--
libavcodec/h264_parser.c | 2 +-
libavcodec/h264_ps.c | 4 ++--
libavcodec/h264_sei.c | 4 ++--
libavcodec/h264_slice.c | 4 ++--
5 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 3512aaa..f0e4573 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 ce4bab2..7af2a8d 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 76ac9f1..1e1e793 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 0bbd7e5..3bdbaa0 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 6babd66..a63c9b9 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);
More information about the ffmpeg-cvslog
mailing list