GNU Radio 3.6.4.2 C++ API
|
Read stream from file. More...
#include <gr_file_source.h>
Public Member Functions | |
~gr_file_source () | |
int | work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) |
just like gr_block::general_work, only this arranges to call consume_each for you | |
bool | seek (long seek_point, int whence) |
Seek file to seek_point relative to whence . | |
void | open (const char *filename, bool repeat) |
Opens a new file. | |
void | close () |
Close the file handle. | |
Protected Member Functions | |
gr_file_source (size_t itemsize, const char *filename, bool repeat) | |
void | do_update () |
Protected Attributes | |
boost::mutex | fp_mutex |
Friends | |
GR_CORE_API gr_file_source_sptr | gr_make_file_source (size_t itemsize, const char *filename, bool repeat) |
Create a file source. |
Read stream from file.
gr_file_source::gr_file_source | ( | size_t | itemsize, |
const char * | filename, | ||
bool | repeat | ||
) | [protected] |
Close the file handle.
void gr_file_source::do_update | ( | ) | [protected] |
void gr_file_source::open | ( | const char * | filename, |
bool | repeat | ||
) |
Opens a new file.
filename | name of the file to source from |
repeat | repeat file from start |
bool gr_file_source::seek | ( | long | seek_point, |
int | whence | ||
) |
Seek file to seek_point
relative to whence
.
seek_point | sample offset in file |
whence | one of SEEK_SET, SEEK_CUR, SEEK_END (man fseek) |
int gr_file_source::work | ( | int | noutput_items, |
gr_vector_const_void_star & | input_items, | ||
gr_vector_void_star & | output_items | ||
) | [virtual] |
just like gr_block::general_work, only this arranges to call consume_each for you
The user must override work to define the signal processing code
Reimplemented from gr_sync_block.
GR_CORE_API gr_file_source_sptr gr_make_file_source | ( | size_t | itemsize, |
const char * | filename, | ||
bool | repeat | ||
) | [friend] |
Create a file source.
Opens filename
as a source of items into a flowgraph. The data is expected to be in binary format, item after item. The itemsize
of the block determines the conversion from bits to items.
If repeat
is turned on, the file will repeat the file after it's reached the end.
itemsize | the size of each item in the file, in bytes |
filename | name of the file to source from |
repeat | repeat file from start |
boost::mutex gr_file_source::fp_mutex [protected] |