[FFmpeg-devel] [PATCH 4/6] avformat/av1, hevc: Make *_buf-functions return 0 on success

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Thu Jan 23 18:08:30 EET 2020


The output size is already returned via a pointer argument, so there is
no need to return it via the ordinary return value as well. The
rationale behind this is to not poison the return value on success.
It also unifies the behaviour of the *_buf-functions for AVC, AV1 and
HEVC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavformat/av1.c  | 2 +-
 libavformat/av1.h  | 4 ++--
 libavformat/hevc.c | 2 +-
 libavformat/hevc.h | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/av1.c b/libavformat/av1.c
index 5ad9222900..4ff4bffddf 100644
--- a/libavformat/av1.c
+++ b/libavformat/av1.c
@@ -76,7 +76,7 @@ int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size)
     av_freep(out);
     *size = avio_close_dyn_buf(pb, out);
 
-    return ret;
+    return 0;
 }
 
 static inline void uvlc(GetBitContext *gb)
diff --git a/libavformat/av1.h b/libavformat/av1.h
index 9354889afe..0578435376 100644
--- a/libavformat/av1.h
+++ b/libavformat/av1.h
@@ -66,8 +66,8 @@ int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size);
  * @param size size of the input data buffer. The size of the resulting output
                data buffer will be written here
  *
- * @return the amount of bytes written in case of success, a negative AVERROR
- *         code in case of failure. On failure, out and size are unchanged
+ * @return 0 in case of success, a negative AVERROR code in case of failure.
+ *         On failure, out and size are unchanged
  */
 int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size);
 
diff --git a/libavformat/hevc.c b/libavformat/hevc.c
index db931d2017..f621cb2f19 100644
--- a/libavformat/hevc.c
+++ b/libavformat/hevc.c
@@ -1062,7 +1062,7 @@ int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out,
 
     *size = avio_close_dyn_buf(pb, buf_out);
 
-    return ret;
+    return 0;
 }
 
 int ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data,
diff --git a/libavformat/hevc.h b/libavformat/hevc.h
index 1e355cd34a..bb144397c0 100644
--- a/libavformat/hevc.h
+++ b/libavformat/hevc.h
@@ -71,8 +71,8 @@ int ff_hevc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in,
  *        or to discard them (non-zero)
  * @param ps_count address of the variable where the number of discarded
  *        parameter set NAL units shall be written, may be NULL
- * @return the amount (in bytes) of data written in case of success, a negative
- *         value corresponding to an AVERROR code in case of failure
+ * @return 0 in case of success, a negative value corresponding to an AVERROR
+ *         code in case of failure
  */
 int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out,
                            int *size, int filter_ps, int *ps_count);
-- 
2.20.1



More information about the ffmpeg-devel mailing list