gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libbase/LoadThread.cpp libbase/...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libbase/LoadThread.cpp libbase/...
Date: Tue, 10 Jun 2008 06:12:12 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/06/10 06:12:12

Modified files:
        .              : ChangeLog 
        libbase        : LoadThread.cpp LoadThread.h 
        libmedia       : FLVParser.cpp MediaParser.cpp MediaParser.h 
        libmedia/ffmpeg: MediaParserFfmpeg.cpp 

Log message:
        * libbase/LoadThread.{cpp,h}: change seek to return 0 on success
          and -1 on error (to be closer to IOChannel iface). There were no
          users of it, I tested. Note that seek() doesn't do what dox say
          (ie: block) so that'll need to be fixed next ...
        * libmedia/FLVParser.cpp: don't assume _stream is an IOChannel.
        * libmedia/MediaParser.{cpp,h}: don't inline the constructor.
        * libmedia/ffmpeg/MediaParserFfmpeg.cpp: don't assume _stream is
          an IOChannel.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6877&r2=1.6878
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.cpp?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.h?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/FLVParser.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaParser.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaParser.h?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaParserFfmpeg.cpp?cvsroot=gnash&r1=1.12&r2=1.13

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6877
retrieving revision 1.6878
diff -u -b -r1.6877 -r1.6878
--- ChangeLog   10 Jun 2008 05:25:58 -0000      1.6877
+++ ChangeLog   10 Jun 2008 06:12:10 -0000      1.6878
@@ -1,3 +1,14 @@
+2008-06-10 Sandro Santilli <address@hidden>
+
+       * libbase/LoadThread.{cpp,h}: change seek to return 0 on success
+         and -1 on error (to be closer to IOChannel iface). There were no
+         users of it, I tested. Note that seek() doesn't do what dox say
+         (ie: block) so that'll need to be fixed next ...
+       * libmedia/FLVParser.cpp: don't assume _stream is an IOChannel.
+       * libmedia/MediaParser.{cpp,h}: don't inline the constructor.
+       * libmedia/ffmpeg/MediaParserFfmpeg.cpp: don't assume _stream is 
+         an IOChannel.
+
 2008-06-10 Benjamin Wolsey <address@hidden>
 
        * server/asobj/flash/geom/Matrix_as.cpp: add optional debugging output;

Index: libbase/LoadThread.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- libbase/LoadThread.cpp      9 Jun 2008 20:27:13 -0000       1.26
+++ libbase/LoadThread.cpp      10 Jun 2008 06:12:11 -0000      1.27
@@ -121,7 +121,8 @@
        }
 }
 
-bool LoadThread::seek(size_t pos)
+int
+LoadThread::seek(size_t pos)
 {
        // Try to seek to the wanted position, and return
        // true is the new position is equal the wanted,
@@ -129,10 +130,10 @@
 
        if (_loadPosition >= static_cast<long>(pos)) {
                _userPosition = pos;
-               return true;
+               return 0;
        } else {
                _userPosition = _loadPosition;
-               return false;
+               return -1;
        }
 }
 

Index: libbase/LoadThread.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- libbase/LoadThread.h        9 Jun 2008 20:27:13 -0000       1.21
+++ libbase/LoadThread.h        10 Jun 2008 06:12:11 -0000      1.22
@@ -70,9 +70,13 @@
        bool setStream(std::auto_ptr<gnash::IOChannel> str);
 
        /// Put read pointer at given position
+       //
        /// Will block if there is not enough data buffered,
        /// and wait until enough data is present.
-       bool seek(size_t pos);
+       ///
+       /// @return 0 on success, -1 on error (EOF).
+       ///
+       int seek(size_t pos);
 
        /// Read 'bytes' bytes into the given buffer.
        /// Return number of actually read bytes.

Index: libmedia/FLVParser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/FLVParser.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- libmedia/FLVParser.cpp      9 Jun 2008 19:08:26 -0000       1.16
+++ libmedia/FLVParser.cpp      10 Jun 2008 06:12:11 -0000      1.17
@@ -59,12 +59,19 @@
 
 
 boost::uint32_t
-FLVParser::seek(boost::uint32_t /*time*/)
+FLVParser::seek(boost::uint32_t time)
 {
+       if ( time ) // seek to 0 should be fine..
+       {
        LOG_ONCE( log_unimpl("%s", __PRETTY_FUNCTION__) );
+       }
 
        // In particular, what to do if there's no frames in queue ?
        // just seek to the the later available first timestamp
+       _audioFrames.clear();
+       _videoFrames.clear();
+       _stream->seek(0);
+       _parsingComplete=false;
        return 0;
 }
 
