]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/formats.c
mandelbrot: remove always-false condition in fill_from_cache
[ffmpeg] / libavfilter / formats.c
index 1959a0efcfec47e929c947446b89d868bd2680a2..b77ca8a069a5779c634209af58e926a3ec77893f 100644 (file)
@@ -138,7 +138,14 @@ int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)
     return 0;
 }
 
+#if FF_API_OLD_ALL_FORMATS_API
 AVFilterFormats *avfilter_all_formats(enum AVMediaType type)
+{
+    return avfilter_make_all_formats(type);
+}
+#endif
+
+AVFilterFormats *avfilter_make_all_formats(enum AVMediaType type)
 {
     AVFilterFormats *ret = NULL;
     int fmt;
@@ -153,30 +160,19 @@ AVFilterFormats *avfilter_all_formats(enum AVMediaType type)
     return ret;
 }
 
-AVFilterFormats *avfilter_all_channel_layouts(void)
-{
-    static int64_t chlayouts[] = {
-        AV_CH_LAYOUT_MONO,
-        AV_CH_LAYOUT_STEREO,
-        AV_CH_LAYOUT_4POINT0,
-        AV_CH_LAYOUT_QUAD,
-        AV_CH_LAYOUT_5POINT0,
-        AV_CH_LAYOUT_5POINT0_BACK,
-        AV_CH_LAYOUT_5POINT1,
-        AV_CH_LAYOUT_5POINT1_BACK,
-        AV_CH_LAYOUT_5POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX,
-        AV_CH_LAYOUT_7POINT1,
-        AV_CH_LAYOUT_7POINT1_WIDE,
-        AV_CH_LAYOUT_7POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX,
-        -1,
-    };
+const int64_t avfilter_all_channel_layouts[] = {
+#include "all_channel_layouts.h"
+    -1
+};
 
-    return avfilter_make_format64_list(chlayouts);
+AVFilterFormats *avfilter_make_all_channel_layouts(void)
+{
+    return avfilter_make_format64_list(avfilter_all_channel_layouts);
 }
 
-AVFilterFormats *avfilter_all_packing_formats(void)
+AVFilterFormats *avfilter_make_all_packing_formats(void)
 {
-    static int packing[] = {
+    static const int packing[] = {
         AVFILTER_PACKED,
         AVFILTER_PLANAR,
         -1,
@@ -266,11 +262,11 @@ int ff_parse_sample_format(int *ret, const char *arg, void *log_ctx)
     return 0;
 }
 
-int ff_parse_sample_rate(unsigned *ret, const char *arg, void *log_ctx)
+int ff_parse_sample_rate(int *ret, const char *arg, void *log_ctx)
 {
     char *tail;
     double srate = av_strtod(arg, &tail);
-    if (*tail || srate < 1 || (int)srate != srate) {
+    if (*tail || srate < 1 || (int)srate != srate || srate > INT_MAX) {
         av_log(log_ctx, AV_LOG_ERROR, "Invalid sample rate '%s'\n", arg);
         return AVERROR(EINVAL);
     }
@@ -310,3 +306,21 @@ int ff_parse_packing_format(int *ret, const char *arg, void *log_ctx)
     return 0;
 }
 
+#ifdef TEST
+
+#undef printf
+
+int main(void)
+{
+    const int64_t *cl;
+    char buf[512];
+
+    for (cl = avfilter_all_channel_layouts; *cl != -1; cl++) {
+        av_get_channel_layout_string(buf, sizeof(buf), -1, *cl);
+        printf("%s\n", buf);
+    }
+
+    return 0;
+}
+
+#endif