discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] qa_atsc.py type question


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] qa_atsc.py type question
Date: Mon, 2 Aug 2010 14:19:03 -0700
User-agent: Mutt/1.5.20 (2009-08-17)

On Sat, Jul 31, 2010 at 06:35:18PM -0400, Jonathan wrote:
> Hello everyone,
> 
> I have a question regarding a few lines in qa_atsc.py .
> 
> In test_loopback_000, we have:
> src = vector_source_ts(src_data)
> rand = atsc.randomizer()
> and skipping a few lines:
> self.tb.connect(src, rand, derand, dst)
> 
> The definition of vector_source_ts:
> 
> class vector_source_ts(gr.hier_block2):
>     """
>     MPEG Transport stream source for testing.
>     """
>     def __init__(self, ts):
>         """
>         Pad tranport stream packets to 256 bytes and reformat appropriately.
> 
>         @param ts: MPEG transport stream.
>         @type  ts: sequence of ints in [0,255]; len(ts) % 188 == 0
>         """
> 
>         src = gr.vector_source_b(pad_transport_stream(ts))
>         s2v = gr.stream_to_vector(gr.sizeof_char,
> atsc.sizeof_atsc_mpeg_packet)
> 
>       gr.hier_block2.__init__(self, "vector_source_ts",
>                               gr.io_signature(0, 0, 0),
>                               s2v.output_signature())
>         self.connect(src, s2v, self)
> 
> 
> =================================
> It is clear that in "src = vector_source_ts(src_data)",
> src_data is a tuple of integers, and src is a gnuradio_vector datatype
> with elements guradio_characters and each vector length is
> atsc.sizeof_atsc_mpeg_packet
> 
> That is, "src = vector_source_ts(src_data)" does *not* create any
> atsc_mpeg_packet type data, as required by atsc_randomizer.

The runtime only checks that the datatypes have the same size.  Since
the blocks' work methods cast their input and output buffers from (void *)
to the type that they require, everything works out OK.

Eric



reply via email to

[Prev in Thread] Current Thread [Next in Thread]