[vlc-devel] [PATCH] jpeg: handle Spatial RDF medatadata coded as XML data

Vittorio Giovara vittorio.giovara at gmail.com
Wed Nov 30 00:07:44 CET 2016


On Tue, Nov 29, 2016 at 5:36 AM, Steve Lhomme <robux4 at videolabs.io> wrote:
> ---
>  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);
> --

Is this real? v_v
Is a sample available?
-- 
Vittorio


More information about the vlc-devel mailing list