-
Notifications
You must be signed in to change notification settings - Fork 0
GNRC Tutorial Wiki Part 5: Make a simple GNRC graph to play a .tbc file
For an exercise (requires you have a .tbc file on your machine), let's create our own graph to play a .tbc file in the Video SDL sink. Simply follow the following steps in GNRC:
- Select File --> New QT GUI
- Double click the
samp_rate
variable block and enter14318181
value field (this is NTSC, for PAL see the sample rate page).
- As we found out earlier, a .tbc file is u16 data type, and GNRC does not natively support this data type. So we are going create a set of input blocks to get where we need to go (converting 2 bytes to their u16 value inside a float data type). For our input stage, add the following blocks using the "search" and "double click" in the right tree list (see blocks page):
- File Source
- Uchar To Float
- Deinterleave
- Multiply Const
- Add
- Double click the
File Source
block and set the following:- Use the file search button to select a .tbc file on your filesystem (see cvbs/ld/vhs decode on how to make one)
- Output Type = "byte"
- Repeat = "no"
- Select the
Deinterleave
and press the "Down Arrow" key once to switch it to "float" data type. - Double click the
Multiply constant
block and set the following:- Value = 256
- IO Type = float
- Select the
add
block and press the "Down Aarrow" key once to switch it to "float" data type. - Connect all the blocks as you see in this image:
Set up processing for Video SDL Link (need to convert 0-65535 values to 0-255 range and "throttle" the rate we process)
- Search, Find, Add, a
Throttle
block and connect the input of the throttle to the output of theadd
. Use the "down arrow" to set it to "float". - Search, Find, Add, a
Divide
block. Use the "down arrow" to set it to "float". Connect the "out" ofthrottle
to the "in0" ofdivide
. - Search, Find, Add, a
Constant Source
block, double click and set value to 256 and type to float. Connect the "out" ofConstant Source
to the "in1" ofdivide
. - Search, Find, Add, a
rail
block, set the "low" value to 0, and the "high" value to 255. - Search, Find, Add, a
Float To Uchar
block, connect the "in" ofFloat To Uchar
to the "out" of theDivide
. - Search, Find, Add, a
Video SDL Sink
block. connect the "out" ofFloat To Uchar
to the "in" of theVideo SDL Sink
. - Double click the
Video SDL Sink
and set the "input width" to 910 NSTC or 1135 PAL. Set the "input hieght" to 526 NTSC or 626 PAL.
When your graph is done, and you play it, it should look something like this:
Here's a block by block explanation of what is happening:
NOTE: The only thing we are really doing here, is converting data types. If GNRC suppored u16 data type, and if
Video SDL Sink
supported u16 data type, you could simply have aFile Source
connected directly to aVideo SDL Sink
(with possibly aThrottle
in between.
Also NOTE: It is normal for the fields to be shown this way, that's how they are stored in the file, and how they were transmitted OTA back in the days of analog television.
A copy of the graph created here can be found in the tutorial github repo: Here