GNU Radio Manual and C++ API Reference 3.10.5.1
The Free & Open Software Radio Ecosystem
file_meta_source.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2012 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 *
9 */
10
11#ifndef INCLUDED_BLOCKS_FILE_META_SOURCE_H
12#define INCLUDED_BLOCKS_FILE_META_SOURCE_H
13
14#include <gnuradio/blocks/api.h>
15#include <gnuradio/sync_block.h>
16
17namespace gr {
18namespace blocks {
19
20/*!
21 * \brief Reads stream from file with meta-data headers. Headers
22 * are parsed into tags.
23 * \ingroup file_operators_blk
24 *
25 * \details
26 * The information in the metadata headers includes:
27 *
28 * \li rx_rate (double): sample rate of data.
29 * \li rx_time (uint64_t, double): time stamp of first sample in segment.
30 * \li size (uint32_t): item size in bytes.
31 * \li type (::gr_file_types as int32_t): data type.
32 * \li cplx (bool): Is data complex?
33 * \li strt (uint64_t): Starting byte of data in this segment.
34 * \li bytes (uint64_t): Size in bytes of data in this segment.
35 *
36 * Any item inside of the extra header dictionary is ready out and
37 * made into a stream tag.
38 */
40{
41public:
42 // gr::blocks::file_meta_source::sptr
43 typedef std::shared_ptr<file_meta_source> sptr;
44
45 /*!
46 * \brief Create a meta-data file source.
47 *
48 * \param filename (string): Name of file to write data to.
49 * \param repeat (bool): Repeats file when EOF is found.
50 * \param detached_header (bool): Set to true if header
51 * info is stored in a separate file (usually named filename.hdr)
52 * \param hdr_filename (string): Name of detached header file if used.
53 * Defaults to 'filename.hdr' if detached_header is true but this
54 * field is an empty string.
55 */
56 static sptr make(const std::string& filename,
57 bool repeat = false,
58 bool detached_header = false,
59 const std::string& hdr_filename = "");
60
61 virtual bool open(const std::string& filename,
62 const std::string& hdr_filename = "") = 0;
63 virtual void close() = 0;
64 virtual void do_update() = 0;
65};
66
67} /* namespace blocks */
68} /* namespace gr */
69
70#endif /* INCLUDED_BLOCKS_FILE_META_SOURCE_H */
Reads stream from file with meta-data headers. Headers are parsed into tags.
Definition: file_meta_source.h:40
virtual bool open(const std::string &filename, const std::string &hdr_filename="")=0
virtual void do_update()=0
static sptr make(const std::string &filename, bool repeat=false, bool detached_header=false, const std::string &hdr_filename="")
Create a meta-data file source.
std::shared_ptr< file_meta_source > sptr
Definition: file_meta_source.h:43
repeat each input repeat times
Definition: repeat.h:30
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29