/*
 * --- GSMP-COPYRIGHT-NOTE-BEGIN ---
 * 
 * This copyright note is auto-generated by ./scripts/Create-CopyPatch.
 * Please add additional copyright information _after_ the line containing
 * the GSMP-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
 * the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
 * 
 * GSMP: pcm/include/MP3Stream.hh
 * General Sound Manipulation Program is Copyright (C) 2000 - 2004
 *   Valentin Ziegler and René Rebe
 * 
 * This program 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; version 2. A copy of the GNU General
 * Public License can be found in the file LICENSE.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANT-
 * ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details.
 * 
 * --- GSMP-COPYRIGHT-NOTE-END ---
 */

/* Short Description:
 *   Extended IO-Streaming, according Importer and OggVorbis / MP3
 *   IO-Stream classes.
 */

#ifndef LOWLEVEL__MP3STREAM_HH__
#define LOWLEVEL__MP3STREAM_HH__

#include "BasicFileStream.hh"

#include "Logging.hh"
#include "MADHelper.hh" // our mad-lib abstraction (mid-level interface)

#include <string>

namespace GSMP
{

  extern GSMP::Logger <DefaultLogging_MP3> MP3Log;
  
  /* MP3 implementation !! ;-) */
  class MP3FileStream : public BasicFileStream
  {
  public:
    MP3FileStream ();
    virtual ~MP3FileStream ();
    
    /* Control */
    virtual bool Open (const std::string& fname);
    virtual bool IsOpen ();
    virtual bool Close ();
    
    /* Info */
    virtual global_index Size ();
    virtual channel_index Channels ();
    virtual sample_rate Rate ();
    
    /* Operations */
    virtual local_index Read (local_index size,
			      BasicStream* dest);
    virtual global_index Seek (global_index pos);
    
  protected:
    
    bool m_open;
    MADHelper m_mad;
    
    global_index m_size;
    channel_index m_channels;
    sample_rate m_rate;
    
    global_index m_stream_pos;
    
    std::string m_fname;
  };

} // end namespace GSMP

#endif // GSMP_EXTFILEIO_IMPL_H
