[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-dev] from Hong Yu: progress of debugging Gnash-cvs (checked-o
From: |
Hong Yu |
Subject: |
Re: [Gnash-dev] from Hong Yu: progress of debugging Gnash-cvs (checked-out Feb 12, 2008) with new FFmpeg (VP6 support) for YouTube flash video |
Date: |
Wed, 20 Feb 2008 18:07:37 +0800 |
User-agent: |
Thunderbird 2.0.0.9 (X11/20071031) |
Thanks for your suggestions! We have verified our modifications with new
FFmpeg (newer than March 2007) and Gstreamer0.10, and both run
satisfactorily as expected. Due to the long time-period spent on
testing, this patch may not catch up with the most updated Gnash-cvs
version.
The attached files:
[1] 'patch-diff.out' is the contextual diff result with Gnash-cvs source
checked out on '2008-02-19 15:39 HKT' (with r.104 version of the file
'gnash/server/asobj/NetStreamFfmpeg.cpp')
[2] 'ffmpegDir.tar.gz' contains the newly added directory
'gnash/libmedia/ffmpeg/' and programs inside. To apply, extract it
outside the directory 'gnash/'
[3] 'rebuild.ffmpeg.x86.sh' is our build script for ffmpeg option under
'gnash/'
[4] 'rebuild.gst.x86.sh' is our build script for gst option under 'gnash/'
We look forward to your suggestions on further improvement.
Best regards,
Hong Yu
strk wrote:
On Wed, Feb 20, 2008 at 01:34:32PM +0800, Hong Yu wrote:
We have tried 'cvs diff -u' and generated 'patch-diff.1.out' (as
attached). One thing is that, we have added a new directory
'gnash/libmedia/ffmpeg' (in which 8 programs for 4 classes) as part of
our modifications for using FFmpeg. However, 'patch-diff.1.out' did not
include the changes of directories. Could you suggest more utility
commands for patching directories? Thanks!
Hong Yu
Make a tar.gz file with all new directories/files.
--strk;
? libmedia/ffmpeg
Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.478
diff -u -r1.478 configure.ac
--- configure.ac 1 Feb 2008 01:30:27 -0000 1.478
+++ configure.ac 20 Feb 2008 07:56:41 -0000
@@ -568,12 +568,16 @@
media_handler_specified=false
AC_ARG_ENABLE(media,
- AC_HELP_STRING([--enable-media=handler], [Enable media handling support using
the specified handler: gst or none (no sound) [[none]] ]),
+ AC_HELP_STRING([--enable-media=handler], [Enable media handling support using
the specified handler: gst, ffmpeg or none (no sound) [[gst]] ]),
[case "${enableval}" in
GST|gst)
media_handler=gst
media_handler_specified=true
;;
+ ffmpeg|FFMPEG)
+ media_handler=ffmpeg
+ media_handler_specified=true
+ ;;
no|NO|none)
media_handler=none
media_handler_specified=true
@@ -1583,9 +1587,14 @@
case "${media_handler}" in
gst) AC_DEFINE([SOUND_GST], [1], [Use GSTREAMER for media handling]) ;;
+ ffmpeg) AC_DEFINE([SOUND_SDL], [1], [Use SDL for sound handling]) ;;
*)
esac
+case "${media_handler}" in
+ ffmpeg) AC_DEFINE([USE_FFMPEG], [1], [Use FFMPEG for media decoding]) ;;
+ *)
+esac
dnl I'm kinda lazy, get rid of this later... //Markus
AM_CONDITIONAL(HAVE_GST, test x$media_handler = xgst)
Index: gui/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/gui/Makefile.am,v
retrieving revision 1.118
diff -u -r1.118 Makefile.am
--- gui/Makefile.am 17 Feb 2008 02:04:26 -0000 1.118
+++ gui/Makefile.am 20 Feb 2008 07:56:42 -0000
@@ -42,11 +42,10 @@
-I$(top_srcdir)/backend \
-I$(top_srcdir)/libgeometry \
-I$(top_srcdir)/libmedia \
- -I$(top_srcdir)/libmedia/sdl \
- -I$(top_srcdir)/libmedia/gst \
+ -I$(top_srcdir)/libmedia/ffmpeg \
+ -I$(top_srcdir)/libmedia/gst \
-DLOCALEDIR=\"$(localedir)\" \
-DPLUGINSDIR=\"$(pluginsdir)\" \
- $(GLIB_CFLAGS) \
$(LIBXML_CFLAGS) \
$(DMALLOC_CFLAGS) \
$(LIRC_CFLAGS) \
@@ -79,7 +78,6 @@
AM_LDFLAGS = \
$(GLIB_LIBS) \
$(LIBLTDL) \
- $(FFMPEG_LIBS) \
$(CURL_LIBS) \
$(LIBXML_LIBS) \
$(INCLTDL) \
@@ -127,19 +125,19 @@
endif # HAVE_OPENGL
endif # BUILD_AQUA_GUI
-if USE_SOUND_SDL
if USE_FFMPEG_ENGINE
AM_LDFLAGS += $(FFMPEG_LIBS)
-AM_CPPFLAGS += $(FFMPEG_CFLAGS)
+AM_CPPFLAGS += $(FFMPEG_CFLAGS)
endif
+
if USE_MAD_ENGINE
AM_LDFLAGS += $(MAD_LIBS)
AM_CPPFLAGS += $(MAD_CFLAGS)
endif
-endif
if USE_SOUND_GST
AM_CPPFLAGS += $(GSTREAMER_CFLAGS)
+AM_LDFLAGS += $(GSTREAMER_LIBS)
endif
# if USE_GUI_FLTK
@@ -165,8 +163,8 @@
bin_PROGRAMS =
gnash: gnash.in
- $(INSTALL_DATA) $? gnash
- chmod a+x gnash
+ cp $< $@
+ chmod +x $@
GUI_SRCS = gnash.cpp \
gui.cpp gui.h \
Index: libmedia/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/libmedia/Makefile.am,v
retrieving revision 1.12
diff -u -r1.12 Makefile.am
--- libmedia/Makefile.am 8 Feb 2008 15:27:30 -0000 1.12
+++ libmedia/Makefile.am 20 Feb 2008 07:56:42 -0000
@@ -42,12 +42,11 @@
-I$(top_srcdir)/server/parser \
-I$(top_srcdir)/libgeometry \
$(PTHREAD_CFLAGS) \
+ $(DMALLOC_CFLAGS) \
$(OPENGL_CFLAGS) \
$(LIBXML_CFLAGS) \
$(PNG_CFLAGS) \
- $(SDL_CFLAGS) \
$(GLIB_CFLAGS) \
- $(GSTREAMER_CFLAGS) \
$(CURL_CFLAGS) \
$(Z_CFLAGS) \
$(JPEG_CFLAGS) \
@@ -72,7 +71,6 @@
$(LIBLTDLHEAD) \
$(BOOST_LIBS) \
$(PTHREAD_LIBS) \
- $(SDL_LIBS) \
$(NULL)
libgnashmedia_la_SOURCES = \
@@ -133,39 +131,39 @@
if USE_FFMPEG_ENGINE
libgnashmedia_la_SOURCES += \
- sdl/MediaDecoderSdl.cpp \
- sdl/AudioDecoderFfmpeg.cpp \
- sdl/VideoDecoderFfmpeg.cpp \
- sdl/MediaParserFfmpeg.cpp \
- sdl/sound_handler_sdl.cpp
+ ffmpeg/AudioDecoderFfmpeg.cpp \
+ ffmpeg/VideoDecoderFfmpeg.cpp \
+ ffmpeg/sound_handler_sdl.cpp \
+ ffmpeg/ffmpegNetStreamUtil.cpp
noinst_HEADERS += \
- sdl/AudioDecoderFfmpeg.h \
- sdl/VideoDecoderFfmpeg.h \
- sdl/sound_handler_sdl.h \
- sdl/MediaDecoderSdl.h \
- sdl/MediaParserFfmpeg.h
+ ffmpeg/AudioDecoderFfmpeg.h \
+ ffmpeg/VideoDecoderFfmpeg.h \
+ ffmpeg/sound_handler_sdl.h \
+ ffmpeg/ffmpegNetStreamUtil.h
libgnashmedia_la_LIBADD += \
- $(FFMPEG_LIBS)
+ $(FFMPEG_LIBS) \
+ $(SDL_LIBS)
libgnashmedia_la_CPPFLAGS += \
- $(FFMPEG_CFLAGS)
+ $(FFMPEG_CFLAGS) \
+ $(SDL_CFLAGS)
endif
if USE_MAD_ENGINE
libgnashmedia_la_SOURCES += \
- sdl/MediaDecoderSdl.cpp \
- sdl/AudioDecoderMad.cpp \
- sdl/sound_handler_sdl.cpp
+ ffmpeg/MediaDecoderSdl.cpp \
+ ffmpeg/AudioDecoderMad.cpp \
+ ffmpeg/sound_handler_sdl.cpp
noinst_HEADERS += \
- sdl/MediaDecoderSdl.h \
- sdl/AudioDecoderMad.h \
- sdl/sound_handler_sdl.h
+ ffmpeg/MediaDecoderSdl.h \
+ ffmpeg/AudioDecoderMad.h \
+ ffmpeg/sound_handler_sdl.h
libgnashmedia_la_LIBADD += \
- $(MAD_LIBS)
+ $(MAD_LIBS)
libgnashmedia_la_CPPFLAGS += \
$(MAD_CFLAGS)
Index: libmedia/sound_handler.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/sound_handler.h,v
retrieving revision 1.10
diff -u -r1.10 sound_handler.h
--- libmedia/sound_handler.h 9 Feb 2008 15:06:01 -0000 1.10
+++ libmedia/sound_handler.h 20 Feb 2008 07:56:42 -0000
@@ -355,7 +355,41 @@
///
virtual bool is_muted() = 0;
+#ifdef USE_FFMPEG
+ /// This is called by AS classes NetStream or Sound to attach callback,
so
+ /// that audio from the classes will be played through the soundhandler.
+ //
+ /// This is actually only used by the SDL sound_handler. It uses these
"auxiliary"
+ /// streamers to fetch decoded audio data to mix and send to the output
channel.
+ ///
+ /// The "aux streamer" will be called with the 'udata' pointer as first
argument,
+ /// then will be passed a buffer pointer as second argument and it's
length
+ /// as third. The callbacks should fill the given buffer if possible.
+ /// The callback should return true if wants to remain attached, false
if wants
+ /// to be detached.
+ ///
+ /// @param ptr
+ /// The pointer to the callback function
+ ///
+ /// @param udata
+ /// User data pointer, passed as first argument to the registered
callback.
+ /// WARNING: this is currently also used to *identify* the callback
for later
+ /// removal, see detach_aux_streamer. TODO: stop using the data
pointer for
+ /// identification purposes and use the callback pointer directly
instead.
+ ///
+ virtual void attach_aux_streamer(aux_streamer_ptr ptr, void* owner)
= 0;
+ /// This is called by AS classes NetStream or Sound to dettach
callback, so
+ /// that audio from the classes no longer will be played through the
+ /// soundhandler.
+ //
+ /// @param udata
+ /// The key identifying the auxiliary streamer.
+ /// WARNING: this need currently be the 'udata' pointer passed to
attach_aux_streamer.
+ /// TODO: get the aux_streamer_ptr as key !!
+ ///
+ virtual void detach_aux_streamer(void* udata) = 0;
+#endif
virtual ~sound_handler() {};
Index: po/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/po/Makefile.am,v
retrieving revision 1.15
diff -u -r1.15 Makefile.am
--- po/Makefile.am 13 Jan 2008 10:31:52 -0000 1.15
+++ po/Makefile.am 20 Feb 2008 07:56:42 -0000
@@ -35,7 +35,7 @@
$(top_srcdir)/backend \
$(top_srcdir)/libamf \
$(top_srcdir)/libmedia \
- $(top_srcdir)/libmedia/sdl \
+ $(top_srcdir)/libmedia/ffmpeg \
$(top_srcdir)/libmedia/gst \
$(top_srcdir)/server \
$(top_srcdir)/server/vm \
Index: pythonmodule/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/pythonmodule/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- pythonmodule/Makefile.am 10 Jan 2008 08:25:28 -0000 1.3
+++ pythonmodule/Makefile.am 20 Feb 2008 07:56:42 -0000
@@ -34,6 +34,7 @@
$(GLIB_LIBS) \
$(LIBLTDL) \
$(FFMPEG_LIBS) \
+ $(GSTREAMER_LIBS) \
$(CURL_LIBS) \
$(LIBXML_LIBS) \
$(INCLTDL) \
@@ -51,7 +52,7 @@
-I$(top_srcdir)/backend \
-I$(top_srcdir)/libgeometry \
-I$(top_srcdir)/libmedia \
- -I$(top_srcdir)/libmedia/sdl \
+ -I$(top_srcdir)/libmedia/ffmpeg \
-I$(top_srcdir)/libmedia/gst \
-DLOCALEDIR=\"$(localedir)\" \
$(BOOSTPYTHON_CFLAGS) \
@@ -84,7 +85,7 @@
-I$(top_srcdir)/backend \
-I$(top_srcdir)/libgeometry \
-I$(top_srcdir)/libmedia \
- -I$(top_srcdir)/libmedia/sdl \
+ -I$(top_srcdir)/libmedia/ffmpeg \
-I$(top_srcdir)/libmedia/gst \
-DLOCALEDIR=\"$(localedir)\" \
-DBOOST_PYTHON_DYNAMIC_LIB \
Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.138
diff -u -r1.138 Makefile.am
--- server/Makefile.am 8 Feb 2008 15:27:32 -0000 1.138
+++ server/Makefile.am 20 Feb 2008 07:56:42 -0000
@@ -37,13 +37,10 @@
-I$(top_srcdir)/libbase \
-I$(top_srcdir)/libgeometry \
-I$(top_srcdir)/libmedia \
- -I$(top_srcdir)/libmedia/sdl \
- -I$(top_srcdir)/libmedia/gst \
-I$(top_srcdir) \
$(PTHREAD_CFLAGS) \
$(DMALLOC_CFLAGS) \
$(GLIB_CFLAGS) \
- $(GSTREAMER_CFLAGS) \
$(BOOST_CFLAGS) \
$(LIBXML_CFLAGS) \
$(FREETYPE2_CFLAGS) \
@@ -202,10 +199,15 @@
$(NULL)
if USE_SOUND_GST
-AM_CPPFLAGS += $(GSTREAMER_CFLAGS)
+AM_CPPFLAGS += $(GSTREAMER_CFLAGS) \
+ -I$(top_srcdir)/libmedia/gst
libgnashserver_la_LIBADD += $(GSTREAMER_LIBS)
endif
+if USE_FFMPEG_ENGINE
+AM_CPPFLAGS += $(FFMPEG_CFLAGS) \
+ -I$(top_srcdir)/libmedia/ffmpeg
+endif
# Enable building the Flash debugger
if DEBUGGER
Index: server/asobj/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Makefile.am,v
retrieving revision 1.48
diff -u -r1.48 Makefile.am
--- server/asobj/Makefile.am 21 Jan 2008 20:55:56 -0000 1.48
+++ server/asobj/Makefile.am 20 Feb 2008 07:56:42 -0000
@@ -32,14 +32,10 @@
-I$(top_srcdir)/libamf \
-I$(top_srcdir)/libltdl \
-I$(top_srcdir)/libmedia \
- -I$(top_srcdir)/libmedia/gst \
- -I$(top_srcdir)/libmedia/sdl \
-I$(top_srcdir) \
$(PTHREAD_CFLAGS) \
$(DMALLOC_CFLAGS) \
$(GLIB_CFLAGS) \
- $(FFMPEG_CFLAGS) \
- $(GSTREAMER_CFLAGS) \
$(BOOST_CFLAGS) \
$(LIBXML_CFLAGS) \
$(NULL)
@@ -71,7 +67,7 @@
Math.cpp \
Microphone.cpp \
Mouse.cpp \
- NetConnection.cpp\
+ NetConnection.cpp \
NetStream.cpp \
Number.cpp \
Object.cpp \
@@ -145,14 +141,19 @@
$(LIBXML_LIBS)
if USE_FFMPEG_ENGINE
-libgnashasobjs_la_SOURCES += NetStreamFfmpeg.cpp SoundFfmpeg.cpp
-AM_CPPFLAGS += $(FFMPEG_CFLAGS)
-# libgnashasobjs_la_LIBADD += $(FFMPEG_LIBS)
+libgnashasobjs_la_SOURCES += NetStreamFfmpeg.cpp \
+ SoundFfmpeg.cpp
+AM_CPPFLAGS += $(FFMPEG_CFLAGS) \
+ $(SDL_CFLAGS) \
+ -I$(top_srcdir)/libmedia/ffmpeg
+libgnashasobjs_la_LIBADD += $(FFMPEG_LIBS) \
+ $(SDL_LIBS)
endif
if USE_SOUND_GST
libgnashasobjs_la_SOURCES += NetStreamGst.cpp SoundGst.cpp
-AM_CPPFLAGS += $(GSTREAMER_CFLAGS)
+AM_CPPFLAGS += $(GSTREAMER_CFLAGS) \
+ -I$(top_srcdir)/libmedia/gst
libgnashasobjs_la_LIBADD += $(GSTREAMER_LIBS)
endif
Index: server/asobj/NetConnection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.cpp,v
retrieving revision 1.56
diff -u -r1.56 NetConnection.cpp
--- server/asobj/NetConnection.cpp 30 Jan 2008 10:09:35 -0000 1.56
+++ server/asobj/NetConnection.cpp 20 Feb 2008 07:56:43 -0000
@@ -50,15 +50,80 @@
NetConnection::NetConnection()
:
- as_object(getNetConnectionInterface())
+ as_object(getNetConnectionInterface()),
+ _loader()
{
attachProperties();
}
+
NetConnection::~NetConnection()
{
}
+
+/*public*/
+bool NetConnection::openConnection(const std::string& url)
+{
+ // if already running there is no need to setup things again
+ if ( _loader.get() ) {
+ log_debug("NetConnection::openConnection() called when already connected
to a stream. Checking if the existing connection can be used.");
+ std::string newurl;
+ if (_prefixUrl.size() > 0) {
+ newurl += _prefixUrl + "/" + url;
+ } else {
+ newurl += url;
+ }
+ if (newurl.compare(_completeUrl) == 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ if ( _prefixUrl.size() > 0 ) {
+ _completeUrl += _prefixUrl + "/" + url;
+ } else {
+ _completeUrl += url;
+ }
+
+ URL uri( _completeUrl, get_base_url() );
+
+ std::string uriStr( uri.str() );
+ assert( uriStr.find( "://" ) != std::string::npos );
+
+ // Check if we're allowed to open url
+ if ( ! URLAccessManager::allow( uri ) ) {
+ log_security( _("Gnash is not allowed to open this url: %s"),
uriStr.c_str() );
+ return false;
+ }
+
+ log_msg( _("Connecting to movie: %s"), uriStr.c_str() );
+
+ _loader.reset( new LoadThread() );
+
+ if ( ! _loader->setStream(
std::auto_ptr<tu_file>(StreamProvider::getDefaultInstance().getStream( uri ) )
) ) {
+ log_error( _("Gnash could not open this url: %s"), uriStr.c_str() );
+ _loader.reset();
+
+ return false;
+ }
+
+ log_msg( _("Connection established to movie: %s"), uriStr.c_str() );
+
+ return true;
+}
+
+
+/*public*/
+bool
+NetConnection::eof()
+{
+ if (!_loader.get()) return true; // @@ correct ?
+ return _loader->eof();
+}
+
+
/*public*/
std::string NetConnection::validateURL(const std::string& url)
{
@@ -85,7 +150,7 @@
return uriStr;
}
-/*public*/
+/*private*/
void
NetConnection::addToURL(const std::string& url)
{
@@ -100,6 +165,82 @@
}
+/*public*/
+size_t
+NetConnection::read( void *dst, size_t bytes )
+{
+ if ( ! _loader.get() ) {
+ return 0;
+ }
+
+ return _loader->read( dst, bytes );
+}
+
+
+/*public*/
+bool
+NetConnection::seek( size_t pos )
+{
+ if ( ! _loader.get() ) {
+ return false;
+ }
+
+ return _loader->seek( pos );
+}
+
+
+/*public*/
+size_t
+NetConnection::tell()
+{
+ if (!_loader.get()) return 0; // @@ correct ?
+ return _loader->tell();
+}
+
+
+/*public*/
+long
+NetConnection::getBytesLoaded()
+{
+ if (!_loader.get()) return 0; // @@ correct ?
+ return _loader->getBytesLoaded();
+}
+
+
+/*public*/
+long
+NetConnection::getBytesTotal()
+{
+ if (!_loader.get()) return 0; // @@ correct ?
+ return _loader->getBytesTotal();
+}
+
+
+/*public*/
+bool
+NetConnection::loadCompleted()
+{
+ if ( ! _loader.get() ) {
+ return false;
+ }
+
+ return _loader->completed();
+}
+
+
+std::auto_ptr<FLVParser>
+NetConnection::getConnectedParser() const
+{
+ std::auto_ptr<FLVParser> ret;
+
+ if ( _loader.get() ) {
+ ret.reset( new FLVParser(*_loader) );
+ }
+
+ return ret;
+}
+
+
/// \brief callback to instantiate a new NetConnection object.
/// \param fn the parameters from the Flash movie
/// \return nothing from the function call.
Index: server/asobj/NetConnection.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.h,v
retrieving revision 1.38
diff -u -r1.38 NetConnection.h
--- server/asobj/NetConnection.h 21 Jan 2008 20:55:56 -0000 1.38
+++ server/asobj/NetConnection.h 20 Feb 2008 07:56:43 -0000
@@ -80,6 +80,83 @@
/// Register the "NetConnection" constructor to the given global object
static void registerConstructor(as_object& global);
+ /// Open a connection to stream FLV files.
+ //
+ /// If already connected an error is raised and false
+ /// is returned. Otherwise, a connection is attempted
+ /// using a separate thread that starts loading data
+ /// caching it.
+ ///
+ /// @param url
+ /// An url portion to append to the base url (???)
+ ///
+ /// @return true on success, false on error.
+ ///
+ /// @note Older Flash movies can only take a NULL value as
+ /// the parameter, which therefor only connects to the localhost using
+ /// RTMP. Newer Flash movies have a parameter to connect which is a
+ /// URL string like rtmp://foobar.com/videos/bar.flv
+ ///
+ bool openConnection(const std::string& url);
+
+ /// Put read pointer at given position
+ //
+ /// If the position has not been loaded yet
+ /// this call blocks. If not connected false
+ /// is returned w/out blocking.
+ ///
+ bool seek(size_t pos);
+
+ /// Read 'bytes' bytes into the given buffer.
+ //
+ /// If not enough bytes have been loaded yet
+ /// this call blocks. If not connected false
+ /// is returned w/out blocking.
+ ///
+ /// Return number of actually read bytes
+ ///
+ size_t read(void *dst, size_t bytes);
+
+ /// Return true if EOF has been reached
+ //
+ /// This call never blocks.
+ /// If not connected, true is returned (is this correct behaviour?)
+ ///
+ bool eof();
+
+ /// Report global position within the file
+ //
+ /// This call never blocks.
+ /// If not connected, 0 is returned (is this correct behaviour?)
+ ///
+ size_t tell();
+
+ /// Returns the number of bytes cached
+ //
+ /// This call never blocks.
+ /// If not connected, 0 is returned (is this correct behaviour?)
+ ///
+ long getBytesLoaded();
+
+ /// Returns the total size of the file
+ //
+ /// This call never blocks.
+ /// If not connected, 0 is returned (is this correct behaviour?)
+ ///
+ long getBytesTotal();
+
+ /// Return an FLVParser using our LoadThread for input
+ //
+ /// If not connected, a NULL auto_ptr is returned.
+ ///
+ std::auto_ptr<FLVParser> getConnectedParser() const;
+
+ /// Returns whether the load is complete
+ //
+ /// This call never blocks.
+ ///
+ bool loadCompleted();
+
private:
/// Extend the URL to be used for playing
@@ -88,6 +165,12 @@
/// the url prefix optionally passed to connect()
std::string _prefixUrl;
+ /// the complete url of the file
+ std::string _completeUrl;
+
+ /// The file/stream loader thread and interface
+ std::auto_ptr<LoadThread> _loader;
+
/// Attach ActionScript instance properties
void attachProperties();
Index: server/asobj/NetStreamFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.cpp,v
retrieving revision 1.104
diff -u -r1.104 NetStreamFfmpeg.cpp
--- server/asobj/NetStreamFfmpeg.cpp 21 Jan 2008 20:55:57 -0000 1.104
+++ server/asobj/NetStreamFfmpeg.cpp 20 Feb 2008 07:56:43 -0000
@@ -31,7 +31,6 @@
#include "NetStream.h"
#include "render.h"
#include "movie_root.h"
-#include "NetConnection.h"
#include "sound_handler.h"
#include "VideoDecoderFfmpeg.h"
#include "tu_timer.h" // TODO: use the VirtualClock instead ?
@@ -88,26 +87,33 @@
close();
}
-void NetStreamFfmpeg::pause(int mode)
+
+void NetStreamFfmpeg::pause( PauseMode mode )
{
+ switch ( mode ) {
+ case pauseModeToggle:
+ if ( m_pause ) {
+ unpausePlayback();
+ } else {
+ pausePlayback();
+ }
+ break;
+ case pauseModePause:
+ pausePlayback();
+ break;
+ case pauseModeUnPause:
+ unpausePlayback();
+ break;
+ default:
+ break;
+ }
- if (mode == -1)
- {
- if (m_pause) unpausePlayback();
- else pausePlayback();
- }
- else
- {
- if (mode == 0) pausePlayback();
- else unpausePlayback();
- }
- if (!m_pause && !m_go)
- {
- setStatus(playStart);
- m_go = true;
- _decodeThread = new
boost::thread(boost::bind(NetStreamFfmpeg::av_streamer, this));
- }
+ if ( !m_pause && !m_go ) {
+ setStatus( playStart );
+ m_go = true;
+ _decodeThread = new boost::thread(
boost::bind(NetStreamFfmpeg::av_streamer, this) );
+ }
}
void NetStreamFfmpeg::close()
@@ -136,25 +142,15 @@
if (m_Frame) av_free(m_Frame);
m_Frame = NULL;
- if (m_VCodecCtx)
- {
- avcodec_close(m_VCodecCtx);
- if (m_isFLV)
- {
- av_free(m_VCodecCtx);
- }
- }
- m_VCodecCtx = NULL;
-
- if (m_ACodecCtx)
- {
- avcodec_close(m_ACodecCtx);
- if (m_isFLV)
- {
- av_free(m_ACodecCtx);
- }
- }
- m_ACodecCtx = NULL;
+ if ( m_VCodecCtx ) {
+ avcodec_close( m_VCodecCtx );
+ }
+ m_VCodecCtx = NULL;
+
+ if ( m_ACodecCtx ) {
+ avcodec_close( m_ACodecCtx );
+ }
+ m_ACodecCtx = NULL;
if (m_FormatCtx)
{
@@ -209,7 +205,7 @@
// Offset is absolute new position in the file
if (whence == SEEK_SET)
- {
+ {
nc->seek(offset);
ns->inputPos = offset;
@@ -228,7 +224,7 @@
// Instead we seek to 50.000 bytes... seems to work fine...
nc->seek(50000);
ns->inputPos = 50000;
-
+
}
return ns->inputPos;
@@ -451,16 +447,13 @@
if (!m_VCodecCtx)
{
log_msg(_("Failed to initialize FLV video codec"));
+ return false;
}
m_ACodecCtx = initFlvAudio(m_parser.get());
if (!m_ACodecCtx)
{
log_msg(_("Failed to initialize FLV audio codec"));
- }
-
- if (!m_ACodecCtx && !m_VCodecCtx)
- {
return false;
}
@@ -625,24 +618,20 @@
/// of this structure must be initialized.
/// @param width the width, in bytes, of a row of video data.
static void
-rgbcopy(image::rgb* dst, raw_mediadata_t* src, int width)
+rgbcopy(image::rgb* dst, media::raw_mediadata_t* src, int width)
{
- assert( dst->size() >= src->m_size );
- assert( dst->pitch() >= width );
- dst->update(src->m_data);
-
-#if 0
- boost::uint8_t* dstptr = dst->m_data;
-
- boost::uint8_t* srcptr = src->m_data;
- boost::uint8_t* srcend = src->m_data + src->m_size;
-
- while (srcptr < srcend) {
- memcpy(dstptr, srcptr, width);
- dstptr += dst->m_pitch;
- srcptr += width;
- }
-#endif
+ assert( src->m_size <= static_cast<boost::uint32_t>(dst->width() *
dst->height() * 3) );
+
+ boost::uint8_t* dstptr = dst->data();
+
+ boost::uint8_t* srcptr = src->m_data;
+ boost::uint8_t* srcend = src->m_data + src->m_size;
+
+ while (srcptr < srcend) {
+ memcpy(dstptr, srcptr, width);
+ dstptr += dst->pitch();
+ srcptr += width;
+ }
}
// decoder thread
@@ -695,7 +684,7 @@
if (ns->m_isFLV)
{
// If queues are full then don't bother filling it
- if ((ns->m_VCodecCtx && ns->m_qvideo.size() < 20) ||
(ns->m_ACodecCtx && ns->m_qaudio.size() < 20))
+ if ( ns->m_qvideo.size() < 20 || ns->m_qaudio.size() <
20 )
{
// If we have problems with decoding - break
@@ -747,7 +736,7 @@
while (len > 0 && ns->m_qaudio.size() > 0)
{
- raw_mediadata_t* samples = ns->m_qaudio.front();
+ media::raw_mediadata_t* samples = ns->m_qaudio.front();
int n = imin(samples->m_size, len);
memcpy(stream, samples->m_ptr, n);
@@ -771,14 +760,12 @@
bool NetStreamFfmpeg::decodeFLVFrame()
{
FLVFrame* frame = NULL;
- if (m_qvideo.size() < m_qaudio.size() && m_VCodecCtx)
- {
- frame = m_parser->nextVideoFrame();
- }
- else if (m_ACodecCtx)
+ if ( m_qvideo.size() < m_qaudio.size() )
{
- frame = m_parser->nextAudioFrame();
- }
+ frame = m_parser->nextVideoFrame();
+ } else {
+ frame = m_parser->nextAudioFrame();
+ }
if (frame == NULL)
{
@@ -788,7 +775,7 @@
log_debug("decodeFLVFrame: load completed, stopping");
#endif
// Stop!
- //m_go = false;
+ this->m_go = false;
}
else
{
@@ -799,28 +786,29 @@
return false;
}
- AvPkt packet;
- // TODO: move this logic in AvPkt itself ?
- packet->destruct = avpacket_destruct;
- packet->size = frame->dataSize;
- packet->data = frame->data;
- // FIXME: is this the right value for packet.dts?
- packet->pts = packet->dts =
static_cast<boost::int64_t>(frame->timestamp);
+ AVPacket packet;
+
+ packet.destruct = avpacket_destruct;
+ packet.size = frame->dataSize;
+ packet.data = frame->data;
+ // FIXME: is this the right value for packet.dts?
+ packet.pts = packet.dts = static_cast<boost::int64_t>(frame->timestamp);
if (frame->tag == 9)
{
- packet->stream_index = 0;
- return decodeVideo(packet);
+ packet.stream_index = 0;
+ return decodeVideo(&packet);
}
else
{
- packet->stream_index = 1;
- return decodeAudio(packet);
+ packet.stream_index = 1;
+ return decodeAudio(&packet);
}
}
-bool NetStreamFfmpeg::decodeAudio(AvPkt& packet)
+
+bool NetStreamFfmpeg::decodeAudio( AVPacket* packet )
{
if (!m_ACodecCtx) return false;
@@ -852,7 +840,7 @@
ptr = reinterpret_cast<boost::uint8_t*>(output);
}
- raw_mediadata_t* raw = new raw_mediadata_t();
+ media::raw_mediadata_t* raw = new media::raw_mediadata_t();
raw->m_data = ptr;
raw->m_ptr = raw->m_data;
@@ -895,7 +883,8 @@
return true;
}
-bool NetStreamFfmpeg::decodeVideo(AvPkt& packet)
+
+bool NetStreamFfmpeg::decodeVideo(AVPacket* packet)
{
if (!m_VCodecCtx) return false;
@@ -925,7 +914,7 @@
}
else if (m_videoFrameFormat == render::YUV &&
m_VCodecCtx->pix_fmt != PIX_FMT_YUV420P)
{
- abort(); // TODO
+ assert( 0 ); // TODO
//img_convert((AVPicture*) pFrameYUV, PIX_FMT_YUV420P,
(AVPicture*) pFrame, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
// Don't use depreceted img_convert, use sws_scale
@@ -935,7 +924,7 @@
buffer.reset(media::VideoDecoderFfmpeg::convertRGB24(m_VCodecCtx, m_Frame));
}
- raw_mediadata_t* video = new raw_mediadata_t;
+ media::raw_mediadata_t* video = new media::raw_mediadata_t();
if (m_videoFrameFormat == render::YUV)
{
@@ -944,7 +933,7 @@
else if (m_videoFrameFormat == render::RGB)
{
image::rgb* tmp =
static_cast<image::rgb*>(m_imageframe);
- video->m_data = new
boost::uint8_t[m_imageframe->size()]; // tmp->m_pitch * tmp->m_height];
+ video->m_data = new boost::uint8_t[tmp->pitch() *
tmp->height()];
}
video->m_ptr = video->m_data;
@@ -1052,29 +1041,30 @@
return true;
}
- AvPkt packet;
+ AVPacket packet;
- int rc = av_read_frame(m_FormatCtx, packet.get());
+ int rc = av_read_frame(m_FormatCtx, &packet);
if (rc >= 0)
{
- if (packet->stream_index == m_audio_index &&
get_sound_handler())
+ if (packet.stream_index == m_audio_index && get_sound_handler())
{
- if (!decodeAudio(packet))
+ if (!decodeAudio(&packet))
{
log_error(_("Problems decoding audio frame"));
return false;
}
}
else
- if (packet->stream_index == m_video_index)
+ if (packet.stream_index == m_video_index)
{
- if (!decodeVideo(packet))
+ if (!decodeVideo(&packet))
{
log_error(_("Problems decoding video frame"));
return false;
}
}
+ av_free_packet(&packet);
}
else
{
@@ -1107,7 +1097,7 @@
{
AVStream* videostream = m_FormatCtx->streams[m_video_index];
- timebase = as_double(videostream->time_base);
+ timebase = static_cast<double>(videostream->time_base.num /
videostream->time_base.den);
newpos = static_cast<long>(pos / timebase);
if (av_seek_frame(m_FormatCtx, m_video_index, newpos, 0) < 0)
@@ -1144,19 +1134,23 @@
}
else
{
- AvPkt packet;
+ AVPacket Packet;
+ av_init_packet(&Packet);
double newtime = 0;
while (newtime == 0)
{
- if ( av_read_frame(m_FormatCtx, packet.get()) < 0)
+ if (av_read_frame(m_FormatCtx, &Packet) < 0)
{
av_seek_frame(m_FormatCtx, -1, 0,
AVSEEK_FLAG_BACKWARD);
+ av_free_packet( &Packet );
return;
}
newtime = timebase *
(double)m_FormatCtx->streams[m_video_index]->cur_dts;
}
+ av_free_packet( &Packet );
+
av_seek_frame(m_FormatCtx, m_video_index, newpos, 0);
boost::uint32_t newtime_ms =
static_cast<boost::int32_t>(newtime / 1000.0);
m_start_clock += m_last_audio_timestamp - newtime_ms;
@@ -1167,8 +1161,16 @@
}
// Flush the queues
- m_qvideo.clear();
- m_qaudio.clear();
+ while ( m_qvideo.size() > 0 )
+ {
+ delete m_qvideo.front();
+ m_qvideo.pop();
+ }
+ while ( m_qaudio.size() > 0 )
+ {
+ delete m_qaudio.front();
+ m_qaudio.pop();
+ }
}
@@ -1183,7 +1185,7 @@
{
// Get video frame from queue, will have the lowest timestamp
// will return NULL if empty(). See multithread_queue::front
- raw_mediadata_t* video = m_qvideo.front();
+ media::raw_mediadata_t* video = m_qvideo.front();
// If the queue is empty we have nothing to do
if (!video)
@@ -1279,7 +1281,7 @@
if (m_FormatCtx && m_FormatCtx->nb_streams > 0)
{
- double time = as_double(m_FormatCtx->streams[0]->time_base) *
(double)m_FormatCtx->streams[0]->cur_dts;
+ double time = (double)m_FormatCtx->streams[0]->time_base.num /
(double)m_FormatCtx->streams[0]->time_base.den *
(double)m_FormatCtx->streams[0]->cur_dts;
return static_cast<boost::int32_t>(time);
}
else if
@@ -1328,10 +1330,39 @@
// Re-connect to the soundhandler.
// It was disconnected to avoid to keep playing sound while paused
media::sound_handler* s = get_sound_handler();
- if (s && m_ACodecCtx) s->attach_aux_streamer(audio_streamer, (void*)
this);
+ if ( s ) s->attach_aux_streamer(audio_streamer, (void*) this);
+}
+
+
+long
+NetStreamFfmpeg::bytesLoaded ()
+{
+ long ret_val = 0;
+
+ if ( _netCon )
+ {
+ ret_val = _netCon->getBytesLoaded();
+ }
+
+ return ret_val;
+}
+
+
+long
+NetStreamFfmpeg::bytesTotal ()
+{
+ long ret_val = 0;
+
+ if ( _netCon )
+ {
+ ret_val = _netCon->getBytesTotal();
+ }
+
+ return ret_val;
}
} // gnash namespcae
#endif // USE_FFMPEG
+
Index: server/asobj/NetStreamFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStreamFfmpeg.h,v
retrieving revision 1.56
diff -u -r1.56 NetStreamFfmpeg.h
--- server/asobj/NetStreamFfmpeg.h 21 Jan 2008 20:55:57 -0000 1.56
+++ server/asobj/NetStreamFfmpeg.h 20 Feb 2008 07:56:43 -0000
@@ -37,7 +37,6 @@
#include <boost/thread/condition.hpp>
#include "impl.h"
-#include "video_stream_instance.h"
extern "C" {
#include <ffmpeg/avformat.h>
@@ -49,194 +48,11 @@
#include "FLVParser.h"
-namespace gnash {
-
-class raw_mediadata_t
-{
-public:
- raw_mediadata_t():
- m_stream_index(-1),
- m_size(0),
- m_data(NULL),
- m_ptr(NULL),
- m_pts(0)
- {
- }
-
- ~raw_mediadata_t()
- {
- if (m_data) delete [] m_data;
- }
-
- int m_stream_index;
- boost::uint32_t m_size;
- boost::uint8_t* m_data;
- boost::uint8_t* m_ptr;
- boost::uint32_t m_pts; // presentation timestamp in millisec
-};
-
-/// Threadsafe elements-owning queue
-//
-/// This class is a threadsafe queue, using std:queue and locking.
-/// It is used to store decoded audio and video data which are waiting to be
"played"
-/// Elements of the queue are owned by instances of this class.
-///
-template<class T>
-class multithread_queue
-{
- public:
-
- multithread_queue()
- {
- }
-
- // Destroy all elements of the queue. Locks.
- ~multithread_queue()
- {
- clear();
- }
-
- // Destroy all elements of the queue. Locks.
- void clear()
- {
- boost::mutex::scoped_lock lock(_mutex);
- while (!m_queue.empty())
- {
- T x = m_queue.front();
- m_queue.pop();
- delete x;
- }
- }
-
- /// Returns the size if the queue. Locks.
- //
- /// @return the size of the queue
- ///
- size_t size()
- {
- boost::mutex::scoped_lock lock(_mutex);
- size_t n = m_queue.size();
- return n;
- }
-
- /// Pushes an element to the queue. Locks.
- //
- /// @param member
- /// The element to be pushed unto the queue.
- ///
- /// @return true if queue isn't full and the element was pushed to the
queue,
- /// or false if the queue was full, and the element wasn't push unto it.
- ///
- bool push(T member)
- {
- bool rc = false;
- boost::mutex::scoped_lock lock(_mutex);
-
- // We only keep max 20 items in the queue.
- // If it's "full" the item must wait, see calls
- // to this function in read_frame() to see how it is done.
- if (m_queue.size() < 20)
- {
- m_queue.push(member);
- rc = true;
- }
- return rc;
- }
-
- /// Returns a pointer to the first element on the queue. Locks.
- //
- /// If no elements are available this function returns NULL.
- ///
- /// @return a pointer to the first element on the queue, NULL if queue
is empty.
- ///
- T front()
- {
- boost::mutex::scoped_lock lock(_mutex);
- T member = NULL;
- if (!m_queue.empty())
- {
- member = m_queue.front();
- }
- return member;
- }
-
- /// Pops the first element from the queue. Locks.
- //
- /// If no elements are available this function is
- /// a noop.
- ///
- void pop()
- {
- boost::mutex::scoped_lock lock(_mutex);
- if (!m_queue.empty())
- {
- m_queue.pop();
- }
- }
-
-private:
-
- // Mutex used for locking
- boost::mutex _mutex;
+#include "ffmpegNetStreamUtil.h"
- // The actual queue.
- std::queue < T > m_queue;
-};
-
-/// This class is used to provide an easy interface to libavcodecs audio
resampler.
-///
-class AudioResampler
-{
-public:
- AudioResampler() : _context(NULL) {}
- ~AudioResampler()
- {
- if(_context) {
- audio_resample_close (_context);
- }
- }
-
- /// Initializes the resampler
- //
- /// @param ctx
- /// The audio format container.
- ///
- /// @return true if resampling is needed, if not false
- ///
- bool init(AVCodecContext* ctx)
- {
- if (ctx->sample_rate != 44100 || ctx->channels != 2) {
- if (!_context) {
- _context = audio_resample_init(2,
ctx->channels,
- 44100, ctx->sample_rate);
- }
- return true;
- }
- return false;
- }
-
- /// Resamples audio
- //
- /// @param input
- /// A pointer to the audio data that needs resampling
- ///
- /// @param output
- /// A pointer to where the resampled output should be placed
- ///
- /// @param samples
- /// Number of samples in the audio
- ///
- /// @return the number of samples in the output data.
- ///
- int resample(boost::int16_t* input, boost::int16_t* output, int samples)
- {
- return audio_resample (_context, output, input, samples);
- }
-private:
- // The container of the resample format information.
- ReSampleContext* _context;
-};
+namespace gnash {
+
class NetStreamFfmpeg: public NetStream {
public:
@@ -247,7 +63,7 @@
void close();
// See dox in NetStream.h
- void pause(int mode);
+ void pause( PauseMode mode );
// See dox in NetStream.h
void play(const std::string& source);
@@ -284,48 +100,11 @@
///
static bool audio_streamer(void *udata, boost::uint8_t *stream, int
len);
-private:
+ long bytesLoaded();
- /// A C++ wrapper around ffmpeg's AVPacket structure
- //
- /// Used in decodeVideo() and decodeAudio().
- //
- /// Use Pkt.get() to access.
- ///
- class AvPkt
- {
- public:
-
- /// Constructs and initialize an AVPacket
- AvPkt ()
- {
- av_init_packet(&_pkt);
- }
-
- /// Properly deinitialize the owned AVPacket
- ~AvPkt ()
- {
- av_free_packet(&_pkt);
- }
-
- /// @ return AVPacket* owned by this instance
- AVPacket* get ()
- {
- return &_pkt;
-
- }
-
- /// @ return AVPacket* owned by this instance
- AVPacket* operator-> ()
- {
- return &_pkt;
- }
-
- private:
- AVPacket _pkt;
- AvPkt(const AvPkt&);
- AvPkt& operator= (const AvPkt&);
- };
+ long bytesTotal();
+
+private:
// Setups the playback
bool startPlayback();
@@ -378,10 +157,10 @@
bool decodeFLVFrame();
// Used to decode a video frame and push it on the videoqueue
- bool decodeVideo(AvPkt& packet);
+ bool decodeVideo( AVPacket* packet );
// Used to decode a audio frame and push it on the audioqueue
- bool decodeAudio(AvPkt& packet);
+ bool decodeAudio( AVPacket* packet );
// Used to calculate a decimal value from a ffmpeg fraction
inline double as_double(AVRational time)
@@ -406,7 +185,7 @@
AVFrame* m_Frame;
// Use for resampling audio
- AudioResampler _resampler;
+ media::AudioResampler _resampler;
// The decoding thread
boost::thread* _decodeThread;
@@ -422,15 +201,15 @@
boost::uint32_t m_current_timestamp;
// The queues of audio and video data.
- multithread_queue <raw_mediadata_t*> m_qaudio;
- multithread_queue <raw_mediadata_t*> m_qvideo;
+ media::multithread_queue <media::raw_mediadata_t*> m_qaudio;
+ media::multithread_queue <media::raw_mediadata_t*> m_qvideo;
// The time we started playing in seconds (since VM start ?)
volatile boost::uint64_t m_start_clock;
// When the queues are full, this is where we keep the audio/video frame
// there wasn't room for on its queue
- raw_mediadata_t* m_unqueued_data;
+ media::raw_mediadata_t* m_unqueued_data;
ByteIOContext ByteIOCxt;
@@ -438,8 +217,10 @@
volatile boost::uint64_t m_time_of_pause;
};
+
} // gnash namespace
+
#endif // USE_FFMPEG
#endif // __NETSTREAMFFMPEG_H__
Index: server/parser/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/parser/Makefile.am,v
retrieving revision 1.42
diff -u -r1.42 Makefile.am
--- server/parser/Makefile.am 21 Jan 2008 20:55:59 -0000 1.42
+++ server/parser/Makefile.am 20 Feb 2008 07:56:43 -0000
@@ -36,8 +36,6 @@
-I$(top_srcdir)/libbase \
-I$(top_srcdir)/libgeometry \
-I$(top_srcdir)/libmedia \
- -I$(top_srcdir)/libmedia/sdl \
- -I$(top_srcdir)/libmedia/gst \
-I$(top_srcdir)/libamf \
-I$(top_srcdir) \
$(LIBXML_CFLAGS) \
@@ -91,11 +89,13 @@
libgnashparser_la_LDFLAGS = $(BOOST_LIBS) -export-dynamic # -release
$(VERSION) -no-undefined
if USE_SOUND_GST
-AM_CPPFLAGS += $(GSTREAMER_CFLAGS)
+AM_CPPFLAGS += $(GSTREAMER_CFLAGS) \
+ -I$(top_srcdir)/libmedia/gst
endif
if USE_FFMPEG_ENGINE
-AM_CPPFLAGS += $(FFMPEG_CFLAGS)
+AM_CPPFLAGS += $(FFMPEG_CFLAGS) \
+ -I$(top_srcdir)/libmedia/ffmpeg
endif
# Rebuild with GCC 4.x Mudflap support
Index: server/parser/video_stream_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/video_stream_def.cpp,v
retrieving revision 1.38
diff -u -r1.38 video_stream_def.cpp
--- server/parser/video_stream_def.cpp 18 Feb 2008 22:25:19 -0000 1.38
+++ server/parser/video_stream_def.cpp 20 Feb 2008 07:56:43 -0000
@@ -16,14 +16,19 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: video_stream_def.cpp,v 1.38 2008/02/18 22:25:19 strk Exp $
+// $Id: video_stream_def.cpp,v 1.36 2008/01/29 05:18:33 bjacques Exp $
#include "video_stream_def.h"
#include "video_stream_instance.h"
#include "render.h"
#include "BitsReader.h"
-#include "VideoDecoderGst.h"
+#ifdef SOUND_GST
+# include "VideoDecoderGst.h"
+#elif defined(USE_FFMPEG)
+# include "VideoDecoderFfmpeg.h"
+#endif
+
#include <boost/bind.hpp>
@@ -39,22 +44,31 @@
{
}
+
+#ifdef SOUND_GST
void myunref(GstBuffer* buf)
{
gst_buffer_unref(buf);
}
+#endif
video_stream_definition::~video_stream_definition()
{
+#ifdef SOUND_GST
std::for_each(_video_frames.begin(), _video_frames.end(), myunref);
+#elif defined(USE_FFMPEG)
+ for ( int32_t size = _video_frames.size()-1; size >= 0; size-- ) {
+ delete _video_frames[size];
+ }
+ _video_frames.clear();
+#endif
}
void
video_stream_definition::readDefineVideoStream(stream* in, SWF::tag_type tag,
movie_definition* m)
{
-
// Character ID has been read already, and was loaded in the constructor
assert(tag == SWF::DEFINEVIDEOSTREAM);
@@ -62,7 +76,7 @@
m_start_frame = m->get_loading_frame();
- // numFrames:2 width:2 height:2 flags:1 codec:1
+ // numFrames:2 width:2 height:2 flags:1
in->ensureBytes(8);
m_num_frames = in->read_u16();
@@ -79,13 +93,18 @@
m_codec_id = static_cast<media::videoCodecType>(in->read_u8());
+#ifdef SOUND_GST
_decoder.reset( new media::VideoDecoderGst(m_codec_id, _width, _height)
);
-
+#elif defined(USE_FFMPEG)
+ _decoder.reset( new media::VideoDecoderFfmpeg() );
+#endif
}
void
video_stream_definition::readDefineVideoFrame(stream* in, SWF::tag_type tag,
movie_definition* m)
{
+#ifdef SOUND_GST
+
// Character ID has been read already, and was loaded in the constructor
assert(tag == SWF::VIDEOFRAME);
@@ -119,6 +138,8 @@
in->read((char*)GST_BUFFER_DATA(buffer), dataSize);
_video_frames.push_back(buffer);
+
+#endif
}
@@ -129,15 +150,23 @@
return ch;
}
+
+#ifdef SOUND_GST
+
bool
has_frame_number(GstBuffer* buf, boost::uint32_t frameNumber)
{
return GST_BUFFER_OFFSET(buf) == frameNumber;
}
+#endif
+
+
std::auto_ptr<image::image_base>
video_stream_definition::get_frame_data(boost::uint32_t frameNum)
{
+#ifdef SOUND_GST
+
// Check if the requested frame holds any video data.
EmbedFrameVec::iterator it = std::find_if(_video_frames.begin(),
_video_frames.end(), boost::bind(has_frame_number, _1, frameNum));
@@ -183,6 +212,12 @@
}
return std::auto_ptr<image::image_base>(buffer.release());
+
+#elif defined(USE_FFMPEG)
+
+ return std::auto_ptr<image::image_base>( NULL );
+
+#endif
}
Index: server/parser/video_stream_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/video_stream_def.h,v
retrieving revision 1.22
diff -u -r1.22 video_stream_def.h
--- server/parser/video_stream_def.h 27 Jan 2008 07:18:20 -0000 1.22
+++ server/parser/video_stream_def.h 20 Feb 2008 07:56:43 -0000
@@ -31,7 +31,13 @@
#include "swf.h"
#include "rect.h" // for composition
#include "ControlTag.h"
-#include "VideoDecoderGst.h"
+
+#ifdef SOUND_GST
+# include "VideoDecoderGst.h"
+#elif defined(USE_FFMPEG)
+# include "VideoDecoderFfmpeg.h"
+#endif
+
#include "image.h"
#include <map>
@@ -157,7 +163,12 @@
/// Elements of this vector are owned by this instance, and will be
deleted
/// at instance destruction time.
///
+#ifdef SOUND_GST
typedef std::vector<GstBuffer*> EmbedFrameVec;
+#elif defined(USE_FFMPEG)
+ typedef std::vector<uint8_t*> EmbedFrameVec;
+#endif
+
EmbedFrameVec _video_frames;
/// Last decoded frame number
@@ -170,7 +181,11 @@
boost::uint32_t _height;
/// The decoder used to decode the video frames
+#ifdef SOUND_GST
boost::scoped_ptr<media::VideoDecoderGst> _decoder;
+#elif defined(USE_FFMPEG)
+ boost::scoped_ptr<media::VideoDecoderFfmpeg> _decoder;
+#endif
};
} // end namespace gnash
Index: server/vm/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/vm/Makefile.am,v
retrieving revision 1.17
diff -u -r1.17 Makefile.am
--- server/vm/Makefile.am 21 Jan 2008 20:56:04 -0000 1.17
+++ server/vm/Makefile.am 20 Feb 2008 07:56:43 -0000
@@ -31,12 +31,8 @@
-I$(top_srcdir)/libgeometry \
-I$(top_srcdir)/libamf \
-I$(top_srcdir)/libmedia \
- -I$(top_srcdir)/libmedia/sdl \
- -I$(top_srcdir)/libmedia/gst \
-I$(top_srcdir) \
$(GLIB_CFLAGS) \
- $(FFMPEG_CFLAGS) \
- $(GSTREAMER_CFLAGS) \
$(PTHREAD_CFLAGS) \
$(DMALLOC_CFLAGS) \
$(BOOST_CFLAGS) \
Index: utilities/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/utilities/Makefile.am,v
retrieving revision 1.64
diff -u -r1.64 Makefile.am
--- utilities/Makefile.am 13 Feb 2008 02:36:34 -0000 1.64
+++ utilities/Makefile.am 20 Feb 2008 07:56:43 -0000
@@ -36,9 +36,7 @@
$(LIBLTDL) \
$(MYSQL_LIBS) \
$(LIBXML_LIBS) \
- $(FFMPEG_LIBS) \
$(CURL_LIBS) \
- $(INTLLIBS) \
$(BOOST_LIBS) \
$(PTHREAD_LIBS) \
$(NULL)
@@ -56,8 +54,6 @@
-I$(top_srcdir)/server/parser \
-I$(top_srcdir)/server/vm \
-I$(top_srcdir)/libmedia \
- -I$(top_srcdir)/libmedia/sdl \
- -I$(top_srcdir)/libmedia/gst \
-DLOCALEDIR=\"$(localedir)\" \
$(PTHREAD_CFLAGS) \
$(BOOST_CFLAGS) \
@@ -66,7 +62,8 @@
$(NULL)
if USE_FFMPEG_ENGINE
- AM_CPPFLAGS += $(FFMPEG_INCLS)
+ AM_CPPFLAGS += $(FFMPEG_CFLAGS) \
+ -I$(top_srcdir)/libmedia/ffmpeg
GNASH_LIBS += $(FFMPEG_LIBS)
endif
@@ -76,6 +73,8 @@
endif
#if USE_SOUND_GST
+ AM_CPPFLAGS += $(GSTREAMER_CFLAGS) \
+ -I$(top_srcdir)/libmedia/gst
GNASH_LIBS += $(GLIB_LIBS) $(GSTREAMER_LIBS)
#endif
@@ -86,14 +85,14 @@
gprocessor_CPPFLAGS = $(AM_CPPFLAGS)
# export our symbols so they can be used by Gnash plugins
gprocessor_LDFLAGS = -export-dynamic $(LIBLTDL)
-gprocessor_LDADD = $(GNASH_LIBS) $(AM_LDFLAGS)
+gprocessor_LDADD = $(GNASH_LIBS)
#gprocessor_DEPENDENCIES =
dumpshm_SOURCES = dumpshm.cpp
-dumpshm_LDADD = $(GNASH_LIBS) $(AM_LDFLAGS)
+dumpshm_LDADD = $(GNASH_LIBS)
soldumper_SOURCES = soldumper.cpp
-soldumper_LDADD = $(GNASH_LIBS) $(AM_LDFLAGS)
+soldumper_LDADD = $(GNASH_LIBS)
# Rebuild with GCC 4.x Mudflap support
mudflap:
ffmpegDir.tar.gz
Description: GNU Zip compressed data
rebuild.ffmpeg.x86.sh
Description: application/shellscript
rebuild.gst.x86.sh
Description: application/shellscript
- [Gnash-dev] Re: from Hong Yu: partial progress of debugging Gnash-cvs with new FFmpeg, (continued)
- [Gnash-dev] Re: from Hong Yu: partial progress of debugging Gnash-cvs with new FFmpeg, strk, 2008/02/01
- Re: [Gnash-dev] Re: from Hong Yu: partial progress of debugging Gnash-cvs with new FFmpeg, strk, 2008/02/01
- Re: [Gnash-dev] Re: from Hong Yu: partial progress of debugging Gnash-cvs with new FFmpeg, Hong Yu, 2008/02/03
- Re: [Gnash-dev] Re: from Hong Yu: partial progress of debugging Gnash-cvs with new FFmpeg, Hong Yu, 2008/02/05
- Re: [Gnash-dev] Re: from Hong Yu: partial progress of debugging Gnash-cvs with new FFmpeg, Markus Gothe, 2008/02/05
- Re: [Gnash-dev] Re: from Hong Yu: partial progress of debugging Gnash-cvs with new FFmpeg, strk, 2008/02/06
- Re: [Gnash-dev] Re: from Hong Yu: partial progress of debugging Gnash-cvs with new FFmpeg, Hong Yu, 2008/02/10
- [Gnash-dev] from Hong Yu: progress of debugging Gnash-cvs (checked-out Feb 12, 2008) with new FFmpeg (VP6 support) for YouTube flash video, Hong Yu, 2008/02/15
- Re: [Gnash-dev] from Hong Yu: progress of debugging Gnash-cvs (checked-out Feb 12, 2008) with new FFmpeg (VP6 support) for YouTube flash video, strk, 2008/02/16
- Message not available
- Message not available
- Message not available
- Re: [Gnash-dev] from Hong Yu: progress of debugging Gnash-cvs (checked-out Feb 12, 2008) with new FFmpeg (VP6 support) for YouTube flash video, strk, 2008/02/20
- Re: [Gnash-dev] from Hong Yu: progress of debugging Gnash-cvs (checked-out Feb 12, 2008) with new FFmpeg (VP6 support) for YouTube flash video,
Hong Yu <=
- [Gnash-dev] inclusion of ffmpeg patch into Gnash 0.8.2 ?, Hong Yu, 2008/02/22
- Re: [Gnash-dev] inclusion of ffmpeg patch into Gnash 0.8.2 ?, Markus Gothe, 2008/02/22
- Re: [Gnash-dev] inclusion of ffmpeg patch into Gnash 0.8.2 ?, Hubert Figuiere, 2008/02/22
- Re: [Gnash-dev] inclusion of ffmpeg patch into Gnash 0.8.2 ?, Markus Gothe, 2008/02/22
- Re: [Gnash-dev] inclusion of ffmpeg patch into Gnash 0.8.2 ?, Bastiaan Jacques, 2008/02/23
- Re: Re: [Gnash-dev] inclusion of ffmpeg patch into Gnash 0.8.2 ?, Markus Gothe, 2008/02/23
- Re: Re: [Gnash-dev] inclusion of ffmpeg patch into Gnash 0.8.2 ?, Bastiaan Jacques, 2008/02/23
- Re: [Gnash-dev] inclusion of ffmpeg patch into Gnash 0.8.2 ?, strk, 2008/02/22
- [Gnash-dev] [COMMITTED] inclusion of ffmpeg patch into Gnash 0.8.2 ?, strk, 2008/02/22
- [Gnash-dev] libmedia/sdl still needed ?, strk, 2008/02/22