mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioControllerUtility/Src/MP3AudioControllerUtility.cpp
branchRCL_3
changeset 17 3570217d8c21
parent 0 71ca22bcf22a
equal deleted inserted replaced
13:f5c5c82a163e 17:3570217d8c21
   173 	iNumFrames = aNumFrames;
   173 	iNumFrames = aNumFrames;
   174 	
   174 	
   175 	TInt frameBytes = 0;
   175 	TInt frameBytes = 0;
   176 	TInt avgFrameLen = 0;
   176 	TInt avgFrameLen = 0;
   177 	TInt frames = 0;
   177 	TInt frames = 0;
       
   178 	TInt scaling=0;
       
   179 	TInt round=0;
   178 	// We could have used the bitrate found above for CBR MP3 content and not continue to average
   180 	// We could have used the bitrate found above for CBR MP3 content and not continue to average
   179 	// the bitrate. However, some users can manipulated the file and append other bitrate content.
   181 	// the bitrate. However, some users can manipulated the file and append other bitrate content.
   180 	// Since it is not too difficult, we can update the bitrate above with an averaged bitrate.
   182 	// Since it is not too difficult, we can update the bitrate above with an averaged bitrate.
   181 	// If we want to only use the bitate above for cbr, we would set the bitrate frozen flag and
   183 	// If we want to only use the bitate above for cbr, we would set the bitrate frozen flag and
   182 	// on the condition that it's not iFormatIsVBR and the bitrate is non-zero. 
   184 	// on the condition that it's not iFormatIsVBR and the bitrate is non-zero. 
   201 			{
   203 			{
   202 			frameBytes += frameLen;
   204 			frameBytes += frameLen;
   203 			frames++;    	        	
   205 			frames++;    	        	
   204 			}	
   206 			}	
   205 		avgFrameLen = frameBytes / frames; // frames is always non-zero here
   207 		avgFrameLen = frameBytes / frames; // frames is always non-zero here
       
   208 		scaling = frameBytes*10/frames;
       
   209 		round = scaling%10;
       
   210 		if(round > 5)
       
   211 		    {
       
   212 		     ++avgFrameLen;
       
   213 		    }
   206 		}
   214 		}
   207 	iBitRate = (avgFrameLen * 8 * iSamplingRate) / iSamplesPerFrame;
   215 	iBitRate = (avgFrameLen * 8 * iSamplingRate) / iSamplesPerFrame;
   208 	}
   216 	}
   209 
   217 
   210 // -----------------------------------------------------------------------------
   218 // -----------------------------------------------------------------------------