]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_extractplanes.c
Merge commit '871b4f3654636ed64560e86b9faa33828d195ceb'
[ffmpeg] / libavfilter / vf_extractplanes.c
index d3a90465b60549d3c1ed67b1509beeb2e3af12e9..fc676a25fae38957598547be42c2896f47b36843 100644 (file)
@@ -103,6 +103,13 @@ static int query_formats(AVFilterContext *ctx)
         AV_PIX_FMT_YUV440P12LE,
         AV_PIX_FMT_GBRP10LE, AV_PIX_FMT_GBRAP10LE,
         AV_PIX_FMT_GBRP12LE, AV_PIX_FMT_GBRAP12LE,
+        AV_PIX_FMT_YUV420P9LE,
+        AV_PIX_FMT_YUV422P9LE,
+        AV_PIX_FMT_YUV444P9LE,
+        AV_PIX_FMT_YUVA420P9LE,
+        AV_PIX_FMT_YUVA422P9LE,
+        AV_PIX_FMT_YUVA444P9LE,
+        AV_PIX_FMT_GBRP9LE,
         AV_PIX_FMT_NONE,
     };
     static const enum AVPixelFormat in_pixfmts_be[] = {
@@ -142,9 +149,18 @@ static int query_formats(AVFilterContext *ctx)
         AV_PIX_FMT_YUV440P12BE,
         AV_PIX_FMT_GBRP10BE, AV_PIX_FMT_GBRAP10BE,
         AV_PIX_FMT_GBRP12BE, AV_PIX_FMT_GBRAP12BE,
+        AV_PIX_FMT_YUV420P9BE,
+        AV_PIX_FMT_YUV422P9BE,
+        AV_PIX_FMT_YUV444P9BE,
+        AV_PIX_FMT_YUVA420P9BE,
+        AV_PIX_FMT_YUVA422P9BE,
+        AV_PIX_FMT_YUVA444P9BE,
+        AV_PIX_FMT_GBRP9BE,
         AV_PIX_FMT_NONE,
     };
     static const enum AVPixelFormat out8_pixfmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
+    static const enum AVPixelFormat out9le_pixfmts[] = { AV_PIX_FMT_GRAY9LE, AV_PIX_FMT_NONE };
+    static const enum AVPixelFormat out9be_pixfmts[] = { AV_PIX_FMT_GRAY9BE, AV_PIX_FMT_NONE };
     static const enum AVPixelFormat out10le_pixfmts[] = { AV_PIX_FMT_GRAY10LE, AV_PIX_FMT_NONE };
     static const enum AVPixelFormat out10be_pixfmts[] = { AV_PIX_FMT_GRAY10BE, AV_PIX_FMT_NONE };
     static const enum AVPixelFormat out12le_pixfmts[] = { AV_PIX_FMT_GRAY12LE, AV_PIX_FMT_NONE };
@@ -184,6 +200,10 @@ static int query_formats(AVFilterContext *ctx)
 
     if (depth == 8)
         out_pixfmts = out8_pixfmts;
+    else if (!be && depth == 9)
+        out_pixfmts = out9le_pixfmts;
+    else if (be && depth == 9)
+        out_pixfmts = out9be_pixfmts;
     else if (!be && depth == 10)
         out_pixfmts = out10le_pixfmts;
     else if (be && depth == 10)
@@ -328,7 +348,7 @@ static av_cold int init(AVFilterContext *ctx)
 {
     ExtractPlanesContext *s = ctx->priv;
     int planes = (s->requested_planes & 0xf) | (s->requested_planes >> 4);
-    int i;
+    int i, ret;
 
     for (i = 0; i < 4; i++) {
         char *name;
@@ -345,7 +365,10 @@ static av_cold int init(AVFilterContext *ctx)
         pad.type = AVMEDIA_TYPE_VIDEO;
         pad.config_props = config_output;
 
-        ff_insert_outpad(ctx, ctx->nb_outputs, &pad);
+        if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) {
+            av_freep(&pad.name);
+            return ret;
+        }
     }
 
     return 0;