Merge commit 'b4679ecdbd80ae050094733f137ccd7ebf1316ab'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 24 Mar 2014 14:32:48 +0000 (15:32 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 24 Mar 2014 14:32:48 +0000 (15:32 +0100)
* commit 'b4679ecdbd80ae050094733f137ccd7ebf1316ab':
  {v,a}f_showinfo: print frame side data

Conflicts:
libavfilter/af_ashowinfo.c
libavfilter/vf_showinfo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavfilter/af_ashowinfo.c
libavfilter/vf_showinfo.c

  #include "libavutil/attributes.h"
  #include "libavutil/channel_layout.h"
  #include "libavutil/common.h"
+ #include "libavutil/downmix_info.h"
+ #include "libavutil/intreadwrite.h"
  #include "libavutil/mem.h"
+ #include "libavutil/replaygain.h"
 +#include "libavutil/timestamp.h"
  #include "libavutil/samplefmt.h"
  
  #include "audio.h"
@@@ -96,6 -200,21 +192,20 @@@ static int filter_frame(AVFilterLink *i
          av_log(ctx, AV_LOG_INFO, "%08"PRIX32" ", s->plane_checksums[i]);
      av_log(ctx, AV_LOG_INFO, "]\n");
  
 -    s->frame++;
+     for (i = 0; i < buf->nb_side_data; i++) {
+         AVFrameSideData *sd = buf->side_data[i];
+         av_log(ctx, AV_LOG_INFO, "  side data - ");
+         switch (sd->type) {
+         case AV_FRAME_DATA_MATRIXENCODING: dump_matrixenc (ctx, sd); break;
+         case AV_FRAME_DATA_DOWNMIX_INFO:   dump_downmix   (ctx, sd); break;
+         case AV_FRAME_DATA_REPLAYGAIN:     dump_replaygain(ctx, sd); break;
+         default:                           dump_unknown   (ctx, sd); break;
+         }
+         av_log(ctx, AV_LOG_INFO, "\n");
+     }
      return ff_filter_frame(inlink->dst->outputs[0], buf);
  }
  
  #include "libavutil/imgutils.h"
  #include "libavutil/internal.h"
  #include "libavutil/pixdesc.h"
+ #include "libavutil/stereo3d.h"
 +#include "libavutil/timestamp.h"
  #include "avfilter.h"
  #include "internal.h"
  #include "video.h"
  
 -typedef struct {
 -    unsigned int frame;
 -} ShowInfoContext;
 -
+ static void dump_stereo3d(AVFilterContext *ctx, AVFrameSideData *sd)
+ {
+     AVStereo3D *stereo;
+     av_log(ctx, AV_LOG_INFO, "stereoscopic information: ");
+     if (sd->size < sizeof(*stereo)) {
+         av_log(ctx, AV_LOG_INFO, "invalid data");
+         return;
+     }
+     stereo = (AVStereo3D *)sd->data;
+     av_log(ctx, AV_LOG_INFO, "type - ");
+     switch (stereo->type) {
+     case AV_STEREO3D_2D:                  av_log(ctx, AV_LOG_INFO, "2D");                     break;
+     case AV_STEREO3D_SIDEBYSIDE:          av_log(ctx, AV_LOG_INFO, "side by side");           break;
+     case AV_STEREO3D_TOPBOTTOM:           av_log(ctx, AV_LOG_INFO, "top and bottom");         break;
+     case AV_STEREO3D_FRAMESEQUENCE:       av_log(ctx, AV_LOG_INFO, "frame alternate");        break;
+     case AV_STEREO3D_CHECKERBOARD:        av_log(ctx, AV_LOG_INFO, "checkerboard");           break;
+     case AV_STEREO3D_LINES:               av_log(ctx, AV_LOG_INFO, "interleaved lines");      break;
+     case AV_STEREO3D_COLUMNS:             av_log(ctx, AV_LOG_INFO, "interleaved columns");    break;
+     case AV_STEREO3D_SIDEBYSIDE_QUINCUNX: av_log(ctx, AV_LOG_INFO, "side by side "
+                                                                    "(quincunx subsampling)"); break;
+     default:                              av_log(ctx, AV_LOG_WARNING, "unknown");             break;
+     }
+     if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
+         av_log(ctx, AV_LOG_INFO, " (inverted)");
+ }
  static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
  {
      AVFilterContext *ctx = inlink->dst;
             frame->top_field_first   ? 'T' : 'B',    /* Top / Bottom */
             frame->key_frame,
             av_get_picture_type_char(frame->pict_type),
 -           checksum, plane_checksum[0], plane_checksum[1], plane_checksum[2], plane_checksum[3]);
 +           checksum, plane_checksum[0]);
 +
 +    for (plane = 1; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++)
 +        av_log(ctx, AV_LOG_INFO, " %08"PRIX32, plane_checksum[plane]);
 +    av_log(ctx, AV_LOG_INFO, "]\n");
  
 -    showinfo->frame++;
+     for (i = 0; i < frame->nb_side_data; i++) {
+         AVFrameSideData *sd = frame->side_data[i];
+         av_log(ctx, AV_LOG_INFO, "  side data - ");
+         switch (sd->type) {
+         case AV_FRAME_DATA_PANSCAN:
+             av_log(ctx, AV_LOG_INFO, "pan/scan");
+             break;
+         case AV_FRAME_DATA_A53_CC:
+             av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%d bytes)", sd->size);
+             break;
+         case AV_FRAME_DATA_STEREO3D:
+             dump_stereo3d(ctx, sd);
+             break;
+         default:
+             av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)",
+                    sd->type, sd->size);
+             break;
+         }
+         av_log(ctx, AV_LOG_INFO, "\n");
+     }
      return ff_filter_frame(inlink->dst->outputs[0], frame);
  }