diff mbox

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

Message ID 20170329025557.952-2-jamrial@gmail.com
State Accepted
Headers show

Commit Message

James Almer March 29, 2017, 2:55 a.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/dump.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Comments

Vittorio Giovara March 31, 2017, 8:46 a.m. UTC | #1
On Wed, Mar 29, 2017 at 4:55 AM, James Almer <jamrial@gmail.com> wrote:
> Signed-off-by: James Almer <jamrial@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
James Almer March 31, 2017, 5:16 p.m. UTC | #2
On 3/31/2017 5:46 AM, Vittorio Giovara wrote:
> On Wed, Mar 29, 2017 at 4:55 AM, James Almer <jamrial@gmail.com> wrote:
>> Signed-off-by: James Almer <jamrial@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.

Ok.

> 
>>
>>      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

Changed and pushed. Thanks.
diff mbox

Patch

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;
     }
 
     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);
 
     if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
         size_t l, t, r, b;