Merge branch 'upstream' into dfsg-orig
[debian/gnuradio] / gr-atsc / src / lib / atsc_fs_checker.cc
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include <atsc_fs_checker.h>
28 #include <create_atsci_fs_checker.h>
29 #include <atsci_fs_checker.h>
30 #include <gr_io_signature.h>
31 #include <atsc_consts.h>
32 #include <atsci_syminfo.h>
33
34
35 atsc_fs_checker_sptr
36 atsc_make_fs_checker()
37 {
38   return atsc_fs_checker_sptr(new atsc_fs_checker());
39 }
40
41 atsc_fs_checker::atsc_fs_checker()
42   : gr_sync_block("atsc_fs_checker",
43                   gr_make_io_signature(2, 2, sizeof(float)),
44                   gr_make_io_signature(2, 2, sizeof(float)))
45 {
46   d_fsc = create_atsci_fs_checker();
47 }
48
49
50 atsc_fs_checker::~atsc_fs_checker ()
51 {
52   // Anything that isn't automatically cleaned up...
53
54   delete d_fsc;
55 }
56
57
58 int
59 atsc_fs_checker::work (int noutput_items,
60                        gr_vector_const_void_star &input_items,
61                        gr_vector_void_star &output_items)
62 {
63   const float *in = (const float *) input_items[0];
64   const atsc::syminfo *tag_in = (const atsc::syminfo *) input_items[1];
65   float *out = (float *) output_items[0];
66   atsc::syminfo *tag_out = (atsc::syminfo *) output_items[1];
67
68   assert(sizeof(float) == sizeof(atsc::syminfo));
69
70
71   for (int i = 0; i < noutput_items; i++)
72     d_fsc->filter (in[i], tag_in[i], &out[i], &tag_out[i]);
73
74   return noutput_items;
75 }