/* * 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.cc 745 2007-05-23 23:51:24Z $ #include #include "mp3_bitrate_dist.h" #include "mp3_frame.h" namespace net_outlyer { namespace mp3 { bitrate_distribution::bitrate_distribution() : max(0), is_filled(false) { for (int i=0; ibitrate]++; if (max < table[it->bitrate]) { max=table[it->bitrate]; } } is_filled = true; } bitrate_table_constit_t bitrate_distribution::begin() const { assert( is_filled ); // bitrate_table_t is sorted, the invalid value is < 0, so it will be // at the start, jump over it bitrate_table_constit_t it = table.begin(); // Let's self-protect from future changes... assert( it->first == BAD_BITRATE ); it++; assert( it->first >= 0 ); return it; } numframes_t bitrate_distribution::bad_frames() const { assert( is_filled ); bitrate_table_constit_t it = table.begin(); // As in begin(), BAD_BITRATE should be at the start and have a negative key assert( it->first == BAD_BITRATE ); return it->second; } } // namespace mp3 } // namespace net_outlyer /* vim:set ts=4 et ai: */