[FFmpeg-devel] [PATCH] lavc: report frame field order in avctx
Michael Niedermayer
michael at niedermayer.cc
Tue Nov 15 11:43:32 EET 2016
On Mon, Nov 14, 2016 at 05:19:25PM -0600, Rodger Combs wrote:
> ---
> libavcodec/utils.c | 13 +++++++++++++
> tests/api/api-codec-param-test.c | 3 +++
> tests/fate/matroska.mak | 2 +-
> tests/ref/fate/api-mjpeg-codec-param | 2 +-
> tests/ref/fate/api-png-codec-param | 2 +-
> tests/ref/fate/mov-zombie | 2 +-
> 6 files changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index d6dca18..b9af880 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -2296,6 +2296,12 @@ fail:
> guess_correct_pts(avctx,
> picture->pts,
> picture->pkt_dts));
> +
> + if (avctx->field_order == AV_FIELD_UNKNOWN) {
> + avctx->field_order = picture->interlaced_frame
> + ? (picture->top_field_first ? AV_FIELD_TT : AV_FIELD_BB)
> + : AV_FIELD_PROGRESSIVE;
> + }
> } else
> av_frame_unref(picture);
> } else
> @@ -2895,6 +2901,13 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
> av_frame_set_best_effort_timestamp(frame,
> guess_correct_pts(avctx, frame->pts, frame->pkt_dts));
> }
> +
> + if (avctx->field_order == AV_FIELD_UNKNOWN &&
> + avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
> + avctx->field_order = frame->interlaced_frame
> + ? (frame->top_field_first ? AV_FIELD_TT : AV_FIELD_BB)
> + : AV_FIELD_PROGRESSIVE;
> + }
> }
> return ret;
> }
This doesnt leave any "unknown" option left.
What should a decoder do that knows the field order is unknown
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
What does censorship reveal? It reveals fear. -- Julian Assange
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161115/65eb2772/attachment.sig>
More information about the ffmpeg-devel
mailing list