[FFmpeg-devel] [PATCH] transform: give avfilter_transform() a return value for returning an error

Michael Niedermayer michaelni at gmx.at
Thu Nov 1 00:44:41 CET 2012


Fixes CID703674
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavfilter/transform.c |    5 ++++-
 libavfilter/transform.h |    3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavfilter/transform.c b/libavfilter/transform.c
index b3f85dd..1db8c08 100644
--- a/libavfilter/transform.c
+++ b/libavfilter/transform.c
@@ -146,7 +146,7 @@ static inline int mirror(int v, int m)
     return v;
 }
 
-void avfilter_transform(const uint8_t *src, uint8_t *dst,
+int avfilter_transform(const uint8_t *src, uint8_t *dst,
                         int src_stride, int dst_stride,
                         int width, int height, const float *matrix,
                         enum InterpolateMethod interpolate,
@@ -167,6 +167,8 @@ void avfilter_transform(const uint8_t *src, uint8_t *dst,
         case INTERPOLATE_BIQUADRATIC:
             func = interpolate_biquadratic;
             break;
+        default:
+            return AVERROR(EINVAL);
     }
 
     for (y = 0; y < height; y++) {
@@ -195,5 +197,6 @@ void avfilter_transform(const uint8_t *src, uint8_t *dst,
             dst[y * dst_stride + x] = func(x_s, y_s, src, width, height, src_stride, def);
         }
     }
+    return 0;
 }
 
diff --git a/libavfilter/transform.h b/libavfilter/transform.h
index edd0cf2..07436bf 100644
--- a/libavfilter/transform.h
+++ b/libavfilter/transform.h
@@ -116,8 +116,9 @@ void avfilter_mul_matrix(const float *m1, float scalar, float *result);
  * @param matrix      9-item affine transformation matrix
  * @param interpolate pixel interpolation method
  * @param fill        edge fill method
+ * @return negative on error
  */
-void avfilter_transform(const uint8_t *src, uint8_t *dst,
+int avfilter_transform(const uint8_t *src, uint8_t *dst,
                         int src_stride, int dst_stride,
                         int width, int height, const float *matrix,
                         enum InterpolateMethod interpolate,
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list