* Coding style.
* Always use keyframes. The BMediaTrack may not be able to implement FindKeyFrameForFrame(), so the detection may not work even though the track really does use keyframes. If it doesn't, then no harm is done anyway. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38721 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -239,8 +239,11 @@ MediaTrackAudioSupplier::_InitFromTrack()
|
|||||||
TRACE("_InitFromTrack()\n");
|
TRACE("_InitFromTrack()\n");
|
||||||
// Try to suggest a big buffer size, we do a lot of caching...
|
// Try to suggest a big buffer size, we do a lot of caching...
|
||||||
fFormat.u.raw_audio.buffer_size = 16384;
|
fFormat.u.raw_audio.buffer_size = 16384;
|
||||||
if (fMediaTrack && fMediaTrack->DecodedFormat(&fFormat) == B_OK
|
if (fMediaTrack == NULL || fMediaTrack->DecodedFormat(&fFormat) != B_OK
|
||||||
&& fFormat.type == B_MEDIA_RAW_AUDIO) {
|
|| fFormat.type != B_MEDIA_RAW_AUDIO) {
|
||||||
|
fMediaTrack = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef TRACE_AUDIO_SUPPLIER
|
#ifdef TRACE_AUDIO_SUPPLIER
|
||||||
char formatString[256];
|
char formatString[256];
|
||||||
@@ -258,6 +261,7 @@ MediaTrackAudioSupplier::_InitFromTrack()
|
|||||||
// key frame.
|
// key frame.
|
||||||
// Note: It shouldn't harm that much, if we're wrong and the
|
// Note: It shouldn't harm that much, if we're wrong and the
|
||||||
// track has key frame although we found out that it has not.
|
// track has key frame although we found out that it has not.
|
||||||
|
#if 0
|
||||||
int64 keyFrame0 = 0;
|
int64 keyFrame0 = 0;
|
||||||
int64 keyFrame1 = 1;
|
int64 keyFrame1 = 1;
|
||||||
fMediaTrack->FindKeyFrameForFrame(&keyFrame0,
|
fMediaTrack->FindKeyFrameForFrame(&keyFrame0,
|
||||||
@@ -265,14 +269,17 @@ MediaTrackAudioSupplier::_InitFromTrack()
|
|||||||
fMediaTrack->FindKeyFrameForFrame(&keyFrame1,
|
fMediaTrack->FindKeyFrameForFrame(&keyFrame1,
|
||||||
B_MEDIA_SEEK_CLOSEST_BACKWARD);
|
B_MEDIA_SEEK_CLOSEST_BACKWARD);
|
||||||
fHasKeyFrames = (keyFrame0 == keyFrame1);
|
fHasKeyFrames = (keyFrame0 == keyFrame1);
|
||||||
|
#else
|
||||||
|
fHasKeyFrames = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// get the length of the track
|
// get the length of the track
|
||||||
fCountFrames = fMediaTrack->CountFrames();
|
fCountFrames = fMediaTrack->CountFrames();
|
||||||
|
|
||||||
TRACE("_InitFromTrack(): keyframes: %d, frame count: %lld\n",
|
TRACE("_InitFromTrack(): keyframes: %d, frame count: %lld\n",
|
||||||
fHasKeyFrames, fCountFrames);
|
fHasKeyFrames, fCountFrames);
|
||||||
} else
|
printf("_InitFromTrack(): keyframes: %d, frame count: %lld\n",
|
||||||
fMediaTrack = NULL;
|
fHasKeyFrames, fCountFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _FramesPerBuffer
|
// _FramesPerBuffer
|
||||||
|
|||||||
Reference in New Issue
Block a user