Commit 22ec35a4 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by James Almer

avformat/av1, hevc: Make *_buf-functions return 0 on success

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: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 680cd59b
...@@ -76,7 +76,7 @@ int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size) ...@@ -76,7 +76,7 @@ int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size)
av_freep(out); av_freep(out);
*size = avio_close_dyn_buf(pb, out); *size = avio_close_dyn_buf(pb, out);
return ret; return 0;
} }
static inline void uvlc(GetBitContext *gb) static inline void uvlc(GetBitContext *gb)
......
...@@ -66,8 +66,8 @@ int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size); ...@@ -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 * @param size size of the input data buffer. The size of the resulting output
data buffer will be written here data buffer will be written here
* *
* @return the amount of bytes written in case of success, a negative AVERROR * @return 0 in case of success, a negative AVERROR code in case of failure.
* code in case of failure. On failure, out and size are unchanged * On failure, out and size are unchanged
*/ */
int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size); int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size);
......
...@@ -1062,7 +1062,7 @@ int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, ...@@ -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); *size = avio_close_dyn_buf(pb, buf_out);
return ret; return 0;
} }
int ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data, int ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data,
......
...@@ -71,8 +71,8 @@ int ff_hevc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in, ...@@ -71,8 +71,8 @@ int ff_hevc_annexb2mp4(AVIOContext *pb, const uint8_t *buf_in,
* or to discard them (non-zero) * or to discard them (non-zero)
* @param ps_count address of the variable where the number of discarded * @param ps_count address of the variable where the number of discarded
* parameter set NAL units shall be written, may be NULL * parameter set NAL units shall be written, may be NULL
* @return the amount (in bytes) of data written in case of success, a negative * @return 0 in case of success, a negative value corresponding to an AVERROR
* value corresponding to an AVERROR code in case of failure * code in case of failure
*/ */
int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out,
int *size, int filter_ps, int *ps_count); int *size, int filter_ps, int *ps_count);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment