[vlc-commits] core/es_out: fix projection to name conversions in EsOutUpdateInfo

Adrien Maglo git at videolan.org
Mon Dec 12 13:17:56 CET 2016


vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Dec 12 13:09:29 2016 +0100| [135e125b1e62ab0589572387ed423522d5c4fec0] | committer: Jean-Baptiste Kempf

core/es_out: fix projection to name conversions in EsOutUpdateInfo

This fix a crash occurring when PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD
is used.
PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD value is 256 and not 2 so
projection names cannot be stored in an array.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=135e125b1e62ab0589572387ed423522d5c4fec0
---

 src/input/es_out.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index 6f2f4df..2bc4c5d 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3062,12 +3062,23 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
        }
        if( fmt->video.projection_mode != PROJECTION_MODE_RECTANGULAR )
        {
-           static const char *c_loc_names[] = { N_("Rectangular"),
-               N_("Equirectangular"),
-               N_("Cubemap"),
-           };
-           info_category_AddInfo( p_cat, _("Projection"), "%s",
-                   _(c_loc_names[fmt->video.projection_mode]) );
+           const char *psz_loc_name = NULL;
+           switch (fmt->video.projection_mode)
+           {
+           case PROJECTION_MODE_RECTANGULAR:
+               psz_loc_name = N_("Rectangular");
+               break;
+           case PROJECTION_MODE_EQUIRECTANGULAR:
+               psz_loc_name = N_("Equirectangular");
+               break;
+           case PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD:
+               psz_loc_name = N_("Cubemap");
+               break;
+           default:
+               vlc_assert_unreachable();
+               break;
+           }
+           info_category_AddInfo( p_cat, _("Projection"), "%s", _(psz_loc_name) );
 
            info_category_AddInfo( p_cat, _("Yaw"), "%.2f",
                                   fmt->video.pose.f_yaw_degrees );



More information about the vlc-commits mailing list