]> git.vomp.tv Git - vompclient.git/blob - audiowin.h
Rename TCP class to TCPOld
[vompclient.git] / audiowin.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, see <https://www.gnu.org/licenses/>.
18 */
19
20 #ifndef AUDIOWIN_H
21 #define AUDIOWIN_H
22
23 #include "defines.h"
24 #include "log.h"
25 #include "audio.h"
26 #include <winsock2.h>
27 #include <dshow.h>
28 #include "dssourcefilter.h"
29
30 #include <vector>
31
32 struct AudioFilterDesc {
33     char * displayname;
34     char * friendlyname;
35 };
36 typedef std::vector<AudioFilterDesc> AudioFilterDescList;
37
38 class AudioWin : public Audio
39 {
40   public:
41     AudioWin();
42     ~AudioWin();
43
44     int init(UCHAR streamType);
45     int shutdown();
46
47     int setStreamType(UCHAR streamType);
48     int setChannel();
49     int setSource();
50     int sync();
51     int play();
52     int stop();
53     int pause();
54     int unPause();
55     int reset();
56     int setVolume(int volume);
57     int mute();
58     int unMute();
59     int write(char *buf, int len);
60
61     bool loadOptionsFromServer(VDR* vdr);
62     bool saveOptionstoServer();
63     bool addOptionPagesToWTB(WTabBar *wtb);
64
65     // Writing Data to Audiodevice
66     virtual void PrepareMediaSample(const MediaPacketList&, UINT samplepos);
67     virtual UINT DeliverMediaSample(UCHAR* buffer, UINT *samplepos);
68     UINT DeliverMediaPacket(MediaPacket packet, UCHAR* buffer, UINT *samplepos);
69     
70     int dsInitAudioFilter(IGraphBuilder* dsgraphbuilder);
71     const AudioFilterDescList *getAudioFilterList(int &selected);
72      bool selectAudioFilter(int filter);
73
74      const AudioFilterDescList *getMp3AudioFilterList(int &selected);
75      bool selectMp3AudioFilter(int filter);
76
77     virtual bool supportsAc3();
78     virtual bool maysupportAc3(){return true;} // We are not sure maybe we support this, allows the player to select ac3, if there is no other option
79
80     virtual bool streamTypeSupported(int streamtype)
81     {
82         switch (streamtype) {
83         case 0x6A:
84         case 3:
85         case 4:
86                 return true;
87         default:
88                 return false;
89         };
90     }
91
92
93   private:
94     MediaPacket mediapacket;
95   public:
96     virtual long long SetStartOffset(long long curreftime, bool *rsync);
97   virtual void ResetTimeOffsets();
98
99 private:
100   IBaseFilter *getAudioFilter();
101   IBaseFilter *getMp3AudioFilter();
102   void initFilterDatabase();
103   void initMp3FilterDatabase();
104   AudioFilterDescList audiofilterlist;
105   AudioFilterDescList mp3audiofilterlist;
106   int  audiofilterselected;
107   int  mp3audiofilterselected;
108   bool firstsynched;
109   long winvolume;
110   UCHAR aud_type;
111 #ifdef DEV
112     int test();
113 #endif
114 };
115
116 #endif
117