[vlc-commits] omxdl: avoid integer to pointer conversion
Rémi Denis-Courmont
git at videolan.org
Tue Nov 20 21:34:17 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 20 21:32:19 2018 +0200| [f11e4fcf9b757c2fcdfcfc4160e430c328dd6922] | committer: Rémi Denis-Courmont
omxdl: avoid integer to pointer conversion
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f11e4fcf9b757c2fcdfcfc4160e430c328dd6922
---
modules/video_chroma/omxdl.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/modules/video_chroma/omxdl.c b/modules/video_chroma/omxdl.c
index f5902907ed..adca69a7d1 100644
--- a/modules/video_chroma/omxdl.c
+++ b/modules/video_chroma/omxdl.c
@@ -342,7 +342,7 @@ static int Open (vlc_object_t *obj)
(OMX_INT)(((float)((SRC_WIDTH & ~1) - 1)) / ((DST_WIDTH & ~1) - 1) * (1 << 16) + .5)
#define YRR_MAX \
(OMX_INT)(((float)((SRC_HEIGHT & ~1) - 1)) / ((DST_HEIGHT & ~1) - 1) * (1 << 16) + .5)
-#define CNV ((intptr_t)(filter->p_sys))
+#define CNV (*(int *)(filter->p_sys))
/*** Scaling from I420 ***/
static void I420_I420_Scale (filter_t *filter, picture_t *src, picture_t *dst)
@@ -471,6 +471,12 @@ VIDEO_FILTER_WRAPPER (I422_RGB_Scale)
static int OpenScaler (vlc_object_t *obj)
{
filter_t *filter = (filter_t *)obj;
+ int *conv = vlc_obj_malloc(obj, sizeof (*conv));
+
+ if (unlikely(conv == NULL))
+ return VLC_ENOMEM;
+
+ filter->p_sys = conv;
switch (filter->fmt_in.video.i_chroma)
{
@@ -487,25 +493,25 @@ static int OpenScaler (vlc_object_t *obj)
if (FixRV16 (&filter->fmt_out.video))
return VLC_EGENERIC;
filter->pf_video_filter = I420_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR565;
+ *conv = OMX_IP_BGR565;
return VLC_SUCCESS;
case VLC_CODEC_RGB15:
if (FixRV15 (&filter->fmt_out.video))
break;
filter->pf_video_filter = I420_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR555;
+ *conv = OMX_IP_BGR555;
return VLC_SUCCESS;
case VLC_CODEC_RGB12:
if (FixRV12 (&filter->fmt_out.video))
break;
filter->pf_video_filter = I420_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR444;
+ *conv = OMX_IP_BGR444;
return VLC_SUCCESS;
case VLC_CODEC_RGB24:
if (FixRV24 (&filter->fmt_out.video))
break;
filter->pf_video_filter = I420_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR888;
+ *conv = OMX_IP_BGR888;
return VLC_SUCCESS;
}
break;
@@ -523,25 +529,25 @@ static int OpenScaler (vlc_object_t *obj)
if (FixRV16 (&filter->fmt_out.video))
break;
filter->pf_video_filter = YV12_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR565;
+ *conv = OMX_IP_BGR565;
return VLC_SUCCESS;
case VLC_CODEC_RGB15:
if (FixRV15 (&filter->fmt_out.video))
break;
filter->pf_video_filter = YV12_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR555;
+ *conv = OMX_IP_BGR555;
return VLC_SUCCESS;
case VLC_CODEC_RGB12:
if (FixRV12 (&filter->fmt_out.video))
break;
filter->pf_video_filter = YV12_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR444;
+ *conv = OMX_IP_BGR444;
return VLC_SUCCESS;
case VLC_CODEC_RGB24:
if (FixRV24 (&filter->fmt_out.video))
break;
filter->pf_video_filter = YV12_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR888;
+ *conv = OMX_IP_BGR888;
return VLC_SUCCESS;
}
break;
@@ -556,25 +562,25 @@ static int OpenScaler (vlc_object_t *obj)
if (FixRV16 (&filter->fmt_out.video))
break;
filter->pf_video_filter = I422_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR565;
+ *conv = OMX_IP_BGR565;
return VLC_SUCCESS;
case VLC_CODEC_RGB15:
if (FixRV15 (&filter->fmt_out.video))
break;
filter->pf_video_filter = I422_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR555;
+ *conv = OMX_IP_BGR555;
return VLC_SUCCESS;
case VLC_CODEC_RGB12:
if (FixRV12 (&filter->fmt_out.video))
break;
filter->pf_video_filter = I422_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR444;
+ *conv = OMX_IP_BGR444;
return VLC_SUCCESS;
case VLC_CODEC_RGB24:
if (FixRV24 (&filter->fmt_out.video))
break;
filter->pf_video_filter = I422_RGB_Scale_Filter;
- filter->p_sys = (void *)(intptr_t)OMX_IP_BGR888;
+ *conv = OMX_IP_BGR888;
return VLC_SUCCESS;
}
break;
More information about the vlc-commits
mailing list