X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fdump.c;h=04c93dd7d3a486d91ff0d28b6b13ec103fd900b8;hb=4796ec5d4ea00a86f9f6732653469e682e5266da;hp=3c76edfee4ed62639d55e4c18df80ff2d57674e1;hpb=0179ef7eacbb0e2add043f31836b0e91f48be838;p=ffmpeg diff --git a/libavformat/dump.c b/libavformat/dump.c index 3c76edfee4e..04c93dd7d3a 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -34,8 +34,10 @@ #include "libavutil/replaygain.h" #include "libavutil/spherical.h" #include "libavutil/stereo3d.h" +#include "libavutil/timecode.h" #include "avformat.h" +#include "internal.h" #define HEXDUMP_PRINT(...) \ do { \ @@ -211,7 +213,7 @@ static void dump_paramchange(void *ctx, const AVPacketSideData *sd) return; fail: - av_log(ctx, AV_LOG_ERROR, "unknown param"); + av_log(ctx, AV_LOG_ERROR, "unknown param\n"); } /* replaygain side data*/ @@ -240,7 +242,7 @@ static void dump_replaygain(void *ctx, const AVPacketSideData *sd) const AVReplayGain *rg; if (sd->size < sizeof(*rg)) { - av_log(ctx, AV_LOG_ERROR, "invalid data"); + av_log(ctx, AV_LOG_ERROR, "invalid data\n"); return; } rg = (const AVReplayGain *)sd->data; @@ -256,7 +258,7 @@ static void dump_stereo3d(void *ctx, const AVPacketSideData *sd) const AVStereo3D *stereo; if (sd->size < sizeof(*stereo)) { - av_log(ctx, AV_LOG_ERROR, "invalid data"); + av_log(ctx, AV_LOG_ERROR, "invalid data\n"); return; } @@ -273,7 +275,7 @@ static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd) const enum AVAudioServiceType *ast = (const enum AVAudioServiceType *)sd->data; if (sd->size < sizeof(*ast)) { - av_log(ctx, AV_LOG_ERROR, "invalid data"); + av_log(ctx, AV_LOG_ERROR, "invalid data\n"); return; } @@ -316,16 +318,12 @@ static void dump_cpb(void *ctx, const AVPacketSideData *sd) const AVCPBProperties *cpb = (const AVCPBProperties *)sd->data; if (sd->size < sizeof(*cpb)) { - av_log(ctx, AV_LOG_ERROR, "invalid data"); + av_log(ctx, AV_LOG_ERROR, "invalid data\n"); return; } av_log(ctx, AV_LOG_INFO, -#if FF_API_UNSANITIZED_BITRATES - "bitrate max/min/avg: %d/%d/%d buffer size: %d ", -#else - "bitrate max/min/avg: %"PRId64"/%"PRId64"/%"PRId64" buffer size: %d ", -#endif + "bitrate max/min/avg: %"PRId64"/%"PRId64"/%"PRId64" buffer size: %"PRId64" ", cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate, cpb->buffer_size); if (cpb->vbv_delay == UINT64_MAX) @@ -369,7 +367,7 @@ static void dump_spherical(void *ctx, const AVCodecParameters *par, double yaw, pitch, roll; if (sd->size < sizeof(*spherical)) { - av_log(ctx, AV_LOG_ERROR, "invalid data"); + av_log(ctx, AV_LOG_ERROR, "invalid data\n"); return; } @@ -407,6 +405,22 @@ static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd) dovi->dv_bl_signal_compatibility_id); } +static void dump_s12m_timecode(void *ctx, const AVStream *st, const AVPacketSideData *sd) +{ + const uint32_t *tc = (const uint32_t *)sd->data; + + if ((sd->size != sizeof(uint32_t) * 4) || (tc[0] > 3)) { + av_log(ctx, AV_LOG_ERROR, "invalid data\n"); + return; + } + + for (int j = 1; j <= tc[0]; j++) { + char tcbuf[AV_TIMECODE_STR_SIZE]; + av_timecode_make_smpte_tc_string2(tcbuf, st->avg_frame_rate, tc[j], 0, 0); + av_log(ctx, AV_LOG_INFO, "timecode - %s%s", tcbuf, j != tc[0] ? ", " : ""); + } +} + static void dump_sidedata(void *ctx, const AVStream *st, const char *indent) { int i; @@ -473,9 +487,13 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent) av_log(ctx, AV_LOG_INFO, "DOVI configuration record: "); dump_dovi_conf(ctx, sd); break; + case AV_PKT_DATA_S12M_TIMECODE: + av_log(ctx, AV_LOG_INFO, "SMPTE ST 12-1:2014: "); + dump_s12m_timecode(ctx, st, sd); + break; default: - av_log(ctx, AV_LOG_INFO, - "unknown side data type %d (%d bytes)", sd->type, sd->size); + av_log(ctx, AV_LOG_INFO, "unknown side data type %d " + "(%"SIZE_SPECIFIER" bytes)", sd->type, sd->size); break; } @@ -505,24 +523,20 @@ static void dump_stream_format(const AVFormatContext *ic, int i, return; } -#if FF_API_LAVF_AVCTX -FF_DISABLE_DEPRECATION_WARNINGS // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext - avctx->properties = st->codec->properties; - avctx->codec = st->codec->codec; - avctx->qmin = st->codec->qmin; - avctx->qmax = st->codec->qmax; - avctx->coded_width = st->codec->coded_width; - avctx->coded_height = st->codec->coded_height; -FF_ENABLE_DEPRECATION_WARNINGS -#endif + avctx->properties = st->internal->avctx->properties; + avctx->codec = st->internal->avctx->codec; + avctx->qmin = st->internal->avctx->qmin; + avctx->qmax = st->internal->avctx->qmax; + avctx->coded_width = st->internal->avctx->coded_width; + avctx->coded_height = st->internal->avctx->coded_height; if (separator) av_opt_set(avctx, "dump_separator", separator, 0); avcodec_string(buf, sizeof(buf), avctx, is_output); avcodec_free_context(&avctx); - av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i); + av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i); /* the pid is an important information, so we display it */ /* XXX: add a generic system */ @@ -550,29 +564,16 @@ FF_ENABLE_DEPRECATION_WARNINGS int fps = st->avg_frame_rate.den && st->avg_frame_rate.num; int tbr = st->r_frame_rate.den && st->r_frame_rate.num; int tbn = st->time_base.den && st->time_base.num; -#if FF_API_LAVF_AVCTX -FF_DISABLE_DEPRECATION_WARNINGS - int tbc = st->codec->time_base.den && st->codec->time_base.num; -FF_ENABLE_DEPRECATION_WARNINGS -#else - int tbc = 0; -#endif - - if (fps || tbr || tbn || tbc) + + if (fps || tbr || tbn) av_log(NULL, AV_LOG_INFO, "%s", separator); if (fps) - print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps"); + print_fps(av_q2d(st->avg_frame_rate), tbr || tbn ? "fps, " : "fps"); if (tbr) - print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr"); + print_fps(av_q2d(st->r_frame_rate), tbn ? "tbr, " : "tbr"); if (tbn) - print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn"); -#if FF_API_LAVF_AVCTX -FF_DISABLE_DEPRECATION_WARNINGS - if (tbc) - print_fps(1 / av_q2d(st->codec->time_base), "tbc"); -FF_ENABLE_DEPRECATION_WARNINGS -#endif + print_fps(1 / av_q2d(st->time_base), "tbn"); } if (st->disposition & AV_DISPOSITION_DEFAULT) @@ -665,6 +666,8 @@ void av_dump_format(AVFormatContext *ic, int index, av_log(NULL, AV_LOG_INFO, "\n"); } + if (ic->nb_chapters) + av_log(NULL, AV_LOG_INFO, " Chapters:\n"); for (i = 0; i < ic->nb_chapters; i++) { const AVChapter *ch = ic->chapters[i]; av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i); @@ -673,23 +676,24 @@ void av_dump_format(AVFormatContext *ic, int index, av_log(NULL, AV_LOG_INFO, "end %f\n", ch->end * av_q2d(ch->time_base)); - dump_metadata(NULL, ch->metadata, " "); + dump_metadata(NULL, ch->metadata, " "); } if (ic->nb_programs) { int j, k, total = 0; for (j = 0; j < ic->nb_programs; j++) { - const AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata, + const AVProgram *program = ic->programs[j]; + const AVDictionaryEntry *name = av_dict_get(program->metadata, "name", NULL, 0); - av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id, + av_log(NULL, AV_LOG_INFO, " Program %d %s\n", program->id, name ? name->value : ""); - dump_metadata(NULL, ic->programs[j]->metadata, " "); - for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) { - dump_stream_format(ic, ic->programs[j]->stream_index[k], + dump_metadata(NULL, program->metadata, " "); + for (k = 0; k < program->nb_stream_indexes; k++) { + dump_stream_format(ic, program->stream_index[k], index, is_output); - printed[ic->programs[j]->stream_index[k]] = 1; + printed[program->stream_index[k]] = 1; } - total += ic->programs[j]->nb_stream_indexes; + total += program->nb_stream_indexes; } if (total < ic->nb_streams) av_log(NULL, AV_LOG_INFO, " No Program\n");