[vlc-devel] [PATCH 1/2] core: merge the video format pose fields in a struct

Steve Lhomme robux4 at videolabs.io
Tue Nov 22 18:04:28 CET 2016


---
 include/vlc_es.h                | 10 ++++++----
 modules/codec/jpeg.c            | 14 +++++++-------
 modules/demux/mp4/essetup.c     |  6 +++---
 src/input/es_out.c              |  8 ++++----
 src/video_output/video_output.c |  8 ++++----
 5 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/include/vlc_es.h b/include/vlc_es.h
index 4910b06..0dee672 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -321,10 +321,12 @@ struct video_format_t
     video_multiview_mode_t multiview_mode;        /** Multiview mode, 2D, 3D */
 
     video_projection_mode_t projection_mode;            /**< projection mode */
-    float f_pose_yaw_degrees;      /**< view point yaw in degrees ]-180;180] */
-    float f_pose_pitch_degrees;    /**< view point pitch in degrees ]-90;90] */
-    float f_pose_roll_degrees;    /**< view point roll in degrees ]-180;180] */
-    float f_pose_fov_degrees;         /**< view point fov in degrees ]0;180[ */
+    struct {
+        float f_yaw_degrees;       /**< view point yaw in degrees ]-180;180] */
+        float f_pitch_degrees;     /**< view point pitch in degrees ]-90;90] */
+        float f_roll_degrees;     /**< view point roll in degrees ]-180;180] */
+        float f_fov_degrees;          /**< view point fov in degrees ]0;180[ */
+    } pose;
     uint32_t i_cubemap_padding; /**< padding in pixels of the cube map faces */
 };
 
diff --git a/modules/codec/jpeg.c b/modules/codec/jpeg.c
index 62fdcf6..62dec07 100644
--- a/modules/codec/jpeg.c
+++ b/modules/codec/jpeg.c
@@ -302,26 +302,26 @@ static void jpeg_GetProjection(j_decompress_ptr cinfo, video_format_t *fmt)
     /* pose handling */
     float value;
     if (getRDFFloat(psz_rdf, &value, "PoseHeadingDegrees=\""))
-        fmt->f_pose_yaw_degrees = value;
+        fmt->pose.f_yaw_degrees = value;
 
     if (getRDFFloat(psz_rdf, &value, "PosePitchDegrees=\""))
-        fmt->f_pose_pitch_degrees = value;
+        fmt->pose.f_pitch_degrees = value;
 
     if (getRDFFloat(psz_rdf, &value, "PoseRollDegrees=\""))
-        fmt->f_pose_roll_degrees = value;
+        fmt->pose.f_roll_degrees = value;
 
     /* initial view */
     if (getRDFFloat(psz_rdf, &value, "InitialViewHeadingDegrees=\""))
-        fmt->f_pose_yaw_degrees = value;
+        fmt->pose.f_yaw_degrees = value;
 
     if (getRDFFloat(psz_rdf, &value, "InitialViewPitchDegrees=\""))
-        fmt->f_pose_pitch_degrees = value;
+        fmt->pose.f_pitch_degrees = value;
 
     if (getRDFFloat(psz_rdf, &value, "InitialViewRollDegrees=\""))
-        fmt->f_pose_roll_degrees = value;
+        fmt->pose.f_roll_degrees = value;
 
     if (getRDFFloat(psz_rdf, &value, "InitialHorizontalFOVDegrees=\""))
-        fmt->f_pose_fov_degrees = value;
+        fmt->pose.f_fov_degrees = value;
 
     free(psz_rdf);
 }
diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index ed554d7..c06d475 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -379,11 +379,11 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
     const MP4_Box_t *p_prhd = MP4_BoxGet( p_sample, "sv3d/proj/prhd" );
     if (p_prhd && BOXDATA(p_prhd))
     {
-        p_track->fmt.video.f_pose_yaw_degrees
+        p_track->fmt.video.pose.f_yaw_degrees
                 = BOXDATA(p_prhd)->f_pose_yaw_degrees;
-        p_track->fmt.video.f_pose_pitch_degrees
+        p_track->fmt.video.pose.f_pitch_degrees
                 = BOXDATA(p_prhd)->f_pose_pitch_degrees;
-        p_track->fmt.video.f_pose_roll_degrees
+        p_track->fmt.video.pose.f_roll_degrees
                 = BOXDATA(p_prhd)->f_pose_roll_degrees;
     }
 
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 4ba4016..3182388 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3076,13 +3076,13 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const es_format_t *
                    _(c_loc_names[fmt->video.projection_mode]) );
 
            info_category_AddInfo( p_cat, _("Yaw"), "%.2f",
-                                  fmt->video.f_pose_yaw_degrees );
+                                  fmt->video.pose.f_yaw_degrees );
            info_category_AddInfo( p_cat, _("Pitch"), "%.2f",
-                                  fmt->video.f_pose_pitch_degrees );
+                                  fmt->video.pose.f_pitch_degrees );
            info_category_AddInfo( p_cat, _("Roll"), "%.2f",
-                                  fmt->video.f_pose_roll_degrees );
+                                  fmt->video.pose.f_roll_degrees );
            info_category_AddInfo( p_cat, _("Field of view"), "%.2f",
-                                  fmt->video.f_pose_fov_degrees );
+                                  fmt->video.pose.f_fov_degrees );
        }
        break;
 
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index fde5947..4a9f34e 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -560,10 +560,10 @@ static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg, cons
         cfg->viewpoint = *p_viewpoint;
     else
     {
-        cfg->viewpoint.yaw = vout->p->original.f_pose_yaw_degrees;
-        cfg->viewpoint.pitch = vout->p->original.f_pose_pitch_degrees;
-        cfg->viewpoint.roll = vout->p->original.f_pose_roll_degrees;
-        cfg->viewpoint.fov = vout->p->original.f_pose_fov_degrees;
+        cfg->viewpoint.yaw   = vout->p->original.pose.f_yaw_degrees;
+        cfg->viewpoint.pitch = vout->p->original.pose.f_pitch_degrees;
+        cfg->viewpoint.roll  = vout->p->original.pose.f_roll_degrees;
+        cfg->viewpoint.fov   = vout->p->original.pose.f_fov_degrees;
         cfg->viewpoint.zoom = 0.f;
     }
     cfg->display.title = title;
-- 
2.10.1



More information about the vlc-devel mailing list