This adds a time_base field (currently unused), analogue to the AVPacket.time_base field. This allows for API clients to exchange AVFrames directly, without needing to plumb extra data from sources via side mechanisms.
Patch attached.
>From 7a5b8fe31ff7e193ddd776daf8aac1c2c528d8d2 Mon Sep 17 00:00:00 2001 From: Lynne <d...@lynne.ee> Date: Thu, 25 Nov 2021 18:26:20 +0100 Subject: [PATCH] lavu/avframe: add a time_base field This adds a time_base field (currently unused), analogue to the AVPacket.time_base field. --- libavutil/frame.c | 2 ++ libavutil/frame.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/libavutil/frame.c b/libavutil/frame.c index d4d3ad6988..64eed5b0dd 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -63,6 +63,7 @@ static void get_frame_defaults(AVFrame *frame) frame->pkt_duration = 0; frame->pkt_pos = -1; frame->pkt_size = -1; + frame->time_base = (AVRational){ 0, 1 }; frame->key_frame = 1; frame->sample_aspect_ratio = (AVRational){ 0, 1 }; frame->format = -1; /* unknown */ @@ -278,6 +279,7 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy) dst->pkt_pos = src->pkt_pos; dst->pkt_size = src->pkt_size; dst->pkt_duration = src->pkt_duration; + dst->time_base = src->time_base; dst->reordered_opaque = src->reordered_opaque; dst->quality = src->quality; dst->best_effort_timestamp = src->best_effort_timestamp; diff --git a/libavutil/frame.h b/libavutil/frame.h index 753234792e..66fe3070f8 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -421,6 +421,12 @@ typedef struct AVFrame { */ int64_t pkt_dts; + /** + * Time base for the timestamps in this frame. May be 0, in which case the + * time_base from the frame source should be used. + */ + AVRational time_base; + /** * picture number in bitstream order */ -- 2.34.0
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".