History

mfenc: Fall back to avctx->time_base if avctx->framerate isn't set

The framerate field is the one users are supposed to set, but not all users might be setting it, so it might be good to fall back time_base in that case.

Martin Storsjö committed 6 years ago

Commit c116c121 parent fea5f5b1 file · +9 −1Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/mfenc.c+9−1
@@ -637,11 +637,19 @@ static int64_t mf_encv_output_score(AVCodecContext *avctx, IMFMediaType *type) · 636 unmodified lines
637637 static int mf_encv_output_adjust(AVCodecContext *avctx, IMFMediaType *type)
638638 {
639639 MFContext *c = avctx->priv_data;
640+ AVRational framerate;
640641
641642 ff_MFSetAttributeSize((IMFAttributes *)type, &MF_MT_FRAME_SIZE, avctx->width, avctx->height);
642643 IMFAttributes_SetUINT32(type, &MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive);
643644
644− ff_MFSetAttributeRatio((IMFAttributes *)type, &MF_MT_FRAME_RATE, avctx->framerate.num, avctx->framerate.den);
645+ if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
646+ framerate = avctx->framerate;
647+ } else {
648+ framerate = av_inv_q(avctx->time_base);
649+ framerate.den *= avctx->ticks_per_frame;
650+ }
651+
652+ ff_MFSetAttributeRatio((IMFAttributes *)type, &MF_MT_FRAME_RATE, framerate.num, framerate.den);
645653
646654 // (MS HEVC supports eAVEncH265VProfile_Main_420_8 only.)
647655 if (avctx->codec_id == AV_CODEC_ID_H264) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t