[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] File source and seek()
From: |
Martin Braun |
Subject: |
Re: [Discuss-gnuradio] File source and seek() |
Date: |
Mon, 10 Mar 2014 22:36:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 03/10/2014 06:38 PM, trracer dangly wrote:
> Hello,
>
> I am having some trouble getting the seek() function in the file source
> to work.
>
> My program has a non-repeating file source, and a GUI button with the
> callback function set_button(). In the callback I have written the below
> code, which should reset the file source to the beginning of the file:
>
> self.blocks_file_source_0.seek(0,0)
>
> When I press the button before the file source has streamed to the end,
> the seek() works fine and resets the file source to the beginning. When
> I press the button after the file source has streamed to the end and
> stopped, the seek() does not work and nothing happens in the code. I
> suspect this has something to do with the scheduler thinking this block
> is done and ignoring it or deleting it or something, but I have been
> unable to get it working the way I want it to.
You're on the right track: In a non-repeating file source, the block
will return -1 after the file was read, which triggers a shutdown of the
FG. So, what you really want is to restart the flow graph.
Perhaps you need to write your own block which acts on your inputs.
M