diff options
author | James Almer <jamrial@gmail.com> | 2018-03-19 12:39:08 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2018-03-21 22:17:40 -0300 |
commit | f14ca600015d234f383e9ea5ba5c9f9830271cb3 (patch) | |
tree | 3a975ea16cbe70b340afca7d932e31ba286634ac /libavcodec/avcodec.h | |
parent | 28aaed773712d170e13f35658aac685dd8b7db44 (diff) |
avcodec/avpacket: add av_packet_make_writable()
Useful as well to quickly make a packet reference counted when it
isn't already so.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/avcodec.h')
-rw-r--r-- | libavcodec/avcodec.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index a8322fb62a..a78017f1fb 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4519,6 +4519,17 @@ void av_packet_move_ref(AVPacket *dst, AVPacket *src); int av_packet_copy_props(AVPacket *dst, const AVPacket *src); /** + * Create a writable reference for the data described by a given packet, + * avoiding data copy if possible. + * + * @param pkt Packet whose data should be made writable. + * + * @return 0 on success, a negative AVERROR on failure. On failure, the + * packet is unchanged. + */ +int av_packet_make_writable(AVPacket *pkt); + +/** * Convert valid timing fields (timestamps / durations) in a packet from one * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be * ignored. |