aboutsummaryrefslogtreecommitdiffstats
path: root/src/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stream.c')
-rw-r--r--src/stream.c33
1 files changed, 33 insertions, 0 deletions
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)
{