Re: [FFmpeg-devel] [PATCH 1/2] swresample/swresample: add av_warn_unused_result

2015-10-30 Thread Michael Niedermayer
On Thu, Oct 15, 2015 at 09:31:59PM -0400, Ganesh Ajjanagadde wrote:
> This will trigger a few warnings (e.g in avfilter) that need to be
> fixed.
> 
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libswresample/swresample.h | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/libswresample/swresample.h b/libswresample/swresample.h
> index 10eaebc..d21084f 100644
> --- a/libswresample/swresample.h
> +++ b/libswresample/swresample.h
> @@ -220,6 +220,7 @@ struct SwrContext *swr_alloc(void);
>   * @param[in,out]   s Swr context to initialize
>   * @return AVERROR error code in case of failure.
>   */
> +av_warn_unused_result
>  int swr_init(struct SwrContext *s);
>  
>  /**

> @@ -307,6 +308,7 @@ void swr_close(struct SwrContext *s);
>   *
>   * @return number of samples output per channel, negative value on error
>   */
> +av_warn_unused_result
>  int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,
>  const uint8_t **in , int in_count);
>  

i dont think the user needs to check the return code for simple
sample format convertions for example


> @@ -354,6 +356,7 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts);
>   *@li compensation unsupported by resampler, or
>   *@li swr_init() fails when called.
>   */
> +av_warn_unused_result
>  int swr_set_compensation(struct SwrContext *s, int sample_delta, int 
> compensation_distance);
>  
>  /**
> @@ -364,6 +367,7 @@ int swr_set_compensation(struct SwrContext *s, int 
> sample_delta, int compensatio
>   *indexes, -1 for a muted channel)
>   * @return >= 0 on success, or AVERROR error code in case of failure.
>   */
> +av_warn_unused_result
>  int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
>  
>  /**

> @@ -375,6 +379,7 @@ int swr_set_channel_mapping(struct SwrContext *s, const 
> int *channel_map);
>   * @param stride  offset between lines of the matrix
>   * @return  >= 0 on success, or AVERROR error code in case of failure.
>   */
> +av_warn_unused_result
>  int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride);

the only failure mode i see is EINVAL, so the user could know that
failure wont happen

its possible this applies to more functions

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] swresample/swresample: add av_warn_unused_result

2015-10-28 Thread Ganesh Ajjanagadde
On Thu, Oct 15, 2015 at 9:31 PM, Ganesh Ajjanagadde
 wrote:
