diff options
author | James Almer <jamrial@gmail.com> | 2019-10-04 17:54:28 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2020-01-16 05:33:41 +0300 |
commit | 717b2074ecf3ade6b213ee8d67efa23f12a4e67e (patch) | |
tree | aed0c73697a812fb098d16e2d72038fc9e029529 /libavcodec/avpacket.c | |
parent | ea5a9106287b85ea702a13e83778f80dab51143b (diff) |
avcodec: add a Producer Reference Time AVPacketSideData type
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/avpacket.c')
-rw-r--r-- | libavcodec/avpacket.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 858f827a0a..74845efcd2 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -741,3 +741,25 @@ int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, i return 0; } + +int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp) +{ + AVProducerReferenceTime *prft; + uint8_t *side_data; + int side_data_size; + + side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size); + if (!side_data) { + side_data_size = sizeof(AVProducerReferenceTime); + side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_PRFT, side_data_size); + } + + if (!side_data || side_data_size < sizeof(AVProducerReferenceTime)) + return AVERROR(ENOMEM); + + prft = (AVProducerReferenceTime *)side_data; + prft->wallclock = timestamp; + prft->flags = 0; + + return 0; +} |