mirror of https://git.ffmpeg.org/ffmpeg.git
lavc/encode: combine setting no-delay pts for video/audio
This commit is contained in:
parent
8789720d28
commit
adb927fa7a
|
@ -209,13 +209,13 @@ int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
|
||||||
av_assert0(avpkt->buf);
|
av_assert0(avpkt->buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->codec->type == AVMEDIA_TYPE_VIDEO &&
|
// set the timestamps for the simple no-delay case
|
||||||
!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
|
// encoders with delay have to set the timestamps themselves
|
||||||
avpkt->pts = frame->pts;
|
|
||||||
if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY)) {
|
if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY)) {
|
||||||
if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
|
|
||||||
if (avpkt->pts == AV_NOPTS_VALUE)
|
if (avpkt->pts == AV_NOPTS_VALUE)
|
||||||
avpkt->pts = frame->pts;
|
avpkt->pts = frame->pts;
|
||||||
|
|
||||||
|
if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
|
||||||
if (!avpkt->duration)
|
if (!avpkt->duration)
|
||||||
avpkt->duration = ff_samples_to_time_base(avctx,
|
avpkt->duration = ff_samples_to_time_base(avctx,
|
||||||
frame->nb_samples);
|
frame->nb_samples);
|
||||||
|
|
Loading…
Reference in New Issue