|
|
@ -2596,11 +2596,11 @@ int av_write_header(AVFormatContext *s) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//FIXME merge with compute_pkt_fields
|
|
|
|
//FIXME merge with compute_pkt_fields
|
|
|
|
static int compute_pkt_fields2(AVStream *st, AVPacket *pkt){ |
|
|
|
static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){ |
|
|
|
int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames); |
|
|
|
int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames); |
|
|
|
int num, den, frame_size, i; |
|
|
|
int num, den, frame_size, i; |
|
|
|
|
|
|
|
|
|
|
|
// av_log(st->codec, AV_LOG_DEBUG, "av_write_frame: pts:%"PRId64" dts:%"PRId64" cur_dts:%"PRId64" b:%d size:%d st:%d\n", pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index);
|
|
|
|
// av_log(s, AV_LOG_DEBUG, "av_write_frame: pts:%"PRId64" dts:%"PRId64" cur_dts:%"PRId64" b:%d size:%d st:%d\n", pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index);
|
|
|
|
|
|
|
|
|
|
|
|
/* if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE)
|
|
|
|
/* if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE)
|
|
|
|
return -1;*/ |
|
|
|
return -1;*/ |
|
|
@ -2635,15 +2635,17 @@ static int compute_pkt_fields2(AVStream *st, AVPacket *pkt){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && st->cur_dts >= pkt->dts){ |
|
|
|
if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && st->cur_dts >= pkt->dts){ |
|
|
|
av_log(st->codec, AV_LOG_ERROR, "error, non monotone timestamps %"PRId64" >= %"PRId64"\n", st->cur_dts, pkt->dts); |
|
|
|
av_log(s, AV_LOG_ERROR, |
|
|
|
|
|
|
|
"st:%d error, non monotone timestamps %"PRId64" >= %"PRId64"\n", |
|
|
|
|
|
|
|
st->index, st->cur_dts, pkt->dts); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts){ |
|
|
|
if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts){ |
|
|
|
av_log(st->codec, AV_LOG_ERROR, "error, pts < dts\n"); |
|
|
|
av_log(s, AV_LOG_ERROR, "st:%d error, pts < dts\n", st->index); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// av_log(NULL, AV_LOG_DEBUG, "av_write_frame: pts2:%"PRId64" dts2:%"PRId64"\n", pkt->pts, pkt->dts);
|
|
|
|
// av_log(s, AV_LOG_DEBUG, "av_write_frame: pts2:%"PRId64" dts2:%"PRId64"\n", pkt->pts, pkt->dts);
|
|
|
|
st->cur_dts= pkt->dts; |
|
|
|
st->cur_dts= pkt->dts; |
|
|
|
st->pts.val= pkt->dts; |
|
|
|
st->pts.val= pkt->dts; |
|
|
|
|
|
|
|
|
|
|
@ -2670,7 +2672,7 @@ static int compute_pkt_fields2(AVStream *st, AVPacket *pkt){ |
|
|
|
|
|
|
|
|
|
|
|
int av_write_frame(AVFormatContext *s, AVPacket *pkt) |
|
|
|
int av_write_frame(AVFormatContext *s, AVPacket *pkt) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int ret = compute_pkt_fields2(s->streams[pkt->stream_index], pkt); |
|
|
|
int ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt); |
|
|
|
|
|
|
|
|
|
|
|
if(ret<0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) |
|
|
|
if(ret<0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
@ -2784,7 +2786,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){ |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
//av_log(NULL, AV_LOG_DEBUG, "av_interleaved_write_frame %d %"PRId64" %"PRId64"\n", pkt->size, pkt->dts, pkt->pts);
|
|
|
|
//av_log(NULL, AV_LOG_DEBUG, "av_interleaved_write_frame %d %"PRId64" %"PRId64"\n", pkt->size, pkt->dts, pkt->pts);
|
|
|
|
if(compute_pkt_fields2(st, pkt) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) |
|
|
|
if(compute_pkt_fields2(s, st, pkt) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
if(pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) |
|
|
|
if(pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) |
|
|
|