lavu/frame: add a duration field to AVFrame

The only duration field currently present in AVFrame is pkt_duration,
which is semantically restricted to those frames that are output by
decoders.

Add a new field that stores the frame's duration without regard for how
that frame was produced. Deprecate pkt_duration.
This commit is contained in:
Anton Khirnov
2022-07-11 10:04:17 +02:00
parent 0a6bb7da55
commit 4397f9a5a0
4 changed files with 25 additions and 1 deletions

View File

@@ -604,13 +604,18 @@ typedef struct AVFrame {
*/
int64_t pkt_pos;
#if FF_API_PKT_DURATION
/**
* duration of the corresponding packet, expressed in
* AVStream->time_base units, 0 if unknown.
* - encoding: unused
* - decoding: Read by user.
*
* @deprecated use duration instead
*/
attribute_deprecated
int64_t pkt_duration;
#endif
/**
* metadata.
@@ -702,6 +707,11 @@ typedef struct AVFrame {
* Channel layout of the audio data.
*/
AVChannelLayout ch_layout;
/**
* Duration of the frame, in the same units as pts. 0 if unknown.
*/
int64_t duration;
} AVFrame;