Correct display of Duration

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26976 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
David McPaul 2008-08-14 23:09:14 +00:00
parent 4431edd453
commit 84b6bd9a95
3 changed files with 12 additions and 4 deletions

View File

@ -126,6 +126,7 @@ Controller::~Controller()
int64
Controller::Duration()
{
// This should really be total frames (video frames at that)
// TODO: It is not so nice that the MediaPlayer still measures
// in video frames if only playing audio. Here for example, it will
// return a duration of 0 if the audio clip happens to be shorter than
@ -221,12 +222,19 @@ Controller::SetTo(const entry_ref &ref)
BMediaTrack* t = mf->TrackAt(i);
media_format f;
err = t->EncodedFormat(&f);
if (err != B_OK || t->Duration() <= 0) {
if (err != B_OK) {
printf("Controller::SetTo: EncodedFormat failed for track index %d, error 0x%08lx (%s)\n",
i, err, strerror(err));
mf->ReleaseTrack(t);
continue;
}
if (t->Duration() <= 0) {
printf("Controller::SetTo: track index %d has no duration\n",i);
mf->ReleaseTrack(t);
continue;
}
if (f.IsAudio()) {
if (!fAudioTrackList.AddItem(t))
return B_NO_MEMORY;

View File

@ -321,7 +321,7 @@ printf("InfoWin::Update(0x%08lx)\n", which);
if ((which & INFO_STATS) && fController->HasFile()) {
fLabelsView->Insert("Duration\n");
BString s;
bigtime_t d = fController->Duration();
bigtime_t d = fController->TimeDuration();
bigtime_t v;
//s << d << "µs; ";

View File

@ -715,7 +715,7 @@ VideoProducer::_FrameGeneratorThread()
"Terminating video producer frame generator thread.\n");
TRACE("_FrameGeneratorThread: frame generator thread done.\n");
// do not access any member variables, since this could
// also me the Node has been deleted
// also mean the Node has been deleted
return B_OK;
}
@ -739,7 +739,7 @@ VideoProducer::_FrameGeneratorThread()
// nothing to do
} else if (nextWaitUntil < system_time()) {
// Drop frame if it's at least a frame late.
//printf("VideoProducer: dropped frame (%ld)\n", fFrame);
printf("VideoProducer: dropped frame (%Ld)\n", fFrame);
if (fManager->LockWithTimeout(10000) == B_OK) {
fManager->FrameDropped();
fManager->Unlock();