/* * 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_common.h 744 2007-05-23 19:12:43Z $ #ifndef ONET_MP3COMMON_H #define ONET_MP3COMMON_H #include #include #include #include namespace net_outlyer { namespace mp3 { // Classes defined elsewhere struct mp3frame; // Used to call read functions in a more compact way #define CHARR(a) (reinterpret_cast((a))) //! Type for bitrate in kbps typedef int16_t bitrate_t; //! Type for numbers of frames typedef uint32_t numframes_t; // Extern declarations for the modules that include this file extern const bitrate_t BAD_BITRATE; //! \deprecated TO be phased out extern const uint8_t BITRATE_TABLE_LEN; extern const bitrate_t BITRATE_TABLE[]; //! Generic error class e_error { private: std::string msg; public: const int error_code; e_error(const std::string & s, int errcode = EX_SOFTWARE); e_error() : msg("Undefined internal error"), error_code(EX_SOFTWARE) {} const std::string & get_msg() const; }; class e_read_failure : public e_error { public: e_read_failure(const std::string & msg, int errcode = EX_IOERR) : e_error(msg, errcode) {} e_read_failure() : e_error("Failed to read data.", EX_IOERR) {} }; struct e_bad_filetype : public e_error { public: e_bad_filetype(); protected: e_bad_filetype(const std::string & m, const int errcode = EX_DATAERR) : e_error(m, errcode) {} }; /*! * \brief MPEG Version * \note The values match the bit in the header */ enum mpeg_version_t { MPEG2_5 = 0x00, //!< MPEG 2.5 (unofficial) _version_reserved = 0x01, // bitrate_table_t; /*! * \brief Constant Iterator for tables of bitrate distribution * \see bitrate_table_t */ typedef bitrate_table_t::const_iterator bitrate_table_constit_t; //! Vector of frames typedef std::vector frame_vector_t; /*! * \brief Contant Iterator for vectors of frames * \see frame_vector_t */ typedef frame_vector_t::const_iterator frame_vector_constit_t; } // namespace mp3 } // namespace net_outlyer #endif // ONET_MP3COMMON_H /* vim:set ts=4 et ai: */