2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include <vdr/channels.h>
25 #include <vdr/device.h>
26 #include <vdr/receiver.h>
30 #include "ringbuffer.h"
34 class MVPReceiver : public cReceiver, public Thread
37 static MVPReceiver* create(cChannel*, int priority);
38 virtual ~MVPReceiver();
39 int init(TCP* tcp, ULONG streamID);
40 ULONG getBlock(unsigned char* buffer, unsigned long amount);
41 bool isVdrActivated();
44 MVPReceiver(cChannel* channel, cDevice* device);
49 Ringbuffer processed; // A simpler deleting ringbuffer for processed data
50 pthread_mutex_t processedRingLock; // needs outside locking
54 ULONG streamDataCollected;
58 void Activate(bool On);
59 void Receive(UCHAR *Data, int Length);
62 static int numMVPReceivers;
72 cReceiver docs from the header file
74 void Activate(bool On);
75 // This function is called just before the cReceiver gets attached to
76 // (On == true) or detached from (On == false) a cDevice. It can be used
77 // to do things like starting/stopping a thread.
78 // It is guaranteed that Receive() will not be called before Activate(true).
79 void Receive(uchar *Data, int Length);
80 // This function is called from the cDevice we are attached to, and
81 // delivers one TS packet from the set of PIDs the cReceiver has requested.
82 // The data packet must be accepted immediately, and the call must return
83 // as soon as possible, without any unnecessary delay. Each TS packet
84 // will be delivered only ONCE, so the cReceiver must make sure that
85 // it will be able to buffer the data if necessary.
94 static cDevice *GetDevice(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL);
95 ///< Returns a device that is able to receive the given Channel at the
97 ///< See ProvidesChannel() for more information on how
98 ///< priorities are handled, and the meaning of NeedsDetachReceivers.
101 static cDevice *GetDevice(const cChannel *Channel, int Priority, bool LiveView);
102 ///< Returns a device that is able to receive the given Channel at the
103 ///< given Priority, with the least impact on active recordings and
104 ///< live viewing. The LiveView parameter tells whether the device will
105 ///< be used for live viewing or a recording.
106 ///< If the Channel is encrypted, a CAM slot that claims to be able to
107 ///< decrypt the channel is automatically selected and assigned to the
108 ///< returned device. Whether or not this combination of device and CAM
109 ///< slot is actually able to decrypt the channel can only be determined
110 ///< by checking the "scrambling control" bits of the received TS packets.
111 ///< The Action() function automatically does this and takes care that
112 ///< after detaching any receivers because the channel can't be decrypted,
113 ///< this device/CAM combination will be skipped in the next call to
115 ///< See also ProvidesChannel().