GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
atsc_plinfo.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2001,2006,2014 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef DTV_INCLUDED_ATSC_PLINFO_H
12 #define DTV_INCLUDED_ATSC_PLINFO_H
13 
15 #include <cassert>
16 #include <cstdint>
17 #include <cstring>
18 
19 #include <gnuradio/dtv/api.h>
20 
21 namespace gr {
22 namespace dtv {
23 
24 /*!
25  * \brief pipeline info that flows with data
26  *
27  * Not all modules need all the info
28  */
30 {
31 public:
32  plinfo();
33  plinfo(uint16_t flags, int16_t segno);
34 
35  /**
36  * @brief Resets the flags and segno fields
37  *
38  */
39  void reset();
40 
41  // accessors
42  bool field_sync1_p() const;
43  bool field_sync2_p() const;
44  bool field_sync_p() const;
45 
46  bool regular_seg_p() const;
47 
48  bool in_field1_p() const;
49  bool in_field2_p() const;
50 
51  bool first_regular_seg_p() const;
52 
53  bool transport_error_p() const;
54 
55  unsigned int segno() const;
56  unsigned int flags() const;
57 
58  // setters
59 
61 
63 
64  void set_regular_seg(bool field2, int segno);
65 
66  void set_transport_error(bool error);
67 
68  /*!
69  * Set \p OUT such that it reflects a \p NSEGS_OF_DELAY
70  * pipeline delay from \p IN.
71  */
72  static void delay(plinfo& out, const plinfo& in, int nsegs_of_delay);
73 
74  // these three are mutually exclusive
75  // This is a regular data segment.
76  static constexpr int fl_regular_seg = 0x0001;
77  // This is a field sync segment, for 1st half of a field.
78  static constexpr int fl_field_sync1 = 0x0002;
79  // This is a field sync segment, for 2nd half of a field.
80  static constexpr int fl_field_sync2 = 0x0004;
81 
82  // This bit is on ONLY when fl_regular_seg is set AND when this is
83  // the first regular data segment AFTER a field sync segment. This
84  // segment causes various processing modules to reset.
85  static constexpr int fl_first_regular_seg = 0x0008;
86 
87  // which field are we in?
88  static constexpr int fl_field2 = 0x0010; // else field 1
89 
90  // This bit is set when Reed-Solomon decoding detects an error that it
91  // can't correct. Note that other error detection (e.g. Viterbi) do not
92  // set it, since Reed-Solomon will correct many of those. This bit is
93  // then copied into the final Transport Stream packet so that MPEG
94  // software can see that the 188-byte data segment has been corrupted.
95  static constexpr int fl_transport_error = 0x0020;
96 
97 private:
98  uint16_t d_flags = 0; // bitmask
99  int16_t d_segno = 0; // segment number [-1,311] -1 is the field sync segment
100 };
101 
102 } /* namespace dtv */
103 } /* namespace gr */
104 
105 #endif /* _ATSC_PLINFO_H_ */
pipeline info that flows with data
Definition: atsc_plinfo.h:30
unsigned int segno() const
bool in_field1_p() const
bool field_sync_p() const
void set_regular_seg(bool field2, int segno)
void set_transport_error(bool error)
bool transport_error_p() const
bool in_field2_p() const
unsigned int flags() const
bool regular_seg_p() const
void set_field_sync2()
static void delay(plinfo &out, const plinfo &in, int nsegs_of_delay)
void set_field_sync1()
void reset()
Resets the flags and segno fields.
plinfo(uint16_t flags, int16_t segno)
bool field_sync1_p() const
bool field_sync2_p() const
bool first_regular_seg_p() const
#define DTV_API
Definition: gr-dtv/include/gnuradio/dtv/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29