Re: Reading from a stream (not a file)
Paul Schneider <[email protected]> Mon, 27 Aug 2007 11:39:22 -0400
| Newsgroups | gmane.comp.video.openexr.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, Brad,
it's true that the IStream constructor requires a "filename", but
it's possible to make a subclass that doesn't need the filename to
point to an actual file on disk. Generally, the "filename" is only
used to build the error string when an exception is thrown. I
imagine that the problem is not that there is no file on disk named
"", but that the data in your stream is malformed, or not what the
IMF library is expecting (maybe there is some metadata before the EXR
file information).
The Photoshop plugin uses an IStream subclass to read EXR data from
an already-open file, and passes a dummy file name to the
constructor. You can check out the source here:
http://download.savannah.gnu.org/releases/openexr/
OpenEXR_Photoshop-1.2.1.Source.tar.gz
- Paul
PS: the openexr-devel group might be more appropriate for code-level
questions.
On Aug 27, 2007, at 11:25 AM, Brad Hards wrote:
> G'day,
>
> I'm trying to update the KDE metadata plugin for EXR format files,
> and have
> run into a problem.
>
> KDE4 has some fairly substantial changes in the way metadata gets
> managed, and
> one of those changes is that we no longer work on files, but only on a
> stream. The reason for this is so we can index into archives and so
> on.
>
> However this is causing a problem with using OpenEXR, where the
> constructors
> appear to insist on having a filename. I tried to build a little
> adapter
> class, but I still needed a filename.
>
> class ExrIStream : public Imf::IStream
> {
> public:
> ExrIStream (Strigi::InputStream *in):
> Imf::IStream (""), m_strigiStream(in) {}
>
> // other features omitted
> }
>
> but it throws:
> terminate called after throwing an instance of 'Iex::ArgExc'
> what(): Cannot read image file "". Invalid pixel aspect ratio in
> image
> header.
> Aborted
>
> Any suggestions?
>
> Brad
> _______________________________________________
> Openexr-user mailing list
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/openexr-user