/* * mp3plot - Bitrate analysis tool * * Copyright (C) 2007 Toni Corvera * * 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; either version 2 of the License, or * (at your option) any later version. * * This program 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 */ // $Id: mp3_element.h 733 2007-05-21 18:27:33Z $ #ifndef ONET_MP3ELEMENT_H #define ONET_MP3ELEMENT_H #include #include "mp3_common.h" namespace net_outlyer { namespace mp3 { /*! * \brief Abstraction of an mp3 element (frame or tag). */ struct mp3element { mp3element() {} virtual ~mp3element() {}; /*! * \brief Read element's data. * Implementors should obtain their data in the implementation of this method. * \param input The input file * \throw e_error If a read error occurs */ virtual void read(std::ifstream & input) throw (e_error) = 0; /*! * \brief Returns the index of a given bitrate. * \note Each possible bitrate has an associated index in the file headers. * \param kbps Nominal bitrate in kbps */ static uint8_t bitrate_index(uint16_t kbps); protected: /*! * \brief Tests if the input is ok to continue reading * \throws e_read_failure if can't read further. * \param input The input file * \param failed_on Context of the check. It will be used to construct * the error message. */ static void check(const std::ifstream & input, const std::string & failed_on="data") throw (e_read_failure); }; } // namespace mp3 } // namespace net_outlyer #endif // ONET_MP3ELEMENT_H /* vim:set ts=4 et ai: */