gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libmedia/FLVParser.cpp libmedia...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libmedia/FLVParser.cpp libmedia...
Date: Mon, 16 Jun 2008 11:16:13 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/06/16 11:16:13

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

Log message:
        * libmedia/MediaParser.{cpp,h}: move _bytesLoaded to superclass, don't
          forget to initialize _seekRequested(), move parser thread starter
          in its own method so subclasses can do other initializations before
          starting it.
        * libmedia/FLVParser.{cpp,h}: start parser thread after having
          parsed the header.
        * libmedia/ffmpeg/MediaParserFfmpeg.{cpp,h}: start the parser thread
          after having initialized the parser.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6939&r2=1.6940
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/FLVParser.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/FLVParser.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaParser.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaParser.h?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaParserFfmpeg.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaParserFfmpeg.h?cvsroot=gnash&r1=1.10&r2=1.11

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6939
retrieving revision 1.6940
diff -u -b -r1.6939 -r1.6940
--- ChangeLog   16 Jun 2008 09:45:45 -0000      1.6939
+++ ChangeLog   16 Jun 2008 11:16:09 -0000      1.6940
@@ -1,5 +1,16 @@
 2008-06-16 Sandro Santilli <address@hidden>
 
+       * libmedia/MediaParser.{cpp,h}: move _bytesLoaded to superclass, don't
+         forget to initialize _seekRequested(), move parser thread starter
+         in its own method so subclasses can do other initializations before
+         starting it.
+       * libmedia/FLVParser.{cpp,h}: start parser thread after having
+         parsed the header.
+       * libmedia/ffmpeg/MediaParserFfmpeg.{cpp,h}: start the parser thread
+         after having initialized the parser.
+
+2008-06-16 Sandro Santilli <address@hidden>
+
        * libmedia/MediaParser.cpp: fix members initialization order.
 
 2008-06-16 Sandro Santilli <address@hidden>

Index: libmedia/FLVParser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/FLVParser.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- libmedia/FLVParser.cpp      16 Jun 2008 09:05:01 -0000      1.18
+++ libmedia/FLVParser.cpp      16 Jun 2008 11:16:11 -0000      1.19
@@ -43,7 +43,6 @@
        :
        MediaParser(lt),
        _lastParsedPosition(0),
-       _bytesLoaded(0),
        _nextAudioFrame(0),
        _nextVideoFrame(0),
        _audio(false),
@@ -51,6 +50,7 @@
 {
        if ( ! parseHeader() ) 
                throw GnashException("FLVParser couldn't parse header from 
input");
+       startParserThread();
 }
 
 FLVParser::~FLVParser()
@@ -384,7 +384,6 @@
 FLVParser::getBytesLoaded() const
 {
        boost::mutex::scoped_lock lock(_bytesLoadedMutex);
-       //log_debug("FLVParser::getBytesLoaded returning %d/%d", _bytesLoaded, 
_stream->size()); // _stream->size would need mutex-protection..
        return _bytesLoaded;
 }
 

Index: libmedia/FLVParser.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/FLVParser.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- libmedia/FLVParser.h        16 Jun 2008 09:05:01 -0000      1.17
+++ libmedia/FLVParser.h        16 Jun 2008 11:16:11 -0000      1.18
@@ -209,12 +209,6 @@
        /// flag, if found to be true will clear the buffers and reset to false.
        bool _seekRequested;
 
-       /// Number of bytes loaded
-       boost::uint64_t _bytesLoaded;
-
-       /// Mutex protecting _bytesLoaded (read by main, set by parser)
-       mutable boost::mutex _bytesLoadedMutex;
-
        /// Audio frame cursor position 
        //
        /// This is the video frame number that will

Index: libmedia/MediaParser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/MediaParser.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libmedia/MediaParser.cpp    16 Jun 2008 09:45:46 -0000      1.4
+++ libmedia/MediaParser.cpp    16 Jun 2008 11:16:11 -0000      1.5
@@ -33,10 +33,18 @@
        _stream(stream),
        _parsingComplete(false),
        _bufferTime(100), // 100 ms 
