home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / h / vd2 / Priss / decoder.h < prev   
Encoding:
C/C++ Source or Header  |  2009-09-14  |  2.2 KB  |  74 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    MPEG audio decoding library
  3. //    Copyright (C) 2003-2007 Avery Lee
  4. //
  5. //    This program is free software; you can redistribute it and/or modify
  6. //    it under the terms of the GNU General Public License as published by
  7. //    the Free Software Foundation; either version 2 of the License, or
  8. //    (at your option) any later version.
  9. //
  10. //    This program is distributed in the hope that it will be useful,
  11. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. //    GNU General Public License for more details.
  14. //
  15. //    You should have received a copy of the GNU General Public License
  16. //    along with this program; if not, write to the Free Software
  17. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. #ifndef f_VD2_PRISS_DECODER_H
  20. #define f_VD2_PRISS_DECODER_H
  21.  
  22. #ifdef _MSC_VER
  23.     #pragma once
  24. #endif
  25.  
  26. class VDMPEGAudioStreamInfo {
  27. public:
  28.     long    lBitrate;            // average bits/second for this stream (0=unconstrained)
  29.     long    lSamplingFreq;        // sampling frequency (Hz)
  30.     char    nLayer;                // MPEG audio layer (1-3)
  31.     char    nMPEGVer;            // MPEG version (1/2)
  32.     char    fStereo;            // true: stereo, false: mono
  33. };
  34.  
  35. class IVDMPEGAudioBitsource {
  36. public:
  37.     virtual int read(void *buffer, int bytes)=0;
  38. };
  39.  
  40. class IVDMPEGAudioDecoder {
  41. public:
  42.     enum {
  43.         ERR_NONE            = 0,
  44.         ERR_EOF                = 1,
  45.         ERR_READ            = 2,
  46.         ERR_MPEG25            = 3,
  47. /*        ERR_LAYER1            = 4,*/ /* Not applicable to NekoAmp1.4 */
  48.         ERR_FREEFORM        = 5,
  49.         ERR_SYNC            = 6,
  50.         ERR_INTERNAL        = 7,
  51.         ERR_INCOMPLETEFRAME    = 8,
  52.         ERR_INVALIDDATA        = 9
  53.     };
  54.  
  55.     virtual ~IVDMPEGAudioDecoder() {}
  56.  
  57.     virtual void    Init()                                = 0;
  58.     virtual void    SetSource(IVDMPEGAudioBitsource *pSource) = 0;
  59.     virtual void    SetDestination(sint16 *psDest)        = 0;
  60.     virtual uint32    GetSampleCount()                    = 0;
  61.     virtual uint32    GetFrameDataSize()                    = 0;
  62.     virtual void    GetStreamInfo(VDMPEGAudioStreamInfo *pasi)    = 0;
  63.     virtual const char *GetErrorString(int err)            = 0;
  64.     virtual void    Reset()                                = 0;
  65.     virtual void    ReadHeader()                        = 0;
  66.     virtual void    PrereadFrame()                        = 0;
  67.     virtual bool    DecodeFrame()                        = 0;
  68.     virtual void    ConcealFrame()                        = 0;
  69. };
  70.  
  71. IVDMPEGAudioDecoder *VDCreateMPEGAudioDecoder();
  72.  
  73. #endif
  74.