[vlc-commits] jpeg: handle Spatial RDF metadata coded as XML data
Steve Lhomme
git at videolan.org
Wed Nov 30 18:11:03 CET 2016
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue Nov 29 11:36:41 2016 +0100| [921d37dd06604def8054df0ec76ecbadf736b470] | committer: Jean-Baptiste Kempf
jpeg: handle Spatial RDF metadata coded as XML data
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=921d37dd06604def8054df0ec76ecbadf736b470
---
modules/codec/jpeg.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/modules/codec/jpeg.c b/modules/codec/jpeg.c
index 62dec07..60f60c3 100644
--- a/modules/codec/jpeg.c
+++ b/modules/codec/jpeg.c
@@ -256,11 +256,23 @@ static bool getRDFFloat(const char *psz_rdf, float *out, const char *psz_var)
return false;
size_t varlen = strlen(psz_var);
- char *p_end = strchr(p_start + varlen, '"');
+ p_start += varlen;
+ char *p_end = NULL;
+ /* XML style */
+ if (p_start[0] == '>')
+ {
+ p_start += 1;
+ p_end = strchr(p_start, '<');
+ }
+ else if (p_start[0] == '=' && p_start[1] == '"')
+ {
+ p_start += 2;
+ p_end = strchr(p_start, '"');
+ }
if (unlikely(p_end == NULL || p_end == p_start + 1))
return false;
- *out = us_strtof(p_start + varlen, NULL);
+ *out = us_strtof(p_start, NULL);
return true;
}
@@ -296,31 +308,32 @@ static void jpeg_GetProjection(j_decompress_ptr cinfo, video_format_t *fmt)
/* Try to find the string "GSpherical:Spherical" because the v1
spherical video spec says the tag must be there. */
- if (strcasestr(psz_rdf, "ProjectionType=\"equirectangular\""))
+ if (strcasestr(psz_rdf, "ProjectionType=\"equirectangular\"") ||
+ strcasestr(psz_rdf, "ProjectionType>equirectangular"))
fmt->projection_mode = PROJECTION_MODE_EQUIRECTANGULAR;
/* pose handling */
float value;
- if (getRDFFloat(psz_rdf, &value, "PoseHeadingDegrees=\""))
+ if (getRDFFloat(psz_rdf, &value, "PoseHeadingDegrees"))
fmt->pose.f_yaw_degrees = value;
- if (getRDFFloat(psz_rdf, &value, "PosePitchDegrees=\""))
+ if (getRDFFloat(psz_rdf, &value, "PosePitchDegrees"))
fmt->pose.f_pitch_degrees = value;
- if (getRDFFloat(psz_rdf, &value, "PoseRollDegrees=\""))
+ if (getRDFFloat(psz_rdf, &value, "PoseRollDegrees"))
fmt->pose.f_roll_degrees = value;
/* initial view */
- if (getRDFFloat(psz_rdf, &value, "InitialViewHeadingDegrees=\""))
+ if (getRDFFloat(psz_rdf, &value, "InitialViewHeadingDegrees"))
fmt->pose.f_yaw_degrees = value;
- if (getRDFFloat(psz_rdf, &value, "InitialViewPitchDegrees=\""))
+ if (getRDFFloat(psz_rdf, &value, "InitialViewPitchDegrees"))
fmt->pose.f_pitch_degrees = value;
- if (getRDFFloat(psz_rdf, &value, "InitialViewRollDegrees=\""))
+ if (getRDFFloat(psz_rdf, &value, "InitialViewRollDegrees"))
fmt->pose.f_roll_degrees = value;
- if (getRDFFloat(psz_rdf, &value, "InitialHorizontalFOVDegrees=\""))
+ if (getRDFFloat(psz_rdf, &value, "InitialHorizontalFOVDegrees"))
fmt->pose.f_fov_degrees = value;
free(psz_rdf);
More information about the vlc-commits
mailing list