@@ -303,15 +310,14 @@
 FLVParser::getBytesLoaded() const
 {
        return _lastParsedPosition;
+       //return _stream->getBytesLoaded();
 }
 
 /*private*/
 std::auto_ptr<EncodedAudioFrame>
 FLVParser::readAudioFrame(boost::uint32_t dataSize, boost::uint32_t timestamp)
 {
-       IOChannel& in = *_stream;
-
-       //log_debug("Reading the %dth audio frame, with data size %d, from 
position %d", _audioFrames.size()+1, dataSize, in.tell());
+       //log_debug("Reading the %dth audio frame, with data size %d, from 
position %d", _audioFrames.size()+1, dataSize, _stream->tell());
 
        std::auto_ptr<EncodedAudioFrame> frame ( new EncodedAudioFrame );
        frame->dataSize = dataSize;
@@ -320,7 +326,7 @@
        unsigned long int chunkSize = smallestMultipleContaining(READ_CHUNKS, 
dataSize+PADDING_BYTES);
 
        frame->data.reset( new boost::uint8_t[chunkSize] );
-       size_t bytesread = in.read(frame->data.get(), dataSize);
+       size_t bytesread = _stream->read(frame->data.get(), dataSize);
        if ( bytesread < dataSize )
        {
                log_error("FLVParser::readAudioFrame: could only read %d/%d 
bytes", bytesread, dataSize);
@@ -337,14 +343,12 @@
 std::auto_ptr<EncodedVideoFrame>
 FLVParser::readVideoFrame(boost::uint32_t dataSize, boost::uint32_t timestamp)
 {
-       IOChannel& in = *_stream;
-
        std::auto_ptr<EncodedVideoFrame> frame;
 
        unsigned long int chunkSize = smallestMultipleContaining(READ_CHUNKS, 
dataSize+PADDING_BYTES);
 
        boost::uint8_t* data = new boost::uint8_t[chunkSize];
-       size_t bytesread = in.read(data, dataSize);
+       size_t bytesread = _stream->read(data, dataSize);
 
        unsigned long int padding = chunkSize-dataSize;
        assert(padding);

Index: libmedia/MediaParser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/MediaParser.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libmedia/MediaParser.cpp    6 Jun 2008 16:45:08 -0000       1.1
+++ libmedia/MediaParser.cpp    10 Jun 2008 06:12:12 -0000      1.2
@@ -24,6 +24,17 @@
 namespace gnash {
 namespace media {
 
+MediaParser::MediaParser(std::auto_ptr<IOChannel> stream)
+       :
+       _isAudioMp3(false),
+       _isAudioNellymoser(false),
+       _stream(stream),
+       //_stream(new LoadThread),
+       _parsingComplete(false)
+{
+       //_stream->setStream(stream);
+}
+
 boost::uint64_t
 MediaParser::getBufferLength() const
 {

Index: libmedia/MediaParser.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/MediaParser.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- libmedia/MediaParser.h      9 Jun 2008 18:12:55 -0000       1.23
+++ libmedia/MediaParser.h      10 Jun 2008 06:12:12 -0000      1.24
@@ -226,13 +226,7 @@
 {
 public:
 
-       MediaParser(std::auto_ptr<IOChannel> stream)
-               :
-               _isAudioMp3(false),
-               _isAudioNellymoser(false),
-               _stream(stream),
-               _parsingComplete(false)
-       {}
+       MediaParser(std::auto_ptr<IOChannel> stream);
 
        // Classes with virtual methods (virtual classes)
        // must have a virtual destructor, or the destructors

Index: libmedia/ffmpeg/MediaParserFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/MediaParserFfmpeg.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- libmedia/ffmpeg/MediaParserFfmpeg.cpp       9 Jun 2008 19:08:26 -0000       
1.12
+++ libmedia/ffmpeg/MediaParserFfmpeg.cpp       10 Jun 2008 06:12:12 -0000      
1.13
@@ -400,10 +400,7 @@
        //GNASH_REPORT_FUNCTION;
        log_debug("readPacket(%d)", buf_size);
 
-       assert( _stream.get() );
-       IOChannel& in = *_stream;
-
-       size_t ret = in.read(static_cast<void*>(buf), buf_size);
+       size_t ret = _stream->read(static_cast<void*>(buf), buf_size);
 
        return ret;
 
@@ -415,28 +412,27 @@
        GNASH_REPORT_FUNCTION;
 
        assert(_stream.get());
-       IOChannel& in = *(_stream);
 
        // Offset is absolute new position in the file
        if (whence == SEEK_SET)
        {       
-               in.seek(offset);
+               _stream->seek(offset);
                // New position is offset + old position
        }
        else if (whence == SEEK_CUR)
        {
-               in.seek(in.tell() + offset);
+               _stream->seek(_stream->tell() + offset);
                // New position is offset + end of file
        }
        else if (whence == SEEK_END)
        {
                // This is (most likely) a streamed file, so we can't seek to 
the end!
                // Instead we seek to byteIOBufferSize bytes... seems to work 
fine...
-               in.seek(byteIOBufferSize);
+               _stream->seek(byteIOBufferSize);
 
        }
 
-       return in.tell(); 
+       return _stream->tell(); 
 }
 
 boost::uint16_t




reply via email to

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