2002-06-16 12:57:31 +02:00
|
|
|
/*
|
|
|
|
* audio.h: The basic audio interface
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2005-02-12 13:01:24 +01:00
|
|
|
* $Id: audio.h 1.3 2005/02/12 12:20:19 kls Exp $
|
2002-06-16 12:57:31 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __AUDIO_H
|
|
|
|
#define __AUDIO_H
|
|
|
|
|
2002-11-03 11:53:58 +01:00
|
|
|
#include "thread.h"
|
|
|
|
#include "tools.h"
|
|
|
|
|
|
|
|
class cAudio : public cListObject {
|
|
|
|
protected:
|
|
|
|
cAudio(void);
|
|
|
|
public:
|
|
|
|
virtual ~cAudio();
|
2005-02-12 13:01:24 +01:00
|
|
|
virtual void Play(const uchar *Data, int Length, uchar Id) = 0;
|
|
|
|
///< Plays the given block of audio Data. Must return as soon as possible.
|
|
|
|
///< If the entire block of data can't be processed immediately, it must
|
|
|
|
///< be copied and processed in a separate thread. The Data is always a
|
|
|
|
///< complete PES audio packet. Id indicates the type of audio data this
|
|
|
|
///< packet holds.
|
2002-11-03 11:53:58 +01:00
|
|
|
virtual void Mute(bool On) = 0;
|
2005-02-12 13:01:24 +01:00
|
|
|
///< Immediately sets the audio device to be silent (On==true) or to
|
|
|
|
///< normal replay (On==false).
|
2002-11-03 11:53:58 +01:00
|
|
|
virtual void Clear(void) = 0;
|
2005-02-12 13:01:24 +01:00
|
|
|
///< Clears all data that might still be awaiting processing.
|
2002-11-03 11:53:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class cAudios : public cList<cAudio> {
|
|
|
|
public:
|
2005-02-12 13:01:24 +01:00
|
|
|
void PlayAudio(const uchar *Data, int Length, uchar Id);
|
2002-11-03 11:53:58 +01:00
|
|
|
void MuteAudio(bool On);
|
|
|
|
void ClearAudio(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern cAudios Audios;
|
|
|
|
|
|
|
|
class cExternalAudio : public cAudio {
|
|
|
|
private:
|
|
|
|
char *command;
|
|
|
|
cPipe pipe;
|
|
|
|
bool mute;
|
|
|
|
public:
|
|
|
|
cExternalAudio(const char *Command);
|
|
|
|
virtual ~cExternalAudio();
|
2005-02-12 13:01:24 +01:00
|
|
|
virtual void Play(const uchar *Data, int Length, uchar Id);
|
2002-11-03 11:53:58 +01:00
|
|
|
virtual void Mute(bool On);
|
|
|
|
virtual void Clear(void);
|
|
|
|
};
|
|
|
|
|
2002-06-16 12:57:31 +02:00
|
|
|
#endif //__AUDIO_H
|