dump: be more verbose when printing spherical metadata information

Message ID 20161215225644.2804-1-jamrial@gmail.com
State New
Headers show

Commit Message

James Almer Dec. 15, 2016, 10:56 p.m.
Signed-off-by: James Almer <jamrial@gmail.com>
---
This prints

spherical: equirectangular, yaw=0.000000, pitch=0.000000, roll=0.000000

Instead of

spherical: equirectangular (0.000000/0.000000/0.000000)

 libavformat/dump.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Luca Barbato Dec. 16, 2016, 12:16 p.m. | #1
On 15/12/2016 23:56, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---

Sure, why not?
Vittorio Giovara Dec. 16, 2016, 4:04 p.m. | #2
On Thu, Dec 15, 2016 at 5:56 PM, James Almer <jamrial@gmail.com> wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> This prints
>
> spherical: equirectangular, yaw=0.000000, pitch=0.000000, roll=0.000000
>
> Instead of
>
> spherical: equirectangular (0.000000/0.000000/0.000000)

Hey James,
I wasn't too verbose in dump.c because i thought that this should be a
summary of what the metadata is, not a full description, and I didn't
want to leave the possibility of letting parsing the output of the
command. For more descriptive naming one should use any of the -of
options. Do you think it makes sense? If not, why do you think this is
necessary?
Cheers
James Almer Dec. 16, 2016, 4:36 p.m. | #3
On 12/16/2016 1:04 PM, Vittorio Giovara wrote:
> On Thu, Dec 15, 2016 at 5:56 PM, James Almer <jamrial@gmail.com> wrote:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> This prints
>>
>> spherical: equirectangular, yaw=0.000000, pitch=0.000000, roll=0.000000
>>
>> Instead of
>>
>> spherical: equirectangular (0.000000/0.000000/0.000000)
> 
> Hey James,
> I wasn't too verbose in dump.c because i thought that this should be a
> summary of what the metadata is, not a full description, and I didn't
> want to leave the possibility of letting parsing the output of the
> command. For more descriptive naming one should use any of the -of
> options. Do you think it makes sense? If not, why do you think this is
> necessary?
> Cheers

I don't think it's necessary, i just thought it would be nicer to know
what those values actually mean.
ReplayGain, Mastering Display and such all show the name for the values
they print, so i figured Spherical should do the same.

Patch

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 660df0a..ed48746 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -318,9 +318,9 @@  static void dump_spherical(void *ctx, AVPacketSideData *sd)
     }
 
     if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
-        av_log(ctx, AV_LOG_INFO, "equirectangular ");
+        av_log(ctx, AV_LOG_INFO, "equirectangular, ");
     else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
-        av_log(ctx, AV_LOG_INFO, "cubemap ");
+        av_log(ctx, AV_LOG_INFO, "cubemap, ");
     else {
         av_log(ctx, AV_LOG_WARNING, "unknown");
         return;
@@ -329,7 +329,7 @@  static void dump_spherical(void *ctx, AVPacketSideData *sd)
     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, "yaw=%f, pitch=%f, roll=%f ", yaw, pitch, roll);
 }
 
 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)