X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4d6306eb4da8cdac4b5dee9784959672c233eec8..2356708db31b737c6eae53c2316b642aa5a2e68d:/utils/wxMMedia/sndfrmt.h?ds=sidebyside diff --git a/utils/wxMMedia/sndfrmt.h b/utils/wxMMedia/sndfrmt.h index feb0ad62d2..6a67db7de2 100644 --- a/utils/wxMMedia/sndfrmt.h +++ b/utils/wxMMedia/sndfrmt.h @@ -1,3 +1,12 @@ +//////////////////////////////////////////////////////////////////////////////// +// Name: sndfrmt.h +// Purpose: wxMMedia +// Author: Guilhem Lavaux +// Created: 1998 +// Updated: December 1998 +// Copyright: (C) 1997, 1998, Guilhem Lavaux +// License: wxWindows license +//////////////////////////////////////////////////////////////////////////////// #ifndef __SNDFRMT_H__ #define __SNDFRMT_H__ @@ -6,6 +15,7 @@ #endif #include +#include class wxSndBuffer; @@ -19,12 +29,14 @@ class wxSoundCodec; class wxSoundDataFormat { public: wxSoundDataFormat(); + wxSoundDataFormat(const wxSoundDataFormat& format); ~wxSoundDataFormat(); void SetSampleRate(int srate) { m_srate = srate; } void SetChannels(int channels); void SetStereo(bool on); void SetCodecNo(int no); + int GetCodecNo() { return m_codno; } void SetCodecCreate(bool create) { m_codcreate = create; } int GetSampleRate() const { return m_srate; } @@ -60,6 +72,12 @@ class wxSoundDataFormat { class wxSoundCodec : public wxObject, public wxStreamBase { DECLARE_ABSTRACT_CLASS(wxSoundCodec) + public: + typedef enum { + WAITING = 0, + ENCODING, + DECODING + } ModeType; public: wxSoundCodec(); virtual ~wxSoundCodec(); @@ -68,8 +86,7 @@ class wxSoundCodec : public wxObject, public wxStreamBase { size_t Available(); void InitIO(const wxSoundDataFormat& format); - void InitMode(int mode); - void ExitMode(); + virtual void InitWith(const wxSoundDataFormat& format) {} inline void SetInStream(wxStreamBuffer *s) { m_in_sound = s; } @@ -78,11 +95,15 @@ class wxSoundCodec : public wxObject, public wxStreamBase { inline wxStreamBuffer *GetInStream() const { return m_in_sound; } inline wxStreamBuffer *GetOutStream() const { return m_out_sound; } - inline bool Good() const { return (m_in_sound->Stream()->LastError() == wxStream_NOERROR) && (m_out_sound->Stream()->LastError() == wxStream_NOERROR); } + inline bool StreamOk() const + { return (m_in_sound->Stream()->LastError() == wxStream_NOERROR) && + (m_out_sound->Stream()->LastError() == wxStream_NOERROR); } virtual size_t GetByteRate() const = 0; virtual wxSoundDataFormat GetPreferredFormat(int codec = 0) const = 0; + virtual void InitMode(ModeType mode); + virtual void ExitMode(); virtual void Decode() = 0; virtual void Encode() = 0; @@ -109,11 +130,7 @@ class wxSoundCodec : public wxObject, public wxStreamBase { wxStreamBuffer *m_in_sound, *m_out_sound; wxSoundCodec *m_chain_codec; bool m_init, m_chain_before; - - enum { - ENCODING = 0, - DECODING - } m_mode; + ModeType m_mode; }; #endif