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:
@@ -126,6 +126,7 @@ Controller::~Controller()
|
|||||||
int64
|
int64
|
||||||
Controller::Duration()
|
Controller::Duration()
|
||||||
{
|
{
|
||||||
|
// This should really be total frames (video frames at that)
|
||||||
// TODO: It is not so nice that the MediaPlayer still measures
|
// TODO: It is not so nice that the MediaPlayer still measures
|
||||||
// in video frames if only playing audio. Here for example, it will
|
// 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
|
// 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);
|
BMediaTrack* t = mf->TrackAt(i);
|
||||||
media_format f;
|
media_format f;
|
||||||
err = t->EncodedFormat(&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",
|
printf("Controller::SetTo: EncodedFormat failed for track index %d, error 0x%08lx (%s)\n",
|
||||||
i, err, strerror(err));
|
i, err, strerror(err));
|
||||||
mf->ReleaseTrack(t);
|
mf->ReleaseTrack(t);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (t->Duration() <= 0) {
|
||||||
|
printf("Controller::SetTo: track index %d has no duration\n",i);
|
||||||
|
mf->ReleaseTrack(t);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (f.IsAudio()) {
|
if (f.IsAudio()) {
|
||||||
if (!fAudioTrackList.AddItem(t))
|
if (!fAudioTrackList.AddItem(t))
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ printf("InfoWin::Update(0x%08lx)\n", which);
|
|||||||
if ((which & INFO_STATS) && fController->HasFile()) {
|
if ((which & INFO_STATS) && fController->HasFile()) {
|
||||||
fLabelsView->Insert("Duration\n");
|
fLabelsView->Insert("Duration\n");
|
||||||
BString s;
|
BString s;
|
||||||
bigtime_t d = fController->Duration();
|
bigtime_t d = fController->TimeDuration();
|
||||||
bigtime_t v;
|
bigtime_t v;
|
||||||
|
|
||||||
//s << d << "µs; ";
|
//s << d << "µs; ";
|
||||||
|
|||||||
@@ -715,7 +715,7 @@ VideoProducer::_FrameGeneratorThread()
|
|||||||
"Terminating video producer frame generator thread.\n");
|
"Terminating video producer frame generator thread.\n");
|
||||||
TRACE("_FrameGeneratorThread: frame generator thread done.\n");
|
TRACE("_FrameGeneratorThread: frame generator thread done.\n");
|
||||||
// do not access any member variables, since this could
|
// 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;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -739,7 +739,7 @@ VideoProducer::_FrameGeneratorThread()
|
|||||||
// nothing to do
|
// nothing to do
|
||||||
} else if (nextWaitUntil < system_time()) {
|
} else if (nextWaitUntil < system_time()) {
|
||||||
// Drop frame if it's at least a frame late.
|
// 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) {
|
if (fManager->LockWithTimeout(10000) == B_OK) {
|
||||||
fManager->FrameDropped();
|
fManager->FrameDropped();
|
||||||
fManager->Unlock();
|
fManager->Unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user