<div dir="ltr">Hi Tristan,<div><br></div><div>Agree, Will do the  necessary corrections.</div><div><br></div><div>Thanks,</div><div>Vikram</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 28, 2020 at 7:00 PM Tristan Matthews <<a href="mailto:tmatth@videolan.org">tmatth@videolan.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
On Sun, Jun 28, 2020 at 8:37 AM Vikram Fugro <<a href="mailto:vikram.fugro@gmail.com" target="_blank">vikram.fugro@gmail.com</a>> wrote:<br>
><br>
> Eliminate warnings related to typecasting<br>
> ---<br>
>  modules/codec/gstreamer/gstdecode.c           |  5 +-<br>
>  .../gstreamer/gstvlcpictureplaneallocator.c   | 56 ++++++++++---------<br>
>  2 files changed, 34 insertions(+), 27 deletions(-)<br>
><br>
> diff --git a/modules/codec/gstreamer/gstdecode.c b/modules/codec/gstreamer/gstdecode.c<br>
> index 118138dcbe..c442c332db 100644<br>
> --- a/modules/codec/gstreamer/gstdecode.c<br>
> +++ b/modules/codec/gstreamer/gstdecode.c<br>
> @@ -333,11 +333,12 @@ static bool vlc_gst_registered = false;<br>
>  static void vlc_gst_init_once(void)<br>
>  {<br>
>      gst_init( NULL, NULL );<br>
> +<br>
> +    vlc_gst_build_fourcc_table();<br>
> +<br>
>      vlc_gst_registered = gst_plugin_register_static( 1, 0, "videolan",<br>
>                  "VLC Gstreamer plugins", vlc_gst_plugin_init,<br>
>                  "1.0.0", "LGPL", "NA", "vlc", "NA" );<br>
> -<br>
> -    vlc_gst_build_fourcc_table();<br>
>  }<br>
><br>
>  /* gst_init( ) is not thread-safe, hence a thread-safe wrapper */<br>
> diff --git a/modules/codec/gstreamer/gstvlcpictureplaneallocator.c b/modules/codec/gstreamer/gstvlcpictureplaneallocator.c<br>
> index 580a9f931b..80b525e10e 100644<br>
> --- a/modules/codec/gstreamer/gstvlcpictureplaneallocator.c<br>
> +++ b/modules/codec/gstreamer/gstvlcpictureplaneallocator.c<br>
> @@ -134,32 +134,38 @@ static GstMemory* gst_vlc_picture_plane_copy(<br>
><br>
>  void vlc_gst_build_fourcc_table ( void )<br>
>  {<br>
> +    if( p_fourcc_map )<br>
> +        g_hash_table_destroy( p_fourcc_map );<br>
> +<br>
>      p_fourcc_map = g_hash_table_new( g_str_hash, g_str_equal );<br>
><br>
> -    g_hash_table_insert( p_fourcc_map, "I420_9LE",  "I09L");<br>
> -    g_hash_table_insert( p_fourcc_map, "I420_9BE",  "I09B");<br>
> -    g_hash_table_insert( p_fourcc_map, "I420_10LE", "I0AL");<br>
> -    g_hash_table_insert( p_fourcc_map, "I420_10BE", "I0AB");<br>
> -    g_hash_table_insert( p_fourcc_map, "I420_12LE", "I0CL");<br>
> -    g_hash_table_insert( p_fourcc_map, "I420_12BE", "I0CB");<br>
> -    g_hash_table_insert( p_fourcc_map, "I420_16LE", "I0FL");<br>
> -    g_hash_table_insert( p_fourcc_map, "I420_16BE", "I0FB");<br>
> -    g_hash_table_insert( p_fourcc_map, "I422_9LE",  "I29L");<br>
> -    g_hash_table_insert( p_fourcc_map, "I422_9BE",  "I29B");<br>
> -    g_hash_table_insert( p_fourcc_map, "I422_10LE", "I2AL");<br>
> -    g_hash_table_insert( p_fourcc_map, "I422_10BE", "I2AB");<br>
> -    g_hash_table_insert( p_fourcc_map, "I422_12LE", "I2CL");<br>
> -    g_hash_table_insert( p_fourcc_map, "I422_12BE", "I2CB");<br>
> -    g_hash_table_insert( p_fourcc_map, "I422_16LE", "I2FL");<br>
> -    g_hash_table_insert( p_fourcc_map, "I422_16BE", "I2FB");<br>
> -    g_hash_table_insert( p_fourcc_map, "I444_9LE",  "I49L");<br>
> -    g_hash_table_insert( p_fourcc_map, "I444_9BE",  "I49B");<br>
> -    g_hash_table_insert( p_fourcc_map, "I444_10LE", "I4AL");<br>
> -    g_hash_table_insert( p_fourcc_map, "I444_10BE", "I4AB");<br>
> -    g_hash_table_insert( p_fourcc_map, "I444_12LE", "I4CL");<br>
> -    g_hash_table_insert( p_fourcc_map, "I444_12BE", "I4CB");<br>
> -    g_hash_table_insert( p_fourcc_map, "I444_16LE", "I4FL");<br>
> -    g_hash_table_insert( p_fourcc_map, "I444_16BE", "I4FB");<br>
> +#define INSERT_KEY_VALUE( map, key, val ) \<br>
> +    g_hash_table_insert( map, (gpointer)key,  (gpointer)val )<br>
> +<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I420_9LE", "I09L" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I420_9BE", "I09B" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I420_10LE", "I0AL" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I420_10BE", "I0AB" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I420_12LE", "I0CL" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I420_12BE", "I0CB" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I420_16LE", "I0FL" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I420_16BE", "I0FB" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I422_9LE", "I29L" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I422_9BE", "I29B" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I422_10LE", "I2AL" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I422_10BE", "I2AB" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I422_12LE", "I2CL" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I422_12BE", "I2CB" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I422_16LE", "I2FL" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I422_16BE", "I2FB" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I444_9LE", "I49L" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I444_9BE", "I49B" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I444_10LE", "I4AL" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I444_10BE", "I4AB" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I444_12LE", "I4CL" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I444_12BE", "I4CB" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I444_16LE", "I4FL" );<br>
> +    INSERT_KEY_VALUE( p_fourcc_map, "I444_16BE", "I4FB" );<br>
>  }<br>
><br>
>  void gst_vlc_picture_plane_allocator_release(<br>
> @@ -253,7 +259,7 @@ bool gst_vlc_set_vout_fmt( GstVideoInfo *p_info, GstVideoAlignment *p_align,<br>
>      vlc_fourcc_t i_chroma;<br>
>      int i_padded_width, i_padded_height;<br>
><br>
> -    char* psz_fourcc = gst_structure_get_string(p_str, "format");<br>
> +    const char* psz_fourcc = gst_structure_get_string( p_str, "format" );<br>
>      if( psz_fourcc )<br>
>      {<br>
>          if( strlen( psz_fourcc ) != 4 )<br>
> --<br>
<br>
Couple things here,<br>
- Can you squash patches before sending them to the list? It doesn't<br>
make sense to have patch 4/4 fix warnings that were introduced in<br>
patch 1/4.<br>
- Why use a g_hashtable (that will get leaked at program exit) for a<br>
table that is effectively immutable? You probably just want to do<br>
something like we're already doing to map avcodec fourcc's to VLC's<br>
here:<br>
<a href="http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/fourcc.c;h=bd849f485851a755fa13f5d94ee4c39f1ffee7da;hb=refs/heads/master" rel="noreferrer" target="_blank">http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/fourcc.c;h=bd849f485851a755fa13f5d94ee4c39f1ffee7da;hb=refs/heads/master</a><br>
(Note the use of static tables)<br>
<br>
Best,<br>
-t<br>
_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a></blockquote></div>