diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-12-07 23:48:45 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-12-07 23:48:45 +0100 |
| commit | 4d7c506a29a5153a2b6ab903d2f4731bbab6abcb (patch) | |
| tree | 67bdf5fa8d517cd9fc137f45567f4e312a0f4fc9 /src/stream.h | |
| parent | blind-peek-head: fix minor compile-time bug (diff) | |
| download | blind-4d7c506a29a5153a2b6ab903d2f4731bbab6abcb.tar.gz blind-4d7c506a29a5153a2b6ab903d2f4731bbab6abcb.tar.bz2 blind-4d7c506a29a5153a2b6ab903d2f4731bbab6abcb.tar.xz | |
Start on libblind
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | src/stream.h | 69 |
1 files changed, 4 insertions, 65 deletions
diff --git a/src/stream.h b/src/stream.h index 9499bcf..9ff1bdb 100644 --- a/src/stream.h +++ b/src/stream.h @@ -3,7 +3,8 @@ #include <stddef.h> #include <stdio.h> -#define STREAM_HEAD_MAX (3 * INTSTRLEN(size_t) + sizeof(((struct stream *)0)->pixfmt) + 10) +#define LIBBLIND_NO_NAMESPACE +#include "libblind.h" #define XPRINTF_HEAD_FMT "%zu %zu %zu %s\n%cuivf" #define XPRINTF_HEAD_ARGS(FRAMES, WIDTH, HEIGHT, PIXFMT)\ @@ -37,7 +38,7 @@ #define einit_stream(...) eninit_stream(1, __VA_ARGS__) #define eopen_stream(...) enopen_stream(1, __VA_ARGS__) -#define eset_pixel_format(...) enset_pixel_format(1, __VA_ARGS__) +#define eset_pixfmt(...) enset_pixfmt(1, __VA_ARGS__) #define eread_stream(...) enread_stream(1, __VA_ARGS__) #define einf_check_fd(...) eninf_check_fd(1, __VA_ARGS__) #define echeck_dimensions(...) encheck_dimensions(1, __VA_ARGS__) @@ -58,77 +59,15 @@ #define process_multiple_streams(...) nprocess_multiple_streams(1, __VA_ARGS__) #define process_each_frame_two_streams(...) nprocess_each_frame_two_streams(1, __VA_ARGS__) -enum dimension { - WIDTH = 1, - HEIGHT = 2, - LENGTH = 4 -}; - -enum colour_space { - CIEXYZ, - YUV_NONLINEAR, - SRGB_NONLINEAR, - SRGB -}; - -enum alpha { - NO_ALPHA, - UNPREMULTIPLIED, - PREMULTIPLIED /* not used */ -}; - -enum encoding { - FLOAT, - DOUBLE, - LONG_DOUBLE, /* not used */ - UINT8, /* not used */ - UINT16, - UINT32, /* not used */ - UINT64 /* not used */ -}; - -enum endian { - HOST, - LITTLE, - BIG /* not used */ -}; - -struct stream { - size_t frames; - size_t width; - size_t height; - size_t n_chan; - size_t chan_size; - size_t pixel_size; - char pixfmt[32]; - enum colour_space space; - enum alpha alpha; - enum encoding encoding; - enum endian endian; - short int alpha_chan; - short int luma_chan; - int fd; - size_t ptr; - size_t xptr; - char buf[BUFSIZ]; - const char *file; - size_t headlen; - size_t row_size; - size_t col_size; - size_t frame_size; -}; - void eninit_stream(int status, struct stream *stream); void enopen_stream(int status, struct stream *stream, const char *file); -int set_pixel_format(struct stream *stream, const char *pixfmt); -void enset_pixel_format(int status, struct stream *stream, const char *pixfmt); +void enset_pixfmt(int status, struct stream *stream, const char *pixfmt); void fprint_stream_head(FILE *fp, struct stream *stream); int dprint_stream_head(int fd, struct stream *stream); size_t enread_stream(int status, struct stream *stream, size_t n); void eninf_check_fd(int status, int fd, const char *file); void encheck_dimensions(int status, const struct stream *stream, enum dimension dimensions, const char *prefix); void 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 *nselect_print_format(int status, const char *format, enum encoding encoding, const char *fmt); int enread_segment(int status, struct stream *stream, void *buf, size_t n); size_t ensend_frames(int status, struct stream *stream, int outfd, size_t frames, const char *outfname); |
