[FFmpeg-devel] [PATCH] lavc: report frame field order in avctx
Rodger Combs
rodger.combs at gmail.com
Thu Nov 17 12:48:07 EET 2016
> On Nov 15, 2016, at 03:43, Michael Niedermayer <michael at niedermayer.cc> wrote:
>
> 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
Is this a real case?
What I really need here is a stream-level "is interlaced" indicator; I've considered adding an AV_FIELD_INTERLACED_UNKNOWN value to indicate "This is interlaced, but I don't know the field order".
Thoughts?
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> What does censorship reveal? It reveals fear. -- Julian Assange
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org <mailto:ffmpeg-devel at ffmpeg.org>
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel <http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>
More information about the ffmpeg-devel
mailing list