]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vsrc_buffer.c
Fixed-point MDCT with 32-bit unscaled output
[ffmpeg] / libavfilter / vsrc_buffer.c
index 12302423b0e9b3386e46a2c6216496a0c7750f1d..93f2367ab8da9d49b6ed9477cd577d366d4fdf58 100644 (file)
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008 Vitor Sessak
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -25,7 +25,7 @@
 
 #include "avfilter.h"
 #include "vsrc_buffer.h"
-#include "libavcore/imgutils.h"
+#include "libavutil/imgutils.h"
 
 typedef struct {
     int64_t           pts;
@@ -33,6 +33,7 @@ typedef struct {
     int               has_frame;
     int               h, w;
     enum PixelFormat  pix_fmt;
+    AVRational        time_base;     ///< time_base to set in the output link
     AVRational        pixel_aspect;
 } BufferSourceContext;
 
@@ -66,8 +67,9 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
     char pix_fmt_str[128];
     int n = 0;
 
-    if (!args || (n = sscanf(args, "%d:%d:%127s", &c->w, &c->h, pix_fmt_str)) != 3) {
-        av_log(ctx, AV_LOG_ERROR, "Expected 3 arguments, but only %d found in '%s'\n", n, args ? args : "");
+    if (!args ||
+        (n = sscanf(args, "%d:%d:%127[^:]:%d:%d", &c->w, &c->h, pix_fmt_str, &c->time_base.num, &c->time_base.den)) != 5) {
+        av_log(ctx, AV_LOG_ERROR, "Expected 5 arguments, but only %d found in '%s'\n", n, args);
         return AVERROR(EINVAL);
     }
     if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) {
@@ -98,6 +100,7 @@ static int config_props(AVFilterLink *link)
 
     link->w = c->w;
     link->h = c->h;
+    link->time_base = c->time_base;
 
     return 0;
 }
@@ -120,8 +123,8 @@ static int request_frame(AVFilterLink *link)
                                        link->w, link->h);
 
     av_image_copy(picref->data, picref->linesize,
-                         c->frame.data, c->frame.linesize,
-                         picref->format, link->w, link->h);
+                  c->frame.data, c->frame.linesize,
+                  picref->format, link->w, link->h);
 
     picref->pts                    = c->pts;
     picref->video->pixel_aspect    = c->pixel_aspect;