Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: source/patched-ffmpeg-mt/libavfilter/vsrc_nullsrc.c

Issue 4533003: patched ffmpeg nov 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: source/patched-ffmpeg-mt/libavfilter/vsrc_nullsrc.c
===================================================================
--- source/patched-ffmpeg-mt/libavfilter/vsrc_nullsrc.c (revision 65184)
+++ source/patched-ffmpeg-mt/libavfilter/vsrc_nullsrc.c (working copy)
@@ -21,10 +21,31 @@
* null video source
*/
+#include "libavutil/avstring.h"
+#include "libavutil/eval.h"
+#include "libavcore/parseutils.h"
#include "avfilter.h"
+static const char *var_names[] = {
+ "E",
+ "PHI",
+ "PI",
+ "AVTB", /* default timebase 1/AV_TIME_BASE */
+ NULL
+};
+
+enum var_name {
+ VAR_E,
+ VAR_PHI,
+ VAR_PI,
+ VAR_AVTB,
+ VAR_VARS_NB
+};
+
typedef struct {
int w, h;
+ char tb_expr[256];
+ double var_values[VAR_VARS_NB];
} NullContext;
static int init(AVFilterContext *ctx, const char *args, void *opaque)
@@ -33,9 +54,10 @@
priv->w = 352;
priv->h = 288;
+ av_strlcpy(priv->tb_expr, "AVTB", sizeof(priv->tb_expr));
if (args)
- sscanf(args, "%d:%d", &priv->w, &priv->h);
+ sscanf(args, "%d:%d:%255[^:]", &priv->w, &priv->h, priv->tb_expr);
if (priv->w <= 0 || priv->h <= 0) {
av_log(ctx, AV_LOG_ERROR, "Non-positive size values are not acceptable.\n");
@@ -47,12 +69,36 @@
static int config_props(AVFilterLink *outlink)
{
- NullContext *priv = outlink->src->priv;
+ AVFilterContext *ctx = outlink->src;
+ NullContext *priv = ctx->priv;
+ AVRational tb;
+ int ret;
+ double res;
+ priv->var_values[VAR_E] = M_E;
+ priv->var_values[VAR_PHI] = M_PHI;
+ priv->var_values[VAR_PI] = M_PI;
+ priv->var_values[VAR_AVTB] = av_q2d(AV_TIME_BASE_Q);
+
+ if ((ret = av_parse_and_eval_expr(&res, priv->tb_expr, var_names, priv->var_values,
+ NULL, NULL, NULL, NULL, NULL, 0, NULL)) < 0) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid expression '%s' for timebase.\n", priv->tb_expr);
+ return ret;
+ }
+ tb = av_d2q(res, INT_MAX);
+ if (tb.num <= 0 || tb.den <= 0) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Invalid non-positive value for the timebase %d/%d.\n",
+ tb.num, tb.den);
+ return AVERROR(EINVAL);
+ }
+
outlink->w = priv->w;
outlink->h = priv->h;
+ outlink->time_base = tb;
- av_log(outlink->src, AV_LOG_INFO, "w:%d h:%d\n", priv->w, priv->h);
+ av_log(outlink->src, AV_LOG_INFO, "w:%d h:%d tb:%d/%d\n", priv->w, priv->h,
+ tb.num, tb.den);
return 0;
}

Powered by Google App Engine
This is Rietveld 408576698