summaryrefslogtreecommitdiff
path: root/audioreceiver.h
blob: 9639b5f36922b38685dd75e4cbc661b7ae7e1a91 (plain)
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
/*
 * audioreceiver.h
 */

#ifndef __AUDIORECEIVER_H
#define __AUDIORECEIVER_H

#include "postdata.h"
#include "rds.h"
#include "mpa-frame.h"
#include "recstat.h"
#include "a-tools.h"

#include <vdr/receiver.h>
#include <vdr/ringbuffer.h>
#include <vdr/channels.h>

#include <string>
#include <fstream>


class cAudioReceiver : public cReceiver, cThread {
private:
        bool active;
        int device_number;

        std::ofstream outfile;

        cRingBufferLinear *buffer;
        const cChannel *channel;

        cPostData *postdata;
        cRds *rds;

        eRecStat recstat;
        mpeg_audio_frame mpa_frame;
        bool pes_sync;

        void set_recstat_rds(void);
        void control_track(void);
protected:
        virtual void Receive(uchar *data, int length);

        virtual void Action(void);
        virtual void Activate(bool on);
public:
        cAudioReceiver(const cChannel* _channel);
        ~cAudioReceiver();

        void set_device_number(int _device_number) { device_number =
                _device_number; }
        int get_device_number(void) { return device_number; }
        bool is_attached(int attached_device_number);
        /*
        * returns true if the receiver is attached to the given device.
        * if attached_device_number == -1, true is returned if the
        * receiver is attached to a device
        */
        bool is_recording(void);
        const cChannel *get_channel(void) { return channel; }
};

#endif /* __AUDIORECEIVER_H */