DVBProtocolWrapper.cc
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #include "DVBProtocolWrapper.hh"
18 
19 // Custom includes
22 
23 #define prefix_
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 SENF_CONSOLE_REGISTER_ENUM( dmx_input_t, (DMX_IN_FRONTEND)(DMX_IN_DVR) );
27 SENF_CONSOLE_REGISTER_ENUM( dmx_output_t, (DMX_OUT_DECODER)(DMX_OUT_TAP)(DMX_OUT_TS_TAP) );
28 SENF_CONSOLE_REGISTER_ENUM( dmx_pes_type_t, (DMX_PES_AUDIO0)(DMX_PES_VIDEO0)(DMX_PES_TELETEXT0)
29  (DMX_PES_SUBTITLE0)(DMX_PES_PCR0)(DMX_PES_AUDIO1)(DMX_PES_VIDEO1)(DMX_PES_TELETEXT1)
30  (DMX_PES_SUBTITLE1)(DMX_PES_PCR1)(DMX_PES_AUDIO2)(DMX_PES_VIDEO2)(DMX_PES_TELETEXT2)
31  (DMX_PES_SUBTITLE2)(DMX_PES_PCR2)(DMX_PES_AUDIO3)(DMX_PES_VIDEO3)(DMX_PES_TELETEXT3)
32  (DMX_PES_SUBTITLE3)(DMX_PES_PCR3)(DMX_PES_OTHER));
33 
34 namespace senf {
35  SENF_CONSOLE_REGISTER_ENUM_MEMBER(DVBSectionProtocolWrapper, Flags,
36  (CHECK_CRC)(ONESHOT)(IMMEDIATE_START));
37 
38  SENF_CONSOLE_REGISTER_ENUM_MEMBER(DVBPESProtocolWrapper, Flags,
39  (CHECK_CRC)(ONESHOT)(IMMEDIATE_START));
40 }
41 
43  : protocol(sh.protocol())
44 {
45  namespace kw = console::kw;
46  namespace fty = console::factory;
47 
48  dir.add("buffersize", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
49  .doc("Set the size of the circular buffer used for filtered data.")
50  .arg("size", "in byte") );
51 
52  dir.add("start", fty::Command(&DVBSectionProtocolWrapper::startFiltering, this)
53  .doc("Starts filtering") );
54 
55  dir.add("stop", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
56  .doc("Stops filtering") );
57 
58  dir.add("filter",
59  fty::Command<void (unsigned short int,
60  unsigned,
62  unsigned,
63  unsigned,
64  unsigned)
66  .arg("pid", "pid to filter")
67  .arg("filter", "filter",
68  kw::default_value = 62,
69  kw::default_doc = "0x3e")
70  .arg("flags", "or-able: CHECK_CRC, ONESHOT, IMMEDIATE_START",
71  kw::default_value = DMX_IMMEDIATE_START | DMX_CHECK_CRC,
72  kw::default_doc = "(IMMEDIATE_START CHECK_CRC)")
73  .arg("mask", "mask",
74  kw::default_value = 0xff,
75  kw::default_doc = "0xff")
76  .arg("mode", "mode",
77  kw::default_value = 0,
78  kw::default_doc = "0x00")
79  .arg("timeout", "timeout",
80  kw::default_value = 0,
81  kw::default_doc = "0x00")
82  .doc("Sets parameters for section filter.") );
83 
84  dir.add("stop", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
85  .doc("Stops filtering") );
86 }
87 
88 
90  : protocol(sh.protocol())
91 {
92  namespace kw = console::kw;
93  namespace fty = console::factory;
94  dir.add("filter",
95  fty::Command<void (unsigned short int,
96  dmx_input_t,
97  dmx_output_t,
98  dmx_pes_type_t,
101  .arg("pid", "pid to filter")
102  .arg("input", "input-filter: DMX_IN_FRONTEND DMX_IN_DVR ")
103  .arg("output", "output-filter: DMX_OUT_DECODER DMX_OUT_TAP DMX_OUT_TS_TAP ")
104  .arg("pesType", "PES type: DMX_PES_AUDIO[0-3] DMX_PES_VIDEO[0-3] "
105  "DMX_PES_TELETEXT[0-3], DMX_PES_SUBTITLE[0-3], DMX_PES_PCR[0-3], "
106  "DMX_PES_OTHER")
107  .arg("flags", "or-able: CHECK_CRC, ONESHOT, IMMEDIATE_START",
108  kw::default_value = DMX_IMMEDIATE_START | DMX_CHECK_CRC,
109  kw::default_doc = "(IMMEDIATE_START CHECK_CRC)")
110  .doc("Sets parameters for PES filter.") );
111 
112  dir.add("start", fty::Command(&DVBPESProtocolWrapper::startFiltering, this)
113  .doc("Starts filtering") );
114 
115  dir.add("stop", fty::Command(&DVBPESProtocolWrapper::stopFiltering, this)
116  .doc("Stops filtering") );
117 }
118 
119 //-/////////////////////////////////////////////////////////////////////////////////////////////////
120 #undef prefix_
121 
122 
123 // Local Variables:
124 // mode: c++
125 // fill-column: 100
126 // c-file-style: "senf"
127 // indent-tabs-mode: nil
128 // ispell-local-dictionary: "american"
129 // compile-command: "scons -u test"
130 // comment-column: 40
131 // End:
void stopFiltering()
Stops filtering.
void setBufferSize(unsigned long size)
Set the size of the circular buffer used for filtered data.
senf::console::ScopedDirectory dir
void startFiltering()
Starts filtering.
void setPESFilter(unsigned short int pid, dmx_input_t input, dmx_output_t output, dmx_pes_type_t pesType, unsigned int flags)
DVBPESProtocolWrapper(senf::DVBDemuxPESHandle sh)
#define prefix_
Protocol specific socket handle (client interface)
SENF_CONSOLE_REGISTER_ENUM(dmx_input_t,(DMX_IN_FRONTEND)(DMX_IN_DVR))
void setSectionFilter(unsigned short int pid, uint8_t filter, unsigned int flags, uint8_t mask, uint8_t mode, unsigned int timeout)
SENF_CONSOLE_REGISTER_ENUM_MEMBER(DVBSectionProtocolWrapper, Flags,(CHECK_CRC)(ONESHOT)(IMMEDIATE_START))
senf::console::ScopedDirectory dir
DVBSectionProtocolWrapper(senf::DVBDemuxSectionHandle sh)
void startFiltering()
Starts filtering.
NodeType & add(std::string const &name, boost::shared_ptr< NodeType > node)