You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
libavformat/utils: Only consider dvb teletext timestamps for start time when they are consistent with the rest.
This fixes Ticket51. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -1797,18 +1797,23 @@ static int av_has_duration(AVFormatContext *ic)
|
|||||||
*/
|
*/
|
||||||
static void av_update_stream_timings(AVFormatContext *ic)
|
static void av_update_stream_timings(AVFormatContext *ic)
|
||||||
{
|
{
|
||||||
int64_t start_time, start_time1, end_time, end_time1;
|
int64_t start_time, start_time1, start_time_text, end_time, end_time1;
|
||||||
int64_t duration, duration1;
|
int64_t duration, duration1;
|
||||||
int i;
|
int i;
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
|
|
||||||
start_time = INT64_MAX;
|
start_time = INT64_MAX;
|
||||||
|
start_time_text = INT64_MAX;
|
||||||
end_time = INT64_MIN;
|
end_time = INT64_MIN;
|
||||||
duration = INT64_MIN;
|
duration = INT64_MIN;
|
||||||
for(i = 0;i < ic->nb_streams; i++) {
|
for(i = 0;i < ic->nb_streams; i++) {
|
||||||
st = ic->streams[i];
|
st = ic->streams[i];
|
||||||
if (st->start_time != AV_NOPTS_VALUE && st->time_base.den) {
|
if (st->start_time != AV_NOPTS_VALUE && st->time_base.den) {
|
||||||
start_time1= av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q);
|
start_time1= av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q);
|
||||||
|
if (st->codec->codec_id == CODEC_ID_DVB_TELETEXT) {
|
||||||
|
if (start_time1 < start_time_text)
|
||||||
|
start_time_text = start_time1;
|
||||||
|
} else
|
||||||
if (start_time1 < start_time)
|
if (start_time1 < start_time)
|
||||||
start_time = start_time1;
|
start_time = start_time1;
|
||||||
if (st->duration != AV_NOPTS_VALUE) {
|
if (st->duration != AV_NOPTS_VALUE) {
|
||||||
@@ -1824,6 +1829,8 @@ static void av_update_stream_timings(AVFormatContext *ic)
|
|||||||
duration = duration1;
|
duration = duration1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (start_time == INT64_MAX || (start_time > start_time_text && start_time - start_time_text < AV_TIME_BASE))
|
||||||
|
start_time = start_time_text;
|
||||||
if (start_time != INT64_MAX) {
|
if (start_time != INT64_MAX) {
|
||||||
ic->start_time = start_time;
|
ic->start_time = start_time;
|
||||||
if (end_time != INT64_MIN) {
|
if (end_time != INT64_MIN) {
|
||||||
|
Reference in New Issue
Block a user