[FFmpeg-devel] [PATCH] h264: make H264ParamSets sps const
Clément Bœsch
u at pkh.me
Tue Jun 21 14:40:55 CEST 2016
On Tue, Jun 21, 2016 at 02:34:33PM +0200, Benoit Fouet wrote:
> Hi,
>
> Unless I totally missed something, the FIXME in H264ParamSets structure
> should be fixed by attached patch.
>
> --
> Ben
>
> From 28ae10498f81070539bdb8f40236326743350101 Mon Sep 17 00:00:00 2001
> From: Benoit Fouet <benoit.fouet at free.fr>
> Date: Tue, 21 Jun 2016 14:17:13 +0200
> Subject: [PATCH] h264: make H264ParamSets sps const
>
> ---
> libavcodec/h264.h | 3 +--
> libavcodec/h264_slice.c | 2 +-
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/h264.h b/libavcodec/h264.h
> index c4d2921..b809ee5 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_slice.c b/libavcodec/h264_slice.c
> index 6e7b940..da7f9dd 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -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;
> + SPS *sps = (SPS*)h->ps.sps_ref->data;
> 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);
So it's not actually const, right?
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160621/90796aa0/attachment.sig>
More information about the ffmpeg-devel
mailing list