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: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F...
Date: Mon, 12 May 2008 08:15:10 +0000

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

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

Log message:
                * libbase/FLVParser.{cpp,h}: more dox about utility classes,
                  rename FLVVideoFrame and FLVAudioFrame to FLVVideoFrameInfo
                  and FLVAudioFrameInfo as they don't contain the actual data,
                  just offsets in the input.
                * server/asobj/NetStreamFfmpeg.cpp: update use of FLVVideoFrame
                  and FLVAudioFrame.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6584&r2=1.6585
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/FLVParser.cpp?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/FLVParser.h?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStreamFfmpeg.cpp?cvsroot=gnash&r1=1.117&r2=1.118

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6584
retrieving revision 1.6585
diff -u -b -r1.6584 -r1.6585
--- ChangeLog   12 May 2008 07:49:54 -0000      1.6584
+++ ChangeLog   12 May 2008 08:15:05 -0000      1.6585
@@ -1,3 +1,12 @@
+2008-05-12 Sandro Santilli <address@hidden>
+
+       * libbase/FLVParser.{cpp,h}: more dox about utility classes,
+         rename FLVVideoFrame and FLVAudioFrame to FLVVideoFrameInfo
+         and FLVAudioFrameInfo as they don't contain the actual data,
+         just offsets in the input.
+       * server/asobj/NetStreamFfmpeg.cpp: update use of FLVVideoFrame
+         and FLVAudioFrame.
+
 2008-05-12 Robert Millan <address@hidden>
 
        * libbase/: Makefile.am, gnashpluginrc.in, gnashrc.in,