+       _seekRequest(false),
+       _bytesLoaded(0),
        _parserThread(0),
        _parserThreadStartBarrier(2),
        _parserThreadKillRequested(false)
 {
+}
+
+/*protected*/
+void
+MediaParser::startParserThread()
+{
 #ifdef LOAD_MEDIA_IN_A_SEPARATE_THREAD
        log_debug("Starting MediaParser thread");
        _parserThread.reset( new boost::thread(boost::bind(parserLoopStarter, 
this)) );

Index: libmedia/MediaParser.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/MediaParser.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- libmedia/MediaParser.h      16 Jun 2008 09:05:02 -0000      1.25
+++ libmedia/MediaParser.h      16 Jun 2008 11:16:12 -0000      1.26
@@ -376,6 +376,8 @@
 
 protected:
 
+       /// Start the parser thread
+       void startParserThread();
 
        /// Clear the a/v buffers
        void clearBuffers();
@@ -473,6 +475,12 @@
        /// mutex protecting access to the a/v encoded frames queues
        mutable boost::mutex _qMutex;
 
+       /// Number of bytes loaded
+       boost::uint64_t _bytesLoaded;
+
+       /// Mutex protecting _bytesLoaded (read by main, set by parser)
+       mutable boost::mutex _bytesLoadedMutex;
+
 private:
 
        // Method to check if buffer is full w/out locking the _qMutex

Index: libmedia/ffmpeg/MediaParserFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/MediaParserFfmpeg.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- libmedia/ffmpeg/MediaParserFfmpeg.cpp       16 Jun 2008 09:05:02 -0000      
1.14
+++ libmedia/ffmpeg/MediaParserFfmpeg.cpp       16 Jun 2008 11:16:12 -0000      
1.15
@@ -192,6 +192,10 @@
 bool
 MediaParserFfmpeg::parseNextFrame()
 {
+       // lock the stream while reading from it, so actionscript
+       // won't mess with the parser on seek  or on getBytesLoaded
+       boost::mutex::scoped_lock streamLock(_streamMutex);
+
        if ( _parsingComplete )
        {
                log_debug("MediaParserFfmpeg::parseNextFrame: parsing complete, 
nothing to do");
@@ -280,6 +284,15 @@
        _audioStream(0),
        _lastParsedPosition(0)
 {
+       initializeParser();
+
+       startParserThread();
+}
+
+/*private*/
+void
+MediaParserFfmpeg::initializeParser()
+{
        av_register_all(); // TODO: needs to be invoked only once ?
 
        _byteIOCxt.buffer = NULL;
@@ -291,6 +304,7 @@
        }
 
        _formatCtx = av_alloc_format_context();
+       assert(_formatCtx);
 
        // Setup the filereader/seeker mechanism. 7th argument (NULL) is the 
writer function,
        // which isn't needed.
@@ -310,7 +324,7 @@
        // Open the stream. the 4th argument is the filename, which we ignore.
        if(av_open_input_stream(&_formatCtx, &_byteIOCxt, "", _inputFmt, NULL) 
< 0)
        {
-               throw GnashException("MediaParserFfmpeg couldn't open input 
stream");
+               throw IOException("MediaParserFfmpeg couldn't open input 
stream");
        }
 
        // Find audio and video stream
@@ -369,9 +383,9 @@
 #endif
                _audioInfo.reset( new AudioInfo(codec, sampleRate, sampleSize, 
stereo, duration, FFMPEG /*codec type*/) );
        }
-
 }
 
+
 MediaParserFfmpeg::~MediaParserFfmpeg()
 {
 

Index: libmedia/ffmpeg/MediaParserFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/MediaParserFfmpeg.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libmedia/ffmpeg/MediaParserFfmpeg.h 16 Jun 2008 09:05:02 -0000      1.10
+++ libmedia/ffmpeg/MediaParserFfmpeg.h 16 Jun 2008 11:16:12 -0000      1.11
@@ -75,6 +75,10 @@
 
 private:
 
+       /// Initialize parser, figuring format and 
+       /// creating VideoInfo and AudioInfo objects
+       void initializeParser();
+
        /// Video frame cursor position 
        //
        /// This is the video frame number that will




reply via email to

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