summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/vf.rst20
-rw-r--r--Makefile1
-rw-r--r--TOOLS/vf_dlopen/Makefile24
-rw-r--r--TOOLS/vf_dlopen/filterutils.c19
-rw-r--r--TOOLS/vf_dlopen/filterutils.h6
-rw-r--r--TOOLS/vf_dlopen/showqscale.c99
-rw-r--r--TOOLS/vf_dlopen/telecine.c242
-rw-r--r--TOOLS/vf_dlopen/tile.c157
-rwxr-xr-xconfigure22
-rw-r--r--input/input.c15
-rw-r--r--input/input.h9
-rw-r--r--libmpcodecs/img_format.c101
-rw-r--r--libmpcodecs/img_format.h10
-rw-r--r--libmpcodecs/vf.c2
-rw-r--r--libmpcodecs/vf_dlopen.c356
-rw-r--r--libmpcodecs/vf_dlopen.h88
-rw-r--r--m_option.c81
-rw-r--r--mplayer.c4
18 files changed, 1157 insertions, 99 deletions
diff --git a/DOCS/man/en/vf.rst b/DOCS/man/en/vf.rst
index 2a93e8ec78..434c2faec3 100644
--- a/DOCS/man/en/vf.rst
+++ b/DOCS/man/en/vf.rst
@@ -1405,3 +1405,23 @@ fixpts[=options]
*NOTE*: Using this filter together with any sort of seeking (including
``--ss``) may make demons fly out of your nose.
+
+dlopen=dll[:a0[:a1[:a2[:a3]]]]
+ Loads an external library to filter the image. The library interface
+ is the vf_dlopen interface specified using libmpcodecs/vf_dlopen.h.
+
+ dll=<library>
+ Specify the library to load. This may require a full file system path
+ in some cases! This argument is required.
+
+ a0=<string>
+ Specify the first parameter to pass to the library.
+
+ a1=<string>
+ Specify the second parameter to pass to the library.
+
+ a2=<string>
+ Specify the third parameter to pass to the library.
+
+ a3=<string>
+ Specify the fourth parameter to pass to the library.
diff --git a/Makefile b/Makefile
index 9b73377020..99b310d8d2 100644
--- a/Makefile
+++ b/Makefile
@@ -161,6 +161,7 @@ SRCS_COMMON = asxparser.c \
libmpcodecs/vf_detc.c \
libmpcodecs/vf_dint.c \
libmpcodecs/vf_divtc.c \
+ libmpcodecs/vf_dlopen.c \
libmpcodecs/vf_down3dright.c \
libmpcodecs/vf_dsize.c \
libmpcodecs/vf_dvbscale.c \
diff --git a/TOOLS/vf_dlopen/Makefile b/TOOLS/vf_dlopen/Makefile
new file mode 100644
index 0000000000..2fa4e740c2
--- /dev/null
+++ b/TOOLS/vf_dlopen/Makefile
@@ -0,0 +1,24 @@
+FILTERS = showqscale telecine tile
+COMMON = filterutils.o
+
+OBJECTS = $(patsubst %,%.o,$(FILTERS)) $(COMMON)
+HEADERS = $(wildcard *.h)
+OUT = $(patsubst %,%.so,$(FILTERS))
+
+CFLAGS ?= -Wall -Wextra -O3 -march=native -mtune=native
+
+CPPFLAGS += -I../../libmpcodecs
+CFLAGS += -fPIC
+LDFLAGS += -shared -fPIC
+
+all: $(OUT)
+
+clean:
+ $(RM) $(OBJECTS) $(OUT)
+
+%.so: %.o $(COMMON)
+ $(CC) $(LDFLAGS) $(LIBS) -o $@ $(COMMON) $<
+
+# FIXME replace this by real dependency tracking
+%.o: %.c $(HEADERS)
+
diff --git a/TOOLS/vf_dlopen/filterutils.c b/TOOLS/vf_dlopen/filterutils.c
new file mode 100644
index 0000000000..e2f14092de
--- /dev/null
+++ b/TOOLS/vf_dlopen/filterutils.c
@@ -0,0 +1,19 @@
+#include <assert.h>
+#include <string.h>
+
+#include "filterutils.h"
+
+void copy_plane(
+ unsigned char *dest, unsigned dest_stride,
+ const unsigned char *src, unsigned src_stride,
+ unsigned length,
+ unsigned rows
+ )
+{
+ unsigned i;
+ assert(dest_stride >= length);
+ assert(src_stride >= length);
+ for (i = 0; i < rows; ++i)
+ memcpy(&dest[dest_stride * i], &src[src_stride * i], length);
+}
+
diff --git a/TOOLS/vf_dlopen/filterutils.h b/TOOLS/vf_dlopen/filterutils.h
new file mode 100644
index 0000000000..4b4229d8ea
--- /dev/null
+++ b/TOOLS/vf_dlopen/filterutils.h
@@ -0,0 +1,6 @@
+void copy_plane(
+ unsigned char *dest, unsigned dest_stride,
+ const unsigned char *src, unsigned src_stride,
+ unsigned length,
+ unsigned rows
+ );
diff --git a/TOOLS/vf_dlopen/showqscale.c b/TOOLS/vf_dlopen/showqscale.c
new file mode 100644
index 0000000000..9bece60a4f
--- /dev/null
+++ b/TOOLS/vf_dlopen/showqscale.c
@@ -0,0 +1,99 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "vf_dlopen.h"
+
+/*
+ * qscale visualizer
+ *
+ * usage: -vf dlopen=./showqscale.so
+ *
+ * uses reddish colors for high QPs, and greenish colors for low QPs
+ */
+
+#define PLANE_Y 0
+#define PLANE_U 1
+#define PLANE_V 2
+
+static int qs_put_image(struct vf_dlopen_context *ctx)
+{
+ unsigned int x, y, p;
+
+ assert(ctx->inpic.planes == ctx->outpic[0].planes);
+
+ for (p = 0; p < ctx->outpic[0].planes; ++p) {
+ assert(ctx->inpic.planewidth[p] == ctx->outpic[0].planewidth[p]);
+ assert(ctx->inpic.planeheight[p] == ctx->outpic[0].planeheight[p]);
+ if ((p == PLANE_U || p == PLANE_V) && ctx->inpic_qscale)
+ continue;
+#if 0
+ // copy as is
+ for (y = 0; y < ctx->outpic[0].planeheight[p]; ++y)
+ memcpy(
+ &ctx->outpic[0].plane[p][ctx->outpic[0].planestride[p] * y],
+ &inpic[ctx->outpic[0].planeofs[p] + ctx->inpic.planestride[p] * y],
+ ctx->outpic[0].planewidth[p]
+ );
+#else
+ // reduce contrast
+ for (y = 0; y < ctx->outpic[0].planeheight[p]; ++y)
+ for (x = 0; x < ctx->outpic[0].planewidth[p]; ++x)
+ ctx->outpic[0].plane[p][ctx->outpic[0].planestride[p] * y + x] =
+ 0x20 + ((ctx->inpic.plane[p][ctx->inpic.planestride[p] * y + x] * 3) >> 2);
+#endif
+ }
+
+ if (ctx->inpic_qscale) {
+ int qmin = 255;
+ int qmax = -255;
+
+ // clear U plane
+ p = PLANE_U;
+ for (y = 0; y < ctx->outpic[0].planeheight[p]; ++y)
+ memset(
+ &ctx->outpic[0].plane[p][ctx->outpic[0].planestride[p] * y],
+ 0x80,
+ ctx->outpic[0].planewidth[p]
+ );
+
+ // replace V by the qp (0 = green, 12 = red)
+ p = PLANE_V;
+ for (y = 0; y < ctx->outpic[0].planeheight[p]; ++y)
+ for (x = 0; x < ctx->outpic[0].planewidth[p]; ++x) {
+ int q = ctx->inpic_qscale[
+ (x >> (ctx->inpic_qscaleshift - ctx->inpic.planexshift[p])) +
+ (y >> (ctx->inpic_qscaleshift - ctx->inpic.planeyshift[p])) * ctx->inpic_qscalestride];
+ if (q < qmin)
+ qmin = q;
+ if (q > qmax)
+ qmax = q;
+ int v = 128 + 21 * (q - 6); // range: 0 = green, 12 = red
+ if (v < 0)
+ v = 0;
+ if (v > 255)
+ v = 255;
+ ctx->outpic[0].plane[p][ctx->outpic[0].planestride[p] * y + x] = v;
+ }
+
+ // printf("qscale range: %d .. %d\n", qmin, qmax);
+ }
+
+ ctx->outpic[0].pts = ctx->inpic.pts;
+ return 1;
+}
+
+int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
+{
+ VF_DLOPEN_CHECK_VERSION(ctx);
+ (void) argc;
+ (void) argv;
+ static struct vf_dlopen_formatpair map[] = {
+ { "yv12", "yv12" },
+ { NULL, NULL }
+ };
+ ctx->format_mapping = map;
+ ctx->put_image = qs_put_image;
+ return 1;
+}
diff --git a/TOOLS/vf_dlopen/telecine.c b/TOOLS/vf_dlopen/telecine.c
new file mode 100644
index 0000000000..109fef2d6b
--- /dev/null
+++ b/TOOLS/vf_dlopen/telecine.c
@@ -0,0 +1,242 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "vf_dlopen.h"
+#include "filterutils.h"
+
+#define MIN(a,b) ((a)<(b)?(a):(b))
+
+/*
+ * telecine filter
+ *
+ * usage: -vf dlopen=./telecine.so:t:32
+ *
+ * Parameter: first parameter is "t" for top field first, "b" for bottom field first
+ * then digits (0-9) for how many fields a frame is to be displayed
+ *
+ * Typical patterns (see http://en.wikipedia.org/wiki/Telecine):
+ *
+ * NTSC output (30i):
+ * 27.5p: 32222
+ * 24p: 23 (classic)
+ * 24p: 2332 (preferred)
+ * 20p: 33
+ * 18p: 334
+ * 16p: 3444
+ *
+ * PAL output (25i):
+ * 27.5p: 12222
+ * 24p: 222222222223 ("Euro pulldown")
+ * 16.67p: 33
+ * 16p: 33333334
+ */
+
+typedef struct {
+ int firstfield;
+ const char *pattern;
+ unsigned int pattern_pos;
+ unsigned char *buffer_plane[4];
+ size_t buffer_size[4];
+ int pts_num;
+ int pts_denom;
+ int occupied;
+ double lastpts_in;
+ double lastpts_out;
+} tc_data_t;
+
+static int tc_config(struct vf_dlopen_context *ctx)
+{
+ // we may return more than one pic!
+ tc_data_t *tc = ctx->priv;
+ const char *p;
+ int max = 0;
+ tc->pts_num = 0;
+ tc->pts_denom = 0;
+ for (p = tc->pattern; *p; ++p) {
+ if (*p - '0' > max)
+ max = *p - '0';
+ tc->pts_num += 2;
+ tc->pts_denom += *p - '0';
+ }
+ ctx->out_cnt = (max + 1) / 2;
+ printf(
+ "Telecine pattern %s yields up to %d frames per frame, pts advance factor: %d/%d\n",
+ tc->pattern, ctx->out_cnt, tc->pts_num, tc->pts_denom);
+ return 1;
+}
+
+static int tc_put_image(struct vf_dlopen_context *ctx)
+{
+ tc_data_t *tc = ctx->priv;
+
+ unsigned p;
+ unsigned np = ctx->outpic[0].planes;
+ assert(ctx->inpic.planes == ctx->outpic[0].planes);
+
+ int need_reinit = 0;
+
+ // fix buffers
+ for (p = 0; p < np; ++p) {
+ size_t sz = ctx->inpic.planestride[p] * ctx->inpic.planeheight[p];
+ if (sz != tc->buffer_size[p]) {
+ if (p == 0 && tc->buffer_plane[p])
+ printf("WARNING: reinitializing telecine buffers.\n");
+ tc->buffer_plane[p] = realloc(tc->buffer_plane[p], sz);
+ tc->buffer_size[p] = sz;
+ need_reinit = 1;
+ }
+ }
+
+ // too big pts change? reinit
+ if (ctx->inpic.pts < tc->lastpts_in || ctx->inpic.pts > tc->lastpts_in + 0.5)
+ need_reinit = 1;
+
+ if (need_reinit) {
+ // initialize telecine
+ tc->pattern_pos = 0;
+ tc->occupied = 0;
+ tc->lastpts_in = ctx->inpic.pts;
+ tc->lastpts_out = ctx->inpic.pts;
+ }
+
+ int len = tc->pattern[tc->pattern_pos] - '0';
+ unsigned nout;
+ double delta = ctx->inpic.pts - tc->lastpts_in;
+ tc->lastpts_in = ctx->inpic.pts;
+
+ for (nout = 0; nout < ctx->out_cnt; ++nout) {
+ for (p = 0; p < np; ++p) {
+ assert(ctx->inpic.planewidth[p] == ctx->outpic[nout].planewidth[p]);
+ assert(ctx->inpic.planeheight[p] == ctx->outpic[nout].planeheight[p]);
+ }
+ }
+ nout = 0;
+
+ if (tc->pattern_pos == 0 && !tc->occupied) {
+ // at the start of the pattern, reset pts
+ double newpts = ctx->inpic.pts - (delta * tc->pts_num) / tc->pts_denom;
+ // printf("pts reset: %f -> %f (delta: %f)\n", tc->lastpts_out, newpts, newpts - tc->lastpts_out);
+ tc->lastpts_out = newpts;
+ }
+ ++tc->pattern_pos;
+ if (!tc->pattern[tc->pattern_pos])
+ tc->pattern_pos = 0;
+
+ if (len == 0) {
+ // do not output any field from this frame
+ return 0;
+ }
+
+ if (tc->occupied) {
+ for (p = 0; p < np; ++p) {
+ // fill in the EARLIER field from the buffered pic
+ copy_plane(
+ &ctx->outpic[nout].plane[p][ctx->outpic[nout].planestride[p] * tc->firstfield],
+ ctx->outpic[nout].planestride[p] * 2,
+ &tc->buffer_plane[p][ctx->inpic.planestride[p] * tc->firstfield],
+ ctx->inpic.planestride[p] * 2,
+ MIN(ctx->inpic.planestride[p], ctx->outpic[nout].planestride[p]),
+ (ctx->inpic.planeheight[p] - tc->firstfield + 1) / 2
+ );
+ // fill in the LATER field from the new pic
+ copy_plane(
+ &ctx->outpic[nout].plane[p][ctx->outpic[nout].planestride[p] * !tc->firstfield],
+ ctx->outpic[nout].planestride[p] * 2,
+ &ctx->inpic.plane[p][ctx->inpic.planestride[p] * !tc->firstfield],
+ ctx->inpic.planestride[p] * 2,
+ MIN(ctx->inpic.planestride[p], ctx->outpic[nout].planestride[p]),
+ (ctx->inpic.planeheight[p] - !tc->firstfield + 1) / 2
+ );
+ }
+ tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
+ ctx->outpic[nout].pts = tc->lastpts_out;
+ // printf("pts written: %f\n", ctx->outpic[nout].pts);
+ ++nout;
+ --len;
+ tc->occupied = 0;
+ }
+
+ while (len >= 2) {
+ // output THIS image as-is
+ for (p = 0; p < np; ++p)
+ copy_plane(
+ ctx->outpic[nout].plane[p], ctx->outpic[nout].planestride[p],
+ ctx->inpic.plane[p], ctx->inpic.planestride[p],
+ MIN(ctx->inpic.planestride[p], ctx->outpic[nout].planestride[p]),
+ ctx->inpic.planeheight[p]
+ );
+ tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
+ ctx->outpic[nout].pts = tc->lastpts_out;
+ // printf("pts written: %f\n", ctx->outpic[nout].pts);
+ ++nout;
+ len -= 2;
+ }
+
+ if (len >= 1) {
+ // copy THIS image to the buffer, we need it later
+ for (p = 0; p < np; ++p)
+ copy_plane(
+ &tc->buffer_plane[p][0], ctx->inpic.planestride[p],
+ &ctx->inpic.plane[p][0], ctx->inpic.planestride[p],
+ ctx->inpic.planestride[p],
+ ctx->inpic.planeheight[p]
+ );
+ tc->occupied = 1;
+ }
+
+ return nout;
+}
+
+void tc_uninit(struct vf_dlopen_context *ctx)
+{
+ tc_data_t *tc = ctx->priv;
+ free(tc->buffer_plane[3]);
+ free(tc->buffer_plane[2]);
+ free(tc->buffer_plane[1]);
+ free(tc->buffer_plane[0]);
+ free(tc);
+}
+
+int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
+{
+ VF_DLOPEN_CHECK_VERSION(ctx);
+
+ const char *a0 = (argc < 1) ? "t" : argv[0];
+ const char *a1 = (argc < 2) ? "23" : argv[1];
+
+ if (!a0[0] || a0[1] || !a1[0] || argc > 2)
+ return -1;
+
+ tc_data_t *tc = malloc(sizeof(tc_data_t));
+ memset(tc, 0, sizeof(*tc));
+
+ if (a0[0] == 't')
+ tc->firstfield = 0;
+ else if (a0[0] == 'b')
+ tc->firstfield = 1;
+ else {
+ printf("telecine: invalid first field\n");
+ free(tc);
+ return -1;
+ }
+
+ tc->pattern = a1;
+
+ const char *p;
+ for (p = tc->pattern; *p; ++p)
+ if (*p < '0' || *p > '9') {
+ printf("telecine: invalid pattern\n");
+ free(tc);
+ return -1;
+ }
+
+ ctx->priv = tc;
+ ctx->format_mapping = NULL; // anything goes
+ ctx->config = tc_config;
+ ctx->put_image = tc_put_image;
+ ctx->uninit = tc_uninit;
+
+ return 1;
+}
diff --git a/TOOLS/vf_dlopen/tile.c b/TOOLS/vf_dlopen/tile.c
new file mode 100644
index 0000000000..0e9a14fb62
--- /dev/null
+++ b/TOOLS/vf_dlopen/tile.c
@@ -0,0 +1,157 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "vf_dlopen.h"
+#include "filterutils.h"
+
+/*
+ * tile filter
+ *
+ * usage: -vf dlopen=./tile.so:4:3
+ *
+ * only supports rgb24 and yv12 for now
+ * in theory can support any format where rows are a multiple of bytes, and the
+ * multiple is known
+ */
+
+#define ALLFORMATS \
+ /* format bytes xmul ymul */ \
+ FORMAT("rgb24", 3, 1, 1) \
+ FORMAT("yv12", 1, 2, 2)
+
+typedef struct {
+ int rows, cols;
+ unsigned char *buffer_plane[4];
+ size_t buffer_size[4];
+ int pos;
+ int pixelbytes;
+} tile_data_t;
+
+static int tile_config(struct vf_dlopen_context *ctx)
+{
+ // we may return more than one pic!
+ tile_data_t *tile = ctx->priv;
+
+ ctx->out_width = tile->cols * ctx->in_width;
+ ctx->out_height = tile->rows * ctx->in_height;
+ ctx->out_d_width = tile->cols * ctx->in_d_width;
+ ctx->out_d_height = tile->rows * ctx->in_d_height;
+
+#define FORMAT(fmt,sz,xmul,ymul) \
+ if (!strcmp(ctx->in_fmt, fmt)) { \
+ if (ctx->in_width % xmul || ctx->in_height % ymul) { \
+ printf("Format " fmt " requires width to be a multiple of %d and height to be a multiple of %d\n", \
+ xmul, ymul); \
+ return -1; \
+ } \
+ tile->pixelbytes = sz; \
+ } else
+ ALLFORMATS
+#undef FORMAT
+ {
+ printf("Format %s is not in the list, how come?\n", ctx->in_fmt);
+ return -1;
+ }
+
+ return 1;
+}
+
+static int tile_put_image(struct vf_dlopen_context *ctx)
+{
+ tile_data_t *tile = ctx->priv;
+
+ unsigned p;
+ unsigned np = ctx->outpic[0].planes;
+ assert(ctx->inpic.planes == ctx->outpic[0].planes);
+
+ // fix buffers
+ for (p = 0; p < np; ++p) {
+ size_t sz = ctx->outpic->planestride[p] * ctx->outpic->planeheight[p];
+ if (sz != tile->buffer_size[p]) {
+ if (p == 0 && tile->buffer_plane[p])
+ printf("WARNING: reinitializing output buffers.\n");
+ tile->buffer_plane[p] = realloc(tile->buffer_plane[p], sz);
+ tile->buffer_size[p] = sz;
+ tile->pos = 0;
+ }
+ }
+
+ for (p = 0; p < np; ++p) {
+ assert(ctx->inpic.planewidth[p] * tile->cols == ctx->outpic->planewidth[p]);
+ assert(ctx->inpic.planeheight[p] * tile->rows == ctx->outpic->planeheight[p]);
+ }
+
+ // copy this frame
+ for (p = 0; p < np; ++p)
+ copy_plane(
+ &tile->buffer_plane[p][ctx->outpic->planestride[p] * ctx->inpic.planeheight[p] * (tile->pos / tile->cols) + tile->pixelbytes * ctx->inpic.planewidth[p] * (tile->pos % tile->cols)],
+ ctx->outpic->planestride[p],
+ ctx->inpic.plane[p],
+ ctx->inpic.planestride[p],
+ tile->pixelbytes * ctx->inpic.planewidth[p],
+ ctx->inpic.planeheight[p]
+ );
+
+ ++tile->pos;
+ if (tile->pos == tile->rows * tile->cols) {
+ // copy THIS image to the buffer, we need it later
+ for (p = 0; p < np; ++p)
+ copy_plane(
+ ctx->outpic->plane[p], ctx->outpic->planestride[p],
+ &tile->buffer_plane[p][0], ctx->outpic->planestride[p],
+ tile->pixelbytes * ctx->outpic->planewidth[p],
+ ctx->outpic->planeheight[p]
+ );
+ ctx->outpic->pts = ctx->inpic.pts;
+ tile->pos = 0;
+ return 1;
+ }
+
+ return 0;
+}
+
+void tile_uninit(struct vf_dlopen_context *ctx)
+{
+ tile_data_t *tile = ctx->priv;
+ free(tile->buffer_plane[3]);
+ free(tile->buffer_plane[2]);
+ free(tile->buffer_plane[1]);
+ free(tile->buffer_plane[0]);
+ free(tile);
+}
+
+int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
+{
+ VF_DLOPEN_CHECK_VERSION(ctx);
+
+ if (argc != 2)
+ return -1;
+
+ tile_data_t *tile = malloc(sizeof(tile_data_t));
+ memset(tile, 0, sizeof(*tile));
+
+ tile->cols = atoi(argv[0]);
+ tile->rows = atoi(argv[1]);
+
+ if (!tile->rows || !tile->cols) {
+ printf("tile: invalid rows/cols\n");
+ free(tile);
+ return -1;
+ }
+
+ ctx->priv = tile;
+ static struct vf_dlopen_formatpair map[] = {
+#define FORMAT(fmt,sz,xmul,ymul) {fmt, NULL},
+ ALLFORMATS
+#undef FORMAT
+ {NULL, NULL}
+ };
+ ctx->format_mapping = map;
+ ctx->config = tile_config;
+ ctx->put_image = tile_put_image;
+ ctx->uninit = tile_uninit;
+
+ return 1;
+}
diff --git a/configure b/configure
index d209b74550..e2162d0ffc 100755
--- a/configure
+++ b/configure
@@ -429,6 +429,8 @@ _pkg_config=auto
_windres=auto
_cc=auto
test "$CC" && _cc="$CC"
+_debug=
+_opt=-O2
_cross_compile=no
_prefix="/usr/local"
ffmpeg=auto
@@ -603,9 +605,11 @@ for ac_option do
;;
--enable-debug)
_debug='-g'
+ _opt=
;;
--enable-debug=*)
_debug=$(echo $_echo_n '-g'$_echo_c; echo $ac_option | cut -d '=' -f 2)
+ _opt=
;;
--disable-debug)
_debug=
@@ -1143,16 +1147,16 @@ if test "$_profile" != "" || test "$_debug" != "" ; then
fi
if test -z "$CFLAGS" ; then
if test "$cc_vendor" = "intel" ; then
- CFLAGS="-O2 $_debug $_profile $_march $_mcpu $_pipe -fomit-frame-pointer"
+ CFLAGS="$_opt $_debug $_profile $_march $_mcpu $_pipe -fomit-frame-pointer"
WARNFLAGS="-wd167 -wd556 -wd144"
elif test "$cc_vendor" = "clang"; then
- CFLAGS="-O2 $_debug $_profile $_march $_pipe"
+ CFLAGS="$_opt $_debug $_profile $_march $_pipe"
WARNFLAGS="-Wall -Wno-switch-enum -Wno-logical-op-parentheses -Wpointer-arith -Wundef -Wno-pointer-sign -Wmissing-prototypes"
ERRORFLAGS="-Werror=implicit-function-declaration"
elif test "$cc_vendor" != "gnu" ; then
- CFLAGS="-O2 $_debug $_profile $_march $_mcpu $_pipe"
+ CFLAGS="$_opt $_debug $_profile $_march $_mcpu $_pipe"
else
- CFLAGS="-O2 $_debug $_profile $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
+ CFLAGS="$_opt $_debug $_profile $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
WARNFLAGS="-Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundant-decls"
ERRORFLAGS="-Werror-implicit-function-declaration"
extra_ldflags="$extra_ldflags -ffast-math"
@@ -2056,7 +2060,7 @@ if test "$_x11" = auto && test "$_x11_headers" = yes ; then
fi
if test "$_x11" = yes ; then
def_x11='#define CONFIG_X11 1'
- vomodules="x11 xover $vomodules"
+ vomodules="x11 $vomodules"
else
_x11=no
def_x11='#undef CONFIG_X11'
@@ -2297,11 +2301,9 @@ echores "$_jpeg"
if test "$_jpeg" = yes ; then
def_jpeg='#define CONFIG_JPEG 1'
- vomodules="jpeg $vomodules"
extra_ldflags="$extra_ldflags -ljpeg"
else
def_jpeg='#undef CONFIG_JPEG'
- novomodules="jpeg $novomodules"
fi
@@ -2338,7 +2340,6 @@ fi
if test "$_gif" = yes ; then
def_gif='#define CONFIG_GIF 1'
codecmodules="gif $codecmodules"
- vomodules="gif89a $vomodules"
res_comment="old version, some encoding functions disabled"
def_gif_4='#undef CONFIG_GIF_4'
extra_ldflags="$extra_ldflags $_ld_gif"
@@ -2363,7 +2364,6 @@ EOF
else
def_gif='#undef CONFIG_GIF'
def_gif_4='#undef CONFIG_GIF_4'
- novomodules="gif89a $novomodules"
nocodecmodules="gif $nocodecmodules"
fi
echores "$_gif"
@@ -3585,6 +3585,8 @@ $def_caca
$def_corevideo
$def_cocoa
$def_direct3d
+$def_dvb
+$def_dvbin
$def_gif
$def_gif_4
$def_gif_tvt_hack
@@ -3643,7 +3645,7 @@ Config files successfully generated by ./configure $configuration !
Enabled optional drivers:
Input: $inputmodules
- Codecs: $codecmodules
+ Codecs: libavcodecs $codecmodules
Audio output: $aomodules
Video output: $vomodules
diff --git a/input/input.c b/input/input.c
index 98b135c349..6bf45edf7e 100644
--- a/input/input.c
+++ b/input/input.c
@@ -452,6 +452,8 @@ struct input_ctx {
struct cmd_bind_section *cmd_bind_sections;
// Name of currently used command section
char *section;
+ // Bitfield of mp_input_section_flags
+ int section_flags;
// Used to track whether we managed to read something while checking
// events sources. If yes, the sources may have more queued.
@@ -1023,10 +1025,12 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, int n, int *keys)
cmd = section_find_bind_for_key(ictx, false, ictx->section, n, keys);
if (ictx->default_bindings && cmd == NULL)
cmd = section_find_bind_for_key(ictx, true, ictx->section, n, keys);
- if (cmd == NULL)
- cmd = section_find_bind_for_key(ictx, false, "default", n, keys);
- if (ictx->default_bindings && cmd == NULL)
- cmd = section_find_bind_for_key(ictx, true, "default", n, keys);
+ if (!(ictx->section_flags & MP_INPUT_NO_DEFAULT_SECTION)) {
+ if (cmd == NULL)
+ cmd = section_find_bind_for_key(ictx, false, "default", n, keys);
+ if (ictx->default_bindings && cmd == NULL)
+ cmd = section_find_bind_for_key(ictx, true, "default", n, keys);
+ }
if (cmd == NULL) {
char *key_buf = get_key_combo_name(keys, n);
@@ -1524,10 +1528,11 @@ static int parse_config_file(struct input_ctx *ictx, char *file)
return 1;
}
-void mp_input_set_section(struct input_ctx *ictx, char *name)
+void mp_input_set_section(struct input_ctx *ictx, char *name, int flags)
{
talloc_free(ictx->section);
ictx->section = talloc_strdup(ictx, name ? name : "default");
+ ictx->section_flags = flags;
}
char *mp_input_get_section(struct input_ctx *ictx)
diff --git a/input/input.h b/input/input.h
index 04cefab46e..910561fa9f 100644
--- a/input/input.h
+++ b/input/input.h
@@ -166,6 +166,12 @@ enum mp_command_type {
// Key FIFO was full - release events may be lost, zero button-down status
#define MP_INPUT_RELEASE_ALL -5
+enum mp_input_section_flags {
+ // If a key binding is not defined in the current section, search the
+ // default section for it ("default" refers to bindings with no section
+ // specified, not to the default input.conf aka builtin key bindings)
+ MP_INPUT_NO_DEFAULT_SECTION = 1,
+};
struct input_ctx;
@@ -246,7 +252,8 @@ void mp_cmd_free(struct mp_cmd *cmd);
struct mp_cmd *mp_cmd_clone(struct mp_cmd *cmd);
// Set current input section
-void mp_input_set_section(struct input_ctx *ictx, char *name);
+// flags is a bitfield of enum mp_input_section_flags values
+void mp_input_set_section(struct input_ctx *ictx, char *name, int flags);
// Get current input section
char *mp_input_get_section(struct input_ctx *ictx);
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index 0c99d3176d..bae52c3399 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -21,6 +21,8 @@
#include "stdio.h"
#include "mpbswap.h"
+#include <string.h>
+
const char *vo_format_name(int format)
{
static char unknown_format[20];
@@ -199,3 +201,102 @@ int mp_get_chroma_shift(int format, int *x_shift, int *y_shift, int *component_b
bpp *= (bits + 7) >> 3;
return err ? 0 : bpp;
}
+
+struct mp_imgfmt_entry mp_imgfmt_list[] = {
+ {"444p16le", IMGFMT_444P16_LE},
+ {"444p16be", IMGFMT_444P16_BE},
+ {"444p10le", IMGFMT_444P10_LE},
+ {"444p10be", IMGFMT_444P10_BE},
+ {"444p9le", IMGFMT_444P9_LE},
+ {"444p9be", IMGFMT_444P9_BE},
+ {"422p16le", IMGFMT_422P16_LE},
+ {"422p16be", IMGFMT_422P16_BE},
+ {"422p10le", IMGFMT_422P10_LE},
+ {"422p10be", IMGFMT_422P10_BE},
+ {"422p9le", IMGFMT_422P9_LE},
+ {"422p9be", IMGFMT_422P9_BE},
+ {"420p16le", IMGFMT_420P16_LE},
+ {"420p16be", IMGFMT_420P16_BE},
+ {"420p10le", IMGFMT_420P10_LE},
+ {"420p10be", IMGFMT_420P10_BE},
+ {"420p9le", IMGFMT_420P9_LE},
+ {"420p9be", IMGFMT_420P9_BE},
+ {"444p16", IMGFMT_444P16},
+ {"444p10", IMGFMT_444P10},
+ {"444p9", IMGFMT_444P9},
+ {"422p16", IMGFMT_422P16},
+ {"422p10", IMGFMT_422P10},
+ {"420p10", IMGFMT_420P10},
+ {"420p9", IMGFMT_420P9},
+ {"420p16", IMGFMT_420P16},
+ {"420a", IMGFMT_420A},
+ {"444p", IMGFMT_444P},
+ {"422p", IMGFMT_422P},
+ {"411p", IMGFMT_411P},
+ {"440p", IMGFMT_440P},
+ {"yuy2", IMGFMT_YUY2},
+ {"yvyu", IMGFMT_YVYU},
+ {"uyvy", IMGFMT_UYVY},
+ {"yvu9", IMGFMT_YVU9},
+ {"if09", IMGFMT_IF09},
+ {"yv12", IMGFMT_YV12},
+ {"i420", IMGFMT_I420},
+ {"iyuv", IMGFMT_IYUV},
+ {"clpl", IMGFMT_CLPL},
+ {"hm12", IMGFMT_HM12},
+ {"y800", IMGFMT_Y800},
+ {"y8", IMGFMT_Y8},
+ {"nv12", IMGFMT_NV12},
+ {"nv21", IMGFMT_NV21},
+ {"bgr24", IMGFMT_BGR24},
+ {"bgr32", IMGFMT_BGR32},
+ {"bgr16", IMGFMT_BGR16},
+ {"bgr15", IMGFMT_BGR15},
+ {"bgr12", IMGFMT_BGR12},
+ {"bgr8", IMGFMT_BGR8},
+ {"bgr4", IMGFMT_BGR4},
+ {"bg4b", IMGFMT_BG4B},
+ {"bgr1", IMGFMT_BGR1},
+ {"rgb48be", IMGFMT_RGB48BE},
+ {"rgb48le", IMGFMT_RGB48LE},
+ {"rgb48ne", IMGFMT_RGB48NE},
+ {"rgb24", IMGFMT_RGB24},
+ {"rgb32", IMGFMT_RGB32},
+ {"rgb16", IMGFMT_RGB16},
+ {"rgb15", IMGFMT_RGB15},
+ {"rgb12", IMGFMT_RGB12},
+ {"rgb8", IMGFMT_RGB8},
+ {"rgb4", IMGFMT_RGB4},
+ {"rg4b", IMGFMT_RG4B},
+ {"rgb1", IMGFMT_RGB1},
+ {"rgba", IMGFMT_RGBA},
+ {"argb", IMGFMT_ARGB},
+ {"bgra", IMGFMT_BGRA},
+ {"abgr", IMGFMT_ABGR},
+ {"gbrp", IMGFMT_GBRP},
+ {"mjpeg", IMGFMT_MJPEG},
+ {"mjpg", IMGFMT_MJPEG},
+ { NULL, 0 }
+};
+
+unsigned int mp_imgfmt_from_name(const char *name)
+{
+ struct mp_imgfmt_entry *p = mp_imgfmt_list;
+ if (!name)
+ return 0;
+ for(; p->name; ++p) {
+ if(!strcmp(name, p->name))
+ return p->fmt;
+ }
+ return 0;
+}
+
+const char *mp_imgfmt_to_name(unsigned int fmt)
+{
+ struct mp_imgfmt_entry *p = mp_imgfmt_list;
+ for(; p->name; ++p) {
+