summaryrefslogtreecommitdiff
path: root/libavformat/mux.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-18 18:18:25 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-18 19:49:17 +0200
commitac293b66851f6c4461eab03ca91af59d5ee4e02e (patch)
tree4bcf9e474aaec1e346c368660b52e4630059e380 /libavformat/mux.c
parent88514378bac99872265dad28072fb30160b26bfa (diff)
parent194be1f43ea391eb986732707435176e579265aa (diff)
Merge commit '194be1f43ea391eb986732707435176e579265aa'
* commit '194be1f43ea391eb986732707435176e579265aa': lavf: switch to AVStream.time_base as the hint for the muxer timebase Conflicts: doc/APIchanges libavformat/filmstripenc.c libavformat/movenc.c libavformat/mxfenc.c libavformat/oggenc.c libavformat/swf.h libavformat/version.h tests/ref/lavf/mkv Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mux.c')
-rw-r--r--libavformat/mux.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 57044f3ab2..f542c9e686 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -252,6 +252,25 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
st = s->streams[i];
codec = st->codec;
+#if FF_API_LAVF_CODEC_TB
+FF_DISABLE_DEPRECATION_WARNINGS
+ if (!st->time_base.num && codec->time_base.num) {
+ av_log(s, AV_LOG_WARNING, "Using AVStream.codec.time_base as a "
+ "timebase hint to the muxer is deprecated. Set "
+ "AVStream.time_base instead.\n");
+ avpriv_set_pts_info(st, 64, codec->time_base.num, codec->time_base.den);
+ }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+ if (!st->time_base.num) {
+ /* fall back on the default timebase values */
+ if (codec->codec_type == AVMEDIA_TYPE_AUDIO && codec->sample_rate)
+ avpriv_set_pts_info(st, 64, 1, codec->sample_rate);
+ else
+ avpriv_set_pts_info(st, 33, 1, 90000);
+ }
+
switch (codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
if (codec->sample_rate <= 0) {
@@ -264,13 +283,6 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
av_get_bits_per_sample(codec->codec_id) >> 3;
break;
case AVMEDIA_TYPE_VIDEO:
- if (codec->time_base.num <= 0 ||
- codec->time_base.den <= 0) { //FIXME audio too?
- av_log(s, AV_LOG_ERROR, "time base not set\n");
- ret = AVERROR(EINVAL);
- goto fail;
- }
-
if ((codec->width <= 0 || codec->height <= 0) &&
!(of->flags & AVFMT_NODIMENSIONS)) {
av_log(s, AV_LOG_ERROR, "dimensions not set\n");