[FFmpeg-cvslog] lavc: replace avcodec_set_dimensions with ff_set_dimensions
Anton Khirnov
git at videolan.org
Fri Nov 1 13:15:27 CET 2013
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Oct 27 09:24:22 2013 +0100| [7644f5a80787c9b608b82873604805d7e38a6a18] | committer: Anton Khirnov
lavc: replace avcodec_set_dimensions with ff_set_dimensions
avcodec_set_dimensions() is supposed to be an internal utility function,
there is no reason whatsoever for it to be public. Therefore deprecate
it.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7644f5a80787c9b608b82873604805d7e38a6a18
---
libavcodec/avcodec.h | 6 ++++++
libavcodec/internal.h | 6 ++++++
libavcodec/utils.c | 19 +++++++++++++++----
libavcodec/version.h | 3 +++
4 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3f3b4d2..a4a0446 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4028,7 +4028,13 @@ enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const en
* @}
*/
+#if FF_API_SET_DIMENSIONS
+/**
+ * @deprecated this function is not supposed to be used from outside of lavc
+ */
+attribute_deprecated
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
+#endif
/**
* Put a string representing the codec tag codec_tag in buf.
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index f57bedc..2133137 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -166,4 +166,10 @@ const uint8_t *avpriv_find_start_code(const uint8_t *restrict p,
const uint8_t *end,
uint32_t *restrict state);
+/**
+ * Check that the provided frame dimensions are valid and set them on the codec
+ * context.
+ */
+int ff_set_dimensions(AVCodecContext *s, int width, int height);
+
#endif /* AVCODEC_INTERNAL_H */
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d14d4f4..1e0026d 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -152,12 +152,23 @@ unsigned avcodec_get_edge_width(void)
return EDGE_WIDTH;
}
+#if FF_API_SET_DIMENSIONS
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
{
- s->coded_width = width;
- s->coded_height = height;
- s->width = width;
- s->height = height;
+ ff_set_dimensions(s, width, height);
+}
+#endif
+
+int ff_set_dimensions(AVCodecContext *s, int width, int height)
+{
+ int ret = av_image_check_size(width, height, 0, s);
+
+ if (ret < 0)
+ width = height = 0;
+ s->width = s->coded_width = width;
+ s->height = s->coded_height = height;
+
+ return ret;
}
#if HAVE_NEON || ARCH_PPC || HAVE_MMX
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 838587f..b2b745d 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -73,5 +73,8 @@
#ifndef FF_API_VOXWARE
#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 56)
#endif
+#ifndef FF_API_SET_DIMENSIONS
+#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
#endif /* AVCODEC_VERSION_H */
More information about the ffmpeg-cvslog
mailing list