Permalink
Browse files

Improve auto-detection of bitrate, and removed a debug print

  • Loading branch information...
1 parent bd75125 commit 81bac7e1d5b04911fca774028ae1c8f12a5ca7ea @elan elan committed Jul 27, 2009
Showing with 23 additions and 2 deletions.
  1. +0 −1 xbmc/cores/CoreAudioAUHAL.cpp
  2. +23 −1 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -514,7 +514,6 @@ int CoreAudioAUHAL::OpenPCM(struct CoreAudioDeviceParameters *deviceParameters,
deviceParameters->outputBuffer = (PaUtilRingBuffer *)malloc(sizeof(PaUtilRingBuffer));
deviceParameters->outputBufferData = malloc(framecount * deviceParameters->stream_format.mBytesPerFrame);
- printf("Size of ring buffer is %d bytes.\n", deviceParameters->stream_format.mBytesPerFrame * framecount);
PaUtil_InitializeRingBuffer(deviceParameters->outputBuffer,
deviceParameters->stream_format.mBytesPerFrame,
framecount, deviceParameters->outputBufferData);
@@ -880,7 +880,29 @@ int CDVDDemuxFFmpeg::GetStreamBitrate()
if (!m_pFormatContext)
return 0;
- return m_pFormatContext->bit_rate;
+ // Get the bitrate of the file.
+ int overallBitrate = m_pFormatContext->bit_rate;
+
+ // Get the aggregate bitrate of the streams.
+ int aggregateBitrate = 0;
+ int numStreams = GetNrOfStreams();
+ bool missingStreamInfo = false;
+
+ for (int i=0; i<numStreams; i++)
+ {
+ CDemuxStream* stream = GetStream(i);
+ aggregateBitrate += stream->iBitRate;
+
+ if (stream->iBitRate == 0)
+ missingStreamInfo = true;
+ }
+
+ printf("Aggregate bitrate = %d, file bitrate = %d.\n", aggregateBitrate, overallBitrate);
+
+ if (missingStreamInfo)
+ return overallBitrate;
+ else
+ return aggregateBitrate;
}
CDemuxStream* CDVDDemuxFFmpeg::GetStream(int iStreamId)

0 comments on commit 81bac7e

Please sign in to comment.