]> git.vomp.tv Git - vompclient.git/blob - audiomvp.h
Update for windows
[vompclient.git] / audiomvp.h
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
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.
10
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.
15
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 // Thanks to Jon Gettler and BtB for all the ioctl information
22
23 #ifndef AUDIOMVP_H
24 #define AUDIOMVP_H
25
26 #include <stdio.h>
27 #include <unistd.h>
28 #include <fcntl.h>
29 #include <sys/ioctl.h>
30
31 #include "defines.h"
32 #include "log.h"
33 #include "audio.h"
34
35
36 typedef struct
37 {
38   int parm1;
39   int parm2;
40 } aud_sync_parms_t;
41
42 typedef struct
43 {
44   int aud_ctl0;
45   int aud_ctl1;
46   int aud_ctl2;
47 } aud_ctl_regs_t;
48
49 #define AV_SET_AUD_PLAY         _IOW('a', 2, int)
50 #define AV_SET_AUD_PAUSE        _IOW('a', 3, int)
51 #define AV_SET_AUD_UNPAUSE      _IOW('a', 4, int)
52 #define AV_SET_AUD_SRC          _IOW('a', 5, int)
53 #define AV_SET_AUD_MUTE         _IOW('a', 6, int)
54 #define AV_SET_AUD_CHANNEL      _IOW('a', 9, int)
55 #define AV_GET_AUD_INFO         _IOR('a', 10, int)
56 #define AV_SET_AUD_VOLUME       _IOW('a', 13, int)
57 #define AV_GET_AUD_VOLUME       _IOR('a', 14, int)
58 #define AV_SET_AUD_STREAMTYPE   _IOW('a', 15, int)
59 #define AV_SET_AUD_FORMAT       _IOW('a', 16, int)
60 #define AV_GET_AUD_TIMESTAMPS   _IOR('a', 21, sync_data_t*)
61 #define AV_SET_AUD_STC          _IOW('a', 22, uint64_t *)
62 #define AV_SET_AUD_SYNC         _IOW('a', 23, int)
63 #define AV_SET_AUD_DISABLE_SYNC _IOW('a', 24, aud_sync_parms_t*)
64 #define AV_SET_AUD_RESET        _IOW('a', 26, int)
65 #define AV_SET_AUD_DAC_CLK      _IOW('a', 27, int)
66 #define AV_GET_AUD_REGS         _IOW('a', 28, aud_ctl_regs_t*)
67
68
69 class AudioMVP : public Audio
70 {
71   public:
72     AudioMVP();
73     ~AudioMVP();
74
75     int init(UCHAR streamType);
76     int shutdown();
77
78     int setStreamType(UCHAR streamType);
79     int setChannel();
80     int setSource();
81     int sync();
82     int play();
83     int stop();
84     int pause();
85     int unPause();
86     int reset();
87     int setVolume(int volume);
88     int mute();
89     int unMute();
90
91     //Writing Data to Audiodevice
92     virtual void PrepareMediaSample(const MediaPacketList&, UINT samplepos);
93     virtual UINT DeliverMediaSample(const UCHAR* buffer, UINT *samplepos);
94     virtual long long SetStartOffset(long long curreftime, bool *rsync) { return 0; };
95     virtual void ResetTimeOffsets();
96
97 #ifdef DEV
98     int test();
99 #endif
100
101   private:
102     int initAllParams();
103     UCHAR streamType;
104     int fdAudio;
105
106     MediaPacket packet;
107     UINT packetpos;
108 };
109
110 #endif