From 4df594b3f48679f594e6f738981cb3baca8a42d9 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 7 May 2017 16:11:31 +0200 Subject: Add support for floats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/stream.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/stream.c') diff --git a/src/stream.c b/src/stream.c index 4bb0195..6ff71c0 100644 --- a/src/stream.c +++ b/src/stream.c @@ -184,6 +184,39 @@ encheck_compat(int status, const struct stream *a, const struct stream *b) } +const char * +get_pixel_format(const char *specified, const char *current) +{ + const char *base = NULL; + int as_float = 0; + + if (!strcmp(current, "xyza")) + base = "xyza"; + else if (!strcmp(current, "xyza f")) + base = "xyza", as_float = 1; + else + return specified; + + if (!strcmp(specified, "xyza")) + base = "xyza"; + else if (!strcmp(specified, "xyza f")) + return "xyza f"; + else if (!strcmp(specified, "xyza !f")) + return "xyza"; + else if (!strcmp(specified, "f")) + as_float = 1; + else if (!strcmp(specified, "!f")) + as_float = 0; + else + return specified; + + if (!strcmp(base, "xyza")) + return as_float ? "xyza f" : "xyza"; + else + return specified; +} + + int enread_frame(int status, struct stream *stream, void *buf, size_t n) { -- cgit v1.2.3-70-g09d2