summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau2012-12-12 18:45:53 -0500
committerTom Rondeau2012-12-12 18:45:53 -0500
commitf1de74af9270235126b67e9507111df5752a3e5c (patch)
tree61bb10c9a73d03d1e9016d9c2de84e6e2c28aeca
parent9ac98067a8529d80501ab3c8122b3ce11e896657 (diff)
downloadgnuradio-f1de74af9270235126b67e9507111df5752a3e5c.tar.gz
gnuradio-f1de74af9270235126b67e9507111df5752a3e5c.tar.bz2
gnuradio-f1de74af9270235126b67e9507111df5752a3e5c.zip
core: add new options to GRC for file_meta_sink.
Also updates gr_read_file_metadata to add a -D option that properly parses a detached header.
-rw-r--r--gr-utils/src/python/gr_read_file_metadata10
-rw-r--r--grc/blocks/gr_file_meta_sink.xml28
2 files changed, 33 insertions, 5 deletions
diff --git a/gr-utils/src/python/gr_read_file_metadata b/gr-utils/src/python/gr_read_file_metadata
index ba530ca54..efbf8d15d 100644
--- a/gr-utils/src/python/gr_read_file_metadata
+++ b/gr-utils/src/python/gr_read_file_metadata
@@ -26,7 +26,7 @@ from optparse import OptionParser
from gnuradio import gr
from gnuradio import parse_file_metadata
-def main(filename):
+def main(filename, detached=False):
handle = open(filename, "rb")
nheaders = 0
@@ -63,7 +63,9 @@ def main(filename):
extra_info = parse_file_metadata.parse_extra_dict(extra, info, True)
nheaders += 1
- nread += info['nbytes'] + parse_file_metadata.HEADER_LENGTH + info["extra_len"]
+ nread += parse_file_metadata.HEADER_LENGTH + info["extra_len"]
+ if(not detached):
+ nread += info['nbytes']
handle.seek(nread, 0)
print "\n\n"
@@ -73,6 +75,8 @@ if __name__ == "__main__":
parser = OptionParser(conflict_handler="resolve",
usage=usage, description=description)
+ parser.add_option("-D", "--detached", action="store_true", default=False,
+ help="Used if header is detached.")
(options, args) = parser.parse_args ()
if(len(args) < 1):
@@ -80,4 +84,4 @@ if __name__ == "__main__":
sys.exit(1)
filename = args[0]
- main(filename)
+ main(filename, options.detached)
diff --git a/grc/blocks/gr_file_meta_sink.xml b/grc/blocks/gr_file_meta_sink.xml
index e6f5f2bd6..ba9bf4ee1 100644
--- a/grc/blocks/gr_file_meta_sink.xml
+++ b/grc/blocks/gr_file_meta_sink.xml
@@ -8,7 +8,7 @@
<name>File Meta Sink</name>
<key>gr_file_meta_sink</key>
<import>from gnuradio import gr</import>
- <make>gr.file_meta_sink($type.size*$vlen, $file, $samp_rate, $rel_rate, $type.dtype, $type.cplx)
+ <make>gr.file_meta_sink($type.size*$vlen, $file, $samp_rate, $rel_rate, $type.dtype, $type.cplx, $max_seg_size, $extra_dict, $detached)
self.$(id).set_unbuffered($unbuffered)</make>
<callback>set_unbuffered($unbuffered)</callback>
<callback>open($file)</callback>
@@ -77,6 +77,31 @@ self.$(id).set_unbuffered($unbuffered)</make>
<type>int</type>
</param>
<param>
+ <name>Max Seg. Size</name>
+ <key>max_seg_size</key>
+ <value>1000000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Extra Dict.</name>
+ <key>extra_dict</key>
+ <value>""</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Detached</name>
+ <key>detached</key>
+ <value>False</value>
+ <type>bool</type>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ </param> <param>
<name>Unbuffered</name>
<key>unbuffered</key>
<value>False</value>
@@ -90,7 +115,6 @@ self.$(id).set_unbuffered($unbuffered)</make>
<key>True</key>
</option>
</param>
-
<check>$vlen &gt; 0</check>
<sink>
<name>in</name>