[FFmpeg-devel] [PATCH] h264: make H264ParamSets sps const

Benoit Fouet benoit.fouet at free.fr
Tue Jun 21 14:34:33 CEST 2016


Hi,

Unless I totally missed something, the FIXME in H264ParamSets structure 
should be fixed by attached patch.

-- 
Ben

-------------- next part --------------
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);
-- 
2.9.0.rc2



More information about the ffmpeg-devel mailing list