~ubuntu-branches/ubuntu/lucid/mythtv/lucid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// -*- Mode: c++ -*-
/**
 *  IPTVRecorder
 *  Copyright (c) 2006 by Laurent Arnal, Benjamin Lerman & Mickaƫl Remars
 *  Distributed as part of MythTV under GPL v2 and later.
 */

#ifndef _IPTV_RECORDER_H_
#define _IPTV_RECORDER_H_

#include <QWaitCondition>

#include "dtvrecorder.h"
#include "streamlisteners.h"

class QString;
class IPTVChannel;

/** \brief Processes data from a IPTVFeeder and writes it to disk.
 */
class IPTVRecorder : public DTVRecorder, public TSDataListener,
                     public MPEGSingleProgramStreamListener
{
    friend class IPTVMediaSink;

  public:
    IPTVRecorder(TVRec *rec, IPTVChannel *channel);
    ~IPTVRecorder();

    bool Open(void);
    void Close(void);

    virtual void Pause(bool clear = true);
    virtual void Unpause(void);

    virtual void StartRecording(void);
    virtual void StopRecording(void);

    virtual void SetOptionsFromProfile(RecordingProfile*, const QString&,
                                       const QString&, const QString&) {}

    virtual void SetStreamData(MPEGStreamData*);
    virtual MPEGStreamData *GetStreamData(void) { return _stream_data; }

  private:
    void ProcessTSPacket(const TSPacket& tspacket);

    // implements TSDataListener
    void AddData(const unsigned char *data, unsigned int dataSize);

    // implements MPEGSingleProgramStreamListener
    void HandleSingleProgramPAT(ProgramAssociationTable *pat);
    void HandleSingleProgramPMT(ProgramMapTable *pmt);

  private:
    IPTVChannel *_channel;
    MPEGStreamData *_stream_data;
    QWaitCondition  _cond_recording;

  private:
    IPTVRecorder &operator=(const IPTVRecorder&); //< avoid default impl
    IPTVRecorder(const IPTVRecorder&);            //< avoid default impl
    IPTVRecorder();                                  //< avoid default impl
};

#endif // _IPTV_RECORDER_H_

/* vim: set expandtab tabstop=4 shiftwidth=4: */