diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-06-18 18:18:25 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-18 19:49:17 +0200 |
commit | ac293b66851f6c4461eab03ca91af59d5ee4e02e (patch) | |
tree | 4bcf9e474aaec1e346c368660b52e4630059e380 /libavformat/mpegtsenc.c | |
parent | 88514378bac99872265dad28072fb30160b26bfa (diff) | |
parent | 194be1f43ea391eb986732707435176e579265aa (diff) | |
download | ffmpeg-ac293b66851f6c4461eab03ca91af59d5ee4e02e.tar.gz |
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/mpegtsenc.c')
-rw-r--r-- | libavformat/mpegtsenc.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index f0d9cd2780..a4a32e0e16 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -201,6 +201,7 @@ typedef struct MpegTSWriteStream { int payload_flags; uint8_t *payload; AVFormatContext *amux; + AVRational user_tb; } MpegTSWriteStream; static void mpegts_write_pat(AVFormatContext *s) @@ -602,13 +603,17 @@ static int mpegts_write_header(AVFormatContext *s) /* assign pids to each stream */ for(i = 0;i < s->nb_streams; i++) { st = s->streams[i]; - avpriv_set_pts_info(st, 33, 1, 90000); + ts_st = av_mallocz(sizeof(MpegTSWriteStream)); if (!ts_st) { ret = AVERROR(ENOMEM); goto fail; } st->priv_data = ts_st; + + ts_st->user_tb = st->time_base; + avpriv_set_pts_info(st, 33, 1, 90000); + ts_st->payload = av_mallocz(ts->pes_payload_size); if (!ts_st->payload) { ret = AVERROR(ENOMEM); @@ -683,7 +688,8 @@ static int mpegts_write_header(AVFormatContext *s) pcr_st = s->streams[0]; ts_st = pcr_st->priv_data; service->pcr_pid = ts_st->pid; - } + } else + ts_st = pcr_st->priv_data; if (ts->mux_rate > 1) { service->pcr_packet_period = (ts->mux_rate * ts->pcr_period) / @@ -710,8 +716,9 @@ static int mpegts_write_header(AVFormatContext *s) } } else { // max delta PCR 0.1s + // TODO: should be avg_frame_rate service->pcr_packet_period = - pcr_st->codec->time_base.den/(10*pcr_st->codec->time_base.num); + ts_st->user_tb.den / (10 * ts_st->user_tb.num); } if(!service->pcr_packet_period) service->pcr_packet_period = 1; |