PTMemoryFilter
@interface PTMemoryFilter : PTFilter
MemoryFilter is a memory buffer that can be used as a source or a sink Filter in the Filter pipeline. When a MemoryFilter is the source, other filters can read data stored in memory; When MemoryFilter is a sink, other filters generate data which is then pushed in a memory buffer owned by MemoryFilter (MemoryFilter makes sure that there is enough space to accommodate all data).
-
Constructs a new memory filter with specified buffer size.
Declaration
Objective-C
- (instancetype)initWithBuf_sz:(unsigned long)buf_sz is_input:(BOOL)is_input;
Swift
init!(buf_sz: UInt, is_input: Bool)
Parameters
is_input
When true, this MemoryFilter acts as a source that other filters can read. When false, it acts as a sink that other filters can write to.
-
Note
MemoryFilter specific function.Declaration
Objective-C
- (NSData *)GetBuffer;
Swift
func getBuffer() -> Data!
Return Value
a pointer to the beginning of the buffer. Use method Count() to determine the number of bytes written to or read from MemoryFilter.
-
Note
MemoryFilter specific function used to change filter mode from output to input. The utility function is useful in cases when and output data buffer should be converted to an input stream.
Note
The function has no effect on an input MemoryFilter.
Declaration
Objective-C
- (void)SetAsInputFilter;
Swift
func setAsInputFilter()