[haiku-commits] r38670 - in haiku/trunk/src/apps/mediaplayer: media_node_framework/video supplier

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 16 Sep 2010 14:43:42 +0200 (CEST)

Author: stippi
Date: 2010-09-16 14:43:41 +0200 (Thu, 16 Sep 2010)
New Revision: 38670
Changeset: http://dev.haiku-os.org/changeset/38670

Modified:
   haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp
   haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoProducer.h
   haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoSupplier.h
   haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp
   haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.h
Log:
 * 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.


Modified: 
haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp
===================================================================
--- 
haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp   
    2010-09-16 12:39:51 UTC (rev 38669)
+++ 
haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp   
    2010-09-16 12:43:41 UTC (rev 38670)
@@ -80,13 +80,6 @@
 }
 
 
-port_id
-VideoProducer::ControlPort() const
-{
-       return BMediaNode::ControlPort();
-}
-
-
 BMediaAddOn*
 VideoProducer::AddOn(int32* _internalId) const
 {
@@ -111,13 +104,6 @@
 }
 
 
-status_t
-VideoProducer::RequestCompleted(const media_request_info& info)
-{
-       return BMediaNode::RequestCompleted(info);
-}
-
-
 void
 VideoProducer::NodeRegistered()
 {
@@ -174,29 +160,6 @@
 
 
 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 @@
 }
 
 
-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 @@
                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 @@
                        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 @@
                                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 @@
                                                * 
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 @@
                                                "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

Modified: 
haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoProducer.h
===================================================================
--- haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoProducer.h 
2010-09-16 12:39:51 UTC (rev 38669)
+++ haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoProducer.h 
2010-09-16 12:43:41 UTC (rev 38670)
@@ -36,13 +36,11 @@
        
        // 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 @@
        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

Modified: 
haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoSupplier.h
===================================================================
--- haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoSupplier.h 
2010-09-16 12:39:51 UTC (rev 38669)
+++ haiku/trunk/src/apps/mediaplayer/media_node_framework/video/VideoSupplier.h 
2010-09-16 12:43:41 UTC (rev 38670)
@@ -20,7 +20,7 @@
 
        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();
 

Modified: haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp    
2010-09-16 12:39:51 UTC (rev 38669)
+++ haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp    
2010-09-16 12:43:41 UTC (rev 38670)
@@ -30,7 +30,8 @@
 
 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 @@
                // 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,

Modified: haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.h
===================================================================
--- haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.h      
2010-09-16 12:39:51 UTC (rev 38669)
+++ haiku/trunk/src/apps/mediaplayer/supplier/ProxyVideoSupplier.h      
2010-09-16 12:43:41 UTC (rev 38670)
@@ -20,7 +20,7 @@
 
        virtual status_t                        FillBuffer(int64 startFrame, 
void* buffer,
                                                                        const 
media_raw_video_format& format,
-                                                                       bool& 
wasCached);
+                                                                       bool 
forceGeneration, bool& wasCached);
 
        virtual void                            DeleteCaches();
 


Other related posts:

  • » [haiku-commits] r38670 - in haiku/trunk/src/apps/mediaplayer: media_node_framework/video supplier - superstippi