> This will trigger a few warnings (e.g in avfilter) that need to be
> fixed.
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libswresample/swresample.h | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/libswresample/swresample.h b/libswresample/swresample.h
> index 10eaebc..d21084f 100644
> --- a/libswresample/swresample.h
> +++ b/libswresample/swresample.h
> @@ -220,6 +220,7 @@ struct SwrContext *swr_alloc(void);
>   * @param[in,out]   s Swr context to initialize
>   * @return AVERROR error code in case of failure.
>   */
> +av_warn_unused_result
>  int swr_init(struct SwrContext *s);
>
>  /**
> @@ -307,6 +308,7 @@ void swr_close(struct SwrContext *s);
>   *
>   * @return number of samples output per channel, negative value on error
>   */
> +av_warn_unused_result
>  int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,
>  const uint8_t **in , int in_count);
>
> @@ -354,6 +356,7 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts);
>   *@li compensation unsupported by resampler, or
>   *@li swr_init() fails when called.
>   */
> +av_warn_unused_result
>  int swr_set_compensation(struct SwrContext *s, int sample_delta, int 
> compensation_distance);
>
>  /**
> @@ -364,6 +367,7 @@ int swr_set_compensation(struct SwrContext *s, int 
> sample_delta, int compensatio
>   *indexes, -1 for a muted channel)
>   * @return >= 0 on success, or AVERROR error code in case of failure.
>   */
> +av_warn_unused_result
>  int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
>
>  /**
> @@ -375,6 +379,7 @@ int swr_set_channel_mapping(struct SwrContext *s, const 
> int *channel_map);
>   * @param stride  offset between lines of the matrix
>   * @return  >= 0 on success, or AVERROR error code in case of failure.
>   */
> +av_warn_unused_result
>  int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride);
>
>  /**
> @@ -395,6 +400,7 @@ int swr_set_matrix(struct SwrContext *s, const double 
> *matrix, int stride);
>   *
>   * @return >= 0 on success, or a negative AVERROR code on failure
>   */
> +av_warn_unused_result
>  int swr_drop_output(struct SwrContext *s, int count);
>
>  /**
> @@ -408,6 +414,7 @@ int swr_drop_output(struct SwrContext *s, int count);
>   *
>   * @return >= 0 on success, or a negative AVERROR code on failure
>   */
> +av_warn_unused_result
>  int swr_inject_silence(struct SwrContext *s, int count);
>
>  /**
> @@ -526,6 +533,7 @@ const char *swresample_license(void);
>   * @return0 on success, AVERROR on failure or nonmatching
>   *configuration.
>   */
> +av_warn_unused_result
>  int swr_convert_frame(SwrContext *swr,
>AVFrame *output, const AVFrame *input);
>
> @@ -543,6 +551,7 @@ int swr_convert_frame(SwrContext *swr,
>   * @param input   input AVFrame
>   * @return0 on success, AVERROR on failure.
>   */
> +av_warn_unused_result
>  int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in);
>
>  /**
> --
> 2.6.1
>

ping
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] swresample/swresample: add av_warn_unused_result

2015-10-15 Thread Ganesh Ajjanagadde
This will trigger a few warnings (e.g in avfilter) that need to be
fixed.

Signed-off-by: Ganesh Ajjanagadde 
---
 libswresample/swresample.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libswresample/swresample.h b/libswresample/swresample.h
index 10eaebc..d21084f 100644
--- a/libswresample/swresample.h
+++ b/libswresample/swresample.h
@@ -220,6 +220,7 @@ struct SwrContext *swr_alloc(void);
  * @param[in,out]   s Swr context to initialize
  * @return AVERROR error code in case of failure.
  */
+av_warn_unused_result
 int swr_init(struct SwrContext *s);
 
 /**
@@ -307,6 +308,7 @@ void swr_close(struct SwrContext *s);
  *
  * @return number of samples output per channel, negative value on error
  */
+av_warn_unused_result
 int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,
 const uint8_t **in , int in_count);
 
@@ -354,6 +356,7 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts);
  *@li compensation unsupported by resampler, or
  *@li swr_init() fails when called.
  */
+av_warn_unused_result
 int swr_set_compensation(struct SwrContext *s, int sample_delta, int 
compensation_distance);
 
 /**
@@ -364,6 +367,7 @@ int swr_set_compensation(struct SwrContext *s, int 
sample_delta, int compensatio
  *indexes, -1 for a muted channel)
  * @return >= 0 on success, or AVERROR error code in case of failure.
  */
+av_warn_unused_result
 int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
 
 /**
@@ -375,6 +379,7 @@ int swr_set_channel_mapping(struct SwrContext *s, const int 
*channel_map);
  * @param stride  offset between lines of the matrix
  * @return  >= 0 on success, or AVERROR error code in case of failure.
  */
+av_warn_unused_result
 int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride);
 
 /**
@@ -395,6 +400,7 @@ int swr_set_matrix(struct SwrContext *s, const double 
*matrix, int stride);
  *
  * @return >= 0 on success, or a negative AVERROR code on failure
  */
+av_warn_unused_result
 int swr_drop_output(struct SwrContext *s, int count);
 
 /**
@@ -408,6 +414,7 @@ int swr_drop_output(struct SwrContext *s, int count);
  *
  * @return >= 0 on success, or a negative AVERROR code on failure
  */
+av_warn_unused_result
 int swr_inject_silence(struct SwrContext *s, int count);
 
 /**
@@ -526,6 +533,7 @@ const char *swresample_license(void);
  * @return0 on success, AVERROR on failure or nonmatching
  *configuration.
  */
+av_warn_unused_result
 int swr_convert_frame(SwrContext *swr,
   AVFrame *output, const AVFrame *input);
 
@@ -543,6 +551,7 @@ int swr_convert_frame(SwrContext *swr,
  * @param input   input AVFrame
  * @return0 on success, AVERROR on failure.
  */
+av_warn_unused_result
 int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in);
 
 /**
-- 
2.6.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel