[Top][All Lists]
[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: |
Sat, 10 May 2008 16:42:27 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/05/10 16:42:27
Modified files:
. : ChangeLog
libbase : FLVParser.cpp FLVParser.h
Log message:
* libbase/FLVParser.{cpp,h}: rename parseNextFrame to
parseNextTag, as that's really what the function does;
fix parsing of audio/video flag, add parsing of FLV version.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6578&r2=1.6579
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/FLVParser.cpp?cvsroot=gnash&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/FLVParser.h?cvsroot=gnash&r1=1.26&r2=1.27
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6578
retrieving revision 1.6579
diff -u -b -r1.6578 -r1.6579
--- ChangeLog 10 May 2008 15:40:46 -0000 1.6578
+++ ChangeLog 10 May 2008 16:42:26 -0000 1.6579
@@ -1,5 +1,11 @@
2008-05-10 Sandro Santilli <address@hidden>
+ * libbase/FLVParser.{cpp,h}: rename parseNextFrame to
+ parseNextTag, as that's really what the function does;
+ fix parsing of audio/video flag, add parsing of FLV version.
+
+2008-05-10 Sandro Santilli <address@hidden>
+
* testsuite/misc-ming.all/: NetStream-SquareTest.c,
NetStream-SquareTestRunner.cpp: add test for pause/play
using user-interaction + some events-related tests.
Index: libbase/FLVParser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/FLVParser.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- libbase/FLVParser.cpp 10 May 2008 11:05:27 -0000 1.31
+++ libbase/FLVParser.cpp 10 May 2008 16:42:26 -0000 1.32
@@ -139,7 +139,7 @@
// Make sure that there are parsed some frames
while(_videoFrames.size() < 2 && !_parsingComplete) {
- parseNextFrame();
+ parseNextTag();
}
if (_videoFrames.size() < 2) return 0;
@@ -159,7 +159,7 @@
// Make sure that there are parsed some frames
while(_videoFrames.size() < 2 && !_parsingComplete) {
- parseNextFrame();
+ parseNextTag();
}
// If there is no video data return 0
@@ -177,7 +177,7 @@
// Make sure that there are parsed some frames
while(_audioFrames.size() < 2 && !_parsingComplete) {
- parseNextFrame();
+ parseNextTag();
}
// If there is no video data return 0
@@ -198,7 +198,7 @@
// Parse a media frame if any left or if needed
while(_videoFrames.size() <= _nextVideoFrame &&
_audioFrames.size() <= _nextAudioFrame && !_parsingComplete) {
- if (!parseNextFrame()) break;
+ if (!parseNextTag()) break;
}
}
@@ -260,7 +260,7 @@
// Make sure that there are parsed enough frames to return the need
frame
while(_audioFrames.size() <= _nextAudioFrame && !_parsingComplete) {
- if (!parseNextFrame()) break;
+ if (!parseNextTag()) break;
}
// If the needed frame can't be parsed (EOF reached) return NULL
@@ -293,7 +293,7 @@
// Make sure that there are parsed enough frames to return the need
frame
while(_videoFrames.size() <=
static_cast<boost::uint32_t>(_nextVideoFrame) && !_parsingComplete)
{
- if (!parseNextFrame()) break;
+ if (!parseNextTag()) break;
}
// If the needed frame can't be parsed (EOF reached) return NULL
@@ -322,7 +322,7 @@
// Make sure that there are parsed some frames
while(_audioFrames.size() < 1 && !_parsingComplete) {
- parseNextFrame();
+ parseNextTag();
}
// If there is no audio data return NULL
@@ -331,7 +331,7 @@
// Make sure that there are parsed some enough frames
// to get the right frame.
while(_audioFrames.back()->timestamp < time && !_parsingComplete) {
- parseNextFrame();
+ parseNextTag();
}
// If there are no audio greater than the given time
@@ -375,7 +375,7 @@
{
// Make sure that there are parsed some frames
while(_videoFrames.size() < 1 && !_parsingComplete) {
- parseNextFrame();
+ parseNextTag();
}
// If there is no video data return NULL
@@ -384,7 +384,7 @@
// Make sure that there are parsed some enough frames
// to get the right frame.
while(_videoFrames.back()->timestamp < time && !_parsingComplete) {
- parseNextFrame();
+ parseNextTag();
}
// If there are no videoframe greater than the given time
@@ -490,7 +490,7 @@
// Make sure that there are parsed some video frames
while(_videoInfo == NULL && !_parsingComplete) {
- parseNextFrame();
+ parseNextTag();
}
// If there are no video data return NULL
@@ -511,7 +511,7 @@
// Make sure that there are parsed some audio frames
while(_audioInfo == NULL && !_parsingComplete) {
- parseNextFrame();
+ parseNextTag();
}
// If there are no audio data return NULL
@@ -528,7 +528,7 @@
// Parse frames until the need time is found, or EOF
while (!_parsingComplete) {
- if (!parseNextFrame()) break;
+ if (!parseNextTag()) break;
if ((_videoFrames.size() > 0 && _videoFrames.back()->timestamp
>= time)
|| (_audioFrames.size() > 0 &&
_audioFrames.back()->timestamp >= time)) {
return true;
@@ -561,18 +561,18 @@
return time;
}
-bool FLVParser::parseNextFrame()
+bool FLVParser::parseNextTag()
{
+ if ( _parsingComplete ) return false;
+
// Parse the header if not done already. If unsuccesfull return false.
if (_lastParsedPosition == 0 && !parseHeader()) return false;
- // Check if there is enough data to parse the header of the frame
- //if (!_lt.isPositionConfirmed(_lastParsedPosition+14)) return false;
-
// Seek to next frame and skip the size of the last tag
if ( _lt.set_position(_lastParsedPosition+4) )
{
- log_error("FLVParser::parseNextFrame: can't seek to %d",
_lastParsedPosition+4);
+ log_error("FLVParser::parseNextTag: can't seek to %d",
_lastParsedPosition+4);
+ _parsingComplete=true;
return false;
}
@@ -581,7 +581,8 @@
int actuallyRead = _lt.read_bytes(tag, 12);
if ( actuallyRead < 12 )
{
- log_error("FLVParser::parseNextFrame: can't read tag info
(needed 12 bytes, only got %d)", actuallyRead);
+ log_error("FLVParser::parseNextTag: can't read tag info (needed
12 bytes, only got %d)", actuallyRead);
+ _parsingComplete=true;
return false;
}
@@ -589,9 +590,6 @@
boost::uint32_t bodyLength = getUInt24(&tag[1]);
boost::uint32_t timestamp = getUInt24(&tag[4]);
- // Check if there is enough data to parse the body of the frame
- //if (!_lt.isPositionConfirmed(_lastParsedPosition+15+bodyLength))
return false;
-
_lastParsedPosition += 15 + bodyLength;
// check for empty tag
@@ -642,13 +640,15 @@
if ( _lt.set_position(frame->dataPosition) )
{
log_error(" Couldn't seek to VideoTag
data position");
+ _parsingComplete=true;
return false;
}
boost::uint8_t videohead[12];
int actuallyRead = _lt.read_bytes(videohead,
12);
if ( actuallyRead < 12 )
{
- log_error("FLVParser::parseNextFrame: can't read H263 video
header (needed 12 bytes, only got %d)", actuallyRead);
+ log_error("FLVParser::parseNextTag: can't read H263 video
header (needed 12 bytes, only got %d)", actuallyRead);
+ _parsingComplete=true;
return false;
}
@@ -702,8 +702,9 @@
amfParser->parseAMF(metaTag);*/
} else {
- _parsingComplete = true;
- return false;
+ log_error("Unknown FLV tag type %d", tag[0]);
+ //_parsingComplete = true;
+ //return false;
}
return true;
@@ -725,19 +726,13 @@
// Check if this is really a FLV file
if (header[0] != 'F' || header[1] != 'L' || header[2] != 'V') return
false;
+ int version = header[3];
+
// Parse the audio+video bitmask
- if (header[4] == 5) {
- _audio = true;
- _video = true;
- } else if (header[4] == 4) {
- _audio = true;
- _video = false;
- } else if (header[4] == 4) {
- _audio = false;
- _video = true;
- } else {
- gnash::log_debug("Weird FLV bit mask\n");
- }
+ _audio = header[4]&(1<<2);
+ _video = header[4]&(1<<0);
+
+ log_debug("Parsing FLV version %d, audio:%d, video:%d", version,
_audio, _video);
_lastParsedPosition = 9;
return true;
Index: libbase/FLVParser.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/FLVParser.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- libbase/FLVParser.h 10 May 2008 11:05:28 -0000 1.26
+++ libbase/FLVParser.h 10 May 2008 16:42:27 -0000 1.27
@@ -305,9 +305,12 @@
boost::uint32_t seekVideo(boost::uint32_t time);
- /// Parses next frame from the file, returns true is a frame
- /// was succesfully parsed, or false if not enough data was present.
- bool parseNextFrame();
+ /// Parses next tag from the file
+ //
+ /// Returns true if something was parsed, false otherwise.
+ /// Sets _parsingComplete=true on end of file.
+ ///
+ bool parseNextTag();
/// Parses the header of the file
bool parseHeader();
- [Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F..., Sandro Santilli, 2008/05/09
- [Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F..., Sandro Santilli, 2008/05/11
- [Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F...,
Sandro Santilli <=
- [Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F..., Sandro Santilli, 2008/05/12
- [Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F..., Sandro Santilli, 2008/05/12
- [Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F..., Sandro Santilli, 2008/05/23
- [Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F..., Sandro Santilli, 2008/05/24
- [Gnash-commit] gnash ChangeLog libbase/FLVParser.cpp libbase/F..., Sandro Santilli, 2008/05/27