gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F...


From: Tomas Groth
Subject: [Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F...
Date: Wed, 16 May 2007 18:22:32 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Tomas Groth <tgc>       07/05/16 18:22:32

Modified files:
        .              : ChangeLog 
        libbase        : FLVParser.cpp FLVParser.h 
        server/asobj   : NetStream.cpp NetStream.h 

Log message:
                * libbase/FLVParser.{h,cpp}, server/asobj/NetStream.{h,cpp}: 
                  Implemented bufferLength.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3244&r2=1.3245
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/FLVParser.cpp?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/FLVParser.h?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.cpp?cvsroot=gnash&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.h?cvsroot=gnash&r1=1.32&r2=1.33

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3244
retrieving revision 1.3245
diff -u -b -r1.3244 -r1.3245
--- ChangeLog   16 May 2007 17:50:02 -0000      1.3244
+++ ChangeLog   16 May 2007 18:22:31 -0000      1.3245
@@ -2,6 +2,8 @@
 
        * server/asobj/NetStream.{h,cpp}, 
          server/asobj/NetStream{Gst,Ffmpeg}.{h,cpp}: Updated documentation.
+       * libbase/FLVParser.{h,cpp}, server/asobj/NetStream.{h,cpp}: 
+         Implemented bufferLength.
 
 2007-05-16 Sandro Santilli <address@hidden>
 

Index: libbase/FLVParser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/FLVParser.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- libbase/FLVParser.cpp       14 May 2007 11:32:49 -0000      1.11
+++ libbase/FLVParser.cpp       16 May 2007 18:22:31 -0000      1.12
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-// $Id: FLVParser.cpp,v 1.11 2007/05/14 11:32:49 tgc Exp $
+// $Id: FLVParser.cpp,v 1.12 2007/05/16 18:22:31 tgc Exp $
 
 #include "FLVParser.h"
 #include "amf.h"
@@ -44,6 +44,23 @@
        _audioFrames.clear();
 }
 
+
+uint32_t FLVParser::getBufferLength()
+{
+       if (_video) {
+               size_t size = _videoFrames.size();
+               if (size > 1 && size > _nextVideoFrame) {
+                       return _videoFrames.back()->timestamp - 
_videoFrames[_nextVideoFrame]->timestamp;
+               }
+       }
+       if (_audio) {
+               size_t size = _audioFrames.size();
+               if (size > 1 && size > _nextAudioFrame) {
+                       return _audioFrames.back()->timestamp - 
_audioFrames[_nextAudioFrame]->timestamp;
+               }
+       }
+       return 0;
+}
 uint16_t FLVParser::videoFrameRate()
 {
        boost::mutex::scoped_lock lock(_mutex);

Index: libbase/FLVParser.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/FLVParser.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- libbase/FLVParser.h 16 May 2007 17:38:23 -0000      1.7
+++ libbase/FLVParser.h 16 May 2007 18:22:32 -0000      1.8
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-// $Id: FLVParser.h,v 1.7 2007/05/16 17:38:23 strk Exp $
+// $Id: FLVParser.h,v 1.8 2007/05/16 18:22:32 tgc Exp $
 
 // Information about the FLV format can be found at http://osflash.org/flv
 
@@ -202,6 +202,11 @@
        /// Returns the framerate of the video
        uint16_t videoFrameRate();
 
+       /// Returns the "bufferlength", meaning the differens between the
+       /// current frames timestamp and the timestamp of the last parseable
+       /// frame. Returns the difference in milliseconds.
+       uint32_t getBufferLength();
+
 private:
 
        /// seeks to the closest possible position the given position,

Index: server/asobj/NetStream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- server/asobj/NetStream.cpp  16 May 2007 17:50:03 -0000      1.47
+++ server/asobj/NetStream.cpp  16 May 2007 18:22:32 -0000      1.48
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: NetStream.cpp,v 1.47 2007/05/16 17:50:03 tgc Exp $ */
+/* $Id: NetStream.cpp,v 1.48 2007/05/16 18:22:32 tgc Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -328,19 +328,8 @@
 {
        boost::intrusive_ptr<NetStream> ns = ensureType<NetStream>(fn.this_ptr);
 
-       bool warned = false;
-       if ( ! warned ) {
-               log_unimpl("NetStream.bufferLength getter/setter");
-               warned = true;
-       }
-       if ( fn.nargs == 0 ) // getter
-       {
-               return as_value();
-       }
-       else // setter
-       {
-               return as_value();
-       }
+       long ret = ns->bufferLength();
+       return as_value(ret);
 }
 
 // Both a getter and a (do-nothing) setter for bufferTime
@@ -530,6 +519,13 @@
        return _netCon->getBytesTotal();
 }
 
+long
+NetStream::bufferLength()
+{
+       if (m_parser == NULL) return 0;
+       return m_parser->getBufferLength();
+}
+
 bool
 NetStream::newFrameReady()
 {

Index: server/asobj/NetStream.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- server/asobj/NetStream.h    16 May 2007 17:50:03 -0000      1.32
+++ server/asobj/NetStream.h    16 May 2007 18:22:32 -0000      1.33
@@ -18,7 +18,7 @@
 //
 //
 
-/*  $Id: NetStream.h,v 1.32 2007/05/16 17:50:03 tgc Exp $ */
+/*  $Id: NetStream.h,v 1.33 2007/05/16 18:22:32 tgc Exp $ */
 
 #ifndef __NETSTREAM_H__
 #define __NETSTREAM_H__
@@ -196,6 +196,10 @@
        /// Returns the total number of bytes (size) of the media file
        long bytesTotal();
 
+       /// Returns the number of second of the media file that is buffered and 
+       /// yet to be played
+       long bufferLength();
+
        /// Tells us if there is a new video frame ready
        bool newFrameReady();
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]