* @}
*/
+#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.
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 */
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
#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 */