diff options
author | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2005-07-29 23:00:53 +0000 |
---|---|---|
committer | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2005-07-29 23:00:53 +0000 |
commit | 335def9f61ce75a3857bd21745c629005c37db79 (patch) | |
tree | daae8b1105c422542181a4bf5568f684b6e955b9 /vdr_decoder_sndfile.h | |
parent | da2367d81a6a117554b31080a6e722b51150b8f8 (diff) | |
download | vdr-plugin-muggle-335def9f61ce75a3857bd21745c629005c37db79.tar.gz vdr-plugin-muggle-335def9f61ce75a3857bd21745c629005c37db79.tar.bz2 |
Merged from 0.1.7-wr
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@791 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'vdr_decoder_sndfile.h')
-rw-r--r-- | vdr_decoder_sndfile.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/vdr_decoder_sndfile.h b/vdr_decoder_sndfile.h new file mode 100644 index 0000000..eed8a16 --- /dev/null +++ b/vdr_decoder_sndfile.h @@ -0,0 +1,104 @@ +/* + * Muggle plugin to VDR (C++) + * + * (C) 2005 Lars von Wedel, Wolfgang Rohdewald, mainly copied from + * (C) 2001-2005 Stefan Huelswitt <s.huelswitt@gmx.de> + * + * This code is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This code is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html + */ + +#ifndef ___DECODER_SND_H +#define ___DECODER_SND_H + +#define DEC_SND DEC_ID('S','N','D',' ') +#define DEC_SND_STR "SND" + +#ifdef HAVE_SNDFILE + +#include <string> + +#include <time.h> +#include <mad.h> +#include <sndfile.h> + +#include <thread.h> + +#include "vdr_decoder.h" + +#define CDFS_MAGIC 0xCDDA // cdfs filesystem-ID + +// ---------------------------------------------------------------- + +class mgSndfile +{ +private: + SNDFILE *m_sf; + std::string m_filename; + + void Error(const char *action); + + SF_INFO m_sfi; +public: + + mgSndfile( mgItemGd *item ); + ~mgSndfile(); + + SF_INFO* SoundfileInfo(); + bool Open( bool log = true ); + void Close(); + sf_count_t Seek( sf_count_t frames = 0, bool relative = false ); + sf_count_t Stream( int *buffer, sf_count_t frames ); +}; + +// ---------------------------------------------------------------- + +class mgSndfileDecoder : public mgDecoder, public cThread +{ +private: + mgSndfile m_file; + + struct mgDecode m_ds; + struct mad_pcm *m_pcm; + unsigned long long m_index; + // + cMutex m_buffMutex; + cCondVar m_fgCond, m_bgCond; + bool m_run, m_ready; + int *m_framebuff, m_deferedN, m_softCount; + // + void init(); + bool clean(); + struct mgDecode *done( eDecodeStatus status ); + +protected: + virtual void Action(void); + +public: + mgSndfileDecoder( mgItemGd *item ); + ~mgSndfileDecoder(); + + virtual bool valid(void); + virtual bool start(void); + virtual bool stop(void); + virtual bool skip(int seconds, int avail, int rate); + virtual struct mgDecode *decode(); + virtual mgPlayInfo *playInfo(); +}; + +// ---------------------------------------------------------------- + +#endif //HAVE_SNDFILE +#endif //___DECODER_SND_H |