diff options
author | Tom Rondeau | 2012-12-04 16:54:47 -0500 |
---|---|---|
committer | Tom Rondeau | 2012-12-04 17:38:48 -0500 |
commit | 13139bb7dff0d543dfdb2cdaaa684a9fc5800cae (patch) | |
tree | 756bed3a4528d946ebf0599b543e0026ad28a7e7 /gnuradio-core/src/python | |
parent | 88a9e1f9332d54c1743d062adfaf48aa6d3040ff (diff) | |
download | gnuradio-13139bb7dff0d543dfdb2cdaaa684a9fc5800cae.tar.gz gnuradio-13139bb7dff0d543dfdb2cdaaa684a9fc5800cae.tar.bz2 gnuradio-13139bb7dff0d543dfdb2cdaaa684a9fc5800cae.zip |
core: adding a max segment size to metadata files.
Automatically generates a new header after the MSS is reached.
Also adds a metadata format version number (starting at 0).
Diffstat (limited to 'gnuradio-core/src/python')
-rw-r--r-- | gnuradio-core/src/python/gnuradio/parse_file_metadata.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gnuradio-core/src/python/gnuradio/parse_file_metadata.py b/gnuradio-core/src/python/gnuradio/parse_file_metadata.py index c8a9fbde1..31ba5f7f0 100644 --- a/gnuradio-core/src/python/gnuradio/parse_file_metadata.py +++ b/gnuradio-core/src/python/gnuradio/parse_file_metadata.py @@ -32,7 +32,8 @@ strt Start of data (or size of header) in bytes size Size of data in bytes ''' -HEADER_LENGTH = 117 +HEADER_LENGTH = gr.METADATA_HEADER_SIZE + ftype_to_string = {gr.GR_FILE_BYTE: "bytes", gr.GR_FILE_SHORT: "short", gr.GR_FILE_INT: "int", @@ -58,6 +59,16 @@ def parse_header(p, hdr_start, VERBOSE=False): sys.stderr.write("Header is not a PMT dictionary: invalid or corrupt data file.\n") sys.exit(1) + # GET FILE FORMAT VERSION NUMBER + if(gr.pmt_dict_has_key(p, gr.pmt_string_to_symbol("version"))): + r = gr.pmt_dict_ref(p, gr.pmt_string_to_symbol("version"), dump) + version = gr.pmt_to_long(r) + if(VERBOSE): + print "Version Number: {0}".format(version) + else: + sys.stderr.write("Could not find key 'sr': invalid or corrupt data file.\n") + sys.exit(1) + # EXTRACT SAMPLE RATE if(gr.pmt_dict_has_key(p, gr.pmt_string_to_symbol("rx_rate"))): r = gr.pmt_dict_ref(p, gr.pmt_string_to_symbol("rx_rate"), dump) |