24#include <core/exception.h>
25#include <fvutils/color/colorspaces.h>
26#include <fvutils/readers/fvraw.h>
27#include <fvutils/writers/fvraw.h>
49 infile = fopen(filename,
"r");
52 throw Exception(
"Could not open file for reading");
55 if (fread((
char *)&header,
sizeof(header), 1, infile) != 1) {
59 throw(
"Invalid file identifier");
61 buffer_size = colorspace_buffer_size(header.colorspace, header.width, header.height);
77 buffer = yuv422planar_buffer;
113 if (buffer == NULL) {
114 throw Exception(
"Read failed: buffer == NULL");
116 if (buffer_size == 0) {
117 throw Exception(
"Read failed: buffer_size == 0");
120 if (fread(buffer, buffer_size, 1, infile) != 1) {
121 throw Exception(
"Failed to read data", errno);
133 f = fopen(filename,
"r");
136 if (fread((
char *)&header,
sizeof(header), 1, f) == 1) {
Base class for exceptions in Fawkes.
virtual void read()
Read data from file.
static bool is_FvRaw(const char *filename)
Check if given file contains FvRaw image.
FvRawReader(const char *filename)
Constructor.
virtual ~FvRawReader()
Destructor.
virtual unsigned int pixel_width()
Get width of read image in pixels.
virtual colorspace_t colorspace()
Get colorspace from the just read image.
virtual void set_buffer(unsigned char *yuv422planar_buffer)
Set buffer that the read image should be written to.
virtual unsigned int pixel_height()
Get height of read image in pixels.
static const unsigned int FILE_IDENTIFIER
File identifier for FvRaw images.
Fawkes library namespace.