[FFmpeg-devel] [PATCH 2/3] avformat/dump: use av_spherical_projection_name() to print spherical projection names

Vittorio Giovara vittorio.giovara at gmail.com
Fri Mar 31 11:46:14 EEST 2017


On Wed, Mar 29, 2017 at 4:55 AM, James Almer <jamrial at gmail.com> wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavformat/dump.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/libavformat/dump.c b/libavformat/dump.c
> index 3e6218303d..cb0468559e 100644
> --- a/libavformat/dump.c
> +++ b/libavformat/dump.c
> @@ -353,21 +353,18 @@ static void dump_spherical(void *ctx, AVCodecParameters *par, AVPacketSideData *
>          return;
>      }
>
> -    if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
> -        av_log(ctx, AV_LOG_INFO, "equirectangular ");
> -    else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
> -        av_log(ctx, AV_LOG_INFO, "cubemap ");
> -    else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE)
> -        av_log(ctx, AV_LOG_INFO, "tiled equirectangular ");
> -    else {
> -        av_log(ctx, AV_LOG_WARNING, "unknown");
> +    av_log(ctx, AV_LOG_INFO, "%s", av_spherical_projection_name(spherical->projection));
> +
> +    if (spherical->projection != AV_SPHERICAL_EQUIRECTANGULAR &&
> +        spherical->projection != AV_SPHERICAL_EQUIRECTANGULAR_TILE &&
> +        spherical->projection != AV_SPHERICAL_CUBEMAP) {
>          return;
>      }

I don't think this check is necessary, it's probably better to show as
much info as possible even for a unknown case.

>
>      yaw = ((double)spherical->yaw) / (1 << 16);
>      pitch = ((double)spherical->pitch) / (1 << 16);
>      roll = ((double)spherical->roll) / (1 << 16);
> -    av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
> +    av_log(ctx, AV_LOG_INFO, " (%f/%f/%f) ", yaw, pitch, roll);

I'd rather you add a space after %s rather than modifying this log line.

ok otherwise
-- 
Vittorio


More information about the ffmpeg-devel mailing list