Skip to content

Commit

Permalink
Improve auto-detection of bitrate, and removed a debug print
Browse files Browse the repository at this point in the history
  • Loading branch information
elan committed Jul 27, 2009
1 parent bd75125 commit 81bac7e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
1 change: 0 additions & 1 deletion xbmc/cores/CoreAudioAUHAL.cpp
Expand Up @@ -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);
Expand Down
24 changes: 23 additions & 1 deletion xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 81bac7e

Please sign in to comment.