* Changed the VideoSupplier interface to allow forcing the
video generation. This allows step back frame-wise even though it means the video has to seeked back far and re-generated more than five frames ahead to reach the seek frame. * Don't print dropped frames in the producer when the video is paused. * Don't lock the PlaybackManager to report dropped frames, report it later when the manager had to be locked anyway. * Removed a whole bunch of methods that were only implemened because of that old BeOS PPC compiler bug. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38670 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b80311be97
commit
892e4f21be
@ -80,13 +80,6 @@ VideoProducer::~VideoProducer()
|
||||
}
|
||||
|
||||
|
||||
port_id
|
||||
VideoProducer::ControlPort() const
|
||||
{
|
||||
return BMediaNode::ControlPort();
|
||||
}
|
||||
|
||||
|
||||
BMediaAddOn*
|
||||
VideoProducer::AddOn(int32* _internalId) const
|
||||
{
|
||||
@ -111,13 +104,6 @@ VideoProducer::SetTimeSource(BTimeSource* timeSource)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
VideoProducer::RequestCompleted(const media_request_info& info)
|
||||
{
|
||||
return BMediaNode::RequestCompleted(info);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VideoProducer::NodeRegistered()
|
||||
{
|
||||
@ -173,29 +159,6 @@ VideoProducer::Seek(bigtime_t media_time, bigtime_t performanceTime)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VideoProducer::TimeWarp(bigtime_t at_real_time, bigtime_t to_performance_time)
|
||||
{
|
||||
BMediaEventLooper::TimeWarp(at_real_time, to_performance_time);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
VideoProducer::AddTimer(bigtime_t at_performance_time, int32 cookie)
|
||||
{
|
||||
return BMediaEventLooper::AddTimer(at_performance_time, cookie);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VideoProducer::SetRunMode(run_mode mode)
|
||||
{
|
||||
printf("VideoProducer::SetRunMode(%d)\n", mode);
|
||||
TRACE("SetRunMode(%d)\n", mode);
|
||||
BMediaEventLooper::SetRunMode(mode);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VideoProducer::HandleEvent(const media_timed_event* event,
|
||||
bigtime_t lateness, bool realTimeEvent)
|
||||
@ -225,27 +188,6 @@ VideoProducer::HandleEvent(const media_timed_event* event,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VideoProducer::CleanUpEvent(const media_timed_event *event)
|
||||
{
|
||||
BMediaEventLooper::CleanUpEvent(event);
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
VideoProducer::OfflineTime()
|
||||
{
|
||||
return BMediaEventLooper::OfflineTime();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
VideoProducer::ControlLoop()
|
||||
{
|
||||
BMediaEventLooper::ControlLoop();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
VideoProducer::DeleteHook(BMediaNode* node)
|
||||
{
|
||||
@ -444,7 +386,7 @@ VideoProducer::Connect(status_t error, const media_source& source,
|
||||
ERROR("Connect() - wrong source.\n");
|
||||
return;
|
||||
}
|
||||
if (error < B_OK) {
|
||||
if (error != B_OK) {
|
||||
ERROR("Connect() - consumer error: %s\n", strerror(error));
|
||||
return;
|
||||
}
|
||||
@ -696,6 +638,8 @@ VideoProducer::_FrameGeneratorThread()
|
||||
case B_OK: {
|
||||
TRACE("_FrameGeneratorThread: node manager successfully "
|
||||
"locked\n");
|
||||
if (droppedFrames > 0)
|
||||
fManager->FrameDropped();
|
||||
// get the times for the current and the next frame
|
||||
performanceTime = fManager->TimeForFrame(fFrame);
|
||||
nextPerformanceTime = fManager->TimeForFrame(fFrame + 1);
|
||||
@ -749,14 +693,12 @@ VideoProducer::_FrameGeneratorThread()
|
||||
if (ignoreEvent || !fRunning || !fEnabled) {
|
||||
TRACE("_FrameGeneratorThread: ignore event\n");
|
||||
// nothing to do
|
||||
} else if (nextWaitUntil < system_time() - fBufferLatency
|
||||
} else if (!forceSendingBuffer
|
||||
&& nextWaitUntil < system_time() - fBufferLatency
|
||||
&& droppedFrames < kMaxDroppedFrames) {
|
||||
// Drop frame if it's at least a frame late.
|
||||
printf("VideoProducer: dropped frame (%Ld)\n", fFrame);
|
||||
if (fManager->LockWithTimeout(10000) == B_OK) {
|
||||
fManager->FrameDropped();
|
||||
fManager->Unlock();
|
||||
}
|
||||
if (playingDirection > 0)
|
||||
printf("VideoProducer: dropped frame (%Ld)\n", fFrame);
|
||||
// next frame
|
||||
droppedFrames++;
|
||||
fFrame++;
|
||||
@ -772,8 +714,7 @@ VideoProducer::_FrameGeneratorThread()
|
||||
* fConnectedFormat.display.line_count, 0LL);
|
||||
if (buffer == NULL) {
|
||||
// Wait until a buffer becomes available again
|
||||
TRACE("_FrameGeneratorThread: no buffer!\n");
|
||||
// ERROR("_FrameGeneratorThread: no buffer!\n");
|
||||
ERROR("_FrameGeneratorThread: no buffer!\n");
|
||||
break;
|
||||
}
|
||||
// Fill out the details about this buffer.
|
||||
@ -802,7 +743,8 @@ VideoProducer::_FrameGeneratorThread()
|
||||
"playlistFrame: %Ld\n", fFrame, playlistFrame);
|
||||
bool wasCached = false;
|
||||
err = fSupplier->FillBuffer(playlistFrame,
|
||||
buffer->Data(), fConnectedFormat, wasCached);
|
||||
buffer->Data(), fConnectedFormat, forceSendingBuffer,
|
||||
wasCached);
|
||||
// clean the buffer if something went wrong
|
||||
if (err != B_OK) {
|
||||
// TODO: should use "back value" according
|
||||
|
@ -36,13 +36,11 @@ public:
|
||||
|
||||
// BMediaNode interface
|
||||
public:
|
||||
virtual port_id ControlPort() const;
|
||||
virtual BMediaAddOn* AddOn(int32* _internalId) const;
|
||||
virtual status_t HandleMessage(int32 message, const void* data,
|
||||
size_t size);
|
||||
protected:
|
||||
virtual void SetTimeSource(BTimeSource* timeSource);
|
||||
virtual status_t RequestCompleted(const media_request_info& info);
|
||||
|
||||
// BMediaEventLooper interface
|
||||
protected:
|
||||
@ -51,17 +49,9 @@ protected:
|
||||
virtual void Stop(bigtime_t performanceTime, bool immediate);
|
||||
virtual void Seek(bigtime_t mediaTime,
|
||||
bigtime_t performanceTime);
|
||||
virtual void TimeWarp(bigtime_t atRealTime,
|
||||
bigtime_t toPerformanceTime);
|
||||
virtual status_t AddTimer(bigtime_t atPerformanceTime,
|
||||
int32 cookie);
|
||||
virtual void SetRunMode(run_mode mode);
|
||||
virtual void HandleEvent(const media_timed_event* event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
virtual void CleanUpEvent(const media_timed_event* event);
|
||||
virtual bigtime_t OfflineTime();
|
||||
virtual void ControlLoop();
|
||||
virtual status_t DeleteHook(BMediaNode* node);
|
||||
|
||||
// BBufferProducer interface
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
virtual status_t FillBuffer(int64 startFrame, void* buffer,
|
||||
const media_raw_video_format& format,
|
||||
bool& wasCached) = 0;
|
||||
bool forceGeneration, bool& wasCached) = 0;
|
||||
|
||||
virtual void DeleteCaches();
|
||||
|
||||
|
@ -30,7 +30,8 @@ ProxyVideoSupplier::~ProxyVideoSupplier()
|
||||
|
||||
status_t
|
||||
ProxyVideoSupplier::FillBuffer(int64 startFrame, void* buffer,
|
||||
const media_raw_video_format& format, bool& wasCached)
|
||||
const media_raw_video_format& format, bool forceGeneration,
|
||||
bool& wasCached)
|
||||
{
|
||||
bigtime_t now = system_time();
|
||||
|
||||
@ -56,7 +57,7 @@ ProxyVideoSupplier::FillBuffer(int64 startFrame, void* buffer,
|
||||
// But don't do it for more than 5 frames, or we will take too much
|
||||
// time. Doing it this way will still catch up to the next keyframe
|
||||
// eventually (we may return the wrong frames until the next keyframe).
|
||||
if (startFrame - frame > 5)
|
||||
if (!forceGeneration && startFrame - frame > 5)
|
||||
return B_TIMED_OUT;
|
||||
while (frame < startFrame) {
|
||||
ret = fSupplier->ReadFrame(buffer, &performanceTime, format,
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
virtual status_t FillBuffer(int64 startFrame, void* buffer,
|
||||
const media_raw_video_format& format,
|
||||
bool& wasCached);
|
||||
bool forceGeneration, bool& wasCached);
|
||||
|
||||
virtual void DeleteCaches();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user