gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11665: Add an interface to get earl


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11665: Add an interface to get earliest timestamp in queue (either from audio or video frame)
Date: Mon, 30 Nov 2009 22:46:44 +0100
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11665
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Mon 2009-11-30 22:46:44 +0100
message:
  Add an interface to get earliest timestamp in queue (either from audio or 
video frame)
modified:
  libmedia/MediaParser.cpp
  libmedia/MediaParser.h
=== modified file 'libmedia/MediaParser.cpp'
--- a/libmedia/MediaParser.cpp  2009-03-04 11:57:06 +0000
+++ b/libmedia/MediaParser.cpp  2009-11-30 21:46:44 +0000
@@ -124,6 +124,46 @@
 }
 
 bool
+MediaParser::nextFrameTimestamp(boost::uint64_t& ts) const
+{
+#ifdef LOAD_MEDIA_IN_A_SEPARATE_THREAD
+    boost::mutex::scoped_lock lock(_qMutex);
+#else // ndef LOAD_MEDIA_IN_A_SEPARATE_THREAD
+    while (!parsingCompleted() && _videoInfo.get() && _videoFrames.empty())
+    {
+        const_cast<MediaParser*>(this)->parseNextChunk();
+    }
+#endif
+
+    if (_videoFrames.empty())
+    {
+        if (_audioFrames.empty())
+        {
+            return false;
+        }
+        else
+        {
+            ts = _audioFrames.front()->timestamp;
+            return true;
+        }
+    }
+    else
+    {
+        if (_audioFrames.empty())
+        {
+            ts = _videoFrames.front()->timestamp();
+            return true;
+        }
+        else
+        {
+            ts = std::min(_videoFrames.front()->timestamp(),
+                          _audioFrames.front()->timestamp);
+            return true;
+        }
+    }
+}
+
+bool
 MediaParser::nextVideoFrameTimestamp(boost::uint64_t& ts) const
 {
        const EncodedVideoFrame* ef = peekNextVideoFrame();

=== modified file 'libmedia/MediaParser.h'
--- a/libmedia/MediaParser.h    2009-03-18 15:40:50 +0000
+++ b/libmedia/MediaParser.h    2009-11-30 21:46:44 +0000
@@ -492,6 +492,13 @@
                _bufferTime=t;
        }
 
+       /// Get timestamp of the next frame available, if any
+       //
+       /// @param ts will be set to timestamp of next available frame
+       /// @return false if no frame is available yet
+       ///
+       DSOEXPORT bool nextFrameTimestamp(boost::uint64_t& ts) const;
+
        /// Get timestamp of the video frame which would be returned on 
nextVideoFrame
        //
        /// @return false if there no video frame left


reply via email to

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