26#include "io/stream.hpp"
27#include "libopenraw/consts.h"
29#include "streamclone.hpp"
35StreamClone::StreamClone(
const Stream::Ptr & clone,
37 : Stream(clone->get_path().c_str()),
38 m_cloned(clone), m_offset(offset)
43StreamClone::~StreamClone()
48Stream::Error StreamClone::open()
50 if (m_cloned == NULL) {
51 set_error(OR_ERROR_CLOSED_STREAM);
52 return OR_ERROR_CLOSED_STREAM;
54 m_cloned->seek(m_offset, SEEK_SET);
61int StreamClone::close()
68int StreamClone::seek(off_t offset,
int whence)
70 if (m_cloned == NULL) {
71 set_error(OR_ERROR_CLOSED_STREAM);
74 if (whence == SEEK_SET) {
77 int new_pos = m_cloned->seek(offset, whence);
83int StreamClone::read(
void *buf,
size_t count)
85 if (m_cloned == NULL) {
86 set_error(OR_ERROR_CLOSED_STREAM);
89 return m_cloned->read(buf, count);
93off_t StreamClone::filesize()
95 if (m_cloned == NULL) {
96 set_error(OR_ERROR_CLOSED_STREAM);
99 return m_cloned->filesize() - m_offset;
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard....