[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-datatype-cvs
Subject: [Datatype-cvs] flash/flv/fileformat flv_file_format.cpp, 1.6.2.1,
From: ehyche () helixcommunity ! org
Date: 2007-05-24 19:26:43
Message-ID: 200705241926.l4OJQqrI009432 () mailer ! progressive-comp ! com
[Download RAW message or body]
Update of /cvsroot/datatype/flash/flv/fileformat
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv481
Modified Files:
Tag: hxclient_2_0_4_cayenne
flv_file_format.cpp
Log Message:
Merge from HEAD to 204Cay.
Add "FramesPerMSecond" field to FLV stream header.
Index: flv_file_format.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flv/fileformat/flv_file_format.cpp,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.1.2.1
diff -u -d -r1.6.2.1 -r1.6.2.1.2.1
--- flv_file_format.cpp 23 Apr 2007 17:18:40 -0000 1.6.2.1
+++ flv_file_format.cpp 24 May 2007 19:26:40 -0000 1.6.2.1.2.1
@@ -89,6 +89,7 @@
#define HX_FLV_INDEX_MAX_TIME_GRANULE 15000 // in milliseconds
#endif /* #if defined(HELIX_FEATURE_MIN_HEAP) */
#define HX_FLV_INITIAL_AUDIO_SCAN_TIME 5000 // milliseconds of audio we will \
read to determine audio bitrate +#define HX_FLV_INITIAL_VIDEO_SCAN_TIME 1000 // \
minimum milliseconds of video we will read to determine video framerate
const char* const CHXFLVFileFormat::m_pszDescription = "Helix FLV File \
Format Plugin"; const char* const CHXFLVFileFormat::m_pszCopyright = \
HXVER_COPYRIGHT; @@ -123,6 +124,9 @@
, m_ulAudioBitrate(0)
, m_ulVideoBitrate(0)
, m_ulLastVideoKeyFrameTimeStamp(0)
+ , m_ulFirstVideoTimeStamp(0)
+ , m_ulNumVideoFrames(0)
+ , m_dVideoFrameRate(0.0)
, m_ulState(kStateConstructed)
, m_ulSeekOffsetRequested(0)
, m_ulReadBytesRequested(0)
@@ -146,6 +150,9 @@
, m_bHaveReadOneAudioPacket(FALSE)
, m_bHaveReadOneVideoPacket(FALSE)
, m_bReTimeStampVideo(TRUE)
+ , m_bHaveVideoFrameRate(FALSE)
+ , m_bUpdateFrameRateEstimate(TRUE)
+ , m_bHaveFirstVideoTimeStamp(FALSE)
{
HXLOGL4(HXLOG_FLVF, "CON CHXFLVFileFormat this=%p", this);
}
@@ -791,6 +798,26 @@
m_bHaveHeight = TRUE;
}
}
+ // Do we have the first video timestamp?
+ if (!m_bHaveFirstVideoTimeStamp)
+ {
+ // Save the first video timestamp
+ m_ulFirstVideoTimeStamp = \
m_cTagHeader.GetTimeStamp(); + // Set the flag \
saying we've got the first video timestamp + \
m_bHaveFirstVideoTimeStamp = TRUE; + }
+ // Increment the number of video frames we've see in \
the initial scan + m_ulNumVideoFrames++;
+ // Have we scanned enough to make a frame rate \
estimate? + UINT32 ulTimeScanned = \
m_cTagHeader.GetTimeStamp() - m_ulFirstVideoTimeStamp; + \
if (ulTimeScanned >= HX_FLV_INITIAL_VIDEO_SCAN_TIME && m_bUpdateFrameRateEstimate) + \
{ + // We have scanned enough time to make a frame \
rate estimate + m_dVideoFrameRate = ((double) \
m_ulNumVideoFrames) * 1000.0 / + \
((double) ulTimeScanned); + // Set the flag saying \
we now have our frame rate + m_bHaveVideoFrameRate \
= TRUE; + }
// Set the flag saying we've read one video packet
m_bHaveReadOneVideoPacket = TRUE;
}
@@ -863,6 +890,20 @@
// Set the flag saying we have the video \
bitrate from meta-data m_bHaveVideoBitrate = TRUE;
}
+ // Try to get the video frame rate from \
meta-data + dTmp = 0.0;
+ rv = m_cMetaPacket.FindValueDouble("framerate", \
&dTmp); + if (SUCCEEDED(rv))
+ {
+ // Save the video frame rate
+ m_dVideoFrameRate = dTmp;
+ // Set the flag saying we have the video \
frame rate + m_bHaveVideoFrameRate = TRUE;
+ // If we have the frame rate from the \
meta-data, + // then we don't want to update \
the frame rate estimate + // as we scan \
initial video frames. + \
m_bUpdateFrameRateEstimate = FALSE; + }
}
}
}
@@ -872,7 +913,7 @@
{
// Check if we are done reading packets
if ((!m_cHeader.HasAudio() || (m_bHaveAudioBitrate && \
m_bHaveReadOneAudioPacket)) &&
- (!m_cHeader.HasVideo() || (m_bHaveWidth && m_bHaveHeight && \
m_bHaveReadOneVideoPacket))) + (!m_cHeader.HasVideo() || \
(m_bHaveWidth && m_bHaveHeight && m_bHaveReadOneVideoPacket && \
m_bHaveVideoFrameRate))) {
// We've now read one video and one audio packet (if
// indeed we have those streams). So by now we
@@ -1965,6 +2006,16 @@
// Set the height property
rpHdr->SetPropertyULONG32("Height", m_ulHeight);
}
+ // Do we have the video frame rate?
+ if (m_bHaveVideoFrameRate)
+ {
+ // The standard stream header field for frame rate is
+ // "FramesPerMSecond", which is the number of frames
+ // per million seconds.
+ UINT32 ulFramesPerMSecond = (UINT32) (m_dVideoFrameRate * \
1000000.0); + // Set the field
+ rpHdr->SetPropertyULONG32("FramesPerMSecond", ulFramesPerMSecond);
+ }
// Set the codec ID
rpHdr->SetPropertyULONG32("CodecID", (UINT32) \
m_cVideoHeader.GetCodecID()); // Get the codec string
_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic