diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-02 00:41:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-02 01:09:12 +0200 |
commit | e3fb5bc1472c600af628df10e1472a4319781640 (patch) | |
tree | 9ea388e8d0c0c1ed40625105de17ef607b0e9c67 /libavformat | |
parent | 4eb0f5f635462562275200ecb6b4e1b718fcae37 (diff) | |
download | ffmpeg-e3fb5bc1472c600af628df10e1472a4319781640.tar.gz |
nut: store and read the r_frame_rate
With this, when we use a finer timebase than neccessary to store
durations the demuxer still knows what the original timebase was.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/nutdec.c | 6 | ||||
-rw-r--r-- | libavformat/nutenc.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index d6732b289b..d9d115daf8 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -510,6 +510,12 @@ static int decode_info_header(NUTContext *nut) set_disposition_bits(s, str_value, stream_id_plus1 - 1); continue; } + + if (stream_id_plus1 && !strcmp(name, "r_frame_rate")) { + sscanf(str_value, "%d/%d", &st->r_frame_rate.num, &st->r_frame_rate.den); + continue; + } + if (metadata && av_strcasecmp(name, "Uses") && av_strcasecmp(name, "Depends") && av_strcasecmp(name, "Replaces")) av_dict_set(metadata, name, str_value, 0); diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 955a6fb5fa..5133adee08 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -485,6 +485,11 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){ if (st->disposition & ff_nut_dispositions[i].flag) count += add_info(dyn_bc, "Disposition", ff_nut_dispositions[i].str); } + if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { + uint8_t buf[256]; + snprintf(buf, sizeof(buf), "%d/%d", st->codec->time_base.den, st->codec->time_base.num); + count += add_info(dyn_bc, "r_frame_rate", buf); + } dyn_size = avio_close_dyn_buf(dyn_bc, &dyn_buf); if (count) { |