Commit bf0d2d60 authored by Ganesh Ajjanagadde's avatar Ganesh Ajjanagadde

avfilter/formats: add av_warn_unused_result to function prototypes

This uses the av_warn_unused_result attribute liberally to catch some forms of improper
usage of functions defined in avfilter/formats.h.
Reviewed-by: 's avatarNicolas George <george@nsup.org>
Signed-off-by: 's avatarGanesh Ajjanagadde <gajjanagadde@gmail.com>
parent 6aaac24d
...@@ -125,15 +125,20 @@ AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a, ...@@ -125,15 +125,20 @@ AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
* Construct an empty AVFilterChannelLayouts/AVFilterFormats struct -- * Construct an empty AVFilterChannelLayouts/AVFilterFormats struct --
* representing any channel layout (with known disposition)/sample rate. * representing any channel layout (with known disposition)/sample rate.
*/ */
av_warn_unused_result
AVFilterChannelLayouts *ff_all_channel_layouts(void); AVFilterChannelLayouts *ff_all_channel_layouts(void);
av_warn_unused_result
AVFilterFormats *ff_all_samplerates(void); AVFilterFormats *ff_all_samplerates(void);
/** /**
* Construct an AVFilterChannelLayouts coding for any channel layout, with * Construct an AVFilterChannelLayouts coding for any channel layout, with
* known or unknown disposition. * known or unknown disposition.
*/ */
av_warn_unused_result
AVFilterChannelLayouts *ff_all_channel_counts(void); AVFilterChannelLayouts *ff_all_channel_counts(void);
av_warn_unused_result
AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts); AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts);
...@@ -142,8 +147,10 @@ AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts); ...@@ -142,8 +147,10 @@ AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts);
* layouts/sample rates. If there are no links hooked to this filter, the list * layouts/sample rates. If there are no links hooked to this filter, the list
* is freed. * is freed.
*/ */
av_warn_unused_result
int ff_set_common_channel_layouts(AVFilterContext *ctx, int ff_set_common_channel_layouts(AVFilterContext *ctx,
AVFilterChannelLayouts *layouts); AVFilterChannelLayouts *layouts);
av_warn_unused_result
int ff_set_common_samplerates(AVFilterContext *ctx, int ff_set_common_samplerates(AVFilterContext *ctx,
AVFilterFormats *samplerates); AVFilterFormats *samplerates);
...@@ -152,13 +159,16 @@ int ff_set_common_samplerates(AVFilterContext *ctx, ...@@ -152,13 +159,16 @@ int ff_set_common_samplerates(AVFilterContext *ctx,
* formats. If there are no links hooked to this filter, the list of formats is * formats. If there are no links hooked to this filter, the list of formats is
* freed. * freed.
*/ */
av_warn_unused_result
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats); int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
av_warn_unused_result
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout); int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);
/** /**
* Add *ref as a new reference to f. * Add *ref as a new reference to f.
*/ */
av_warn_unused_result
int ff_channel_layouts_ref(AVFilterChannelLayouts *f, int ff_channel_layouts_ref(AVFilterChannelLayouts *f,
AVFilterChannelLayouts **ref); AVFilterChannelLayouts **ref);
...@@ -170,6 +180,7 @@ void ff_channel_layouts_unref(AVFilterChannelLayouts **ref); ...@@ -170,6 +180,7 @@ void ff_channel_layouts_unref(AVFilterChannelLayouts **ref);
void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref, void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
AVFilterChannelLayouts **newref); AVFilterChannelLayouts **newref);
av_warn_unused_result
int ff_default_query_formats(AVFilterContext *ctx); int ff_default_query_formats(AVFilterContext *ctx);
/** /**
...@@ -178,6 +189,7 @@ int ff_default_query_formats(AVFilterContext *ctx); ...@@ -178,6 +189,7 @@ int ff_default_query_formats(AVFilterContext *ctx);
* accepts channel layouts with unknown disposition. It should only be used * accepts channel layouts with unknown disposition. It should only be used
* with audio filters. * with audio filters.
*/ */
av_warn_unused_result
int ff_query_formats_all(AVFilterContext *ctx); int ff_query_formats_all(AVFilterContext *ctx);
...@@ -188,6 +200,7 @@ int ff_query_formats_all(AVFilterContext *ctx); ...@@ -188,6 +200,7 @@ int ff_query_formats_all(AVFilterContext *ctx);
* @param fmts list of media formats, terminated by -1 * @param fmts list of media formats, terminated by -1
* @return the format list, with no existing references * @return the format list, with no existing references
*/ */
av_warn_unused_result
AVFilterFormats *ff_make_format_list(const int *fmts); AVFilterFormats *ff_make_format_list(const int *fmts);
/** /**
...@@ -198,16 +211,19 @@ AVFilterFormats *ff_make_format_list(const int *fmts); ...@@ -198,16 +211,19 @@ AVFilterFormats *ff_make_format_list(const int *fmts);
* @return a non negative value in case of success, or a negative * @return a non negative value in case of success, or a negative
* value corresponding to an AVERROR code in case of error * value corresponding to an AVERROR code in case of error
*/ */
av_warn_unused_result
int ff_add_format(AVFilterFormats **avff, int64_t fmt); int ff_add_format(AVFilterFormats **avff, int64_t fmt);
/** /**
* Return a list of all formats supported by FFmpeg for the given media type. * Return a list of all formats supported by FFmpeg for the given media type.
*/ */
av_warn_unused_result
AVFilterFormats *ff_all_formats(enum AVMediaType type); AVFilterFormats *ff_all_formats(enum AVMediaType type);
/** /**
* Construct a formats list containing all planar sample formats. * Construct a formats list containing all planar sample formats.
*/ */
av_warn_unused_result
AVFilterFormats *ff_planar_sample_fmts(void); AVFilterFormats *ff_planar_sample_fmts(void);
/** /**
...@@ -233,6 +249,7 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b, ...@@ -233,6 +249,7 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b,
* | |____| | | |____| * | |____| | | |____|
* |________| |________________________ * |________| |________________________
*/ */
av_warn_unused_result
int ff_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref); int ff_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref);
/** /**
......
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