Mako 8.4.0 API
MakoCore SDK API Documentation
Loading...
Searching...
No Matches
edlstream.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007-2026 Hybrid Software Helix Ltd. All rights reserved.
3 */
4
12
13#ifndef EDLSTREAM_H
14#define EDLSTREAM_H
15
16#include <fstream>
17#include <edl/edltypes.h>
18#include <edl/iedlobject.h>
19#include <edl/idomhashable.h>
20#include <edl/edlvector.h>
21#include <edl/edlerrors.h>
22#include <edl/edlfwd.h>
23
24#ifdef _WIN32
25#include <cstdarg>
26#endif
27
29
35
36class IEDLStream : virtual public IEDLObject
37{
38 public:
43 virtual bool isValid() const = 0;
44
49 virtual bool open()
50 {
51 try
52 {
53 openE();
54 return true;
55 }
56 catch (IEDLError &e)
57 {
58 if (e.getErrorCode() == EDL_ERR_PANIC)
59 {
60 throw;
61 }
62 return false;
63 }
64 }
65
70 virtual void openE() = 0;
71
75 virtual void close() = 0;
76
81 virtual int64 getPos() = 0;
82};
84#define edlobj2IEDLStream(src) edl_cast((IEDLStream *)nullptr, src)
85
86class IInputStream;
89class IRAInputStream;
92class IRAOutputStream;
96
111typedef int (*UserStreamWriteFunc) (void *pPriv, void *pBuff, unsigned int len);
112
124typedef int (*UserStreamReadFunc) (void *pPriv, void *pBuff, unsigned int len,
125 unsigned int *pLenRead, int *pEof);
126
139typedef int (*UserRAReadFunc) (void *pPriv, void *pBuff, int64 offset, int32 length);
140
146
147class IInputStream : virtual public IEDLStream, virtual public IDOMHashable
148{
149 public:
157 static EDL_API IRAInputStreamPtr createFromFile(IEDLClassFactory *pFactory, const EDLSysString &path);
158
166 static EDL_API IRAInputStreamPtr createFromFile(IEDLClassFactory *pFactory, const EDLString &path);
167
181 static EDL_API IRAInputStreamPtr createFromFileShared(IEDLClassFactory *pFactory, const EDLSysString &path);
182
196 static EDL_API IRAInputStreamPtr createFromFileShared(IEDLClassFactory *pFactory, const EDLString &path);
197
212 static EDL_API IRAInputStreamPtr createSharedFromStream(IEDLClassFactory *pFactory, const IRAInputStreamPtr &stream, bool clone = true);
213
226 static EDL_API IRAInputStreamPtr createFromMemory(IEDLClassFactory *pFactory, const void *mem, uint32 length, bool copy = false, bool free = true);
227
236 static EDL_API IInputStreamPtr createFromUserReadFunc(IEDLClassFactory *pFactory, UserStreamReadFunc readFunc, void *priv);
237
247 static EDL_API IRAInputStreamPtr createFromRAUserFunc(IEDLClassFactory *pFactory, int64 length, UserRAReadFunc readFunc, void *priv);
248
259 static EDL_API IRAInputStreamPtr createRandomAccessFromNonRandomAccess(IEDLClassFactory *pFactory, const IInputStreamPtr &stream);
260
270 static EDL_API IRAInputStreamPtr createFromNewFileWithContents(IEDLClassFactory *pFactory, const EDLSysString &path, const IInputStreamPtr &stream);
271
281 static EDL_API IRAInputStreamPtr createFromNewFileWithContents(IEDLClassFactory *pFactory, const EDLString &path, const IInputStreamPtr &stream);
282
293 static EDL_API IInputStreamPtr createSubFile(IEDLClassFactory *pFactory, const IInputStreamPtr &stream, int64 offset, int64 length);
294
304 static EDL_API IInputStreamPtr createFromFlateCompressed(IEDLClassFactory *pFactory, const IInputStreamPtr &stream, bool raw = true, bool ignoreChecksums = false);
305
315 static EDL_API IInputStreamPtr createFromLz4Compressed(IEDLClassFactory *pFactory, const IInputStreamPtr &stream);
316
330 static EDL_API IInputStreamPtr createFromPredictorCompressed(IEDLClassFactory *pFactory, const IInputStreamPtr &stream,
331 uint8 predictor, uint8 colors, uint8 bitsPerComponent, uint32 columns);
332
340 static EDL_API IInputStreamPtr createCompositeStream(IEDLClassFactory *pFactory, const CIInputStreamVect &streams);
341
352 static EDL_API IInputPushbackStreamPtr createPushbackStream(IEDLClassFactory *pFactory, const IInputStreamPtr &sourceStream, bool clone = true);
353
368 static EDL_API IInputStreamPtr createUelStream(IEDLClassFactory *pFactory, const IInputStreamPtr &sourceStream);
369
383 static EDL_API IInputStreamPtr createTbcpStream(IEDLClassFactory *pFactory, const IInputStreamPtr &sourceStream, bool openSource = false);
384
409 static EDL_API IRAInputStreamPtr createBackgroundCopyStream(const EDL::ISessionPtr &session,
410 const IRAInputStreamPtr &sourceStream,
411 bool clonable = true);
412
413#ifdef SWIG
414#if SWIGJAVA
415 %apply char *BYTE {void *buffer}
416#endif
417#if SWIGCSHARP
418 %apply unsigned char OUTPUT[] {void *buffer}
419#endif
420#if SWIGPYTHON
421 %apply char INOUT[] {void *buffer};
422#endif
423#endif
424
432 virtual int32 read(void * buffer, int32 count) = 0;
433#ifdef SWIG
434 %clear void *buffer;
435#endif
436
441 virtual int8 read() = 0;
442
447 virtual bool eof() const = 0;
448
454 virtual int64 skip(int64 count)
455 {
456 static const int32 kBufSize = 1024;
457 char buf[kBufSize];
458 int64 rc = 0;
459 int32 n_read;
460 while (count > 0)
461 {
462 if ((n_read = read((void *)buf, (int32)((count > kBufSize)? kBufSize : count))) <= 0)
463 {
464 break;
465 }
466 else
467 {
468 rc += n_read;
469 }
470 count -= n_read;
471 }
472 return rc;
473 }
474
483 virtual bool getSourceFilePath(EDLSysString &sourcePath) = 0;
484
494 virtual bool getCanonicalSourceFilePath(EDLSysString &sourceCanonicalPath) = 0;
495
496 #ifdef SWIG
497#if SWIGJAVA
498 %apply char *BYTE {void *buffer}
499#endif
500#if SWIGCSHARP
501 %apply unsigned char OUTPUT[] {void *buffer}
502#endif
503#if SWIGPYTHON
504 %apply char INOUT[] {void *buffer}
505#endif
506#endif
513 virtual bool completeRead(void * buffer, int32 count);
514#ifdef SWIG
515 %clear void *buffer;
516#endif
517
518#ifdef SWIG
519#if SWIGJAVA
520 %apply char *BYTE {void *buffer}
521#endif
522#if SWIGCSHARP
523 %apply unsigned char OUTPUT[] {void *buffer}
524#endif
525#if SWIGPYTHON
526 %apply char INOUT[] {void *buffer}
527#endif
528#endif
534 virtual void completeReadE(void *buffer, int32 count);
535#ifdef SWIG
536 %clear void *buffer;
537#endif
538
539#ifdef SWIG
540#if SWIGJAVA
541 %apply uint64_t &OUTPUT {uint64 &hash };
542#endif
543#if SWIGCSHARP
544 %apply uint64_t &OUTPUT {uint64 &hash };
545#endif
546#endif
555 virtual bool hash(uint64 &hash);
556#ifdef SWIG
557 %clear uint64 &hash;
558#endif
559};
560#define edlobj2IInputStream(src) edl_cast((IInputStream *)nullptr, src)
561
568
570{
571public:
575 virtual ~IRAStream ()
576 {}
577
582 virtual int64 length() = 0;
583
589 virtual bool setPos(int64 newPos) = 0;
590
595 virtual void setPosE(int64 newPos)
596 {
597 if (!setPos(newPos))
598 {
600 }
601 }
602};
603
613{
614 public:
619 {}
620
626 virtual bool pushBack(uint8 byte) = 0;
627
628#ifdef SWIG
629#if SWIGJAVA
630 %apply char *BYTE {const void *buffer}
631#endif
632#if SWIGCSHARP
633 %apply unsigned char INPUT[] {const void *buffer}
634#endif
635#if SWIGPYTHON
636 %apply char INPUT[] {const void *buffer}
637#endif
638#endif
645
646 virtual bool pushBack(const void *buffer, int32 count) = 0;
647#ifdef SWIG
648 %clear const void *buffer;
649#endif
650};
651
657class IRAInputStream : virtual public IInputStream, virtual public IRAStream
658{
659};
660
662#define edlobj2IRAInputStream(src) edl_cast((IRAInputStream *)nullptr, src)
663
669
670class IInputPushbackStream : virtual public IInputStream, virtual public IPushbackStream
671{
672};
673
674#define edlobj2IInputPushbackStream(src) edl_cast((IInputPushbackStream *)nullptr, src)
675
681
682class IRAInputPushbackStream : virtual public IRAInputStream, virtual public IPushbackStream
683{
684};
685
687#define edlobj2IRAInputPushbackStream(src) edl_cast((IRAInputPushbackStream *)nullptr, src)
688
689#define FILE_STREAM_GUID 0x89ad895, 0x48f1685b, 0x8dab9c1a, 0xe8e3b18b
690#define SHARED_STREAM_GUID 0xe88a727d, 0xe53140da, 0x9bbff26d, 0x79a42d81
691#define OUTPUTFILE_STREAM_GUID 0x50a914fc, 0xe81446b9, 0x8e420d48, 0x09454eff
692#define OUTPUTUSER_STREAM_GUID 0x789AEE52, 0xD0384136, 0x8B4584B0, 0x942E55CA
693#define INPUTUSER_STREAM_GUID 0xd55cc022, 0xa6844749, 0x9414d265, 0xeeab7cea
694#define INPUTRAUSER_STREAM_GUID 0x9895EBEB, 0xe2654b86, 0xa527a102, 0x3c3d36cd
695#define INPUT_MEMORY_STREAM_GUID 0x26CAC8F2, 0x726A432c, 0xB8399237, 0xEA12D95F
696#define FILE_STREAM_WITH_CALLBACK_GUID 0X7FB63540, 0XC0684D87, 0XB513F53A, 0X4925CF1C
697
698#define USERINPUT_RASTREAM_GUID 0x776b2562, 0x87e141b0, 0xa3d4c121, 0xdf3588ba
699#define USEROUTPUT_STREAM_GUID 0x1d0a1b45, 0xb2694fd2, 0xa1b28077, 0xee815f6a
700
708typedef void (*FileStreamReadFunc) (void *pPriv, int64 pos, int32 len);
709
711{
712 public:
713 CFileStreamParams(const EDLSysString & sName, bool append = false) : m_sName(sName), m_bAppend(append) {}
714
717};
718
720{
721 public:
722 CFileStreamWithCallbackParams(const EDLSysString & sName, FileStreamReadFunc pReadFunc, void *pPriv) :
723 CFileStreamParams(sName),
724 m_pReadFunc(pReadFunc),
725 m_pPriv(pPriv)
726 {
727 }
728
730 void *m_pPriv;
731};
732
733// Forward declaration
734class ISession;
735
736
738{
739 public:
741 m_pWriteFunc(pWriteFunc), m_pPriv(pPriv)
742 {}
743
745 void *m_pPriv;
746};
747
749{
750 public:
752 m_pReadFunc(pReadFunc), m_pPriv(pPriv)
753 {}
754
756 void *m_pPriv;
757};
758
760{
761 public:
762 CRAUserStreamReadParams(UserRAReadFunc pReadFunc, int64 length, void *pPriv) :
763 m_pReadFunc(pReadFunc), m_pPriv(pPriv), m_length(length)
764 {}
765
767 void *m_pPriv;
769};
770
772{
773 public:
774 // If makeCopy is false and free is true, the memory input stream will take ownership of the memory
775 // (which must be able to be freed by free()).
776 // If makeCopy is true, then a copy is made and will be managed by the stream. In this case,
777 // free is ignored.
778#ifdef SWIG
779#if SWIGJAVA
780 %apply char *BYTE {const uint8 *mem}
781#endif
782#if SWIGCSHARP
783 %apply unsigned char INPUT[] {const uint8 *mem}
784#endif
785#if SWIGPYTHON
786 %apply char INPUT[] {const uint8 *mem}
787#endif
788#endif
789 CInputMemoryParams(const uint8 *mem, int32 length, bool makeCopy, bool free = true) : m_memory(mem), m_length(length), m_makeCopy(makeCopy), m_free(free) {}
790#ifdef SWIG
791 %clear const uint8 *mem;
792#endif
793
797 bool m_free; // Ignored if m_makeCopy is true
798};
799
800class IOutputStream;
802
808
809class IOutputStream : virtual public IEDLStream
810{
811 public:
822 static EDL_API IRAOutputStreamPtr createToFile(IEDLClassFactory *pFactory, const EDLSysString &path, bool append = false);
823
834 static EDL_API IRAOutputStreamPtr createToFile(IEDLClassFactory *pFactory, const EDLString &path, bool append = false);
835
844 static EDL_API IOutputStreamPtr createFromUserWriteFunc(IEDLClassFactory *pFactory, UserStreamWriteFunc writeFunc, void *priv);
845
856 static EDL_API IOutputStreamPtr createToFlateCompressed(IEDLClassFactory *pFactory, const IOutputStreamPtr &stream, uint32 compressionLevel, bool raw = true);
857
869 static EDL_API IOutputStreamPtr createToLz4Compressed(IEDLClassFactory *pFactory, const IOutputStreamPtr &stream, bool openSourceStream = true);
870
879 static EDL_API int64 copy(const IInputStreamPtr &inStream, const IOutputStreamPtr &outStream);
880
881#ifdef SWIG
882#if SWIGJAVA
883 %apply char *BYTE {const void *buffer}
884#endif
885#if SWIGCSHARP
886 %apply unsigned char INPUT[] {const void *buffer}
887#endif
888#if SWIGPYTHON
889 %apply char INPUT[] {const void *buffer}
890#endif
891#endif
892
899 virtual int32 write(const void *buffer, int32 count) = 0;
900#ifdef SWIG
901 %clear const void *buffer;
902#endif
903
904#ifdef SWIG
905#if SWIGJAVA
906 %apply char *BYTE { const void *buffer }
907#endif
908#if SWIGCSHARP
909 %apply unsigned char INPUT[] { const void *buffer }
910#endif
911#if SWIGPYTHON
912 %apply char INPUT[] { const void *buffer }
913#endif
914#endif
915
922 virtual int32 writeE(const void *buffer, int32 count);
923#ifdef SWIG
924 %clear const void *buffer;
925#endif
926
935 static EDL_API int64 writeStream(const IInputStreamPtr &inStream, const IOutputStreamPtr &outStream);
936
943 virtual int32 write(const char *str);
944
950 virtual int32 writeE(const char *str);
951
956 virtual bool flush() = 0;
957
965 virtual int32 writeFormatted(const char *fmt, ...);
966
973 virtual int32 writeFormattedE(const char *fmt, ...);
974
975#ifdef SWIG
976#if SWIGJAVA
977 %apply char *BYTE {const void *buffer}
978#endif
979#if SWIGCSHARP
980 %apply unsigned char INPUT[] {const void *buffer}
981#endif
982#if SWIGPYTHON
983 %apply char INPUT[] {const void *buffer}
984#endif
985#endif
986
994 virtual bool completeWrite(const void * buffer, int32 count);
995#ifdef SWIG
996 %clear const void *buffer;
997#endif
998
1005 virtual bool completeWrite(const char *str);
1006
1007#ifdef SWIG
1008#if SWIGJAVA
1009 %apply char *BYTE {const void *buffer}
1010#endif
1011#if SWIGCSHARP
1012 %apply unsigned char INPUT[] {const void *buffer}
1013#endif
1014#if SWIGPYTHON
1015 %apply char INPUT[] {const void *buffer}
1016#endif
1017#endif
1023 virtual void completeWriteE(const void *buffer, int32 count);
1024#ifdef SWIG
1025 %clear const void *buffer;
1026#endif
1027
1032 virtual void completeWriteE(const char *str);
1033
1037 virtual void flushE();
1038};
1039#define edlobj2IOutputStream(src) edl_cast((IOutputStream *)nullptr, src)
1040
1046
1047class IRAOutputStream : public IOutputStream, virtual public IRAStream
1048{
1049};
1050
1051#define edlobj2IRAOutputStream(src) edl_cast((IRAOutputStream *)nullptr, src)
1052
1054{
1055};
1056
1058#define edlobj2IRAInputOutputStream(src) edl_cast((IRAInputOutputStream *)nullptr, src)
1059
1065class EDLIFStream : public std::ifstream
1066{
1067 public:
1068 EDLIFStream() : std::ifstream() {}
1069 explicit EDLIFStream(const char* filename, std::ios_base::openmode mode = std::ios_base::in) : std::ifstream()
1070 {
1071 open(filename, mode);
1072 }
1073#ifdef _WIN32
1074 void open(const char* filename, std::ios_base::openmode mode = std::ios_base::in)
1075 {
1076 EDLString wFilename = EDLSysStringToEDLString(EDLSysString(filename));
1077 std::ifstream::open(wFilename.c_str(), mode);
1078 }
1079#endif
1080};
1081
1087class EDLOFStream : public std::ofstream
1088{
1089 public:
1090 EDLOFStream() : std::ofstream() {}
1091 explicit EDLOFStream(const char* filename, std::ios_base::openmode mode = std::ios_base::out) : std::ofstream()
1092 {
1093 open(filename, mode);
1094 }
1095#ifdef _WIN32
1096 void open(const char* filename, std::ios_base::openmode mode = std::ios_base::out)
1097 {
1098 EDLString wFilename = EDLSysStringToEDLString(EDLSysString(filename));
1099 std::ofstream::open(wFilename.c_str(), mode);
1100 }
1101#endif
1102};
1103
1105
1106#endif /* EDLSTREAM_H */
EDL Object Interface.
Definition iedlobject.h:31
Definition edlvector.h:30
bool m_bAppend
Definition edlstream.h:716
EDLSysString m_sName
Definition edlstream.h:715
CFileStreamParams(const EDLSysString &sName, bool append=false)
Definition edlstream.h:713
void * m_pPriv
Definition edlstream.h:730
FileStreamReadFunc m_pReadFunc
Definition edlstream.h:729
CFileStreamWithCallbackParams(const EDLSysString &sName, FileStreamReadFunc pReadFunc, void *pPriv)
Definition edlstream.h:722
bool m_free
Definition edlstream.h:797
const uint8 * m_memory
Definition edlstream.h:794
int32 m_length
Definition edlstream.h:795
bool m_makeCopy
Definition edlstream.h:796
CInputMemoryParams(const uint8 *mem, int32 length, bool makeCopy, bool free=true)
Definition edlstream.h:789
int64 m_length
Definition edlstream.h:768
void * m_pPriv
Definition edlstream.h:767
CRAUserStreamReadParams(UserRAReadFunc pReadFunc, int64 length, void *pPriv)
Definition edlstream.h:762
UserRAReadFunc m_pReadFunc
Definition edlstream.h:766
UserStreamReadFunc m_pReadFunc
Definition edlstream.h:755
void * m_pPriv
Definition edlstream.h:756
CUserStreamReadParams(UserStreamReadFunc pReadFunc, void *pPriv)
Definition edlstream.h:751
UserStreamWriteFunc m_pWriteFunc
Definition edlstream.h:744
CUserStreamWriteParams(UserStreamWriteFunc pWriteFunc, void *pPriv)
Definition edlstream.h:740
void * m_pPriv
Definition edlstream.h:745
EDLIFStream(const char *filename, std::ios_base::openmode mode=std::ios_base::in)
Definition edlstream.h:1069
EDLIFStream()
Definition edlstream.h:1068
EDLOFStream(const char *filename, std::ios_base::openmode mode=std::ios_base::out)
Definition edlstream.h:1091
EDLOFStream()
Definition edlstream.h:1090
Abstract interface for objects that can be hashed.
Definition idomhashable.h:28
EDL Factory Interface allows one part of the EDL infrastructure to register class creation methods id...
Definition iedlfactory.h:31
An abstract class for EDL exceptions.
Definition edlerrors.h:228
virtual uint32 getErrorCode() const =0
IEDLObject is an abstract base class that is used by all classes that are intended to be created via ...
Definition iedlobject.h:53
virtual bool clone(IEDLObjectPtr &ptrObject, IEDLClassFactory *pFactory)
Create a copy of EDLObject.
Definition iedlobject.h:82
Generic stream. Abstract base class for EDL stream subsystem.
Definition edlstream.h:37
virtual bool open()
Opens the stream.
Definition edlstream.h:49
virtual int64 getPos()=0
Get current stream position.
virtual bool isValid() const =0
Determine stream validity.
virtual void openE()=0
As per open(), but will throw an exception on failure (IEDLError) that for some stream types may cont...
virtual void close()=0
Closes the stream.
Input Stream with pushback support.
Definition edlstream.h:671
Generic input stream. Abstract base class for all input streams.
Definition edlstream.h:148
static EDL_API IInputStreamPtr createUelStream(IEDLClassFactory *pFactory, const IInputStreamPtr &sourceStream)
Creation routine for a stream that emulates an end-of-file condition should a Universal End of Langua...
static EDL_API IRAInputStreamPtr createSharedFromStream(IEDLClassFactory *pFactory, const IRAInputStreamPtr &stream, bool clone=true)
Creation function for a shared stream overlaying an existing stream. If this stream is cloned,...
virtual bool hash(uint64 &hash)
Obtain a 64-bit hash of the stream. Please note that this requires reading the stream and is therefor...
virtual bool completeRead(void *buffer, int32 count)
Perform a complete read.
static EDL_API IRAInputStreamPtr createFromFileShared(IEDLClassFactory *pFactory, const EDLString &path)
Creation function for an IInputStream for a file on disk. Similar to createFromFile,...
static EDL_API IRAInputStreamPtr createFromNewFileWithContents(IEDLClassFactory *pFactory, const EDLString &path, const IInputStreamPtr &stream)
Creation function for an IInputStream for a file on disk created with the contents of an existing str...
static EDL_API IRAInputStreamPtr createFromFile(IEDLClassFactory *pFactory, const EDLString &path)
Creation function for an IInputStream for a file on disk. Throws an IEDLError exception on failure.
static EDL_API IRAInputStreamPtr createFromMemory(IEDLClassFactory *pFactory, const void *mem, uint32 length, bool copy=false, bool free=true)
Creation function for an IInputStream for data in memory. Throws an IEDLError exception on failure.
virtual bool getSourceFilePath(EDLSysString &sourcePath)=0
If available, find the file path of the file that this stream references, or for streams that take th...
static EDL_API IRAInputStreamPtr createRandomAccessFromNonRandomAccess(IEDLClassFactory *pFactory, const IInputStreamPtr &stream)
Creation function to make a random access stream from a stream that is not random access....
static EDL_API IInputStreamPtr createFromLz4Compressed(IEDLClassFactory *pFactory, const IInputStreamPtr &stream)
Creation routine for a input stream for decompressing an lz4 block compressed stream....
virtual int32 read(void *buffer, int32 count)=0
Read specified number of bytes from a stream into buffer.
static EDL_API IInputStreamPtr createSubFile(IEDLClassFactory *pFactory, const IInputStreamPtr &stream, int64 offset, int64 length)
Creation routine for a stream representing a portion of a file on disk. If the source file is random ...
static EDL_API IInputStreamPtr createFromPredictorCompressed(IEDLClassFactory *pFactory, const IInputStreamPtr &stream, uint8 predictor, uint8 colors, uint8 bitsPerComponent, uint32 columns)
Creation routine for a input stream for applying a predictor algorithm to a compressed stream....
static EDL_API IInputStreamPtr createTbcpStream(IEDLClassFactory *pFactory, const IInputStreamPtr &sourceStream, bool openSource=false)
Creation routine for a stream that reads data from an underlying stream encoded using Adobe's Tagged ...
static EDL_API IRAInputStreamPtr createFromRAUserFunc(IEDLClassFactory *pFactory, int64 length, UserRAReadFunc readFunc, void *priv)
Creation function for an IRAInputStream from a user function that provides random access....
virtual bool eof() const =0
Determine if the stream has exhausted.
static EDL_API IInputStreamPtr createFromFlateCompressed(IEDLClassFactory *pFactory, const IInputStreamPtr &stream, bool raw=true, bool ignoreChecksums=false)
Creation routine for a input stream for decompressing a flate stream. Throws an IEDLError exception o...
static EDL_API IRAInputStreamPtr createFromFile(IEDLClassFactory *pFactory, const EDLSysString &path)
Creation function for an IInputStream for a file on disk. Throws an IEDLError exception on failure.
virtual void completeReadE(void *buffer, int32 count)
As completeRead(), but throws an exception if the operation fails.
virtual bool getCanonicalSourceFilePath(EDLSysString &sourceCanonicalPath)=0
If available, find the canonical file path of the file that this stream references,...
virtual int64 skip(int64 count)
Skip a specified number of bytes.
Definition edlstream.h:454
static EDL_API IRAInputStreamPtr createFromNewFileWithContents(IEDLClassFactory *pFactory, const EDLSysString &path, const IInputStreamPtr &stream)
Creation function for an IInputStream for a file on disk created with the contents of an existing str...
static EDL_API IInputStreamPtr createCompositeStream(IEDLClassFactory *pFactory, const CIInputStreamVect &streams)
Creation routine for creating a composite input stream representing the concatenation of a series of ...
virtual int8 read()=0
Read single byte from a stream.
static EDL_API IInputStreamPtr createFromUserReadFunc(IEDLClassFactory *pFactory, UserStreamReadFunc readFunc, void *priv)
Creation function for an IInputStream from a user function that provides data. Throws an IEDLError ex...
static EDL_API IRAInputStreamPtr createBackgroundCopyStream(const EDL::ISessionPtr &session, const IRAInputStreamPtr &sourceStream, bool clonable=true)
Creation routine for a stream that, in the background, copies the contents of an input stream into th...
static EDL_API IInputPushbackStreamPtr createPushbackStream(IEDLClassFactory *pFactory, const IInputStreamPtr &sourceStream, bool clone=true)
Creation routine for creating a push-back stream using a non-pushback stream as a data source....
static EDL_API IRAInputStreamPtr createFromFileShared(IEDLClassFactory *pFactory, const EDLSysString &path)
Creation function for an IInputStream for a file on disk. Similar to createFromFile,...
Generic output stream. Abstract base class for output streams.
Definition edlstream.h:810
static EDL_API IOutputStreamPtr createToFlateCompressed(IEDLClassFactory *pFactory, const IOutputStreamPtr &stream, uint32 compressionLevel, bool raw=true)
Creation routine for an output stream for compressing a flate stream. Throws an IEDLError exception o...
virtual int32 writeE(const void *buffer, int32 count)
Perform a write, throwing an exception on failure.
virtual void flushE()
As flush(), but throws an exception if the operation fails.
static EDL_API IOutputStreamPtr createToLz4Compressed(IEDLClassFactory *pFactory, const IOutputStreamPtr &stream, bool openSourceStream=true)
Creation routine for an output stream for compressing an lz4 stream. Throws an IEDLError exception on...
static EDL_API IOutputStreamPtr createFromUserWriteFunc(IEDLClassFactory *pFactory, UserStreamWriteFunc writeFunc, void *priv)
Creation function for an IOutputStream from a user function that provides data. Throws an IEDLError e...
virtual int32 writeFormattedE(const char *fmt,...)
As writeFormatted(), but throws an exception if the operation fails.
virtual bool completeWrite(const void *buffer, int32 count)
Perform a complete write.
virtual void completeWriteE(const void *buffer, int32 count)
As completeWrite(), but throws an exception if the operation fails.
static EDL_API IRAOutputStreamPtr createToFile(IEDLClassFactory *pFactory, const EDLString &path, bool append=false)
Creation function for an IOutputStream for a file on disk. Throws an IEDLError exception on failure.
virtual bool flush()=0
Flush the given stream.
static EDL_API int64 writeStream(const IInputStreamPtr &inStream, const IOutputStreamPtr &outStream)
Write the contents of the given stream to an output stream. Opens and closes the input,...
virtual int32 write(const void *buffer, int32 count)=0
Perform a write.
virtual void completeWriteE(const char *str)
As completeWrite(), but throws an exception if the operation fails.
static EDL_API int64 copy(const IInputStreamPtr &inStream, const IOutputStreamPtr &outStream)
Copy a source stream to a destination stream. Opens and closes both the input and output streams....
virtual bool completeWrite(const char *str)
Perform a complete write.
virtual int32 writeE(const char *str)
Perform a write, throwing an exception on failure.
static EDL_API IRAOutputStreamPtr createToFile(IEDLClassFactory *pFactory, const EDLSysString &path, bool append=false)
Creation function for an IOutputStream for a file on disk. Throws an IEDLError exception on failure.
virtual int32 write(const char *str)
Perform a write.
virtual int32 writeFormatted(const char *fmt,...)
Perform a formatted write as per fprintf().
Abstract base class (for input streams only) that provides a "push back" mechanism....
Definition edlstream.h:613
virtual bool pushBack(uint8 byte)=0
Push back a byte.
virtual bool pushBack(const void *buffer, int32 count)=0
Push back from a buffer.
virtual ~IPushbackStream()
Virtual destructor.
Definition edlstream.h:618
Definition edlstream.h:1054
Random-access Input Stream with pushback support.
Definition edlstream.h:683
Random Access Input Stream.
Definition edlstream.h:658
Random Access Output Stream.
Definition edlstream.h:1048
Abstract base class for "Random-Access" streams i.e. streams that can be arbitrarily re-positioned.
Definition edlstream.h:570
virtual void setPosE(int64 newPos)
Set stream position, but throw an exception on failure.
Definition edlstream.h:595
virtual ~IRAStream()
Virtual destructor.
Definition edlstream.h:575
virtual bool setPos(int64 newPos)=0
Set stream position.
virtual int64 length()=0
Get length of the stream.
EDL session class.
Definition isession.h:21
EDL_API void throwEDLError(uint32 errorcode)
Utility - Throw an IEDLError exception with the given error code.
#define _BEGIN_EDL_NAMESPACE
Definition edlnamespaces.h:75
#define _END_EDL_NAMESPACE
Definition edlnamespaces.h:76
void(* FileStreamReadFunc)(void *pPriv, int64 pos, int32 len)
Callback typedef for CFileStreamWithCallback that is used to notify a client of reads from stream.
Definition edlstream.h:708
int(* UserRAReadFunc)(void *pPriv, void *pBuff, int64 offset, int32 length)
Callback typedef for user defined random access input.
Definition edlstream.h:139
CEDLVector< IInputStreamPtr > CIInputStreamVect
Definition edlstream.h:88
int(* UserStreamWriteFunc)(void *pPriv, void *pBuff, unsigned int len)
Type definition of a callback function to receive streamed output.
Definition edlstream.h:111
int(* UserStreamReadFunc)(void *pPriv, void *pBuff, unsigned int len, unsigned int *pLenRead, int *pEof)
Callback typedef for streaming input.
Definition edlstream.h:124
CEDLVector< IRAInputStreamPtr > CIRAInputStreamVect
Definition edlstream.h:91
std::string EDLSysString
Definition edlstring.h:158
std::wstring EDLString
Definition edlstring.h:165
EDL_API EDLString EDLSysStringToEDLString(const EDLSysString &edlSysString)
EDLSysStringToEDLString converts an EDLSysString (UTF8) to an EDLString (UTF16 or UTF32 depending on ...
EDL "standard" types including known bit-length signed and unsigned integer type[def]s and definition...
unsigned int uint32
Definition edltypes.h:34
#define EDL_API
Definition edltypes.h:86
_BEGIN_HQN_NAMESPACE typedef signed char int8
Definition edltypes.h:27
unsigned long long uint64
Definition edltypes.h:35
signed int int32
Definition edltypes.h:29
signed long long int64
Definition edltypes.h:30
unsigned char uint8
Definition edltypes.h:32
Simple template vector class for general use.
@ EDL_ERR_IOERROR
General IO error.
Definition edlerrors.h:39
@ EDL_ERR_PANIC
Unstable state - abort the application.
Definition edlerrors.h:29
#define DECL_SMART_PTR(cls)
Definition smartptr.h:211