Moved wxMMedia to contrib/src/mmedia
Added contrib configure Made wxSocket sample compile Made OGL compile Modified main configure to pass some more parameter to children Changed the wxProcess doc according to the modification Still some win makefiles to come git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
74
contrib/include/wx/mmedia/cdbase.h
Normal file
74
contrib/include/wx/mmedia/cdbase.h
Normal file
@@ -0,0 +1,74 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: cdbase.h
|
||||
// Purpose: wxMMedia
|
||||
// Author: Guilhem Lavaux
|
||||
// Created: 1997
|
||||
// Updated: 1998, 1999, 2000
|
||||
// Copyright: (C) 1997, 1998, 1999, 2000 Guilhem Lavaux
|
||||
// License: wxWindows license
|
||||
// ---------------------------------------------------------------------------
|
||||
#ifndef __CDA_base_H__
|
||||
#define __CDA_base_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "cdbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
|
||||
typedef struct wxCDtime {
|
||||
wxUint8 track;
|
||||
wxUint8 hour, min, sec;
|
||||
} wxCDtime;
|
||||
|
||||
class WXDLLEXPORT wxCDAudio : public wxObject {
|
||||
DECLARE_ABSTRACT_CLASS(wxCDAudio)
|
||||
public:
|
||||
typedef enum { PLAYING, PAUSED, STOPPED } CDstatus;
|
||||
// Table of contents manager
|
||||
class CDtoc {
|
||||
protected:
|
||||
wxCDtime *tracks_time, *tracks_pos;
|
||||
wxCDtime total_time;
|
||||
public:
|
||||
//
|
||||
CDtoc(wxCDtime& tot_tm, wxCDtime *trks_tm, wxCDtime *trks_pos)
|
||||
{ tracks_time = trks_tm; total_time = tot_tm; tracks_pos = trks_pos; }
|
||||
|
||||
// Returns the length of the specified track
|
||||
// track: track to get length
|
||||
wxCDtime GetTrackTime(wxUint8 track) const;
|
||||
// Returns the position of the specified track
|
||||
// track: track to get position
|
||||
wxCDtime GetTrackPos(wxUint8 track) const;
|
||||
// Returns the total time
|
||||
inline wxCDtime GetTotalTime() const { return total_time; }
|
||||
};
|
||||
public:
|
||||
//
|
||||
wxCDAudio() : wxObject() {}
|
||||
//
|
||||
virtual ~wxCDAudio() {}
|
||||
|
||||
// Play audio at the specified position
|
||||
virtual bool Play(const wxCDtime& beg_play, const wxCDtime& end_play) = 0;
|
||||
// Play audio from the specified to the end of the CD audio
|
||||
bool Play(const wxCDtime& beg_play);
|
||||
//
|
||||
bool Play(wxUint8 beg_track, wxUint8 end_track = 0);
|
||||
// Pause the audio playing
|
||||
virtual bool Pause() = 0;
|
||||
// Resume a paused audio playing
|
||||
virtual bool Resume() = 0;
|
||||
// Get the current CD status
|
||||
virtual CDstatus GetStatus() = 0;
|
||||
// Get the current playing time
|
||||
virtual wxCDtime GetTime() = 0;
|
||||
// Returns the table of contents
|
||||
virtual const CDtoc& GetToc() = 0;
|
||||
// CD ok
|
||||
virtual bool Ok() const = 0;
|
||||
};
|
||||
|
||||
#endif
|
58
contrib/include/wx/mmedia/cdunix.h
Normal file
58
contrib/include/wx/mmedia/cdunix.h
Normal file
@@ -0,0 +1,58 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// Name: cdunix.h
|
||||
// Purpose: wxMMedia
|
||||
// Author: Guilhem Lavaux
|
||||
// Created: 1997
|
||||
// Updated: 2000
|
||||
// Copyright: (C) 1997, 1998, 1999, 2000 Guilhem Lavaux
|
||||
// License: wxWindows license
|
||||
// ---------------------------------------------------------------------------
|
||||
#ifndef __CDUNIXH__
|
||||
#define __CDUNIXH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "cdunix.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/mmedia/cdbase.h"
|
||||
|
||||
///
|
||||
class WXDLLEXPORT wxCDAudioLinux : public wxCDAudio {
|
||||
DECLARE_DYNAMIC_CLASS(wxCDAudioLinux)
|
||||
protected:
|
||||
wxCDtime m_time;
|
||||
CDstatus m_status;
|
||||
CDtoc *m_toc;
|
||||
int m_fd;
|
||||
wxCDtime *m_trksize, *m_trkpos;
|
||||
public:
|
||||
///
|
||||
wxCDAudioLinux();
|
||||
///
|
||||
wxCDAudioLinux(const wxString& dev_name);
|
||||
///
|
||||
virtual ~wxCDAudioLinux();
|
||||
|
||||
///
|
||||
virtual bool Play(const wxCDtime& beg_time, const wxCDtime& end_time);
|
||||
///
|
||||
virtual bool Pause();
|
||||
///
|
||||
virtual bool Resume();
|
||||
///
|
||||
virtual CDstatus GetStatus();
|
||||
///
|
||||
virtual wxCDtime GetTime();
|
||||
///
|
||||
virtual CDtoc& GetToc();
|
||||
///
|
||||
virtual inline bool Ok() const { return (m_fd != -1); }
|
||||
protected:
|
||||
///
|
||||
void OpenDevice(const wxString& dev_name);
|
||||
};
|
||||
|
||||
#endif
|
62
contrib/include/wx/mmedia/cdwin.h
Normal file
62
contrib/include/wx/mmedia/cdwin.h
Normal file
@@ -0,0 +1,62 @@
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
// Name: cdwin.h
|
||||
// Purpose: wxMMedia
|
||||
// Author: Guilhem Lavaux
|
||||
// Created: 1997
|
||||
// Updated: 1998
|
||||
// Copyright: (C) 1997, 1998, Guilhem Lavaux
|
||||
// License: wxWindows license
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef __CDA_win_H__
|
||||
#define __CDA_win_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#include "cdbase.h"
|
||||
|
||||
#ifdef WXMMEDIA_INTERNAL
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
typedef struct CDAW_Internal {
|
||||
MCIDEVICEID dev_id;
|
||||
} CDAW_Internal;
|
||||
#endif
|
||||
|
||||
///
|
||||
class WXDLLEXPORT wxCDAudioWin : public wxCDAudio {
|
||||
DECLARE_DYNAMIC_CLASS(wxCDAudioWin)
|
||||
protected:
|
||||
struct CDAW_Internal *m_internal;
|
||||
wxCDtime *m_trksize, *m_trkpos;
|
||||
CDtoc *m_toc;
|
||||
bool m_ok;
|
||||
public:
|
||||
///
|
||||
wxCDAudioWin(void);
|
||||
///
|
||||
wxCDAudioWin(const char *dev_name);
|
||||
///
|
||||
virtual ~wxCDAudioWin(void);
|
||||
|
||||
///
|
||||
virtual bool Play(const wxCDtime& beg_time, const wxCDtime& end_time);
|
||||
///
|
||||
virtual bool Pause(void);
|
||||
///
|
||||
virtual bool Resume(void);
|
||||
///
|
||||
virtual CDstatus GetStatus(void);
|
||||
///
|
||||
virtual wxCDtime GetTime(void);
|
||||
///
|
||||
virtual const CDtoc& GetToc(void);
|
||||
///
|
||||
virtual inline bool Ok(void) const { return m_ok; }
|
||||
protected:
|
||||
void PrepareToc();
|
||||
};
|
||||
|
||||
#endif
|
123
contrib/include/wx/mmedia/internal/g72x.h
Normal file
123
contrib/include/wx/mmedia/internal/g72x.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* This source code is a product of Sun Microsystems, Inc. and is provided
|
||||
* for unrestricted use. Users may copy or modify this source code without
|
||||
* charge.
|
||||
*
|
||||
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
|
||||
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun source code is provided with no support and without any obligation on
|
||||
* the part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
|
||||
/*
|
||||
* g72x.h
|
||||
*
|
||||
* Header file for CCITT conversion routines.
|
||||
*
|
||||
*/
|
||||
#ifndef _G72X_H
|
||||
#define _G72X_H
|
||||
|
||||
#define AUDIO_ENCODING_ULAW (1) /* ISDN u-law */
|
||||
#define AUDIO_ENCODING_ALAW (2) /* ISDN A-law */
|
||||
#define AUDIO_ENCODING_LINEAR (3) /* PCM 2's-complement (0-center) */
|
||||
|
||||
/*
|
||||
* The following is the definition of the state structure
|
||||
* used by the G.721/G.723 encoder and decoder to preserve their internal
|
||||
* state between successive calls. The meanings of the majority
|
||||
* of the state structure fields are explained in detail in the
|
||||
* CCITT Recommendation G.721. The field names are essentially indentical
|
||||
* to variable names in the bit level description of the coding algorithm
|
||||
* included in this Recommendation.
|
||||
*/
|
||||
struct g72x_state {
|
||||
long yl; /* Locked or steady state step size multiplier. */
|
||||
short yu; /* Unlocked or non-steady state step size multiplier. */
|
||||
short dms; /* Short term energy estimate. */
|
||||
short dml; /* Long term energy estimate. */
|
||||
short ap; /* Linear weighting coefficient of 'yl' and 'yu'. */
|
||||
|
||||
short a[2]; /* Coefficients of pole portion of prediction filter. */
|
||||
short b[6]; /* Coefficients of zero portion of prediction filter. */
|
||||
short pk[2]; /*
|
||||
* Signs of previous two samples of a partially
|
||||
* reconstructed signal.
|
||||
*/
|
||||
short dq[6]; /*
|
||||
* Previous 6 samples of the quantized difference
|
||||
* signal represented in an internal floating point
|
||||
* format.
|
||||
*/
|
||||
short sr[2]; /*
|
||||
* Previous 2 samples of the quantized difference
|
||||
* signal represented in an internal floating point
|
||||
* format.
|
||||
*/
|
||||
char td; /* delayed tone detect, new in 1988 version */
|
||||
};
|
||||
|
||||
/* External function definitions. */
|
||||
|
||||
extern unsigned char linear2alaw (int pcm_val); /* 2's complement (16-bit range) */
|
||||
extern int alaw2linear (unsigned char a_val);
|
||||
extern unsigned char linear2ulaw (int pcm_val); /* 2's complement (16-bit range) */
|
||||
extern int ulaw2linear (unsigned char u_val);
|
||||
extern int predictor_zero (struct g72x_state *state_ptr);
|
||||
extern int predictor_pole (struct g72x_state *state_ptr);
|
||||
extern int step_size (struct g72x_state *state_ptr);
|
||||
extern int quantize (int d, int y, short *table, int size);
|
||||
extern int reconstruct (int sign, int dqln, int y);
|
||||
|
||||
extern void update
|
||||
( int code_size, int y, int wi, int fi, int dq
|
||||
, int sr, int dqsez, struct g72x_state *state_ptr);
|
||||
|
||||
int tandem_adjust_alaw
|
||||
(int sr, int se, int y, int i, int sign, short *qtab);
|
||||
|
||||
int tandem_adjust_ulaw
|
||||
(int sr, int se, int y, int i, int sign, short *qtab);
|
||||
|
||||
extern void g72x_init_state (struct g72x_state *);
|
||||
extern int g721_encoder(
|
||||
int sample,
|
||||
int in_coding,
|
||||
struct g72x_state *state_ptr);
|
||||
extern int g721_decoder(
|
||||
int code,
|
||||
int out_coding,
|
||||
struct g72x_state *state_ptr);
|
||||
extern int g723_24_encoder(
|
||||
int sample,
|
||||
int in_coding,
|
||||
struct g72x_state *state_ptr);
|
||||
extern int g723_24_decoder(
|
||||
int code,
|
||||
int out_coding,
|
||||
struct g72x_state *state_ptr);
|
||||
extern int g723_40_encoder(
|
||||
int sample,
|
||||
int in_coding,
|
||||
struct g72x_state *state_ptr);
|
||||
extern int g723_40_decoder(
|
||||
int code,
|
||||
int out_coding,
|
||||
struct g72x_state *state_ptr);
|
||||
|
||||
#endif /* !_G72X_H */
|
46
contrib/include/wx/mmedia/sndaiff.h
Normal file
46
contrib/include/wx/mmedia/sndaiff.h
Normal file
@@ -0,0 +1,46 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndaiff.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDAIFF_H
|
||||
#define _WX_SNDAIFF_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndaiff.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/stream.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
#include "wx/mmedia/sndcodec.h"
|
||||
#include "wx/mmedia/sndfile.h"
|
||||
|
||||
//
|
||||
// AIFF codec
|
||||
//
|
||||
|
||||
class wxSoundAiff: public wxSoundFileStream {
|
||||
public:
|
||||
wxSoundAiff(wxInputStream& stream, wxSoundStream& io_sound);
|
||||
wxSoundAiff(wxOutputStream& stream, wxSoundStream& io_sound);
|
||||
~wxSoundAiff();
|
||||
|
||||
bool CanRead();
|
||||
wxString GetCodecName() const;
|
||||
|
||||
protected:
|
||||
bool PrepareToPlay();
|
||||
bool PrepareToRecord(wxUint32 time);
|
||||
bool FinishRecording();
|
||||
bool RepositionStream(wxUint32 position);
|
||||
|
||||
wxUint32 GetData(void *buffer, wxUint32 len);
|
||||
wxUint32 PutData(const void *buffer, wxUint32 len);
|
||||
protected:
|
||||
off_t m_base_offset;
|
||||
};
|
||||
|
||||
#endif
|
171
contrib/include/wx/mmedia/sndbase.h
Normal file
171
contrib/include/wx/mmedia/sndbase.h
Normal file
@@ -0,0 +1,171 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndbase.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDBASE_H
|
||||
#define _WX_SNDBASE_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// DEFINITIONS
|
||||
|
||||
// ---------------------
|
||||
// Sound streaming mode:
|
||||
// - wxSOUND_INPUT: simple recording mode
|
||||
// - wxSOUND_OUTPUT: simple playing mode
|
||||
// - wxSOUND_DUPLEX: full duplex record/play at the same time
|
||||
// ---------------------
|
||||
enum {
|
||||
wxSOUND_INPUT = 1,
|
||||
wxSOUND_OUTPUT = 2,
|
||||
wxSOUND_DUPLEX = wxSOUND_INPUT | wxSOUND_OUTPUT,
|
||||
};
|
||||
|
||||
// ---------------------
|
||||
// wxSoundFormatType: it specifies the format family of the sound data
|
||||
// which will be passed to the stream.
|
||||
// ---------------------
|
||||
typedef enum {
|
||||
wxSOUND_NOFORMAT,
|
||||
wxSOUND_PCM,
|
||||
wxSOUND_ULAW,
|
||||
wxSOUND_G72X,
|
||||
wxSOUND_MSADPCM
|
||||
} wxSoundFormatType;
|
||||
|
||||
// ---------------------
|
||||
// wxSoundError:
|
||||
// - wxSOUND_NOERR: No error occured
|
||||
// - wxSOUND_IOERR: an input/output error occured, it may concern either
|
||||
// a driver or a file
|
||||
// - wxSOUND_INVFRMT: the sound format passed to the function is invalid.
|
||||
// Generally, it means that you passed out of range values
|
||||
// to the codec stream or you don't pass the right sound
|
||||
// format object to the right sound codec stream.
|
||||
// - wxSOUND_INVDEV: Invalid device. Generally, it means that the sound stream
|
||||
// didn't manage to open the device driver due to an invalid// parameter or to the fact that sound is not supported on
|
||||
// this computer.
|
||||
// - wxSOUND_NOEXACT: No exact matching sound codec has been found for
|
||||
// this sound format. It means that the sound driver didn't
|
||||
// manage to setup the sound card with the specified
|
||||
// values.
|
||||
// - wxSOUND_NOCODEC: No matching codec has been found. Generally, it
|
||||
// may happen when you call
|
||||
// wxSoundRouterStream::SetSoundFormat().
|
||||
// - wxSOUND_MEMERR: Not enough memory.
|
||||
// - wxSOUND_NOTSTARTED: You did not start the production using
|
||||
// StartProduction()
|
||||
// ---------------------
|
||||
typedef enum {
|
||||
wxSOUND_NOERROR,
|
||||
wxSOUND_IOERROR,
|
||||
wxSOUND_INVFRMT,
|
||||
wxSOUND_INVDEV,
|
||||
wxSOUND_NOEXACT,
|
||||
wxSOUND_INVSTRM,
|
||||
wxSOUND_NOCODEC,
|
||||
wxSOUND_MEMERROR,
|
||||
wxSOUND_NOTSTARTED
|
||||
} wxSoundError;
|
||||
|
||||
class WXDLLEXPORT wxSoundStream;
|
||||
|
||||
// ---------------------
|
||||
// wxSoundCallback(stream, evt, cdata): C callback for sound event.
|
||||
// - stream: current wxSoundStream
|
||||
// - evt: the sound event which has occured, it may be wxSOUND_INPUT,
|
||||
// wxSOUND_OUTPUT or wxSOUND_DUPLEX
|
||||
// - cdata: User callback data
|
||||
// ---------------------
|
||||
typedef void (*wxSoundCallback)(wxSoundStream *stream, int evt,
|
||||
void *cdata);
|
||||
|
||||
//
|
||||
// Base class for sound format specification
|
||||
//
|
||||
|
||||
class WXDLLEXPORT wxSoundFormatBase {
|
||||
public:
|
||||
wxSoundFormatBase();
|
||||
virtual ~wxSoundFormatBase();
|
||||
|
||||
// It returns a "standard" format type.
|
||||
virtual wxSoundFormatType GetType() const { return wxSOUND_NOFORMAT; }
|
||||
// It clones the current format.
|
||||
virtual wxSoundFormatBase *Clone() const;
|
||||
|
||||
virtual wxUint32 GetTimeFromBytes(wxUint32 bytes) const = 0;
|
||||
virtual wxUint32 GetBytesFromTime(wxUint32 time) const = 0;
|
||||
|
||||
virtual bool operator !=(const wxSoundFormatBase& frmt2) const;
|
||||
};
|
||||
|
||||
//
|
||||
// Base class for sound streams
|
||||
//
|
||||
|
||||
class wxSoundStream {
|
||||
public:
|
||||
wxSoundStream();
|
||||
virtual ~wxSoundStream();
|
||||
|
||||
// Reads "len" bytes from the sound stream.
|
||||
virtual wxSoundStream& Read(void *buffer, wxUint32 len) = 0;
|
||||
// Writes "len" byte to the sound stream.
|
||||
virtual wxSoundStream& Write(const void *buffer, wxUint32 len) = 0;
|
||||
// Returns the best size for IO calls
|
||||
virtual wxUint32 GetBestSize() const { return 1024; }
|
||||
|
||||
// SetSoundFormat returns TRUE when the format can be handled.
|
||||
virtual bool SetSoundFormat(const wxSoundFormatBase& format);
|
||||
|
||||
// GetSoundFormat returns the current sound format.
|
||||
wxSoundFormatBase& GetSoundFormat() const { return *m_sndformat; }
|
||||
|
||||
// Register a callback for a specified async event.
|
||||
void SetCallback(int evt, wxSoundCallback cbk, void *cdata);
|
||||
|
||||
// Starts the async notifier. After this call, the stream begins either
|
||||
// recording or playing or the two at the same time.
|
||||
virtual bool StartProduction(int evt) = 0;
|
||||
// Stops the async notifier.
|
||||
virtual bool StopProduction() = 0;
|
||||
// Sets the event handler: if it is non-null, all events are routed to it.
|
||||
void SetEventHandler(wxSoundStream *handler) { m_handler = handler; }
|
||||
|
||||
wxSoundError GetError() const { return m_snderror; }
|
||||
wxUint32 GetLastAccess() const { return m_lastcount; }
|
||||
|
||||
// This is only useful for device (I think).
|
||||
virtual bool QueueFilled() const { return TRUE; }
|
||||
|
||||
protected:
|
||||
// Current sound format
|
||||
wxSoundFormatBase *m_sndformat;
|
||||
|
||||
// Last error
|
||||
wxSoundError m_snderror;
|
||||
|
||||
// Last access
|
||||
wxUint32 m_lastcount;
|
||||
|
||||
// Event handler
|
||||
wxSoundStream *m_handler;
|
||||
|
||||
wxSoundCallback m_callback[2];
|
||||
void *m_cdata[2];
|
||||
|
||||
protected:
|
||||
// Handles event
|
||||
virtual void OnSoundEvent(int evt);
|
||||
};
|
||||
|
||||
#endif
|
32
contrib/include/wx/mmedia/sndcodec.h
Normal file
32
contrib/include/wx/mmedia/sndcodec.h
Normal file
@@ -0,0 +1,32 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndcodec.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDCODEC_H
|
||||
#define _WX_SNDCODEC_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndcodec.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
|
||||
class wxSoundStreamCodec: public wxSoundStream {
|
||||
public:
|
||||
wxSoundStreamCodec(wxSoundStream& snd_io);
|
||||
~wxSoundStreamCodec();
|
||||
|
||||
bool StartProduction(int evt);
|
||||
bool StopProduction();
|
||||
|
||||
wxUint32 GetBestSize() const;
|
||||
|
||||
protected:
|
||||
wxSoundStream *m_sndio;
|
||||
};
|
||||
|
||||
#endif
|
54
contrib/include/wx/mmedia/sndcpcm.h
Normal file
54
contrib/include/wx/mmedia/sndcpcm.h
Normal file
@@ -0,0 +1,54 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndcpcm.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDCPCM_H
|
||||
#define _WX_SNDCPCM_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndcpcm.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
#include "wx/mmedia/sndcodec.h"
|
||||
|
||||
//
|
||||
// PCM converter class
|
||||
//
|
||||
|
||||
class wxSoundStreamPcm: public wxSoundStreamCodec {
|
||||
public:
|
||||
typedef void (*ConverterType)(const void *buf_in, void *buf_out,
|
||||
wxUint32 len);
|
||||
|
||||
wxSoundStreamPcm(wxSoundStream& sndio);
|
||||
~wxSoundStreamPcm();
|
||||
|
||||
wxSoundStream& Read(void *buffer, wxUint32 len);
|
||||
wxSoundStream& Write(const void *buffer, wxUint32 len);
|
||||
|
||||
bool SetSoundFormat(const wxSoundFormatBase& format);
|
||||
|
||||
wxUint32 GetBestSize() const;
|
||||
|
||||
protected:
|
||||
wxUint32 GetReadSize(wxUint32 len) const;
|
||||
wxUint32 GetWriteSize(wxUint32 len) const;
|
||||
|
||||
protected:
|
||||
ConverterType m_function_out, m_function_in;
|
||||
|
||||
// Static temporary buffer
|
||||
char *m_prebuffer;
|
||||
wxUint32 m_prebuffer_size;
|
||||
// Estimated best size to fit into the static buffer
|
||||
wxUint32 m_best_size;
|
||||
// Multiplier for IO buffer size
|
||||
float m_multiplier_in, m_multiplier_out;
|
||||
};
|
||||
|
||||
#endif
|
53
contrib/include/wx/mmedia/sndesd.h
Normal file
53
contrib/include/wx/mmedia/sndesd.h
Normal file
@@ -0,0 +1,53 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndesd.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDESD_H
|
||||
#define _WX_SNDESD_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndesd.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
#include "wx/mmedia/sndpcm.h"
|
||||
|
||||
//
|
||||
// ESD output class
|
||||
//
|
||||
|
||||
class wxSoundStreamESD : public wxSoundStream {
|
||||
public:
|
||||
wxSoundStreamESD(const wxString& hostname = wxT("localhost"));
|
||||
~wxSoundStreamESD();
|
||||
|
||||
wxSoundStream& Read(void *buffer, wxUint32 len);
|
||||
wxSoundStream& Write(const void *buffer, wxUint32 len);
|
||||
|
||||
bool SetSoundFormat(const wxSoundFormatBase& format);
|
||||
|
||||
bool StartProduction(int evt);
|
||||
bool StopProduction();
|
||||
|
||||
// You should not call this.
|
||||
void WakeUpEvt(int evt);
|
||||
|
||||
bool QueueFilled() const { return m_q_filled; }
|
||||
protected:
|
||||
int m_fd_input, m_fd_output; // ESD fds
|
||||
int m_tag_input, m_tag_output; // GLIB tags
|
||||
bool m_esd_stop; // Stream started ?
|
||||
bool m_esd_ok; // ESD detected
|
||||
wxString m_hostname; // ESD host
|
||||
bool m_q_filled; // queue filled
|
||||
|
||||
private:
|
||||
void DetectBest(wxSoundFormatPcm *pcm);
|
||||
};
|
||||
|
||||
#endif
|
125
contrib/include/wx/mmedia/sndfile.h
Normal file
125
contrib/include/wx/mmedia/sndfile.h
Normal file
@@ -0,0 +1,125 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndfile.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDFILE_H
|
||||
#define _WX_SNDFILE_H
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/stream.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
#include "wx/mmedia/sndcodec.h"
|
||||
|
||||
#define wxSOUND_INFINITE_TIME ((wxUint32)-1)
|
||||
|
||||
//
|
||||
// Codec router class
|
||||
//
|
||||
|
||||
class WXDLLEXPORT wxSoundRouterStream: public wxSoundStreamCodec {
|
||||
public:
|
||||
wxSoundRouterStream(wxSoundStream& sndio);
|
||||
~wxSoundRouterStream();
|
||||
|
||||
wxSoundStream& Read(void *buffer, wxUint32 len);
|
||||
wxSoundStream& Write(const void *buffer, wxUint32 len);
|
||||
|
||||
bool SetSoundFormat(const wxSoundFormatBase& format);
|
||||
|
||||
bool StartProduction(int evt);
|
||||
bool StopProduction();
|
||||
|
||||
wxUint32 GetBestSize() const;
|
||||
|
||||
protected:
|
||||
wxSoundStream *m_router;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
wxSOUND_FILE_STOPPED,
|
||||
wxSOUND_FILE_PAUSED,
|
||||
wxSOUND_FILE_PLAYING,
|
||||
wxSOUND_FILE_RECORDING
|
||||
} wxSoundFileState;
|
||||
|
||||
//
|
||||
// Base class for file coders/decoders
|
||||
//
|
||||
|
||||
class wxSoundFileStream: public wxSoundStream {
|
||||
public:
|
||||
wxSoundFileStream(wxInputStream& stream, wxSoundStream& io_sound);
|
||||
wxSoundFileStream(wxOutputStream& stream, wxSoundStream& io_sound);
|
||||
~wxSoundFileStream();
|
||||
|
||||
// Usual sound file calls (Play, Stop, ...)
|
||||
bool Play();
|
||||
bool Record(wxUint32 time);
|
||||
bool Stop();
|
||||
bool Pause();
|
||||
bool Resume();
|
||||
|
||||
// Functions which return the current state
|
||||
bool IsStopped() const { return m_state == wxSOUND_FILE_STOPPED; }
|
||||
bool IsPaused() const { return m_state == wxSOUND_FILE_PAUSED; }
|
||||
|
||||
// A user should not call these two functions.
|
||||
// Several things must be done before calling them.
|
||||
// Users should use Play(), ...
|
||||
bool StartProduction(int evt);
|
||||
bool StopProduction();
|
||||
|
||||
// These three functions deals with the length, the position in the sound file.
|
||||
// All the values are expressed in bytes. If you need the values expressed
|
||||
// in terms of time, you have to use GetSoundFormat().GetTimeFromBytes(...)
|
||||
wxUint32 GetLength();
|
||||
wxUint32 GetPosition();
|
||||
wxUint32 SetPosition(wxUint32 new_position);
|
||||
|
||||
// These two functions use the sound format specified by GetSoundFormat().
|
||||
// All samples must be encoded in that format.
|
||||
wxSoundStream& Read(void *buffer, wxUint32 len);
|
||||
wxSoundStream& Write(const void *buffer, wxUint32 len);
|
||||
|
||||
// This function set the sound format of the file. !! It must be used only
|
||||
// when you are in output mode (concerning the file) !! If you are in
|
||||
// input mode (concerning the file) you can't use this function to modify
|
||||
// the format of the samples returned by Read() !
|
||||
// For this action, you must use wxSoundRouterStream applied to wxSoundFileStream.
|
||||
bool SetSoundFormat(const wxSoundFormatBase& format);
|
||||
|
||||
// This function returns the Codec name. This is useful for those who want to build
|
||||
// a player (But also in some other case).
|
||||
virtual wxString GetCodecName() const;
|
||||
|
||||
// You should use this function to test whether this file codec can read
|
||||
// the stream you passed to it.
|
||||
virtual bool CanRead() { return FALSE; }
|
||||
|
||||
protected:
|
||||
wxSoundRouterStream m_codec;
|
||||
wxSoundStream *m_sndio;
|
||||
wxInputStream *m_input;
|
||||
wxOutputStream *m_output;
|
||||
|
||||
wxSoundFileState m_state, m_oldstate;
|
||||
wxUint32 m_length, m_bytes_left;
|
||||
bool m_prepared;
|
||||
|
||||
protected:
|
||||
virtual bool PrepareToPlay() = 0;
|
||||
virtual bool PrepareToRecord(wxUint32 time) = 0;
|
||||
virtual bool FinishRecording() = 0;
|
||||
virtual bool RepositionStream(wxUint32 position) = 0;
|
||||
void FinishPreparation(wxUint32 len);
|
||||
|
||||
virtual wxUint32 GetData(void *buffer, wxUint32 len) = 0;
|
||||
virtual wxUint32 PutData(const void *buffer, wxUint32 len) = 0;
|
||||
|
||||
void OnSoundEvent(int evt);
|
||||
};
|
||||
|
||||
#endif
|
85
contrib/include/wx/mmedia/sndg72x.h
Normal file
85
contrib/include/wx/mmedia/sndg72x.h
Normal file
@@ -0,0 +1,85 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndg72x.h
|
||||
// Purpose:
|
||||
// Date: 08/26/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDG72X_H
|
||||
#define _WX_SNDG72X_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndg72x.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
#include "wx/mmedia/sndcodec.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
|
||||
typedef enum {
|
||||
wxSOUND_G721,
|
||||
wxSOUND_G723_24,
|
||||
wxSOUND_G723_40
|
||||
} wxSoundG72XType;
|
||||
|
||||
// This fixes a bug in Mingw95
|
||||
typedef struct g72x_state g72state;
|
||||
|
||||
//
|
||||
// G72X format
|
||||
//
|
||||
class WXDLLEXPORT wxSoundFormatG72X: public wxSoundFormatBase {
|
||||
public:
|
||||
wxSoundFormatG72X();
|
||||
~wxSoundFormatG72X();
|
||||
|
||||
void SetG72XType(wxSoundG72XType type);
|
||||
wxSoundG72XType GetG72XType() const { return m_g72x_type; }
|
||||
|
||||
void SetSampleRate(wxUint32 srate);
|
||||
wxUint32 GetSampleRate() const;
|
||||
|
||||
wxSoundFormatType GetType() const { return wxSOUND_G72X; }
|
||||
wxSoundFormatBase *Clone() const;
|
||||
|
||||
wxUint32 GetTimeFromBytes(wxUint32 bytes) const;
|
||||
wxUint32 GetBytesFromTime(wxUint32 time) const;
|
||||
|
||||
bool operator !=(const wxSoundFormatBase& frmt2) const;
|
||||
|
||||
protected:
|
||||
wxUint32 m_srate;
|
||||
wxSoundG72XType m_g72x_type;
|
||||
};
|
||||
|
||||
//
|
||||
// ULAW converter class
|
||||
//
|
||||
|
||||
class WXDLLEXPORT wxSoundRouterStream;
|
||||
class WXDLLEXPORT wxSoundStreamG72X: public wxSoundStreamCodec {
|
||||
public:
|
||||
wxSoundStreamG72X(wxSoundStream& sndio);
|
||||
~wxSoundStreamG72X();
|
||||
|
||||
wxSoundStream& Read(void *buffer, wxUint32 len);
|
||||
wxSoundStream& Write(const void *buffer, wxUint32 len);
|
||||
|
||||
bool SetSoundFormat(const wxSoundFormatBase& format);
|
||||
|
||||
protected:
|
||||
wxSoundRouterStream *m_router;
|
||||
wxUint8 m_n_bits, m_current_mask, m_current_b_pos, m_current_byte;
|
||||
wxUint8 *m_io_buffer;
|
||||
g72state *m_state;
|
||||
|
||||
int (*m_coder)(int code, int in_code, struct g72x_state *state);
|
||||
int (*m_decoder)(int code, int out_code, struct g72x_state *state);
|
||||
|
||||
protected:
|
||||
void PutBits(wxUint8 bits);
|
||||
wxUint8 GetBits();
|
||||
};
|
||||
|
||||
#endif
|
72
contrib/include/wx/mmedia/sndmsad.h
Normal file
72
contrib/include/wx/mmedia/sndmsad.h
Normal file
@@ -0,0 +1,72 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndmsad(pcm).h
|
||||
// Purpose: MS ADPCM codec
|
||||
// Date: 25/02/2000
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 2000
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDULAW_H
|
||||
#define _WX_SNDULAW_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndmsad.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/mmedia/sndcodec.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
|
||||
WX_DEFINE_EXPORTED_ARRAY(wxUint16, wxMSAdpcmCoeffs);
|
||||
|
||||
//
|
||||
// MSADPCM format
|
||||
//
|
||||
class WXDLLEXPORT wxSoundFormatMSAdpcm: public wxSoundFormatBase {
|
||||
public:
|
||||
wxSoundFormatMSAdpcm();
|
||||
~wxSoundFormatMSAdpcm();
|
||||
|
||||
void SetSampleRate(wxUint32 srate);
|
||||
wxUint32 GetSampleRate() const;
|
||||
|
||||
void SetSamplesBlock(wxUint16 sampblock);
|
||||
wxUint16 GetSamplesBlock() const;
|
||||
|
||||
void SetCoefs(wxMSAdpcmCoefs& coefs);
|
||||
wxMSAdpcmCoefs& GetCoefs() const;
|
||||
|
||||
wxSoundFormatType GetType() const { return wxSOUND_ULAW; }
|
||||
wxSoundFormatBase *Clone() const;
|
||||
|
||||
wxUint32 GetTimeFromBytes(wxUint32 bytes) const;
|
||||
wxUint32 GetBytesFromTime(wxUint32 time) const;
|
||||
|
||||
bool operator !=(const wxSoundFormatBase& frmt2) const;
|
||||
|
||||
protected:
|
||||
wxUint32 m_srate;
|
||||
wxMSAdpcmCoefs *m_coefs;
|
||||
};
|
||||
|
||||
//
|
||||
// MS ADPCM converter class
|
||||
//
|
||||
class WXDLLEXPORT wxSoundRouterStream;
|
||||
class WXDLLEXPORT wxSoundStreamAdpcm: public wxSoundStreamCodec {
|
||||
public:
|
||||
wxSoundStreamAdpcm(wxSoundStream& sndio);
|
||||
~wxSoundStreamAdpcm();
|
||||
|
||||
wxSoundStream& Read(void *buffer, wxUint32 len);
|
||||
wxSoundStream& Write(const void *buffer, wxUint32 len);
|
||||
|
||||
bool SetSoundFormat(const wxSoundFormatBase& format);
|
||||
|
||||
wxUint32 GetBestSize() const;
|
||||
|
||||
protected:
|
||||
wxSoundRouterStream *m_router;
|
||||
};
|
||||
|
||||
#endif
|
55
contrib/include/wx/mmedia/sndoss.h
Normal file
55
contrib/include/wx/mmedia/sndoss.h
Normal file
@@ -0,0 +1,55 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndoss.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDOSS_H
|
||||
#define _WX_SNDOSS_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndoss.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
#include "wx/mmedia/sndpcm.h"
|
||||
|
||||
//
|
||||
// OSS output class
|
||||
//
|
||||
|
||||
class wxSoundStreamOSS : public wxSoundStream {
|
||||
public:
|
||||
wxSoundStreamOSS(const wxString& dev_name = wxT("/dev/dsp"));
|
||||
~wxSoundStreamOSS();
|
||||
|
||||
wxSoundStream& Read(void *buffer, wxUint32 len);
|
||||
wxSoundStream& Write(const void *buffer, wxUint32 len);
|
||||
wxUint32 GetBestSize() const;
|
||||
|
||||
bool SetSoundFormat(const wxSoundFormatBase& format);
|
||||
|
||||
bool StartProduction(int evt);
|
||||
bool StopProduction();
|
||||
|
||||
bool QueueFilled() const;
|
||||
|
||||
// You should not call this.
|
||||
void WakeUpEvt(int evt);
|
||||
protected:
|
||||
// OSS device
|
||||
int m_fd;
|
||||
wxUint32 m_bufsize;
|
||||
int m_tag;
|
||||
bool m_oss_stop, m_oss_ok, m_q_filled;
|
||||
wxString m_devname;
|
||||
|
||||
private:
|
||||
bool SetupFormat(wxSoundFormatPcm *pcm);
|
||||
void DetectBest(wxSoundFormatPcm *pcm);
|
||||
};
|
||||
|
||||
#endif
|
57
contrib/include/wx/mmedia/sndpcm.h
Normal file
57
contrib/include/wx/mmedia/sndpcm.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndpcm.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDPCM_H
|
||||
#define _WX_SNDPCM_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndpcm.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
|
||||
//
|
||||
// PCM specification class
|
||||
//
|
||||
|
||||
class wxSoundFormatPcm : public wxSoundFormatBase {
|
||||
public:
|
||||
wxSoundFormatPcm(wxUint32 srate = 22500, wxUint8 bps = 8,
|
||||
wxUint16 channels = 2, bool sign = TRUE,
|
||||
int order = wxLITTLE_ENDIAN);
|
||||
~wxSoundFormatPcm();
|
||||
|
||||
void SetSampleRate(wxUint32 srate);
|
||||
void SetBPS(wxUint8 bps);
|
||||
void SetChannels(wxUint16 nchannels);
|
||||
void SetOrder(int order);
|
||||
void Signed(bool sign);
|
||||
|
||||
wxUint32 GetSampleRate() const { return m_srate; }
|
||||
wxUint8 GetBPS() const { return m_bps; }
|
||||
wxUint16 GetChannels() const { return m_nchan; }
|
||||
int GetOrder() const { return m_order; }
|
||||
bool Signed() const { return m_signed; }
|
||||
|
||||
wxSoundFormatType GetType() const { return wxSOUND_PCM; }
|
||||
wxSoundFormatBase *Clone() const;
|
||||
|
||||
wxUint32 GetTimeFromBytes(wxUint32 bytes) const;
|
||||
wxUint32 GetBytesFromTime(wxUint32 time) const;
|
||||
|
||||
bool operator!=(const wxSoundFormatBase& frmt2) const;
|
||||
|
||||
protected:
|
||||
wxUint32 m_srate;
|
||||
wxUint8 m_bps;
|
||||
wxUint16 m_nchan;
|
||||
int m_order;
|
||||
bool m_signed;
|
||||
};
|
||||
|
||||
#endif
|
67
contrib/include/wx/mmedia/sndulaw.h
Normal file
67
contrib/include/wx/mmedia/sndulaw.h
Normal file
@@ -0,0 +1,67 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndulaw.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDULAW_H
|
||||
#define _WX_SNDULAW_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndulaw.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/mmedia/sndcodec.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
|
||||
//
|
||||
// ULAW format
|
||||
//
|
||||
class WXDLLEXPORT wxSoundFormatUlaw: public wxSoundFormatBase {
|
||||
public:
|
||||
wxSoundFormatUlaw();
|
||||
~wxSoundFormatUlaw();
|
||||
|
||||
void SetSampleRate(wxUint32 srate);
|
||||
wxUint32 GetSampleRate() const;
|
||||
|
||||
void SetChannels(wxUint8 channels);
|
||||
wxUint8 GetChannels() const;
|
||||
|
||||
wxSoundFormatType GetType() const { return wxSOUND_ULAW; }
|
||||
wxSoundFormatBase *Clone() const;
|
||||
|
||||
wxUint32 GetTimeFromBytes(wxUint32 bytes) const;
|
||||
wxUint32 GetBytesFromTime(wxUint32 time) const;
|
||||
|
||||
bool operator !=(const wxSoundFormatBase& frmt2) const;
|
||||
|
||||
protected:
|
||||
wxUint32 m_srate;
|
||||
wxUint8 m_channels;
|
||||
};
|
||||
|
||||
//
|
||||
// ULAW converter class
|
||||
//
|
||||
|
||||
class WXDLLEXPORT wxSoundRouterStream;
|
||||
class WXDLLEXPORT wxSoundStreamUlaw: public wxSoundStreamCodec {
|
||||
public:
|
||||
wxSoundStreamUlaw(wxSoundStream& sndio);
|
||||
~wxSoundStreamUlaw();
|
||||
|
||||
wxSoundStream& Read(void *buffer, wxUint32 len);
|
||||
wxSoundStream& Write(const void *buffer, wxUint32 len);
|
||||
|
||||
bool SetSoundFormat(const wxSoundFormatBase& format);
|
||||
|
||||
wxUint32 GetBestSize() const;
|
||||
|
||||
protected:
|
||||
wxSoundRouterStream *m_router;
|
||||
};
|
||||
|
||||
#endif
|
58
contrib/include/wx/mmedia/sndwav.h
Normal file
58
contrib/include/wx/mmedia/sndwav.h
Normal file
@@ -0,0 +1,58 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndwav.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDWAV_H
|
||||
#define _WX_SNDWAV_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sndwav.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/stream.h"
|
||||
#include "wx/datstrm.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
#include "wx/mmedia/sndcodec.h"
|
||||
#include "wx/mmedia/sndfile.h"
|
||||
|
||||
//
|
||||
// WAVE codec
|
||||
//
|
||||
|
||||
class wxSoundWave: public wxSoundFileStream {
|
||||
public:
|
||||
wxSoundWave(wxInputStream& stream, wxSoundStream& io_sound);
|
||||
wxSoundWave(wxOutputStream& stream, wxSoundStream& io_sound);
|
||||
~wxSoundWave();
|
||||
|
||||
bool CanRead();
|
||||
wxString GetCodecName() const;
|
||||
|
||||
protected:
|
||||
bool PrepareToPlay();
|
||||
bool PrepareToRecord(wxUint32 time);
|
||||
bool FinishRecording();
|
||||
bool RepositionStream(wxUint32 position);
|
||||
|
||||
wxUint32 GetData(void *buffer, wxUint32 len);
|
||||
wxUint32 PutData(const void *buffer, wxUint32 len);
|
||||
|
||||
bool HandleOutputPCM(wxDataInputStream& data, wxUint16 channels,
|
||||
wxUint32 sample_fq, wxUint32 byte_p_sec,
|
||||
wxUint16 byte_p_spl, wxUint16 bits_p_spl);
|
||||
bool HandleOutputG721(wxDataInputStream& data, wxUint16 channels,
|
||||
wxUint32 sample_fq, wxUint32 byte_p_sec,
|
||||
wxUint16 byte_p_spl, wxUint16 bits_p_spl);
|
||||
wxSoundFormatBase *HandleInputPCM(wxDataOutputStream& data);
|
||||
wxSoundFormatBase *HandleInputG72X(wxDataOutputStream& data);
|
||||
|
||||
protected:
|
||||
off_t m_base_offset;
|
||||
};
|
||||
|
||||
#endif
|
65
contrib/include/wx/mmedia/sndwin.h
Normal file
65
contrib/include/wx/mmedia/sndwin.h
Normal file
@@ -0,0 +1,65 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// Name: sndwin.h
|
||||
// Purpose:
|
||||
// Date: 08/11/1999
|
||||
// Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
|
||||
// CVSID: $Id$
|
||||
// --------------------------------------------------------------------------
|
||||
#ifndef _WX_SNDWIN_H
|
||||
#define _WX_SNDWIN_H
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/mmedia/sndbase.h"
|
||||
|
||||
typedef struct _wxSoundInternal wxSoundInternal;
|
||||
typedef struct _wxSoundInfoHeader wxSoundInfoHeader;
|
||||
|
||||
class wxSoundInternal;
|
||||
class WXDLLEXPORT wxSoundStreamWin : public wxSoundStream {
|
||||
public:
|
||||
wxSoundStreamWin();
|
||||
~wxSoundStreamWin();
|
||||
|
||||
wxSoundStream& Write(const void *buffer, wxUint32 len);
|
||||
wxSoundStream& Read(void *buffer, wxUint32 len);
|
||||
|
||||
bool SetSoundFormat(wxSoundFormatBase& base);
|
||||
|
||||
bool StartProduction(int evt);
|
||||
bool StopProduction();
|
||||
|
||||
bool QueueFilled() const;
|
||||
|
||||
// Internal but defined as public
|
||||
void NotifyDoneBuffer(wxUint32 dev_handle, int flag);
|
||||
|
||||
wxUint32 GetBestSize() const { return 4096; }
|
||||
|
||||
protected:
|
||||
wxSoundInternal *m_internal;
|
||||
wxUint32 m_current_frag_in, m_current_frag_out;
|
||||
wxUint32 m_input_frag_in, m_output_frag_out;
|
||||
wxSoundInfoHeader **m_headers_play, **m_headers_rec;
|
||||
|
||||
bool m_production_started, m_queue_filled, m_waiting_for;
|
||||
|
||||
protected:
|
||||
void CreateSndWindow();
|
||||
void DestroySndWindow();
|
||||
bool OpenDevice(int mode);
|
||||
void CloseDevice();
|
||||
|
||||
wxSoundInfoHeader *AllocHeader(int mode);
|
||||
void FreeHeader(wxSoundInfoHeader *header, int mode);
|
||||
bool AllocHeaders(int mode);
|
||||
void FreeHeaders(int mode);
|
||||
|
||||
void WaitFor(wxSoundInfoHeader *info);
|
||||
bool AddToQueue(wxSoundInfoHeader *info);
|
||||
void ClearHeader(wxSoundInfoHeader *info);
|
||||
|
||||
wxSoundInfoHeader *NextFragmentOutput();
|
||||
wxSoundInfoHeader *NextFragmentInput();
|
||||
};
|
||||
|
||||
#endif
|
110
contrib/include/wx/mmedia/vidbase.h
Normal file
110
contrib/include/wx/mmedia/vidbase.h
Normal file
@@ -0,0 +1,110 @@
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
// Name: vidbase.h
|
||||
// Purpose: wxMMedia
|
||||
// Author: Guilhem Lavaux
|
||||
// Created: 1997
|
||||
// Updated: 1998
|
||||
// Copyright: (C) 1997, 1998, Guilhem Lavaux
|
||||
// CVS: $Id$
|
||||
// License: wxWindows license
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
/* Real -*- C++ -*- */
|
||||
#ifndef __VID_bdrv_H__
|
||||
#define __VID_bdrv_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "vidbase.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWindows headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/defs.h"
|
||||
#include "wx/stream.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/window.h"
|
||||
#include "wx/frame.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMMedia2 (video) types
|
||||
|
||||
typedef enum {
|
||||
wxVIDEO_MSAVI,
|
||||
wxVIDEO_MPEG,
|
||||
wxVIDEO_QT,
|
||||
wxVIDEO_GIF,
|
||||
wxVIDEO_JMOV,
|
||||
wxVIDEO_FLI,
|
||||
wxVIDEO_IFF,
|
||||
wxVIDEO_SGI,
|
||||
wxVIDEO_MPEG2
|
||||
} wxVideoType;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Classes definition
|
||||
|
||||
class WXDLLEXPORT wxVideoBaseDriver : public wxObject {
|
||||
DECLARE_ABSTRACT_CLASS(wxVideoBaseDriver)
|
||||
protected:
|
||||
wxWindow *m_video_output;
|
||||
public:
|
||||
// Ctors
|
||||
wxVideoBaseDriver();
|
||||
wxVideoBaseDriver(wxInputStream& str);
|
||||
wxVideoBaseDriver(const wxString& filename);
|
||||
// Dtor
|
||||
virtual ~wxVideoBaseDriver();
|
||||
|
||||
// Usual functions ... They all return FALSE in case of errors.
|
||||
virtual bool Play() = 0;
|
||||
virtual bool Stop() = 0;
|
||||
virtual bool Pause() = 0;
|
||||
virtual bool Resume() = 0;
|
||||
|
||||
// Size management
|
||||
virtual bool SetSize(wxSize size) = 0;
|
||||
virtual bool GetSize(wxSize& size) const = 0;
|
||||
|
||||
// Test the capability of the driver to handle the specified type
|
||||
virtual bool IsCapable(wxVideoType WXUNUSED(v_type)) const { return FALSE; }
|
||||
|
||||
// Return the video codec name
|
||||
virtual wxString GetMovieCodec() const = 0;
|
||||
// Return the audio codec name
|
||||
virtual wxString GetAudioCodec() const = 0;
|
||||
// Return misc info about audio
|
||||
virtual wxUint32 GetSampleRate() const = 0;
|
||||
virtual wxUint8 GetChannels() const = 0;
|
||||
virtual wxUint8 GetBPS() const = 0;
|
||||
// Return frame rate
|
||||
virtual double GetFrameRate() const = 0;
|
||||
// Return number of frames
|
||||
virtual wxUint32 GetNbFrames() const = 0;
|
||||
|
||||
// Called when the movie finished
|
||||
virtual void OnFinished() {}
|
||||
|
||||
// Attaches the video output to a window. The video will be shown in that window.
|
||||
virtual bool AttachOutput(wxWindow& output);
|
||||
virtual void DetachOutput();
|
||||
|
||||
// They return the state of the movie.
|
||||
virtual bool IsPaused() const = 0;
|
||||
virtual bool IsStopped() const = 0;
|
||||
};
|
||||
|
||||
WXDLLEXPORT wxFrame *wxVideoCreateFrame(wxVideoBaseDriver *vid_drv);
|
||||
|
||||
|
||||
#endif
|
101
contrib/include/wx/mmedia/vidwin.h
Normal file
101
contrib/include/wx/mmedia/vidwin.h
Normal file
@@ -0,0 +1,101 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Name: vidwin.h
|
||||
// Purpose: wxMMedia
|
||||
// Author: Guilhem Lavaux
|
||||
// Created: February 1998
|
||||
// Updated:
|
||||
// Copyright: (C) 1998, Guilhem Lavaux
|
||||
// License: wxWindows license
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __VID_windows_H__
|
||||
#define __VID_windows_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "vidwin.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWindows headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/string.h"
|
||||
#include "wx/stream.h"
|
||||
#include "wx/window.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMMedia2 headers
|
||||
|
||||
#include "wx/mmedia/vidbase.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// System headers and private types
|
||||
|
||||
#ifdef WXMMEDIA_INTERNAL
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
typedef struct VIDW_Internal {
|
||||
MCIDEVICEID m_dev_id;
|
||||
} wxVIDWinternal;
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Class definition
|
||||
|
||||
class WXDLLEXPORT wxVideoWindows : public wxVideoBaseDriver {
|
||||
DECLARE_DYNAMIC_CLASS(wxVideoWindows)
|
||||
protected:
|
||||
struct VIDW_Internal *m_internal;
|
||||
bool m_paused, m_stopped, m_remove_file;
|
||||
wxString m_filename;
|
||||
double m_frameRate;
|
||||
wxUint8 m_bps;
|
||||
|
||||
void OpenFile();
|
||||
public:
|
||||
wxVideoWindows(void);
|
||||
wxVideoWindows(wxInputStream& str);
|
||||
wxVideoWindows(const wxString& fname);
|
||||
~wxVideoWindows(void);
|
||||
|
||||
bool Play();
|
||||
bool Stop();
|
||||
bool Pause();
|
||||
bool Resume();
|
||||
|
||||
bool GetSize(wxSize& size) const;
|
||||
bool SetSize(wxSize size);
|
||||
|
||||
// Return codec name for each stream.
|
||||
wxString GetMovieCodec() const;
|
||||
wxString GetAudioCodec() const;
|
||||
// Return misc. info about audio
|
||||
wxUint32 GetSampleRate() const;
|
||||
wxUint8 GetChannels() const;
|
||||
wxUint8 GetBPS() const;
|
||||
// Return the frame rate of the video (in frames/second)
|
||||
double GetFrameRate() const;
|
||||
// Return the total number of frames in the movie
|
||||
wxUint32 GetNbFrames() const;
|
||||
|
||||
bool IsCapable(wxVideoType v_type);
|
||||
|
||||
bool AttachOutput(wxWindow& output);
|
||||
void DetachOutput(void);
|
||||
|
||||
bool IsPaused() const;
|
||||
bool IsStopped() const;
|
||||
};
|
||||
|
||||
#endif
|
136
contrib/include/wx/mmedia/vidxanm.h
Normal file
136
contrib/include/wx/mmedia/vidxanm.h
Normal file
@@ -0,0 +1,136 @@
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
// Name: vidxanm.h
|
||||
// Purpose: wxMMedia
|
||||
// Author: Guilhem Lavaux
|
||||
// Created: 1997
|
||||
// Updated: 1998
|
||||
// Copyright: (C) 1997, 1998, Guilhem Lavaux
|
||||
// License: wxWindows license
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
/* Real -*- C++ -*- */
|
||||
#ifndef __VID_xanim_H__
|
||||
#define __VID_xanim_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "vidxanm.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWindows headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/process.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// System dependent headers
|
||||
|
||||
#if defined(WXMMEDIA_INTERNAL) && (defined(__X__) || defined(__WXGTK__))
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMMedia2 headers
|
||||
|
||||
#include "wx/mmedia/vidbase.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Internal types
|
||||
|
||||
#ifdef WXMMEDIA_INTERNAL
|
||||
typedef struct wxXANIMinternal {
|
||||
Display *xanim_dpy;
|
||||
Window xanim_window;
|
||||
Atom xanim_atom, xanim_ret;
|
||||
} wxXANIMinternal;
|
||||
|
||||
#ifndef __XANIM_COMMAND__
|
||||
#define __XANIM_COMMAND__ "/usr/X11R6/bin/xanim"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Class definition
|
||||
|
||||
class WXDLLEXPORT wxVideoXANIM : public wxVideoBaseDriver {
|
||||
DECLARE_DYNAMIC_CLASS(wxVideoXANIM)
|
||||
protected:
|
||||
// Remember the state of the subprocess
|
||||
bool m_xanim_started, m_paused;
|
||||
// Pure X11 variables
|
||||
struct wxXANIMinternal *m_internal;
|
||||
wxString m_filename;
|
||||
wxProcess *m_xanim_detector;
|
||||
// Remember to delete the temporary file when necessary
|
||||
bool m_remove_file;
|
||||
wxUint32 m_size[2];
|
||||
wxUint32 m_sampleRate;
|
||||
wxUint8 m_channels;
|
||||
wxUint8 m_bps;
|
||||
wxUint32 m_frames;
|
||||
double m_frameRate;
|
||||
wxString m_movieCodec, m_audioCodec;
|
||||
|
||||
public:
|
||||
wxVideoXANIM();
|
||||
wxVideoXANIM(wxInputStream& str);
|
||||
wxVideoXANIM(const wxString& filename);
|
||||
~wxVideoXANIM();
|
||||
|
||||
bool Play();
|
||||
bool Pause();
|
||||
bool Resume();
|
||||
bool Stop();
|
||||
|
||||
bool SetVolume(wxUint8 vol);
|
||||
bool SetSize(wxSize size);
|
||||
bool GetSize(wxSize& size) const;
|
||||
|
||||
// Return the video codec name
|
||||
wxString GetMovieCodec() const;
|
||||
// Return the audio codec name
|
||||
wxString GetAudioCodec() const;
|
||||
// Return misc info about audio
|
||||
wxUint32 GetSampleRate() const;
|
||||
wxUint8 GetChannels() const;
|
||||
wxUint8 GetBPS() const;
|
||||
// Return frame rate
|
||||
double GetFrameRate() const;
|
||||
// Return number of frames in the movie
|
||||
wxUint32 GetNbFrames() const;
|
||||
|
||||
bool IsCapable(wxVideoType v_type) const;
|
||||
|
||||
bool AttachOutput(wxWindow& output);
|
||||
void DetachOutput();
|
||||
|
||||
bool IsPaused() const;
|
||||
bool IsStopped() const;
|
||||
|
||||
friend class wxVideoXANIMProcess;
|
||||
|
||||
protected:
|
||||
// Start the subprocess with the right parameters
|
||||
bool RestartXANIM();
|
||||
// Send a command to the subprocess
|
||||
bool SendCommand(const char *command,char **ret = NULL,
|
||||
wxUint32 *size = NULL);
|
||||
|
||||
// Collect informations from XAnim
|
||||
bool CollectInfo();
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user