[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog backend/sound_handler_gst.cpp l...
From: |
Tomas Groth |
Subject: |
[Gnash-commit] gnash ChangeLog backend/sound_handler_gst.cpp l... |
Date: |
Sat, 12 May 2007 09:59:45 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Tomas Groth <tgc> 07/05/12 09:59:44
Modified files:
. : ChangeLog
backend : sound_handler_gst.cpp
libbase : FLVParser.cpp FLVParser.h curl_adapter.cpp
macros : opengl.m4
Log message:
* backend/sound_handler_gst.cpp: Make sure sounds are stopped
when done being played. Should fix bug #19628.
* libbase/FLVParser.{h,cpp}: Switched from referring to the last
frame we used, to the next frame we're going to use.
* libbase/curl_adapter.cpp: Fix use of usleep() on windows.
* macros/opengl.m4: Fixed detection on windows.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3172&r2=1.3173
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_gst.cpp?cvsroot=gnash&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/FLVParser.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/FLVParser.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/curl_adapter.cpp?cvsroot=gnash&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/gnash/macros/opengl.m4?cvsroot=gnash&r1=1.31&r2=1.32
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3172
retrieving revision 1.3173
diff -u -b -r1.3172 -r1.3173
--- ChangeLog 12 May 2007 08:41:12 -0000 1.3172
+++ ChangeLog 12 May 2007 09:59:44 -0000 1.3173
@@ -1,3 +1,12 @@
+2007-05-12 Tomas Groth Christensen <address@hidden>
+
+ * backend/sound_handler_gst.cpp: Make sure sounds are stopped
+ when done being played. Should fix bug #19628.
+ * libbase/FLVParser.{h,cpp}: Switched from referring to the last
+ frame we used, to the next frame we're going to use.
+ * libbase/curl_adapter.cpp: Fix use of usleep() on windows.
+ * macros/opengl.m4: Fixed detection on windows.
+
2007-05-12 Sandro Santilli <address@hidden>
* server/character.h (isDynamic): the root movie, not having
Index: backend/sound_handler_gst.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_gst.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- backend/sound_handler_gst.cpp 3 May 2007 06:00:15 -0000 1.37
+++ backend/sound_handler_gst.cpp 12 May 2007 09:59:44 -0000 1.38
@@ -18,7 +18,7 @@
// Based on sound_handler_sdl.cpp by Thatcher Ulrich http://tulrich.com 2003
// which has been donated to the Public Domain.
-/* $Id: sound_handler_gst.cpp,v 1.37 2007/05/03 06:00:15 strk Exp $ */
+/* $Id: sound_handler_gst.cpp,v 1.38 2007/05/12 09:59:44 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -185,6 +185,14 @@
return 0;
}
+// This stops sounds when they are done playing
+static gboolean sound_killer (gpointer user_data)
+{
+ gst_elements *gstelements = static_cast<gst_elements*>(user_data);
+ gst_element_set_state (GST_ELEMENT (gstelements->pipeline),
GST_STATE_NULL);
+ return false;
+}
+
// The callback function which refills the buffer with data
static void callback_handoff (GstElement * /*c*/, GstBuffer *buffer, GstPad*
/*pad*/, gpointer user_data)
{
@@ -207,8 +215,12 @@
GST_BUFFER_DATA(buffer) = tmp_buf;
}
- // This shouldn't happen
+ // All the data has been given to the pipeline, so now we need to stop
+ // the pipeline. g_idle_add() makes sure sound_killer is called soon.
if (gstelements->position > gstelements->data_size) {
+ g_idle_add(sound_killer, user_data);
+ GST_BUFFER_SIZE(buffer) = 0;
+ GST_BUFFER_DATA(buffer) = 0;
return;
}
Index: libbase/FLVParser.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/FLVParser.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- libbase/FLVParser.cpp 7 May 2007 23:15:44 -0000 1.9
+++ libbase/FLVParser.cpp 12 May 2007 09:59:44 -0000 1.10
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: FLVParser.cpp,v 1.9 2007/05/07 23:15:44 tgc Exp $
+// $Id: FLVParser.cpp,v 1.10 2007/05/12 09:59:44 tgc Exp $
#include "FLVParser.h"
#include "amf.h"
@@ -30,8 +30,8 @@
_parsingComplete(false),
_videoInfo(NULL),
_audioInfo(NULL),
- _lastAudioFrame(-1),
- _lastVideoFrame(-1),
+ _nextAudioFrame(0),
+ _nextVideoFrame(0),
_audio(false),
_video(false)
{
@@ -74,9 +74,9 @@
}
// If there is no video data return 0
- if (_videoFrames.size() == 0 || !_video || _lastVideoFrame < 1) return
0;
+ if (_videoFrames.size() == 0 || !_video || _nextVideoFrame < 1) return
0;
- return _videoFrames[_lastVideoFrame]->timestamp -
_videoFrames[_lastVideoFrame-1]->timestamp;
+ return _videoFrames[_nextVideoFrame]->timestamp -
_videoFrames[_nextVideoFrame-1]->timestamp;
}
FLVFrame* FLVParser::nextMediaFrame()
@@ -86,7 +86,7 @@
uint32_t video_size = _videoFrames.size();
uint32_t audio_size = _audioFrames.size();
- if ( ! (audio_size <= _lastAudioFrame+1 && video_size <=
_lastVideoFrame+1) )
+ if ( ! (audio_size <= _nextAudioFrame && video_size <= _nextVideoFrame)
)
{
// Parse a media frame if any left or if needed
@@ -96,12 +96,12 @@
}
// Find the next frame in the file
- bool audioReady = _audioFrames.size() > _lastAudioFrame+1;
- bool videoReady = _videoFrames.size() > _lastVideoFrame+1;
+ bool audioReady = _audioFrames.size() > _nextAudioFrame;
+ bool videoReady = _videoFrames.size() > _nextVideoFrame;
bool useAudio = false;
if (audioReady && videoReady) {
- useAudio = _audioFrames[_lastAudioFrame+1]->dataPosition <
_videoFrames[_lastVideoFrame+1]->dataPosition;
+ useAudio = _audioFrames[_nextAudioFrame]->dataPosition <
_videoFrames[_nextVideoFrame]->dataPosition;
} else if (!audioReady && videoReady) {
useAudio = false;
} else if (audioReady && !videoReady) {
@@ -115,33 +115,32 @@
#define PADDING_BYTES 8
if (useAudio) {
- _lastAudioFrame++;
FLVFrame* frame = new FLVFrame;
- frame->dataSize = _audioFrames[_lastAudioFrame]->dataSize;
- frame->timestamp = _audioFrames[_lastAudioFrame]->timestamp;
+ frame->dataSize = _audioFrames[_nextAudioFrame]->dataSize;
+ frame->timestamp = _audioFrames[_nextAudioFrame]->timestamp;
- _lt->seek(_audioFrames[_lastAudioFrame]->dataPosition);
+ _lt->seek(_audioFrames[_nextAudioFrame]->dataPosition);
frame->data = new uint8_t[frame->dataSize + PADDING_BYTES];
size_t bytesread = _lt->read(frame->data, frame->dataSize);
memset(frame->data + bytesread, 0, PADDING_BYTES);
frame->tag = 8;
+ _nextAudioFrame++;
return frame;
} else {
- _lastVideoFrame++;
-
FLVFrame* frame = new FLVFrame;
- frame->dataSize = _videoFrames[_lastVideoFrame]->dataSize;
- frame->timestamp = _videoFrames[_lastVideoFrame]->timestamp;
+ frame->dataSize = _videoFrames[_nextVideoFrame]->dataSize;
+ frame->timestamp = _videoFrames[_nextVideoFrame]->timestamp;
- _lt->seek(_videoFrames[_lastVideoFrame]->dataPosition);
+ _lt->seek(_videoFrames[_nextVideoFrame]->dataPosition);
frame->data = new uint8_t[frame->dataSize + PADDING_BYTES];
size_t bytesread = _lt->read(frame->data, frame->dataSize);
memset(frame->data + bytesread, 0, PADDING_BYTES);
frame->tag = 9;
+ _nextVideoFrame++;
return frame;
}
@@ -157,22 +156,22 @@
if (!_audio && _lastParsedPosition > 0) return NULL;
// Make sure that there are parsed enough frames to return the need
frame
- while(_audioFrames.size() <= _lastAudioFrame+1 && !_parsingComplete) {
+ while(_audioFrames.size() <= _nextAudioFrame && !_parsingComplete) {
if (!parseNextFrame()) break;
}
// If the needed frame can't be parsed (EOF reached) return NULL
- if (_audioFrames.size() <= _lastAudioFrame+1 || _audioFrames.size() ==
0) return NULL;
-
- _lastAudioFrame++;
+ if (_audioFrames.size() <= _nextAudioFrame || _audioFrames.size() == 0)
return NULL;
FLVFrame* frame = new FLVFrame;
- frame->dataSize = _audioFrames[_lastAudioFrame]->dataSize;
- frame->timestamp = _audioFrames[_lastAudioFrame]->timestamp;
+ frame->dataSize = _audioFrames[_nextAudioFrame]->dataSize;
+ frame->timestamp = _audioFrames[_nextAudioFrame]->timestamp;
+
+ _lt->seek(_audioFrames[_nextAudioFrame]->dataPosition);
+ frame->data = new uint8_t[_audioFrames[_nextAudioFrame]->dataSize];
+ _lt->read(frame->data, _audioFrames[_nextAudioFrame]->dataSize);
- _lt->seek(_audioFrames[_lastAudioFrame]->dataPosition);
- frame->data = new uint8_t[_audioFrames[_lastAudioFrame]->dataSize];
- _lt->read(frame->data, _audioFrames[_lastAudioFrame]->dataSize);
+ _nextAudioFrame++;
return frame;
}
@@ -189,27 +188,27 @@
}
// Make sure that there are parsed enough frames to return the need
frame
- while(_videoFrames.size() <= static_cast<uint32_t>(_lastVideoFrame+1)
&& !_parsingComplete)
+ while(_videoFrames.size() <= static_cast<uint32_t>(_nextVideoFrame) &&
!_parsingComplete)
{
if (!parseNextFrame()) break;
}
// If the needed frame can't be parsed (EOF reached) return NULL
- if (_videoFrames.size() <= _lastVideoFrame+1 || _videoFrames.size() ==
0)
+ if (_videoFrames.size() <= _nextVideoFrame || _videoFrames.size() == 0)
{
//gnash::log_debug("The needed frame (%d) can't be parsed (EOF
reached)", _lastVideoFrame);
return NULL;
}
- _lastVideoFrame++;
-
FLVFrame* frame = new FLVFrame;
- frame->dataSize = _videoFrames[_lastVideoFrame]->dataSize;
- frame->timestamp = _videoFrames[_lastVideoFrame]->timestamp;
+ frame->dataSize = _videoFrames[_nextVideoFrame]->dataSize;
+ frame->timestamp = _videoFrames[_nextVideoFrame]->timestamp;
+
+ _lt->seek(_videoFrames[_nextVideoFrame]->dataPosition);
+ frame->data = new uint8_t[_videoFrames[_nextVideoFrame]->dataSize];
+ _lt->read(frame->data, _videoFrames[_nextVideoFrame]->dataSize);
- _lt->seek(_videoFrames[_lastVideoFrame]->dataPosition);
- frame->data = new uint8_t[_videoFrames[_lastVideoFrame]->dataSize];
- _lt->read(frame->data, _videoFrames[_lastVideoFrame]->dataSize);
+ _nextVideoFrame++;
return frame;
}
@@ -236,7 +235,7 @@
// the last audioframe is returned
FLVAudioFrame* lastFrame = _audioFrames.back();
if (lastFrame->timestamp < time) {
- _lastAudioFrame = _audioFrames.size() - 2;
+ _nextAudioFrame = _audioFrames.size() - 1;
return lastFrame->timestamp;
}
@@ -261,7 +260,7 @@
}
gnash::log_debug("Seek (audio): " SIZET_FMT "/" SIZET_FMT " (%u/%u)",
bestFrame, numFrames, _audioFrames[bestFrame]->timestamp, time);
- _lastAudioFrame = bestFrame;
+ _nextAudioFrame = bestFrame + 1;
return _audioFrames[bestFrame]->timestamp;
}
@@ -296,7 +295,7 @@
lastFrame = _videoFrames[lastFrameNum];
}
- _lastVideoFrame = lastFrameNum-1; // Why -1 ?
+ _nextVideoFrame = lastFrameNum;
return lastFrame->timestamp;
}
@@ -368,9 +367,9 @@
gnash::log_debug("Seek (video): " SIZET_FMT "/" SIZET_FMT " (%u/%u)",
bestFrame, numFrames, _videoFrames[bestFrame]->timestamp, time);
- _lastVideoFrame = bestFrame;
- assert( _videoFrames[_lastVideoFrame]->isKeyFrame() );
- return _videoFrames[_lastVideoFrame]->timestamp;
+ _nextVideoFrame = bestFrame+1;
+ assert( _videoFrames[bestFrame]->isKeyFrame() );
+ return _videoFrames[bestFrame]->timestamp;
}
@@ -442,8 +441,8 @@
boost::mutex::scoped_lock lock(_mutex);
if (time == 0) {
- if (_video) _lastVideoFrame = -1;
- if (_audio) _lastAudioFrame = -1;
+ if (_video) _nextVideoFrame = 0;
+ if (_audio) _nextAudioFrame = 0;
}
if (_video) time = seekVideo(time);
Index: libbase/FLVParser.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/FLVParser.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libbase/FLVParser.h 5 May 2007 16:19:18 -0000 1.5
+++ libbase/FLVParser.h 12 May 2007 09:59:44 -0000 1.6
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: FLVParser.h,v 1.5 2007/05/05 16:19:18 strk Exp $
+// $Id: FLVParser.h,v 1.6 2007/05/12 09:59:44 tgc Exp $
// Information about the FLV format can be found at http://osflash.org/flv
@@ -246,10 +246,10 @@
FLVAudioInfo* _audioInfo;
/// Last audio frame returned
- size_t _lastAudioFrame;
+ size_t _nextAudioFrame;
/// Last video frame returned
- size_t _lastVideoFrame;
+ size_t _nextVideoFrame;
/// Audio stream is present
bool _audio;
Index: libbase/curl_adapter.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/curl_adapter.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- libbase/curl_adapter.cpp 7 May 2007 09:33:20 -0000 1.31
+++ libbase/curl_adapter.cpp 12 May 2007 09:59:44 -0000 1.32
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: curl_adapter.cpp,v 1.31 2007/05/07 09:33:20 strk Exp $ */
+/* $Id: curl_adapter.cpp,v 1.32 2007/05/12 09:59:44 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -32,7 +32,12 @@
#include <map>
#include <iostream>
#include <string>
-#include <unistd.h> // for usleep
+#if defined(_WIN32) || defined(WIN32)
+ #include <Windows.h> // for sleep()
+ #define usleep(x) Sleep(x/1000)
+#else
+ #include "unistd.h" // for usleep()
+#endif
using namespace std;
Index: macros/opengl.m4
===================================================================
RCS file: /sources/gnash/gnash/macros/opengl.m4,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- macros/opengl.m4 10 Apr 2007 18:18:46 -0000 1.31
+++ macros/opengl.m4 12 May 2007 09:59:44 -0000 1.32
@@ -14,7 +14,7 @@
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-dnl $Id: opengl.m4,v 1.31 2007/04/10 18:18:46 rsavoye Exp $
+dnl $Id: opengl.m4,v 1.32 2007/05/12 09:59:44 tgc Exp $
AC_DEFUN([GNASH_PATH_OPENGL],
[
@@ -79,8 +79,9 @@
if test -f ${with_opengl_lib}/libGL.a -o -f
${with_opengl_lib}/libGL.${shlibext}; then
ac_cv_path_opengl_lib="-L`(cd ${with_opengl_lib}; pwd)` -lGL -lGLU"
else
- if test -f ${with_opengl_lib}/libopengl32.a -o; then
+ if test -f ${with_opengl_lib}/libopengl32.a; then
ac_cv_path_opengl_lib="-L`(cd ${with_opengl_lib}; pwd) -lopengl32
-lglu32`"
+ else
AC_MSG_ERROR([${with_opengl_lib} directory doesn't contain libGL.])
fi
fi
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog backend/sound_handler_gst.cpp l...,
Tomas Groth <=