dvdsubdec: parse the size from the extradata
authorClément Bœsch <ubitux@gmail.com>
Wed, 16 Jan 2013 17:42:16 +0000 (18:42 +0100)
committerLuca Barbato <lu_zero@gentoo.org>
Sat, 19 Jan 2013 14:12:58 +0000 (15:12 +0100)
Signed-off-by: Alexandra Khirnova <alexandra.khirnova@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/dvdsubdec.c

index f29d278d6da90947e55d7080ffb9e26a11fb3174..7afdd27b18e9b3f67d127f90cddf6e2cbd728add 100644 (file)
@@ -22,6 +22,7 @@
 #include "get_bits.h"
 #include "dsputil.h"
 #include "libavutil/colorspace.h"
+#include "libavutil/imgutils.h"
 
 //#define DEBUG
 
@@ -524,6 +525,11 @@ static int dvdsub_init(AVCodecContext *avctx)
                 while (*p == ',' || isspace(*p))
                     p++;
             }
+        } else if (!strncmp("size:", cur, 5)) {
+            int w, h;
+            if (sscanf(cur + 5, "%dx%d", &w, &h) == 2 &&
+                av_image_check_size(w, h, 0, avctx) >= 0)
+                avcodec_set_dimensions(avctx, w, h);
         }
         cur += strcspn(cur, "\n\r");
         cur += strspn(cur, "\n\r");