Index: libbase/FLVParser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/FLVParser.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- libbase/FLVParser.cpp       10 May 2008 16:51:07 -0000      1.33
+++ libbase/FLVParser.cpp       12 May 2008 08:15:07 -0000      1.34
@@ -36,13 +36,13 @@
 namespace gnash {
 
 static std::auto_ptr<FLVFrame>
-makeVideoFrame(tu_file& in, const FLVVideoFrame& frameInfo)
+makeVideoFrame(tu_file& in, const FLVVideoFrameInfo& frameInfo)
 {
        std::auto_ptr<FLVFrame> frame ( new FLVFrame );
 
        frame->dataSize = frameInfo.dataSize;
        frame->timestamp = frameInfo.timestamp;
-       frame->tag = 9;
+       frame->type = videoFrame;
 
        if ( in.set_position(frameInfo.dataPosition) )
        {
@@ -65,11 +65,13 @@
 }
 
 static std::auto_ptr<FLVFrame>
-makeAudioFrame(tu_file& in, const FLVAudioFrame& frameInfo)
+makeAudioFrame(tu_file& in, const FLVAudioFrameInfo& frameInfo)
 {
        std::auto_ptr<FLVFrame> frame ( new FLVFrame );
        frame->dataSize = frameInfo.dataSize; 
        frame->timestamp = frameInfo.timestamp;
+       frame->type = audioFrame;
+
 
        if ( in.set_position(frameInfo.dataPosition) )
        {
@@ -88,8 +90,6 @@
        assert(padding);
        memset(frame->data + bytesread, 0, padding);
 
-       frame->tag = 8;
-
        return frame;
 }
 
@@ -222,7 +222,7 @@
 
        if (useAudio) {
 
-               FLVAudioFrame* frameInfo = _audioFrames[_nextAudioFrame];
+               FLVAudioFrameInfo* frameInfo = _audioFrames[_nextAudioFrame];
 
                std::auto_ptr<FLVFrame> frame = makeAudioFrame(_lt, *frameInfo);
                if ( ! frame.get() )
@@ -236,7 +236,7 @@
 
        } else {
 
-               FLVVideoFrame* frameInfo = _videoFrames[_nextVideoFrame];
+               FLVVideoFrameInfo* frameInfo = _videoFrames[_nextVideoFrame];
                std::auto_ptr<FLVFrame> frame = makeVideoFrame(_lt, *frameInfo);
                if ( ! frame.get() )
                {
@@ -266,7 +266,7 @@
        // If the needed frame can't be parsed (EOF reached) return NULL
        if (_audioFrames.size() <= _nextAudioFrame || _audioFrames.size() == 0) 
return NULL;
 
-       FLVAudioFrame* frameInfo = _audioFrames[_nextAudioFrame];
+       FLVAudioFrameInfo* frameInfo = _audioFrames[_nextAudioFrame];
        std::auto_ptr<FLVFrame> frame = makeAudioFrame(_lt, *frameInfo);
        if ( ! frame.get() )
        {
@@ -304,7 +304,7 @@
        }
 
        // TODO: let a function do this
-       FLVVideoFrame* frameInfo = _videoFrames[_nextVideoFrame];
+       FLVVideoFrameInfo* frameInfo = _videoFrames[_nextVideoFrame];
        std::auto_ptr<FLVFrame> frame = makeVideoFrame(_lt, *frameInfo);
        if ( ! frame.get() )
        {
@@ -336,7 +336,7 @@
 
        // If there are no audio greater than the given time
        // the last audioframe is returned
-       FLVAudioFrame* lastFrame = _audioFrames.back();
+       FLVAudioFrameInfo* lastFrame = _audioFrames.back();
        if (lastFrame->timestamp < time) {
                _nextAudioFrame = _audioFrames.size() - 1;
                return lastFrame->timestamp;
@@ -389,7 +389,7 @@
 
        // If there are no videoframe greater than the given time
        // the last key videoframe is returned
-       FLVVideoFrame* lastFrame = _videoFrames.back();
+       FLVVideoFrameInfo* lastFrame = _videoFrames.back();
        size_t numFrames = _videoFrames.size();
        if (lastFrame->timestamp < time)
        {
@@ -598,7 +598,7 @@
        if (bodyLength == 0) return true;
 
        if (tag[0] == AUDIO_TAG) {
-               FLVAudioFrame* frame = new FLVAudioFrame;
+               FLVAudioFrameInfo* frame = new FLVAudioFrameInfo;
                frame->dataSize = bodyLength - 1;
                frame->timestamp = timestamp;
                frame->dataPosition = _lt.get_position();
@@ -622,7 +622,7 @@
 
 
        } else if (tag[0] == VIDEO_TAG) {
-               FLVVideoFrame* frame = new FLVVideoFrame;
+               FLVVideoFrameInfo* frame = new FLVVideoFrameInfo;
                frame->dataSize = bodyLength - 1;
                frame->timestamp = timestamp;
                frame->dataPosition = _lt.get_position();

Index: libbase/FLVParser.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/FLVParser.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- libbase/FLVParser.h 10 May 2008 16:42:27 -0000      1.27
+++ libbase/FLVParser.h 12 May 2008 08:15:07 -0000      1.28
@@ -30,23 +30,40 @@
 
 namespace gnash {
 
+/// Frame type
+enum FrameType {
+
+       /// Video frame
+       videoFrame,
+
+       /// Audio frame
+       audioFrame
+};
+
 /// \brief
-/// The FLVFrame class contains a video or audio frame, its size, its
+/// The FLVFrame class contains an encoded
+/// video or audio frame, its size, its
 /// timestamp,
 class FLVFrame
 {
 public:
+       /// Size of the encoded frame
        boost::uint32_t dataSize;
+
+       /// Encoded data
        boost::uint8_t* data;
+
+       /// Frame timestamp, in milliseconds
        boost::uint64_t timestamp;
-       boost::uint8_t tag;
+
+       /// Frame type (audio/video)
+       FrameType type;
 };
 
 /// \brief
 /// The FLVAudioInfo class contains information about the audiostream
 /// in the FLV being parsed. The information stored is codec-type,
-/// samplerate, samplesize, stereo and duration.
-/// timestamp,
+/// samplerate, samplesize, stereo flag and duration.
 class FLVAudioInfo
 {
 public:
@@ -70,7 +87,6 @@
 /// The FLVVideoInfo class contains information about the videostream
 /// in the FLV being parsed. The information stored is codec-type,
 /// width, height, framerate and duration.
-/// timestamp,
 class FLVVideoInfo
 {
 public:
@@ -92,7 +108,7 @@
 
 
 /// Information about an FLV Audio Frame
-class FLVVideoFrame
+class FLVVideoFrameInfo
 {
 public:
 
@@ -117,7 +133,7 @@
 };
 
 /// Information about an FLV Audio Frame
-class FLVAudioFrame
+class FLVAudioFrameInfo
 {
 public:
        /// Size of the frame in bytes
@@ -321,18 +337,18 @@
        /// The interface to the file, externally owned
        tu_file& _lt;
 
-       // NOTE: FLVVideoFrame is a relatively small structure,
+       // NOTE: FLVVideoFrameInfo is a relatively small structure,
        //       chances are keeping by value here would reduce
        //       memory fragmentation with no big cost
-       typedef std::vector<FLVVideoFrame*> VideoFrames;
+       typedef std::vector<FLVVideoFrameInfo*> VideoFrames;
 
        /// list of videoframes, does no contain the frame data.
        VideoFrames _videoFrames;
 
-       // NOTE: FLVAudioFrame is a relatively small structure,
+       // NOTE: FLVAudioFrameInfo is a relatively small structure,
        //       chances are keeping by value here would reduce
        //       memory fragmentation with no big cost
-       typedef std::vector<FLVAudioFrame*> AudioFrames;
+       typedef std::vector<FLVAudioFrameInfo*> AudioFrames;
 
        /// list of audioframes, does no contain the frame data.
        AudioFrames _audioFrames;

Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -b -r1.117 -r1.118
--- server/asobj/NetStreamFfmpeg.cpp    11 May 2008 18:20:20 -0000      1.117
+++ server/asobj/NetStreamFfmpeg.cpp    12 May 2008 08:15:08 -0000      1.118
@@ -807,13 +807,14 @@
        // FIXME: is this the right value for packet.dts?
        packet.pts = packet.dts = static_cast<boost::int64_t>(frame->timestamp);
 
-       if (frame->tag == 9)
+       if (frame->type == videoFrame)
        {
                packet.stream_index = 0;
                return decodeVideo(&packet);
        }
        else
        {
+               assert(frame->type == audioFrame);
                packet.stream_index = 1;
                return decodeAudio(&packet);
        }




reply via email to

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