d8fdb6cca2f09c9454d2a3b976a316cbbcde54e7
[senf.git] / senf / Socket / Protocols / DVB / DVBProtocolWrapper.cc
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Anton Gillert <atx@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief DVBSocketController non-inline non-template implementation */
25
26 #include "DVBProtocolWrapper.hh"
27
28 // Custom includes
29
30 #define prefix_
31 ///////////////////////////////cc.p////////////////////////////////////////
32
33 prefix_ senf::DVBSectionProtocolWrapper::DVBSectionProtocolWrapper(senf::DVBDemuxSectionHandle sh)
34     : protocol(sh.protocol()), dir(this)
35 {
36     namespace kw = senf::console::kw;
37     namespace fty = senf::console::factory;
38
39     dir.add("buffersize", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
40             .doc("Set the size of the circular buffer used for filtered data.")
41             .arg("size", "in byte") );
42
43     dir.add("start", fty::Command(&DVBSectionProtocolWrapper::startFiltering, this)
44             .doc("Starts filtering") );
45
46     dir.add("stop", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
47             .doc("Stops filtering") );
48
49     dir.add("filter",
50             fty::Command<void (unsigned short int,
51                                     unsigned,
52                                     senf::console::FlagCollection<Flags>,
53                                     unsigned,
54                                     unsigned,
55                                     unsigned)
56             >(&DVBSectionProtocolWrapper::setSectionFilter, this)
57             .arg("pid", "pid to filter")
58             .arg("filter", "filter",
59                  kw::default_value = 62,
60                  kw::default_doc = "0x3e")
61             .arg("flags", "or-able: CHECK_CRC, ONESHOT, IMMEDIATE_START, KERNEL_CLIENT",
62                  kw::default_value = DMX_IMMEDIATE_START | DMX_CHECK_CRC,
63                  kw::default_doc = "(IMMEDIATE_START CHECK_CRC)")
64             .arg("mask", "mask",
65                  kw::default_value = 0xff,
66                  kw::default_doc = "0xff")
67             .arg("mode", "mode",
68                  kw::default_value = 0,
69                  kw::default_doc = "0x00")
70             .arg("timeout", "timeout",
71                  kw::default_value = 0,
72                  kw::default_doc = "0x00")
73             .doc("Sets parameters for section filter.") );
74
75     dir.add("stop", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
76             .doc("Stops filtering") );
77 }
78
79
80 prefix_ senf::DVBPESProtocolWrapper::DVBPESProtocolWrapper(senf::DVBDemuxPESHandle sh)
81     : protocol(sh.protocol()), dir(this)
82 {
83     namespace kw = senf::console::kw;
84     namespace fty = senf::console::factory;
85
86     dir.add("filter",
87             fty::Command<void (unsigned short int,
88                                     dmx_input_t,
89                                     dmx_output_t,
90                                     dmx_pes_type_t,
91                                     senf::console::FlagCollection<Flags>)
92             >(&DVBPESProtocolWrapper::setPESFilter, this)
93             .arg("pid", "pid to filter")
94             .arg("input", "input-filter: DMX_IN_FRONTEND DMX_IN_DVR ")
95             .arg("output", "output-filter: DMX_OUT_DECODER DMX_OUT_TAP DMX_OUT_TS_TAP ")
96             .arg("pesType", "PES type: DMX_PES_AUDIO[0-3] DMX_PES_VIDEO[0-3] "
97                             "DMX_PES_TELETEXT[0-3], DMX_PES_SUBTITLE[0-3], DMX_PES_PCR[0-3], "
98                             "DMX_PES_OTHER")
99             .arg("flags", "or-able: CHECK_CRC, ONESHOT, IMMEDIATE_START, KERNEL_CLIENT",
100                  kw::default_value = DMX_IMMEDIATE_START | DMX_CHECK_CRC,
101                  kw::default_doc = "(IMMEDIATE_START CHECK_CRC)")
102             .doc("Sets parameters for PES filter.") );
103
104     dir.add("start", fty::Command(&DVBPESProtocolWrapper::startFiltering, this)
105             .doc("Starts filtering") );
106
107     dir.add("stop", fty::Command(&DVBPESProtocolWrapper::stopFiltering, this)
108             .doc("Stops filtering") );
109 }
110
111 ///////////////////////////////cc.e////////////////////////////////////////
112 #undef prefix_
113
114 \f
115 // Local Variables:
116 // mode: c++
117 // fill-column: 100
118 // c-file-style: "senf"
119 // indent-tabs-mode: nil
120 // ispell-local-dictionary: "american"
121 // compile-command: "scons -u test"
122 // comment-column: 40
123 // End: