]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/parseutils.c
Pass codec pixel format list to get_format, if present, fix vdpau decoding
[ffmpeg] / libavfilter / parseutils.c
index f407b2bef97648364029e7fb63bf50df3cc19daa..9ac61d80730fc429980a86b82b9049c4b21f2af1 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 /**
- * @file libavfilter/parseutils.c
+ * @file
  * parsing utils
  */
 
@@ -218,7 +218,7 @@ static int color_table_compare(const void *lhs, const void *rhs)
 int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
 {
     if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) {
-        int rgba = ff_random_get_seed();
+        int rgba = av_get_random_seed();
         rgba_color[0] = rgba >> 24;
         rgba_color[1] = rgba >> 16;
         rgba_color[2] = rgba >> 8;
@@ -227,11 +227,11 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
     if (!strncmp(color_string, "0x", 2)) {
         char *tail;
         int len = strlen(color_string);
-        int rgba = strtol(color_string, &tail, 16);
+        unsigned int rgba = strtoul(color_string, &tail, 16);
 
         if (*tail || (len != 8 && len != 10)) {
             av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string);
-            return -1;
+            return AVERROR(EINVAL);
         }
         if (len == 10) {
             rgba_color[3] = rgba;
@@ -247,8 +247,8 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
                                           sizeof(ColorEntry),
                                           color_table_compare);
         if (!entry) {
-            av_log(log_ctx, AV_LOG_DEBUG, "Cannot find color '%s'\n", color_string);
-            return -1;
+            av_log(log_ctx, AV_LOG_ERROR, "Cannot find color '%s'\n", color_string);
+            return AVERROR(EINVAL);
         }
         memcpy(rgba_color, entry->rgba_color, 4);
     }
@@ -292,6 +292,8 @@ static int parse_key_value_pair(void *ctx, const char **buf,
     av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n", val, key);
 
     ret = av_set_string3(ctx, key, val, 1, NULL);
+    if (ret == AVERROR(ENOENT))
+        av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key);
 
     av_free(key);
     av_free(val);
@@ -412,6 +414,7 @@ int main(void)
             "Red",
             "0x000000",
             "0x0000000",
+            "0xff000000",
             "0x3e34ff",
             "0x3e34ffaa",
             "0xffXXee",