aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/dump.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-10 20:58:15 +0100
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-10 20:59:55 +0100
commit6f69f7a8bf6a0d013985578df2ef42ee6b1c7994 (patch)
tree0c2ec8349ff1763d5f48454b8b9f26374dbd80b0 /libavformat/dump.c
parent60b75186b2c878b6257b43c8fcc0b1356ada218e (diff)
parent9200514ad8717c63f82101dc394f4378854325bf (diff)
downloadffmpeg-6f69f7a8bf6a0d013985578df2ef42ee6b1c7994.tar.gz
Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavformat/dump.c')
-rw-r--r--libavformat/dump.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 86bb82da13..3d117f6fdf 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -440,14 +440,24 @@ static void dump_stream_format(AVFormatContext *ic, int i,
AVStream *st = ic->streams[i];
AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
char *separator = ic->dump_separator;
- char **codec_separator = av_opt_ptr(st->codec->av_class, st->codec, "dump_separator");
- int use_format_separator = !*codec_separator;
-
- if (use_format_separator)
- *codec_separator = av_strdup(separator);
- avcodec_string(buf, sizeof(buf), st->codec, is_output);
- if (use_format_separator)
- av_freep(codec_separator);
+ AVCodecContext *avctx;
+ int ret;
+
+ avctx = avcodec_alloc_context3(NULL);
+ if (!avctx)
+ return;
+
+ ret = avcodec_parameters_to_context(avctx, st->codecpar);
+ if (ret < 0) {
+ avcodec_free_context(&avctx);
+ return;
+ }
+
+ 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);
/* the pid is an important information, so we display it */
@@ -460,35 +470,32 @@ static void dump_stream_format(AVFormatContext *ic, int i,
st->time_base.num, st->time_base.den);
av_log(NULL, AV_LOG_INFO, ": %s", buf);
- if (st->sample_aspect_ratio.num && // default
- av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) {
+ if (st->sample_aspect_ratio.num &&
+ av_cmp_q(st->sample_aspect_ratio, st->codecpar->sample_aspect_ratio)) {
AVRational display_aspect_ratio;
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
- st->codec->width * (int64_t)st->sample_aspect_ratio.num,
- st->codec->height * (int64_t)st->sample_aspect_ratio.den,
+ st->codecpar->width * (int64_t)st->sample_aspect_ratio.num,
+ st->codecpar->height * (int64_t)st->sample_aspect_ratio.den,
1024 * 1024);
av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d",
st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
display_aspect_ratio.num, display_aspect_ratio.den);
}
- if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
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;
- int tbc = st->codec->time_base.den && st->codec->time_base.num;
- 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 (tbc)
- print_fps(1 / av_q2d(st->codec->time_base), "tbc");
+ print_fps(1 / av_q2d(st->time_base), "tbn");
}
if (st->disposition & AV_DISPOSITION_DEFAULT)