3rdparty/licenseReport: Add seperate LGPL checks
[haiku.git] / src / add-ons / media / media-add-ons / opensound / OpenSoundDeviceEngine.h
blobae4c05f75913d5f368ba0003d828203b3dc829f6
1 /*
2 * OpenSound media addon for BeOS and Haiku
4 * Copyright (c) 2007, François Revol (revol@free.fr)
5 * Distributed under the terms of the MIT License.
6 */
8 #ifndef _OPENSOUNDDEVICEENGINE_H
9 #define _OPENSOUNDDEVICEENGINE_H
11 #include "OpenSoundDevice.h"
13 class OpenSoundDeviceEngine
15 public:
16 OpenSoundDeviceEngine(oss_audioinfo *info);
17 virtual ~OpenSoundDeviceEngine(void);
19 virtual status_t InitCheck(void) const;
20 int FD() const { return fFD; };
21 const oss_audioinfo *Info() const { return &fAudioInfo; };
23 status_t Open(int mode/* OPEN_* */);
24 status_t Close();
26 //BDadaIO...
27 virtual ssize_t Read(void *buffer, size_t size);
28 virtual ssize_t Write(const void *buffer, size_t size);
31 /* chain of engines for the same physical in/out */
32 OpenSoundDeviceEngine *NextPlay() const { return fNextPlay; };
33 OpenSoundDeviceEngine *NextRec() const { return fNextRec; };
35 int OpenMode() const { return fOpenMode; };
36 bool InUse() const { return (fOpenMode != 0); };
38 status_t UpdateInfo();
39 // shortcuts
40 int Caps() const { return fAudioInfo.caps; };
41 bigtime_t CardLatency(void) const { return (fAudioInfo.latency < 0) ? 0 : fAudioInfo.latency; };
42 bigtime_t PlaybackLatency(void);
43 bigtime_t RecordingLatency(void);
46 int GetChannels(void);
47 status_t SetChannels(int chans);
49 int GetFormat(void);
50 status_t SetFormat(int fmt);
52 int GetSpeed(void);
53 status_t SetSpeed(int speed);
55 void GetMediaFormat(media_format &format);
57 size_t GetISpace(audio_buf_info *info=NULL);
58 size_t GetOSpace(audio_buf_info *info=NULL);
60 int64 GetCurrentIPtr(int32* fifoed = NULL,
61 oss_count_t* info = NULL);
62 int64 GetCurrentOPtr(int32* fifoed = NULL,
63 size_t* fragmentPos = NULL);
65 int32 GetIOverruns();
66 int32 GetOUnderruns();
68 size_t DriverBufferSize() const;
70 status_t StartRecording(void);
72 // suggest possibles
73 status_t WildcardFormatFor(int fmt, media_format &format, bool rec=false);
74 // suggest best
75 status_t PreferredFormatFor(int fmt, media_format &format, bool rec=false);
76 // try this format
77 status_t AcceptFormatFor(int fmt, media_format &format, bool rec=false);
78 // apply this format
79 status_t SpecializeFormatFor(int fmt, media_format &format, bool rec=true);
81 private:
82 status_t fInitCheckStatus;
83 oss_audioinfo fAudioInfo;
84 friend class OpenSoundAddOn;
85 OpenSoundDeviceEngine *fNextPlay;
86 OpenSoundDeviceEngine *fNextRec;
87 int fOpenMode; // OPEN_*
88 int fFD;
89 media_format fMediaFormat;
90 int64 fPlayedFramesCount;
91 bigtime_t fPlayedRealTime;
92 size_t fDriverBufferSize;
95 #endif