From: Anton Khirnov <anton@khirnov.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 1/4] lavu/frame: allow calling av_frame_make_writable() on non-refcounted frames Date: Sun, 17 Jul 2022 21:26:57 +0200 Message-ID: <20220717192700.1077-1-anton@khirnov.net> (raw) This is an easy way to make a refcounted frame from a non-refcounted one. --- doc/APIchanges | 5 +++++ libavutil/frame.c | 3 --- libavutil/frame.h | 3 ++- libavutil/version.h | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index f9a1484bbc..4e218af94e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,11 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-07-xx - xxxxxxxxxx - lavu 57.30.100 - frame.h + av_frame_make_writable() may now be called on non-refcounted + frames and will make a refcounted copy out of them. + Previously an error was returned in such cases. + -------- 8< --------- FFmpeg 5.1 was cut here -------- 8< --------- 2022-06-12 - 7cae3d8b76 - lavf 59.25.100 - avio.h diff --git a/libavutil/frame.c b/libavutil/frame.c index 4c16488c66..7408817e1f 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -542,9 +542,6 @@ int av_frame_make_writable(AVFrame *frame) AVFrame tmp; int ret; - if (!frame->buf[0]) - return AVERROR(EINVAL); - if (av_frame_is_writable(frame)) return 0; diff --git a/libavutil/frame.h b/libavutil/frame.h index 33fac2054c..cc55d67e3c 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -818,7 +818,8 @@ int av_frame_is_writable(AVFrame *frame); * Ensure that the frame data is writable, avoiding data copy if possible. * * Do nothing if the frame is writable, allocate new buffers and copy the data - * if it is not. + * if it is not. Non-refcounted frames behave as non-writable, i.e. a copy + * is always made. * * @return 0 on success, a negative AVERROR on error. * diff --git a/libavutil/version.h b/libavutil/version.h index f185322550..734d3f8330 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 29 +#define LIBAVUTIL_VERSION_MINOR 30 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2022-07-17 19:28 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-17 19:26 Anton Khirnov [this message] 2022-07-17 19:26 ` [FFmpeg-devel] [PATCH 2/4] lavc: add API for exporting reconstructed frames from encoders Anton Khirnov 2022-07-18 12:35 ` James Almer 2022-07-18 18:05 ` [FFmpeg-devel] [PATCH] " Anton Khirnov 2022-07-18 21:29 ` James Almer 2022-07-17 19:26 ` [FFmpeg-devel] [PATCH 3/4] lavc/mpegvideo_enc: support AV_CODEC_CAP_ENCODER_RECON_FRAME Anton Khirnov 2022-07-17 19:27 ` [FFmpeg-devel] [PATCH 4/4] lavc/libx264: " Anton Khirnov 2022-07-17 22:06 ` Michael Niedermayer 2022-07-18 7:12 ` [FFmpeg-devel] [PATCH] " Anton Khirnov 2022-07-18 12:23 ` James Almer 2022-07-18 18:15 ` Anton Khirnov 2022-07-18 18:18 ` James Almer 2022-07-18 18:29 ` Anton Khirnov 2022-07-19 11:44 ` Michael Niedermayer 2022-07-19 12:43 ` Anton Khirnov 2022-07-18 17:41 ` James Almer 2022-07-18 18:07 ` Anton Khirnov 2022-07-19 12:47 ` [FFmpeg-devel] [PATCH v2] " Anton Khirnov 2022-07-19 12:51 ` James Almer 2022-07-19 12:57 ` Anton Khirnov 2022-07-19 18:13 ` James Almer 2022-07-28 14:24 ` [FFmpeg-devel] [PATCH] " Anton Khirnov 2022-07-28 14:33 ` James Almer 2022-07-18 12:24 ` [FFmpeg-devel] [PATCH 1/4] lavu/frame: allow calling av_frame_make_writable() on non-refcounted frames James Almer
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220717192700.1077-1-anton@khirnov.net \ --to=anton@khirnov.net \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git