/* * 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_bitrate_dist.h 746 2007-05-24 00:55:42Z $ #ifndef ONET_BITRATE_DIST_H #define ONET_BITRATE_DIST_H #include "mp3_common.h" namespace net_outlyer { namespace mp3 { /*! * \brief Holds the bitrate distribution of a file * The bitrate distribution is table that maps a given nominal bitrate * to the number of frames that use this given bitrate. * \note It is only meant to be filled once. See fill_from()'s precondition * \note Free-form bitrates aren't currently handled * \see fill_from() */ class bitrate_distribution { private: //! The actual bitrate distribution table bitrate_table_t table; public: typedef bitrate_table_constit_t const_iterator; //! The maximum number of frames with the same bitrate numframes_t max; /*! * \brief true if a file has already been processed */ bool is_filled; bitrate_distribution(); /*! * \brief Fills the table with statatistics from a given * vector of frames. * \param frames The frames of a file * \param is_vbr true if the file is a vbr file * \pre ! is_filled */ void fill_from(const frame_vector_t & frames, bool is_vbr); // Let's hide implementation details /*! * \brief Returns a constant iterator to the first valid bitrate * \pre is_filled * \see bad_frames() * \see end() */ const_iterator begin() const; /*! * \brief Returns a constant iterator to the bitrate distribution end * \pre is_filled * \see begin() */ const_iterator end() const { return table.end(); } /*! * \brief Returns the number of frames with an invalid bitrate * \pre is_filled */ numframes_t bad_frames() const; }; } // namespace mp3 } // namespace net_outlyer #endif // ONET_BITRATE_DIST_H /* vim:set ts=4 et ai: */