switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Socket / Protocols / DVB / DVBProtocolWrapper.cc
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 //
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at 
9 // http://senf.berlios.de/license.html
10 //
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on, 
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
14 //
15 // Software distributed under the License is distributed on an "AS IS" basis, 
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
17 // for the specific language governing rights and limitations under the License.
18 //
19 // The Original Code is Fraunhofer FOKUS code.
20 //
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. 
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
24 //
25 // Contributor(s):
26 //   Anton Gillert <atx@berlios.de>
27 /** \file
28     \brief DVBSocketController non-inline non-template implementation */
29
30 #include "DVBProtocolWrapper.hh"
31
32 // Custom includes
33 #include <senf/Utils/Console/ParsedCommand.hh>
34 #include <senf/Utils/Console/Utility.hh>
35
36 #define prefix_
37 //-/////////////////////////////////////////////////////////////////////////////////////////////////
38
39 prefix_ senf::DVBSectionProtocolWrapper::DVBSectionProtocolWrapper(senf::DVBDemuxSectionHandle sh)
40     : protocol(sh.protocol()), dir(this)
41 {
42     namespace kw = console::kw;
43     namespace fty = console::factory;
44
45     dir.add("buffersize", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
46             .doc("Set the size of the circular buffer used for filtered data.")
47             .arg("size", "in byte") );
48
49     dir.add("start", fty::Command(&DVBSectionProtocolWrapper::startFiltering, this)
50             .doc("Starts filtering") );
51
52     dir.add("stop", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
53             .doc("Stops filtering") );
54
55     dir.add("filter",
56             fty::Command<void (unsigned short int,
57                                     unsigned,
58                                     senf::console::FlagCollection<Flags>,
59                                     unsigned,
60                                     unsigned,
61                                     unsigned)
62             >(&DVBSectionProtocolWrapper::setSectionFilter, this)
63             .arg("pid", "pid to filter")
64             .arg("filter", "filter",
65                  kw::default_value = 62,
66                  kw::default_doc = "0x3e")
67             .arg("flags", "or-able: CHECK_CRC, ONESHOT, IMMEDIATE_START, KERNEL_CLIENT",
68                  kw::default_value = DMX_IMMEDIATE_START | DMX_CHECK_CRC,
69                  kw::default_doc = "(IMMEDIATE_START CHECK_CRC)")
70             .arg("mask", "mask",
71                  kw::default_value = 0xff,
72                  kw::default_doc = "0xff")
73             .arg("mode", "mode",
74                  kw::default_value = 0,
75                  kw::default_doc = "0x00")
76             .arg("timeout", "timeout",
77                  kw::default_value = 0,
78                  kw::default_doc = "0x00")
79             .doc("Sets parameters for section filter.") );
80
81     dir.add("stop", fty::Command(&DVBSectionProtocolWrapper::setBufferSize, this)
82             .doc("Stops filtering") );
83 }
84
85
86 prefix_ senf::DVBPESProtocolWrapper::DVBPESProtocolWrapper(senf::DVBDemuxPESHandle sh)
87     : protocol(sh.protocol()), dir(this)
88 {
89     namespace kw = console::kw;
90     namespace fty = console::factory;
91
92     dir.add("filter",
93             fty::Command<void (unsigned short int,
94                                     dmx_input_t,
95                                     dmx_output_t,
96                                     dmx_pes_type_t,
97                                     senf::console::FlagCollection<Flags>)
98             >(&DVBPESProtocolWrapper::setPESFilter, this)
99             .arg("pid", "pid to filter")
100             .arg("input", "input-filter: DMX_IN_FRONTEND DMX_IN_DVR ")
101             .arg("output", "output-filter: DMX_OUT_DECODER DMX_OUT_TAP DMX_OUT_TS_TAP ")
102             .arg("pesType", "PES type: DMX_PES_AUDIO[0-3] DMX_PES_VIDEO[0-3] "
103                             "DMX_PES_TELETEXT[0-3], DMX_PES_SUBTITLE[0-3], DMX_PES_PCR[0-3], "
104                             "DMX_PES_OTHER")
105             .arg("flags", "or-able: CHECK_CRC, ONESHOT, IMMEDIATE_START, KERNEL_CLIENT",
106                  kw::default_value = DMX_IMMEDIATE_START | DMX_CHECK_CRC,
107                  kw::default_doc = "(IMMEDIATE_START CHECK_CRC)")
108             .doc("Sets parameters for PES filter.") );
109
110     dir.add("start", fty::Command(&DVBPESProtocolWrapper::startFiltering, this)
111             .doc("Starts filtering") );
112
113     dir.add("stop", fty::Command(&DVBPESProtocolWrapper::stopFiltering, this)
114             .doc("Stops filtering") );
115 }
116
117 //-/////////////////////////////////////////////////////////////////////////////////////////////////
118 #undef prefix_
119
120 \f
121 // Local Variables:
122 // mode: c++
123 // fill-column: 100
124 // c-file-style: "senf"
125 // indent-tabs-mode: nil
126 // ispell-local-dictionary: "american"
127 // compile-command: "scons -u test"
128 // comment-column: 40
129 // End: