FFMPEG Plugin: Print debug output for audio frames, too

- Also change what is printed for video frames. Currently both
  debug_fframe_[audio|video] are used in AVCodecDecoder only and thus are
  streamlined for their usage there. For example we print the AVFrame.pkt_dts
  field instead of the AVFrame.pkt field because the later one is never touched
  by AVCodecDecoders usage of the FFMPEG library.
  Note: AVFrame.pkt being never touched means that it always contains the value
  AV_NOPTS_VALUE making it less useful for debug purposes.
This commit is contained in:
Colin Günther 2014-08-21 09:30:22 +02:00
parent b8c4fa9da6
commit 7f485803cd
3 changed files with 29 additions and 11 deletions

View File

@ -772,6 +772,10 @@ AVCodecDecoder::_DecodeNextAudioFrame()
fContext->sample_fmt, 1);
if (fDecodedDataBufferSize < 0)
fDecodedDataBufferSize = 0;
#ifdef DEBUG
dump_ffframe_audio(fDecodedDataBuffer, "ffaudio");
#endif
}
fFrame += currentFrameCount;
@ -1083,9 +1087,9 @@ AVCodecDecoder::_HandleNewVideoFrameAndUpdateSystemState()
ConvertAVCodecContextToVideoFrameRate(*fContext, fOutputFrameRate);
#ifdef DEBUG
dump_ffframe(fRawDecodedPicture, "ffpict");
// dump_ffframe(fPostProcessedDecodedPicture, "opict");
dump_ffframe_video(fRawDecodedPicture, "ffpict");
#endif
fFrame++;
}

View File

@ -477,21 +477,28 @@ colorspace_to_pixfmt(color_space format)
#define END_TAG "\033[0m"
void
dump_ffframe(AVFrame* frame, const char* name)
dump_ffframe_audio(AVFrame* frame, const char* name)
{
printf(BEGIN_TAG"AVFrame(%s) [ pkt_dts:%-10lld #samples:%-5d %s"
" ]\n"END_TAG,
name,
frame->pkt_dts,
frame->nb_samples,
av_get_sample_fmt_name(static_cast<AVSampleFormat>(frame->format)));
}
void
dump_ffframe_video(AVFrame* frame, const char* name)
{
const char* picttypes[] = {"no pict type", "intra", "predicted",
"bidir pre", "s(gmc)-vop"};
printf(BEGIN_TAG"AVFrame(%s) pts:%-10lld cnum:%-5d dnum:%-5d %s%s, "
printf(BEGIN_TAG"AVFrame(%s) [ pkt_dts:%-10lld cnum:%-5d dnum:%-5d %s%s"
" ]\n"END_TAG,
name,
frame->pts,
frame->pkt_dts,
frame->coded_picture_number,
frame->display_picture_number,
// frame->quality,
frame->key_frame?"keyframe, ":"",
picttypes[frame->pict_type]);
// printf(BEGIN_TAG"\t\tlinesize[] = {%ld, %ld, %ld, %ld}\n"END_TAG,
// frame->linesize[0], frame->linesize[1], frame->linesize[2],
// frame->linesize[3]);
}

View File

@ -1,3 +1,9 @@
/*
* Copyright (C) 2014 Colin Günther <coling@gmx.de>.
*
* All rights reserved. Distributed under the terms of the MIT License.
*/
/******************************************************************************
/
/ File: gfx_util.h
@ -39,6 +45,7 @@ const char *pixfmt_to_string(int format);
color_space pixfmt_to_colorspace(int format);
PixelFormat colorspace_to_pixfmt(color_space format);
void dump_ffframe(AVFrame *frame, const char *name);
void dump_ffframe_audio(AVFrame *frame, const char *name);
void dump_ffframe_video(AVFrame *frame, const char *name);
#endif